@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.es.js CHANGED
@@ -514,10 +514,10 @@ function invokeFunction(fn, args) {
514
514
  return fn.apply(null, args);
515
515
  }
516
516
 
517
- /**
518
- * A factory to create a configurable debouncer.
519
- *
520
- * @param {number|boolean} [config=true]
517
+ /**
518
+ * A factory to create a configurable debouncer.
519
+ *
520
+ * @param {number|boolean} [config=true]
521
521
  */
522
522
  function DebounceFactory(config = true) {
523
523
  const timeout = typeof config === 'number' ? config : config ? 300 : 0;
@@ -530,11 +530,11 @@ function DebounceFactory(config = true) {
530
530
  DebounceFactory.$inject = ['config.debounce'];
531
531
 
532
532
  class FieldFactory {
533
- /**
534
- * @constructor
535
- *
536
- * @param { import('./FormFieldRegistry').default } formFieldRegistry
537
- * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
533
+ /**
534
+ * @constructor
535
+ *
536
+ * @param { import('./FormFieldRegistry').default } formFieldRegistry
537
+ * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
538
538
  */
539
539
  constructor(formFieldRegistry, formFields) {
540
540
  this._formFieldRegistry = formFieldRegistry;
@@ -597,11 +597,11 @@ class FieldFactory {
597
597
  FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
598
598
 
599
599
  class FormFieldRegistry extends FormFieldRegistry$1 {
600
- /**
601
- * Updates a form fields id.
602
- *
603
- * @param {Object} formField
604
- * @param {string} newId
600
+ /**
601
+ * Updates a form fields id.
602
+ *
603
+ * @param {Object} formField
604
+ * @param {string} newId
605
605
  */
606
606
  updateId(formField, newId) {
607
607
  this._validateId(newId);
@@ -622,13 +622,13 @@ class FormFieldRegistry extends FormFieldRegistry$1 {
622
622
  }
623
623
  }
624
624
 
625
- /**
626
- * Validate the suitability of the given id and signals a problem
627
- * with an exception.
628
- *
629
- * @param {string} id
630
- *
631
- * @throws {Error} if id is empty or already assigned
625
+ /**
626
+ * Validate the suitability of the given id and signals a problem
627
+ * with an exception.
628
+ *
629
+ * @param {string} id
630
+ *
631
+ * @throws {Error} if id is empty or already assigned
632
632
  */
633
633
  _validateId(id) {
634
634
  if (!id) {
@@ -645,11 +645,11 @@ const MAX_COLUMNS = 16;
645
645
  const MIN_COLUMNS = 2;
646
646
  const MAX_FIELDS_PER_ROW = 4;
647
647
  class FormLayoutValidator {
648
- /**
649
- * @constructor
650
- *
651
- * @param { import('./FormLayouter').default } formLayouter
652
- * @param { import('./FormFieldRegistry').default } formFieldRegistry
648
+ /**
649
+ * @constructor
650
+ *
651
+ * @param { import('./FormLayouter').default } formLayouter
652
+ * @param { import('./FormFieldRegistry').default } formFieldRegistry
653
653
  */
654
654
  constructor(formLayouter, formFieldRegistry) {
655
655
  this._formLayouter = formLayouter;
@@ -709,11 +709,11 @@ function calculateMaxColumnsWithAuto(autoCols) {
709
709
  }
710
710
 
711
711
  class Importer {
712
- /**
713
- * @constructor
714
- * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
715
- * @param { import('../core/FieldFactory').default } fieldFactory
716
- * @param { import('../core/FormLayouter').default } formLayouter
712
+ /**
713
+ * @constructor
714
+ * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
715
+ * @param { import('../core/FieldFactory').default } fieldFactory
716
+ * @param { import('../core/FormLayouter').default } formLayouter
717
717
  */
718
718
  constructor(formFieldRegistry, fieldFactory, formLayouter) {
719
719
  this._formFieldRegistry = formFieldRegistry;
@@ -721,21 +721,21 @@ class Importer {
721
721
  this._formLayouter = formLayouter;
722
722
  }
723
723
 
724
- /**
725
- * Import schema creating rows, fields, attaching additional
726
- * information to each field and adding fields to the
727
- * field registry.
728
- *
729
- * Additional information attached:
730
- *
731
- * * `id` (unless present)
732
- * * `_parent`
733
- * * `_path`
734
- *
735
- * @param {any} schema
736
- *
737
- * @typedef {{ warnings: Error[], schema: any }} ImportResult
738
- * @returns {ImportResult}
724
+ /**
725
+ * Import schema creating rows, fields, attaching additional
726
+ * information to each field and adding fields to the
727
+ * field registry.
728
+ *
729
+ * Additional information attached:
730
+ *
731
+ * * `id` (unless present)
732
+ * * `_parent`
733
+ * * `_path`
734
+ *
735
+ * @param {any} schema
736
+ *
737
+ * @typedef {{ warnings: Error[], schema: any }} ImportResult
738
+ * @returns {ImportResult}
739
739
  */
740
740
  importSchema(schema) {
741
741
  // TODO: Add warnings
@@ -753,12 +753,12 @@ class Importer {
753
753
  }
754
754
  }
755
755
 
756
- /**
757
- * @param {{[x: string]: any}} fieldAttrs
758
- * @param {String} [parentId]
759
- * @param {number} [index]
760
- *
761
- * @return {any} field
756
+ /**
757
+ * @param {{[x: string]: any}} fieldAttrs
758
+ * @param {String} [parentId]
759
+ * @param {number} [index]
760
+ *
761
+ * @return {any} field
762
762
  */
763
763
  importFormField(fieldAttrs, parentId, index) {
764
764
  const {
@@ -795,11 +795,11 @@ class Importer {
795
795
  return field;
796
796
  }
797
797
 
798
- /**
799
- * @param {Array<any>} components
800
- * @param {string} parentId
801
- *
802
- * @return {Array<any>} imported components
798
+ /**
799
+ * @param {Array<any>} components
800
+ * @param {string} parentId
801
+ *
802
+ * @return {Array<any>} imported components
803
803
  */
804
804
  importFormFields(components, parentId) {
805
805
  return components.map((component, index) => {
@@ -824,22 +824,22 @@ function editorFormFieldClasses(type, {
824
824
  });
825
825
  }
826
826
 
827
- /**
828
- * Add a dragger that calls back the passed function with
829
- * { event, delta } on drag.
830
- *
831
- * @example
832
- *
833
- * function dragMove(event, delta) {
834
- * // we are dragging (!!)
835
- * }
836
- *
837
- * domElement.addEventListener('dragstart', dragger(dragMove));
838
- *
839
- * @param {Function} fn
840
- * @param {Element} dragPreview
841
- *
842
- * @return {Function} drag start callback function
827
+ /**
828
+ * Add a dragger that calls back the passed function with
829
+ * { event, delta } on drag.
830
+ *
831
+ * @example
832
+ *
833
+ * function dragMove(event, delta) {
834
+ * // we are dragging (!!)
835
+ * }
836
+ *
837
+ * domElement.addEventListener('dragstart', dragger(dragMove));
838
+ *
839
+ * @param {Function} fn
840
+ * @param {Element} dragPreview
841
+ *
842
+ * @return {Function} drag start callback function
843
843
  */
844
844
  function createDragger(fn, dragPreview) {
845
845
  let self;
@@ -880,12 +880,12 @@ function createDragger(fn, dragPreview) {
880
880
  return onDragStart;
881
881
  }
882
882
 
883
- /**
884
- * Throttle function call according UI update cycle.
885
- *
886
- * @param {Function} fn
887
- *
888
- * @return {Function} throttled fn
883
+ /**
884
+ * Throttle function call according UI update cycle.
885
+ *
886
+ * @param {Function} fn
887
+ *
888
+ * @return {Function} throttled fn
889
889
  */
890
890
  function throttle(fn) {
891
891
  let active = false;
@@ -914,11 +914,11 @@ const DragAndDropContext = createContext({
914
914
  });
915
915
  var DragAndDropContext$1 = DragAndDropContext;
916
916
 
917
- /**
918
- * @param {string} type
919
- * @param {boolean} [strict]
920
- *
921
- * @returns {any}
917
+ /**
918
+ * @param {string} type
919
+ * @param {boolean} [strict]
920
+ *
921
+ * @returns {any}
922
922
  */
923
923
  function getService(type, strict) {}
924
924
  const FormEditorContext = createContext({
@@ -1117,10 +1117,12 @@ var ModularSection = (props => {
1117
1117
  eventBus.on(`${section}.attach`, onAttach);
1118
1118
  eventBus.on(`${section}.detach`, onDetach);
1119
1119
  eventBus.on(`${section}.reset`, onReset);
1120
+ eventBus.fire(`${section}.section.rendered`);
1120
1121
  return () => {
1121
1122
  eventBus.off(`${section}.attach`, onAttach);
1122
1123
  eventBus.off(`${section}.detach`, onDetach);
1123
1124
  eventBus.off(`${section}.reset`, onReset);
1125
+ eventBus.fire(`${section}.section.destroyed`);
1124
1126
  };
1125
1127
  }, [eventBus, section]);
1126
1128
  useEffect(() => {
@@ -1203,23 +1205,23 @@ var Slot = (props => {
1203
1205
  return fillsAndSeparators;
1204
1206
  });
1205
1207
 
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
1208
+ /**
1209
+ * Creates a Fragment for a fill.
1210
+ *
1211
+ * @param {Object} fill Fill to be rendered
1212
+ * @returns {Object} Preact Fragment containing fill's children
1211
1213
  */
1212
1214
  const FillFragment = fill => jsx(Fragment, {
1213
1215
  children: fill.children
1214
1216
  }, fill.id);
1215
1217
 
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
1218
+ /**
1219
+ * Creates an array of fills, with separators inserted between groups.
1220
+ *
1221
+ * @param {Array} groups Groups of fills
1222
+ * @param {Function} fillRenderer Function to create a fill
1223
+ * @param {Function} separatorRenderer Function to create a separator
1224
+ * @returns {Array} Array of fills and separators
1223
1225
  */
1224
1226
  const buildFills = (groups, fillRenderer, separatorRenderer) => {
1225
1227
  const result = [];
@@ -1237,8 +1239,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
1237
1239
  return result;
1238
1240
  };
1239
1241
 
1240
- /**
1241
- * Groups fills by group name property.
1242
+ /**
1243
+ * Groups fills by group name property.
1242
1244
  */
1243
1245
  const _groupByGroupName = fills => {
1244
1246
  const groups = [];
@@ -1258,8 +1260,8 @@ const _groupByGroupName = fills => {
1258
1260
  return Object.keys(groupsById).sort().map(id => groupsById[id]);
1259
1261
  };
1260
1262
 
1261
- /**
1262
- * Compares fills by priority.
1263
+ /**
1264
+ * Compares fills by priority.
1263
1265
  */
1264
1266
  const _comparePriority = (a, b) => {
1265
1267
  return (b.priority || 0) - (a.priority || 0);
@@ -4012,10 +4014,10 @@ function prefixId(id) {
4012
4014
  return `bio-properties-panel-${id}`;
4013
4015
  }
4014
4016
 
4015
- /**
4016
- * Retrieve list of variables from the form schema.
4017
- *
4018
- * @returns { string[] } list of variables used in form schema
4017
+ /**
4018
+ * Retrieve list of variables from the form schema.
4019
+ *
4020
+ * @returns { string[] } list of variables used in form schema
4019
4021
  */
4020
4022
  function useVariables() {
4021
4023
  const form = useService('formEditor');
@@ -4104,8 +4106,8 @@ const PropertiesPanelHeaderProvider = {
4104
4106
  }
4105
4107
  };
4106
4108
 
4107
- /**
4108
- * Provide placeholders for empty and multiple state.
4109
+ /**
4110
+ * Provide placeholders for empty and multiple state.
4109
4111
  */
4110
4112
  const PropertiesPanelPlaceholderProvider = {
4111
4113
  getEmpty: () => {
@@ -5612,14 +5614,14 @@ function Value(props) {
5612
5614
 
5613
5615
  // helpers //////////
5614
5616
 
5615
- /**
5616
- * Returns copy of object with updated value.
5617
- *
5618
- * @param {Object} properties
5619
- * @param {string} key
5620
- * @param {string} value
5621
- *
5622
- * @returns {Object}
5617
+ /**
5618
+ * Returns copy of object with updated value.
5619
+ *
5620
+ * @param {Object} properties
5621
+ * @param {string} key
5622
+ * @param {string} value
5623
+ *
5624
+ * @returns {Object}
5623
5625
  */
5624
5626
  function updateValue(properties, key, value) {
5625
5627
  return {
@@ -5628,14 +5630,14 @@ function updateValue(properties, key, value) {
5628
5630
  };
5629
5631
  }
5630
5632
 
5631
- /**
5632
- * Returns copy of object with updated key.
5633
- *
5634
- * @param {Object} properties
5635
- * @param {string} oldKey
5636
- * @param {string} newKey
5637
- *
5638
- * @returns {Object}
5633
+ /**
5634
+ * Returns copy of object with updated key.
5635
+ *
5636
+ * @param {Object} properties
5637
+ * @param {string} oldKey
5638
+ * @param {string} newKey
5639
+ *
5640
+ * @returns {Object}
5639
5641
  */
5640
5642
  function updateKey(properties, oldKey, newKey) {
5641
5643
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -6329,8 +6331,8 @@ function ValuesGroups(field, editField) {
6329
6331
  };
6330
6332
  const valuesSourceId = `${fieldId}-valuesSource`;
6331
6333
 
6332
- /**
6333
- * @type {Array<Group|ListGroup>}
6334
+ /**
6335
+ * @type {Array<Group|ListGroup>}
6334
6336
  */
6335
6337
  const groups = [{
6336
6338
  id: valuesSourceId,
@@ -6432,13 +6434,13 @@ function CustomValuesGroup(field, editField) {
6432
6434
 
6433
6435
  // helpers //////////
6434
6436
 
6435
- /**
6436
- * Returns copy of object without key.
6437
- *
6438
- * @param {Object} properties
6439
- * @param {string} oldKey
6440
- *
6441
- * @returns {Object}
6437
+ /**
6438
+ * Returns copy of object without key.
6439
+ *
6440
+ * @param {Object} properties
6441
+ * @param {string} oldKey
6442
+ *
6443
+ * @returns {Object}
6442
6444
  */
6443
6445
  function removeKey(properties, oldKey) {
6444
6446
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -6550,9 +6552,9 @@ function FormPropertiesPanel() {
6550
6552
  }, []);
6551
6553
  useLayoutEffect(() => {
6552
6554
  const onFieldChanged = () => {
6553
- /**
6554
- * TODO(pinussilvestrus): update with actual updated element,
6555
- * once we have a proper updater/change support
6555
+ /**
6556
+ * TODO(pinussilvestrus): update with actual updated element,
6557
+ * once we have a proper updater/change support
6556
6558
  */
6557
6559
  _update(selection.get() || schema);
6558
6560
  };
@@ -6623,19 +6625,19 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
6623
6625
  const DRAG_NO_MOVE_CLS = 'fjs-no-move';
6624
6626
  const ERROR_DROP_CLS = 'fjs-error-drop';
6625
6627
 
6626
- /**
6627
- * @typedef { { id: String, components: Array<any> } } FormRow
6628
+ /**
6629
+ * @typedef { { id: String, components: Array<any> } } FormRow
6628
6630
  */
6629
6631
 
6630
6632
  class Dragging {
6631
- /**
6632
- * @constructor
6633
- *
6634
- * @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
6635
- * @param { import('../../core/FormLayouter').default } formLayouter
6636
- * @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
6637
- * @param { import('../../core/EventBus').default } eventBus
6638
- * @param { import('../modeling/Modeling').default } modeling
6633
+ /**
6634
+ * @constructor
6635
+ *
6636
+ * @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
6637
+ * @param { import('../../core/FormLayouter').default } formLayouter
6638
+ * @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
6639
+ * @param { import('../../core/EventBus').default } eventBus
6640
+ * @param { import('../modeling/Modeling').default } modeling
6639
6641
  */
6640
6642
  constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling) {
6641
6643
  this._formFieldRegistry = formFieldRegistry;
@@ -6645,13 +6647,13 @@ class Dragging {
6645
6647
  this._modeling = modeling;
6646
6648
  }
6647
6649
 
6648
- /**
6649
- * Calculcates position in form schema given the dropped place.
6650
- *
6651
- * @param { FormRow } targetRow
6652
- * @param { any } targetFormField
6653
- * @param { HTMLElement } sibling
6654
- * @returns { number }
6650
+ /**
6651
+ * Calculcates position in form schema given the dropped place.
6652
+ *
6653
+ * @param { FormRow } targetRow
6654
+ * @param { any } targetFormField
6655
+ * @param { HTMLElement } sibling
6656
+ * @returns { number }
6655
6657
  */
6656
6658
  getTargetIndex(targetRow, targetFormField, sibling) {
6657
6659
  /** @type HTMLElement */
@@ -6753,8 +6755,8 @@ class Dragging {
6753
6755
  }
6754
6756
  }
6755
6757
 
6756
- /**
6757
- * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
6758
+ /**
6759
+ * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
6758
6760
  */
6759
6761
  createDragulaInstance(options) {
6760
6762
  const {
@@ -7151,7 +7153,7 @@ function DebugColumns(props) {
7151
7153
  return null;
7152
7154
  }
7153
7155
  return jsx("div", {
7154
- 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;",
7156
+ 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;",
7155
7157
  class: "fjs-debug-columns",
7156
7158
  children: (field.layout || {}).columns || 'auto'
7157
7159
  });
@@ -8197,10 +8199,10 @@ function updateRow(formField, rowId) {
8197
8199
  }
8198
8200
 
8199
8201
  class AddFormFieldHandler {
8200
- /**
8201
- * @constructor
8202
- * @param { import('../../../FormEditor').default } formEditor
8203
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8202
+ /**
8203
+ * @constructor
8204
+ * @param { import('../../../FormEditor').default } formEditor
8205
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8204
8206
  */
8205
8207
  constructor(formEditor, formFieldRegistry) {
8206
8208
  this._formEditor = formEditor;
@@ -8261,10 +8263,10 @@ class AddFormFieldHandler {
8261
8263
  AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8262
8264
 
8263
8265
  class EditFormFieldHandler {
8264
- /**
8265
- * @constructor
8266
- * @param { import('../../../FormEditor').default } formEditor
8267
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8266
+ /**
8267
+ * @constructor
8268
+ * @param { import('../../../FormEditor').default } formEditor
8269
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8268
8270
  */
8269
8271
  constructor(formEditor, formFieldRegistry) {
8270
8272
  this._formEditor = formEditor;
@@ -8327,10 +8329,10 @@ class EditFormFieldHandler {
8327
8329
  EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8328
8330
 
8329
8331
  class MoveFormFieldHandler {
8330
- /**
8331
- * @constructor
8332
- * @param { import('../../../FormEditor').default } formEditor
8333
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8332
+ /**
8333
+ * @constructor
8334
+ * @param { import('../../../FormEditor').default } formEditor
8335
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8334
8336
  */
8335
8337
  constructor(formEditor, formFieldRegistry) {
8336
8338
  this._formEditor = formEditor;
@@ -8419,10 +8421,10 @@ class MoveFormFieldHandler {
8419
8421
  MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8420
8422
 
8421
8423
  class RemoveFormFieldHandler {
8422
- /**
8423
- * @constructor
8424
- * @param { import('../../../FormEditor').default } formEditor
8425
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8424
+ /**
8425
+ * @constructor
8426
+ * @param { import('../../../FormEditor').default } formEditor
8427
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8426
8428
  */
8427
8429
  constructor(formEditor, formFieldRegistry) {
8428
8430
  this._formEditor = formEditor;
@@ -8482,9 +8484,9 @@ class RemoveFormFieldHandler {
8482
8484
  RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
8483
8485
 
8484
8486
  class UpdateIdClaimHandler {
8485
- /**
8486
- * @constructor
8487
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8487
+ /**
8488
+ * @constructor
8489
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8488
8490
  */
8489
8491
  constructor(formFieldRegistry) {
8490
8492
  this._formFieldRegistry = formFieldRegistry;
@@ -8517,9 +8519,9 @@ class UpdateIdClaimHandler {
8517
8519
  UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
8518
8520
 
8519
8521
  class UpdateKeyClaimHandler {
8520
- /**
8521
- * @constructor
8522
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8522
+ /**
8523
+ * @constructor
8524
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
8523
8525
  */
8524
8526
  constructor(formFieldRegistry) {
8525
8527
  this._formFieldRegistry = formFieldRegistry;
@@ -8985,8 +8987,8 @@ class ValidateBehavior extends CommandInterceptor {
8985
8987
  constructor(eventBus) {
8986
8988
  super(eventBus);
8987
8989
 
8988
- /**
8989
- * Remove custom validation if <validationType> is about to be added.
8990
+ /**
8991
+ * Remove custom validation if <validationType> is about to be added.
8990
8992
  */
8991
8993
  // @ts-ignore-next-line
8992
8994
  this.preExecute('formField.edit', function (context) {
@@ -9566,51 +9568,62 @@ var SelectionModule = {
9566
9568
  selectionBehavior: ['type', SelectionBehavior]
9567
9569
  };
9568
9570
 
9569
- /**
9570
- * Base class for sectionable UI modules.
9571
- *
9572
- * @property {EventBus} _eventBus - EventBus instance used for event handling.
9573
- * @property {string} managerType - Type of the render manager. Used to form event names.
9574
- *
9575
- * @class SectionModuleBase
9571
+ /**
9572
+ * Base class for sectionable UI modules.
9573
+ *
9574
+ * @property {EventBus} _eventBus - EventBus instance used for event handling.
9575
+ * @property {string} managerType - Type of the render manager. Used to form event names.
9576
+ *
9577
+ * @class SectionModuleBase
9576
9578
  */
9577
9579
  class SectionModuleBase {
9578
- /**
9579
- * Create a SectionModuleBase instance.
9580
- *
9581
- * @param {any} eventBus - The EventBus instance used for event handling.
9582
- * @param {string} sectionKey - The type of render manager. Used to form event names.
9583
- *
9584
- * @constructor
9580
+ /**
9581
+ * Create a SectionModuleBase instance.
9582
+ *
9583
+ * @param {any} eventBus - The EventBus instance used for event handling.
9584
+ * @param {string} sectionKey - The type of render manager. Used to form event names.
9585
+ *
9586
+ * @constructor
9585
9587
  */
9586
9588
  constructor(eventBus, sectionKey) {
9587
9589
  this._eventBus = eventBus;
9588
- this.sectionKey = sectionKey;
9590
+ this._sectionKey = sectionKey;
9591
+ this._eventBus.on(`${this._sectionKey}.section.rendered`, () => this.isSectionRendered = true);
9592
+ this._eventBus.on(`${this._sectionKey}.section.destroyed`, () => this.isSectionRendered = false);
9589
9593
  }
9590
9594
 
9591
- /**
9592
- * Attach the managed section to a parent node.
9593
- *
9594
- * @param {HTMLElement} container - The parent node to attach to.
9595
+ /**
9596
+ * Attach the managed section to a parent node.
9597
+ *
9598
+ * @param {HTMLElement} container - The parent node to attach to.
9595
9599
  */
9596
9600
  attachTo(container) {
9597
- this._eventBus.fire(`${this.sectionKey}.attach`, {
9601
+ this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
9598
9602
  container
9599
- });
9603
+ }));
9600
9604
  }
9601
9605
 
9602
- /**
9603
- * Detach the managed section from its parent node.
9606
+ /**
9607
+ * Detach the managed section from its parent node.
9604
9608
  */
9605
9609
  detach() {
9606
- this._eventBus.fire(`${this.sectionKey}.detach`);
9610
+ this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
9607
9611
  }
9608
9612
 
9609
- /**
9610
- * Reset the managed section to its initial state.
9613
+ /**
9614
+ * Reset the managed section to its initial state.
9611
9615
  */
9612
9616
  reset() {
9613
- this._eventBus.fire(`${this.sectionKey}.reset`);
9617
+ this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
9618
+ }
9619
+
9620
+ /**
9621
+ * Circumvents timing issues.
9622
+ */
9623
+ _onceSectionRendered(callback) {
9624
+ this.isSectionRendered ? callback() : this._eventBus.once(`${this._sectionKey}.section.rendered`, () => {
9625
+ callback();
9626
+ });
9614
9627
  }
9615
9628
  }
9616
9629
 
@@ -9637,10 +9650,10 @@ var PropertiesPanelModule = {
9637
9650
  propertiesPanel: ['type', PropertiesPanelModule$1]
9638
9651
  };
9639
9652
 
9640
- /**
9641
- * Manages the rendering of visual plugins.
9642
- * @constructor
9643
- * @param {Object} eventBus - Event bus for the application.
9653
+ /**
9654
+ * Manages the rendering of visual plugins.
9655
+ * @constructor
9656
+ * @param {Object} eventBus - Event bus for the application.
9644
9657
  */
9645
9658
  class RenderInjector extends SectionModuleBase {
9646
9659
  constructor(eventBus) {
@@ -9649,10 +9662,10 @@ class RenderInjector extends SectionModuleBase {
9649
9662
  this.registeredRenderers = [];
9650
9663
  }
9651
9664
 
9652
- /**
9653
- * Inject a new renderer into the injector.
9654
- * @param {string} identifier - Identifier for the renderer.
9655
- * @param {Function} Renderer - The renderer function.
9665
+ /**
9666
+ * Inject a new renderer into the injector.
9667
+ * @param {string} identifier - Identifier for the renderer.
9668
+ * @param {Function} Renderer - The renderer function.
9656
9669
  */
9657
9670
  attachRenderer(identifier, Renderer) {
9658
9671
  this.registeredRenderers = [...this.registeredRenderers, {
@@ -9661,17 +9674,17 @@ class RenderInjector extends SectionModuleBase {
9661
9674
  }];
9662
9675
  }
9663
9676
 
9664
- /**
9665
- * Detach a renderer from the by key injector.
9666
- * @param {string} identifier - Identifier for the renderer.
9677
+ /**
9678
+ * Detach a renderer from the by key injector.
9679
+ * @param {string} identifier - Identifier for the renderer.
9667
9680
  */
9668
9681
  detachRenderer(identifier) {
9669
9682
  this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
9670
9683
  }
9671
9684
 
9672
- /**
9673
- * Returns the registered renderers.
9674
- * @returns {Array} Array of registered renderers.
9685
+ /**
9686
+ * Returns the registered renderers.
9687
+ * @returns {Array} Array of registered renderers.
9675
9688
  */
9676
9689
  fetchRenderers() {
9677
9690
  return this.registeredRenderers;
@@ -9705,48 +9718,48 @@ var ExpressionLanguageModule = {
9705
9718
 
9706
9719
  const ids = new Ids([32, 36, 1]);
9707
9720
 
9708
- /**
9709
- * @typedef { import('./types').Injector } Injector
9710
- * @typedef { import('./types').Module } Module
9711
- * @typedef { import('./types').Schema } Schema
9712
- *
9713
- * @typedef { import('./types').FormEditorOptions } FormEditorOptions
9714
- * @typedef { import('./types').FormEditorProperties } FormEditorProperties
9715
- *
9716
- * @typedef { {
9717
- * properties: FormEditorProperties,
9718
- * schema: Schema
9719
- * } } State
9720
- *
9721
- * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
9722
- * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
9723
- * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
9721
+ /**
9722
+ * @typedef { import('./types').Injector } Injector
9723
+ * @typedef { import('./types').Module } Module
9724
+ * @typedef { import('./types').Schema } Schema
9725
+ *
9726
+ * @typedef { import('./types').FormEditorOptions } FormEditorOptions
9727
+ * @typedef { import('./types').FormEditorProperties } FormEditorProperties
9728
+ *
9729
+ * @typedef { {
9730
+ * properties: FormEditorProperties,
9731
+ * schema: Schema
9732
+ * } } State
9733
+ *
9734
+ * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
9735
+ * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
9736
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
9724
9737
  */
9725
9738
 
9726
- /**
9727
- * The form editor.
9739
+ /**
9740
+ * The form editor.
9728
9741
  */
9729
9742
  class FormEditor {
9730
- /**
9731
- * @constructor
9732
- * @param {FormEditorOptions} options
9743
+ /**
9744
+ * @constructor
9745
+ * @param {FormEditorOptions} options
9733
9746
  */
9734
9747
  constructor(options = {}) {
9735
- /**
9736
- * @public
9737
- * @type {OnEventType}
9748
+ /**
9749
+ * @public
9750
+ * @type {OnEventType}
9738
9751
  */
9739
9752
  this.on = this._onEvent;
9740
9753
 
9741
- /**
9742
- * @public
9743
- * @type {String}
9754
+ /**
9755
+ * @public
9756
+ * @type {String}
9744
9757
  */
9745
9758
  this._id = ids.next();
9746
9759
 
9747
- /**
9748
- * @private
9749
- * @type {Element}
9760
+ /**
9761
+ * @private
9762
+ * @type {Element}
9750
9763
  */
9751
9764
  this._container = createFormContainer();
9752
9765
  this._container.setAttribute('input-handle-modified-keys', 'z,y');
@@ -9757,15 +9770,15 @@ class FormEditor {
9757
9770
  properties = {}
9758
9771
  } = options;
9759
9772
 
9760
- /**
9761
- * @private
9762
- * @type {any}
9773
+ /**
9774
+ * @private
9775
+ * @type {any}
9763
9776
  */
9764
9777
  this.exporter = exporter;
9765
9778
 
9766
- /**
9767
- * @private
9768
- * @type {State}
9779
+ /**
9780
+ * @private
9781
+ * @type {State}
9769
9782
  */
9770
9783
  this._state = {
9771
9784
  properties,
@@ -9794,10 +9807,10 @@ class FormEditor {
9794
9807
  this._detach(false);
9795
9808
  }
9796
9809
 
9797
- /**
9798
- * @param {Schema} schema
9799
- *
9800
- * @return {Promise<{ warnings: Array<any> }>}
9810
+ /**
9811
+ * @param {Schema} schema
9812
+ *
9813
+ * @return {Promise<{ warnings: Array<any> }>}
9801
9814
  */
9802
9815
  importSchema(schema) {
9803
9816
  return new Promise((resolve, reject) => {
@@ -9826,15 +9839,15 @@ class FormEditor {
9826
9839
  });
9827
9840
  }
9828
9841
 
9829
- /**
9830
- * @returns {Schema}
9842
+ /**
9843
+ * @returns {Schema}
9831
9844
  */
9832
9845
  saveSchema() {
9833
9846
  return this.getSchema();
9834
9847
  }
9835
9848
 
9836
- /**
9837
- * @returns {Schema}
9849
+ /**
9850
+ * @returns {Schema}
9838
9851
  */
9839
9852
  getSchema() {
9840
9853
  const {
@@ -9843,8 +9856,8 @@ class FormEditor {
9843
9856
  return exportSchema(schema, this.exporter, schemaVersion);
9844
9857
  }
9845
9858
 
9846
- /**
9847
- * @param {Element|string} parentNode
9859
+ /**
9860
+ * @param {Element|string} parentNode
9848
9861
  */
9849
9862
  attachTo(parentNode) {
9850
9863
  if (!parentNode) {
@@ -9862,10 +9875,10 @@ class FormEditor {
9862
9875
  this._detach();
9863
9876
  }
9864
9877
 
9865
- /**
9866
- * @internal
9867
- *
9868
- * @param {boolean} [emit]
9878
+ /**
9879
+ * @internal
9880
+ *
9881
+ * @param {boolean} [emit]
9869
9882
  */
9870
9883
  _detach(emit = true) {
9871
9884
  const container = this._container,
@@ -9879,9 +9892,9 @@ class FormEditor {
9879
9892
  parentNode.removeChild(container);
9880
9893
  }
9881
9894
 
9882
- /**
9883
- * @param {any} property
9884
- * @param {any} value
9895
+ /**
9896
+ * @param {any} property
9897
+ * @param {any} value
9885
9898
  */
9886
9899
  setProperty(property, value) {
9887
9900
  const properties = set$1(this._getState().properties, [property], value);
@@ -9890,21 +9903,21 @@ class FormEditor {
9890
9903
  });
9891
9904
  }
9892
9905
 
9893
- /**
9894
- * @param {string} type
9895
- * @param {Function} handler
9906
+ /**
9907
+ * @param {string} type
9908
+ * @param {Function} handler
9896
9909
  */
9897
9910
  off(type, handler) {
9898
9911
  this.get('eventBus').off(type, handler);
9899
9912
  }
9900
9913
 
9901
- /**
9902
- * @internal
9903
- *
9904
- * @param {FormEditorOptions} options
9905
- * @param {Element} container
9906
- *
9907
- * @returns {Injector}
9914
+ /**
9915
+ * @internal
9916
+ *
9917
+ * @param {FormEditorOptions} options
9918
+ * @param {Element} container
9919
+ *
9920
+ * @returns {Injector}
9908
9921
  */
9909
9922
  _createInjector(options, container) {
9910
9923
  const {
@@ -9926,22 +9939,22 @@ class FormEditor {
9926
9939
  }, core, ...modules, ...additionalModules]);
9927
9940
  }
9928
9941
 
9929
- /**
9930
- * @internal
9942
+ /**
9943
+ * @internal
9931
9944
  */
9932
9945
  _emit(type, data) {
9933
9946
  this.get('eventBus').fire(type, data);
9934
9947
  }
9935
9948
 
9936
- /**
9937
- * @internal
9949
+ /**
9950
+ * @internal
9938
9951
  */
9939
9952
  _getState() {
9940
9953
  return this._state;
9941
9954
  }
9942
9955
 
9943
- /**
9944
- * @internal
9956
+ /**
9957
+ * @internal
9945
9958
  */
9946
9959
  _setState(state) {
9947
9960
  this._state = {
@@ -9951,15 +9964,15 @@ class FormEditor {
9951
9964
  this._emit('changed', this._getState());
9952
9965
  }
9953
9966
 
9954
- /**
9955
- * @internal
9967
+ /**
9968
+ * @internal
9956
9969
  */
9957
9970
  _getModules() {
9958
9971
  return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
9959
9972
  }
9960
9973
 
9961
- /**
9962
- * @internal
9974
+ /**
9975
+ * @internal
9963
9976
  */
9964
9977
  _onEvent(type, priority, handler) {
9965
9978
  this.get('eventBus').on(type, priority, handler);