@jylups/cmmn-js 0.0.0-stage → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/.babelrc +3 -0
  2. package/CHANGELOG.md +119 -0
  3. package/LICENSE +23 -0
  4. package/README.md +107 -2
  5. package/dist/assets/cmmn-font/css/cmmn-codes.css +41 -0
  6. package/dist/assets/cmmn-font/css/cmmn-embedded.css +94 -0
  7. package/dist/assets/cmmn-font/css/cmmn.css +97 -0
  8. package/dist/assets/cmmn-font/font/cmmn.eot +0 -0
  9. package/dist/assets/cmmn-font/font/cmmn.svg +90 -0
  10. package/dist/assets/cmmn-font/font/cmmn.ttf +0 -0
  11. package/dist/assets/cmmn-font/font/cmmn.woff +0 -0
  12. package/dist/assets/cmmn-font/font/cmmn.woff2 +0 -0
  13. package/dist/assets/diagram-js.css +713 -0
  14. package/dist/cmmn-modeler.development.js +44817 -0
  15. package/dist/cmmn-modeler.production.min.js +2 -0
  16. package/dist/cmmn-navigated-viewer.development.js +18131 -0
  17. package/dist/cmmn-navigated-viewer.production.min.js +2 -0
  18. package/dist/cmmn-viewer.development.js +17599 -0
  19. package/dist/cmmn-viewer.production.min.js +2 -0
  20. package/index.js +1 -0
  21. package/lib/Modeler.js +222 -0
  22. package/lib/NavigatedViewer.js +28 -0
  23. package/lib/Viewer.js +489 -0
  24. package/lib/core/ItemRegistry.js +316 -0
  25. package/lib/core/index.js +7 -0
  26. package/lib/draw/CmmnRenderer.js +1235 -0
  27. package/lib/draw/PathMap.js +335 -0
  28. package/lib/draw/index.js +5 -0
  29. package/lib/features/auto-resize/CmmnAutoResizeProvider.js +57 -0
  30. package/lib/features/auto-resize/index.js +7 -0
  31. package/lib/features/context-pad/ContextPadProvider.js +240 -0
  32. package/lib/features/context-pad/index.js +11 -0
  33. package/lib/features/editor-actions/CmmnEditorActions.js +105 -0
  34. package/lib/features/editor-actions/index.js +10 -0
  35. package/lib/features/keyboard/CmmnKeyboardBindings.js +159 -0
  36. package/lib/features/keyboard/index.js +7 -0
  37. package/lib/features/label-editing/LabelEditingProvider.js +221 -0
  38. package/lib/features/label-editing/LabelUtil.js +95 -0
  39. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +63 -0
  40. package/lib/features/label-editing/index.js +9 -0
  41. package/lib/features/modeling/CmmnFactory.js +166 -0
  42. package/lib/features/modeling/CmmnLayouter.js +49 -0
  43. package/lib/features/modeling/CmmnUpdater.js +511 -0
  44. package/lib/features/modeling/ElementFactory.js +215 -0
  45. package/lib/features/modeling/Modeling.js +185 -0
  46. package/lib/features/modeling/behavior/AttachCriterionBehavior.js +58 -0
  47. package/lib/features/modeling/behavior/CaseFileItemUpdater.js +324 -0
  48. package/lib/features/modeling/behavior/LabelBehavior.js +139 -0
  49. package/lib/features/modeling/behavior/PlanItemDefinitionUpdater.js +449 -0
  50. package/lib/features/modeling/behavior/PlanningTableUpdater.js +620 -0
  51. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +320 -0
  52. package/lib/features/modeling/behavior/ReplaceElementBehavior.js +395 -0
  53. package/lib/features/modeling/behavior/ResizeCasePlanModelBehavior.js +108 -0
  54. package/lib/features/modeling/behavior/SentryUpdater.js +678 -0
  55. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +28 -0
  56. package/lib/features/modeling/behavior/index.js +24 -0
  57. package/lib/features/modeling/cmd/AppendShapeHandler.js +52 -0
  58. package/lib/features/modeling/cmd/IdClaimHandler.js +38 -0
  59. package/lib/features/modeling/cmd/ReconnectConnectionHandler.js +57 -0
  60. package/lib/features/modeling/cmd/ReplaceShapeHandler.js +46 -0
  61. package/lib/features/modeling/cmd/UpdateControlsHandler.js +221 -0
  62. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +240 -0
  63. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +94 -0
  64. package/lib/features/modeling/index.js +20 -0
  65. package/lib/features/modeling/util/ModelingUtil.js +138 -0
  66. package/lib/features/modeling/util/PlanItemDefinitionUtil.js +183 -0
  67. package/lib/features/ordering/CmmnOrderingProvider.js +146 -0
  68. package/lib/features/ordering/index.js +4 -0
  69. package/lib/features/outline/Outline.js +47 -0
  70. package/lib/features/outline/index.js +6 -0
  71. package/lib/features/palette/PaletteProvider.js +171 -0
  72. package/lib/features/palette/index.js +12 -0
  73. package/lib/features/popup-menu/ReplaceMenuProvider.js +448 -0
  74. package/lib/features/popup-menu/index.js +4 -0
  75. package/lib/features/replace/CmmnReplace.js +355 -0
  76. package/lib/features/replace/ReplaceOptions.js +241 -0
  77. package/lib/features/replace/index.js +8 -0
  78. package/lib/features/replace-preview/CmmnReplacePreview.js +247 -0
  79. package/lib/features/replace-preview/index.js +7 -0
  80. package/lib/features/rules/CmmnRules.js +1040 -0
  81. package/lib/features/rules/index.js +7 -0
  82. package/lib/features/search/CmmnSearchProvider.js +129 -0
  83. package/lib/features/search/index.js +7 -0
  84. package/lib/features/snapping/CmmnConnectSnapping.js +110 -0
  85. package/lib/features/snapping/CmmnCreateMoveSnapping.js +148 -0
  86. package/lib/features/snapping/CmmnResizeSnapping.js +42 -0
  87. package/lib/features/snapping/CmmnSnappingUtil.js +76 -0
  88. package/lib/features/snapping/index.js +17 -0
  89. package/lib/import/CmmnImporter.js +251 -0
  90. package/lib/import/CmmnTreeWalker.js +410 -0
  91. package/lib/import/Importer.js +73 -0
  92. package/lib/import/Util.js +9 -0
  93. package/lib/import/index.js +3 -0
  94. package/lib/util/DiUtil.js +39 -0
  95. package/lib/util/LabelUtil.js +124 -0
  96. package/lib/util/ModelUtil.js +257 -0
  97. package/lib/util/PoweredByUtil.js +91 -0
  98. package/package.json +88 -4
  99. package/test/helper/index.js +231 -0
  100. package/test/util/KeyEvents.js +23 -0
  101. package/test/util/MockEvents.js +55 -0
  102. package/test/util/custom-rules/CustomRules.js +19 -0
  103. package/test/util/custom-rules/index.js +4 -0
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ var ModelUtil = require('../../../util/ModelUtil');
4
+
5
+ var is = ModelUtil.is,
6
+ getBusinessObject = ModelUtil.getBusinessObject,
7
+ isCasePlanModel = ModelUtil.isCasePlanModel;
8
+
9
+ var filter = require('min-dash').filter;
10
+ var ResizeUtil = require('diagram-js/lib/features/resize/ResizeUtil');
11
+ var getBBox = require('diagram-js/lib/util/Elements').getBBox;
12
+
13
+ var SLIGHTLY_HIGHER_PRIORITY = 1001;
14
+
15
+ var DEFAULT_MIN_WIDTH = 10;
16
+
17
+ /**
18
+ * Computes the minimum resize box.
19
+ *
20
+ * Note: it is slightly different than
21
+ * diagram-js/lib/features/resize/Resize#computeMinResizeBox
22
+ */
23
+ function computeMinResizeBox(context) {
24
+ var shape = context.shape,
25
+ direction = context.direction,
26
+ minDimensions,
27
+ childrenBounds;
28
+
29
+ minDimensions = context.minDimensions || {
30
+ width: DEFAULT_MIN_WIDTH,
31
+ height: DEFAULT_MIN_WIDTH
32
+ };
33
+
34
+ // get children bounds
35
+ childrenBounds = computeChildrenBBox(shape, context.childrenBoxPadding);
36
+
37
+ // get correct minimum bounds from given resize direction
38
+ // basically ensures that the minBounds is max(childrenBounds, minDimensions)
39
+ return ResizeUtil.getMinResizeBounds(direction, shape, minDimensions, childrenBounds);
40
+ }
41
+
42
+ /**
43
+ * Computes the bbox of the children.
44
+ *
45
+ * It first determine all relevant children,
46
+ * then it computes the size of the bbox.
47
+ */
48
+ function computeChildrenBBox(shape, padding) {
49
+ // grab all the children that are part of the
50
+ // parents children box
51
+ var elements = filter(shape.children, function(element) {
52
+ return isBBoxChild(shape, element);
53
+ });
54
+
55
+ if (elements.length) {
56
+ return ResizeUtil.addPadding(getBBox(elements), padding);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Returns true, if the given element does
62
+ * have any waypoints, is not a label or an
63
+ * exit criterian attached to the given shape.
64
+ */
65
+ function isBBoxChild(shape, element) {
66
+
67
+ // exclude connections
68
+ if (element.waypoints) {
69
+ return false;
70
+ }
71
+
72
+ // exclude labels
73
+ if (element.type === 'label') {
74
+ return false;
75
+ }
76
+
77
+ if (is(element, 'cmmn:ExitCriterion')) {
78
+ var bo = getBusinessObject(shape);
79
+ var exitCriteria = bo.get('exitCriteria');
80
+ var exitCriterion = getBusinessObject(element);
81
+ if (exitCriteria.indexOf(exitCriterion) >= 0) {
82
+ return false;
83
+ }
84
+ }
85
+
86
+ return true;
87
+ }
88
+
89
+ /**
90
+ * Computes the minimum resize box by excluding
91
+ * attached exit criteria to the case plan model.
92
+ */
93
+ function ResizeCasePlanModelBehavior(eventBus, modeling) {
94
+
95
+ eventBus.on('resize.start', SLIGHTLY_HIGHER_PRIORITY, function(event) {
96
+ var context = event.context,
97
+ shape = context.shape;
98
+
99
+ if (isCasePlanModel(shape)) {
100
+ context.minBounds = computeMinResizeBox(context);
101
+ }
102
+ });
103
+
104
+ }
105
+
106
+ ResizeCasePlanModelBehavior.$inject = [ 'eventBus', 'modeling' ];
107
+
108
+ module.exports = ResizeCasePlanModelBehavior;