@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.
- package/.babelrc +3 -0
- package/CHANGELOG.md +119 -0
- package/LICENSE +23 -0
- package/README.md +107 -2
- package/dist/assets/cmmn-font/css/cmmn-codes.css +41 -0
- package/dist/assets/cmmn-font/css/cmmn-embedded.css +94 -0
- package/dist/assets/cmmn-font/css/cmmn.css +97 -0
- package/dist/assets/cmmn-font/font/cmmn.eot +0 -0
- package/dist/assets/cmmn-font/font/cmmn.svg +90 -0
- package/dist/assets/cmmn-font/font/cmmn.ttf +0 -0
- package/dist/assets/cmmn-font/font/cmmn.woff +0 -0
- package/dist/assets/cmmn-font/font/cmmn.woff2 +0 -0
- package/dist/assets/diagram-js.css +713 -0
- package/dist/cmmn-modeler.development.js +44817 -0
- package/dist/cmmn-modeler.production.min.js +2 -0
- package/dist/cmmn-navigated-viewer.development.js +18131 -0
- package/dist/cmmn-navigated-viewer.production.min.js +2 -0
- package/dist/cmmn-viewer.development.js +17599 -0
- package/dist/cmmn-viewer.production.min.js +2 -0
- package/index.js +1 -0
- package/lib/Modeler.js +222 -0
- package/lib/NavigatedViewer.js +28 -0
- package/lib/Viewer.js +489 -0
- package/lib/core/ItemRegistry.js +316 -0
- package/lib/core/index.js +7 -0
- package/lib/draw/CmmnRenderer.js +1235 -0
- package/lib/draw/PathMap.js +335 -0
- package/lib/draw/index.js +5 -0
- package/lib/features/auto-resize/CmmnAutoResizeProvider.js +57 -0
- package/lib/features/auto-resize/index.js +7 -0
- package/lib/features/context-pad/ContextPadProvider.js +240 -0
- package/lib/features/context-pad/index.js +11 -0
- package/lib/features/editor-actions/CmmnEditorActions.js +105 -0
- package/lib/features/editor-actions/index.js +10 -0
- package/lib/features/keyboard/CmmnKeyboardBindings.js +159 -0
- package/lib/features/keyboard/index.js +7 -0
- package/lib/features/label-editing/LabelEditingProvider.js +221 -0
- package/lib/features/label-editing/LabelUtil.js +95 -0
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +63 -0
- package/lib/features/label-editing/index.js +9 -0
- package/lib/features/modeling/CmmnFactory.js +166 -0
- package/lib/features/modeling/CmmnLayouter.js +49 -0
- package/lib/features/modeling/CmmnUpdater.js +511 -0
- package/lib/features/modeling/ElementFactory.js +215 -0
- package/lib/features/modeling/Modeling.js +185 -0
- package/lib/features/modeling/behavior/AttachCriterionBehavior.js +58 -0
- package/lib/features/modeling/behavior/CaseFileItemUpdater.js +324 -0
- package/lib/features/modeling/behavior/LabelBehavior.js +139 -0
- package/lib/features/modeling/behavior/PlanItemDefinitionUpdater.js +449 -0
- package/lib/features/modeling/behavior/PlanningTableUpdater.js +620 -0
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +320 -0
- package/lib/features/modeling/behavior/ReplaceElementBehavior.js +395 -0
- package/lib/features/modeling/behavior/ResizeCasePlanModelBehavior.js +108 -0
- package/lib/features/modeling/behavior/SentryUpdater.js +678 -0
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +28 -0
- package/lib/features/modeling/behavior/index.js +24 -0
- package/lib/features/modeling/cmd/AppendShapeHandler.js +52 -0
- package/lib/features/modeling/cmd/IdClaimHandler.js +38 -0
- package/lib/features/modeling/cmd/ReconnectConnectionHandler.js +57 -0
- package/lib/features/modeling/cmd/ReplaceShapeHandler.js +46 -0
- package/lib/features/modeling/cmd/UpdateControlsHandler.js +221 -0
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +240 -0
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +94 -0
- package/lib/features/modeling/index.js +20 -0
- package/lib/features/modeling/util/ModelingUtil.js +138 -0
- package/lib/features/modeling/util/PlanItemDefinitionUtil.js +183 -0
- package/lib/features/ordering/CmmnOrderingProvider.js +146 -0
- package/lib/features/ordering/index.js +4 -0
- package/lib/features/outline/Outline.js +47 -0
- package/lib/features/outline/index.js +6 -0
- package/lib/features/palette/PaletteProvider.js +171 -0
- package/lib/features/palette/index.js +12 -0
- package/lib/features/popup-menu/ReplaceMenuProvider.js +448 -0
- package/lib/features/popup-menu/index.js +4 -0
- package/lib/features/replace/CmmnReplace.js +355 -0
- package/lib/features/replace/ReplaceOptions.js +241 -0
- package/lib/features/replace/index.js +8 -0
- package/lib/features/replace-preview/CmmnReplacePreview.js +247 -0
- package/lib/features/replace-preview/index.js +7 -0
- package/lib/features/rules/CmmnRules.js +1040 -0
- package/lib/features/rules/index.js +7 -0
- package/lib/features/search/CmmnSearchProvider.js +129 -0
- package/lib/features/search/index.js +7 -0
- package/lib/features/snapping/CmmnConnectSnapping.js +110 -0
- package/lib/features/snapping/CmmnCreateMoveSnapping.js +148 -0
- package/lib/features/snapping/CmmnResizeSnapping.js +42 -0
- package/lib/features/snapping/CmmnSnappingUtil.js +76 -0
- package/lib/features/snapping/index.js +17 -0
- package/lib/import/CmmnImporter.js +251 -0
- package/lib/import/CmmnTreeWalker.js +410 -0
- package/lib/import/Importer.js +73 -0
- package/lib/import/Util.js +9 -0
- package/lib/import/index.js +3 -0
- package/lib/util/DiUtil.js +39 -0
- package/lib/util/LabelUtil.js +124 -0
- package/lib/util/ModelUtil.js +257 -0
- package/lib/util/PoweredByUtil.js +91 -0
- package/package.json +88 -4
- package/test/helper/index.js +231 -0
- package/test/util/KeyEvents.js +23 -0
- package/test/util/MockEvents.js +55 -0
- package/test/util/custom-rules/CustomRules.js +19 -0
- 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;
|