@bpmn-io/form-js-viewer 1.6.2 → 1.6.4
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 +189 -189
- package/dist/assets/form-js-base.css +1244 -1244
- package/dist/index.cjs +622 -631
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +622 -631
- package/dist/index.es.js.map +1 -1
- package/dist/types/types.d.ts +35 -35
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -74,26 +74,26 @@ const getFlavouredFeelVariableNames = (feelString, feelFlavour = 'expression', o
|
|
|
74
74
|
return [...new Set(variables)];
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
/**
|
|
78
|
-
* Get the variable name at the specified index in a given path expression.
|
|
79
|
-
*
|
|
80
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
81
|
-
* @param {number} index - The index of the variable name to retrieve.
|
|
82
|
-
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
77
|
+
/**
|
|
78
|
+
* Get the variable name at the specified index in a given path expression.
|
|
79
|
+
*
|
|
80
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
81
|
+
* @param {number} index - The index of the variable name to retrieve.
|
|
82
|
+
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
83
83
|
*/
|
|
84
84
|
const _getVariableNameAtPathIndex = (root, index) => {
|
|
85
85
|
const nodes = _linearizePathExpression(root);
|
|
86
86
|
return nodes[index].variableName || null;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
/**
|
|
90
|
-
* Extracts the variables which are required of the external context for a given path expression.
|
|
91
|
-
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
92
|
-
*
|
|
93
|
-
* @param {Object} node - The root node of the path expression tree.
|
|
94
|
-
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
95
|
-
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
96
|
-
* @returns {Set} - A set containing the extracted variable names.
|
|
89
|
+
/**
|
|
90
|
+
* Extracts the variables which are required of the external context for a given path expression.
|
|
91
|
+
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} node - The root node of the path expression tree.
|
|
94
|
+
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
95
|
+
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
96
|
+
* @returns {Set} - A set containing the extracted variable names.
|
|
97
97
|
*/
|
|
98
98
|
const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) => {
|
|
99
99
|
// depth info represents the previous (initialised as null) and current depth of the current accessor in the path expression
|
|
@@ -139,11 +139,11 @@ const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) =
|
|
|
139
139
|
return new Set(extractedVariables);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
/**
|
|
143
|
-
* Deconstructs a path expression tree into an array of components.
|
|
144
|
-
*
|
|
145
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
146
|
-
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
142
|
+
/**
|
|
143
|
+
* Deconstructs a path expression tree into an array of components.
|
|
144
|
+
*
|
|
145
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
146
|
+
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
147
147
|
*/
|
|
148
148
|
const _linearizePathExpression = root => {
|
|
149
149
|
let node = root;
|
|
@@ -162,13 +162,13 @@ const _linearizePathExpression = root => {
|
|
|
162
162
|
return parts.reverse();
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
/**
|
|
166
|
-
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
167
|
-
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
168
|
-
*
|
|
169
|
-
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
170
|
-
* @param {string} feelString - The feel string used for parsing.
|
|
171
|
-
* @returns {Object} The simplified feel structure tree.
|
|
165
|
+
/**
|
|
166
|
+
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
167
|
+
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
168
|
+
*
|
|
169
|
+
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
170
|
+
* @param {string} feelString - The feel string used for parsing.
|
|
171
|
+
* @returns {Object} The simplified feel structure tree.
|
|
172
172
|
*/
|
|
173
173
|
const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
174
174
|
const stack = [{
|
|
@@ -194,9 +194,9 @@ const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
|
194
194
|
return _extractFilterExpressions(stack[0].children[0]);
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
/**
|
|
198
|
-
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
199
|
-
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
197
|
+
/**
|
|
198
|
+
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
199
|
+
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
200
200
|
*/
|
|
201
201
|
const _extractFilterExpressions = tree => {
|
|
202
202
|
const flattenedExpressionTree = {
|
|
@@ -237,25 +237,25 @@ class FeelExpressionLanguage {
|
|
|
237
237
|
this._eventBus = eventBus;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
/**
|
|
241
|
-
* Determines if the given value is a FEEL expression.
|
|
242
|
-
*
|
|
243
|
-
* @param {any} value
|
|
244
|
-
* @returns {boolean}
|
|
245
|
-
*
|
|
240
|
+
/**
|
|
241
|
+
* Determines if the given value is a FEEL expression.
|
|
242
|
+
*
|
|
243
|
+
* @param {any} value
|
|
244
|
+
* @returns {boolean}
|
|
245
|
+
*
|
|
246
246
|
*/
|
|
247
247
|
isExpression(value) {
|
|
248
248
|
return minDash.isString(value) && value.startsWith('=');
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
/**
|
|
252
|
-
* Retrieve variable names from a given FEEL expression.
|
|
253
|
-
*
|
|
254
|
-
* @param {string} expression
|
|
255
|
-
* @param {object} [options]
|
|
256
|
-
* @param {string} [options.type]
|
|
257
|
-
*
|
|
258
|
-
* @returns {string[]}
|
|
251
|
+
/**
|
|
252
|
+
* Retrieve variable names from a given FEEL expression.
|
|
253
|
+
*
|
|
254
|
+
* @param {string} expression
|
|
255
|
+
* @param {object} [options]
|
|
256
|
+
* @param {string} [options.type]
|
|
257
|
+
*
|
|
258
|
+
* @returns {string[]}
|
|
259
259
|
*/
|
|
260
260
|
getVariableNames(expression, options = {}) {
|
|
261
261
|
const {
|
|
@@ -270,13 +270,13 @@ class FeelExpressionLanguage {
|
|
|
270
270
|
return getFlavouredFeelVariableNames(expression, type);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
/**
|
|
274
|
-
* Evaluate an expression.
|
|
275
|
-
*
|
|
276
|
-
* @param {string} expression
|
|
277
|
-
* @param {import('../../types').Data} [data]
|
|
278
|
-
*
|
|
279
|
-
* @returns {any}
|
|
273
|
+
/**
|
|
274
|
+
* Evaluate an expression.
|
|
275
|
+
*
|
|
276
|
+
* @param {string} expression
|
|
277
|
+
* @param {import('../../types').Data} [data]
|
|
278
|
+
*
|
|
279
|
+
* @returns {any}
|
|
280
280
|
*/
|
|
281
281
|
evaluate(expression, data = {}) {
|
|
282
282
|
if (!expression) {
|
|
@@ -301,23 +301,23 @@ FeelExpressionLanguage.$inject = ['eventBus'];
|
|
|
301
301
|
class FeelersTemplating {
|
|
302
302
|
constructor() {}
|
|
303
303
|
|
|
304
|
-
/**
|
|
305
|
-
* Determines if the given value is a feelers template.
|
|
306
|
-
*
|
|
307
|
-
* @param {any} value
|
|
308
|
-
* @returns {boolean}
|
|
309
|
-
*
|
|
304
|
+
/**
|
|
305
|
+
* Determines if the given value is a feelers template.
|
|
306
|
+
*
|
|
307
|
+
* @param {any} value
|
|
308
|
+
* @returns {boolean}
|
|
309
|
+
*
|
|
310
310
|
*/
|
|
311
311
|
isTemplate(value) {
|
|
312
312
|
return minDash.isString(value) && (value.startsWith('=') || /{{.*?}}/.test(value));
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
/**
|
|
316
|
-
* Retrieve variable names from a given feelers template.
|
|
317
|
-
*
|
|
318
|
-
* @param {string} template
|
|
319
|
-
*
|
|
320
|
-
* @returns {string[]}
|
|
315
|
+
/**
|
|
316
|
+
* Retrieve variable names from a given feelers template.
|
|
317
|
+
*
|
|
318
|
+
* @param {string} template
|
|
319
|
+
*
|
|
320
|
+
* @returns {string[]}
|
|
321
321
|
*/
|
|
322
322
|
getVariableNames(template) {
|
|
323
323
|
if (!this.isTemplate(template)) {
|
|
@@ -343,17 +343,17 @@ class FeelersTemplating {
|
|
|
343
343
|
}, []);
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
/**
|
|
347
|
-
* Evaluate a template.
|
|
348
|
-
*
|
|
349
|
-
* @param {string} template
|
|
350
|
-
* @param {Object<string, any>} context
|
|
351
|
-
* @param {Object} options
|
|
352
|
-
* @param {boolean} [options.debug = false]
|
|
353
|
-
* @param {boolean} [options.strict = false]
|
|
354
|
-
* @param {Function} [options.buildDebugString]
|
|
355
|
-
*
|
|
356
|
-
* @returns
|
|
346
|
+
/**
|
|
347
|
+
* Evaluate a template.
|
|
348
|
+
*
|
|
349
|
+
* @param {string} template
|
|
350
|
+
* @param {Object<string, any>} context
|
|
351
|
+
* @param {Object} options
|
|
352
|
+
* @param {boolean} [options.debug = false]
|
|
353
|
+
* @param {boolean} [options.strict = false]
|
|
354
|
+
* @param {Function} [options.buildDebugString]
|
|
355
|
+
*
|
|
356
|
+
* @returns
|
|
357
357
|
*/
|
|
358
358
|
evaluate(template, context = {}, options = {}) {
|
|
359
359
|
const {
|
|
@@ -368,22 +368,22 @@ class FeelersTemplating {
|
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
-
/**
|
|
372
|
-
* @typedef {Object} ExpressionWithDepth
|
|
373
|
-
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
374
|
-
* @property {string} expression - The extracted expression
|
|
371
|
+
/**
|
|
372
|
+
* @typedef {Object} ExpressionWithDepth
|
|
373
|
+
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
374
|
+
* @property {string} expression - The extracted expression
|
|
375
375
|
*/
|
|
376
376
|
|
|
377
|
-
/**
|
|
378
|
-
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
379
|
-
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
380
|
-
|
|
381
|
-
* @param {string} template - A feelers template string.
|
|
382
|
-
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
383
|
-
*
|
|
384
|
-
* @example
|
|
385
|
-
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
386
|
-
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
377
|
+
/**
|
|
378
|
+
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
379
|
+
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
380
|
+
* @name extractExpressionsWithDepth
|
|
381
|
+
* @param {string} template - A feelers template string.
|
|
382
|
+
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
386
|
+
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
387
387
|
*/
|
|
388
388
|
_extractExpressionsWithDepth(template) {
|
|
389
389
|
// build simplified feelers syntax tree
|
|
@@ -489,10 +489,10 @@ function createInjector(bootstrapModules) {
|
|
|
489
489
|
return injector;
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
/**
|
|
493
|
-
* @param {string?} prefix
|
|
494
|
-
*
|
|
495
|
-
* @returns Element
|
|
492
|
+
/**
|
|
493
|
+
* @param {string?} prefix
|
|
494
|
+
*
|
|
495
|
+
* @returns Element
|
|
496
496
|
*/
|
|
497
497
|
function createFormContainer(prefix = 'fjs') {
|
|
498
498
|
const container = document.createElement('div');
|
|
@@ -623,11 +623,11 @@ const LocalExpressionContext = preact.createContext({
|
|
|
623
623
|
});
|
|
624
624
|
var LocalExpressionContext$1 = LocalExpressionContext;
|
|
625
625
|
|
|
626
|
-
/**
|
|
627
|
-
* @param {string} type
|
|
628
|
-
* @param {boolean} [strict]
|
|
629
|
-
*
|
|
630
|
-
* @returns {any}
|
|
626
|
+
/**
|
|
627
|
+
* @param {string} type
|
|
628
|
+
* @param {boolean} [strict]
|
|
629
|
+
*
|
|
630
|
+
* @returns {any}
|
|
631
631
|
*/
|
|
632
632
|
function getService(type, strict) {}
|
|
633
633
|
const FormContext = preact.createContext({
|
|
@@ -670,21 +670,21 @@ function generateIdForType(type) {
|
|
|
670
670
|
return `${type}${generateIndexForType(type)}`;
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
-
/**
|
|
674
|
-
* @template T
|
|
675
|
-
* @param {T} data
|
|
676
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
677
|
-
* @return {T}
|
|
673
|
+
/**
|
|
674
|
+
* @template T
|
|
675
|
+
* @param {T} data
|
|
676
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
677
|
+
* @return {T}
|
|
678
678
|
*/
|
|
679
679
|
function clone(data, replacer) {
|
|
680
680
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
681
681
|
}
|
|
682
682
|
|
|
683
|
-
/**
|
|
684
|
-
* Transform a LocalExpressionContext object into a usable FEEL context.
|
|
685
|
-
*
|
|
686
|
-
* @param {Object} context - The LocalExpressionContext object.
|
|
687
|
-
* @returns {Object} The usable FEEL context.
|
|
683
|
+
/**
|
|
684
|
+
* Transform a LocalExpressionContext object into a usable FEEL context.
|
|
685
|
+
*
|
|
686
|
+
* @param {Object} context - The LocalExpressionContext object.
|
|
687
|
+
* @returns {Object} The usable FEEL context.
|
|
688
688
|
*/
|
|
689
689
|
|
|
690
690
|
function buildExpressionContext(context) {
|
|
@@ -716,12 +716,12 @@ function _wrapObjectKeysWithUnderscores(obj) {
|
|
|
716
716
|
return newObj;
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
/**
|
|
720
|
-
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
721
|
-
*
|
|
722
|
-
* @param {string | undefined} condition
|
|
723
|
-
*
|
|
724
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
719
|
+
/**
|
|
720
|
+
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
721
|
+
*
|
|
722
|
+
* @param {string | undefined} condition
|
|
723
|
+
*
|
|
724
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
725
725
|
*/
|
|
726
726
|
function useCondition(condition) {
|
|
727
727
|
const conditionChecker = useService('conditionChecker', false);
|
|
@@ -731,17 +731,17 @@ function useCondition(condition) {
|
|
|
731
731
|
}, [conditionChecker, condition, expressionContextInfo]);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
/**
|
|
735
|
-
* Custom hook to scroll an element into view only when it is not visible within the viewport.
|
|
736
|
-
*
|
|
737
|
-
* @param {Object} targetRef - A ref pointing to the DOM element to scroll into view.
|
|
738
|
-
* @param {Array} deps - An array of dependencies that trigger the effect.
|
|
739
|
-
* @param {Array} flagRefs - An array of refs that are used as flags to control when to scroll.
|
|
740
|
-
* @param {Object} [scrollOptions={}] - Options defining the behavior of the scrolling.
|
|
741
|
-
* @param {String} [scrollOptions.align='center'] - The alignment of the element within the viewport.
|
|
742
|
-
* @param {String} [scrollOptions.behavior='auto'] - The scrolling behavior.
|
|
743
|
-
* @param {Number} [scrollOptions.offset=0] - An offset that is added to the scroll position.
|
|
744
|
-
* @param {Boolean} [scrollOptions.scrollIfVisible=false] - Whether to scroll even if the element is visible.
|
|
734
|
+
/**
|
|
735
|
+
* Custom hook to scroll an element into view only when it is not visible within the viewport.
|
|
736
|
+
*
|
|
737
|
+
* @param {Object} targetRef - A ref pointing to the DOM element to scroll into view.
|
|
738
|
+
* @param {Array} deps - An array of dependencies that trigger the effect.
|
|
739
|
+
* @param {Array} flagRefs - An array of refs that are used as flags to control when to scroll.
|
|
740
|
+
* @param {Object} [scrollOptions={}] - Options defining the behavior of the scrolling.
|
|
741
|
+
* @param {String} [scrollOptions.align='center'] - The alignment of the element within the viewport.
|
|
742
|
+
* @param {String} [scrollOptions.behavior='auto'] - The scrolling behavior.
|
|
743
|
+
* @param {Number} [scrollOptions.offset=0] - An offset that is added to the scroll position.
|
|
744
|
+
* @param {Boolean} [scrollOptions.scrollIfVisible=false] - Whether to scroll even if the element is visible.
|
|
745
745
|
*/
|
|
746
746
|
function useScrollIntoView(targetRef, deps, scrollOptions = null, flagRefs = []) {
|
|
747
747
|
hooks.useEffect(() => {
|
|
@@ -806,13 +806,13 @@ function _getTopOffset(item, scrollContainer, options) {
|
|
|
806
806
|
return 0;
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
-
/**
|
|
810
|
-
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
811
|
-
* If the string is not an expression, it is returned as is.
|
|
812
|
-
* The function is memoized to minimize re-renders.
|
|
813
|
-
*
|
|
814
|
-
* @param {string} value - The string to evaluate.
|
|
815
|
-
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
809
|
+
/**
|
|
810
|
+
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
811
|
+
* If the string is not an expression, it is returned as is.
|
|
812
|
+
* The function is memoized to minimize re-renders.
|
|
813
|
+
*
|
|
814
|
+
* @param {string} value - The string to evaluate.
|
|
815
|
+
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
816
816
|
*/
|
|
817
817
|
function useExpressionEvaluation(value) {
|
|
818
818
|
const expressionLanguage = useService('expressionLanguage');
|
|
@@ -825,11 +825,11 @@ function useExpressionEvaluation(value) {
|
|
|
825
825
|
}, [expressionLanguage, expressionContextInfo, value]);
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
/**
|
|
829
|
-
* Returns the conditionally filtered data of a form reactively.
|
|
830
|
-
* Memoised to minimize re-renders
|
|
831
|
-
*
|
|
832
|
-
* Warning: costly operation, use with care
|
|
828
|
+
/**
|
|
829
|
+
* Returns the conditionally filtered data of a form reactively.
|
|
830
|
+
* Memoised to minimize re-renders
|
|
831
|
+
*
|
|
832
|
+
* Warning: costly operation, use with care
|
|
833
833
|
*/
|
|
834
834
|
function useFilteredFormData() {
|
|
835
835
|
const {
|
|
@@ -862,16 +862,16 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
|
862
862
|
});
|
|
863
863
|
}
|
|
864
864
|
|
|
865
|
-
/**
|
|
866
|
-
* Retrieve readonly value of a form field, given it can be an
|
|
867
|
-
* expression optionally or configured globally.
|
|
868
|
-
*
|
|
869
|
-
* @typedef { import('../../types').FormProperties } FormProperties
|
|
870
|
-
*
|
|
871
|
-
* @param {any} formField
|
|
872
|
-
* @param {FormProperties} properties
|
|
873
|
-
*
|
|
874
|
-
* @returns {boolean}
|
|
865
|
+
/**
|
|
866
|
+
* Retrieve readonly value of a form field, given it can be an
|
|
867
|
+
* expression optionally or configured globally.
|
|
868
|
+
*
|
|
869
|
+
* @typedef { import('../../types').FormProperties } FormProperties
|
|
870
|
+
*
|
|
871
|
+
* @param {any} formField
|
|
872
|
+
* @param {FormProperties} properties
|
|
873
|
+
*
|
|
874
|
+
* @returns {boolean}
|
|
875
875
|
*/
|
|
876
876
|
function useReadonly(formField, properties = {}) {
|
|
877
877
|
const expressionLanguage = useService('expressionLanguage');
|
|
@@ -895,12 +895,12 @@ function usePrevious(value, defaultValue, dependencies) {
|
|
|
895
895
|
return ref.current;
|
|
896
896
|
}
|
|
897
897
|
|
|
898
|
-
/**
|
|
899
|
-
* A custom hook to manage state changes with deep comparison.
|
|
900
|
-
*
|
|
901
|
-
* @param {any} value - The current value to manage.
|
|
902
|
-
* @param {any} defaultValue - The initial default value for the state.
|
|
903
|
-
* @returns {any} - Returns the current state.
|
|
898
|
+
/**
|
|
899
|
+
* A custom hook to manage state changes with deep comparison.
|
|
900
|
+
*
|
|
901
|
+
* @param {any} value - The current value to manage.
|
|
902
|
+
* @param {any} defaultValue - The initial default value for the state.
|
|
903
|
+
* @returns {any} - Returns the current state.
|
|
904
904
|
*/
|
|
905
905
|
function useDeepCompareState(value, defaultValue) {
|
|
906
906
|
const [state, setState] = hooks.useState(defaultValue);
|
|
@@ -920,16 +920,16 @@ function compare(a, b) {
|
|
|
920
920
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
/**
|
|
924
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
925
|
-
* Memoised to minimize re-renders
|
|
926
|
-
*
|
|
927
|
-
* @param {string} value
|
|
928
|
-
* @param {Object} options
|
|
929
|
-
* @param {boolean} [options.debug = false]
|
|
930
|
-
* @param {boolean} [options.strict = false]
|
|
931
|
-
* @param {Function} [options.buildDebugString]
|
|
932
|
-
*
|
|
923
|
+
/**
|
|
924
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
925
|
+
* Memoised to minimize re-renders
|
|
926
|
+
*
|
|
927
|
+
* @param {string} value
|
|
928
|
+
* @param {Object} options
|
|
929
|
+
* @param {boolean} [options.debug = false]
|
|
930
|
+
* @param {boolean} [options.strict = false]
|
|
931
|
+
* @param {Function} [options.buildDebugString]
|
|
932
|
+
*
|
|
933
933
|
*/
|
|
934
934
|
function useTemplateEvaluation(value, options = {}) {
|
|
935
935
|
const templating = useService('templating');
|
|
@@ -942,17 +942,17 @@ function useTemplateEvaluation(value, options = {}) {
|
|
|
942
942
|
}, [templating, value, expressionContextInfo, options]);
|
|
943
943
|
}
|
|
944
944
|
|
|
945
|
-
/**
|
|
946
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
947
|
-
* If the string contains multiple lines, only the first line is returned.
|
|
948
|
-
* Memoised to minimize re-renders
|
|
949
|
-
*
|
|
950
|
-
* @param {string} value
|
|
951
|
-
* @param {Object} [options]
|
|
952
|
-
* @param {boolean} [options.debug = false]
|
|
953
|
-
* @param {boolean} [options.strict = false]
|
|
954
|
-
* @param {Function} [options.buildDebugString]
|
|
955
|
-
*
|
|
945
|
+
/**
|
|
946
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
947
|
+
* If the string contains multiple lines, only the first line is returned.
|
|
948
|
+
* Memoised to minimize re-renders
|
|
949
|
+
*
|
|
950
|
+
* @param {string} value
|
|
951
|
+
* @param {Object} [options]
|
|
952
|
+
* @param {boolean} [options.debug = false]
|
|
953
|
+
* @param {boolean} [options.strict = false]
|
|
954
|
+
* @param {Function} [options.buildDebugString]
|
|
955
|
+
*
|
|
956
956
|
*/
|
|
957
957
|
function useSingleLineTemplateEvaluation(value, options = {}) {
|
|
958
958
|
const evaluatedTemplate = useTemplateEvaluation(value, options);
|
|
@@ -1108,15 +1108,15 @@ function normalizeOptionsData(optionsData) {
|
|
|
1108
1108
|
return optionsData.filter(_isAllowedValue).map(_normalizeOption).filter(o => !minDash.isNil(o));
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
|
-
/**
|
|
1112
|
-
* Converts the provided option to a normalized format.
|
|
1113
|
-
* If the option is not valid, null is returned.
|
|
1114
|
-
*
|
|
1115
|
-
* @param {object} option
|
|
1116
|
-
* @param {string} option.label
|
|
1117
|
-
* @param {*} option.value
|
|
1118
|
-
*
|
|
1119
|
-
* @returns
|
|
1111
|
+
/**
|
|
1112
|
+
* Converts the provided option to a normalized format.
|
|
1113
|
+
* If the option is not valid, null is returned.
|
|
1114
|
+
*
|
|
1115
|
+
* @param {object} option
|
|
1116
|
+
* @param {string} option.label
|
|
1117
|
+
* @param {*} option.value
|
|
1118
|
+
*
|
|
1119
|
+
* @returns
|
|
1120
1120
|
*/
|
|
1121
1121
|
function _normalizeOption(option) {
|
|
1122
1122
|
// (1) simple primitive case, use it as both label and value
|
|
@@ -1174,8 +1174,8 @@ function createEmptyOptions(options = {}) {
|
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
1176
|
|
|
1177
|
-
/**
|
|
1178
|
-
* @enum { String }
|
|
1177
|
+
/**
|
|
1178
|
+
* @enum { String }
|
|
1179
1179
|
*/
|
|
1180
1180
|
const LOAD_STATES = {
|
|
1181
1181
|
LOADING: 'loading',
|
|
@@ -1183,17 +1183,17 @@ const LOAD_STATES = {
|
|
|
1183
1183
|
ERROR: 'error'
|
|
1184
1184
|
};
|
|
1185
1185
|
|
|
1186
|
-
/**
|
|
1187
|
-
* @typedef {Object} OptionsGetter
|
|
1188
|
-
* @property {Object[]} options - The options data
|
|
1189
|
-
* @property {(LOAD_STATES)} loadState - The options data's loading state, to use for conditional rendering
|
|
1186
|
+
/**
|
|
1187
|
+
* @typedef {Object} OptionsGetter
|
|
1188
|
+
* @property {Object[]} options - The options data
|
|
1189
|
+
* @property {(LOAD_STATES)} loadState - The options data's loading state, to use for conditional rendering
|
|
1190
1190
|
*/
|
|
1191
1191
|
|
|
1192
|
-
/**
|
|
1193
|
-
* A hook to load options for single and multiselect components.
|
|
1194
|
-
*
|
|
1195
|
-
* @param {Object} field - The form field to handle options for
|
|
1196
|
-
* @return {OptionsGetter} optionsGetter - A options getter object providing loading state and options
|
|
1192
|
+
/**
|
|
1193
|
+
* A hook to load options for single and multiselect components.
|
|
1194
|
+
*
|
|
1195
|
+
* @param {Object} field - The form field to handle options for
|
|
1196
|
+
* @return {OptionsGetter} optionsGetter - A options getter object providing loading state and options
|
|
1197
1197
|
*/
|
|
1198
1198
|
function useOptionsAsync (field) {
|
|
1199
1199
|
const {
|
|
@@ -1840,12 +1840,12 @@ FormComponent$1.config = {
|
|
|
1840
1840
|
})
|
|
1841
1841
|
};
|
|
1842
1842
|
|
|
1843
|
-
/**
|
|
1844
|
-
* Returns date format for the provided locale.
|
|
1845
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1846
|
-
*
|
|
1847
|
-
* @param {string} [locale] - The locale to get date format for.
|
|
1848
|
-
* @returns {string} The date format for the locale.
|
|
1843
|
+
/**
|
|
1844
|
+
* Returns date format for the provided locale.
|
|
1845
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1846
|
+
*
|
|
1847
|
+
* @param {string} [locale] - The locale to get date format for.
|
|
1848
|
+
* @returns {string} The date format for the locale.
|
|
1849
1849
|
*/
|
|
1850
1850
|
function getLocaleDateFormat(locale = 'default') {
|
|
1851
1851
|
const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(Date.UTC(2020, 5, 5)));
|
|
@@ -1864,12 +1864,12 @@ function getLocaleDateFormat(locale = 'default') {
|
|
|
1864
1864
|
}).join('');
|
|
1865
1865
|
}
|
|
1866
1866
|
|
|
1867
|
-
/**
|
|
1868
|
-
* Returns readable date format for the provided locale.
|
|
1869
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1870
|
-
*
|
|
1871
|
-
* @param {string} [locale] - The locale to get readable date format for.
|
|
1872
|
-
* @returns {string} The readable date format for the locale.
|
|
1867
|
+
/**
|
|
1868
|
+
* Returns readable date format for the provided locale.
|
|
1869
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1870
|
+
*
|
|
1871
|
+
* @param {string} [locale] - The locale to get readable date format for.
|
|
1872
|
+
* @returns {string} The readable date format for the locale.
|
|
1873
1873
|
*/
|
|
1874
1874
|
function getLocaleReadableDateFormat(locale) {
|
|
1875
1875
|
let format = getLocaleDateFormat(locale).toLowerCase();
|
|
@@ -1886,12 +1886,12 @@ function getLocaleReadableDateFormat(locale) {
|
|
|
1886
1886
|
return format;
|
|
1887
1887
|
}
|
|
1888
1888
|
|
|
1889
|
-
/**
|
|
1890
|
-
* Returns flatpickr config for the provided locale.
|
|
1891
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1892
|
-
*
|
|
1893
|
-
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1894
|
-
* @returns {object} The flatpickr config for the locale.
|
|
1889
|
+
/**
|
|
1890
|
+
* Returns flatpickr config for the provided locale.
|
|
1891
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1892
|
+
*
|
|
1893
|
+
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1894
|
+
* @returns {object} The flatpickr config for the locale.
|
|
1895
1895
|
*/
|
|
1896
1896
|
function getLocaleDateFlatpickrConfig(locale) {
|
|
1897
1897
|
return flatpickerizeDateFormat(getLocaleDateFormat(locale));
|
|
@@ -2603,10 +2603,10 @@ Datetime.config = {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
};
|
|
2605
2605
|
|
|
2606
|
-
/**
|
|
2607
|
-
* This file must not be changed or exchanged.
|
|
2608
|
-
*
|
|
2609
|
-
* @see http://bpmn.io/license for more information.
|
|
2606
|
+
/**
|
|
2607
|
+
* This file must not be changed or exchanged.
|
|
2608
|
+
*
|
|
2609
|
+
* @see http://bpmn.io/license for more information.
|
|
2610
2610
|
*/
|
|
2611
2611
|
function Logo() {
|
|
2612
2612
|
return jsxRuntime.jsxs("svg", {
|
|
@@ -2792,11 +2792,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
2792
2792
|
|
|
2793
2793
|
const FORM_ELEMENT = document.createElement('form');
|
|
2794
2794
|
|
|
2795
|
-
/**
|
|
2796
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2797
|
-
*
|
|
2798
|
-
* @param {string} html
|
|
2799
|
-
* @return {string}
|
|
2795
|
+
/**
|
|
2796
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2797
|
+
*
|
|
2798
|
+
* @param {string} html
|
|
2799
|
+
* @return {string}
|
|
2800
2800
|
*/
|
|
2801
2801
|
|
|
2802
2802
|
// see https://github.com/developit/snarkdown/issues/70
|
|
@@ -2814,41 +2814,41 @@ function sanitizeHTML(html) {
|
|
|
2814
2814
|
}
|
|
2815
2815
|
}
|
|
2816
2816
|
|
|
2817
|
-
/**
|
|
2818
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2819
|
-
* that start with http(s).
|
|
2820
|
-
*
|
|
2821
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2822
|
-
*
|
|
2823
|
-
* @param {string} src
|
|
2824
|
-
* @returns {string}
|
|
2817
|
+
/**
|
|
2818
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2819
|
+
* that start with http(s).
|
|
2820
|
+
*
|
|
2821
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2822
|
+
*
|
|
2823
|
+
* @param {string} src
|
|
2824
|
+
* @returns {string}
|
|
2825
2825
|
*/
|
|
2826
2826
|
function sanitizeImageSource(src) {
|
|
2827
2827
|
const valid = ALLOWED_IMAGE_SRC_PATTERN.test(src);
|
|
2828
2828
|
return valid ? src : '';
|
|
2829
2829
|
}
|
|
2830
2830
|
|
|
2831
|
-
/**
|
|
2832
|
-
* Sanitizes an iframe source to ensure we only allow for links
|
|
2833
|
-
* that start with http(s).
|
|
2834
|
-
*
|
|
2835
|
-
* @param {string} src
|
|
2836
|
-
* @returns {string}
|
|
2831
|
+
/**
|
|
2832
|
+
* Sanitizes an iframe source to ensure we only allow for links
|
|
2833
|
+
* that start with http(s).
|
|
2834
|
+
*
|
|
2835
|
+
* @param {string} src
|
|
2836
|
+
* @returns {string}
|
|
2837
2837
|
*/
|
|
2838
2838
|
function sanitizeIFrameSource(src) {
|
|
2839
2839
|
const valid = ALLOWED_IFRAME_SRC_PATTERN.test(src);
|
|
2840
2840
|
return valid ? src : '';
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
-
/**
|
|
2844
|
-
* Recursively sanitize a HTML node, potentially
|
|
2845
|
-
* removing it, its children or attributes.
|
|
2846
|
-
*
|
|
2847
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2848
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2849
|
-
* for our use-case.
|
|
2850
|
-
*
|
|
2851
|
-
* @param {Element} node
|
|
2843
|
+
/**
|
|
2844
|
+
* Recursively sanitize a HTML node, potentially
|
|
2845
|
+
* removing it, its children or attributes.
|
|
2846
|
+
*
|
|
2847
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2848
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2849
|
+
* for our use-case.
|
|
2850
|
+
*
|
|
2851
|
+
* @param {Element} node
|
|
2852
2852
|
*/
|
|
2853
2853
|
function sanitizeNode(node) {
|
|
2854
2854
|
// allow text nodes
|
|
@@ -2892,13 +2892,13 @@ function sanitizeNode(node) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
}
|
|
2894
2894
|
|
|
2895
|
-
/**
|
|
2896
|
-
* Validates attributes for validity.
|
|
2897
|
-
*
|
|
2898
|
-
* @param {string} lcTag
|
|
2899
|
-
* @param {string} lcName
|
|
2900
|
-
* @param {string} value
|
|
2901
|
-
* @return {boolean}
|
|
2895
|
+
/**
|
|
2896
|
+
* Validates attributes for validity.
|
|
2897
|
+
*
|
|
2898
|
+
* @param {string} lcTag
|
|
2899
|
+
* @param {string} lcName
|
|
2900
|
+
* @param {string} value
|
|
2901
|
+
* @return {boolean}
|
|
2902
2902
|
*/
|
|
2903
2903
|
function isValidAttribute(lcTag, lcName, value) {
|
|
2904
2904
|
// disallow most attributes based on whitelist
|
|
@@ -3078,40 +3078,6 @@ Image.config = {
|
|
|
3078
3078
|
})
|
|
3079
3079
|
};
|
|
3080
3080
|
|
|
3081
|
-
function useFlushDebounce(func, additionalDeps = []) {
|
|
3082
|
-
const timeoutRef = hooks.useRef(null);
|
|
3083
|
-
const lastArgsRef = hooks.useRef(null);
|
|
3084
|
-
const config = useService('config', false);
|
|
3085
|
-
const debounce = config && config.debounce;
|
|
3086
|
-
const shouldDebounce = debounce !== false && debounce !== 0;
|
|
3087
|
-
const delay = typeof debounce === 'number' ? debounce : 300;
|
|
3088
|
-
const debounceFunc = hooks.useCallback((...args) => {
|
|
3089
|
-
if (!shouldDebounce) {
|
|
3090
|
-
func(...args);
|
|
3091
|
-
return;
|
|
3092
|
-
}
|
|
3093
|
-
lastArgsRef.current = args;
|
|
3094
|
-
if (timeoutRef.current) {
|
|
3095
|
-
clearTimeout(timeoutRef.current);
|
|
3096
|
-
}
|
|
3097
|
-
timeoutRef.current = setTimeout(() => {
|
|
3098
|
-
func(...lastArgsRef.current);
|
|
3099
|
-
lastArgsRef.current = null;
|
|
3100
|
-
}, delay);
|
|
3101
|
-
}, [func, delay, shouldDebounce, ...additionalDeps]);
|
|
3102
|
-
const flushFunc = hooks.useCallback(() => {
|
|
3103
|
-
if (timeoutRef.current) {
|
|
3104
|
-
clearTimeout(timeoutRef.current);
|
|
3105
|
-
if (lastArgsRef.current !== null) {
|
|
3106
|
-
func(...lastArgsRef.current);
|
|
3107
|
-
lastArgsRef.current = null;
|
|
3108
|
-
}
|
|
3109
|
-
timeoutRef.current = null;
|
|
3110
|
-
}
|
|
3111
|
-
}, [func, ...additionalDeps]);
|
|
3112
|
-
return [debounceFunc, flushFunc];
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
3081
|
function TemplatedInputAdorner(props) {
|
|
3116
3082
|
const {
|
|
3117
3083
|
pre,
|
|
@@ -3202,7 +3168,8 @@ function Numberfield(props) {
|
|
|
3202
3168
|
onFocus,
|
|
3203
3169
|
field,
|
|
3204
3170
|
value,
|
|
3205
|
-
readonly
|
|
3171
|
+
readonly,
|
|
3172
|
+
onChange
|
|
3206
3173
|
} = props;
|
|
3207
3174
|
const {
|
|
3208
3175
|
description,
|
|
@@ -3222,16 +3189,6 @@ function Numberfield(props) {
|
|
|
3222
3189
|
} = validate;
|
|
3223
3190
|
const inputRef = hooks.useRef();
|
|
3224
3191
|
const [stringValueCache, setStringValueCache] = hooks.useState('');
|
|
3225
|
-
const [onChangeDebounced, flushOnChange] = useFlushDebounce(params => {
|
|
3226
|
-
props.onChange(params);
|
|
3227
|
-
}, [props.onChange]);
|
|
3228
|
-
const onInputBlur = () => {
|
|
3229
|
-
flushOnChange && flushOnChange();
|
|
3230
|
-
onBlur && onBlur();
|
|
3231
|
-
};
|
|
3232
|
-
const onInputFocus = () => {
|
|
3233
|
-
onFocus && onFocus();
|
|
3234
|
-
};
|
|
3235
3192
|
|
|
3236
3193
|
// checks whether the value currently in the form data is practically different from the one in the input field cache
|
|
3237
3194
|
// this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
|
|
@@ -3255,7 +3212,7 @@ function Numberfield(props) {
|
|
|
3255
3212
|
const setValue = hooks.useCallback(stringValue => {
|
|
3256
3213
|
if (isNullEquivalentValue(stringValue)) {
|
|
3257
3214
|
setStringValueCache('');
|
|
3258
|
-
|
|
3215
|
+
onChange({
|
|
3259
3216
|
field,
|
|
3260
3217
|
value: null
|
|
3261
3218
|
});
|
|
@@ -3270,18 +3227,18 @@ function Numberfield(props) {
|
|
|
3270
3227
|
}
|
|
3271
3228
|
if (isNaN(Number(stringValue))) {
|
|
3272
3229
|
setStringValueCache('NaN');
|
|
3273
|
-
|
|
3230
|
+
onChange({
|
|
3274
3231
|
field,
|
|
3275
3232
|
value: 'NaN'
|
|
3276
3233
|
});
|
|
3277
3234
|
return;
|
|
3278
3235
|
}
|
|
3279
3236
|
setStringValueCache(stringValue);
|
|
3280
|
-
|
|
3237
|
+
onChange({
|
|
3281
3238
|
field,
|
|
3282
3239
|
value: serializeToString ? stringValue : Number(stringValue)
|
|
3283
3240
|
});
|
|
3284
|
-
}, [field,
|
|
3241
|
+
}, [field, onChange, serializeToString]);
|
|
3285
3242
|
const increment = () => {
|
|
3286
3243
|
if (readonly) {
|
|
3287
3244
|
return;
|
|
@@ -3365,8 +3322,8 @@ function Numberfield(props) {
|
|
|
3365
3322
|
id: domId,
|
|
3366
3323
|
onKeyDown: onKeyDown,
|
|
3367
3324
|
onKeyPress: onKeyPress,
|
|
3368
|
-
onBlur:
|
|
3369
|
-
onFocus:
|
|
3325
|
+
onBlur: onBlur,
|
|
3326
|
+
onFocus: onFocus
|
|
3370
3327
|
|
|
3371
3328
|
// @ts-ignore
|
|
3372
3329
|
,
|
|
@@ -3556,9 +3513,9 @@ Radio.config = {
|
|
|
3556
3513
|
create: createEmptyOptions
|
|
3557
3514
|
};
|
|
3558
3515
|
|
|
3559
|
-
/**
|
|
3560
|
-
* This hook allows us to retrieve the label from a value in linear time by caching it in a map
|
|
3561
|
-
* @param {Array} options
|
|
3516
|
+
/**
|
|
3517
|
+
* This hook allows us to retrieve the label from a value in linear time by caching it in a map
|
|
3518
|
+
* @param {Array} options
|
|
3562
3519
|
*/
|
|
3563
3520
|
function useGetLabelCorrelation(options) {
|
|
3564
3521
|
// This allows us to retrieve the label from a value in linear time
|
|
@@ -4376,6 +4333,40 @@ function DisabledLink({
|
|
|
4376
4333
|
});
|
|
4377
4334
|
}
|
|
4378
4335
|
|
|
4336
|
+
function useFlushDebounce(func, additionalDeps = []) {
|
|
4337
|
+
const timeoutRef = hooks.useRef(null);
|
|
4338
|
+
const lastArgsRef = hooks.useRef(null);
|
|
4339
|
+
const config = useService('config', false);
|
|
4340
|
+
const debounce = config && config.debounce;
|
|
4341
|
+
const shouldDebounce = debounce !== false && debounce !== 0;
|
|
4342
|
+
const delay = typeof debounce === 'number' ? debounce : 300;
|
|
4343
|
+
const debounceFunc = hooks.useCallback((...args) => {
|
|
4344
|
+
if (!shouldDebounce) {
|
|
4345
|
+
func(...args);
|
|
4346
|
+
return;
|
|
4347
|
+
}
|
|
4348
|
+
lastArgsRef.current = args;
|
|
4349
|
+
if (timeoutRef.current) {
|
|
4350
|
+
clearTimeout(timeoutRef.current);
|
|
4351
|
+
}
|
|
4352
|
+
timeoutRef.current = setTimeout(() => {
|
|
4353
|
+
func(...lastArgsRef.current);
|
|
4354
|
+
lastArgsRef.current = null;
|
|
4355
|
+
}, delay);
|
|
4356
|
+
}, [func, delay, shouldDebounce, ...additionalDeps]);
|
|
4357
|
+
const flushFunc = hooks.useCallback(() => {
|
|
4358
|
+
if (timeoutRef.current) {
|
|
4359
|
+
clearTimeout(timeoutRef.current);
|
|
4360
|
+
if (lastArgsRef.current !== null) {
|
|
4361
|
+
func(...lastArgsRef.current);
|
|
4362
|
+
lastArgsRef.current = null;
|
|
4363
|
+
}
|
|
4364
|
+
timeoutRef.current = null;
|
|
4365
|
+
}
|
|
4366
|
+
}, [func, ...additionalDeps]);
|
|
4367
|
+
return [debounceFunc, flushFunc];
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4379
4370
|
const type$2 = 'textfield';
|
|
4380
4371
|
function Textfield(props) {
|
|
4381
4372
|
const {
|
|
@@ -4636,28 +4627,28 @@ var CaretRightIcon = SvgCaretRight;
|
|
|
4636
4627
|
|
|
4637
4628
|
const type = 'table';
|
|
4638
4629
|
|
|
4639
|
-
/**
|
|
4640
|
-
* @typedef {('asc'|'desc')} Direction
|
|
4641
|
-
*
|
|
4642
|
-
* @typedef Sorting
|
|
4643
|
-
* @property {string} key
|
|
4644
|
-
* @property {Direction} direction
|
|
4645
|
-
*
|
|
4646
|
-
* @typedef Column
|
|
4647
|
-
* @property {string} label
|
|
4648
|
-
* @property {string} key
|
|
4649
|
-
*
|
|
4650
|
-
* @typedef Props
|
|
4651
|
-
* @property {Object} field
|
|
4652
|
-
* @property {string} field.id
|
|
4653
|
-
* @property {Array<Column>} [field.columns]
|
|
4654
|
-
* @property {string} [field.columnsExpression]
|
|
4655
|
-
* @property {string} [field.label]
|
|
4656
|
-
* @property {number} [field.rowCount]
|
|
4657
|
-
* @property {string} [field.dataSource]
|
|
4658
|
-
*
|
|
4659
|
-
* @param {Props} props
|
|
4660
|
-
* @returns {import("preact").JSX.Element}
|
|
4630
|
+
/**
|
|
4631
|
+
* @typedef {('asc'|'desc')} Direction
|
|
4632
|
+
*
|
|
4633
|
+
* @typedef Sorting
|
|
4634
|
+
* @property {string} key
|
|
4635
|
+
* @property {Direction} direction
|
|
4636
|
+
*
|
|
4637
|
+
* @typedef Column
|
|
4638
|
+
* @property {string} label
|
|
4639
|
+
* @property {string} key
|
|
4640
|
+
*
|
|
4641
|
+
* @typedef Props
|
|
4642
|
+
* @property {Object} field
|
|
4643
|
+
* @property {string} field.id
|
|
4644
|
+
* @property {Array<Column>} [field.columns]
|
|
4645
|
+
* @property {string} [field.columnsExpression]
|
|
4646
|
+
* @property {string} [field.label]
|
|
4647
|
+
* @property {number} [field.rowCount]
|
|
4648
|
+
* @property {string} [field.dataSource]
|
|
4649
|
+
*
|
|
4650
|
+
* @param {Props} props
|
|
4651
|
+
* @returns {import("preact").JSX.Element}
|
|
4661
4652
|
*/
|
|
4662
4653
|
function Table(props) {
|
|
4663
4654
|
const {
|
|
@@ -4867,10 +4858,10 @@ Table.config = {
|
|
|
4867
4858
|
|
|
4868
4859
|
// helpers /////////////////////////////
|
|
4869
4860
|
|
|
4870
|
-
/**
|
|
4871
|
-
* @param {string|void} columnsExpression
|
|
4872
|
-
* @param {Column[]} fallbackColumns
|
|
4873
|
-
* @returns {Column[]}
|
|
4861
|
+
/**
|
|
4862
|
+
* @param {string|void} columnsExpression
|
|
4863
|
+
* @param {Column[]} fallbackColumns
|
|
4864
|
+
* @returns {Column[]}
|
|
4874
4865
|
*/
|
|
4875
4866
|
function useEvaluatedColumns(columnsExpression, fallbackColumns) {
|
|
4876
4867
|
/** @type {Column[]|null} */
|
|
@@ -4878,18 +4869,18 @@ function useEvaluatedColumns(columnsExpression, fallbackColumns) {
|
|
|
4878
4869
|
return Array.isArray(evaluation) && evaluation.every(isColumn) ? evaluation : fallbackColumns;
|
|
4879
4870
|
}
|
|
4880
4871
|
|
|
4881
|
-
/**
|
|
4882
|
-
* @param {any} column
|
|
4883
|
-
* @returns {column is Column}
|
|
4872
|
+
/**
|
|
4873
|
+
* @param {any} column
|
|
4874
|
+
* @returns {column is Column}
|
|
4884
4875
|
*/
|
|
4885
4876
|
function isColumn(column) {
|
|
4886
4877
|
return minDash.isObject(column) && minDash.isString(column['label']) && minDash.isString(column['key']);
|
|
4887
4878
|
}
|
|
4888
4879
|
|
|
4889
|
-
/**
|
|
4890
|
-
* @param {Array} array
|
|
4891
|
-
* @param {number} size
|
|
4892
|
-
* @returns {Array}
|
|
4880
|
+
/**
|
|
4881
|
+
* @param {Array} array
|
|
4882
|
+
* @param {number} size
|
|
4883
|
+
* @returns {Array}
|
|
4893
4884
|
*/
|
|
4894
4885
|
function chunk(array, size) {
|
|
4895
4886
|
return array.reduce((chunks, item, index) => {
|
|
@@ -4902,11 +4893,11 @@ function chunk(array, size) {
|
|
|
4902
4893
|
}, []);
|
|
4903
4894
|
}
|
|
4904
4895
|
|
|
4905
|
-
/**
|
|
4906
|
-
* @param {unknown[]} array
|
|
4907
|
-
* @param {string} key
|
|
4908
|
-
* @param {Direction} direction
|
|
4909
|
-
* @returns {unknown[]}
|
|
4896
|
+
/**
|
|
4897
|
+
* @param {unknown[]} array
|
|
4898
|
+
* @param {string} key
|
|
4899
|
+
* @param {Direction} direction
|
|
4900
|
+
* @returns {unknown[]}
|
|
4910
4901
|
*/
|
|
4911
4902
|
function sortByColumn(array, key, direction) {
|
|
4912
4903
|
return [...array].sort((a, b) => {
|
|
@@ -4920,10 +4911,10 @@ function sortByColumn(array, key, direction) {
|
|
|
4920
4911
|
});
|
|
4921
4912
|
}
|
|
4922
4913
|
|
|
4923
|
-
/**
|
|
4924
|
-
* @param {null|Sorting} sortBy
|
|
4925
|
-
* @param {string} key
|
|
4926
|
-
* @param {string} label
|
|
4914
|
+
/**
|
|
4915
|
+
* @param {null|Sorting} sortBy
|
|
4916
|
+
* @param {string} key
|
|
4917
|
+
* @param {string} label
|
|
4927
4918
|
*/
|
|
4928
4919
|
function getHeaderAriaLabel(sortBy, key, label) {
|
|
4929
4920
|
if (sortBy === null || sortBy.key !== key) {
|
|
@@ -5298,37 +5289,37 @@ class FormFields {
|
|
|
5298
5289
|
const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url', 'dataSource', 'columnsExpression'];
|
|
5299
5290
|
const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'url'];
|
|
5300
5291
|
|
|
5301
|
-
/**
|
|
5302
|
-
* @typedef { import('../types').Schema } Schema
|
|
5292
|
+
/**
|
|
5293
|
+
* @typedef { import('../types').Schema } Schema
|
|
5303
5294
|
*/
|
|
5304
5295
|
|
|
5305
|
-
/**
|
|
5306
|
-
* Parse the schema for variables a form might make use of.
|
|
5307
|
-
*
|
|
5308
|
-
* @example
|
|
5309
|
-
*
|
|
5310
|
-
* // retrieve variables from schema
|
|
5311
|
-
* const variables = getSchemaVariables(schema);
|
|
5312
|
-
*
|
|
5313
|
-
* @example
|
|
5314
|
-
*
|
|
5315
|
-
* // retrieve input variables from schema
|
|
5316
|
-
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
5317
|
-
*
|
|
5318
|
-
* @example
|
|
5319
|
-
*
|
|
5320
|
-
* // retrieve output variables from schema
|
|
5321
|
-
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
5322
|
-
*
|
|
5323
|
-
* @param {Schema} schema
|
|
5324
|
-
* @param {object} [options]
|
|
5325
|
-
* @param {any} [options.expressionLanguage]
|
|
5326
|
-
* @param {any} [options.templating]
|
|
5327
|
-
* @param {any} [options.formFields]
|
|
5328
|
-
* @param {boolean} [options.inputs=true]
|
|
5329
|
-
* @param {boolean} [options.outputs=true]
|
|
5330
|
-
*
|
|
5331
|
-
* @return {string[]}
|
|
5296
|
+
/**
|
|
5297
|
+
* Parse the schema for variables a form might make use of.
|
|
5298
|
+
*
|
|
5299
|
+
* @example
|
|
5300
|
+
*
|
|
5301
|
+
* // retrieve variables from schema
|
|
5302
|
+
* const variables = getSchemaVariables(schema);
|
|
5303
|
+
*
|
|
5304
|
+
* @example
|
|
5305
|
+
*
|
|
5306
|
+
* // retrieve input variables from schema
|
|
5307
|
+
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
5308
|
+
*
|
|
5309
|
+
* @example
|
|
5310
|
+
*
|
|
5311
|
+
* // retrieve output variables from schema
|
|
5312
|
+
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
5313
|
+
*
|
|
5314
|
+
* @param {Schema} schema
|
|
5315
|
+
* @param {object} [options]
|
|
5316
|
+
* @param {any} [options.expressionLanguage]
|
|
5317
|
+
* @param {any} [options.templating]
|
|
5318
|
+
* @param {any} [options.formFields]
|
|
5319
|
+
* @param {boolean} [options.inputs=true]
|
|
5320
|
+
* @param {boolean} [options.outputs=true]
|
|
5321
|
+
*
|
|
5322
|
+
* @return {string[]}
|
|
5332
5323
|
*/
|
|
5333
5324
|
function getSchemaVariables(schema, options = {}) {
|
|
5334
5325
|
const {
|
|
@@ -5404,13 +5395,13 @@ function getSchemaVariables(schema, options = {}) {
|
|
|
5404
5395
|
return Array.from(new Set(variables));
|
|
5405
5396
|
}
|
|
5406
5397
|
|
|
5407
|
-
/**
|
|
5408
|
-
* Get the ancestry list of a form field.
|
|
5409
|
-
*
|
|
5410
|
-
* @param {string} formFieldId
|
|
5411
|
-
* @param {import('../core/FormFieldRegistry').default} formFieldRegistry
|
|
5412
|
-
*
|
|
5413
|
-
* @return {Array<string>} ancestry list
|
|
5398
|
+
/**
|
|
5399
|
+
* Get the ancestry list of a form field.
|
|
5400
|
+
*
|
|
5401
|
+
* @param {string} formFieldId
|
|
5402
|
+
* @param {import('../core/FormFieldRegistry').default} formFieldRegistry
|
|
5403
|
+
*
|
|
5404
|
+
* @return {Array<string>} ancestry list
|
|
5414
5405
|
*/
|
|
5415
5406
|
const getAncestryList = (formFieldId, formFieldRegistry) => {
|
|
5416
5407
|
const ids = [];
|
|
@@ -5422,9 +5413,9 @@ const getAncestryList = (formFieldId, formFieldRegistry) => {
|
|
|
5422
5413
|
return ids;
|
|
5423
5414
|
};
|
|
5424
5415
|
|
|
5425
|
-
/**
|
|
5426
|
-
* @typedef {object} Condition
|
|
5427
|
-
* @property {string} [hide]
|
|
5416
|
+
/**
|
|
5417
|
+
* @typedef {object} Condition
|
|
5418
|
+
* @property {string} [hide]
|
|
5428
5419
|
*/
|
|
5429
5420
|
|
|
5430
5421
|
class ConditionChecker {
|
|
@@ -5434,14 +5425,14 @@ class ConditionChecker {
|
|
|
5434
5425
|
this._eventBus = eventBus;
|
|
5435
5426
|
}
|
|
5436
5427
|
|
|
5437
|
-
/**
|
|
5438
|
-
* For given data, remove properties based on condition.
|
|
5439
|
-
*
|
|
5440
|
-
* @param {Object<string, any>} data
|
|
5441
|
-
* @param {Object<string, any>} contextData
|
|
5442
|
-
* @param {Object} [options]
|
|
5443
|
-
* @param {Function} [options.getFilterPath]
|
|
5444
|
-
* @param {boolean} [options.leafNodeDeletionOnly]
|
|
5428
|
+
/**
|
|
5429
|
+
* For given data, remove properties based on condition.
|
|
5430
|
+
*
|
|
5431
|
+
* @param {Object<string, any>} data
|
|
5432
|
+
* @param {Object<string, any>} contextData
|
|
5433
|
+
* @param {Object} [options]
|
|
5434
|
+
* @param {Function} [options.getFilterPath]
|
|
5435
|
+
* @param {boolean} [options.leafNodeDeletionOnly]
|
|
5445
5436
|
*/
|
|
5446
5437
|
applyConditions(data, contextData = {}, options = {}) {
|
|
5447
5438
|
const workingData = clone(data);
|
|
@@ -5535,13 +5526,13 @@ class ConditionChecker {
|
|
|
5535
5526
|
return workingData;
|
|
5536
5527
|
}
|
|
5537
5528
|
|
|
5538
|
-
/**
|
|
5539
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
5540
|
-
*
|
|
5541
|
-
* @param {string} condition
|
|
5542
|
-
* @param {import('../../types').Data} [data]
|
|
5543
|
-
*
|
|
5544
|
-
* @returns {boolean|null}
|
|
5529
|
+
/**
|
|
5530
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
5531
|
+
*
|
|
5532
|
+
* @param {string} condition
|
|
5533
|
+
* @param {import('../../types').Data} [data]
|
|
5534
|
+
*
|
|
5535
|
+
* @returns {boolean|null}
|
|
5545
5536
|
*/
|
|
5546
5537
|
check(condition, data = {}) {
|
|
5547
5538
|
if (!condition) {
|
|
@@ -5562,12 +5553,12 @@ class ConditionChecker {
|
|
|
5562
5553
|
}
|
|
5563
5554
|
}
|
|
5564
5555
|
|
|
5565
|
-
/**
|
|
5566
|
-
* Check if hide condition is met.
|
|
5567
|
-
*
|
|
5568
|
-
* @param {Condition} condition
|
|
5569
|
-
* @param {Object<string, any>} data
|
|
5570
|
-
* @returns {boolean}
|
|
5556
|
+
/**
|
|
5557
|
+
* Check if hide condition is met.
|
|
5558
|
+
*
|
|
5559
|
+
* @param {Condition} condition
|
|
5560
|
+
* @param {Object<string, any>} data
|
|
5561
|
+
* @returns {boolean}
|
|
5571
5562
|
*/
|
|
5572
5563
|
_checkHideCondition(condition, data) {
|
|
5573
5564
|
if (!condition.hide) {
|
|
@@ -5609,12 +5600,12 @@ class MarkdownRenderer {
|
|
|
5609
5600
|
this._converter = new showdown.Converter();
|
|
5610
5601
|
}
|
|
5611
5602
|
|
|
5612
|
-
/**
|
|
5613
|
-
* Render markdown to HTML.
|
|
5614
|
-
*
|
|
5615
|
-
* @param {string} markdown - The markdown to render
|
|
5616
|
-
*
|
|
5617
|
-
* @returns {string} HTML
|
|
5603
|
+
/**
|
|
5604
|
+
* Render markdown to HTML.
|
|
5605
|
+
*
|
|
5606
|
+
* @param {string} markdown - The markdown to render
|
|
5607
|
+
*
|
|
5608
|
+
* @returns {string} HTML
|
|
5618
5609
|
*/
|
|
5619
5610
|
render(markdown) {
|
|
5620
5611
|
return this._converter.makeHtml(markdown);
|
|
@@ -6235,11 +6226,11 @@ class RepeatRenderManager {
|
|
|
6235
6226
|
this.RepeatFooter = this.RepeatFooter.bind(this);
|
|
6236
6227
|
}
|
|
6237
6228
|
|
|
6238
|
-
/**
|
|
6239
|
-
* Checks whether a field is currently repeating its children.
|
|
6240
|
-
*
|
|
6241
|
-
* @param {string} id - The id of the field to check
|
|
6242
|
-
* @returns {boolean} - True if repeatable, false otherwise
|
|
6229
|
+
/**
|
|
6230
|
+
* Checks whether a field is currently repeating its children.
|
|
6231
|
+
*
|
|
6232
|
+
* @param {string} id - The id of the field to check
|
|
6233
|
+
* @returns {boolean} - True if repeatable, false otherwise
|
|
6243
6234
|
*/
|
|
6244
6235
|
isFieldRepeating(id) {
|
|
6245
6236
|
if (!id) {
|
|
@@ -6999,8 +6990,8 @@ Validator.$inject = ['expressionLanguage', 'conditionChecker', 'form'];
|
|
|
6999
6990
|
|
|
7000
6991
|
// helpers //////////
|
|
7001
6992
|
|
|
7002
|
-
/**
|
|
7003
|
-
* Helper function to evaluate optional FEEL validation values.
|
|
6993
|
+
/**
|
|
6994
|
+
* Helper function to evaluate optional FEEL validation values.
|
|
7004
6995
|
*/
|
|
7005
6996
|
function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
7006
6997
|
const evaluatedValidate = {
|
|
@@ -7034,12 +7025,12 @@ function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form
|
|
|
7034
7025
|
}
|
|
7035
7026
|
|
|
7036
7027
|
class Importer {
|
|
7037
|
-
/**
|
|
7038
|
-
* @constructor
|
|
7039
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
7040
|
-
* @param { import('./PathRegistry').default } pathRegistry
|
|
7041
|
-
* @param { import('./FieldFactory').default } fieldFactory
|
|
7042
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
7028
|
+
/**
|
|
7029
|
+
* @constructor
|
|
7030
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
7031
|
+
* @param { import('./PathRegistry').default } pathRegistry
|
|
7032
|
+
* @param { import('./FieldFactory').default } fieldFactory
|
|
7033
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
7043
7034
|
*/
|
|
7044
7035
|
constructor(formFieldRegistry, pathRegistry, fieldFactory, formLayouter) {
|
|
7045
7036
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -7048,21 +7039,21 @@ class Importer {
|
|
|
7048
7039
|
this._formLayouter = formLayouter;
|
|
7049
7040
|
}
|
|
7050
7041
|
|
|
7051
|
-
/**
|
|
7052
|
-
* Import schema creating rows, fields, attaching additional
|
|
7053
|
-
* information to each field and adding fields to the
|
|
7054
|
-
* field registry.
|
|
7055
|
-
*
|
|
7056
|
-
* Additional information attached:
|
|
7057
|
-
*
|
|
7058
|
-
* * `id` (unless present)
|
|
7059
|
-
* * `_parent`
|
|
7060
|
-
* * `_path`
|
|
7061
|
-
*
|
|
7062
|
-
* @param {any} schema
|
|
7063
|
-
*
|
|
7064
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
7065
|
-
* @returns {ImportResult}
|
|
7042
|
+
/**
|
|
7043
|
+
* Import schema creating rows, fields, attaching additional
|
|
7044
|
+
* information to each field and adding fields to the
|
|
7045
|
+
* field registry.
|
|
7046
|
+
*
|
|
7047
|
+
* Additional information attached:
|
|
7048
|
+
*
|
|
7049
|
+
* * `id` (unless present)
|
|
7050
|
+
* * `_parent`
|
|
7051
|
+
* * `_path`
|
|
7052
|
+
*
|
|
7053
|
+
* @param {any} schema
|
|
7054
|
+
*
|
|
7055
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
7056
|
+
* @returns {ImportResult}
|
|
7066
7057
|
*/
|
|
7067
7058
|
importSchema(schema) {
|
|
7068
7059
|
// TODO: Add warnings
|
|
@@ -7087,12 +7078,12 @@ class Importer {
|
|
|
7087
7078
|
this._pathRegistry.clear();
|
|
7088
7079
|
}
|
|
7089
7080
|
|
|
7090
|
-
/**
|
|
7091
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
7092
|
-
* @param {String} [parentId]
|
|
7093
|
-
* @param {number} [index]
|
|
7094
|
-
*
|
|
7095
|
-
* @return {any} field
|
|
7081
|
+
/**
|
|
7082
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
7083
|
+
* @param {String} [parentId]
|
|
7084
|
+
* @param {number} [index]
|
|
7085
|
+
*
|
|
7086
|
+
* @return {any} field
|
|
7096
7087
|
*/
|
|
7097
7088
|
importFormField(fieldAttrs, parentId, index) {
|
|
7098
7089
|
const {
|
|
@@ -7117,11 +7108,11 @@ class Importer {
|
|
|
7117
7108
|
return field;
|
|
7118
7109
|
}
|
|
7119
7110
|
|
|
7120
|
-
/**
|
|
7121
|
-
* @param {Array<any>} components
|
|
7122
|
-
* @param {string} parentId
|
|
7123
|
-
*
|
|
7124
|
-
* @return {Array<any>} imported components
|
|
7111
|
+
/**
|
|
7112
|
+
* @param {Array<any>} components
|
|
7113
|
+
* @param {string} parentId
|
|
7114
|
+
*
|
|
7115
|
+
* @return {Array<any>} imported components
|
|
7125
7116
|
*/
|
|
7126
7117
|
importFormFields(components, parentId) {
|
|
7127
7118
|
return components.map((component, index) => {
|
|
@@ -7132,11 +7123,11 @@ class Importer {
|
|
|
7132
7123
|
Importer.$inject = ['formFieldRegistry', 'pathRegistry', 'fieldFactory', 'formLayouter'];
|
|
7133
7124
|
|
|
7134
7125
|
class FieldFactory {
|
|
7135
|
-
/**
|
|
7136
|
-
* @constructor
|
|
7137
|
-
*
|
|
7138
|
-
* @param formFieldRegistry
|
|
7139
|
-
* @param formFields
|
|
7126
|
+
/**
|
|
7127
|
+
* @constructor
|
|
7128
|
+
*
|
|
7129
|
+
* @param formFieldRegistry
|
|
7130
|
+
* @param formFields
|
|
7140
7131
|
*/
|
|
7141
7132
|
constructor(formFieldRegistry, pathRegistry, formFields) {
|
|
7142
7133
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -7246,36 +7237,36 @@ class FieldFactory {
|
|
|
7246
7237
|
}
|
|
7247
7238
|
FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
|
|
7248
7239
|
|
|
7249
|
-
/**
|
|
7250
|
-
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
7251
|
-
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
7252
|
-
*
|
|
7253
|
-
* Example Tree Structure:
|
|
7254
|
-
*
|
|
7255
|
-
* [
|
|
7256
|
-
* {
|
|
7257
|
-
* segment: 'root',
|
|
7258
|
-
* claimCount: 1,
|
|
7259
|
-
* children: [
|
|
7260
|
-
* {
|
|
7261
|
-
* segment: 'child1',
|
|
7262
|
-
* claimCount: 2,
|
|
7263
|
-
* children: null // A leaf node (closed path)
|
|
7264
|
-
* },
|
|
7265
|
-
* {
|
|
7266
|
-
* segment: 'child2',
|
|
7267
|
-
* claimCount: 1,
|
|
7268
|
-
* children: [
|
|
7269
|
-
* {
|
|
7270
|
-
* segment: 'subChild1',
|
|
7271
|
-
* claimCount: 1,
|
|
7272
|
-
* children: [] // An open node (open path)
|
|
7273
|
-
* }
|
|
7274
|
-
* ]
|
|
7275
|
-
* }
|
|
7276
|
-
* ]
|
|
7277
|
-
* }
|
|
7278
|
-
* ]
|
|
7240
|
+
/**
|
|
7241
|
+
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
7242
|
+
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
7243
|
+
*
|
|
7244
|
+
* Example Tree Structure:
|
|
7245
|
+
*
|
|
7246
|
+
* [
|
|
7247
|
+
* {
|
|
7248
|
+
* segment: 'root',
|
|
7249
|
+
* claimCount: 1,
|
|
7250
|
+
* children: [
|
|
7251
|
+
* {
|
|
7252
|
+
* segment: 'child1',
|
|
7253
|
+
* claimCount: 2,
|
|
7254
|
+
* children: null // A leaf node (closed path)
|
|
7255
|
+
* },
|
|
7256
|
+
* {
|
|
7257
|
+
* segment: 'child2',
|
|
7258
|
+
* claimCount: 1,
|
|
7259
|
+
* children: [
|
|
7260
|
+
* {
|
|
7261
|
+
* segment: 'subChild1',
|
|
7262
|
+
* claimCount: 1,
|
|
7263
|
+
* children: [] // An open node (open path)
|
|
7264
|
+
* }
|
|
7265
|
+
* ]
|
|
7266
|
+
* }
|
|
7267
|
+
* ]
|
|
7268
|
+
* }
|
|
7269
|
+
* ]
|
|
7279
7270
|
*/
|
|
7280
7271
|
class PathRegistry {
|
|
7281
7272
|
constructor(formFieldRegistry, formFields, injector) {
|
|
@@ -7391,16 +7382,16 @@ class PathRegistry {
|
|
|
7391
7382
|
}
|
|
7392
7383
|
}
|
|
7393
7384
|
|
|
7394
|
-
/**
|
|
7395
|
-
* Applies a function (fn) recursively on a given field and its children.
|
|
7396
|
-
*
|
|
7397
|
-
* - `field`: Starting field object.
|
|
7398
|
-
* - `fn`: Function to apply.
|
|
7399
|
-
* - `context`: Optional object for passing data between calls.
|
|
7400
|
-
*
|
|
7401
|
-
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
7402
|
-
*
|
|
7403
|
-
* @returns {boolean} Success status based on function execution.
|
|
7385
|
+
/**
|
|
7386
|
+
* Applies a function (fn) recursively on a given field and its children.
|
|
7387
|
+
*
|
|
7388
|
+
* - `field`: Starting field object.
|
|
7389
|
+
* - `fn`: Function to apply.
|
|
7390
|
+
* - `context`: Optional object for passing data between calls.
|
|
7391
|
+
*
|
|
7392
|
+
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
7393
|
+
*
|
|
7394
|
+
* @returns {boolean} Success status based on function execution.
|
|
7404
7395
|
*/
|
|
7405
7396
|
executeRecursivelyOnFields(field, fn, context = {}) {
|
|
7406
7397
|
let result = true;
|
|
@@ -7441,16 +7432,16 @@ class PathRegistry {
|
|
|
7441
7432
|
return result;
|
|
7442
7433
|
}
|
|
7443
7434
|
|
|
7444
|
-
/**
|
|
7445
|
-
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
7446
|
-
*
|
|
7447
|
-
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
7448
|
-
* @param {Object} [options={}] - Configuration options.
|
|
7449
|
-
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
7450
|
-
* @param {Object} [options.indexes=null] - A map of parent IDs to the index of the field within said parent, leave null to get an unindexed path.
|
|
7451
|
-
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
7452
|
-
*
|
|
7453
|
-
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
7435
|
+
/**
|
|
7436
|
+
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
7437
|
+
*
|
|
7438
|
+
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
7439
|
+
* @param {Object} [options={}] - Configuration options.
|
|
7440
|
+
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
7441
|
+
* @param {Object} [options.indexes=null] - A map of parent IDs to the index of the field within said parent, leave null to get an unindexed path.
|
|
7442
|
+
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
7443
|
+
*
|
|
7444
|
+
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
7454
7445
|
*/
|
|
7455
7446
|
getValuePath(field, options = {}) {
|
|
7456
7447
|
const {
|
|
@@ -7511,23 +7502,23 @@ const _getNextSegment = (node, segment) => {
|
|
|
7511
7502
|
};
|
|
7512
7503
|
PathRegistry.$inject = ['formFieldRegistry', 'formFields', 'injector'];
|
|
7513
7504
|
|
|
7514
|
-
/**
|
|
7515
|
-
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
7516
|
-
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
7505
|
+
/**
|
|
7506
|
+
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
7507
|
+
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
7517
7508
|
*/
|
|
7518
7509
|
|
|
7519
|
-
/**
|
|
7520
|
-
* Maintains the Form layout in a given structure, for example
|
|
7521
|
-
*
|
|
7522
|
-
* [
|
|
7523
|
-
* {
|
|
7524
|
-
* formFieldId: 'FormField_1',
|
|
7525
|
-
* rows: [
|
|
7526
|
-
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
7527
|
-
* ]
|
|
7528
|
-
* }
|
|
7529
|
-
* ]
|
|
7530
|
-
*
|
|
7510
|
+
/**
|
|
7511
|
+
* Maintains the Form layout in a given structure, for example
|
|
7512
|
+
*
|
|
7513
|
+
* [
|
|
7514
|
+
* {
|
|
7515
|
+
* formFieldId: 'FormField_1',
|
|
7516
|
+
* rows: [
|
|
7517
|
+
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
7518
|
+
* ]
|
|
7519
|
+
* }
|
|
7520
|
+
* ]
|
|
7521
|
+
*
|
|
7531
7522
|
*/
|
|
7532
7523
|
class FormLayouter {
|
|
7533
7524
|
constructor(eventBus) {
|
|
@@ -7537,8 +7528,8 @@ class FormLayouter {
|
|
|
7537
7528
|
this._eventBus = eventBus;
|
|
7538
7529
|
}
|
|
7539
7530
|
|
|
7540
|
-
/**
|
|
7541
|
-
* @param {FormRow} row
|
|
7531
|
+
/**
|
|
7532
|
+
* @param {FormRow} row
|
|
7542
7533
|
*/
|
|
7543
7534
|
addRow(formFieldId, row) {
|
|
7544
7535
|
let rowsPerComponent = this._rows.find(r => r.formFieldId === formFieldId);
|
|
@@ -7552,18 +7543,18 @@ class FormLayouter {
|
|
|
7552
7543
|
rowsPerComponent.rows.push(row);
|
|
7553
7544
|
}
|
|
7554
7545
|
|
|
7555
|
-
/**
|
|
7556
|
-
* @param {String} id
|
|
7557
|
-
* @returns {FormRow}
|
|
7546
|
+
/**
|
|
7547
|
+
* @param {String} id
|
|
7548
|
+
* @returns {FormRow}
|
|
7558
7549
|
*/
|
|
7559
7550
|
getRow(id) {
|
|
7560
7551
|
const rows = allRows(this._rows);
|
|
7561
7552
|
return rows.find(r => r.id === id);
|
|
7562
7553
|
}
|
|
7563
7554
|
|
|
7564
|
-
/**
|
|
7565
|
-
* @param {any} formField
|
|
7566
|
-
* @returns {FormRow}
|
|
7555
|
+
/**
|
|
7556
|
+
* @param {any} formField
|
|
7557
|
+
* @returns {FormRow}
|
|
7567
7558
|
*/
|
|
7568
7559
|
getRowForField(formField) {
|
|
7569
7560
|
return allRows(this._rows).find(r => {
|
|
@@ -7574,9 +7565,9 @@ class FormLayouter {
|
|
|
7574
7565
|
});
|
|
7575
7566
|
}
|
|
7576
7567
|
|
|
7577
|
-
/**
|
|
7578
|
-
* @param {String} formFieldId
|
|
7579
|
-
* @returns { Array<FormRow> }
|
|
7568
|
+
/**
|
|
7569
|
+
* @param {String} formFieldId
|
|
7570
|
+
* @returns { Array<FormRow> }
|
|
7580
7571
|
*/
|
|
7581
7572
|
getRows(formFieldId) {
|
|
7582
7573
|
const rowsForField = this._rows.find(r => formFieldId === r.formFieldId);
|
|
@@ -7586,15 +7577,15 @@ class FormLayouter {
|
|
|
7586
7577
|
return rowsForField.rows;
|
|
7587
7578
|
}
|
|
7588
7579
|
|
|
7589
|
-
/**
|
|
7590
|
-
* @returns {string}
|
|
7580
|
+
/**
|
|
7581
|
+
* @returns {string}
|
|
7591
7582
|
*/
|
|
7592
7583
|
nextRowId() {
|
|
7593
7584
|
return this._ids.nextPrefixed('Row_');
|
|
7594
7585
|
}
|
|
7595
7586
|
|
|
7596
|
-
/**
|
|
7597
|
-
* @param {any} formField
|
|
7587
|
+
/**
|
|
7588
|
+
* @param {any} formField
|
|
7598
7589
|
*/
|
|
7599
7590
|
calculateLayout(formField) {
|
|
7600
7591
|
const {
|
|
@@ -7648,9 +7639,9 @@ function groupByRow(components, ids) {
|
|
|
7648
7639
|
});
|
|
7649
7640
|
}
|
|
7650
7641
|
|
|
7651
|
-
/**
|
|
7652
|
-
* @param {Array<FormRows>} formRows
|
|
7653
|
-
* @returns {Array<FormRow>}
|
|
7642
|
+
/**
|
|
7643
|
+
* @param {Array<FormRows>} formRows
|
|
7644
|
+
* @returns {Array<FormRow>}
|
|
7654
7645
|
*/
|
|
7655
7646
|
function allRows(formRows) {
|
|
7656
7647
|
return minDash.flatten(formRows.map(c => c.rows));
|
|
@@ -7775,55 +7766,55 @@ var core = {
|
|
|
7775
7766
|
validator: ['type', Validator]
|
|
7776
7767
|
};
|
|
7777
7768
|
|
|
7778
|
-
/**
|
|
7779
|
-
* @typedef { import('./types').Injector } Injector
|
|
7780
|
-
* @typedef { import('./types').Data } Data
|
|
7781
|
-
* @typedef { import('./types').Errors } Errors
|
|
7782
|
-
* @typedef { import('./types').Schema } Schema
|
|
7783
|
-
* @typedef { import('./types').FormProperties } FormProperties
|
|
7784
|
-
* @typedef { import('./types').FormProperty } FormProperty
|
|
7785
|
-
* @typedef { import('./types').FormEvent } FormEvent
|
|
7786
|
-
* @typedef { import('./types').FormOptions } FormOptions
|
|
7787
|
-
*
|
|
7788
|
-
* @typedef { {
|
|
7789
|
-
* data: Data,
|
|
7790
|
-
* initialData: Data,
|
|
7791
|
-
* errors: Errors,
|
|
7792
|
-
* properties: FormProperties,
|
|
7793
|
-
* schema: Schema
|
|
7794
|
-
* } } State
|
|
7795
|
-
*
|
|
7796
|
-
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7797
|
-
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
7798
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7769
|
+
/**
|
|
7770
|
+
* @typedef { import('./types').Injector } Injector
|
|
7771
|
+
* @typedef { import('./types').Data } Data
|
|
7772
|
+
* @typedef { import('./types').Errors } Errors
|
|
7773
|
+
* @typedef { import('./types').Schema } Schema
|
|
7774
|
+
* @typedef { import('./types').FormProperties } FormProperties
|
|
7775
|
+
* @typedef { import('./types').FormProperty } FormProperty
|
|
7776
|
+
* @typedef { import('./types').FormEvent } FormEvent
|
|
7777
|
+
* @typedef { import('./types').FormOptions } FormOptions
|
|
7778
|
+
*
|
|
7779
|
+
* @typedef { {
|
|
7780
|
+
* data: Data,
|
|
7781
|
+
* initialData: Data,
|
|
7782
|
+
* errors: Errors,
|
|
7783
|
+
* properties: FormProperties,
|
|
7784
|
+
* schema: Schema
|
|
7785
|
+
* } } State
|
|
7786
|
+
*
|
|
7787
|
+
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
7788
|
+
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
7789
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
7799
7790
|
*/
|
|
7800
7791
|
|
|
7801
7792
|
const ids = new Ids([32, 36, 1]);
|
|
7802
7793
|
|
|
7803
|
-
/**
|
|
7804
|
-
* The form.
|
|
7794
|
+
/**
|
|
7795
|
+
* The form.
|
|
7805
7796
|
*/
|
|
7806
7797
|
class Form {
|
|
7807
|
-
/**
|
|
7808
|
-
* @constructor
|
|
7809
|
-
* @param {FormOptions} options
|
|
7798
|
+
/**
|
|
7799
|
+
* @constructor
|
|
7800
|
+
* @param {FormOptions} options
|
|
7810
7801
|
*/
|
|
7811
7802
|
constructor(options = {}) {
|
|
7812
|
-
/**
|
|
7813
|
-
* @public
|
|
7814
|
-
* @type {OnEventType}
|
|
7803
|
+
/**
|
|
7804
|
+
* @public
|
|
7805
|
+
* @type {OnEventType}
|
|
7815
7806
|
*/
|
|
7816
7807
|
this.on = this._onEvent;
|
|
7817
7808
|
|
|
7818
|
-
/**
|
|
7819
|
-
* @public
|
|
7820
|
-
* @type {String}
|
|
7809
|
+
/**
|
|
7810
|
+
* @public
|
|
7811
|
+
* @type {String}
|
|
7821
7812
|
*/
|
|
7822
7813
|
this._id = ids.next();
|
|
7823
7814
|
|
|
7824
|
-
/**
|
|
7825
|
-
* @private
|
|
7826
|
-
* @type {Element}
|
|
7815
|
+
/**
|
|
7816
|
+
* @private
|
|
7817
|
+
* @type {Element}
|
|
7827
7818
|
*/
|
|
7828
7819
|
this._container = createFormContainer();
|
|
7829
7820
|
const {
|
|
@@ -7832,9 +7823,9 @@ class Form {
|
|
|
7832
7823
|
properties = {}
|
|
7833
7824
|
} = options;
|
|
7834
7825
|
|
|
7835
|
-
/**
|
|
7836
|
-
* @private
|
|
7837
|
-
* @type {State}
|
|
7826
|
+
/**
|
|
7827
|
+
* @private
|
|
7828
|
+
* @type {State}
|
|
7838
7829
|
*/
|
|
7839
7830
|
this._state = {
|
|
7840
7831
|
initialData: null,
|
|
@@ -7858,9 +7849,9 @@ class Form {
|
|
|
7858
7849
|
this._emit('form.clear');
|
|
7859
7850
|
}
|
|
7860
7851
|
|
|
7861
|
-
/**
|
|
7862
|
-
* Destroy the form, removing it from DOM,
|
|
7863
|
-
* if attached.
|
|
7852
|
+
/**
|
|
7853
|
+
* Destroy the form, removing it from DOM,
|
|
7854
|
+
* if attached.
|
|
7864
7855
|
*/
|
|
7865
7856
|
destroy() {
|
|
7866
7857
|
// destroy form services
|
|
@@ -7871,13 +7862,13 @@ class Form {
|
|
|
7871
7862
|
this._detach(false);
|
|
7872
7863
|
}
|
|
7873
7864
|
|
|
7874
|
-
/**
|
|
7875
|
-
* Open a form schema with the given initial data.
|
|
7876
|
-
*
|
|
7877
|
-
* @param {Schema} schema
|
|
7878
|
-
* @param {Data} [data]
|
|
7879
|
-
*
|
|
7880
|
-
* @return Promise<{ warnings: Array<any> }>
|
|
7865
|
+
/**
|
|
7866
|
+
* Open a form schema with the given initial data.
|
|
7867
|
+
*
|
|
7868
|
+
* @param {Schema} schema
|
|
7869
|
+
* @param {Data} [data]
|
|
7870
|
+
*
|
|
7871
|
+
* @return Promise<{ warnings: Array<any> }>
|
|
7881
7872
|
*/
|
|
7882
7873
|
importSchema(schema, data = {}) {
|
|
7883
7874
|
return new Promise((resolve, reject) => {
|
|
@@ -7910,10 +7901,10 @@ class Form {
|
|
|
7910
7901
|
});
|
|
7911
7902
|
}
|
|
7912
7903
|
|
|
7913
|
-
/**
|
|
7914
|
-
* Submit the form, triggering all field validations.
|
|
7915
|
-
*
|
|
7916
|
-
* @returns { { data: Data, errors: Errors } }
|
|
7904
|
+
/**
|
|
7905
|
+
* Submit the form, triggering all field validations.
|
|
7906
|
+
*
|
|
7907
|
+
* @returns { { data: Data, errors: Errors } }
|
|
7917
7908
|
*/
|
|
7918
7909
|
submit() {
|
|
7919
7910
|
const {
|
|
@@ -7939,8 +7930,8 @@ class Form {
|
|
|
7939
7930
|
});
|
|
7940
7931
|
}
|
|
7941
7932
|
|
|
7942
|
-
/**
|
|
7943
|
-
* @returns {Errors}
|
|
7933
|
+
/**
|
|
7934
|
+
* @returns {Errors}
|
|
7944
7935
|
*/
|
|
7945
7936
|
validate() {
|
|
7946
7937
|
const formFields = this.get('formFields'),
|
|
@@ -8012,8 +8003,8 @@ class Form {
|
|
|
8012
8003
|
return filteredErrors;
|
|
8013
8004
|
}
|
|
8014
8005
|
|
|
8015
|
-
/**
|
|
8016
|
-
* @param {Element|string} parentNode
|
|
8006
|
+
/**
|
|
8007
|
+
* @param {Element|string} parentNode
|
|
8017
8008
|
*/
|
|
8018
8009
|
attachTo(parentNode) {
|
|
8019
8010
|
if (!parentNode) {
|
|
@@ -8031,10 +8022,10 @@ class Form {
|
|
|
8031
8022
|
this._detach();
|
|
8032
8023
|
}
|
|
8033
8024
|
|
|
8034
|
-
/**
|
|
8035
|
-
* @private
|
|
8036
|
-
*
|
|
8037
|
-
* @param {boolean} [emit]
|
|
8025
|
+
/**
|
|
8026
|
+
* @private
|
|
8027
|
+
*
|
|
8028
|
+
* @param {boolean} [emit]
|
|
8038
8029
|
*/
|
|
8039
8030
|
_detach(emit = true) {
|
|
8040
8031
|
const container = this._container,
|
|
@@ -8048,9 +8039,9 @@ class Form {
|
|
|
8048
8039
|
parentNode.removeChild(container);
|
|
8049
8040
|
}
|
|
8050
8041
|
|
|
8051
|
-
/**
|
|
8052
|
-
* @param {FormProperty} property
|
|
8053
|
-
* @param {any} value
|
|
8042
|
+
/**
|
|
8043
|
+
* @param {FormProperty} property
|
|
8044
|
+
* @param {any} value
|
|
8054
8045
|
*/
|
|
8055
8046
|
setProperty(property, value) {
|
|
8056
8047
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -8059,21 +8050,21 @@ class Form {
|
|
|
8059
8050
|
});
|
|
8060
8051
|
}
|
|
8061
8052
|
|
|
8062
|
-
/**
|
|
8063
|
-
* @param {FormEvent} type
|
|
8064
|
-
* @param {Function} handler
|
|
8053
|
+
/**
|
|
8054
|
+
* @param {FormEvent} type
|
|
8055
|
+
* @param {Function} handler
|
|
8065
8056
|
*/
|
|
8066
8057
|
off(type, handler) {
|
|
8067
8058
|
this.get('eventBus').off(type, handler);
|
|
8068
8059
|
}
|
|
8069
8060
|
|
|
8070
|
-
/**
|
|
8071
|
-
* @private
|
|
8072
|
-
*
|
|
8073
|
-
* @param {FormOptions} options
|
|
8074
|
-
* @param {Element} container
|
|
8075
|
-
*
|
|
8076
|
-
* @returns {Injector}
|
|
8061
|
+
/**
|
|
8062
|
+
* @private
|
|
8063
|
+
*
|
|
8064
|
+
* @param {FormOptions} options
|
|
8065
|
+
* @param {Element} container
|
|
8066
|
+
*
|
|
8067
|
+
* @returns {Injector}
|
|
8077
8068
|
*/
|
|
8078
8069
|
_createInjector(options, container) {
|
|
8079
8070
|
const {
|
|
@@ -8094,17 +8085,17 @@ class Form {
|
|
|
8094
8085
|
}, core, ...modules, ...additionalModules]);
|
|
8095
8086
|
}
|
|
8096
8087
|
|
|
8097
|
-
/**
|
|
8098
|
-
* @private
|
|
8088
|
+
/**
|
|
8089
|
+
* @private
|
|
8099
8090
|
*/
|
|
8100
8091
|
_emit(type, data) {
|
|
8101
8092
|
this.get('eventBus').fire(type, data);
|
|
8102
8093
|
}
|
|
8103
8094
|
|
|
8104
|
-
/**
|
|
8105
|
-
* @internal
|
|
8106
|
-
*
|
|
8107
|
-
* @param { { add?: boolean, field: any, indexes: object, remove?: number, value?: any } } update
|
|
8095
|
+
/**
|
|
8096
|
+
* @internal
|
|
8097
|
+
*
|
|
8098
|
+
* @param { { add?: boolean, field: any, indexes: object, remove?: number, value?: any } } update
|
|
8108
8099
|
*/
|
|
8109
8100
|
_update(update) {
|
|
8110
8101
|
const {
|
|
@@ -8130,15 +8121,15 @@ class Form {
|
|
|
8130
8121
|
});
|
|
8131
8122
|
}
|
|
8132
8123
|
|
|
8133
|
-
/**
|
|
8134
|
-
* @internal
|
|
8124
|
+
/**
|
|
8125
|
+
* @internal
|
|
8135
8126
|
*/
|
|
8136
8127
|
_getState() {
|
|
8137
8128
|
return this._state;
|
|
8138
8129
|
}
|
|
8139
8130
|
|
|
8140
|
-
/**
|
|
8141
|
-
* @internal
|
|
8131
|
+
/**
|
|
8132
|
+
* @internal
|
|
8142
8133
|
*/
|
|
8143
8134
|
_setState(state) {
|
|
8144
8135
|
this._state = {
|
|
@@ -8148,22 +8139,22 @@ class Form {
|
|
|
8148
8139
|
this._emit('changed', this._getState());
|
|
8149
8140
|
}
|
|
8150
8141
|
|
|
8151
|
-
/**
|
|
8152
|
-
* @internal
|
|
8142
|
+
/**
|
|
8143
|
+
* @internal
|
|
8153
8144
|
*/
|
|
8154
8145
|
_getModules() {
|
|
8155
8146
|
return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule, RepeatRenderModule];
|
|
8156
8147
|
}
|
|
8157
8148
|
|
|
8158
|
-
/**
|
|
8159
|
-
* @internal
|
|
8149
|
+
/**
|
|
8150
|
+
* @internal
|
|
8160
8151
|
*/
|
|
8161
8152
|
_onEvent(type, priority, handler) {
|
|
8162
8153
|
this.get('eventBus').on(type, priority, handler);
|
|
8163
8154
|
}
|
|
8164
8155
|
|
|
8165
|
-
/**
|
|
8166
|
-
* @internal
|
|
8156
|
+
/**
|
|
8157
|
+
* @internal
|
|
8167
8158
|
*/
|
|
8168
8159
|
_getSubmitData() {
|
|
8169
8160
|
const formFieldRegistry = this.get('formFieldRegistry');
|
|
@@ -8220,16 +8211,16 @@ class Form {
|
|
|
8220
8211
|
return this._applyConditions(workingSubmitData, formData);
|
|
8221
8212
|
}
|
|
8222
8213
|
|
|
8223
|
-
/**
|
|
8224
|
-
* @internal
|
|
8214
|
+
/**
|
|
8215
|
+
* @internal
|
|
8225
8216
|
*/
|
|
8226
8217
|
_applyConditions(toFilter, data, options = {}) {
|
|
8227
8218
|
const conditionChecker = this.get('conditionChecker');
|
|
8228
8219
|
return conditionChecker.applyConditions(toFilter, data, options);
|
|
8229
8220
|
}
|
|
8230
8221
|
|
|
8231
|
-
/**
|
|
8232
|
-
* @internal
|
|
8222
|
+
/**
|
|
8223
|
+
* @internal
|
|
8233
8224
|
*/
|
|
8234
8225
|
_getInitializedFieldData(data, options = {}) {
|
|
8235
8226
|
const formFieldRegistry = this.get('formFieldRegistry');
|