@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.es.js
CHANGED
|
@@ -446,10 +446,10 @@ function invokeFunction(fn, args) {
|
|
|
446
446
|
return fn.apply(null, args);
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
/**
|
|
450
|
-
* A factory to create a configurable debouncer.
|
|
451
|
-
*
|
|
452
|
-
* @param {number|boolean} [config=true]
|
|
449
|
+
/**
|
|
450
|
+
* A factory to create a configurable debouncer.
|
|
451
|
+
*
|
|
452
|
+
* @param {number|boolean} [config=true]
|
|
453
453
|
*/
|
|
454
454
|
function DebounceFactory(config = true) {
|
|
455
455
|
const timeout = typeof config === 'number' ? config : config ? 300 : 0;
|
|
@@ -462,11 +462,11 @@ function DebounceFactory(config = true) {
|
|
|
462
462
|
DebounceFactory.$inject = ['config.debounce'];
|
|
463
463
|
|
|
464
464
|
class FieldFactory {
|
|
465
|
-
/**
|
|
466
|
-
* @constructor
|
|
467
|
-
*
|
|
468
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
469
|
-
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
465
|
+
/**
|
|
466
|
+
* @constructor
|
|
467
|
+
*
|
|
468
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
469
|
+
* @param { import('@bpmn-io/form-js-viewer').FormFields } formFields
|
|
470
470
|
*/
|
|
471
471
|
constructor(formFieldRegistry, formFields) {
|
|
472
472
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -526,11 +526,11 @@ class FieldFactory {
|
|
|
526
526
|
FieldFactory.$inject = ['formFieldRegistry', 'formFields'];
|
|
527
527
|
|
|
528
528
|
class FormFieldRegistry extends FormFieldRegistry$1 {
|
|
529
|
-
/**
|
|
530
|
-
* Updates a form fields id.
|
|
531
|
-
*
|
|
532
|
-
* @param {Object} formField
|
|
533
|
-
* @param {string} newId
|
|
529
|
+
/**
|
|
530
|
+
* Updates a form fields id.
|
|
531
|
+
*
|
|
532
|
+
* @param {Object} formField
|
|
533
|
+
* @param {string} newId
|
|
534
534
|
*/
|
|
535
535
|
updateId(formField, newId) {
|
|
536
536
|
this._validateId(newId);
|
|
@@ -551,13 +551,13 @@ class FormFieldRegistry extends FormFieldRegistry$1 {
|
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
/**
|
|
555
|
-
* Validate the suitability of the given id and signals a problem
|
|
556
|
-
* with an exception.
|
|
557
|
-
*
|
|
558
|
-
* @param {string} id
|
|
559
|
-
*
|
|
560
|
-
* @throws {Error} if id is empty or already assigned
|
|
554
|
+
/**
|
|
555
|
+
* Validate the suitability of the given id and signals a problem
|
|
556
|
+
* with an exception.
|
|
557
|
+
*
|
|
558
|
+
* @param {string} id
|
|
559
|
+
*
|
|
560
|
+
* @throws {Error} if id is empty or already assigned
|
|
561
561
|
*/
|
|
562
562
|
_validateId(id) {
|
|
563
563
|
if (!id) {
|
|
@@ -570,31 +570,31 @@ class FormFieldRegistry extends FormFieldRegistry$1 {
|
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
class Importer {
|
|
573
|
-
/**
|
|
574
|
-
* @constructor
|
|
575
|
-
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
576
|
-
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
573
|
+
/**
|
|
574
|
+
* @constructor
|
|
575
|
+
* @param { import('../core/FormFieldRegistry').default } formFieldRegistry
|
|
576
|
+
* @param { import('../core/FieldFactory').default } fieldFactory
|
|
577
577
|
*/
|
|
578
578
|
constructor(formFieldRegistry, fieldFactory) {
|
|
579
579
|
this._formFieldRegistry = formFieldRegistry;
|
|
580
580
|
this._fieldFactory = fieldFactory;
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
-
/**
|
|
584
|
-
* Import schema creating fields, attaching additional
|
|
585
|
-
* information to each field and adding fields to the
|
|
586
|
-
* field registry.
|
|
587
|
-
*
|
|
588
|
-
* Additional information attached:
|
|
589
|
-
*
|
|
590
|
-
* * `id` (unless present)
|
|
591
|
-
* * `_parent`
|
|
592
|
-
* * `_path`
|
|
593
|
-
*
|
|
594
|
-
* @param {any} schema
|
|
595
|
-
*
|
|
596
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
597
|
-
* @returns {ImportResult}
|
|
583
|
+
/**
|
|
584
|
+
* Import schema creating fields, attaching additional
|
|
585
|
+
* information to each field and adding fields to the
|
|
586
|
+
* field registry.
|
|
587
|
+
*
|
|
588
|
+
* Additional information attached:
|
|
589
|
+
*
|
|
590
|
+
* * `id` (unless present)
|
|
591
|
+
* * `_parent`
|
|
592
|
+
* * `_path`
|
|
593
|
+
*
|
|
594
|
+
* @param {any} schema
|
|
595
|
+
*
|
|
596
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
597
|
+
* @returns {ImportResult}
|
|
598
598
|
*/
|
|
599
599
|
importSchema(schema) {
|
|
600
600
|
// TODO: Add warnings
|
|
@@ -611,12 +611,12 @@ class Importer {
|
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
-
/**
|
|
615
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
616
|
-
* @param {String} [parentId]
|
|
617
|
-
* @param {number} [index]
|
|
618
|
-
*
|
|
619
|
-
* @return {any} field
|
|
614
|
+
/**
|
|
615
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
616
|
+
* @param {String} [parentId]
|
|
617
|
+
* @param {number} [index]
|
|
618
|
+
*
|
|
619
|
+
* @return {any} field
|
|
620
620
|
*/
|
|
621
621
|
importFormField(fieldAttrs, parentId, index) {
|
|
622
622
|
const {
|
|
@@ -653,11 +653,11 @@ class Importer {
|
|
|
653
653
|
return field;
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
-
/**
|
|
657
|
-
* @param {Array<any>} components
|
|
658
|
-
* @param {string} parentId
|
|
659
|
-
*
|
|
660
|
-
* @return {Array<any>} imported components
|
|
656
|
+
/**
|
|
657
|
+
* @param {Array<any>} components
|
|
658
|
+
* @param {string} parentId
|
|
659
|
+
*
|
|
660
|
+
* @return {Array<any>} imported components
|
|
661
661
|
*/
|
|
662
662
|
importFormFields(components, parentId) {
|
|
663
663
|
return components.map((component, index) => {
|
|
@@ -675,11 +675,11 @@ const DragAndDropContext = createContext({
|
|
|
675
675
|
drake: null
|
|
676
676
|
});
|
|
677
677
|
|
|
678
|
-
/**
|
|
679
|
-
* @param {string} type
|
|
680
|
-
* @param {boolean} [strict]
|
|
681
|
-
*
|
|
682
|
-
* @returns {any}
|
|
678
|
+
/**
|
|
679
|
+
* @param {string} type
|
|
680
|
+
* @param {boolean} [strict]
|
|
681
|
+
*
|
|
682
|
+
* @returns {any}
|
|
683
683
|
*/
|
|
684
684
|
function getService$1(type, strict) {}
|
|
685
685
|
const FormEditorContext = createContext({
|
|
@@ -1748,10 +1748,10 @@ function updatePath(formFieldRegistry, formField, index) {
|
|
|
1748
1748
|
}
|
|
1749
1749
|
|
|
1750
1750
|
class AddFormFieldHandler {
|
|
1751
|
-
/**
|
|
1752
|
-
* @constructor
|
|
1753
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
1754
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1751
|
+
/**
|
|
1752
|
+
* @constructor
|
|
1753
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1754
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1755
1755
|
*/
|
|
1756
1756
|
constructor(formEditor, formFieldRegistry) {
|
|
1757
1757
|
this._formEditor = formEditor;
|
|
@@ -1812,10 +1812,10 @@ class AddFormFieldHandler {
|
|
|
1812
1812
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
1813
1813
|
|
|
1814
1814
|
class EditFormFieldHandler {
|
|
1815
|
-
/**
|
|
1816
|
-
* @constructor
|
|
1817
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
1818
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1815
|
+
/**
|
|
1816
|
+
* @constructor
|
|
1817
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1818
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1819
1819
|
*/
|
|
1820
1820
|
constructor(formEditor, formFieldRegistry) {
|
|
1821
1821
|
this._formEditor = formEditor;
|
|
@@ -1878,10 +1878,10 @@ class EditFormFieldHandler {
|
|
|
1878
1878
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
1879
1879
|
|
|
1880
1880
|
class MoveFormFieldHandler {
|
|
1881
|
-
/**
|
|
1882
|
-
* @constructor
|
|
1883
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
1884
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1881
|
+
/**
|
|
1882
|
+
* @constructor
|
|
1883
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1884
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1885
1885
|
*/
|
|
1886
1886
|
constructor(formEditor, formFieldRegistry) {
|
|
1887
1887
|
this._formEditor = formEditor;
|
|
@@ -1958,10 +1958,10 @@ class MoveFormFieldHandler {
|
|
|
1958
1958
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
1959
1959
|
|
|
1960
1960
|
class RemoveFormFieldHandler {
|
|
1961
|
-
/**
|
|
1962
|
-
* @constructor
|
|
1963
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
1964
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1961
|
+
/**
|
|
1962
|
+
* @constructor
|
|
1963
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1964
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1965
1965
|
*/
|
|
1966
1966
|
constructor(formEditor, formFieldRegistry) {
|
|
1967
1967
|
this._formEditor = formEditor;
|
|
@@ -2021,9 +2021,9 @@ class RemoveFormFieldHandler {
|
|
|
2021
2021
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2022
2022
|
|
|
2023
2023
|
class UpdateIdClaimHandler {
|
|
2024
|
-
/**
|
|
2025
|
-
* @constructor
|
|
2026
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2024
|
+
/**
|
|
2025
|
+
* @constructor
|
|
2026
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2027
2027
|
*/
|
|
2028
2028
|
constructor(formFieldRegistry) {
|
|
2029
2029
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -2056,9 +2056,9 @@ class UpdateIdClaimHandler {
|
|
|
2056
2056
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
2057
2057
|
|
|
2058
2058
|
class UpdateKeyClaimHandler {
|
|
2059
|
-
/**
|
|
2060
|
-
* @constructor
|
|
2061
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2059
|
+
/**
|
|
2060
|
+
* @constructor
|
|
2061
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2062
2062
|
*/
|
|
2063
2063
|
constructor(formFieldRegistry) {
|
|
2064
2064
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -2956,10 +2956,10 @@ class PaletteRenderer {
|
|
|
2956
2956
|
});
|
|
2957
2957
|
}
|
|
2958
2958
|
|
|
2959
|
-
/**
|
|
2960
|
-
* Attach the palette to a parent node.
|
|
2961
|
-
*
|
|
2962
|
-
* @param {HTMLElement} container
|
|
2959
|
+
/**
|
|
2960
|
+
* Attach the palette to a parent node.
|
|
2961
|
+
*
|
|
2962
|
+
* @param {HTMLElement} container
|
|
2963
2963
|
*/
|
|
2964
2964
|
attachTo(container) {
|
|
2965
2965
|
if (!container) {
|
|
@@ -2979,8 +2979,8 @@ class PaletteRenderer {
|
|
|
2979
2979
|
this._eventBus.fire('palette.attach');
|
|
2980
2980
|
}
|
|
2981
2981
|
|
|
2982
|
-
/**
|
|
2983
|
-
* Detach the palette from its parent node.
|
|
2982
|
+
/**
|
|
2983
|
+
* Detach the palette from its parent node.
|
|
2984
2984
|
*/
|
|
2985
2985
|
detach() {
|
|
2986
2986
|
const parentNode = this._container.parentNode;
|
|
@@ -5117,11 +5117,11 @@ function prefixId$1(id) {
|
|
|
5117
5117
|
return `bio-properties-panel-${id}`;
|
|
5118
5118
|
}
|
|
5119
5119
|
|
|
5120
|
-
/**
|
|
5121
|
-
* @param {string} type
|
|
5122
|
-
* @param {boolean} [strict]
|
|
5123
|
-
*
|
|
5124
|
-
* @returns {any}
|
|
5120
|
+
/**
|
|
5121
|
+
* @param {string} type
|
|
5122
|
+
* @param {boolean} [strict]
|
|
5123
|
+
*
|
|
5124
|
+
* @returns {any}
|
|
5125
5125
|
*/
|
|
5126
5126
|
function getService(type, strict) {}
|
|
5127
5127
|
const PropertiesPanelContext = createContext({
|
|
@@ -5209,8 +5209,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
5209
5209
|
}
|
|
5210
5210
|
};
|
|
5211
5211
|
|
|
5212
|
-
/**
|
|
5213
|
-
* Provide placeholders for empty and multiple state.
|
|
5212
|
+
/**
|
|
5213
|
+
* Provide placeholders for empty and multiple state.
|
|
5214
5214
|
*/
|
|
5215
5215
|
const PropertiesPanelPlaceholderProvider = {
|
|
5216
5216
|
getEmpty: () => {
|
|
@@ -5282,10 +5282,10 @@ function useService (type, strict) {
|
|
|
5282
5282
|
return getService(type, strict);
|
|
5283
5283
|
}
|
|
5284
5284
|
|
|
5285
|
-
/**
|
|
5286
|
-
* Retrieve list of variables from the form schema.
|
|
5287
|
-
*
|
|
5288
|
-
* @returns { string[] } list of variables used in form schema
|
|
5285
|
+
/**
|
|
5286
|
+
* Retrieve list of variables from the form schema.
|
|
5287
|
+
*
|
|
5288
|
+
* @returns { string[] } list of variables used in form schema
|
|
5289
5289
|
*/
|
|
5290
5290
|
function useVariables() {
|
|
5291
5291
|
const form = useService('formEditor');
|
|
@@ -6094,7 +6094,12 @@ function NumberArrowStep(props) {
|
|
|
6094
6094
|
if (!isValidNumber(value)) return null;
|
|
6095
6095
|
return value;
|
|
6096
6096
|
};
|
|
6097
|
-
const
|
|
6097
|
+
const clearLeadingZeroes = value => {
|
|
6098
|
+
if (!value) return value;
|
|
6099
|
+
const trimmed = value.replace(/^0+/g, '');
|
|
6100
|
+
return (trimmed.startsWith('.') ? '0' : '') + trimmed;
|
|
6101
|
+
};
|
|
6102
|
+
const setValue = value => editField(field, ['increment'], clearLeadingZeroes(value));
|
|
6098
6103
|
const decimalDigitsSet = decimalDigits || decimalDigits === 0;
|
|
6099
6104
|
return TextfieldEntry({
|
|
6100
6105
|
debounce,
|
|
@@ -6570,14 +6575,14 @@ function Value(props) {
|
|
|
6570
6575
|
|
|
6571
6576
|
// helpers //////////
|
|
6572
6577
|
|
|
6573
|
-
/**
|
|
6574
|
-
* Returns copy of object with updated value.
|
|
6575
|
-
*
|
|
6576
|
-
* @param {Object} properties
|
|
6577
|
-
* @param {string} key
|
|
6578
|
-
* @param {string} value
|
|
6579
|
-
*
|
|
6580
|
-
* @returns {Object}
|
|
6578
|
+
/**
|
|
6579
|
+
* Returns copy of object with updated value.
|
|
6580
|
+
*
|
|
6581
|
+
* @param {Object} properties
|
|
6582
|
+
* @param {string} key
|
|
6583
|
+
* @param {string} value
|
|
6584
|
+
*
|
|
6585
|
+
* @returns {Object}
|
|
6581
6586
|
*/
|
|
6582
6587
|
function updateValue(properties, key, value) {
|
|
6583
6588
|
return {
|
|
@@ -6586,14 +6591,14 @@ function updateValue(properties, key, value) {
|
|
|
6586
6591
|
};
|
|
6587
6592
|
}
|
|
6588
6593
|
|
|
6589
|
-
/**
|
|
6590
|
-
* Returns copy of object with updated key.
|
|
6591
|
-
*
|
|
6592
|
-
* @param {Object} properties
|
|
6593
|
-
* @param {string} oldKey
|
|
6594
|
-
* @param {string} newKey
|
|
6595
|
-
*
|
|
6596
|
-
* @returns {Object}
|
|
6594
|
+
/**
|
|
6595
|
+
* Returns copy of object with updated key.
|
|
6596
|
+
*
|
|
6597
|
+
* @param {Object} properties
|
|
6598
|
+
* @param {string} oldKey
|
|
6599
|
+
* @param {string} newKey
|
|
6600
|
+
*
|
|
6601
|
+
* @returns {Object}
|
|
6597
6602
|
*/
|
|
6598
6603
|
function updateKey(properties, oldKey, newKey) {
|
|
6599
6604
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6979,7 +6984,7 @@ function ConstraintsGroup(field, editField) {
|
|
|
6979
6984
|
|
|
6980
6985
|
const VALIDATION_TYPE_OPTIONS = {
|
|
6981
6986
|
custom: {
|
|
6982
|
-
value:
|
|
6987
|
+
value: undefined,
|
|
6983
6988
|
label: 'Custom'
|
|
6984
6989
|
},
|
|
6985
6990
|
email: {
|
|
@@ -7158,10 +7163,10 @@ function Min(props) {
|
|
|
7158
7163
|
return NumberFieldEntry({
|
|
7159
7164
|
debounce,
|
|
7160
7165
|
element: field,
|
|
7161
|
-
getValue: getValue('min'),
|
|
7162
7166
|
id,
|
|
7163
7167
|
label: 'Minimum',
|
|
7164
|
-
|
|
7168
|
+
step: 'any',
|
|
7169
|
+
getValue: getValue('min'),
|
|
7165
7170
|
setValue: onChange('min')
|
|
7166
7171
|
});
|
|
7167
7172
|
}
|
|
@@ -7176,10 +7181,10 @@ function Max(props) {
|
|
|
7176
7181
|
return NumberFieldEntry({
|
|
7177
7182
|
debounce,
|
|
7178
7183
|
element: field,
|
|
7179
|
-
getValue: getValue('max'),
|
|
7180
7184
|
id,
|
|
7181
7185
|
label: 'Maximum',
|
|
7182
|
-
|
|
7186
|
+
step: 'any',
|
|
7187
|
+
getValue: getValue('max'),
|
|
7183
7188
|
setValue: onChange('max')
|
|
7184
7189
|
});
|
|
7185
7190
|
}
|
|
@@ -7191,16 +7196,25 @@ function ValidationType(props) {
|
|
|
7191
7196
|
onChange
|
|
7192
7197
|
} = props;
|
|
7193
7198
|
const debounce = useService('debounce');
|
|
7199
|
+
const clearCustomValidation = () => {
|
|
7200
|
+
onChange('minLength')(undefined);
|
|
7201
|
+
onChange('maxLength')(undefined);
|
|
7202
|
+
onChange('pattern')(undefined);
|
|
7203
|
+
};
|
|
7204
|
+
const setValue = validationType => {
|
|
7205
|
+
if (validationType) {
|
|
7206
|
+
clearCustomValidation();
|
|
7207
|
+
}
|
|
7208
|
+
onChange('validationType')(validationType || undefined);
|
|
7209
|
+
};
|
|
7194
7210
|
return SelectEntry({
|
|
7195
7211
|
debounce,
|
|
7196
7212
|
element: field,
|
|
7197
7213
|
getValue: getValue('validationType'),
|
|
7198
7214
|
id,
|
|
7199
7215
|
label: 'Regular expression validation',
|
|
7200
|
-
setValue
|
|
7201
|
-
getOptions()
|
|
7202
|
-
return Object.values(VALIDATION_TYPE_OPTIONS);
|
|
7203
|
-
}
|
|
7216
|
+
setValue,
|
|
7217
|
+
getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
|
|
7204
7218
|
});
|
|
7205
7219
|
}
|
|
7206
7220
|
|
|
@@ -7218,8 +7232,8 @@ function ValuesGroups(field, editField) {
|
|
|
7218
7232
|
};
|
|
7219
7233
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
7220
7234
|
|
|
7221
|
-
/**
|
|
7222
|
-
* @type {Array<Group|ListGroup>}
|
|
7235
|
+
/**
|
|
7236
|
+
* @type {Array<Group|ListGroup>}
|
|
7223
7237
|
*/
|
|
7224
7238
|
const groups = [{
|
|
7225
7239
|
id: valuesSourceId,
|
|
@@ -7320,13 +7334,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
7320
7334
|
|
|
7321
7335
|
// helpers //////////
|
|
7322
7336
|
|
|
7323
|
-
/**
|
|
7324
|
-
* Returns copy of object without key.
|
|
7325
|
-
*
|
|
7326
|
-
* @param {Object} properties
|
|
7327
|
-
* @param {string} oldKey
|
|
7328
|
-
*
|
|
7329
|
-
* @returns {Object}
|
|
7337
|
+
/**
|
|
7338
|
+
* Returns copy of object without key.
|
|
7339
|
+
*
|
|
7340
|
+
* @param {Object} properties
|
|
7341
|
+
* @param {string} oldKey
|
|
7342
|
+
*
|
|
7343
|
+
* @returns {Object}
|
|
7330
7344
|
*/
|
|
7331
7345
|
function removeKey(properties, oldKey) {
|
|
7332
7346
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -7419,9 +7433,9 @@ function FormPropertiesPanel(props) {
|
|
|
7419
7433
|
}, []);
|
|
7420
7434
|
useLayoutEffect(() => {
|
|
7421
7435
|
const onFieldChanged = () => {
|
|
7422
|
-
/**
|
|
7423
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
7424
|
-
* once we have a proper updater/change support
|
|
7436
|
+
/**
|
|
7437
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
7438
|
+
* once we have a proper updater/change support
|
|
7425
7439
|
*/
|
|
7426
7440
|
_update(selection.get() || schema);
|
|
7427
7441
|
};
|
|
@@ -7473,10 +7487,10 @@ class PropertiesPanelRenderer {
|
|
|
7473
7487
|
});
|
|
7474
7488
|
}
|
|
7475
7489
|
|
|
7476
|
-
/**
|
|
7477
|
-
* Attach the properties panel to a parent node.
|
|
7478
|
-
*
|
|
7479
|
-
* @param {HTMLElement} container
|
|
7490
|
+
/**
|
|
7491
|
+
* Attach the properties panel to a parent node.
|
|
7492
|
+
*
|
|
7493
|
+
* @param {HTMLElement} container
|
|
7480
7494
|
*/
|
|
7481
7495
|
attachTo(container) {
|
|
7482
7496
|
if (!container) {
|
|
@@ -7496,8 +7510,8 @@ class PropertiesPanelRenderer {
|
|
|
7496
7510
|
this._eventBus.fire('propertiesPanel.attach');
|
|
7497
7511
|
}
|
|
7498
7512
|
|
|
7499
|
-
/**
|
|
7500
|
-
* Detach the properties panel from its parent node.
|
|
7513
|
+
/**
|
|
7514
|
+
* Detach the properties panel from its parent node.
|
|
7501
7515
|
*/
|
|
7502
7516
|
detach() {
|
|
7503
7517
|
const parentNode = this._container.parentNode;
|
|
@@ -7529,48 +7543,48 @@ var PropertiesPanelModule = {
|
|
|
7529
7543
|
|
|
7530
7544
|
const ids = new Ids([32, 36, 1]);
|
|
7531
7545
|
|
|
7532
|
-
/**
|
|
7533
|
-
* @typedef { import('./types').Injector } Injector
|
|
7534
|
-
* @typedef { import('./types').Module } Module
|
|
7535
|
-
* @typedef { import('./types').Schema } Schema
|
|
7536
|
-
*
|
|
7537
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
7538
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
7539
|
-
*
|
|
7540
|
-
* @typedef { {
|
|
7541
|
-
* properties: FormEditorProperties,
|
|
7542
|
-
* schema: Schema
|
|
7543
|
-
* } } State
|
|
7544
|
-
*
|
|
7545
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7546
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
7547
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7546
|
+
/**
|
|
7547
|
+
* @typedef { import('./types').Injector } Injector
|
|
7548
|
+
* @typedef { import('./types').Module } Module
|
|
7549
|
+
* @typedef { import('./types').Schema } Schema
|
|
7550
|
+
*
|
|
7551
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
7552
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
7553
|
+
*
|
|
7554
|
+
* @typedef { {
|
|
7555
|
+
* properties: FormEditorProperties,
|
|
7556
|
+
* schema: Schema
|
|
7557
|
+
* } } State
|
|
7558
|
+
*
|
|
7559
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7560
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
7561
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7548
7562
|
*/
|
|
7549
7563
|
|
|
7550
|
-
/**
|
|
7551
|
-
* The form editor.
|
|
7564
|
+
/**
|
|
7565
|
+
* The form editor.
|
|
7552
7566
|
*/
|
|
7553
7567
|
class FormEditor {
|
|
7554
|
-
/**
|
|
7555
|
-
* @constructor
|
|
7556
|
-
* @param {FormEditorOptions} options
|
|
7568
|
+
/**
|
|
7569
|
+
* @constructor
|
|
7570
|
+
* @param {FormEditorOptions} options
|
|
7557
7571
|
*/
|
|
7558
7572
|
constructor(options = {}) {
|
|
7559
|
-
/**
|
|
7560
|
-
* @public
|
|
7561
|
-
* @type {OnEventType}
|
|
7573
|
+
/**
|
|
7574
|
+
* @public
|
|
7575
|
+
* @type {OnEventType}
|
|
7562
7576
|
*/
|
|
7563
7577
|
this.on = this._onEvent;
|
|
7564
7578
|
|
|
7565
|
-
/**
|
|
7566
|
-
* @public
|
|
7567
|
-
* @type {String}
|
|
7579
|
+
/**
|
|
7580
|
+
* @public
|
|
7581
|
+
* @type {String}
|
|
7568
7582
|
*/
|
|
7569
7583
|
this._id = ids.next();
|
|
7570
7584
|
|
|
7571
|
-
/**
|
|
7572
|
-
* @private
|
|
7573
|
-
* @type {Element}
|
|
7585
|
+
/**
|
|
7586
|
+
* @private
|
|
7587
|
+
* @type {Element}
|
|
7574
7588
|
*/
|
|
7575
7589
|
this._container = createFormContainer();
|
|
7576
7590
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -7581,15 +7595,15 @@ class FormEditor {
|
|
|
7581
7595
|
properties = {}
|
|
7582
7596
|
} = options;
|
|
7583
7597
|
|
|
7584
|
-
/**
|
|
7585
|
-
* @private
|
|
7586
|
-
* @type {any}
|
|
7598
|
+
/**
|
|
7599
|
+
* @private
|
|
7600
|
+
* @type {any}
|
|
7587
7601
|
*/
|
|
7588
7602
|
this.exporter = exporter;
|
|
7589
7603
|
|
|
7590
|
-
/**
|
|
7591
|
-
* @private
|
|
7592
|
-
* @type {State}
|
|
7604
|
+
/**
|
|
7605
|
+
* @private
|
|
7606
|
+
* @type {State}
|
|
7593
7607
|
*/
|
|
7594
7608
|
this._state = {
|
|
7595
7609
|
properties,
|
|
@@ -7618,10 +7632,10 @@ class FormEditor {
|
|
|
7618
7632
|
this._detach(false);
|
|
7619
7633
|
}
|
|
7620
7634
|
|
|
7621
|
-
/**
|
|
7622
|
-
* @param {Schema} schema
|
|
7623
|
-
*
|
|
7624
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
7635
|
+
/**
|
|
7636
|
+
* @param {Schema} schema
|
|
7637
|
+
*
|
|
7638
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
7625
7639
|
*/
|
|
7626
7640
|
importSchema(schema) {
|
|
7627
7641
|
return new Promise((resolve, reject) => {
|
|
@@ -7650,15 +7664,15 @@ class FormEditor {
|
|
|
7650
7664
|
});
|
|
7651
7665
|
}
|
|
7652
7666
|
|
|
7653
|
-
/**
|
|
7654
|
-
* @returns {Schema}
|
|
7667
|
+
/**
|
|
7668
|
+
* @returns {Schema}
|
|
7655
7669
|
*/
|
|
7656
7670
|
saveSchema() {
|
|
7657
7671
|
return this.getSchema();
|
|
7658
7672
|
}
|
|
7659
7673
|
|
|
7660
|
-
/**
|
|
7661
|
-
* @returns {Schema}
|
|
7674
|
+
/**
|
|
7675
|
+
* @returns {Schema}
|
|
7662
7676
|
*/
|
|
7663
7677
|
getSchema() {
|
|
7664
7678
|
const {
|
|
@@ -7667,8 +7681,8 @@ class FormEditor {
|
|
|
7667
7681
|
return exportSchema(schema, this.exporter, schemaVersion);
|
|
7668
7682
|
}
|
|
7669
7683
|
|
|
7670
|
-
/**
|
|
7671
|
-
* @param {Element|string} parentNode
|
|
7684
|
+
/**
|
|
7685
|
+
* @param {Element|string} parentNode
|
|
7672
7686
|
*/
|
|
7673
7687
|
attachTo(parentNode) {
|
|
7674
7688
|
if (!parentNode) {
|
|
@@ -7686,10 +7700,10 @@ class FormEditor {
|
|
|
7686
7700
|
this._detach();
|
|
7687
7701
|
}
|
|
7688
7702
|
|
|
7689
|
-
/**
|
|
7690
|
-
* @internal
|
|
7691
|
-
*
|
|
7692
|
-
* @param {boolean} [emit]
|
|
7703
|
+
/**
|
|
7704
|
+
* @internal
|
|
7705
|
+
*
|
|
7706
|
+
* @param {boolean} [emit]
|
|
7693
7707
|
*/
|
|
7694
7708
|
_detach(emit = true) {
|
|
7695
7709
|
const container = this._container,
|
|
@@ -7703,9 +7717,9 @@ class FormEditor {
|
|
|
7703
7717
|
parentNode.removeChild(container);
|
|
7704
7718
|
}
|
|
7705
7719
|
|
|
7706
|
-
/**
|
|
7707
|
-
* @param {any} property
|
|
7708
|
-
* @param {any} value
|
|
7720
|
+
/**
|
|
7721
|
+
* @param {any} property
|
|
7722
|
+
* @param {any} value
|
|
7709
7723
|
*/
|
|
7710
7724
|
setProperty(property, value) {
|
|
7711
7725
|
const properties = set(this._getState().properties, [property], value);
|
|
@@ -7714,21 +7728,21 @@ class FormEditor {
|
|
|
7714
7728
|
});
|
|
7715
7729
|
}
|
|
7716
7730
|
|
|
7717
|
-
/**
|
|
7718
|
-
* @param {string} type
|
|
7719
|
-
* @param {Function} handler
|
|
7731
|
+
/**
|
|
7732
|
+
* @param {string} type
|
|
7733
|
+
* @param {Function} handler
|
|
7720
7734
|
*/
|
|
7721
7735
|
off(type, handler) {
|
|
7722
7736
|
this.get('eventBus').off(type, handler);
|
|
7723
7737
|
}
|
|
7724
7738
|
|
|
7725
|
-
/**
|
|
7726
|
-
* @internal
|
|
7727
|
-
*
|
|
7728
|
-
* @param {FormEditorOptions} options
|
|
7729
|
-
* @param {Element} container
|
|
7730
|
-
*
|
|
7731
|
-
* @returns {Injector}
|
|
7739
|
+
/**
|
|
7740
|
+
* @internal
|
|
7741
|
+
*
|
|
7742
|
+
* @param {FormEditorOptions} options
|
|
7743
|
+
* @param {Element} container
|
|
7744
|
+
*
|
|
7745
|
+
* @returns {Injector}
|
|
7732
7746
|
*/
|
|
7733
7747
|
_createInjector(options, container) {
|
|
7734
7748
|
const {
|
|
@@ -7750,22 +7764,22 @@ class FormEditor {
|
|
|
7750
7764
|
}, core, ...modules, ...additionalModules]);
|
|
7751
7765
|
}
|
|
7752
7766
|
|
|
7753
|
-
/**
|
|
7754
|
-
* @internal
|
|
7767
|
+
/**
|
|
7768
|
+
* @internal
|
|
7755
7769
|
*/
|
|
7756
7770
|
_emit(type, data) {
|
|
7757
7771
|
this.get('eventBus').fire(type, data);
|
|
7758
7772
|
}
|
|
7759
7773
|
|
|
7760
|
-
/**
|
|
7761
|
-
* @internal
|
|
7774
|
+
/**
|
|
7775
|
+
* @internal
|
|
7762
7776
|
*/
|
|
7763
7777
|
_getState() {
|
|
7764
7778
|
return this._state;
|
|
7765
7779
|
}
|
|
7766
7780
|
|
|
7767
|
-
/**
|
|
7768
|
-
* @internal
|
|
7781
|
+
/**
|
|
7782
|
+
* @internal
|
|
7769
7783
|
*/
|
|
7770
7784
|
_setState(state) {
|
|
7771
7785
|
this._state = {
|
|
@@ -7775,15 +7789,15 @@ class FormEditor {
|
|
|
7775
7789
|
this._emit('changed', this._getState());
|
|
7776
7790
|
}
|
|
7777
7791
|
|
|
7778
|
-
/**
|
|
7779
|
-
* @internal
|
|
7792
|
+
/**
|
|
7793
|
+
* @internal
|
|
7780
7794
|
*/
|
|
7781
7795
|
_getModules() {
|
|
7782
7796
|
return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
|
|
7783
7797
|
}
|
|
7784
7798
|
|
|
7785
|
-
/**
|
|
7786
|
-
* @internal
|
|
7799
|
+
/**
|
|
7800
|
+
* @internal
|
|
7787
7801
|
*/
|
|
7788
7802
|
_onEvent(type, priority, handler) {
|
|
7789
7803
|
this.get('eventBus').on(type, priority, handler);
|