@bpmn-io/form-js-editor 0.10.1 → 0.11.1

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 (96) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +119 -119
  3. package/dist/assets/form-js-editor.css +295 -295
  4. package/dist/index.cjs +251 -214
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.es.js +251 -214
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/types/FormEditor.d.ts +155 -155
  9. package/dist/types/core/Debounce.d.ts +10 -10
  10. package/dist/types/core/EventBus.d.ts +1 -1
  11. package/dist/types/core/FieldFactory.d.ts +18 -18
  12. package/dist/types/core/FormFieldRegistry.d.ts +19 -19
  13. package/dist/types/core/index.d.ts +17 -17
  14. package/dist/types/features/editor-actions/FormEditorActions.d.ts +8 -8
  15. package/dist/types/features/editor-actions/index.d.ts +6 -6
  16. package/dist/types/features/keyboard/FormEditorKeyboardBindings.d.ts +8 -8
  17. package/dist/types/features/keyboard/index.d.ts +7 -7
  18. package/dist/types/features/modeling/Modeling.d.ts +34 -34
  19. package/dist/types/features/modeling/behavior/IdBehavior.d.ts +7 -7
  20. package/dist/types/features/modeling/behavior/KeyBehavior.d.ts +7 -7
  21. package/dist/types/features/modeling/behavior/ValidateBehavior.d.ts +7 -0
  22. package/dist/types/features/modeling/behavior/index.d.ts +10 -8
  23. package/dist/types/features/modeling/cmd/AddFormFieldHandler.d.ts +16 -16
  24. package/dist/types/features/modeling/cmd/EditFormFieldHandler.d.ts +16 -16
  25. package/dist/types/features/modeling/cmd/MoveFormFieldHandler.d.ts +17 -17
  26. package/dist/types/features/modeling/cmd/RemoveFormFieldHandler.d.ts +16 -16
  27. package/dist/types/features/modeling/cmd/UpdateIdClaimHandler.d.ts +14 -14
  28. package/dist/types/features/modeling/cmd/UpdateKeyClaimHandler.d.ts +14 -14
  29. package/dist/types/features/modeling/cmd/Util.d.ts +4 -4
  30. package/dist/types/features/modeling/index.d.ts +7 -7
  31. package/dist/types/features/palette/PaletteRenderer.d.ts +33 -33
  32. package/dist/types/features/palette/components/Palette.d.ts +1 -1
  33. package/dist/types/features/palette/index.d.ts +5 -5
  34. package/dist/types/features/properties-panel/PropertiesPanel.d.ts +1 -1
  35. package/dist/types/features/properties-panel/PropertiesPanelHeaderProvider.d.ts +5 -5
  36. package/dist/types/features/properties-panel/PropertiesPanelPlaceholderProvider.d.ts +8 -8
  37. package/dist/types/features/properties-panel/PropertiesPanelRenderer.d.ts +37 -37
  38. package/dist/types/features/properties-panel/Util.d.ts +9 -9
  39. package/dist/types/features/properties-panel/context/FormPropertiesPanelContext.d.ts +11 -11
  40. package/dist/types/features/properties-panel/context/index.d.ts +1 -1
  41. package/dist/types/features/properties-panel/entries/ActionEntry.d.ts +9 -9
  42. package/dist/types/features/properties-panel/entries/AdornerEntry.d.ts +11 -11
  43. package/dist/types/features/properties-panel/entries/AltTextEntry.d.ts +9 -9
  44. package/dist/types/features/properties-panel/entries/ColumnsEntry.d.ts +9 -9
  45. package/dist/types/features/properties-panel/entries/ConditionEntry.d.ts +9 -9
  46. package/dist/types/features/properties-panel/entries/CustomValueEntry.d.ts +11 -11
  47. package/dist/types/features/properties-panel/entries/DateTimeConstraintsEntry.d.ts +9 -9
  48. package/dist/types/features/properties-panel/entries/DateTimeEntry.d.ts +9 -9
  49. package/dist/types/features/properties-panel/entries/DateTimeSerializationEntry.d.ts +9 -9
  50. package/dist/types/features/properties-panel/entries/DefaultValueEntry.d.ts +1 -1
  51. package/dist/types/features/properties-panel/entries/DescriptionEntry.d.ts +9 -9
  52. package/dist/types/features/properties-panel/entries/DisabledEntry.d.ts +9 -9
  53. package/dist/types/features/properties-panel/entries/IdEntry.d.ts +9 -9
  54. package/dist/types/features/properties-panel/entries/ImageSourceEntry.d.ts +9 -9
  55. package/dist/types/features/properties-panel/entries/InputKeyValuesSourceEntry.d.ts +11 -11
  56. package/dist/types/features/properties-panel/entries/KeyEntry.d.ts +9 -9
  57. package/dist/types/features/properties-panel/entries/LabelEntry.d.ts +9 -9
  58. package/dist/types/features/properties-panel/entries/NumberEntries.d.ts +9 -9
  59. package/dist/types/features/properties-panel/entries/NumberSerializationEntry.d.ts +9 -9
  60. package/dist/types/features/properties-panel/entries/StaticValuesSourceEntry.d.ts +5 -5
  61. package/dist/types/features/properties-panel/entries/TextEntry.d.ts +9 -9
  62. package/dist/types/features/properties-panel/entries/ValueEntry.d.ts +11 -11
  63. package/dist/types/features/properties-panel/entries/ValuesSourceSelectEntry.d.ts +9 -9
  64. package/dist/types/features/properties-panel/entries/factories/index.d.ts +1 -1
  65. package/dist/types/features/properties-panel/entries/factories/simpleStringEntryFactory.d.ts +9 -9
  66. package/dist/types/features/properties-panel/entries/index.d.ts +23 -23
  67. package/dist/types/features/properties-panel/groups/AppearanceGroup.d.ts +13 -13
  68. package/dist/types/features/properties-panel/groups/ConditionGroup.d.ts +11 -11
  69. package/dist/types/features/properties-panel/groups/ConstraintsGroup.d.ts +11 -11
  70. package/dist/types/features/properties-panel/groups/CustomValuesGroup.d.ts +31 -31
  71. package/dist/types/features/properties-panel/groups/GeneralGroup.d.ts +5 -5
  72. package/dist/types/features/properties-panel/groups/SerializationGroup.d.ts +11 -11
  73. package/dist/types/features/properties-panel/groups/ValidationGroup.d.ts +14 -14
  74. package/dist/types/features/properties-panel/groups/ValuesGroups.d.ts +1 -1
  75. package/dist/types/features/properties-panel/groups/index.d.ts +8 -8
  76. package/dist/types/features/properties-panel/hooks/index.d.ts +2 -2
  77. package/dist/types/features/properties-panel/hooks/usePropertiesPanelService.d.ts +1 -1
  78. package/dist/types/features/properties-panel/hooks/useVariables.d.ts +6 -6
  79. package/dist/types/features/properties-panel/icons/index.d.ts +1 -1
  80. package/dist/types/features/properties-panel/index.d.ts +6 -6
  81. package/dist/types/features/selection/Selection.d.ts +14 -14
  82. package/dist/types/features/selection/SelectionBehavior.d.ts +7 -7
  83. package/dist/types/features/selection/index.d.ts +8 -8
  84. package/dist/types/import/Importer.d.ts +51 -51
  85. package/dist/types/import/index.d.ts +5 -5
  86. package/dist/types/index.d.ts +15 -15
  87. package/dist/types/render/Renderer.d.ts +26 -26
  88. package/dist/types/render/components/FormEditor.d.ts +1 -1
  89. package/dist/types/render/components/icons/index.d.ts +1 -1
  90. package/dist/types/render/context/DragAndDropContext.d.ts +4 -4
  91. package/dist/types/render/context/FormEditorContext.d.ts +11 -11
  92. package/dist/types/render/context/index.d.ts +2 -2
  93. package/dist/types/render/hooks/useService.d.ts +1 -1
  94. package/dist/types/render/index.d.ts +8 -8
  95. package/dist/types/src/types.d.ts +28 -28
  96. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -458,10 +458,10 @@ function invokeFunction(fn, args) {
458
458
  return fn.apply(null, args);
459
459
  }
460
460
 
461
- /**
462
- * A factory to create a configurable debouncer.
463
- *
464
- * @param {number|boolean} [config=true]
461
+ /**
462
+ * A factory to create a configurable debouncer.
463
+ *
464
+ * @param {number|boolean} [config=true]
465
465
  */
466
466
  function DebounceFactory(config = true) {
467
467
  const timeout = typeof config === 'number' ? config : config ? 300 : 0;
@@ -474,11 +474,11 @@ function DebounceFactory(config = true) {
474
474
  DebounceFactory.$inject = ['config.debounce'];
475
475
 
476
476
  class FieldFactory {
477
- /**
478
- * @constructor
479
- *
480
- * @param { import('./FormFieldRegistry').default } formFieldRegistry
481
- * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
477
+ /**
478
+ * @constructor
479
+ *
480
+ * @param { import('./FormFieldRegistry').default } formFieldRegistry
481
+ * @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
482
482
  */
483
483
  constructor(formFieldRegistry, formFields) {
484
484
  this._formFieldRegistry = formFieldRegistry;
@@ -538,11 +538,11 @@ class FieldFactory {
538
538
  FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
539
539
 
540
540
  class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
541
- /**
542
- * Updates a form fields id.
543
- *
544
- * @param {Object} formField
545
- * @param {string} newId
541
+ /**
542
+ * Updates a form fields id.
543
+ *
544
+ * @param {Object} formField
545
+ * @param {string} newId
546
546
  */
547
547
  updateId(formField, newId) {
548
548
  this._validateId(newId);
@@ -563,13 +563,13 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
563
563
  }
564
564
  }
565
565
 
566
- /**
567
- * Validate the suitability of the given id and signals a problem
568
- * with an exception.
569
- *
570
- * @param {string} id
571
- *
572
- * @throws {Error} if id is empty or already assigned
566
+ /**
567
+ * Validate the suitability of the given id and signals a problem
568
+ * with an exception.
569
+ *
570
+ * @param {string} id
571
+ *
572
+ * @throws {Error} if id is empty or already assigned
573
573
  */
574
574
  _validateId(id) {
575
575
  if (!id) {
@@ -582,31 +582,31 @@ class FormFieldRegistry extends formJsViewer.FormFieldRegistry {
582
582
  }
583
583
 
584
584
  class Importer {
585
- /**
586
- * @constructor
587
- * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
588
- * @param { import('../core/FieldFactory').default } fieldFactory
585
+ /**
586
+ * @constructor
587
+ * @param { import('../core/FormFieldRegistry').default } formFieldRegistry
588
+ * @param { import('../core/FieldFactory').default } fieldFactory
589
589
  */
590
590
  constructor(formFieldRegistry, fieldFactory) {
591
591
  this._formFieldRegistry = formFieldRegistry;
592
592
  this._fieldFactory = fieldFactory;
593
593
  }
594
594
 
595
- /**
596
- * Import schema creating fields, attaching additional
597
- * information to each field and adding fields to the
598
- * field registry.
599
- *
600
- * Additional information attached:
601
- *
602
- * * `id` (unless present)
603
- * * `_parent`
604
- * * `_path`
605
- *
606
- * @param {any} schema
607
- *
608
- * @typedef {{ warnings: Error[], schema: any }} ImportResult
609
- * @returns {ImportResult}
595
+ /**
596
+ * Import schema creating fields, attaching additional
597
+ * information to each field and adding fields to the
598
+ * field registry.
599
+ *
600
+ * Additional information attached:
601
+ *
602
+ * * `id` (unless present)
603
+ * * `_parent`
604
+ * * `_path`
605
+ *
606
+ * @param {any} schema
607
+ *
608
+ * @typedef {{ warnings: Error[], schema: any }} ImportResult
609
+ * @returns {ImportResult}
610
610
  */
611
611
  importSchema(schema) {
612
612
  // TODO: Add warnings
@@ -623,12 +623,12 @@ class Importer {
623
623
  }
624
624
  }
625
625
 
626
- /**
627
- * @param {{[x: string]: any}} fieldAttrs
628
- * @param {String} [parentId]
629
- * @param {number} [index]
630
- *
631
- * @return {any} field
626
+ /**
627
+ * @param {{[x: string]: any}} fieldAttrs
628
+ * @param {String} [parentId]
629
+ * @param {number} [index]
630
+ *
631
+ * @return {any} field
632
632
  */
633
633
  importFormField(fieldAttrs, parentId, index) {
634
634
  const {
@@ -665,11 +665,11 @@ class Importer {
665
665
  return field;
666
666
  }
667
667
 
668
- /**
669
- * @param {Array<any>} components
670
- * @param {string} parentId
671
- *
672
- * @return {Array<any>} imported components
668
+ /**
669
+ * @param {Array<any>} components
670
+ * @param {string} parentId
671
+ *
672
+ * @return {Array<any>} imported components
673
673
  */
674
674
  importFormFields(components, parentId) {
675
675
  return components.map((component, index) => {
@@ -687,11 +687,11 @@ const DragAndDropContext = preact.createContext({
687
687
  drake: null
688
688
  });
689
689
 
690
- /**
691
- * @param {string} type
692
- * @param {boolean} [strict]
693
- *
694
- * @returns {any}
690
+ /**
691
+ * @param {string} type
692
+ * @param {boolean} [strict]
693
+ *
694
+ * @returns {any}
695
695
  */
696
696
  function getService$1(type, strict) {}
697
697
  const FormEditorContext = preact.createContext({
@@ -1760,10 +1760,10 @@ function updatePath(formFieldRegistry, formField, index) {
1760
1760
  }
1761
1761
 
1762
1762
  class AddFormFieldHandler {
1763
- /**
1764
- * @constructor
1765
- * @param { import('../../../FormEditor').default } formEditor
1766
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1763
+ /**
1764
+ * @constructor
1765
+ * @param { import('../../../FormEditor').default } formEditor
1766
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1767
1767
  */
1768
1768
  constructor(formEditor, formFieldRegistry) {
1769
1769
  this._formEditor = formEditor;
@@ -1824,10 +1824,10 @@ class AddFormFieldHandler {
1824
1824
  AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
1825
1825
 
1826
1826
  class EditFormFieldHandler {
1827
- /**
1828
- * @constructor
1829
- * @param { import('../../../FormEditor').default } formEditor
1830
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1827
+ /**
1828
+ * @constructor
1829
+ * @param { import('../../../FormEditor').default } formEditor
1830
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1831
1831
  */
1832
1832
  constructor(formEditor, formFieldRegistry) {
1833
1833
  this._formEditor = formEditor;
@@ -1890,10 +1890,10 @@ class EditFormFieldHandler {
1890
1890
  EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
1891
1891
 
1892
1892
  class MoveFormFieldHandler {
1893
- /**
1894
- * @constructor
1895
- * @param { import('../../../FormEditor').default } formEditor
1896
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1893
+ /**
1894
+ * @constructor
1895
+ * @param { import('../../../FormEditor').default } formEditor
1896
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1897
1897
  */
1898
1898
  constructor(formEditor, formFieldRegistry) {
1899
1899
  this._formEditor = formEditor;
@@ -1970,10 +1970,10 @@ class MoveFormFieldHandler {
1970
1970
  MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
1971
1971
 
1972
1972
  class RemoveFormFieldHandler {
1973
- /**
1974
- * @constructor
1975
- * @param { import('../../../FormEditor').default } formEditor
1976
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1973
+ /**
1974
+ * @constructor
1975
+ * @param { import('../../../FormEditor').default } formEditor
1976
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
1977
1977
  */
1978
1978
  constructor(formEditor, formFieldRegistry) {
1979
1979
  this._formEditor = formEditor;
@@ -2033,9 +2033,9 @@ class RemoveFormFieldHandler {
2033
2033
  RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
2034
2034
 
2035
2035
  class UpdateIdClaimHandler {
2036
- /**
2037
- * @constructor
2038
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
2036
+ /**
2037
+ * @constructor
2038
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
2039
2039
  */
2040
2040
  constructor(formFieldRegistry) {
2041
2041
  this._formFieldRegistry = formFieldRegistry;
@@ -2068,9 +2068,9 @@ class UpdateIdClaimHandler {
2068
2068
  UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
2069
2069
 
2070
2070
  class UpdateKeyClaimHandler {
2071
- /**
2072
- * @constructor
2073
- * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
2071
+ /**
2072
+ * @constructor
2073
+ * @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
2074
2074
  */
2075
2075
  constructor(formFieldRegistry) {
2076
2076
  this._formFieldRegistry = formFieldRegistry;
@@ -2376,10 +2376,40 @@ class KeyBehavior extends CommandInterceptor {
2376
2376
  }
2377
2377
  KeyBehavior.$inject = ['eventBus', 'modeling'];
2378
2378
 
2379
+ class ValidateBehavior extends CommandInterceptor {
2380
+ constructor(eventBus) {
2381
+ super(eventBus);
2382
+
2383
+ /**
2384
+ * Remove custom validation if <validationType> is about to be added.
2385
+ */
2386
+ // @ts-ignore-next-line
2387
+ this.preExecute('formField.edit', function (context) {
2388
+ const {
2389
+ properties
2390
+ } = context;
2391
+ const {
2392
+ validate = {}
2393
+ } = properties;
2394
+ if (validate.validationType) {
2395
+ const newValidate = {
2396
+ ...validate
2397
+ };
2398
+ delete newValidate.minLength;
2399
+ delete newValidate.maxLength;
2400
+ delete newValidate.pattern;
2401
+ properties['validate'] = newValidate;
2402
+ }
2403
+ }, true);
2404
+ }
2405
+ }
2406
+ ValidateBehavior.$inject = ['eventBus'];
2407
+
2379
2408
  var behaviorModule = {
2380
- __init__: ['idBehavior', 'keyBehavior'],
2409
+ __init__: ['idBehavior', 'keyBehavior', 'validateBehavior'],
2381
2410
  idBehavior: ['type', IdBehavior],
2382
- keyBehavior: ['type', KeyBehavior]
2411
+ keyBehavior: ['type', KeyBehavior],
2412
+ validateBehavior: ['type', ValidateBehavior]
2383
2413
  };
2384
2414
 
2385
2415
  /**
@@ -2968,10 +2998,10 @@ class PaletteRenderer {
2968
2998
  });
2969
2999
  }
2970
3000
 
2971
- /**
2972
- * Attach the palette to a parent node.
2973
- *
2974
- * @param {HTMLElement} container
3001
+ /**
3002
+ * Attach the palette to a parent node.
3003
+ *
3004
+ * @param {HTMLElement} container
2975
3005
  */
2976
3006
  attachTo(container) {
2977
3007
  if (!container) {
@@ -2991,8 +3021,8 @@ class PaletteRenderer {
2991
3021
  this._eventBus.fire('palette.attach');
2992
3022
  }
2993
3023
 
2994
- /**
2995
- * Detach the palette from its parent node.
3024
+ /**
3025
+ * Detach the palette from its parent node.
2996
3026
  */
2997
3027
  detach() {
2998
3028
  const parentNode = this._container.parentNode;
@@ -5129,11 +5159,11 @@ function prefixId$1(id) {
5129
5159
  return `bio-properties-panel-${id}`;
5130
5160
  }
5131
5161
 
5132
- /**
5133
- * @param {string} type
5134
- * @param {boolean} [strict]
5135
- *
5136
- * @returns {any}
5162
+ /**
5163
+ * @param {string} type
5164
+ * @param {boolean} [strict]
5165
+ *
5166
+ * @returns {any}
5137
5167
  */
5138
5168
  function getService(type, strict) {}
5139
5169
  const PropertiesPanelContext = preact.createContext({
@@ -5221,8 +5251,8 @@ const PropertiesPanelHeaderProvider = {
5221
5251
  }
5222
5252
  };
5223
5253
 
5224
- /**
5225
- * Provide placeholders for empty and multiple state.
5254
+ /**
5255
+ * Provide placeholders for empty and multiple state.
5226
5256
  */
5227
5257
  const PropertiesPanelPlaceholderProvider = {
5228
5258
  getEmpty: () => {
@@ -5294,10 +5324,10 @@ function useService (type, strict) {
5294
5324
  return getService(type, strict);
5295
5325
  }
5296
5326
 
5297
- /**
5298
- * Retrieve list of variables from the form schema.
5299
- *
5300
- * @returns { string[] } list of variables used in form schema
5327
+ /**
5328
+ * Retrieve list of variables from the form schema.
5329
+ *
5330
+ * @returns { string[] } list of variables used in form schema
5301
5331
  */
5302
5332
  function useVariables() {
5303
5333
  const form = useService('formEditor');
@@ -6106,7 +6136,12 @@ function NumberArrowStep(props) {
6106
6136
  if (!isValidNumber(value)) return null;
6107
6137
  return value;
6108
6138
  };
6109
- const setValue = value => editField(field, ['increment'], value);
6139
+ const clearLeadingZeroes = value => {
6140
+ if (!value) return value;
6141
+ const trimmed = value.replace(/^0+/g, '');
6142
+ return (trimmed.startsWith('.') ? '0' : '') + trimmed;
6143
+ };
6144
+ const setValue = value => editField(field, ['increment'], clearLeadingZeroes(value));
6110
6145
  const decimalDigitsSet = decimalDigits || decimalDigits === 0;
6111
6146
  return TextfieldEntry({
6112
6147
  debounce,
@@ -6582,14 +6617,14 @@ function Value(props) {
6582
6617
 
6583
6618
  // helpers //////////
6584
6619
 
6585
- /**
6586
- * Returns copy of object with updated value.
6587
- *
6588
- * @param {Object} properties
6589
- * @param {string} key
6590
- * @param {string} value
6591
- *
6592
- * @returns {Object}
6620
+ /**
6621
+ * Returns copy of object with updated value.
6622
+ *
6623
+ * @param {Object} properties
6624
+ * @param {string} key
6625
+ * @param {string} value
6626
+ *
6627
+ * @returns {Object}
6593
6628
  */
6594
6629
  function updateValue(properties, key, value) {
6595
6630
  return {
@@ -6598,14 +6633,14 @@ function updateValue(properties, key, value) {
6598
6633
  };
6599
6634
  }
6600
6635
 
6601
- /**
6602
- * Returns copy of object with updated key.
6603
- *
6604
- * @param {Object} properties
6605
- * @param {string} oldKey
6606
- * @param {string} newKey
6607
- *
6608
- * @returns {Object}
6636
+ /**
6637
+ * Returns copy of object with updated key.
6638
+ *
6639
+ * @param {Object} properties
6640
+ * @param {string} oldKey
6641
+ * @param {string} newKey
6642
+ *
6643
+ * @returns {Object}
6609
6644
  */
6610
6645
  function updateKey(properties, oldKey, newKey) {
6611
6646
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -6991,7 +7026,7 @@ function ConstraintsGroup(field, editField) {
6991
7026
 
6992
7027
  const VALIDATION_TYPE_OPTIONS = {
6993
7028
  custom: {
6994
- value: 'custom',
7029
+ value: undefined,
6995
7030
  label: 'Custom'
6996
7031
  },
6997
7032
  email: {
@@ -7037,6 +7072,7 @@ function ValidationGroup(field, editField) {
7037
7072
  component: ValidationType,
7038
7073
  getValue,
7039
7074
  field,
7075
+ editField,
7040
7076
  isEdited: isEdited$1,
7041
7077
  onChange
7042
7078
  });
@@ -7170,10 +7206,10 @@ function Min(props) {
7170
7206
  return NumberFieldEntry({
7171
7207
  debounce,
7172
7208
  element: field,
7173
- getValue: getValue('min'),
7174
7209
  id,
7175
7210
  label: 'Minimum',
7176
- min: 0,
7211
+ step: 'any',
7212
+ getValue: getValue('min'),
7177
7213
  setValue: onChange('min')
7178
7214
  });
7179
7215
  }
@@ -7188,10 +7224,10 @@ function Max(props) {
7188
7224
  return NumberFieldEntry({
7189
7225
  debounce,
7190
7226
  element: field,
7191
- getValue: getValue('max'),
7192
7227
  id,
7193
7228
  label: 'Maximum',
7194
- min: 0,
7229
+ step: 'any',
7230
+ getValue: getValue('max'),
7195
7231
  setValue: onChange('max')
7196
7232
  });
7197
7233
  }
@@ -7203,16 +7239,17 @@ function ValidationType(props) {
7203
7239
  onChange
7204
7240
  } = props;
7205
7241
  const debounce = useService('debounce');
7242
+ const setValue = validationType => {
7243
+ onChange('validationType')(validationType || undefined);
7244
+ };
7206
7245
  return SelectEntry({
7207
7246
  debounce,
7208
7247
  element: field,
7209
7248
  getValue: getValue('validationType'),
7210
7249
  id,
7211
7250
  label: 'Regular expression validation',
7212
- setValue: onChange('validationType'),
7213
- getOptions() {
7214
- return Object.values(VALIDATION_TYPE_OPTIONS);
7215
- }
7251
+ setValue,
7252
+ getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
7216
7253
  });
7217
7254
  }
7218
7255
 
@@ -7230,8 +7267,8 @@ function ValuesGroups(field, editField) {
7230
7267
  };
7231
7268
  const valuesSourceId = `${fieldId}-valuesSource`;
7232
7269
 
7233
- /**
7234
- * @type {Array<Group|ListGroup>}
7270
+ /**
7271
+ * @type {Array<Group|ListGroup>}
7235
7272
  */
7236
7273
  const groups = [{
7237
7274
  id: valuesSourceId,
@@ -7332,13 +7369,13 @@ function CustomValuesGroup(field, editField) {
7332
7369
 
7333
7370
  // helpers //////////
7334
7371
 
7335
- /**
7336
- * Returns copy of object without key.
7337
- *
7338
- * @param {Object} properties
7339
- * @param {string} oldKey
7340
- *
7341
- * @returns {Object}
7372
+ /**
7373
+ * Returns copy of object without key.
7374
+ *
7375
+ * @param {Object} properties
7376
+ * @param {string} oldKey
7377
+ *
7378
+ * @returns {Object}
7342
7379
  */
7343
7380
  function removeKey(properties, oldKey) {
7344
7381
  return Object.entries(properties).reduce((newProperties, entry) => {
@@ -7431,9 +7468,9 @@ function FormPropertiesPanel(props) {
7431
7468
  }, []);
7432
7469
  hooks$1.useLayoutEffect(() => {
7433
7470
  const onFieldChanged = () => {
7434
- /**
7435
- * TODO(pinussilvestrus): update with actual updated element,
7436
- * once we have a proper updater/change support
7471
+ /**
7472
+ * TODO(pinussilvestrus): update with actual updated element,
7473
+ * once we have a proper updater/change support
7437
7474
  */
7438
7475
  _update(selection.get() || schema);
7439
7476
  };
@@ -7485,10 +7522,10 @@ class PropertiesPanelRenderer {
7485
7522
  });
7486
7523
  }
7487
7524
 
7488
- /**
7489
- * Attach the properties panel to a parent node.
7490
- *
7491
- * @param {HTMLElement} container
7525
+ /**
7526
+ * Attach the properties panel to a parent node.
7527
+ *
7528
+ * @param {HTMLElement} container
7492
7529
  */
7493
7530
  attachTo(container) {
7494
7531
  if (!container) {
@@ -7508,8 +7545,8 @@ class PropertiesPanelRenderer {
7508
7545
  this._eventBus.fire('propertiesPanel.attach');
7509
7546
  }
7510
7547
 
7511
- /**
7512
- * Detach the properties panel from its parent node.
7548
+ /**
7549
+ * Detach the properties panel from its parent node.
7513
7550
  */
7514
7551
  detach() {
7515
7552
  const parentNode = this._container.parentNode;
@@ -7541,48 +7578,48 @@ var PropertiesPanelModule = {
7541
7578
 
7542
7579
  const ids = new Ids__default['default']([32, 36, 1]);
7543
7580
 
7544
- /**
7545
- * @typedef { import('./types').Injector } Injector
7546
- * @typedef { import('./types').Module } Module
7547
- * @typedef { import('./types').Schema } Schema
7548
- *
7549
- * @typedef { import('./types').FormEditorOptions } FormEditorOptions
7550
- * @typedef { import('./types').FormEditorProperties } FormEditorProperties
7551
- *
7552
- * @typedef { {
7553
- * properties: FormEditorProperties,
7554
- * schema: Schema
7555
- * } } State
7556
- *
7557
- * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
7558
- * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
7559
- * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
7581
+ /**
7582
+ * @typedef { import('./types').Injector } Injector
7583
+ * @typedef { import('./types').Module } Module
7584
+ * @typedef { import('./types').Schema } Schema
7585
+ *
7586
+ * @typedef { import('./types').FormEditorOptions } FormEditorOptions
7587
+ * @typedef { import('./types').FormEditorProperties } FormEditorProperties
7588
+ *
7589
+ * @typedef { {
7590
+ * properties: FormEditorProperties,
7591
+ * schema: Schema
7592
+ * } } State
7593
+ *
7594
+ * @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
7595
+ * @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
7596
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
7560
7597
  */
7561
7598
 
7562
- /**
7563
- * The form editor.
7599
+ /**
7600
+ * The form editor.
7564
7601
  */
7565
7602
  class FormEditor {
7566
- /**
7567
- * @constructor
7568
- * @param {FormEditorOptions} options
7603
+ /**
7604
+ * @constructor
7605
+ * @param {FormEditorOptions} options
7569
7606
  */
7570
7607
  constructor(options = {}) {
7571
- /**
7572
- * @public
7573
- * @type {OnEventType}
7608
+ /**
7609
+ * @public
7610
+ * @type {OnEventType}
7574
7611
  */
7575
7612
  this.on = this._onEvent;
7576
7613
 
7577
- /**
7578
- * @public
7579
- * @type {String}
7614
+ /**
7615
+ * @public
7616
+ * @type {String}
7580
7617
  */
7581
7618
  this._id = ids.next();
7582
7619
 
7583
- /**
7584
- * @private
7585
- * @type {Element}
7620
+ /**
7621
+ * @private
7622
+ * @type {Element}
7586
7623
  */
7587
7624
  this._container = formJsViewer.createFormContainer();
7588
7625
  this._container.setAttribute('input-handle-modified-keys', 'z,y');
@@ -7593,15 +7630,15 @@ class FormEditor {
7593
7630
  properties = {}
7594
7631
  } = options;
7595
7632
 
7596
- /**
7597
- * @private
7598
- * @type {any}
7633
+ /**
7634
+ * @private
7635
+ * @type {any}
7599
7636
  */
7600
7637
  this.exporter = exporter;
7601
7638
 
7602
- /**
7603
- * @private
7604
- * @type {State}
7639
+ /**
7640
+ * @private
7641
+ * @type {State}
7605
7642
  */
7606
7643
  this._state = {
7607
7644
  properties,
@@ -7630,10 +7667,10 @@ class FormEditor {
7630
7667
  this._detach(false);
7631
7668
  }
7632
7669
 
7633
- /**
7634
- * @param {Schema} schema
7635
- *
7636
- * @return {Promise<{ warnings: Array<any> }>}
7670
+ /**
7671
+ * @param {Schema} schema
7672
+ *
7673
+ * @return {Promise<{ warnings: Array<any> }>}
7637
7674
  */
7638
7675
  importSchema(schema) {
7639
7676
  return new Promise((resolve, reject) => {
@@ -7662,15 +7699,15 @@ class FormEditor {
7662
7699
  });
7663
7700
  }
7664
7701
 
7665
- /**
7666
- * @returns {Schema}
7702
+ /**
7703
+ * @returns {Schema}
7667
7704
  */
7668
7705
  saveSchema() {
7669
7706
  return this.getSchema();
7670
7707
  }
7671
7708
 
7672
- /**
7673
- * @returns {Schema}
7709
+ /**
7710
+ * @returns {Schema}
7674
7711
  */
7675
7712
  getSchema() {
7676
7713
  const {
@@ -7679,8 +7716,8 @@ class FormEditor {
7679
7716
  return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
7680
7717
  }
7681
7718
 
7682
- /**
7683
- * @param {Element|string} parentNode
7719
+ /**
7720
+ * @param {Element|string} parentNode
7684
7721
  */
7685
7722
  attachTo(parentNode) {
7686
7723
  if (!parentNode) {
@@ -7698,10 +7735,10 @@ class FormEditor {
7698
7735
  this._detach();
7699
7736
  }
7700
7737
 
7701
- /**
7702
- * @internal
7703
- *
7704
- * @param {boolean} [emit]
7738
+ /**
7739
+ * @internal
7740
+ *
7741
+ * @param {boolean} [emit]
7705
7742
  */
7706
7743
  _detach(emit = true) {
7707
7744
  const container = this._container,
@@ -7715,9 +7752,9 @@ class FormEditor {
7715
7752
  parentNode.removeChild(container);
7716
7753
  }
7717
7754
 
7718
- /**
7719
- * @param {any} property
7720
- * @param {any} value
7755
+ /**
7756
+ * @param {any} property
7757
+ * @param {any} value
7721
7758
  */
7722
7759
  setProperty(property, value) {
7723
7760
  const properties = minDash.set(this._getState().properties, [property], value);
@@ -7726,21 +7763,21 @@ class FormEditor {
7726
7763
  });
7727
7764
  }
7728
7765
 
7729
- /**
7730
- * @param {string} type
7731
- * @param {Function} handler
7766
+ /**
7767
+ * @param {string} type
7768
+ * @param {Function} handler
7732
7769
  */
7733
7770
  off(type, handler) {
7734
7771
  this.get('eventBus').off(type, handler);
7735
7772
  }
7736
7773
 
7737
- /**
7738
- * @internal
7739
- *
7740
- * @param {FormEditorOptions} options
7741
- * @param {Element} container
7742
- *
7743
- * @returns {Injector}
7774
+ /**
7775
+ * @internal
7776
+ *
7777
+ * @param {FormEditorOptions} options
7778
+ * @param {Element} container
7779
+ *
7780
+ * @returns {Injector}
7744
7781
  */
7745
7782
  _createInjector(options, container) {
7746
7783
  const {
@@ -7762,22 +7799,22 @@ class FormEditor {
7762
7799
  }, core, ...modules, ...additionalModules]);
7763
7800
  }
7764
7801
 
7765
- /**
7766
- * @internal
7802
+ /**
7803
+ * @internal
7767
7804
  */
7768
7805
  _emit(type, data) {
7769
7806
  this.get('eventBus').fire(type, data);
7770
7807
  }
7771
7808
 
7772
- /**
7773
- * @internal
7809
+ /**
7810
+ * @internal
7774
7811
  */
7775
7812
  _getState() {
7776
7813
  return this._state;
7777
7814
  }
7778
7815
 
7779
- /**
7780
- * @internal
7816
+ /**
7817
+ * @internal
7781
7818
  */
7782
7819
  _setState(state) {
7783
7820
  this._state = {
@@ -7787,15 +7824,15 @@ class FormEditor {
7787
7824
  this._emit('changed', this._getState());
7788
7825
  }
7789
7826
 
7790
- /**
7791
- * @internal
7827
+ /**
7828
+ * @internal
7792
7829
  */
7793
7830
  _getModules() {
7794
7831
  return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
7795
7832
  }
7796
7833
 
7797
- /**
7798
- * @internal
7834
+ /**
7835
+ * @internal
7799
7836
  */
7800
7837
  _onEvent(type, priority, handler) {
7801
7838
  this.get('eventBus').on(type, priority, handler);