@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.cjs
CHANGED
|
@@ -537,10 +537,10 @@ function invokeFunction(fn, args) {
|
|
|
537
537
|
return fn.apply(null, args);
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
-
/**
|
|
541
|
-
* A factory to create a configurable debouncer.
|
|
542
|
-
*
|
|
543
|
-
* @param {number|boolean} [config=true]
|
|
540
|
+
/**
|
|
541
|
+
* A factory to create a configurable debouncer.
|
|
542
|
+
*
|
|
543
|
+
* @param {number|boolean} [config=true]
|
|
544
544
|
*/
|
|
545
545
|
function DebounceFactory(config = true) {
|
|
546
546
|
const timeout = typeof config === 'number' ? config : config ? 300 : 0;
|
|
@@ -553,11 +553,11 @@ function DebounceFactory(config = true) {
|
|
|
553
553
|
DebounceFactory.$inject = ['config.debounce'];
|
|
554
554
|
|
|
555
555
|
class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
556
|
-
/**
|
|
557
|
-
* Updates a form fields id.
|
|
558
|
-
*
|
|
559
|
-
* @param {Object} formField
|
|
560
|
-
* @param {string} newId
|
|
556
|
+
/**
|
|
557
|
+
* Updates a form fields id.
|
|
558
|
+
*
|
|
559
|
+
* @param {Object} formField
|
|
560
|
+
* @param {string} newId
|
|
561
561
|
*/
|
|
562
562
|
updateId(formField, newId) {
|
|
563
563
|
this._validateId(newId);
|
|
@@ -578,13 +578,13 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
/**
|
|
582
|
-
* Validate the suitability of the given id and signals a problem
|
|
583
|
-
* with an exception.
|
|
584
|
-
*
|
|
585
|
-
* @param {string} id
|
|
586
|
-
*
|
|
587
|
-
* @throws {Error} if id is empty or already assigned
|
|
581
|
+
/**
|
|
582
|
+
* Validate the suitability of the given id and signals a problem
|
|
583
|
+
* with an exception.
|
|
584
|
+
*
|
|
585
|
+
* @param {string} id
|
|
586
|
+
*
|
|
587
|
+
* @throws {Error} if id is empty or already assigned
|
|
588
588
|
*/
|
|
589
589
|
_validateId(id) {
|
|
590
590
|
if (!id) {
|
|
@@ -601,11 +601,11 @@ const MAX_COLUMNS = 16;
|
|
|
601
601
|
const MIN_COLUMNS = 2;
|
|
602
602
|
const MAX_FIELDS_PER_ROW = 4;
|
|
603
603
|
class FormLayoutValidator {
|
|
604
|
-
/**
|
|
605
|
-
* @constructor
|
|
606
|
-
*
|
|
607
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
608
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
604
|
+
/**
|
|
605
|
+
* @constructor
|
|
606
|
+
*
|
|
607
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
608
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
609
609
|
*/
|
|
610
610
|
constructor(formLayouter, formFieldRegistry) {
|
|
611
611
|
this._formLayouter = formLayouter;
|
|
@@ -676,21 +676,21 @@ function editorFormFieldClasses(type, {
|
|
|
676
676
|
});
|
|
677
677
|
}
|
|
678
678
|
|
|
679
|
-
/**
|
|
680
|
-
* Add a dragger that calls back the passed function with
|
|
681
|
-
* { event, delta } on drag.
|
|
682
|
-
*
|
|
683
|
-
* @example
|
|
684
|
-
*
|
|
685
|
-
* function dragMove(event, delta) {
|
|
686
|
-
* // we are dragging (!!)
|
|
687
|
-
* }
|
|
688
|
-
*
|
|
689
|
-
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
690
|
-
*
|
|
691
|
-
* @param {Function} fn
|
|
692
|
-
*
|
|
693
|
-
* @return {Function} drag start callback function
|
|
679
|
+
/**
|
|
680
|
+
* Add a dragger that calls back the passed function with
|
|
681
|
+
* { event, delta } on drag.
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
*
|
|
685
|
+
* function dragMove(event, delta) {
|
|
686
|
+
* // we are dragging (!!)
|
|
687
|
+
* }
|
|
688
|
+
*
|
|
689
|
+
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
690
|
+
*
|
|
691
|
+
* @param {Function} fn
|
|
692
|
+
*
|
|
693
|
+
* @return {Function} drag start callback function
|
|
694
694
|
*/
|
|
695
695
|
function createDragger$1(fn) {
|
|
696
696
|
let self;
|
|
@@ -731,12 +731,12 @@ function createDragger$1(fn) {
|
|
|
731
731
|
return onDragStart;
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
/**
|
|
735
|
-
* Throttle function call according UI update cycle.
|
|
736
|
-
*
|
|
737
|
-
* @param {Function} fn
|
|
738
|
-
*
|
|
739
|
-
* @return {Function} throttled fn
|
|
734
|
+
/**
|
|
735
|
+
* Throttle function call according UI update cycle.
|
|
736
|
+
*
|
|
737
|
+
* @param {Function} fn
|
|
738
|
+
*
|
|
739
|
+
* @return {Function} throttled fn
|
|
740
740
|
*/
|
|
741
741
|
function throttle(fn) {
|
|
742
742
|
let active = false;
|
|
@@ -770,11 +770,11 @@ const DragAndDropContext = preact.createContext({
|
|
|
770
770
|
});
|
|
771
771
|
var DragAndDropContext$1 = DragAndDropContext;
|
|
772
772
|
|
|
773
|
-
/**
|
|
774
|
-
* @param {string} type
|
|
775
|
-
* @param {boolean} [strict]
|
|
776
|
-
*
|
|
777
|
-
* @returns {any}
|
|
773
|
+
/**
|
|
774
|
+
* @param {string} type
|
|
775
|
+
* @param {boolean} [strict]
|
|
776
|
+
*
|
|
777
|
+
* @returns {any}
|
|
778
778
|
*/
|
|
779
779
|
function getService$1(type, strict) {}
|
|
780
780
|
const FormEditorContext = preact.createContext({
|
|
@@ -1124,23 +1124,23 @@ var Slot = (props => {
|
|
|
1124
1124
|
return fillsAndSeparators;
|
|
1125
1125
|
});
|
|
1126
1126
|
|
|
1127
|
-
/**
|
|
1128
|
-
* Creates a Fragment for a fill.
|
|
1129
|
-
*
|
|
1130
|
-
* @param {Object} fill Fill to be rendered
|
|
1131
|
-
* @returns {Object} Preact Fragment containing fill's children
|
|
1127
|
+
/**
|
|
1128
|
+
* Creates a Fragment for a fill.
|
|
1129
|
+
*
|
|
1130
|
+
* @param {Object} fill Fill to be rendered
|
|
1131
|
+
* @returns {Object} Preact Fragment containing fill's children
|
|
1132
1132
|
*/
|
|
1133
1133
|
const FillFragment = fill => jsxRuntime.jsx(preact.Fragment, {
|
|
1134
1134
|
children: fill.children
|
|
1135
1135
|
}, fill.id);
|
|
1136
1136
|
|
|
1137
|
-
/**
|
|
1138
|
-
* Creates an array of fills, with separators inserted between groups.
|
|
1139
|
-
*
|
|
1140
|
-
* @param {Array} groups Groups of fills
|
|
1141
|
-
* @param {Function} fillRenderer Function to create a fill
|
|
1142
|
-
* @param {Function} separatorRenderer Function to create a separator
|
|
1143
|
-
* @returns {Array} Array of fills and separators
|
|
1137
|
+
/**
|
|
1138
|
+
* Creates an array of fills, with separators inserted between groups.
|
|
1139
|
+
*
|
|
1140
|
+
* @param {Array} groups Groups of fills
|
|
1141
|
+
* @param {Function} fillRenderer Function to create a fill
|
|
1142
|
+
* @param {Function} separatorRenderer Function to create a separator
|
|
1143
|
+
* @returns {Array} Array of fills and separators
|
|
1144
1144
|
*/
|
|
1145
1145
|
const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
1146
1146
|
const result = [];
|
|
@@ -1158,8 +1158,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
|
1158
1158
|
return result;
|
|
1159
1159
|
};
|
|
1160
1160
|
|
|
1161
|
-
/**
|
|
1162
|
-
* Groups fills by group name property.
|
|
1161
|
+
/**
|
|
1162
|
+
* Groups fills by group name property.
|
|
1163
1163
|
*/
|
|
1164
1164
|
const _groupByGroupName = fills => {
|
|
1165
1165
|
const groups = [];
|
|
@@ -1179,8 +1179,8 @@ const _groupByGroupName = fills => {
|
|
|
1179
1179
|
return Object.keys(groupsById).sort().map(id => groupsById[id]);
|
|
1180
1180
|
};
|
|
1181
1181
|
|
|
1182
|
-
/**
|
|
1183
|
-
* Compares fills by priority.
|
|
1182
|
+
/**
|
|
1183
|
+
* Compares fills by priority.
|
|
1184
1184
|
*/
|
|
1185
1185
|
const _comparePriority = (a, b) => {
|
|
1186
1186
|
return (b.priority || 0) - (a.priority || 0);
|
|
@@ -1408,20 +1408,20 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
|
|
|
1408
1408
|
const DRAG_NO_MOVE_CLS = 'fjs-no-move';
|
|
1409
1409
|
const ERROR_DROP_CLS = 'fjs-error-drop';
|
|
1410
1410
|
|
|
1411
|
-
/**
|
|
1412
|
-
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1411
|
+
/**
|
|
1412
|
+
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1413
1413
|
*/
|
|
1414
1414
|
|
|
1415
1415
|
class Dragging {
|
|
1416
|
-
/**
|
|
1417
|
-
* @constructor
|
|
1418
|
-
*
|
|
1419
|
-
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1420
|
-
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1421
|
-
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1422
|
-
* @param { import('../../core/EventBus').default } eventBus
|
|
1423
|
-
* @param { import('../modeling/Modeling').default } modeling
|
|
1424
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
1416
|
+
/**
|
|
1417
|
+
* @constructor
|
|
1418
|
+
*
|
|
1419
|
+
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1420
|
+
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1421
|
+
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1422
|
+
* @param { import('../../core/EventBus').default } eventBus
|
|
1423
|
+
* @param { import('../modeling/Modeling').default } modeling
|
|
1424
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
1425
1425
|
*/
|
|
1426
1426
|
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling, pathRegistry) {
|
|
1427
1427
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -1432,13 +1432,13 @@ class Dragging {
|
|
|
1432
1432
|
this._pathRegistry = pathRegistry;
|
|
1433
1433
|
}
|
|
1434
1434
|
|
|
1435
|
-
/**
|
|
1436
|
-
* Calculcates position in form schema given the dropped place.
|
|
1437
|
-
*
|
|
1438
|
-
* @param { FormRow } targetRow
|
|
1439
|
-
* @param { any } targetFormField
|
|
1440
|
-
* @param { HTMLElement } sibling
|
|
1441
|
-
* @returns { number }
|
|
1435
|
+
/**
|
|
1436
|
+
* Calculcates position in form schema given the dropped place.
|
|
1437
|
+
*
|
|
1438
|
+
* @param { FormRow } targetRow
|
|
1439
|
+
* @param { any } targetFormField
|
|
1440
|
+
* @param { HTMLElement } sibling
|
|
1441
|
+
* @returns { number }
|
|
1442
1442
|
*/
|
|
1443
1443
|
getTargetIndex(targetRow, targetFormField, sibling) {
|
|
1444
1444
|
/** @type HTMLElement */
|
|
@@ -1579,8 +1579,8 @@ class Dragging {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
-
/**
|
|
1583
|
-
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1582
|
+
/**
|
|
1583
|
+
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1584
1584
|
*/
|
|
1585
1585
|
createDragulaInstance(options) {
|
|
1586
1586
|
const {
|
|
@@ -1994,7 +1994,7 @@ function DebugColumns(props) {
|
|
|
1994
1994
|
return null;
|
|
1995
1995
|
}
|
|
1996
1996
|
return jsxRuntime.jsx("div", {
|
|
1997
|
-
style: "width: fit-content
|
|
1997
|
+
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;",
|
|
1998
1998
|
class: "fjs-debug-columns",
|
|
1999
1999
|
children: (field.layout || {}).columns || 'auto'
|
|
2000
2000
|
});
|
|
@@ -3065,10 +3065,10 @@ function updateRow(formField, rowId) {
|
|
|
3065
3065
|
}
|
|
3066
3066
|
|
|
3067
3067
|
class AddFormFieldHandler {
|
|
3068
|
-
/**
|
|
3069
|
-
* @constructor
|
|
3070
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3071
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3068
|
+
/**
|
|
3069
|
+
* @constructor
|
|
3070
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3071
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3072
3072
|
*/
|
|
3073
3073
|
constructor(formEditor, formFieldRegistry) {
|
|
3074
3074
|
this._formEditor = formEditor;
|
|
@@ -3129,10 +3129,10 @@ class AddFormFieldHandler {
|
|
|
3129
3129
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3130
3130
|
|
|
3131
3131
|
class EditFormFieldHandler {
|
|
3132
|
-
/**
|
|
3133
|
-
* @constructor
|
|
3134
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3135
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3132
|
+
/**
|
|
3133
|
+
* @constructor
|
|
3134
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3135
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3136
3136
|
*/
|
|
3137
3137
|
constructor(formEditor, formFieldRegistry) {
|
|
3138
3138
|
this._formEditor = formEditor;
|
|
@@ -3195,11 +3195,11 @@ class EditFormFieldHandler {
|
|
|
3195
3195
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3196
3196
|
|
|
3197
3197
|
class MoveFormFieldHandler {
|
|
3198
|
-
/**
|
|
3199
|
-
* @constructor
|
|
3200
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3201
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3202
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3198
|
+
/**
|
|
3199
|
+
* @constructor
|
|
3200
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3201
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3202
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3203
3203
|
*/
|
|
3204
3204
|
constructor(formEditor, formFieldRegistry, pathRegistry) {
|
|
3205
3205
|
this._formEditor = formEditor;
|
|
@@ -3304,10 +3304,10 @@ class MoveFormFieldHandler {
|
|
|
3304
3304
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry', 'pathRegistry'];
|
|
3305
3305
|
|
|
3306
3306
|
class RemoveFormFieldHandler {
|
|
3307
|
-
/**
|
|
3308
|
-
* @constructor
|
|
3309
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3310
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3307
|
+
/**
|
|
3308
|
+
* @constructor
|
|
3309
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3310
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3311
3311
|
*/
|
|
3312
3312
|
constructor(formEditor, formFieldRegistry) {
|
|
3313
3313
|
this._formEditor = formEditor;
|
|
@@ -3367,9 +3367,9 @@ class RemoveFormFieldHandler {
|
|
|
3367
3367
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3368
3368
|
|
|
3369
3369
|
class UpdateIdClaimHandler {
|
|
3370
|
-
/**
|
|
3371
|
-
* @constructor
|
|
3372
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3370
|
+
/**
|
|
3371
|
+
* @constructor
|
|
3372
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3373
3373
|
*/
|
|
3374
3374
|
constructor(formFieldRegistry) {
|
|
3375
3375
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3402,9 +3402,9 @@ class UpdateIdClaimHandler {
|
|
|
3402
3402
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
3403
3403
|
|
|
3404
3404
|
class UpdateKeyClaimHandler {
|
|
3405
|
-
/**
|
|
3406
|
-
* @constructor
|
|
3407
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3405
|
+
/**
|
|
3406
|
+
* @constructor
|
|
3407
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3408
3408
|
*/
|
|
3409
3409
|
constructor(pathRegistry) {
|
|
3410
3410
|
this._pathRegistry = pathRegistry;
|
|
@@ -3445,9 +3445,9 @@ class UpdateKeyClaimHandler {
|
|
|
3445
3445
|
UpdateKeyClaimHandler.$inject = ['pathRegistry'];
|
|
3446
3446
|
|
|
3447
3447
|
class UpdatePathClaimHandler {
|
|
3448
|
-
/**
|
|
3449
|
-
* @constructor
|
|
3450
|
-
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3448
|
+
/**
|
|
3449
|
+
* @constructor
|
|
3450
|
+
* @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
|
|
3451
3451
|
*/
|
|
3452
3452
|
constructor(pathRegistry) {
|
|
3453
3453
|
this._pathRegistry = pathRegistry;
|
|
@@ -4009,8 +4009,8 @@ class ValidateBehavior extends CommandInterceptor {
|
|
|
4009
4009
|
constructor(eventBus) {
|
|
4010
4010
|
super(eventBus);
|
|
4011
4011
|
|
|
4012
|
-
/**
|
|
4013
|
-
* Remove custom validation if <validationType> is about to be added.
|
|
4012
|
+
/**
|
|
4013
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
4014
4014
|
*/
|
|
4015
4015
|
this.preExecute('formField.edit', function (context) {
|
|
4016
4016
|
const {
|
|
@@ -4590,22 +4590,22 @@ var SelectionModule = {
|
|
|
4590
4590
|
selectionBehavior: ['type', SelectionBehavior]
|
|
4591
4591
|
};
|
|
4592
4592
|
|
|
4593
|
-
/**
|
|
4594
|
-
* Base class for sectionable UI modules.
|
|
4595
|
-
*
|
|
4596
|
-
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4597
|
-
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4598
|
-
*
|
|
4599
|
-
* @class SectionModuleBase
|
|
4593
|
+
/**
|
|
4594
|
+
* Base class for sectionable UI modules.
|
|
4595
|
+
*
|
|
4596
|
+
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4597
|
+
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4598
|
+
*
|
|
4599
|
+
* @class SectionModuleBase
|
|
4600
4600
|
*/
|
|
4601
4601
|
class SectionModuleBase {
|
|
4602
|
-
/**
|
|
4603
|
-
* Create a SectionModuleBase instance.
|
|
4604
|
-
*
|
|
4605
|
-
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4606
|
-
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4607
|
-
*
|
|
4608
|
-
* @constructor
|
|
4602
|
+
/**
|
|
4603
|
+
* Create a SectionModuleBase instance.
|
|
4604
|
+
*
|
|
4605
|
+
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4606
|
+
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4607
|
+
*
|
|
4608
|
+
* @constructor
|
|
4609
4609
|
*/
|
|
4610
4610
|
constructor(eventBus, sectionKey) {
|
|
4611
4611
|
this._eventBus = eventBus;
|
|
@@ -4618,10 +4618,10 @@ class SectionModuleBase {
|
|
|
4618
4618
|
});
|
|
4619
4619
|
}
|
|
4620
4620
|
|
|
4621
|
-
/**
|
|
4622
|
-
* Attach the managed section to a parent node.
|
|
4623
|
-
*
|
|
4624
|
-
* @param {HTMLElement} container - The parent node to attach to.
|
|
4621
|
+
/**
|
|
4622
|
+
* Attach the managed section to a parent node.
|
|
4623
|
+
*
|
|
4624
|
+
* @param {HTMLElement} container - The parent node to attach to.
|
|
4625
4625
|
*/
|
|
4626
4626
|
attachTo(container) {
|
|
4627
4627
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
|
|
@@ -4629,22 +4629,22 @@ class SectionModuleBase {
|
|
|
4629
4629
|
}));
|
|
4630
4630
|
}
|
|
4631
4631
|
|
|
4632
|
-
/**
|
|
4633
|
-
* Detach the managed section from its parent node.
|
|
4632
|
+
/**
|
|
4633
|
+
* Detach the managed section from its parent node.
|
|
4634
4634
|
*/
|
|
4635
4635
|
detach() {
|
|
4636
4636
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
|
|
4637
4637
|
}
|
|
4638
4638
|
|
|
4639
|
-
/**
|
|
4640
|
-
* Reset the managed section to its initial state.
|
|
4639
|
+
/**
|
|
4640
|
+
* Reset the managed section to its initial state.
|
|
4641
4641
|
*/
|
|
4642
4642
|
reset() {
|
|
4643
4643
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
|
|
4644
4644
|
}
|
|
4645
4645
|
|
|
4646
|
-
/**
|
|
4647
|
-
* Circumvents timing issues.
|
|
4646
|
+
/**
|
|
4647
|
+
* Circumvents timing issues.
|
|
4648
4648
|
*/
|
|
4649
4649
|
_onceSectionRendered(callback) {
|
|
4650
4650
|
if (this.isSectionRendered) {
|
|
@@ -5263,20 +5263,24 @@ function Group(props) {
|
|
|
5263
5263
|
|
|
5264
5264
|
// set edited state depending on all entries
|
|
5265
5265
|
hooks.useEffect(() => {
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5266
|
+
// 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
|
|
5267
|
+
const scheduled = requestAnimationFrame(() => {
|
|
5268
|
+
const hasOneEditedEntry = entries.find(entry => {
|
|
5269
|
+
const {
|
|
5270
|
+
id,
|
|
5271
|
+
isEdited
|
|
5272
|
+
} = entry;
|
|
5273
|
+
const entryNode = minDom.query(`[data-entry-id="${id}"]`);
|
|
5274
|
+
if (!minDash.isFunction(isEdited) || !entryNode) {
|
|
5275
|
+
return false;
|
|
5276
|
+
}
|
|
5277
|
+
const inputNode = minDom.query('.bio-properties-panel-input', entryNode);
|
|
5278
|
+
return isEdited(inputNode);
|
|
5279
|
+
});
|
|
5280
|
+
setEdited(hasOneEditedEntry);
|
|
5277
5281
|
});
|
|
5278
|
-
|
|
5279
|
-
}, [entries]);
|
|
5282
|
+
return () => cancelAnimationFrame(scheduled);
|
|
5283
|
+
}, [entries, setEdited]);
|
|
5280
5284
|
|
|
5281
5285
|
// set error state depending on all entries
|
|
5282
5286
|
const allErrors = useErrors();
|
|
@@ -5704,7 +5708,11 @@ function createDragger(fn, dragPreview) {
|
|
|
5704
5708
|
// (2) setup drag listeners
|
|
5705
5709
|
|
|
5706
5710
|
// attach drag + cleanup event
|
|
5707
|
-
|
|
5711
|
+
// we need to do this to make sure we track cursor
|
|
5712
|
+
// movements before we reach other drag event handlers,
|
|
5713
|
+
// e.g. in child containers.
|
|
5714
|
+
document.addEventListener('dragover', onDrag, true);
|
|
5715
|
+
document.addEventListener('dragenter', preventDefault, true);
|
|
5708
5716
|
document.addEventListener('dragend', onEnd);
|
|
5709
5717
|
document.addEventListener('drop', preventDefault);
|
|
5710
5718
|
}
|
|
@@ -5718,7 +5726,8 @@ function createDragger(fn, dragPreview) {
|
|
|
5718
5726
|
return fn.call(self, event, delta);
|
|
5719
5727
|
}
|
|
5720
5728
|
function onEnd() {
|
|
5721
|
-
document.removeEventListener('dragover', onDrag);
|
|
5729
|
+
document.removeEventListener('dragover', onDrag, true);
|
|
5730
|
+
document.removeEventListener('dragenter', preventDefault, true);
|
|
5722
5731
|
document.removeEventListener('dragend', onEnd);
|
|
5723
5732
|
document.removeEventListener('drop', preventDefault);
|
|
5724
5733
|
}
|
|
@@ -5749,8 +5758,9 @@ const noop$3 = () => {};
|
|
|
5749
5758
|
* @param {boolean} [props.returnFocus]
|
|
5750
5759
|
* @param {boolean} [props.closeOnEscape]
|
|
5751
5760
|
* @param {string} props.title
|
|
5761
|
+
* @param {Ref} [ref]
|
|
5752
5762
|
*/
|
|
5753
|
-
function
|
|
5763
|
+
function PopupComponent(props, globalRef) {
|
|
5754
5764
|
const {
|
|
5755
5765
|
container,
|
|
5756
5766
|
className,
|
|
@@ -5766,7 +5776,8 @@ function Popup(props) {
|
|
|
5766
5776
|
title
|
|
5767
5777
|
} = props;
|
|
5768
5778
|
const focusTrapRef = hooks.useRef(null);
|
|
5769
|
-
const
|
|
5779
|
+
const localRef = hooks.useRef(null);
|
|
5780
|
+
const popupRef = globalRef || localRef;
|
|
5770
5781
|
const handleKeydown = event => {
|
|
5771
5782
|
// do not allow keyboard events to bubble
|
|
5772
5783
|
event.stopPropagation();
|
|
@@ -5828,6 +5839,7 @@ function Popup(props) {
|
|
|
5828
5839
|
children: props.children
|
|
5829
5840
|
}), container || document.body);
|
|
5830
5841
|
}
|
|
5842
|
+
const Popup = React.forwardRef(PopupComponent);
|
|
5831
5843
|
Popup.Title = Title;
|
|
5832
5844
|
Popup.Body = Body;
|
|
5833
5845
|
Popup.Footer = Footer;
|
|
@@ -5836,6 +5848,7 @@ function Title(props) {
|
|
|
5836
5848
|
children,
|
|
5837
5849
|
className,
|
|
5838
5850
|
draggable,
|
|
5851
|
+
emit = () => {},
|
|
5839
5852
|
title,
|
|
5840
5853
|
...rest
|
|
5841
5854
|
} = props;
|
|
@@ -5848,7 +5861,8 @@ function Title(props) {
|
|
|
5848
5861
|
});
|
|
5849
5862
|
const dragPreviewRef = hooks.useRef();
|
|
5850
5863
|
const titleRef = hooks.useRef();
|
|
5851
|
-
const onMove =
|
|
5864
|
+
const onMove = (event, delta) => {
|
|
5865
|
+
cancel(event);
|
|
5852
5866
|
const {
|
|
5853
5867
|
x: dx,
|
|
5854
5868
|
y: dy
|
|
@@ -5860,20 +5874,33 @@ function Title(props) {
|
|
|
5860
5874
|
const popupParent = getPopupParent(titleRef.current);
|
|
5861
5875
|
popupParent.style.top = newPosition.y + 'px';
|
|
5862
5876
|
popupParent.style.left = newPosition.x + 'px';
|
|
5863
|
-
|
|
5877
|
+
|
|
5878
|
+
// notify interested parties
|
|
5879
|
+
emit('dragover', {
|
|
5880
|
+
newPosition,
|
|
5881
|
+
delta
|
|
5882
|
+
});
|
|
5883
|
+
};
|
|
5864
5884
|
const onMoveStart = event => {
|
|
5865
5885
|
// initialize drag handler
|
|
5866
5886
|
const onDragStart = createDragger(onMove, dragPreviewRef.current);
|
|
5867
5887
|
onDragStart(event);
|
|
5888
|
+
event.stopPropagation();
|
|
5868
5889
|
const popupParent = getPopupParent(titleRef.current);
|
|
5869
5890
|
const bounds = popupParent.getBoundingClientRect();
|
|
5870
5891
|
context.current.startPosition = {
|
|
5871
5892
|
x: bounds.left,
|
|
5872
5893
|
y: bounds.top
|
|
5873
5894
|
};
|
|
5895
|
+
|
|
5896
|
+
// notify interested parties
|
|
5897
|
+
emit('dragstart');
|
|
5874
5898
|
};
|
|
5875
5899
|
const onMoveEnd = () => {
|
|
5876
5900
|
context.current.newPosition = null;
|
|
5901
|
+
|
|
5902
|
+
// notify interested parties
|
|
5903
|
+
emit('dragend');
|
|
5877
5904
|
};
|
|
5878
5905
|
return jsxRuntime.jsxs("div", {
|
|
5879
5906
|
class: classnames('bio-properties-panel-popup__header', draggable && 'draggable', className),
|
|
@@ -5926,11 +5953,19 @@ function Footer(props) {
|
|
|
5926
5953
|
function getPopupParent(node) {
|
|
5927
5954
|
return node.closest('.bio-properties-panel-popup');
|
|
5928
5955
|
}
|
|
5956
|
+
function cancel(event) {
|
|
5957
|
+
event.preventDefault();
|
|
5958
|
+
event.stopPropagation();
|
|
5959
|
+
}
|
|
5929
5960
|
const FEEL_POPUP_WIDTH = 700;
|
|
5930
5961
|
const FEEL_POPUP_HEIGHT = 250;
|
|
5931
5962
|
|
|
5932
5963
|
/**
|
|
5933
|
-
* FEEL popup component, built as a singleton.
|
|
5964
|
+
* FEEL popup component, built as a singleton. Emits lifecycle events as follows:
|
|
5965
|
+
* - `feelPopup.open` - fired before the popup is mounted
|
|
5966
|
+
* - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
|
|
5967
|
+
* - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
|
|
5968
|
+
* - `feelPopup.closed` - fired after the popup is unmounted
|
|
5934
5969
|
*/
|
|
5935
5970
|
function FEELPopupRoot(props) {
|
|
5936
5971
|
const {
|
|
@@ -5953,17 +5988,21 @@ function FEELPopupRoot(props) {
|
|
|
5953
5988
|
const isOpen = hooks.useCallback(() => {
|
|
5954
5989
|
return !!open;
|
|
5955
5990
|
}, [open]);
|
|
5991
|
+
useUpdateEffect(() => {
|
|
5992
|
+
if (!open) {
|
|
5993
|
+
emit('closed');
|
|
5994
|
+
}
|
|
5995
|
+
}, [open]);
|
|
5956
5996
|
const handleOpen = (entryId, config, _sourceElement) => {
|
|
5957
5997
|
setSource(entryId);
|
|
5958
5998
|
setPopupConfig(config);
|
|
5959
5999
|
setOpen(true);
|
|
5960
6000
|
setSourceElement(_sourceElement);
|
|
5961
|
-
emit('
|
|
6001
|
+
emit('open');
|
|
5962
6002
|
};
|
|
5963
6003
|
const handleClose = () => {
|
|
5964
6004
|
setOpen(false);
|
|
5965
6005
|
setSource(null);
|
|
5966
|
-
emit('closed');
|
|
5967
6006
|
};
|
|
5968
6007
|
const feelPopupContext = {
|
|
5969
6008
|
open: handleOpen,
|
|
@@ -6006,6 +6045,7 @@ function FEELPopupRoot(props) {
|
|
|
6006
6045
|
onClose: handleClose,
|
|
6007
6046
|
container: popupContainer,
|
|
6008
6047
|
sourceElement: sourceElement,
|
|
6048
|
+
emit: emit,
|
|
6009
6049
|
...popupConfig
|
|
6010
6050
|
}), props.children]
|
|
6011
6051
|
});
|
|
@@ -6024,9 +6064,11 @@ function FeelPopupComponent(props) {
|
|
|
6024
6064
|
tooltipContainer,
|
|
6025
6065
|
type,
|
|
6026
6066
|
value,
|
|
6027
|
-
variables
|
|
6067
|
+
variables,
|
|
6068
|
+
emit
|
|
6028
6069
|
} = props;
|
|
6029
6070
|
const editorRef = hooks.useRef();
|
|
6071
|
+
const popupRef = hooks.useRef();
|
|
6030
6072
|
const isAutoCompletionOpen = hooks.useRef(false);
|
|
6031
6073
|
const handleSetReturnFocus = () => {
|
|
6032
6074
|
sourceElement && sourceElement.focus();
|
|
@@ -6049,9 +6091,18 @@ function FeelPopupComponent(props) {
|
|
|
6049
6091
|
}
|
|
6050
6092
|
}
|
|
6051
6093
|
};
|
|
6094
|
+
hooks.useEffect(() => {
|
|
6095
|
+
emit('opened', {
|
|
6096
|
+
domNode: popupRef.current
|
|
6097
|
+
});
|
|
6098
|
+
return () => emit('close', {
|
|
6099
|
+
domNode: popupRef.current
|
|
6100
|
+
});
|
|
6101
|
+
}, []);
|
|
6052
6102
|
return jsxRuntime.jsxs(Popup, {
|
|
6053
6103
|
container: container,
|
|
6054
6104
|
className: "bio-properties-panel-feel-popup",
|
|
6105
|
+
emit: emit,
|
|
6055
6106
|
position: position,
|
|
6056
6107
|
title: title,
|
|
6057
6108
|
onClose: onClose
|
|
@@ -6065,8 +6116,10 @@ function FeelPopupComponent(props) {
|
|
|
6065
6116
|
onPostDeactivate: handleSetReturnFocus,
|
|
6066
6117
|
height: FEEL_POPUP_HEIGHT,
|
|
6067
6118
|
width: FEEL_POPUP_WIDTH,
|
|
6119
|
+
ref: popupRef,
|
|
6068
6120
|
children: [jsxRuntime.jsx(Popup.Title, {
|
|
6069
6121
|
title: title,
|
|
6122
|
+
emit: emit,
|
|
6070
6123
|
draggable: true
|
|
6071
6124
|
}), jsxRuntime.jsx(Popup.Body, {
|
|
6072
6125
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -6116,6 +6169,23 @@ function prefixId$8(id) {
|
|
|
6116
6169
|
function autoCompletionOpen(element) {
|
|
6117
6170
|
return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
|
|
6118
6171
|
}
|
|
6172
|
+
|
|
6173
|
+
/**
|
|
6174
|
+
* This hook behaves like useEffect, but does not trigger on the first render.
|
|
6175
|
+
*
|
|
6176
|
+
* @param {Function} effect
|
|
6177
|
+
* @param {Array} deps
|
|
6178
|
+
*/
|
|
6179
|
+
function useUpdateEffect(effect, deps) {
|
|
6180
|
+
const isMounted = hooks.useRef(false);
|
|
6181
|
+
hooks.useEffect(() => {
|
|
6182
|
+
if (isMounted.current) {
|
|
6183
|
+
return effect();
|
|
6184
|
+
} else {
|
|
6185
|
+
isMounted.current = true;
|
|
6186
|
+
}
|
|
6187
|
+
}, deps);
|
|
6188
|
+
}
|
|
6119
6189
|
function ToggleSwitch(props) {
|
|
6120
6190
|
const {
|
|
6121
6191
|
id,
|
|
@@ -7011,7 +7081,7 @@ function calculatePopupPosition(element) {
|
|
|
7011
7081
|
|
|
7012
7082
|
// todo(pinussilvestrus): make this configurable in the future
|
|
7013
7083
|
function getPopupTitle(element, label) {
|
|
7014
|
-
let popupTitle;
|
|
7084
|
+
let popupTitle = '';
|
|
7015
7085
|
if (element && element.type) {
|
|
7016
7086
|
popupTitle = `${element.type} / `;
|
|
7017
7087
|
}
|
|
@@ -8196,11 +8266,11 @@ var index = {
|
|
|
8196
8266
|
feelPopup: ['type', FeelPopupModule]
|
|
8197
8267
|
};
|
|
8198
8268
|
|
|
8199
|
-
/**
|
|
8200
|
-
* @param {string} type
|
|
8201
|
-
* @param {boolean} [strict]
|
|
8202
|
-
*
|
|
8203
|
-
* @returns {any}
|
|
8269
|
+
/**
|
|
8270
|
+
* @param {string} type
|
|
8271
|
+
* @param {boolean} [strict]
|
|
8272
|
+
*
|
|
8273
|
+
* @returns {any}
|
|
8204
8274
|
*/
|
|
8205
8275
|
function getService(type, strict) {}
|
|
8206
8276
|
const PropertiesPanelContext = preact.createContext({
|
|
@@ -8297,8 +8367,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
8297
8367
|
}
|
|
8298
8368
|
};
|
|
8299
8369
|
|
|
8300
|
-
/**
|
|
8301
|
-
* Provide placeholders for empty and multiple state.
|
|
8370
|
+
/**
|
|
8371
|
+
* Provide placeholders for empty and multiple state.
|
|
8302
8372
|
*/
|
|
8303
8373
|
const PropertiesPanelPlaceholderProvider = {
|
|
8304
8374
|
getEmpty: () => {
|
|
@@ -8370,10 +8440,10 @@ function useService (type, strict) {
|
|
|
8370
8440
|
return getService(type, strict);
|
|
8371
8441
|
}
|
|
8372
8442
|
|
|
8373
|
-
/**
|
|
8374
|
-
* Retrieve list of variables from the form schema.
|
|
8375
|
-
*
|
|
8376
|
-
* @returns { string[] } list of variables used in form schema
|
|
8443
|
+
/**
|
|
8444
|
+
* Retrieve list of variables from the form schema.
|
|
8445
|
+
*
|
|
8446
|
+
* @returns { string[] } list of variables used in form schema
|
|
8377
8447
|
*/
|
|
8378
8448
|
function useVariables() {
|
|
8379
8449
|
const form = useService('formEditor');
|
|
@@ -10024,14 +10094,14 @@ function Value(props) {
|
|
|
10024
10094
|
|
|
10025
10095
|
// helpers //////////
|
|
10026
10096
|
|
|
10027
|
-
/**
|
|
10028
|
-
* Returns copy of object with updated value.
|
|
10029
|
-
*
|
|
10030
|
-
* @param {Object} properties
|
|
10031
|
-
* @param {string} key
|
|
10032
|
-
* @param {string} value
|
|
10033
|
-
*
|
|
10034
|
-
* @returns {Object}
|
|
10097
|
+
/**
|
|
10098
|
+
* Returns copy of object with updated value.
|
|
10099
|
+
*
|
|
10100
|
+
* @param {Object} properties
|
|
10101
|
+
* @param {string} key
|
|
10102
|
+
* @param {string} value
|
|
10103
|
+
*
|
|
10104
|
+
* @returns {Object}
|
|
10035
10105
|
*/
|
|
10036
10106
|
function updateValue(properties, key, value) {
|
|
10037
10107
|
return {
|
|
@@ -10040,14 +10110,14 @@ function updateValue(properties, key, value) {
|
|
|
10040
10110
|
};
|
|
10041
10111
|
}
|
|
10042
10112
|
|
|
10043
|
-
/**
|
|
10044
|
-
* Returns copy of object with updated key.
|
|
10045
|
-
*
|
|
10046
|
-
* @param {Object} properties
|
|
10047
|
-
* @param {string} oldKey
|
|
10048
|
-
* @param {string} newKey
|
|
10049
|
-
*
|
|
10050
|
-
* @returns {Object}
|
|
10113
|
+
/**
|
|
10114
|
+
* Returns copy of object with updated key.
|
|
10115
|
+
*
|
|
10116
|
+
* @param {Object} properties
|
|
10117
|
+
* @param {string} oldKey
|
|
10118
|
+
* @param {string} newKey
|
|
10119
|
+
*
|
|
10120
|
+
* @returns {Object}
|
|
10051
10121
|
*/
|
|
10052
10122
|
function updateKey(properties, oldKey, newKey) {
|
|
10053
10123
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -10156,19 +10226,9 @@ function InputKeyValuesSourceEntry(props) {
|
|
|
10156
10226
|
field,
|
|
10157
10227
|
id
|
|
10158
10228
|
} = props;
|
|
10159
|
-
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10160
|
-
const description = jsxRuntime.jsxs("div", {
|
|
10161
|
-
children: ["Define which input property to populate the values from.", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("br", {}), "The input property may be an array of simple values or alternatively follow this schema:", jsxRuntime.jsx("pre", {
|
|
10162
|
-
children: jsxRuntime.jsx("code", {
|
|
10163
|
-
children: schema
|
|
10164
|
-
})
|
|
10165
|
-
})]
|
|
10166
|
-
});
|
|
10167
10229
|
return [{
|
|
10168
10230
|
id: id + '-key',
|
|
10169
10231
|
component: InputValuesKey,
|
|
10170
|
-
label: 'Input values key',
|
|
10171
|
-
description,
|
|
10172
10232
|
isEdited: isEdited,
|
|
10173
10233
|
editField,
|
|
10174
10234
|
field
|
|
@@ -10178,12 +10238,18 @@ function InputValuesKey(props) {
|
|
|
10178
10238
|
const {
|
|
10179
10239
|
editField,
|
|
10180
10240
|
field,
|
|
10181
|
-
id
|
|
10182
|
-
label,
|
|
10183
|
-
description
|
|
10241
|
+
id
|
|
10184
10242
|
} = props;
|
|
10185
10243
|
const debounce = useService('debounce');
|
|
10186
10244
|
const path = formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.INPUT];
|
|
10245
|
+
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10246
|
+
const tooltip = jsxRuntime.jsxs("div", {
|
|
10247
|
+
children: ["The input property may be an array of simple values or alternatively follow this schema:", jsxRuntime.jsx("pre", {
|
|
10248
|
+
children: jsxRuntime.jsx("code", {
|
|
10249
|
+
children: schema
|
|
10250
|
+
})
|
|
10251
|
+
})]
|
|
10252
|
+
});
|
|
10187
10253
|
const getValue = () => minDash.get(field, path, '');
|
|
10188
10254
|
const setValue = (value, error) => {
|
|
10189
10255
|
if (error) {
|
|
@@ -10202,11 +10268,12 @@ function InputValuesKey(props) {
|
|
|
10202
10268
|
};
|
|
10203
10269
|
return TextfieldEntry({
|
|
10204
10270
|
debounce,
|
|
10205
|
-
description,
|
|
10271
|
+
description: 'Define which input property to populate the values from',
|
|
10272
|
+
tooltip,
|
|
10206
10273
|
element: field,
|
|
10207
10274
|
getValue,
|
|
10208
10275
|
id,
|
|
10209
|
-
label,
|
|
10276
|
+
label: 'Input values key',
|
|
10210
10277
|
setValue,
|
|
10211
10278
|
validate
|
|
10212
10279
|
});
|
|
@@ -10482,7 +10549,6 @@ function ValuesExpressionEntry(props) {
|
|
|
10482
10549
|
return [{
|
|
10483
10550
|
id: id + '-expression',
|
|
10484
10551
|
component: ValuesExpression,
|
|
10485
|
-
label: 'Values expression',
|
|
10486
10552
|
isEdited: isEdited$6,
|
|
10487
10553
|
editField,
|
|
10488
10554
|
field
|
|
@@ -10500,8 +10566,8 @@ function ValuesExpression(props) {
|
|
|
10500
10566
|
}));
|
|
10501
10567
|
const path = formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.EXPRESSION];
|
|
10502
10568
|
const schema = '[\n {\n "label": "dollar",\n "value": "$"\n }\n]';
|
|
10503
|
-
const
|
|
10504
|
-
children: ["
|
|
10569
|
+
const tooltip = jsxRuntime.jsxs("div", {
|
|
10570
|
+
children: ["The expression may result in an array of simple values or alternatively follow this schema:", jsxRuntime.jsx("pre", {
|
|
10505
10571
|
children: jsxRuntime.jsx("code", {
|
|
10506
10572
|
children: schema
|
|
10507
10573
|
})
|
|
@@ -10511,7 +10577,8 @@ function ValuesExpression(props) {
|
|
|
10511
10577
|
const setValue = value => editField(field, path, value || '');
|
|
10512
10578
|
return FeelEntry({
|
|
10513
10579
|
debounce,
|
|
10514
|
-
description,
|
|
10580
|
+
description: 'Define an expression to populate the options from.',
|
|
10581
|
+
tooltip,
|
|
10515
10582
|
element: field,
|
|
10516
10583
|
feel: 'required',
|
|
10517
10584
|
getValue,
|
|
@@ -10880,8 +10947,8 @@ function ValuesGroups(field, editField) {
|
|
|
10880
10947
|
};
|
|
10881
10948
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
10882
10949
|
|
|
10883
|
-
/**
|
|
10884
|
-
* @type {Array<Group|ListGroup>}
|
|
10950
|
+
/**
|
|
10951
|
+
* @type {Array<Group|ListGroup>}
|
|
10885
10952
|
*/
|
|
10886
10953
|
const groups = [{
|
|
10887
10954
|
id: valuesSourceId,
|
|
@@ -11002,13 +11069,13 @@ function CustomPropertiesGroup(field, editField) {
|
|
|
11002
11069
|
|
|
11003
11070
|
// helpers //////////
|
|
11004
11071
|
|
|
11005
|
-
/**
|
|
11006
|
-
* Returns copy of object without key.
|
|
11007
|
-
*
|
|
11008
|
-
* @param {Object} properties
|
|
11009
|
-
* @param {string} oldKey
|
|
11010
|
-
*
|
|
11011
|
-
* @returns {Object}
|
|
11072
|
+
/**
|
|
11073
|
+
* Returns copy of object without key.
|
|
11074
|
+
*
|
|
11075
|
+
* @param {Object} properties
|
|
11076
|
+
* @param {string} oldKey
|
|
11077
|
+
*
|
|
11078
|
+
* @returns {Object}
|
|
11012
11079
|
*/
|
|
11013
11080
|
function removeKey(properties, oldKey) {
|
|
11014
11081
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -11115,9 +11182,9 @@ function FormPropertiesPanel(props) {
|
|
|
11115
11182
|
});
|
|
11116
11183
|
}, [eventBus, formEditor, selectionModule]);
|
|
11117
11184
|
hooks.useLayoutEffect(() => {
|
|
11118
|
-
/**
|
|
11119
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
11120
|
-
* once we have a proper updater/change support
|
|
11185
|
+
/**
|
|
11186
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
11187
|
+
* once we have a proper updater/change support
|
|
11121
11188
|
*/
|
|
11122
11189
|
eventBus.on('changed', refresh);
|
|
11123
11190
|
eventBus.on('import.done', refresh);
|
|
@@ -11170,10 +11237,10 @@ class PropertiesPanelRenderer {
|
|
|
11170
11237
|
});
|
|
11171
11238
|
}
|
|
11172
11239
|
|
|
11173
|
-
/**
|
|
11174
|
-
* Attach the properties panel to a parent node.
|
|
11175
|
-
*
|
|
11176
|
-
* @param {HTMLElement} container
|
|
11240
|
+
/**
|
|
11241
|
+
* Attach the properties panel to a parent node.
|
|
11242
|
+
*
|
|
11243
|
+
* @param {HTMLElement} container
|
|
11177
11244
|
*/
|
|
11178
11245
|
attachTo(container) {
|
|
11179
11246
|
if (!container) {
|
|
@@ -11193,8 +11260,8 @@ class PropertiesPanelRenderer {
|
|
|
11193
11260
|
this._eventBus.fire('propertiesPanel.attach');
|
|
11194
11261
|
}
|
|
11195
11262
|
|
|
11196
|
-
/**
|
|
11197
|
-
* Detach the properties panel from its parent node.
|
|
11263
|
+
/**
|
|
11264
|
+
* Detach the properties panel from its parent node.
|
|
11198
11265
|
*/
|
|
11199
11266
|
detach() {
|
|
11200
11267
|
const parentNode = this._container.parentNode;
|
|
@@ -11225,10 +11292,10 @@ var PropertiesPanelModule = {
|
|
|
11225
11292
|
propertiesPanel: ['type', PropertiesPanelRenderer]
|
|
11226
11293
|
};
|
|
11227
11294
|
|
|
11228
|
-
/**
|
|
11229
|
-
* Manages the rendering of visual plugins.
|
|
11230
|
-
* @constructor
|
|
11231
|
-
* @param {Object} eventBus - Event bus for the application.
|
|
11295
|
+
/**
|
|
11296
|
+
* Manages the rendering of visual plugins.
|
|
11297
|
+
* @constructor
|
|
11298
|
+
* @param {Object} eventBus - Event bus for the application.
|
|
11232
11299
|
*/
|
|
11233
11300
|
class RenderInjector extends SectionModuleBase {
|
|
11234
11301
|
constructor(eventBus) {
|
|
@@ -11237,10 +11304,10 @@ class RenderInjector extends SectionModuleBase {
|
|
|
11237
11304
|
this.registeredRenderers = [];
|
|
11238
11305
|
}
|
|
11239
11306
|
|
|
11240
|
-
/**
|
|
11241
|
-
* Inject a new renderer into the injector.
|
|
11242
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
11243
|
-
* @param {Function} Renderer - The renderer function.
|
|
11307
|
+
/**
|
|
11308
|
+
* Inject a new renderer into the injector.
|
|
11309
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
11310
|
+
* @param {Function} Renderer - The renderer function.
|
|
11244
11311
|
*/
|
|
11245
11312
|
attachRenderer(identifier, Renderer) {
|
|
11246
11313
|
this.registeredRenderers = [...this.registeredRenderers, {
|
|
@@ -11249,17 +11316,17 @@ class RenderInjector extends SectionModuleBase {
|
|
|
11249
11316
|
}];
|
|
11250
11317
|
}
|
|
11251
11318
|
|
|
11252
|
-
/**
|
|
11253
|
-
* Detach a renderer from the by key injector.
|
|
11254
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
11319
|
+
/**
|
|
11320
|
+
* Detach a renderer from the by key injector.
|
|
11321
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
11255
11322
|
*/
|
|
11256
11323
|
detachRenderer(identifier) {
|
|
11257
11324
|
this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
|
|
11258
11325
|
}
|
|
11259
11326
|
|
|
11260
|
-
/**
|
|
11261
|
-
* Returns the registered renderers.
|
|
11262
|
-
* @returns {Array} Array of registered renderers.
|
|
11327
|
+
/**
|
|
11328
|
+
* Returns the registered renderers.
|
|
11329
|
+
* @returns {Array} Array of registered renderers.
|
|
11263
11330
|
*/
|
|
11264
11331
|
fetchRenderers() {
|
|
11265
11332
|
return this.registeredRenderers;
|
|
@@ -11293,48 +11360,48 @@ var ExpressionLanguageModule = {
|
|
|
11293
11360
|
|
|
11294
11361
|
const ids = new Ids([32, 36, 1]);
|
|
11295
11362
|
|
|
11296
|
-
/**
|
|
11297
|
-
* @typedef { import('./types').Injector } Injector
|
|
11298
|
-
* @typedef { import('./types').Module } Module
|
|
11299
|
-
* @typedef { import('./types').Schema } Schema
|
|
11300
|
-
*
|
|
11301
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
11302
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
11303
|
-
*
|
|
11304
|
-
* @typedef { {
|
|
11305
|
-
* properties: FormEditorProperties,
|
|
11306
|
-
* schema: Schema
|
|
11307
|
-
* } } State
|
|
11308
|
-
*
|
|
11309
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
11310
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
11311
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
11363
|
+
/**
|
|
11364
|
+
* @typedef { import('./types').Injector } Injector
|
|
11365
|
+
* @typedef { import('./types').Module } Module
|
|
11366
|
+
* @typedef { import('./types').Schema } Schema
|
|
11367
|
+
*
|
|
11368
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
11369
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
11370
|
+
*
|
|
11371
|
+
* @typedef { {
|
|
11372
|
+
* properties: FormEditorProperties,
|
|
11373
|
+
* schema: Schema
|
|
11374
|
+
* } } State
|
|
11375
|
+
*
|
|
11376
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
11377
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
11378
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
11312
11379
|
*/
|
|
11313
11380
|
|
|
11314
|
-
/**
|
|
11315
|
-
* The form editor.
|
|
11381
|
+
/**
|
|
11382
|
+
* The form editor.
|
|
11316
11383
|
*/
|
|
11317
11384
|
class FormEditor {
|
|
11318
|
-
/**
|
|
11319
|
-
* @constructor
|
|
11320
|
-
* @param {FormEditorOptions} options
|
|
11385
|
+
/**
|
|
11386
|
+
* @constructor
|
|
11387
|
+
* @param {FormEditorOptions} options
|
|
11321
11388
|
*/
|
|
11322
11389
|
constructor(options = {}) {
|
|
11323
|
-
/**
|
|
11324
|
-
* @public
|
|
11325
|
-
* @type {OnEventType}
|
|
11390
|
+
/**
|
|
11391
|
+
* @public
|
|
11392
|
+
* @type {OnEventType}
|
|
11326
11393
|
*/
|
|
11327
11394
|
this.on = this._onEvent;
|
|
11328
11395
|
|
|
11329
|
-
/**
|
|
11330
|
-
* @public
|
|
11331
|
-
* @type {String}
|
|
11396
|
+
/**
|
|
11397
|
+
* @public
|
|
11398
|
+
* @type {String}
|
|
11332
11399
|
*/
|
|
11333
11400
|
this._id = ids.next();
|
|
11334
11401
|
|
|
11335
|
-
/**
|
|
11336
|
-
* @private
|
|
11337
|
-
* @type {Element}
|
|
11402
|
+
/**
|
|
11403
|
+
* @private
|
|
11404
|
+
* @type {Element}
|
|
11338
11405
|
*/
|
|
11339
11406
|
this._container = formJsViewer.createFormContainer();
|
|
11340
11407
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -11345,15 +11412,15 @@ class FormEditor {
|
|
|
11345
11412
|
properties = {}
|
|
11346
11413
|
} = options;
|
|
11347
11414
|
|
|
11348
|
-
/**
|
|
11349
|
-
* @private
|
|
11350
|
-
* @type {any}
|
|
11415
|
+
/**
|
|
11416
|
+
* @private
|
|
11417
|
+
* @type {any}
|
|
11351
11418
|
*/
|
|
11352
11419
|
this.exporter = exporter;
|
|
11353
11420
|
|
|
11354
|
-
/**
|
|
11355
|
-
* @private
|
|
11356
|
-
* @type {State}
|
|
11421
|
+
/**
|
|
11422
|
+
* @private
|
|
11423
|
+
* @type {State}
|
|
11357
11424
|
*/
|
|
11358
11425
|
this._state = {
|
|
11359
11426
|
properties,
|
|
@@ -11382,10 +11449,10 @@ class FormEditor {
|
|
|
11382
11449
|
this._detach(false);
|
|
11383
11450
|
}
|
|
11384
11451
|
|
|
11385
|
-
/**
|
|
11386
|
-
* @param {Schema} schema
|
|
11387
|
-
*
|
|
11388
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
11452
|
+
/**
|
|
11453
|
+
* @param {Schema} schema
|
|
11454
|
+
*
|
|
11455
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
11389
11456
|
*/
|
|
11390
11457
|
importSchema(schema) {
|
|
11391
11458
|
return new Promise((resolve, reject) => {
|
|
@@ -11414,15 +11481,15 @@ class FormEditor {
|
|
|
11414
11481
|
});
|
|
11415
11482
|
}
|
|
11416
11483
|
|
|
11417
|
-
/**
|
|
11418
|
-
* @returns {Schema}
|
|
11484
|
+
/**
|
|
11485
|
+
* @returns {Schema}
|
|
11419
11486
|
*/
|
|
11420
11487
|
saveSchema() {
|
|
11421
11488
|
return this.getSchema();
|
|
11422
11489
|
}
|
|
11423
11490
|
|
|
11424
|
-
/**
|
|
11425
|
-
* @returns {Schema}
|
|
11491
|
+
/**
|
|
11492
|
+
* @returns {Schema}
|
|
11426
11493
|
*/
|
|
11427
11494
|
getSchema() {
|
|
11428
11495
|
const {
|
|
@@ -11431,8 +11498,8 @@ class FormEditor {
|
|
|
11431
11498
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
11432
11499
|
}
|
|
11433
11500
|
|
|
11434
|
-
/**
|
|
11435
|
-
* @param {Element|string} parentNode
|
|
11501
|
+
/**
|
|
11502
|
+
* @param {Element|string} parentNode
|
|
11436
11503
|
*/
|
|
11437
11504
|
attachTo(parentNode) {
|
|
11438
11505
|
if (!parentNode) {
|
|
@@ -11450,10 +11517,10 @@ class FormEditor {
|
|
|
11450
11517
|
this._detach();
|
|
11451
11518
|
}
|
|
11452
11519
|
|
|
11453
|
-
/**
|
|
11454
|
-
* @internal
|
|
11455
|
-
*
|
|
11456
|
-
* @param {boolean} [emit]
|
|
11520
|
+
/**
|
|
11521
|
+
* @internal
|
|
11522
|
+
*
|
|
11523
|
+
* @param {boolean} [emit]
|
|
11457
11524
|
*/
|
|
11458
11525
|
_detach(emit = true) {
|
|
11459
11526
|
const container = this._container,
|
|
@@ -11467,9 +11534,9 @@ class FormEditor {
|
|
|
11467
11534
|
parentNode.removeChild(container);
|
|
11468
11535
|
}
|
|
11469
11536
|
|
|
11470
|
-
/**
|
|
11471
|
-
* @param {any} property
|
|
11472
|
-
* @param {any} value
|
|
11537
|
+
/**
|
|
11538
|
+
* @param {any} property
|
|
11539
|
+
* @param {any} value
|
|
11473
11540
|
*/
|
|
11474
11541
|
setProperty(property, value) {
|
|
11475
11542
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -11478,21 +11545,21 @@ class FormEditor {
|
|
|
11478
11545
|
});
|
|
11479
11546
|
}
|
|
11480
11547
|
|
|
11481
|
-
/**
|
|
11482
|
-
* @param {string} type
|
|
11483
|
-
* @param {Function} handler
|
|
11548
|
+
/**
|
|
11549
|
+
* @param {string} type
|
|
11550
|
+
* @param {Function} handler
|
|
11484
11551
|
*/
|
|
11485
11552
|
off(type, handler) {
|
|
11486
11553
|
this.get('eventBus').off(type, handler);
|
|
11487
11554
|
}
|
|
11488
11555
|
|
|
11489
|
-
/**
|
|
11490
|
-
* @internal
|
|
11491
|
-
*
|
|
11492
|
-
* @param {FormEditorOptions} options
|
|
11493
|
-
* @param {Element} container
|
|
11494
|
-
*
|
|
11495
|
-
* @returns {Injector}
|
|
11556
|
+
/**
|
|
11557
|
+
* @internal
|
|
11558
|
+
*
|
|
11559
|
+
* @param {FormEditorOptions} options
|
|
11560
|
+
* @param {Element} container
|
|
11561
|
+
*
|
|
11562
|
+
* @returns {Injector}
|
|
11496
11563
|
*/
|
|
11497
11564
|
_createInjector(options, container) {
|
|
11498
11565
|
const {
|
|
@@ -11514,22 +11581,22 @@ class FormEditor {
|
|
|
11514
11581
|
}, core, ...modules, ...additionalModules]);
|
|
11515
11582
|
}
|
|
11516
11583
|
|
|
11517
|
-
/**
|
|
11518
|
-
* @internal
|
|
11584
|
+
/**
|
|
11585
|
+
* @internal
|
|
11519
11586
|
*/
|
|
11520
11587
|
_emit(type, data) {
|
|
11521
11588
|
this.get('eventBus').fire(type, data);
|
|
11522
11589
|
}
|
|
11523
11590
|
|
|
11524
|
-
/**
|
|
11525
|
-
* @internal
|
|
11591
|
+
/**
|
|
11592
|
+
* @internal
|
|
11526
11593
|
*/
|
|
11527
11594
|
_getState() {
|
|
11528
11595
|
return this._state;
|
|
11529
11596
|
}
|
|
11530
11597
|
|
|
11531
|
-
/**
|
|
11532
|
-
* @internal
|
|
11598
|
+
/**
|
|
11599
|
+
* @internal
|
|
11533
11600
|
*/
|
|
11534
11601
|
_setState(state) {
|
|
11535
11602
|
this._state = {
|
|
@@ -11539,15 +11606,15 @@ class FormEditor {
|
|
|
11539
11606
|
this._emit('changed', this._getState());
|
|
11540
11607
|
}
|
|
11541
11608
|
|
|
11542
|
-
/**
|
|
11543
|
-
* @internal
|
|
11609
|
+
/**
|
|
11610
|
+
* @internal
|
|
11544
11611
|
*/
|
|
11545
11612
|
_getModules() {
|
|
11546
11613
|
return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
|
|
11547
11614
|
}
|
|
11548
11615
|
|
|
11549
|
-
/**
|
|
11550
|
-
* @internal
|
|
11616
|
+
/**
|
|
11617
|
+
* @internal
|
|
11551
11618
|
*/
|
|
11552
11619
|
_onEvent(type, priority, handler) {
|
|
11553
11620
|
this.get('eventBus').on(type, priority, handler);
|