@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.cjs
CHANGED
|
@@ -26,9 +26,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
26
26
|
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
27
27
|
var Markup__default = /*#__PURE__*/_interopDefaultLegacy(Markup);
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {object} Condition
|
|
31
|
-
* @property {string} [hide]
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {object} Condition
|
|
31
|
+
* @property {string} [hide]
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
class ConditionChecker {
|
|
@@ -37,11 +37,11 @@ class ConditionChecker {
|
|
|
37
37
|
this._eventBus = eventBus;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* For given data, remove properties based on condition.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object<string, any>} properties
|
|
44
|
-
* @param {Object<string, any>} data
|
|
40
|
+
/**
|
|
41
|
+
* For given data, remove properties based on condition.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object<string, any>} properties
|
|
44
|
+
* @param {Object<string, any>} data
|
|
45
45
|
*/
|
|
46
46
|
applyConditions(properties, data = {}) {
|
|
47
47
|
const conditions = this._getConditions();
|
|
@@ -60,13 +60,13 @@ class ConditionChecker {
|
|
|
60
60
|
return newProperties;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
65
|
-
*
|
|
66
|
-
* @param {string} condition
|
|
67
|
-
* @param {import('../types').Data} [data]
|
|
68
|
-
*
|
|
69
|
-
* @returns {boolean|null}
|
|
63
|
+
/**
|
|
64
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} condition
|
|
67
|
+
* @param {import('../types').Data} [data]
|
|
68
|
+
*
|
|
69
|
+
* @returns {boolean|null}
|
|
70
70
|
*/
|
|
71
71
|
check(condition, data = {}) {
|
|
72
72
|
if (!condition) {
|
|
@@ -87,12 +87,12 @@ class ConditionChecker {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* Check if hide condition is met.
|
|
92
|
-
*
|
|
93
|
-
* @param {Condition} condition
|
|
94
|
-
* @param {Object<string, any>} data
|
|
95
|
-
* @returns {boolean}
|
|
90
|
+
/**
|
|
91
|
+
* Check if hide condition is met.
|
|
92
|
+
*
|
|
93
|
+
* @param {Condition} condition
|
|
94
|
+
* @param {Object<string, any>} data
|
|
95
|
+
* @returns {boolean}
|
|
96
96
|
*/
|
|
97
97
|
_checkHideCondition(condition, data) {
|
|
98
98
|
if (!condition.hide) {
|
|
@@ -102,13 +102,13 @@ class ConditionChecker {
|
|
|
102
102
|
return result === true;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* Evaluate an expression.
|
|
107
|
-
*
|
|
108
|
-
* @param {string} expression
|
|
109
|
-
* @param {import('../types').Data} [data]
|
|
110
|
-
*
|
|
111
|
-
* @returns {any}
|
|
105
|
+
/**
|
|
106
|
+
* Evaluate an expression.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} expression
|
|
109
|
+
* @param {import('../types').Data} [data]
|
|
110
|
+
*
|
|
111
|
+
* @returns {any}
|
|
112
112
|
*/
|
|
113
113
|
evaluate(expression, data = {}) {
|
|
114
114
|
if (!expression) {
|
|
@@ -616,7 +616,7 @@ class Validator {
|
|
|
616
616
|
if (type === 'number') {
|
|
617
617
|
const {
|
|
618
618
|
decimalDigits,
|
|
619
|
-
|
|
619
|
+
increment
|
|
620
620
|
} = field;
|
|
621
621
|
if (value === 'NaN') {
|
|
622
622
|
errors = [...errors, 'Value is not a number.'];
|
|
@@ -624,13 +624,13 @@ class Validator {
|
|
|
624
624
|
if (decimalDigits >= 0 && countDecimals(value) > decimalDigits) {
|
|
625
625
|
errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
|
|
626
626
|
}
|
|
627
|
-
if (
|
|
627
|
+
if (increment) {
|
|
628
628
|
const bigValue = Big__default['default'](value);
|
|
629
|
-
const
|
|
630
|
-
const offset = bigValue.mod(
|
|
629
|
+
const bigIncrement = Big__default['default'](increment);
|
|
630
|
+
const offset = bigValue.mod(bigIncrement);
|
|
631
631
|
if (offset.cmp(0) !== 0) {
|
|
632
632
|
const previousValue = bigValue.minus(offset);
|
|
633
|
-
const nextValue = previousValue.plus(
|
|
633
|
+
const nextValue = previousValue.plus(bigIncrement);
|
|
634
634
|
errors = [...errors, `Please select a valid value, the two nearest valid values are ${previousValue} and ${nextValue}.`];
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -645,10 +645,10 @@ class Validator {
|
|
|
645
645
|
if (validate.required && (minDash.isNil(value) || value === '')) {
|
|
646
646
|
errors = [...errors, 'Field is required.'];
|
|
647
647
|
}
|
|
648
|
-
if ('min' in validate && value && value < validate.min) {
|
|
648
|
+
if ('min' in validate && (value || value === 0) && value < validate.min) {
|
|
649
649
|
errors = [...errors, `Field must have minimum value of ${validate.min}.`];
|
|
650
650
|
}
|
|
651
|
-
if ('max' in validate && value && value > validate.max) {
|
|
651
|
+
if ('max' in validate && (value || value === 0) && value > validate.max) {
|
|
652
652
|
errors = [...errors, `Field must have maximum value of ${validate.max}.`];
|
|
653
653
|
}
|
|
654
654
|
if ('minLength' in validate && value && value.trim().length < validate.minLength) {
|
|
@@ -717,11 +717,11 @@ class FormFieldRegistry {
|
|
|
717
717
|
}
|
|
718
718
|
FormFieldRegistry.$inject = ['eventBus'];
|
|
719
719
|
|
|
720
|
-
/**
|
|
721
|
-
* Retrieve variable names from given FEEL unary test.
|
|
722
|
-
*
|
|
723
|
-
* @param {string} unaryTest
|
|
724
|
-
* @returns {string[]}
|
|
720
|
+
/**
|
|
721
|
+
* Retrieve variable names from given FEEL unary test.
|
|
722
|
+
*
|
|
723
|
+
* @param {string} unaryTest
|
|
724
|
+
* @returns {string[]}
|
|
725
725
|
*/
|
|
726
726
|
function getVariableNames(unaryTest) {
|
|
727
727
|
const tree = feelin.parseUnaryTests(unaryTest);
|
|
@@ -736,11 +736,11 @@ function getVariableNames(unaryTest) {
|
|
|
736
736
|
return Array.from(variables);
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
/**
|
|
740
|
-
* Retrieve variable names from given FEEL expression.
|
|
741
|
-
*
|
|
742
|
-
* @param {string} expression
|
|
743
|
-
* @returns {string[]}
|
|
739
|
+
/**
|
|
740
|
+
* Retrieve variable names from given FEEL expression.
|
|
741
|
+
*
|
|
742
|
+
* @param {string} expression
|
|
743
|
+
* @returns {string[]}
|
|
744
744
|
*/
|
|
745
745
|
function getExpressionVariableNames(expression) {
|
|
746
746
|
const tree = feelin.parseExpressions(expression);
|
|
@@ -826,10 +826,10 @@ function createInjector(bootstrapModules) {
|
|
|
826
826
|
return injector;
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
/**
|
|
830
|
-
* @param {string?} prefix
|
|
831
|
-
*
|
|
832
|
-
* @returns Element
|
|
829
|
+
/**
|
|
830
|
+
* @param {string?} prefix
|
|
831
|
+
*
|
|
832
|
+
* @returns Element
|
|
833
833
|
*/
|
|
834
834
|
function createFormContainer(prefix = 'fjs') {
|
|
835
835
|
const container = document.createElement('div');
|
|
@@ -874,22 +874,22 @@ function generateIdForType(type) {
|
|
|
874
874
|
return `${type}${generateIndexForType(type)}`;
|
|
875
875
|
}
|
|
876
876
|
|
|
877
|
-
/**
|
|
878
|
-
* @template T
|
|
879
|
-
* @param {T} data
|
|
880
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
881
|
-
* @return {T}
|
|
877
|
+
/**
|
|
878
|
+
* @template T
|
|
879
|
+
* @param {T} data
|
|
880
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
881
|
+
* @return {T}
|
|
882
882
|
*/
|
|
883
883
|
function clone(data, replacer) {
|
|
884
884
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
885
885
|
}
|
|
886
886
|
|
|
887
|
-
/**
|
|
888
|
-
* Parse the schema for input variables a form might make use of
|
|
889
|
-
*
|
|
890
|
-
* @param {any} schema
|
|
891
|
-
*
|
|
892
|
-
* @return {string[]}
|
|
887
|
+
/**
|
|
888
|
+
* Parse the schema for input variables a form might make use of
|
|
889
|
+
*
|
|
890
|
+
* @param {any} schema
|
|
891
|
+
*
|
|
892
|
+
* @return {string[]}
|
|
893
893
|
*/
|
|
894
894
|
function getSchemaVariables(schema) {
|
|
895
895
|
if (!schema.components) {
|
|
@@ -938,25 +938,25 @@ function isExpression$1(value) {
|
|
|
938
938
|
}
|
|
939
939
|
|
|
940
940
|
class Importer {
|
|
941
|
-
/**
|
|
942
|
-
* @constructor
|
|
943
|
-
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
944
|
-
* @param { import('../render/FormFields').default } formFields
|
|
941
|
+
/**
|
|
942
|
+
* @constructor
|
|
943
|
+
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
944
|
+
* @param { import('../render/FormFields').default } formFields
|
|
945
945
|
*/
|
|
946
946
|
constructor(formFieldRegistry, formFields) {
|
|
947
947
|
this._formFieldRegistry = formFieldRegistry;
|
|
948
948
|
this._formFields = formFields;
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
-
/**
|
|
952
|
-
* Import schema adding `id`, `_parent` and `_path`
|
|
953
|
-
* information to each field and adding it to the
|
|
954
|
-
* form field registry.
|
|
955
|
-
*
|
|
956
|
-
* @param {any} schema
|
|
957
|
-
* @param {any} [data]
|
|
958
|
-
*
|
|
959
|
-
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
951
|
+
/**
|
|
952
|
+
* Import schema adding `id`, `_parent` and `_path`
|
|
953
|
+
* information to each field and adding it to the
|
|
954
|
+
* form field registry.
|
|
955
|
+
*
|
|
956
|
+
* @param {any} schema
|
|
957
|
+
* @param {any} [data]
|
|
958
|
+
*
|
|
959
|
+
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
960
960
|
*/
|
|
961
961
|
importSchema(schema, data = {}) {
|
|
962
962
|
// TODO: Add warnings - https://github.com/bpmn-io/form-js/issues/289
|
|
@@ -975,11 +975,11 @@ class Importer {
|
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
-
/**
|
|
979
|
-
* @param {any} formField
|
|
980
|
-
* @param {string} [parentId]
|
|
981
|
-
*
|
|
982
|
-
* @return {any} importedField
|
|
978
|
+
/**
|
|
979
|
+
* @param {any} formField
|
|
980
|
+
* @param {string} [parentId]
|
|
981
|
+
*
|
|
982
|
+
* @return {any} importedField
|
|
983
983
|
*/
|
|
984
984
|
importFormField(formField, parentId) {
|
|
985
985
|
const {
|
|
@@ -1030,10 +1030,10 @@ class Importer {
|
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
1033
|
-
/**
|
|
1034
|
-
* @param {Object} data
|
|
1035
|
-
*
|
|
1036
|
-
* @return {Object} initializedData
|
|
1033
|
+
/**
|
|
1034
|
+
* @param {Object} data
|
|
1035
|
+
*
|
|
1036
|
+
* @return {Object} initializedData
|
|
1037
1037
|
*/
|
|
1038
1038
|
initializeFieldValues(data) {
|
|
1039
1039
|
return this._formFieldRegistry.getAll().reduce((initializedData, formField) => {
|
|
@@ -1083,11 +1083,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
1083
1083
|
|
|
1084
1084
|
const FORM_ELEMENT = document.createElement('form');
|
|
1085
1085
|
|
|
1086
|
-
/**
|
|
1087
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1088
|
-
*
|
|
1089
|
-
* @param {string} html
|
|
1090
|
-
* @return {string}
|
|
1086
|
+
/**
|
|
1087
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1088
|
+
*
|
|
1089
|
+
* @param {string} html
|
|
1090
|
+
* @return {string}
|
|
1091
1091
|
*/
|
|
1092
1092
|
function sanitizeHTML(html) {
|
|
1093
1093
|
const doc = new DOMParser().parseFromString(`<!DOCTYPE html>\n<html><body><div>${html}`, 'text/html');
|
|
@@ -1107,15 +1107,15 @@ function sanitizeImageSource(src) {
|
|
|
1107
1107
|
return valid ? src : '';
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
|
-
/**
|
|
1111
|
-
* Recursively sanitize a HTML node, potentially
|
|
1112
|
-
* removing it, its children or attributes.
|
|
1113
|
-
*
|
|
1114
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1115
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1116
|
-
* for our use-case.
|
|
1117
|
-
*
|
|
1118
|
-
* @param {Element} node
|
|
1110
|
+
/**
|
|
1111
|
+
* Recursively sanitize a HTML node, potentially
|
|
1112
|
+
* removing it, its children or attributes.
|
|
1113
|
+
*
|
|
1114
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1115
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1116
|
+
* for our use-case.
|
|
1117
|
+
*
|
|
1118
|
+
* @param {Element} node
|
|
1119
1119
|
*/
|
|
1120
1120
|
function sanitizeNode(node) {
|
|
1121
1121
|
// allow text nodes
|
|
@@ -1159,13 +1159,13 @@ function sanitizeNode(node) {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
1162
|
-
/**
|
|
1163
|
-
* Validates attributes for validity.
|
|
1164
|
-
*
|
|
1165
|
-
* @param {string} lcTag
|
|
1166
|
-
* @param {string} lcName
|
|
1167
|
-
* @param {string} value
|
|
1168
|
-
* @return {boolean}
|
|
1162
|
+
/**
|
|
1163
|
+
* Validates attributes for validity.
|
|
1164
|
+
*
|
|
1165
|
+
* @param {string} lcTag
|
|
1166
|
+
* @param {string} lcName
|
|
1167
|
+
* @param {string} value
|
|
1168
|
+
* @return {boolean}
|
|
1169
1169
|
*/
|
|
1170
1170
|
function isValidAttribute(lcTag, lcName, value) {
|
|
1171
1171
|
// disallow most attributes based on whitelist
|
|
@@ -1217,14 +1217,14 @@ function safeMarkdown(markdown) {
|
|
|
1217
1217
|
return sanitizeHTML(html);
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
|
-
/**
|
|
1221
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1222
|
-
* that start with http(s).
|
|
1223
|
-
*
|
|
1224
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1225
|
-
*
|
|
1226
|
-
* @param {string} src
|
|
1227
|
-
* @returns {string}
|
|
1220
|
+
/**
|
|
1221
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1222
|
+
* that start with http(s).
|
|
1223
|
+
*
|
|
1224
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1225
|
+
*
|
|
1226
|
+
* @param {string} src
|
|
1227
|
+
* @returns {string}
|
|
1228
1228
|
*/
|
|
1229
1229
|
function safeImageSource(src) {
|
|
1230
1230
|
return sanitizeImageSource(src);
|
|
@@ -1271,11 +1271,11 @@ const FormRenderContext = preact.createContext({
|
|
|
1271
1271
|
}
|
|
1272
1272
|
});
|
|
1273
1273
|
|
|
1274
|
-
/**
|
|
1275
|
-
* @param {string} type
|
|
1276
|
-
* @param {boolean} [strict]
|
|
1277
|
-
*
|
|
1278
|
-
* @returns {any}
|
|
1274
|
+
/**
|
|
1275
|
+
* @param {string} type
|
|
1276
|
+
* @param {boolean} [strict]
|
|
1277
|
+
*
|
|
1278
|
+
* @returns {any}
|
|
1279
1279
|
*/
|
|
1280
1280
|
function getService(type, strict) {}
|
|
1281
1281
|
const FormContext = preact.createContext({
|
|
@@ -1404,8 +1404,8 @@ function useService (type, strict) {
|
|
|
1404
1404
|
return getService(type, strict);
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
1407
|
-
/**
|
|
1408
|
-
* @enum { String }
|
|
1407
|
+
/**
|
|
1408
|
+
* @enum { String }
|
|
1409
1409
|
*/
|
|
1410
1410
|
const LOAD_STATES = {
|
|
1411
1411
|
LOADING: 'loading',
|
|
@@ -1413,17 +1413,17 @@ const LOAD_STATES = {
|
|
|
1413
1413
|
ERROR: 'error'
|
|
1414
1414
|
};
|
|
1415
1415
|
|
|
1416
|
-
/**
|
|
1417
|
-
* @typedef {Object} ValuesGetter
|
|
1418
|
-
* @property {Object[]} values - The values data
|
|
1419
|
-
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1416
|
+
/**
|
|
1417
|
+
* @typedef {Object} ValuesGetter
|
|
1418
|
+
* @property {Object[]} values - The values data
|
|
1419
|
+
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1420
1420
|
*/
|
|
1421
1421
|
|
|
1422
|
-
/**
|
|
1423
|
-
* A hook to load values for single and multiselect components.
|
|
1424
|
-
*
|
|
1425
|
-
* @param {Object} field - The form field to handle values for
|
|
1426
|
-
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1422
|
+
/**
|
|
1423
|
+
* A hook to load values for single and multiselect components.
|
|
1424
|
+
*
|
|
1425
|
+
* @param {Object} field - The form field to handle values for
|
|
1426
|
+
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1427
1427
|
*/
|
|
1428
1428
|
function useValuesAsync (field) {
|
|
1429
1429
|
const {
|
|
@@ -1758,13 +1758,13 @@ Checklist.keyed = true;
|
|
|
1758
1758
|
Checklist.emptyValue = [];
|
|
1759
1759
|
Checklist.sanitizeValue = sanitizeMultiSelectValue;
|
|
1760
1760
|
|
|
1761
|
-
/**
|
|
1762
|
-
* Check if condition is met with given variables.
|
|
1763
|
-
*
|
|
1764
|
-
* @param {string | undefined} condition
|
|
1765
|
-
* @param {import('../../types').Data} data
|
|
1766
|
-
*
|
|
1767
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1761
|
+
/**
|
|
1762
|
+
* Check if condition is met with given variables.
|
|
1763
|
+
*
|
|
1764
|
+
* @param {string | undefined} condition
|
|
1765
|
+
* @param {import('../../types').Data} data
|
|
1766
|
+
*
|
|
1767
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1768
1768
|
*/
|
|
1769
1769
|
function useCondition(condition, data) {
|
|
1770
1770
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -1874,7 +1874,7 @@ var CalendarIcon = (({
|
|
|
1874
1874
|
fillRule: "evenodd",
|
|
1875
1875
|
clipRule: "evenodd",
|
|
1876
1876
|
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",
|
|
1877
|
-
fill: "
|
|
1877
|
+
fill: "currentColor"
|
|
1878
1878
|
})));
|
|
1879
1879
|
|
|
1880
1880
|
function InputAdorner(props) {
|
|
@@ -1939,10 +1939,6 @@ function Datepicker(props) {
|
|
|
1939
1939
|
|
|
1940
1940
|
// setup flatpickr instance
|
|
1941
1941
|
hooks.useEffect(() => {
|
|
1942
|
-
if (disabled) {
|
|
1943
|
-
setFlatpickrInstance(null);
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
1942
|
let config = {
|
|
1947
1943
|
allowInput: true,
|
|
1948
1944
|
dateFormat: 'm/d/Y',
|
|
@@ -1975,7 +1971,7 @@ function Datepicker(props) {
|
|
|
1975
1971
|
// flatpicker logic that was lost when setting allowInput to true
|
|
1976
1972
|
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
1977
1973
|
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
1978
|
-
}, [
|
|
1974
|
+
}, [disallowPassedDates]);
|
|
1979
1975
|
|
|
1980
1976
|
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
1981
1977
|
hooks.useEffect(() => {
|
|
@@ -2064,12 +2060,12 @@ var ClockIcon = (({
|
|
|
2064
2060
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2065
2061
|
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2066
2062
|
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
|
|
2067
|
-
fill: "
|
|
2063
|
+
fill: "currentColor"
|
|
2068
2064
|
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2069
2065
|
fillRule: "evenodd",
|
|
2070
2066
|
clipRule: "evenodd",
|
|
2071
2067
|
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",
|
|
2072
|
-
fill: "
|
|
2068
|
+
fill: "currentColor"
|
|
2073
2069
|
})));
|
|
2074
2070
|
|
|
2075
2071
|
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
@@ -2161,6 +2157,7 @@ function DropdownList(props) {
|
|
|
2161
2157
|
ref: dropdownContainer,
|
|
2162
2158
|
tabIndex: -1,
|
|
2163
2159
|
class: "fjs-dropdownlist",
|
|
2160
|
+
onMouseDown: e => e.preventDefault(),
|
|
2164
2161
|
style: {
|
|
2165
2162
|
maxHeight: height,
|
|
2166
2163
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
@@ -2172,10 +2169,7 @@ function DropdownList(props) {
|
|
|
2172
2169
|
}),
|
|
2173
2170
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2174
2171
|
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2175
|
-
onMouseDown: e =>
|
|
2176
|
-
e.preventDefault();
|
|
2177
|
-
onValueSelected(v);
|
|
2178
|
-
},
|
|
2172
|
+
onMouseDown: e => onValueSelected(v),
|
|
2179
2173
|
children: getLabel(v)
|
|
2180
2174
|
});
|
|
2181
2175
|
}), !values.length && jsxRuntime.jsx("div", {
|
|
@@ -2375,31 +2369,29 @@ function Datetime(props) {
|
|
|
2375
2369
|
date,
|
|
2376
2370
|
time
|
|
2377
2371
|
} = getNullDateTime();
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2372
|
+
switch (subtype) {
|
|
2373
|
+
case DATETIME_SUBTYPES.DATE:
|
|
2374
|
+
{
|
|
2375
|
+
date = new Date(Date.parse(value));
|
|
2376
|
+
break;
|
|
2377
|
+
}
|
|
2378
|
+
case DATETIME_SUBTYPES.TIME:
|
|
2379
|
+
{
|
|
2380
|
+
time = parseIsoTime(value);
|
|
2381
|
+
break;
|
|
2382
|
+
}
|
|
2383
|
+
case DATETIME_SUBTYPES.DATETIME:
|
|
2384
|
+
{
|
|
2385
|
+
date = new Date(Date.parse(value));
|
|
2386
|
+
time = isValidDate(date) ? 60 * date.getHours() + date.getMinutes() : null;
|
|
2387
|
+
break;
|
|
2388
|
+
}
|
|
2397
2389
|
}
|
|
2398
2390
|
setDateTime({
|
|
2399
2391
|
date,
|
|
2400
2392
|
time
|
|
2401
2393
|
});
|
|
2402
|
-
}, [subtype, value
|
|
2394
|
+
}, [subtype, value]);
|
|
2403
2395
|
const computeAndSetState = hooks.useCallback(({
|
|
2404
2396
|
date,
|
|
2405
2397
|
time
|
|
@@ -2516,10 +2508,10 @@ Datetime.keyed = true;
|
|
|
2516
2508
|
Datetime.emptyValue = null;
|
|
2517
2509
|
Datetime.sanitizeValue = sanitizeDateTimePickerValue;
|
|
2518
2510
|
|
|
2519
|
-
/**
|
|
2520
|
-
* This file must not be changed or exchanged.
|
|
2521
|
-
*
|
|
2522
|
-
* @see http://bpmn.io/license for more information.
|
|
2511
|
+
/**
|
|
2512
|
+
* This file must not be changed or exchanged.
|
|
2513
|
+
*
|
|
2514
|
+
* @see http://bpmn.io/license for more information.
|
|
2523
2515
|
*/
|
|
2524
2516
|
function Logo() {
|
|
2525
2517
|
return jsxRuntime.jsxs("svg", {
|
|
@@ -2636,10 +2628,10 @@ function FormComponent(props) {
|
|
|
2636
2628
|
});
|
|
2637
2629
|
}
|
|
2638
2630
|
|
|
2639
|
-
/**
|
|
2640
|
-
*
|
|
2641
|
-
* @param {string | undefined} expression
|
|
2642
|
-
* @param {import('../../types').Data} data
|
|
2631
|
+
/**
|
|
2632
|
+
*
|
|
2633
|
+
* @param {string | undefined} expression
|
|
2634
|
+
* @param {import('../../types').Data} data
|
|
2643
2635
|
*/
|
|
2644
2636
|
function useEvaluation(expression, data) {
|
|
2645
2637
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -2656,9 +2648,9 @@ function useEvaluation(expression, data) {
|
|
|
2656
2648
|
return conditionChecker.evaluate(expression, filteredData);
|
|
2657
2649
|
}
|
|
2658
2650
|
|
|
2659
|
-
/**
|
|
2660
|
-
*
|
|
2661
|
-
* @param {string} value
|
|
2651
|
+
/**
|
|
2652
|
+
*
|
|
2653
|
+
* @param {string} value
|
|
2662
2654
|
*/
|
|
2663
2655
|
function useExpressionValue(value) {
|
|
2664
2656
|
const formData = useService('form')._getState().data;
|
|
@@ -2789,6 +2781,7 @@ function Numberfield(props) {
|
|
|
2789
2781
|
}), [stringValueCache, value, field]);
|
|
2790
2782
|
const displayValue = hooks.useMemo(() => {
|
|
2791
2783
|
if (value === 'NaN') return 'NaN';
|
|
2784
|
+
if (stringValueCache === '-') return '-';
|
|
2792
2785
|
return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big__default['default'](value).toFixed() : '';
|
|
2793
2786
|
}, [stringValueCache, value, cacheValueMatchesState]);
|
|
2794
2787
|
const arrowIncrementValue = hooks.useMemo(() => {
|
|
@@ -2808,6 +2801,10 @@ function Numberfield(props) {
|
|
|
2808
2801
|
|
|
2809
2802
|
// treat commas as dots
|
|
2810
2803
|
stringValue = stringValue.replaceAll(',', '.');
|
|
2804
|
+
if (stringValue === '-') {
|
|
2805
|
+
setStringValueCache('-');
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2811
2808
|
if (isNaN(Number(stringValue))) {
|
|
2812
2809
|
setStringValueCache('NaN');
|
|
2813
2810
|
onChange({
|
|
@@ -3338,18 +3335,18 @@ var ChecklistIcon = (({
|
|
|
3338
3335
|
styles = {},
|
|
3339
3336
|
...props
|
|
3340
3337
|
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
|
|
3338
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3341
3339
|
width: "54",
|
|
3342
3340
|
height: "54",
|
|
3343
|
-
fill: "none"
|
|
3344
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
3341
|
+
fill: "none"
|
|
3345
3342
|
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3346
3343
|
fillRule: "evenodd",
|
|
3347
3344
|
clipRule: "evenodd",
|
|
3348
|
-
d: "
|
|
3349
|
-
fill: "#
|
|
3345
|
+
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",
|
|
3346
|
+
fill: "#161616"
|
|
3350
3347
|
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3351
|
-
d: "
|
|
3352
|
-
fill: "#
|
|
3348
|
+
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",
|
|
3349
|
+
fill: "#161616"
|
|
3353
3350
|
})));
|
|
3354
3351
|
|
|
3355
3352
|
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); }
|