@bpmn-io/form-js-editor 1.3.0-alpha.0 → 1.3.0

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.es.js CHANGED
@@ -517,10 +517,10 @@ function invokeFunction(fn, args) {
517
517
  return fn.apply(null, args);
518
518
  }
519
519
 
520
- /**
521
- * A factory to create a configurable debouncer.
522
- *
523
- * @param {number|boolean} [config=true]
520
+ /**
521
+ * A factory to create a configurable debouncer.
522
+ *
523
+ * @param {number|boolean} [config=true]
524
524
  */
525
525
  function DebounceFactory(config = true) {
526
526
  const timeout = typeof config === 'number' ? config : config ? 300 : 0;
@@ -533,11 +533,11 @@ function DebounceFactory(config = true) {
533
533
  DebounceFactory.$inject = ['config.debounce'];
534
534
 
535
535
  class FormFieldRegistry extends FormFieldRegistry$1 {
536
- /**
537
- * Updates a form fields id.
538
- *
539
- * @param {Object} formField
540
- * @param {string} newId
536
+ /**
537
+ * Updates a form fields id.
538
+ *
539
+ * @param {Object} formField
540
+ * @param {string} newId
541
541
  */
542
542
  updateId(formField, newId) {
543
543
  this._validateId(newId);
@@ -558,13 +558,13 @@ class FormFieldRegistry extends FormFieldRegistry$1 {
558
558
  }
559
559
  }
560
560
 
561
- /**
562
- * Validate the suitability of the given id and signals a problem
563
- * with an exception.
564
- *
565
- * @param {string} id
566
- *
567
- * @throws {Error} if id is empty or already assigned
561
+ /**
562
+ * Validate the suitability of the given id and signals a problem
563
+ * with an exception.
564
+ *
565
+ * @param {string} id
566
+ *
567
+ * @throws {Error} if id is empty or already assigned
568
568
  */
569
569
  _validateId(id) {
570
570
  if (!id) {
@@ -581,11 +581,11 @@ const MAX_COLUMNS = 16;
581
581
  const MIN_COLUMNS = 2;
582
582
  const MAX_FIELDS_PER_ROW = 4;
583
583
  class FormLayoutValidator {
584
- /**
585
- * @constructor
586
- *
587
- * @param { import('./FormLayouter').default } formLayouter
588
- * @param { import('./FormFieldRegistry').default } formFieldRegistry
584
+ /**
585
+ * @constructor
586
+ *
587
+ * @param { import('./FormLayouter').default } formLayouter
588
+ * @param { import('./FormFieldRegistry').default } formFieldRegistry
589
589
  */
590
590
  constructor(formLayouter, formFieldRegistry) {
591
591
  this._formLayouter = formLayouter;
@@ -656,21 +656,21 @@ function editorFormFieldClasses(type, {
656
656
  });
657
657
  }
658
658
 
659
- /**
660
- * Add a dragger that calls back the passed function with
661
- * { event, delta } on drag.
662
- *
663
- * @example
664
- *
665
- * function dragMove(event, delta) {
666
- * // we are dragging (!!)
667
- * }
668
- *
669
- * domElement.addEventListener('dragstart', dragger(dragMove));
670
- *
671
- * @param {Function} fn
672
- *
673
- * @return {Function} drag start callback function
659
+ /**
660
+ * Add a dragger that calls back the passed function with
661
+ * { event, delta } on drag.
662
+ *
663
+ * @example
664
+ *
665
+ * function dragMove(event, delta) {
666
+ * // we are dragging (!!)
667
+ * }
668
+ *
669
+ * domElement.addEventListener('dragstart', dragger(dragMove));
670
+ *
671
+ * @param {Function} fn
672
+ *
673
+ * @return {Function} drag start callback function
674
674
  */
675
675
  function createDragger$1(fn) {
676
676
  let self;
@@ -711,12 +711,12 @@ function createDragger$1(fn) {
711
711
  return onDragStart;
712
712
  }
713
713
 
714
- /**
715
- * Throttle function call according UI update cycle.
716
- *
717
- * @param {Function} fn
718
- *
719
- * @return {Function} throttled fn
714
+ /**
715
+ * Throttle function call according UI update cycle.
716
+ *
717
+ * @param {Function} fn
718
+ *
719
+ * @return {Function} throttled fn
720
720
  */
721
721
  function throttle(fn) {
722
722
  let active = false;
@@ -750,11 +750,11 @@ const DragAndDropContext = createContext({
750
750
  });
751
751
  var DragAndDropContext$1 = DragAndDropContext;
752
752
 
753
- /**
754
- * @param {string} type
755
- * @param {boolean} [strict]
756
- *
757
- * @returns {any}
753
+ /**
754
+ * @param {string} type
755
+ * @param {boolean} [strict]
756
+ *
757
+ * @returns {any}
758
758
  */
759
759
  function getService$1(type, strict) {}
760
760
  const FormEditorContext = createContext({
@@ -1104,23 +1104,23 @@ var Slot = (props => {
1104
1104
  return fillsAndSeparators;
1105
1105
  });
1106
1106
 
1107
- /**
1108
- * Creates a Fragment for a fill.
1109
- *
1110
- * @param {Object} fill Fill to be rendered
1111
- * @returns {Object} Preact Fragment containing fill's children
1107
+ /**
1108
+ * Creates a Fragment for a fill.
1109
+ *
1110
+ * @param {Object} fill Fill to be rendered
1111
+ * @returns {Object} Preact Fragment containing fill's children
1112
1112
  */
1113
1113
  const FillFragment = fill => jsx(Fragment, {
1114
1114
  children: fill.children
1115
1115
  }, fill.id);
1116
1116
 
1117
- /**
1118
- * Creates an array of fills, with separators inserted between groups.
1119
- *
1120
- * @param {Array} groups Groups of fills
1121
- * @param {Function} fillRenderer Function to create a fill
1122
- * @param {Function} separatorRenderer Function to create a separator
1123
- * @returns {Array} Array of fills and separators
1117
+ /**
1118
+ * Creates an array of fills, with separators inserted between groups.
1119
+ *
1120
+ * @param {Array} groups Groups of fills
1121
+ * @param {Function} fillRenderer Function to create a fill
1122
+ * @param {Function} separatorRenderer Function to create a separator
1123
+ * @returns {Array} Array of fills and separators
1124
1124
  */
1125
1125
  const buildFills = (groups, fillRenderer, separatorRenderer) => {
1126
1126
  const result = [];
@@ -1138,8 +1138,8 @@ const buildFills = (groups, fillRenderer, separatorRenderer) => {
1138
1138
  return result;
1139
1139
  };
1140
1140
 
1141
- /**
1142
- * Groups fills by group name property.
1141
+ /**
1142
+ * Groups fills by group name property.
1143
1143
  */
1144
1144
  const _groupByGroupName = fills => {
1145
1145
  const groups = [];
@@ -1159,8 +1159,8 @@ const _groupByGroupName = fills => {
1159
1159
  return Object.keys(groupsById).sort().map(id => groupsById[id]);
1160
1160
  };
1161
1161
 
1162
- /**
1163
- * Compares fills by priority.
1162
+ /**
1163
+ * Compares fills by priority.
1164
1164
  */
1165
1165
  const _comparePriority = (a, b) => {
1166
1166
  return (b.priority || 0) - (a.priority || 0);
@@ -1388,20 +1388,20 @@ const DRAG_NO_DROP_CLS = 'fjs-no-drop';
1388
1388
  const DRAG_NO_MOVE_CLS = 'fjs-no-move';
1389
1389
  const ERROR_DROP_CLS = 'fjs-error-drop';
1390
1390
 
1391
- /**
1392
- * @typedef { { id: String, components: Array<any> } } FormRow
1391
+ /**
1392
+ * @typedef { { id: String, components: Array<any> } } FormRow
1393
1393
  */
1394
1394
 
1395
1395
  class Dragging {
1396
- /**
1397
- * @constructor
1398
- *
1399
- * @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
1400
- * @param { import('../../core/FormLayouter').default } formLayouter
1401
- * @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
1402
- * @param { import('../../core/EventBus').default } eventBus
1403
- * @param { import('../modeling/Modeling').default } modeling
1404
- * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
1396
+ /**
1397
+ * @constructor
1398
+ *
1399
+ * @param { import('../../core/FormFieldRegistry').default } formFieldRegistry
1400
+ * @param { import('../../core/FormLayouter').default } formLayouter
1401
+ * @param { import('../../core/FormLayoutValidator').default } formLayoutValidator
1402
+ * @param { import('../../core/EventBus').default } eventBus
1403
+ * @param { import('../modeling/Modeling').default } modeling
1404
+ * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
1405
1405
  */
1406
1406
  constructor(formFieldRegistry, formLayouter, formLayoutValidator, eventBus, modeling, pathRegistry) {
1407
1407
  this._formFieldRegistry = formFieldRegistry;
@@ -1412,13 +1412,13 @@ class Dragging {
1412
1412
  this._pathRegistry = pathRegistry;
1413
1413
  }
1414
1414
 
1415
- /**
1416
- * Calculcates position in form schema given the dropped place.
1417
- *
1418
- * @param { FormRow } targetRow
1419
- * @param { any } targetFormField
1420
- * @param { HTMLElement } sibling
1421
- * @returns { number }
1415
+ /**
1416
+ * Calculcates position in form schema given the dropped place.
1417
+ *
1418
+ * @param { FormRow } targetRow
1419
+ * @param { any } targetFormField
1420
+ * @param { HTMLElement } sibling
1421
+ * @returns { number }
1422
1422
  */
1423
1423
  getTargetIndex(targetRow, targetFormField, sibling) {
1424
1424
  /** @type HTMLElement */
@@ -1559,8 +1559,8 @@ class Dragging {
1559
1559
  }
1560
1560
  }
1561
1561
 
1562
- /**
1563
- * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
1562
+ /**
1563
+ * @param { { container: Array<string>, direction: string, mirrorContainer: string } } options
1564
1564
  */
1565
1565
  createDragulaInstance(options) {
1566
1566
  const {
@@ -1974,7 +1974,7 @@ function DebugColumns(props) {
1974
1974
  return null;
1975
1975
  }
1976
1976
  return jsx("div", {
1977
- 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;",
1977
+ 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;",
1978
1978
  class: "fjs-debug-columns",
1979
1979
  children: (field.layout || {}).columns || 'auto'
1980
1980
  });
@@ -3045,10 +3045,10 @@ function updateRow(formField, rowId) {
3045
3045
  }
3046
3046
 
3047
3047
  class AddFormFieldHandler {
3048
- /**
3049
- * @constructor
3050
- * @param { import('../../../FormEditor').default } formEditor
3051
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3048
+ /**
3049
+ * @constructor
3050
+ * @param { import('../../../FormEditor').default } formEditor
3051
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3052
3052
  */
3053
3053
  constructor(formEditor, formFieldRegistry) {
3054
3054
  this._formEditor = formEditor;
@@ -3109,10 +3109,10 @@ class AddFormFieldHandler {
3109
3109
  AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
3110
3110
 
3111
3111
  class EditFormFieldHandler {
3112
- /**
3113
- * @constructor
3114
- * @param { import('../../../FormEditor').default } formEditor
3115
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3112
+ /**
3113
+ * @constructor
3114
+ * @param { import('../../../FormEditor').default } formEditor
3115
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3116
3116
  */
3117
3117
  constructor(formEditor, formFieldRegistry) {
3118
3118
  this._formEditor = formEditor;
@@ -3175,11 +3175,11 @@ class EditFormFieldHandler {
3175
3175
  EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
3176
3176
 
3177
3177
  class MoveFormFieldHandler {
3178
- /**
3179
- * @constructor
3180
- * @param { import('../../../FormEditor').default } formEditor
3181
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3182
- * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3178
+ /**
3179
+ * @constructor
3180
+ * @param { import('../../../FormEditor').default } formEditor
3181
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3182
+ * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3183
3183
  */
3184
3184
  constructor(formEditor, formFieldRegistry, pathRegistry) {
3185
3185
  this._formEditor = formEditor;
@@ -3284,10 +3284,10 @@ class MoveFormFieldHandler {
3284
3284
  MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry', 'pathRegistry'];
3285
3285
 
3286
3286
  class RemoveFormFieldHandler {
3287
- /**
3288
- * @constructor
3289
- * @param { import('../../../FormEditor').default } formEditor
3290
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3287
+ /**
3288
+ * @constructor
3289
+ * @param { import('../../../FormEditor').default } formEditor
3290
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3291
3291
  */
3292
3292
  constructor(formEditor, formFieldRegistry) {
3293
3293
  this._formEditor = formEditor;
@@ -3347,9 +3347,9 @@ class RemoveFormFieldHandler {
3347
3347
  RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
3348
3348
 
3349
3349
  class UpdateIdClaimHandler {
3350
- /**
3351
- * @constructor
3352
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3350
+ /**
3351
+ * @constructor
3352
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
3353
3353
  */
3354
3354
  constructor(formFieldRegistry) {
3355
3355
  this._formFieldRegistry = formFieldRegistry;
@@ -3382,9 +3382,9 @@ class UpdateIdClaimHandler {
3382
3382
  UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
3383
3383
 
3384
3384
  class UpdateKeyClaimHandler {
3385
- /**
3386
- * @constructor
3387
- * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3385
+ /**
3386
+ * @constructor
3387
+ * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3388
3388
  */
3389
3389
  constructor(pathRegistry) {
3390
3390
  this._pathRegistry = pathRegistry;
@@ -3425,9 +3425,9 @@ class UpdateKeyClaimHandler {
3425
3425
  UpdateKeyClaimHandler.$inject = ['pathRegistry'];
3426
3426
 
3427
3427
  class UpdatePathClaimHandler {
3428
- /**
3429
- * @constructor
3430
- * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3428
+ /**
3429
+ * @constructor
3430
+ * @param { import('@bpmn-io/form-js-viewer').PathRegistry } pathRegistry
3431
3431
  */
3432
3432
  constructor(pathRegistry) {
3433
3433
  this._pathRegistry = pathRegistry;
@@ -3989,8 +3989,8 @@ class ValidateBehavior extends CommandInterceptor {
3989
3989
  constructor(eventBus) {
3990
3990
  super(eventBus);
3991
3991
 
3992
- /**
3993
- * Remove custom validation if <validationType> is about to be added.
3992
+ /**
3993
+ * Remove custom validation if <validationType> is about to be added.
3994
3994
  */
3995
3995
  this.preExecute('formField.edit', function (context) {
3996
3996
  const {
@@ -4570,22 +4570,22 @@ var SelectionModule = {
4570
4570
  selectionBehavior: ['type', SelectionBehavior]
4571
4571
  };
4572
4572
 
4573
- /**
4574
- * Base class for sectionable UI modules.
4575
- *
4576
- * @property {EventBus} _eventBus - EventBus instance used for event handling.
4577
- * @property {string} managerType - Type of the render manager. Used to form event names.
4578
- *
4579
- * @class SectionModuleBase
4573
+ /**
4574
+ * Base class for sectionable UI modules.
4575
+ *
4576
+ * @property {EventBus} _eventBus - EventBus instance used for event handling.
4577
+ * @property {string} managerType - Type of the render manager. Used to form event names.
4578
+ *
4579
+ * @class SectionModuleBase
4580
4580
  */
4581
4581
  class SectionModuleBase {
4582
- /**
4583
- * Create a SectionModuleBase instance.
4584
- *
4585
- * @param {any} eventBus - The EventBus instance used for event handling.
4586
- * @param {string} sectionKey - The type of render manager. Used to form event names.
4587
- *
4588
- * @constructor
4582
+ /**
4583
+ * Create a SectionModuleBase instance.
4584
+ *
4585
+ * @param {any} eventBus - The EventBus instance used for event handling.
4586
+ * @param {string} sectionKey - The type of render manager. Used to form event names.
4587
+ *
4588
+ * @constructor
4589
4589
  */
4590
4590
  constructor(eventBus, sectionKey) {
4591
4591
  this._eventBus = eventBus;
@@ -4598,10 +4598,10 @@ class SectionModuleBase {
4598
4598
  });
4599
4599
  }
4600
4600
 
4601
- /**
4602
- * Attach the managed section to a parent node.
4603
- *
4604
- * @param {HTMLElement} container - The parent node to attach to.
4601
+ /**
4602
+ * Attach the managed section to a parent node.
4603
+ *
4604
+ * @param {HTMLElement} container - The parent node to attach to.
4605
4605
  */
4606
4606
  attachTo(container) {
4607
4607
  this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.attach`, {
@@ -4609,22 +4609,22 @@ class SectionModuleBase {
4609
4609
  }));
4610
4610
  }
4611
4611
 
4612
- /**
4613
- * Detach the managed section from its parent node.
4612
+ /**
4613
+ * Detach the managed section from its parent node.
4614
4614
  */
4615
4615
  detach() {
4616
4616
  this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.detach`));
4617
4617
  }
4618
4618
 
4619
- /**
4620
- * Reset the managed section to its initial state.
4619
+ /**
4620
+ * Reset the managed section to its initial state.
4621
4621
  */
4622
4622
  reset() {
4623
4623
  this._onceSectionRendered(() => this._eventBus.fire(`${this._sectionKey}.reset`));
4624
4624
  }
4625
4625
 
4626
- /**
4627
- * Circumvents timing issues.
4626
+ /**
4627
+ * Circumvents timing issues.
4628
4628
  */
4629
4629
  _onceSectionRendered(callback) {
4630
4630
  if (this.isSectionRendered) {
@@ -4875,18 +4875,25 @@ function Tooltip(props) {
4875
4875
  parent
4876
4876
  } = props;
4877
4877
  const [visible, setShow] = useState(false);
4878
+ const [focusedViaKeyboard, setFocusedViaKeyboard] = useState(false);
4878
4879
  let timeout = null;
4879
4880
  const wrapperRef = useRef$1(null);
4880
4881
  const tooltipRef = useRef$1(null);
4881
4882
  const showTooltip = async event => {
4882
- const show = () => !visible && setShow(true);
4883
- if (event instanceof MouseEvent) {
4884
- timeout = setTimeout(show, 200);
4885
- } else {
4886
- show();
4883
+ const show = () => setShow(true);
4884
+ if (!visible && !timeout) {
4885
+ if (event instanceof MouseEvent) {
4886
+ timeout = setTimeout(show, 200);
4887
+ } else {
4888
+ show();
4889
+ setFocusedViaKeyboard(true);
4890
+ }
4887
4891
  }
4888
4892
  };
4889
- const hideTooltip = () => setShow(false);
4893
+ const hideTooltip = () => {
4894
+ setShow(false);
4895
+ setFocusedViaKeyboard(false);
4896
+ };
4890
4897
  const hideTooltipViaEscape = e => {
4891
4898
  e.code === 'Escape' && hideTooltip();
4892
4899
  };
@@ -4910,7 +4917,7 @@ function Tooltip(props) {
4910
4917
  if (visible && !isTooltipHovered({
4911
4918
  x: e.x,
4912
4919
  y: e.y
4913
- }) && !isFocused) {
4920
+ }) && !(isFocused && focusedViaKeyboard)) {
4914
4921
  hideTooltip();
4915
4922
  }
4916
4923
  };
@@ -4918,8 +4925,8 @@ function Tooltip(props) {
4918
4925
  const {
4919
4926
  relatedTarget
4920
4927
  } = e;
4921
- const isTooltipChild = el => el && !!el.closest('.bio-properties-panel-tooltip');
4922
- if (visible && !isHovered(wrapperRef.current) && !isTooltipChild(relatedTarget)) {
4928
+ const isTooltipChild = el => !!el.closest('.bio-properties-panel-tooltip');
4929
+ if (visible && !isHovered(wrapperRef.current) && relatedTarget && !isTooltipChild(relatedTarget)) {
4923
4930
  hideTooltip();
4924
4931
  }
4925
4932
  };
@@ -4931,7 +4938,7 @@ function Tooltip(props) {
4931
4938
  document.removeEventListener('mousemove', hideHoveredTooltip);
4932
4939
  document.removeEventListener('focusout', hideFocusedTooltip);
4933
4940
  };
4934
- }, [wrapperRef.current, visible]);
4941
+ }, [wrapperRef.current, visible, focusedViaKeyboard]);
4935
4942
  const renderTooltip = () => {
4936
4943
  return jsxs("div", {
4937
4944
  class: "bio-properties-panel-tooltip",
@@ -4954,12 +4961,12 @@ function Tooltip(props) {
4954
4961
  tabIndex: "0",
4955
4962
  ref: wrapperRef,
4956
4963
  onMouseEnter: showTooltip,
4957
- onMouseLeave: () => clearTimeout(timeout),
4964
+ onMouseLeave: () => {
4965
+ clearTimeout(timeout);
4966
+ timeout = null;
4967
+ },
4958
4968
  onFocus: showTooltip,
4959
4969
  onKeyDown: hideTooltipViaEscape,
4960
- onMouseDown: e => {
4961
- e.preventDefault();
4962
- },
4963
4970
  children: [props.children, visible ? parent ? createPortal(renderTooltip(), parent.current) : renderTooltip() : null]
4964
4971
  });
4965
4972
  }
@@ -5269,7 +5276,8 @@ function Group(props) {
5269
5276
  class: classnames('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''),
5270
5277
  onClick: toggleOpen,
5271
5278
  children: [jsx("div", {
5272
- title: label,
5279
+ title: props.tooltip ? null : label,
5280
+ "data-title": label,
5273
5281
  class: "bio-properties-panel-group-header-title",
5274
5282
  children: jsx(TooltipWrapper, {
5275
5283
  value: props.tooltip,
@@ -5711,6 +5719,7 @@ const noop$3 = () => {};
5711
5719
  * @param {Object} props
5712
5720
  * @param {HTMLElement} [props.container]
5713
5721
  * @param {string} [props.className]
5722
+ * @param {boolean} [props.delayInitialFocus]
5714
5723
  * @param {{x: number, y: number}} [props.position]
5715
5724
  * @param {number} [props.width]
5716
5725
  * @param {number} [props.height]
@@ -5718,12 +5727,14 @@ const noop$3 = () => {};
5718
5727
  * @param {Function} [props.onPostActivate]
5719
5728
  * @param {Function} [props.onPostDeactivate]
5720
5729
  * @param {boolean} [props.returnFocus]
5730
+ * @param {boolean} [props.closeOnEscape]
5721
5731
  * @param {string} props.title
5722
5732
  */
5723
5733
  function Popup(props) {
5724
5734
  const {
5725
5735
  container,
5726
5736
  className,
5737
+ delayInitialFocus,
5727
5738
  position,
5728
5739
  width,
5729
5740
  height,
@@ -5731,12 +5742,15 @@ function Popup(props) {
5731
5742
  onPostActivate = noop$3,
5732
5743
  onPostDeactivate = noop$3,
5733
5744
  returnFocus = true,
5745
+ closeOnEscape = true,
5734
5746
  title
5735
5747
  } = props;
5736
5748
  const focusTrapRef = useRef$1(null);
5737
5749
  const popupRef = useRef$1(null);
5738
- const handleKeyPress = event => {
5739
- if (event.key === 'Escape') {
5750
+ const handleKeydown = event => {
5751
+ // do not allow keyboard events to bubble
5752
+ event.stopPropagation();
5753
+ if (closeOnEscape && event.key === 'Escape') {
5740
5754
  onClose();
5741
5755
  }
5742
5756
  };
@@ -5761,14 +5775,6 @@ function Popup(props) {
5761
5775
  if (height) {
5762
5776
  style.height = height + 'px';
5763
5777
  }
5764
- useEffect(() => {
5765
- if (popupRef.current) {
5766
- popupRef.current.addEventListener('keydown', handleKeyPress);
5767
- }
5768
- return () => {
5769
- popupRef.current.removeEventListener('keydown', handleKeyPress);
5770
- };
5771
- }, [popupRef]);
5772
5778
  useEffect(() => {
5773
5779
  if (popupRef.current) {
5774
5780
  popupRef.current.addEventListener('focusin', handleFocus);
@@ -5781,6 +5787,7 @@ function Popup(props) {
5781
5787
  if (popupRef.current) {
5782
5788
  focusTrapRef.current = focusTrap.createFocusTrap(popupRef.current, {
5783
5789
  clickOutsideDeactivates: true,
5790
+ delayInitialFocus,
5784
5791
  fallbackFocus: popupRef.current,
5785
5792
  onPostActivate,
5786
5793
  onPostDeactivate,
@@ -5794,6 +5801,7 @@ function Popup(props) {
5794
5801
  "aria-label": title,
5795
5802
  tabIndex: -1,
5796
5803
  ref: popupRef,
5804
+ onKeyDown: handleKeydown,
5797
5805
  role: "dialog",
5798
5806
  class: classnames('bio-properties-panel-popup', className),
5799
5807
  style: style,
@@ -5906,22 +5914,36 @@ const FEEL_POPUP_HEIGHT = 250;
5906
5914
  */
5907
5915
  function FEELPopupRoot(props) {
5908
5916
  const {
5909
- element
5917
+ element,
5918
+ eventBus = {
5919
+ fire() {},
5920
+ on() {},
5921
+ off() {}
5922
+ },
5923
+ popupContainer
5910
5924
  } = props;
5911
5925
  const prevElement = usePrevious(element);
5912
5926
  const [popupConfig, setPopupConfig] = useState({});
5913
5927
  const [open, setOpen] = useState(false);
5914
5928
  const [source, setSource] = useState(null);
5915
5929
  const [sourceElement, setSourceElement] = useState(null);
5916
- const handleOpen = (key, config, _sourceElement) => {
5917
- setSource(key);
5930
+ const emit = (type, context) => {
5931
+ eventBus.fire('feelPopup.' + type, context);
5932
+ };
5933
+ const isOpen = useCallback(() => {
5934
+ return !!open;
5935
+ }, [open]);
5936
+ const handleOpen = (entryId, config, _sourceElement) => {
5937
+ setSource(entryId);
5918
5938
  setPopupConfig(config);
5919
5939
  setOpen(true);
5920
5940
  setSourceElement(_sourceElement);
5941
+ emit('opened');
5921
5942
  };
5922
5943
  const handleClose = () => {
5923
5944
  setOpen(false);
5924
5945
  setSource(null);
5946
+ emit('closed');
5925
5947
  };
5926
5948
  const feelPopupContext = {
5927
5949
  open: handleOpen,
@@ -5931,14 +5953,38 @@ function FEELPopupRoot(props) {
5931
5953
 
5932
5954
  // close popup on element change, cf. https://github.com/bpmn-io/properties-panel/issues/270
5933
5955
  useEffect(() => {
5934
- if (element && element !== prevElement) {
5956
+ if (element && prevElement && element !== prevElement) {
5935
5957
  handleClose();
5936
5958
  }
5937
5959
  }, [element]);
5960
+
5961
+ // allow close and open via events
5962
+ useEffect(() => {
5963
+ const handlePopupOpen = context => {
5964
+ const {
5965
+ entryId,
5966
+ popupConfig,
5967
+ sourceElement
5968
+ } = context;
5969
+ handleOpen(entryId, popupConfig, sourceElement);
5970
+ };
5971
+ const handleIsOpen = () => {
5972
+ return isOpen();
5973
+ };
5974
+ eventBus.on('feelPopup._close', handleClose);
5975
+ eventBus.on('feelPopup._open', handlePopupOpen);
5976
+ eventBus.on('feelPopup._isOpen', handleIsOpen);
5977
+ return () => {
5978
+ eventBus.off('feelPopup._close', handleClose);
5979
+ eventBus.off('feelPopup._open', handleOpen);
5980
+ eventBus.off('feelPopup._isOpen', handleIsOpen);
5981
+ };
5982
+ }, [eventBus, isOpen]);
5938
5983
  return jsxs(FeelPopupContext.Provider, {
5939
5984
  value: feelPopupContext,
5940
5985
  children: [open && jsx(FeelPopupComponent, {
5941
5986
  onClose: handleClose,
5987
+ container: popupContainer,
5942
5988
  sourceElement: sourceElement,
5943
5989
  ...popupConfig
5944
5990
  }), props.children]
@@ -5946,6 +5992,7 @@ function FEELPopupRoot(props) {
5946
5992
  }
5947
5993
  function FeelPopupComponent(props) {
5948
5994
  const {
5995
+ container,
5949
5996
  id,
5950
5997
  hostLanguage,
5951
5998
  onInput,
@@ -5960,16 +6007,30 @@ function FeelPopupComponent(props) {
5960
6007
  variables
5961
6008
  } = props;
5962
6009
  const editorRef = useRef$1();
6010
+ const isAutoCompletionOpen = useRef$1(false);
5963
6011
  const handleSetReturnFocus = () => {
5964
6012
  sourceElement && sourceElement.focus();
5965
6013
  };
5966
- useEffect(() => {
5967
- const editor = editorRef.current;
5968
- if (editor) {
5969
- editor.focus();
6014
+ const onKeyDownCapture = event => {
6015
+ // we use capture here to make sure we handle the event before the editor does
6016
+ if (event.key === 'Escape') {
6017
+ isAutoCompletionOpen.current = autoCompletionOpen(event.target);
6018
+ }
6019
+ };
6020
+ const onKeyDown = event => {
6021
+ if (event.key === 'Escape') {
6022
+ // close popup only if auto completion is not open
6023
+ // we need to do check this because the editor is not
6024
+ // stop propagating the keydown event
6025
+ // cf. https://discuss.codemirror.net/t/how-can-i-replace-the-default-autocompletion-keymap-v6/3322/5
6026
+ if (!isAutoCompletionOpen.current) {
6027
+ onClose();
6028
+ isAutoCompletionOpen.current = false;
6029
+ }
5970
6030
  }
5971
- }, [editorRef, id]);
6031
+ };
5972
6032
  return jsxs(Popup, {
6033
+ container: container,
5973
6034
  className: "bio-properties-panel-feel-popup",
5974
6035
  position: position,
5975
6036
  title: title,
@@ -5979,6 +6040,8 @@ function FeelPopupComponent(props) {
5979
6040
  ,
5980
6041
 
5981
6042
  returnFocus: false,
6043
+ closeOnEscape: false,
6044
+ delayInitialFocus: false,
5982
6045
  onPostDeactivate: handleSetReturnFocus,
5983
6046
  height: FEEL_POPUP_HEIGHT,
5984
6047
  width: FEEL_POPUP_WIDTH,
@@ -5987,6 +6050,8 @@ function FeelPopupComponent(props) {
5987
6050
  draggable: true
5988
6051
  }), jsx(Popup.Body, {
5989
6052
  children: jsxs("div", {
6053
+ onKeyDownCapture: onKeyDownCapture,
6054
+ onKeyDown: onKeyDown,
5990
6055
  class: "bio-properties-panel-feel-popup__body",
5991
6056
  children: [type === 'feel' && jsx(CodeEditor, {
5992
6057
  enableGutters: true,
@@ -6028,6 +6093,9 @@ function FeelPopupComponent(props) {
6028
6093
  function prefixId$8(id) {
6029
6094
  return `bio-properties-panel-${id}`;
6030
6095
  }
6096
+ function autoCompletionOpen(element) {
6097
+ return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
6098
+ }
6031
6099
  function ToggleSwitch(props) {
6032
6100
  const {
6033
6101
  id,
@@ -6774,7 +6842,7 @@ function FeelEntry(props) {
6774
6842
  setLocalError(err);
6775
6843
  }, []);
6776
6844
  const temporaryError = useError(id);
6777
- const error = localError || temporaryError || validationError;
6845
+ const error = temporaryError || localError || validationError;
6778
6846
  return jsxs("div", {
6779
6847
  class: classnames(props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
6780
6848
  "data-entry-id": id,
@@ -7010,6 +7078,7 @@ const DEFAULT_TOOLTIP = {};
7010
7078
  * @param {Function} [props.descriptionLoaded]
7011
7079
  * @param {TooltipConfig} [props.tooltipConfig]
7012
7080
  * @param {Function} [props.tooltipLoaded]
7081
+ * @param {HTMLElement} [props.feelPopupContainer]
7013
7082
  * @param {Object} [props.eventBus]
7014
7083
  */
7015
7084
  function PropertiesPanel(props) {
@@ -7024,6 +7093,7 @@ function PropertiesPanel(props) {
7024
7093
  descriptionLoaded,
7025
7094
  tooltipConfig,
7026
7095
  tooltipLoaded,
7096
+ feelPopupContainer,
7027
7097
  eventBus
7028
7098
  } = props;
7029
7099
 
@@ -7126,6 +7196,8 @@ function PropertiesPanel(props) {
7126
7196
  value: eventContext,
7127
7197
  children: jsx(FEELPopupRoot, {
7128
7198
  element: element,
7199
+ eventBus: eventBus,
7200
+ popupContainer: feelPopupContainer,
7129
7201
  children: jsxs("div", {
7130
7202
  class: "bio-properties-panel",
7131
7203
  children: [jsx(Header, {
@@ -7425,7 +7497,8 @@ function ListGroup(props) {
7425
7497
  class: classnames('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''),
7426
7498
  onClick: hasItems ? toggleOpen : noop$1,
7427
7499
  children: [jsx("div", {
7428
- title: label,
7500
+ title: props.tooltip ? null : label,
7501
+ "data-title": label,
7429
7502
  class: "bio-properties-panel-group-header-title",
7430
7503
  children: jsx(TooltipWrapper, {
7431
7504
  value: props.tooltip,
@@ -8063,12 +8136,51 @@ function isEdited(node) {
8063
8136
  function prefixId(id) {
8064
8137
  return `bio-properties-panel-${id}`;
8065
8138
  }
8139
+ class FeelPopupModule {
8140
+ constructor(eventBus) {
8141
+ this._eventBus = eventBus;
8142
+ }
8066
8143
 
8067
- /**
8068
- * @param {string} type
8069
- * @param {boolean} [strict]
8070
- *
8071
- * @returns {any}
8144
+ /**
8145
+ * Check if the FEEL popup is open.
8146
+ * @return {Boolean}
8147
+ */
8148
+ isOpen() {
8149
+ return this._eventBus.fire('feelPopup._isOpen');
8150
+ }
8151
+
8152
+ /**
8153
+ * Open the FEEL popup.
8154
+ *
8155
+ * @param {String} entryId
8156
+ * @param {Object} popupConfig
8157
+ * @param {HTMLElement} sourceElement
8158
+ */
8159
+ open(entryId, popupConfig, sourceElement) {
8160
+ return this._eventBus.fire('feelPopup._open', {
8161
+ entryId,
8162
+ popupConfig,
8163
+ sourceElement
8164
+ });
8165
+ }
8166
+
8167
+ /**
8168
+ * Close the FEEL popup.
8169
+ */
8170
+ close() {
8171
+ return this._eventBus.fire('feelPopup._close');
8172
+ }
8173
+ }
8174
+ FeelPopupModule.$inject = ['eventBus'];
8175
+ var index = {
8176
+ feelPopup: ['type', FeelPopupModule]
8177
+ };
8178
+
8179
+ /**
8180
+ * @param {string} type
8181
+ * @param {boolean} [strict]
8182
+ *
8183
+ * @returns {any}
8072
8184
  */
8073
8185
  function getService(type, strict) {}
8074
8186
  const PropertiesPanelContext = createContext({
@@ -8165,8 +8277,8 @@ const PropertiesPanelHeaderProvider = {
8165
8277
  }
8166
8278
  };
8167
8279
 
8168
- /**
8169
- * Provide placeholders for empty and multiple state.
8280
+ /**
8281
+ * Provide placeholders for empty and multiple state.
8170
8282
  */
8171
8283
  const PropertiesPanelPlaceholderProvider = {
8172
8284
  getEmpty: () => {
@@ -8238,10 +8350,10 @@ function useService (type, strict) {
8238
8350
  return getService(type, strict);
8239
8351
  }
8240
8352
 
8241
- /**
8242
- * Retrieve list of variables from the form schema.
8243
- *
8244
- * @returns { string[] } list of variables used in form schema
8353
+ /**
8354
+ * Retrieve list of variables from the form schema.
8355
+ *
8356
+ * @returns { string[] } list of variables used in form schema
8245
8357
  */
8246
8358
  function useVariables() {
8247
8359
  const form = useService('formEditor');
@@ -9892,14 +10004,14 @@ function Value(props) {
9892
10004
 
9893
10005
  // helpers //////////
9894
10006
 
9895
- /**
9896
- * Returns copy of object with updated value.
9897
- *
9898
- * @param {Object} properties
9899
- * @param {string} key
9900
- * @param {string} value
9901
- *
9902
- * @returns {Object}
10007
+ /**
10008
+ * Returns copy of object with updated value.
10009
+ *
10010
+ * @param {Object} properties
10011
+ * @param {string} key
10012
+ * @param {string} value
10013
+ *
10014
+ * @returns {Object}
9903
10015
  */
9904
10016
  function updateValue(properties, key, value) {
9905
10017
  return {
@@ -9908,14 +10020,14 @@ function updateValue(properties, key, value) {
9908
10020
  };
9909
10021
  }
9910
10022
 
9911
- /**
9912
- * Returns copy of object with updated key.
9913
- *
9914
- * @param {Object} properties
9915
- * @param {string} oldKey
9916
- * @param {string} newKey
9917
- *
9918
- * @returns {Object}
10023
+ /**
10024
+ * Returns copy of object with updated key.
10025
+ *
10026
+ * @param {Object} properties
10027
+ * @param {string} oldKey
10028
+ * @param {string} newKey
10029
+ *
10030
+ * @returns {Object}
9919
10031
  */
9920
10032
  function updateKey(properties, oldKey, newKey) {
9921
10033
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -10729,7 +10841,8 @@ function ValidationType(props) {
10729
10841
  id,
10730
10842
  label: 'Validation pattern',
10731
10843
  setValue,
10732
- getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
10844
+ getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS),
10845
+ tooltip: getValue('validationType')() === VALIDATION_TYPE_OPTIONS.phone.value ? 'The built-in phone validation pattern is based on the E.164 standard with no spaces. Ex: +491234567890' : undefined
10733
10846
  });
10734
10847
  }
10735
10848
 
@@ -10747,13 +10860,13 @@ function ValuesGroups(field, editField) {
10747
10860
  };
10748
10861
  const valuesSourceId = `${fieldId}-valuesSource`;
10749
10862
 
10750
- /**
10751
- * @type {Array<Group|ListGroup>}
10863
+ /**
10864
+ * @type {Array<Group|ListGroup>}
10752
10865
  */
10753
10866
  const groups = [{
10754
10867
  id: valuesSourceId,
10755
10868
  label: 'Options source',
10756
- tooltip: '"Static" defines a constant, predefined set of form options.\n"Dynamic" defines options that are populated dynamically, adjusting based on variable data for flexible responses to different conditions or inputs.',
10869
+ tooltip: getValuesTooltip(),
10757
10870
  component: Group,
10758
10871
  entries: ValuesSourceSelectEntry({
10759
10872
  ...context,
@@ -10798,6 +10911,12 @@ function ValuesGroups(field, editField) {
10798
10911
  return groups;
10799
10912
  }
10800
10913
 
10914
+ // helpers //////////
10915
+
10916
+ function getValuesTooltip() {
10917
+ return '"Static" defines a constant, predefined set of form options.\n\n' + '"Input data" defines options that are populated dynamically, adjusting based on variable data for flexible responses to different conditions or inputs.\n\n' + '"Expression" defines options that are populated from a FEEL expression.';
10918
+ }
10919
+
10801
10920
  function CustomPropertiesGroup(field, editField) {
10802
10921
  const {
10803
10922
  properties = {},
@@ -10863,13 +10982,13 @@ function CustomPropertiesGroup(field, editField) {
10863
10982
 
10864
10983
  // helpers //////////
10865
10984
 
10866
- /**
10867
- * Returns copy of object without key.
10868
- *
10869
- * @param {Object} properties
10870
- * @param {string} oldKey
10871
- *
10872
- * @returns {Object}
10985
+ /**
10986
+ * Returns copy of object without key.
10987
+ *
10988
+ * @param {Object} properties
10989
+ * @param {string} oldKey
10990
+ *
10991
+ * @returns {Object}
10873
10992
  */
10874
10993
  function removeKey(properties, oldKey) {
10875
10994
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -10955,6 +11074,10 @@ function FormPropertiesPanel(props) {
10955
11074
  const formEditor = injector.get('formEditor');
10956
11075
  const modeling = injector.get('modeling');
10957
11076
  const selectionModule = injector.get('selection');
11077
+ const propertiesPanelConfig = injector.get('config.propertiesPanel') || {};
11078
+ const {
11079
+ feelPopupContainer
11080
+ } = propertiesPanelConfig;
10958
11081
  const [state, setState] = useState({
10959
11082
  selectedFormField: selectionModule.get() || formEditor._getState().schema
10960
11083
  });
@@ -10972,9 +11095,9 @@ function FormPropertiesPanel(props) {
10972
11095
  });
10973
11096
  }, [eventBus, formEditor, selectionModule]);
10974
11097
  useLayoutEffect(() => {
10975
- /**
10976
- * TODO(pinussilvestrus): update with actual updated element,
10977
- * once we have a proper updater/change support
11098
+ /**
11099
+ * TODO(pinussilvestrus): update with actual updated element,
11100
+ * once we have a proper updater/change support
10978
11101
  */
10979
11102
  eventBus.on('changed', refresh);
10980
11103
  eventBus.on('import.done', refresh);
@@ -11004,7 +11127,8 @@ function FormPropertiesPanel(props) {
11004
11127
  eventBus: eventBus,
11005
11128
  groups: getGroups(selectedFormField, editField, getService),
11006
11129
  headerProvider: PropertiesPanelHeaderProvider,
11007
- placeholderProvider: PropertiesPanelPlaceholderProvider
11130
+ placeholderProvider: PropertiesPanelPlaceholderProvider,
11131
+ feelPopupContainer: feelPopupContainer
11008
11132
  })
11009
11133
  })
11010
11134
  });
@@ -11026,10 +11150,10 @@ class PropertiesPanelRenderer {
11026
11150
  });
11027
11151
  }
11028
11152
 
11029
- /**
11030
- * Attach the properties panel to a parent node.
11031
- *
11032
- * @param {HTMLElement} container
11153
+ /**
11154
+ * Attach the properties panel to a parent node.
11155
+ *
11156
+ * @param {HTMLElement} container
11033
11157
  */
11034
11158
  attachTo(container) {
11035
11159
  if (!container) {
@@ -11049,8 +11173,8 @@ class PropertiesPanelRenderer {
11049
11173
  this._eventBus.fire('propertiesPanel.attach');
11050
11174
  }
11051
11175
 
11052
- /**
11053
- * Detach the properties panel from its parent node.
11176
+ /**
11177
+ * Detach the properties panel from its parent node.
11054
11178
  */
11055
11179
  detach() {
11056
11180
  const parentNode = this._container.parentNode;
@@ -11076,14 +11200,15 @@ class PropertiesPanelRenderer {
11076
11200
  PropertiesPanelRenderer.$inject = ['config.propertiesPanel', 'injector', 'eventBus'];
11077
11201
 
11078
11202
  var PropertiesPanelModule = {
11203
+ __depends__: [index],
11079
11204
  __init__: ['propertiesPanel'],
11080
11205
  propertiesPanel: ['type', PropertiesPanelRenderer]
11081
11206
  };
11082
11207
 
11083
- /**
11084
- * Manages the rendering of visual plugins.
11085
- * @constructor
11086
- * @param {Object} eventBus - Event bus for the application.
11208
+ /**
11209
+ * Manages the rendering of visual plugins.
11210
+ * @constructor
11211
+ * @param {Object} eventBus - Event bus for the application.
11087
11212
  */
11088
11213
  class RenderInjector extends SectionModuleBase {
11089
11214
  constructor(eventBus) {
@@ -11092,10 +11217,10 @@ class RenderInjector extends SectionModuleBase {
11092
11217
  this.registeredRenderers = [];
11093
11218
  }
11094
11219
 
11095
- /**
11096
- * Inject a new renderer into the injector.
11097
- * @param {string} identifier - Identifier for the renderer.
11098
- * @param {Function} Renderer - The renderer function.
11220
+ /**
11221
+ * Inject a new renderer into the injector.
11222
+ * @param {string} identifier - Identifier for the renderer.
11223
+ * @param {Function} Renderer - The renderer function.
11099
11224
  */
11100
11225
  attachRenderer(identifier, Renderer) {
11101
11226
  this.registeredRenderers = [...this.registeredRenderers, {
@@ -11104,17 +11229,17 @@ class RenderInjector extends SectionModuleBase {
11104
11229
  }];
11105
11230
  }
11106
11231
 
11107
- /**
11108
- * Detach a renderer from the by key injector.
11109
- * @param {string} identifier - Identifier for the renderer.
11232
+ /**
11233
+ * Detach a renderer from the by key injector.
11234
+ * @param {string} identifier - Identifier for the renderer.
11110
11235
  */
11111
11236
  detachRenderer(identifier) {
11112
11237
  this.registeredRenderers = this.registeredRenderers.filter(r => r.identifier !== identifier);
11113
11238
  }
11114
11239
 
11115
- /**
11116
- * Returns the registered renderers.
11117
- * @returns {Array} Array of registered renderers.
11240
+ /**
11241
+ * Returns the registered renderers.
11242
+ * @returns {Array} Array of registered renderers.
11118
11243
  */
11119
11244
  fetchRenderers() {
11120
11245
  return this.registeredRenderers;
@@ -11148,48 +11273,48 @@ var ExpressionLanguageModule = {
11148
11273
 
11149
11274
  const ids = new Ids([32, 36, 1]);
11150
11275
 
11151
- /**
11152
- * @typedef { import('./types').Injector } Injector
11153
- * @typedef { import('./types').Module } Module
11154
- * @typedef { import('./types').Schema } Schema
11155
- *
11156
- * @typedef { import('./types').FormEditorOptions } FormEditorOptions
11157
- * @typedef { import('./types').FormEditorProperties } FormEditorProperties
11158
- *
11159
- * @typedef { {
11160
- * properties: FormEditorProperties,
11161
- * schema: Schema
11162
- * } } State
11163
- *
11164
- * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
11165
- * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
11166
- * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
11276
+ /**
11277
+ * @typedef { import('./types').Injector } Injector
11278
+ * @typedef { import('./types').Module } Module
11279
+ * @typedef { import('./types').Schema } Schema
11280
+ *
11281
+ * @typedef { import('./types').FormEditorOptions } FormEditorOptions
11282
+ * @typedef { import('./types').FormEditorProperties } FormEditorProperties
11283
+ *
11284
+ * @typedef { {
11285
+ * properties: FormEditorProperties,
11286
+ * schema: Schema
11287
+ * } } State
11288
+ *
11289
+ * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
11290
+ * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
11291
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
11167
11292
  */
11168
11293
 
11169
- /**
11170
- * The form editor.
11294
+ /**
11295
+ * The form editor.
11171
11296
  */
11172
11297
  class FormEditor {
11173
- /**
11174
- * @constructor
11175
- * @param {FormEditorOptions} options
11298
+ /**
11299
+ * @constructor
11300
+ * @param {FormEditorOptions} options
11176
11301
  */
11177
11302
  constructor(options = {}) {
11178
- /**
11179
- * @public
11180
- * @type {OnEventType}
11303
+ /**
11304
+ * @public
11305
+ * @type {OnEventType}
11181
11306
  */
11182
11307
  this.on = this._onEvent;
11183
11308
 
11184
- /**
11185
- * @public
11186
- * @type {String}
11309
+ /**
11310
+ * @public
11311
+ * @type {String}
11187
11312
  */
11188
11313
  this._id = ids.next();
11189
11314
 
11190
- /**
11191
- * @private
11192
- * @type {Element}
11315
+ /**
11316
+ * @private
11317
+ * @type {Element}
11193
11318
  */
11194
11319
  this._container = createFormContainer();
11195
11320
  this._container.setAttribute('input-handle-modified-keys', 'z,y');
@@ -11200,15 +11325,15 @@ class FormEditor {
11200
11325
  properties = {}
11201
11326
  } = options;
11202
11327
 
11203
- /**
11204
- * @private
11205
- * @type {any}
11328
+ /**
11329
+ * @private
11330
+ * @type {any}
11206
11331
  */
11207
11332
  this.exporter = exporter;
11208
11333
 
11209
- /**
11210
- * @private
11211
- * @type {State}
11334
+ /**
11335
+ * @private
11336
+ * @type {State}
11212
11337
  */
11213
11338
  this._state = {
11214
11339
  properties,
@@ -11237,10 +11362,10 @@ class FormEditor {
11237
11362
  this._detach(false);
11238
11363
  }
11239
11364
 
11240
- /**
11241
- * @param {Schema} schema
11242
- *
11243
- * @return {Promise<{ warnings: Array<any> }>}
11365
+ /**
11366
+ * @param {Schema} schema
11367
+ *
11368
+ * @return {Promise<{ warnings: Array<any> }>}
11244
11369
  */
11245
11370
  importSchema(schema) {
11246
11371
  return new Promise((resolve, reject) => {
@@ -11269,15 +11394,15 @@ class FormEditor {
11269
11394
  });
11270
11395
  }
11271
11396
 
11272
- /**
11273
- * @returns {Schema}
11397
+ /**
11398
+ * @returns {Schema}
11274
11399
  */
11275
11400
  saveSchema() {
11276
11401
  return this.getSchema();
11277
11402
  }
11278
11403
 
11279
- /**
11280
- * @returns {Schema}
11404
+ /**
11405
+ * @returns {Schema}
11281
11406
  */
11282
11407
  getSchema() {
11283
11408
  const {
@@ -11286,8 +11411,8 @@ class FormEditor {
11286
11411
  return exportSchema(schema, this.exporter, schemaVersion);
11287
11412
  }
11288
11413
 
11289
- /**
11290
- * @param {Element|string} parentNode
11414
+ /**
11415
+ * @param {Element|string} parentNode
11291
11416
  */
11292
11417
  attachTo(parentNode) {
11293
11418
  if (!parentNode) {
@@ -11305,10 +11430,10 @@ class FormEditor {
11305
11430
  this._detach();
11306
11431
  }
11307
11432
 
11308
- /**
11309
- * @internal
11310
- *
11311
- * @param {boolean} [emit]
11433
+ /**
11434
+ * @internal
11435
+ *
11436
+ * @param {boolean} [emit]
11312
11437
  */
11313
11438
  _detach(emit = true) {
11314
11439
  const container = this._container,
@@ -11322,9 +11447,9 @@ class FormEditor {
11322
11447
  parentNode.removeChild(container);
11323
11448
  }
11324
11449
 
11325
- /**
11326
- * @param {any} property
11327
- * @param {any} value
11450
+ /**
11451
+ * @param {any} property
11452
+ * @param {any} value
11328
11453
  */
11329
11454
  setProperty(property, value) {
11330
11455
  const properties = set$1(this._getState().properties, [property], value);
@@ -11333,21 +11458,21 @@ class FormEditor {
11333
11458
  });
11334
11459
  }
11335
11460
 
11336
- /**
11337
- * @param {string} type
11338
- * @param {Function} handler
11461
+ /**
11462
+ * @param {string} type
11463
+ * @param {Function} handler
11339
11464
  */
11340
11465
  off(type, handler) {
11341
11466
  this.get('eventBus').off(type, handler);
11342
11467
  }
11343
11468
 
11344
- /**
11345
- * @internal
11346
- *
11347
- * @param {FormEditorOptions} options
11348
- * @param {Element} container
11349
- *
11350
- * @returns {Injector}
11469
+ /**
11470
+ * @internal
11471
+ *
11472
+ * @param {FormEditorOptions} options
11473
+ * @param {Element} container
11474
+ *
11475
+ * @returns {Injector}
11351
11476
  */
11352
11477
  _createInjector(options, container) {
11353
11478
  const {
@@ -11369,22 +11494,22 @@ class FormEditor {
11369
11494
  }, core, ...modules, ...additionalModules]);
11370
11495
  }
11371
11496
 
11372
- /**
11373
- * @internal
11497
+ /**
11498
+ * @internal
11374
11499
  */
11375
11500
  _emit(type, data) {
11376
11501
  this.get('eventBus').fire(type, data);
11377
11502
  }
11378
11503
 
11379
- /**
11380
- * @internal
11504
+ /**
11505
+ * @internal
11381
11506
  */
11382
11507
  _getState() {
11383
11508
  return this._state;
11384
11509
  }
11385
11510
 
11386
- /**
11387
- * @internal
11511
+ /**
11512
+ * @internal
11388
11513
  */
11389
11514
  _setState(state) {
11390
11515
  this._state = {
@@ -11394,15 +11519,15 @@ class FormEditor {
11394
11519
  this._emit('changed', this._getState());
11395
11520
  }
11396
11521
 
11397
- /**
11398
- * @internal
11522
+ /**
11523
+ * @internal
11399
11524
  */
11400
11525
  _getModules() {
11401
11526
  return [ModelingModule, EditorActionsModule, DraggingModule, KeyboardModule, SelectionModule, PaletteModule, ExpressionLanguageModule, MarkdownModule, PropertiesPanelModule, RenderInjectionModule];
11402
11527
  }
11403
11528
 
11404
- /**
11405
- * @internal
11529
+ /**
11530
+ * @internal
11406
11531
  */
11407
11532
  _onEvent(type, priority, handler) {
11408
11533
  this.get('eventBus').on(type, priority, handler);