@bpmn-io/form-js-editor 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +734 -734
- package/dist/index.cjs +316 -326
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +316 -326
- package/dist/index.es.js.map +1 -1
- package/dist/types/types.d.ts +28 -28
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -515,10 +515,10 @@ function invokeFunction(fn, args) {
|
|
|
515
515
|
return fn.apply(null, args);
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
/**
|
|
519
|
-
* A factory to create a configurable debouncer.
|
|
520
|
-
*
|
|
521
|
-
* @param {number|boolean} [config=true]
|
|
518
|
+
/**
|
|
519
|
+
* A factory to create a configurable debouncer.
|
|
520
|
+
*
|
|
521
|
+
* @param {number|boolean} [config=true]
|
|
522
522
|
*/
|
|
523
523
|
function DebounceFactory(config = true) {
|
|
524
524
|
const timeout = typeof config === 'number' ? config : config ? 300 : 0;
|
|
@@ -531,11 +531,11 @@ function DebounceFactory(config = true) {
|
|
|
531
531
|
DebounceFactory.$inject = ['config.debounce'];
|
|
532
532
|
|
|
533
533
|
class FieldFactory {
|
|
534
|
-
/**
|
|
535
|
-
* @constructor
|
|
536
|
-
*
|
|
537
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
538
|
-
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
534
|
+
/**
|
|
535
|
+
* @constructor
|
|
536
|
+
*
|
|
537
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
538
|
+
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
539
539
|
*/
|
|
540
540
|
constructor(formFieldRegistry, formFields) {
|
|
541
541
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -598,11 +598,11 @@ class FieldFactory {
|
|
|
598
598
|
FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
|
|
599
599
|
|
|
600
600
|
class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
601
|
-
/**
|
|
602
|
-
* Updates a form fields id.
|
|
603
|
-
*
|
|
604
|
-
* @param {Object} formField
|
|
605
|
-
* @param {string} newId
|
|
601
|
+
/**
|
|
602
|
+
* Updates a form fields id.
|
|
603
|
+
*
|
|
604
|
+
* @param {Object} formField
|
|
605
|
+
* @param {string} newId
|
|
606
606
|
*/
|
|
607
607
|
updateId(formField, newId) {
|
|
608
608
|
this._validateId(newId);
|
|
@@ -623,13 +623,13 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
|
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
/**
|
|
627
|
-
* Validate the suitability of the given id and signals a problem
|
|
628
|
-
* with an exception.
|
|
629
|
-
*
|
|
630
|
-
* @param {string} id
|
|
631
|
-
*
|
|
632
|
-
* @throws {Error} if id is empty or already assigned
|
|
626
|
+
/**
|
|
627
|
+
* Validate the suitability of the given id and signals a problem
|
|
628
|
+
* with an exception.
|
|
629
|
+
*
|
|
630
|
+
* @param {string} id
|
|
631
|
+
*
|
|
632
|
+
* @throws {Error} if id is empty or already assigned
|
|
633
633
|
*/
|
|
634
634
|
_validateId(id) {
|
|
635
635
|
if (!id) {
|
|
@@ -646,11 +646,11 @@ const MAX_COLUMNS = 16;
|
|
|
646
646
|
const MIN_COLUMNS = 2;
|
|
647
647
|
const MAX_FIELDS_PER_ROW = 4;
|
|
648
648
|
class FormLayoutValidator {
|
|
649
|
-
/**
|
|
650
|
-
* @constructor
|
|
651
|
-
*
|
|
652
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
653
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
649
|
+
/**
|
|
650
|
+
* @constructor
|
|
651
|
+
*
|
|
652
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
653
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
654
654
|
*/
|
|
655
655
|
constructor(formLayouter, formFieldRegistry) {
|
|
656
656
|
this._formLayouter = formLayouter;
|
|
@@ -710,11 +710,11 @@ function calculateMaxColumnsWithAuto(autoCols) {
|
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
class Importer {
|
|
713
|
-
/**
|
|
714
|
-
* @constructor
|
|
715
|
-
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
716
|
-
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
717
|
-
* @param { import('../core/FormLayouter').default } formLayouter
|
|
713
|
+
/**
|
|
714
|
+
* @constructor
|
|
715
|
+
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
716
|
+
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
717
|
+
* @param { import('../core/FormLayouter').default } formLayouter
|
|
718
718
|
*/
|
|
719
719
|
constructor(formFieldRegistry, fieldFactory, formLayouter) {
|
|
720
720
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -722,21 +722,21 @@ class Importer {
|
|
|
722
722
|
this._formLayouter = formLayouter;
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
/**
|
|
726
|
-
* Import schema creating rows, fields, attaching additional
|
|
727
|
-
* information to each field and adding fields to the
|
|
728
|
-
* field registry.
|
|
729
|
-
*
|
|
730
|
-
* Additional information attached:
|
|
731
|
-
*
|
|
732
|
-
* * `id` (unless present)
|
|
733
|
-
* * `_parent`
|
|
734
|
-
* * `_path`
|
|
735
|
-
*
|
|
736
|
-
* @param {any} schema
|
|
737
|
-
*
|
|
738
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
739
|
-
* @returns {ImportResult}
|
|
725
|
+
/**
|
|
726
|
+
* Import schema creating rows, fields, attaching additional
|
|
727
|
+
* information to each field and adding fields to the
|
|
728
|
+
* field registry.
|
|
729
|
+
*
|
|
730
|
+
* Additional information attached:
|
|
731
|
+
*
|
|
732
|
+
* * `id` (unless present)
|
|
733
|
+
* * `_parent`
|
|
734
|
+
* * `_path`
|
|
735
|
+
*
|
|
736
|
+
* @param {any} schema
|
|
737
|
+
*
|
|
738
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
739
|
+
* @returns {ImportResult}
|
|
740
740
|
*/
|
|
741
741
|
importSchema(schema) {
|
|
742
742
|
// TODO: Add warnings
|
|
@@ -754,12 +754,12 @@ class Importer {
|
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
/**
|
|
758
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
759
|
-
* @param {String} [parentId]
|
|
760
|
-
* @param {number} [index]
|
|
761
|
-
*
|
|
762
|
-
* @return {any} field
|
|
757
|
+
/**
|
|
758
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
759
|
+
* @param {String} [parentId]
|
|
760
|
+
* @param {number} [index]
|
|
761
|
+
*
|
|
762
|
+
* @return {any} field
|
|
763
763
|
*/
|
|
764
764
|
importFormField(fieldAttrs, parentId, index) {
|
|
765
765
|
const {
|
|
@@ -796,11 +796,11 @@ class Importer {
|
|
|
796
796
|
return field;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
/**
|
|
800
|
-
* @param {Array<any>} components
|
|
801
|
-
* @param {string} parentId
|
|
802
|
-
*
|
|
803
|
-
* @return {Array<any>} imported components
|
|
799
|
+
/**
|
|
800
|
+
* @param {Array<any>} components
|
|
801
|
+
* @param {string} parentId
|
|
802
|
+
*
|
|
803
|
+
* @return {Array<any>} imported components
|
|
804
804
|
*/
|
|
805
805
|
importFormFields(components, parentId) {
|
|
806
806
|
return components.map((component, index) => {
|
|
@@ -825,22 +825,22 @@ function editorFormFieldClasses(type, {
|
|
|
825
825
|
});
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
/**
|
|
829
|
-
* Add a dragger that calls back the passed function with
|
|
830
|
-
* { event, delta } on drag.
|
|
831
|
-
*
|
|
832
|
-
* @example
|
|
833
|
-
*
|
|
834
|
-
* function dragMove(event, delta) {
|
|
835
|
-
* // we are dragging (!!)
|
|
836
|
-
* }
|
|
837
|
-
*
|
|
838
|
-
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
839
|
-
*
|
|
840
|
-
* @param {Function} fn
|
|
841
|
-
* @param {Element} dragPreview
|
|
842
|
-
*
|
|
843
|
-
* @return {Function} drag start callback function
|
|
828
|
+
/**
|
|
829
|
+
* Add a dragger that calls back the passed function with
|
|
830
|
+
* { event, delta } on drag.
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
*
|
|
834
|
+
* function dragMove(event, delta) {
|
|
835
|
+
* // we are dragging (!!)
|
|
836
|
+
* }
|
|
837
|
+
*
|
|
838
|
+
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
839
|
+
*
|
|
840
|
+
* @param {Function} fn
|
|
841
|
+
* @param {Element} dragPreview
|
|
842
|
+
*
|
|
843
|
+
* @return {Function} drag start callback function
|
|
844
844
|
*/
|
|
845
845
|
function createDragger(fn, dragPreview) {
|
|
846
846
|
let self;
|
|
@@ -881,12 +881,12 @@ function createDragger(fn, dragPreview) {
|
|
|
881
881
|
return onDragStart;
|
|
882
882
|
}
|
|
883
883
|
|
|
884
|
-
/**
|
|
885
|
-
* Throttle function call according UI update cycle.
|
|
886
|
-
*
|
|
887
|
-
* @param {Function} fn
|
|
888
|
-
*
|
|
889
|
-
* @return {Function} throttled fn
|
|
884
|
+
/**
|
|
885
|
+
* Throttle function call according UI update cycle.
|
|
886
|
+
*
|
|
887
|
+
* @param {Function} fn
|
|
888
|
+
*
|
|
889
|
+
* @return {Function} throttled fn
|
|
890
890
|
*/
|
|
891
891
|
function throttle(fn) {
|
|
892
892
|
let active = false;
|
|
@@ -915,11 +915,11 @@ const DragAndDropContext = preact.createContext({
|
|
|
915
915
|
});
|
|
916
916
|
var DragAndDropContext$1 = DragAndDropContext;
|
|
917
917
|
|
|
918
|
-
/**
|
|
919
|
-
* @param {string} type
|
|
920
|
-
* @param {boolean} [strict]
|
|
921
|
-
*
|
|
922
|
-
* @returns {any}
|
|
918
|
+
/**
|
|
919
|
+
* @param {string} type
|
|
920
|
+
* @param {boolean} [strict]
|
|
921
|
+
*
|
|
922
|
+
* @returns {any}
|
|
923
923
|
*/
|
|
924
924
|
function getService$1(type, strict) {}
|
|
925
925
|
const FormEditorContext = preact.createContext({
|
|
@@ -1206,23 +1206,23 @@ var Slot = (props => {
|
|
|
1206
1206
|
return fillsAndSeparators;
|
|
1207
1207
|
});
|
|
1208
1208
|
|
|
1209
|
-
/**
|
|
1210
|
-
* Creates a Fragment for a fill.
|
|
1211
|
-
*
|
|
1212
|
-
* @param {Object} fill Fill to be rendered
|
|
1213
|
-
* @returns {Object} Preact Fragment containing fill's children
|
|
1209
|
+
/**
|
|
1210
|
+
* Creates a Fragment for a fill.
|
|
1211
|
+
*
|
|
1212
|
+
* @param {Object} fill Fill to be rendered
|
|
1213
|
+
* @returns {Object} Preact Fragment containing fill's children
|
|
1214
1214
|
*/
|
|
1215
1215
|
const FillFragment = fill => jsxRuntime.jsx(preact.Fragment, {
|
|
1216
1216
|
children: fill.children
|
|
1217
1217
|
}, fill.id);
|
|
1218
1218
|
|
|
1219
|
-
/**
|
|
1220
|
-
* Creates an array of fills, with separators inserted between groups.
|
|
1221
|
-
*
|
|
1222
|
-
* @param {Array} groups Groups of fills
|
|
1223
|
-
* @param {Function} fillRenderer Function to create a fill
|
|
1224
|
-
* @param {Function} separatorRenderer Function to create a separator
|
|
1225
|
-
* @returns {Array} Array of fills and separators
|
|
1219
|
+
/**
|
|
1220
|
+
* Creates an array of fills, with separators inserted between groups.
|
|
1221
|
+
*
|
|
1222
|
+
* @param {Array} groups Groups of fills
|
|
1223
|
+
* @param {Function} fillRenderer Function to create a fill
|
|
1224
|
+
* @param {Function} separatorRenderer Function to create a separator
|
|
1225
|
+
* @returns {Array} Array of fills and separators
|
|
1226
1226
|
*/
|
|
1227
1227
|
const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
1228
1228
|
const result = [];
|
|
@@ -1240,8 +1240,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
|
1240
1240
|
return result;
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
/**
|
|
1244
|
-
* Groups fills by group name property.
|
|
1243
|
+
/**
|
|
1244
|
+
* Groups fills by group name property.
|
|
1245
1245
|
*/
|
|
1246
1246
|
const _groupByGroupName = fills => {
|
|
1247
1247
|
const groups = [];
|
|
@@ -1261,8 +1261,8 @@ const _groupByGroupName = fills => {
|
|
|
1261
1261
|
return Object.keys(groupsById).sort().map(id => groupsById[id]);
|
|
1262
1262
|
};
|
|
1263
1263
|
|
|
1264
|
-
/**
|
|
1265
|
-
* Compares fills by priority.
|
|
1264
|
+
/**
|
|
1265
|
+
* Compares fills by priority.
|
|
1266
1266
|
*/
|
|
1267
1267
|
const _comparePriority = (a, b) => {
|
|
1268
1268
|
return (b.priority || 0) - (a.priority || 0);
|
|
@@ -1490,19 +1490,19 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
|
|
|
1490
1490
|
const DRAG_NO_MOVE_CLS = 'fjs-no-move';
|
|
1491
1491
|
const ERROR_DROP_CLS = 'fjs-error-drop';
|
|
1492
1492
|
|
|
1493
|
-
/**
|
|
1494
|
-
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1493
|
+
/**
|
|
1494
|
+
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
1495
1495
|
*/
|
|
1496
1496
|
|
|
1497
1497
|
class Dragging {
|
|
1498
|
-
/**
|
|
1499
|
-
* @constructor
|
|
1500
|
-
*
|
|
1501
|
-
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1502
|
-
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1503
|
-
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1504
|
-
* @param { import('../../core/EventBus').default } eventBus
|
|
1505
|
-
* @param { import('../modeling/Modeling').default } modeling
|
|
1498
|
+
/**
|
|
1499
|
+
* @constructor
|
|
1500
|
+
*
|
|
1501
|
+
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1502
|
+
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
1503
|
+
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
1504
|
+
* @param { import('../../core/EventBus').default } eventBus
|
|
1505
|
+
* @param { import('../modeling/Modeling').default } modeling
|
|
1506
1506
|
*/
|
|
1507
1507
|
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling) {
|
|
1508
1508
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -1512,13 +1512,13 @@ class Dragging {
|
|
|
1512
1512
|
this._modeling = modeling;
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
|
-
/**
|
|
1516
|
-
* Calculcates position in form schema given the dropped place.
|
|
1517
|
-
*
|
|
1518
|
-
* @param { FormRow } targetRow
|
|
1519
|
-
* @param { any } targetFormField
|
|
1520
|
-
* @param { HTMLElement } sibling
|
|
1521
|
-
* @returns { number }
|
|
1515
|
+
/**
|
|
1516
|
+
* Calculcates position in form schema given the dropped place.
|
|
1517
|
+
*
|
|
1518
|
+
* @param { FormRow } targetRow
|
|
1519
|
+
* @param { any } targetFormField
|
|
1520
|
+
* @param { HTMLElement } sibling
|
|
1521
|
+
* @returns { number }
|
|
1522
1522
|
*/
|
|
1523
1523
|
getTargetIndex(targetRow, targetFormField, sibling) {
|
|
1524
1524
|
/** @type HTMLElement */
|
|
@@ -1620,8 +1620,8 @@ class Dragging {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
}
|
|
1622
1622
|
|
|
1623
|
-
/**
|
|
1624
|
-
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1623
|
+
/**
|
|
1624
|
+
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
1625
1625
|
*/
|
|
1626
1626
|
createDragulaInstance(options) {
|
|
1627
1627
|
const {
|
|
@@ -2018,7 +2018,7 @@ function DebugColumns(props) {
|
|
|
2018
2018
|
return null;
|
|
2019
2019
|
}
|
|
2020
2020
|
return jsxRuntime.jsx("div", {
|
|
2021
|
-
style: "width: fit-content
|
|
2021
|
+
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;",
|
|
2022
2022
|
class: "fjs-debug-columns",
|
|
2023
2023
|
children: (field.layout || {}).columns || 'auto'
|
|
2024
2024
|
});
|
|
@@ -3077,10 +3077,10 @@ function updateRow(formField, rowId) {
|
|
|
3077
3077
|
}
|
|
3078
3078
|
|
|
3079
3079
|
class AddFormFieldHandler {
|
|
3080
|
-
/**
|
|
3081
|
-
* @constructor
|
|
3082
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3083
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3080
|
+
/**
|
|
3081
|
+
* @constructor
|
|
3082
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3083
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3084
3084
|
*/
|
|
3085
3085
|
constructor(formEditor, formFieldRegistry) {
|
|
3086
3086
|
this._formEditor = formEditor;
|
|
@@ -3141,10 +3141,10 @@ class AddFormFieldHandler {
|
|
|
3141
3141
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3142
3142
|
|
|
3143
3143
|
class EditFormFieldHandler {
|
|
3144
|
-
/**
|
|
3145
|
-
* @constructor
|
|
3146
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3147
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3144
|
+
/**
|
|
3145
|
+
* @constructor
|
|
3146
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3147
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3148
3148
|
*/
|
|
3149
3149
|
constructor(formEditor, formFieldRegistry) {
|
|
3150
3150
|
this._formEditor = formEditor;
|
|
@@ -3207,10 +3207,10 @@ class EditFormFieldHandler {
|
|
|
3207
3207
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3208
3208
|
|
|
3209
3209
|
class MoveFormFieldHandler {
|
|
3210
|
-
/**
|
|
3211
|
-
* @constructor
|
|
3212
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3213
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3210
|
+
/**
|
|
3211
|
+
* @constructor
|
|
3212
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3213
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3214
3214
|
*/
|
|
3215
3215
|
constructor(formEditor, formFieldRegistry) {
|
|
3216
3216
|
this._formEditor = formEditor;
|
|
@@ -3299,10 +3299,10 @@ class MoveFormFieldHandler {
|
|
|
3299
3299
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3300
3300
|
|
|
3301
3301
|
class RemoveFormFieldHandler {
|
|
3302
|
-
/**
|
|
3303
|
-
* @constructor
|
|
3304
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
3305
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3302
|
+
/**
|
|
3303
|
+
* @constructor
|
|
3304
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
3305
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3306
3306
|
*/
|
|
3307
3307
|
constructor(formEditor, formFieldRegistry) {
|
|
3308
3308
|
this._formEditor = formEditor;
|
|
@@ -3362,9 +3362,9 @@ class RemoveFormFieldHandler {
|
|
|
3362
3362
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
3363
3363
|
|
|
3364
3364
|
class UpdateIdClaimHandler {
|
|
3365
|
-
/**
|
|
3366
|
-
* @constructor
|
|
3367
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3365
|
+
/**
|
|
3366
|
+
* @constructor
|
|
3367
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3368
3368
|
*/
|
|
3369
3369
|
constructor(formFieldRegistry) {
|
|
3370
3370
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3397,9 +3397,9 @@ class UpdateIdClaimHandler {
|
|
|
3397
3397
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
3398
3398
|
|
|
3399
3399
|
class UpdateKeyClaimHandler {
|
|
3400
|
-
/**
|
|
3401
|
-
* @constructor
|
|
3402
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3400
|
+
/**
|
|
3401
|
+
* @constructor
|
|
3402
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
3403
3403
|
*/
|
|
3404
3404
|
constructor(formFieldRegistry) {
|
|
3405
3405
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3865,8 +3865,8 @@ class ValidateBehavior extends CommandInterceptor {
|
|
|
3865
3865
|
constructor(eventBus) {
|
|
3866
3866
|
super(eventBus);
|
|
3867
3867
|
|
|
3868
|
-
/**
|
|
3869
|
-
* Remove custom validation if <validationType> is about to be added.
|
|
3868
|
+
/**
|
|
3869
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
3870
3870
|
*/
|
|
3871
3871
|
// @ts-ignore-next-line
|
|
3872
3872
|
this.preExecute('formField.edit', function (context) {
|
|
@@ -4446,22 +4446,22 @@ var SelectionModule = {
|
|
|
4446
4446
|
selectionBehavior: ['type', SelectionBehavior]
|
|
4447
4447
|
};
|
|
4448
4448
|
|
|
4449
|
-
/**
|
|
4450
|
-
* Base class for sectionable UI modules.
|
|
4451
|
-
*
|
|
4452
|
-
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4453
|
-
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4454
|
-
*
|
|
4455
|
-
* @class SectionModuleBase
|
|
4449
|
+
/**
|
|
4450
|
+
* Base class for sectionable UI modules.
|
|
4451
|
+
*
|
|
4452
|
+
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
4453
|
+
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
4454
|
+
*
|
|
4455
|
+
* @class SectionModuleBase
|
|
4456
4456
|
*/
|
|
4457
4457
|
class SectionModuleBase {
|
|
4458
|
-
/**
|
|
4459
|
-
* Create a SectionModuleBase instance.
|
|
4460
|
-
*
|
|
4461
|
-
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4462
|
-
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4463
|
-
*
|
|
4464
|
-
* @constructor
|
|
4458
|
+
/**
|
|
4459
|
+
* Create a SectionModuleBase instance.
|
|
4460
|
+
*
|
|
4461
|
+
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
4462
|
+
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
4463
|
+
*
|
|
4464
|
+
* @constructor
|
|
4465
4465
|
*/
|
|
4466
4466
|
constructor(eventBus, sectionKey) {
|
|
4467
4467
|
this._eventBus = eventBus;
|
|
@@ -4474,10 +4474,10 @@ class SectionModuleBase {
|
|
|
4474
4474
|
});
|
|
4475
4475
|
}
|
|
4476
4476
|
|
|
4477
|
-
/**
|
|
4478
|
-
* Attach the managed section to a parent node.
|
|
4479
|
-
*
|
|
4480
|
-
* @param {HTMLElement} container - The parent node to attach to.
|
|
4477
|
+
/**
|
|
4478
|
+
* Attach the managed section to a parent node.
|
|
4479
|
+
*
|
|
4480
|
+
* @param {HTMLElement} container - The parent node to attach to.
|
|
4481
4481
|
*/
|
|
4482
4482
|
attachTo(container) {
|
|
4483
4483
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
|
|
@@ -4485,22 +4485,22 @@ class SectionModuleBase {
|
|
|
4485
4485
|
}));
|
|
4486
4486
|
}
|
|
4487
4487
|
|
|
4488
|
-
/**
|
|
4489
|
-
* Detach the managed section from its parent node.
|
|
4488
|
+
/**
|
|
4489
|
+
* Detach the managed section from its parent node.
|
|
4490
4490
|
*/
|
|
4491
4491
|
detach() {
|
|
4492
4492
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
|
|
4493
4493
|
}
|
|
4494
4494
|
|
|
4495
|
-
/**
|
|
4496
|
-
* Reset the managed section to its initial state.
|
|
4495
|
+
/**
|
|
4496
|
+
* Reset the managed section to its initial state.
|
|
4497
4497
|
*/
|
|
4498
4498
|
reset() {
|
|
4499
4499
|
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
|
|
4500
4500
|
}
|
|
4501
4501
|
|
|
4502
|
-
/**
|
|
4503
|
-
* Circumvents timing issues.
|
|
4502
|
+
/**
|
|
4503
|
+
* Circumvents timing issues.
|
|
4504
4504
|
*/
|
|
4505
4505
|
_onceSectionRendered(callback) {
|
|
4506
4506
|
if (this.isSectionRendered) {
|
|
@@ -7088,11 +7088,11 @@ function prefixId(id) {
|
|
|
7088
7088
|
return `bio-properties-panel-${id}`;
|
|
7089
7089
|
}
|
|
7090
7090
|
|
|
7091
|
-
/**
|
|
7092
|
-
* @param {string} type
|
|
7093
|
-
* @param {boolean} [strict]
|
|
7094
|
-
*
|
|
7095
|
-
* @returns {any}
|
|
7091
|
+
/**
|
|
7092
|
+
* @param {string} type
|
|
7093
|
+
* @param {boolean} [strict]
|
|
7094
|
+
*
|
|
7095
|
+
* @returns {any}
|
|
7096
7096
|
*/
|
|
7097
7097
|
function getService(type, strict) {}
|
|
7098
7098
|
const PropertiesPanelContext = preact.createContext({
|
|
@@ -7181,8 +7181,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
7181
7181
|
}
|
|
7182
7182
|
};
|
|
7183
7183
|
|
|
7184
|
-
/**
|
|
7185
|
-
* Provide placeholders for empty and multiple state.
|
|
7184
|
+
/**
|
|
7185
|
+
* Provide placeholders for empty and multiple state.
|
|
7186
7186
|
*/
|
|
7187
7187
|
const PropertiesPanelPlaceholderProvider = {
|
|
7188
7188
|
getEmpty: () => {
|
|
@@ -7254,10 +7254,10 @@ function useService (type, strict) {
|
|
|
7254
7254
|
return getService(type, strict);
|
|
7255
7255
|
}
|
|
7256
7256
|
|
|
7257
|
-
/**
|
|
7258
|
-
* Retrieve list of variables from the form schema.
|
|
7259
|
-
*
|
|
7260
|
-
* @returns { string[] } list of variables used in form schema
|
|
7257
|
+
/**
|
|
7258
|
+
* Retrieve list of variables from the form schema.
|
|
7259
|
+
*
|
|
7260
|
+
* @returns { string[] } list of variables used in form schema
|
|
7261
7261
|
*/
|
|
7262
7262
|
function useVariables() {
|
|
7263
7263
|
const form = useService('formEditor');
|
|
@@ -8707,14 +8707,14 @@ function Value(props) {
|
|
|
8707
8707
|
|
|
8708
8708
|
// helpers //////////
|
|
8709
8709
|
|
|
8710
|
-
/**
|
|
8711
|
-
* Returns copy of object with updated value.
|
|
8712
|
-
*
|
|
8713
|
-
* @param {Object} properties
|
|
8714
|
-
* @param {string} key
|
|
8715
|
-
* @param {string} value
|
|
8716
|
-
*
|
|
8717
|
-
* @returns {Object}
|
|
8710
|
+
/**
|
|
8711
|
+
* Returns copy of object with updated value.
|
|
8712
|
+
*
|
|
8713
|
+
* @param {Object} properties
|
|
8714
|
+
* @param {string} key
|
|
8715
|
+
* @param {string} value
|
|
8716
|
+
*
|
|
8717
|
+
* @returns {Object}
|
|
8718
8718
|
*/
|
|
8719
8719
|
function updateValue(properties, key, value) {
|
|
8720
8720
|
return {
|
|
@@ -8723,14 +8723,14 @@ function updateValue(properties, key, value) {
|
|
|
8723
8723
|
};
|
|
8724
8724
|
}
|
|
8725
8725
|
|
|
8726
|
-
/**
|
|
8727
|
-
* Returns copy of object with updated key.
|
|
8728
|
-
*
|
|
8729
|
-
* @param {Object} properties
|
|
8730
|
-
* @param {string} oldKey
|
|
8731
|
-
* @param {string} newKey
|
|
8732
|
-
*
|
|
8733
|
-
* @returns {Object}
|
|
8726
|
+
/**
|
|
8727
|
+
* Returns copy of object with updated key.
|
|
8728
|
+
*
|
|
8729
|
+
* @param {Object} properties
|
|
8730
|
+
* @param {string} oldKey
|
|
8731
|
+
* @param {string} newKey
|
|
8732
|
+
*
|
|
8733
|
+
* @returns {Object}
|
|
8734
8734
|
*/
|
|
8735
8735
|
function updateKey(properties, oldKey, newKey) {
|
|
8736
8736
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -9424,8 +9424,8 @@ function ValuesGroups(field, editField) {
|
|
|
9424
9424
|
};
|
|
9425
9425
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
9426
9426
|
|
|
9427
|
-
/**
|
|
9428
|
-
* @type {Array<Group|ListGroup>}
|
|
9427
|
+
/**
|
|
9428
|
+
* @type {Array<Group|ListGroup>}
|
|
9429
9429
|
*/
|
|
9430
9430
|
const groups = [{
|
|
9431
9431
|
id: valuesSourceId,
|
|
@@ -9527,13 +9527,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
9527
9527
|
|
|
9528
9528
|
// helpers //////////
|
|
9529
9529
|
|
|
9530
|
-
/**
|
|
9531
|
-
* Returns copy of object without key.
|
|
9532
|
-
*
|
|
9533
|
-
* @param {Object} properties
|
|
9534
|
-
* @param {string} oldKey
|
|
9535
|
-
*
|
|
9536
|
-
* @returns {Object}
|
|
9530
|
+
/**
|
|
9531
|
+
* Returns copy of object without key.
|
|
9532
|
+
*
|
|
9533
|
+
* @param {Object} properties
|
|
9534
|
+
* @param {string} oldKey
|
|
9535
|
+
*
|
|
9536
|
+
* @returns {Object}
|
|
9537
9537
|
*/
|
|
9538
9538
|
function removeKey(properties, oldKey) {
|
|
9539
9539
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -9618,47 +9618,37 @@ function FormPropertiesPanel(props) {
|
|
|
9618
9618
|
} = props;
|
|
9619
9619
|
const formEditor = injector.get('formEditor');
|
|
9620
9620
|
const modeling = injector.get('modeling');
|
|
9621
|
-
const
|
|
9622
|
-
const {
|
|
9623
|
-
schema
|
|
9624
|
-
} = formEditor._getState();
|
|
9621
|
+
const selectionModule = injector.get('selection');
|
|
9625
9622
|
const [state, setState] = hooks.useState({
|
|
9626
|
-
selectedFormField:
|
|
9623
|
+
selectedFormField: selectionModule.get() || formEditor._getState().schema
|
|
9627
9624
|
});
|
|
9628
|
-
const
|
|
9625
|
+
const selectedFormField = state.selectedFormField;
|
|
9626
|
+
const refresh = hooks.useCallback(field => {
|
|
9627
|
+
// TODO(skaiir): rework state management, re-rendering the whole properties panel is not the way to go
|
|
9628
|
+
// https://github.com/bpmn-io/form-js/issues/686
|
|
9629
9629
|
setState({
|
|
9630
|
-
|
|
9631
|
-
selectedFormField: field
|
|
9630
|
+
selectedFormField: selectionModule.get() || formEditor._getState().schema
|
|
9632
9631
|
});
|
|
9633
9632
|
|
|
9634
9633
|
// notify interested parties on property panel updates
|
|
9635
9634
|
eventBus.fire('propertiesPanel.updated', {
|
|
9636
9635
|
formField: field
|
|
9637
9636
|
});
|
|
9638
|
-
};
|
|
9639
|
-
hooks.useLayoutEffect(() => {
|
|
9640
|
-
function onSelectionChange(event) {
|
|
9641
|
-
_update(event.selection || schema);
|
|
9642
|
-
}
|
|
9643
|
-
eventBus.on('selection.changed', onSelectionChange);
|
|
9644
|
-
return () => {
|
|
9645
|
-
eventBus.off('selection.changed', onSelectionChange);
|
|
9646
|
-
};
|
|
9647
|
-
}, []);
|
|
9637
|
+
}, [eventBus, formEditor, selectionModule]);
|
|
9648
9638
|
hooks.useLayoutEffect(() => {
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
eventBus.on('changed', onFieldChanged);
|
|
9639
|
+
/**
|
|
9640
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
9641
|
+
* once we have a proper updater/change support
|
|
9642
|
+
*/
|
|
9643
|
+
eventBus.on('changed', refresh);
|
|
9644
|
+
eventBus.on('import.done', refresh);
|
|
9645
|
+
eventBus.on('selection.changed', refresh);
|
|
9657
9646
|
return () => {
|
|
9658
|
-
eventBus.off('changed',
|
|
9647
|
+
eventBus.off('changed', refresh);
|
|
9648
|
+
eventBus.off('import.done', refresh);
|
|
9649
|
+
eventBus.off('selection.changed', refresh);
|
|
9659
9650
|
};
|
|
9660
|
-
}, []);
|
|
9661
|
-
const selectedFormField = state.selectedFormField;
|
|
9651
|
+
}, [eventBus, refresh]);
|
|
9662
9652
|
const getService = (type, strict = true) => injector.get(type, strict);
|
|
9663
9653
|
const propertiesPanelContext = {
|
|
9664
9654
|
getService
|
|
@@ -9700,10 +9690,10 @@ class PropertiesPanelRenderer {
|
|
|
9700
9690
|
});
|
|
9701
9691
|
}
|
|
9702
9692
|
|
|
9703
|
-
/**
|
|
9704
|
-
* Attach the properties panel to a parent node.
|
|
9705
|
-
*
|
|
9706
|
-
* @param {HTMLElement} container
|
|
9693
|
+
/**
|
|
9694
|
+
* Attach the properties panel to a parent node.
|
|
9695
|
+
*
|
|
9696
|
+
* @param {HTMLElement} container
|
|
9707
9697
|
*/
|
|
9708
9698
|
attachTo(container) {
|
|
9709
9699
|
if (!container) {
|
|
@@ -9723,8 +9713,8 @@ class PropertiesPanelRenderer {
|
|
|
9723
9713
|
this._eventBus.fire('propertiesPanel.attach');
|
|
9724
9714
|
}
|
|
9725
9715
|
|
|
9726
|
-
/**
|
|
9727
|
-
* Detach the properties panel from its parent node.
|
|
9716
|
+
/**
|
|
9717
|
+
* Detach the properties panel from its parent node.
|
|
9728
9718
|
*/
|
|
9729
9719
|
detach() {
|
|
9730
9720
|
const parentNode = this._container.parentNode;
|
|
@@ -9754,10 +9744,10 @@ var PropertiesPanelModule = {
|
|
|
9754
9744
|
propertiesPanel: ['type', PropertiesPanelRenderer]
|
|
9755
9745
|
};
|
|
9756
9746
|
|
|
9757
|
-
/**
|
|
9758
|
-
* Manages the rendering of visual plugins.
|
|
9759
|
-
* @constructor
|
|
9760
|
-
* @param {Object} eventBus - Event bus for the application.
|
|
9747
|
+
/**
|
|
9748
|
+
* Manages the rendering of visual plugins.
|
|
9749
|
+
* @constructor
|
|
9750
|
+
* @param {Object} eventBus - Event bus for the application.
|
|
9761
9751
|
*/
|
|
9762
9752
|
class RenderInjector extends SectionModuleBase {
|
|
9763
9753
|
constructor(eventBus) {
|
|
@@ -9766,10 +9756,10 @@ class RenderInjector extends SectionModuleBase {
|
|
|
9766
9756
|
this.registeredRenderers = [];
|
|
9767
9757
|
}
|
|
9768
9758
|
|
|
9769
|
-
/**
|
|
9770
|
-
* Inject a new renderer into the injector.
|
|
9771
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
9772
|
-
* @param {Function} Renderer - The renderer function.
|
|
9759
|
+
/**
|
|
9760
|
+
* Inject a new renderer into the injector.
|
|
9761
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
9762
|
+
* @param {Function} Renderer - The renderer function.
|
|
9773
9763
|
*/
|
|
9774
9764
|
attachRenderer(identifier, Renderer) {
|
|
9775
9765
|
this.registeredRenderers = [...this.registeredRenderers, {
|
|
@@ -9778,17 +9768,17 @@ class RenderInjector extends SectionModuleBase {
|
|
|
9778
9768
|
}];
|
|
9779
9769
|
}
|
|
9780
9770
|
|
|
9781
|
-
/**
|
|
9782
|
-
* Detach a renderer from the by key injector.
|
|
9783
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
9771
|
+
/**
|
|
9772
|
+
* Detach a renderer from the by key injector.
|
|
9773
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
9784
9774
|
*/
|
|
9785
9775
|
detachRenderer(identifier) {
|
|
9786
9776
|
this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
|
|
9787
9777
|
}
|
|
9788
9778
|
|
|
9789
|
-
/**
|
|
9790
|
-
* Returns the registered renderers.
|
|
9791
|
-
* @returns {Array} Array of registered renderers.
|
|
9779
|
+
/**
|
|
9780
|
+
* Returns the registered renderers.
|
|
9781
|
+
* @returns {Array} Array of registered renderers.
|
|
9792
9782
|
*/
|
|
9793
9783
|
fetchRenderers() {
|
|
9794
9784
|
return this.registeredRenderers;
|
|
@@ -9822,48 +9812,48 @@ var ExpressionLanguageModule = {
|
|
|
9822
9812
|
|
|
9823
9813
|
const ids = new Ids([32, 36, 1]);
|
|
9824
9814
|
|
|
9825
|
-
/**
|
|
9826
|
-
* @typedef { import('./types').Injector } Injector
|
|
9827
|
-
* @typedef { import('./types').Module } Module
|
|
9828
|
-
* @typedef { import('./types').Schema } Schema
|
|
9829
|
-
*
|
|
9830
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
9831
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
9832
|
-
*
|
|
9833
|
-
* @typedef { {
|
|
9834
|
-
* properties: FormEditorProperties,
|
|
9835
|
-
* schema: Schema
|
|
9836
|
-
* } } State
|
|
9837
|
-
*
|
|
9838
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
9839
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
9840
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
9815
|
+
/**
|
|
9816
|
+
* @typedef { import('./types').Injector } Injector
|
|
9817
|
+
* @typedef { import('./types').Module } Module
|
|
9818
|
+
* @typedef { import('./types').Schema } Schema
|
|
9819
|
+
*
|
|
9820
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
9821
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
9822
|
+
*
|
|
9823
|
+
* @typedef { {
|
|
9824
|
+
* properties: FormEditorProperties,
|
|
9825
|
+
* schema: Schema
|
|
9826
|
+
* } } State
|
|
9827
|
+
*
|
|
9828
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
9829
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
9830
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
9841
9831
|
*/
|
|
9842
9832
|
|
|
9843
|
-
/**
|
|
9844
|
-
* The form editor.
|
|
9833
|
+
/**
|
|
9834
|
+
* The form editor.
|
|
9845
9835
|
*/
|
|
9846
9836
|
class FormEditor {
|
|
9847
|
-
/**
|
|
9848
|
-
* @constructor
|
|
9849
|
-
* @param {FormEditorOptions} options
|
|
9837
|
+
/**
|
|
9838
|
+
* @constructor
|
|
9839
|
+
* @param {FormEditorOptions} options
|
|
9850
9840
|
*/
|
|
9851
9841
|
constructor(options = {}) {
|
|
9852
|
-
/**
|
|
9853
|
-
* @public
|
|
9854
|
-
* @type {OnEventType}
|
|
9842
|
+
/**
|
|
9843
|
+
* @public
|
|
9844
|
+
* @type {OnEventType}
|
|
9855
9845
|
*/
|
|
9856
9846
|
this.on = this._onEvent;
|
|
9857
9847
|
|
|
9858
|
-
/**
|
|
9859
|
-
* @public
|
|
9860
|
-
* @type {String}
|
|
9848
|
+
/**
|
|
9849
|
+
* @public
|
|
9850
|
+
* @type {String}
|
|
9861
9851
|
*/
|
|
9862
9852
|
this._id = ids.next();
|
|
9863
9853
|
|
|
9864
|
-
/**
|
|
9865
|
-
* @private
|
|
9866
|
-
* @type {Element}
|
|
9854
|
+
/**
|
|
9855
|
+
* @private
|
|
9856
|
+
* @type {Element}
|
|
9867
9857
|
*/
|
|
9868
9858
|
this._container = formJsViewer.createFormContainer();
|
|
9869
9859
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -9874,15 +9864,15 @@ class FormEditor {
|
|
|
9874
9864
|
properties = {}
|
|
9875
9865
|
} = options;
|
|
9876
9866
|
|
|
9877
|
-
/**
|
|
9878
|
-
* @private
|
|
9879
|
-
* @type {any}
|
|
9867
|
+
/**
|
|
9868
|
+
* @private
|
|
9869
|
+
* @type {any}
|
|
9880
9870
|
*/
|
|
9881
9871
|
this.exporter = exporter;
|
|
9882
9872
|
|
|
9883
|
-
/**
|
|
9884
|
-
* @private
|
|
9885
|
-
* @type {State}
|
|
9873
|
+
/**
|
|
9874
|
+
* @private
|
|
9875
|
+
* @type {State}
|
|
9886
9876
|
*/
|
|
9887
9877
|
this._state = {
|
|
9888
9878
|
properties,
|
|
@@ -9911,10 +9901,10 @@ class FormEditor {
|
|
|
9911
9901
|
this._detach(false);
|
|
9912
9902
|
}
|
|
9913
9903
|
|
|
9914
|
-
/**
|
|
9915
|
-
* @param {Schema} schema
|
|
9916
|
-
*
|
|
9917
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
9904
|
+
/**
|
|
9905
|
+
* @param {Schema} schema
|
|
9906
|
+
*
|
|
9907
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
9918
9908
|
*/
|
|
9919
9909
|
importSchema(schema) {
|
|
9920
9910
|
return new Promise((resolve, reject) => {
|
|
@@ -9943,15 +9933,15 @@ class FormEditor {
|
|
|
9943
9933
|
});
|
|
9944
9934
|
}
|
|
9945
9935
|
|
|
9946
|
-
/**
|
|
9947
|
-
* @returns {Schema}
|
|
9936
|
+
/**
|
|
9937
|
+
* @returns {Schema}
|
|
9948
9938
|
*/
|
|
9949
9939
|
saveSchema() {
|
|
9950
9940
|
return this.getSchema();
|
|
9951
9941
|
}
|
|
9952
9942
|
|
|
9953
|
-
/**
|
|
9954
|
-
* @returns {Schema}
|
|
9943
|
+
/**
|
|
9944
|
+
* @returns {Schema}
|
|
9955
9945
|
*/
|
|
9956
9946
|
getSchema() {
|
|
9957
9947
|
const {
|
|
@@ -9960,8 +9950,8 @@ class FormEditor {
|
|
|
9960
9950
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
9961
9951
|
}
|
|
9962
9952
|
|
|
9963
|
-
/**
|
|
9964
|
-
* @param {Element|string} parentNode
|
|
9953
|
+
/**
|
|
9954
|
+
* @param {Element|string} parentNode
|
|
9965
9955
|
*/
|
|
9966
9956
|
attachTo(parentNode) {
|
|
9967
9957
|
if (!parentNode) {
|
|
@@ -9979,10 +9969,10 @@ class FormEditor {
|
|
|
9979
9969
|
this._detach();
|
|
9980
9970
|
}
|
|
9981
9971
|
|
|
9982
|
-
/**
|
|
9983
|
-
* @internal
|
|
9984
|
-
*
|
|
9985
|
-
* @param {boolean} [emit]
|
|
9972
|
+
/**
|
|
9973
|
+
* @internal
|
|
9974
|
+
*
|
|
9975
|
+
* @param {boolean} [emit]
|
|
9986
9976
|
*/
|
|
9987
9977
|
_detach(emit = true) {
|
|
9988
9978
|
const container = this._container,
|
|
@@ -9996,9 +9986,9 @@ class FormEditor {
|
|
|
9996
9986
|
parentNode.removeChild(container);
|
|
9997
9987
|
}
|
|
9998
9988
|
|
|
9999
|
-
/**
|
|
10000
|
-
* @param {any} property
|
|
10001
|
-
* @param {any} value
|
|
9989
|
+
/**
|
|
9990
|
+
* @param {any} property
|
|
9991
|
+
* @param {any} value
|
|
10002
9992
|
*/
|
|
10003
9993
|
setProperty(property, value) {
|
|
10004
9994
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -10007,21 +9997,21 @@ class FormEditor {
|
|
|
10007
9997
|
});
|
|
10008
9998
|
}
|
|
10009
9999
|
|
|
10010
|
-
/**
|
|
10011
|
-
* @param {string} type
|
|
10012
|
-
* @param {Function} handler
|
|
10000
|
+
/**
|
|
10001
|
+
* @param {string} type
|
|
10002
|
+
* @param {Function} handler
|
|
10013
10003
|
*/
|
|
10014
10004
|
off(type, handler) {
|
|
10015
10005
|
this.get('eventBus').off(type, handler);
|
|
10016
10006
|
}
|
|
10017
10007
|
|
|
10018
|
-
/**
|
|
10019
|
-
* @internal
|
|
10020
|
-
*
|
|
10021
|
-
* @param {FormEditorOptions} options
|
|
10022
|
-
* @param {Element} container
|
|
10023
|
-
*
|
|
10024
|
-
* @returns {Injector}
|
|
10008
|
+
/**
|
|
10009
|
+
* @internal
|
|
10010
|
+
*
|
|
10011
|
+
* @param {FormEditorOptions} options
|
|
10012
|
+
* @param {Element} container
|
|
10013
|
+
*
|
|
10014
|
+
* @returns {Injector}
|
|
10025
10015
|
*/
|
|
10026
10016
|
_createInjector(options, container) {
|
|
10027
10017
|
const {
|
|
@@ -10043,22 +10033,22 @@ class FormEditor {
|
|
|
10043
10033
|
}, core, ...modules, ...additionalModules]);
|
|
10044
10034
|
}
|
|
10045
10035
|
|
|
10046
|
-
/**
|
|
10047
|
-
* @internal
|
|
10036
|
+
/**
|
|
10037
|
+
* @internal
|
|
10048
10038
|
*/
|
|
10049
10039
|
_emit(type, data) {
|
|
10050
10040
|
this.get('eventBus').fire(type, data);
|
|
10051
10041
|
}
|
|
10052
10042
|
|
|
10053
|
-
/**
|
|
10054
|
-
* @internal
|
|
10043
|
+
/**
|
|
10044
|
+
* @internal
|
|
10055
10045
|
*/
|
|
10056
10046
|
_getState() {
|
|
10057
10047
|
return this._state;
|
|
10058
10048
|
}
|
|
10059
10049
|
|
|
10060
|
-
/**
|
|
10061
|
-
* @internal
|
|
10050
|
+
/**
|
|
10051
|
+
* @internal
|
|
10062
10052
|
*/
|
|
10063
10053
|
_setState(state) {
|
|
10064
10054
|
this._state = {
|
|
@@ -10068,15 +10058,15 @@ class FormEditor {
|
|
|
10068
10058
|
this._emit('changed', this._getState());
|
|
10069
10059
|
}
|
|
10070
10060
|
|
|
10071
|
-
/**
|
|
10072
|
-
* @internal
|
|
10061
|
+
/**
|
|
10062
|
+
* @internal
|
|
10073
10063
|
*/
|
|
10074
10064
|
_getModules() {
|
|
10075
10065
|
return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
|
|
10076
10066
|
}
|
|
10077
10067
|
|
|
10078
|
-
/**
|
|
10079
|
-
* @internal
|
|
10068
|
+
/**
|
|
10069
|
+
* @internal
|
|
10080
10070
|
*/
|
|
10081
10071
|
_onEvent(type, priority, handler) {
|
|
10082
10072
|
this.get('eventBus').on(type, priority, handler);
|