@bpmn-io/form-js-editor 1.3.0 → 1.3.2
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/LICENSE +22 -22
- package/README.md +116 -116
- package/dist/assets/form-js-editor-base.css +797 -797
- package/dist/assets/form-js-editor.css +1 -1
- package/dist/assets/properties-panel.css +1 -1
- package/dist/index.cjs +378 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +379 -312
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/properties-panel/entries/InputKeyValuesSourceEntry.d.ts +0 -2
- package/dist/types/features/properties-panel/entries/ValuesExpressionEntry.d.ts +0 -1
- package/dist/types/types.d.ts +28 -28
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormFieldRegistry as FormFieldRegistry$1, iconsByType, Text as Text$1, FormFields, formFields, FormContext, FormRenderContext, FormComponent, Importer, PathRegistry, FormLayouter, FieldFactory, runRecursively, clone, getSchemaVariables, DATETIME_SUBTYPES, DATE_LABEL_PATH, TIME_LABEL_PATH, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES_LABELS, TIME_SERIALISING_FORMAT_PATH, TIME_SERIALISING_FORMATS, TIME_INTERVAL_PATH, TIME_USE24H_PATH, DATE_DISALLOW_PAST_PATH, TIME_SERIALISINGFORMAT_LABELS, getValuesSource, VALUES_SOURCES, VALUES_SOURCES_DEFAULTS, VALUES_SOURCES_PATHS, VALUES_SOURCES_LABELS, FeelExpressionLanguage, createFormContainer, createInjector, MarkdownModule, schemaVersion } from '@bpmn-io/form-js-viewer';
|
|
2
2
|
export { schemaVersion } from '@bpmn-io/form-js-viewer';
|
|
3
3
|
import Ids from 'ids';
|
|
4
|
-
import { isArray, isFunction, isNumber, bind, assign, debounce, forEach, get, isObject, uniqueBy, sortBy, find,
|
|
4
|
+
import { isArray, isFunction, isNumber, bind, assign, debounce, forEach, get, isObject, uniqueBy, sortBy, find, set as set$1, isString, isUndefined, without, has } from 'min-dash';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'preact/jsx-runtime';
|
|
7
7
|
import { useContext, useState, useMemo, useEffect, useCallback, useRef as useRef$1, useLayoutEffect } from 'preact/hooks';
|
|
@@ -517,10 +517,10 @@ function invokeFunction(fn, args) {
|
|
|
517
517
|
return fn.apply(null, args);
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
-
/**
|
|
521
|
-
* A factory to create a configurable debouncer.
|
|
522
|
-
*
|
|
523
|
-
* @param {number|boolean} [config=true]
|
|
520
|
+
/**
|
|
521
|
+
* A factory to create a configurable debouncer.
|
|
522
|
+
*
|
|
523
|
+
* @param {number|boolean} [config=true]
|
|
524
524
|
*/
|
|
525
525
|
function DebounceFactory(config = true) {
|
|
526
526
|
const timeout = typeof config === 'number' ? config : config ? 300 : 0;
|
|
@@ -533,11 +533,11 @@ function DebounceFactory(config = true) {
|
|
|
533
533
|
DebounceFactory.$inject = ['config.debounce'];
|
|
534
534
|
|
|
535
535
|
class FormFieldRegistry extends FormFieldRegistry$1 {
|
|
536
|
-
/**
|
|
537
|
-
* Updates a form fields id.
|
|
538
|
-
*
|
|
539
|
-
* @param {Object} formField
|
|
540
|
-
* @param {string} newId
|
|
536
|
+
/**
|
|
537
|
+
* Updates a form fields id.
|
|
538
|
+
*
|
|
539
|
+
* @param {Object} formField
|
|
540
|
+
* @param {string} newId
|
|
541
541
|
*/
|
|
542
542
|
updateId(formField, newId) {
|
|
543
543
|
this._validateId(newId);
|
|
@@ -558,13 +558,13 @@ class FormFieldRegistry extends FormFieldRegistry$1 {
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
-
/**
|
|
562
|
-
* Validate the suitability of the given id and signals a problem
|
|
563
|
-
* with an exception.
|
|
564
|
-
*
|
|
565
|
-
* @param {string} id
|
|
566
|
-
*
|
|
567
|
-
* @throws {Error} if id is empty or already assigned
|
|
561
|
+
/**
|
|
562
|
+
* Validate the suitability of the given id and signals a problem
|
|
563
|
+
* with an exception.
|
|
564
|
+
*
|
|
565
|
+
* @param {string} id
|
|
566
|
+
*
|
|
567
|
+
* @throws {Error} if id is empty or already assigned
|
|
568
568
|
*/
|
|
569
569
|
_validateId(id) {
|
|
570
570
|
if (!id) {
|
|
@@ -581,11 +581,11 @@ const MAX_COLUMNS = 16;
|
|
|
581
581
|
const MIN_COLUMNS = 2;
|
|
582
582
|
const MAX_FIELDS_PER_ROW = 4;
|
|
583
583
|
class FormLayoutValidator {
|
|
584
|
-
/**
|
|
585
|
-
* @constructor
|
|
586
|
-
*
|
|
587
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
588
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
584
|
+
/**
|
|
585
|
+
* @constructor
|
|
586
|
+
*
|
|
587
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
588
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
589
589
|
*/
|
|
590
590
|
constructor(formLayouter, formFieldRegistry) {
|
|
591
591
|
this._formLayouter = formLayouter;
|
|
@@ -656,21 +656,21 @@ function editorFormFieldClasses(type, {
|
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
-
/**
|
|
660
|
-
* Add a dragger that calls back the passed function with
|
|
661
|
-
* { event, delta } on drag.
|
|
662
|
-
*
|
|
663
|
-
* @example
|
|
664
|
-
*
|
|
665
|
-
* function dragMove(event, delta) {
|
|
666
|
-
* // we are dragging (!!)
|
|
667
|
-
* }
|
|
668
|
-
*
|
|
669
|
-
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
670
|
-
*
|
|
671
|
-
* @param {Function} fn
|
|
672
|
-
*
|
|
673
|
-
* @return {Function} drag start callback function
|
|
659
|
+
/**
|
|
660
|
+
* Add a dragger that calls back the passed function with
|
|
661
|
+
* { event, delta } on drag.
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
*
|
|
665
|
+
* function dragMove(event, delta) {
|
|
666
|
+
* // we are dragging (!!)
|
|
667
|
+
* }
|
|
668
|
+
*
|
|
669
|
+
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
670
|
+
*
|
|
671
|
+
* @param {Function} fn
|
|
672
|
+
*
|
|
673
|
+
* @return {Function} drag start callback function
|
|
674
674
|
*/
|
|
675
675
|
function createDragger$1(fn) {
|
|
676
676
|
let self;
|
|
@@ -711,12 +711,12 @@ function createDragger$1(fn) {
|
|
|
711
711
|
return onDragStart;
|
|
712
712
|
}
|
|
713
713
|
|
|
714
|
-
/**
|
|
715
|
-
* Throttle function call according UI update cycle.
|
|
716
|
-
*
|
|
717
|
-
* @param {Function} fn
|
|
718
|
-
*
|
|
719
|
-
* @return {Function} throttled fn
|
|
714
|
+
/**
|
|
715
|
+
* Throttle function call according UI update cycle.
|
|
716
|
+
*
|
|
717
|
+
* @param {Function} fn
|
|
718
|
+
*
|
|
719
|
+
* @return {Function} throttled fn
|
|
720
720
|
*/
|
|
721
721
|
function throttle(fn) {
|
|
722
722
|
let active = false;
|
|
@@ -750,11 +750,11 @@ const DragAndDropContext = createContext({
|
|
|
750
750
|
});
|
|
751
751
|
var DragAndDropContext$1 = DragAndDropContext;
|
|
752
752
|
|
|
753
|
-
/**
|
|
754
|
-
* @param {string} type
|
|
755
|
-
* @param {boolean} [strict]
|
|
756
|
-
*
|
|
757
|
-
* @returns {any}
|
|
753
|
+
/**
|
|
754
|
+
* @param {string} type
|
|
755
|
+
* @param {boolean} [strict]
|
|
756
|
+
*
|
|
757
|
+
* @returns {any}
|
|
758
758
|
*/
|
|
759
759
|
function getService$1(type, strict) {}
|
|
760
760
|
const FormEditorContext = createContext({
|
|
@@ -1104,23 +1104,23 @@ var Slot = (props => {
|
|
|
1104
1104
|
return fillsAndSeparators;
|
|
1105
1105
|
});
|
|
1106
1106
|
|
|
1107
|
-
/**
|
|
1108
|
-
* Creates a Fragment for a fill.
|
|
1109
|
-
*
|
|
1110
|
-
* @param {Object} fill Fill to be rendered
|
|
1111
|
-
* @returns {Object} Preact Fragment containing fill's children
|
|
1107
|
+
/**
|
|
1108
|
+
* Creates a Fragment for a fill.
|
|
1109
|
+
*
|
|
1110
|
+
* @param {Object} fill Fill to be rendered
|
|
1111
|
+
* @returns {Object} Preact Fragment containing fill's children
|
|
1112
1112
|
*/
|
|
1113
1113
|
const FillFragment = fill => jsx(Fragment, {
|
|
1114
1114
|
children: fill.children
|
|
1115
1115
|
}, fill.id);
|
|
1116
1116
|
|
|
1117
|
-
/**
|
|
1118
|
-
* Creates an array of fills, with separators inserted between groups.
|
|
1119
|
-
*
|
|
1120
|
-
* @param {Array} groups Groups of fills
|
|
1121
|
-
* @param {Function} fillRenderer Function to create a fill
|
|
1122
|
-
* @param {Function} separatorRenderer Function to create a separator
|
|
1123
|
-
* @returns {Array} Array of fills and separators
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates an array of fills, with separators inserted between groups.
|
|
1119
|
+
*
|
|
1120
|
+
* @param {Array} groups Groups of fills
|
|
1121
|
+
* @param {Function} fillRenderer Function to create a fill
|
|
1122
|
+
* @param {Function} separatorRenderer Function to create a separator
|
|
1123
|
+
* @returns {Array} Array of fills and separators
|
|
1124
1124
|
*/
|
|
1125
1125
|
const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
1126
1126
|
const result = [];
|
|
@@ -1138,8 +1138,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
|
1138
1138
|
return result;
|
|
1139
1139
|
};
|
|
1140
1140
|
|
|
1141
|
-
/**
|
|
1142
|
-
* Groups fills by group name property.
|
|
1141
|
+
/**
|
|
1142
|
+
* Groups fills by group name property.
|
|
1143
1143
|
*/
|
|
1144
1144
|
const _groupByGroupName = fills => {
|
|
1145
1145
|
const groups = [];
|
|
@@ -1159,8 +1159,8 @@ const _groupByGroupName = fills => {
|
|
|
1159
1159
|
return Object.keys(groupsById).sort().map(id => groupsById[id]);
|
|
1160
1160
|
};
|
|
1161
1161
|
|
|
1162
|
-
/**
|
|
1163
|
-
* Compares fills by priority.
|
|
1162
|
+
/**
|
|
1163
|
+
* Compares fills by priority.
|
|
1164
1164
|
*/
|
|
1165
1165
|
const _comparePriority = (a, b) => {
|
|
1166
1166
|
return (b.priority || 0) - (a.priority || 0);
|
|
@@ -1388,20 +1388,20 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
|
|
|
1388
1388
|
const DRAG_NO_MOVE_CLS = 'fjs-no-move';
|
|
1389
1389
|
const ERROR_DROP_CLS = 'fjs-error-drop';
|
|
1390
1390
|
|
|
1391
|
-
/**
|
|
1392
|
-
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1391
|
+
/**
|
|
1392
|
+
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1393
1393
|
*/
|
|
1394
1394
|
|
|
1395
1395
|
class Dragging {
|
|
1396
|
-
/**
|
|
1397
|
-
* @constructor
|
|
1398
|
-
*
|
|
1399
|
-
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1400
|
-
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1401
|
-
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1402
|
-
* @param { import('../../core/EventBus').default } eventBus
|
|
1403
|
-
* @param { import('../modeling/Modeling').default } modeling
|
|
1404
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
1396
|
+
/**
|
|
1397
|
+
* @constructor
|
|
1398
|
+
*
|
|
1399
|
+
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1400
|
+
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1401
|
+
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1402
|
+
* @param { import('../../core/EventBus').default } eventBus
|
|
1403
|
+
* @param { import('../modeling/Modeling').default } modeling
|
|
1404
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
1405
1405
|
*/
|
|
1406
1406
|
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling, pathRegistry) {
|
|
1407
1407
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -1412,13 +1412,13 @@ class Dragging {
|
|
|
1412
1412
|
this._pathRegistry = pathRegistry;
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
-
/**
|
|
1416
|
-
* Calculcates position in form schema given the dropped place.
|
|
1417
|
-
*
|
|
1418
|
-
* @param { FormRow } targetRow
|
|
1419
|
-
* @param { any } targetFormField
|
|
1420
|
-
* @param { HTMLElement } sibling
|
|
1421
|
-
* @returns { number }
|
|
1415
|
+
/**
|
|
1416
|
+
* Calculcates position in form schema given the dropped place.
|
|
1417
|
+
*
|
|
1418
|
+
* @param { FormRow } targetRow
|
|
1419
|
+
* @param { any } targetFormField
|
|
1420
|
+
* @param { HTMLElement } sibling
|
|
1421
|
+
* @returns { number }
|
|
1422
1422
|
*/
|
|
1423
1423
|
getTargetIndex(targetRow, targetFormField, sibling) {
|
|
1424
1424
|
/** @type HTMLElement */
|
|
@@ -1559,8 +1559,8 @@ class Dragging {
|
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
1561
|
|
|
1562
|
-
/**
|
|
1563
|
-
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1562
|
+
/**
|
|
1563
|
+
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1564
1564
|
*/
|
|
1565
1565
|
createDragulaInstance(options) {
|
|
1566
1566
|
const {
|
|
@@ -1974,7 +1974,7 @@ function DebugColumns(props) {
|
|
|
1974
1974
|
return null;
|
|
1975
1975
|
}
|
|
1976
1976
|
return jsx("div", {
|
|
1977
|
-
style: "width: fit-content
|
|
1977
|
+
style: "width: fit-content;\r padding: 2px 6px;\r height: 16px;\r background: var(--color-blue-205-100-95);\r display: flex;\r justify-content: center;\r align-items: center;\r position: absolute;\r bottom: -2px;\r z-index: 2;\r font-size: 10px;\r right: 3px;",
|
|
1978
1978
|
class: "fjs-debug-columns",
|
|
1979
1979
|
children: (field.layout || {}).columns || 'auto'
|
|
1980
1980
|
});
|
|
@@ -3045,10 +3045,10 @@ function updateRow(formField, rowId) {
|
|
|
3045
3045
|
}
|
|
3046
3046
|
|
|
3047
3047
|
class AddFormFieldHandler {
|
|
3048
|
-
/**
|
|
3049
|
-
* @constructor
|
|
3050
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3051
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3048
|
+
/**
|
|
3049
|
+
* @constructor
|
|
3050
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3051
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3052
3052
|
*/
|
|
3053
3053
|
constructor(formEditor, formFieldRegistry) {
|
|
3054
3054
|
this._formEditor = formEditor;
|
|
@@ -3109,10 +3109,10 @@ class AddFormFieldHandler {
|
|
|
3109
3109
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3110
3110
|
|
|
3111
3111
|
class EditFormFieldHandler {
|
|
3112
|
-
/**
|
|
3113
|
-
* @constructor
|
|
3114
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3115
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3112
|
+
/**
|
|
3113
|
+
* @constructor
|
|
3114
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3115
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3116
3116
|
*/
|
|
3117
3117
|
constructor(formEditor, formFieldRegistry) {
|
|
3118
3118
|
this._formEditor = formEditor;
|
|
@@ -3175,11 +3175,11 @@ class EditFormFieldHandler {
|
|
|
3175
3175
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3176
3176
|
|
|
3177
3177
|
class MoveFormFieldHandler {
|
|
3178
|
-
/**
|
|
3179
|
-
* @constructor
|
|
3180
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3181
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3182
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3178
|
+
/**
|
|
3179
|
+
* @constructor
|
|
3180
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3181
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3182
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3183
3183
|
*/
|
|
3184
3184
|
constructor(formEditor, formFieldRegistry, pathRegistry) {
|
|
3185
3185
|
this._formEditor = formEditor;
|
|
@@ -3284,10 +3284,10 @@ class MoveFormFieldHandler {
|
|
|
3284
3284
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry', 'pathRegistry'];
|
|
3285
3285
|
|
|
3286
3286
|
class RemoveFormFieldHandler {
|
|
3287
|
-
/**
|
|
3288
|
-
* @constructor
|
|
3289
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3290
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3287
|
+
/**
|
|
3288
|
+
* @constructor
|
|
3289
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3290
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3291
3291
|
*/
|
|
3292
3292
|
constructor(formEditor, formFieldRegistry) {
|
|
3293
3293
|
this._formEditor = formEditor;
|
|
@@ -3347,9 +3347,9 @@ class RemoveFormFieldHandler {
|
|
|
3347
3347
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3348
3348
|
|
|
3349
3349
|
class UpdateIdClaimHandler {
|
|
3350
|
-
/**
|
|
3351
|
-
* @constructor
|
|
3352
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3350
|
+
/**
|
|
3351
|
+
* @constructor
|
|
3352
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3353
3353
|
*/
|
|
3354
3354
|
constructor(formFieldRegistry) {
|
|
3355
3355
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3382,9 +3382,9 @@ class UpdateIdClaimHandler {
|
|
|
3382
3382
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
3383
3383
|
|
|
3384
3384
|
class UpdateKeyClaimHandler {
|
|
3385
|
-
/**
|
|
3386
|
-
* @constructor
|
|
3387
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3385
|
+
/**
|
|
3386
|
+
* @constructor
|
|
3387
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3388
3388
|
*/
|
|
3389
3389
|
constructor(pathRegistry) {
|
|
3390
3390
|
this._pathRegistry = pathRegistry;
|
|
@@ -3425,9 +3425,9 @@ class UpdateKeyClaimHandler {
|
|
|
3425
3425
|
UpdateKeyClaimHandler.$inject = ['pathRegistry'];
|
|
3426
3426
|
|
|
3427
3427
|
class UpdatePathClaimHandler {
|
|
3428
|
-
/**
|
|
3429
|
-
* @constructor
|
|
3430
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3428
|
+
/**
|
|
3429
|
+
* @constructor
|
|
3430
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3431
3431
|
*/
|
|
3432
3432
|
constructor(pathRegistry) {
|
|
3433
3433
|
this._pathRegistry = pathRegistry;
|
|
@@ -3989,8 +3989,8 @@ class ValidateBehavior extends CommandInterceptor {
|
|
|
3989
3989
|
constructor(eventBus) {
|
|
3990
3990
|
super(eventBus);
|
|
3991
3991
|
|
|
3992
|
-
/**
|
|
3993
|
-
* Remove custom validation if <validationType> is about to be added.
|
|
3992
|
+
/**
|
|
3993
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
3994
3994
|
*/
|
|
3995
3995
|
this.preExecute('formField.edit', function (context) {
|
|
3996
3996
|
const {
|
|
@@ -4570,22 +4570,22 @@ var SelectionModule = {
|
|
|
4570
4570
|
selectionBehavior: ['type', SelectionBehavior]
|
|
4571
4571
|
};
|
|
4572
4572
|
|
|
4573
|
-
/**
|
|
4574
|
-
* Base class for sectionable UI modules.
|
|
4575
|
-
*
|
|
4576
|
-
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4577
|
-
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4578
|
-
*
|
|
4579
|
-
* @class SectionModuleBase
|
|
4573
|
+
/**
|
|
4574
|
+
* Base class for sectionable UI modules.
|
|
4575
|
+
*
|
|
4576
|
+
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4577
|
+
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4578
|
+
*
|
|
4579
|
+
* @class SectionModuleBase
|
|
4580
4580
|
*/
|
|
4581
4581
|
class SectionModuleBase {
|
|
4582
|
-
/**
|
|
4583
|
-
* Create a SectionModuleBase instance.
|
|
4584
|
-
*
|
|
4585
|
-
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4586
|
-
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4587
|
-
*
|
|
4588
|
-
* @constructor
|
|
4582
|
+
/**
|
|
4583
|
+
* Create a SectionModuleBase instance.
|
|
4584
|
+
*
|
|
4585
|
+
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4586
|
+
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4587
|
+
*
|
|
4588
|
+
* @constructor
|
|
4589
4589
|
*/
|
|
4590
4590
|
constructor(eventBus, sectionKey) {
|
|
4591
4591
|
this._eventBus = eventBus;
|
|
@@ -4598,10 +4598,10 @@ class SectionModuleBase {
|
|
|
4598
4598
|
});
|
|
4599
4599
|
}
|
|
4600
4600
|
|
|
4601
|
-
/**
|
|
4602
|
-
* Attach the managed section to a parent node.
|
|
4603
|
-
*
|
|
4604
|
-
* @param {HTMLElement} container - The parent node to attach to.
|
|
4601
|
+
/**
|
|
4602
|
+
* Attach the managed section to a parent node.
|
|
4603
|
+
*
|
|
4604
|
+
* @param {HTMLElement} container - The parent node to attach to.
|
|
4605
4605
|
*/
|
|
4606
4606
|
attachTo(container) {
|
|
4607
4607
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
|
|
@@ -4609,22 +4609,22 @@ class SectionModuleBase {
|
|
|
4609
4609
|
}));
|
|
4610
4610
|
}
|
|
4611
4611
|
|
|
4612
|
-
/**
|
|
4613
|
-
* Detach the managed section from its parent node.
|
|
4612
|
+
/**
|
|
4613
|
+
* Detach the managed section from its parent node.
|
|
4614
4614
|
*/
|
|
4615
4615
|
detach() {
|
|
4616
4616
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
|
|
4617
4617
|
}
|
|
4618
4618
|
|
|
4619
|
-
/**
|
|
4620
|
-
* Reset the managed section to its initial state.
|
|
4619
|
+
/**
|
|
4620
|
+
* Reset the managed section to its initial state.
|
|
4621
4621
|
*/
|
|
4622
4622
|
reset() {
|
|
4623
4623
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
|
|
4624
4624
|
}
|
|
4625
4625
|
|
|
4626
|
-
/**
|
|
4627
|
-
* Circumvents timing issues.
|
|
4626
|
+
/**
|
|
4627
|
+
* Circumvents timing issues.
|
|
4628
4628
|
*/
|
|
4629
4629
|
_onceSectionRendered(callback) {
|
|
4630
4630
|
if (this.isSectionRendered) {
|
|
@@ -5243,20 +5243,24 @@ function Group(props) {
|
|
|
5243
5243
|
|
|
5244
5244
|
// set edited state depending on all entries
|
|
5245
5245
|
useEffect(() => {
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5246
|
+
// TODO(@barmac): replace with CSS when `:has()` is supported in all major browsers, or rewrite as in https://github.com/camunda/camunda-modeler/issues/3815#issuecomment-1733038161
|
|
5247
|
+
const scheduled = requestAnimationFrame(() => {
|
|
5248
|
+
const hasOneEditedEntry = entries.find(entry => {
|
|
5249
|
+
const {
|
|
5250
|
+
id,
|
|
5251
|
+
isEdited
|
|
5252
|
+
} = entry;
|
|
5253
|
+
const entryNode = query(`[data-entry-id="${id}"]`);
|
|
5254
|
+
if (!isFunction(isEdited) || !entryNode) {
|
|
5255
|
+
return false;
|
|
5256
|
+
}
|
|
5257
|
+
const inputNode = query('.bio-properties-panel-input', entryNode);
|
|
5258
|
+
return isEdited(inputNode);
|
|
5259
|
+
});
|
|
5260
|
+
setEdited(hasOneEditedEntry);
|
|
5257
5261
|
});
|
|
5258
|
-
|
|
5259
|
-
}, [entries]);
|
|
5262
|
+
return () => cancelAnimationFrame(scheduled);
|
|
5263
|
+
}, [entries, setEdited]);
|
|
5260
5264
|
|
|
5261
5265
|
// set error state depending on all entries
|
|
5262
5266
|
const allErrors = useErrors();
|
|
@@ -5684,7 +5688,11 @@ function createDragger(fn, dragPreview) {
|
|
|
5684
5688
|
// (2) setup drag listeners
|
|
5685
5689
|
|
|
5686
5690
|
// attach drag + cleanup event
|
|
5687
|
-
|
|
5691
|
+
// we need to do this to make sure we track cursor
|
|
5692
|
+
// movements before we reach other drag event handlers,
|
|
5693
|
+
// e.g. in child containers.
|
|
5694
|
+
document.addEventListener('dragover', onDrag, true);
|
|
5695
|
+
document.addEventListener('dragenter', preventDefault, true);
|
|
5688
5696
|
document.addEventListener('dragend', onEnd);
|
|
5689
5697
|
document.addEventListener('drop', preventDefault);
|
|
5690
5698
|
}
|
|
@@ -5698,7 +5706,8 @@ function createDragger(fn, dragPreview) {
|
|
|
5698
5706
|
return fn.call(self, event, delta);
|
|
5699
5707
|
}
|
|
5700
5708
|
function onEnd() {
|
|
5701
|
-
document.removeEventListener('dragover', onDrag);
|
|
5709
|
+
document.removeEventListener('dragover', onDrag, true);
|
|
5710
|
+
document.removeEventListener('dragenter', preventDefault, true);
|
|
5702
5711
|
document.removeEventListener('dragend', onEnd);
|
|
5703
5712
|
document.removeEventListener('drop', preventDefault);
|
|
5704
5713
|
}
|
|
@@ -5729,8 +5738,9 @@ const noop$3 = () => {};
|
|
|
5729
5738
|
* @param {boolean} [props.returnFocus]
|
|
5730
5739
|
* @param {boolean} [props.closeOnEscape]
|
|
5731
5740
|
* @param {string} props.title
|
|
5741
|
+
* @param {Ref} [ref]
|
|
5732
5742
|
*/
|
|
5733
|
-
function
|
|
5743
|
+
function PopupComponent(props, globalRef) {
|
|
5734
5744
|
const {
|
|
5735
5745
|
container,
|
|
5736
5746
|
className,
|
|
@@ -5746,7 +5756,8 @@ function Popup(props) {
|
|
|
5746
5756
|
title
|
|
5747
5757
|
} = props;
|
|
5748
5758
|
const focusTrapRef = useRef$1(null);
|
|
5749
|
-
const
|
|
5759
|
+
const localRef = useRef$1(null);
|
|
5760
|
+
const popupRef = globalRef || localRef;
|
|
5750
5761
|
const handleKeydown = event => {
|
|
5751
5762
|
// do not allow keyboard events to bubble
|
|
5752
5763
|
event.stopPropagation();
|
|
@@ -5808,6 +5819,7 @@ function Popup(props) {
|
|
|
5808
5819
|
children: props.children
|
|
5809
5820
|
}), container || document.body);
|
|
5810
5821
|
}
|
|
5822
|
+
const Popup = forwardRef(PopupComponent);
|
|
5811
5823
|
Popup.Title = Title;
|
|
5812
5824
|
Popup.Body = Body;
|
|
5813
5825
|
Popup.Footer = Footer;
|
|
@@ -5816,6 +5828,7 @@ function Title(props) {
|
|
|
5816
5828
|
children,
|
|
5817
5829
|
className,
|
|
5818
5830
|
draggable,
|
|
5831
|
+
emit = () => {},
|
|
5819
5832
|
title,
|
|
5820
5833
|
...rest
|
|
5821
5834
|
} = props;
|
|
@@ -5828,7 +5841,8 @@ function Title(props) {
|
|
|
5828
5841
|
});
|
|
5829
5842
|
const dragPreviewRef = useRef$1();
|
|
5830
5843
|
const titleRef = useRef$1();
|
|
5831
|
-
const onMove =
|
|
5844
|
+
const onMove = (event, delta) => {
|
|
5845
|
+
cancel(event);
|
|
5832
5846
|
const {
|
|
5833
5847
|
x: dx,
|
|
5834
5848
|
y: dy
|
|
@@ -5840,20 +5854,33 @@ function Title(props) {
|
|
|
5840
5854
|
const popupParent = getPopupParent(titleRef.current);
|
|
5841
5855
|
popupParent.style.top = newPosition.y + 'px';
|
|
5842
5856
|
popupParent.style.left = newPosition.x + 'px';
|
|
5843
|
-
|
|
5857
|
+
|
|
5858
|
+
// notify interested parties
|
|
5859
|
+
emit('dragover', {
|
|
5860
|
+
newPosition,
|
|
5861
|
+
delta
|
|
5862
|
+
});
|
|
5863
|
+
};
|
|
5844
5864
|
const onMoveStart = event => {
|
|
5845
5865
|
// initialize drag handler
|
|
5846
5866
|
const onDragStart = createDragger(onMove, dragPreviewRef.current);
|
|
5847
5867
|
onDragStart(event);
|
|
5868
|
+
event.stopPropagation();
|
|
5848
5869
|
const popupParent = getPopupParent(titleRef.current);
|
|
5849
5870
|
const bounds = popupParent.getBoundingClientRect();
|
|
5850
5871
|
context.current.startPosition = {
|
|
5851
5872
|
x: bounds.left,
|
|
5852
5873
|
y: bounds.top
|
|
5853
5874
|
};
|
|
5875
|
+
|
|
5876
|
+
// notify interested parties
|
|
5877
|
+
emit('dragstart');
|
|
5854
5878
|
};
|
|
5855
5879
|
const onMoveEnd = () => {
|
|
5856
5880
|
context.current.newPosition = null;
|
|
5881
|
+
|
|
5882
|
+
// notify interested parties
|
|
5883
|
+
emit('dragend');
|
|
5857
5884
|
};
|
|
5858
5885
|
return jsxs("div", {
|
|
5859
5886
|
class: classnames('bio-properties-panel-popup__header', draggable && 'draggable', className),
|
|
@@ -5906,11 +5933,19 @@ function Footer(props) {
|
|
|
5906
5933
|
function getPopupParent(node) {
|
|
5907
5934
|
return node.closest('.bio-properties-panel-popup');
|
|
5908
5935
|
}
|
|
5936
|
+
function cancel(event) {
|
|
5937
|
+
event.preventDefault();
|
|
5938
|
+
event.stopPropagation();
|
|
5939
|
+
}
|
|
5909
5940
|
const FEEL_POPUP_WIDTH = 700;
|
|
5910
5941
|
const FEEL_POPUP_HEIGHT = 250;
|
|
5911
5942
|
|
|
5912
5943
|
/**
|
|
5913
|
-
* FEEL popup component, built as a singleton.
|
|
5944
|
+
* FEEL popup component, built as a singleton. Emits lifecycle events as follows:
|
|
5945
|
+
* - `feelPopup.open` - fired before the popup is mounted
|
|
5946
|
+
* - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
|
|
5947
|
+
* - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
|
|
5948
|
+
* - `feelPopup.closed` - fired after the popup is unmounted
|
|
5914
5949
|
*/
|
|
5915
5950
|
function FEELPopupRoot(props) {
|
|
5916
5951
|
const {
|
|
@@ -5933,17 +5968,21 @@ function FEELPopupRoot(props) {
|
|
|
5933
5968
|
const isOpen = useCallback(() => {
|
|
5934
5969
|
return !!open;
|
|
5935
5970
|
}, [open]);
|
|
5971
|
+
useUpdateEffect(() => {
|
|
5972
|
+
if (!open) {
|
|
5973
|
+
emit('closed');
|
|
5974
|
+
}
|
|
5975
|
+
}, [open]);
|
|
5936
5976
|
const handleOpen = (entryId, config, _sourceElement) => {
|
|
5937
5977
|
setSource(entryId);
|
|
5938
5978
|
setPopupConfig(config);
|
|
5939
5979
|
setOpen(true);
|
|
5940
5980
|
setSourceElement(_sourceElement);
|
|
5941
|
-
emit('
|
|
5981
|
+
emit('open');
|
|
5942
5982
|
};
|
|
5943
5983
|
const handleClose = () => {
|
|
5944
5984
|
setOpen(false);
|
|
5945
5985
|
setSource(null);
|
|
5946
|
-
emit('closed');
|
|
5947
5986
|
};
|
|
5948
5987
|
const feelPopupContext = {
|
|
5949
5988
|
open: handleOpen,
|
|
@@ -5986,6 +6025,7 @@ function FEELPopupRoot(props) {
|
|
|
5986
6025
|
onClose: handleClose,
|
|
5987
6026
|
container: popupContainer,
|
|
5988
6027
|
sourceElement: sourceElement,
|
|
6028
|
+
emit: emit,
|
|
5989
6029
|
...popupConfig
|
|
5990
6030
|
}), props.children]
|
|
5991
6031
|
});
|
|
@@ -6004,9 +6044,11 @@ function FeelPopupComponent(props) {
|
|
|
6004
6044
|
tooltipContainer,
|
|
6005
6045
|
type,
|
|
6006
6046
|
value,
|
|
6007
|
-
variables
|
|
6047
|
+
variables,
|
|
6048
|
+
emit
|
|
6008
6049
|
} = props;
|
|
6009
6050
|
const editorRef = useRef$1();
|
|
6051
|
+
const popupRef = useRef$1();
|
|
6010
6052
|
const isAutoCompletionOpen = useRef$1(false);
|
|
6011
6053
|
const handleSetReturnFocus = () => {
|
|
6012
6054
|
sourceElement && sourceElement.focus();
|
|
@@ -6029,9 +6071,18 @@ function FeelPopupComponent(props) {
|
|
|
6029
6071
|
}
|
|
6030
6072
|
}
|
|
6031
6073
|
};
|
|
6074
|
+
useEffect(() => {
|
|
6075
|
+
emit('opened', {
|
|
6076
|
+
domNode: popupRef.current
|
|
6077
|
+
});
|
|
6078
|
+
return () => emit('close', {
|
|
6079
|
+
domNode: popupRef.current
|
|
6080
|
+
});
|
|
6081
|
+
}, []);
|
|
6032
6082
|
return jsxs(Popup, {
|
|
6033
6083
|
container: container,
|
|
6034
6084
|
className: "bio-properties-panel-feel-popup",
|
|
6085
|
+
emit: emit,
|
|
6035
6086
|
position: position,
|
|
6036
6087
|
title: title,
|
|
6037
6088
|
onClose: onClose
|
|
@@ -6045,8 +6096,10 @@ function FeelPopupComponent(props) {
|
|
|
6045
6096
|
onPostDeactivate: handleSetReturnFocus,
|
|
6046
6097
|
height: FEEL_POPUP_HEIGHT,
|
|
6047
6098
|
width: FEEL_POPUP_WIDTH,
|
|
6099
|
+
ref: popupRef,
|
|
6048
6100
|
children: [jsx(Popup.Title, {
|
|
6049
6101
|
title: title,
|
|
6102
|
+
emit: emit,
|
|
6050
6103
|
draggable: true
|
|
6051
6104
|
}), jsx(Popup.Body, {
|
|
6052
6105
|
children: jsxs("div", {
|
|
@@ -6096,6 +6149,23 @@ function prefixId$8(id) {
|
|
|
6096
6149
|
function autoCompletionOpen(element) {
|
|
6097
6150
|
return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
|
|
6098
6151
|
}
|
|
6152
|
+
|
|
6153
|
+
/**
|
|
6154
|
+
* This hook behaves like useEffect, but does not trigger on the first render.
|
|
6155
|
+
*
|
|
6156
|
+
* @param {Function} effect
|
|
6157
|
+
* @param {Array} deps
|
|
6158
|
+
*/
|
|
6159
|
+
function useUpdateEffect(effect, deps) {
|
|
6160
|
+
const isMounted = useRef$1(false);
|
|
6161
|
+
useEffect(() => {
|
|
6162
|
+
if (isMounted.current) {
|
|
6163
|
+
return effect();
|
|
6164
|
+
} else {
|
|
6165
|
+
isMounted.current = true;
|
|
6166
|
+
}
|
|
6167
|
+
}, deps);
|
|
6168
|
+
}
|
|
6099
6169
|
function ToggleSwitch(props) {
|
|
6100
6170
|
const {
|
|
6101
6171
|
id,
|
|
@@ -6991,7 +7061,7 @@ function calculatePopupPosition(element) {
|
|
|
6991
7061
|
|
|
6992
7062
|
// todo(pinussilvestrus): make this configurable in the future
|
|
6993
7063
|
function getPopupTitle(element, label) {
|
|
6994
|
-
let popupTitle;
|
|
7064
|
+
let popupTitle = '';
|
|
6995
7065
|
if (element && element.type) {
|
|
6996
7066
|
popupTitle = `${element.type} / `;
|
|
6997
7067
|
}
|
|
@@ -8176,11 +8246,11 @@ var index = {
|
|
|
8176
8246
|
feelPopup: ['type', FeelPopupModule]
|
|
8177
8247
|
};
|
|
8178
8248
|
|
|
8179
|
-
/**
|
|
8180
|
-
* @param {string} type
|
|
8181
|
-
* @param {boolean} [strict]
|
|
8182
|
-
*
|
|
8183
|
-
* @returns {any}
|
|
8249
|
+
/**
|
|
8250
|
+
* @param {string} type
|
|
8251
|
+
* @param {boolean} [strict]
|
|
8252
|
+
*
|
|
8253
|
+
* @returns {any}
|
|
8184
8254
|
*/
|
|
8185
8255
|
function getService(type, strict) {}
|
|
8186
8256
|
const PropertiesPanelContext = createContext({
|
|
@@ -8277,8 +8347,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
8277
8347
|
}
|
|
8278
8348
|
};
|
|
8279
8349
|
|
|
8280
|
-
/**
|
|
8281
|
-
* Provide placeholders for empty and multiple state.
|
|
8350
|
+
/**
|
|
8351
|
+
* Provide placeholders for empty and multiple state.
|
|
8282
8352
|
*/
|
|
8283
8353
|
const PropertiesPanelPlaceholderProvider = {
|
|
8284
8354
|
getEmpty: () => {
|
|
@@ -8350,10 +8420,10 @@ function useService (type, strict) {
|
|
|
8350
8420
|
return getService(type, strict);
|
|
8351
8421
|
}
|
|
8352
8422
|
|
|
8353
|
-
/**
|
|
8354
|
-
* Retrieve list of variables from the form schema.
|
|
8355
|
-
*
|
|
8356
|
-
* @returns { string[] } list of variables used in form schema
|
|
8423
|
+
/**
|
|
8424
|
+
* Retrieve list of variables from the form schema.
|
|
8425
|
+
*
|
|
8426
|
+
* @returns { string[] } list of variables used in form schema
|
|
8357
8427
|
*/
|
|
8358
8428
|
function useVariables() {
|
|
8359
8429
|
const form = useService('formEditor');
|
|
@@ -10004,14 +10074,14 @@ function Value(props) {
|
|
|
10004
10074
|
|
|
10005
10075
|
// helpers //////////
|
|
10006
10076
|
|
|
10007
|
-
/**
|
|
10008
|
-
* Returns copy of object with updated value.
|
|
10009
|
-
*
|
|
10010
|
-
* @param {Object} properties
|
|
10011
|
-
* @param {string} key
|
|
10012
|
-
* @param {string} value
|
|
10013
|
-
*
|
|
10014
|
-
* @returns {Object}
|
|
10077
|
+
/**
|
|
10078
|
+
* Returns copy of object with updated value.
|
|
10079
|
+
*
|
|
10080
|
+
* @param {Object} properties
|
|
10081
|
+
* @param {string} key
|
|
10082
|
+
* @param {string} value
|
|
10083
|
+
*
|
|
10084
|
+
* @returns {Object}
|
|
10015
10085
|
*/
|
|
10016
10086
|
function updateValue(properties, key, value) {
|
|
10017
10087
|
return {
|
|
@@ -10020,14 +10090,14 @@ function updateValue(properties, key, value) {
|
|
|
10020
10090
|
};
|
|
10021
10091
|
}
|
|
10022
10092
|
|
|
10023
|
-
/**
|
|
10024
|
-
* Returns copy of object with updated key.
|
|
10025
|
-
*
|
|
10026
|
-
* @param {Object} properties
|
|
10027
|
-
* @param {string} oldKey
|
|
10028
|
-
* @param {string} newKey
|
|
10029
|
-
*
|
|
10030
|
-
* @returns {Object}
|
|
10093
|
+
/**
|
|
10094
|
+
* Returns copy of object with updated key.
|
|
10095
|
+
*
|
|
10096
|
+
* @param {Object} properties
|
|
10097
|
+
* @param {string} oldKey
|
|
10098
|
+
* @param {string} newKey
|
|
10099
|
+
*
|
|
10100
|
+
* @returns {Object}
|
|
10031
10101
|
*/
|
|
10032
10102
|
function updateKey(properties, oldKey, newKey) {
|
|
10033
10103
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -10136,19 +10206,9 @@ function InputKeyValuesSourceEntry(props) {
|
|
|
10136
10206
|
field,
|
|
10137
10207
|
id
|
|
10138
10208
|
} = props;
|
|
10139
|
-
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10140
|
-
const description = jsxs("div", {
|
|
10141
|
-
children: ["Define which input property to populate the values from.", jsx("br", {}), jsx("br", {}), "The input property may be an array of simple values or alternatively follow this schema:", jsx("pre", {
|
|
10142
|
-
children: jsx("code", {
|
|
10143
|
-
children: schema
|
|
10144
|
-
})
|
|
10145
|
-
})]
|
|
10146
|
-
});
|
|
10147
10209
|
return [{
|
|
10148
10210
|
id: id + '-key',
|
|
10149
10211
|
component: InputValuesKey,
|
|
10150
|
-
label: 'Input values key',
|
|
10151
|
-
description,
|
|
10152
10212
|
isEdited: isEdited,
|
|
10153
10213
|
editField,
|
|
10154
10214
|
field
|
|
@@ -10158,12 +10218,18 @@ function InputValuesKey(props) {
|
|
|
10158
10218
|
const {
|
|
10159
10219
|
editField,
|
|
10160
10220
|
field,
|
|
10161
|
-
id
|
|
10162
|
-
label,
|
|
10163
|
-
description
|
|
10221
|
+
id
|
|
10164
10222
|
} = props;
|
|
10165
10223
|
const debounce = useService('debounce');
|
|
10166
10224
|
const path = VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];
|
|
10225
|
+
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10226
|
+
const tooltip = jsxs("div", {
|
|
10227
|
+
children: ["The input property may be an array of simple values or alternatively follow this schema:", jsx("pre", {
|
|
10228
|
+
children: jsx("code", {
|
|
10229
|
+
children: schema
|
|
10230
|
+
})
|
|
10231
|
+
})]
|
|
10232
|
+
});
|
|
10167
10233
|
const getValue = () => get(field, path, '');
|
|
10168
10234
|
const setValue = (value, error) => {
|
|
10169
10235
|
if (error) {
|
|
@@ -10182,11 +10248,12 @@ function InputValuesKey(props) {
|
|
|
10182
10248
|
};
|
|
10183
10249
|
return TextfieldEntry({
|
|
10184
10250
|
debounce,
|
|
10185
|
-
description,
|
|
10251
|
+
description: 'Define which input property to populate the values from',
|
|
10252
|
+
tooltip,
|
|
10186
10253
|
element: field,
|
|
10187
10254
|
getValue,
|
|
10188
10255
|
id,
|
|
10189
|
-
label,
|
|
10256
|
+
label: 'Input values key',
|
|
10190
10257
|
setValue,
|
|
10191
10258
|
validate
|
|
10192
10259
|
});
|
|
@@ -10462,7 +10529,6 @@ function ValuesExpressionEntry(props) {
|
|
|
10462
10529
|
return [{
|
|
10463
10530
|
id: id + '-expression',
|
|
10464
10531
|
component: ValuesExpression,
|
|
10465
|
-
label: 'Values expression',
|
|
10466
10532
|
isEdited: isEdited$6,
|
|
10467
10533
|
editField,
|
|
10468
10534
|
field
|
|
@@ -10480,8 +10546,8 @@ function ValuesExpression(props) {
|
|
|
10480
10546
|
}));
|
|
10481
10547
|
const path = VALUES_SOURCES_PATHS[VALUES_SOURCES.EXPRESSION];
|
|
10482
10548
|
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10483
|
-
const
|
|
10484
|
-
children: ["
|
|
10549
|
+
const tooltip = jsxs("div", {
|
|
10550
|
+
children: ["The expression may result in an array of simple values or alternatively follow this schema:", jsx("pre", {
|
|
10485
10551
|
children: jsx("code", {
|
|
10486
10552
|
children: schema
|
|
10487
10553
|
})
|
|
@@ -10491,7 +10557,8 @@ function ValuesExpression(props) {
|
|
|
10491
10557
|
const setValue = value => editField(field, path, value || '');
|
|
10492
10558
|
return FeelEntry({
|
|
10493
10559
|
debounce,
|
|
10494
|
-
description,
|
|
10560
|
+
description: 'Define an expression to populate the options from.',
|
|
10561
|
+
tooltip,
|
|
10495
10562
|
element: field,
|
|
10496
10563
|
feel: 'required',
|
|
10497
10564
|
getValue,
|
|
@@ -10860,8 +10927,8 @@ function ValuesGroups(field, editField) {
|
|
|
10860
10927
|
};
|
|
10861
10928
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
10862
10929
|
|
|
10863
|
-
/**
|
|
10864
|
-
* @type {Array<Group|ListGroup>}
|
|
10930
|
+
/**
|
|
10931
|
+
* @type {Array<Group|ListGroup>}
|
|
10865
10932
|
*/
|
|
10866
10933
|
const groups = [{
|
|
10867
10934
|
id: valuesSourceId,
|
|
@@ -10982,13 +11049,13 @@ function CustomPropertiesGroup(field, editField) {
|
|
|
10982
11049
|
|
|
10983
11050
|
// helpers //////////
|
|
10984
11051
|
|
|
10985
|
-
/**
|
|
10986
|
-
* Returns copy of object without key.
|
|
10987
|
-
*
|
|
10988
|
-
* @param {Object} properties
|
|
10989
|
-
* @param {string} oldKey
|
|
10990
|
-
*
|
|
10991
|
-
* @returns {Object}
|
|
11052
|
+
/**
|
|
11053
|
+
* Returns copy of object without key.
|
|
11054
|
+
*
|
|
11055
|
+
* @param {Object} properties
|
|
11056
|
+
* @param {string} oldKey
|
|
11057
|
+
*
|
|
11058
|
+
* @returns {Object}
|
|
10992
11059
|
*/
|
|
10993
11060
|
function removeKey(properties, oldKey) {
|
|
10994
11061
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -11095,9 +11162,9 @@ function FormPropertiesPanel(props) {
|
|
|
11095
11162
|
});
|
|
11096
11163
|
}, [eventBus, formEditor, selectionModule]);
|
|
11097
11164
|
useLayoutEffect(() => {
|
|
11098
|
-
/**
|
|
11099
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
11100
|
-
* once we have a proper updater/change support
|
|
11165
|
+
/**
|
|
11166
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
11167
|
+
* once we have a proper updater/change support
|
|
11101
11168
|
*/
|
|
11102
11169
|
eventBus.on('changed', refresh);
|
|
11103
11170
|
eventBus.on('import.done', refresh);
|
|
@@ -11150,10 +11217,10 @@ class PropertiesPanelRenderer {
|
|
|
11150
11217
|
});
|
|
11151
11218
|
}
|
|
11152
11219
|
|
|
11153
|
-
/**
|
|
11154
|
-
* Attach the properties panel to a parent node.
|
|
11155
|
-
*
|
|
11156
|
-
* @param {HTMLElement} container
|
|
11220
|
+
/**
|
|
11221
|
+
* Attach the properties panel to a parent node.
|
|
11222
|
+
*
|
|
11223
|
+
* @param {HTMLElement} container
|
|
11157
11224
|
*/
|
|
11158
11225
|
attachTo(container) {
|
|
11159
11226
|
if (!container) {
|
|
@@ -11173,8 +11240,8 @@ class PropertiesPanelRenderer {
|
|
|
11173
11240
|
this._eventBus.fire('propertiesPanel.attach');
|
|
11174
11241
|
}
|
|
11175
11242
|
|
|
11176
|
-
/**
|
|
11177
|
-
* Detach the properties panel from its parent node.
|
|
11243
|
+
/**
|
|
11244
|
+
* Detach the properties panel from its parent node.
|
|
11178
11245
|
*/
|
|
11179
11246
|
detach() {
|
|
11180
11247
|
const parentNode = this._container.parentNode;
|
|
@@ -11205,10 +11272,10 @@ var PropertiesPanelModule = {
|
|
|
11205
11272
|
propertiesPanel: ['type', PropertiesPanelRenderer]
|
|
11206
11273
|
};
|
|
11207
11274
|
|
|
11208
|
-
/**
|
|
11209
|
-
* Manages the rendering of visual plugins.
|
|
11210
|
-
* @constructor
|
|
11211
|
-
* @param {Object} eventBus - Event bus for the application.
|
|
11275
|
+
/**
|
|
11276
|
+
* Manages the rendering of visual plugins.
|
|
11277
|
+
* @constructor
|
|
11278
|
+
* @param {Object} eventBus - Event bus for the application.
|
|
11212
11279
|
*/
|
|
11213
11280
|
class RenderInjector extends SectionModuleBase {
|
|
11214
11281
|
constructor(eventBus) {
|
|
@@ -11217,10 +11284,10 @@ class RenderInjector extends SectionModuleBase {
|
|
|
11217
11284
|
this.registeredRenderers = [];
|
|
11218
11285
|
}
|
|
11219
11286
|
|
|
11220
|
-
/**
|
|
11221
|
-
* Inject a new renderer into the injector.
|
|
11222
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
11223
|
-
* @param {Function} Renderer - The renderer function.
|
|
11287
|
+
/**
|
|
11288
|
+
* Inject a new renderer into the injector.
|
|
11289
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
11290
|
+
* @param {Function} Renderer - The renderer function.
|
|
11224
11291
|
*/
|
|
11225
11292
|
attachRenderer(identifier, Renderer) {
|
|
11226
11293
|
this.registeredRenderers = [...this.registeredRenderers, {
|
|
@@ -11229,17 +11296,17 @@ class RenderInjector extends SectionModuleBase {
|
|
|
11229
11296
|
}];
|
|
11230
11297
|
}
|
|
11231
11298
|
|
|
11232
|
-
/**
|
|
11233
|
-
* Detach a renderer from the by key injector.
|
|
11234
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
11299
|
+
/**
|
|
11300
|
+
* Detach a renderer from the by key injector.
|
|
11301
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
11235
11302
|
*/
|
|
11236
11303
|
detachRenderer(identifier) {
|
|
11237
11304
|
this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
|
|
11238
11305
|
}
|
|
11239
11306
|
|
|
11240
|
-
/**
|
|
11241
|
-
* Returns the registered renderers.
|
|
11242
|
-
* @returns {Array} Array of registered renderers.
|
|
11307
|
+
/**
|
|
11308
|
+
* Returns the registered renderers.
|
|
11309
|
+
* @returns {Array} Array of registered renderers.
|
|
11243
11310
|
*/
|
|
11244
11311
|
fetchRenderers() {
|
|
11245
11312
|
return this.registeredRenderers;
|
|
@@ -11273,48 +11340,48 @@ var ExpressionLanguageModule = {
|
|
|
11273
11340
|
|
|
11274
11341
|
const ids = new Ids([32, 36, 1]);
|
|
11275
11342
|
|
|
11276
|
-
/**
|
|
11277
|
-
* @typedef { import('./types').Injector } Injector
|
|
11278
|
-
* @typedef { import('./types').Module } Module
|
|
11279
|
-
* @typedef { import('./types').Schema } Schema
|
|
11280
|
-
*
|
|
11281
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
11282
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
11283
|
-
*
|
|
11284
|
-
* @typedef { {
|
|
11285
|
-
* properties: FormEditorProperties,
|
|
11286
|
-
* schema: Schema
|
|
11287
|
-
* } } State
|
|
11288
|
-
*
|
|
11289
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
11290
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
11291
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
11343
|
+
/**
|
|
11344
|
+
* @typedef { import('./types').Injector } Injector
|
|
11345
|
+
* @typedef { import('./types').Module } Module
|
|
11346
|
+
* @typedef { import('./types').Schema } Schema
|
|
11347
|
+
*
|
|
11348
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
11349
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
11350
|
+
*
|
|
11351
|
+
* @typedef { {
|
|
11352
|
+
* properties: FormEditorProperties,
|
|
11353
|
+
* schema: Schema
|
|
11354
|
+
* } } State
|
|
11355
|
+
*
|
|
11356
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
11357
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
11358
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
11292
11359
|
*/
|
|
11293
11360
|
|
|
11294
|
-
/**
|
|
11295
|
-
* The form editor.
|
|
11361
|
+
/**
|
|
11362
|
+
* The form editor.
|
|
11296
11363
|
*/
|
|
11297
11364
|
class FormEditor {
|
|
11298
|
-
/**
|
|
11299
|
-
* @constructor
|
|
11300
|
-
* @param {FormEditorOptions} options
|
|
11365
|
+
/**
|
|
11366
|
+
* @constructor
|
|
11367
|
+
* @param {FormEditorOptions} options
|
|
11301
11368
|
*/
|
|
11302
11369
|
constructor(options = {}) {
|
|
11303
|
-
/**
|
|
11304
|
-
* @public
|
|
11305
|
-
* @type {OnEventType}
|
|
11370
|
+
/**
|
|
11371
|
+
* @public
|
|
11372
|
+
* @type {OnEventType}
|
|
11306
11373
|
*/
|
|
11307
11374
|
this.on = this._onEvent;
|
|
11308
11375
|
|
|
11309
|
-
/**
|
|
11310
|
-
* @public
|
|
11311
|
-
* @type {String}
|
|
11376
|
+
/**
|
|
11377
|
+
* @public
|
|
11378
|
+
* @type {String}
|
|
11312
11379
|
*/
|
|
11313
11380
|
this._id = ids.next();
|
|
11314
11381
|
|
|
11315
|
-
/**
|
|
11316
|
-
* @private
|
|
11317
|
-
* @type {Element}
|
|
11382
|
+
/**
|
|
11383
|
+
* @private
|
|
11384
|
+
* @type {Element}
|
|
11318
11385
|
*/
|
|
11319
11386
|
this._container = createFormContainer();
|
|
11320
11387
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -11325,15 +11392,15 @@ class FormEditor {
|
|
|
11325
11392
|
properties = {}
|
|
11326
11393
|
} = options;
|
|
11327
11394
|
|
|
11328
|
-
/**
|
|
11329
|
-
* @private
|
|
11330
|
-
* @type {any}
|
|
11395
|
+
/**
|
|
11396
|
+
* @private
|
|
11397
|
+
* @type {any}
|
|
11331
11398
|
*/
|
|
11332
11399
|
this.exporter = exporter;
|
|
11333
11400
|
|
|
11334
|
-
/**
|
|
11335
|
-
* @private
|
|
11336
|
-
* @type {State}
|
|
11401
|
+
/**
|
|
11402
|
+
* @private
|
|
11403
|
+
* @type {State}
|
|
11337
11404
|
*/
|
|
11338
11405
|
this._state = {
|
|
11339
11406
|
properties,
|
|
@@ -11362,10 +11429,10 @@ class FormEditor {
|
|
|
11362
11429
|
this._detach(false);
|
|
11363
11430
|
}
|
|
11364
11431
|
|
|
11365
|
-
/**
|
|
11366
|
-
* @param {Schema} schema
|
|
11367
|
-
*
|
|
11368
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
11432
|
+
/**
|
|
11433
|
+
* @param {Schema} schema
|
|
11434
|
+
*
|
|
11435
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
11369
11436
|
*/
|
|
11370
11437
|
importSchema(schema) {
|
|
11371
11438
|
return new Promise((resolve, reject) => {
|
|
@@ -11394,15 +11461,15 @@ class FormEditor {
|
|
|
11394
11461
|
});
|
|
11395
11462
|
}
|
|
11396
11463
|
|
|
11397
|
-
/**
|
|
11398
|
-
* @returns {Schema}
|
|
11464
|
+
/**
|
|
11465
|
+
* @returns {Schema}
|
|
11399
11466
|
*/
|
|
11400
11467
|
saveSchema() {
|
|
11401
11468
|
return this.getSchema();
|
|
11402
11469
|
}
|
|
11403
11470
|
|
|
11404
|
-
/**
|
|
11405
|
-
* @returns {Schema}
|
|
11471
|
+
/**
|
|
11472
|
+
* @returns {Schema}
|
|
11406
11473
|
*/
|
|
11407
11474
|
getSchema() {
|
|
11408
11475
|
const {
|
|
@@ -11411,8 +11478,8 @@ class FormEditor {
|
|
|
11411
11478
|
return exportSchema(schema, this.exporter, schemaVersion);
|
|
11412
11479
|
}
|
|
11413
11480
|
|
|
11414
|
-
/**
|
|
11415
|
-
* @param {Element|string} parentNode
|
|
11481
|
+
/**
|
|
11482
|
+
* @param {Element|string} parentNode
|
|
11416
11483
|
*/
|
|
11417
11484
|
attachTo(parentNode) {
|
|
11418
11485
|
if (!parentNode) {
|
|
@@ -11430,10 +11497,10 @@ class FormEditor {
|
|
|
11430
11497
|
this._detach();
|
|
11431
11498
|
}
|
|
11432
11499
|
|
|
11433
|
-
/**
|
|
11434
|
-
* @internal
|
|
11435
|
-
*
|
|
11436
|
-
* @param {boolean} [emit]
|
|
11500
|
+
/**
|
|
11501
|
+
* @internal
|
|
11502
|
+
*
|
|
11503
|
+
* @param {boolean} [emit]
|
|
11437
11504
|
*/
|
|
11438
11505
|
_detach(emit = true) {
|
|
11439
11506
|
const container = this._container,
|
|
@@ -11447,9 +11514,9 @@ class FormEditor {
|
|
|
11447
11514
|
parentNode.removeChild(container);
|
|
11448
11515
|
}
|
|
11449
11516
|
|
|
11450
|
-
/**
|
|
11451
|
-
* @param {any} property
|
|
11452
|
-
* @param {any} value
|
|
11517
|
+
/**
|
|
11518
|
+
* @param {any} property
|
|
11519
|
+
* @param {any} value
|
|
11453
11520
|
*/
|
|
11454
11521
|
setProperty(property, value) {
|
|
11455
11522
|
const properties = set$1(this._getState().properties, [property], value);
|
|
@@ -11458,21 +11525,21 @@ class FormEditor {
|
|
|
11458
11525
|
});
|
|
11459
11526
|
}
|
|
11460
11527
|
|
|
11461
|
-
/**
|
|
11462
|
-
* @param {string} type
|
|
11463
|
-
* @param {Function} handler
|
|
11528
|
+
/**
|
|
11529
|
+
* @param {string} type
|
|
11530
|
+
* @param {Function} handler
|
|
11464
11531
|
*/
|
|
11465
11532
|
off(type, handler) {
|
|
11466
11533
|
this.get('eventBus').off(type, handler);
|
|
11467
11534
|
}
|
|
11468
11535
|
|
|
11469
|
-
/**
|
|
11470
|
-
* @internal
|
|
11471
|
-
*
|
|
11472
|
-
* @param {FormEditorOptions} options
|
|
11473
|
-
* @param {Element} container
|
|
11474
|
-
*
|
|
11475
|
-
* @returns {Injector}
|
|
11536
|
+
/**
|
|
11537
|
+
* @internal
|
|
11538
|
+
*
|
|
11539
|
+
* @param {FormEditorOptions} options
|
|
11540
|
+
* @param {Element} container
|
|
11541
|
+
*
|
|
11542
|
+
* @returns {Injector}
|
|
11476
11543
|
*/
|
|
11477
11544
|
_createInjector(options, container) {
|
|
11478
11545
|
const {
|
|
@@ -11494,22 +11561,22 @@ class FormEditor {
|
|
|
11494
11561
|
}, core, ...modules, ...additionalModules]);
|
|
11495
11562
|
}
|
|
11496
11563
|
|
|
11497
|
-
/**
|
|
11498
|
-
* @internal
|
|
11564
|
+
/**
|
|
11565
|
+
* @internal
|
|
11499
11566
|
*/
|
|
11500
11567
|
_emit(type, data) {
|
|
11501
11568
|
this.get('eventBus').fire(type, data);
|
|
11502
11569
|
}
|
|
11503
11570
|
|
|
11504
|
-
/**
|
|
11505
|
-
* @internal
|
|
11571
|
+
/**
|
|
11572
|
+
* @internal
|
|
11506
11573
|
*/
|
|
11507
11574
|
_getState() {
|
|
11508
11575
|
return this._state;
|
|
11509
11576
|
}
|
|
11510
11577
|
|
|
11511
|
-
/**
|
|
11512
|
-
* @internal
|
|
11578
|
+
/**
|
|
11579
|
+
* @internal
|
|
11513
11580
|
*/
|
|
11514
11581
|
_setState(state) {
|
|
11515
11582
|
this._state = {
|
|
@@ -11519,15 +11586,15 @@ class FormEditor {
|
|
|
11519
11586
|
this._emit('changed', this._getState());
|
|
11520
11587
|
}
|
|
11521
11588
|
|
|
11522
|
-
/**
|
|
11523
|
-
* @internal
|
|
11589
|
+
/**
|
|
11590
|
+
* @internal
|
|
11524
11591
|
*/
|
|
11525
11592
|
_getModules() {
|
|
11526
11593
|
return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
|
|
11527
11594
|
}
|
|
11528
11595
|
|
|
11529
|
-
/**
|
|
11530
|
-
* @internal
|
|
11596
|
+
/**
|
|
11597
|
+
* @internal
|
|
11531
11598
|
*/
|
|
11532
11599
|
_onEvent(type, priority, handler) {
|
|
11533
11600
|
this.get('eventBus').on(type, priority, handler);
|