@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.
- package/LICENSE +22 -22
- package/README.md +119 -119
- package/dist/assets/form-js-editor.css +295 -295
- package/dist/index.cjs +251 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +251 -214
- 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/ValidateBehavior.d.ts +7 -0
- package/dist/types/features/modeling/behavior/index.d.ts +10 -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;
|
|
@@ -2364,10 +2364,40 @@ class KeyBehavior extends CommandInterceptor {
|
|
|
2364
2364
|
}
|
|
2365
2365
|
KeyBehavior.$inject = ['eventBus', 'modeling'];
|
|
2366
2366
|
|
|
2367
|
+
class ValidateBehavior extends CommandInterceptor {
|
|
2368
|
+
constructor(eventBus) {
|
|
2369
|
+
super(eventBus);
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
2373
|
+
*/
|
|
2374
|
+
// @ts-ignore-next-line
|
|
2375
|
+
this.preExecute('formField.edit', function (context) {
|
|
2376
|
+
const {
|
|
2377
|
+
properties
|
|
2378
|
+
} = context;
|
|
2379
|
+
const {
|
|
2380
|
+
validate = {}
|
|
2381
|
+
} = properties;
|
|
2382
|
+
if (validate.validationType) {
|
|
2383
|
+
const newValidate = {
|
|
2384
|
+
...validate
|
|
2385
|
+
};
|
|
2386
|
+
delete newValidate.minLength;
|
|
2387
|
+
delete newValidate.maxLength;
|
|
2388
|
+
delete newValidate.pattern;
|
|
2389
|
+
properties['validate'] = newValidate;
|
|
2390
|
+
}
|
|
2391
|
+
}, true);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
ValidateBehavior.$inject = ['eventBus'];
|
|
2395
|
+
|
|
2367
2396
|
var behaviorModule = {
|
|
2368
|
-
__init__: ['idBehavior', 'keyBehavior'],
|
|
2397
|
+
__init__: ['idBehavior', 'keyBehavior', 'validateBehavior'],
|
|
2369
2398
|
idBehavior: ['type', IdBehavior],
|
|
2370
|
-
keyBehavior: ['type', KeyBehavior]
|
|
2399
|
+
keyBehavior: ['type', KeyBehavior],
|
|
2400
|
+
validateBehavior: ['type', ValidateBehavior]
|
|
2371
2401
|
};
|
|
2372
2402
|
|
|
2373
2403
|
/**
|
|
@@ -2956,10 +2986,10 @@ class PaletteRenderer {
|
|
|
2956
2986
|
});
|
|
2957
2987
|
}
|
|
2958
2988
|
|
|
2959
|
-
/**
|
|
2960
|
-
* Attach the palette to a parent node.
|
|
2961
|
-
*
|
|
2962
|
-
* @param {HTMLElement} container
|
|
2989
|
+
/**
|
|
2990
|
+
* Attach the palette to a parent node.
|
|
2991
|
+
*
|
|
2992
|
+
* @param {HTMLElement} container
|
|
2963
2993
|
*/
|
|
2964
2994
|
attachTo(container) {
|
|
2965
2995
|
if (!container) {
|
|
@@ -2979,8 +3009,8 @@ class PaletteRenderer {
|
|
|
2979
3009
|
this._eventBus.fire('palette.attach');
|
|
2980
3010
|
}
|
|
2981
3011
|
|
|
2982
|
-
/**
|
|
2983
|
-
* Detach the palette from its parent node.
|
|
3012
|
+
/**
|
|
3013
|
+
* Detach the palette from its parent node.
|
|
2984
3014
|
*/
|
|
2985
3015
|
detach() {
|
|
2986
3016
|
const parentNode = this._container.parentNode;
|
|
@@ -5117,11 +5147,11 @@ function prefixId$1(id) {
|
|
|
5117
5147
|
return `bio-properties-panel-${id}`;
|
|
5118
5148
|
}
|
|
5119
5149
|
|
|
5120
|
-
/**
|
|
5121
|
-
* @param {string} type
|
|
5122
|
-
* @param {boolean} [strict]
|
|
5123
|
-
*
|
|
5124
|
-
* @returns {any}
|
|
5150
|
+
/**
|
|
5151
|
+
* @param {string} type
|
|
5152
|
+
* @param {boolean} [strict]
|
|
5153
|
+
*
|
|
5154
|
+
* @returns {any}
|
|
5125
5155
|
*/
|
|
5126
5156
|
function getService(type, strict) {}
|
|
5127
5157
|
const PropertiesPanelContext = createContext({
|
|
@@ -5209,8 +5239,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
5209
5239
|
}
|
|
5210
5240
|
};
|
|
5211
5241
|
|
|
5212
|
-
/**
|
|
5213
|
-
* Provide placeholders for empty and multiple state.
|
|
5242
|
+
/**
|
|
5243
|
+
* Provide placeholders for empty and multiple state.
|
|
5214
5244
|
*/
|
|
5215
5245
|
const PropertiesPanelPlaceholderProvider = {
|
|
5216
5246
|
getEmpty: () => {
|
|
@@ -5282,10 +5312,10 @@ function useService (type, strict) {
|
|
|
5282
5312
|
return getService(type, strict);
|
|
5283
5313
|
}
|
|
5284
5314
|
|
|
5285
|
-
/**
|
|
5286
|
-
* Retrieve list of variables from the form schema.
|
|
5287
|
-
*
|
|
5288
|
-
* @returns { string[] } list of variables used in form schema
|
|
5315
|
+
/**
|
|
5316
|
+
* Retrieve list of variables from the form schema.
|
|
5317
|
+
*
|
|
5318
|
+
* @returns { string[] } list of variables used in form schema
|
|
5289
5319
|
*/
|
|
5290
5320
|
function useVariables() {
|
|
5291
5321
|
const form = useService('formEditor');
|
|
@@ -6094,7 +6124,12 @@ function NumberArrowStep(props) {
|
|
|
6094
6124
|
if (!isValidNumber(value)) return null;
|
|
6095
6125
|
return value;
|
|
6096
6126
|
};
|
|
6097
|
-
const
|
|
6127
|
+
const clearLeadingZeroes = value => {
|
|
6128
|
+
if (!value) return value;
|
|
6129
|
+
const trimmed = value.replace(/^0+/g, '');
|
|
6130
|
+
return (trimmed.startsWith('.') ? '0' : '') + trimmed;
|
|
6131
|
+
};
|
|
6132
|
+
const setValue = value => editField(field, ['increment'], clearLeadingZeroes(value));
|
|
6098
6133
|
const decimalDigitsSet = decimalDigits || decimalDigits === 0;
|
|
6099
6134
|
return TextfieldEntry({
|
|
6100
6135
|
debounce,
|
|
@@ -6570,14 +6605,14 @@ function Value(props) {
|
|
|
6570
6605
|
|
|
6571
6606
|
// helpers //////////
|
|
6572
6607
|
|
|
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}
|
|
6608
|
+
/**
|
|
6609
|
+
* Returns copy of object with updated value.
|
|
6610
|
+
*
|
|
6611
|
+
* @param {Object} properties
|
|
6612
|
+
* @param {string} key
|
|
6613
|
+
* @param {string} value
|
|
6614
|
+
*
|
|
6615
|
+
* @returns {Object}
|
|
6581
6616
|
*/
|
|
6582
6617
|
function updateValue(properties, key, value) {
|
|
6583
6618
|
return {
|
|
@@ -6586,14 +6621,14 @@ function updateValue(properties, key, value) {
|
|
|
6586
6621
|
};
|
|
6587
6622
|
}
|
|
6588
6623
|
|
|
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}
|
|
6624
|
+
/**
|
|
6625
|
+
* Returns copy of object with updated key.
|
|
6626
|
+
*
|
|
6627
|
+
* @param {Object} properties
|
|
6628
|
+
* @param {string} oldKey
|
|
6629
|
+
* @param {string} newKey
|
|
6630
|
+
*
|
|
6631
|
+
* @returns {Object}
|
|
6597
6632
|
*/
|
|
6598
6633
|
function updateKey(properties, oldKey, newKey) {
|
|
6599
6634
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6979,7 +7014,7 @@ function ConstraintsGroup(field, editField) {
|
|
|
6979
7014
|
|
|
6980
7015
|
const VALIDATION_TYPE_OPTIONS = {
|
|
6981
7016
|
custom: {
|
|
6982
|
-
value:
|
|
7017
|
+
value: undefined,
|
|
6983
7018
|
label: 'Custom'
|
|
6984
7019
|
},
|
|
6985
7020
|
email: {
|
|
@@ -7025,6 +7060,7 @@ function ValidationGroup(field, editField) {
|
|
|
7025
7060
|
component: ValidationType,
|
|
7026
7061
|
getValue,
|
|
7027
7062
|
field,
|
|
7063
|
+
editField,
|
|
7028
7064
|
isEdited: isEdited$1,
|
|
7029
7065
|
onChange
|
|
7030
7066
|
});
|
|
@@ -7158,10 +7194,10 @@ function Min(props) {
|
|
|
7158
7194
|
return NumberFieldEntry({
|
|
7159
7195
|
debounce,
|
|
7160
7196
|
element: field,
|
|
7161
|
-
getValue: getValue('min'),
|
|
7162
7197
|
id,
|
|
7163
7198
|
label: 'Minimum',
|
|
7164
|
-
|
|
7199
|
+
step: 'any',
|
|
7200
|
+
getValue: getValue('min'),
|
|
7165
7201
|
setValue: onChange('min')
|
|
7166
7202
|
});
|
|
7167
7203
|
}
|
|
@@ -7176,10 +7212,10 @@ function Max(props) {
|
|
|
7176
7212
|
return NumberFieldEntry({
|
|
7177
7213
|
debounce,
|
|
7178
7214
|
element: field,
|
|
7179
|
-
getValue: getValue('max'),
|
|
7180
7215
|
id,
|
|
7181
7216
|
label: 'Maximum',
|
|
7182
|
-
|
|
7217
|
+
step: 'any',
|
|
7218
|
+
getValue: getValue('max'),
|
|
7183
7219
|
setValue: onChange('max')
|
|
7184
7220
|
});
|
|
7185
7221
|
}
|
|
@@ -7191,16 +7227,17 @@ function ValidationType(props) {
|
|
|
7191
7227
|
onChange
|
|
7192
7228
|
} = props;
|
|
7193
7229
|
const debounce = useService('debounce');
|
|
7230
|
+
const setValue = validationType => {
|
|
7231
|
+
onChange('validationType')(validationType || undefined);
|
|
7232
|
+
};
|
|
7194
7233
|
return SelectEntry({
|
|
7195
7234
|
debounce,
|
|
7196
7235
|
element: field,
|
|
7197
7236
|
getValue: getValue('validationType'),
|
|
7198
7237
|
id,
|
|
7199
7238
|
label: 'Regular expression validation',
|
|
7200
|
-
setValue
|
|
7201
|
-
getOptions()
|
|
7202
|
-
return Object.values(VALIDATION_TYPE_OPTIONS);
|
|
7203
|
-
}
|
|
7239
|
+
setValue,
|
|
7240
|
+
getOptions: () => Object.values(VALIDATION_TYPE_OPTIONS)
|
|
7204
7241
|
});
|
|
7205
7242
|
}
|
|
7206
7243
|
|
|
@@ -7218,8 +7255,8 @@ function ValuesGroups(field, editField) {
|
|
|
7218
7255
|
};
|
|
7219
7256
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
7220
7257
|
|
|
7221
|
-
/**
|
|
7222
|
-
* @type {Array<Group|ListGroup>}
|
|
7258
|
+
/**
|
|
7259
|
+
* @type {Array<Group|ListGroup>}
|
|
7223
7260
|
*/
|
|
7224
7261
|
const groups = [{
|
|
7225
7262
|
id: valuesSourceId,
|
|
@@ -7320,13 +7357,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
7320
7357
|
|
|
7321
7358
|
// helpers //////////
|
|
7322
7359
|
|
|
7323
|
-
/**
|
|
7324
|
-
* Returns copy of object without key.
|
|
7325
|
-
*
|
|
7326
|
-
* @param {Object} properties
|
|
7327
|
-
* @param {string} oldKey
|
|
7328
|
-
*
|
|
7329
|
-
* @returns {Object}
|
|
7360
|
+
/**
|
|
7361
|
+
* Returns copy of object without key.
|
|
7362
|
+
*
|
|
7363
|
+
* @param {Object} properties
|
|
7364
|
+
* @param {string} oldKey
|
|
7365
|
+
*
|
|
7366
|
+
* @returns {Object}
|
|
7330
7367
|
*/
|
|
7331
7368
|
function removeKey(properties, oldKey) {
|
|
7332
7369
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -7419,9 +7456,9 @@ function FormPropertiesPanel(props) {
|
|
|
7419
7456
|
}, []);
|
|
7420
7457
|
useLayoutEffect(() => {
|
|
7421
7458
|
const onFieldChanged = () => {
|
|
7422
|
-
/**
|
|
7423
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
7424
|
-
* once we have a proper updater/change support
|
|
7459
|
+
/**
|
|
7460
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
7461
|
+
* once we have a proper updater/change support
|
|
7425
7462
|
*/
|
|
7426
7463
|
_update(selection.get() || schema);
|
|
7427
7464
|
};
|
|
@@ -7473,10 +7510,10 @@ class PropertiesPanelRenderer {
|
|
|
7473
7510
|
});
|
|
7474
7511
|
}
|
|
7475
7512
|
|
|
7476
|
-
/**
|
|
7477
|
-
* Attach the properties panel to a parent node.
|
|
7478
|
-
*
|
|
7479
|
-
* @param {HTMLElement} container
|
|
7513
|
+
/**
|
|
7514
|
+
* Attach the properties panel to a parent node.
|
|
7515
|
+
*
|
|
7516
|
+
* @param {HTMLElement} container
|
|
7480
7517
|
*/
|
|
7481
7518
|
attachTo(container) {
|
|
7482
7519
|
if (!container) {
|
|
@@ -7496,8 +7533,8 @@ class PropertiesPanelRenderer {
|
|
|
7496
7533
|
this._eventBus.fire('propertiesPanel.attach');
|
|
7497
7534
|
}
|
|
7498
7535
|
|
|
7499
|
-
/**
|
|
7500
|
-
* Detach the properties panel from its parent node.
|
|
7536
|
+
/**
|
|
7537
|
+
* Detach the properties panel from its parent node.
|
|
7501
7538
|
*/
|
|
7502
7539
|
detach() {
|
|
7503
7540
|
const parentNode = this._container.parentNode;
|
|
@@ -7529,48 +7566,48 @@ var PropertiesPanelModule = {
|
|
|
7529
7566
|
|
|
7530
7567
|
const ids = new Ids([32, 36, 1]);
|
|
7531
7568
|
|
|
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
|
|
7569
|
+
/**
|
|
7570
|
+
* @typedef { import('./types').Injector } Injector
|
|
7571
|
+
* @typedef { import('./types').Module } Module
|
|
7572
|
+
* @typedef { import('./types').Schema } Schema
|
|
7573
|
+
*
|
|
7574
|
+
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
7575
|
+
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
7576
|
+
*
|
|
7577
|
+
* @typedef { {
|
|
7578
|
+
* properties: FormEditorProperties,
|
|
7579
|
+
* schema: Schema
|
|
7580
|
+
* } } State
|
|
7581
|
+
*
|
|
7582
|
+
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7583
|
+
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
7584
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7548
7585
|
*/
|
|
7549
7586
|
|
|
7550
|
-
/**
|
|
7551
|
-
* The form editor.
|
|
7587
|
+
/**
|
|
7588
|
+
* The form editor.
|
|
7552
7589
|
*/
|
|
7553
7590
|
class FormEditor {
|
|
7554
|
-
/**
|
|
7555
|
-
* @constructor
|
|
7556
|
-
* @param {FormEditorOptions} options
|
|
7591
|
+
/**
|
|
7592
|
+
* @constructor
|
|
7593
|
+
* @param {FormEditorOptions} options
|
|
7557
7594
|
*/
|
|
7558
7595
|
constructor(options = {}) {
|
|
7559
|
-
/**
|
|
7560
|
-
* @public
|
|
7561
|
-
* @type {OnEventType}
|
|
7596
|
+
/**
|
|
7597
|
+
* @public
|
|
7598
|
+
* @type {OnEventType}
|
|
7562
7599
|
*/
|
|
7563
7600
|
this.on = this._onEvent;
|
|
7564
7601
|
|
|
7565
|
-
/**
|
|
7566
|
-
* @public
|
|
7567
|
-
* @type {String}
|
|
7602
|
+
/**
|
|
7603
|
+
* @public
|
|
7604
|
+
* @type {String}
|
|
7568
7605
|
*/
|
|
7569
7606
|
this._id = ids.next();
|
|
7570
7607
|
|
|
7571
|
-
/**
|
|
7572
|
-
* @private
|
|
7573
|
-
* @type {Element}
|
|
7608
|
+
/**
|
|
7609
|
+
* @private
|
|
7610
|
+
* @type {Element}
|
|
7574
7611
|
*/
|
|
7575
7612
|
this._container = createFormContainer();
|
|
7576
7613
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -7581,15 +7618,15 @@ class FormEditor {
|
|
|
7581
7618
|
properties = {}
|
|
7582
7619
|
} = options;
|
|
7583
7620
|
|
|
7584
|
-
/**
|
|
7585
|
-
* @private
|
|
7586
|
-
* @type {any}
|
|
7621
|
+
/**
|
|
7622
|
+
* @private
|
|
7623
|
+
* @type {any}
|
|
7587
7624
|
*/
|
|
7588
7625
|
this.exporter = exporter;
|
|
7589
7626
|
|
|
7590
|
-
/**
|
|
7591
|
-
* @private
|
|
7592
|
-
* @type {State}
|
|
7627
|
+
/**
|
|
7628
|
+
* @private
|
|
7629
|
+
* @type {State}
|
|
7593
7630
|
*/
|
|
7594
7631
|
this._state = {
|
|
7595
7632
|
properties,
|
|
@@ -7618,10 +7655,10 @@ class FormEditor {
|
|
|
7618
7655
|
this._detach(false);
|
|
7619
7656
|
}
|
|
7620
7657
|
|
|
7621
|
-
/**
|
|
7622
|
-
* @param {Schema} schema
|
|
7623
|
-
*
|
|
7624
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
7658
|
+
/**
|
|
7659
|
+
* @param {Schema} schema
|
|
7660
|
+
*
|
|
7661
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
7625
7662
|
*/
|
|
7626
7663
|
importSchema(schema) {
|
|
7627
7664
|
return new Promise((resolve, reject) => {
|
|
@@ -7650,15 +7687,15 @@ class FormEditor {
|
|
|
7650
7687
|
});
|
|
7651
7688
|
}
|
|
7652
7689
|
|
|
7653
|
-
/**
|
|
7654
|
-
* @returns {Schema}
|
|
7690
|
+
/**
|
|
7691
|
+
* @returns {Schema}
|
|
7655
7692
|
*/
|
|
7656
7693
|
saveSchema() {
|
|
7657
7694
|
return this.getSchema();
|
|
7658
7695
|
}
|
|
7659
7696
|
|
|
7660
|
-
/**
|
|
7661
|
-
* @returns {Schema}
|
|
7697
|
+
/**
|
|
7698
|
+
* @returns {Schema}
|
|
7662
7699
|
*/
|
|
7663
7700
|
getSchema() {
|
|
7664
7701
|
const {
|
|
@@ -7667,8 +7704,8 @@ class FormEditor {
|
|
|
7667
7704
|
return exportSchema(schema, this.exporter, schemaVersion);
|
|
7668
7705
|
}
|
|
7669
7706
|
|
|
7670
|
-
/**
|
|
7671
|
-
* @param {Element|string} parentNode
|
|
7707
|
+
/**
|
|
7708
|
+
* @param {Element|string} parentNode
|
|
7672
7709
|
*/
|
|
7673
7710
|
attachTo(parentNode) {
|
|
7674
7711
|
if (!parentNode) {
|
|
@@ -7686,10 +7723,10 @@ class FormEditor {
|
|
|
7686
7723
|
this._detach();
|
|
7687
7724
|
}
|
|
7688
7725
|
|
|
7689
|
-
/**
|
|
7690
|
-
* @internal
|
|
7691
|
-
*
|
|
7692
|
-
* @param {boolean} [emit]
|
|
7726
|
+
/**
|
|
7727
|
+
* @internal
|
|
7728
|
+
*
|
|
7729
|
+
* @param {boolean} [emit]
|
|
7693
7730
|
*/
|
|
7694
7731
|
_detach(emit = true) {
|
|
7695
7732
|
const container = this._container,
|
|
@@ -7703,9 +7740,9 @@ class FormEditor {
|
|
|
7703
7740
|
parentNode.removeChild(container);
|
|
7704
7741
|
}
|
|
7705
7742
|
|
|
7706
|
-
/**
|
|
7707
|
-
* @param {any} property
|
|
7708
|
-
* @param {any} value
|
|
7743
|
+
/**
|
|
7744
|
+
* @param {any} property
|
|
7745
|
+
* @param {any} value
|
|
7709
7746
|
*/
|
|
7710
7747
|
setProperty(property, value) {
|
|
7711
7748
|
const properties = set(this._getState().properties, [property], value);
|
|
@@ -7714,21 +7751,21 @@ class FormEditor {
|
|
|
7714
7751
|
});
|
|
7715
7752
|
}
|
|
7716
7753
|
|
|
7717
|
-
/**
|
|
7718
|
-
* @param {string} type
|
|
7719
|
-
* @param {Function} handler
|
|
7754
|
+
/**
|
|
7755
|
+
* @param {string} type
|
|
7756
|
+
* @param {Function} handler
|
|
7720
7757
|
*/
|
|
7721
7758
|
off(type, handler) {
|
|
7722
7759
|
this.get('eventBus').off(type, handler);
|
|
7723
7760
|
}
|
|
7724
7761
|
|
|
7725
|
-
/**
|
|
7726
|
-
* @internal
|
|
7727
|
-
*
|
|
7728
|
-
* @param {FormEditorOptions} options
|
|
7729
|
-
* @param {Element} container
|
|
7730
|
-
*
|
|
7731
|
-
* @returns {Injector}
|
|
7762
|
+
/**
|
|
7763
|
+
* @internal
|
|
7764
|
+
*
|
|
7765
|
+
* @param {FormEditorOptions} options
|
|
7766
|
+
* @param {Element} container
|
|
7767
|
+
*
|
|
7768
|
+
* @returns {Injector}
|
|
7732
7769
|
*/
|
|
7733
7770
|
_createInjector(options, container) {
|
|
7734
7771
|
const {
|
|
@@ -7750,22 +7787,22 @@ class FormEditor {
|
|
|
7750
7787
|
}, core, ...modules, ...additionalModules]);
|
|
7751
7788
|
}
|
|
7752
7789
|
|
|
7753
|
-
/**
|
|
7754
|
-
* @internal
|
|
7790
|
+
/**
|
|
7791
|
+
* @internal
|
|
7755
7792
|
*/
|
|
7756
7793
|
_emit(type, data) {
|
|
7757
7794
|
this.get('eventBus').fire(type, data);
|
|
7758
7795
|
}
|
|
7759
7796
|
|
|
7760
|
-
/**
|
|
7761
|
-
* @internal
|
|
7797
|
+
/**
|
|
7798
|
+
* @internal
|
|
7762
7799
|
*/
|
|
7763
7800
|
_getState() {
|
|
7764
7801
|
return this._state;
|
|
7765
7802
|
}
|
|
7766
7803
|
|
|
7767
|
-
/**
|
|
7768
|
-
* @internal
|
|
7804
|
+
/**
|
|
7805
|
+
* @internal
|
|
7769
7806
|
*/
|
|
7770
7807
|
_setState(state) {
|
|
7771
7808
|
this._state = {
|
|
@@ -7775,15 +7812,15 @@ class FormEditor {
|
|
|
7775
7812
|
this._emit('changed', this._getState());
|
|
7776
7813
|
}
|
|
7777
7814
|
|
|
7778
|
-
/**
|
|
7779
|
-
* @internal
|
|
7815
|
+
/**
|
|
7816
|
+
* @internal
|
|
7780
7817
|
*/
|
|
7781
7818
|
_getModules() {
|
|
7782
7819
|
return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
|
|
7783
7820
|
}
|
|
7784
7821
|
|
|
7785
|
-
/**
|
|
7786
|
-
* @internal
|
|
7822
|
+
/**
|
|
7823
|
+
* @internal
|
|
7787
7824
|
*/
|
|
7788
7825
|
_onEvent(type, priority, handler) {
|
|
7789
7826
|
this.get('eventBus').on(type, priority, handler);
|