@bpmn-io/form-js-editor 0.9.6 → 0.9.8
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/dist/index.cjs +83 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +83 -56
- package/dist/index.es.js.map +1 -1
- package/dist/types/FormEditor.d.ts +155 -155
- package/dist/types/core/Debounce.d.ts +10 -10
- package/dist/types/core/EventBus.d.ts +1 -1
- package/dist/types/core/FieldFactory.d.ts +18 -18
- package/dist/types/core/FormFieldRegistry.d.ts +19 -19
- package/dist/types/core/index.d.ts +17 -17
- package/dist/types/features/editor-actions/FormEditorActions.d.ts +8 -8
- package/dist/types/features/editor-actions/index.d.ts +6 -6
- package/dist/types/features/keyboard/FormEditorKeyboardBindings.d.ts +8 -8
- package/dist/types/features/keyboard/index.d.ts +7 -7
- package/dist/types/features/modeling/Modeling.d.ts +34 -34
- package/dist/types/features/modeling/behavior/IdBehavior.d.ts +7 -7
- package/dist/types/features/modeling/behavior/KeyBehavior.d.ts +7 -7
- package/dist/types/features/modeling/behavior/index.d.ts +8 -8
- package/dist/types/features/modeling/cmd/AddFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/EditFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/MoveFormFieldHandler.d.ts +17 -17
- package/dist/types/features/modeling/cmd/RemoveFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/UpdateIdClaimHandler.d.ts +14 -14
- package/dist/types/features/modeling/cmd/UpdateKeyClaimHandler.d.ts +14 -14
- package/dist/types/features/modeling/cmd/Util.d.ts +4 -4
- package/dist/types/features/modeling/index.d.ts +7 -7
- package/dist/types/features/palette/PaletteRenderer.d.ts +33 -33
- package/dist/types/features/palette/components/Palette.d.ts +1 -1
- package/dist/types/features/palette/index.d.ts +5 -5
- package/dist/types/features/properties-panel/PropertiesPanel.d.ts +1 -1
- package/dist/types/features/properties-panel/PropertiesPanelHeaderProvider.d.ts +5 -5
- package/dist/types/features/properties-panel/PropertiesPanelPlaceholderProvider.d.ts +8 -8
- package/dist/types/features/properties-panel/PropertiesPanelRenderer.d.ts +37 -37
- package/dist/types/features/properties-panel/Util.d.ts +7 -7
- package/dist/types/features/properties-panel/context/FormPropertiesPanelContext.d.ts +11 -11
- package/dist/types/features/properties-panel/context/index.d.ts +1 -1
- package/dist/types/features/properties-panel/entries/ActionEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ColumnsEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/CustomValueEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/DefaultValueEntry.d.ts +1 -1
- package/dist/types/features/properties-panel/entries/DescriptionEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/DisabledEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/IdEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/InputKeyValuesSourceEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/KeyEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/LabelEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/StaticValuesSourceEntry.d.ts +5 -4
- package/dist/types/features/properties-panel/entries/TextEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ValueEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/ValuesSourceSelectEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ValuesSourceUtil.d.ts +15 -15
- package/dist/types/features/properties-panel/entries/index.d.ts +14 -14
- package/dist/types/features/properties-panel/groups/CustomValuesGroup.d.ts +31 -31
- package/dist/types/features/properties-panel/groups/GeneralGroup.d.ts +5 -5
- package/dist/types/features/properties-panel/groups/ValidationGroup.d.ts +14 -14
- package/dist/types/features/properties-panel/groups/ValuesGroups.d.ts +1 -1
- package/dist/types/features/properties-panel/groups/index.d.ts +4 -4
- package/dist/types/features/properties-panel/hooks/index.d.ts +1 -1
- package/dist/types/features/properties-panel/hooks/usePropertiesPanelService.d.ts +1 -1
- package/dist/types/features/properties-panel/icons/index.d.ts +1 -1
- package/dist/types/features/properties-panel/index.d.ts +6 -6
- package/dist/types/features/selection/Selection.d.ts +14 -14
- package/dist/types/features/selection/SelectionBehavior.d.ts +7 -7
- package/dist/types/features/selection/index.d.ts +8 -8
- package/dist/types/import/Importer.d.ts +51 -51
- package/dist/types/import/index.d.ts +5 -5
- package/dist/types/index.d.ts +15 -15
- package/dist/types/render/Renderer.d.ts +26 -26
- package/dist/types/render/components/FormEditor.d.ts +1 -1
- package/dist/types/render/components/icons/index.d.ts +13 -13
- package/dist/types/render/context/DragAndDropContext.d.ts +4 -4
- package/dist/types/render/context/FormEditorContext.d.ts +11 -11
- package/dist/types/render/context/index.d.ts +2 -2
- package/dist/types/render/hooks/useService.d.ts +1 -1
- package/dist/types/render/index.d.ts +8 -8
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1425,7 +1425,10 @@ EditorActions.prototype._registerDefaultActions = function (injector) {
|
|
|
1425
1425
|
if (copyPaste && selection) {
|
|
1426
1426
|
this.register('copy', function () {
|
|
1427
1427
|
var selectedElements = selection.get();
|
|
1428
|
-
|
|
1428
|
+
|
|
1429
|
+
if (selectedElements.length) {
|
|
1430
|
+
return copyPaste.copy(selectedElements);
|
|
1431
|
+
}
|
|
1429
1432
|
});
|
|
1430
1433
|
}
|
|
1431
1434
|
|
|
@@ -1655,6 +1658,14 @@ var EditorActionsModule = {
|
|
|
1655
1658
|
editorActions: ['type', FormEditorActions]
|
|
1656
1659
|
};
|
|
1657
1660
|
|
|
1661
|
+
var KEYCODE_C = 67;
|
|
1662
|
+
var KEYCODE_V = 86;
|
|
1663
|
+
var KEYCODE_Y$1 = 89;
|
|
1664
|
+
var KEYCODE_Z$1 = 90;
|
|
1665
|
+
var KEYS_COPY = ['c', 'C', KEYCODE_C];
|
|
1666
|
+
var KEYS_PASTE = ['v', 'V', KEYCODE_V];
|
|
1667
|
+
var KEYS_REDO$1 = ['y', 'Y', KEYCODE_Y$1];
|
|
1668
|
+
var KEYS_UNDO$1 = ['z', 'Z', KEYCODE_Z$1];
|
|
1658
1669
|
/**
|
|
1659
1670
|
* Returns true if event was triggered with any modifier
|
|
1660
1671
|
* @param {KeyboardEvent} event
|
|
@@ -1694,6 +1705,18 @@ function isKey(keys, event) {
|
|
|
1694
1705
|
function isShift(event) {
|
|
1695
1706
|
return event.shiftKey;
|
|
1696
1707
|
}
|
|
1708
|
+
function isCopy(event) {
|
|
1709
|
+
return isCmd(event) && isKey(KEYS_COPY, event);
|
|
1710
|
+
}
|
|
1711
|
+
function isPaste(event) {
|
|
1712
|
+
return isCmd(event) && isKey(KEYS_PASTE, event);
|
|
1713
|
+
}
|
|
1714
|
+
function isUndo(event) {
|
|
1715
|
+
return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO$1, event);
|
|
1716
|
+
}
|
|
1717
|
+
function isRedo(event) {
|
|
1718
|
+
return isCmd(event) && (isKey(KEYS_REDO$1, event) || isKey(KEYS_UNDO$1, event) && isShift(event));
|
|
1719
|
+
}
|
|
1697
1720
|
|
|
1698
1721
|
var KEYDOWN_EVENT = 'keyboard.keydown',
|
|
1699
1722
|
KEYUP_EVENT = 'keyboard.keyup';
|
|
@@ -1786,7 +1809,7 @@ Keyboard.prototype._isModifiedKeyIgnored = function (event) {
|
|
|
1786
1809
|
|
|
1787
1810
|
var allowedModifiers = this._getAllowedModifiers(event.target);
|
|
1788
1811
|
|
|
1789
|
-
return
|
|
1812
|
+
return allowedModifiers.indexOf(event.key) === -1;
|
|
1790
1813
|
};
|
|
1791
1814
|
|
|
1792
1815
|
Keyboard.prototype._getAllowedModifiers = function (element) {
|
|
@@ -1868,12 +1891,8 @@ function isInput(target) {
|
|
|
1868
1891
|
}
|
|
1869
1892
|
|
|
1870
1893
|
var LOW_PRIORITY$1 = 500;
|
|
1871
|
-
var KEYCODE_C = 67;
|
|
1872
|
-
var KEYCODE_V = 86;
|
|
1873
1894
|
var KEYCODE_Y = 89;
|
|
1874
1895
|
var KEYCODE_Z = 90;
|
|
1875
|
-
var KEYS_COPY = ['c', 'C', KEYCODE_C];
|
|
1876
|
-
var KEYS_PASTE = ['v', 'V', KEYCODE_V];
|
|
1877
1896
|
var KEYS_REDO = ['y', 'Y', KEYCODE_Y];
|
|
1878
1897
|
var KEYS_UNDO = ['z', 'Z', KEYCODE_Z];
|
|
1879
1898
|
/**
|
|
@@ -1920,7 +1939,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1920
1939
|
addListener('undo', function (context) {
|
|
1921
1940
|
var event = context.keyEvent;
|
|
1922
1941
|
|
|
1923
|
-
if (
|
|
1942
|
+
if (isUndo(event)) {
|
|
1924
1943
|
editorActions.trigger('undo');
|
|
1925
1944
|
return true;
|
|
1926
1945
|
}
|
|
@@ -1931,7 +1950,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1931
1950
|
addListener('redo', function (context) {
|
|
1932
1951
|
var event = context.keyEvent;
|
|
1933
1952
|
|
|
1934
|
-
if (
|
|
1953
|
+
if (isRedo(event)) {
|
|
1935
1954
|
editorActions.trigger('redo');
|
|
1936
1955
|
return true;
|
|
1937
1956
|
}
|
|
@@ -1941,7 +1960,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1941
1960
|
addListener('copy', function (context) {
|
|
1942
1961
|
var event = context.keyEvent;
|
|
1943
1962
|
|
|
1944
|
-
if (
|
|
1963
|
+
if (isCopy(event)) {
|
|
1945
1964
|
editorActions.trigger('copy');
|
|
1946
1965
|
return true;
|
|
1947
1966
|
}
|
|
@@ -1951,7 +1970,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1951
1970
|
addListener('paste', function (context) {
|
|
1952
1971
|
var event = context.keyEvent;
|
|
1953
1972
|
|
|
1954
|
-
if (
|
|
1973
|
+
if (isPaste(event)) {
|
|
1955
1974
|
editorActions.trigger('paste');
|
|
1956
1975
|
return true;
|
|
1957
1976
|
}
|
|
@@ -2579,7 +2598,7 @@ var DEFAULT_PRIORITY = 1000;
|
|
|
2579
2598
|
*
|
|
2580
2599
|
* @example
|
|
2581
2600
|
*
|
|
2582
|
-
* import inherits from 'inherits';
|
|
2601
|
+
* import inherits from 'inherits-browser';
|
|
2583
2602
|
*
|
|
2584
2603
|
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
2585
2604
|
*
|
|
@@ -2893,7 +2912,7 @@ CommandStack.prototype.execute = function (command, context) {
|
|
|
2893
2912
|
}
|
|
2894
2913
|
|
|
2895
2914
|
this._currentExecution.trigger = 'execute';
|
|
2896
|
-
|
|
2915
|
+
const action = {
|
|
2897
2916
|
command: command,
|
|
2898
2917
|
context: context
|
|
2899
2918
|
};
|
|
@@ -2927,14 +2946,14 @@ CommandStack.prototype.execute = function (command, context) {
|
|
|
2927
2946
|
|
|
2928
2947
|
|
|
2929
2948
|
CommandStack.prototype.canExecute = function (command, context) {
|
|
2930
|
-
|
|
2949
|
+
const action = {
|
|
2931
2950
|
command: command,
|
|
2932
2951
|
context: context
|
|
2933
2952
|
};
|
|
2934
2953
|
|
|
2935
|
-
|
|
2954
|
+
const handler = this._getHandler(command);
|
|
2936
2955
|
|
|
2937
|
-
|
|
2956
|
+
let result = this._fire(command, 'canExecute', action); // handler#canExecute will only be called if no listener
|
|
2938
2957
|
// decided on a result already
|
|
2939
2958
|
|
|
2940
2959
|
|
|
@@ -2971,7 +2990,7 @@ CommandStack.prototype.clear = function (emit) {
|
|
|
2971
2990
|
|
|
2972
2991
|
|
|
2973
2992
|
CommandStack.prototype.undo = function () {
|
|
2974
|
-
|
|
2993
|
+
let action = this._getUndoAction(),
|
|
2975
2994
|
next;
|
|
2976
2995
|
|
|
2977
2996
|
if (action) {
|
|
@@ -3000,7 +3019,7 @@ CommandStack.prototype.undo = function () {
|
|
|
3000
3019
|
|
|
3001
3020
|
|
|
3002
3021
|
CommandStack.prototype.redo = function () {
|
|
3003
|
-
|
|
3022
|
+
let action = this._getRedoAction(),
|
|
3004
3023
|
next;
|
|
3005
3024
|
|
|
3006
3025
|
if (action) {
|
|
@@ -3048,7 +3067,7 @@ CommandStack.prototype.registerHandler = function (command, handlerCls) {
|
|
|
3048
3067
|
throw new Error('command and handlerCls must be defined');
|
|
3049
3068
|
}
|
|
3050
3069
|
|
|
3051
|
-
|
|
3070
|
+
const handler = this._injector.instantiate(handlerCls);
|
|
3052
3071
|
|
|
3053
3072
|
this.register(command, handler);
|
|
3054
3073
|
};
|
|
@@ -3072,23 +3091,22 @@ CommandStack.prototype._getUndoAction = function () {
|
|
|
3072
3091
|
|
|
3073
3092
|
|
|
3074
3093
|
CommandStack.prototype._internalUndo = function (action) {
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
context = action.context;
|
|
3094
|
+
const command = action.command,
|
|
3095
|
+
context = action.context;
|
|
3078
3096
|
|
|
3079
|
-
|
|
3097
|
+
const handler = this._getHandler(command); // guard against illegal nested command stack invocations
|
|
3080
3098
|
|
|
3081
3099
|
|
|
3082
|
-
this._atomicDo(
|
|
3083
|
-
|
|
3100
|
+
this._atomicDo(() => {
|
|
3101
|
+
this._fire(command, 'revert', action);
|
|
3084
3102
|
|
|
3085
3103
|
if (handler.revert) {
|
|
3086
|
-
|
|
3104
|
+
this._markDirty(handler.revert(context));
|
|
3087
3105
|
}
|
|
3088
3106
|
|
|
3089
|
-
|
|
3107
|
+
this._revertedAction(action);
|
|
3090
3108
|
|
|
3091
|
-
|
|
3109
|
+
this._fire(command, 'reverted', action);
|
|
3092
3110
|
});
|
|
3093
3111
|
};
|
|
3094
3112
|
|
|
@@ -3098,13 +3116,11 @@ CommandStack.prototype._fire = function (command, qualifier, event) {
|
|
|
3098
3116
|
qualifier = null;
|
|
3099
3117
|
}
|
|
3100
3118
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
name,
|
|
3104
|
-
result;
|
|
3119
|
+
const names = qualifier ? [command + '.' + qualifier, qualifier] : [command];
|
|
3120
|
+
let result;
|
|
3105
3121
|
event = this._eventBus.createEvent(event);
|
|
3106
3122
|
|
|
3107
|
-
for (
|
|
3123
|
+
for (const name of names) {
|
|
3108
3124
|
result = this._eventBus.fire('commandStack.' + name, event);
|
|
3109
3125
|
|
|
3110
3126
|
if (event.cancelBubble) {
|
|
@@ -3120,7 +3136,7 @@ CommandStack.prototype._createId = function () {
|
|
|
3120
3136
|
};
|
|
3121
3137
|
|
|
3122
3138
|
CommandStack.prototype._atomicDo = function (fn) {
|
|
3123
|
-
|
|
3139
|
+
const execution = this._currentExecution;
|
|
3124
3140
|
execution.atomic = true;
|
|
3125
3141
|
|
|
3126
3142
|
try {
|
|
@@ -3131,11 +3147,10 @@ CommandStack.prototype._atomicDo = function (fn) {
|
|
|
3131
3147
|
};
|
|
3132
3148
|
|
|
3133
3149
|
CommandStack.prototype._internalExecute = function (action, redo) {
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
context = action.context;
|
|
3150
|
+
const command = action.command,
|
|
3151
|
+
context = action.context;
|
|
3137
3152
|
|
|
3138
|
-
|
|
3153
|
+
const handler = this._getHandler(command);
|
|
3139
3154
|
|
|
3140
3155
|
if (!handler) {
|
|
3141
3156
|
throw new Error('no command handler registered for <' + command + '>');
|
|
@@ -3154,18 +3169,18 @@ CommandStack.prototype._internalExecute = function (action, redo) {
|
|
|
3154
3169
|
} // guard against illegal nested command stack invocations
|
|
3155
3170
|
|
|
3156
3171
|
|
|
3157
|
-
this._atomicDo(
|
|
3158
|
-
|
|
3172
|
+
this._atomicDo(() => {
|
|
3173
|
+
this._fire(command, 'execute', action);
|
|
3159
3174
|
|
|
3160
3175
|
if (handler.execute) {
|
|
3161
3176
|
// actual execute + mark return results as dirty
|
|
3162
|
-
|
|
3177
|
+
this._markDirty(handler.execute(context));
|
|
3163
3178
|
} // log to stack
|
|
3164
3179
|
|
|
3165
3180
|
|
|
3166
|
-
|
|
3181
|
+
this._executedAction(action, redo);
|
|
3167
3182
|
|
|
3168
|
-
|
|
3183
|
+
this._fire(command, 'executed', action);
|
|
3169
3184
|
});
|
|
3170
3185
|
|
|
3171
3186
|
if (!redo) {
|
|
@@ -3182,9 +3197,9 @@ CommandStack.prototype._internalExecute = function (action, redo) {
|
|
|
3182
3197
|
};
|
|
3183
3198
|
|
|
3184
3199
|
CommandStack.prototype._pushAction = function (action) {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3200
|
+
const execution = this._currentExecution,
|
|
3201
|
+
actions = execution.actions;
|
|
3202
|
+
const baseAction = actions[0];
|
|
3188
3203
|
|
|
3189
3204
|
if (execution.atomic) {
|
|
3190
3205
|
throw new Error('illegal invocation in <execute> or <revert> phase (action: ' + action.command + ')');
|
|
@@ -3198,10 +3213,10 @@ CommandStack.prototype._pushAction = function (action) {
|
|
|
3198
3213
|
};
|
|
3199
3214
|
|
|
3200
3215
|
CommandStack.prototype._popAction = function () {
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3216
|
+
const execution = this._currentExecution,
|
|
3217
|
+
trigger = execution.trigger,
|
|
3218
|
+
actions = execution.actions,
|
|
3219
|
+
dirty = execution.dirty;
|
|
3205
3220
|
actions.pop();
|
|
3206
3221
|
|
|
3207
3222
|
if (!actions.length) {
|
|
@@ -3220,7 +3235,7 @@ CommandStack.prototype._popAction = function () {
|
|
|
3220
3235
|
};
|
|
3221
3236
|
|
|
3222
3237
|
CommandStack.prototype._markDirty = function (elements) {
|
|
3223
|
-
|
|
3238
|
+
const execution = this._currentExecution;
|
|
3224
3239
|
|
|
3225
3240
|
if (!elements) {
|
|
3226
3241
|
return;
|
|
@@ -3231,7 +3246,7 @@ CommandStack.prototype._markDirty = function (elements) {
|
|
|
3231
3246
|
};
|
|
3232
3247
|
|
|
3233
3248
|
CommandStack.prototype._executedAction = function (action, redo) {
|
|
3234
|
-
|
|
3249
|
+
const stackIdx = ++this._stackIdx;
|
|
3235
3250
|
|
|
3236
3251
|
if (!redo) {
|
|
3237
3252
|
this._stack.splice(stackIdx, this._stack.length, action);
|
|
@@ -8487,10 +8502,7 @@ function StaticValuesSourceEntry(props) {
|
|
|
8487
8502
|
const addEntry = e => {
|
|
8488
8503
|
e.stopPropagation();
|
|
8489
8504
|
const index = values.length + 1;
|
|
8490
|
-
const entry =
|
|
8491
|
-
label: `Value ${index}`,
|
|
8492
|
-
value: `value${index}`
|
|
8493
|
-
};
|
|
8505
|
+
const entry = getIndexedEntry(index);
|
|
8494
8506
|
editField(field, VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC], arrayAdd(values, values.length, entry));
|
|
8495
8507
|
};
|
|
8496
8508
|
|
|
@@ -8534,8 +8546,23 @@ function StaticValuesSourceEntry(props) {
|
|
|
8534
8546
|
});
|
|
8535
8547
|
return {
|
|
8536
8548
|
items,
|
|
8537
|
-
add: addEntry
|
|
8549
|
+
add: addEntry,
|
|
8550
|
+
shouldSort: false
|
|
8538
8551
|
};
|
|
8552
|
+
} // helper
|
|
8553
|
+
|
|
8554
|
+
function getIndexedEntry(index) {
|
|
8555
|
+
const entry = {
|
|
8556
|
+
label: 'Value',
|
|
8557
|
+
value: 'value'
|
|
8558
|
+
};
|
|
8559
|
+
|
|
8560
|
+
if (index > 1) {
|
|
8561
|
+
entry.label += ` ${index}`;
|
|
8562
|
+
entry.value += `${index}`;
|
|
8563
|
+
}
|
|
8564
|
+
|
|
8565
|
+
return entry;
|
|
8539
8566
|
}
|
|
8540
8567
|
|
|
8541
8568
|
function GeneralGroup(field, editField) {
|