@bpmn-io/form-js-editor 0.10.0-alpha.3 → 0.10.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 -118
- package/dist/assets/form-js-editor.css +295 -287
- package/dist/index.cjs +682 -516
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +668 -502
- 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 -0
- 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 -0
- package/dist/types/features/properties-panel/entries/DateTimeEntry.d.ts +9 -0
- package/dist/types/features/properties-panel/entries/DateTimeSerializationEntry.d.ts +9 -0
- 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 -0
- package/dist/types/features/properties-panel/entries/factories/simpleStringEntryFactory.d.ts +9 -0
- package/dist/types/features/properties-panel/entries/index.d.ts +23 -19
- package/dist/types/features/properties-panel/groups/AppearanceGroup.d.ts +13 -0
- package/dist/types/features/properties-panel/groups/ConditionGroup.d.ts +11 -11
- package/dist/types/features/properties-panel/groups/ConstraintsGroup.d.ts +11 -0
- 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 -6
- 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 -15
- 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/types/features/properties-panel/entries/ValuesSourceUtil.d.ts +0 -15
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ var minDash = require('min-dash');
|
|
|
8
8
|
var preact = require('preact');
|
|
9
9
|
var hooks$1 = require('preact/hooks');
|
|
10
10
|
var dragula = require('dragula');
|
|
11
|
-
var React = require('preact/compat');
|
|
12
11
|
var jsxRuntime = require('preact/jsx-runtime');
|
|
12
|
+
var React = require('preact/compat');
|
|
13
13
|
var minDom = require('min-dom');
|
|
14
14
|
var arrayMove = require('array-move');
|
|
15
15
|
var classnames = require('classnames');
|
|
@@ -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({
|
|
@@ -705,11 +705,11 @@ function useService$1 (type, strict) {
|
|
|
705
705
|
return getService(type, strict);
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
-
function _extends
|
|
708
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
709
709
|
var ListDeleteIcon = (({
|
|
710
710
|
styles = {},
|
|
711
711
|
...props
|
|
712
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends
|
|
712
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
|
|
713
713
|
xmlns: "http://www.w3.org/2000/svg",
|
|
714
714
|
width: "11",
|
|
715
715
|
height: "14"
|
|
@@ -717,223 +717,6 @@ var ListDeleteIcon = (({
|
|
|
717
717
|
d: "M10 4v8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V4h9zM8 6H3v4.8c0 .66.5 1.2 1.111 1.2H6.89C7.5 12 8 11.46 8 10.8V6zm3-5H8.5l-1-1h-4l-1 1H0v1.5h11V1z"
|
|
718
718
|
})));
|
|
719
719
|
|
|
720
|
-
function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
|
|
721
|
-
var ButtonIcon = (({
|
|
722
|
-
styles = {},
|
|
723
|
-
...props
|
|
724
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$c({
|
|
725
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
726
|
-
width: "54",
|
|
727
|
-
height: "54"
|
|
728
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
729
|
-
fillRule: "evenodd",
|
|
730
|
-
d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
|
|
731
|
-
})));
|
|
732
|
-
|
|
733
|
-
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
|
|
734
|
-
var CheckboxIcon = (({
|
|
735
|
-
styles = {},
|
|
736
|
-
...props
|
|
737
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
|
|
738
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
739
|
-
width: "54",
|
|
740
|
-
height: "54"
|
|
741
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
742
|
-
d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
|
|
743
|
-
})));
|
|
744
|
-
|
|
745
|
-
function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
|
|
746
|
-
var ChecklistIcon = (({
|
|
747
|
-
styles = {},
|
|
748
|
-
...props
|
|
749
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
|
|
750
|
-
width: "54",
|
|
751
|
-
height: "54",
|
|
752
|
-
fill: "none",
|
|
753
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
754
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
755
|
-
fillRule: "evenodd",
|
|
756
|
-
clipRule: "evenodd",
|
|
757
|
-
d: "M19 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6 18h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6-30h-6v6h6V8zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2V8a2 2 0 00-2-2h-6z",
|
|
758
|
-
fill: "#22242A"
|
|
759
|
-
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
760
|
-
d: "M26 26a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0 16a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0-32a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2z",
|
|
761
|
-
fill: "#22242A"
|
|
762
|
-
})));
|
|
763
|
-
|
|
764
|
-
function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
|
|
765
|
-
var TaglistIcon = (({
|
|
766
|
-
styles = {},
|
|
767
|
-
...props
|
|
768
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
|
|
769
|
-
width: "54",
|
|
770
|
-
height: "54",
|
|
771
|
-
fill: "none",
|
|
772
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
773
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
774
|
-
fillRule: "evenodd",
|
|
775
|
-
clipRule: "evenodd",
|
|
776
|
-
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
|
|
777
|
-
fill: "#000"
|
|
778
|
-
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
779
|
-
d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
|
|
780
|
-
fill: "#505562"
|
|
781
|
-
})));
|
|
782
|
-
|
|
783
|
-
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
784
|
-
var FormIcon = (({
|
|
785
|
-
styles = {},
|
|
786
|
-
...props
|
|
787
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
|
|
788
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
789
|
-
width: "54",
|
|
790
|
-
height: "54"
|
|
791
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
792
|
-
x: "15",
|
|
793
|
-
y: "17",
|
|
794
|
-
width: "24",
|
|
795
|
-
height: "4",
|
|
796
|
-
rx: "1"
|
|
797
|
-
}), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
798
|
-
x: "15",
|
|
799
|
-
y: "25",
|
|
800
|
-
width: "24",
|
|
801
|
-
height: "4",
|
|
802
|
-
rx: "1"
|
|
803
|
-
}), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
804
|
-
x: "15",
|
|
805
|
-
y: "33",
|
|
806
|
-
width: "13",
|
|
807
|
-
height: "4",
|
|
808
|
-
rx: "1"
|
|
809
|
-
})));
|
|
810
|
-
|
|
811
|
-
function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
|
|
812
|
-
var ColumnsIcon = (({
|
|
813
|
-
styles = {},
|
|
814
|
-
...props
|
|
815
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
|
|
816
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
817
|
-
width: "54",
|
|
818
|
-
height: "54"
|
|
819
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
820
|
-
fillRule: "evenodd",
|
|
821
|
-
d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
|
|
822
|
-
})));
|
|
823
|
-
|
|
824
|
-
function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
|
|
825
|
-
var NumberIcon = (({
|
|
826
|
-
styles = {},
|
|
827
|
-
...props
|
|
828
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
|
|
829
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
830
|
-
width: "54",
|
|
831
|
-
height: "54"
|
|
832
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
833
|
-
fillRule: "evenodd",
|
|
834
|
-
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
|
|
835
|
-
})));
|
|
836
|
-
|
|
837
|
-
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
838
|
-
var RadioIcon = (({
|
|
839
|
-
styles = {},
|
|
840
|
-
...props
|
|
841
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
|
|
842
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
843
|
-
width: "54",
|
|
844
|
-
height: "54"
|
|
845
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
846
|
-
d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
847
|
-
})));
|
|
848
|
-
|
|
849
|
-
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
850
|
-
var SelectIcon = (({
|
|
851
|
-
styles = {},
|
|
852
|
-
...props
|
|
853
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
|
|
854
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
855
|
-
width: "54",
|
|
856
|
-
height: "54"
|
|
857
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
858
|
-
fillRule: "evenodd",
|
|
859
|
-
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
|
|
860
|
-
})));
|
|
861
|
-
|
|
862
|
-
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
863
|
-
var TextIcon = (({
|
|
864
|
-
styles = {},
|
|
865
|
-
...props
|
|
866
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
|
|
867
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
868
|
-
width: "54",
|
|
869
|
-
height: "54"
|
|
870
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
871
|
-
d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
|
|
872
|
-
})));
|
|
873
|
-
|
|
874
|
-
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
875
|
-
var TextfieldIcon = (({
|
|
876
|
-
styles = {},
|
|
877
|
-
...props
|
|
878
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
|
|
879
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
880
|
-
width: "54",
|
|
881
|
-
height: "54"
|
|
882
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
883
|
-
fillRule: "evenodd",
|
|
884
|
-
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
|
|
885
|
-
})));
|
|
886
|
-
|
|
887
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
888
|
-
var TextareaIcon = (({
|
|
889
|
-
styles = {},
|
|
890
|
-
...props
|
|
891
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
|
|
892
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
893
|
-
width: "54",
|
|
894
|
-
height: "54"
|
|
895
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
896
|
-
fillRule: "evenodd",
|
|
897
|
-
d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
|
|
898
|
-
})));
|
|
899
|
-
|
|
900
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
901
|
-
var ImageIcon = (({
|
|
902
|
-
styles = {},
|
|
903
|
-
...props
|
|
904
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
|
|
905
|
-
width: "54",
|
|
906
|
-
height: "54",
|
|
907
|
-
fill: "none",
|
|
908
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
909
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
910
|
-
fillRule: "evenodd",
|
|
911
|
-
clipRule: "evenodd",
|
|
912
|
-
d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
|
|
913
|
-
fill: "#000"
|
|
914
|
-
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
915
|
-
fillRule: "evenodd",
|
|
916
|
-
clipRule: "evenodd",
|
|
917
|
-
d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
|
|
918
|
-
fill: "#000"
|
|
919
|
-
})));
|
|
920
|
-
|
|
921
|
-
const iconsByType = {
|
|
922
|
-
button: ButtonIcon,
|
|
923
|
-
checkbox: CheckboxIcon,
|
|
924
|
-
checklist: ChecklistIcon,
|
|
925
|
-
columns: ColumnsIcon,
|
|
926
|
-
image: ImageIcon,
|
|
927
|
-
number: NumberIcon,
|
|
928
|
-
radio: RadioIcon,
|
|
929
|
-
select: SelectIcon,
|
|
930
|
-
taglist: TaglistIcon,
|
|
931
|
-
text: TextIcon,
|
|
932
|
-
textfield: TextfieldIcon,
|
|
933
|
-
textarea: TextareaIcon,
|
|
934
|
-
default: FormIcon
|
|
935
|
-
};
|
|
936
|
-
|
|
937
720
|
function ContextPad(props) {
|
|
938
721
|
if (!props.children) {
|
|
939
722
|
return null;
|
|
@@ -1208,7 +991,7 @@ function CreatePreview(props) {
|
|
|
1208
991
|
} = hooks$1.useContext(DragAndDropContext);
|
|
1209
992
|
function handleCloned(clone, original, type) {
|
|
1210
993
|
const fieldType = clone.dataset.fieldType;
|
|
1211
|
-
const Icon = iconsByType[fieldType];
|
|
994
|
+
const Icon = formJsViewer.iconsByType[fieldType];
|
|
1212
995
|
if (fieldType) {
|
|
1213
996
|
clone.innerHTML = '';
|
|
1214
997
|
clone.class = 'gu-mirror';
|
|
@@ -1977,10 +1760,10 @@ function updatePath(formFieldRegistry, formField, index) {
|
|
|
1977
1760
|
}
|
|
1978
1761
|
|
|
1979
1762
|
class AddFormFieldHandler {
|
|
1980
|
-
/**
|
|
1981
|
-
* @constructor
|
|
1982
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
1983
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1763
|
+
/**
|
|
1764
|
+
* @constructor
|
|
1765
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1766
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1984
1767
|
*/
|
|
1985
1768
|
constructor(formEditor, formFieldRegistry) {
|
|
1986
1769
|
this._formEditor = formEditor;
|
|
@@ -2041,10 +1824,10 @@ class AddFormFieldHandler {
|
|
|
2041
1824
|
AddFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2042
1825
|
|
|
2043
1826
|
class EditFormFieldHandler {
|
|
2044
|
-
/**
|
|
2045
|
-
* @constructor
|
|
2046
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2047
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1827
|
+
/**
|
|
1828
|
+
* @constructor
|
|
1829
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1830
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2048
1831
|
*/
|
|
2049
1832
|
constructor(formEditor, formFieldRegistry) {
|
|
2050
1833
|
this._formEditor = formEditor;
|
|
@@ -2107,10 +1890,10 @@ class EditFormFieldHandler {
|
|
|
2107
1890
|
EditFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2108
1891
|
|
|
2109
1892
|
class MoveFormFieldHandler {
|
|
2110
|
-
/**
|
|
2111
|
-
* @constructor
|
|
2112
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2113
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1893
|
+
/**
|
|
1894
|
+
* @constructor
|
|
1895
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1896
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2114
1897
|
*/
|
|
2115
1898
|
constructor(formEditor, formFieldRegistry) {
|
|
2116
1899
|
this._formEditor = formEditor;
|
|
@@ -2187,10 +1970,10 @@ class MoveFormFieldHandler {
|
|
|
2187
1970
|
MoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2188
1971
|
|
|
2189
1972
|
class RemoveFormFieldHandler {
|
|
2190
|
-
/**
|
|
2191
|
-
* @constructor
|
|
2192
|
-
* @param { import('../../../FormEditor').default } formEditor
|
|
2193
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
1973
|
+
/**
|
|
1974
|
+
* @constructor
|
|
1975
|
+
* @param { import('../../../FormEditor').default } formEditor
|
|
1976
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2194
1977
|
*/
|
|
2195
1978
|
constructor(formEditor, formFieldRegistry) {
|
|
2196
1979
|
this._formEditor = formEditor;
|
|
@@ -2250,9 +2033,9 @@ class RemoveFormFieldHandler {
|
|
|
2250
2033
|
RemoveFormFieldHandler.$inject = ['formEditor', 'formFieldRegistry'];
|
|
2251
2034
|
|
|
2252
2035
|
class UpdateIdClaimHandler {
|
|
2253
|
-
/**
|
|
2254
|
-
* @constructor
|
|
2255
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2036
|
+
/**
|
|
2037
|
+
* @constructor
|
|
2038
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2256
2039
|
*/
|
|
2257
2040
|
constructor(formFieldRegistry) {
|
|
2258
2041
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -2285,9 +2068,9 @@ class UpdateIdClaimHandler {
|
|
|
2285
2068
|
UpdateIdClaimHandler.$inject = ['formFieldRegistry'];
|
|
2286
2069
|
|
|
2287
2070
|
class UpdateKeyClaimHandler {
|
|
2288
|
-
/**
|
|
2289
|
-
* @constructor
|
|
2290
|
-
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2071
|
+
/**
|
|
2072
|
+
* @constructor
|
|
2073
|
+
* @param { import('../../../core/FormFieldRegistry').default } formFieldRegistry
|
|
2291
2074
|
*/
|
|
2292
2075
|
constructor(formFieldRegistry) {
|
|
2293
2076
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -3106,6 +2889,9 @@ const types = [{
|
|
|
3106
2889
|
}, {
|
|
3107
2890
|
label: 'Number',
|
|
3108
2891
|
type: 'number'
|
|
2892
|
+
}, {
|
|
2893
|
+
label: 'Datetime',
|
|
2894
|
+
type: 'datetime'
|
|
3109
2895
|
}, {
|
|
3110
2896
|
label: 'Checkbox',
|
|
3111
2897
|
type: 'checkbox'
|
|
@@ -3122,7 +2908,7 @@ const types = [{
|
|
|
3122
2908
|
label: 'Select',
|
|
3123
2909
|
type: 'select'
|
|
3124
2910
|
}, {
|
|
3125
|
-
label: 'Text',
|
|
2911
|
+
label: 'Text view',
|
|
3126
2912
|
type: 'text'
|
|
3127
2913
|
}, {
|
|
3128
2914
|
label: 'Image view',
|
|
@@ -3147,7 +2933,7 @@ function Palette(props) {
|
|
|
3147
2933
|
label,
|
|
3148
2934
|
type
|
|
3149
2935
|
}) => {
|
|
3150
|
-
const Icon = iconsByType[type];
|
|
2936
|
+
const Icon = formJsViewer.iconsByType[type];
|
|
3151
2937
|
return jsxRuntime.jsxs("div", {
|
|
3152
2938
|
class: "fjs-palette-field fjs-drag-copy fjs-no-drop",
|
|
3153
2939
|
"data-field-type": type,
|
|
@@ -3182,10 +2968,10 @@ class PaletteRenderer {
|
|
|
3182
2968
|
});
|
|
3183
2969
|
}
|
|
3184
2970
|
|
|
3185
|
-
/**
|
|
3186
|
-
* Attach the palette to a parent node.
|
|
3187
|
-
*
|
|
3188
|
-
* @param {HTMLElement} container
|
|
2971
|
+
/**
|
|
2972
|
+
* Attach the palette to a parent node.
|
|
2973
|
+
*
|
|
2974
|
+
* @param {HTMLElement} container
|
|
3189
2975
|
*/
|
|
3190
2976
|
attachTo(container) {
|
|
3191
2977
|
if (!container) {
|
|
@@ -3205,8 +2991,8 @@ class PaletteRenderer {
|
|
|
3205
2991
|
this._eventBus.fire('palette.attach');
|
|
3206
2992
|
}
|
|
3207
2993
|
|
|
3208
|
-
/**
|
|
3209
|
-
* Detach the palette from its parent node.
|
|
2994
|
+
/**
|
|
2995
|
+
* Detach the palette from its parent node.
|
|
3210
2996
|
*/
|
|
3211
2997
|
detach() {
|
|
3212
2998
|
const parentNode = this._container.parentNode;
|
|
@@ -4682,7 +4468,7 @@ const OptionalFeelInput = React.forwardRef((props, ref) => {
|
|
|
4682
4468
|
value: value || ''
|
|
4683
4469
|
});
|
|
4684
4470
|
});
|
|
4685
|
-
React.forwardRef((props, ref) => {
|
|
4471
|
+
const OptionalFeelTextArea = React.forwardRef((props, ref) => {
|
|
4686
4472
|
const {
|
|
4687
4473
|
id,
|
|
4688
4474
|
disabled,
|
|
@@ -4816,6 +4602,28 @@ function FeelEntry(props) {
|
|
|
4816
4602
|
})]
|
|
4817
4603
|
});
|
|
4818
4604
|
}
|
|
4605
|
+
|
|
4606
|
+
/**
|
|
4607
|
+
* @param {Object} props
|
|
4608
|
+
* @param {Object} props.element
|
|
4609
|
+
* @param {String} props.id
|
|
4610
|
+
* @param {String} props.description
|
|
4611
|
+
* @param {Boolean} props.debounce
|
|
4612
|
+
* @param {Boolean} props.disabled
|
|
4613
|
+
* @param {String} props.label
|
|
4614
|
+
* @param {Function} props.getValue
|
|
4615
|
+
* @param {Function} props.setValue
|
|
4616
|
+
* @param {Function} props.onFocus
|
|
4617
|
+
* @param {Function} props.onBlur
|
|
4618
|
+
* @param {Function} props.validate
|
|
4619
|
+
*/
|
|
4620
|
+
function FeelTextArea(props) {
|
|
4621
|
+
return jsxRuntime.jsx(FeelEntry, {
|
|
4622
|
+
class: "bio-properties-panel-feel-textarea",
|
|
4623
|
+
OptionalComponent: OptionalFeelTextArea,
|
|
4624
|
+
...props
|
|
4625
|
+
});
|
|
4626
|
+
}
|
|
4819
4627
|
function isEdited$6(node) {
|
|
4820
4628
|
return node && (!!node.value || node.classList.contains('edited'));
|
|
4821
4629
|
}
|
|
@@ -5321,11 +5129,11 @@ function prefixId$1(id) {
|
|
|
5321
5129
|
return `bio-properties-panel-${id}`;
|
|
5322
5130
|
}
|
|
5323
5131
|
|
|
5324
|
-
/**
|
|
5325
|
-
* @param {string} type
|
|
5326
|
-
* @param {boolean} [strict]
|
|
5327
|
-
*
|
|
5328
|
-
* @returns {any}
|
|
5132
|
+
/**
|
|
5133
|
+
* @param {string} type
|
|
5134
|
+
* @param {boolean} [strict]
|
|
5135
|
+
*
|
|
5136
|
+
* @returns {any}
|
|
5329
5137
|
*/
|
|
5330
5138
|
function getService(type, strict) {}
|
|
5331
5139
|
const PropertiesPanelContext = preact.createContext({
|
|
@@ -5357,7 +5165,7 @@ function textToLabel(text) {
|
|
|
5357
5165
|
}
|
|
5358
5166
|
return null;
|
|
5359
5167
|
}
|
|
5360
|
-
const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea'];
|
|
5168
|
+
const INPUTS = ['checkbox', 'checklist', 'datetime', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea'];
|
|
5361
5169
|
const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
|
|
5362
5170
|
|
|
5363
5171
|
const labelsByType = {
|
|
@@ -5366,12 +5174,13 @@ const labelsByType = {
|
|
|
5366
5174
|
checklist: 'CHECKLIST',
|
|
5367
5175
|
columns: 'COLUMNS',
|
|
5368
5176
|
default: 'FORM',
|
|
5369
|
-
|
|
5177
|
+
datetime: 'DATETIME',
|
|
5178
|
+
image: 'IMAGE VIEW',
|
|
5370
5179
|
number: 'NUMBER',
|
|
5371
5180
|
radio: 'RADIO',
|
|
5372
5181
|
select: 'SELECT',
|
|
5373
5182
|
taglist: 'TAGLIST',
|
|
5374
|
-
text: 'TEXT',
|
|
5183
|
+
text: 'TEXT VIEW',
|
|
5375
5184
|
textfield: 'TEXT FIELD',
|
|
5376
5185
|
textarea: 'TEXT AREA'
|
|
5377
5186
|
};
|
|
@@ -5395,7 +5204,7 @@ const PropertiesPanelHeaderProvider = {
|
|
|
5395
5204
|
const {
|
|
5396
5205
|
type
|
|
5397
5206
|
} = field;
|
|
5398
|
-
const Icon = iconsByType[type];
|
|
5207
|
+
const Icon = formJsViewer.iconsByType[type];
|
|
5399
5208
|
if (Icon) {
|
|
5400
5209
|
return () => jsxRuntime.jsx(Icon, {
|
|
5401
5210
|
width: "36",
|
|
@@ -5412,8 +5221,8 @@ const PropertiesPanelHeaderProvider = {
|
|
|
5412
5221
|
}
|
|
5413
5222
|
};
|
|
5414
5223
|
|
|
5415
|
-
/**
|
|
5416
|
-
* Provide placeholders for empty and multiple state.
|
|
5224
|
+
/**
|
|
5225
|
+
* Provide placeholders for empty and multiple state.
|
|
5417
5226
|
*/
|
|
5418
5227
|
const PropertiesPanelPlaceholderProvider = {
|
|
5419
5228
|
getEmpty: () => {
|
|
@@ -5485,10 +5294,10 @@ function useService (type, strict) {
|
|
|
5485
5294
|
return getService(type, strict);
|
|
5486
5295
|
}
|
|
5487
5296
|
|
|
5488
|
-
/**
|
|
5489
|
-
* Retrieve list of variables from the form schema.
|
|
5490
|
-
*
|
|
5491
|
-
* @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
|
|
5492
5301
|
*/
|
|
5493
5302
|
function useVariables() {
|
|
5494
5303
|
const form = useService('formEditor');
|
|
@@ -6054,48 +5863,83 @@ function Key$1(props) {
|
|
|
6054
5863
|
});
|
|
6055
5864
|
}
|
|
6056
5865
|
|
|
6057
|
-
function
|
|
5866
|
+
function simpleStringEntryFactory(options) {
|
|
5867
|
+
const {
|
|
5868
|
+
id,
|
|
5869
|
+
label,
|
|
5870
|
+
path,
|
|
5871
|
+
props
|
|
5872
|
+
} = options;
|
|
6058
5873
|
const {
|
|
6059
5874
|
editField,
|
|
6060
5875
|
field
|
|
6061
5876
|
} = props;
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
field: field,
|
|
6072
|
-
isEdited: isEdited$1
|
|
6073
|
-
});
|
|
6074
|
-
}
|
|
6075
|
-
return entries;
|
|
5877
|
+
return {
|
|
5878
|
+
id,
|
|
5879
|
+
label,
|
|
5880
|
+
path,
|
|
5881
|
+
field,
|
|
5882
|
+
editField,
|
|
5883
|
+
component: SimpleStringComponent,
|
|
5884
|
+
isEdited: isEdited$1
|
|
5885
|
+
};
|
|
6076
5886
|
}
|
|
6077
|
-
|
|
5887
|
+
const SimpleStringComponent = props => {
|
|
6078
5888
|
const {
|
|
6079
|
-
|
|
5889
|
+
id,
|
|
5890
|
+
label,
|
|
5891
|
+
path,
|
|
6080
5892
|
field,
|
|
6081
|
-
|
|
5893
|
+
editField
|
|
6082
5894
|
} = props;
|
|
6083
5895
|
const debounce = useService('debounce');
|
|
6084
|
-
const
|
|
6085
|
-
const
|
|
6086
|
-
return minDash.get(field, path, '');
|
|
6087
|
-
};
|
|
6088
|
-
const setValue = value => {
|
|
6089
|
-
return editField(field, path, value);
|
|
6090
|
-
};
|
|
5896
|
+
const getValue = () => minDash.get(field, path, '');
|
|
5897
|
+
const setValue = value => editField(field, path, value);
|
|
6091
5898
|
return TextfieldEntry({
|
|
6092
5899
|
debounce,
|
|
6093
5900
|
element: field,
|
|
6094
5901
|
getValue,
|
|
6095
5902
|
id,
|
|
6096
|
-
label
|
|
5903
|
+
label,
|
|
6097
5904
|
setValue
|
|
6098
5905
|
});
|
|
5906
|
+
};
|
|
5907
|
+
|
|
5908
|
+
function LabelEntry(props) {
|
|
5909
|
+
const {
|
|
5910
|
+
field
|
|
5911
|
+
} = props;
|
|
5912
|
+
const {
|
|
5913
|
+
type,
|
|
5914
|
+
subtype
|
|
5915
|
+
} = field;
|
|
5916
|
+
const entries = [];
|
|
5917
|
+
if (type === 'datetime') {
|
|
5918
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.DATE || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
5919
|
+
entries.push(simpleStringEntryFactory({
|
|
5920
|
+
id: 'date-label',
|
|
5921
|
+
path: formJsViewer.DATE_LABEL_PATH,
|
|
5922
|
+
label: 'Date label',
|
|
5923
|
+
props
|
|
5924
|
+
}));
|
|
5925
|
+
}
|
|
5926
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.TIME || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
5927
|
+
entries.push(simpleStringEntryFactory({
|
|
5928
|
+
id: 'time-label',
|
|
5929
|
+
path: formJsViewer.TIME_LABEL_PATH,
|
|
5930
|
+
label: 'Time label',
|
|
5931
|
+
props
|
|
5932
|
+
}));
|
|
5933
|
+
}
|
|
5934
|
+
} else if (INPUTS.includes(type) || type === 'button') {
|
|
5935
|
+
entries.push(simpleStringEntryFactory({
|
|
5936
|
+
id: 'label',
|
|
5937
|
+
path: ['label'],
|
|
5938
|
+
label: 'Field label',
|
|
5939
|
+
props
|
|
5940
|
+
}));
|
|
5941
|
+
}
|
|
5942
|
+
return entries;
|
|
6099
5943
|
}
|
|
6100
5944
|
|
|
6101
5945
|
function SourceEntry(props) {
|
|
@@ -6156,17 +6000,16 @@ function TextEntry(props) {
|
|
|
6156
6000
|
const {
|
|
6157
6001
|
type
|
|
6158
6002
|
} = field;
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
entries.push({
|
|
6162
|
-
id: 'text',
|
|
6163
|
-
component: Text,
|
|
6164
|
-
editField: editField,
|
|
6165
|
-
field: field,
|
|
6166
|
-
isEdited: isEdited$2
|
|
6167
|
-
});
|
|
6003
|
+
if (type !== 'text') {
|
|
6004
|
+
return [];
|
|
6168
6005
|
}
|
|
6169
|
-
return
|
|
6006
|
+
return [{
|
|
6007
|
+
id: 'text',
|
|
6008
|
+
component: Text,
|
|
6009
|
+
editField: editField,
|
|
6010
|
+
field: field,
|
|
6011
|
+
isEdited: isEdited$6
|
|
6012
|
+
}];
|
|
6170
6013
|
}
|
|
6171
6014
|
function Text(props) {
|
|
6172
6015
|
const {
|
|
@@ -6175,6 +6018,9 @@ function Text(props) {
|
|
|
6175
6018
|
id
|
|
6176
6019
|
} = props;
|
|
6177
6020
|
const debounce = useService('debounce');
|
|
6021
|
+
const variables = useVariables().map(name => ({
|
|
6022
|
+
name
|
|
6023
|
+
}));
|
|
6178
6024
|
const path = ['text'];
|
|
6179
6025
|
const getValue = () => {
|
|
6180
6026
|
return minDash.get(field, path, '');
|
|
@@ -6182,15 +6028,17 @@ function Text(props) {
|
|
|
6182
6028
|
const setValue = value => {
|
|
6183
6029
|
return editField(field, path, value);
|
|
6184
6030
|
};
|
|
6185
|
-
return
|
|
6031
|
+
return FeelTextArea({
|
|
6186
6032
|
debounce,
|
|
6187
|
-
description: 'Use Markdown or basic HTML to format.',
|
|
6033
|
+
description: 'Use an Expression, Markdown or basic HTML to format.',
|
|
6188
6034
|
element: field,
|
|
6035
|
+
feel: 'optional',
|
|
6189
6036
|
getValue,
|
|
6190
6037
|
id,
|
|
6191
6038
|
label: 'Text',
|
|
6192
6039
|
rows: 10,
|
|
6193
|
-
setValue
|
|
6040
|
+
setValue,
|
|
6041
|
+
variables
|
|
6194
6042
|
});
|
|
6195
6043
|
}
|
|
6196
6044
|
|
|
@@ -6283,8 +6131,7 @@ function NumberArrowStep(props) {
|
|
|
6283
6131
|
function NumberSerializationEntry(props) {
|
|
6284
6132
|
const {
|
|
6285
6133
|
editField,
|
|
6286
|
-
field
|
|
6287
|
-
id
|
|
6134
|
+
field
|
|
6288
6135
|
} = props;
|
|
6289
6136
|
const {
|
|
6290
6137
|
type
|
|
@@ -6294,7 +6141,7 @@ function NumberSerializationEntry(props) {
|
|
|
6294
6141
|
}
|
|
6295
6142
|
const entries = [];
|
|
6296
6143
|
entries.push({
|
|
6297
|
-
id:
|
|
6144
|
+
id: 'serialize-to-string',
|
|
6298
6145
|
component: SerializeToString,
|
|
6299
6146
|
isEdited: isEdited$7,
|
|
6300
6147
|
editField,
|
|
@@ -6332,6 +6179,243 @@ function SerializeToString(props) {
|
|
|
6332
6179
|
});
|
|
6333
6180
|
}
|
|
6334
6181
|
|
|
6182
|
+
function DateTimeEntry(props) {
|
|
6183
|
+
const {
|
|
6184
|
+
editField,
|
|
6185
|
+
field
|
|
6186
|
+
} = props;
|
|
6187
|
+
const {
|
|
6188
|
+
type,
|
|
6189
|
+
subtype
|
|
6190
|
+
} = field;
|
|
6191
|
+
if (type !== 'datetime') {
|
|
6192
|
+
return [];
|
|
6193
|
+
}
|
|
6194
|
+
const entries = [{
|
|
6195
|
+
id: 'subtype',
|
|
6196
|
+
component: DateTimeSubtypeSelect,
|
|
6197
|
+
isEdited: isEdited$4,
|
|
6198
|
+
editField,
|
|
6199
|
+
field
|
|
6200
|
+
}];
|
|
6201
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.TIME || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
6202
|
+
entries.push({
|
|
6203
|
+
id: 'use24h',
|
|
6204
|
+
component: Use24h,
|
|
6205
|
+
isEdited: isEdited$7,
|
|
6206
|
+
editField,
|
|
6207
|
+
field
|
|
6208
|
+
});
|
|
6209
|
+
}
|
|
6210
|
+
return entries;
|
|
6211
|
+
}
|
|
6212
|
+
function DateTimeSubtypeSelect(props) {
|
|
6213
|
+
const {
|
|
6214
|
+
editField,
|
|
6215
|
+
field,
|
|
6216
|
+
id
|
|
6217
|
+
} = props;
|
|
6218
|
+
const getValue = e => minDash.get(field, formJsViewer.DATETIME_SUBTYPE_PATH);
|
|
6219
|
+
const clearTimeConfig = () => {
|
|
6220
|
+
const timeConfigPaths = [formJsViewer.TIME_LABEL_PATH, formJsViewer.TIME_USE24H_PATH, formJsViewer.TIME_INTERVAL_PATH, formJsViewer.TIME_SERIALISING_FORMAT_PATH];
|
|
6221
|
+
for (const path of timeConfigPaths) {
|
|
6222
|
+
editField(field, path, undefined);
|
|
6223
|
+
}
|
|
6224
|
+
};
|
|
6225
|
+
const initTimeConfig = () => {
|
|
6226
|
+
editField(field, formJsViewer.TIME_LABEL_PATH, 'Time');
|
|
6227
|
+
editField(field, formJsViewer.TIME_SERIALISING_FORMAT_PATH, formJsViewer.TIME_SERIALISING_FORMATS.UTC_OFFSET);
|
|
6228
|
+
editField(field, formJsViewer.TIME_INTERVAL_PATH, 15);
|
|
6229
|
+
};
|
|
6230
|
+
const clearDateConfig = () => {
|
|
6231
|
+
const dateConfigPaths = [formJsViewer.DATE_LABEL_PATH, formJsViewer.DATE_DISALLOW_PAST_PATH];
|
|
6232
|
+
for (const path of dateConfigPaths) {
|
|
6233
|
+
editField(field, path, undefined);
|
|
6234
|
+
}
|
|
6235
|
+
};
|
|
6236
|
+
const initDateConfig = () => {
|
|
6237
|
+
editField(field, formJsViewer.DATE_LABEL_PATH, 'Date');
|
|
6238
|
+
};
|
|
6239
|
+
const setValue = value => {
|
|
6240
|
+
const oldValue = getValue();
|
|
6241
|
+
if (oldValue === value) return;
|
|
6242
|
+
if (value === formJsViewer.DATETIME_SUBTYPES.DATE) {
|
|
6243
|
+
clearTimeConfig();
|
|
6244
|
+
oldValue === formJsViewer.DATETIME_SUBTYPES.TIME && initDateConfig();
|
|
6245
|
+
} else if (value === formJsViewer.DATETIME_SUBTYPES.TIME) {
|
|
6246
|
+
clearDateConfig();
|
|
6247
|
+
oldValue === formJsViewer.DATETIME_SUBTYPES.DATE && initTimeConfig();
|
|
6248
|
+
} else if (value === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
6249
|
+
oldValue === formJsViewer.DATETIME_SUBTYPES.DATE && initTimeConfig();
|
|
6250
|
+
oldValue === formJsViewer.DATETIME_SUBTYPES.TIME && initDateConfig();
|
|
6251
|
+
}
|
|
6252
|
+
return editField(field, formJsViewer.DATETIME_SUBTYPE_PATH, value);
|
|
6253
|
+
};
|
|
6254
|
+
const getDatetimeSubtypes = () => {
|
|
6255
|
+
return Object.values(formJsViewer.DATETIME_SUBTYPES).map(subtype => ({
|
|
6256
|
+
label: formJsViewer.DATETIME_SUBTYPES_LABELS[subtype],
|
|
6257
|
+
value: subtype
|
|
6258
|
+
}));
|
|
6259
|
+
};
|
|
6260
|
+
return SelectEntry({
|
|
6261
|
+
label: 'Subtype',
|
|
6262
|
+
element: field,
|
|
6263
|
+
getOptions: getDatetimeSubtypes,
|
|
6264
|
+
getValue,
|
|
6265
|
+
id,
|
|
6266
|
+
setValue
|
|
6267
|
+
});
|
|
6268
|
+
}
|
|
6269
|
+
function Use24h(props) {
|
|
6270
|
+
const {
|
|
6271
|
+
editField,
|
|
6272
|
+
field,
|
|
6273
|
+
id
|
|
6274
|
+
} = props;
|
|
6275
|
+
const path = formJsViewer.TIME_USE24H_PATH;
|
|
6276
|
+
const getValue = () => {
|
|
6277
|
+
return minDash.get(field, path, '');
|
|
6278
|
+
};
|
|
6279
|
+
const setValue = value => {
|
|
6280
|
+
return editField(field, path, value);
|
|
6281
|
+
};
|
|
6282
|
+
return CheckboxEntry({
|
|
6283
|
+
element: field,
|
|
6284
|
+
getValue,
|
|
6285
|
+
id,
|
|
6286
|
+
label: 'Use 24h',
|
|
6287
|
+
setValue
|
|
6288
|
+
});
|
|
6289
|
+
}
|
|
6290
|
+
|
|
6291
|
+
function DateTimeConstraintsEntry(props) {
|
|
6292
|
+
const {
|
|
6293
|
+
editField,
|
|
6294
|
+
field,
|
|
6295
|
+
id
|
|
6296
|
+
} = props;
|
|
6297
|
+
const {
|
|
6298
|
+
type,
|
|
6299
|
+
subtype
|
|
6300
|
+
} = field;
|
|
6301
|
+
if (type !== 'datetime') {
|
|
6302
|
+
return [];
|
|
6303
|
+
}
|
|
6304
|
+
const entries = [];
|
|
6305
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.TIME || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
6306
|
+
entries.push({
|
|
6307
|
+
id: id + '-timeInterval',
|
|
6308
|
+
component: TimeIntervalSelect,
|
|
6309
|
+
isEdited: isEdited$4,
|
|
6310
|
+
editField,
|
|
6311
|
+
field
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.DATE || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
6315
|
+
entries.push({
|
|
6316
|
+
id: id + '-disallowPassedDates',
|
|
6317
|
+
component: DisallowPassedDates,
|
|
6318
|
+
isEdited: isEdited$7,
|
|
6319
|
+
editField,
|
|
6320
|
+
field
|
|
6321
|
+
});
|
|
6322
|
+
}
|
|
6323
|
+
return entries;
|
|
6324
|
+
}
|
|
6325
|
+
function DisallowPassedDates(props) {
|
|
6326
|
+
const {
|
|
6327
|
+
editField,
|
|
6328
|
+
field,
|
|
6329
|
+
id
|
|
6330
|
+
} = props;
|
|
6331
|
+
const path = formJsViewer.DATE_DISALLOW_PAST_PATH;
|
|
6332
|
+
const getValue = () => {
|
|
6333
|
+
return minDash.get(field, path, '');
|
|
6334
|
+
};
|
|
6335
|
+
const setValue = value => {
|
|
6336
|
+
return editField(field, path, value);
|
|
6337
|
+
};
|
|
6338
|
+
return CheckboxEntry({
|
|
6339
|
+
element: field,
|
|
6340
|
+
getValue,
|
|
6341
|
+
id,
|
|
6342
|
+
label: 'Disallow past dates',
|
|
6343
|
+
setValue
|
|
6344
|
+
});
|
|
6345
|
+
}
|
|
6346
|
+
function TimeIntervalSelect(props) {
|
|
6347
|
+
const {
|
|
6348
|
+
editField,
|
|
6349
|
+
field,
|
|
6350
|
+
id
|
|
6351
|
+
} = props;
|
|
6352
|
+
const timeIntervals = [1, 5, 10, 15, 30, 60];
|
|
6353
|
+
const getValue = e => minDash.get(field, formJsViewer.TIME_INTERVAL_PATH);
|
|
6354
|
+
const setValue = value => editField(field, formJsViewer.TIME_INTERVAL_PATH, parseInt(value));
|
|
6355
|
+
const getTimeIntervals = () => {
|
|
6356
|
+
return timeIntervals.map(timeInterval => ({
|
|
6357
|
+
label: timeInterval === 60 ? '1h' : timeInterval + 'm',
|
|
6358
|
+
value: timeInterval
|
|
6359
|
+
}));
|
|
6360
|
+
};
|
|
6361
|
+
return SelectEntry({
|
|
6362
|
+
label: 'Time interval',
|
|
6363
|
+
element: field,
|
|
6364
|
+
getOptions: getTimeIntervals,
|
|
6365
|
+
getValue,
|
|
6366
|
+
id,
|
|
6367
|
+
setValue
|
|
6368
|
+
});
|
|
6369
|
+
}
|
|
6370
|
+
|
|
6371
|
+
function DateTimeFormatEntry(props) {
|
|
6372
|
+
const {
|
|
6373
|
+
editField,
|
|
6374
|
+
field
|
|
6375
|
+
} = props;
|
|
6376
|
+
const {
|
|
6377
|
+
type,
|
|
6378
|
+
subtype
|
|
6379
|
+
} = field;
|
|
6380
|
+
if (type !== 'datetime') {
|
|
6381
|
+
return [];
|
|
6382
|
+
}
|
|
6383
|
+
const entries = [];
|
|
6384
|
+
if (subtype === formJsViewer.DATETIME_SUBTYPES.TIME || subtype === formJsViewer.DATETIME_SUBTYPES.DATETIME) {
|
|
6385
|
+
entries.push({
|
|
6386
|
+
id: 'time-format',
|
|
6387
|
+
component: TimeFormatSelect,
|
|
6388
|
+
isEdited: isEdited$4,
|
|
6389
|
+
editField,
|
|
6390
|
+
field
|
|
6391
|
+
});
|
|
6392
|
+
}
|
|
6393
|
+
return entries;
|
|
6394
|
+
}
|
|
6395
|
+
function TimeFormatSelect(props) {
|
|
6396
|
+
const {
|
|
6397
|
+
editField,
|
|
6398
|
+
field,
|
|
6399
|
+
id
|
|
6400
|
+
} = props;
|
|
6401
|
+
const getValue = e => minDash.get(field, formJsViewer.TIME_SERIALISING_FORMAT_PATH);
|
|
6402
|
+
const setValue = value => editField(field, formJsViewer.TIME_SERIALISING_FORMAT_PATH, value);
|
|
6403
|
+
const getTimeSerialisingFormats = () => {
|
|
6404
|
+
return Object.values(formJsViewer.TIME_SERIALISING_FORMATS).map(format => ({
|
|
6405
|
+
label: formJsViewer.TIME_SERIALISINGFORMAT_LABELS[format],
|
|
6406
|
+
value: format
|
|
6407
|
+
}));
|
|
6408
|
+
};
|
|
6409
|
+
return SelectEntry({
|
|
6410
|
+
label: 'Time format',
|
|
6411
|
+
element: field,
|
|
6412
|
+
getOptions: getTimeSerialisingFormats,
|
|
6413
|
+
getValue,
|
|
6414
|
+
id,
|
|
6415
|
+
setValue
|
|
6416
|
+
});
|
|
6417
|
+
}
|
|
6418
|
+
|
|
6335
6419
|
function ValueEntry(props) {
|
|
6336
6420
|
const {
|
|
6337
6421
|
editField,
|
|
@@ -6498,14 +6582,14 @@ function Value(props) {
|
|
|
6498
6582
|
|
|
6499
6583
|
// helpers //////////
|
|
6500
6584
|
|
|
6501
|
-
/**
|
|
6502
|
-
* Returns copy of object with updated value.
|
|
6503
|
-
*
|
|
6504
|
-
* @param {Object} properties
|
|
6505
|
-
* @param {string} key
|
|
6506
|
-
* @param {string} value
|
|
6507
|
-
*
|
|
6508
|
-
* @returns {Object}
|
|
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}
|
|
6509
6593
|
*/
|
|
6510
6594
|
function updateValue(properties, key, value) {
|
|
6511
6595
|
return {
|
|
@@ -6514,14 +6598,14 @@ function updateValue(properties, key, value) {
|
|
|
6514
6598
|
};
|
|
6515
6599
|
}
|
|
6516
6600
|
|
|
6517
|
-
/**
|
|
6518
|
-
* Returns copy of object with updated key.
|
|
6519
|
-
*
|
|
6520
|
-
* @param {Object} properties
|
|
6521
|
-
* @param {string} oldKey
|
|
6522
|
-
* @param {string} newKey
|
|
6523
|
-
*
|
|
6524
|
-
* @returns {Object}
|
|
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}
|
|
6525
6609
|
*/
|
|
6526
6610
|
function updateKey(properties, oldKey, newKey) {
|
|
6527
6611
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -6533,37 +6617,6 @@ function updateKey(properties, oldKey, newKey) {
|
|
|
6533
6617
|
}, {});
|
|
6534
6618
|
}
|
|
6535
6619
|
|
|
6536
|
-
// config ///////////////////
|
|
6537
|
-
|
|
6538
|
-
const VALUES_SOURCES = {
|
|
6539
|
-
STATIC: 'static',
|
|
6540
|
-
INPUT: 'input'
|
|
6541
|
-
};
|
|
6542
|
-
const VALUES_SOURCE_DEFAULT = VALUES_SOURCES.STATIC;
|
|
6543
|
-
const VALUES_SOURCES_LABELS = {
|
|
6544
|
-
[VALUES_SOURCES.STATIC]: 'Static',
|
|
6545
|
-
[VALUES_SOURCES.INPUT]: 'Input data'
|
|
6546
|
-
};
|
|
6547
|
-
const VALUES_SOURCES_PATHS = {
|
|
6548
|
-
[VALUES_SOURCES.STATIC]: ['values'],
|
|
6549
|
-
[VALUES_SOURCES.INPUT]: ['valuesKey']
|
|
6550
|
-
};
|
|
6551
|
-
const VALUES_SOURCES_DEFAULTS = {
|
|
6552
|
-
[VALUES_SOURCES.STATIC]: [],
|
|
6553
|
-
[VALUES_SOURCES.INPUT]: ''
|
|
6554
|
-
};
|
|
6555
|
-
|
|
6556
|
-
// helpers ///////////////////
|
|
6557
|
-
|
|
6558
|
-
function getValuesSource(field) {
|
|
6559
|
-
for (const source of Object.values(VALUES_SOURCES)) {
|
|
6560
|
-
if (minDash.get(field, VALUES_SOURCES_PATHS[source]) !== undefined) {
|
|
6561
|
-
return source;
|
|
6562
|
-
}
|
|
6563
|
-
}
|
|
6564
|
-
return VALUES_SOURCE_DEFAULT;
|
|
6565
|
-
}
|
|
6566
|
-
|
|
6567
6620
|
function ValuesSourceSelectEntry(props) {
|
|
6568
6621
|
const {
|
|
6569
6622
|
editField,
|
|
@@ -6584,21 +6637,21 @@ function ValuesSourceSelect(props) {
|
|
|
6584
6637
|
field,
|
|
6585
6638
|
id
|
|
6586
6639
|
} = props;
|
|
6587
|
-
const getValue = getValuesSource;
|
|
6640
|
+
const getValue = formJsViewer.getValuesSource;
|
|
6588
6641
|
const setValue = value => {
|
|
6589
6642
|
let newField = field;
|
|
6590
6643
|
const newProperties = {};
|
|
6591
|
-
Object.values(VALUES_SOURCES).forEach(source => {
|
|
6644
|
+
Object.values(formJsViewer.VALUES_SOURCES).forEach(source => {
|
|
6592
6645
|
// Clear all values source definitions and default the newly selected one
|
|
6593
|
-
const newValue = value === source ? VALUES_SOURCES_DEFAULTS[source] : undefined;
|
|
6594
|
-
newProperties[VALUES_SOURCES_PATHS[source]] = newValue;
|
|
6646
|
+
const newValue = value === source ? formJsViewer.VALUES_SOURCES_DEFAULTS[source] : undefined;
|
|
6647
|
+
newProperties[formJsViewer.VALUES_SOURCES_PATHS[source]] = newValue;
|
|
6595
6648
|
});
|
|
6596
6649
|
newField = editField(field, newProperties);
|
|
6597
6650
|
return newField;
|
|
6598
6651
|
};
|
|
6599
6652
|
const getValuesSourceOptions = () => {
|
|
6600
|
-
return Object.values(VALUES_SOURCES).map(valueSource => ({
|
|
6601
|
-
label: VALUES_SOURCES_LABELS[valueSource],
|
|
6653
|
+
return Object.values(formJsViewer.VALUES_SOURCES).map(valueSource => ({
|
|
6654
|
+
label: formJsViewer.VALUES_SOURCES_LABELS[valueSource],
|
|
6602
6655
|
value: valueSource
|
|
6603
6656
|
}));
|
|
6604
6657
|
};
|
|
@@ -6637,7 +6690,7 @@ function InputValuesKey(props) {
|
|
|
6637
6690
|
description
|
|
6638
6691
|
} = props;
|
|
6639
6692
|
const debounce = useService('debounce');
|
|
6640
|
-
const path = VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];
|
|
6693
|
+
const path = formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.INPUT];
|
|
6641
6694
|
const getValue = () => minDash.get(field, path, '');
|
|
6642
6695
|
const setValue = value => editField(field, path, value || '');
|
|
6643
6696
|
const validate = value => {
|
|
@@ -6674,10 +6727,10 @@ function StaticValuesSourceEntry(props) {
|
|
|
6674
6727
|
e.stopPropagation();
|
|
6675
6728
|
const index = values.length + 1;
|
|
6676
6729
|
const entry = getIndexedEntry(index);
|
|
6677
|
-
editField(field, VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC], arrayAdd(values, values.length, entry));
|
|
6730
|
+
editField(field, formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.STATIC], arrayAdd(values, values.length, entry));
|
|
6678
6731
|
};
|
|
6679
6732
|
const removeEntry = entry => {
|
|
6680
|
-
editField(field, VALUES_SOURCES_PATHS[VALUES_SOURCES.STATIC], minDash.without(values, entry));
|
|
6733
|
+
editField(field, formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.STATIC], minDash.without(values, entry));
|
|
6681
6734
|
};
|
|
6682
6735
|
const validateFactory = key => {
|
|
6683
6736
|
return value => {
|
|
@@ -6730,6 +6783,83 @@ function getIndexedEntry(index) {
|
|
|
6730
6783
|
return entry;
|
|
6731
6784
|
}
|
|
6732
6785
|
|
|
6786
|
+
function AdornerEntry(props) {
|
|
6787
|
+
const {
|
|
6788
|
+
editField,
|
|
6789
|
+
field
|
|
6790
|
+
} = props;
|
|
6791
|
+
const {
|
|
6792
|
+
type
|
|
6793
|
+
} = field;
|
|
6794
|
+
const entries = [];
|
|
6795
|
+
const onChange = key => {
|
|
6796
|
+
return value => {
|
|
6797
|
+
const appearance = minDash.get(field, ['appearance'], {});
|
|
6798
|
+
editField(field, ['appearance'], minDash.set(appearance, [key], value));
|
|
6799
|
+
};
|
|
6800
|
+
};
|
|
6801
|
+
const getValue = key => {
|
|
6802
|
+
return () => {
|
|
6803
|
+
return minDash.get(field, ['appearance', key]);
|
|
6804
|
+
};
|
|
6805
|
+
};
|
|
6806
|
+
if (['number', 'textfield'].includes(type)) {
|
|
6807
|
+
entries.push({
|
|
6808
|
+
id: 'prefix-adorner',
|
|
6809
|
+
component: PrefixAdorner,
|
|
6810
|
+
isEdited: isEdited$1,
|
|
6811
|
+
editField,
|
|
6812
|
+
field,
|
|
6813
|
+
onChange,
|
|
6814
|
+
getValue
|
|
6815
|
+
});
|
|
6816
|
+
entries.push({
|
|
6817
|
+
id: 'suffix-adorner',
|
|
6818
|
+
component: SuffixAdorner,
|
|
6819
|
+
isEdited: isEdited$1,
|
|
6820
|
+
editField,
|
|
6821
|
+
field,
|
|
6822
|
+
onChange,
|
|
6823
|
+
getValue
|
|
6824
|
+
});
|
|
6825
|
+
}
|
|
6826
|
+
return entries;
|
|
6827
|
+
}
|
|
6828
|
+
function PrefixAdorner(props) {
|
|
6829
|
+
const {
|
|
6830
|
+
field,
|
|
6831
|
+
id,
|
|
6832
|
+
onChange,
|
|
6833
|
+
getValue
|
|
6834
|
+
} = props;
|
|
6835
|
+
const debounce = useService('debounce');
|
|
6836
|
+
return TextfieldEntry({
|
|
6837
|
+
debounce,
|
|
6838
|
+
element: field,
|
|
6839
|
+
getValue: getValue('prefixAdorner'),
|
|
6840
|
+
id,
|
|
6841
|
+
label: 'Prefix',
|
|
6842
|
+
setValue: onChange('prefixAdorner')
|
|
6843
|
+
});
|
|
6844
|
+
}
|
|
6845
|
+
function SuffixAdorner(props) {
|
|
6846
|
+
const {
|
|
6847
|
+
field,
|
|
6848
|
+
id,
|
|
6849
|
+
onChange,
|
|
6850
|
+
getValue
|
|
6851
|
+
} = props;
|
|
6852
|
+
const debounce = useService('debounce');
|
|
6853
|
+
return TextfieldEntry({
|
|
6854
|
+
debounce,
|
|
6855
|
+
element: field,
|
|
6856
|
+
getValue: getValue('suffixAdorner'),
|
|
6857
|
+
id,
|
|
6858
|
+
label: 'Suffix',
|
|
6859
|
+
setValue: onChange('suffixAdorner')
|
|
6860
|
+
});
|
|
6861
|
+
}
|
|
6862
|
+
|
|
6733
6863
|
function ConditionEntry(props) {
|
|
6734
6864
|
const {
|
|
6735
6865
|
editField,
|
|
@@ -6800,6 +6930,9 @@ function GeneralGroup(field, editField) {
|
|
|
6800
6930
|
}), ...ColumnsEntry({
|
|
6801
6931
|
field,
|
|
6802
6932
|
editField
|
|
6933
|
+
}), ...DateTimeEntry({
|
|
6934
|
+
field,
|
|
6935
|
+
editField
|
|
6803
6936
|
}), ...TextEntry({
|
|
6804
6937
|
field,
|
|
6805
6938
|
editField
|
|
@@ -6827,6 +6960,9 @@ function SerializationGroup(field, editField) {
|
|
|
6827
6960
|
const entries = [...NumberSerializationEntry({
|
|
6828
6961
|
field,
|
|
6829
6962
|
editField
|
|
6963
|
+
}), ...DateTimeFormatEntry({
|
|
6964
|
+
field,
|
|
6965
|
+
editField
|
|
6830
6966
|
})];
|
|
6831
6967
|
if (!entries.length) {
|
|
6832
6968
|
return null;
|
|
@@ -6838,6 +6974,21 @@ function SerializationGroup(field, editField) {
|
|
|
6838
6974
|
};
|
|
6839
6975
|
}
|
|
6840
6976
|
|
|
6977
|
+
function ConstraintsGroup(field, editField) {
|
|
6978
|
+
const entries = [...DateTimeConstraintsEntry({
|
|
6979
|
+
field,
|
|
6980
|
+
editField
|
|
6981
|
+
})];
|
|
6982
|
+
if (!entries.length) {
|
|
6983
|
+
return null;
|
|
6984
|
+
}
|
|
6985
|
+
return {
|
|
6986
|
+
id: 'constraints',
|
|
6987
|
+
label: 'Constraints',
|
|
6988
|
+
entries
|
|
6989
|
+
};
|
|
6990
|
+
}
|
|
6991
|
+
|
|
6841
6992
|
const VALIDATION_TYPE_OPTIONS = {
|
|
6842
6993
|
custom: {
|
|
6843
6994
|
value: 'custom',
|
|
@@ -7079,8 +7230,8 @@ function ValuesGroups(field, editField) {
|
|
|
7079
7230
|
};
|
|
7080
7231
|
const valuesSourceId = `${fieldId}-valuesSource`;
|
|
7081
7232
|
|
|
7082
|
-
/**
|
|
7083
|
-
* @type {Array<Group|ListGroup>}
|
|
7233
|
+
/**
|
|
7234
|
+
* @type {Array<Group|ListGroup>}
|
|
7084
7235
|
*/
|
|
7085
7236
|
const groups = [{
|
|
7086
7237
|
id: valuesSourceId,
|
|
@@ -7091,8 +7242,8 @@ function ValuesGroups(field, editField) {
|
|
|
7091
7242
|
id: valuesSourceId
|
|
7092
7243
|
})
|
|
7093
7244
|
}];
|
|
7094
|
-
const valuesSource = getValuesSource(field);
|
|
7095
|
-
if (valuesSource === VALUES_SOURCES.INPUT) {
|
|
7245
|
+
const valuesSource = formJsViewer.getValuesSource(field);
|
|
7246
|
+
if (valuesSource === formJsViewer.VALUES_SOURCES.INPUT) {
|
|
7096
7247
|
const dynamicValuesId = `${fieldId}-dynamicValues`;
|
|
7097
7248
|
groups.push({
|
|
7098
7249
|
id: dynamicValuesId,
|
|
@@ -7103,7 +7254,7 @@ function ValuesGroups(field, editField) {
|
|
|
7103
7254
|
id: dynamicValuesId
|
|
7104
7255
|
})
|
|
7105
7256
|
});
|
|
7106
|
-
} else if (valuesSource === VALUES_SOURCES.STATIC) {
|
|
7257
|
+
} else if (valuesSource === formJsViewer.VALUES_SOURCES.STATIC) {
|
|
7107
7258
|
const staticValuesId = `${fieldId}-staticValues`;
|
|
7108
7259
|
groups.push({
|
|
7109
7260
|
id: staticValuesId,
|
|
@@ -7181,13 +7332,13 @@ function CustomValuesGroup(field, editField) {
|
|
|
7181
7332
|
|
|
7182
7333
|
// helpers //////////
|
|
7183
7334
|
|
|
7184
|
-
/**
|
|
7185
|
-
* Returns copy of object without key.
|
|
7186
|
-
*
|
|
7187
|
-
* @param {Object} properties
|
|
7188
|
-
* @param {string} oldKey
|
|
7189
|
-
*
|
|
7190
|
-
* @returns {Object}
|
|
7335
|
+
/**
|
|
7336
|
+
* Returns copy of object without key.
|
|
7337
|
+
*
|
|
7338
|
+
* @param {Object} properties
|
|
7339
|
+
* @param {string} oldKey
|
|
7340
|
+
*
|
|
7341
|
+
* @returns {Object}
|
|
7191
7342
|
*/
|
|
7192
7343
|
function removeKey(properties, oldKey) {
|
|
7193
7344
|
return Object.entries(properties).reduce((newProperties, entry) => {
|
|
@@ -7202,6 +7353,21 @@ function removeKey(properties, oldKey) {
|
|
|
7202
7353
|
}, {});
|
|
7203
7354
|
}
|
|
7204
7355
|
|
|
7356
|
+
function AppearanceGroup(field, editField) {
|
|
7357
|
+
const entries = [...AdornerEntry({
|
|
7358
|
+
field,
|
|
7359
|
+
editField
|
|
7360
|
+
})];
|
|
7361
|
+
if (!entries.length) {
|
|
7362
|
+
return null;
|
|
7363
|
+
}
|
|
7364
|
+
return {
|
|
7365
|
+
id: 'appearance',
|
|
7366
|
+
label: 'Appearance',
|
|
7367
|
+
entries
|
|
7368
|
+
};
|
|
7369
|
+
}
|
|
7370
|
+
|
|
7205
7371
|
function ConditionGroup(field, editField) {
|
|
7206
7372
|
const {
|
|
7207
7373
|
type
|
|
@@ -7224,7 +7390,7 @@ function getGroups(field, editField) {
|
|
|
7224
7390
|
if (!field) {
|
|
7225
7391
|
return [];
|
|
7226
7392
|
}
|
|
7227
|
-
const groups = [GeneralGroup(field, editField), ConditionGroup(field, editField), SerializationGroup(field, editField), ...ValuesGroups(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
|
|
7393
|
+
const groups = [GeneralGroup(field, editField), ConditionGroup(field, editField), AppearanceGroup(field, editField), SerializationGroup(field, editField), ...ValuesGroups(field, editField), ConstraintsGroup(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
|
|
7228
7394
|
|
|
7229
7395
|
// contract: if a group returns null, it should not be displayed at all
|
|
7230
7396
|
return groups.filter(group => group !== null);
|
|
@@ -7265,9 +7431,9 @@ function FormPropertiesPanel(props) {
|
|
|
7265
7431
|
}, []);
|
|
7266
7432
|
hooks$1.useLayoutEffect(() => {
|
|
7267
7433
|
const onFieldChanged = () => {
|
|
7268
|
-
/**
|
|
7269
|
-
* TODO(pinussilvestrus): update with actual updated element,
|
|
7270
|
-
* once we have a proper updater/change support
|
|
7434
|
+
/**
|
|
7435
|
+
* TODO(pinussilvestrus): update with actual updated element,
|
|
7436
|
+
* once we have a proper updater/change support
|
|
7271
7437
|
*/
|
|
7272
7438
|
_update(selection.get() || schema);
|
|
7273
7439
|
};
|
|
@@ -7319,10 +7485,10 @@ class PropertiesPanelRenderer {
|
|
|
7319
7485
|
});
|
|
7320
7486
|
}
|
|
7321
7487
|
|
|
7322
|
-
/**
|
|
7323
|
-
* Attach the properties panel to a parent node.
|
|
7324
|
-
*
|
|
7325
|
-
* @param {HTMLElement} container
|
|
7488
|
+
/**
|
|
7489
|
+
* Attach the properties panel to a parent node.
|
|
7490
|
+
*
|
|
7491
|
+
* @param {HTMLElement} container
|
|
7326
7492
|
*/
|
|
7327
7493
|
attachTo(container) {
|
|
7328
7494
|
if (!container) {
|
|
@@ -7342,8 +7508,8 @@ class PropertiesPanelRenderer {
|
|
|
7342
7508
|
this._eventBus.fire('propertiesPanel.attach');
|
|
7343
7509
|
}
|
|
7344
7510
|
|
|
7345
|
-
/**
|
|
7346
|
-
* Detach the properties panel from its parent node.
|
|
7511
|
+
/**
|
|
7512
|
+
* Detach the properties panel from its parent node.
|
|
7347
7513
|
*/
|
|
7348
7514
|
detach() {
|
|
7349
7515
|
const parentNode = this._container.parentNode;
|
|
@@ -7375,48 +7541,48 @@ var PropertiesPanelModule = {
|
|
|
7375
7541
|
|
|
7376
7542
|
const ids = new Ids__default['default']([32, 36, 1]);
|
|
7377
7543
|
|
|
7378
|
-
/**
|
|
7379
|
-
* @typedef { import('./types').Injector } Injector
|
|
7380
|
-
* @typedef { import('./types').Module } Module
|
|
7381
|
-
* @typedef { import('./types').Schema } Schema
|
|
7382
|
-
*
|
|
7383
|
-
* @typedef { import('./types').FormEditorOptions } FormEditorOptions
|
|
7384
|
-
* @typedef { import('./types').FormEditorProperties } FormEditorProperties
|
|
7385
|
-
*
|
|
7386
|
-
* @typedef { {
|
|
7387
|
-
* properties: FormEditorProperties,
|
|
7388
|
-
* schema: Schema
|
|
7389
|
-
* } } State
|
|
7390
|
-
*
|
|
7391
|
-
* @typedef { (type:string, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7392
|
-
* @typedef { (type:string, handler:Function) => void } OnEventWithOutPriority
|
|
7393
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
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
|
|
7394
7560
|
*/
|
|
7395
7561
|
|
|
7396
|
-
/**
|
|
7397
|
-
* The form editor.
|
|
7562
|
+
/**
|
|
7563
|
+
* The form editor.
|
|
7398
7564
|
*/
|
|
7399
7565
|
class FormEditor {
|
|
7400
|
-
/**
|
|
7401
|
-
* @constructor
|
|
7402
|
-
* @param {FormEditorOptions} options
|
|
7566
|
+
/**
|
|
7567
|
+
* @constructor
|
|
7568
|
+
* @param {FormEditorOptions} options
|
|
7403
7569
|
*/
|
|
7404
7570
|
constructor(options = {}) {
|
|
7405
|
-
/**
|
|
7406
|
-
* @public
|
|
7407
|
-
* @type {OnEventType}
|
|
7571
|
+
/**
|
|
7572
|
+
* @public
|
|
7573
|
+
* @type {OnEventType}
|
|
7408
7574
|
*/
|
|
7409
7575
|
this.on = this._onEvent;
|
|
7410
7576
|
|
|
7411
|
-
/**
|
|
7412
|
-
* @public
|
|
7413
|
-
* @type {String}
|
|
7577
|
+
/**
|
|
7578
|
+
* @public
|
|
7579
|
+
* @type {String}
|
|
7414
7580
|
*/
|
|
7415
7581
|
this._id = ids.next();
|
|
7416
7582
|
|
|
7417
|
-
/**
|
|
7418
|
-
* @private
|
|
7419
|
-
* @type {Element}
|
|
7583
|
+
/**
|
|
7584
|
+
* @private
|
|
7585
|
+
* @type {Element}
|
|
7420
7586
|
*/
|
|
7421
7587
|
this._container = formJsViewer.createFormContainer();
|
|
7422
7588
|
this._container.setAttribute('input-handle-modified-keys', 'z,y');
|
|
@@ -7427,15 +7593,15 @@ class FormEditor {
|
|
|
7427
7593
|
properties = {}
|
|
7428
7594
|
} = options;
|
|
7429
7595
|
|
|
7430
|
-
/**
|
|
7431
|
-
* @private
|
|
7432
|
-
* @type {any}
|
|
7596
|
+
/**
|
|
7597
|
+
* @private
|
|
7598
|
+
* @type {any}
|
|
7433
7599
|
*/
|
|
7434
7600
|
this.exporter = exporter;
|
|
7435
7601
|
|
|
7436
|
-
/**
|
|
7437
|
-
* @private
|
|
7438
|
-
* @type {State}
|
|
7602
|
+
/**
|
|
7603
|
+
* @private
|
|
7604
|
+
* @type {State}
|
|
7439
7605
|
*/
|
|
7440
7606
|
this._state = {
|
|
7441
7607
|
properties,
|
|
@@ -7464,10 +7630,10 @@ class FormEditor {
|
|
|
7464
7630
|
this._detach(false);
|
|
7465
7631
|
}
|
|
7466
7632
|
|
|
7467
|
-
/**
|
|
7468
|
-
* @param {Schema} schema
|
|
7469
|
-
*
|
|
7470
|
-
* @return {Promise<{ warnings: Array<any> }>}
|
|
7633
|
+
/**
|
|
7634
|
+
* @param {Schema} schema
|
|
7635
|
+
*
|
|
7636
|
+
* @return {Promise<{ warnings: Array<any> }>}
|
|
7471
7637
|
*/
|
|
7472
7638
|
importSchema(schema) {
|
|
7473
7639
|
return new Promise((resolve, reject) => {
|
|
@@ -7496,15 +7662,15 @@ class FormEditor {
|
|
|
7496
7662
|
});
|
|
7497
7663
|
}
|
|
7498
7664
|
|
|
7499
|
-
/**
|
|
7500
|
-
* @returns {Schema}
|
|
7665
|
+
/**
|
|
7666
|
+
* @returns {Schema}
|
|
7501
7667
|
*/
|
|
7502
7668
|
saveSchema() {
|
|
7503
7669
|
return this.getSchema();
|
|
7504
7670
|
}
|
|
7505
7671
|
|
|
7506
|
-
/**
|
|
7507
|
-
* @returns {Schema}
|
|
7672
|
+
/**
|
|
7673
|
+
* @returns {Schema}
|
|
7508
7674
|
*/
|
|
7509
7675
|
getSchema() {
|
|
7510
7676
|
const {
|
|
@@ -7513,8 +7679,8 @@ class FormEditor {
|
|
|
7513
7679
|
return exportSchema(schema, this.exporter, formJsViewer.schemaVersion);
|
|
7514
7680
|
}
|
|
7515
7681
|
|
|
7516
|
-
/**
|
|
7517
|
-
* @param {Element|string} parentNode
|
|
7682
|
+
/**
|
|
7683
|
+
* @param {Element|string} parentNode
|
|
7518
7684
|
*/
|
|
7519
7685
|
attachTo(parentNode) {
|
|
7520
7686
|
if (!parentNode) {
|
|
@@ -7532,10 +7698,10 @@ class FormEditor {
|
|
|
7532
7698
|
this._detach();
|
|
7533
7699
|
}
|
|
7534
7700
|
|
|
7535
|
-
/**
|
|
7536
|
-
* @internal
|
|
7537
|
-
*
|
|
7538
|
-
* @param {boolean} [emit]
|
|
7701
|
+
/**
|
|
7702
|
+
* @internal
|
|
7703
|
+
*
|
|
7704
|
+
* @param {boolean} [emit]
|
|
7539
7705
|
*/
|
|
7540
7706
|
_detach(emit = true) {
|
|
7541
7707
|
const container = this._container,
|
|
@@ -7549,9 +7715,9 @@ class FormEditor {
|
|
|
7549
7715
|
parentNode.removeChild(container);
|
|
7550
7716
|
}
|
|
7551
7717
|
|
|
7552
|
-
/**
|
|
7553
|
-
* @param {any} property
|
|
7554
|
-
* @param {any} value
|
|
7718
|
+
/**
|
|
7719
|
+
* @param {any} property
|
|
7720
|
+
* @param {any} value
|
|
7555
7721
|
*/
|
|
7556
7722
|
setProperty(property, value) {
|
|
7557
7723
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -7560,21 +7726,21 @@ class FormEditor {
|
|
|
7560
7726
|
});
|
|
7561
7727
|
}
|
|
7562
7728
|
|
|
7563
|
-
/**
|
|
7564
|
-
* @param {string} type
|
|
7565
|
-
* @param {Function} handler
|
|
7729
|
+
/**
|
|
7730
|
+
* @param {string} type
|
|
7731
|
+
* @param {Function} handler
|
|
7566
7732
|
*/
|
|
7567
7733
|
off(type, handler) {
|
|
7568
7734
|
this.get('eventBus').off(type, handler);
|
|
7569
7735
|
}
|
|
7570
7736
|
|
|
7571
|
-
/**
|
|
7572
|
-
* @internal
|
|
7573
|
-
*
|
|
7574
|
-
* @param {FormEditorOptions} options
|
|
7575
|
-
* @param {Element} container
|
|
7576
|
-
*
|
|
7577
|
-
* @returns {Injector}
|
|
7737
|
+
/**
|
|
7738
|
+
* @internal
|
|
7739
|
+
*
|
|
7740
|
+
* @param {FormEditorOptions} options
|
|
7741
|
+
* @param {Element} container
|
|
7742
|
+
*
|
|
7743
|
+
* @returns {Injector}
|
|
7578
7744
|
*/
|
|
7579
7745
|
_createInjector(options, container) {
|
|
7580
7746
|
const {
|
|
@@ -7596,22 +7762,22 @@ class FormEditor {
|
|
|
7596
7762
|
}, core, ...modules, ...additionalModules]);
|
|
7597
7763
|
}
|
|
7598
7764
|
|
|
7599
|
-
/**
|
|
7600
|
-
* @internal
|
|
7765
|
+
/**
|
|
7766
|
+
* @internal
|
|
7601
7767
|
*/
|
|
7602
7768
|
_emit(type, data) {
|
|
7603
7769
|
this.get('eventBus').fire(type, data);
|
|
7604
7770
|
}
|
|
7605
7771
|
|
|
7606
|
-
/**
|
|
7607
|
-
* @internal
|
|
7772
|
+
/**
|
|
7773
|
+
* @internal
|
|
7608
7774
|
*/
|
|
7609
7775
|
_getState() {
|
|
7610
7776
|
return this._state;
|
|
7611
7777
|
}
|
|
7612
7778
|
|
|
7613
|
-
/**
|
|
7614
|
-
* @internal
|
|
7779
|
+
/**
|
|
7780
|
+
* @internal
|
|
7615
7781
|
*/
|
|
7616
7782
|
_setState(state) {
|
|
7617
7783
|
this._state = {
|
|
@@ -7621,15 +7787,15 @@ class FormEditor {
|
|
|
7621
7787
|
this._emit('changed', this._getState());
|
|
7622
7788
|
}
|
|
7623
7789
|
|
|
7624
|
-
/**
|
|
7625
|
-
* @internal
|
|
7790
|
+
/**
|
|
7791
|
+
* @internal
|
|
7626
7792
|
*/
|
|
7627
7793
|
_getModules() {
|
|
7628
7794
|
return [ModelingModule, EditorActionsModule, KeyboardModule, SelectionModule, PaletteModule, PropertiesPanelModule];
|
|
7629
7795
|
}
|
|
7630
7796
|
|
|
7631
|
-
/**
|
|
7632
|
-
* @internal
|
|
7797
|
+
/**
|
|
7798
|
+
* @internal
|
|
7633
7799
|
*/
|
|
7634
7800
|
_onEvent(type, priority, handler) {
|
|
7635
7801
|
this.get('eventBus').on(type, priority, handler);
|