@bpmn-io/form-js-editor 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +116 -116
- package/dist/assets/form-js-editor-base.css +489 -486
- package/dist/assets/form-js-editor.css +15 -12
- package/dist/index.cjs +231 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +231 -231
- package/dist/index.es.js.map +1 -1
- package/dist/types/types.d.ts +28 -28
- package/package.json +3 -4
package/dist/index.cjs
CHANGED
|
@@ -448,10 +448,10 @@ function invokeFunction(fn, args) {
|
|
|
448
448
|
return fn.apply(null, args);
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
/**
|
|
452
|
-
* A factory to create a configurable debouncer.
|
|
453
|
-
*
|
|
454
|
-
* @param {number|boolean} [config=true]
|
|
451
|
+
/**
|
|
452
|
+
* A factory to create a configurable debouncer.
|
|
453
|
+
*
|
|
454
|
+
* @param {number|boolean} [config=true]
|
|
455
455
|
*/
|
|
456
456
|
function DebounceFactory(config = true) {
|
|
457
457
|
const timeout = typeof config === 'number' ? config : config ? 300 : 0;
|
|
@@ -464,11 +464,11 @@ function DebounceFactory(config = true) {
|
|
|
464
464
|
DebounceFactory.$inject = ['config.debounce'];
|
|
465
465
|
|
|
466
466
|
class FieldFactory {
|
|
467
|
-
/**
|
|
468
|
-
* @constructor
|
|
469
|
-
*
|
|
470
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
471
|
-
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
467
|
+
/**
|
|
468
|
+
* @constructor
|
|
469
|
+
*
|
|
470
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
471
|
+
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
472
472
|
*/
|
|
473
473
|
constructor(formFieldRegistry, formFields) {
|
|
474
474
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -528,11 +528,11 @@ class FieldFactory {
|
|
|
528
528
|
FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
|
|
529
529
|
|
|
530
530
|
class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
531
|
-
/**
|
|
532
|
-
* Updates a form fields id.
|
|
533
|
-
*
|
|
534
|
-
* @param {Object} formField
|
|
535
|
-
* @param {string} newId
|
|
531
|
+
/**
|
|
532
|
+
* Updates a form fields id.
|
|
533
|
+
*
|
|
534
|
+
* @param {Object} formField
|
|
535
|
+
* @param {string} newId
|
|
536
536
|
*/
|
|
537
537
|
updateId(formField, newId) {
|
|
538
538
|
this._validateId(newId);
|
|
@@ -553,13 +553,13 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
-
/**
|
|
557
|
-
* Validate the suitability of the given id and signals a problem
|
|
558
|
-
* with an exception.
|
|
559
|
-
*
|
|
560
|
-
* @param {string} id
|
|
561
|
-
*
|
|
562
|
-
* @throws {Error} if id is empty or already assigned
|
|
556
|
+
/**
|
|
557
|
+
* Validate the suitability of the given id and signals a problem
|
|
558
|
+
* with an exception.
|
|
559
|
+
*
|
|
560
|
+
* @param {string} id
|
|
561
|
+
*
|
|
562
|
+
* @throws {Error} if id is empty or already assigned
|
|
563
563
|
*/
|
|
564
564
|
_validateId(id) {
|
|
565
565
|
if (!id) {
|
|
@@ -572,11 +572,11 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
class FormLayoutValidator {
|
|
575
|
-
/**
|
|
576
|
-
* @constructor
|
|
577
|
-
*
|
|
578
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
579
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
575
|
+
/**
|
|
576
|
+
* @constructor
|
|
577
|
+
*
|
|
578
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
579
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
580
580
|
*/
|
|
581
581
|
constructor(formLayouter, formFieldRegistry) {
|
|
582
582
|
this._formLayouter = formLayouter;
|
|
@@ -629,11 +629,11 @@ class FormLayoutValidator {
|
|
|
629
629
|
FormLayoutValidator.$inject = ['formLayouter', 'formFieldRegistry'];
|
|
630
630
|
|
|
631
631
|
class Importer {
|
|
632
|
-
/**
|
|
633
|
-
* @constructor
|
|
634
|
-
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
635
|
-
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
636
|
-
* @param { import('../core/FormLayouter').default } formLayouter
|
|
632
|
+
/**
|
|
633
|
+
* @constructor
|
|
634
|
+
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
635
|
+
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
636
|
+
* @param { import('../core/FormLayouter').default } formLayouter
|
|
637
637
|
*/
|
|
638
638
|
constructor(formFieldRegistry, fieldFactory, formLayouter) {
|
|
639
639
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -641,21 +641,21 @@ class Importer {
|
|
|
641
641
|
this._formLayouter = formLayouter;
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
/**
|
|
645
|
-
* Import schema creating rows, fields, attaching additional
|
|
646
|
-
* information to each field and adding fields to the
|
|
647
|
-
* field registry.
|
|
648
|
-
*
|
|
649
|
-
* Additional information attached:
|
|
650
|
-
*
|
|
651
|
-
* * `id` (unless present)
|
|
652
|
-
* * `_parent`
|
|
653
|
-
* * `_path`
|
|
654
|
-
*
|
|
655
|
-
* @param {any} schema
|
|
656
|
-
*
|
|
657
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
658
|
-
* @returns {ImportResult}
|
|
644
|
+
/**
|
|
645
|
+
* Import schema creating rows, fields, attaching additional
|
|
646
|
+
* information to each field and adding fields to the
|
|
647
|
+
* field registry.
|
|
648
|
+
*
|
|
649
|
+
* Additional information attached:
|
|
650
|
+
*
|
|
651
|
+
* * `id` (unless present)
|
|
652
|
+
* * `_parent`
|
|
653
|
+
* * `_path`
|
|
654
|
+
*
|
|
655
|
+
* @param {any} schema
|
|
656
|
+
*
|
|
657
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
658
|
+
* @returns {ImportResult}
|
|
659
659
|
*/
|
|
660
660
|
importSchema(schema) {
|
|
661
661
|
// TODO: Add warnings
|
|
@@ -673,12 +673,12 @@ class Importer {
|
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
|
|
676
|
-
/**
|
|
677
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
678
|
-
* @param {String} [parentId]
|
|
679
|
-
* @param {number} [index]
|
|
680
|
-
*
|
|
681
|
-
* @return {any} field
|
|
676
|
+
/**
|
|
677
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
678
|
+
* @param {String} [parentId]
|
|
679
|
+
* @param {number} [index]
|
|
680
|
+
*
|
|
681
|
+
* @return {any} field
|
|
682
682
|
*/
|
|
683
683
|
importFormField(fieldAttrs, parentId, index) {
|
|
684
684
|
const {
|
|
@@ -715,11 +715,11 @@ class Importer {
|
|
|
715
715
|
return field;
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
/**
|
|
719
|
-
* @param {Array<any>} components
|
|
720
|
-
* @param {string} parentId
|
|
721
|
-
*
|
|
722
|
-
* @return {Array<any>} imported components
|
|
718
|
+
/**
|
|
719
|
+
* @param {Array<any>} components
|
|
720
|
+
* @param {string} parentId
|
|
721
|
+
*
|
|
722
|
+
* @return {Array<any>} imported components
|
|
723
723
|
*/
|
|
724
724
|
importFormFields(components, parentId) {
|
|
725
725
|
return components.map((component, index) => {
|
|
@@ -749,11 +749,11 @@ const DragAndDropContext = preact.createContext({
|
|
|
749
749
|
});
|
|
750
750
|
var DragAndDropContext$1 = DragAndDropContext;
|
|
751
751
|
|
|
752
|
-
/**
|
|
753
|
-
* @param {string} type
|
|
754
|
-
* @param {boolean} [strict]
|
|
755
|
-
*
|
|
756
|
-
* @returns {any}
|
|
752
|
+
/**
|
|
753
|
+
* @param {string} type
|
|
754
|
+
* @param {boolean} [strict]
|
|
755
|
+
*
|
|
756
|
+
* @returns {any}
|
|
757
757
|
*/
|
|
758
758
|
function getService$1(type, strict) {}
|
|
759
759
|
const FormEditorContext = preact.createContext({
|
|
@@ -1046,19 +1046,19 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
|
|
|
1046
1046
|
const DRAG_NO_MOVE_CLS = 'fjs-no-move';
|
|
1047
1047
|
const ERROR_DROP_CLS = 'fjs-error-drop';
|
|
1048
1048
|
|
|
1049
|
-
/**
|
|
1050
|
-
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1049
|
+
/**
|
|
1050
|
+
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1051
1051
|
*/
|
|
1052
1052
|
|
|
1053
1053
|
class Dragging {
|
|
1054
|
-
/**
|
|
1055
|
-
* @constructor
|
|
1056
|
-
*
|
|
1057
|
-
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1058
|
-
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1059
|
-
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1060
|
-
* @param { import('../../core/EventBus').default } eventBus
|
|
1061
|
-
* @param { import('../modeling/Modeling').default } modeling
|
|
1054
|
+
/**
|
|
1055
|
+
* @constructor
|
|
1056
|
+
*
|
|
1057
|
+
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1058
|
+
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1059
|
+
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1060
|
+
* @param { import('../../core/EventBus').default } eventBus
|
|
1061
|
+
* @param { import('../modeling/Modeling').default } modeling
|
|
1062
1062
|
*/
|
|
1063
1063
|
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling) {
|
|
1064
1064
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -1068,13 +1068,13 @@ class Dragging {
|
|
|
1068
1068
|
this._modeling = modeling;
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
|
-
/**
|
|
1072
|
-
* Calculcates position in form schema given the dropped place.
|
|
1073
|
-
*
|
|
1074
|
-
* @param { FormRow } targetRow
|
|
1075
|
-
* @param { any } targetFormField
|
|
1076
|
-
* @param { HTMLElement } sibling
|
|
1077
|
-
* @returns { number }
|
|
1071
|
+
/**
|
|
1072
|
+
* Calculcates position in form schema given the dropped place.
|
|
1073
|
+
*
|
|
1074
|
+
* @param { FormRow } targetRow
|
|
1075
|
+
* @param { any } targetFormField
|
|
1076
|
+
* @param { HTMLElement } sibling
|
|
1077
|
+
* @returns { number }
|
|
1078
1078
|
*/
|
|
1079
1079
|
getTargetIndex(targetRow, targetFormField, sibling) {
|
|
1080
1080
|
/** @type HTMLElement */
|
|
@@ -1176,8 +1176,8 @@ class Dragging {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
|
|
1179
|
-
/**
|
|
1180
|
-
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1179
|
+
/**
|
|
1180
|
+
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1181
1181
|
*/
|
|
1182
1182
|
createDragulaInstance(options) {
|
|
1183
1183
|
const {
|
|
@@ -1422,7 +1422,7 @@ function DebugColumns(props) {
|
|
|
1422
1422
|
return null;
|
|
1423
1423
|
}
|
|
1424
1424
|
return jsxRuntime.jsx("div", {
|
|
1425
|
-
style: "width: fit-content
|
|
1425
|
+
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;",
|
|
1426
1426
|
class: "fjs-debug-columns",
|
|
1427
1427
|
children: (field.layout || {}).columns || 'auto'
|
|
1428
1428
|
});
|
|
@@ -2469,10 +2469,10 @@ function updateRow(formField, rowId) {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
|
|
2471
2471
|
class AddFormFieldHandler {
|
|
2472
|
-
/**
|
|
2473
|
-
* @constructor
|
|
2474
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2475
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2472
|
+
/**
|
|
2473
|
+
* @constructor
|
|
2474
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
2475
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2476
2476
|
*/
|
|
2477
2477
|
constructor(formEditor, formFieldRegistry) {
|
|
2478
2478
|
this._formEditor = formEditor;
|
|
@@ -2533,10 +2533,10 @@ class AddFormFieldHandler {
|
|
|
2533
2533
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2534
2534
|
|
|
2535
2535
|
class EditFormFieldHandler {
|
|
2536
|
-
/**
|
|
2537
|
-
* @constructor
|
|
2538
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2539
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2536
|
+
/**
|
|
2537
|
+
* @constructor
|
|
2538
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
2539
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2540
2540
|
*/
|
|
2541
2541
|
constructor(formEditor, formFieldRegistry) {
|
|
2542
2542
|
this._formEditor = formEditor;
|
|
@@ -2599,10 +2599,10 @@ class EditFormFieldHandler {
|
|
|
2599
2599
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2600
2600
|
|
|
2601
2601
|
class MoveFormFieldHandler {
|
|
2602
|
-
/**
|
|
2603
|
-
* @constructor
|
|
2604
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2605
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2602
|
+
/**
|
|
2603
|
+
* @constructor
|
|
2604
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
2605
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2606
2606
|
*/
|
|
2607
2607
|
constructor(formEditor, formFieldRegistry) {
|
|
2608
2608
|
this._formEditor = formEditor;
|
|
@@ -2691,10 +2691,10 @@ class MoveFormFieldHandler {
|
|
|
2691
2691
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2692
2692
|
|
|
2693
2693
|
class RemoveFormFieldHandler {
|
|
2694
|
-
/**
|
|
2695
|
-
* @constructor
|
|
2696
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2697
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2694
|
+
/**
|
|
2695
|
+
* @constructor
|
|
2696
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
2697
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2698
2698
|
*/
|
|
2699
2699
|
constructor(formEditor, formFieldRegistry) {
|
|
2700
2700
|
this._formEditor = formEditor;
|
|
@@ -2754,9 +2754,9 @@ class RemoveFormFieldHandler {
|
|
|
2754
2754
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2755
2755
|
|
|
2756
2756
|
class UpdateIdClaimHandler {
|
|
2757
|
-
/**
|
|
2758
|
-
* @constructor
|
|
2759
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2757
|
+
/**
|
|
2758
|
+
* @constructor
|
|
2759
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2760
2760
|
*/
|
|
2761
2761
|
constructor(formFieldRegistry) {
|
|
2762
2762
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -2789,9 +2789,9 @@ class UpdateIdClaimHandler {
|
|
|
2789
2789
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
2790
2790
|
|
|
2791
2791
|
class UpdateKeyClaimHandler {
|
|
2792
|
-
/**
|
|
2793
|
-
* @constructor
|
|
2794
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2792
|
+
/**
|
|
2793
|
+
* @constructor
|
|
2794
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2795
2795
|
*/
|
|
2796
2796
|
constructor(formFieldRegistry) {
|
|
2797
2797
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3141,8 +3141,8 @@ class ValidateBehavior extends CommandInterceptor {
|
|
|
3141
3141
|
constructor(eventBus) {
|
|
3142
3142
|
super(eventBus);
|
|
3143
3143
|
|
|
3144
|
-
/**
|
|
3145
|
-
* Remove custom validation if <validationType> is about to be added.
|
|
3144
|
+
/**
|
|
3145
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
3146
3146
|
*/
|
|
3147
3147
|
// @ts-ignore-next-line
|
|
3148
3148
|
this.preExecute('formField.edit', function (context) {
|
|
@@ -3687,10 +3687,10 @@ class PaletteRenderer {
|
|
|
3687
3687
|
});
|
|
3688
3688
|
}
|
|
3689
3689
|
|
|
3690
|
-
/**
|
|
3691
|
-
* Attach the palette to a parent node.
|
|
3692
|
-
*
|
|
3693
|
-
* @param {HTMLElement} container
|
|
3690
|
+
/**
|
|
3691
|
+
* Attach the palette to a parent node.
|
|
3692
|
+
*
|
|
3693
|
+
* @param {HTMLElement} container
|
|
3694
3694
|
*/
|
|
3695
3695
|
attachTo(container) {
|
|
3696
3696
|
if (!container) {
|
|
@@ -3710,8 +3710,8 @@ class PaletteRenderer {
|
|
|
3710
3710
|
this._eventBus.fire('palette.attach');
|
|
3711
3711
|
}
|
|
3712
3712
|
|
|
3713
|
-
/**
|
|
3714
|
-
* Detach the palette from its parent node.
|
|
3713
|
+
/**
|
|
3714
|
+
* Detach the palette from its parent node.
|
|
3715
3715
|
*/
|
|
3716
3716
|
detach() {
|
|
3717
3717
|
const parentNode = this._container.parentNode;
|
|
@@ -6068,11 +6068,11 @@ function prefixId$1(id) {
|
|
|
6068
6068
|
return `bio-properties-panel-${id}`;
|
|
6069
6069
|
}
|
|
6070
6070
|
|
|
6071
|
-
/**
|
|
6072
|
-
* @param {string} type
|
|
6073
|
-
* @param {boolean} [strict]
|
|
6074
|
-
*
|
|
6075
|
-
* @returns {any}
|
|
6071
|
+
/**
|
|
6072
|
+
* @param {string} type
|
|
6073
|
+
* @param {boolean} [strict]
|
|
6074
|
+
*
|
|
6075
|
+
* @returns {any}
|
|
6076
6076
|
*/
|
|
6077
6077
|
function getService(type, strict) {}
|
|
6078
6078
|
const PropertiesPanelContext = preact.createContext({
|
|
@@ -6161,8 +6161,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
6161
6161
|
}
|
|
6162
6162
|
};
|
|
6163
6163
|
|
|
6164
|
-
/**
|
|
6165
|
-
* Provide placeholders for empty and multiple state.
|
|
6164
|
+
/**
|
|
6165
|
+
* Provide placeholders for empty and multiple state.
|
|
6166
6166
|
*/
|
|
6167
6167
|
const PropertiesPanelPlaceholderProvider = {
|
|
6168
6168
|
getEmpty: () => {
|
|
@@ -6234,10 +6234,10 @@ function useService (type, strict) {
|
|
|
6234
6234
|
return getService(type, strict);
|
|
6235
6235
|
}
|
|
6236
6236
|
|
|
6237
|
-
/**
|
|
6238
|
-
* Retrieve list of variables from the form schema.
|
|
6239
|
-
*
|
|
6240
|
-
* @returns { string[] } list of variables used in form schema
|
|
6237
|
+
/**
|
|
6238
|
+
* Retrieve list of variables from the form schema.
|
|
6239
|
+
*
|
|
6240
|
+
* @returns { string[] } list of variables used in form schema
|
|
6241
6241
|
*/
|
|
6242
6242
|
function useVariables() {
|
|
6243
6243
|
const form = useService('formEditor');
|
|
@@ -7630,14 +7630,14 @@ function Value(props) {
|
|
|
7630
7630
|
|
|
7631
7631
|
// helpers //////////
|
|
7632
7632
|
|
|
7633
|
-
/**
|
|
7634
|
-
* Returns copy of object with updated value.
|
|
7635
|
-
*
|
|
7636
|
-
* @param {Object} properties
|
|
7637
|
-
* @param {string} key
|
|
7638
|
-
* @param {string} value
|
|
7639
|
-
*
|
|
7640
|
-
* @returns {Object}
|
|
7633
|
+
/**
|
|
7634
|
+
* Returns copy of object with updated value.
|
|
7635
|
+
*
|
|
7636
|
+
* @param {Object} properties
|
|
7637
|
+
* @param {string} key
|
|
7638
|
+
* @param {string} value
|
|
7639
|
+
*
|
|
7640
|
+
* @returns {Object}
|
|
7641
7641
|
*/
|
|
7642
7642
|
function updateValue(properties, key, value) {
|
|
7643
7643
|
return {
|
|
@@ -7646,14 +7646,14 @@ function updateValue(properties, key, value) {
|
|
|
7646
7646
|
};
|
|
7647
7647
|
}
|
|
7648
7648
|
|
|
7649
|
-
/**
|
|
7650
|
-
* Returns copy of object with updated key.
|
|
7651
|
-
*
|
|
7652
|
-
* @param {Object} properties
|
|
7653
|
-
* @param {string} oldKey
|
|
7654
|
-
* @param {string} newKey
|
|
7655
|
-
*
|
|
7656
|
-
* @returns {Object}
|
|
7649
|
+
/**
|
|
7650
|
+
* Returns copy of object with updated key.
|
|
7651
|
+
*
|
|
7652
|
+
* @param {Object} properties
|
|
7653
|
+
* @param {string} oldKey
|
|
7654
|
+
* @param {string} newKey
|
|
7655
|
+
*
|
|
7656
|
+
* @returns {Object}
|
|
7657
7657
|
*/
|
|
7658
7658
|
function updateKey(properties, oldKey, newKey) {
|
|
7659
7659
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -8066,7 +8066,7 @@ function ValidationGroup(field, editField) {
|
|
|
8066
8066
|
} = field;
|
|
8067
8067
|
const validate = minDash.get(field, ['validate'], {});
|
|
8068
8068
|
const isCustomValidation = [undefined, VALIDATION_TYPE_OPTIONS.custom.value].includes(validate.validationType);
|
|
8069
|
-
if (!
|
|
8069
|
+
if (!INPUTS.includes(type)) {
|
|
8070
8070
|
return null;
|
|
8071
8071
|
}
|
|
8072
8072
|
const onChange = key => {
|
|
@@ -8289,8 +8289,8 @@ function ValuesGroups(field, editField) {
|
|
|
8289
8289
|
};
|
|
8290
8290
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
8291
8291
|
|
|
8292
|
-
/**
|
|
8293
|
-
* @type {Array<Group|ListGroup>}
|
|
8292
|
+
/**
|
|
8293
|
+
* @type {Array<Group|ListGroup>}
|
|
8294
8294
|
*/
|
|
8295
8295
|
const groups = [{
|
|
8296
8296
|
id: valuesSourceId,
|
|
@@ -8391,13 +8391,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
8391
8391
|
|
|
8392
8392
|
// helpers //////////
|
|
8393
8393
|
|
|
8394
|
-
/**
|
|
8395
|
-
* Returns copy of object without key.
|
|
8396
|
-
*
|
|
8397
|
-
* @param {Object} properties
|
|
8398
|
-
* @param {string} oldKey
|
|
8399
|
-
*
|
|
8400
|
-
* @returns {Object}
|
|
8394
|
+
/**
|
|
8395
|
+
* Returns copy of object without key.
|
|
8396
|
+
*
|
|
8397
|
+
* @param {Object} properties
|
|
8398
|
+
* @param {string} oldKey
|
|
8399
|
+
*
|
|
8400
|
+
* @returns {Object}
|
|
8401
8401
|
*/
|
|
8402
8402
|
function removeKey(properties, oldKey) {
|
|
8403
8403
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -8511,9 +8511,9 @@ function FormPropertiesPanel(props) {
|
|
|
8511
8511
|
}, []);
|
|
8512
8512
|
hooks$1.useLayoutEffect(() => {
|
|
8513
8513
|
const onFieldChanged = () => {
|
|
8514
|
-
/**
|
|
8515
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
8516
|
-
* once we have a proper updater/change support
|
|
8514
|
+
/**
|
|
8515
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
8516
|
+
* once we have a proper updater/change support
|
|
8517
8517
|
*/
|
|
8518
8518
|
_update(selection.get() || schema);
|
|
8519
8519
|
};
|
|
@@ -8564,10 +8564,10 @@ class PropertiesPanelRenderer {
|
|
|
8564
8564
|
});
|
|
8565
8565
|
}
|
|
8566
8566
|
|
|
8567
|
-
/**
|
|
8568
|
-
* Attach the properties panel to a parent node.
|
|
8569
|
-
*
|
|
8570
|
-
* @param {HTMLElement} container
|
|
8567
|
+
/**
|
|
8568
|
+
* Attach the properties panel to a parent node.
|
|
8569
|
+
*
|
|
8570
|
+
* @param {HTMLElement} container
|
|
8571
8571
|
*/
|
|
8572
8572
|
attachTo(container) {
|
|
8573
8573
|
if (!container) {
|
|
@@ -8587,8 +8587,8 @@ class PropertiesPanelRenderer {
|
|
|
8587
8587
|
this._eventBus.fire('propertiesPanel.attach');
|
|
8588
8588
|
}
|
|
8589
8589
|
|
|
8590
|
-
/**
|
|
8591
|
-
* Detach the properties panel from its parent node.
|
|
8590
|
+
/**
|
|
8591
|
+
* Detach the properties panel from its parent node.
|
|
8592
8592
|
*/
|
|
8593
8593
|
detach() {
|
|
8594
8594
|
const parentNode = this._container.parentNode;
|
|
@@ -8626,48 +8626,48 @@ var ExpressionLanguageModule = {
|
|
|
8626
8626
|
|
|
8627
8627
|
const ids = new Ids([32, 36, 1]);
|
|
8628
8628
|
|
|
8629
|
-
/**
|
|
8630
|
-
* @typedef { import('./types').Injector } Injector
|
|
8631
|
-
* @typedef { import('./types').Module } Module
|
|
8632
|
-
* @typedef { import('./types').Schema } Schema
|
|
8633
|
-
*
|
|
8634
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
8635
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
8636
|
-
*
|
|
8637
|
-
* @typedef { {
|
|
8638
|
-
* properties: FormEditorProperties,
|
|
8639
|
-
* schema: Schema
|
|
8640
|
-
* } } State
|
|
8641
|
-
*
|
|
8642
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
8643
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
8644
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
8629
|
+
/**
|
|
8630
|
+
* @typedef { import('./types').Injector } Injector
|
|
8631
|
+
* @typedef { import('./types').Module } Module
|
|
8632
|
+
* @typedef { import('./types').Schema } Schema
|
|
8633
|
+
*
|
|
8634
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
8635
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
8636
|
+
*
|
|
8637
|
+
* @typedef { {
|
|
8638
|
+
* properties: FormEditorProperties,
|
|
8639
|
+
* schema: Schema
|
|
8640
|
+
* } } State
|
|
8641
|
+
*
|
|
8642
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
8643
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
8644
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
8645
8645
|
*/
|
|
8646
8646
|
|
|
8647
|
-
/**
|
|
8648
|
-
* The form editor.
|
|
8647
|
+
/**
|
|
8648
|
+
* The form editor.
|
|
8649
8649
|
*/
|
|
8650
8650
|
class FormEditor {
|
|
8651
|
-
/**
|
|
8652
|
-
* @constructor
|
|
8653
|
-
* @param {FormEditorOptions} options
|
|
8651
|
+
/**
|
|
8652
|
+
* @constructor
|
|
8653
|
+
* @param {FormEditorOptions} options
|
|
8654
8654
|
*/
|
|
8655
8655
|
constructor(options = {}) {
|
|
8656
|
-
/**
|
|
8657
|
-
* @public
|
|
8658
|
-
* @type {OnEventType}
|
|
8656
|
+
/**
|
|
8657
|
+
* @public
|
|
8658
|
+
* @type {OnEventType}
|
|
8659
8659
|
*/
|
|
8660
8660
|
this.on = this._onEvent;
|
|
8661
8661
|
|
|
8662
|
-
/**
|
|
8663
|
-
* @public
|
|
8664
|
-
* @type {String}
|
|
8662
|
+
/**
|
|
8663
|
+
* @public
|
|
8664
|
+
* @type {String}
|
|
8665
8665
|
*/
|
|
8666
8666
|
this._id = ids.next();
|
|
8667
8667
|
|
|
8668
|
-
/**
|
|
8669
|
-
* @private
|
|
8670
|
-
* @type {Element}
|
|
8668
|
+
/**
|
|
8669
|
+
* @private
|
|
8670
|
+
* @type {Element}
|
|
8671
8671
|
*/
|
|
8672
8672
|
this._container = formJsViewer.createFormContainer();
|
|
8673
8673
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -8678,15 +8678,15 @@ class FormEditor {
|
|
|
8678
8678
|
properties = {}
|
|
8679
8679
|
} = options;
|
|
8680
8680
|
|
|
8681
|
-
/**
|
|
8682
|
-
* @private
|
|
8683
|
-
* @type {any}
|
|
8681
|
+
/**
|
|
8682
|
+
* @private
|
|
8683
|
+
* @type {any}
|
|
8684
8684
|
*/
|
|
8685
8685
|
this.exporter = exporter;
|
|
8686
8686
|
|
|
8687
|
-
/**
|
|
8688
|
-
* @private
|
|
8689
|
-
* @type {State}
|
|
8687
|
+
/**
|
|
8688
|
+
* @private
|
|
8689
|
+
* @type {State}
|
|
8690
8690
|
*/
|
|
8691
8691
|
this._state = {
|
|
8692
8692
|
properties,
|
|
@@ -8715,10 +8715,10 @@ class FormEditor {
|
|
|
8715
8715
|
this._detach(false);
|
|
8716
8716
|
}
|
|
8717
8717
|
|
|
8718
|
-
/**
|
|
8719
|
-
* @param {Schema} schema
|
|
8720
|
-
*
|
|
8721
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
8718
|
+
/**
|
|
8719
|
+
* @param {Schema} schema
|
|
8720
|
+
*
|
|
8721
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
8722
8722
|
*/
|
|
8723
8723
|
importSchema(schema) {
|
|
8724
8724
|
return new Promise((resolve, reject) => {
|
|
@@ -8747,15 +8747,15 @@ class FormEditor {
|
|
|
8747
8747
|
});
|
|
8748
8748
|
}
|
|
8749
8749
|
|
|
8750
|
-
/**
|
|
8751
|
-
* @returns {Schema}
|
|
8750
|
+
/**
|
|
8751
|
+
* @returns {Schema}
|
|
8752
8752
|
*/
|
|
8753
8753
|
saveSchema() {
|
|
8754
8754
|
return this.getSchema();
|
|
8755
8755
|
}
|
|
8756
8756
|
|
|
8757
|
-
/**
|
|
8758
|
-
* @returns {Schema}
|
|
8757
|
+
/**
|
|
8758
|
+
* @returns {Schema}
|
|
8759
8759
|
*/
|
|
8760
8760
|
getSchema() {
|
|
8761
8761
|
const {
|
|
@@ -8764,8 +8764,8 @@ class FormEditor {
|
|
|
8764
8764
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
8765
8765
|
}
|
|
8766
8766
|
|
|
8767
|
-
/**
|
|
8768
|
-
* @param {Element|string} parentNode
|
|
8767
|
+
/**
|
|
8768
|
+
* @param {Element|string} parentNode
|
|
8769
8769
|
*/
|
|
8770
8770
|
attachTo(parentNode) {
|
|
8771
8771
|
if (!parentNode) {
|
|
@@ -8783,10 +8783,10 @@ class FormEditor {
|
|
|
8783
8783
|
this._detach();
|
|
8784
8784
|
}
|
|
8785
8785
|
|
|
8786
|
-
/**
|
|
8787
|
-
* @internal
|
|
8788
|
-
*
|
|
8789
|
-
* @param {boolean} [emit]
|
|
8786
|
+
/**
|
|
8787
|
+
* @internal
|
|
8788
|
+
*
|
|
8789
|
+
* @param {boolean} [emit]
|
|
8790
8790
|
*/
|
|
8791
8791
|
_detach(emit = true) {
|
|
8792
8792
|
const container = this._container,
|
|
@@ -8800,9 +8800,9 @@ class FormEditor {
|
|
|
8800
8800
|
parentNode.removeChild(container);
|
|
8801
8801
|
}
|
|
8802
8802
|
|
|
8803
|
-
/**
|
|
8804
|
-
* @param {any} property
|
|
8805
|
-
* @param {any} value
|
|
8803
|
+
/**
|
|
8804
|
+
* @param {any} property
|
|
8805
|
+
* @param {any} value
|
|
8806
8806
|
*/
|
|
8807
8807
|
setProperty(property, value) {
|
|
8808
8808
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -8811,21 +8811,21 @@ class FormEditor {
|
|
|
8811
8811
|
});
|
|
8812
8812
|
}
|
|
8813
8813
|
|
|
8814
|
-
/**
|
|
8815
|
-
* @param {string} type
|
|
8816
|
-
* @param {Function} handler
|
|
8814
|
+
/**
|
|
8815
|
+
* @param {string} type
|
|
8816
|
+
* @param {Function} handler
|
|
8817
8817
|
*/
|
|
8818
8818
|
off(type, handler) {
|
|
8819
8819
|
this.get('eventBus').off(type, handler);
|
|
8820
8820
|
}
|
|
8821
8821
|
|
|
8822
|
-
/**
|
|
8823
|
-
* @internal
|
|
8824
|
-
*
|
|
8825
|
-
* @param {FormEditorOptions} options
|
|
8826
|
-
* @param {Element} container
|
|
8827
|
-
*
|
|
8828
|
-
* @returns {Injector}
|
|
8822
|
+
/**
|
|
8823
|
+
* @internal
|
|
8824
|
+
*
|
|
8825
|
+
* @param {FormEditorOptions} options
|
|
8826
|
+
* @param {Element} container
|
|
8827
|
+
*
|
|
8828
|
+
* @returns {Injector}
|
|
8829
8829
|
*/
|
|
8830
8830
|
_createInjector(options, container) {
|
|
8831
8831
|
const {
|
|
@@ -8847,22 +8847,22 @@ class FormEditor {
|
|
|
8847
8847
|
}, core, ...modules, ...additionalModules]);
|
|
8848
8848
|
}
|
|
8849
8849
|
|
|
8850
|
-
/**
|
|
8851
|
-
* @internal
|
|
8850
|
+
/**
|
|
8851
|
+
* @internal
|
|
8852
8852
|
*/
|
|
8853
8853
|
_emit(type, data) {
|
|
8854
8854
|
this.get('eventBus').fire(type, data);
|
|
8855
8855
|
}
|
|
8856
8856
|
|
|
8857
|
-
/**
|
|
8858
|
-
* @internal
|
|
8857
|
+
/**
|
|
8858
|
+
* @internal
|
|
8859
8859
|
*/
|
|
8860
8860
|
_getState() {
|
|
8861
8861
|
return this._state;
|
|
8862
8862
|
}
|
|
8863
8863
|
|
|
8864
|
-
/**
|
|
8865
|
-
* @internal
|
|
8864
|
+
/**
|
|
8865
|
+
* @internal
|
|
8866
8866
|
*/
|
|
8867
8867
|
_setState(state) {
|
|
8868
8868
|
this._state = {
|
|
@@ -8872,15 +8872,15 @@ class FormEditor {
|
|
|
8872
8872
|
this._emit('changed', this._getState());
|
|
8873
8873
|
}
|
|
8874
8874
|
|
|
8875
|
-
/**
|
|
8876
|
-
* @internal
|
|
8875
|
+
/**
|
|
8876
|
+
* @internal
|
|
8877
8877
|
*/
|
|
8878
8878
|
_getModules() {
|
|
8879
8879
|
return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule];
|
|
8880
8880
|
}
|
|
8881
8881
|
|
|
8882
|
-
/**
|
|
8883
|
-
* @internal
|
|
8882
|
+
/**
|
|
8883
|
+
* @internal
|
|
8884
8884
|
*/
|
|
8885
8885
|
_onEvent(type, priority, handler) {
|
|
8886
8886
|
this.get('eventBus').on(type, priority, handler);
|