@bpmn-io/form-js-editor 1.0.0-alpha.1 → 1.0.0-alpha.3
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 -723
- package/dist/assets/form-js-editor.css +11 -0
- package/dist/index.cjs +314 -295
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +314 -295
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/SectionModuleBase.d.ts +6 -1
- package/dist/types/features/assistant/AssistantPrompter.d.ts +20 -0
- package/dist/types/features/assistant/AssistantPrompterLayout.d.ts +20 -0
- package/dist/types/features/assistant/AssistantPrompterLayoutV2.d.ts +20 -0
- package/dist/types/features/assistant/AssistantRenderer.d.ts +34 -0
- package/dist/types/features/assistant/components/Assistant.d.ts +10 -0
- package/dist/types/features/assistant/data/minischema.d.ts +1 -0
- package/dist/types/features/assistant/index.d.ts +7 -0
- package/dist/types/features/assistant/model/AssistantPrompterLayoutV2/AssistantPrompterLayoutV2.d.ts +20 -0
- package/dist/types/features/assistant/model/AssistantPrompterLayoutV2/Prompts.d.ts +4 -0
- package/dist/types/features/assistant/util/CleanupUtil.d.ts +1 -0
- package/dist/types/features/form-generation-ui/FormGenerationUIModule.d.ts +3 -0
- package/dist/types/features/form-generation-ui/components/FormGeneration.d.ts +2 -0
- package/dist/types/features/form-generation-ui/components/GPTModal.d.ts +2 -0
- package/dist/types/features/form-generation-ui/dist/index.d.cts +63 -0
- package/dist/types/features/form-generation-ui/dist/index.es.d.ts +60 -0
- package/dist/types/features/form-generation-ui/index.d.ts +2 -0
- package/dist/types/features/form-generation-ui/inject.d.ts +7 -0
- package/dist/types/features/palette/PaletteRenderer.d.ts +33 -0
- package/dist/types/features/properties-panel/PropertiesPanelRenderer.d.ts +37 -0
- package/dist/types/features/properties-panel/context/FormPropertiesPanelContext.d.ts +11 -0
- package/dist/types/features/properties-panel/context/index.d.ts +1 -0
- package/dist/types/features/properties-panel/entries/ExpressionValidationEntry.d.ts +44 -0
- package/dist/types/features/properties-panel/groups/ExpressionValidationsGroup.d.ts +53 -0
- package/dist/types/features/properties-panel/hooks/usePropertiesPanelService.d.ts +1 -0
- package/dist/types/features/properties-panel/icons/index.d.ts +1 -0
- package/dist/types/features/render-injection/TestInjection.d.ts +7 -0
- package/dist/types/features/render-injection/components/TestInjectionComponent.d.ts +2 -0
- package/dist/types/features/render-injection/slot-fill/Slot.d.ts +1 -0
- package/dist/types/features/util/renderManagerBuilder.d.ts +45 -0
- 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(type, strict) {}
|
|
925
925
|
const FormEditorContext = preact.createContext({
|
|
@@ -1118,10 +1118,12 @@ var ModularSection = (props => {
|
|
|
1118
1118
|
eventBus.on(`${section}.attach`, onAttach);
|
|
1119
1119
|
eventBus.on(`${section}.detach`, onDetach);
|
|
1120
1120
|
eventBus.on(`${section}.reset`, onReset);
|
|
1121
|
+
eventBus.fire(`${section}.section.rendered`);
|
|
1121
1122
|
return () => {
|
|
1122
1123
|
eventBus.off(`${section}.attach`, onAttach);
|
|
1123
1124
|
eventBus.off(`${section}.detach`, onDetach);
|
|
1124
1125
|
eventBus.off(`${section}.reset`, onReset);
|
|
1126
|
+
eventBus.fire(`${section}.section.destroyed`);
|
|
1125
1127
|
};
|
|
1126
1128
|
}, [eventBus, section]);
|
|
1127
1129
|
hooks.useEffect(() => {
|
|
@@ -1187,6 +1189,7 @@ var SlotContext$1 = SlotContext;
|
|
|
1187
1189
|
var Slot = (props => {
|
|
1188
1190
|
const {
|
|
1189
1191
|
name,
|
|
1192
|
+
fillRoot = FillFragment,
|
|
1190
1193
|
groupFn = _groupByGroupName,
|
|
1191
1194
|
separatorFn = key => null,
|
|
1192
1195
|
limit
|
|
@@ -1198,28 +1201,28 @@ var Slot = (props => {
|
|
|
1198
1201
|
const cropped = hooks.useMemo(() => limit ? filtered.slice(0, limit) : filtered, [filtered, limit]);
|
|
1199
1202
|
const groups = hooks.useMemo(() => groupFn(cropped), [cropped, groupFn]);
|
|
1200
1203
|
const fillsAndSeparators = hooks.useMemo(() => {
|
|
1201
|
-
return buildFills(groups,
|
|
1202
|
-
}, [groups, separatorFn]);
|
|
1204
|
+
return buildFills(groups, fillRoot, separatorFn);
|
|
1205
|
+
}, [groups, fillRoot, separatorFn]);
|
|
1203
1206
|
return fillsAndSeparators;
|
|
1204
1207
|
});
|
|
1205
1208
|
|
|
1206
|
-
/**
|
|
1207
|
-
* Creates a Fragment for a fill.
|
|
1208
|
-
*
|
|
1209
|
-
* @param {Object} fill Fill to be rendered
|
|
1210
|
-
* @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
|
|
1211
1214
|
*/
|
|
1212
1215
|
const FillFragment = fill => jsxRuntime.jsx(preact.Fragment, {
|
|
1213
1216
|
children: fill.children
|
|
1214
1217
|
}, fill.id);
|
|
1215
1218
|
|
|
1216
|
-
/**
|
|
1217
|
-
* Creates an array of fills, with separators inserted between groups.
|
|
1218
|
-
*
|
|
1219
|
-
* @param {Array} groups Groups of fills
|
|
1220
|
-
* @param {Function} fillRenderer Function to create a fill
|
|
1221
|
-
* @param {Function} separatorRenderer Function to create a separator
|
|
1222
|
-
* @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
|
|
1223
1226
|
*/
|
|
1224
1227
|
const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
1225
1228
|
const result = [];
|
|
@@ -1237,8 +1240,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
|
|
|
1237
1240
|
return result;
|
|
1238
1241
|
};
|
|
1239
1242
|
|
|
1240
|
-
/**
|
|
1241
|
-
* Groups fills by group name property.
|
|
1243
|
+
/**
|
|
1244
|
+
* Groups fills by group name property.
|
|
1242
1245
|
*/
|
|
1243
1246
|
const _groupByGroupName = fills => {
|
|
1244
1247
|
const groups = [];
|
|
@@ -1258,8 +1261,8 @@ const _groupByGroupName = fills => {
|
|
|
1258
1261
|
return Object.keys(groupsById).sort().map(id => groupsById[id]);
|
|
1259
1262
|
};
|
|
1260
1263
|
|
|
1261
|
-
/**
|
|
1262
|
-
* Compares fills by priority.
|
|
1264
|
+
/**
|
|
1265
|
+
* Compares fills by priority.
|
|
1263
1266
|
*/
|
|
1264
1267
|
const _comparePriority = (a, b) => {
|
|
1265
1268
|
return (b.priority || 0) - (a.priority || 0);
|
|
@@ -1410,11 +1413,16 @@ function Palette(props) {
|
|
|
1410
1413
|
}), jsxRuntime.jsx("div", {
|
|
1411
1414
|
class: "fjs-palette-footer",
|
|
1412
1415
|
children: jsxRuntime.jsx(Slot, {
|
|
1413
|
-
name: "editor-palette__footer"
|
|
1416
|
+
name: "editor-palette__footer",
|
|
1417
|
+
fillRoot: FillRoot
|
|
1414
1418
|
})
|
|
1415
1419
|
})]
|
|
1416
1420
|
});
|
|
1417
1421
|
}
|
|
1422
|
+
const FillRoot = fill => jsxRuntime.jsx("div", {
|
|
1423
|
+
className: "fjs-palette-footer-fill",
|
|
1424
|
+
children: fill.children
|
|
1425
|
+
});
|
|
1418
1426
|
|
|
1419
1427
|
// helpers ///////
|
|
1420
1428
|
|
|
@@ -4007,10 +4015,10 @@ function prefixId(id) {
|
|
|
4007
4015
|
return `bio-properties-panel-${id}`;
|
|
4008
4016
|
}
|
|
4009
4017
|
|
|
4010
|
-
/**
|
|
4011
|
-
* Retrieve list of variables from the form schema.
|
|
4012
|
-
*
|
|
4013
|
-
* @returns { string[] } list of variables used in form schema
|
|
4018
|
+
/**
|
|
4019
|
+
* Retrieve list of variables from the form schema.
|
|
4020
|
+
*
|
|
4021
|
+
* @returns { string[] } list of variables used in form schema
|
|
4014
4022
|
*/
|
|
4015
4023
|
function useVariables() {
|
|
4016
4024
|
const form = useService('formEditor');
|
|
@@ -4099,8 +4107,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
4099
4107
|
}
|
|
4100
4108
|
};
|
|
4101
4109
|
|
|
4102
|
-
/**
|
|
4103
|
-
* Provide placeholders for empty and multiple state.
|
|
4110
|
+
/**
|
|
4111
|
+
* Provide placeholders for empty and multiple state.
|
|
4104
4112
|
*/
|
|
4105
4113
|
const PropertiesPanelPlaceholderProvider = {
|
|
4106
4114
|
getEmpty: () => {
|
|
@@ -5607,14 +5615,14 @@ function Value(props) {
|
|
|
5607
5615
|
|
|
5608
5616
|
// helpers //////////
|
|
5609
5617
|
|
|
5610
|
-
/**
|
|
5611
|
-
* Returns copy of object with updated value.
|
|
5612
|
-
*
|
|
5613
|
-
* @param {Object} properties
|
|
5614
|
-
* @param {string} key
|
|
5615
|
-
* @param {string} value
|
|
5616
|
-
*
|
|
5617
|
-
* @returns {Object}
|
|
5618
|
+
/**
|
|
5619
|
+
* Returns copy of object with updated value.
|
|
5620
|
+
*
|
|
5621
|
+
* @param {Object} properties
|
|
5622
|
+
* @param {string} key
|
|
5623
|
+
* @param {string} value
|
|
5624
|
+
*
|
|
5625
|
+
* @returns {Object}
|
|
5618
5626
|
*/
|
|
5619
5627
|
function updateValue(properties, key, value) {
|
|
5620
5628
|
return {
|
|
@@ -5623,14 +5631,14 @@ function updateValue(properties, key, value) {
|
|
|
5623
5631
|
};
|
|
5624
5632
|
}
|
|
5625
5633
|
|
|
5626
|
-
/**
|
|
5627
|
-
* Returns copy of object with updated key.
|
|
5628
|
-
*
|
|
5629
|
-
* @param {Object} properties
|
|
5630
|
-
* @param {string} oldKey
|
|
5631
|
-
* @param {string} newKey
|
|
5632
|
-
*
|
|
5633
|
-
* @returns {Object}
|
|
5634
|
+
/**
|
|
5635
|
+
* Returns copy of object with updated key.
|
|
5636
|
+
*
|
|
5637
|
+
* @param {Object} properties
|
|
5638
|
+
* @param {string} oldKey
|
|
5639
|
+
* @param {string} newKey
|
|
5640
|
+
*
|
|
5641
|
+
* @returns {Object}
|
|
5634
5642
|
*/
|
|
5635
5643
|
function updateKey(properties, oldKey, newKey) {
|
|
5636
5644
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6324,8 +6332,8 @@ function ValuesGroups(field, editField) {
|
|
|
6324
6332
|
};
|
|
6325
6333
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
6326
6334
|
|
|
6327
|
-
/**
|
|
6328
|
-
* @type {Array<Group|ListGroup>}
|
|
6335
|
+
/**
|
|
6336
|
+
* @type {Array<Group|ListGroup>}
|
|
6329
6337
|
*/
|
|
6330
6338
|
const groups = [{
|
|
6331
6339
|
id: valuesSourceId,
|
|
@@ -6427,13 +6435,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
6427
6435
|
|
|
6428
6436
|
// helpers //////////
|
|
6429
6437
|
|
|
6430
|
-
/**
|
|
6431
|
-
* Returns copy of object without key.
|
|
6432
|
-
*
|
|
6433
|
-
* @param {Object} properties
|
|
6434
|
-
* @param {string} oldKey
|
|
6435
|
-
*
|
|
6436
|
-
* @returns {Object}
|
|
6438
|
+
/**
|
|
6439
|
+
* Returns copy of object without key.
|
|
6440
|
+
*
|
|
6441
|
+
* @param {Object} properties
|
|
6442
|
+
* @param {string} oldKey
|
|
6443
|
+
*
|
|
6444
|
+
* @returns {Object}
|
|
6437
6445
|
*/
|
|
6438
6446
|
function removeKey(properties, oldKey) {
|
|
6439
6447
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6545,9 +6553,9 @@ function FormPropertiesPanel() {
|
|
|
6545
6553
|
}, []);
|
|
6546
6554
|
hooks.useLayoutEffect(() => {
|
|
6547
6555
|
const onFieldChanged = () => {
|
|
6548
|
-
/**
|
|
6549
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
6550
|
-
* once we have a proper updater/change support
|
|
6556
|
+
/**
|
|
6557
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
6558
|
+
* once we have a proper updater/change support
|
|
6551
6559
|
*/
|
|
6552
6560
|
_update(selection.get() || schema);
|
|
6553
6561
|
};
|
|
@@ -6618,19 +6626,19 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
|
|
|
6618
6626
|
const DRAG_NO_MOVE_CLS = 'fjs-no-move';
|
|
6619
6627
|
const ERROR_DROP_CLS = 'fjs-error-drop';
|
|
6620
6628
|
|
|
6621
|
-
/**
|
|
6622
|
-
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
6629
|
+
/**
|
|
6630
|
+
* @typedef { { id: String, components: Array<any> } } FormRow
|
|
6623
6631
|
*/
|
|
6624
6632
|
|
|
6625
6633
|
class Dragging {
|
|
6626
|
-
/**
|
|
6627
|
-
* @constructor
|
|
6628
|
-
*
|
|
6629
|
-
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
6630
|
-
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
6631
|
-
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
6632
|
-
* @param { import('../../core/EventBus').default } eventBus
|
|
6633
|
-
* @param { import('../modeling/Modeling').default } modeling
|
|
6634
|
+
/**
|
|
6635
|
+
* @constructor
|
|
6636
|
+
*
|
|
6637
|
+
* @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
|
|
6638
|
+
* @param { import('../../core/FormLayouter').default } formLayouter
|
|
6639
|
+
* @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
|
|
6640
|
+
* @param { import('../../core/EventBus').default } eventBus
|
|
6641
|
+
* @param { import('../modeling/Modeling').default } modeling
|
|
6634
6642
|
*/
|
|
6635
6643
|
constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling) {
|
|
6636
6644
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -6640,13 +6648,13 @@ class Dragging {
|
|
|
6640
6648
|
this._modeling = modeling;
|
|
6641
6649
|
}
|
|
6642
6650
|
|
|
6643
|
-
/**
|
|
6644
|
-
* Calculcates position in form schema given the dropped place.
|
|
6645
|
-
*
|
|
6646
|
-
* @param { FormRow } targetRow
|
|
6647
|
-
* @param { any } targetFormField
|
|
6648
|
-
* @param { HTMLElement } sibling
|
|
6649
|
-
* @returns { number }
|
|
6651
|
+
/**
|
|
6652
|
+
* Calculcates position in form schema given the dropped place.
|
|
6653
|
+
*
|
|
6654
|
+
* @param { FormRow } targetRow
|
|
6655
|
+
* @param { any } targetFormField
|
|
6656
|
+
* @param { HTMLElement } sibling
|
|
6657
|
+
* @returns { number }
|
|
6650
6658
|
*/
|
|
6651
6659
|
getTargetIndex(targetRow, targetFormField, sibling) {
|
|
6652
6660
|
/** @type HTMLElement */
|
|
@@ -6748,8 +6756,8 @@ class Dragging {
|
|
|
6748
6756
|
}
|
|
6749
6757
|
}
|
|
6750
6758
|
|
|
6751
|
-
/**
|
|
6752
|
-
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
6759
|
+
/**
|
|
6760
|
+
* @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
|
|
6753
6761
|
*/
|
|
6754
6762
|
createDragulaInstance(options) {
|
|
6755
6763
|
const {
|
|
@@ -7146,7 +7154,7 @@ function DebugColumns(props) {
|
|
|
7146
7154
|
return null;
|
|
7147
7155
|
}
|
|
7148
7156
|
return jsxRuntime.jsx("div", {
|
|
7149
|
-
style: "width: fit-content
|
|
7157
|
+
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;",
|
|
7150
7158
|
class: "fjs-debug-columns",
|
|
7151
7159
|
children: (field.layout || {}).columns || 'auto'
|
|
7152
7160
|
});
|
|
@@ -8192,10 +8200,10 @@ function updateRow(formField, rowId) {
|
|
|
8192
8200
|
}
|
|
8193
8201
|
|
|
8194
8202
|
class AddFormFieldHandler {
|
|
8195
|
-
/**
|
|
8196
|
-
* @constructor
|
|
8197
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
8198
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8203
|
+
/**
|
|
8204
|
+
* @constructor
|
|
8205
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
8206
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8199
8207
|
*/
|
|
8200
8208
|
constructor(formEditor, formFieldRegistry) {
|
|
8201
8209
|
this._formEditor = formEditor;
|
|
@@ -8256,10 +8264,10 @@ class AddFormFieldHandler {
|
|
|
8256
8264
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
8257
8265
|
|
|
8258
8266
|
class EditFormFieldHandler {
|
|
8259
|
-
/**
|
|
8260
|
-
* @constructor
|
|
8261
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
8262
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8267
|
+
/**
|
|
8268
|
+
* @constructor
|
|
8269
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
8270
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8263
8271
|
*/
|
|
8264
8272
|
constructor(formEditor, formFieldRegistry) {
|
|
8265
8273
|
this._formEditor = formEditor;
|
|
@@ -8322,10 +8330,10 @@ class EditFormFieldHandler {
|
|
|
8322
8330
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
8323
8331
|
|
|
8324
8332
|
class MoveFormFieldHandler {
|
|
8325
|
-
/**
|
|
8326
|
-
* @constructor
|
|
8327
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
8328
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8333
|
+
/**
|
|
8334
|
+
* @constructor
|
|
8335
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
8336
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8329
8337
|
*/
|
|
8330
8338
|
constructor(formEditor, formFieldRegistry) {
|
|
8331
8339
|
this._formEditor = formEditor;
|
|
@@ -8414,10 +8422,10 @@ class MoveFormFieldHandler {
|
|
|
8414
8422
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
8415
8423
|
|
|
8416
8424
|
class RemoveFormFieldHandler {
|
|
8417
|
-
/**
|
|
8418
|
-
* @constructor
|
|
8419
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
8420
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8425
|
+
/**
|
|
8426
|
+
* @constructor
|
|
8427
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
8428
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8421
8429
|
*/
|
|
8422
8430
|
constructor(formEditor, formFieldRegistry) {
|
|
8423
8431
|
this._formEditor = formEditor;
|
|
@@ -8477,9 +8485,9 @@ class RemoveFormFieldHandler {
|
|
|
8477
8485
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
8478
8486
|
|
|
8479
8487
|
class UpdateIdClaimHandler {
|
|
8480
|
-
/**
|
|
8481
|
-
* @constructor
|
|
8482
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8488
|
+
/**
|
|
8489
|
+
* @constructor
|
|
8490
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8483
8491
|
*/
|
|
8484
8492
|
constructor(formFieldRegistry) {
|
|
8485
8493
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -8512,9 +8520,9 @@ class UpdateIdClaimHandler {
|
|
|
8512
8520
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
8513
8521
|
|
|
8514
8522
|
class UpdateKeyClaimHandler {
|
|
8515
|
-
/**
|
|
8516
|
-
* @constructor
|
|
8517
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8523
|
+
/**
|
|
8524
|
+
* @constructor
|
|
8525
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
8518
8526
|
*/
|
|
8519
8527
|
constructor(formFieldRegistry) {
|
|
8520
8528
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -8980,8 +8988,8 @@ class ValidateBehavior extends CommandInterceptor {
|
|
|
8980
8988
|
constructor(eventBus) {
|
|
8981
8989
|
super(eventBus);
|
|
8982
8990
|
|
|
8983
|
-
/**
|
|
8984
|
-
* Remove custom validation if <validationType> is about to be added.
|
|
8991
|
+
/**
|
|
8992
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
8985
8993
|
*/
|
|
8986
8994
|
// @ts-ignore-next-line
|
|
8987
8995
|
this.preExecute('formField.edit', function (context) {
|
|
@@ -9561,51 +9569,62 @@ var SelectionModule = {
|
|
|
9561
9569
|
selectionBehavior: ['type', SelectionBehavior]
|
|
9562
9570
|
};
|
|
9563
9571
|
|
|
9564
|
-
/**
|
|
9565
|
-
* Base class for sectionable UI modules.
|
|
9566
|
-
*
|
|
9567
|
-
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
9568
|
-
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
9569
|
-
*
|
|
9570
|
-
* @class SectionModuleBase
|
|
9572
|
+
/**
|
|
9573
|
+
* Base class for sectionable UI modules.
|
|
9574
|
+
*
|
|
9575
|
+
* @property {EventBus} _eventBus - EventBus instance used for event handling.
|
|
9576
|
+
* @property {string} managerType - Type of the render manager. Used to form event names.
|
|
9577
|
+
*
|
|
9578
|
+
* @class SectionModuleBase
|
|
9571
9579
|
*/
|
|
9572
9580
|
class SectionModuleBase {
|
|
9573
|
-
/**
|
|
9574
|
-
* Create a SectionModuleBase instance.
|
|
9575
|
-
*
|
|
9576
|
-
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
9577
|
-
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
9578
|
-
*
|
|
9579
|
-
* @constructor
|
|
9581
|
+
/**
|
|
9582
|
+
* Create a SectionModuleBase instance.
|
|
9583
|
+
*
|
|
9584
|
+
* @param {any} eventBus - The EventBus instance used for event handling.
|
|
9585
|
+
* @param {string} sectionKey - The type of render manager. Used to form event names.
|
|
9586
|
+
*
|
|
9587
|
+
* @constructor
|
|
9580
9588
|
*/
|
|
9581
9589
|
constructor(eventBus, sectionKey) {
|
|
9582
9590
|
this._eventBus = eventBus;
|
|
9583
|
-
this.
|
|
9591
|
+
this._sectionKey = sectionKey;
|
|
9592
|
+
this._eventBus.on(`${this._sectionKey}.section.rendered`, () => this.isSectionRendered = true);
|
|
9593
|
+
this._eventBus.on(`${this._sectionKey}.section.destroyed`, () => this.isSectionRendered = false);
|
|
9584
9594
|
}
|
|
9585
9595
|
|
|
9586
|
-
/**
|
|
9587
|
-
* Attach the managed section to a parent node.
|
|
9588
|
-
*
|
|
9589
|
-
* @param {HTMLElement} container - The parent node to attach to.
|
|
9596
|
+
/**
|
|
9597
|
+
* Attach the managed section to a parent node.
|
|
9598
|
+
*
|
|
9599
|
+
* @param {HTMLElement} container - The parent node to attach to.
|
|
9590
9600
|
*/
|
|
9591
9601
|
attachTo(container) {
|
|
9592
|
-
this._eventBus.fire(`${this.
|
|
9602
|
+
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
|
|
9593
9603
|
container
|
|
9594
|
-
});
|
|
9604
|
+
}));
|
|
9595
9605
|
}
|
|
9596
9606
|
|
|
9597
|
-
/**
|
|
9598
|
-
* Detach the managed section from its parent node.
|
|
9607
|
+
/**
|
|
9608
|
+
* Detach the managed section from its parent node.
|
|
9599
9609
|
*/
|
|
9600
9610
|
detach() {
|
|
9601
|
-
this._eventBus.fire(`${this.
|
|
9611
|
+
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
|
|
9602
9612
|
}
|
|
9603
9613
|
|
|
9604
|
-
/**
|
|
9605
|
-
* Reset the managed section to its initial state.
|
|
9614
|
+
/**
|
|
9615
|
+
* Reset the managed section to its initial state.
|
|
9606
9616
|
*/
|
|
9607
9617
|
reset() {
|
|
9608
|
-
this._eventBus.fire(`${this.
|
|
9618
|
+
this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9621
|
+
/**
|
|
9622
|
+
* Circumvents timing issues.
|
|
9623
|
+
*/
|
|
9624
|
+
_onceSectionRendered(callback) {
|
|
9625
|
+
this.isSectionRendered ? callback() : this._eventBus.once(`${this._sectionKey}.section.rendered`, () => {
|
|
9626
|
+
callback();
|
|
9627
|
+
});
|
|
9609
9628
|
}
|
|
9610
9629
|
}
|
|
9611
9630
|
|
|
@@ -9632,10 +9651,10 @@ var PropertiesPanelModule = {
|
|
|
9632
9651
|
propertiesPanel: ['type', PropertiesPanelModule$1]
|
|
9633
9652
|
};
|
|
9634
9653
|
|
|
9635
|
-
/**
|
|
9636
|
-
* Manages the rendering of visual plugins.
|
|
9637
|
-
* @constructor
|
|
9638
|
-
* @param {Object} eventBus - Event bus for the application.
|
|
9654
|
+
/**
|
|
9655
|
+
* Manages the rendering of visual plugins.
|
|
9656
|
+
* @constructor
|
|
9657
|
+
* @param {Object} eventBus - Event bus for the application.
|
|
9639
9658
|
*/
|
|
9640
9659
|
class RenderInjector extends SectionModuleBase {
|
|
9641
9660
|
constructor(eventBus) {
|
|
@@ -9644,10 +9663,10 @@ class RenderInjector extends SectionModuleBase {
|
|
|
9644
9663
|
this.registeredRenderers = [];
|
|
9645
9664
|
}
|
|
9646
9665
|
|
|
9647
|
-
/**
|
|
9648
|
-
* Inject a new renderer into the injector.
|
|
9649
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
9650
|
-
* @param {Function} Renderer - The renderer function.
|
|
9666
|
+
/**
|
|
9667
|
+
* Inject a new renderer into the injector.
|
|
9668
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
9669
|
+
* @param {Function} Renderer - The renderer function.
|
|
9651
9670
|
*/
|
|
9652
9671
|
attachRenderer(identifier, Renderer) {
|
|
9653
9672
|
this.registeredRenderers = [...this.registeredRenderers, {
|
|
@@ -9656,17 +9675,17 @@ class RenderInjector extends SectionModuleBase {
|
|
|
9656
9675
|
}];
|
|
9657
9676
|
}
|
|
9658
9677
|
|
|
9659
|
-
/**
|
|
9660
|
-
* Detach a renderer from the by key injector.
|
|
9661
|
-
* @param {string} identifier - Identifier for the renderer.
|
|
9678
|
+
/**
|
|
9679
|
+
* Detach a renderer from the by key injector.
|
|
9680
|
+
* @param {string} identifier - Identifier for the renderer.
|
|
9662
9681
|
*/
|
|
9663
9682
|
detachRenderer(identifier) {
|
|
9664
9683
|
this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
|
|
9665
9684
|
}
|
|
9666
9685
|
|
|
9667
|
-
/**
|
|
9668
|
-
* Returns the registered renderers.
|
|
9669
|
-
* @returns {Array} Array of registered renderers.
|
|
9686
|
+
/**
|
|
9687
|
+
* Returns the registered renderers.
|
|
9688
|
+
* @returns {Array} Array of registered renderers.
|
|
9670
9689
|
*/
|
|
9671
9690
|
fetchRenderers() {
|
|
9672
9691
|
return this.registeredRenderers;
|
|
@@ -9700,48 +9719,48 @@ var ExpressionLanguageModule = {
|
|
|
9700
9719
|
|
|
9701
9720
|
const ids = new Ids([32, 36, 1]);
|
|
9702
9721
|
|
|
9703
|
-
/**
|
|
9704
|
-
* @typedef { import('./types').Injector } Injector
|
|
9705
|
-
* @typedef { import('./types').Module } Module
|
|
9706
|
-
* @typedef { import('./types').Schema } Schema
|
|
9707
|
-
*
|
|
9708
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
9709
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
9710
|
-
*
|
|
9711
|
-
* @typedef { {
|
|
9712
|
-
* properties: FormEditorProperties,
|
|
9713
|
-
* schema: Schema
|
|
9714
|
-
* } } State
|
|
9715
|
-
*
|
|
9716
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
9717
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
9718
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
9722
|
+
/**
|
|
9723
|
+
* @typedef { import('./types').Injector } Injector
|
|
9724
|
+
* @typedef { import('./types').Module } Module
|
|
9725
|
+
* @typedef { import('./types').Schema } Schema
|
|
9726
|
+
*
|
|
9727
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
9728
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
9729
|
+
*
|
|
9730
|
+
* @typedef { {
|
|
9731
|
+
* properties: FormEditorProperties,
|
|
9732
|
+
* schema: Schema
|
|
9733
|
+
* } } State
|
|
9734
|
+
*
|
|
9735
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
9736
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
9737
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
9719
9738
|
*/
|
|
9720
9739
|
|
|
9721
|
-
/**
|
|
9722
|
-
* The form editor.
|
|
9740
|
+
/**
|
|
9741
|
+
* The form editor.
|
|
9723
9742
|
*/
|
|
9724
9743
|
class FormEditor {
|
|
9725
|
-
/**
|
|
9726
|
-
* @constructor
|
|
9727
|
-
* @param {FormEditorOptions} options
|
|
9744
|
+
/**
|
|
9745
|
+
* @constructor
|
|
9746
|
+
* @param {FormEditorOptions} options
|
|
9728
9747
|
*/
|
|
9729
9748
|
constructor(options = {}) {
|
|
9730
|
-
/**
|
|
9731
|
-
* @public
|
|
9732
|
-
* @type {OnEventType}
|
|
9749
|
+
/**
|
|
9750
|
+
* @public
|
|
9751
|
+
* @type {OnEventType}
|
|
9733
9752
|
*/
|
|
9734
9753
|
this.on = this._onEvent;
|
|
9735
9754
|
|
|
9736
|
-
/**
|
|
9737
|
-
* @public
|
|
9738
|
-
* @type {String}
|
|
9755
|
+
/**
|
|
9756
|
+
* @public
|
|
9757
|
+
* @type {String}
|
|
9739
9758
|
*/
|
|
9740
9759
|
this._id = ids.next();
|
|
9741
9760
|
|
|
9742
|
-
/**
|
|
9743
|
-
* @private
|
|
9744
|
-
* @type {Element}
|
|
9761
|
+
/**
|
|
9762
|
+
* @private
|
|
9763
|
+
* @type {Element}
|
|
9745
9764
|
*/
|
|
9746
9765
|
this._container = formJsViewer.createFormContainer();
|
|
9747
9766
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -9752,15 +9771,15 @@ class FormEditor {
|
|
|
9752
9771
|
properties = {}
|
|
9753
9772
|
} = options;
|
|
9754
9773
|
|
|
9755
|
-
/**
|
|
9756
|
-
* @private
|
|
9757
|
-
* @type {any}
|
|
9774
|
+
/**
|
|
9775
|
+
* @private
|
|
9776
|
+
* @type {any}
|
|
9758
9777
|
*/
|
|
9759
9778
|
this.exporter = exporter;
|
|
9760
9779
|
|
|
9761
|
-
/**
|
|
9762
|
-
* @private
|
|
9763
|
-
* @type {State}
|
|
9780
|
+
/**
|
|
9781
|
+
* @private
|
|
9782
|
+
* @type {State}
|
|
9764
9783
|
*/
|
|
9765
9784
|
this._state = {
|
|
9766
9785
|
properties,
|
|
@@ -9789,10 +9808,10 @@ class FormEditor {
|
|
|
9789
9808
|
this._detach(false);
|
|
9790
9809
|
}
|
|
9791
9810
|
|
|
9792
|
-
/**
|
|
9793
|
-
* @param {Schema} schema
|
|
9794
|
-
*
|
|
9795
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
9811
|
+
/**
|
|
9812
|
+
* @param {Schema} schema
|
|
9813
|
+
*
|
|
9814
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
9796
9815
|
*/
|
|
9797
9816
|
importSchema(schema) {
|
|
9798
9817
|
return new Promise((resolve, reject) => {
|
|
@@ -9821,15 +9840,15 @@ class FormEditor {
|
|
|
9821
9840
|
});
|
|
9822
9841
|
}
|
|
9823
9842
|
|
|
9824
|
-
/**
|
|
9825
|
-
* @returns {Schema}
|
|
9843
|
+
/**
|
|
9844
|
+
* @returns {Schema}
|
|
9826
9845
|
*/
|
|
9827
9846
|
saveSchema() {
|
|
9828
9847
|
return this.getSchema();
|
|
9829
9848
|
}
|
|
9830
9849
|
|
|
9831
|
-
/**
|
|
9832
|
-
* @returns {Schema}
|
|
9850
|
+
/**
|
|
9851
|
+
* @returns {Schema}
|
|
9833
9852
|
*/
|
|
9834
9853
|
getSchema() {
|
|
9835
9854
|
const {
|
|
@@ -9838,8 +9857,8 @@ class FormEditor {
|
|
|
9838
9857
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
9839
9858
|
}
|
|
9840
9859
|
|
|
9841
|
-
/**
|
|
9842
|
-
* @param {Element|string} parentNode
|
|
9860
|
+
/**
|
|
9861
|
+
* @param {Element|string} parentNode
|
|
9843
9862
|
*/
|
|
9844
9863
|
attachTo(parentNode) {
|
|
9845
9864
|
if (!parentNode) {
|
|
@@ -9857,10 +9876,10 @@ class FormEditor {
|
|
|
9857
9876
|
this._detach();
|
|
9858
9877
|
}
|
|
9859
9878
|
|
|
9860
|
-
/**
|
|
9861
|
-
* @internal
|
|
9862
|
-
*
|
|
9863
|
-
* @param {boolean} [emit]
|
|
9879
|
+
/**
|
|
9880
|
+
* @internal
|
|
9881
|
+
*
|
|
9882
|
+
* @param {boolean} [emit]
|
|
9864
9883
|
*/
|
|
9865
9884
|
_detach(emit = true) {
|
|
9866
9885
|
const container = this._container,
|
|
@@ -9874,9 +9893,9 @@ class FormEditor {
|
|
|
9874
9893
|
parentNode.removeChild(container);
|
|
9875
9894
|
}
|
|
9876
9895
|
|
|
9877
|
-
/**
|
|
9878
|
-
* @param {any} property
|
|
9879
|
-
* @param {any} value
|
|
9896
|
+
/**
|
|
9897
|
+
* @param {any} property
|
|
9898
|
+
* @param {any} value
|
|
9880
9899
|
*/
|
|
9881
9900
|
setProperty(property, value) {
|
|
9882
9901
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -9885,21 +9904,21 @@ class FormEditor {
|
|
|
9885
9904
|
});
|
|
9886
9905
|
}
|
|
9887
9906
|
|
|
9888
|
-
/**
|
|
9889
|
-
* @param {string} type
|
|
9890
|
-
* @param {Function} handler
|
|
9907
|
+
/**
|
|
9908
|
+
* @param {string} type
|
|
9909
|
+
* @param {Function} handler
|
|
9891
9910
|
*/
|
|
9892
9911
|
off(type, handler) {
|
|
9893
9912
|
this.get('eventBus').off(type, handler);
|
|
9894
9913
|
}
|
|
9895
9914
|
|
|
9896
|
-
/**
|
|
9897
|
-
* @internal
|
|
9898
|
-
*
|
|
9899
|
-
* @param {FormEditorOptions} options
|
|
9900
|
-
* @param {Element} container
|
|
9901
|
-
*
|
|
9902
|
-
* @returns {Injector}
|
|
9915
|
+
/**
|
|
9916
|
+
* @internal
|
|
9917
|
+
*
|
|
9918
|
+
* @param {FormEditorOptions} options
|
|
9919
|
+
* @param {Element} container
|
|
9920
|
+
*
|
|
9921
|
+
* @returns {Injector}
|
|
9903
9922
|
*/
|
|
9904
9923
|
_createInjector(options, container) {
|
|
9905
9924
|
const {
|
|
@@ -9921,22 +9940,22 @@ class FormEditor {
|
|
|
9921
9940
|
}, core, ...modules, ...additionalModules]);
|
|
9922
9941
|
}
|
|
9923
9942
|
|
|
9924
|
-
/**
|
|
9925
|
-
* @internal
|
|
9943
|
+
/**
|
|
9944
|
+
* @internal
|
|
9926
9945
|
*/
|
|
9927
9946
|
_emit(type, data) {
|
|
9928
9947
|
this.get('eventBus').fire(type, data);
|
|
9929
9948
|
}
|
|
9930
9949
|
|
|
9931
|
-
/**
|
|
9932
|
-
* @internal
|
|
9950
|
+
/**
|
|
9951
|
+
* @internal
|
|
9933
9952
|
*/
|
|
9934
9953
|
_getState() {
|
|
9935
9954
|
return this._state;
|
|
9936
9955
|
}
|
|
9937
9956
|
|
|
9938
|
-
/**
|
|
9939
|
-
* @internal
|
|
9957
|
+
/**
|
|
9958
|
+
* @internal
|
|
9940
9959
|
*/
|
|
9941
9960
|
_setState(state) {
|
|
9942
9961
|
this._state = {
|
|
@@ -9946,15 +9965,15 @@ class FormEditor {
|
|
|
9946
9965
|
this._emit('changed', this._getState());
|
|
9947
9966
|
}
|
|
9948
9967
|
|
|
9949
|
-
/**
|
|
9950
|
-
* @internal
|
|
9968
|
+
/**
|
|
9969
|
+
* @internal
|
|
9951
9970
|
*/
|
|
9952
9971
|
_getModules() {
|
|
9953
9972
|
return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
|
|
9954
9973
|
}
|
|
9955
9974
|
|
|
9956
|
-
/**
|
|
9957
|
-
* @internal
|
|
9975
|
+
/**
|
|
9976
|
+
* @internal
|
|
9958
9977
|
*/
|
|
9959
9978
|
_onEvent(type, priority, handler) {
|
|
9960
9979
|
this.get('eventBus').on(type, priority, handler);
|