@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.cjs
CHANGED
|
@@ -1435,7 +1435,10 @@ EditorActions.prototype._registerDefaultActions = function (injector) {
|
|
|
1435
1435
|
if (copyPaste && selection) {
|
|
1436
1436
|
this.register('copy', function () {
|
|
1437
1437
|
var selectedElements = selection.get();
|
|
1438
|
-
|
|
1438
|
+
|
|
1439
|
+
if (selectedElements.length) {
|
|
1440
|
+
return copyPaste.copy(selectedElements);
|
|
1441
|
+
}
|
|
1439
1442
|
});
|
|
1440
1443
|
}
|
|
1441
1444
|
|
|
@@ -1665,6 +1668,14 @@ var EditorActionsModule = {
|
|
|
1665
1668
|
editorActions: ['type', FormEditorActions]
|
|
1666
1669
|
};
|
|
1667
1670
|
|
|
1671
|
+
var KEYCODE_C = 67;
|
|
1672
|
+
var KEYCODE_V = 86;
|
|
1673
|
+
var KEYCODE_Y$1 = 89;
|
|
1674
|
+
var KEYCODE_Z$1 = 90;
|
|
1675
|
+
var KEYS_COPY = ['c', 'C', KEYCODE_C];
|
|
1676
|
+
var KEYS_PASTE = ['v', 'V', KEYCODE_V];
|
|
1677
|
+
var KEYS_REDO$1 = ['y', 'Y', KEYCODE_Y$1];
|
|
1678
|
+
var KEYS_UNDO$1 = ['z', 'Z', KEYCODE_Z$1];
|
|
1668
1679
|
/**
|
|
1669
1680
|
* Returns true if event was triggered with any modifier
|
|
1670
1681
|
* @param {KeyboardEvent} event
|
|
@@ -1704,6 +1715,18 @@ function isKey(keys, event) {
|
|
|
1704
1715
|
function isShift(event) {
|
|
1705
1716
|
return event.shiftKey;
|
|
1706
1717
|
}
|
|
1718
|
+
function isCopy(event) {
|
|
1719
|
+
return isCmd(event) && isKey(KEYS_COPY, event);
|
|
1720
|
+
}
|
|
1721
|
+
function isPaste(event) {
|
|
1722
|
+
return isCmd(event) && isKey(KEYS_PASTE, event);
|
|
1723
|
+
}
|
|
1724
|
+
function isUndo(event) {
|
|
1725
|
+
return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO$1, event);
|
|
1726
|
+
}
|
|
1727
|
+
function isRedo(event) {
|
|
1728
|
+
return isCmd(event) && (isKey(KEYS_REDO$1, event) || isKey(KEYS_UNDO$1, event) && isShift(event));
|
|
1729
|
+
}
|
|
1707
1730
|
|
|
1708
1731
|
var KEYDOWN_EVENT = 'keyboard.keydown',
|
|
1709
1732
|
KEYUP_EVENT = 'keyboard.keyup';
|
|
@@ -1796,7 +1819,7 @@ Keyboard.prototype._isModifiedKeyIgnored = function (event) {
|
|
|
1796
1819
|
|
|
1797
1820
|
var allowedModifiers = this._getAllowedModifiers(event.target);
|
|
1798
1821
|
|
|
1799
|
-
return
|
|
1822
|
+
return allowedModifiers.indexOf(event.key) === -1;
|
|
1800
1823
|
};
|
|
1801
1824
|
|
|
1802
1825
|
Keyboard.prototype._getAllowedModifiers = function (element) {
|
|
@@ -1878,12 +1901,8 @@ function isInput(target) {
|
|
|
1878
1901
|
}
|
|
1879
1902
|
|
|
1880
1903
|
var LOW_PRIORITY$1 = 500;
|
|
1881
|
-
var KEYCODE_C = 67;
|
|
1882
|
-
var KEYCODE_V = 86;
|
|
1883
1904
|
var KEYCODE_Y = 89;
|
|
1884
1905
|
var KEYCODE_Z = 90;
|
|
1885
|
-
var KEYS_COPY = ['c', 'C', KEYCODE_C];
|
|
1886
|
-
var KEYS_PASTE = ['v', 'V', KEYCODE_V];
|
|
1887
1906
|
var KEYS_REDO = ['y', 'Y', KEYCODE_Y];
|
|
1888
1907
|
var KEYS_UNDO = ['z', 'Z', KEYCODE_Z];
|
|
1889
1908
|
/**
|
|
@@ -1930,7 +1949,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1930
1949
|
addListener('undo', function (context) {
|
|
1931
1950
|
var event = context.keyEvent;
|
|
1932
1951
|
|
|
1933
|
-
if (
|
|
1952
|
+
if (isUndo(event)) {
|
|
1934
1953
|
editorActions.trigger('undo');
|
|
1935
1954
|
return true;
|
|
1936
1955
|
}
|
|
@@ -1941,7 +1960,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1941
1960
|
addListener('redo', function (context) {
|
|
1942
1961
|
var event = context.keyEvent;
|
|
1943
1962
|
|
|
1944
|
-
if (
|
|
1963
|
+
if (isRedo(event)) {
|
|
1945
1964
|
editorActions.trigger('redo');
|
|
1946
1965
|
return true;
|
|
1947
1966
|
}
|
|
@@ -1951,7 +1970,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1951
1970
|
addListener('copy', function (context) {
|
|
1952
1971
|
var event = context.keyEvent;
|
|
1953
1972
|
|
|
1954
|
-
if (
|
|
1973
|
+
if (isCopy(event)) {
|
|
1955
1974
|
editorActions.trigger('copy');
|
|
1956
1975
|
return true;
|
|
1957
1976
|
}
|
|
@@ -1961,7 +1980,7 @@ KeyboardBindings.prototype.registerBindings = function (keyboard, editorActions)
|
|
|
1961
1980
|
addListener('paste', function (context) {
|
|
1962
1981
|
var event = context.keyEvent;
|
|
1963
1982
|
|
|
1964
|
-
if (
|
|
1983
|
+
if (isPaste(event)) {
|
|
1965
1984
|
editorActions.trigger('paste');
|
|
1966
1985
|
return true;
|
|
1967
1986
|
}
|
|
@@ -2589,7 +2608,7 @@ var DEFAULT_PRIORITY = 1000;
|
|
|
2589
2608
|
*
|
|
2590
2609
|
* @example
|
|
2591
2610
|
*
|
|
2592
|
-
* import inherits from 'inherits';
|
|
2611
|
+
* import inherits from 'inherits-browser';
|
|
2593
2612
|
*
|
|
2594
2613
|
* import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
2595
2614
|
*
|
|
@@ -2903,7 +2922,7 @@ CommandStack.prototype.execute = function (command, context) {
|
|
|
2903
2922
|
}
|
|
2904
2923
|
|
|
2905
2924
|
this._currentExecution.trigger = 'execute';
|
|
2906
|
-
|
|
2925
|
+
const action = {
|
|
2907
2926
|
command: command,
|
|
2908
2927
|
context: context
|
|
2909
2928
|
};
|
|
@@ -2937,14 +2956,14 @@ CommandStack.prototype.execute = function (command, context) {
|
|
|
2937
2956
|
|
|
2938
2957
|
|
|
2939
2958
|
CommandStack.prototype.canExecute = function (command, context) {
|
|
2940
|
-
|
|
2959
|
+
const action = {
|
|
2941
2960
|
command: command,
|
|
2942
2961
|
context: context
|
|
2943
2962
|
};
|
|
2944
2963
|
|
|
2945
|
-
|
|
2964
|
+
const handler = this._getHandler(command);
|
|
2946
2965
|
|
|
2947
|
-
|
|
2966
|
+
let result = this._fire(command, 'canExecute', action); // handler#canExecute will only be called if no listener
|
|
2948
2967
|
// decided on a result already
|
|
2949
2968
|
|
|
2950
2969
|
|
|
@@ -2981,7 +3000,7 @@ CommandStack.prototype.clear = function (emit) {
|
|
|
2981
3000
|
|
|
2982
3001
|
|
|
2983
3002
|
CommandStack.prototype.undo = function () {
|
|
2984
|
-
|
|
3003
|
+
let action = this._getUndoAction(),
|
|
2985
3004
|
next;
|
|
2986
3005
|
|
|
2987
3006
|
if (action) {
|
|
@@ -3010,7 +3029,7 @@ CommandStack.prototype.undo = function () {
|
|
|
3010
3029
|
|
|
3011
3030
|
|
|
3012
3031
|
CommandStack.prototype.redo = function () {
|
|
3013
|
-
|
|
3032
|
+
let action = this._getRedoAction(),
|
|
3014
3033
|
next;
|
|
3015
3034
|
|
|
3016
3035
|
if (action) {
|
|
@@ -3058,7 +3077,7 @@ CommandStack.prototype.registerHandler = function (command, handlerCls) {
|
|
|
3058
3077
|
throw new Error('command and handlerCls must be defined');
|
|
3059
3078
|
}
|
|
3060
3079
|
|
|
3061
|
-
|
|
3080
|
+
const handler = this._injector.instantiate(handlerCls);
|
|
3062
3081
|
|
|
3063
3082
|
this.register(command, handler);
|
|
3064
3083
|
};
|
|
@@ -3082,23 +3101,22 @@ CommandStack.prototype._getUndoAction = function () {
|
|
|
3082
3101
|
|
|
3083
3102
|
|
|
3084
3103
|
CommandStack.prototype._internalUndo = function (action) {
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
context = action.context;
|
|
3104
|
+
const command = action.command,
|
|
3105
|
+
context = action.context;
|
|
3088
3106
|
|
|
3089
|
-
|
|
3107
|
+
const handler = this._getHandler(command); // guard against illegal nested command stack invocations
|
|
3090
3108
|
|
|
3091
3109
|
|
|
3092
|
-
this._atomicDo(
|
|
3093
|
-
|
|
3110
|
+
this._atomicDo(() => {
|
|
3111
|
+
this._fire(command, 'revert', action);
|
|
3094
3112
|
|
|
3095
3113
|
if (handler.revert) {
|
|
3096
|
-
|
|
3114
|
+
this._markDirty(handler.revert(context));
|
|
3097
3115
|
}
|
|
3098
3116
|
|
|
3099
|
-
|
|
3117
|
+
this._revertedAction(action);
|
|
3100
3118
|
|
|
3101
|
-
|
|
3119
|
+
this._fire(command, 'reverted', action);
|
|
3102
3120
|
});
|
|
3103
3121
|
};
|
|
3104
3122
|
|
|
@@ -3108,13 +3126,11 @@ CommandStack.prototype._fire = function (command, qualifier, event) {
|
|
|
3108
3126
|
qualifier = null;
|
|
3109
3127
|
}
|
|
3110
3128
|
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
name,
|
|
3114
|
-
result;
|
|
3129
|
+
const names = qualifier ? [command + '.' + qualifier, qualifier] : [command];
|
|
3130
|
+
let result;
|
|
3115
3131
|
event = this._eventBus.createEvent(event);
|
|
3116
3132
|
|
|
3117
|
-
for (
|
|
3133
|
+
for (const name of names) {
|
|
3118
3134
|
result = this._eventBus.fire('commandStack.' + name, event);
|
|
3119
3135
|
|
|
3120
3136
|
if (event.cancelBubble) {
|
|
@@ -3130,7 +3146,7 @@ CommandStack.prototype._createId = function () {
|
|
|
3130
3146
|
};
|
|
3131
3147
|
|
|
3132
3148
|
CommandStack.prototype._atomicDo = function (fn) {
|
|
3133
|
-
|
|
3149
|
+
const execution = this._currentExecution;
|
|
3134
3150
|
execution.atomic = true;
|
|
3135
3151
|
|
|
3136
3152
|
try {
|
|
@@ -3141,11 +3157,10 @@ CommandStack.prototype._atomicDo = function (fn) {
|
|
|
3141
3157
|
};
|
|
3142
3158
|
|
|
3143
3159
|
CommandStack.prototype._internalExecute = function (action, redo) {
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
context = action.context;
|
|
3160
|
+
const command = action.command,
|
|
3161
|
+
context = action.context;
|
|
3147
3162
|
|
|
3148
|
-
|
|
3163
|
+
const handler = this._getHandler(command);
|
|
3149
3164
|
|
|
3150
3165
|
if (!handler) {
|
|
3151
3166
|
throw new Error('no command handler registered for <' + command + '>');
|
|
@@ -3164,18 +3179,18 @@ CommandStack.prototype._internalExecute = function (action, redo) {
|
|
|
3164
3179
|
} // guard against illegal nested command stack invocations
|
|
3165
3180
|
|
|
3166
3181
|
|
|
3167
|
-
this._atomicDo(
|
|
3168
|
-
|
|
3182
|
+
this._atomicDo(() => {
|
|
3183
|
+
this._fire(command, 'execute', action);
|
|
3169
3184
|
|
|
3170
3185
|
if (handler.execute) {
|
|
3171
3186
|
// actual execute + mark return results as dirty
|
|
3172
|
-
|
|
3187
|
+
this._markDirty(handler.execute(context));
|
|
3173
3188
|
} // log to stack
|
|
3174
3189
|
|
|
3175
3190
|
|
|
3176
|
-
|
|
3191
|
+
this._executedAction(action, redo);
|
|
3177
3192
|
|
|
3178
|
-
|
|
3193
|
+
this._fire(command, 'executed', action);
|
|
3179
3194
|
});
|
|
3180
3195
|
|
|
3181
3196
|
if (!redo) {
|
|
@@ -3192,9 +3207,9 @@ CommandStack.prototype._internalExecute = function (action, redo) {
|
|
|
3192
3207
|
};
|
|
3193
3208
|
|
|
3194
3209
|
CommandStack.prototype._pushAction = function (action) {
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3210
|
+
const execution = this._currentExecution,
|
|
3211
|
+
actions = execution.actions;
|
|
3212
|
+
const baseAction = actions[0];
|
|
3198
3213
|
|
|
3199
3214
|
if (execution.atomic) {
|
|
3200
3215
|
throw new Error('illegal invocation in <execute> or <revert> phase (action: ' + action.command + ')');
|
|
@@ -3208,10 +3223,10 @@ CommandStack.prototype._pushAction = function (action) {
|
|
|
3208
3223
|
};
|
|
3209
3224
|
|
|
3210
3225
|
CommandStack.prototype._popAction = function () {
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3226
|
+
const execution = this._currentExecution,
|
|
3227
|
+
trigger = execution.trigger,
|
|
3228
|
+
actions = execution.actions,
|
|
3229
|
+
dirty = execution.dirty;
|
|
3215
3230
|
actions.pop();
|
|
3216
3231
|
|
|
3217
3232
|
if (!actions.length) {
|
|
@@ -3230,7 +3245,7 @@ CommandStack.prototype._popAction = function () {
|
|
|
3230
3245
|
};
|
|
3231
3246
|
|
|
3232
3247
|
CommandStack.prototype._markDirty = function (elements) {
|
|
3233
|
-
|
|
3248
|
+
const execution = this._currentExecution;
|
|
3234
3249
|
|
|
3235
3250
|
if (!elements) {
|
|
3236
3251
|
return;
|
|
@@ -3241,7 +3256,7 @@ CommandStack.prototype._markDirty = function (elements) {
|
|
|
3241
3256
|
};
|
|
3242
3257
|
|
|
3243
3258
|
CommandStack.prototype._executedAction = function (action, redo) {
|
|
3244
|
-
|
|
3259
|
+
const stackIdx = ++this._stackIdx;
|
|
3245
3260
|
|
|
3246
3261
|
if (!redo) {
|
|
3247
3262
|
this._stack.splice(stackIdx, this._stack.length, action);
|
|
@@ -8497,10 +8512,7 @@ function StaticValuesSourceEntry(props) {
|
|
|
8497
8512
|
const addEntry = e => {
|
|
8498
8513
|
e.stopPropagation();
|
|
8499
8514
|
const index = values.length + 1;
|
|
8500
|
-
const entry =
|
|
8501
|
-
label: `Value ${index}`,
|
|
8502
|
-
value: `value${index}`
|
|
8503
|
-
};
|
|
8515
|
+
const entry = getIndexedEntry(index);
|
|
8504
8516
|
editField(field, VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC], arrayAdd(values, values.length, entry));
|
|
8505
8517
|
};
|
|
8506
8518
|
|
|
@@ -8544,8 +8556,23 @@ function StaticValuesSourceEntry(props) {
|
|
|
8544
8556
|
});
|
|
8545
8557
|
return {
|
|
8546
8558
|
items,
|
|
8547
|
-
add: addEntry
|
|
8559
|
+
add: addEntry,
|
|
8560
|
+
shouldSort: false
|
|
8548
8561
|
};
|
|
8562
|
+
} // helper
|
|
8563
|
+
|
|
8564
|
+
function getIndexedEntry(index) {
|
|
8565
|
+
const entry = {
|
|
8566
|
+
label: 'Value',
|
|
8567
|
+
value: 'value'
|
|
8568
|
+
};
|
|
8569
|
+
|
|
8570
|
+
if (index > 1) {
|
|
8571
|
+
entry.label += ` ${index}`;
|
|
8572
|
+
entry.value += `${index}`;
|
|
8573
|
+
}
|
|
8574
|
+
|
|
8575
|
+
return entry;
|
|
8549
8576
|
}
|
|
8550
8577
|
|
|
8551
8578
|
function GeneralGroup(field, editField) {
|