├── .codecov.yml ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ ├── FEATURE_REQUEST.md │ ├── TASK.md │ └── config.yml └── workflows │ ├── CI.yml │ ├── CODE_SCANNING.yml │ ├── MERGE_MAIN_TO_DEVELOP.yml │ └── POST_RELEASE.yml ├── .gitignore ├── .stylelintrc ├── LICENSE ├── README.md ├── babel.config.json ├── docs └── project │ └── COMMIT_MESSAGES.md ├── eslint.config.mjs ├── lerna.json ├── package-lock.json ├── package.json ├── packages ├── dmn-js-boxed-expression │ ├── .babelrc │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── css │ │ │ ├── dmn-js-boxed-expression-controls.css │ │ │ └── dmn-js-boxed-expression.css │ ├── karma.conf.js │ ├── package.json │ ├── src │ │ ├── Editor.js │ │ ├── Viewer.js │ │ ├── components │ │ │ └── EditButton.js │ │ ├── core │ │ │ ├── DmnFactory.js │ │ │ ├── ElementRegistry.js │ │ │ └── index.js │ │ ├── features │ │ │ ├── editor-actions │ │ │ │ ├── EditorActions.js │ │ │ │ └── index.js │ │ │ ├── element-logic │ │ │ │ ├── ElementLogic.js │ │ │ │ └── index.js │ │ │ ├── element-properties │ │ │ │ ├── ElementProperties.js │ │ │ │ ├── ElementPropertiesEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── ElementPropertiesComponent.js │ │ │ │ │ └── ElementPropertiesEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── element-variable │ │ │ │ ├── ElementVariable.js │ │ │ │ ├── ElementVariableEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── ElementVariableComponent.js │ │ │ │ │ └── ElementVariableEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── function-definition │ │ │ │ ├── FunctionDefinition.js │ │ │ │ ├── FunctionDefinitionEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── FormalParametersEditor.js │ │ │ │ │ ├── FunctionDefinitionComponent.js │ │ │ │ │ ├── FunctionDefinitionEditorComponent.js │ │ │ │ │ └── KindEditor.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── keyboard │ │ │ │ ├── KeyboardBindings.js │ │ │ │ └── index.js │ │ │ ├── literal-expression │ │ │ │ ├── LiteralExpression.js │ │ │ │ ├── LiteralExpressionEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── LiteralExpressionComponent.js │ │ │ │ │ └── LiteralExpressionEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── modeling │ │ │ │ ├── Modeling.js │ │ │ │ ├── behavior │ │ │ │ │ └── NameChangeBehavior.js │ │ │ │ └── index.js │ │ │ ├── powered-by │ │ │ │ ├── PoweredBy.js │ │ │ │ └── index.js │ │ │ └── view-drd │ │ │ │ ├── ViewDrd.js │ │ │ │ ├── components │ │ │ │ └── ViewDrdComponent.js │ │ │ │ └── index.js │ │ ├── index.js │ │ ├── render │ │ │ ├── TableJsSupport.js │ │ │ ├── ViewRenderer.js │ │ │ └── index.js │ │ └── util │ │ │ └── withChangeSupport.js │ └── test │ │ ├── TestHelper.js │ │ ├── coverageBundle.js │ │ ├── helper │ │ ├── Editor.js │ │ ├── Viewer.js │ │ └── index.js │ │ ├── spec │ │ ├── EditorSpec.js │ │ ├── ViewerSpec.js │ │ ├── bkm-literal-expression.dmn │ │ ├── core │ │ │ └── ElementRegistrySpec.js │ │ ├── empty-literal-expression.dmn │ │ ├── expression-language.dmn │ │ ├── features │ │ │ ├── function-definition │ │ │ │ ├── FunctionDefinitionEditorSpec.js │ │ │ │ └── function-definition.dmn │ │ │ ├── modeling │ │ │ │ ├── ModelingSpec.js │ │ │ │ └── behavior │ │ │ │ │ └── NameChangeBehaviorSpec.js │ │ │ └── view-drd │ │ │ │ ├── MockViewer.js │ │ │ │ └── ViewDrdSpec.js │ │ ├── literal-expression.dmn │ │ └── no-variable.dmn │ │ └── testBundle.js ├── dmn-js-decision-table │ ├── .babelrc │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── css │ │ │ ├── dmn-js-decision-table-controls.css │ │ │ └── dmn-js-decision-table.css │ ├── karma.conf.js │ ├── package.json │ ├── src │ │ ├── Editor.js │ │ ├── Viewer.js │ │ ├── core │ │ │ └── index.js │ │ ├── features │ │ │ ├── add-input-output │ │ │ │ ├── AddInputOutputProvider.js │ │ │ │ ├── components │ │ │ │ │ ├── AddInput.js │ │ │ │ │ └── AddOutput.js │ │ │ │ └── index.js │ │ │ ├── add-rule │ │ │ │ ├── AddRule.js │ │ │ │ ├── components │ │ │ │ │ └── AddRuleFootComponent.js │ │ │ │ └── index.js │ │ │ ├── allowed-values │ │ │ │ ├── AllowedValuesEditingProvider.js │ │ │ │ ├── Utils.js │ │ │ │ ├── behavior │ │ │ │ │ └── AllowedValuesUpdateBehavior.js │ │ │ │ ├── components │ │ │ │ │ └── AllowedValuesEditing.js │ │ │ │ └── index.js │ │ │ ├── annotations │ │ │ │ ├── AnnotationsProvider.js │ │ │ │ ├── components │ │ │ │ │ ├── AnnotationCell.js │ │ │ │ │ └── AnnotationHeader.js │ │ │ │ ├── editor │ │ │ │ │ ├── AnnotationsEditingProvider.js │ │ │ │ │ ├── components │ │ │ │ │ │ └── AnnotationCell.js │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── cell-selection │ │ │ │ ├── CellSelection.js │ │ │ │ ├── CellSelectionUtil.js │ │ │ │ └── index.js │ │ │ ├── column-resize │ │ │ │ ├── ColumnResizeProvider.js │ │ │ │ ├── components │ │ │ │ │ └── ResizeColumn.js │ │ │ │ └── index.js │ │ │ ├── context-menu │ │ │ │ ├── ContextMenu.js │ │ │ │ ├── ContextMenuCloseBehavior.js │ │ │ │ ├── ContextMenuKeyboard.js │ │ │ │ └── index.js │ │ │ ├── copy-cut-paste │ │ │ │ ├── CopyCutPaste.js │ │ │ │ ├── DescriptorUtil.js │ │ │ │ ├── cmd │ │ │ │ │ ├── CutHandler.js │ │ │ │ │ └── PasteHandler.js │ │ │ │ ├── index.js │ │ │ │ └── key-bindings │ │ │ │ │ ├── CopyCutPasteKeyBindings.js │ │ │ │ │ └── index.js │ │ │ ├── create-inputs │ │ │ │ ├── CreateInputsProvider.js │ │ │ │ ├── components │ │ │ │ │ ├── CreateInputCell.js │ │ │ │ │ └── CreateInputHeaderCell.js │ │ │ │ └── index.js │ │ │ ├── decision-rule-indices │ │ │ │ ├── DecisionRuleIndices.js │ │ │ │ ├── components │ │ │ │ │ └── DecisionRuleIndexCellComponent.js │ │ │ │ └── index.js │ │ │ ├── decision-rules │ │ │ │ ├── DecisionRules.js │ │ │ │ ├── DecisionRulesEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── DecisionRulesBodyComponent.js │ │ │ │ │ ├── DecisionRulesCellComponent.js │ │ │ │ │ ├── DecisionRulesCellEditorComponent.js │ │ │ │ │ └── DecisionRulesRowComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── decision-table-head │ │ │ │ ├── DecisionTableHeadProvider.js │ │ │ │ ├── components │ │ │ │ │ └── DecisionTableHead.js │ │ │ │ ├── editor │ │ │ │ │ ├── InputEditingProvider.js │ │ │ │ │ ├── OutputEditingProvider.js │ │ │ │ │ ├── components │ │ │ │ │ │ ├── InputCell.js │ │ │ │ │ │ ├── InputCellContextMenu.js │ │ │ │ │ │ ├── InputEditButton.js │ │ │ │ │ │ ├── InputEditor.js │ │ │ │ │ │ ├── OutputCell.js │ │ │ │ │ │ ├── OutputCellContextMenu.js │ │ │ │ │ │ ├── OutputEditButton.js │ │ │ │ │ │ └── OutputEditor.js │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── decision-table-properties │ │ │ │ ├── DecisionTableProperties.js │ │ │ │ ├── DecisionTablePropertiesEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── DecisionTablePropertiesComponent.js │ │ │ │ │ └── DecisionTablePropertiesEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── description │ │ │ │ ├── Description.js │ │ │ │ ├── components │ │ │ │ │ └── DescriptionEditor.js │ │ │ │ └── index.js │ │ │ ├── drag-and-drop │ │ │ │ ├── DragAndDrop.js │ │ │ │ └── index.js │ │ │ ├── editor-actions │ │ │ │ ├── DecisionTableEditorActions.js │ │ │ │ └── index.js │ │ │ ├── expression-language │ │ │ │ ├── ExpressionLanguage.js │ │ │ │ └── index.js │ │ │ ├── hit-policy │ │ │ │ ├── HitPolicies.js │ │ │ │ ├── HitPolicyProvider.js │ │ │ │ ├── components │ │ │ │ │ └── HitPolicy.js │ │ │ │ ├── editor │ │ │ │ │ ├── HitPolicyEditingProvider.js │ │ │ │ │ ├── components │ │ │ │ │ │ └── EditableHitPolicy.js │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── keyboard │ │ │ │ ├── Keyboard.js │ │ │ │ ├── KeyboardUtil.js │ │ │ │ └── index.js │ │ │ ├── modeling │ │ │ │ ├── DmnFactory.js │ │ │ │ ├── DmnUpdater.js │ │ │ │ ├── ElementFactory.js │ │ │ │ ├── Modeling.js │ │ │ │ ├── behavior │ │ │ │ │ ├── IdClaimBehavior.js │ │ │ │ │ ├── IdUnclaimBehavior.js │ │ │ │ │ └── index.js │ │ │ │ ├── cmd │ │ │ │ │ ├── IdClaimHandler.js │ │ │ │ │ └── UpdateAllowedValuesHandler.js │ │ │ │ └── index.js │ │ │ ├── powered-by │ │ │ │ ├── PoweredBy.js │ │ │ │ └── index.js │ │ │ ├── rules │ │ │ │ ├── DecisionTableModelingRules.js │ │ │ │ └── index.js │ │ │ ├── simple-boolean-edit │ │ │ │ ├── SimpleBooleanEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ └── BooleanEdit.js │ │ │ │ └── index.js │ │ │ ├── simple-date-edit │ │ │ │ ├── SimpleDateEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ ├── InputDateEdit.js │ │ │ │ │ └── OutputDateEdit.js │ │ │ │ └── index.js │ │ │ ├── simple-date-time-edit │ │ │ │ ├── SimpleDateTimeEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ ├── InputDateTimeEdit.js │ │ │ │ │ └── OutputDateTimeEdit.js │ │ │ │ └── index.js │ │ │ ├── simple-duration-edit │ │ │ │ ├── SimpleDurationEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ ├── DurationInput.js │ │ │ │ │ ├── InputDurationEdit.js │ │ │ │ │ └── OutputDurationEdit.js │ │ │ │ └── index.js │ │ │ ├── simple-mode │ │ │ │ ├── SimpleMode.js │ │ │ │ ├── components │ │ │ │ │ └── SimpleModeButtonComponent.js │ │ │ │ └── index.js │ │ │ ├── simple-number-edit │ │ │ │ ├── SimpleNumberEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ ├── InputNumberEdit.js │ │ │ │ │ └── OutputNumberEdit.js │ │ │ │ └── index.js │ │ │ ├── simple-string-edit │ │ │ │ ├── SimpleStringEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ └── SimpleStringEditContextMenuComponent.js │ │ │ │ └── index.js │ │ │ ├── simple-time-edit │ │ │ │ ├── SimpleTimeEdit.js │ │ │ │ ├── Utils.js │ │ │ │ ├── components │ │ │ │ │ ├── InputTimeEdit.js │ │ │ │ │ └── OutputTimeEdit.js │ │ │ │ └── index.js │ │ │ ├── type-ref │ │ │ │ ├── TypeRefEditingProvider.js │ │ │ │ ├── components │ │ │ │ │ └── TypeRefCellContextMenu.js │ │ │ │ └── index.js │ │ │ └── view-drd │ │ │ │ ├── ViewDrd.js │ │ │ │ ├── components │ │ │ │ └── ViewDrdComponent.js │ │ │ │ └── index.js │ │ ├── import │ │ │ ├── Importer.js │ │ │ ├── TableImporter.js │ │ │ ├── TableTreeWalker.js │ │ │ ├── Util.js │ │ │ └── index.js │ │ ├── index.js │ │ └── util │ │ │ └── DomUtil.js │ └── test │ │ ├── TestHelper.js │ │ ├── coverageBundle.js │ │ ├── helper │ │ ├── DecisionTableEditor.js │ │ ├── DecisionTableViewer.js │ │ └── index.js │ │ ├── spec │ │ ├── EditorSpec.js │ │ ├── PerformanceSpec.js │ │ ├── ViewerSpec.js │ │ ├── complex.dmn │ │ ├── expression-language.dmn │ │ ├── features │ │ │ ├── add-input-output │ │ │ │ └── AddInputOutputSpec.js │ │ │ ├── add-rule │ │ │ │ └── AddRuleSpec.js │ │ │ ├── allowed-values │ │ │ │ ├── AllowedValues.dmn │ │ │ │ ├── AllowedValuesEditingSpec.js │ │ │ │ └── UtilsSpec.js │ │ │ ├── annotations │ │ │ │ ├── AnnotationsEditorSpec.js │ │ │ │ └── AnnotationsSpec.js │ │ │ ├── cell-selection │ │ │ │ ├── CellSelectionSpec.js │ │ │ │ └── cell-selection.dmn │ │ │ ├── column-resize │ │ │ │ └── ColumnResizeSpec.js │ │ │ ├── context-menu │ │ │ │ ├── ContextMenuCloseBehaviorSpec.js │ │ │ │ ├── ContextMenuKeyboardSpec.js │ │ │ │ └── ContextMenuSpec.js │ │ │ ├── copy-cut-paste │ │ │ │ ├── CopyCutPasteKeyBindingsSpec.js │ │ │ │ ├── CopyCutPasteSpec.js │ │ │ │ ├── DescriptorUtilSpec.js │ │ │ │ ├── copy-cut-paste-key-bindings.dmn │ │ │ │ └── copy-cut-paste.dmn │ │ │ ├── create-inputs │ │ │ │ ├── CreateInputsSpec.js │ │ │ │ └── no-inputs.dmn │ │ │ ├── decision-rule-indices │ │ │ │ └── DecisionRuleIndicesSpec.js │ │ │ ├── decision-rules │ │ │ │ ├── DecisionRulesEditorSpec.js │ │ │ │ ├── DecisionRulesSpec.js │ │ │ │ └── empty-rule.dmn │ │ │ ├── decision-table-head │ │ │ │ ├── DecisionTableHeadSpec.js │ │ │ │ ├── editor │ │ │ │ │ ├── DecisionTableHeadEditor.dmn │ │ │ │ │ ├── DecisionTableHeadEditorSpec.js │ │ │ │ │ ├── input │ │ │ │ │ │ ├── InputEditor.dmn │ │ │ │ │ │ ├── InputEditorCellSpec.js │ │ │ │ │ │ └── InputEditorSpec.js │ │ │ │ │ └── output │ │ │ │ │ │ ├── OutputEditor.dmn │ │ │ │ │ │ ├── OutputEditorCellSpec.js │ │ │ │ │ │ └── OutputEditorSpec.js │ │ │ │ └── missing-type-ref.dmn │ │ │ ├── decision-table-properties │ │ │ │ ├── DecisionTablePropertiesEditorSpec.js │ │ │ │ └── DecisionTablePropertiesSpec.js │ │ │ ├── description │ │ │ │ ├── DescriptionSpec.js │ │ │ │ └── description.dmn │ │ │ ├── drag-and-drop │ │ │ │ ├── DragAndDropSpec.js │ │ │ │ └── drag-and-drop.dmn │ │ │ ├── editor-actions │ │ │ │ └── EditorActionsSpec.js │ │ │ ├── expression-language │ │ │ │ └── ExpressionLanguageSpec.js │ │ │ ├── hit-policy │ │ │ │ ├── HitPolicyEditingSpec.js │ │ │ │ └── HitPolicySpec.js │ │ │ ├── keyboard │ │ │ │ ├── KeyboardSpec.js │ │ │ │ └── diagram.dmn │ │ │ ├── modeling │ │ │ │ ├── ModelingSpec.js │ │ │ │ ├── UpdatePropertiesSpec.js │ │ │ │ ├── behavior │ │ │ │ │ ├── IdChangeBehaviorSpec.js │ │ │ │ │ ├── IdClaimBehaviorSpec.js │ │ │ │ │ ├── IdUnclaimBehaviorSpec.js │ │ │ │ │ ├── NameChangeBehaviorSpec.js │ │ │ │ │ ├── id-claim-unclaim.dmn │ │ │ │ │ ├── name-change-behavior.dmn │ │ │ │ │ └── two-decision-tables.dmn │ │ │ │ └── modeling.dmn │ │ │ ├── rules │ │ │ │ ├── DecisionTableModelingRulesSpec.js │ │ │ │ └── rules.dmn │ │ │ ├── simple-boolean-edit │ │ │ │ ├── SimpleBooleanEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-boolean-edit.dmn │ │ │ ├── simple-date-edit │ │ │ │ ├── SimpleDateEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-date-edit.dmn │ │ │ ├── simple-date-time-edit │ │ │ │ ├── SimpleDateTimeEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-date-time-edit.dmn │ │ │ ├── simple-duration-edit │ │ │ │ ├── SimpleDurationEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-duration-edit.dmn │ │ │ ├── simple-mode │ │ │ │ ├── FooProvider.js │ │ │ │ ├── SimpleModeSpec.js │ │ │ │ └── simple-mode.dmn │ │ │ ├── simple-number-edit │ │ │ │ ├── SimpleNumberEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-number-edit.dmn │ │ │ ├── simple-string-edit │ │ │ │ ├── SimpleStringEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-string-edit.dmn │ │ │ ├── simple-time-edit │ │ │ │ ├── SimpleTimeEditSpec.js │ │ │ │ ├── UtilsSpec.js │ │ │ │ └── simple-time-edit.dmn │ │ │ ├── type-ref │ │ │ │ ├── TypeRef.dmn │ │ │ │ └── TypeRefEditorCellSpec.js │ │ │ └── view-drd │ │ │ │ ├── MockViewer.js │ │ │ │ └── ViewDrdSpec.js │ │ ├── import │ │ │ ├── ImportSpec.js │ │ │ ├── no-decision-table.dmn │ │ │ ├── no-input.dmn │ │ │ ├── no-output.dmn │ │ │ └── simple.dmn │ │ ├── no-inputs.dmn │ │ ├── one-rule-one-input-one-output.dmn │ │ ├── performance.dmn │ │ ├── simple.dmn │ │ └── two-decisions.dmn │ │ ├── testBundle.js │ │ └── util │ │ └── KeyEvents.js ├── dmn-js-drd │ ├── .babelrc │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── css │ │ │ └── dmn-js-drd.css │ ├── karma.conf.js │ ├── package.json │ ├── src │ │ ├── Modeler.js │ │ ├── NavigatedViewer.js │ │ ├── Viewer.js │ │ ├── core │ │ │ └── index.js │ │ ├── draw │ │ │ ├── DrdRenderer.js │ │ │ ├── PathMap.js │ │ │ ├── TextRenderer.js │ │ │ └── index.js │ │ ├── features │ │ │ ├── auto-place │ │ │ │ ├── DmnAutoPlace.js │ │ │ │ ├── DmnAutoPlaceUtil.js │ │ │ │ └── index.js │ │ │ ├── context-pad │ │ │ │ ├── ContextPadProvider.js │ │ │ │ └── index.js │ │ │ ├── definition-properties │ │ │ │ ├── DefinitionPropertiesEdit.js │ │ │ │ ├── DefinitionPropertiesView.js │ │ │ │ ├── PaletteAdapter.js │ │ │ │ ├── modeler.js │ │ │ │ └── viewer.js │ │ │ ├── distribute-elements │ │ │ │ ├── DrdDistributeElements.js │ │ │ │ └── index.js │ │ │ ├── drill-down │ │ │ │ ├── DrillDown.js │ │ │ │ └── index.js │ │ │ ├── editor-actions │ │ │ │ ├── DrdEditorActions.js │ │ │ │ └── index.js │ │ │ ├── generate-di │ │ │ │ ├── DiGenerator.js │ │ │ │ └── index.js │ │ │ ├── keyboard │ │ │ │ ├── DrdKeyboardBindings.js │ │ │ │ └── index.js │ │ │ ├── label-editing │ │ │ │ ├── LabelEditingProvider.js │ │ │ │ ├── LabelUtil.js │ │ │ │ ├── cmd │ │ │ │ │ └── UpdateLabelHandler.js │ │ │ │ └── index.js │ │ │ ├── modeling │ │ │ │ ├── DrdFactory.js │ │ │ │ ├── DrdLayouter.js │ │ │ │ ├── DrdUpdater.js │ │ │ │ ├── ElementFactory.js │ │ │ │ ├── Modeling.js │ │ │ │ ├── behavior │ │ │ │ │ ├── CreateConnectionBehavior.js │ │ │ │ │ ├── LayoutConnectionBehavior.js │ │ │ │ │ ├── ReplaceConnectionBehavior.js │ │ │ │ │ ├── ReplaceElementBehavior.js │ │ │ │ │ └── index.js │ │ │ │ ├── cmd │ │ │ │ │ ├── IdClaimHandler.js │ │ │ │ │ ├── UpdateModdlePropertiesHandler.js │ │ │ │ │ └── UpdatePropertiesHandler.js │ │ │ │ └── index.js │ │ │ ├── outline │ │ │ │ ├── OutlineProvider.js │ │ │ │ ├── OutlineUtil.js │ │ │ │ └── index.js │ │ │ ├── palette │ │ │ │ ├── PaletteProvider.js │ │ │ │ └── index.js │ │ │ ├── popup-menu │ │ │ │ ├── ReplaceMenuProvider.js │ │ │ │ └── index.js │ │ │ ├── replace │ │ │ │ ├── DrdReplace.js │ │ │ │ ├── ReplaceOptions.js │ │ │ │ └── index.js │ │ │ ├── rules │ │ │ │ ├── DrdRules.js │ │ │ │ └── index.js │ │ │ ├── search │ │ │ │ ├── DmnSearchProvider.js │ │ │ │ └── index.js │ │ │ └── snapping │ │ │ │ ├── DrdBendpointSnapping.js │ │ │ │ ├── DrdConnectSnapping.js │ │ │ │ └── index.js │ │ ├── import │ │ │ ├── DrdImporter.js │ │ │ ├── DrdTreeWalker.js │ │ │ ├── Importer.js │ │ │ └── index.js │ │ └── index.js │ └── test │ │ ├── TestHelper.js │ │ ├── coverageBundle.js │ │ ├── fixtures │ │ └── dmn │ │ │ ├── boolean.dmn │ │ │ ├── business-knowledge.dmn │ │ │ ├── connections-lost.dmn │ │ │ ├── connections.dmn │ │ │ ├── date.dmn │ │ │ ├── di-1-3.dmn │ │ │ ├── di.dmn │ │ │ ├── double-di.dmn │ │ │ ├── empty-decision-id.dmn │ │ │ ├── empty-definitions.dmn │ │ │ ├── input-data.dmn │ │ │ ├── knowledge-source.dmn │ │ │ ├── large.dmn │ │ │ ├── literal-expression.dmn │ │ │ ├── multiple-decisions.dmn │ │ │ ├── multiple-tables.dmn │ │ │ ├── namespace.dmn │ │ │ ├── new-table.dmn │ │ │ ├── no-decision-id.dmn │ │ │ ├── no-di.dmn │ │ │ ├── no-rules.dmn │ │ │ ├── one-decision.dmn │ │ │ ├── one-input.dmn │ │ │ ├── one-literal-expr.dmn │ │ │ ├── one-output.dmn │ │ │ ├── reconnect.dmn │ │ │ ├── simple-1-3.dmn │ │ │ ├── simple-connections.dmn │ │ │ ├── simple.dmn │ │ │ └── text-annotation.dmn │ │ ├── helper │ │ ├── DrdModeler.js │ │ ├── DrdViewer.js │ │ └── index.js │ │ ├── spec │ │ ├── ModelerSpec.js │ │ ├── ViewerSpec.js │ │ ├── draw │ │ │ └── DrdRendererSpec.js │ │ ├── features │ │ │ ├── auto-place │ │ │ │ ├── DmnAutoPlace.dmn │ │ │ │ └── DmnAutoPlaceSpec.js │ │ │ ├── connection-preview │ │ │ │ ├── ConnectionPreview.dmn │ │ │ │ └── ConnectionPreviewSpec.js │ │ │ ├── context-pad │ │ │ │ ├── ContextPad.dmn │ │ │ │ └── ContextPadProviderSpec.js │ │ │ ├── definition-properties │ │ │ │ ├── DefinitionPropertiesSpec.js │ │ │ │ └── definitionProperties.dmn │ │ │ ├── distribute-elements │ │ │ │ ├── DrdDistributeElements.dmn │ │ │ │ └── DrdDistributeElementsSpec.js │ │ │ ├── drill-down │ │ │ │ ├── DrillDown.dmn │ │ │ │ └── DrillDownSpec.js │ │ │ ├── editor-actions │ │ │ │ ├── DrdEditorActions.dmn │ │ │ │ └── DrdEditorActionsSpec.js │ │ │ ├── generate-di │ │ │ │ └── DiGeneratorSpec.js │ │ │ ├── keyboard │ │ │ │ └── DrdKeyboardBindingsSpec.js │ │ │ ├── label-editing │ │ │ │ └── LabelEditingProviderSpec.js │ │ │ ├── modeling │ │ │ │ ├── CreateConnectionSpec.js │ │ │ │ ├── DeleteConnectionSpec.js │ │ │ │ ├── DeleteElementSpec.js │ │ │ │ ├── DrdFactorySpec.js │ │ │ │ ├── DrdUpdaterSpec.js │ │ │ │ ├── ElementFactory.dmn │ │ │ │ ├── ElementFactorySpec.js │ │ │ │ ├── LayoutConnection.dmn │ │ │ │ ├── LayoutConnectionSpec.js │ │ │ │ ├── MoveElementsSpec.js │ │ │ │ ├── MoveShapeSpec.js │ │ │ │ ├── UpdateModdleProperties.dmn │ │ │ │ ├── UpdateModdlePropertiesSpec.js │ │ │ │ ├── behavior │ │ │ │ │ ├── CreateConnectionBehaviorSpec.js │ │ │ │ │ ├── IdChangeBehaviorSpec.js │ │ │ │ │ ├── LayoutConnectionBehaviorSpec.js │ │ │ │ │ ├── NameChangeBehaviorSpec.js │ │ │ │ │ ├── ReplaceConnectionBehaviorSpec.js │ │ │ │ │ ├── ReplaceElementBehaviorSpec.js │ │ │ │ │ ├── create-connection-behavior.dmn │ │ │ │ │ ├── layout-connection-behavior.dmn │ │ │ │ │ ├── name-change-behavior.dmn │ │ │ │ │ ├── replace-connection-behavior.dmn │ │ │ │ │ └── replace-element-behavior.dmn │ │ │ │ └── drd-updater.dmn │ │ │ ├── outline │ │ │ │ ├── OutlineProvider.dmn │ │ │ │ └── OutlineProviderSpec.js │ │ │ ├── palette │ │ │ │ └── PaletteProviderSpec.js │ │ │ ├── popup-menu │ │ │ │ ├── ReplaceMenuProviderSpec.js │ │ │ │ └── replaceMenu.dmn │ │ │ ├── replace │ │ │ │ ├── DrdReplaceSpec.js │ │ │ │ ├── replace.dmn │ │ │ │ └── textAnnotation.dmn │ │ │ ├── rules │ │ │ │ ├── DrdRules.grouped.dmn │ │ │ │ ├── DrdRulesSpec.js │ │ │ │ └── drd-rules.dmn │ │ │ ├── search │ │ │ │ ├── DmnSearchProviderSpec.js │ │ │ │ └── dmn-search.dmn │ │ │ └── snapping │ │ │ │ ├── DrdBendpointSnapping.dmn │ │ │ │ ├── DrdBendpointSnappingSpec.js │ │ │ │ ├── DrdConnectSnapping.dmn │ │ │ │ └── DrdConnectSnappingSpec.js │ │ └── import │ │ │ ├── DrdTreeWalkerSpec.js │ │ │ └── ImportSpec.js │ │ ├── testBundle.js │ │ └── util │ │ ├── ElementsUtil.js │ │ ├── EventUtils.js │ │ ├── KeyEvents.js │ │ ├── MockEvents.js │ │ └── custom-rules │ │ ├── CustomRules.js │ │ └── index.js ├── dmn-js-literal-expression │ ├── .babelrc │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── css │ │ │ └── dmn-js-literal-expression.css │ ├── karma.conf.js │ ├── package.json │ ├── src │ │ ├── Editor.js │ │ ├── Viewer.js │ │ ├── core │ │ │ ├── ElementRegistry.js │ │ │ └── index.js │ │ ├── features │ │ │ ├── decision-properties │ │ │ │ ├── DecisionProperties.js │ │ │ │ ├── DecisionPropertiesEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── DecisionPropertiesComponent.js │ │ │ │ │ └── DecisionPropertiesEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── editor-actions │ │ │ │ ├── EditorActions.js │ │ │ │ └── index.js │ │ │ ├── keyboard │ │ │ │ ├── Keyboard.js │ │ │ │ ├── KeyboardUtil.js │ │ │ │ └── index.js │ │ │ ├── literal-expression-properties │ │ │ │ ├── LiteralExpressionProperties.js │ │ │ │ ├── LiteralExpressionPropertiesEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── LiteralExpressionPropertiesComponent.js │ │ │ │ │ └── LiteralExpressionPropertiesEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ ├── modeling │ │ │ │ ├── Modeling.js │ │ │ │ └── index.js │ │ │ ├── powered-by │ │ │ │ ├── PoweredBy.js │ │ │ │ └── index.js │ │ │ ├── textarea │ │ │ │ ├── Textarea.js │ │ │ │ ├── TextareaEditor.js │ │ │ │ ├── components │ │ │ │ │ ├── TextareaComponent.js │ │ │ │ │ └── TextareaEditorComponent.js │ │ │ │ ├── editor.js │ │ │ │ └── index.js │ │ │ └── view-drd │ │ │ │ ├── ViewDrd.js │ │ │ │ ├── components │ │ │ │ └── ViewDrdComponent.js │ │ │ │ └── index.js │ │ └── index.js │ └── test │ │ ├── TestHelper.js │ │ ├── coverageBundle.js │ │ ├── helper │ │ ├── LiteralExpressionEditor.js │ │ ├── LiteralExpressionViewer.js │ │ └── index.js │ │ ├── spec │ │ ├── EditorSpec.js │ │ ├── ViewerSpec.js │ │ ├── core │ │ │ └── ElementRegistrySpec.js │ │ ├── empty-literal-expression.dmn │ │ ├── expression-language.dmn │ │ ├── features │ │ │ ├── decision-properties │ │ │ │ ├── DecisionPropertiesEditorSpec.js │ │ │ │ └── DecisionPropertiesSpec.js │ │ │ ├── literal-expression-properties │ │ │ │ ├── LiteralExpressionEditorProperties.no-type-ref.dmn │ │ │ │ ├── LiteralExpressionEditorPropertiesSpec.js │ │ │ │ └── LiteralExpressionPropertiesSpec.js │ │ │ ├── modeling │ │ │ │ ├── ModelingSpec.js │ │ │ │ └── behavior │ │ │ │ │ └── NameChangeBehaviorSpec.js │ │ │ ├── textarea │ │ │ │ ├── TextareaEditorSpec.js │ │ │ │ └── TextareaSpec.js │ │ │ └── view-drd │ │ │ │ ├── MockViewer.js │ │ │ │ └── ViewDrdSpec.js │ │ └── literal-expression.dmn │ │ └── testBundle.js ├── dmn-js-shared │ ├── .babelrc │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── assets │ │ └── css │ │ │ └── dmn-js-shared.css │ ├── karma.base.js │ ├── karma.conf.js │ ├── package.json │ ├── src │ │ ├── base │ │ │ ├── EditingManager.js │ │ │ ├── Manager.js │ │ │ ├── View.js │ │ │ └── viewer │ │ │ │ ├── Viewer.js │ │ │ │ └── core │ │ │ │ ├── ChangeSupport.js │ │ │ │ ├── Components.js │ │ │ │ ├── Renderer.js │ │ │ │ ├── components │ │ │ │ └── ViewerComponent.js │ │ │ │ └── index.js │ │ ├── components │ │ │ ├── Button.js │ │ │ ├── ContentEditable.js │ │ │ ├── EditableComponent.js │ │ │ ├── Input.js │ │ │ ├── InputSelect.js │ │ │ ├── List.js │ │ │ ├── LiteralExpression.js │ │ │ ├── Select.js │ │ │ ├── ValidatedInput.js │ │ │ └── mixins │ │ │ │ ├── ComponentWithSlots.js │ │ │ │ └── index.js │ │ ├── features │ │ │ ├── data-types │ │ │ │ ├── DataTypes.js │ │ │ │ └── index.js │ │ │ ├── debounce-input │ │ │ │ ├── debounceInput.js │ │ │ │ └── index.js │ │ │ ├── expression-languages │ │ │ │ ├── ExpressionLanguages.js │ │ │ │ └── index.js │ │ │ └── modeling │ │ │ │ ├── behavior │ │ │ │ ├── IdChangeBehavior.js │ │ │ │ └── NameChangeBehavior.js │ │ │ │ └── cmd │ │ │ │ └── UpdatePropertiesHandler.js │ │ └── util │ │ │ ├── CompatibilityUtils.js │ │ │ ├── DiUtil.js │ │ │ ├── IdsUtil.js │ │ │ ├── ModelUtil.js │ │ │ └── PoweredByUtil.js │ └── test │ │ ├── coverageBundle.js │ │ ├── spec │ │ ├── base │ │ │ ├── EditingManagerSpec.js │ │ │ ├── ManagerSpec.js │ │ │ ├── TestView.js │ │ │ ├── diagram.dmn │ │ │ ├── dmn-11.dmn │ │ │ ├── dmn-12.dmn │ │ │ ├── drd-only.dmn │ │ │ ├── one-decision.dmn │ │ │ └── viewer │ │ │ │ ├── TestHelper.js │ │ │ │ ├── ViewerSpec.js │ │ │ │ └── core │ │ │ │ ├── ChangeSupportSpec.js │ │ │ │ ├── ComponentsSpec.js │ │ │ │ ├── RendererSpec.js │ │ │ │ └── components │ │ │ │ └── ViewerComponentSpec.js │ │ ├── components │ │ │ ├── ContentEditableSpec.js │ │ │ ├── DiContainer.js │ │ │ ├── EditableComponentSpec.js │ │ │ ├── InputSelectSpec.js │ │ │ ├── InputSpec.js │ │ │ ├── ListSpec.js │ │ │ ├── LiteralExpressionSpec.js │ │ │ ├── SelectSpec.js │ │ │ └── ValidatedInputSpec.js │ │ ├── features │ │ │ ├── data-types │ │ │ │ └── DataTypesSpec.js │ │ │ └── expression-languages │ │ │ │ └── ExpressionLanguagesSpec.js │ │ └── util │ │ │ └── ModelUtilSpec.js │ │ ├── testBundle.js │ │ └── util │ │ ├── EditorUtil.js │ │ ├── EventUtil.js │ │ ├── InjectorUtil.js │ │ └── TranslateUtil.js └── dmn-js │ ├── .babelrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── karma.conf.js │ ├── package.json │ ├── resources │ ├── banner-min.txt │ └── banner.txt │ ├── rollup.config.js │ ├── src │ ├── Modeler.js │ ├── NavigatedViewer.js │ ├── Viewer.js │ └── index.js │ ├── tasks │ ├── build-distro.mjs │ └── test-distro.mjs │ └── test │ ├── coverageBundle.js │ ├── distro │ ├── diagram.dmn │ ├── dmn-modeler.js │ ├── dmn-navigated-viewer.js │ ├── dmn-viewer.js │ ├── helper.js │ └── karma.conf.js │ ├── helper │ └── index.js │ ├── spec │ ├── ModelerSpec.js │ ├── NavigatedViewerSpec.js │ ├── TabbingSpec.js │ ├── ViewerSpec.js │ ├── diagram.dmn │ ├── dmn-11.dmn │ ├── drd-only.dmn │ ├── no-di.dmn │ ├── no-displayable-contents.dmn │ └── performance.dmn │ └── testBundle.js ├── renovate.json ├── resources └── logo.svg └── tasks └── stages ├── await-published ├── update-demo ├── update-examples └── update-website /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | 3 | parsers: 4 | javascript: 5 | enable_partials: yes 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a problem and help us fix it. 4 | labels: "bug" 5 | --- 6 | 7 | 8 | ### Describe the Bug 9 | 10 | A clear and concise description of what the bug is. 11 | 12 | 13 | ### Steps to Reproduce 14 | 15 | Steps to reproduce the behavior: 16 | 17 | 1. do this 18 | 2. do that 19 | 20 | If you report a modeling related issue, ensure you can reproduce it on [demo.bpmn.io](https://demo.bpmn.io/dmn/new) 21 | 22 | When reporting a library error, try to build an example that reproduces your problem. You can use our playgrounds for [viewer](https://jsfiddle.net/x2doq4vn/) or [modeler](https://jsfiddle.net/nrko5hyt/) as a starting point or put a demo up on [GitHub](https://github.com/) for inspection. 23 | 24 | 25 | ### Expected Behavior 26 | 27 | A clear and concise description of what you expected to happen. 28 | 29 | 30 | ### Environment 31 | 32 | Please complete the following information: 33 | 34 | - Browser: [e.g. IE 11, Chrome 69] 35 | - OS: [e.g. Windows 7] 36 | - Library version: [e.g. 2.0.0] 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or general improvement. 4 | labels: "enhancement" 5 | --- 6 | 7 | 8 | ### Is your feature request related to a problem? Please describe. 9 | 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | 13 | ### Describe the solution you'd like 14 | 15 | A clear and concise description of what you want to happen. 16 | 17 | 18 | ### Describe alternatives you've considered 19 | 20 | A clear and concise description of any alternative solutions or features you've considered. 21 | 22 | 23 | ### Additional context 24 | 25 | Add any other context or screenshots about the feature request here. 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/TASK.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Task 3 | about: Describe a generic activity we should carry out. 4 | --- 5 | 6 | 7 | ### What should we do? 8 | 9 | 10 | 11 | 12 | ### Why should we do it? 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://forum.bpmn.io 5 | about: Head over to our community forum to ask questions and get answers. -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [ push, pull_request ] 3 | jobs: 4 | build: 5 | 6 | strategy: 7 | matrix: 8 | os: [ ubuntu-latest ] 9 | node-version: [ 20 ] 10 | 11 | runs-on: ${{ matrix.os }} 12 | 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | - name: Use Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | cache: 'npm' 21 | - name: Install dependencies 22 | run: npm ci 23 | - name: Project setup 24 | uses: bpmn-io/actions/setup@latest 25 | - name: Build 26 | if: runner.os == 'Linux' 27 | env: 28 | COVERAGE: 1 29 | TEST_BROWSERS: Firefox,ChromeHeadless 30 | run: xvfb-run npm run ci 31 | - name: Build 32 | if: runner.os != 'Linux' 33 | env: 34 | TEST_BROWSERS: ChromeHeadless 35 | run: npm run ci 36 | - name: Upload Coverage 37 | uses: codecov/codecov-action@v5 38 | if: runner.os == 'Linux' 39 | with: 40 | fail_ci_if_error: true 41 | token: ${{ secrets.CODECOV_TOKEN }} 42 | -------------------------------------------------------------------------------- /.github/workflows/CODE_SCANNING.yml: -------------------------------------------------------------------------------- 1 | name: "Code Scanning" 2 | 3 | on: 4 | push: 5 | branches: [ main, develop ] 6 | pull_request: 7 | branches: [ main, develop ] 8 | paths-ignore: 9 | - '**/*.md' 10 | 11 | jobs: 12 | codeql_build: 13 | # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest 14 | runs-on: ubuntu-latest 15 | 16 | permissions: 17 | # required for all workflows 18 | security-events: write 19 | 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | # Initializes the CodeQL tools for scanning. 25 | - name: Initialize CodeQL 26 | uses: github/codeql-action/init@v3 27 | with: 28 | languages: javascript 29 | config: | 30 | paths-ignore: 31 | - '**/test' 32 | 33 | - name: Perform CodeQL Analysis 34 | uses: github/codeql-action/analyze@v3 35 | -------------------------------------------------------------------------------- /.github/workflows/MERGE_MAIN_TO_DEVELOP.yml: -------------------------------------------------------------------------------- 1 | name: MERGE_MAIN_TO_DEVELOP 2 | on: 3 | push: 4 | branches: 5 | - "main" 6 | 7 | jobs: 8 | merge_main_to_develop: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: write 12 | 13 | steps: 14 | - name: Checkout develop 15 | uses: actions/checkout@v4 16 | with: 17 | ref: develop 18 | fetch-depth: 0 19 | - name: Merge main to develop and push 20 | run: | 21 | git config user.name github-actions 22 | git config user.email github-actions@github.com 23 | git merge -m 'chore: merge main to develop' --no-edit origin/main 24 | git push 25 | 26 | - name: Notify failure on Slack 27 | if: failure() 28 | uses: slackapi/slack-github-action@v2 29 | with: 30 | method: chat.postMessage 31 | token: ${{ secrets.SLACK_BOT_TOKEN }} 32 | payload: | 33 | channel: ${{ secrets.SLACK_CHANNEL_ID }} 34 | text: "Automatic merge of to failed." 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | lerna-debug.log 4 | npm-debug.log 5 | .idea 6 | *.iml 7 | .DS_Store 8 | coverage -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "stylelint-config-standard", 3 | "rules": { 4 | "hue-degree-notation": "number" 5 | }, 6 | "ignoreFiles": [ 7 | "**/coverage/**/*.css", 8 | "**/dist/**/*.css" 9 | ] 10 | } -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "@babel/preset-env", { 5 | "modules": false, 6 | "targets": { 7 | "browsers": [ 8 | "last 1 safari version", 9 | "last 1 chrome version", 10 | "last 1 firefox version", 11 | "last 1 edge version" 12 | ] 13 | } 14 | } 15 | ] 16 | ] 17 | } -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "node_modules/lerna/schemas/lerna-schema.json", 3 | "version": "17.2.1" 4 | } -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json", 3 | "plugins": [ 4 | "inferno" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/README.md: -------------------------------------------------------------------------------- 1 | # dmn-js-boxed-expression 2 | 3 | A boxed expression viewer and editor for [dmn-js](https://github.com/bpmn-io/dmn-js). 4 | 5 | 6 | ## License 7 | 8 | Use under the terms of the [bpmn.io license](http://bpmn.io/license). -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('dmn-js-shared/karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/src/components/EditButton.js: -------------------------------------------------------------------------------- 1 | export function EditButton({ label, onClick }) { 2 | return 28 | 29 | ); 30 | } 31 | 32 | } 33 | 34 | ViewDrdComponent.$inject = [ 'translate' ]; 35 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/src/features/view-drd/index.js: -------------------------------------------------------------------------------- 1 | import ViewDrd from './ViewDrd'; 2 | 3 | export default { 4 | __init__: [ 'viewDrd' ], 5 | viewDrd: [ 'type', ViewDrd ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/src/index.js: -------------------------------------------------------------------------------- 1 | export { Viewer } from './Viewer'; 2 | export { Editor } from './Editor'; 3 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/src/render/TableJsSupport.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Allows to use modules from `table-js` which depend on `table.*` components. 3 | * @TODO(barmac): This is a temporary solution until we move context menu out of table-js. 4 | */ 5 | export class TableJsSupport { 6 | static $inject = [ 'components' ]; 7 | 8 | constructor(components) { 9 | components.onGetComponent('viewer', () => { 10 | const children = components.getComponents('table.before') || []; 11 | 12 | return () => { 13 | return ( 14 |
15 | { children.map((Component, index) => ) } 16 |
17 | ); 18 | }; 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/src/render/index.js: -------------------------------------------------------------------------------- 1 | import { ViewRenderer } from './ViewRenderer'; 2 | import { TableJsSupport } from './TableJsSupport'; 3 | 4 | export default { 5 | __init__: [ 'viewRenderer', 'tableJsSupport' ], 6 | 'viewRenderer': [ 'type', ViewRenderer ], 7 | 'tableJsSupport': [ 'type', TableJsSupport ] 8 | }; 9 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/TestHelper.js: -------------------------------------------------------------------------------- 1 | import { 2 | insertCSS 3 | } from './helper'; 4 | 5 | export * from './helper'; 6 | 7 | insertCSS('dmn-font.css', 8 | require('dmn-font/dist/css/dmn-embedded.css') 9 | ); 10 | 11 | insertCSS('dmn-js-shared.css', 12 | require('dmn-js-shared/assets/css/dmn-js-shared.css') 13 | ); 14 | 15 | insertCSS('dmn-js-boxed-expression.css', 16 | require('../assets/css/dmn-js-boxed-expression.css') 17 | ); 18 | 19 | insertCSS('dmn-js-boxed-expression-controls.css', 20 | require('../assets/css/dmn-js-boxed-expression-controls.css') 21 | ); 22 | 23 | insertCSS('dmn-js-testing.css', 24 | '.test-container .dmn-js-parent { height: 500px; }' 25 | ); -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | const allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/helper/Editor.js: -------------------------------------------------------------------------------- 1 | import EditingManager from 'dmn-js-shared/lib/base/EditingManager'; 2 | import { isAny } from 'dmn-js-shared/lib/util/ModelUtil'; 3 | 4 | import { Editor } from 'src'; 5 | 6 | 7 | export default class LiteralExpressionEditor extends EditingManager { 8 | 9 | _getViewProviders() { 10 | 11 | return [ 12 | { 13 | id: 'literalExpression', 14 | constructor: Editor, 15 | opens(element) { 16 | return isAny(element, [ 'dmn:Decision', 'dmn:BusinessKnowledgeModel' ]); 17 | } 18 | } 19 | ]; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/helper/Viewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | import { isAny } from 'dmn-js-shared/lib/util/ModelUtil'; 3 | 4 | import { Viewer } from 'src'; 5 | 6 | 7 | export default class LiteralExpressionViewer extends Manager { 8 | 9 | _getViewProviders() { 10 | 11 | return [ 12 | { 13 | id: 'literalExpression', 14 | constructor: Viewer, 15 | opens(element) { 16 | return isAny(element, [ 'dmn:Decision', 'dmn:BusinessKnowledgeModel' ]); 17 | } 18 | } 19 | ]; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/spec/bkm-literal-expression.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | calendar.getSeason(date) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/spec/empty-literal-expression.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/spec/expression-language.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | calendar.getSeason(date) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/spec/features/function-definition/function-definition.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | calendar.getSeason(date) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/spec/features/view-drd/MockViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | import View from 'dmn-js-shared/lib/base/View'; 3 | 4 | import { Viewer } from 'src'; 5 | 6 | 7 | export default class MockViewer extends Manager { 8 | 9 | _getViewProviders() { 10 | 11 | return [ { 12 | id: 'literalExpression', 13 | constructor: Viewer, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:LiteralExpression' 19 | ); 20 | } 21 | }, { 22 | id: 'drd', 23 | constructor: View, 24 | opens: 'dmn:Definitions' 25 | } ]; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /packages/dmn-js-boxed-expression/test/testBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json", 3 | "plugins": [ 4 | "inferno" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/README.md: -------------------------------------------------------------------------------- 1 | # dmn-js-decision-table 2 | 3 | A decision table viewer and editor for [dmn-js](https://github.com/bpmn-io/dmn-js). 4 | 5 | 6 | ## License 7 | 8 | Use under the terms of the [bpmn.io license](http://bpmn.io/license). -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('dmn-js-shared/karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dmn-js-decision-table", 3 | "description": "A decision table view for dmn-js", 4 | "version": "17.2.1", 5 | "files": [ 6 | "assets", 7 | "lib" 8 | ], 9 | "scripts": { 10 | "test": "karma start", 11 | "build": "del-cli lib && babel -s --quiet -d lib src", 12 | "dev": "npm test -- --no-single-run --auto-watch", 13 | "prepublishOnly": "npm run build" 14 | }, 15 | "main": "./lib/index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/bpmn-io/dmn-js", 19 | "directory": "packages/dmn-js-decision-table" 20 | }, 21 | "license": "SEE LICENSE IN LICENSE", 22 | "keywords": [ 23 | "dmn", 24 | "dmn-js", 25 | "dmn-js-view", 26 | "decision table" 27 | ], 28 | "devDependencies": { 29 | "dmn-font": "^0.6.2", 30 | "inferno-test-utils": "~5.6.2" 31 | }, 32 | "dependencies": { 33 | "@bpmn-io/dmn-variable-resolver": "^0.7.0", 34 | "css.escape": "^1.5.1", 35 | "diagram-js": "^15.2.0", 36 | "dmn-js-shared": "^17.2.1", 37 | "escape-html": "^1.0.3", 38 | "inferno": "~5.6.3", 39 | "min-dash": "^4.2.2", 40 | "min-dom": "^4.2.1", 41 | "selection-ranges": "^3.0.2", 42 | "table-js": "^9.2.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/core/index.js: -------------------------------------------------------------------------------- 1 | import importModule from '../import'; 2 | import renderModule from 'table-js/lib/render'; 3 | 4 | export default { 5 | __depends__: [ 6 | importModule, 7 | renderModule 8 | ] 9 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/add-input-output/AddInputOutputProvider.js: -------------------------------------------------------------------------------- 1 | import AddInput from './components/AddInput'; 2 | import AddOutput from './components/AddOutput'; 3 | 4 | 5 | export default function AddInputOutputProvider( 6 | components, editorActions, eventBus 7 | ) { 8 | 9 | components.onGetComponent('cell-inner', (context = {}) => { 10 | const { cellType, index, inputsLength, outputsLength } = context; 11 | 12 | if (cellType === 'input-cell' && index === inputsLength - 1) { 13 | return AddInput; 14 | } 15 | 16 | if (cellType === 'output-cell' && index === outputsLength - 1) { 17 | return AddOutput; 18 | } 19 | }); 20 | 21 | eventBus.on('addInput', () => { 22 | editorActions.trigger('addInput'); 23 | }); 24 | 25 | eventBus.on('addOutput', () => { 26 | editorActions.trigger('addOutput'); 27 | }); 28 | } 29 | 30 | AddInputOutputProvider.$inject = [ 31 | 'components', 32 | 'editorActions', 33 | 'eventBus' 34 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/add-input-output/index.js: -------------------------------------------------------------------------------- 1 | import AddInputOutputProvider from './AddInputOutputProvider'; 2 | import EditorActions from '../editor-actions'; 3 | 4 | export default { 5 | __depends__: [ EditorActions ], 6 | __init__: [ 7 | 'addInputOutputProvider' 8 | ], 9 | addInputOutputProvider: [ 'type', AddInputOutputProvider ] 10 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/add-rule/AddRule.js: -------------------------------------------------------------------------------- 1 | import AddRuleFootComponent from './components/AddRuleFootComponent'; 2 | 3 | export default class AddRule { 4 | constructor(components, editorActions, eventBus, selection) { 5 | components.onGetComponent('table.foot', () => AddRuleFootComponent); 6 | 7 | eventBus.on('addRule', (e, context) => { 8 | const rule = editorActions.trigger('addRule'); 9 | const colIndex = context.colIndex; 10 | 11 | if (rule.cells[colIndex]) { 12 | selection.select(rule.cells[colIndex]); 13 | } else { 14 | selection.select(rule.cells[0]); 15 | } 16 | }); 17 | } 18 | } 19 | 20 | AddRule.$inject = [ 'components', 'editorActions', 'eventBus', 'selection' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/add-rule/index.js: -------------------------------------------------------------------------------- 1 | import AddRule from './AddRule'; 2 | import EditorActions from '../editor-actions'; 3 | 4 | export default { 5 | __depends__: [ EditorActions ], 6 | __init__: [ 'addRule' ], 7 | addRule: [ 'type', AddRule ] 8 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/allowed-values/AllowedValuesEditingProvider.js: -------------------------------------------------------------------------------- 1 | import AllowedValuesEditing from './components/AllowedValuesEditing'; 2 | 3 | const LOW_PRIORITY = 500; 4 | 5 | 6 | export default class InputOutputValues { 7 | constructor(components) { 8 | components.onGetComponent('context-menu', LOW_PRIORITY, (context = {}) => { 9 | const { contextMenuType } = context; 10 | 11 | if (contextMenuType === 'input-edit' || contextMenuType === 'output-edit') { 12 | return AllowedValuesEditing; 13 | } 14 | }); 15 | } 16 | } 17 | 18 | InputOutputValues.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/allowed-values/Utils.js: -------------------------------------------------------------------------------- 1 | export function parseString(string) { 2 | 3 | // empty string or no string at all 4 | if (!string || isEmptyString(string.trim())) { 5 | return { 6 | values: [] 7 | }; 8 | } 9 | 10 | // disjunction 11 | let values = string.split(','); 12 | 13 | const result = { 14 | values: [] 15 | }; 16 | 17 | let openString = ''; 18 | 19 | values.forEach(value => { 20 | openString += value; 21 | 22 | if (/^"[^"]*"$/.test(openString.trim())) { 23 | result.values.push(openString.trim()); 24 | 25 | openString = ''; 26 | } else { 27 | openString += ','; 28 | } 29 | }); 30 | 31 | if (!openString) { 32 | return result; 33 | } 34 | } 35 | 36 | function isEmptyString(string) { 37 | return string === ''; 38 | } 39 | 40 | export function getValuesArray(values) { 41 | return values.map(value => value.value); 42 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/allowed-values/behavior/AllowedValuesUpdateBehavior.js: -------------------------------------------------------------------------------- 1 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 2 | 3 | import { is, isInput } from 'dmn-js-shared/lib/util/ModelUtil'; 4 | 5 | /** 6 | * Makes sure allowed values are removed if type is set to 7 | * something other than string. 8 | */ 9 | export default class AllowedValuesUpdateBehavior extends CommandInterceptor { 10 | 11 | constructor(eventBus, modeling) { 12 | super(eventBus); 13 | 14 | this.postExecuted('element.updateProperties', event => { 15 | const { 16 | element, 17 | properties 18 | } = event.context; 19 | 20 | const actualProperties = isInput(element) ? properties.inputExpression : properties; 21 | 22 | if (actualProperties 23 | && actualProperties.typeRef 24 | && actualProperties.typeRef !== 'string') { 25 | 26 | const target = ( 27 | is(element, 'dmn:LiteralExpression') ? 28 | element.$parent : 29 | element 30 | ); 31 | 32 | // delete allowed values 33 | modeling.editAllowedValues(target, null); 34 | } 35 | }); 36 | } 37 | } 38 | 39 | AllowedValuesUpdateBehavior.$inject = [ 40 | 'eventBus', 41 | 'modeling' 42 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/allowed-values/index.js: -------------------------------------------------------------------------------- 1 | import AllowedValuesUpdateBehavior from './behavior/AllowedValuesUpdateBehavior'; 2 | import AllowedValuesEditingProvider from './AllowedValuesEditingProvider'; 3 | 4 | export default { 5 | __init__: [ 6 | 'allowedValuesUpdateBehavior', 7 | 'allowedValuesEditingProvider', 8 | ], 9 | allowedValuesUpdateBehavior: [ 'type', AllowedValuesUpdateBehavior ], 10 | allowedValuesEditingProvider: [ 'type', AllowedValuesEditingProvider ] 11 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/annotations/AnnotationsProvider.js: -------------------------------------------------------------------------------- 1 | import AnnotationHeader from './components/AnnotationHeader'; 2 | import AnnotationCell from './components/AnnotationCell'; 3 | 4 | 5 | export default function AnnotationsProvider(components) { 6 | 7 | components.onGetComponent('cell', ({ cellType }) => { 8 | 9 | if (cellType === 'after-label-cells') { 10 | return AnnotationHeader; 11 | } else if (cellType === 'after-rule-cells') { 12 | return AnnotationCell; 13 | } 14 | }); 15 | } 16 | 17 | AnnotationsProvider.$inject = [ 'components' ]; 18 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/annotations/components/AnnotationCell.js: -------------------------------------------------------------------------------- 1 | import { 2 | Cell 3 | } from 'table-js/lib/components'; 4 | 5 | 6 | export default function AnnotationCell(props) { 7 | const { row } = props; 8 | 9 | const { 10 | id, 11 | description 12 | } = row.businessObject; 13 | 14 | return ( 15 | 16 | { description || '-' } 17 | 18 | ); 19 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/annotations/editor/AnnotationsEditingProvider.js: -------------------------------------------------------------------------------- 1 | import AnnotationHeader from '../components/AnnotationHeader'; 2 | import AnnotationCell from './components/AnnotationCell'; 3 | 4 | export default function AnnotationsEditingProvider(components) { 5 | 6 | components.onGetComponent('cell', ({ cellType }) => { 7 | if (cellType === 'after-label-cells') { 8 | return AnnotationHeader; 9 | } else if (cellType === 'after-rule-cells') { 10 | return AnnotationCell; 11 | } 12 | }); 13 | } 14 | 15 | AnnotationsEditingProvider.$inject = [ 'components' ]; 16 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/annotations/editor/index.js: -------------------------------------------------------------------------------- 1 | import AnnotationsEditingProvider from './AnnotationsEditingProvider'; 2 | import DebounceInput from 'dmn-js-shared/lib/features/debounce-input'; 3 | 4 | export default { 5 | __depends__: [ DebounceInput ], 6 | __init__: [ 'annotationsProvider' ], 7 | annotationsProvider: [ 'type', AnnotationsEditingProvider ] 8 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/annotations/index.js: -------------------------------------------------------------------------------- 1 | import AnnotationsProvider from './AnnotationsProvider'; 2 | 3 | export default { 4 | __init__: [ 'annotationsProvider' ], 5 | annotationsProvider: [ 'type', AnnotationsProvider ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/cell-selection/index.js: -------------------------------------------------------------------------------- 1 | import SelectionModule from 'table-js/lib/features/selection'; 2 | import InteractionEventsModule from 'table-js/lib/features/interaction-events'; 3 | 4 | import CellSelection from './CellSelection'; 5 | 6 | 7 | export default { 8 | __depends__: [ 9 | InteractionEventsModule, 10 | SelectionModule 11 | ], 12 | __init__: [ 13 | 'cellSelection' 14 | ], 15 | cellSelection: [ 'type', CellSelection ] 16 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/column-resize/ColumnResizeProvider.js: -------------------------------------------------------------------------------- 1 | import ResizeColumn from './components/ResizeColumn'; 2 | 3 | 4 | export default function ColumnResizeProvider( 5 | components 6 | ) { 7 | 8 | components.onGetComponent('cell-inner', (context = {}) => { 9 | const { cellType } = context; 10 | 11 | if ( 12 | cellType === 'input-cell' || 13 | cellType === 'output-cell' || 14 | cellType === 'annotations' 15 | ) { 16 | return ResizeColumn; 17 | } 18 | }); 19 | } 20 | 21 | ColumnResizeProvider.$inject = [ 22 | 'components' 23 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/column-resize/index.js: -------------------------------------------------------------------------------- 1 | import ColumnResizeProvider from './ColumnResizeProvider'; 2 | 3 | export default { 4 | __init__: [ 5 | 'columnResizeProvider' 6 | ], 7 | columnResizeProvider: [ 'type', ColumnResizeProvider ] 8 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/context-menu/ContextMenuCloseBehavior.js: -------------------------------------------------------------------------------- 1 | const COMMANDS = [ 2 | 'row.add', 3 | 'row.remove', 4 | 'col.add', 5 | 'col.remove' 6 | ]; 7 | 8 | export default class ContextMenuCloseBehavior { 9 | constructor(contextMenu, eventBus) { 10 | eventBus.on('commandStack.executed', ({ command }) => { 11 | 12 | // close on certain modeling operations 13 | if (COMMANDS.indexOf(command) !== -1) { 14 | contextMenu.close(); 15 | } 16 | 17 | }); 18 | 19 | // always close on undo 20 | eventBus.on('commandStack.reverted', () => { 21 | contextMenu.close(); 22 | }); 23 | } 24 | } 25 | 26 | ContextMenuCloseBehavior.$inject = [ 'contextMenu', 'eventBus' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/context-menu/index.js: -------------------------------------------------------------------------------- 1 | import ContextMenu from './ContextMenu'; 2 | import EditorActions from '../editor-actions'; 3 | import TableContextMenu from 'table-js/lib/features/context-menu'; 4 | import ModelingRules from '../rules'; 5 | import ContextMenuCloseBehavior from './ContextMenuCloseBehavior'; 6 | import ContextMenuKeyboard from './ContextMenuKeyboard'; 7 | 8 | export default { 9 | __depends__: [ EditorActions, TableContextMenu, ModelingRules ], 10 | __init__: [ 11 | 'decisionTableContextMenu', 12 | 'contextMenuCloseBehavior', 13 | 'contextMenuKeyboard' 14 | ], 15 | decisionTableContextMenu: [ 'type', ContextMenu ], 16 | contextMenuCloseBehavior: [ 'type', ContextMenuCloseBehavior ], 17 | contextMenuKeyboard: [ 'type', ContextMenuKeyboard ] 18 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/copy-cut-paste/index.js: -------------------------------------------------------------------------------- 1 | import ClipboardModule from 'diagram-js/lib/features/clipboard'; 2 | import RulesModule from '../rules'; 3 | 4 | import CopyCutPaste from './CopyCutPaste'; 5 | 6 | export default { 7 | __depends__: [ 8 | ClipboardModule, 9 | RulesModule 10 | ], 11 | __init__: [ 12 | 'copyCutPaste' 13 | ], 14 | copyCutPaste: [ 'type', CopyCutPaste ] 15 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/copy-cut-paste/key-bindings/index.js: -------------------------------------------------------------------------------- 1 | import ClipboardModule from 'diagram-js/lib/features/clipboard'; 2 | import CellSelectionModule from '../../cell-selection'; 3 | 4 | import CopyCutPasteKeyBindings from './CopyCutPasteKeyBindings'; 5 | 6 | 7 | export default { 8 | __depends__: [ 9 | ClipboardModule, 10 | CellSelectionModule 11 | ], 12 | __init__: [ 13 | 'copyCutPasteKeyBindings' 14 | ], 15 | copyCutPasteKeyBindings: [ 'type', CopyCutPasteKeyBindings ] 16 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/create-inputs/CreateInputsProvider.js: -------------------------------------------------------------------------------- 1 | import CreateInputsHeaderCell from './components/CreateInputHeaderCell'; 2 | import CreateInputsCell from './components/CreateInputCell'; 3 | 4 | const LOW_PRIORITY = 500; 5 | 6 | export default class CreateInputsProvider { 7 | constructor(components, sheet) { 8 | components.onGetComponent('cell', LOW_PRIORITY, ({ cellType }) => { 9 | const { businessObject } = sheet.getRoot(); 10 | 11 | if (businessObject.input && businessObject.input.length) { 12 | return; 13 | } 14 | 15 | if (cellType === 'before-label-cells') { 16 | return CreateInputsHeaderCell; 17 | } else if (cellType === 'before-rule-cells') { 18 | return CreateInputsCell; 19 | } 20 | }); 21 | } 22 | } 23 | 24 | CreateInputsProvider.$inject = [ 'components', 'sheet' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/create-inputs/components/CreateInputCell.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | import { 4 | inject 5 | } from 'table-js/lib/components'; 6 | 7 | export default class CreateInputsCell extends Component { 8 | constructor(props, context) { 9 | super(props, context); 10 | 11 | inject(this); 12 | } 13 | 14 | onClick = (event) => { 15 | this.editorActions.trigger('addInput'); 16 | }; 17 | 18 | render() { 19 | return ( 20 | - 24 | ); 25 | } 26 | } 27 | 28 | CreateInputsCell.$inject = [ 'editorActions', 'translate' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/create-inputs/components/CreateInputHeaderCell.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | import { 4 | inject 5 | } from 'table-js/lib/components'; 6 | 7 | export default class CreateInputsHeaderCell extends Component { 8 | constructor(props, context) { 9 | super(props, context); 10 | 11 | inject(this); 12 | } 13 | 14 | onClick = (event) => { 15 | this.editorActions.trigger('addInput'); 16 | }; 17 | 18 | render() { 19 | return ( 20 | 24 | { this.translate('Input') } 28 | 29 | ); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/features/view-drd/index.js: -------------------------------------------------------------------------------- 1 | import ViewDrd from './ViewDrd'; 2 | 3 | export default { 4 | __init__: [ 'viewDrd' ], 5 | viewDrd: [ 'type', ViewDrd ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/import/Util.js: -------------------------------------------------------------------------------- 1 | export function elementToString(element) { 2 | if (!element) { 3 | return ''; 4 | } 5 | 6 | const id = element.id ? ` id="${element.id}"` : ''; 7 | 8 | return `<${element.$type}${id} />`; 9 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/import/index.js: -------------------------------------------------------------------------------- 1 | import TableImporter from './TableImporter'; 2 | import DiagramTranslate from 'diagram-js/lib/i18n/translate'; 3 | 4 | export default { 5 | __depends__: [ DiagramTranslate ], 6 | tableImporter: [ 'type', TableImporter ] 7 | }; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Viewer'; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/src/util/DomUtil.js: -------------------------------------------------------------------------------- 1 | export function selectNodeContents(node) { 2 | const selection = window.getSelection(); 3 | const range = document.createRange(); 4 | 5 | range.selectNodeContents(node); 6 | selection.removeAllRanges(); 7 | selection.addRange(range); 8 | } 9 | 10 | export function removeSelection() { 11 | if (window.getSelection) { 12 | if (window.getSelection().empty) { 13 | window.getSelection().empty(); 14 | } else if (window.getSelection().removeAllRanges) { 15 | window.getSelection().removeAllRanges(); 16 | } 17 | } else if (document.selection) { 18 | document.selection.empty(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/TestHelper.js: -------------------------------------------------------------------------------- 1 | import { 2 | insertCSS 3 | } from './helper'; 4 | 5 | export * from './helper'; 6 | 7 | insertCSS('dmn-font.css', 8 | require('dmn-font/dist/css/dmn-embedded.css') 9 | ); 10 | 11 | insertCSS('diagram-js.css', 12 | require('diagram-js/assets/diagram-js.css') 13 | ); 14 | 15 | insertCSS('dmn-js-shared.css', 16 | require('dmn-js-shared/assets/css/dmn-js-shared.css') 17 | ); 18 | 19 | insertCSS('dmn-js-decision-table.css', 20 | require('../assets/css/dmn-js-decision-table.css') 21 | ); 22 | 23 | insertCSS('dmn-js-decision-table-controls.css', 24 | require('../assets/css/dmn-js-decision-table-controls.css') 25 | ); 26 | 27 | insertCSS('dmn-js-testing.css', 28 | `.test-container { 29 | display: flex; 30 | flex-direction: column; 31 | } 32 | .test-container .test-content-container { 33 | flex-grow: 1; 34 | overflow: hidden; 35 | width: auto; 36 | height: auto; 37 | padding: 10px; 38 | } 39 | .test-container .dmn-js-parent { 40 | height: 400px; 41 | width: 800px 42 | }` 43 | ); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | const allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/helper/DecisionTableEditor.js: -------------------------------------------------------------------------------- 1 | import EditingManager from 'dmn-js-shared/lib/base/EditingManager'; 2 | 3 | import Editor from 'src/Editor'; 4 | 5 | 6 | export default class DecisionTableEditor extends EditingManager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'decisionTable', 13 | constructor: Editor, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:DecisionTable' 19 | ); 20 | } 21 | } 22 | ]; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/helper/DecisionTableViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | 3 | import Viewer from 'src/Viewer'; 4 | 5 | 6 | export default class DecisionTableViewer extends Manager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'decisionTable', 13 | constructor: Viewer, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:DecisionTable' 19 | ); 20 | } 21 | } 22 | ]; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/EditorSpec.js: -------------------------------------------------------------------------------- 1 | import TestContainer from 'mocha-test-container-support'; 2 | 3 | import DmnDecisionTableEditor from '../helper/DecisionTableEditor'; 4 | 5 | import simpleDiagramXML from './simple.dmn'; 6 | import complexDiagramXML from './complex.dmn'; 7 | 8 | 9 | describe('DecisionTable', function() { 10 | 11 | let testContainer; 12 | 13 | let dmnJS; 14 | 15 | afterEach(function() { 16 | if (dmnJS) { 17 | dmnJS.destroy(); 18 | dmnJS = null; 19 | } 20 | }); 21 | 22 | beforeEach(function() { 23 | testContainer = TestContainer.get(this); 24 | }); 25 | 26 | function createDecisionTableEditor(xml) { 27 | dmnJS = new DmnDecisionTableEditor({ 28 | container: testContainer 29 | }); 30 | 31 | return dmnJS.importXML(xml); 32 | } 33 | 34 | 35 | it('should import simple decision', function() { 36 | return createDecisionTableEditor(simpleDiagramXML); 37 | }); 38 | 39 | 40 | it('should import complex decision', function() { 41 | this.timeout(5000); 42 | 43 | return createDecisionTableEditor(complexDiagramXML); 44 | }); 45 | 46 | }); 47 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/allowed-values/UtilsSpec.js: -------------------------------------------------------------------------------- 1 | import { 2 | parseString 3 | } from 'src/features/allowed-values/Utils'; 4 | 5 | function expectParsed(string, result) { 6 | return function() { 7 | return expect(parseString(string)).to.eql(result); 8 | }; 9 | } 10 | 11 | describe('decision-table-head/editor/allowed-values - Utils', function() { 12 | 13 | describe('parseString', function() { 14 | 15 | it('"foo", "bar"', expectParsed('"foo", "bar"', { 16 | values: [ 17 | '"foo"', 18 | '"bar"' 19 | ] 20 | })); 21 | 22 | 23 | it('invalid string', expectParsed('foo', undefined)); 24 | 25 | }); 26 | 27 | }); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/create-inputs/no-inputs.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Foo 8 | 9 | "foo" 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/decision-table-head/missing-type-ref.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | pincode 7 | 8 | 9 | 10 | 11 | yes 12 | 13 | 515004 14 | 15 | 16 | "no" 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/decision-table-properties/DecisionTablePropertiesSpec.js: -------------------------------------------------------------------------------- 1 | import { bootstrapViewer } from 'test/helper'; 2 | 3 | import { query as domQuery } from 'min-dom'; 4 | 5 | import TestContainer from 'mocha-test-container-support'; 6 | 7 | import simpleXML from '../../simple.dmn'; 8 | 9 | import CoreModule from 'src/core'; 10 | import DecisionTableHeadModule from 'src/features/decision-table-head'; 11 | import DecisionTablePropertiesModule from 'src/features/decision-table-properties'; 12 | 13 | describe('decision table properties', function() { 14 | 15 | beforeEach(bootstrapViewer(simpleXML, { 16 | modules: [ 17 | CoreModule, 18 | DecisionTableHeadModule, 19 | DecisionTablePropertiesModule 20 | ] 21 | })); 22 | 23 | let testContainer; 24 | 25 | beforeEach(function() { 26 | testContainer = TestContainer.get(this); 27 | }); 28 | 29 | 30 | it('should render decision table properties', function() { 31 | 32 | // then 33 | expect(domQuery('.decision-table-properties', testContainer)).to.exist; 34 | }); 35 | 36 | }); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/hit-policy/HitPolicySpec.js: -------------------------------------------------------------------------------- 1 | import { bootstrapViewer } from 'test/helper'; 2 | 3 | import { query as domQuery } from 'min-dom'; 4 | 5 | import TestContainer from 'mocha-test-container-support'; 6 | 7 | import simpleXML from '../../simple.dmn'; 8 | 9 | import CoreModule from 'src/core'; 10 | import DecisionTableHeadModule from 'src/features/decision-table-head'; 11 | import DecisionTablePropertiesModule from 'src/features/decision-table-properties'; 12 | import HitPolicyModule from 'src/features/hit-policy'; 13 | 14 | 15 | describe('features/hit-policy', function() { 16 | 17 | beforeEach(bootstrapViewer(simpleXML, { 18 | modules: [ 19 | CoreModule, 20 | DecisionTableHeadModule, 21 | DecisionTablePropertiesModule, 22 | HitPolicyModule 23 | ] 24 | })); 25 | 26 | let testContainer; 27 | 28 | beforeEach(function() { 29 | testContainer = TestContainer.get(this); 30 | }); 31 | 32 | 33 | it('should render hit policy cell', function() { 34 | 35 | // then 36 | expect(domQuery('.hit-policy', testContainer)).to.exist; 37 | }); 38 | 39 | }); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/simple-boolean-edit/UtilsSpec.js: -------------------------------------------------------------------------------- 1 | import { parseString } from 'src/features/simple-boolean-edit/Utils'; 2 | 3 | function expectParsed(string, result) { 4 | return function() { 5 | return expect(parseString(string)).to.eql(result); 6 | }; 7 | } 8 | 9 | describe('simple boolean edit - utils', function() { 10 | 11 | describe('parseString', function() { 12 | 13 | it('true', expectParsed('true', 'true')); 14 | 15 | 16 | it(' true ', expectParsed(' true ', 'true')); 17 | 18 | 19 | it('false', expectParsed('false', 'false')); 20 | 21 | 22 | it(' false ', expectParsed(' false ', 'false')); 23 | 24 | 25 | it('invalid string', expectParsed('foo', undefined)); 26 | 27 | }); 28 | 29 | }); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/simple-mode/FooProvider.js: -------------------------------------------------------------------------------- 1 | export default class FooProvider { 2 | constructor(components, simpleMode) { 3 | simpleMode.registerProvider(() => { 4 | return true; 5 | }); 6 | 7 | components.onGetComponent('context-menu', () => { 8 | return () =>
FOO
; 9 | }); 10 | } 11 | } 12 | 13 | FooProvider.$inject = [ 'components', 'simpleMode' ]; -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/features/view-drd/MockViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | import View from 'dmn-js-shared/lib/base/View'; 3 | 4 | import Viewer from 'src/Viewer'; 5 | 6 | 7 | export default class MockViewer extends Manager { 8 | 9 | _getViewProviders() { 10 | 11 | return [ { 12 | id: 'decisionTable', 13 | constructor: Viewer, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:DecisionTable' 19 | ); 20 | } 21 | }, { 22 | id: 'drd', 23 | constructor: View, 24 | opens: 'dmn:Definitions' 25 | } ]; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/import/no-decision-table.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/import/no-input.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/import/no-output.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/no-inputs.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Foo 8 | 9 | "foo" 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/spec/one-rule-one-input-one-output.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | status 8 | 9 | 10 | 11 | 12 | Bronze is really not that good 13 | 14 | "bronze" 15 | 16 | 17 | "notok" 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/testBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /packages/dmn-js-decision-table/test/util/KeyEvents.js: -------------------------------------------------------------------------------- 1 | import { 2 | isString, 3 | assign 4 | } from 'min-dash'; 5 | 6 | /** 7 | * Create a fake key event for testing purposes. 8 | * 9 | * @param {string|number} key the key or keyCode/charCode 10 | * @param {Object} [attrs] 11 | * 12 | * @return {Event} 13 | */ 14 | export function createKeyEvent(key, attrs) { 15 | var event = ( 16 | document.createEvent('Events') || 17 | new document.defaultView.CustomEvent('keyEvent') 18 | ); 19 | 20 | // init and mark as bubbles / cancelable 21 | event.initEvent('keydown', false, true); 22 | 23 | var keyAttrs = isString(key) ? { key: key } : { keyCode: key, which: key }; 24 | 25 | return assign(event, keyAttrs, attrs || {}); 26 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json" 3 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js-drd/README.md: -------------------------------------------------------------------------------- 1 | # dmn-js-drd 2 | 3 | A decision requirements diagram viewer and editor for [dmn-js](https://github.com/bpmn-io/dmn-js). 4 | 5 | 6 | ## License 7 | 8 | Use under the terms of the [bpmn.io license](http://bpmn.io/license). -------------------------------------------------------------------------------- /packages/dmn-js-drd/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('dmn-js-shared/karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js-drd/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dmn-js-drd", 3 | "description": "A decision requirements diagram view for dmn-js", 4 | "version": "17.2.1", 5 | "files": [ 6 | "assets", 7 | "lib" 8 | ], 9 | "scripts": { 10 | "test": "karma start", 11 | "build": "del-cli lib && babel -s --quiet -d lib src", 12 | "dev": "npm test -- --no-single-run --auto-watch", 13 | "prepublishOnly": "npm run build" 14 | }, 15 | "main": "./lib/index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/bpmn-io/dmn-js", 19 | "directory": "packages/dmn-js-drd" 20 | }, 21 | "license": "SEE LICENSE IN LICENSE", 22 | "keywords": [ 23 | "dmn", 24 | "dmn-js", 25 | "dmn-js-view", 26 | "drd" 27 | ], 28 | "dependencies": { 29 | "diagram-js": "^15.2.0", 30 | "diagram-js-direct-editing": "^3.2.0", 31 | "dmn-js-shared": "^17.2.1", 32 | "inherits-browser": "^0.1.0", 33 | "min-dash": "^4.2.2", 34 | "min-dom": "^4.2.1", 35 | "object-refs": "^0.4.0", 36 | "tiny-svg": "^3.1.3" 37 | }, 38 | "devDependencies": { 39 | "@testing-library/dom": "^10.4.0", 40 | "dmn-font": "^0.6.2" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/NavigatedViewer.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import Viewer from './Viewer'; 4 | 5 | import ZoomScroll from 'diagram-js/lib/navigation/zoomscroll'; 6 | import MoveCanvas from 'diagram-js/lib/navigation/movecanvas'; 7 | 8 | import DmnSearchModule from './features/search'; 9 | 10 | /** 11 | * A viewer that includes mouse navigation facilities 12 | * 13 | * @param {Object} options 14 | */ 15 | export default function NavigatedViewer(options) { 16 | Viewer.call(this, options); 17 | } 18 | 19 | inherits(NavigatedViewer, Viewer); 20 | 21 | 22 | NavigatedViewer.prototype._navigationModules = [ 23 | ZoomScroll, 24 | MoveCanvas, 25 | DmnSearchModule 26 | ]; 27 | 28 | NavigatedViewer.prototype._modules = [].concat( 29 | NavigatedViewer.prototype._modules, 30 | NavigatedViewer.prototype._navigationModules 31 | ); 32 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/core/index.js: -------------------------------------------------------------------------------- 1 | import DrawModule from '../draw'; 2 | import ImportModule from '../import'; 3 | 4 | export default { 5 | __depends__: [ 6 | DrawModule, 7 | ImportModule 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/draw/index.js: -------------------------------------------------------------------------------- 1 | import DrdRenderer from './DrdRenderer'; 2 | import TextRenderer from './TextRenderer'; 3 | 4 | import PathMap from './PathMap'; 5 | 6 | export default { 7 | __init__: [ 'drdRenderer' ], 8 | drdRenderer: [ 'type', DrdRenderer ], 9 | textRenderer: [ 'type', TextRenderer ], 10 | pathMap: [ 'type', PathMap ] 11 | }; 12 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/auto-place/DmnAutoPlace.js: -------------------------------------------------------------------------------- 1 | import { getNewShapePosition } from './DmnAutoPlaceUtil'; 2 | 3 | 4 | /** 5 | * DMN auto-place behavior. 6 | * 7 | * @param {EventBus} eventBus 8 | */ 9 | export default function AutoPlace(eventBus) { 10 | eventBus.on('autoPlace', function(context) { 11 | var shape = context.shape, 12 | source = context.source; 13 | 14 | return getNewShapePosition(source, shape); 15 | }); 16 | } 17 | 18 | AutoPlace.$inject = [ 'eventBus' ]; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/auto-place/index.js: -------------------------------------------------------------------------------- 1 | import AutoPlaceModule from 'diagram-js/lib/features/auto-place'; 2 | 3 | import DmnAutoPlace from './DmnAutoPlace'; 4 | 5 | export default { 6 | __depends__: [ AutoPlaceModule ], 7 | __init__: [ 'dmnAutoPlace' ], 8 | dmnAutoPlace: [ 'type', DmnAutoPlace ] 9 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/context-pad/index.js: -------------------------------------------------------------------------------- 1 | import DiagramTranslate from 'diagram-js/lib/i18n/translate'; 2 | import DiagramContextPad from 'diagram-js/lib/features/context-pad'; 3 | import DiagramSelection from 'diagram-js/lib/features/selection'; 4 | import DiagramConnect from 'diagram-js/lib/features/connect'; 5 | import DiagramCreate from 'diagram-js/lib/features/create'; 6 | import PopupMenu from '../popup-menu'; 7 | 8 | import ContextPadProvider from './ContextPadProvider'; 9 | 10 | export default { 11 | __depends__: [ 12 | DiagramTranslate, 13 | DiagramContextPad, 14 | DiagramSelection, 15 | DiagramConnect, 16 | DiagramCreate, 17 | PopupMenu 18 | ], 19 | __init__: [ 'contextPadProvider' ], 20 | contextPadProvider: [ 'type', ContextPadProvider ] 21 | }; 22 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/definition-properties/PaletteAdapter.js: -------------------------------------------------------------------------------- 1 | import { 2 | classes as domClasses 3 | } from 'min-dom'; 4 | 5 | 6 | export default function PaletteAdapter(eventBus, canvas) { 7 | 8 | function toggleMarker(cls, on) { 9 | var container = canvas.getContainer(); 10 | 11 | domClasses(container).toggle(cls, on); 12 | } 13 | 14 | eventBus.on('palette.create', function() { 15 | toggleMarker('with-palette', true); 16 | }); 17 | 18 | eventBus.on('palette.changed', function(event) { 19 | toggleMarker('with-palette-two-column', event.twoColumn); 20 | }); 21 | 22 | } 23 | 24 | PaletteAdapter.$inject = [ 25 | 'eventBus', 26 | 'canvas' 27 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/definition-properties/modeler.js: -------------------------------------------------------------------------------- 1 | import DefinitionPropertiesView from './viewer'; 2 | import DefinitionPropertiesEdit from './DefinitionPropertiesEdit'; 3 | import PaletteAdapter from './PaletteAdapter'; 4 | 5 | export default { 6 | __depends__: [ DefinitionPropertiesView ], 7 | __init__: [ 8 | 'definitionPropertiesEdit', 9 | 'definitionPropertiesPaletteAdapter' 10 | ], 11 | definitionPropertiesEdit: [ 'type', DefinitionPropertiesEdit ], 12 | definitionPropertiesPaletteAdapter: [ 'type', PaletteAdapter ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/definition-properties/viewer.js: -------------------------------------------------------------------------------- 1 | import DefinitionPropertiesView from './DefinitionPropertiesView'; 2 | import PaletteAdapter from './PaletteAdapter'; 3 | import DiagramTranslate from 'diagram-js/lib/i18n/translate'; 4 | 5 | export default { 6 | __depends__: [ DiagramTranslate ], 7 | __init__: [ 8 | 'definitionPropertiesView', 9 | 'definitionPropertiesPaletteAdapter' 10 | ], 11 | definitionPropertiesView: [ 'type', DefinitionPropertiesView ], 12 | definitionPropertiesPaletteAdapter: [ 'type', PaletteAdapter ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/distribute-elements/DrdDistributeElements.js: -------------------------------------------------------------------------------- 1 | import { 2 | filter 3 | } from 'min-dash'; 4 | 5 | import { 6 | isAny 7 | } from 'dmn-js-shared/lib/util/ModelUtil'; 8 | 9 | 10 | /** 11 | * Registers element exclude filters for elements that 12 | * currently do not support distribution. 13 | */ 14 | export default function DrdDistributeElements(distributeElements) { 15 | 16 | distributeElements.registerFilter(function(elements) { 17 | return filter(elements, function(element) { 18 | 19 | var cannotDistribute = isAny(element, [ 20 | 'dmn:AuthorityRequirement', 21 | 'dmn:InformationRequirement', 22 | 'dmn:KnowledgeRequirement', 23 | 'dmn:Association', 24 | 'dmn:TextAnnotation' 25 | ]); 26 | 27 | return !(element.labelTarget || cannotDistribute); 28 | }); 29 | }); 30 | } 31 | 32 | DrdDistributeElements.$inject = [ 'distributeElements' ]; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/distribute-elements/index.js: -------------------------------------------------------------------------------- 1 | import DistributeElementsModule from 'diagram-js/lib/features/distribute-elements'; 2 | 3 | import DrdDistributeElements from './DrdDistributeElements'; 4 | 5 | 6 | export default { 7 | __depends__: [ 8 | DistributeElementsModule 9 | ], 10 | __init__: [ 'drdDistributeElements' ], 11 | drdDistributeElements: [ 'type', DrdDistributeElements ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/drill-down/index.js: -------------------------------------------------------------------------------- 1 | import TranslateModule from 'diagram-js/lib/i18n/translate'; 2 | import OverlaysModule from 'diagram-js/lib/features/overlays'; 3 | 4 | import DrillDown from './DrillDown'; 5 | 6 | export default { 7 | __depends__: [ 8 | OverlaysModule, 9 | TranslateModule 10 | ], 11 | __init__: [ 'drillDown' ], 12 | drillDown: [ 'type', DrillDown ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/editor-actions/index.js: -------------------------------------------------------------------------------- 1 | import EditorActionsModule from 'diagram-js/lib/features/editor-actions'; 2 | 3 | import DrdEditorActions from './DrdEditorActions'; 4 | 5 | export default { 6 | __depends__: [ 7 | EditorActionsModule 8 | ], 9 | editorActions: [ 'type', DrdEditorActions ] 10 | }; 11 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/generate-di/index.js: -------------------------------------------------------------------------------- 1 | import DiGenerator from './DiGenerator'; 2 | 3 | export default { 4 | __init__: [ 'diGenerator' ], 5 | diGenerator: [ 'type', DiGenerator ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/keyboard/index.js: -------------------------------------------------------------------------------- 1 | import KeyboardModule from 'diagram-js/lib/features/keyboard'; 2 | 3 | import DrdKeyboardBindings from './DrdKeyboardBindings'; 4 | 5 | export default { 6 | __depends__: [ 7 | KeyboardModule 8 | ], 9 | __init__: [ 'keyboardBindings' ], 10 | keyboardBindings: [ 'type', DrdKeyboardBindings ] 11 | }; 12 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/label-editing/LabelUtil.js: -------------------------------------------------------------------------------- 1 | import { 2 | is 3 | } from 'dmn-js-shared/lib/util/ModelUtil'; 4 | 5 | 6 | function getLabelAttr(semantic) { 7 | if (is(semantic, 'dmn:Decision') || 8 | is(semantic, 'dmn:BusinessKnowledgeModel') || 9 | is(semantic, 'dmn:InputData') || 10 | is(semantic, 'dmn:KnowledgeSource')) { 11 | 12 | return 'name'; 13 | } 14 | 15 | if (is(semantic, 'dmn:TextAnnotation')) { 16 | return 'text'; 17 | } 18 | } 19 | 20 | export function getLabel(element) { 21 | var semantic = element.businessObject, 22 | attr = getLabelAttr(semantic); 23 | 24 | if (attr) { 25 | return semantic[attr] || ''; 26 | } 27 | } 28 | 29 | 30 | export function setLabel(element, text, isExternal) { 31 | var semantic = element.businessObject, 32 | attr = getLabelAttr(semantic); 33 | 34 | if (attr) { 35 | semantic[attr] = text; 36 | } 37 | 38 | // show external label if not empty 39 | if (isExternal) { 40 | element.hidden = !text; 41 | } 42 | 43 | return element; 44 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/label-editing/cmd/UpdateLabelHandler.js: -------------------------------------------------------------------------------- 1 | import { 2 | getLabel, 3 | setLabel 4 | } from '../LabelUtil'; 5 | 6 | 7 | /** 8 | * A handler that updates the name of a DMN element. 9 | */ 10 | export default function UpdateLabelHandler() { 11 | 12 | /** 13 | * Set the label and return the changed elements. 14 | * 15 | * Element parameter can be label itself or connection (i.e. sequence flow). 16 | * 17 | * @param {djs.model.Base} element 18 | * @param {string} text 19 | */ 20 | function setText(element, text) { 21 | 22 | // external label if present 23 | var label = element.label || element; 24 | 25 | var labelTarget = element.labelTarget || element; 26 | 27 | setLabel(label, text, labelTarget !== label); 28 | 29 | return [ label, labelTarget ]; 30 | } 31 | 32 | function execute(ctx) { 33 | ctx.oldLabel = getLabel(ctx.element); 34 | return setText(ctx.element, ctx.newLabel); 35 | } 36 | 37 | function revert(ctx) { 38 | return setText(ctx.element, ctx.oldLabel); 39 | } 40 | 41 | // API 42 | 43 | this.execute = execute; 44 | this.revert = revert; 45 | } 46 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/label-editing/index.js: -------------------------------------------------------------------------------- 1 | import DiagramCommand from 'diagram-js/lib/command'; 2 | import DiagramChangeSupport from 'diagram-js/lib/features/change-support'; 3 | import DiagramDirectEditing from 'diagram-js-direct-editing'; 4 | 5 | import LabelEditingProvider from './LabelEditingProvider'; 6 | 7 | export default { 8 | __depends__: [ 9 | DiagramCommand, 10 | DiagramChangeSupport, 11 | DiagramDirectEditing 12 | ], 13 | __init__: [ 'labelEditingProvider' ], 14 | labelEditingProvider: [ 'type', LabelEditingProvider ] 15 | }; 16 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/modeling/behavior/ReplaceConnectionBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 4 | 5 | 6 | export default function ReplaceConnectionBehavior(injector, modeling, rules) { 7 | injector.invoke(CommandInterceptor, this); 8 | 9 | this.preExecute('connection.reconnect', function(context) { 10 | var connection = context.connection, 11 | source = context.newSource || connection.source, 12 | target = context.newTarget || connection.target, 13 | waypoints = connection.waypoints.slice(); 14 | 15 | var allowed = rules.allowed('connection.reconnect', { 16 | connection: connection, 17 | source: source, 18 | target: target 19 | }); 20 | 21 | if (!allowed || allowed.type === connection.type) { 22 | return; 23 | } 24 | 25 | context.connection = modeling.connect(source, target, { 26 | type: allowed.type, 27 | waypoints: waypoints 28 | }); 29 | 30 | modeling.removeConnection(connection); 31 | }, true); 32 | } 33 | 34 | inherits(ReplaceConnectionBehavior, CommandInterceptor); 35 | 36 | ReplaceConnectionBehavior.$inject = [ 37 | 'injector', 38 | 'modeling', 39 | 'rules' 40 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/modeling/behavior/ReplaceElementBehavior.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; 4 | 5 | 6 | /** 7 | * Defines the behaviour of what happens to the elements inside a container 8 | * that morphs into another DRD element 9 | */ 10 | export default function ReplaceElementBehaviour(eventBus, modeling, selection) { 11 | CommandInterceptor.call(this, eventBus); 12 | 13 | this._modeling = modeling; 14 | 15 | this.postExecuted([ 'shape.replace' ], 1500, function(e) { 16 | var context = e.context, 17 | oldShape = context.oldShape, 18 | newShape = context.newShape; 19 | 20 | 21 | modeling.unclaimId(oldShape.businessObject.id, oldShape.businessObject); 22 | modeling.updateProperties(newShape, { id: oldShape.id }); 23 | selection.select(newShape); 24 | }); 25 | } 26 | 27 | inherits(ReplaceElementBehaviour, CommandInterceptor); 28 | 29 | ReplaceElementBehaviour.$inject = [ 'eventBus', 'modeling', 'selection' ]; 30 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/modeling/behavior/index.js: -------------------------------------------------------------------------------- 1 | import CreateConnectionBehavior from './CreateConnectionBehavior'; 2 | import LayoutConnectionBehavior from './LayoutConnectionBehavior'; 3 | import ReplaceConnectionBehavior from './ReplaceConnectionBehavior'; 4 | import ReplaceElementBehavior from './ReplaceElementBehavior'; 5 | import IdChangeBehavior from 6 | 'dmn-js-shared/lib/features/modeling/behavior/IdChangeBehavior'; 7 | import NameChangeBehavior from 8 | 'dmn-js-shared/lib/features/modeling/behavior/NameChangeBehavior'; 9 | export default { 10 | __init__: [ 11 | 'createConnectionBehavior', 12 | 'idChangeBehavior', 13 | 'nameChangeBehavior', 14 | 'layoutConnectionBehavior', 15 | 'replaceConnectionBehavior', 16 | 'replaceElementBehavior' 17 | ], 18 | createConnectionBehavior: [ 'type', CreateConnectionBehavior ], 19 | idChangeBehavior: [ 'type', IdChangeBehavior ], 20 | nameChangeBehavior: [ 'type', NameChangeBehavior ], 21 | layoutConnectionBehavior: [ 'type', LayoutConnectionBehavior ], 22 | replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ], 23 | replaceElementBehavior: [ 'type', ReplaceElementBehavior ] 24 | }; 25 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/modeling/cmd/IdClaimHandler.js: -------------------------------------------------------------------------------- 1 | export default function IdClaimHandler(moddle) { 2 | this._moddle = moddle; 3 | } 4 | 5 | IdClaimHandler.$inject = [ 'moddle' ]; 6 | 7 | 8 | IdClaimHandler.prototype.execute = function(context) { 9 | var ids = this._moddle.ids, 10 | id = context.id, 11 | element = context.element, 12 | claiming = context.claiming; 13 | 14 | if (claiming) { 15 | ids.claim(id, element); 16 | } else { 17 | ids.unclaim(id); 18 | } 19 | }; 20 | 21 | /** 22 | * Command revert implementation. 23 | */ 24 | IdClaimHandler.prototype.revert = function(context) { 25 | var ids = this._moddle.ids, 26 | id = context.id, 27 | element = context.element, 28 | claiming = context.claiming; 29 | 30 | if (claiming) { 31 | ids.unclaim(id); 32 | } else { 33 | ids.claim(id, element); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/modeling/index.js: -------------------------------------------------------------------------------- 1 | import ModelingBehavior from './behavior'; 2 | import Rules from '../rules'; 3 | import DefinitionPropertiesViewer from '../definition-properties/viewer'; 4 | import DiagramCommand from 'diagram-js/lib/command'; 5 | import DiagramSelection from 'diagram-js/lib/features/selection'; 6 | import DiagramChangeSupport from 'diagram-js/lib/features/change-support'; 7 | 8 | import DrdFactory from './DrdFactory'; 9 | import DrdUpdater from './DrdUpdater'; 10 | import ElementFactory from './ElementFactory'; 11 | import Modeling from './Modeling'; 12 | import DrdLayouter from './DrdLayouter'; 13 | import CroppingConnectionDocking from 'diagram-js/lib/layout/CroppingConnectionDocking'; 14 | 15 | export default { 16 | __init__: [ 'modeling', 'drdUpdater' ], 17 | __depends__: [ 18 | ModelingBehavior, 19 | Rules, 20 | DefinitionPropertiesViewer, 21 | DiagramCommand, 22 | DiagramSelection, 23 | DiagramChangeSupport 24 | ], 25 | drdFactory: [ 'type', DrdFactory ], 26 | drdUpdater: [ 'type', DrdUpdater ], 27 | elementFactory: [ 'type', ElementFactory ], 28 | modeling: [ 'type', Modeling ], 29 | layouter: [ 'type', DrdLayouter ], 30 | connectionDocking: [ 'type', CroppingConnectionDocking ] 31 | }; 32 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/outline/index.js: -------------------------------------------------------------------------------- 1 | import Outline from 'diagram-js/lib/features/outline'; 2 | import OutlineProvider from './OutlineProvider'; 3 | 4 | export default { 5 | __depends__: [ 6 | Outline 7 | ], 8 | __init__: [ 'outlineProvider' ], 9 | outlineProvider: [ 'type', OutlineProvider ] 10 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/palette/index.js: -------------------------------------------------------------------------------- 1 | import DiagramTranslate from 'diagram-js/lib/i18n/translate'; 2 | import DiagramPalette from 'diagram-js/lib/features/palette'; 3 | import DiagramCreate from 'diagram-js/lib/features/create'; 4 | import DiagramLasso from 'diagram-js/lib/features/lasso-tool'; 5 | import DiagramHand from 'diagram-js/lib/features/hand-tool'; 6 | 7 | import PaletteProvider from './PaletteProvider'; 8 | 9 | export default { 10 | __depends__: [ 11 | DiagramTranslate, 12 | DiagramPalette, 13 | DiagramCreate, 14 | DiagramLasso, 15 | DiagramHand 16 | ], 17 | __init__: [ 'paletteProvider' ], 18 | paletteProvider: [ 'type', PaletteProvider ] 19 | }; 20 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/popup-menu/index.js: -------------------------------------------------------------------------------- 1 | import DiagramTranslate from 'diagram-js/lib/i18n/translate'; 2 | import DiagramPopupMenu from 'diagram-js/lib/features/popup-menu'; 3 | import Replace from '../replace'; 4 | 5 | import ReplaceMenuProvider from './ReplaceMenuProvider'; 6 | 7 | export default { 8 | __depends__: [ 9 | DiagramTranslate, 10 | DiagramPopupMenu, 11 | Replace 12 | ], 13 | __init__: [ 'replaceMenuProvider' ], 14 | replaceMenuProvider: [ 'type', ReplaceMenuProvider ] 15 | }; 16 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/replace/index.js: -------------------------------------------------------------------------------- 1 | import DiagramReplace from 'diagram-js/lib/features/replace'; 2 | import DiagramSelection from 'diagram-js/lib/features/selection'; 3 | 4 | import DrdReplace from './DrdReplace'; 5 | 6 | export default { 7 | __depends__: [ 8 | DiagramReplace, 9 | DiagramSelection 10 | ], 11 | drdReplace: [ 'type', DrdReplace ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/rules/index.js: -------------------------------------------------------------------------------- 1 | import DiagramRulesModule from 'diagram-js/lib/features/rules'; 2 | 3 | import DrdRules from './DrdRules'; 4 | 5 | export default { 6 | __depends__: [ 7 | DiagramRulesModule 8 | ], 9 | __init__: [ 'drdRules' ], 10 | drdRules: [ 'type', DrdRules ] 11 | }; 12 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/search/index.js: -------------------------------------------------------------------------------- 1 | import SearchPadModule from 'diagram-js/lib/features/search-pad'; 2 | 3 | import DmnSearchProvider from './DmnSearchProvider'; 4 | 5 | 6 | export default { 7 | __depends__: [ 8 | SearchPadModule 9 | ], 10 | __init__: [ 'dmnSearch' ], 11 | dmnSearch: [ 'type', DmnSearchProvider ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/features/snapping/index.js: -------------------------------------------------------------------------------- 1 | import DrdBendpointSnapping from './DrdBendpointSnapping'; 2 | import DrdConnectSnapping from './DrdConnectSnapping'; 3 | import SnappingModule from 'diagram-js/lib/features/snapping'; 4 | 5 | export default { 6 | __depends__: [ SnappingModule ], 7 | __init__: [ 8 | 'bendpointSnapping', 9 | 'connectSnapping' 10 | ], 11 | bendpointSnapping: [ 'type', DrdBendpointSnapping ], 12 | connectSnapping: [ 'type', DrdConnectSnapping ] 13 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/import/index.js: -------------------------------------------------------------------------------- 1 | import DrdImporter from './DrdImporter'; 2 | 3 | export default { 4 | drdImporter: [ 'type', DrdImporter ] 5 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/src/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Viewer'; -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/TestHelper.js: -------------------------------------------------------------------------------- 1 | import { 2 | insertCSS 3 | } from './helper'; 4 | 5 | export * from './helper'; 6 | 7 | insertCSS('dmn-font.css', 8 | require('dmn-font/dist/css/dmn-embedded.css') 9 | ); 10 | 11 | insertCSS( 12 | 'dmn-js-shared.css', 13 | require('dmn-js-shared/assets/css/dmn-js-shared.css') 14 | ); 15 | insertCSS('dmn-js-drd.css', require('../assets/css/dmn-js-drd.css')); 16 | 17 | insertCSS('diagram-js.css', require('diagram-js/assets/diagram-js.css')); 18 | 19 | 20 | insertCSS('dmn-js-testing.css', 21 | '.test-container .dmn-js-parent { height: 500px; }' 22 | ); -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | const allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/business-knowledge.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/empty-decision-id.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/empty-definitions.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/input-data.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/knowledge-source.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/literal-expression.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | calendar.getSeason(date) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/new-table.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/no-decision-id.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/no-di.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/no-rules.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/one-input.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/one-literal-expr.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | calendar.getSeason(date) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/fixtures/dmn/one-output.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/helper/DrdModeler.js: -------------------------------------------------------------------------------- 1 | import EditingManager from 'dmn-js-shared/lib/base/EditingManager'; 2 | 3 | import DrdModelerView from 'src/Modeler'; 4 | 5 | 6 | export default class DrdModeler extends EditingManager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'drd', 13 | constructor: DrdModelerView, 14 | opens: 'dmn:Definitions' 15 | } 16 | ]; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/helper/DrdViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | 3 | import DrdReadOnlyView from 'src/Viewer'; 4 | 5 | 6 | export default class DrdViewer extends Manager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'drd', 13 | constructor: DrdReadOnlyView, 14 | opens: 'dmn:Definitions' 15 | } 16 | ]; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/definition-properties/definitionProperties.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/modeling/ElementFactory.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/modeling/LayoutConnection.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/modeling/UpdateModdleProperties.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/modeling/behavior/create-connection-behavior.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/popup-menu/replaceMenu.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/replace/replace.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/spec/features/replace/textAnnotation.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Annotation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/testBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/util/ElementsUtil.js: -------------------------------------------------------------------------------- 1 | import { 2 | getDrdJS 3 | } from '../helper'; 4 | 5 | import { 6 | query as domQuery, 7 | queryAll as domQueryAll 8 | } from 'min-dom'; 9 | 10 | 11 | /** 12 | * Create an event with global coordinates 13 | * computed based on the loaded diagrams canvas position and the 14 | * specified canvas local coordinates. 15 | * 16 | * @param {Point} point of the event local the canvas (closure) 17 | * @param {Object} data 18 | * 19 | * @return {Event} event, scoped to the given canvas 20 | */ 21 | export function queryElement(selector, target, queryAll) { 22 | return getDrdJS().invoke(function(canvas) { 23 | 24 | if (typeof target === 'boolean') { 25 | queryAll = target; 26 | target = undefined; 27 | } 28 | 29 | target = target || canvas.getContainer(); 30 | 31 | if (queryAll) { 32 | return domQueryAll(selector, target); 33 | } 34 | 35 | return domQuery(selector, target); 36 | }); 37 | } 38 | 39 | 40 | export function getBounds(element) { 41 | return element.getBoundingClientRect(); 42 | } 43 | -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/util/KeyEvents.js: -------------------------------------------------------------------------------- 1 | import { 2 | isString, 3 | assign 4 | } from 'min-dash'; 5 | 6 | /** 7 | * Create a fake key event for testing purposes. 8 | * 9 | * @param {string|number} key the key or keyCode/charCode 10 | * @param {Object} [attrs] 11 | * 12 | * @return {Event} 13 | */ 14 | export function createKeyEvent(key, attrs) { 15 | var event = ( 16 | document.createEvent('Events') || 17 | new document.defaultView.CustomEvent('keyEvent') 18 | ); 19 | 20 | // init and mark as bubbles / cancelable 21 | event.initEvent('keydown', false, true); 22 | 23 | var keyAttrs = isString(key) ? { key: key } : { keyCode: key, which: key }; 24 | 25 | return assign(event, keyAttrs, attrs || {}); 26 | } -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/util/custom-rules/CustomRules.js: -------------------------------------------------------------------------------- 1 | import inherits from 'inherits-browser'; 2 | 3 | import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider'; 4 | 5 | export default function CustomRules(eventBus) { 6 | RuleProvider.call(this, eventBus); 7 | } 8 | 9 | CustomRules.$inject = [ 'eventBus' ]; 10 | 11 | inherits(CustomRules, RuleProvider); 12 | 13 | CustomRules.prototype.init = function() { 14 | 15 | // placeholder 16 | }; -------------------------------------------------------------------------------- /packages/dmn-js-drd/test/util/custom-rules/index.js: -------------------------------------------------------------------------------- 1 | import CustomRules from './CustomRules'; 2 | 3 | export default { 4 | __init__: [ 'customRules' ], 5 | customRules: [ 'type', CustomRules ] 6 | }; 7 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json", 3 | "plugins": [ 4 | "inferno" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/README.md: -------------------------------------------------------------------------------- 1 | # dmn-js-literal-expression 2 | 3 | A literal expression viewer and editor for [dmn-js](https://github.com/bpmn-io/dmn-js). 4 | 5 | 6 | ## License 7 | 8 | Use under the terms of the [bpmn.io license](http://bpmn.io/license). -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('dmn-js-shared/karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dmn-js-literal-expression", 3 | "description": "A literal expression view for dmn-js", 4 | "version": "17.2.1", 5 | "files": [ 6 | "assets", 7 | "lib" 8 | ], 9 | "scripts": { 10 | "test": "karma start", 11 | "build": "del-cli lib && babel -s --quiet -d lib src", 12 | "dev": "npm test -- --no-single-run --auto-watch", 13 | "prepublishOnly": "npm run build" 14 | }, 15 | "main": "./lib/index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/bpmn-io/dmn-js", 19 | "directory": "packages/dmn-js-literal-expression" 20 | }, 21 | "license": "SEE LICENSE IN LICENSE", 22 | "keywords": [ 23 | "dmn", 24 | "dmn-js", 25 | "dmn-js-view", 26 | "literal expression" 27 | ], 28 | "devDependencies": { 29 | "@testing-library/dom": "^10.4.0", 30 | "dmn-font": "^0.6.2", 31 | "inferno-test-utils": "~5.6.2" 32 | }, 33 | "dependencies": { 34 | "@bpmn-io/dmn-variable-resolver": "^0.7.0", 35 | "diagram-js": "^15.2.0", 36 | "dmn-js-shared": "^17.2.1", 37 | "escape-html": "^1.0.3", 38 | "inferno": "~5.6.3", 39 | "min-dash": "^4.2.2", 40 | "min-dom": "^4.2.1", 41 | "table-js": "^9.2.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/Editor.js: -------------------------------------------------------------------------------- 1 | import { DmnVariableResolverModule } from '@bpmn-io/dmn-variable-resolver'; 2 | 3 | import ExpressionLanguagesModule from 'dmn-js-shared/lib/features/expression-languages'; 4 | import DataTypesModule from 'dmn-js-shared/lib/features/data-types'; 5 | 6 | import Viewer from './Viewer'; 7 | 8 | import DecisionPropertiesEditorModule from './features/decision-properties/editor'; 9 | import KeyboardModule from './features/keyboard'; 10 | import LiteralExpressionPropertiesEditorModule 11 | from './features/literal-expression-properties/editor'; 12 | import ModelingModule from './features/modeling'; 13 | import TextareaEditorComponent from './features/textarea/editor'; 14 | 15 | export default class Editor extends Viewer { 16 | getModules() { 17 | return [ 18 | ...Viewer._getModules(), 19 | ...Editor._getModules() 20 | ]; 21 | } 22 | 23 | static _getModules() { 24 | return [ 25 | DecisionPropertiesEditorModule, 26 | KeyboardModule, 27 | LiteralExpressionPropertiesEditorModule, 28 | ModelingModule, 29 | ExpressionLanguagesModule, 30 | DataTypesModule, 31 | TextareaEditorComponent, 32 | DmnVariableResolverModule 33 | ]; 34 | } 35 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/core/ElementRegistry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A single decision element registry. 3 | * 4 | * The sole purpose of this service is to provide the necessary API 5 | * to serve shared components, i.e. the UpdatePropertiesHandler. 6 | */ 7 | export default class ElementRegistry { 8 | 9 | constructor(viewer, eventBus) { 10 | this._eventBus = eventBus; 11 | this._viewer = viewer; 12 | } 13 | 14 | getDecision() { 15 | return this._viewer.getDecision(); 16 | } 17 | 18 | updateId(element, newId) { 19 | 20 | var decision = this.getDecision(); 21 | 22 | if (element !== decision) { 23 | throw new Error('element !== decision'); 24 | } 25 | 26 | this._eventBus.fire('element.updateId', { 27 | element: element, 28 | newId: newId 29 | }); 30 | 31 | element.id = newId; 32 | } 33 | 34 | } 35 | 36 | ElementRegistry.$inject = [ 37 | 'viewer', 38 | 'eventBus' 39 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/core/index.js: -------------------------------------------------------------------------------- 1 | import ElementRegistry from './ElementRegistry'; 2 | 3 | export default { 4 | __init__: [ 'elementRegistry' ], 5 | elementRegistry: [ 'type', ElementRegistry ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/decision-properties/DecisionProperties.js: -------------------------------------------------------------------------------- 1 | import DecisionPropertiesComponent from './components/DecisionPropertiesComponent'; 2 | 3 | const HIGH_PRIORITY = 1500; 4 | 5 | export default class DecisionProperties { 6 | constructor(components) { 7 | components.onGetComponent('viewer', HIGH_PRIORITY, () => DecisionPropertiesComponent); 8 | } 9 | } 10 | 11 | DecisionProperties.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/decision-properties/DecisionPropertiesEditor.js: -------------------------------------------------------------------------------- 1 | import DecisionPropertiesEditorComponent 2 | from './components/DecisionPropertiesEditorComponent'; 3 | 4 | const HIGH_PRIORITY = 1500; 5 | 6 | export default class DecisionPropertiesEditor { 7 | constructor(components) { 8 | components.onGetComponent('viewer', HIGH_PRIORITY, () => { 9 | return DecisionPropertiesEditorComponent; 10 | }); 11 | } 12 | } 13 | 14 | DecisionPropertiesEditor.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/decision-properties/components/DecisionPropertiesComponent.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class DecisionPropertiesComponent extends Component { 5 | constructor(props, context) { 6 | super(props, context); 7 | 8 | this._viewer = context.injector.get('viewer'); 9 | } 10 | 11 | render() { 12 | 13 | // there is only one single element 14 | const { name } = this._viewer.getDecision(); 15 | 16 | return ( 17 |
18 |

{ name }

19 |
20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/decision-properties/editor.js: -------------------------------------------------------------------------------- 1 | import TranslateModule from 'diagram-js/lib/i18n/translate'; 2 | 3 | import DecisionPropertiesEditor from './DecisionPropertiesEditor'; 4 | import DebounceInput from 'dmn-js-shared/lib/features/debounce-input'; 5 | 6 | export default { 7 | __depends__: [ DebounceInput, TranslateModule ], 8 | __init__: [ 'decisionProperties' ], 9 | decisionProperties: [ 'type', DecisionPropertiesEditor ] 10 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/decision-properties/index.js: -------------------------------------------------------------------------------- 1 | import DecisionProperties from './DecisionProperties'; 2 | 3 | export default { 4 | __init__: [ 'decisionProperties' ], 5 | decisionProperties: [ 'type', DecisionProperties ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/editor-actions/index.js: -------------------------------------------------------------------------------- 1 | import EditorActions from './EditorActions'; 2 | 3 | export default { 4 | __init__: [ 'editorActions' ], 5 | editorActions: [ 'type', EditorActions ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/keyboard/KeyboardUtil.js: -------------------------------------------------------------------------------- 1 | export function hasModifier(modifiers) { 2 | return ( 3 | modifiers.ctrlKey || 4 | modifiers.metaKey || 5 | modifiers.shiftKey || 6 | modifiers.altKey 7 | ); 8 | } 9 | 10 | export function isCmd(modifiers) { 11 | 12 | // ensure we don't react to AltGr 13 | // (mapped to CTRL + ALT) 14 | if (modifiers.altKey) { 15 | return false; 16 | } 17 | 18 | return modifiers.ctrlKey || modifiers.metaKey; 19 | } 20 | 21 | export function isShift(modifiers) { 22 | return modifiers.shiftKey; 23 | } 24 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/keyboard/index.js: -------------------------------------------------------------------------------- 1 | import EditorActions from '../editor-actions'; 2 | 3 | import Keyboard from './Keyboard'; 4 | 5 | export default { 6 | __depends__: [ EditorActions ], 7 | __init__: [ 'keyboard' ], 8 | keyboard: [ 'type', Keyboard ] 9 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/literal-expression-properties/LiteralExpressionProperties.js: -------------------------------------------------------------------------------- 1 | import LiteralExpressionPropertiesComponent 2 | from './components/LiteralExpressionPropertiesComponent'; 3 | 4 | const LOW_PRIORITY = 500; 5 | 6 | export default class DecisionProperties { 7 | constructor(components) { 8 | components.onGetComponent('viewer', LOW_PRIORITY, () => { 9 | return LiteralExpressionPropertiesComponent; 10 | }); 11 | } 12 | } 13 | 14 | DecisionProperties.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/literal-expression-properties/LiteralExpressionPropertiesEditor.js: -------------------------------------------------------------------------------- 1 | import LiteralExpressionPropertiesEditorComponent 2 | from './components/LiteralExpressionPropertiesEditorComponent'; 3 | 4 | const LOW_PRIORITY = 500; 5 | 6 | export default class LiteralExpressionPropertiesEditor { 7 | constructor(components) { 8 | components.onGetComponent('viewer', LOW_PRIORITY, () => { 9 | return LiteralExpressionPropertiesEditorComponent; 10 | }); 11 | } 12 | } 13 | 14 | LiteralExpressionPropertiesEditor.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/literal-expression-properties/editor.js: -------------------------------------------------------------------------------- 1 | import LiteralExpressionPropertiesEditor from './LiteralExpressionPropertiesEditor'; 2 | import DebounceInput from 'dmn-js-shared/lib/features/debounce-input'; 3 | import Keyboard from '../keyboard'; 4 | import DataTypesModule from 'dmn-js-shared/lib/features/data-types/DataTypes'; 5 | import ExpressionLanguagesModule from 'dmn-js-shared/lib/features/expression-languages'; 6 | 7 | export default { 8 | __depends__: [ 9 | DebounceInput, 10 | Keyboard, 11 | ExpressionLanguagesModule, 12 | DataTypesModule 13 | ], 14 | __init__: [ 'literalExpressionProperties' ], 15 | literalExpressionProperties: [ 'type', LiteralExpressionPropertiesEditor ] 16 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/literal-expression-properties/index.js: -------------------------------------------------------------------------------- 1 | import LiteralExpressionProperties from './LiteralExpressionProperties'; 2 | 3 | export default { 4 | __depends__: [ 5 | ], 6 | __init__: [ 'literalExpressionProperties' ], 7 | literalExpressionProperties: [ 'type', LiteralExpressionProperties ] 8 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/modeling/index.js: -------------------------------------------------------------------------------- 1 | import CommandStack from 'diagram-js/lib/command/CommandStack'; 2 | import IdChangeBehavior from 3 | 'dmn-js-shared/lib/features/modeling/behavior/IdChangeBehavior'; 4 | import NameChangeBehavior from 5 | 'dmn-js-shared/lib/features/modeling/behavior/NameChangeBehavior'; 6 | import Modeling from './Modeling'; 7 | 8 | export default { 9 | __init__: [ 'idChangeBehavior', 'nameChangeBehavior', 'modeling' ], 10 | commandStack: [ 'type', CommandStack ], 11 | idChangeBehavior: [ 'type', IdChangeBehavior ], 12 | nameChangeBehavior: [ 'type', NameChangeBehavior ], 13 | modeling: [ 'type', Modeling ] 14 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/powered-by/PoweredBy.js: -------------------------------------------------------------------------------- 1 | import { PoweredByComponent } from 'dmn-js-shared/lib/util/PoweredByUtil'; 2 | 3 | const HIGHER_PRIORITY = 2000; 4 | 5 | export default class PoweredBy { 6 | constructor(components) { 7 | components.onGetComponent('viewer', HIGHER_PRIORITY, () => { 8 | return PoweredByComponent; 9 | }); 10 | } 11 | } 12 | 13 | PoweredBy.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/powered-by/index.js: -------------------------------------------------------------------------------- 1 | import PoweredBy from './PoweredBy'; 2 | 3 | export default { 4 | __init__: [ 'poweredBy' ], 5 | poweredBy: [ 'type', PoweredBy ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/textarea/Textarea.js: -------------------------------------------------------------------------------- 1 | import TextareaComponent from './components/TextareaComponent'; 2 | 3 | export default class Textarea { 4 | constructor(components) { 5 | components.onGetComponent('viewer', () => TextareaComponent); 6 | } 7 | } 8 | 9 | Textarea.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/textarea/TextareaEditor.js: -------------------------------------------------------------------------------- 1 | import TextareaEditorComponent from './components/TextareaEditorComponent'; 2 | 3 | export default class Textarea { 4 | constructor(components) { 5 | components.onGetComponent('viewer', () => TextareaEditorComponent); 6 | } 7 | } 8 | 9 | Textarea.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/textarea/components/TextareaComponent.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class TextareaComponent extends Component { 5 | constructor(props, context) { 6 | super(props, context); 7 | 8 | this._viewer = context.injector.get('viewer'); 9 | } 10 | 11 | render() { 12 | const { text } = this._viewer.getDecision().decisionLogic; 13 | 14 | return ( 15 |
16 |
{ text }
17 |
18 | ); 19 | } 20 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/textarea/editor.js: -------------------------------------------------------------------------------- 1 | import TranslateModule from 'diagram-js/lib/i18n/translate'; 2 | import DebounceInput from 'dmn-js-shared/lib/features/debounce-input'; 3 | 4 | import TextareaEditor from './TextareaEditor'; 5 | 6 | export default { 7 | __depends__: [ 8 | DebounceInput, 9 | TranslateModule 10 | ], 11 | __init__: [ 'textarea' ], 12 | textarea: [ 'type', TextareaEditor ] 13 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/textarea/index.js: -------------------------------------------------------------------------------- 1 | import Textarea from './Textarea'; 2 | 3 | export default { 4 | __init__: [ 'textarea' ], 5 | textarea: [ 'type', Textarea ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/view-drd/components/ViewDrdComponent.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class ViewDrdComponent extends Component { 5 | 6 | constructor(props, context) { 7 | super(props, context); 8 | 9 | const { injector } = context; 10 | 11 | this._translate = injector.get('translate'); 12 | this._eventBus = injector.get('eventBus'); 13 | } 14 | 15 | onClick = () => { 16 | this._eventBus.fire('showDrd'); 17 | }; 18 | 19 | render() { 20 | return ( 21 |
this.node = node }> 24 | 28 |
29 | ); 30 | } 31 | 32 | } 33 | 34 | ViewDrdComponent.$inject = [ 'translate' ]; 35 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/features/view-drd/index.js: -------------------------------------------------------------------------------- 1 | import ViewDrd from './ViewDrd'; 2 | 3 | export default { 4 | __init__: [ 'viewDrd' ], 5 | viewDrd: [ 'type', ViewDrd ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/src/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Viewer'; -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/TestHelper.js: -------------------------------------------------------------------------------- 1 | import { 2 | insertCSS 3 | } from './helper'; 4 | 5 | export * from './helper'; 6 | 7 | insertCSS('dmn-font.css', 8 | require('dmn-font/dist/css/dmn-embedded.css') 9 | ); 10 | 11 | insertCSS('dmn-js-shared.css', 12 | require('dmn-js-shared/assets/css/dmn-js-shared.css') 13 | ); 14 | 15 | insertCSS('dmn-js-literal-expression-js.css', 16 | require('../assets/css/dmn-js-literal-expression.css') 17 | ); 18 | 19 | insertCSS('dmn-js-testing.css', 20 | '.test-container .dmn-js-parent { height: 500px; }' 21 | ); -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | const allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/helper/LiteralExpressionEditor.js: -------------------------------------------------------------------------------- 1 | import EditingManager from 'dmn-js-shared/lib/base/EditingManager'; 2 | 3 | import Editor from 'src/Editor'; 4 | 5 | 6 | export default class LiteralExpressionEditor extends EditingManager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'literalExpression', 13 | constructor: Editor, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:LiteralExpression' 19 | ); 20 | } 21 | } 22 | ]; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/helper/LiteralExpressionViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | 3 | import Viewer from 'src/Viewer'; 4 | 5 | 6 | export default class LiteralExpressionViewer extends Manager { 7 | 8 | _getViewProviders() { 9 | 10 | return [ 11 | { 12 | id: 'literalExpression', 13 | constructor: Viewer, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:LiteralExpression' 19 | ); 20 | } 21 | } 22 | ]; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/EditorSpec.js: -------------------------------------------------------------------------------- 1 | import TestContainer from 'mocha-test-container-support'; 2 | 3 | import DmnLiteralExpressionEditor from '../helper/LiteralExpressionEditor'; 4 | 5 | import simpleXML from './empty-literal-expression.dmn'; 6 | 7 | 8 | describe('Editor', function() { 9 | 10 | let testContainer; 11 | 12 | beforeEach(function() { 13 | testContainer = TestContainer.get(this); 14 | }); 15 | 16 | function createEditor(xml) { 17 | const dmnLiteralExpressionEditor = window.editor = new DmnLiteralExpressionEditor({ 18 | container: testContainer 19 | }); 20 | 21 | return dmnLiteralExpressionEditor.importXML(xml); 22 | } 23 | 24 | 25 | it('should import literal expression', function() { 26 | return createEditor(simpleXML); 27 | }); 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/empty-literal-expression.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/expression-language.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | calendar.getSeason(date) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/features/decision-properties/DecisionPropertiesSpec.js: -------------------------------------------------------------------------------- 1 | import { bootstrapViewer } from 'test/helper'; 2 | 3 | import { query as domQuery } from 'min-dom'; 4 | 5 | import TestContainer from 'mocha-test-container-support'; 6 | 7 | import literalExpressionXML from '../../literal-expression.dmn'; 8 | 9 | import CoreModule from 'src/core'; 10 | import DecisionPropertiesModule from 'src/features/decision-properties'; 11 | 12 | 13 | describe('decision properties', function() { 14 | 15 | beforeEach(bootstrapViewer(literalExpressionXML, { 16 | modules: [ 17 | CoreModule, 18 | DecisionPropertiesModule 19 | ] 20 | })); 21 | 22 | let testContainer; 23 | 24 | beforeEach(function() { 25 | testContainer = TestContainer.get(this); 26 | }); 27 | 28 | 29 | it('should render', function() { 30 | 31 | // then 32 | expect(domQuery('.decision-properties', testContainer)).to.exist; 33 | }); 34 | 35 | }); -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/features/literal-expression-properties/LiteralExpressionEditorProperties.no-type-ref.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/features/modeling/behavior/NameChangeBehaviorSpec.js: -------------------------------------------------------------------------------- 1 | import { bootstrapModeler, inject } from 'test/helper'; 2 | 3 | import simpleStringEditXML from '../../../literal-expression.dmn'; 4 | 5 | import CoreModule from 'src/core'; 6 | import Modeling from 'src/features/modeling'; 7 | 8 | 9 | describe('NameChangeBehavior', function() { 10 | 11 | describe('with existing variable', function() { 12 | 13 | beforeEach(bootstrapModeler(simpleStringEditXML, { 14 | modules: [ 15 | CoreModule, 16 | Modeling 17 | ], 18 | })); 19 | 20 | 21 | it('should update variable name when element name is changed', inject( 22 | function(modeling, viewer) { 23 | 24 | // given 25 | const decision = viewer.getDecision(); 26 | 27 | // when 28 | modeling.editDecisionName('foo'); 29 | 30 | // then 31 | const variable = decision.get('variable'); 32 | 33 | expect(variable.get('name')).to.equal('foo'); 34 | } 35 | )); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/features/textarea/TextareaSpec.js: -------------------------------------------------------------------------------- 1 | import { bootstrapViewer } from 'test/helper'; 2 | 3 | import { query as domQuery } from 'min-dom'; 4 | 5 | import TestContainer from 'mocha-test-container-support'; 6 | 7 | import literalExpressionXML from '../../literal-expression.dmn'; 8 | 9 | import CoreModule from 'src/core'; 10 | import TextareaModule 11 | from 'src/features/textarea'; 12 | 13 | 14 | describe('textarea', function() { 15 | 16 | beforeEach(bootstrapViewer(literalExpressionXML, { 17 | modules: [ 18 | CoreModule, 19 | TextareaModule 20 | ] 21 | })); 22 | 23 | let testContainer; 24 | 25 | beforeEach(function() { 26 | testContainer = TestContainer.get(this); 27 | }); 28 | 29 | 30 | it('should render', function() { 31 | 32 | // then 33 | const textarea = domQuery('.textarea', testContainer); 34 | 35 | expect(textarea).to.exist; 36 | expect(textarea.textContent).to.eql('calendar.getSeason(date)'); 37 | }); 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/spec/features/view-drd/MockViewer.js: -------------------------------------------------------------------------------- 1 | import Manager from 'dmn-js-shared/lib/base/Manager'; 2 | import View from 'dmn-js-shared/lib/base/View'; 3 | 4 | import Viewer from 'src/Viewer'; 5 | 6 | 7 | export default class MockViewer extends Manager { 8 | 9 | _getViewProviders() { 10 | 11 | return [ { 12 | id: 'literalExpression', 13 | constructor: Viewer, 14 | opens(element) { 15 | return ( 16 | element.$type === 'dmn:Decision' && 17 | element.decisionLogic && 18 | element.decisionLogic.$type === 'dmn:LiteralExpression' 19 | ); 20 | } 21 | }, { 22 | id: 'drd', 23 | constructor: View, 24 | opens: 'dmn:Definitions' 25 | } ]; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /packages/dmn-js-literal-expression/test/testBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /packages/dmn-js-shared/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json", 3 | "plugins": [ 4 | "inferno" 5 | ] 6 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js-shared/README.md: -------------------------------------------------------------------------------- 1 | # dmn-js-shared 2 | 3 | Shared components used within [dmn-js](https://github.com/bpmn-io/dmn-js). 4 | 5 | 6 | ## License 7 | 8 | Use under the terms of the [bpmn.io license](http://bpmn.io/license). -------------------------------------------------------------------------------- /packages/dmn-js-shared/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('./karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js-shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dmn-js-shared", 3 | "description": "Shared components used by dmn-js", 4 | "version": "17.2.1", 5 | "files": [ 6 | "assets", 7 | "lib" 8 | ], 9 | "scripts": { 10 | "test": "karma start", 11 | "build": "del-cli lib && babel -s --quiet -d lib src", 12 | "dev": "npm test -- --no-single-run --auto-watch", 13 | "prepublishOnly": "npm run build" 14 | }, 15 | "main": "./lib/index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/bpmn-io/dmn-js", 19 | "directory": "packages/dmn-js-shared" 20 | }, 21 | "license": "SEE LICENSE IN LICENSE", 22 | "devDependencies": { 23 | "@testing-library/dom": "^10.4.0", 24 | "inferno-test-utils": "~5.6.2" 25 | }, 26 | "dependencies": { 27 | "@bpmn-io/feel-editor": "^1.10.1", 28 | "diagram-js": "^15.2.0", 29 | "didi": "^10.2.2", 30 | "dmn-moddle": "^10.0.0", 31 | "ids": "^1.0.5", 32 | "inferno": "~5.6.3", 33 | "min-dash": "^4.2.2", 34 | "min-dom": "^4.2.1", 35 | "selection-ranges": "^3.0.2", 36 | "selection-update": "^0.1.2", 37 | "table-js": "^9.2.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/base/viewer/core/Renderer.js: -------------------------------------------------------------------------------- 1 | import { render } from 'inferno'; 2 | 3 | import ViewerComponent from './components/ViewerComponent'; 4 | 5 | export default class Renderer { 6 | 7 | constructor(changeSupport, components, config, eventBus, injector) { 8 | const { container } = config; 9 | 10 | this._container = container; 11 | 12 | eventBus.on('renderer.mount', () => { 13 | render(, container); 14 | }); 15 | 16 | eventBus.on('renderer.unmount', () => { 17 | render(null, container); 18 | }); 19 | } 20 | 21 | getContainer() { 22 | return this._container; 23 | } 24 | 25 | } 26 | 27 | Renderer.$inject = [ 28 | 'changeSupport', 29 | 'components', 30 | 'config.renderer', 31 | 'eventBus', 32 | 'injector' 33 | ]; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/base/viewer/core/components/ViewerComponent.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class ViewerComponent extends Component { 5 | 6 | constructor(props) { 7 | super(props); 8 | 9 | const injector = this._injector = props.injector; 10 | 11 | this._changeSupport = injector.get('changeSupport'); 12 | this._components = injector.get('components'); 13 | this._renderer = injector.get('renderer'); 14 | } 15 | 16 | getChildContext() { 17 | return { 18 | changeSupport: this._changeSupport, 19 | components: this._components, 20 | renderer: this._renderer, 21 | injector: this._injector 22 | }; 23 | } 24 | 25 | render() { 26 | const components = this._components.getComponents('viewer'); 27 | 28 | return ( 29 |
30 | { 31 | components && 32 | components.map((Component, index) => ) 33 | } 34 |
35 | ); 36 | } 37 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/base/viewer/core/index.js: -------------------------------------------------------------------------------- 1 | import ChangeSupport from './ChangeSupport'; 2 | import Components from './Components'; 3 | import EventBus from 'diagram-js/lib/core/EventBus'; 4 | import Renderer from './Renderer'; 5 | 6 | export default { 7 | __init__: [ 'changeSupport', 'components', 'renderer' ], 8 | changeSupport: [ 'type', ChangeSupport ], 9 | components: [ 'type', Components ], 10 | eventBus: [ 'type', EventBus ], 11 | renderer: [ 'type', Renderer ] 12 | }; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/components/Button.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class Button extends Component { 5 | constructor(props, context) { 6 | super(props, context); 7 | } 8 | 9 | onClick = (event) => { 10 | const { onClick } = this.props; 11 | 12 | if (typeof onClick !== 'function') { 13 | return; 14 | } 15 | 16 | onClick(event); 17 | }; 18 | 19 | onMouseDown = (event) => { 20 | const { onMouseDown } = this.props; 21 | 22 | if (typeof onMouseDown !== 'function') { 23 | return; 24 | } 25 | 26 | onMouseDown(event); 27 | }; 28 | 29 | onMouseUp = (event) => { 30 | const { onMouseUp } = this.props; 31 | 32 | if (typeof onMouseUp !== 'function') { 33 | return; 34 | } 35 | 36 | onMouseUp(event); 37 | }; 38 | 39 | render() { 40 | const { 41 | className 42 | } = this.props; 43 | 44 | return ( 45 | 54 | ); 55 | } 56 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/components/mixins/ComponentWithSlots.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * A simple slot extension, built upon the components service. 4 | * 5 | * @type {Object} 6 | */ 7 | const ComponentWithSlots = { 8 | 9 | slotFill(slotProps, DefaultFill) { 10 | 11 | const { 12 | type, 13 | context, 14 | ...props 15 | } = slotProps; 16 | 17 | const Fill = this.components.getComponent(type, context) || DefaultFill; 18 | 19 | if (Fill) { 20 | return ; 21 | } 22 | 23 | return null; 24 | }, 25 | 26 | slotFills(slotProps) { 27 | 28 | const { 29 | type, 30 | context, 31 | ...props 32 | } = slotProps; 33 | 34 | const fills = this.components.getComponents(type, context); 35 | 36 | return fills.map( 37 | Fill => 38 | ); 39 | } 40 | 41 | }; 42 | 43 | export default ComponentWithSlots; 44 | 45 | ComponentWithSlots.$inject = [ 'components' ]; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/components/mixins/index.js: -------------------------------------------------------------------------------- 1 | export { default as ComponentWithSlots } from './ComponentWithSlots'; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/features/data-types/DataTypes.js: -------------------------------------------------------------------------------- 1 | const DEFAULT_DATA_TYPES = [ 2 | 'string', 3 | 'boolean', 4 | 'number', 5 | 'date', 6 | 'time', 7 | 'dateTime', 8 | 'dayTimeDuration', 9 | 'yearMonthDuration', 10 | 'Any' 11 | ]; 12 | 13 | /** 14 | * Provide data types via config. 15 | * 16 | * @example 17 | * 18 | * // The data types will include multiple number types: integer, long, and double. 19 | * const editor = new DmnJS({ 20 | * common: { 21 | * dataTypes: [ 22 | * 'string', 23 | * 'boolean', 24 | * 'integer', 25 | * 'long', 26 | * 'double', 27 | * 'date' 28 | * ] 29 | * } 30 | * }) 31 | */ 32 | export default class DataTypes { 33 | 34 | /** 35 | * @param {string[]} configuredDataTypes 36 | */ 37 | constructor(configuredDataTypes) { 38 | this._dataTypes = configuredDataTypes || DEFAULT_DATA_TYPES; 39 | } 40 | 41 | /** 42 | * Get list of configured data types. 43 | * 44 | * @returns {string[]} 45 | */ 46 | getAll() { 47 | return this._dataTypes; 48 | } 49 | } 50 | 51 | DataTypes.$inject = [ 'config.dataTypes' ]; 52 | -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/features/data-types/index.js: -------------------------------------------------------------------------------- 1 | import DataTypes from './DataTypes'; 2 | 3 | export default { 4 | __init__: [ 'dataTypes' ], 5 | dataTypes: [ 'type', DataTypes ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/features/debounce-input/debounceInput.js: -------------------------------------------------------------------------------- 1 | import { 2 | debounce, 3 | isNumber 4 | } from 'min-dash'; 5 | 6 | const DEFAULT_DEBOUNCE_TIME = 300; 7 | 8 | export default function debounceInput(shouldDebounce) { 9 | return function _debounceInput(fn) { 10 | if (shouldDebounce !== false) { 11 | 12 | var debounceTime = 13 | isNumber(shouldDebounce) ? 14 | shouldDebounce : 15 | DEFAULT_DEBOUNCE_TIME; 16 | 17 | return debounce(fn, debounceTime); 18 | } else { 19 | return fn; 20 | } 21 | }; 22 | } 23 | 24 | debounceInput.$inject = [ 'config.debounceInput' ]; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/features/debounce-input/index.js: -------------------------------------------------------------------------------- 1 | import debounceInput from './debounceInput'; 2 | 3 | export default { 4 | debounceInput: [ 'factory', debounceInput ] 5 | }; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/features/expression-languages/index.js: -------------------------------------------------------------------------------- 1 | import ExpressionLanguages from './ExpressionLanguages'; 2 | 3 | export default { 4 | __init__: [ 'expressionLanguages' ], 5 | expressionLanguages: [ 'type', ExpressionLanguages ] 6 | }; -------------------------------------------------------------------------------- /packages/dmn-js-shared/src/util/DiUtil.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Does the definitions element contain graphical information? 3 | * 4 | * @param {ModdleElement} definitions 5 | * 6 | * @return {boolean} true, if the definitions contains graphical information 7 | */ 8 | export function containsDi(definitions) { 9 | return definitions.dmnDI && definitions.dmnDI.diagrams && definitions.dmnDI.diagrams[0]; 10 | } 11 | 12 | export function hasDi(element) { 13 | return !!element.di; 14 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | const allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/spec/base/drd-only.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/spec/components/DiContainer.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'inferno'; 2 | 3 | 4 | export default class DiContainer extends Component { 5 | 6 | getChildContext() { 7 | 8 | return { 9 | injector: this.props.injector 10 | }; 11 | 12 | } 13 | 14 | render() { 15 | return ( 16 |
17 | { this.props.children } 18 |
19 | ); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/testBundle.js: -------------------------------------------------------------------------------- 1 | const allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/util/EditorUtil.js: -------------------------------------------------------------------------------- 1 | import { query as domQuery } from 'min-dom'; 2 | 3 | export function queryEditor(baseSelector, container) { 4 | return domQuery(baseSelector + ' [contenteditable=true]', container); 5 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/util/InjectorUtil.js: -------------------------------------------------------------------------------- 1 | import { 2 | Injector 3 | } from 'didi'; 4 | 5 | 6 | function toModule(locals) { 7 | 8 | var module = {}; 9 | 10 | Object.keys(locals).forEach(function(k) { 11 | module[k] = [ 'value', locals[k] ]; 12 | }); 13 | 14 | return module; 15 | } 16 | 17 | export function createInjector(locals) { 18 | return new Injector([ toModule(locals) ]); 19 | } -------------------------------------------------------------------------------- /packages/dmn-js-shared/test/util/TranslateUtil.js: -------------------------------------------------------------------------------- 1 | const customTranslate = (template, replacements) => { 2 | replacements = replacements || {}; 3 | 4 | // Translate 5 | template = `tr(${template})`; 6 | 7 | // Replace 8 | return template.replace(/{([^}]+)}/g, function(_, key) { 9 | return replacements[key] && `tr(${replacements[key]})` || '{' + key + '}'; 10 | }); 11 | }; 12 | 13 | export const translateModule = { 14 | translate: [ 'value', customTranslate ], 15 | }; -------------------------------------------------------------------------------- /packages/dmn-js/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../babel.config.json" 3 | } -------------------------------------------------------------------------------- /packages/dmn-js/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /packages/dmn-js/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var createConfig = require('dmn-js-shared/karma.base'); 4 | 5 | var path = require('path'); 6 | 7 | module.exports = createConfig(path.resolve(__dirname)); -------------------------------------------------------------------------------- /packages/dmn-js/resources/banner-min.txt: -------------------------------------------------------------------------------- 1 | /*! dmn-js - {{ name }} v{{ version }} | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */ -------------------------------------------------------------------------------- /packages/dmn-js/resources/banner.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * dmn-js - {{ name }} v{{ version }} 3 | * 4 | * Copyright (c) 2014-present, camunda Services GmbH 5 | * 6 | * Released under the bpmn.io license 7 | * http://bpmn.io/license 8 | * 9 | * Source Code: https://github.com/bpmn-io/dmn-js 10 | * 11 | * Date: {{ date }} 12 | */ -------------------------------------------------------------------------------- /packages/dmn-js/src/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Viewer'; -------------------------------------------------------------------------------- /packages/dmn-js/test/coverageBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); 4 | 5 | var allSources = require.context('../src', true, /.*\.js$/); 6 | 7 | allSources.keys().forEach(allSources); -------------------------------------------------------------------------------- /packages/dmn-js/test/distro/dmn-modeler.js: -------------------------------------------------------------------------------- 1 | describe('dmn-modeler', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | const DmnJS = window.DmnJS; 6 | 7 | // then 8 | expect(DmnJS).to.exist; 9 | expect(new DmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should import initial diagram', async function() { 14 | 15 | const DmnJS = window.DmnJS; 16 | 17 | // then 18 | /* global testImport */ 19 | await testImport(DmnJS); 20 | }); 21 | 22 | 23 | it('should open each view', async function() { 24 | 25 | const DmnJS = window.DmnJS; 26 | 27 | // then 28 | /* global testAllViews */ 29 | await testAllViews(DmnJS); 30 | }); 31 | }); -------------------------------------------------------------------------------- /packages/dmn-js/test/distro/dmn-navigated-viewer.js: -------------------------------------------------------------------------------- 1 | describe('dmn-navigated-viewer', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | const DmnJS = window.DmnJS; 6 | 7 | // then 8 | expect(DmnJS).to.exist; 9 | expect(new DmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should import initial diagram', async function() { 14 | 15 | const DmnJS = window.DmnJS; 16 | 17 | // then 18 | /* global testImport */ 19 | await testImport(DmnJS); 20 | }); 21 | 22 | 23 | it('should open each view', async function() { 24 | 25 | const DmnJS = window.DmnJS; 26 | 27 | // then 28 | /* global testAllViews */ 29 | await testAllViews(DmnJS); 30 | }); 31 | }); -------------------------------------------------------------------------------- /packages/dmn-js/test/distro/dmn-viewer.js: -------------------------------------------------------------------------------- 1 | describe('dmn-viewer', function() { 2 | 3 | it('should expose globals', function() { 4 | 5 | const DmnJS = window.DmnJS; 6 | 7 | // then 8 | expect(DmnJS).to.exist; 9 | expect(new DmnJS()).to.exist; 10 | }); 11 | 12 | 13 | it('should import initial diagram', async function() { 14 | 15 | const DmnJS = window.DmnJS; 16 | 17 | // then 18 | /* global testImport */ 19 | await testImport(DmnJS); 20 | }); 21 | 22 | 23 | it('should open each view', async function() { 24 | 25 | const DmnJS = window.DmnJS; 26 | 27 | // then 28 | /* global testAllViews */ 29 | await testAllViews(DmnJS); 30 | }); 31 | }); -------------------------------------------------------------------------------- /packages/dmn-js/test/helper/index.js: -------------------------------------------------------------------------------- 1 | import axe from 'axe-core'; 2 | 3 | const DEFAULT_AXE_TAGS = [ 'wcag21a', 'wcag21aa' ]; 4 | 5 | export function insertCSS(name, css) { 6 | if (document.querySelector('[data-css-file="' + name + '"]')) { 7 | return; 8 | } 9 | 10 | var head = document.head || document.getElementsByTagName('head')[0], 11 | style = document.createElement('style'); 12 | style.setAttribute('data-css-file', name); 13 | 14 | style.type = 'text/css'; 15 | if (style.styleSheet) { 16 | style.styleSheet.cssText = css; 17 | } else { 18 | style.appendChild(document.createTextNode(css)); 19 | } 20 | 21 | head.appendChild(style); 22 | } 23 | 24 | /** 25 | * Verify no accessibility rules violations in the container. 26 | * 27 | * @param {Element} container 28 | */ 29 | export async function expectToBeAccessible(container) { 30 | 31 | // when 32 | const results = await axe.run(container, { 33 | runOnly: { 34 | type: 'tag', 35 | values: DEFAULT_AXE_TAGS 36 | } 37 | }); 38 | 39 | // then 40 | expect(results.passes).to.be.not.empty; 41 | expect(results.violations).to.be.empty; 42 | } 43 | -------------------------------------------------------------------------------- /packages/dmn-js/test/spec/drd-only.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/dmn-js/test/spec/no-displayable-contents.dmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | Diagram without displayable contents 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/dmn-js/test/testBundle.js: -------------------------------------------------------------------------------- 1 | var allTests = require.context('.', true, /.*Spec\.js$/); 2 | 3 | allTests.keys().forEach(allTests); -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "github>bpmn-io/renovate-config:recommended" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /resources/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tasks/stages/await-published: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | i=0 7 | tries=9 8 | pkg="$PKG" 9 | until [ $i -gt $tries ] 10 | do 11 | echo "Checking for $pkg in npm registry ($((i+1))/$((tries+1)))" 12 | info=$(npm info $pkg 2> /dev/null || echo "FAILED") 13 | if [[ "$info" != "FAILED" ]]; then 14 | echo "Found." 15 | exit 0 16 | fi 17 | 18 | i=$(($i+1)) 19 | 20 | sleep 5s 21 | done 22 | 23 | echo "Not found after $i tries. Giving up." 24 | exit 1; -------------------------------------------------------------------------------- /tasks/stages/update-demo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # bumps dmn-js dependencies in bpmn-io-demo 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | CLONE_DIR="$WORKDIR/bpmn-io-demo" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/$BPMN_IO_DEMO_ENDPOINT.git" "$CLONE_DIR" 16 | 17 | cd "$CLONE_DIR" 18 | 19 | npm install --save dmn-js@$TAG diagram-js@latest 20 | 21 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 22 | 23 | git config user.email "$BPMN_IO_EMAIL" 24 | git config user.name "$BPMN_IO_USERNAME" 25 | git config push.default simple 26 | 27 | git add -A 28 | git commit -m "deps: bump to dmn-js@$TAG" 29 | git tag "dmn-js-$TAG" 30 | git push -q &2>/dev/null 31 | git push --tags -q &2>/dev/null 32 | else 33 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 34 | fi 35 | 36 | cd "$PWD" -------------------------------------------------------------------------------- /tasks/stages/update-examples: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # update dmn-js version in the project 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | EXAMPLES_DIR="$WORKDIR/dmn-js-examples" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/bpmn-io/dmn-js-examples.git" "$EXAMPLES_DIR" 16 | 17 | cd "$EXAMPLES_DIR" 18 | 19 | TOOLKIT_VERSION="${TAG:1}" 20 | echo "Updating to dmn-js@$TOOLKIT_VERSION" 21 | 22 | # update links to static resources 23 | sed -i -E "s#/dmn-js@[^/]+/#/dmn-js@$TOOLKIT_VERSION/#" **/*.{html,md} 24 | 25 | # update via npm if possible 26 | for dir in $(ls -d */) 27 | do 28 | if [[ -f "$dir/package.json" ]]; then 29 | (cd $dir && npm install "dmn-js@$TOOLKIT_VERSION") 30 | fi 31 | done 32 | 33 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 34 | 35 | git config user.email "$BPMN_IO_EMAIL" 36 | git config user.name "$BPMN_IO_USERNAME" 37 | git config push.default simple 38 | 39 | # add all resources 40 | git add -A 41 | git commit -m "deps: bump to dmn-js@$TAG" 42 | git tag "$TAG" 43 | git push -q &2>/dev/null 44 | git push --tags -q &2>/dev/null 45 | else 46 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 47 | fi 48 | 49 | cd "$PWD" -------------------------------------------------------------------------------- /tasks/stages/update-website: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | shopt -s inherit_errexit nullglob 5 | 6 | # update dmn-js version in the project 7 | 8 | PWD="$(pwd)" 9 | WORKDIR="$(pwd)/tmp" 10 | CLONE_DIR="$WORKDIR/bpmn.io" 11 | 12 | # create work dir 13 | mkdir -p "$WORKDIR" 14 | 15 | git clone --depth=1 "https://$BPMN_IO_TOKEN@github.com/bpmn-io/bpmn.io.git" "$CLONE_DIR" 16 | 17 | cd "$CLONE_DIR" 18 | 19 | PUBLISHED=`date +"%F %H:%M"` 20 | 21 | echo "Updating toolkit version to version=$TAG, published=$PUBLISHED on bpmn.io" 22 | 23 | cat src/data/site.yml | \ 24 | tr "\r?\n" "\r" | \ 25 | sed -e "s#dmnjs:\r version: [^\r]*\r published: [^\r]*\r#dmnjs:\r version: $TAG\r published: $PUBLISHED\r#" | \ 26 | tr "\r" "\n" > src/data/site.yml_new 27 | 28 | mv -f src/data/site.yml_new src/data/site.yml 29 | 30 | if [[ "x$SKIP_COMMIT" = "x" ]]; then 31 | 32 | git config user.email "$BPMN_IO_EMAIL" 33 | git config user.name "$BPMN_IO_USERNAME" 34 | git config push.default simple 35 | 36 | # add all resources 37 | git add -A 38 | git commit -m "deps: bump to dmn-js@$TAG" 39 | git push -q &2>/dev/null 40 | else 41 | echo "Skipping commit (SKIP_COMMIT=$SKIP_COMMIT)" 42 | fi 43 | 44 | cd "$PWD" --------------------------------------------------------------------------------