@bpmn-io/form-js-editor 1.0.0-alpha.2 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,68 @@ 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
+ if (this.isSectionRendered) {
9626
+ callback();
9627
+ } else {
9628
+ const onSectionRendered = () => {
9629
+ callback();
9630
+ this._eventBus.off(`${this._sectionKey}.section.rendered`, onSectionRendered);
9631
+ };
9632
+ this._eventBus.on(`${this._sectionKey}.section.rendered`, onSectionRendered);
9633
+ }
9615
9634
  }
9616
9635
  }
9617
9636
 
@@ -9638,10 +9657,10 @@ var PropertiesPanelModule = {
9638
9657
  propertiesPanel: ['type', PropertiesPanelModule$1]
9639
9658
  };
9640
9659
 
9641
- /**
9642
- * Manages the rendering of visual plugins.
9643
- * @constructor
9644
- * @param {Object} eventBus - Event bus for the application.
9660
+ /**
9661
+ * Manages the rendering of visual plugins.
9662
+ * @constructor
9663
+ * @param {Object} eventBus - Event bus for the application.
9645
9664
  */
9646
9665
  class RenderInjector extends SectionModuleBase {
9647
9666
  constructor(eventBus) {
@@ -9650,10 +9669,10 @@ class RenderInjector extends SectionModuleBase {
9650
9669
  this.registeredRenderers = [];
9651
9670
  }
9652
9671
 
9653
- /**
9654
- * Inject a new renderer into the injector.
9655
- * @param {string} identifier - Identifier for the renderer.
9656
- * @param {Function} Renderer - The renderer function.
9672
+ /**
9673
+ * Inject a new renderer into the injector.
9674
+ * @param {string} identifier - Identifier for the renderer.
9675
+ * @param {Function} Renderer - The renderer function.
9657
9676
  */
9658
9677
  attachRenderer(identifier, Renderer) {
9659
9678
  this.registeredRenderers = [...this.registeredRenderers, {
@@ -9662,17 +9681,17 @@ class RenderInjector extends SectionModuleBase {
9662
9681
  }];
9663
9682
  }
9664
9683
 
9665
- /**
9666
- * Detach a renderer from the by key injector.
9667
- * @param {string} identifier - Identifier for the renderer.
9684
+ /**
9685
+ * Detach a renderer from the by key injector.
9686
+ * @param {string} identifier - Identifier for the renderer.
9668
9687
  */
9669
9688
  detachRenderer(identifier) {
9670
9689
  this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
9671
9690
  }
9672
9691
 
9673
- /**
9674
- * Returns the registered renderers.
9675
- * @returns {Array} Array of registered renderers.
9692
+ /**
9693
+ * Returns the registered renderers.
9694
+ * @returns {Array} Array of registered renderers.
9676
9695
  */
9677
9696
  fetchRenderers() {
9678
9697
  return this.registeredRenderers;
@@ -9706,48 +9725,48 @@ var ExpressionLanguageModule = {
9706
9725
 
9707
9726
  const ids = new Ids([32, 36, 1]);
9708
9727
 
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
9728
+ /**
9729
+ * @typedef { import('./types').Injector } Injector
9730
+ * @typedef { import('./types').Module } Module
9731
+ * @typedef { import('./types').Schema } Schema
9732
+ *
9733
+ * @typedef { import('./types').FormEditorOptions } FormEditorOptions
9734
+ * @typedef { import('./types').FormEditorProperties } FormEditorProperties
9735
+ *
9736
+ * @typedef { {
9737
+ * properties: FormEditorProperties,
9738
+ * schema: Schema
9739
+ * } } State
9740
+ *
9741
+ * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
9742
+ * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
9743
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
9725
9744
  */
9726
9745
 
9727
- /**
9728
- * The form editor.
9746
+ /**
9747
+ * The form editor.
9729
9748
  */
9730
9749
  class FormEditor {
9731
- /**
9732
- * @constructor
9733
- * @param {FormEditorOptions} options
9750
+ /**
9751
+ * @constructor
9752
+ * @param {FormEditorOptions} options
9734
9753
  */
9735
9754
  constructor(options = {}) {
9736
- /**
9737
- * @public
9738
- * @type {OnEventType}
9755
+ /**
9756
+ * @public
9757
+ * @type {OnEventType}
9739
9758
  */
9740
9759
  this.on = this._onEvent;
9741
9760
 
9742
- /**
9743
- * @public
9744
- * @type {String}
9761
+ /**
9762
+ * @public
9763
+ * @type {String}
9745
9764
  */
9746
9765
  this._id = ids.next();
9747
9766
 
9748
- /**
9749
- * @private
9750
- * @type {Element}
9767
+ /**
9768
+ * @private
9769
+ * @type {Element}
9751
9770
  */
9752
9771
  this._container = formJsViewer.createFormContainer();
9753
9772
  this._container.setAttribute('input-handle-modified-keys', 'z,y');
@@ -9758,15 +9777,15 @@ class FormEditor {
9758
9777
  properties = {}
9759
9778
  } = options;
9760
9779
 
9761
- /**
9762
- * @private
9763
- * @type {any}
9780
+ /**
9781
+ * @private
9782
+ * @type {any}
9764
9783
  */
9765
9784
  this.exporter = exporter;
9766
9785
 
9767
- /**
9768
- * @private
9769
- * @type {State}
9786
+ /**
9787
+ * @private
9788
+ * @type {State}
9770
9789
  */
9771
9790
  this._state = {
9772
9791
  properties,
@@ -9795,10 +9814,10 @@ class FormEditor {
9795
9814
  this._detach(false);
9796
9815
  }
9797
9816
 
9798
- /**
9799
- * @param {Schema} schema
9800
- *
9801
- * @return {Promise<{ warnings: Array<any> }>}
9817
+ /**
9818
+ * @param {Schema} schema
9819
+ *
9820
+ * @return {Promise<{ warnings: Array<any> }>}
9802
9821
  */
9803
9822
  importSchema(schema) {
9804
9823
  return new Promise((resolve, reject) => {
@@ -9827,15 +9846,15 @@ class FormEditor {
9827
9846
  });
9828
9847
  }
9829
9848
 
9830
- /**
9831
- * @returns {Schema}
9849
+ /**
9850
+ * @returns {Schema}
9832
9851
  */
9833
9852
  saveSchema() {
9834
9853
  return this.getSchema();
9835
9854
  }
9836
9855
 
9837
- /**
9838
- * @returns {Schema}
9856
+ /**
9857
+ * @returns {Schema}
9839
9858
  */
9840
9859
  getSchema() {
9841
9860
  const {
@@ -9844,8 +9863,8 @@ class FormEditor {
9844
9863
  return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
9845
9864
  }
9846
9865
 
9847
- /**
9848
- * @param {Element|string} parentNode
9866
+ /**
9867
+ * @param {Element|string} parentNode
9849
9868
  */
9850
9869
  attachTo(parentNode) {
9851
9870
  if (!parentNode) {
@@ -9863,10 +9882,10 @@ class FormEditor {
9863
9882
  this._detach();
9864
9883
  }
9865
9884
 
9866
- /**
9867
- * @internal
9868
- *
9869
- * @param {boolean} [emit]
9885
+ /**
9886
+ * @internal
9887
+ *
9888
+ * @param {boolean} [emit]
9870
9889
  */
9871
9890
  _detach(emit = true) {
9872
9891
  const container = this._container,
@@ -9880,9 +9899,9 @@ class FormEditor {
9880
9899
  parentNode.removeChild(container);
9881
9900
  }
9882
9901
 
9883
- /**
9884
- * @param {any} property
9885
- * @param {any} value
9902
+ /**
9903
+ * @param {any} property
9904
+ * @param {any} value
9886
9905
  */
9887
9906
  setProperty(property, value) {
9888
9907
  const properties = minDash.set(this._getState().properties, [property], value);
@@ -9891,21 +9910,21 @@ class FormEditor {
9891
9910
  });
9892
9911
  }
9893
9912
 
9894
- /**
9895
- * @param {string} type
9896
- * @param {Function} handler
9913
+ /**
9914
+ * @param {string} type
9915
+ * @param {Function} handler
9897
9916
  */
9898
9917
  off(type, handler) {
9899
9918
  this.get('eventBus').off(type, handler);
9900
9919
  }
9901
9920
 
9902
- /**
9903
- * @internal
9904
- *
9905
- * @param {FormEditorOptions} options
9906
- * @param {Element} container
9907
- *
9908
- * @returns {Injector}
9921
+ /**
9922
+ * @internal
9923
+ *
9924
+ * @param {FormEditorOptions} options
9925
+ * @param {Element} container
9926
+ *
9927
+ * @returns {Injector}
9909
9928
  */
9910
9929
  _createInjector(options, container) {
9911
9930
  const {
@@ -9927,22 +9946,22 @@ class FormEditor {
9927
9946
  }, core, ...modules, ...additionalModules]);
9928
9947
  }
9929
9948
 
9930
- /**
9931
- * @internal
9949
+ /**
9950
+ * @internal
9932
9951
  */
9933
9952
  _emit(type, data) {
9934
9953
  this.get('eventBus').fire(type, data);
9935
9954
  }
9936
9955
 
9937
- /**
9938
- * @internal
9956
+ /**
9957
+ * @internal
9939
9958
  */
9940
9959
  _getState() {
9941
9960
  return this._state;
9942
9961
  }
9943
9962
 
9944
- /**
9945
- * @internal
9963
+ /**
9964
+ * @internal
9946
9965
  */
9947
9966
  _setState(state) {
9948
9967
  this._state = {
@@ -9952,15 +9971,15 @@ class FormEditor {
9952
9971
  this._emit('changed', this._getState());
9953
9972
  }
9954
9973
 
9955
- /**
9956
- * @internal
9974
+ /**
9975
+ * @internal
9957
9976
  */
9958
9977
  _getModules() {
9959
9978
  return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, formJsViewer.MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
9960
9979
  }
9961
9980
 
9962
- /**
9963
- * @internal
9981
+ /**
9982
+ * @internal
9964
9983
  */
9965
9984
  _onEvent(type, priority, handler) {
9966
9985
  this.get('eventBus').on(type, priority, handler);