@bpmn-io/form-js-editor 0.10.1 → 0.11.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/LICENSE +22 -22
- package/README.md +119 -119
- package/dist/assets/form-js-editor.css +295 -295
- package/dist/index.cjs +226 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +226 -212
- package/dist/index.es.js.map +1 -1
- package/dist/types/FormEditor.d.ts +155 -155
- package/dist/types/core/Debounce.d.ts +10 -10
- package/dist/types/core/EventBus.d.ts +1 -1
- package/dist/types/core/FieldFactory.d.ts +18 -18
- package/dist/types/core/FormFieldRegistry.d.ts +19 -19
- package/dist/types/core/index.d.ts +17 -17
- package/dist/types/features/editor-actions/FormEditorActions.d.ts +8 -8
- package/dist/types/features/editor-actions/index.d.ts +6 -6
- package/dist/types/features/keyboard/FormEditorKeyboardBindings.d.ts +8 -8
- package/dist/types/features/keyboard/index.d.ts +7 -7
- package/dist/types/features/modeling/Modeling.d.ts +34 -34
- package/dist/types/features/modeling/behavior/IdBehavior.d.ts +7 -7
- package/dist/types/features/modeling/behavior/KeyBehavior.d.ts +7 -7
- package/dist/types/features/modeling/behavior/index.d.ts +8 -8
- package/dist/types/features/modeling/cmd/AddFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/EditFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/MoveFormFieldHandler.d.ts +17 -17
- package/dist/types/features/modeling/cmd/RemoveFormFieldHandler.d.ts +16 -16
- package/dist/types/features/modeling/cmd/UpdateIdClaimHandler.d.ts +14 -14
- package/dist/types/features/modeling/cmd/UpdateKeyClaimHandler.d.ts +14 -14
- package/dist/types/features/modeling/cmd/Util.d.ts +4 -4
- package/dist/types/features/modeling/index.d.ts +7 -7
- package/dist/types/features/palette/PaletteRenderer.d.ts +33 -33
- package/dist/types/features/palette/components/Palette.d.ts +1 -1
- package/dist/types/features/palette/index.d.ts +5 -5
- package/dist/types/features/properties-panel/PropertiesPanel.d.ts +1 -1
- package/dist/types/features/properties-panel/PropertiesPanelHeaderProvider.d.ts +5 -5
- package/dist/types/features/properties-panel/PropertiesPanelPlaceholderProvider.d.ts +8 -8
- package/dist/types/features/properties-panel/PropertiesPanelRenderer.d.ts +37 -37
- package/dist/types/features/properties-panel/Util.d.ts +9 -9
- package/dist/types/features/properties-panel/context/FormPropertiesPanelContext.d.ts +11 -11
- package/dist/types/features/properties-panel/context/index.d.ts +1 -1
- package/dist/types/features/properties-panel/entries/ActionEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/AdornerEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/AltTextEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ColumnsEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ConditionEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/CustomValueEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/DateTimeConstraintsEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/DateTimeEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/DateTimeSerializationEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/DefaultValueEntry.d.ts +1 -1
- package/dist/types/features/properties-panel/entries/DescriptionEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/DisabledEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/IdEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ImageSourceEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/InputKeyValuesSourceEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/KeyEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/LabelEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/NumberEntries.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/NumberSerializationEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/StaticValuesSourceEntry.d.ts +5 -5
- package/dist/types/features/properties-panel/entries/TextEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/ValueEntry.d.ts +11 -11
- package/dist/types/features/properties-panel/entries/ValuesSourceSelectEntry.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/factories/index.d.ts +1 -1
- package/dist/types/features/properties-panel/entries/factories/simpleStringEntryFactory.d.ts +9 -9
- package/dist/types/features/properties-panel/entries/index.d.ts +23 -23
- package/dist/types/features/properties-panel/groups/AppearanceGroup.d.ts +13 -13
- package/dist/types/features/properties-panel/groups/ConditionGroup.d.ts +11 -11
- package/dist/types/features/properties-panel/groups/ConstraintsGroup.d.ts +11 -11
- package/dist/types/features/properties-panel/groups/CustomValuesGroup.d.ts +31 -31
- package/dist/types/features/properties-panel/groups/GeneralGroup.d.ts +5 -5
- package/dist/types/features/properties-panel/groups/SerializationGroup.d.ts +11 -11
- package/dist/types/features/properties-panel/groups/ValidationGroup.d.ts +14 -14
- package/dist/types/features/properties-panel/groups/ValuesGroups.d.ts +1 -1
- package/dist/types/features/properties-panel/groups/index.d.ts +8 -8
- package/dist/types/features/properties-panel/hooks/index.d.ts +2 -2
- package/dist/types/features/properties-panel/hooks/usePropertiesPanelService.d.ts +1 -1
- package/dist/types/features/properties-panel/hooks/useVariables.d.ts +6 -6
- package/dist/types/features/properties-panel/icons/index.d.ts +1 -1
- package/dist/types/features/properties-panel/index.d.ts +6 -6
- package/dist/types/features/selection/Selection.d.ts +14 -14
- package/dist/types/features/selection/SelectionBehavior.d.ts +7 -7
- package/dist/types/features/selection/index.d.ts +8 -8
- package/dist/types/import/Importer.d.ts +51 -51
- package/dist/types/import/index.d.ts +5 -5
- package/dist/types/index.d.ts +15 -15
- package/dist/types/render/Renderer.d.ts +26 -26
- package/dist/types/render/components/FormEditor.d.ts +1 -1
- package/dist/types/render/components/icons/index.d.ts +1 -1
- package/dist/types/render/context/DragAndDropContext.d.ts +4 -4
- package/dist/types/render/context/FormEditorContext.d.ts +11 -11
- package/dist/types/render/context/index.d.ts +2 -2
- package/dist/types/render/hooks/useService.d.ts +1 -1
- package/dist/types/render/index.d.ts +8 -8
- package/dist/types/src/types.d.ts +28 -28
- 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;
|
|
@@ -2968,10 +2968,10 @@ class PaletteRenderer {
|
|
|
2968
2968
|
});
|
|
2969
2969
|
}
|
|
2970
2970
|
|
|
2971
|
-
/**
|
|
2972
|
-
* Attach the palette to a parent node.
|
|
2973
|
-
*
|
|
2974
|
-
* @param {HTMLElement} container
|
|
2971
|
+
/**
|
|
2972
|
+
* Attach the palette to a parent node.
|
|
2973
|
+
*
|
|
2974
|
+
* @param {HTMLElement} container
|
|
2975
2975
|
*/
|
|
2976
2976
|
attachTo(container) {
|
|
2977
2977
|
if (!container) {
|
|
@@ -2991,8 +2991,8 @@ class PaletteRenderer {
|
|
|
2991
2991
|
this._eventBus.fire('palette.attach');
|
|
2992
2992
|
}
|
|
2993
2993
|
|
|
2994
|
-
/**
|
|
2995
|
-
* Detach the palette from its parent node.
|
|
2994
|
+
/**
|
|
2995
|
+
* Detach the palette from its parent node.
|
|
2996
2996
|
*/
|
|
2997
2997
|
detach() {
|
|
2998
2998
|
const parentNode = this._container.parentNode;
|
|
@@ -5129,11 +5129,11 @@ function prefixId$1(id) {
|
|
|
5129
5129
|
return `bio-properties-panel-${id}`;
|
|
5130
5130
|
}
|
|
5131
5131
|
|
|
5132
|
-
/**
|
|
5133
|
-
* @param {string} type
|
|
5134
|
-
* @param {boolean} [strict]
|
|
5135
|
-
*
|
|
5136
|
-
* @returns {any}
|
|
5132
|
+
/**
|
|
5133
|
+
* @param {string} type
|
|
5134
|
+
* @param {boolean} [strict]
|
|
5135
|
+
*
|
|
5136
|
+
* @returns {any}
|
|
5137
5137
|
*/
|
|
5138
5138
|
function getService(type, strict) {}
|
|
5139
5139
|
const PropertiesPanelContext = preact.createContext({
|
|
@@ -5221,8 +5221,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
5221
5221
|
}
|
|
5222
5222
|
};
|
|
5223
5223
|
|
|
5224
|
-
/**
|
|
5225
|
-
* Provide placeholders for empty and multiple state.
|
|
5224
|
+
/**
|
|
5225
|
+
* Provide placeholders for empty and multiple state.
|
|
5226
5226
|
*/
|
|
5227
5227
|
const PropertiesPanelPlaceholderProvider = {
|
|
5228
5228
|
getEmpty: () => {
|
|
@@ -5294,10 +5294,10 @@ function useService (type, strict) {
|
|
|
5294
5294
|
return getService(type, strict);
|
|
5295
5295
|
}
|
|
5296
5296
|
|
|
5297
|
-
/**
|
|
5298
|
-
* Retrieve list of variables from the form schema.
|
|
5299
|
-
*
|
|
5300
|
-
* @returns { string[] } list of variables used in form schema
|
|
5297
|
+
/**
|
|
5298
|
+
* Retrieve list of variables from the form schema.
|
|
5299
|
+
*
|
|
5300
|
+
* @returns { string[] } list of variables used in form schema
|
|
5301
5301
|
*/
|
|
5302
5302
|
function useVariables() {
|
|
5303
5303
|
const form = useService('formEditor');
|
|
@@ -6106,7 +6106,12 @@ function NumberArrowStep(props) {
|
|
|
6106
6106
|
if (!isValidNumber(value)) return null;
|
|
6107
6107
|
return value;
|
|
6108
6108
|
};
|
|
6109
|
-
const
|
|
6109
|
+
const clearLeadingZeroes = value => {
|
|
6110
|
+
if (!value) return value;
|
|
6111
|
+
const trimmed = value.replace(/^0+/g, '');
|
|
6112
|
+
return (trimmed.startsWith('.') ? '0' : '') + trimmed;
|
|
6113
|
+
};
|
|
6114
|
+
const setValue = value => editField(field, ['increment'], clearLeadingZeroes(value));
|
|
6110
6115
|
const decimalDigitsSet = decimalDigits || decimalDigits === 0;
|
|
6111
6116
|
return TextfieldEntry({
|
|
6112
6117
|
debounce,
|
|
@@ -6582,14 +6587,14 @@ function Value(props) {
|
|
|
6582
6587
|
|
|
6583
6588
|
// helpers //////////
|
|
6584
6589
|
|
|
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}
|
|
6590
|
+
/**
|
|
6591
|
+
* Returns copy of object with updated value.
|
|
6592
|
+
*
|
|
6593
|
+
* @param {Object} properties
|
|
6594
|
+
* @param {string} key
|
|
6595
|
+
* @param {string} value
|
|
6596
|
+
*
|
|
6597
|
+
* @returns {Object}
|
|
6593
6598
|
*/
|
|
6594
6599
|
function updateValue(properties, key, value) {
|
|
6595
6600
|
return {
|
|
@@ -6598,14 +6603,14 @@ function updateValue(properties, key, value) {
|
|
|
6598
6603
|
};
|
|
6599
6604
|
}
|
|
6600
6605
|
|
|
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}
|
|
6606
|
+
/**
|
|
6607
|
+
* Returns copy of object with updated key.
|
|
6608
|
+
*
|
|
6609
|
+
* @param {Object} properties
|
|
6610
|
+
* @param {string} oldKey
|
|
6611
|
+
* @param {string} newKey
|
|
6612
|
+
*
|
|
6613
|
+
* @returns {Object}
|
|
6609
6614
|
*/
|
|
6610
6615
|
function updateKey(properties, oldKey, newKey) {
|
|
6611
6616
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6991,7 +6996,7 @@ function ConstraintsGroup(field, editField) {
|
|
|
6991
6996
|
|
|
6992
6997
|
const VALIDATION_TYPE_OPTIONS = {
|
|
6993
6998
|
custom: {
|
|
6994
|
-
value:
|
|
6999
|
+
value: undefined,
|
|
6995
7000
|
label: 'Custom'
|
|
6996
7001
|
},
|
|
6997
7002
|
email: {
|
|
@@ -7170,10 +7175,10 @@ function Min(props) {
|
|
|
7170
7175
|
return NumberFieldEntry({
|
|
7171
7176
|
debounce,
|
|
7172
7177
|
element: field,
|
|
7173
|
-
getValue: getValue('min'),
|
|
7174
7178
|
id,
|
|
7175
7179
|
label: 'Minimum',
|
|
7176
|
-
|
|
7180
|
+
step: 'any',
|
|
7181
|
+
getValue: getValue('min'),
|
|
7177
7182
|
setValue: onChange('min')
|
|
7178
7183
|
});
|
|
7179
7184
|
}
|
|
@@ -7188,10 +7193,10 @@ function Max(props) {
|
|
|
7188
7193
|
return NumberFieldEntry({
|
|
7189
7194
|
debounce,
|
|
7190
7195
|
element: field,
|
|
7191
|
-
getValue: getValue('max'),
|
|
7192
7196
|
id,
|
|
7193
7197
|
label: 'Maximum',
|
|
7194
|
-
|
|
7198
|
+
step: 'any',
|
|
7199
|
+
getValue: getValue('max'),
|
|
7195
7200
|
setValue: onChange('max')
|
|
7196
7201
|
});
|
|
7197
7202
|
}
|
|
@@ -7203,16 +7208,25 @@ function ValidationType(props) {
|
|
|
7203
7208
|
onChange
|
|
7204
7209
|
} = props;
|
|
7205
7210
|
const debounce = useService('debounce');
|
|
7211
|
+
const clearCustomValidation = () => {
|
|
7212
|
+
onChange('minLength')(undefined);
|
|
7213
|
+
onChange('maxLength')(undefined);
|
|
7214
|
+
onChange('pattern')(undefined);
|
|
7215
|
+
};
|
|
7216
|
+
const setValue = validationType => {
|
|
7217
|
+
if (validationType) {
|
|
7218
|
+
clearCustomValidation();
|
|
7219
|
+
}
|
|
7220
|
+
onChange('validationType')(validationType || undefined);
|
|
7221
|
+
};
|
|
7206
7222
|
return SelectEntry({
|
|
7207
7223
|
debounce,
|
|
7208
7224
|
element: field,
|
|
7209
7225
|
getValue: getValue('validationType'),
|
|
7210
7226
|
id,
|
|
7211
7227
|
label: 'Regular expression validation',
|
|
7212
|
-
setValue
|
|
7213
|
-
getOptions()
|
|
7214
|
-
return Object.values(VALIDATION_TYPE_OPTIONS);
|
|
7215
|
-
}
|
|
7228
|
+
setValue,
|
|
7229
|
+
getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
|
|
7216
7230
|
});
|
|
7217
7231
|
}
|
|
7218
7232
|
|
|
@@ -7230,8 +7244,8 @@ function ValuesGroups(field, editField) {
|
|
|
7230
7244
|
};
|
|
7231
7245
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
7232
7246
|
|
|
7233
|
-
/**
|
|
7234
|
-
* @type {Array<Group|ListGroup>}
|
|
7247
|
+
/**
|
|
7248
|
+
* @type {Array<Group|ListGroup>}
|
|
7235
7249
|
*/
|
|
7236
7250
|
const groups = [{
|
|
7237
7251
|
id: valuesSourceId,
|
|
@@ -7332,13 +7346,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
7332
7346
|
|
|
7333
7347
|
// helpers //////////
|
|
7334
7348
|
|
|
7335
|
-
/**
|
|
7336
|
-
* Returns copy of object without key.
|
|
7337
|
-
*
|
|
7338
|
-
* @param {Object} properties
|
|
7339
|
-
* @param {string} oldKey
|
|
7340
|
-
*
|
|
7341
|
-
* @returns {Object}
|
|
7349
|
+
/**
|
|
7350
|
+
* Returns copy of object without key.
|
|
7351
|
+
*
|
|
7352
|
+
* @param {Object} properties
|
|
7353
|
+
* @param {string} oldKey
|
|
7354
|
+
*
|
|
7355
|
+
* @returns {Object}
|
|
7342
7356
|
*/
|
|
7343
7357
|
function removeKey(properties, oldKey) {
|
|
7344
7358
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -7431,9 +7445,9 @@ function FormPropertiesPanel(props) {
|
|
|
7431
7445
|
}, []);
|
|
7432
7446
|
hooks$1.useLayoutEffect(() => {
|
|
7433
7447
|
const onFieldChanged = () => {
|
|
7434
|
-
/**
|
|
7435
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
7436
|
-
* once we have a proper updater/change support
|
|
7448
|
+
/**
|
|
7449
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
7450
|
+
* once we have a proper updater/change support
|
|
7437
7451
|
*/
|
|
7438
7452
|
_update(selection.get() || schema);
|
|
7439
7453
|
};
|
|
@@ -7485,10 +7499,10 @@ class PropertiesPanelRenderer {
|
|
|
7485
7499
|
});
|
|
7486
7500
|
}
|
|
7487
7501
|
|
|
7488
|
-
/**
|
|
7489
|
-
* Attach the properties panel to a parent node.
|
|
7490
|
-
*
|
|
7491
|
-
* @param {HTMLElement} container
|
|
7502
|
+
/**
|
|
7503
|
+
* Attach the properties panel to a parent node.
|
|
7504
|
+
*
|
|
7505
|
+
* @param {HTMLElement} container
|
|
7492
7506
|
*/
|
|
7493
7507
|
attachTo(container) {
|
|
7494
7508
|
if (!container) {
|
|
@@ -7508,8 +7522,8 @@ class PropertiesPanelRenderer {
|
|
|
7508
7522
|
this._eventBus.fire('propertiesPanel.attach');
|
|
7509
7523
|
}
|
|
7510
7524
|
|
|
7511
|
-
/**
|
|
7512
|
-
* Detach the properties panel from its parent node.
|
|
7525
|
+
/**
|
|
7526
|
+
* Detach the properties panel from its parent node.
|
|
7513
7527
|
*/
|
|
7514
7528
|
detach() {
|
|
7515
7529
|
const parentNode = this._container.parentNode;
|
|
@@ -7541,48 +7555,48 @@ var PropertiesPanelModule = {
|
|
|
7541
7555
|
|
|
7542
7556
|
const ids = new Ids__default['default']([32, 36, 1]);
|
|
7543
7557
|
|
|
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
|
|
7558
|
+
/**
|
|
7559
|
+
* @typedef { import('./types').Injector } Injector
|
|
7560
|
+
* @typedef { import('./types').Module } Module
|
|
7561
|
+
* @typedef { import('./types').Schema } Schema
|
|
7562
|
+
*
|
|
7563
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
7564
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
7565
|
+
*
|
|
7566
|
+
* @typedef { {
|
|
7567
|
+
* properties: FormEditorProperties,
|
|
7568
|
+
* schema: Schema
|
|
7569
|
+
* } } State
|
|
7570
|
+
*
|
|
7571
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7572
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
7573
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7560
7574
|
*/
|
|
7561
7575
|
|
|
7562
|
-
/**
|
|
7563
|
-
* The form editor.
|
|
7576
|
+
/**
|
|
7577
|
+
* The form editor.
|
|
7564
7578
|
*/
|
|
7565
7579
|
class FormEditor {
|
|
7566
|
-
/**
|
|
7567
|
-
* @constructor
|
|
7568
|
-
* @param {FormEditorOptions} options
|
|
7580
|
+
/**
|
|
7581
|
+
* @constructor
|
|
7582
|
+
* @param {FormEditorOptions} options
|
|
7569
7583
|
*/
|
|
7570
7584
|
constructor(options = {}) {
|
|
7571
|
-
/**
|
|
7572
|
-
* @public
|
|
7573
|
-
* @type {OnEventType}
|
|
7585
|
+
/**
|
|
7586
|
+
* @public
|
|
7587
|
+
* @type {OnEventType}
|
|
7574
7588
|
*/
|
|
7575
7589
|
this.on = this._onEvent;
|
|
7576
7590
|
|
|
7577
|
-
/**
|
|
7578
|
-
* @public
|
|
7579
|
-
* @type {String}
|
|
7591
|
+
/**
|
|
7592
|
+
* @public
|
|
7593
|
+
* @type {String}
|
|
7580
7594
|
*/
|
|
7581
7595
|
this._id = ids.next();
|
|
7582
7596
|
|
|
7583
|
-
/**
|
|
7584
|
-
* @private
|
|
7585
|
-
* @type {Element}
|
|
7597
|
+
/**
|
|
7598
|
+
* @private
|
|
7599
|
+
* @type {Element}
|
|
7586
7600
|
*/
|
|
7587
7601
|
this._container = formJsViewer.createFormContainer();
|
|
7588
7602
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -7593,15 +7607,15 @@ class FormEditor {
|
|
|
7593
7607
|
properties = {}
|
|
7594
7608
|
} = options;
|
|
7595
7609
|
|
|
7596
|
-
/**
|
|
7597
|
-
* @private
|
|
7598
|
-
* @type {any}
|
|
7610
|
+
/**
|
|
7611
|
+
* @private
|
|
7612
|
+
* @type {any}
|
|
7599
7613
|
*/
|
|
7600
7614
|
this.exporter = exporter;
|
|
7601
7615
|
|
|
7602
|
-
/**
|
|
7603
|
-
* @private
|
|
7604
|
-
* @type {State}
|
|
7616
|
+
/**
|
|
7617
|
+
* @private
|
|
7618
|
+
* @type {State}
|
|
7605
7619
|
*/
|
|
7606
7620
|
this._state = {
|
|
7607
7621
|
properties,
|
|
@@ -7630,10 +7644,10 @@ class FormEditor {
|
|
|
7630
7644
|
this._detach(false);
|
|
7631
7645
|
}
|
|
7632
7646
|
|
|
7633
|
-
/**
|
|
7634
|
-
* @param {Schema} schema
|
|
7635
|
-
*
|
|
7636
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
7647
|
+
/**
|
|
7648
|
+
* @param {Schema} schema
|
|
7649
|
+
*
|
|
7650
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
7637
7651
|
*/
|
|
7638
7652
|
importSchema(schema) {
|
|
7639
7653
|
return new Promise((resolve, reject) => {
|
|
@@ -7662,15 +7676,15 @@ class FormEditor {
|
|
|
7662
7676
|
});
|
|
7663
7677
|
}
|
|
7664
7678
|
|
|
7665
|
-
/**
|
|
7666
|
-
* @returns {Schema}
|
|
7679
|
+
/**
|
|
7680
|
+
* @returns {Schema}
|
|
7667
7681
|
*/
|
|
7668
7682
|
saveSchema() {
|
|
7669
7683
|
return this.getSchema();
|
|
7670
7684
|
}
|
|
7671
7685
|
|
|
7672
|
-
/**
|
|
7673
|
-
* @returns {Schema}
|
|
7686
|
+
/**
|
|
7687
|
+
* @returns {Schema}
|
|
7674
7688
|
*/
|
|
7675
7689
|
getSchema() {
|
|
7676
7690
|
const {
|
|
@@ -7679,8 +7693,8 @@ class FormEditor {
|
|
|
7679
7693
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
7680
7694
|
}
|
|
7681
7695
|
|
|
7682
|
-
/**
|
|
7683
|
-
* @param {Element|string} parentNode
|
|
7696
|
+
/**
|
|
7697
|
+
* @param {Element|string} parentNode
|
|
7684
7698
|
*/
|
|
7685
7699
|
attachTo(parentNode) {
|
|
7686
7700
|
if (!parentNode) {
|
|
@@ -7698,10 +7712,10 @@ class FormEditor {
|
|
|
7698
7712
|
this._detach();
|
|
7699
7713
|
}
|
|
7700
7714
|
|
|
7701
|
-
/**
|
|
7702
|
-
* @internal
|
|
7703
|
-
*
|
|
7704
|
-
* @param {boolean} [emit]
|
|
7715
|
+
/**
|
|
7716
|
+
* @internal
|
|
7717
|
+
*
|
|
7718
|
+
* @param {boolean} [emit]
|
|
7705
7719
|
*/
|
|
7706
7720
|
_detach(emit = true) {
|
|
7707
7721
|
const container = this._container,
|
|
@@ -7715,9 +7729,9 @@ class FormEditor {
|
|
|
7715
7729
|
parentNode.removeChild(container);
|
|
7716
7730
|
}
|
|
7717
7731
|
|
|
7718
|
-
/**
|
|
7719
|
-
* @param {any} property
|
|
7720
|
-
* @param {any} value
|
|
7732
|
+
/**
|
|
7733
|
+
* @param {any} property
|
|
7734
|
+
* @param {any} value
|
|
7721
7735
|
*/
|
|
7722
7736
|
setProperty(property, value) {
|
|
7723
7737
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -7726,21 +7740,21 @@ class FormEditor {
|
|
|
7726
7740
|
});
|
|
7727
7741
|
}
|
|
7728
7742
|
|
|
7729
|
-
/**
|
|
7730
|
-
* @param {string} type
|
|
7731
|
-
* @param {Function} handler
|
|
7743
|
+
/**
|
|
7744
|
+
* @param {string} type
|
|
7745
|
+
* @param {Function} handler
|
|
7732
7746
|
*/
|
|
7733
7747
|
off(type, handler) {
|
|
7734
7748
|
this.get('eventBus').off(type, handler);
|
|
7735
7749
|
}
|
|
7736
7750
|
|
|
7737
|
-
/**
|
|
7738
|
-
* @internal
|
|
7739
|
-
*
|
|
7740
|
-
* @param {FormEditorOptions} options
|
|
7741
|
-
* @param {Element} container
|
|
7742
|
-
*
|
|
7743
|
-
* @returns {Injector}
|
|
7751
|
+
/**
|
|
7752
|
+
* @internal
|
|
7753
|
+
*
|
|
7754
|
+
* @param {FormEditorOptions} options
|
|
7755
|
+
* @param {Element} container
|
|
7756
|
+
*
|
|
7757
|
+
* @returns {Injector}
|
|
7744
7758
|
*/
|
|
7745
7759
|
_createInjector(options, container) {
|
|
7746
7760
|
const {
|
|
@@ -7762,22 +7776,22 @@ class FormEditor {
|
|
|
7762
7776
|
}, core, ...modules, ...additionalModules]);
|
|
7763
7777
|
}
|
|
7764
7778
|
|
|
7765
|
-
/**
|
|
7766
|
-
* @internal
|
|
7779
|
+
/**
|
|
7780
|
+
* @internal
|
|
7767
7781
|
*/
|
|
7768
7782
|
_emit(type, data) {
|
|
7769
7783
|
this.get('eventBus').fire(type, data);
|
|
7770
7784
|
}
|
|
7771
7785
|
|
|
7772
|
-
/**
|
|
7773
|
-
* @internal
|
|
7786
|
+
/**
|
|
7787
|
+
* @internal
|
|
7774
7788
|
*/
|
|
7775
7789
|
_getState() {
|
|
7776
7790
|
return this._state;
|
|
7777
7791
|
}
|
|
7778
7792
|
|
|
7779
|
-
/**
|
|
7780
|
-
* @internal
|
|
7793
|
+
/**
|
|
7794
|
+
* @internal
|
|
7781
7795
|
*/
|
|
7782
7796
|
_setState(state) {
|
|
7783
7797
|
this._state = {
|
|
@@ -7787,15 +7801,15 @@ class FormEditor {
|
|
|
7787
7801
|
this._emit('changed', this._getState());
|
|
7788
7802
|
}
|
|
7789
7803
|
|
|
7790
|
-
/**
|
|
7791
|
-
* @internal
|
|
7804
|
+
/**
|
|
7805
|
+
* @internal
|
|
7792
7806
|
*/
|
|
7793
7807
|
_getModules() {
|
|
7794
7808
|
return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
|
|
7795
7809
|
}
|
|
7796
7810
|
|
|
7797
|
-
/**
|
|
7798
|
-
* @internal
|
|
7811
|
+
/**
|
|
7812
|
+
* @internal
|
|
7799
7813
|
*/
|
|
7800
7814
|
_onEvent(type, priority, handler) {
|
|
7801
7815
|
this.get('eventBus').on(type, priority, handler);
|