@bpmn-io/form-js-editor 1.0.0-alpha.2 → 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.
Files changed (38) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +116 -116
  3. package/dist/assets/form-js-editor-base.css +734 -734
  4. package/dist/index.cjs +305 -292
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.es.js +305 -292
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/types/features/SectionModuleBase.d.ts +6 -1
  9. package/dist/types/features/assistant/AssistantPrompter.d.ts +20 -0
  10. package/dist/types/features/assistant/AssistantPrompterLayout.d.ts +20 -0
  11. package/dist/types/features/assistant/AssistantPrompterLayoutV2.d.ts +20 -0
  12. package/dist/types/features/assistant/AssistantRenderer.d.ts +34 -0
  13. package/dist/types/features/assistant/components/Assistant.d.ts +10 -0
  14. package/dist/types/features/assistant/data/minischema.d.ts +1 -0
  15. package/dist/types/features/assistant/index.d.ts +7 -0
  16. package/dist/types/features/assistant/model/AssistantPrompterLayoutV2/AssistantPrompterLayoutV2.d.ts +20 -0
  17. package/dist/types/features/assistant/model/AssistantPrompterLayoutV2/Prompts.d.ts +4 -0
  18. package/dist/types/features/assistant/util/CleanupUtil.d.ts +1 -0
  19. package/dist/types/features/form-generation-ui/FormGenerationUIModule.d.ts +3 -0
  20. package/dist/types/features/form-generation-ui/components/FormGeneration.d.ts +2 -0
  21. package/dist/types/features/form-generation-ui/components/GPTModal.d.ts +2 -0
  22. package/dist/types/features/form-generation-ui/dist/index.d.cts +63 -0
  23. package/dist/types/features/form-generation-ui/dist/index.es.d.ts +60 -0
  24. package/dist/types/features/form-generation-ui/index.d.ts +2 -0
  25. package/dist/types/features/form-generation-ui/inject.d.ts +7 -0
  26. package/dist/types/features/palette/PaletteRenderer.d.ts +33 -0
  27. package/dist/types/features/properties-panel/PropertiesPanelRenderer.d.ts +37 -0
  28. package/dist/types/features/properties-panel/context/FormPropertiesPanelContext.d.ts +11 -0
  29. package/dist/types/features/properties-panel/context/index.d.ts +1 -0
  30. package/dist/types/features/properties-panel/entries/ExpressionValidationEntry.d.ts +44 -0
  31. package/dist/types/features/properties-panel/groups/ExpressionValidationsGroup.d.ts +53 -0
  32. package/dist/types/features/properties-panel/hooks/usePropertiesPanelService.d.ts +1 -0
  33. package/dist/types/features/properties-panel/icons/index.d.ts +1 -0
  34. package/dist/types/features/render-injection/TestInjection.d.ts +7 -0
  35. package/dist/types/features/render-injection/components/TestInjectionComponent.d.ts +2 -0
  36. package/dist/types/features/util/renderManagerBuilder.d.ts +45 -0
  37. package/dist/types/types.d.ts +28 -28
  38. 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(() => {
@@ -1204,23 +1206,23 @@ var Slot = (props => {
1204
1206
  return fillsAndSeparators;
1205
1207
  });
1206
1208
 
1207
- /**
1208
- * Creates a Fragment for a fill.
1209
- *
1210
- * @param {Object} fill Fill to be rendered
1211
- * @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
1212
1214
  */
1213
1215
  const FillFragment = fill => jsxRuntime.jsx(preact.Fragment, {
1214
1216
  children: fill.children
1215
1217
  }, fill.id);
1216
1218
 
1217
- /**
1218
- * Creates an array of fills, with separators inserted between groups.
1219
- *
1220
- * @param {Array} groups Groups of fills
1221
- * @param {Function} fillRenderer Function to create a fill
1222
- * @param {Function} separatorRenderer Function to create a separator
1223
- * @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
1224
1226
  */
1225
1227
  const buildFills = (groups, fillRenderer, separatorRenderer) => {
1226
1228
  const result = [];
@@ -1238,8 +1240,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
1238
1240
  return result;
1239
1241
  };
1240
1242
 
1241
- /**
1242
- * Groups fills by group name property.
1243
+ /**
1244
+ * Groups fills by group name property.
1243
1245
  */
1244
1246
  const _groupByGroupName = fills => {
1245
1247
  const groups = [];
@@ -1259,8 +1261,8 @@ const _groupByGroupName = fills => {
1259
1261
  return Object.keys(groupsById).sort().map(id => groupsById[id]);
1260
1262
  };
1261
1263
 
1262
- /**
1263
- * Compares fills by priority.
1264
+ /**
1265
+ * Compares fills by priority.
1264
1266
  */
1265
1267
  const _comparePriority = (a, b) => {
1266
1268
  return (b.priority || 0) - (a.priority || 0);
@@ -4013,10 +4015,10 @@ function prefixId(id) {
4013
4015
  return `bio-properties-panel-${id}`;
4014
4016
  }
4015
4017
 
4016
- /**
4017
- * Retrieve list of variables from the form schema.
4018
- *
4019
- * @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
4020
4022
  */
4021
4023
  function useVariables() {
4022
4024
  const form = useService('formEditor');
@@ -4105,8 +4107,8 @@ const PropertiesPanelHeaderProvider = {
4105
4107
  }
4106
4108
  };
4107
4109
 
4108
- /**
4109
- * Provide placeholders for empty and multiple state.
4110
+ /**
4111
+ * Provide placeholders for empty and multiple state.
4110
4112
  */
4111
4113
  const PropertiesPanelPlaceholderProvider = {
4112
4114
  getEmpty: () => {
@@ -5613,14 +5615,14 @@ function Value(props) {
5613
5615
 
5614
5616
  // helpers //////////
5615
5617
 
5616
- /**
5617
- * Returns copy of object with updated value.
5618
- *
5619
- * @param {Object} properties
5620
- * @param {string} key
5621
- * @param {string} value
5622
- *
5623
- * @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}
5624
5626
  */
5625
5627
  function updateValue(properties, key, value) {
5626
5628
  return {
@@ -5629,14 +5631,14 @@ function updateValue(properties, key, value) {
5629
5631
  };
5630
5632
  }
5631
5633
 
5632
- /**
5633
- * Returns copy of object with updated key.
5634
- *
5635
- * @param {Object} properties
5636
- * @param {string} oldKey
5637
- * @param {string} newKey
5638
- *
5639
- * @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}
5640
5642
  */
5641
5643
  function updateKey(properties, oldKey, newKey) {
5642
5644
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -6330,8 +6332,8 @@ function ValuesGroups(field, editField) {
6330
6332
  };
6331
6333
  const valuesSourceId = `${fieldId}-valuesSource`;
6332
6334
 
6333
- /**
6334
- * @type {Array<Group|ListGroup>}
6335
+ /**
6336
+ * @type {Array<Group|ListGroup>}
6335
6337
  */
6336
6338
  const groups = [{
6337
6339
  id: valuesSourceId,
@@ -6433,13 +6435,13 @@ function CustomValuesGroup(field, editField) {
6433
6435
 
6434
6436
  // helpers //////////
6435
6437
 
6436
- /**
6437
- * Returns copy of object without key.
6438
- *
6439
- * @param {Object} properties
6440
- * @param {string} oldKey
6441
- *
6442
- * @returns {Object}
6438
+ /**
6439
+ * Returns copy of object without key.
6440
+ *
6441
+ * @param {Object} properties
6442
+ * @param {string} oldKey
6443
+ *
6444
+ * @returns {Object}
6443
6445
  */
6444
6446
  function removeKey(properties, oldKey) {
6445
6447
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -6551,9 +6553,9 @@ function FormPropertiesPanel() {
6551
6553
  }, []);
6552
6554
  hooks.useLayoutEffect(() => {
6553
6555
  const onFieldChanged = () => {
6554
- /**
6555
- * TODO(pinussilvestrus): update with actual updated element,
6556
- * 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
6557
6559
  */
6558
6560
  _update(selection.get() || schema);
6559
6561
  };
@@ -6624,19 +6626,19 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
6624
6626
  const DRAG_NO_MOVE_CLS = 'fjs-no-move';
6625
6627
  const ERROR_DROP_CLS = 'fjs-error-drop';
6626
6628
 
6627
- /**
6628
- * @typedef { { id: String, components: Array<any> } } FormRow
6629
+ /**
6630
+ * @typedef { { id: String, components: Array<any> } } FormRow
6629
6631
  */
6630
6632
 
6631
6633
  class Dragging {
6632
- /**
6633
- * @constructor
6634
- *
6635
- * @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
6636
- * @param { import('../../core/FormLayouter').default } formLayouter
6637
- * @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
6638
- * @param { import('../../core/EventBus').default } eventBus
6639
- * @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
6640
6642
  */
6641
6643
  constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling) {
6642
6644
  this._formFieldRegistry = formFieldRegistry;
@@ -6646,13 +6648,13 @@ class Dragging {
6646
6648
  this._modeling = modeling;
6647
6649
  }
6648
6650
 
6649
- /**
6650
- * Calculcates position in form schema given the dropped place.
6651
- *
6652
- * @param { FormRow } targetRow
6653
- * @param { any } targetFormField
6654
- * @param { HTMLElement } sibling
6655
- * @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 }
6656
6658
  */
6657
6659
  getTargetIndex(targetRow, targetFormField, sibling) {
6658
6660
  /** @type HTMLElement */
@@ -6754,8 +6756,8 @@ class Dragging {
6754
6756
  }
6755
6757
  }
6756
6758
 
6757
- /**
6758
- * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
6759
+ /**
6760
+ * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
6759
6761
  */
6760
6762
  createDragulaInstance(options) {
6761
6763
  const {
@@ -7152,7 +7154,7 @@ function DebugColumns(props) {
7152
7154
  return null;
7153
7155
  }
7154
7156
  return jsxRuntime.jsx("div", {
7155
- style: "width: fit-content; padding: 2px 6px; height: 16px; background: var(--color-blue-205-100-95); display: flex; justify-content: center; align-items: center; position: absolute; bottom: -2px; z-index: 2; font-size: 10px; right: 3px;",
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;",
7156
7158
  class: "fjs-debug-columns",
7157
7159
  children: (field.layout || {}).columns || 'auto'
7158
7160
  });
@@ -8198,10 +8200,10 @@ function updateRow(formField, rowId) {
8198
8200
  }
8199
8201
 
8200
8202
  class AddFormFieldHandler {
8201
- /**
8202
- * @constructor
8203
- * @param { import('../../../FormEditor').default } formEditor
8204
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8203
+ /**
8204
+ * @constructor
8205
+ * @param { import('../../../FormEditor').default } formEditor
8206
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8205
8207
  */
8206
8208
  constructor(formEditor, formFieldRegistry) {
8207
8209
  this._formEditor = formEditor;
@@ -8262,10 +8264,10 @@ class AddFormFieldHandler {
8262
8264
  AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8263
8265
 
8264
8266
  class EditFormFieldHandler {
8265
- /**
8266
- * @constructor
8267
- * @param { import('../../../FormEditor').default } formEditor
8268
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8267
+ /**
8268
+ * @constructor
8269
+ * @param { import('../../../FormEditor').default } formEditor
8270
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8269
8271
  */
8270
8272
  constructor(formEditor, formFieldRegistry) {
8271
8273
  this._formEditor = formEditor;
@@ -8328,10 +8330,10 @@ class EditFormFieldHandler {
8328
8330
  EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8329
8331
 
8330
8332
  class MoveFormFieldHandler {
8331
- /**
8332
- * @constructor
8333
- * @param { import('../../../FormEditor').default } formEditor
8334
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8333
+ /**
8334
+ * @constructor
8335
+ * @param { import('../../../FormEditor').default } formEditor
8336
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8335
8337
  */
8336
8338
  constructor(formEditor, formFieldRegistry) {
8337
8339
  this._formEditor = formEditor;
@@ -8420,10 +8422,10 @@ class MoveFormFieldHandler {
8420
8422
  MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8421
8423
 
8422
8424
  class RemoveFormFieldHandler {
8423
- /**
8424
- * @constructor
8425
- * @param { import('../../../FormEditor').default } formEditor
8426
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8425
+ /**
8426
+ * @constructor
8427
+ * @param { import('../../../FormEditor').default } formEditor
8428
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8427
8429
  */
8428
8430
  constructor(formEditor, formFieldRegistry) {
8429
8431
  this._formEditor = formEditor;
@@ -8483,9 +8485,9 @@ class RemoveFormFieldHandler {
8483
8485
  RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8484
8486
 
8485
8487
  class UpdateIdClaimHandler {
8486
- /**
8487
- * @constructor
8488
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8488
+ /**
8489
+ * @constructor
8490
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8489
8491
  */
8490
8492
  constructor(formFieldRegistry) {
8491
8493
  this._formFieldRegistry = formFieldRegistry;
@@ -8518,9 +8520,9 @@ class UpdateIdClaimHandler {
8518
8520
  UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
8519
8521
 
8520
8522
  class UpdateKeyClaimHandler {
8521
- /**
8522
- * @constructor
8523
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8523
+ /**
8524
+ * @constructor
8525
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8524
8526
  */
8525
8527
  constructor(formFieldRegistry) {
8526
8528
  this._formFieldRegistry = formFieldRegistry;
@@ -8986,8 +8988,8 @@ class ValidateBehavior extends CommandInterceptor {
8986
8988
  constructor(eventBus) {
8987
8989
  super(eventBus);
8988
8990
 
8989
- /**
8990
- * Remove custom validation if <validationType> is about to be added.
8991
+ /**
8992
+ * Remove custom validation if <validationType> is about to be added.
8991
8993
  */
8992
8994
  // @ts-ignore-next-line
8993
8995
  this.preExecute('formField.edit', function (context) {
@@ -9567,51 +9569,62 @@ var SelectionModule = {
9567
9569
  selectionBehavior: ['type', SelectionBehavior]
9568
9570
  };
9569
9571
 
9570
- /**
9571
- * Base class for sectionable UI modules.
9572
- *
9573
- * @property {EventBus} _eventBus - EventBus instance used for event handling.
9574
- * @property {string} managerType - Type of the render manager. Used to form event names.
9575
- *
9576
- * @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
9577
9579
  */
9578
9580
  class SectionModuleBase {
9579
- /**
9580
- * Create a SectionModuleBase instance.
9581
- *
9582
- * @param {any} eventBus - The EventBus instance used for event handling.
9583
- * @param {string} sectionKey - The type of render manager. Used to form event names.
9584
- *
9585
- * @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
9586
9588
  */
9587
9589
  constructor(eventBus, sectionKey) {
9588
9590
  this._eventBus = eventBus;
9589
- this.sectionKey = sectionKey;
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);
9590
9594
  }
9591
9595
 
9592
- /**
9593
- * Attach the managed section to a parent node.
9594
- *
9595
- * @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.
9596
9600
  */
9597
9601
  attachTo(container) {
9598
- this._eventBus.fire(`${this.sectionKey}.attach`, {
9602
+ this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
9599
9603
  container
9600
- });
9604
+ }));
9601
9605
  }
9602
9606
 
9603
- /**
9604
- * Detach the managed section from its parent node.
9607
+ /**
9608
+ * Detach the managed section from its parent node.
9605
9609
  */
9606
9610
  detach() {
9607
- this._eventBus.fire(`${this.sectionKey}.detach`);
9611
+ this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
9608
9612
  }
9609
9613
 
9610
- /**
9611
- * Reset the managed section to its initial state.
9614
+ /**
9615
+ * Reset the managed section to its initial state.
9612
9616
  */
9613
9617
  reset() {
9614
- this._eventBus.fire(`${this.sectionKey}.reset`);
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
+ });
9615
9628
  }
9616
9629
  }
9617
9630
 
@@ -9638,10 +9651,10 @@ var PropertiesPanelModule = {
9638
9651
  propertiesPanel: ['type', PropertiesPanelModule$1]
9639
9652
  };
9640
9653
 
9641
- /**
9642
- * Manages the rendering of visual plugins.
9643
- * @constructor
9644
- * @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.
9645
9658
  */
9646
9659
  class RenderInjector extends SectionModuleBase {
9647
9660
  constructor(eventBus) {
@@ -9650,10 +9663,10 @@ class RenderInjector extends SectionModuleBase {
9650
9663
  this.registeredRenderers = [];
9651
9664
  }
9652
9665
 
9653
- /**
9654
- * Inject a new renderer into the injector.
9655
- * @param {string} identifier - Identifier for the renderer.
9656
- * @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.
9657
9670
  */
9658
9671
  attachRenderer(identifier, Renderer) {
9659
9672
  this.registeredRenderers = [...this.registeredRenderers, {
@@ -9662,17 +9675,17 @@ class RenderInjector extends SectionModuleBase {
9662
9675
  }];
9663
9676
  }
9664
9677
 
9665
- /**
9666
- * Detach a renderer from the by key injector.
9667
- * @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.
9668
9681
  */
9669
9682
  detachRenderer(identifier) {
9670
9683
  this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
9671
9684
  }
9672
9685
 
9673
- /**
9674
- * Returns the registered renderers.
9675
- * @returns {Array} Array of registered renderers.
9686
+ /**
9687
+ * Returns the registered renderers.
9688
+ * @returns {Array} Array of registered renderers.
9676
9689
  */
9677
9690
  fetchRenderers() {
9678
9691
  return this.registeredRenderers;
@@ -9706,48 +9719,48 @@ var ExpressionLanguageModule = {
9706
9719
 
9707
9720
  const ids = new Ids([32, 36, 1]);
9708
9721
 
9709
- /**
9710
- * @typedef { import('./types').Injector } Injector
9711
- * @typedef { import('./types').Module } Module
9712
- * @typedef { import('./types').Schema } Schema
9713
- *
9714
- * @typedef { import('./types').FormEditorOptions } FormEditorOptions
9715
- * @typedef { import('./types').FormEditorProperties } FormEditorProperties
9716
- *
9717
- * @typedef { {
9718
- * properties: FormEditorProperties,
9719
- * schema: Schema
9720
- * } } State
9721
- *
9722
- * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
9723
- * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
9724
- * @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
9725
9738
  */
9726
9739
 
9727
- /**
9728
- * The form editor.
9740
+ /**
9741
+ * The form editor.
9729
9742
  */
9730
9743
  class FormEditor {
9731
- /**
9732
- * @constructor
9733
- * @param {FormEditorOptions} options
9744
+ /**
9745
+ * @constructor
9746
+ * @param {FormEditorOptions} options
9734
9747
  */
9735
9748
  constructor(options = {}) {
9736
- /**
9737
- * @public
9738
- * @type {OnEventType}
9749
+ /**
9750
+ * @public
9751
+ * @type {OnEventType}
9739
9752
  */
9740
9753
  this.on = this._onEvent;
9741
9754
 
9742
- /**
9743
- * @public
9744
- * @type {String}
9755
+ /**
9756
+ * @public
9757
+ * @type {String}
9745
9758
  */
9746
9759
  this._id = ids.next();
9747
9760
 
9748
- /**
9749
- * @private
9750
- * @type {Element}
9761
+ /**
9762
+ * @private
9763
+ * @type {Element}
9751
9764
  */
9752
9765
  this._container = formJsViewer.createFormContainer();
9753
9766
  this._container.setAttribute('input-handle-modified-keys', 'z,y');
@@ -9758,15 +9771,15 @@ class FormEditor {
9758
9771
  properties = {}
9759
9772
  } = options;
9760
9773
 
9761
- /**
9762
- * @private
9763
- * @type {any}
9774
+ /**
9775
+ * @private
9776
+ * @type {any}
9764
9777
  */
9765
9778
  this.exporter = exporter;
9766
9779
 
9767
- /**
9768
- * @private
9769
- * @type {State}
9780
+ /**
9781
+ * @private
9782
+ * @type {State}
9770
9783
  */
9771
9784
  this._state = {
9772
9785
  properties,
@@ -9795,10 +9808,10 @@ class FormEditor {
9795
9808
  this._detach(false);
9796
9809
  }
9797
9810
 
9798
- /**
9799
- * @param {Schema} schema
9800
- *
9801
- * @return {Promise<{ warnings: Array<any> }>}
9811
+ /**
9812
+ * @param {Schema} schema
9813
+ *
9814
+ * @return {Promise<{ warnings: Array<any> }>}
9802
9815
  */
9803
9816
  importSchema(schema) {
9804
9817
  return new Promise((resolve, reject) => {
@@ -9827,15 +9840,15 @@ class FormEditor {
9827
9840
  });
9828
9841
  }
9829
9842
 
9830
- /**
9831
- * @returns {Schema}
9843
+ /**
9844
+ * @returns {Schema}
9832
9845
  */
9833
9846
  saveSchema() {
9834
9847
  return this.getSchema();
9835
9848
  }
9836
9849
 
9837
- /**
9838
- * @returns {Schema}
9850
+ /**
9851
+ * @returns {Schema}
9839
9852
  */
9840
9853
  getSchema() {
9841
9854
  const {
@@ -9844,8 +9857,8 @@ class FormEditor {
9844
9857
  return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
9845
9858
  }
9846
9859
 
9847
- /**
9848
- * @param {Element|string} parentNode
9860
+ /**
9861
+ * @param {Element|string} parentNode
9849
9862
  */
9850
9863
  attachTo(parentNode) {
9851
9864
  if (!parentNode) {
@@ -9863,10 +9876,10 @@ class FormEditor {
9863
9876
  this._detach();
9864
9877
  }
9865
9878
 
9866
- /**
9867
- * @internal
9868
- *
9869
- * @param {boolean} [emit]
9879
+ /**
9880
+ * @internal
9881
+ *
9882
+ * @param {boolean} [emit]
9870
9883
  */
9871
9884
  _detach(emit = true) {
9872
9885
  const container = this._container,
@@ -9880,9 +9893,9 @@ class FormEditor {
9880
9893
  parentNode.removeChild(container);
9881
9894
  }
9882
9895
 
9883
- /**
9884
- * @param {any} property
9885
- * @param {any} value
9896
+ /**
9897
+ * @param {any} property
9898
+ * @param {any} value
9886
9899
  */
9887
9900
  setProperty(property, value) {
9888
9901
  const properties = minDash.set(this._getState().properties, [property], value);
@@ -9891,21 +9904,21 @@ class FormEditor {
9891
9904
  });
9892
9905
  }
9893
9906
 
9894
- /**
9895
- * @param {string} type
9896
- * @param {Function} handler
9907
+ /**
9908
+ * @param {string} type
9909
+ * @param {Function} handler
9897
9910
  */
9898
9911
  off(type, handler) {
9899
9912
  this.get('eventBus').off(type, handler);
9900
9913
  }
9901
9914
 
9902
- /**
9903
- * @internal
9904
- *
9905
- * @param {FormEditorOptions} options
9906
- * @param {Element} container
9907
- *
9908
- * @returns {Injector}
9915
+ /**
9916
+ * @internal
9917
+ *
9918
+ * @param {FormEditorOptions} options
9919
+ * @param {Element} container
9920
+ *
9921
+ * @returns {Injector}
9909
9922
  */
9910
9923
  _createInjector(options, container) {
9911
9924
  const {
@@ -9927,22 +9940,22 @@ class FormEditor {
9927
9940
  }, core, ...modules, ...additionalModules]);
9928
9941
  }
9929
9942
 
9930
- /**
9931
- * @internal
9943
+ /**
9944
+ * @internal
9932
9945
  */
9933
9946
  _emit(type, data) {
9934
9947
  this.get('eventBus').fire(type, data);
9935
9948
  }
9936
9949
 
9937
- /**
9938
- * @internal
9950
+ /**
9951
+ * @internal
9939
9952
  */
9940
9953
  _getState() {
9941
9954
  return this._state;
9942
9955
  }
9943
9956
 
9944
- /**
9945
- * @internal
9957
+ /**
9958
+ * @internal
9946
9959
  */
9947
9960
  _setState(state) {
9948
9961
  this._state = {
@@ -9952,15 +9965,15 @@ class FormEditor {
9952
9965
  this._emit('changed', this._getState());
9953
9966
  }
9954
9967
 
9955
- /**
9956
- * @internal
9968
+ /**
9969
+ * @internal
9957
9970
  */
9958
9971
  _getModules() {
9959
9972
  return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
9960
9973
  }
9961
9974
 
9962
- /**
9963
- * @internal
9975
+ /**
9976
+ * @internal
9964
9977
  */
9965
9978
  _onEvent(type, priority, handler) {
9966
9979
  this.get('eventBus').on(type, priority, handler);