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