@bpmn-io/form-js-viewer 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +165 -165
- package/dist/assets/form-js.css +618 -611
- package/dist/index.cjs +180 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +180 -183
- package/dist/index.es.js.map +1 -1
- package/dist/types/Form.d.ts +144 -144
- package/dist/types/core/ConditionChecker.d.ts +57 -57
- package/dist/types/core/EventBus.d.ts +1 -1
- package/dist/types/core/FormFieldRegistry.d.ts +17 -17
- package/dist/types/core/Validator.d.ts +7 -7
- package/dist/types/core/index.d.ts +18 -18
- package/dist/types/import/Importer.d.ts +43 -43
- package/dist/types/import/index.d.ts +5 -5
- package/dist/types/index.d.ts +18 -18
- package/dist/types/render/FormFields.d.ts +5 -5
- package/dist/types/render/Renderer.d.ts +23 -23
- package/dist/types/render/components/Description.d.ts +1 -1
- package/dist/types/render/components/Errors.d.ts +1 -1
- package/dist/types/render/components/FormComponent.d.ts +1 -1
- package/dist/types/render/components/FormField.d.ts +1 -1
- package/dist/types/render/components/Label.d.ts +1 -1
- package/dist/types/render/components/PoweredBy.d.ts +1 -1
- package/dist/types/render/components/Sanitizer.d.ts +8 -8
- package/dist/types/render/components/Util.d.ts +17 -17
- package/dist/types/render/components/form-fields/Button.d.ts +11 -11
- package/dist/types/render/components/form-fields/Checkbox.d.ts +13 -13
- package/dist/types/render/components/form-fields/Checklist.d.ts +12 -12
- package/dist/types/render/components/form-fields/Datetime.d.ts +11 -11
- package/dist/types/render/components/form-fields/Default.d.ts +9 -9
- package/dist/types/render/components/form-fields/Image.d.ts +8 -8
- package/dist/types/render/components/form-fields/Number.d.ts +14 -14
- package/dist/types/render/components/form-fields/Radio.d.ts +12 -12
- package/dist/types/render/components/form-fields/Select.d.ts +12 -12
- package/dist/types/render/components/form-fields/Taglist.d.ts +12 -12
- package/dist/types/render/components/form-fields/Text.d.ts +10 -10
- package/dist/types/render/components/form-fields/Textarea.d.ts +13 -13
- package/dist/types/render/components/form-fields/Textfield.d.ts +13 -13
- package/dist/types/render/components/form-fields/parts/Datepicker.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/DropdownList.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/InputAdorner.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/Timepicker.d.ts +1 -1
- package/dist/types/render/components/icons/index.d.ts +16 -16
- package/dist/types/render/components/index.d.ts +17 -17
- package/dist/types/render/components/util/dateTimeUtil.d.ts +12 -12
- package/dist/types/render/components/util/numberFieldUtil.d.ts +4 -4
- package/dist/types/render/components/util/sanitizerUtil.d.ts +3 -3
- package/dist/types/render/context/FormContext.d.ts +12 -12
- package/dist/types/render/context/FormRenderContext.d.ts +6 -6
- package/dist/types/render/context/index.d.ts +2 -2
- package/dist/types/render/hooks/useCondition.d.ts +9 -9
- package/dist/types/render/hooks/useEvaluation.d.ts +6 -6
- package/dist/types/render/hooks/useExpressionValue.d.ts +5 -5
- package/dist/types/render/hooks/useKeyDownAction.d.ts +1 -1
- package/dist/types/render/hooks/useService.d.ts +1 -1
- package/dist/types/render/hooks/useValuesAsync.d.ts +28 -28
- package/dist/types/render/index.d.ts +11 -11
- package/dist/types/src/types.d.ts +35 -35
- package/dist/types/util/constants/DatetimeConstants.d.ts +24 -24
- package/dist/types/util/constants/ValuesSourceConstants.d.ts +15 -15
- package/dist/types/util/constants/index.d.ts +2 -2
- package/dist/types/util/feel.d.ts +15 -15
- package/dist/types/util/form.d.ts +6 -6
- package/dist/types/util/index.d.ts +25 -25
- package/dist/types/util/injector.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -12,9 +12,9 @@ import flatpickr from 'flatpickr';
|
|
|
12
12
|
import Markup from 'preact-markup';
|
|
13
13
|
import { Injector } from 'didi';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {object} Condition
|
|
17
|
-
* @property {string} [hide]
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} Condition
|
|
17
|
+
* @property {string} [hide]
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
class ConditionChecker {
|
|
@@ -23,11 +23,11 @@ class ConditionChecker {
|
|
|
23
23
|
this._eventBus = eventBus;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* For given data, remove properties based on condition.
|
|
28
|
-
*
|
|
29
|
-
* @param {Object<string, any>} properties
|
|
30
|
-
* @param {Object<string, any>} data
|
|
26
|
+
/**
|
|
27
|
+
* For given data, remove properties based on condition.
|
|
28
|
+
*
|
|
29
|
+
* @param {Object<string, any>} properties
|
|
30
|
+
* @param {Object<string, any>} data
|
|
31
31
|
*/
|
|
32
32
|
applyConditions(properties, data = {}) {
|
|
33
33
|
const conditions = this._getConditions();
|
|
@@ -46,13 +46,13 @@ class ConditionChecker {
|
|
|
46
46
|
return newProperties;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} condition
|
|
53
|
-
* @param {import('../types').Data} [data]
|
|
54
|
-
*
|
|
55
|
-
* @returns {boolean|null}
|
|
49
|
+
/**
|
|
50
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} condition
|
|
53
|
+
* @param {import('../types').Data} [data]
|
|
54
|
+
*
|
|
55
|
+
* @returns {boolean|null}
|
|
56
56
|
*/
|
|
57
57
|
check(condition, data = {}) {
|
|
58
58
|
if (!condition) {
|
|
@@ -73,12 +73,12 @@ class ConditionChecker {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* Check if hide condition is met.
|
|
78
|
-
*
|
|
79
|
-
* @param {Condition} condition
|
|
80
|
-
* @param {Object<string, any>} data
|
|
81
|
-
* @returns {boolean}
|
|
76
|
+
/**
|
|
77
|
+
* Check if hide condition is met.
|
|
78
|
+
*
|
|
79
|
+
* @param {Condition} condition
|
|
80
|
+
* @param {Object<string, any>} data
|
|
81
|
+
* @returns {boolean}
|
|
82
82
|
*/
|
|
83
83
|
_checkHideCondition(condition, data) {
|
|
84
84
|
if (!condition.hide) {
|
|
@@ -88,13 +88,13 @@ class ConditionChecker {
|
|
|
88
88
|
return result === true;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
* Evaluate an expression.
|
|
93
|
-
*
|
|
94
|
-
* @param {string} expression
|
|
95
|
-
* @param {import('../types').Data} [data]
|
|
96
|
-
*
|
|
97
|
-
* @returns {any}
|
|
91
|
+
/**
|
|
92
|
+
* Evaluate an expression.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} expression
|
|
95
|
+
* @param {import('../types').Data} [data]
|
|
96
|
+
*
|
|
97
|
+
* @returns {any}
|
|
98
98
|
*/
|
|
99
99
|
evaluate(expression, data = {}) {
|
|
100
100
|
if (!expression) {
|
|
@@ -602,7 +602,7 @@ class Validator {
|
|
|
602
602
|
if (type === 'number') {
|
|
603
603
|
const {
|
|
604
604
|
decimalDigits,
|
|
605
|
-
|
|
605
|
+
increment
|
|
606
606
|
} = field;
|
|
607
607
|
if (value === 'NaN') {
|
|
608
608
|
errors = [...errors, 'Value is not a number.'];
|
|
@@ -610,13 +610,13 @@ class Validator {
|
|
|
610
610
|
if (decimalDigits >= 0 && countDecimals(value) > decimalDigits) {
|
|
611
611
|
errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
|
|
612
612
|
}
|
|
613
|
-
if (
|
|
613
|
+
if (increment) {
|
|
614
614
|
const bigValue = Big(value);
|
|
615
|
-
const
|
|
616
|
-
const offset = bigValue.mod(
|
|
615
|
+
const bigIncrement = Big(increment);
|
|
616
|
+
const offset = bigValue.mod(bigIncrement);
|
|
617
617
|
if (offset.cmp(0) !== 0) {
|
|
618
618
|
const previousValue = bigValue.minus(offset);
|
|
619
|
-
const nextValue = previousValue.plus(
|
|
619
|
+
const nextValue = previousValue.plus(bigIncrement);
|
|
620
620
|
errors = [...errors, `Please select a valid value, the two nearest valid values are ${previousValue} and ${nextValue}.`];
|
|
621
621
|
}
|
|
622
622
|
}
|
|
@@ -631,10 +631,10 @@ class Validator {
|
|
|
631
631
|
if (validate.required && (isNil(value) || value === '')) {
|
|
632
632
|
errors = [...errors, 'Field is required.'];
|
|
633
633
|
}
|
|
634
|
-
if ('min' in validate && value && value < validate.min) {
|
|
634
|
+
if ('min' in validate && (value || value === 0) && value < validate.min) {
|
|
635
635
|
errors = [...errors, `Field must have minimum value of ${validate.min}.`];
|
|
636
636
|
}
|
|
637
|
-
if ('max' in validate && value && value > validate.max) {
|
|
637
|
+
if ('max' in validate && (value || value === 0) && value > validate.max) {
|
|
638
638
|
errors = [...errors, `Field must have maximum value of ${validate.max}.`];
|
|
639
639
|
}
|
|
640
640
|
if ('minLength' in validate && value && value.trim().length < validate.minLength) {
|
|
@@ -703,11 +703,11 @@ class FormFieldRegistry {
|
|
|
703
703
|
}
|
|
704
704
|
FormFieldRegistry.$inject = ['eventBus'];
|
|
705
705
|
|
|
706
|
-
/**
|
|
707
|
-
* Retrieve variable names from given FEEL unary test.
|
|
708
|
-
*
|
|
709
|
-
* @param {string} unaryTest
|
|
710
|
-
* @returns {string[]}
|
|
706
|
+
/**
|
|
707
|
+
* Retrieve variable names from given FEEL unary test.
|
|
708
|
+
*
|
|
709
|
+
* @param {string} unaryTest
|
|
710
|
+
* @returns {string[]}
|
|
711
711
|
*/
|
|
712
712
|
function getVariableNames(unaryTest) {
|
|
713
713
|
const tree = parseUnaryTests(unaryTest);
|
|
@@ -722,11 +722,11 @@ function getVariableNames(unaryTest) {
|
|
|
722
722
|
return Array.from(variables);
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
-
/**
|
|
726
|
-
* Retrieve variable names from given FEEL expression.
|
|
727
|
-
*
|
|
728
|
-
* @param {string} expression
|
|
729
|
-
* @returns {string[]}
|
|
725
|
+
/**
|
|
726
|
+
* Retrieve variable names from given FEEL expression.
|
|
727
|
+
*
|
|
728
|
+
* @param {string} expression
|
|
729
|
+
* @returns {string[]}
|
|
730
730
|
*/
|
|
731
731
|
function getExpressionVariableNames(expression) {
|
|
732
732
|
const tree = parseExpressions(expression);
|
|
@@ -812,10 +812,10 @@ function createInjector(bootstrapModules) {
|
|
|
812
812
|
return injector;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
/**
|
|
816
|
-
* @param {string?} prefix
|
|
817
|
-
*
|
|
818
|
-
* @returns Element
|
|
815
|
+
/**
|
|
816
|
+
* @param {string?} prefix
|
|
817
|
+
*
|
|
818
|
+
* @returns Element
|
|
819
819
|
*/
|
|
820
820
|
function createFormContainer(prefix = 'fjs') {
|
|
821
821
|
const container = document.createElement('div');
|
|
@@ -860,22 +860,22 @@ function generateIdForType(type) {
|
|
|
860
860
|
return `${type}${generateIndexForType(type)}`;
|
|
861
861
|
}
|
|
862
862
|
|
|
863
|
-
/**
|
|
864
|
-
* @template T
|
|
865
|
-
* @param {T} data
|
|
866
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
867
|
-
* @return {T}
|
|
863
|
+
/**
|
|
864
|
+
* @template T
|
|
865
|
+
* @param {T} data
|
|
866
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
867
|
+
* @return {T}
|
|
868
868
|
*/
|
|
869
869
|
function clone(data, replacer) {
|
|
870
870
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
/**
|
|
874
|
-
* Parse the schema for input variables a form might make use of
|
|
875
|
-
*
|
|
876
|
-
* @param {any} schema
|
|
877
|
-
*
|
|
878
|
-
* @return {string[]}
|
|
873
|
+
/**
|
|
874
|
+
* Parse the schema for input variables a form might make use of
|
|
875
|
+
*
|
|
876
|
+
* @param {any} schema
|
|
877
|
+
*
|
|
878
|
+
* @return {string[]}
|
|
879
879
|
*/
|
|
880
880
|
function getSchemaVariables(schema) {
|
|
881
881
|
if (!schema.components) {
|
|
@@ -924,25 +924,25 @@ function isExpression$1(value) {
|
|
|
924
924
|
}
|
|
925
925
|
|
|
926
926
|
class Importer {
|
|
927
|
-
/**
|
|
928
|
-
* @constructor
|
|
929
|
-
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
930
|
-
* @param { import('../render/FormFields').default } formFields
|
|
927
|
+
/**
|
|
928
|
+
* @constructor
|
|
929
|
+
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
930
|
+
* @param { import('../render/FormFields').default } formFields
|
|
931
931
|
*/
|
|
932
932
|
constructor(formFieldRegistry, formFields) {
|
|
933
933
|
this._formFieldRegistry = formFieldRegistry;
|
|
934
934
|
this._formFields = formFields;
|
|
935
935
|
}
|
|
936
936
|
|
|
937
|
-
/**
|
|
938
|
-
* Import schema adding `id`, `_parent` and `_path`
|
|
939
|
-
* information to each field and adding it to the
|
|
940
|
-
* form field registry.
|
|
941
|
-
*
|
|
942
|
-
* @param {any} schema
|
|
943
|
-
* @param {any} [data]
|
|
944
|
-
*
|
|
945
|
-
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
937
|
+
/**
|
|
938
|
+
* Import schema adding `id`, `_parent` and `_path`
|
|
939
|
+
* information to each field and adding it to the
|
|
940
|
+
* form field registry.
|
|
941
|
+
*
|
|
942
|
+
* @param {any} schema
|
|
943
|
+
* @param {any} [data]
|
|
944
|
+
*
|
|
945
|
+
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
946
946
|
*/
|
|
947
947
|
importSchema(schema, data = {}) {
|
|
948
948
|
// TODO: Add warnings - https://github.com/bpmn-io/form-js/issues/289
|
|
@@ -961,11 +961,11 @@ class Importer {
|
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
/**
|
|
965
|
-
* @param {any} formField
|
|
966
|
-
* @param {string} [parentId]
|
|
967
|
-
*
|
|
968
|
-
* @return {any} importedField
|
|
964
|
+
/**
|
|
965
|
+
* @param {any} formField
|
|
966
|
+
* @param {string} [parentId]
|
|
967
|
+
*
|
|
968
|
+
* @return {any} importedField
|
|
969
969
|
*/
|
|
970
970
|
importFormField(formField, parentId) {
|
|
971
971
|
const {
|
|
@@ -1016,10 +1016,10 @@ class Importer {
|
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
/**
|
|
1020
|
-
* @param {Object} data
|
|
1021
|
-
*
|
|
1022
|
-
* @return {Object} initializedData
|
|
1019
|
+
/**
|
|
1020
|
+
* @param {Object} data
|
|
1021
|
+
*
|
|
1022
|
+
* @return {Object} initializedData
|
|
1023
1023
|
*/
|
|
1024
1024
|
initializeFieldValues(data) {
|
|
1025
1025
|
return this._formFieldRegistry.getAll().reduce((initializedData, formField) => {
|
|
@@ -1069,11 +1069,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
1069
1069
|
|
|
1070
1070
|
const FORM_ELEMENT = document.createElement('form');
|
|
1071
1071
|
|
|
1072
|
-
/**
|
|
1073
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1074
|
-
*
|
|
1075
|
-
* @param {string} html
|
|
1076
|
-
* @return {string}
|
|
1072
|
+
/**
|
|
1073
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {string} html
|
|
1076
|
+
* @return {string}
|
|
1077
1077
|
*/
|
|
1078
1078
|
function sanitizeHTML(html) {
|
|
1079
1079
|
const doc = new DOMParser().parseFromString(`<!DOCTYPE html>\n<html><body><div>${html}`, 'text/html');
|
|
@@ -1093,15 +1093,15 @@ function sanitizeImageSource(src) {
|
|
|
1093
1093
|
return valid ? src : '';
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
|
-
/**
|
|
1097
|
-
* Recursively sanitize a HTML node, potentially
|
|
1098
|
-
* removing it, its children or attributes.
|
|
1099
|
-
*
|
|
1100
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1101
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1102
|
-
* for our use-case.
|
|
1103
|
-
*
|
|
1104
|
-
* @param {Element} node
|
|
1096
|
+
/**
|
|
1097
|
+
* Recursively sanitize a HTML node, potentially
|
|
1098
|
+
* removing it, its children or attributes.
|
|
1099
|
+
*
|
|
1100
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1101
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1102
|
+
* for our use-case.
|
|
1103
|
+
*
|
|
1104
|
+
* @param {Element} node
|
|
1105
1105
|
*/
|
|
1106
1106
|
function sanitizeNode(node) {
|
|
1107
1107
|
// allow text nodes
|
|
@@ -1145,13 +1145,13 @@ function sanitizeNode(node) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
|
-
/**
|
|
1149
|
-
* Validates attributes for validity.
|
|
1150
|
-
*
|
|
1151
|
-
* @param {string} lcTag
|
|
1152
|
-
* @param {string} lcName
|
|
1153
|
-
* @param {string} value
|
|
1154
|
-
* @return {boolean}
|
|
1148
|
+
/**
|
|
1149
|
+
* Validates attributes for validity.
|
|
1150
|
+
*
|
|
1151
|
+
* @param {string} lcTag
|
|
1152
|
+
* @param {string} lcName
|
|
1153
|
+
* @param {string} value
|
|
1154
|
+
* @return {boolean}
|
|
1155
1155
|
*/
|
|
1156
1156
|
function isValidAttribute(lcTag, lcName, value) {
|
|
1157
1157
|
// disallow most attributes based on whitelist
|
|
@@ -1203,14 +1203,14 @@ function safeMarkdown(markdown) {
|
|
|
1203
1203
|
return sanitizeHTML(html);
|
|
1204
1204
|
}
|
|
1205
1205
|
|
|
1206
|
-
/**
|
|
1207
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1208
|
-
* that start with http(s).
|
|
1209
|
-
*
|
|
1210
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1211
|
-
*
|
|
1212
|
-
* @param {string} src
|
|
1213
|
-
* @returns {string}
|
|
1206
|
+
/**
|
|
1207
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1208
|
+
* that start with http(s).
|
|
1209
|
+
*
|
|
1210
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1211
|
+
*
|
|
1212
|
+
* @param {string} src
|
|
1213
|
+
* @returns {string}
|
|
1214
1214
|
*/
|
|
1215
1215
|
function safeImageSource(src) {
|
|
1216
1216
|
return sanitizeImageSource(src);
|
|
@@ -1257,11 +1257,11 @@ const FormRenderContext = createContext({
|
|
|
1257
1257
|
}
|
|
1258
1258
|
});
|
|
1259
1259
|
|
|
1260
|
-
/**
|
|
1261
|
-
* @param {string} type
|
|
1262
|
-
* @param {boolean} [strict]
|
|
1263
|
-
*
|
|
1264
|
-
* @returns {any}
|
|
1260
|
+
/**
|
|
1261
|
+
* @param {string} type
|
|
1262
|
+
* @param {boolean} [strict]
|
|
1263
|
+
*
|
|
1264
|
+
* @returns {any}
|
|
1265
1265
|
*/
|
|
1266
1266
|
function getService(type, strict) {}
|
|
1267
1267
|
const FormContext = createContext({
|
|
@@ -1390,8 +1390,8 @@ function useService (type, strict) {
|
|
|
1390
1390
|
return getService(type, strict);
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
|
-
/**
|
|
1394
|
-
* @enum { String }
|
|
1393
|
+
/**
|
|
1394
|
+
* @enum { String }
|
|
1395
1395
|
*/
|
|
1396
1396
|
const LOAD_STATES = {
|
|
1397
1397
|
LOADING: 'loading',
|
|
@@ -1399,17 +1399,17 @@ const LOAD_STATES = {
|
|
|
1399
1399
|
ERROR: 'error'
|
|
1400
1400
|
};
|
|
1401
1401
|
|
|
1402
|
-
/**
|
|
1403
|
-
* @typedef {Object} ValuesGetter
|
|
1404
|
-
* @property {Object[]} values - The values data
|
|
1405
|
-
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1402
|
+
/**
|
|
1403
|
+
* @typedef {Object} ValuesGetter
|
|
1404
|
+
* @property {Object[]} values - The values data
|
|
1405
|
+
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1406
1406
|
*/
|
|
1407
1407
|
|
|
1408
|
-
/**
|
|
1409
|
-
* A hook to load values for single and multiselect components.
|
|
1410
|
-
*
|
|
1411
|
-
* @param {Object} field - The form field to handle values for
|
|
1412
|
-
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1408
|
+
/**
|
|
1409
|
+
* A hook to load values for single and multiselect components.
|
|
1410
|
+
*
|
|
1411
|
+
* @param {Object} field - The form field to handle values for
|
|
1412
|
+
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1413
1413
|
*/
|
|
1414
1414
|
function useValuesAsync (field) {
|
|
1415
1415
|
const {
|
|
@@ -1744,13 +1744,13 @@ Checklist.keyed = true;
|
|
|
1744
1744
|
Checklist.emptyValue = [];
|
|
1745
1745
|
Checklist.sanitizeValue = sanitizeMultiSelectValue;
|
|
1746
1746
|
|
|
1747
|
-
/**
|
|
1748
|
-
* Check if condition is met with given variables.
|
|
1749
|
-
*
|
|
1750
|
-
* @param {string | undefined} condition
|
|
1751
|
-
* @param {import('../../types').Data} data
|
|
1752
|
-
*
|
|
1753
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1747
|
+
/**
|
|
1748
|
+
* Check if condition is met with given variables.
|
|
1749
|
+
*
|
|
1750
|
+
* @param {string | undefined} condition
|
|
1751
|
+
* @param {import('../../types').Data} data
|
|
1752
|
+
*
|
|
1753
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1754
1754
|
*/
|
|
1755
1755
|
function useCondition(condition, data) {
|
|
1756
1756
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -1860,7 +1860,7 @@ var CalendarIcon = (({
|
|
|
1860
1860
|
fillRule: "evenodd",
|
|
1861
1861
|
clipRule: "evenodd",
|
|
1862
1862
|
d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z",
|
|
1863
|
-
fill: "
|
|
1863
|
+
fill: "currentColor"
|
|
1864
1864
|
})));
|
|
1865
1865
|
|
|
1866
1866
|
function InputAdorner(props) {
|
|
@@ -1925,10 +1925,6 @@ function Datepicker(props) {
|
|
|
1925
1925
|
|
|
1926
1926
|
// setup flatpickr instance
|
|
1927
1927
|
useEffect(() => {
|
|
1928
|
-
if (disabled) {
|
|
1929
|
-
setFlatpickrInstance(null);
|
|
1930
|
-
return;
|
|
1931
|
-
}
|
|
1932
1928
|
let config = {
|
|
1933
1929
|
allowInput: true,
|
|
1934
1930
|
dateFormat: 'm/d/Y',
|
|
@@ -1961,7 +1957,7 @@ function Datepicker(props) {
|
|
|
1961
1957
|
// flatpicker logic that was lost when setting allowInput to true
|
|
1962
1958
|
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
1963
1959
|
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
1964
|
-
}, [
|
|
1960
|
+
}, [disallowPassedDates]);
|
|
1965
1961
|
|
|
1966
1962
|
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
1967
1963
|
useEffect(() => {
|
|
@@ -2050,12 +2046,12 @@ var ClockIcon = (({
|
|
|
2050
2046
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2051
2047
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2052
2048
|
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
|
|
2053
|
-
fill: "
|
|
2049
|
+
fill: "currentColor"
|
|
2054
2050
|
}), /*#__PURE__*/React.createElement("path", {
|
|
2055
2051
|
fillRule: "evenodd",
|
|
2056
2052
|
clipRule: "evenodd",
|
|
2057
2053
|
d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z",
|
|
2058
|
-
fill: "
|
|
2054
|
+
fill: "currentColor"
|
|
2059
2055
|
})));
|
|
2060
2056
|
|
|
2061
2057
|
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
@@ -2147,6 +2143,7 @@ function DropdownList(props) {
|
|
|
2147
2143
|
ref: dropdownContainer,
|
|
2148
2144
|
tabIndex: -1,
|
|
2149
2145
|
class: "fjs-dropdownlist",
|
|
2146
|
+
onMouseDown: e => e.preventDefault(),
|
|
2150
2147
|
style: {
|
|
2151
2148
|
maxHeight: height,
|
|
2152
2149
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
@@ -2158,10 +2155,7 @@ function DropdownList(props) {
|
|
|
2158
2155
|
}),
|
|
2159
2156
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2160
2157
|
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2161
|
-
onMouseDown: e =>
|
|
2162
|
-
e.preventDefault();
|
|
2163
|
-
onValueSelected(v);
|
|
2164
|
-
},
|
|
2158
|
+
onMouseDown: e => onValueSelected(v),
|
|
2165
2159
|
children: getLabel(v)
|
|
2166
2160
|
});
|
|
2167
2161
|
}), !values.length && jsx("div", {
|
|
@@ -2361,31 +2355,29 @@ function Datetime(props) {
|
|
|
2361
2355
|
date,
|
|
2362
2356
|
time
|
|
2363
2357
|
} = getNullDateTime();
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2358
|
+
switch (subtype) {
|
|
2359
|
+
case DATETIME_SUBTYPES.DATE:
|
|
2360
|
+
{
|
|
2361
|
+
date = new Date(Date.parse(value));
|
|
2362
|
+
break;
|
|
2363
|
+
}
|
|
2364
|
+
case DATETIME_SUBTYPES.TIME:
|
|
2365
|
+
{
|
|
2366
|
+
time = parseIsoTime(value);
|
|
2367
|
+
break;
|
|
2368
|
+
}
|
|
2369
|
+
case DATETIME_SUBTYPES.DATETIME:
|
|
2370
|
+
{
|
|
2371
|
+
date = new Date(Date.parse(value));
|
|
2372
|
+
time = isValidDate(date) ? 60 * date.getHours() + date.getMinutes() : null;
|
|
2373
|
+
break;
|
|
2374
|
+
}
|
|
2383
2375
|
}
|
|
2384
2376
|
setDateTime({
|
|
2385
2377
|
date,
|
|
2386
2378
|
time
|
|
2387
2379
|
});
|
|
2388
|
-
}, [subtype, value
|
|
2380
|
+
}, [subtype, value]);
|
|
2389
2381
|
const computeAndSetState = useCallback(({
|
|
2390
2382
|
date,
|
|
2391
2383
|
time
|
|
@@ -2502,10 +2494,10 @@ Datetime.keyed = true;
|
|
|
2502
2494
|
Datetime.emptyValue = null;
|
|
2503
2495
|
Datetime.sanitizeValue = sanitizeDateTimePickerValue;
|
|
2504
2496
|
|
|
2505
|
-
/**
|
|
2506
|
-
* This file must not be changed or exchanged.
|
|
2507
|
-
*
|
|
2508
|
-
* @see http://bpmn.io/license for more information.
|
|
2497
|
+
/**
|
|
2498
|
+
* This file must not be changed or exchanged.
|
|
2499
|
+
*
|
|
2500
|
+
* @see http://bpmn.io/license for more information.
|
|
2509
2501
|
*/
|
|
2510
2502
|
function Logo() {
|
|
2511
2503
|
return jsxs("svg", {
|
|
@@ -2622,10 +2614,10 @@ function FormComponent(props) {
|
|
|
2622
2614
|
});
|
|
2623
2615
|
}
|
|
2624
2616
|
|
|
2625
|
-
/**
|
|
2626
|
-
*
|
|
2627
|
-
* @param {string | undefined} expression
|
|
2628
|
-
* @param {import('../../types').Data} data
|
|
2617
|
+
/**
|
|
2618
|
+
*
|
|
2619
|
+
* @param {string | undefined} expression
|
|
2620
|
+
* @param {import('../../types').Data} data
|
|
2629
2621
|
*/
|
|
2630
2622
|
function useEvaluation(expression, data) {
|
|
2631
2623
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -2642,9 +2634,9 @@ function useEvaluation(expression, data) {
|
|
|
2642
2634
|
return conditionChecker.evaluate(expression, filteredData);
|
|
2643
2635
|
}
|
|
2644
2636
|
|
|
2645
|
-
/**
|
|
2646
|
-
*
|
|
2647
|
-
* @param {string} value
|
|
2637
|
+
/**
|
|
2638
|
+
*
|
|
2639
|
+
* @param {string} value
|
|
2648
2640
|
*/
|
|
2649
2641
|
function useExpressionValue(value) {
|
|
2650
2642
|
const formData = useService('form')._getState().data;
|
|
@@ -2775,6 +2767,7 @@ function Numberfield(props) {
|
|
|
2775
2767
|
}), [stringValueCache, value, field]);
|
|
2776
2768
|
const displayValue = useMemo(() => {
|
|
2777
2769
|
if (value === 'NaN') return 'NaN';
|
|
2770
|
+
if (stringValueCache === '-') return '-';
|
|
2778
2771
|
return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big(value).toFixed() : '';
|
|
2779
2772
|
}, [stringValueCache, value, cacheValueMatchesState]);
|
|
2780
2773
|
const arrowIncrementValue = useMemo(() => {
|
|
@@ -2794,6 +2787,10 @@ function Numberfield(props) {
|
|
|
2794
2787
|
|
|
2795
2788
|
// treat commas as dots
|
|
2796
2789
|
stringValue = stringValue.replaceAll(',', '.');
|
|
2790
|
+
if (stringValue === '-') {
|
|
2791
|
+
setStringValueCache('-');
|
|
2792
|
+
return;
|
|
2793
|
+
}
|
|
2797
2794
|
if (isNaN(Number(stringValue))) {
|
|
2798
2795
|
setStringValueCache('NaN');
|
|
2799
2796
|
onChange({
|
|
@@ -3324,18 +3321,18 @@ var ChecklistIcon = (({
|
|
|
3324
3321
|
styles = {},
|
|
3325
3322
|
...props
|
|
3326
3323
|
}) => /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3324
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3327
3325
|
width: "54",
|
|
3328
3326
|
height: "54",
|
|
3329
|
-
fill: "none"
|
|
3330
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
3327
|
+
fill: "none"
|
|
3331
3328
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3332
3329
|
fillRule: "evenodd",
|
|
3333
3330
|
clipRule: "evenodd",
|
|
3334
|
-
d: "
|
|
3335
|
-
fill: "#
|
|
3331
|
+
d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
|
|
3332
|
+
fill: "#161616"
|
|
3336
3333
|
}), /*#__PURE__*/React.createElement("path", {
|
|
3337
|
-
d: "
|
|
3338
|
-
fill: "#
|
|
3334
|
+
d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
|
|
3335
|
+
fill: "#161616"
|
|
3339
3336
|
})));
|
|
3340
3337
|
|
|
3341
3338
|
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); }
|