@bpmn-io/form-js-viewer 1.3.3 → 1.4.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 +189 -164
- package/dist/assets/form-js-base.css +1016 -987
- package/dist/assets/form-js.css +29 -0
- package/dist/index.cjs +831 -642
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +826 -643
- package/dist/index.es.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/render/components/form-fields/Separator.d.ts +12 -0
- package/dist/types/render/components/form-fields/parts/SkipLink.d.ts +1 -0
- package/dist/types/render/components/index.d.ts +6 -1
- package/dist/types/types.d.ts +35 -35
- package/dist/types/util/index.d.ts +34 -3
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -53,26 +53,26 @@ const getFlavouredFeelVariableNames = (feelString, feelFlavour = 'expression', o
|
|
|
53
53
|
return [...new Set(variables)];
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
* Get the variable name at the specified index in a given path expression.
|
|
58
|
-
*
|
|
59
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
60
|
-
* @param {number} index - The index of the variable name to retrieve.
|
|
61
|
-
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
56
|
+
/**
|
|
57
|
+
* Get the variable name at the specified index in a given path expression.
|
|
58
|
+
*
|
|
59
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
60
|
+
* @param {number} index - The index of the variable name to retrieve.
|
|
61
|
+
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
62
62
|
*/
|
|
63
63
|
const _getVariableNameAtPathIndex = (root, index) => {
|
|
64
64
|
const nodes = _linearizePathExpression(root);
|
|
65
65
|
return nodes[index].variableName || null;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* Extracts the variables which are required of the external context for a given path expression.
|
|
70
|
-
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
71
|
-
*
|
|
72
|
-
* @param {Object} node - The root node of the path expression tree.
|
|
73
|
-
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
74
|
-
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
75
|
-
* @returns {Set} - A set containing the extracted variable names.
|
|
68
|
+
/**
|
|
69
|
+
* Extracts the variables which are required of the external context for a given path expression.
|
|
70
|
+
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} node - The root node of the path expression tree.
|
|
73
|
+
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
74
|
+
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
75
|
+
* @returns {Set} - A set containing the extracted variable names.
|
|
76
76
|
*/
|
|
77
77
|
const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) => {
|
|
78
78
|
// depth info represents the previous (initialised as null) and current depth of the current accessor in the path expression
|
|
@@ -118,11 +118,11 @@ const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) =
|
|
|
118
118
|
return new Set(extractedVariables);
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* Deconstructs a path expression tree into an array of components.
|
|
123
|
-
*
|
|
124
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
125
|
-
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
121
|
+
/**
|
|
122
|
+
* Deconstructs a path expression tree into an array of components.
|
|
123
|
+
*
|
|
124
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
125
|
+
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
126
126
|
*/
|
|
127
127
|
const _linearizePathExpression = root => {
|
|
128
128
|
let node = root;
|
|
@@ -141,13 +141,13 @@ const _linearizePathExpression = root => {
|
|
|
141
141
|
return parts.reverse();
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
/**
|
|
145
|
-
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
146
|
-
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
147
|
-
*
|
|
148
|
-
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
149
|
-
* @param {string} feelString - The feel string used for parsing.
|
|
150
|
-
* @returns {Object} The simplified feel structure tree.
|
|
144
|
+
/**
|
|
145
|
+
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
146
|
+
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
147
|
+
*
|
|
148
|
+
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
149
|
+
* @param {string} feelString - The feel string used for parsing.
|
|
150
|
+
* @returns {Object} The simplified feel structure tree.
|
|
151
151
|
*/
|
|
152
152
|
const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
153
153
|
const stack = [{
|
|
@@ -173,9 +173,9 @@ const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
|
173
173
|
return _extractFilterExpressions(stack[0].children[0]);
|
|
174
174
|
};
|
|
175
175
|
|
|
176
|
-
/**
|
|
177
|
-
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
178
|
-
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
176
|
+
/**
|
|
177
|
+
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
178
|
+
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
179
179
|
*/
|
|
180
180
|
const _extractFilterExpressions = tree => {
|
|
181
181
|
const flattenedExpressionTree = {
|
|
@@ -216,25 +216,25 @@ class FeelExpressionLanguage {
|
|
|
216
216
|
this._eventBus = eventBus;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
/**
|
|
220
|
-
* Determines if the given value is a FEEL expression.
|
|
221
|
-
*
|
|
222
|
-
* @param {any} value
|
|
223
|
-
* @returns {boolean}
|
|
224
|
-
*
|
|
219
|
+
/**
|
|
220
|
+
* Determines if the given value is a FEEL expression.
|
|
221
|
+
*
|
|
222
|
+
* @param {any} value
|
|
223
|
+
* @returns {boolean}
|
|
224
|
+
*
|
|
225
225
|
*/
|
|
226
226
|
isExpression(value) {
|
|
227
227
|
return isString(value) && value.startsWith('=');
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
/**
|
|
231
|
-
* Retrieve variable names from a given FEEL expression.
|
|
232
|
-
*
|
|
233
|
-
* @param {string} expression
|
|
234
|
-
* @param {object} [options]
|
|
235
|
-
* @param {string} [options.type]
|
|
236
|
-
*
|
|
237
|
-
* @returns {string[]}
|
|
230
|
+
/**
|
|
231
|
+
* Retrieve variable names from a given FEEL expression.
|
|
232
|
+
*
|
|
233
|
+
* @param {string} expression
|
|
234
|
+
* @param {object} [options]
|
|
235
|
+
* @param {string} [options.type]
|
|
236
|
+
*
|
|
237
|
+
* @returns {string[]}
|
|
238
238
|
*/
|
|
239
239
|
getVariableNames(expression, options = {}) {
|
|
240
240
|
const {
|
|
@@ -249,13 +249,13 @@ class FeelExpressionLanguage {
|
|
|
249
249
|
return getFlavouredFeelVariableNames(expression, type);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
/**
|
|
253
|
-
* Evaluate an expression.
|
|
254
|
-
*
|
|
255
|
-
* @param {string} expression
|
|
256
|
-
* @param {import('../../types').Data} [data]
|
|
257
|
-
*
|
|
258
|
-
* @returns {any}
|
|
252
|
+
/**
|
|
253
|
+
* Evaluate an expression.
|
|
254
|
+
*
|
|
255
|
+
* @param {string} expression
|
|
256
|
+
* @param {import('../../types').Data} [data]
|
|
257
|
+
*
|
|
258
|
+
* @returns {any}
|
|
259
259
|
*/
|
|
260
260
|
evaluate(expression, data = {}) {
|
|
261
261
|
if (!expression) {
|
|
@@ -280,23 +280,23 @@ FeelExpressionLanguage.$inject = ['eventBus'];
|
|
|
280
280
|
class FeelersTemplating {
|
|
281
281
|
constructor() {}
|
|
282
282
|
|
|
283
|
-
/**
|
|
284
|
-
* Determines if the given value is a feelers template.
|
|
285
|
-
*
|
|
286
|
-
* @param {any} value
|
|
287
|
-
* @returns {boolean}
|
|
288
|
-
*
|
|
283
|
+
/**
|
|
284
|
+
* Determines if the given value is a feelers template.
|
|
285
|
+
*
|
|
286
|
+
* @param {any} value
|
|
287
|
+
* @returns {boolean}
|
|
288
|
+
*
|
|
289
289
|
*/
|
|
290
290
|
isTemplate(value) {
|
|
291
291
|
return isString(value) && (value.startsWith('=') || /{{.*?}}/.test(value));
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
/**
|
|
295
|
-
* Retrieve variable names from a given feelers template.
|
|
296
|
-
*
|
|
297
|
-
* @param {string} template
|
|
298
|
-
*
|
|
299
|
-
* @returns {string[]}
|
|
294
|
+
/**
|
|
295
|
+
* Retrieve variable names from a given feelers template.
|
|
296
|
+
*
|
|
297
|
+
* @param {string} template
|
|
298
|
+
*
|
|
299
|
+
* @returns {string[]}
|
|
300
300
|
*/
|
|
301
301
|
getVariableNames(template) {
|
|
302
302
|
if (!this.isTemplate(template)) {
|
|
@@ -322,17 +322,17 @@ class FeelersTemplating {
|
|
|
322
322
|
}, []);
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
/**
|
|
326
|
-
* Evaluate a template.
|
|
327
|
-
*
|
|
328
|
-
* @param {string} template
|
|
329
|
-
* @param {Object<string, any>} context
|
|
330
|
-
* @param {Object} options
|
|
331
|
-
* @param {boolean} [options.debug = false]
|
|
332
|
-
* @param {boolean} [options.strict = false]
|
|
333
|
-
* @param {Function} [options.buildDebugString]
|
|
334
|
-
*
|
|
335
|
-
* @returns
|
|
325
|
+
/**
|
|
326
|
+
* Evaluate a template.
|
|
327
|
+
*
|
|
328
|
+
* @param {string} template
|
|
329
|
+
* @param {Object<string, any>} context
|
|
330
|
+
* @param {Object} options
|
|
331
|
+
* @param {boolean} [options.debug = false]
|
|
332
|
+
* @param {boolean} [options.strict = false]
|
|
333
|
+
* @param {Function} [options.buildDebugString]
|
|
334
|
+
*
|
|
335
|
+
* @returns
|
|
336
336
|
*/
|
|
337
337
|
evaluate(template, context = {}, options = {}) {
|
|
338
338
|
const {
|
|
@@ -347,22 +347,22 @@ class FeelersTemplating {
|
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
/**
|
|
351
|
-
* @typedef {Object} ExpressionWithDepth
|
|
352
|
-
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
353
|
-
* @property {string} expression - The extracted expression
|
|
350
|
+
/**
|
|
351
|
+
* @typedef {Object} ExpressionWithDepth
|
|
352
|
+
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
353
|
+
* @property {string} expression - The extracted expression
|
|
354
354
|
*/
|
|
355
355
|
|
|
356
|
-
/**
|
|
357
|
-
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
358
|
-
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
359
|
-
|
|
360
|
-
* @param {string} template - A feelers template string.
|
|
361
|
-
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
365
|
-
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
356
|
+
/**
|
|
357
|
+
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
358
|
+
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
359
|
+
* @name extractExpressionsWithDepth
|
|
360
|
+
* @param {string} template - A feelers template string.
|
|
361
|
+
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
365
|
+
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
366
366
|
*/
|
|
367
367
|
_extractExpressionsWithDepth(template) {
|
|
368
368
|
// build simplified feelers syntax tree
|
|
@@ -425,27 +425,31 @@ function prefixId(id, formId) {
|
|
|
425
425
|
return `fjs-form-${id}`;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
const type$
|
|
428
|
+
const type$d = 'button';
|
|
429
429
|
function Button(props) {
|
|
430
430
|
const {
|
|
431
431
|
disabled,
|
|
432
|
+
onFocus,
|
|
433
|
+
onBlur,
|
|
432
434
|
field
|
|
433
435
|
} = props;
|
|
434
436
|
const {
|
|
435
437
|
action = 'submit'
|
|
436
438
|
} = field;
|
|
437
439
|
return jsx("div", {
|
|
438
|
-
class: formFieldClasses(type$
|
|
440
|
+
class: formFieldClasses(type$d),
|
|
439
441
|
children: jsx("button", {
|
|
440
442
|
class: "fjs-button",
|
|
441
443
|
type: action,
|
|
442
444
|
disabled: disabled,
|
|
445
|
+
onFocus: () => onFocus && onFocus(),
|
|
446
|
+
onBlur: () => onBlur && onBlur(),
|
|
443
447
|
children: field.label
|
|
444
448
|
})
|
|
445
449
|
});
|
|
446
450
|
}
|
|
447
451
|
Button.config = {
|
|
448
|
-
type: type$
|
|
452
|
+
type: type$d,
|
|
449
453
|
keyed: false,
|
|
450
454
|
label: 'Button',
|
|
451
455
|
group: 'action',
|
|
@@ -496,11 +500,11 @@ const FormRenderContext = createContext({
|
|
|
496
500
|
});
|
|
497
501
|
var FormRenderContext$1 = FormRenderContext;
|
|
498
502
|
|
|
499
|
-
/**
|
|
500
|
-
* @param {string} type
|
|
501
|
-
* @param {boolean} [strict]
|
|
502
|
-
*
|
|
503
|
-
* @returns {any}
|
|
503
|
+
/**
|
|
504
|
+
* @param {string} type
|
|
505
|
+
* @param {boolean} [strict]
|
|
506
|
+
*
|
|
507
|
+
* @returns {any}
|
|
504
508
|
*/
|
|
505
509
|
function getService(type, strict) {}
|
|
506
510
|
const FormContext = createContext({
|
|
@@ -516,10 +520,10 @@ function useService(type, strict) {
|
|
|
516
520
|
return getService(type, strict);
|
|
517
521
|
}
|
|
518
522
|
|
|
519
|
-
/**
|
|
520
|
-
* Returns the conditionally filtered data of a form reactively.
|
|
521
|
-
* Memoised to minimize re-renders
|
|
522
|
-
*
|
|
523
|
+
/**
|
|
524
|
+
* Returns the conditionally filtered data of a form reactively.
|
|
525
|
+
* Memoised to minimize re-renders
|
|
526
|
+
*
|
|
523
527
|
*/
|
|
524
528
|
function useFilteredFormData() {
|
|
525
529
|
const {
|
|
@@ -536,12 +540,12 @@ function useFilteredFormData() {
|
|
|
536
540
|
}, [conditionChecker, data, initialData]);
|
|
537
541
|
}
|
|
538
542
|
|
|
539
|
-
/**
|
|
540
|
-
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
541
|
-
*
|
|
542
|
-
* @param {string | undefined} condition
|
|
543
|
-
*
|
|
544
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
543
|
+
/**
|
|
544
|
+
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
545
|
+
*
|
|
546
|
+
* @param {string | undefined} condition
|
|
547
|
+
*
|
|
548
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
545
549
|
*/
|
|
546
550
|
function useCondition(condition) {
|
|
547
551
|
const conditionChecker = useService('conditionChecker', false);
|
|
@@ -551,13 +555,13 @@ function useCondition(condition) {
|
|
|
551
555
|
}, [conditionChecker, condition, filteredData]);
|
|
552
556
|
}
|
|
553
557
|
|
|
554
|
-
/**
|
|
555
|
-
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
556
|
-
* If the string is not an expression, it is returned as is.
|
|
557
|
-
* Memoised to minimize re-renders.
|
|
558
|
-
*
|
|
559
|
-
* @param {string} value
|
|
560
|
-
*
|
|
558
|
+
/**
|
|
559
|
+
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
560
|
+
* If the string is not an expression, it is returned as is.
|
|
561
|
+
* Memoised to minimize re-renders.
|
|
562
|
+
*
|
|
563
|
+
* @param {string} value
|
|
564
|
+
*
|
|
561
565
|
*/
|
|
562
566
|
function useExpressionEvaluation(value) {
|
|
563
567
|
const formData = useFilteredFormData();
|
|
@@ -586,16 +590,16 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
|
586
590
|
});
|
|
587
591
|
}
|
|
588
592
|
|
|
589
|
-
/**
|
|
590
|
-
* Retrieve readonly value of a form field, given it can be an
|
|
591
|
-
* expression optionally or configured globally.
|
|
592
|
-
*
|
|
593
|
-
* @typedef { import('../../types').FormProperties } FormProperties
|
|
594
|
-
*
|
|
595
|
-
* @param {any} formField
|
|
596
|
-
* @param {FormProperties} properties
|
|
597
|
-
*
|
|
598
|
-
* @returns {boolean}
|
|
593
|
+
/**
|
|
594
|
+
* Retrieve readonly value of a form field, given it can be an
|
|
595
|
+
* expression optionally or configured globally.
|
|
596
|
+
*
|
|
597
|
+
* @typedef { import('../../types').FormProperties } FormProperties
|
|
598
|
+
*
|
|
599
|
+
* @param {any} formField
|
|
600
|
+
* @param {FormProperties} properties
|
|
601
|
+
*
|
|
602
|
+
* @returns {boolean}
|
|
599
603
|
*/
|
|
600
604
|
function useReadonly(formField, properties = {}) {
|
|
601
605
|
const expressionLanguage = useService('expressionLanguage');
|
|
@@ -619,12 +623,12 @@ function usePrevious(value, defaultValue, dependencies) {
|
|
|
619
623
|
return ref.current;
|
|
620
624
|
}
|
|
621
625
|
|
|
622
|
-
/**
|
|
623
|
-
* A custom hook to manage state changes with deep comparison.
|
|
624
|
-
*
|
|
625
|
-
* @param {any} value - The current value to manage.
|
|
626
|
-
* @param {any} defaultValue - The initial default value for the state.
|
|
627
|
-
* @returns {any} - Returns the current state.
|
|
626
|
+
/**
|
|
627
|
+
* A custom hook to manage state changes with deep comparison.
|
|
628
|
+
*
|
|
629
|
+
* @param {any} value - The current value to manage.
|
|
630
|
+
* @param {any} defaultValue - The initial default value for the state.
|
|
631
|
+
* @returns {any} - Returns the current state.
|
|
628
632
|
*/
|
|
629
633
|
function useDeepCompareState(value, defaultValue) {
|
|
630
634
|
const [state, setState] = useState(defaultValue);
|
|
@@ -644,16 +648,16 @@ function compare(a, b) {
|
|
|
644
648
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
645
649
|
}
|
|
646
650
|
|
|
647
|
-
/**
|
|
648
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
649
|
-
* Memoised to minimize re-renders
|
|
650
|
-
*
|
|
651
|
-
* @param {string} value
|
|
652
|
-
* @param {Object} options
|
|
653
|
-
* @param {boolean} [options.debug = false]
|
|
654
|
-
* @param {boolean} [options.strict = false]
|
|
655
|
-
* @param {Function} [options.buildDebugString]
|
|
656
|
-
*
|
|
651
|
+
/**
|
|
652
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
653
|
+
* Memoised to minimize re-renders
|
|
654
|
+
*
|
|
655
|
+
* @param {string} value
|
|
656
|
+
* @param {Object} options
|
|
657
|
+
* @param {boolean} [options.debug = false]
|
|
658
|
+
* @param {boolean} [options.strict = false]
|
|
659
|
+
* @param {Function} [options.buildDebugString]
|
|
660
|
+
*
|
|
657
661
|
*/
|
|
658
662
|
function useTemplateEvaluation(value, options) {
|
|
659
663
|
const filteredData = useFilteredFormData();
|
|
@@ -666,17 +670,17 @@ function useTemplateEvaluation(value, options) {
|
|
|
666
670
|
}, [filteredData, templating, value, options]);
|
|
667
671
|
}
|
|
668
672
|
|
|
669
|
-
/**
|
|
670
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
671
|
-
* If the string contains multiple lines, only the first line is returned.
|
|
672
|
-
* Memoised to minimize re-renders
|
|
673
|
-
*
|
|
674
|
-
* @param {string} value
|
|
675
|
-
* @param {Object} [options]
|
|
676
|
-
* @param {boolean} [options.debug = false]
|
|
677
|
-
* @param {boolean} [options.strict = false]
|
|
678
|
-
* @param {Function} [options.buildDebugString]
|
|
679
|
-
*
|
|
673
|
+
/**
|
|
674
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
675
|
+
* If the string contains multiple lines, only the first line is returned.
|
|
676
|
+
* Memoised to minimize re-renders
|
|
677
|
+
*
|
|
678
|
+
* @param {string} value
|
|
679
|
+
* @param {Object} [options]
|
|
680
|
+
* @param {boolean} [options.debug = false]
|
|
681
|
+
* @param {boolean} [options.strict = false]
|
|
682
|
+
* @param {Function} [options.buildDebugString]
|
|
683
|
+
*
|
|
680
684
|
*/
|
|
681
685
|
function useSingleLineTemplateEvaluation(value, options = {}) {
|
|
682
686
|
const evaluatedTemplate = useTemplateEvaluation(value, options);
|
|
@@ -743,12 +747,13 @@ function Label(props) {
|
|
|
743
747
|
});
|
|
744
748
|
}
|
|
745
749
|
|
|
746
|
-
const type$
|
|
750
|
+
const type$c = 'checkbox';
|
|
747
751
|
function Checkbox(props) {
|
|
748
752
|
const {
|
|
749
753
|
disabled,
|
|
750
754
|
errors = [],
|
|
751
755
|
onBlur,
|
|
756
|
+
onFocus,
|
|
752
757
|
field,
|
|
753
758
|
readonly,
|
|
754
759
|
value = false
|
|
@@ -775,7 +780,7 @@ function Checkbox(props) {
|
|
|
775
780
|
} = useContext(FormContext$1);
|
|
776
781
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
777
782
|
return jsxs("div", {
|
|
778
|
-
class: classNames(formFieldClasses(type$
|
|
783
|
+
class: classNames(formFieldClasses(type$c, {
|
|
779
784
|
errors,
|
|
780
785
|
disabled,
|
|
781
786
|
readonly
|
|
@@ -794,7 +799,8 @@ function Checkbox(props) {
|
|
|
794
799
|
id: prefixId(id, formId),
|
|
795
800
|
type: "checkbox",
|
|
796
801
|
onChange: onChange,
|
|
797
|
-
onBlur: onBlur,
|
|
802
|
+
onBlur: () => onBlur && onBlur(),
|
|
803
|
+
onFocus: () => onFocus && onFocus(),
|
|
798
804
|
"aria-describedby": errorMessageId
|
|
799
805
|
})
|
|
800
806
|
}), jsx(Description, {
|
|
@@ -806,7 +812,7 @@ function Checkbox(props) {
|
|
|
806
812
|
});
|
|
807
813
|
}
|
|
808
814
|
Checkbox.config = {
|
|
809
|
-
type: type$
|
|
815
|
+
type: type$c,
|
|
810
816
|
keyed: true,
|
|
811
817
|
label: 'Checkbox',
|
|
812
818
|
group: 'selection',
|
|
@@ -880,8 +886,8 @@ function createEmptyOptions(options = {}) {
|
|
|
880
886
|
};
|
|
881
887
|
}
|
|
882
888
|
|
|
883
|
-
/**
|
|
884
|
-
* @enum { String }
|
|
889
|
+
/**
|
|
890
|
+
* @enum { String }
|
|
885
891
|
*/
|
|
886
892
|
const LOAD_STATES = {
|
|
887
893
|
LOADING: 'loading',
|
|
@@ -889,17 +895,17 @@ const LOAD_STATES = {
|
|
|
889
895
|
ERROR: 'error'
|
|
890
896
|
};
|
|
891
897
|
|
|
892
|
-
/**
|
|
893
|
-
* @typedef {Object} ValuesGetter
|
|
894
|
-
* @property {Object[]} values - The values data
|
|
895
|
-
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
898
|
+
/**
|
|
899
|
+
* @typedef {Object} ValuesGetter
|
|
900
|
+
* @property {Object[]} values - The values data
|
|
901
|
+
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
896
902
|
*/
|
|
897
903
|
|
|
898
|
-
/**
|
|
899
|
-
* A hook to load values for single and multiselect components.
|
|
900
|
-
*
|
|
901
|
-
* @param {Object} field - The form field to handle values for
|
|
902
|
-
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
904
|
+
/**
|
|
905
|
+
* A hook to load values for single and multiselect components.
|
|
906
|
+
*
|
|
907
|
+
* @param {Object} field - The form field to handle values for
|
|
908
|
+
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
903
909
|
*/
|
|
904
910
|
function useValuesAsync (field) {
|
|
905
911
|
const {
|
|
@@ -1193,12 +1199,13 @@ function sanitizeMultiSelectValue(options) {
|
|
|
1193
1199
|
}
|
|
1194
1200
|
}
|
|
1195
1201
|
|
|
1196
|
-
const type$
|
|
1202
|
+
const type$b = 'checklist';
|
|
1197
1203
|
function Checklist(props) {
|
|
1198
1204
|
const {
|
|
1199
1205
|
disabled,
|
|
1200
1206
|
errors = [],
|
|
1201
1207
|
onBlur,
|
|
1208
|
+
onFocus,
|
|
1202
1209
|
field,
|
|
1203
1210
|
readonly,
|
|
1204
1211
|
value = []
|
|
@@ -1229,7 +1236,13 @@ function Checklist(props) {
|
|
|
1229
1236
|
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
1230
1237
|
return;
|
|
1231
1238
|
}
|
|
1232
|
-
onBlur();
|
|
1239
|
+
onBlur && onBlur();
|
|
1240
|
+
};
|
|
1241
|
+
const onCheckboxFocus = e => {
|
|
1242
|
+
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
onFocus && onFocus();
|
|
1233
1246
|
};
|
|
1234
1247
|
const {
|
|
1235
1248
|
state: loadState,
|
|
@@ -1240,7 +1253,7 @@ function Checklist(props) {
|
|
|
1240
1253
|
} = useContext(FormContext$1);
|
|
1241
1254
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
1242
1255
|
return jsxs("div", {
|
|
1243
|
-
class: classNames(formFieldClasses(type$
|
|
1256
|
+
class: classNames(formFieldClasses(type$b, {
|
|
1244
1257
|
errors,
|
|
1245
1258
|
disabled,
|
|
1246
1259
|
readonly
|
|
@@ -1266,6 +1279,7 @@ function Checklist(props) {
|
|
|
1266
1279
|
type: "checkbox",
|
|
1267
1280
|
onClick: () => toggleCheckbox(v.value),
|
|
1268
1281
|
onBlur: onCheckboxBlur,
|
|
1282
|
+
onFocus: onCheckboxFocus,
|
|
1269
1283
|
"aria-describedby": errorMessageId
|
|
1270
1284
|
})
|
|
1271
1285
|
}, `${id}-${index}`);
|
|
@@ -1278,7 +1292,7 @@ function Checklist(props) {
|
|
|
1278
1292
|
});
|
|
1279
1293
|
}
|
|
1280
1294
|
Checklist.config = {
|
|
1281
|
-
type: type$
|
|
1295
|
+
type: type$b,
|
|
1282
1296
|
keyed: true,
|
|
1283
1297
|
label: 'Checklist',
|
|
1284
1298
|
group: 'selection',
|
|
@@ -1296,6 +1310,7 @@ function FormField(props) {
|
|
|
1296
1310
|
const formFields = useService('formFields'),
|
|
1297
1311
|
viewerCommands = useService('viewerCommands', false),
|
|
1298
1312
|
pathRegistry = useService('pathRegistry'),
|
|
1313
|
+
eventBus = useService('eventBus'),
|
|
1299
1314
|
form = useService('form');
|
|
1300
1315
|
const {
|
|
1301
1316
|
initialData,
|
|
@@ -1323,7 +1338,15 @@ function FormField(props) {
|
|
|
1323
1338
|
if (viewerCommands) {
|
|
1324
1339
|
viewerCommands.updateFieldValidation(field, value);
|
|
1325
1340
|
}
|
|
1326
|
-
|
|
1341
|
+
eventBus.fire('formField.blur', {
|
|
1342
|
+
formField: field
|
|
1343
|
+
});
|
|
1344
|
+
}, [eventBus, viewerCommands, field, value]);
|
|
1345
|
+
const onFocus = useCallback(() => {
|
|
1346
|
+
eventBus.fire('formField.focus', {
|
|
1347
|
+
formField: field
|
|
1348
|
+
});
|
|
1349
|
+
}, [eventBus, field]);
|
|
1327
1350
|
useEffect(() => {
|
|
1328
1351
|
if (viewerCommands && initialValue) {
|
|
1329
1352
|
viewerCommands.updateFieldValidation(field, initialValue);
|
|
@@ -1345,6 +1368,7 @@ function FormField(props) {
|
|
|
1345
1368
|
errors: errors[field.id],
|
|
1346
1369
|
onChange: disabled || readonly ? noop$1 : onChange,
|
|
1347
1370
|
onBlur: disabled || readonly ? noop$1 : onBlur,
|
|
1371
|
+
onFocus: disabled || readonly ? noop$1 : onFocus,
|
|
1348
1372
|
readonly: readonly,
|
|
1349
1373
|
value: value
|
|
1350
1374
|
})
|
|
@@ -1420,16 +1444,16 @@ FormComponent$1.config = {
|
|
|
1420
1444
|
})
|
|
1421
1445
|
};
|
|
1422
1446
|
|
|
1423
|
-
var _path$
|
|
1424
|
-
function _extends$
|
|
1447
|
+
var _path$i;
|
|
1448
|
+
function _extends$l() { _extends$l = 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$l.apply(this, arguments); }
|
|
1425
1449
|
var SvgCalendar = function SvgCalendar(props) {
|
|
1426
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
1450
|
+
return /*#__PURE__*/React.createElement("svg", _extends$l({
|
|
1427
1451
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1428
1452
|
width: 14,
|
|
1429
1453
|
height: 15,
|
|
1430
1454
|
fill: "none",
|
|
1431
1455
|
viewBox: "0 0 28 30"
|
|
1432
|
-
}, props), _path$
|
|
1456
|
+
}, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
|
|
1433
1457
|
fill: "currentColor",
|
|
1434
1458
|
fillRule: "evenodd",
|
|
1435
1459
|
d: "M19 2H9V0H7v2H2a2 2 0 0 0-2 2v24a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-5V0h-2v2ZM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7Zm-5 4v17h24V11H2Z",
|
|
@@ -1438,12 +1462,12 @@ var SvgCalendar = function SvgCalendar(props) {
|
|
|
1438
1462
|
};
|
|
1439
1463
|
var CalendarIcon = SvgCalendar;
|
|
1440
1464
|
|
|
1441
|
-
/**
|
|
1442
|
-
* Returns date format for the provided locale.
|
|
1443
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1444
|
-
*
|
|
1445
|
-
* @param {string} [locale] - The locale to get date format for.
|
|
1446
|
-
* @returns {string} The date format for the locale.
|
|
1465
|
+
/**
|
|
1466
|
+
* Returns date format for the provided locale.
|
|
1467
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1468
|
+
*
|
|
1469
|
+
* @param {string} [locale] - The locale to get date format for.
|
|
1470
|
+
* @returns {string} The date format for the locale.
|
|
1447
1471
|
*/
|
|
1448
1472
|
function getLocaleDateFormat(locale = 'default') {
|
|
1449
1473
|
const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(Date.UTC(2020, 5, 5)));
|
|
@@ -1462,12 +1486,12 @@ function getLocaleDateFormat(locale = 'default') {
|
|
|
1462
1486
|
}).join('');
|
|
1463
1487
|
}
|
|
1464
1488
|
|
|
1465
|
-
/**
|
|
1466
|
-
* Returns readable date format for the provided locale.
|
|
1467
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1468
|
-
*
|
|
1469
|
-
* @param {string} [locale] - The locale to get readable date format for.
|
|
1470
|
-
* @returns {string} The readable date format for the locale.
|
|
1489
|
+
/**
|
|
1490
|
+
* Returns readable date format for the provided locale.
|
|
1491
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1492
|
+
*
|
|
1493
|
+
* @param {string} [locale] - The locale to get readable date format for.
|
|
1494
|
+
* @returns {string} The readable date format for the locale.
|
|
1471
1495
|
*/
|
|
1472
1496
|
function getLocaleReadableDateFormat(locale) {
|
|
1473
1497
|
let format = getLocaleDateFormat(locale).toLowerCase();
|
|
@@ -1484,12 +1508,12 @@ function getLocaleReadableDateFormat(locale) {
|
|
|
1484
1508
|
return format;
|
|
1485
1509
|
}
|
|
1486
1510
|
|
|
1487
|
-
/**
|
|
1488
|
-
* Returns flatpickr config for the provided locale.
|
|
1489
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1490
|
-
*
|
|
1491
|
-
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1492
|
-
* @returns {object} The flatpickr config for the locale.
|
|
1511
|
+
/**
|
|
1512
|
+
* Returns flatpickr config for the provided locale.
|
|
1513
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1514
|
+
*
|
|
1515
|
+
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1516
|
+
* @returns {object} The flatpickr config for the locale.
|
|
1493
1517
|
*/
|
|
1494
1518
|
function getLocaleDateFlatpickrConfig(locale) {
|
|
1495
1519
|
return flatpickerizeDateFormat(getLocaleDateFormat(locale));
|
|
@@ -1550,6 +1574,7 @@ function Datepicker(props) {
|
|
|
1550
1574
|
label,
|
|
1551
1575
|
collapseLabelOnEmpty,
|
|
1552
1576
|
onDateTimeBlur,
|
|
1577
|
+
onDateTimeFocus,
|
|
1553
1578
|
formId,
|
|
1554
1579
|
required,
|
|
1555
1580
|
disabled,
|
|
@@ -1637,13 +1662,17 @@ function Datepicker(props) {
|
|
|
1637
1662
|
const onInputFocus = useCallback(e => {
|
|
1638
1663
|
if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget) || readonly) return;
|
|
1639
1664
|
flatpickrInstance.open();
|
|
1640
|
-
|
|
1665
|
+
onDateTimeFocus(e);
|
|
1666
|
+
}, [flatpickrInstance, readonly, onDateTimeFocus]);
|
|
1641
1667
|
|
|
1642
1668
|
// simulate an enter press on blur to make sure the date value is submitted in all scenarios
|
|
1643
1669
|
const onInputBlur = useCallback(e => {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1670
|
+
const isFalseBlur = e.relatedTarget && e.relatedTarget.classList.contains('flatpickr-day');
|
|
1671
|
+
if (isFalseBlur) return;
|
|
1672
|
+
if (isInputDirty) {
|
|
1673
|
+
dateInputRef.current.dispatchEvent(ENTER_KEYDOWN_EVENT);
|
|
1674
|
+
setIsInputDirty(false);
|
|
1675
|
+
}
|
|
1647
1676
|
onDateTimeBlur(e);
|
|
1648
1677
|
}, [isInputDirty, onDateTimeBlur]);
|
|
1649
1678
|
const fullId = `${prefixId(id, formId)}--date`;
|
|
@@ -1675,9 +1704,9 @@ function Datepicker(props) {
|
|
|
1675
1704
|
placeholder: getLocaleReadableDateFormat(),
|
|
1676
1705
|
autoComplete: "off",
|
|
1677
1706
|
onFocus: onInputFocus,
|
|
1707
|
+
onBlur: onInputBlur,
|
|
1678
1708
|
onKeyDown: onInputKeyDown,
|
|
1679
1709
|
onMouseDown: () => !flatpickrInstance.isOpen && !readonly && flatpickrInstance.open(),
|
|
1680
|
-
onBlur: onInputBlur,
|
|
1681
1710
|
onInput: () => setIsInputDirty(true),
|
|
1682
1711
|
"data-input": true,
|
|
1683
1712
|
"aria-describedby": props['aria-describedby']
|
|
@@ -1687,19 +1716,19 @@ function Datepicker(props) {
|
|
|
1687
1716
|
});
|
|
1688
1717
|
}
|
|
1689
1718
|
|
|
1690
|
-
var _path$
|
|
1691
|
-
function _extends$
|
|
1719
|
+
var _path$h, _path2$3;
|
|
1720
|
+
function _extends$k() { _extends$k = 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$k.apply(this, arguments); }
|
|
1692
1721
|
var SvgClock = function SvgClock(props) {
|
|
1693
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
1722
|
+
return /*#__PURE__*/React.createElement("svg", _extends$k({
|
|
1694
1723
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1695
1724
|
width: 16,
|
|
1696
1725
|
height: 16,
|
|
1697
1726
|
fill: "none",
|
|
1698
1727
|
viewBox: "0 0 28 29"
|
|
1699
|
-
}, props), _path$
|
|
1728
|
+
}, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
|
|
1700
1729
|
fill: "currentColor",
|
|
1701
1730
|
d: "M13 14.41 18.59 20 20 18.59l-5-5.01V5h-2v9.41Z"
|
|
1702
|
-
})), _path2$
|
|
1731
|
+
})), _path2$3 || (_path2$3 = /*#__PURE__*/React.createElement("path", {
|
|
1703
1732
|
fill: "currentColor",
|
|
1704
1733
|
fillRule: "evenodd",
|
|
1705
1734
|
d: "M6.222 25.64A14 14 0 1 0 21.778 2.36 14 14 0 0 0 6.222 25.64ZM7.333 4.023a12 12 0 1 1 13.334 19.955A12 12 0 0 1 7.333 4.022Z",
|
|
@@ -1810,6 +1839,7 @@ function Timepicker(props) {
|
|
|
1810
1839
|
label,
|
|
1811
1840
|
collapseLabelOnEmpty,
|
|
1812
1841
|
onDateTimeBlur,
|
|
1842
|
+
onDateTimeFocus,
|
|
1813
1843
|
formId,
|
|
1814
1844
|
required,
|
|
1815
1845
|
disabled,
|
|
@@ -1911,6 +1941,10 @@ function Timepicker(props) {
|
|
|
1911
1941
|
propagateRawToMinute();
|
|
1912
1942
|
onDateTimeBlur(e);
|
|
1913
1943
|
};
|
|
1944
|
+
const onInputFocus = e => {
|
|
1945
|
+
onDateTimeFocus(e);
|
|
1946
|
+
!readonly && useDropdown && setDropdownIsOpen(true);
|
|
1947
|
+
};
|
|
1914
1948
|
const onDropdownValueSelected = value => {
|
|
1915
1949
|
setDropdownIsOpen(false);
|
|
1916
1950
|
propagateRawToMinute(value);
|
|
@@ -1939,9 +1973,7 @@ function Timepicker(props) {
|
|
|
1939
1973
|
disabled: disabled,
|
|
1940
1974
|
readOnly: readonly,
|
|
1941
1975
|
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
1942
|
-
autoComplete: "off"
|
|
1943
|
-
onFocus: () => !readonly && useDropdown && setDropdownIsOpen(true),
|
|
1944
|
-
onClick: () => !readonly && useDropdown && setDropdownIsOpen(true)
|
|
1976
|
+
autoComplete: "off"
|
|
1945
1977
|
|
|
1946
1978
|
// @ts-ignore
|
|
1947
1979
|
,
|
|
@@ -1950,6 +1982,8 @@ function Timepicker(props) {
|
|
|
1950
1982
|
useDropdown && setDropdownIsOpen(false);
|
|
1951
1983
|
},
|
|
1952
1984
|
onBlur: onInputBlur,
|
|
1985
|
+
onFocus: onInputFocus,
|
|
1986
|
+
onClick: () => !readonly && useDropdown && setDropdownIsOpen(true),
|
|
1953
1987
|
onKeyDown: onInputKeyDown,
|
|
1954
1988
|
"data-input": true,
|
|
1955
1989
|
"aria-describedby": props['aria-describedby']
|
|
@@ -1965,12 +1999,13 @@ function Timepicker(props) {
|
|
|
1965
1999
|
});
|
|
1966
2000
|
}
|
|
1967
2001
|
|
|
1968
|
-
const type$
|
|
2002
|
+
const type$a = 'datetime';
|
|
1969
2003
|
function Datetime(props) {
|
|
1970
2004
|
const {
|
|
1971
2005
|
disabled,
|
|
1972
2006
|
errors = [],
|
|
1973
2007
|
onBlur,
|
|
2008
|
+
onFocus,
|
|
1974
2009
|
field,
|
|
1975
2010
|
onChange,
|
|
1976
2011
|
readonly,
|
|
@@ -2009,8 +2044,14 @@ function Datetime(props) {
|
|
|
2009
2044
|
if (e.relatedTarget && dateTimeGroupRef.current.contains(e.relatedTarget)) {
|
|
2010
2045
|
return;
|
|
2011
2046
|
}
|
|
2012
|
-
onBlur();
|
|
2047
|
+
onBlur && onBlur();
|
|
2013
2048
|
}, [onBlur]);
|
|
2049
|
+
const onDateTimeFocus = useCallback(e => {
|
|
2050
|
+
if (e.relatedTarget && dateTimeGroupRef.current.contains(e.relatedTarget)) {
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
onFocus && onFocus();
|
|
2054
|
+
}, [onFocus]);
|
|
2014
2055
|
useEffect(() => {
|
|
2015
2056
|
let {
|
|
2016
2057
|
date,
|
|
@@ -2103,6 +2144,7 @@ function Datetime(props) {
|
|
|
2103
2144
|
label: dateLabel,
|
|
2104
2145
|
collapseLabelOnEmpty: !timeLabel,
|
|
2105
2146
|
onDateTimeBlur,
|
|
2147
|
+
onDateTimeFocus,
|
|
2106
2148
|
formId,
|
|
2107
2149
|
required,
|
|
2108
2150
|
disabled,
|
|
@@ -2117,6 +2159,7 @@ function Datetime(props) {
|
|
|
2117
2159
|
label: timeLabel,
|
|
2118
2160
|
collapseLabelOnEmpty: !dateLabel,
|
|
2119
2161
|
onDateTimeBlur,
|
|
2162
|
+
onDateTimeFocus,
|
|
2120
2163
|
formId,
|
|
2121
2164
|
required,
|
|
2122
2165
|
disabled,
|
|
@@ -2128,7 +2171,7 @@ function Datetime(props) {
|
|
|
2128
2171
|
'aria-describedby': errorMessageId
|
|
2129
2172
|
};
|
|
2130
2173
|
return jsxs("div", {
|
|
2131
|
-
class: formFieldClasses(type$
|
|
2174
|
+
class: formFieldClasses(type$a, {
|
|
2132
2175
|
errors: allErrors,
|
|
2133
2176
|
disabled,
|
|
2134
2177
|
readonly
|
|
@@ -2152,7 +2195,7 @@ function Datetime(props) {
|
|
|
2152
2195
|
});
|
|
2153
2196
|
}
|
|
2154
2197
|
Datetime.config = {
|
|
2155
|
-
type: type$
|
|
2198
|
+
type: type$a,
|
|
2156
2199
|
keyed: true,
|
|
2157
2200
|
label: 'Date time',
|
|
2158
2201
|
group: 'basic-input',
|
|
@@ -2169,10 +2212,10 @@ Datetime.config = {
|
|
|
2169
2212
|
}
|
|
2170
2213
|
};
|
|
2171
2214
|
|
|
2172
|
-
/**
|
|
2173
|
-
* This file must not be changed or exchanged.
|
|
2174
|
-
*
|
|
2175
|
-
* @see http://bpmn.io/license for more information.
|
|
2215
|
+
/**
|
|
2216
|
+
* This file must not be changed or exchanged.
|
|
2217
|
+
*
|
|
2218
|
+
* @see http://bpmn.io/license for more information.
|
|
2176
2219
|
*/
|
|
2177
2220
|
function Logo() {
|
|
2178
2221
|
return jsxs("svg", {
|
|
@@ -2350,11 +2393,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
2350
2393
|
|
|
2351
2394
|
const FORM_ELEMENT = document.createElement('form');
|
|
2352
2395
|
|
|
2353
|
-
/**
|
|
2354
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2355
|
-
*
|
|
2356
|
-
* @param {string} html
|
|
2357
|
-
* @return {string}
|
|
2396
|
+
/**
|
|
2397
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2398
|
+
*
|
|
2399
|
+
* @param {string} html
|
|
2400
|
+
* @return {string}
|
|
2358
2401
|
*/
|
|
2359
2402
|
|
|
2360
2403
|
// see https://github.com/developit/snarkdown/issues/70
|
|
@@ -2372,29 +2415,29 @@ function sanitizeHTML(html) {
|
|
|
2372
2415
|
}
|
|
2373
2416
|
}
|
|
2374
2417
|
|
|
2375
|
-
/**
|
|
2376
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2377
|
-
* that start with http(s).
|
|
2378
|
-
*
|
|
2379
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2380
|
-
*
|
|
2381
|
-
* @param {string} src
|
|
2382
|
-
* @returns {string}
|
|
2418
|
+
/**
|
|
2419
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2420
|
+
* that start with http(s).
|
|
2421
|
+
*
|
|
2422
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2423
|
+
*
|
|
2424
|
+
* @param {string} src
|
|
2425
|
+
* @returns {string}
|
|
2383
2426
|
*/
|
|
2384
2427
|
function sanitizeImageSource(src) {
|
|
2385
2428
|
const valid = ALLOWED_IMAGE_SRC_PATTERN.test(src);
|
|
2386
2429
|
return valid ? src : '';
|
|
2387
2430
|
}
|
|
2388
2431
|
|
|
2389
|
-
/**
|
|
2390
|
-
* Recursively sanitize a HTML node, potentially
|
|
2391
|
-
* removing it, its children or attributes.
|
|
2392
|
-
*
|
|
2393
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2394
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2395
|
-
* for our use-case.
|
|
2396
|
-
*
|
|
2397
|
-
* @param {Element} node
|
|
2432
|
+
/**
|
|
2433
|
+
* Recursively sanitize a HTML node, potentially
|
|
2434
|
+
* removing it, its children or attributes.
|
|
2435
|
+
*
|
|
2436
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2437
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2438
|
+
* for our use-case.
|
|
2439
|
+
*
|
|
2440
|
+
* @param {Element} node
|
|
2398
2441
|
*/
|
|
2399
2442
|
function sanitizeNode(node) {
|
|
2400
2443
|
// allow text nodes
|
|
@@ -2438,13 +2481,13 @@ function sanitizeNode(node) {
|
|
|
2438
2481
|
}
|
|
2439
2482
|
}
|
|
2440
2483
|
|
|
2441
|
-
/**
|
|
2442
|
-
* Validates attributes for validity.
|
|
2443
|
-
*
|
|
2444
|
-
* @param {string} lcTag
|
|
2445
|
-
* @param {string} lcName
|
|
2446
|
-
* @param {string} value
|
|
2447
|
-
* @return {boolean}
|
|
2484
|
+
/**
|
|
2485
|
+
* Validates attributes for validity.
|
|
2486
|
+
*
|
|
2487
|
+
* @param {string} lcTag
|
|
2488
|
+
* @param {string} lcName
|
|
2489
|
+
* @param {string} value
|
|
2490
|
+
* @return {boolean}
|
|
2448
2491
|
*/
|
|
2449
2492
|
function isValidAttribute(lcTag, lcName, value) {
|
|
2450
2493
|
// disallow most attributes based on whitelist
|
|
@@ -2467,9 +2510,9 @@ function isValidAttribute(lcTag, lcName, value) {
|
|
|
2467
2510
|
return true;
|
|
2468
2511
|
}
|
|
2469
2512
|
|
|
2470
|
-
function _extends$
|
|
2513
|
+
function _extends$j() { _extends$j = 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$j.apply(this, arguments); }
|
|
2471
2514
|
var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
|
|
2472
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
2515
|
+
return /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
2473
2516
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2474
2517
|
xmlSpace: "preserve",
|
|
2475
2518
|
width: 64,
|
|
@@ -2508,7 +2551,7 @@ var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
|
|
|
2508
2551
|
};
|
|
2509
2552
|
var ImagePlaceholder = SvgImagePlaceholder;
|
|
2510
2553
|
|
|
2511
|
-
const type$
|
|
2554
|
+
const type$9 = 'image';
|
|
2512
2555
|
function Image(props) {
|
|
2513
2556
|
const {
|
|
2514
2557
|
field
|
|
@@ -2529,7 +2572,7 @@ function Image(props) {
|
|
|
2529
2572
|
formId
|
|
2530
2573
|
} = useContext(FormContext$1);
|
|
2531
2574
|
return jsx("div", {
|
|
2532
|
-
class: formFieldClasses(type$
|
|
2575
|
+
class: formFieldClasses(type$9),
|
|
2533
2576
|
children: jsxs("div", {
|
|
2534
2577
|
class: "fjs-image-container",
|
|
2535
2578
|
children: [safeSource && jsx("img", {
|
|
@@ -2547,7 +2590,7 @@ function Image(props) {
|
|
|
2547
2590
|
});
|
|
2548
2591
|
}
|
|
2549
2592
|
Image.config = {
|
|
2550
|
-
type: type$
|
|
2593
|
+
type: type$9,
|
|
2551
2594
|
keyed: false,
|
|
2552
2595
|
label: 'Image view',
|
|
2553
2596
|
group: 'presentation',
|
|
@@ -2574,14 +2617,14 @@ function TemplatedInputAdorner(props) {
|
|
|
2574
2617
|
});
|
|
2575
2618
|
}
|
|
2576
2619
|
|
|
2577
|
-
var _path$
|
|
2578
|
-
function _extends$
|
|
2620
|
+
var _path$g;
|
|
2621
|
+
function _extends$i() { _extends$i = 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$i.apply(this, arguments); }
|
|
2579
2622
|
var SvgAngelDown = function SvgAngelDown(props) {
|
|
2580
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
2623
|
+
return /*#__PURE__*/React.createElement("svg", _extends$i({
|
|
2581
2624
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2582
2625
|
width: 8,
|
|
2583
2626
|
height: 8
|
|
2584
|
-
}, props), _path$
|
|
2627
|
+
}, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
|
|
2585
2628
|
fill: "currentColor",
|
|
2586
2629
|
fillRule: "evenodd",
|
|
2587
2630
|
stroke: "currentColor",
|
|
@@ -2592,14 +2635,14 @@ var SvgAngelDown = function SvgAngelDown(props) {
|
|
|
2592
2635
|
};
|
|
2593
2636
|
var AngelDownIcon = SvgAngelDown;
|
|
2594
2637
|
|
|
2595
|
-
var _path$
|
|
2596
|
-
function _extends$
|
|
2638
|
+
var _path$f;
|
|
2639
|
+
function _extends$h() { _extends$h = 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$h.apply(this, arguments); }
|
|
2597
2640
|
var SvgAngelUp = function SvgAngelUp(props) {
|
|
2598
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
2641
|
+
return /*#__PURE__*/React.createElement("svg", _extends$h({
|
|
2599
2642
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2600
2643
|
width: 8,
|
|
2601
2644
|
height: 8
|
|
2602
|
-
}, props), _path$
|
|
2645
|
+
}, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
|
|
2603
2646
|
fill: "currentColor",
|
|
2604
2647
|
fillRule: "evenodd",
|
|
2605
2648
|
stroke: "currentColor",
|
|
@@ -2635,12 +2678,13 @@ function isNullEquivalentValue(value) {
|
|
|
2635
2678
|
return value === undefined || value === null || value === '';
|
|
2636
2679
|
}
|
|
2637
2680
|
|
|
2638
|
-
const type$
|
|
2681
|
+
const type$8 = 'number';
|
|
2639
2682
|
function Numberfield(props) {
|
|
2640
2683
|
const {
|
|
2641
2684
|
disabled,
|
|
2642
2685
|
errors = [],
|
|
2643
2686
|
onBlur,
|
|
2687
|
+
onFocus,
|
|
2644
2688
|
field,
|
|
2645
2689
|
value,
|
|
2646
2690
|
readonly,
|
|
@@ -2773,7 +2817,7 @@ function Numberfield(props) {
|
|
|
2773
2817
|
} = useContext(FormContext$1);
|
|
2774
2818
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
2775
2819
|
return jsxs("div", {
|
|
2776
|
-
class: formFieldClasses(type$
|
|
2820
|
+
class: formFieldClasses(type$8, {
|
|
2777
2821
|
errors,
|
|
2778
2822
|
disabled,
|
|
2779
2823
|
readonly
|
|
@@ -2802,7 +2846,8 @@ function Numberfield(props) {
|
|
|
2802
2846
|
id: prefixId(id, formId),
|
|
2803
2847
|
onKeyDown: onKeyDown,
|
|
2804
2848
|
onKeyPress: onKeyPress,
|
|
2805
|
-
onBlur: onBlur
|
|
2849
|
+
onBlur: () => onBlur && onBlur(),
|
|
2850
|
+
onFocus: () => onFocus && onFocus()
|
|
2806
2851
|
|
|
2807
2852
|
// @ts-ignore
|
|
2808
2853
|
,
|
|
@@ -2845,7 +2890,7 @@ function Numberfield(props) {
|
|
|
2845
2890
|
});
|
|
2846
2891
|
}
|
|
2847
2892
|
Numberfield.config = {
|
|
2848
|
-
type: type$
|
|
2893
|
+
type: type$8,
|
|
2849
2894
|
keyed: true,
|
|
2850
2895
|
label: 'Number',
|
|
2851
2896
|
group: 'basic-input',
|
|
@@ -2868,12 +2913,13 @@ Numberfield.config = {
|
|
|
2868
2913
|
})
|
|
2869
2914
|
};
|
|
2870
2915
|
|
|
2871
|
-
const type$
|
|
2916
|
+
const type$7 = 'radio';
|
|
2872
2917
|
function Radio(props) {
|
|
2873
2918
|
const {
|
|
2874
2919
|
disabled,
|
|
2875
2920
|
errors = [],
|
|
2876
2921
|
onBlur,
|
|
2922
|
+
onFocus,
|
|
2877
2923
|
field,
|
|
2878
2924
|
readonly,
|
|
2879
2925
|
value
|
|
@@ -2898,7 +2944,13 @@ function Radio(props) {
|
|
|
2898
2944
|
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
2899
2945
|
return;
|
|
2900
2946
|
}
|
|
2901
|
-
onBlur();
|
|
2947
|
+
onBlur && onBlur();
|
|
2948
|
+
};
|
|
2949
|
+
const onRadioFocus = e => {
|
|
2950
|
+
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
onFocus && onFocus();
|
|
2902
2954
|
};
|
|
2903
2955
|
const {
|
|
2904
2956
|
state: loadState,
|
|
@@ -2909,7 +2961,7 @@ function Radio(props) {
|
|
|
2909
2961
|
} = useContext(FormContext$1);
|
|
2910
2962
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
2911
2963
|
return jsxs("div", {
|
|
2912
|
-
class: formFieldClasses(type$
|
|
2964
|
+
class: formFieldClasses(type$7, {
|
|
2913
2965
|
errors,
|
|
2914
2966
|
disabled,
|
|
2915
2967
|
readonly
|
|
@@ -2935,6 +2987,7 @@ function Radio(props) {
|
|
|
2935
2987
|
type: "radio",
|
|
2936
2988
|
onClick: () => onChange(option.value),
|
|
2937
2989
|
onBlur: onRadioBlur,
|
|
2990
|
+
onFocus: onRadioFocus,
|
|
2938
2991
|
"aria-describedby": errorMessageId
|
|
2939
2992
|
})
|
|
2940
2993
|
}, `${id}-${index}`);
|
|
@@ -2947,7 +3000,7 @@ function Radio(props) {
|
|
|
2947
3000
|
});
|
|
2948
3001
|
}
|
|
2949
3002
|
Radio.config = {
|
|
2950
|
-
type: type$
|
|
3003
|
+
type: type$7,
|
|
2951
3004
|
keyed: true,
|
|
2952
3005
|
label: 'Radio',
|
|
2953
3006
|
group: 'selection',
|
|
@@ -2956,14 +3009,14 @@ Radio.config = {
|
|
|
2956
3009
|
create: createEmptyOptions
|
|
2957
3010
|
};
|
|
2958
3011
|
|
|
2959
|
-
var _path$
|
|
2960
|
-
function _extends$
|
|
3012
|
+
var _path$e;
|
|
3013
|
+
function _extends$g() { _extends$g = 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$g.apply(this, arguments); }
|
|
2961
3014
|
var SvgXMark = function SvgXMark(props) {
|
|
2962
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3015
|
+
return /*#__PURE__*/React.createElement("svg", _extends$g({
|
|
2963
3016
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2964
3017
|
width: 8,
|
|
2965
3018
|
height: 8
|
|
2966
|
-
}, props), _path$
|
|
3019
|
+
}, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
|
|
2967
3020
|
fill: "currentColor",
|
|
2968
3021
|
fillRule: "evenodd",
|
|
2969
3022
|
stroke: "currentColor",
|
|
@@ -2980,6 +3033,7 @@ function SearchableSelect(props) {
|
|
|
2980
3033
|
disabled,
|
|
2981
3034
|
errors,
|
|
2982
3035
|
onBlur,
|
|
3036
|
+
onFocus,
|
|
2983
3037
|
field,
|
|
2984
3038
|
readonly,
|
|
2985
3039
|
value
|
|
@@ -2992,6 +3046,7 @@ function SearchableSelect(props) {
|
|
|
2992
3046
|
const [shouldApplyFilter, setShouldApplyFilter] = useState(true);
|
|
2993
3047
|
const [isEscapeClosed, setIsEscapeClose] = useState(false);
|
|
2994
3048
|
const searchbarRef = useRef();
|
|
3049
|
+
const eventBus = useService('eventBus');
|
|
2995
3050
|
const {
|
|
2996
3051
|
state: loadState,
|
|
2997
3052
|
values: options
|
|
@@ -3013,14 +3068,6 @@ function SearchableSelect(props) {
|
|
|
3013
3068
|
}
|
|
3014
3069
|
return [];
|
|
3015
3070
|
}, [filter, loadState, options, shouldApplyFilter]);
|
|
3016
|
-
const onChange = ({
|
|
3017
|
-
target
|
|
3018
|
-
}) => {
|
|
3019
|
-
setIsEscapeClose(false);
|
|
3020
|
-
setIsDropdownExpanded(true);
|
|
3021
|
-
setShouldApplyFilter(true);
|
|
3022
|
-
setFilter(target.value || '');
|
|
3023
|
-
};
|
|
3024
3071
|
const setValue = useCallback(option => {
|
|
3025
3072
|
setFilter(option && option.label || '');
|
|
3026
3073
|
props.onChange({
|
|
@@ -3028,6 +3075,32 @@ function SearchableSelect(props) {
|
|
|
3028
3075
|
field
|
|
3029
3076
|
});
|
|
3030
3077
|
}, [field, props]);
|
|
3078
|
+
const displayState = useMemo(() => {
|
|
3079
|
+
const ds = {};
|
|
3080
|
+
ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
|
|
3081
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3082
|
+
ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
|
|
3083
|
+
return ds;
|
|
3084
|
+
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
|
|
3085
|
+
const onAngelMouseDown = useCallback(e => {
|
|
3086
|
+
setIsEscapeClose(false);
|
|
3087
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3088
|
+
const searchbar = searchbarRef.current;
|
|
3089
|
+
isDropdownExpanded ? searchbar.blur() : searchbar.focus();
|
|
3090
|
+
e.preventDefault();
|
|
3091
|
+
}, [isDropdownExpanded]);
|
|
3092
|
+
const onInputChange = ({
|
|
3093
|
+
target
|
|
3094
|
+
}) => {
|
|
3095
|
+
setIsEscapeClose(false);
|
|
3096
|
+
setIsDropdownExpanded(true);
|
|
3097
|
+
setShouldApplyFilter(true);
|
|
3098
|
+
setFilter(target.value || '');
|
|
3099
|
+
eventBus.fire('formField.search', {
|
|
3100
|
+
formField: field,
|
|
3101
|
+
value: target.value || ''
|
|
3102
|
+
});
|
|
3103
|
+
};
|
|
3031
3104
|
const onInputKeyDown = useCallback(keyDownEvent => {
|
|
3032
3105
|
switch (keyDownEvent.key) {
|
|
3033
3106
|
case 'ArrowUp':
|
|
@@ -3052,20 +3125,21 @@ function SearchableSelect(props) {
|
|
|
3052
3125
|
break;
|
|
3053
3126
|
}
|
|
3054
3127
|
}, [isDropdownExpanded, isEscapeClosed]);
|
|
3055
|
-
const
|
|
3056
|
-
const ds = {};
|
|
3057
|
-
ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
|
|
3058
|
-
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3059
|
-
ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
|
|
3060
|
-
return ds;
|
|
3061
|
-
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
|
|
3062
|
-
const onAngelMouseDown = useCallback(e => {
|
|
3128
|
+
const onInputMouseDown = useCallback(() => {
|
|
3063
3129
|
setIsEscapeClose(false);
|
|
3064
|
-
setIsDropdownExpanded(
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3130
|
+
setIsDropdownExpanded(true);
|
|
3131
|
+
setShouldApplyFilter(false);
|
|
3132
|
+
}, []);
|
|
3133
|
+
const onInputFocus = useCallback(() => {
|
|
3134
|
+
setIsEscapeClose(false);
|
|
3135
|
+
setIsDropdownExpanded(true);
|
|
3136
|
+
onFocus && onFocus();
|
|
3137
|
+
}, [onFocus]);
|
|
3138
|
+
const onInputBlur = useCallback(() => {
|
|
3139
|
+
setIsDropdownExpanded(false);
|
|
3140
|
+
setFilter(valueLabel);
|
|
3141
|
+
onBlur && onBlur();
|
|
3142
|
+
}, [onBlur, valueLabel]);
|
|
3069
3143
|
return jsxs(Fragment$1, {
|
|
3070
3144
|
children: [jsxs("div", {
|
|
3071
3145
|
id: prefixId(`${id}`, formId),
|
|
@@ -3081,26 +3155,15 @@ function SearchableSelect(props) {
|
|
|
3081
3155
|
class: "fjs-input",
|
|
3082
3156
|
ref: searchbarRef,
|
|
3083
3157
|
id: prefixId(`${id}-search`, formId),
|
|
3084
|
-
onChange:
|
|
3158
|
+
onChange: onInputChange,
|
|
3085
3159
|
type: "text",
|
|
3086
3160
|
value: filter,
|
|
3087
3161
|
placeholder: 'Search',
|
|
3088
3162
|
autoComplete: "off",
|
|
3089
|
-
onKeyDown:
|
|
3090
|
-
onMouseDown:
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
setShouldApplyFilter(false);
|
|
3094
|
-
},
|
|
3095
|
-
onFocus: () => {
|
|
3096
|
-
setIsDropdownExpanded(true);
|
|
3097
|
-
setShouldApplyFilter(false);
|
|
3098
|
-
},
|
|
3099
|
-
onBlur: () => {
|
|
3100
|
-
setIsDropdownExpanded(false);
|
|
3101
|
-
setFilter(valueLabel);
|
|
3102
|
-
onBlur();
|
|
3103
|
-
},
|
|
3163
|
+
onKeyDown: onInputKeyDown,
|
|
3164
|
+
onMouseDown: onInputMouseDown,
|
|
3165
|
+
onFocus: onInputFocus,
|
|
3166
|
+
onBlur: onInputBlur,
|
|
3104
3167
|
"aria-describedby": props['aria-describedby']
|
|
3105
3168
|
}), displayState.displayCross && jsxs("span", {
|
|
3106
3169
|
class: "fjs-select-cross",
|
|
@@ -3135,6 +3198,7 @@ function SimpleSelect(props) {
|
|
|
3135
3198
|
disabled,
|
|
3136
3199
|
errors,
|
|
3137
3200
|
onBlur,
|
|
3201
|
+
onFocus,
|
|
3138
3202
|
field,
|
|
3139
3203
|
readonly,
|
|
3140
3204
|
value
|
|
@@ -3178,6 +3242,18 @@ function SimpleSelect(props) {
|
|
|
3178
3242
|
e.preventDefault();
|
|
3179
3243
|
}, [isDropdownExpanded]);
|
|
3180
3244
|
const initialFocusIndex = useMemo(() => value && findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3245
|
+
const onInputFocus = useCallback(() => {
|
|
3246
|
+
if (!readonly) {
|
|
3247
|
+
setIsDropdownExpanded(true);
|
|
3248
|
+
onFocus && onFocus();
|
|
3249
|
+
}
|
|
3250
|
+
}, [onFocus, readonly]);
|
|
3251
|
+
const onInputBlur = useCallback(() => {
|
|
3252
|
+
if (!readonly) {
|
|
3253
|
+
setIsDropdownExpanded(false);
|
|
3254
|
+
onBlur && onBlur();
|
|
3255
|
+
}
|
|
3256
|
+
}, [onBlur, readonly]);
|
|
3181
3257
|
return jsxs(Fragment$1, {
|
|
3182
3258
|
children: [jsxs("div", {
|
|
3183
3259
|
ref: selectRef,
|
|
@@ -3188,11 +3264,8 @@ function SimpleSelect(props) {
|
|
|
3188
3264
|
}, {
|
|
3189
3265
|
'hasErrors': errors.length
|
|
3190
3266
|
}),
|
|
3191
|
-
onFocus:
|
|
3192
|
-
onBlur:
|
|
3193
|
-
setIsDropdownExpanded(false);
|
|
3194
|
-
onBlur();
|
|
3195
|
-
},
|
|
3267
|
+
onFocus: onInputFocus,
|
|
3268
|
+
onBlur: onInputBlur,
|
|
3196
3269
|
onMouseDown: onMouseDown,
|
|
3197
3270
|
children: [jsx("div", {
|
|
3198
3271
|
class: classNames('fjs-select-display', {
|
|
@@ -3204,8 +3277,8 @@ function SimpleSelect(props) {
|
|
|
3204
3277
|
id: prefixId(`${id}-search`, formId),
|
|
3205
3278
|
class: "fjs-select-hidden-input",
|
|
3206
3279
|
value: valueLabel,
|
|
3207
|
-
onFocus:
|
|
3208
|
-
onBlur:
|
|
3280
|
+
onFocus: onInputFocus,
|
|
3281
|
+
onBlur: onInputBlur,
|
|
3209
3282
|
"aria-describedby": props['aria-describedby']
|
|
3210
3283
|
}), displayState.displayCross && jsx("span", {
|
|
3211
3284
|
class: "fjs-select-cross",
|
|
@@ -3234,12 +3307,13 @@ function SimpleSelect(props) {
|
|
|
3234
3307
|
});
|
|
3235
3308
|
}
|
|
3236
3309
|
|
|
3237
|
-
const type$
|
|
3310
|
+
const type$6 = 'select';
|
|
3238
3311
|
function Select(props) {
|
|
3239
3312
|
const {
|
|
3240
3313
|
disabled,
|
|
3241
3314
|
errors = [],
|
|
3242
3315
|
onBlur,
|
|
3316
|
+
onFocus,
|
|
3243
3317
|
field,
|
|
3244
3318
|
onChange,
|
|
3245
3319
|
readonly,
|
|
@@ -3264,14 +3338,15 @@ function Select(props) {
|
|
|
3264
3338
|
disabled,
|
|
3265
3339
|
errors,
|
|
3266
3340
|
onBlur,
|
|
3341
|
+
onFocus,
|
|
3267
3342
|
field,
|
|
3268
3343
|
value,
|
|
3269
3344
|
onChange,
|
|
3270
3345
|
readonly,
|
|
3271
3346
|
'aria-describedby': errorMessageId
|
|
3272
|
-
}), [disabled, errors, field, id, value, onChange, onBlur, readonly, errorMessageId]);
|
|
3347
|
+
}), [disabled, errors, field, id, value, onChange, onBlur, onFocus, readonly, errorMessageId]);
|
|
3273
3348
|
return jsxs("div", {
|
|
3274
|
-
class: formFieldClasses(type$
|
|
3349
|
+
class: formFieldClasses(type$6, {
|
|
3275
3350
|
errors,
|
|
3276
3351
|
disabled,
|
|
3277
3352
|
readonly
|
|
@@ -3299,7 +3374,7 @@ function Select(props) {
|
|
|
3299
3374
|
});
|
|
3300
3375
|
}
|
|
3301
3376
|
Select.config = {
|
|
3302
|
-
type: type$
|
|
3377
|
+
type: type$6,
|
|
3303
3378
|
keyed: true,
|
|
3304
3379
|
label: 'Select',
|
|
3305
3380
|
group: 'selection',
|
|
@@ -3308,6 +3383,23 @@ Select.config = {
|
|
|
3308
3383
|
create: createEmptyOptions
|
|
3309
3384
|
};
|
|
3310
3385
|
|
|
3386
|
+
const type$5 = 'separator';
|
|
3387
|
+
function Separator() {
|
|
3388
|
+
return jsx("div", {
|
|
3389
|
+
class: formFieldClasses(type$5),
|
|
3390
|
+
children: jsx("hr", {})
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
Separator.config = {
|
|
3394
|
+
type: type$5,
|
|
3395
|
+
keyed: false,
|
|
3396
|
+
label: 'Separator',
|
|
3397
|
+
group: 'presentation',
|
|
3398
|
+
create: (options = {}) => ({
|
|
3399
|
+
...options
|
|
3400
|
+
})
|
|
3401
|
+
};
|
|
3402
|
+
|
|
3311
3403
|
const type$4 = 'spacer';
|
|
3312
3404
|
function Spacer(props) {
|
|
3313
3405
|
const {
|
|
@@ -3334,11 +3426,33 @@ Spacer.config = {
|
|
|
3334
3426
|
})
|
|
3335
3427
|
};
|
|
3336
3428
|
|
|
3429
|
+
function SkipLink(props) {
|
|
3430
|
+
const {
|
|
3431
|
+
className,
|
|
3432
|
+
label,
|
|
3433
|
+
onSkip
|
|
3434
|
+
} = props;
|
|
3435
|
+
const onKeyDown = useCallback(event => {
|
|
3436
|
+
if (event.key === 'Enter') {
|
|
3437
|
+
event.preventDefault();
|
|
3438
|
+
event.stopPropagation();
|
|
3439
|
+
onSkip();
|
|
3440
|
+
}
|
|
3441
|
+
}, [onSkip]);
|
|
3442
|
+
return jsx("a", {
|
|
3443
|
+
href: "#",
|
|
3444
|
+
class: classNames('fjs-skip-link', className),
|
|
3445
|
+
onKeyDown: onKeyDown,
|
|
3446
|
+
children: label
|
|
3447
|
+
});
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3337
3450
|
const type$3 = 'taglist';
|
|
3338
3451
|
function Taglist(props) {
|
|
3339
3452
|
const {
|
|
3340
3453
|
disabled,
|
|
3341
3454
|
errors = [],
|
|
3455
|
+
onFocus,
|
|
3342
3456
|
onBlur,
|
|
3343
3457
|
field,
|
|
3344
3458
|
readonly,
|
|
@@ -3362,7 +3476,9 @@ function Taglist(props) {
|
|
|
3362
3476
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
3363
3477
|
const [hasOptionsLeft, setHasOptionsLeft] = useState(true);
|
|
3364
3478
|
const [isEscapeClosed, setIsEscapeClose] = useState(false);
|
|
3365
|
-
const
|
|
3479
|
+
const focusScopeRef = useRef();
|
|
3480
|
+
const inputRef = useRef();
|
|
3481
|
+
const eventBus = useService('eventBus');
|
|
3366
3482
|
const {
|
|
3367
3483
|
state: loadState,
|
|
3368
3484
|
values: options
|
|
@@ -3384,12 +3500,6 @@ function Taglist(props) {
|
|
|
3384
3500
|
useEffect(() => {
|
|
3385
3501
|
setHasOptionsLeft(options.length > values.length);
|
|
3386
3502
|
}, [options.length, values.length]);
|
|
3387
|
-
const onFilterChange = ({
|
|
3388
|
-
target
|
|
3389
|
-
}) => {
|
|
3390
|
-
setIsEscapeClose(false);
|
|
3391
|
-
setFilter(target.value);
|
|
3392
|
-
};
|
|
3393
3503
|
const selectValue = value => {
|
|
3394
3504
|
if (filter) {
|
|
3395
3505
|
setFilter('');
|
|
@@ -3410,6 +3520,16 @@ function Taglist(props) {
|
|
|
3410
3520
|
field
|
|
3411
3521
|
});
|
|
3412
3522
|
};
|
|
3523
|
+
const onInputChange = ({
|
|
3524
|
+
target
|
|
3525
|
+
}) => {
|
|
3526
|
+
setIsEscapeClose(false);
|
|
3527
|
+
setFilter(target.value || '');
|
|
3528
|
+
eventBus.fire('formField.search', {
|
|
3529
|
+
formField: field,
|
|
3530
|
+
value: target.value || ''
|
|
3531
|
+
});
|
|
3532
|
+
};
|
|
3413
3533
|
const onInputKeyDown = e => {
|
|
3414
3534
|
switch (e.key) {
|
|
3415
3535
|
case 'ArrowUp':
|
|
@@ -3432,10 +3552,26 @@ function Taglist(props) {
|
|
|
3432
3552
|
break;
|
|
3433
3553
|
}
|
|
3434
3554
|
};
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3555
|
+
const onElementBlur = e => {
|
|
3556
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3557
|
+
onBlur && onBlur();
|
|
3558
|
+
};
|
|
3559
|
+
const onElementFocus = e => {
|
|
3560
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3561
|
+
onFocus && onFocus();
|
|
3562
|
+
};
|
|
3563
|
+
const onInputBlur = e => {
|
|
3564
|
+
if (!readonly) {
|
|
3565
|
+
setIsDropdownExpanded(false);
|
|
3566
|
+
setFilter('');
|
|
3567
|
+
}
|
|
3568
|
+
onElementBlur(e);
|
|
3569
|
+
};
|
|
3570
|
+
const onInputFocus = e => {
|
|
3571
|
+
if (!readonly) {
|
|
3572
|
+
setIsDropdownExpanded(true);
|
|
3573
|
+
}
|
|
3574
|
+
onElementFocus(e);
|
|
3439
3575
|
};
|
|
3440
3576
|
const onTagRemoveClick = (event, value) => {
|
|
3441
3577
|
const {
|
|
@@ -3446,11 +3582,15 @@ function Taglist(props) {
|
|
|
3446
3582
|
// restore focus if there is no next sibling to focus
|
|
3447
3583
|
const nextTag = target.closest('.fjs-taglist-tag').nextSibling;
|
|
3448
3584
|
if (!nextTag) {
|
|
3449
|
-
|
|
3585
|
+
inputRef.current.focus();
|
|
3450
3586
|
}
|
|
3451
3587
|
};
|
|
3588
|
+
const onSkipToSearch = () => {
|
|
3589
|
+
inputRef.current.focus();
|
|
3590
|
+
};
|
|
3452
3591
|
const shouldDisplayDropdown = useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3453
3592
|
return jsxs("div", {
|
|
3593
|
+
ref: focusScopeRef,
|
|
3454
3594
|
class: formFieldClasses(type$3, {
|
|
3455
3595
|
errors,
|
|
3456
3596
|
disabled,
|
|
@@ -3466,6 +3606,10 @@ function Taglist(props) {
|
|
|
3466
3606
|
label: label,
|
|
3467
3607
|
required: required,
|
|
3468
3608
|
id: prefixId(`${id}-search`, formId)
|
|
3609
|
+
}), !disabled && !readonly && !!values.length && jsx(SkipLink, {
|
|
3610
|
+
className: "fjs-taglist-skip-link",
|
|
3611
|
+
label: "Skip to search",
|
|
3612
|
+
onSkip: onSkipToSearch
|
|
3469
3613
|
}), jsxs("div", {
|
|
3470
3614
|
class: classNames('fjs-taglist', {
|
|
3471
3615
|
'fjs-disabled': disabled,
|
|
@@ -3487,6 +3631,8 @@ function Taglist(props) {
|
|
|
3487
3631
|
type: "button",
|
|
3488
3632
|
title: "Remove tag",
|
|
3489
3633
|
class: "fjs-taglist-tag-remove",
|
|
3634
|
+
onFocus: onElementFocus,
|
|
3635
|
+
onBlur: onElementBlur,
|
|
3490
3636
|
onClick: event => onTagRemoveClick(event, v),
|
|
3491
3637
|
children: jsx(XMarkIcon, {})
|
|
3492
3638
|
})]
|
|
@@ -3496,17 +3642,17 @@ function Taglist(props) {
|
|
|
3496
3642
|
disabled: disabled,
|
|
3497
3643
|
readOnly: readonly,
|
|
3498
3644
|
class: "fjs-taglist-input",
|
|
3499
|
-
ref:
|
|
3645
|
+
ref: inputRef,
|
|
3500
3646
|
id: prefixId(`${id}-search`, formId),
|
|
3501
|
-
onChange:
|
|
3647
|
+
onChange: onInputChange,
|
|
3502
3648
|
type: "text",
|
|
3503
3649
|
value: filter,
|
|
3504
3650
|
placeholder: disabled || readonly ? undefined : 'Search',
|
|
3505
3651
|
autoComplete: "off",
|
|
3506
3652
|
onKeyDown: onInputKeyDown,
|
|
3507
3653
|
onMouseDown: () => setIsEscapeClose(false),
|
|
3508
|
-
onFocus:
|
|
3509
|
-
onBlur:
|
|
3654
|
+
onFocus: onInputFocus,
|
|
3655
|
+
onBlur: onInputBlur,
|
|
3510
3656
|
"aria-describedby": errorMessageId
|
|
3511
3657
|
})]
|
|
3512
3658
|
}), jsx("div", {
|
|
@@ -3516,7 +3662,7 @@ function Taglist(props) {
|
|
|
3516
3662
|
getLabel: o => o.label,
|
|
3517
3663
|
onValueSelected: o => selectValue(o.value),
|
|
3518
3664
|
emptyListMessage: hasOptionsLeft ? 'No results' : 'All values selected',
|
|
3519
|
-
listenerElement:
|
|
3665
|
+
listenerElement: inputRef.current
|
|
3520
3666
|
})
|
|
3521
3667
|
}), jsx(Description, {
|
|
3522
3668
|
description: description
|
|
@@ -3626,6 +3772,7 @@ function Textfield(props) {
|
|
|
3626
3772
|
disabled,
|
|
3627
3773
|
errors = [],
|
|
3628
3774
|
onBlur,
|
|
3775
|
+
onFocus,
|
|
3629
3776
|
field,
|
|
3630
3777
|
readonly,
|
|
3631
3778
|
value = ''
|
|
@@ -3677,7 +3824,8 @@ function Textfield(props) {
|
|
|
3677
3824
|
readOnly: readonly,
|
|
3678
3825
|
id: prefixId(id, formId),
|
|
3679
3826
|
onInput: onChange,
|
|
3680
|
-
onBlur: onBlur,
|
|
3827
|
+
onBlur: () => onBlur && onBlur(),
|
|
3828
|
+
onFocus: () => onFocus && onFocus(),
|
|
3681
3829
|
type: "text",
|
|
3682
3830
|
value: value,
|
|
3683
3831
|
"aria-describedby": errorMessageId
|
|
@@ -3720,6 +3868,7 @@ function Textarea(props) {
|
|
|
3720
3868
|
disabled,
|
|
3721
3869
|
errors = [],
|
|
3722
3870
|
onBlur,
|
|
3871
|
+
onFocus,
|
|
3723
3872
|
field,
|
|
3724
3873
|
readonly,
|
|
3725
3874
|
value = ''
|
|
@@ -3768,7 +3917,8 @@ function Textarea(props) {
|
|
|
3768
3917
|
readonly: readonly,
|
|
3769
3918
|
id: prefixId(id, formId),
|
|
3770
3919
|
onInput: onInput,
|
|
3771
|
-
onBlur: onBlur,
|
|
3920
|
+
onBlur: () => onBlur && onBlur(),
|
|
3921
|
+
onFocus: () => onFocus && onFocus(),
|
|
3772
3922
|
value: value,
|
|
3773
3923
|
ref: textareaRef,
|
|
3774
3924
|
"aria-describedby": errorMessageId
|
|
@@ -3812,39 +3962,39 @@ const autoSizeTextarea = textarea => {
|
|
|
3812
3962
|
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3813
3963
|
};
|
|
3814
3964
|
|
|
3815
|
-
var _path$
|
|
3816
|
-
function _extends$
|
|
3965
|
+
var _path$d;
|
|
3966
|
+
function _extends$f() { _extends$f = 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$f.apply(this, arguments); }
|
|
3817
3967
|
var SvgButton = function SvgButton(props) {
|
|
3818
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3968
|
+
return /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
3819
3969
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3820
3970
|
width: 54,
|
|
3821
3971
|
height: 54,
|
|
3822
3972
|
fill: "currentcolor"
|
|
3823
|
-
}, props), _path$
|
|
3973
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
|
|
3824
3974
|
fillRule: "evenodd",
|
|
3825
3975
|
d: "M45 17a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V20a3 3 0 0 1 3-3h36zm-9 8.889H18v2.222h18v-2.222z"
|
|
3826
3976
|
})));
|
|
3827
3977
|
};
|
|
3828
3978
|
var ButtonIcon = SvgButton;
|
|
3829
3979
|
|
|
3830
|
-
var _path$
|
|
3831
|
-
function _extends$
|
|
3980
|
+
var _path$c;
|
|
3981
|
+
function _extends$e() { _extends$e = 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$e.apply(this, arguments); }
|
|
3832
3982
|
var SvgCheckbox = function SvgCheckbox(props) {
|
|
3833
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3983
|
+
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
3834
3984
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3835
3985
|
width: 54,
|
|
3836
3986
|
height: 54,
|
|
3837
3987
|
fill: "currentcolor"
|
|
3838
|
-
}, props), _path$
|
|
3988
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
|
|
3839
3989
|
d: "M34 18H20a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V20a2 2 0 0 0-2-2zm-9 14-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
|
|
3840
3990
|
})));
|
|
3841
3991
|
};
|
|
3842
3992
|
var CheckboxIcon = SvgCheckbox;
|
|
3843
3993
|
|
|
3844
3994
|
var _g, _use, _use2, _use3, _defs;
|
|
3845
|
-
function _extends$
|
|
3995
|
+
function _extends$d() { _extends$d = 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$d.apply(this, arguments); }
|
|
3846
3996
|
var SvgChecklist = function SvgChecklist(props) {
|
|
3847
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3997
|
+
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
3848
3998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3849
3999
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3850
4000
|
width: 54,
|
|
@@ -3878,18 +4028,18 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3878
4028
|
};
|
|
3879
4029
|
var ChecklistIcon = SvgChecklist;
|
|
3880
4030
|
|
|
3881
|
-
var _path$
|
|
3882
|
-
function _extends$
|
|
4031
|
+
var _path$b, _path2$2, _path3;
|
|
4032
|
+
function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
|
|
3883
4033
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3884
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4034
|
+
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
3885
4035
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3886
4036
|
width: 54,
|
|
3887
4037
|
height: 54,
|
|
3888
4038
|
fill: "currentcolor"
|
|
3889
|
-
}, props), _path$
|
|
4039
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
|
|
3890
4040
|
fillRule: "evenodd",
|
|
3891
4041
|
d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36a2.07 2.07 0 0 0-2.06 2.06v23.549a2.07 2.07 0 0 0 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 0 1-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592a.71.71 0 0 1 .707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z"
|
|
3892
|
-
})), _path2$
|
|
4042
|
+
})), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
|
|
3893
4043
|
d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
|
|
3894
4044
|
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
3895
4045
|
fillRule: "evenodd",
|
|
@@ -3898,27 +4048,27 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3898
4048
|
};
|
|
3899
4049
|
var DatetimeIcon = SvgDatetime;
|
|
3900
4050
|
|
|
3901
|
-
var _path$
|
|
3902
|
-
function _extends$
|
|
4051
|
+
var _path$a, _path2$1;
|
|
4052
|
+
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
|
|
3903
4053
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3904
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4054
|
+
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3905
4055
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3906
4056
|
width: 54,
|
|
3907
4057
|
height: 54,
|
|
3908
4058
|
fill: "currentcolor"
|
|
3909
|
-
}, props), _path$
|
|
4059
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
|
|
3910
4060
|
fillRule: "evenodd",
|
|
3911
4061
|
d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36Zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1Z"
|
|
3912
|
-
})), _path2$
|
|
4062
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
3913
4063
|
d: "M11 22a1 1 0 0 1 1-1h19a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H12a1 1 0 0 1-1-1V22Z"
|
|
3914
4064
|
})));
|
|
3915
4065
|
};
|
|
3916
4066
|
var TaglistIcon = SvgTaglist;
|
|
3917
4067
|
|
|
3918
4068
|
var _rect, _rect2, _rect3;
|
|
3919
|
-
function _extends$
|
|
4069
|
+
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); }
|
|
3920
4070
|
var SvgForm = function SvgForm(props) {
|
|
3921
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4071
|
+
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
3922
4072
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3923
4073
|
width: 54,
|
|
3924
4074
|
height: 54
|
|
@@ -3944,9 +4094,24 @@ var SvgForm = function SvgForm(props) {
|
|
|
3944
4094
|
};
|
|
3945
4095
|
var FormIcon = SvgForm;
|
|
3946
4096
|
|
|
4097
|
+
var _path$9;
|
|
4098
|
+
function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
|
|
4099
|
+
var SvgGroup = function SvgGroup(props) {
|
|
4100
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
4101
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4102
|
+
width: 54,
|
|
4103
|
+
height: 54,
|
|
4104
|
+
fill: "currentcolor"
|
|
4105
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
|
|
4106
|
+
fillRule: "evenodd",
|
|
4107
|
+
d: "M8 33v5a1 1 0 0 0 1 1h4v2H9a3 3 0 0 1-3-3v-5h2Zm18 6v2H15v-2h11Zm13 0v2H28v-2h11Zm9-6v5a3 3 0 0 1-3 3h-4v-2h4a1 1 0 0 0 .993-.883L46 38v-5h2ZM8 22v9H6v-9h2Zm40 0v9h-2v-9h2Zm-35-9v2H9a1 1 0 0 0-.993.883L8 16v4H6v-4a3 3 0 0 1 3-3h4Zm32 0a3 3 0 0 1 3 3v4h-2v-4a1 1 0 0 0-.883-.993L45 15h-4v-2h4Zm-6 0v2H28v-2h11Zm-13 0v2H15v-2h11Z"
|
|
4108
|
+
})));
|
|
4109
|
+
};
|
|
4110
|
+
var GroupIcon = SvgGroup;
|
|
4111
|
+
|
|
3947
4112
|
var _path$8;
|
|
3948
4113
|
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
3949
|
-
var
|
|
4114
|
+
var SvgNumber = function SvgNumber(props) {
|
|
3950
4115
|
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
3951
4116
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3952
4117
|
width: 54,
|
|
@@ -3954,74 +4119,66 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3954
4119
|
fill: "currentcolor"
|
|
3955
4120
|
}, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
|
|
3956
4121
|
fillRule: "evenodd",
|
|
3957
|
-
d: "
|
|
4122
|
+
d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
|
|
3958
4123
|
})));
|
|
3959
4124
|
};
|
|
3960
|
-
var
|
|
4125
|
+
var NumberIcon = SvgNumber;
|
|
3961
4126
|
|
|
3962
4127
|
var _path$7;
|
|
3963
4128
|
function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
|
|
3964
|
-
var
|
|
4129
|
+
var SvgRadio = function SvgRadio(props) {
|
|
3965
4130
|
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
3966
4131
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3967
4132
|
width: 54,
|
|
3968
4133
|
height: 54,
|
|
3969
4134
|
fill: "currentcolor"
|
|
3970
4135
|
}, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
|
|
3971
|
-
|
|
3972
|
-
d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
|
|
4136
|
+
d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18a8 8 0 1 1 0-16 8 8 0 1 1 0 16z"
|
|
3973
4137
|
})));
|
|
3974
4138
|
};
|
|
3975
|
-
var
|
|
4139
|
+
var RadioIcon = SvgRadio;
|
|
3976
4140
|
|
|
3977
4141
|
var _path$6;
|
|
3978
4142
|
function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
|
|
3979
|
-
var
|
|
4143
|
+
var SvgSelect = function SvgSelect(props) {
|
|
3980
4144
|
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
3981
4145
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3982
4146
|
width: 54,
|
|
3983
4147
|
height: 54,
|
|
3984
4148
|
fill: "currentcolor"
|
|
3985
4149
|
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
3986
|
-
|
|
4150
|
+
fillRule: "evenodd",
|
|
4151
|
+
d: "M45 16a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V19a3 3 0 0 1 3-3h36zm0 2H9a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h36a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1zm-12 7h9l-4.5 6-4.5-6z"
|
|
3987
4152
|
})));
|
|
3988
4153
|
};
|
|
3989
|
-
var
|
|
4154
|
+
var SelectIcon = SvgSelect;
|
|
3990
4155
|
|
|
3991
4156
|
var _path$5;
|
|
3992
4157
|
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
3993
|
-
var
|
|
4158
|
+
var SvgSeparator = function SvgSeparator(props) {
|
|
3994
4159
|
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
3995
4160
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3996
4161
|
width: 54,
|
|
3997
4162
|
height: 54,
|
|
3998
|
-
fill: "
|
|
4163
|
+
fill: "none"
|
|
3999
4164
|
}, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
|
|
4000
|
-
|
|
4001
|
-
d: "
|
|
4165
|
+
fill: "currentColor",
|
|
4166
|
+
d: "M26.293 16.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 18.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4ZM9 26h36v2H9v-2Zm13.293 7.707 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 35.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
|
|
4002
4167
|
})));
|
|
4003
4168
|
};
|
|
4004
|
-
var
|
|
4169
|
+
var SeparatorIcon = SvgSeparator;
|
|
4005
4170
|
|
|
4006
|
-
var _path$4
|
|
4171
|
+
var _path$4;
|
|
4007
4172
|
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
4008
4173
|
var SvgSpacer = function SvgSpacer(props) {
|
|
4009
4174
|
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
4010
4175
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4011
4176
|
width: 54,
|
|
4012
4177
|
height: 54,
|
|
4013
|
-
fill: "
|
|
4178
|
+
fill: "none"
|
|
4014
4179
|
}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
strokeWidth: 2,
|
|
4018
|
-
d: "M9 23h36M9 31h36"
|
|
4019
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
4020
|
-
stroke: "currentcolor",
|
|
4021
|
-
strokeLinecap: "round",
|
|
4022
|
-
strokeLinejoin: "round",
|
|
4023
|
-
strokeWidth: 2,
|
|
4024
|
-
d: "m23 17 4-4 4 4M31 37l-4 4-4-4"
|
|
4180
|
+
fill: "currentColor",
|
|
4181
|
+
d: "M9 15v2h36v-2H9Zm0 22v2h36v-2H9Zm17.293-17.707a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L27 21.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4Zm-4 11.414 4 4a1 1 0 0 0 1.414 0l4-4a1 1 0 0 0-1.414-1.414L27 32.586l-3.293-3.293a1 1 0 0 0-1.414 1.414Z"
|
|
4025
4182
|
})));
|
|
4026
4183
|
};
|
|
4027
4184
|
var SpacerIcon = SvgSpacer;
|
|
@@ -4102,6 +4259,7 @@ const iconsByType = type => {
|
|
|
4102
4259
|
number: NumberIcon,
|
|
4103
4260
|
radio: RadioIcon,
|
|
4104
4261
|
select: SelectIcon,
|
|
4262
|
+
separator: SeparatorIcon,
|
|
4105
4263
|
spacer: SpacerIcon,
|
|
4106
4264
|
taglist: TaglistIcon,
|
|
4107
4265
|
text: TextIcon,
|
|
@@ -4111,7 +4269,7 @@ const iconsByType = type => {
|
|
|
4111
4269
|
}[type];
|
|
4112
4270
|
};
|
|
4113
4271
|
|
|
4114
|
-
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Taglist, Text, Textfield, Textarea];
|
|
4272
|
+
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, Taglist, Text, Textfield, Textarea];
|
|
4115
4273
|
|
|
4116
4274
|
class FormFields {
|
|
4117
4275
|
constructor() {
|
|
@@ -4172,10 +4330,10 @@ function createInjector(bootstrapModules) {
|
|
|
4172
4330
|
return injector;
|
|
4173
4331
|
}
|
|
4174
4332
|
|
|
4175
|
-
/**
|
|
4176
|
-
* @param {string?} prefix
|
|
4177
|
-
*
|
|
4178
|
-
* @returns Element
|
|
4333
|
+
/**
|
|
4334
|
+
* @param {string?} prefix
|
|
4335
|
+
*
|
|
4336
|
+
* @returns Element
|
|
4179
4337
|
*/
|
|
4180
4338
|
function createFormContainer(prefix = 'fjs') {
|
|
4181
4339
|
const container = document.createElement('div');
|
|
@@ -4212,22 +4370,47 @@ function generateIdForType(type) {
|
|
|
4212
4370
|
return `${type}${generateIndexForType(type)}`;
|
|
4213
4371
|
}
|
|
4214
4372
|
|
|
4215
|
-
/**
|
|
4216
|
-
* @template T
|
|
4217
|
-
* @param {T} data
|
|
4218
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4219
|
-
* @return {T}
|
|
4373
|
+
/**
|
|
4374
|
+
* @template T
|
|
4375
|
+
* @param {T} data
|
|
4376
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4377
|
+
* @return {T}
|
|
4220
4378
|
*/
|
|
4221
4379
|
function clone(data, replacer) {
|
|
4222
4380
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
4223
4381
|
}
|
|
4224
4382
|
|
|
4225
|
-
/**
|
|
4226
|
-
*
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
*
|
|
4383
|
+
/**
|
|
4384
|
+
* @typedef { import('../types').Schema } Schema
|
|
4385
|
+
*/
|
|
4386
|
+
|
|
4387
|
+
/**
|
|
4388
|
+
* Parse the schema for variables a form might make use of.
|
|
4389
|
+
*
|
|
4390
|
+
* @example
|
|
4391
|
+
*
|
|
4392
|
+
* // retrieve variables from schema
|
|
4393
|
+
* const variables = getSchemaVariables(schema);
|
|
4394
|
+
*
|
|
4395
|
+
* @example
|
|
4396
|
+
*
|
|
4397
|
+
* // retrieve input variables from schema
|
|
4398
|
+
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
4399
|
+
*
|
|
4400
|
+
* @example
|
|
4401
|
+
*
|
|
4402
|
+
* // retrieve output variables from schema
|
|
4403
|
+
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
4404
|
+
*
|
|
4405
|
+
* @param {Schema} schema
|
|
4406
|
+
* @param {object} [options]
|
|
4407
|
+
* @param {any} [options.expressionLanguage]
|
|
4408
|
+
* @param {any} [options.templating]
|
|
4409
|
+
* @param {any} [options.formFields]
|
|
4410
|
+
* @param {boolean} [options.inputs=true]
|
|
4411
|
+
* @param {boolean} [options.outputs=true]
|
|
4412
|
+
*
|
|
4413
|
+
* @return {string[]}
|
|
4231
4414
|
*/
|
|
4232
4415
|
function getSchemaVariables(schema, options = {}) {
|
|
4233
4416
|
const {
|
|
@@ -4310,9 +4493,9 @@ function runRecursively(formField, fn) {
|
|
|
4310
4493
|
fn(formField);
|
|
4311
4494
|
}
|
|
4312
4495
|
|
|
4313
|
-
/**
|
|
4314
|
-
* @typedef {object} Condition
|
|
4315
|
-
* @property {string} [hide]
|
|
4496
|
+
/**
|
|
4497
|
+
* @typedef {object} Condition
|
|
4498
|
+
* @property {string} [hide]
|
|
4316
4499
|
*/
|
|
4317
4500
|
|
|
4318
4501
|
class ConditionChecker {
|
|
@@ -4322,13 +4505,13 @@ class ConditionChecker {
|
|
|
4322
4505
|
this._eventBus = eventBus;
|
|
4323
4506
|
}
|
|
4324
4507
|
|
|
4325
|
-
/**
|
|
4326
|
-
* For given data, remove properties based on condition.
|
|
4327
|
-
*
|
|
4328
|
-
* @param {Object<string, any>} properties
|
|
4329
|
-
* @param {Object<string, any>} data
|
|
4330
|
-
* @param {Object} [options]
|
|
4331
|
-
* @param {Function} [options.getFilterPath]
|
|
4508
|
+
/**
|
|
4509
|
+
* For given data, remove properties based on condition.
|
|
4510
|
+
*
|
|
4511
|
+
* @param {Object<string, any>} properties
|
|
4512
|
+
* @param {Object<string, any>} data
|
|
4513
|
+
* @param {Object} [options]
|
|
4514
|
+
* @param {Function} [options.getFilterPath]
|
|
4332
4515
|
*/
|
|
4333
4516
|
applyConditions(properties, data = {}, options = {}) {
|
|
4334
4517
|
const newProperties = clone(properties);
|
|
@@ -4357,13 +4540,13 @@ class ConditionChecker {
|
|
|
4357
4540
|
return newProperties;
|
|
4358
4541
|
}
|
|
4359
4542
|
|
|
4360
|
-
/**
|
|
4361
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4362
|
-
*
|
|
4363
|
-
* @param {string} condition
|
|
4364
|
-
* @param {import('../../types').Data} [data]
|
|
4365
|
-
*
|
|
4366
|
-
* @returns {boolean|null}
|
|
4543
|
+
/**
|
|
4544
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4545
|
+
*
|
|
4546
|
+
* @param {string} condition
|
|
4547
|
+
* @param {import('../../types').Data} [data]
|
|
4548
|
+
*
|
|
4549
|
+
* @returns {boolean|null}
|
|
4367
4550
|
*/
|
|
4368
4551
|
check(condition, data = {}) {
|
|
4369
4552
|
if (!condition) {
|
|
@@ -4384,12 +4567,12 @@ class ConditionChecker {
|
|
|
4384
4567
|
}
|
|
4385
4568
|
}
|
|
4386
4569
|
|
|
4387
|
-
/**
|
|
4388
|
-
* Check if hide condition is met.
|
|
4389
|
-
*
|
|
4390
|
-
* @param {Condition} condition
|
|
4391
|
-
* @param {Object<string, any>} data
|
|
4392
|
-
* @returns {boolean}
|
|
4570
|
+
/**
|
|
4571
|
+
* Check if hide condition is met.
|
|
4572
|
+
*
|
|
4573
|
+
* @param {Condition} condition
|
|
4574
|
+
* @param {Object<string, any>} data
|
|
4575
|
+
* @returns {boolean}
|
|
4393
4576
|
*/
|
|
4394
4577
|
_checkHideCondition(condition, data) {
|
|
4395
4578
|
if (!condition.hide) {
|
|
@@ -4425,12 +4608,12 @@ class MarkdownRenderer {
|
|
|
4425
4608
|
this._converter = new showdown.Converter();
|
|
4426
4609
|
}
|
|
4427
4610
|
|
|
4428
|
-
/**
|
|
4429
|
-
* Render markdown to HTML.
|
|
4430
|
-
*
|
|
4431
|
-
* @param {string} markdown - The markdown to render
|
|
4432
|
-
*
|
|
4433
|
-
* @returns {string} HTML
|
|
4611
|
+
/**
|
|
4612
|
+
* Render markdown to HTML.
|
|
4613
|
+
*
|
|
4614
|
+
* @param {string} markdown - The markdown to render
|
|
4615
|
+
*
|
|
4616
|
+
* @returns {string} HTML
|
|
4434
4617
|
*/
|
|
4435
4618
|
render(markdown) {
|
|
4436
4619
|
return this._converter.makeHtml(markdown);
|
|
@@ -5553,8 +5736,8 @@ Validator.$inject = ['expressionLanguage', 'conditionChecker', 'form'];
|
|
|
5553
5736
|
|
|
5554
5737
|
// helpers //////////
|
|
5555
5738
|
|
|
5556
|
-
/**
|
|
5557
|
-
* Helper function to evaluate optional FEEL validation values.
|
|
5739
|
+
/**
|
|
5740
|
+
* Helper function to evaluate optional FEEL validation values.
|
|
5558
5741
|
*/
|
|
5559
5742
|
function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
5560
5743
|
const evaluatedValidate = {
|
|
@@ -5588,12 +5771,12 @@ function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form
|
|
|
5588
5771
|
}
|
|
5589
5772
|
|
|
5590
5773
|
class Importer {
|
|
5591
|
-
/**
|
|
5592
|
-
* @constructor
|
|
5593
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5594
|
-
* @param { import('./PathRegistry').default } pathRegistry
|
|
5595
|
-
* @param { import('./FieldFactory').default } fieldFactory
|
|
5596
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
5774
|
+
/**
|
|
5775
|
+
* @constructor
|
|
5776
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5777
|
+
* @param { import('./PathRegistry').default } pathRegistry
|
|
5778
|
+
* @param { import('./FieldFactory').default } fieldFactory
|
|
5779
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
5597
5780
|
*/
|
|
5598
5781
|
constructor(formFieldRegistry, pathRegistry, fieldFactory, formLayouter) {
|
|
5599
5782
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5602,21 +5785,21 @@ class Importer {
|
|
|
5602
5785
|
this._formLayouter = formLayouter;
|
|
5603
5786
|
}
|
|
5604
5787
|
|
|
5605
|
-
/**
|
|
5606
|
-
* Import schema creating rows, fields, attaching additional
|
|
5607
|
-
* information to each field and adding fields to the
|
|
5608
|
-
* field registry.
|
|
5609
|
-
*
|
|
5610
|
-
* Additional information attached:
|
|
5611
|
-
*
|
|
5612
|
-
* * `id` (unless present)
|
|
5613
|
-
* * `_parent`
|
|
5614
|
-
* * `_path`
|
|
5615
|
-
*
|
|
5616
|
-
* @param {any} schema
|
|
5617
|
-
*
|
|
5618
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5619
|
-
* @returns {ImportResult}
|
|
5788
|
+
/**
|
|
5789
|
+
* Import schema creating rows, fields, attaching additional
|
|
5790
|
+
* information to each field and adding fields to the
|
|
5791
|
+
* field registry.
|
|
5792
|
+
*
|
|
5793
|
+
* Additional information attached:
|
|
5794
|
+
*
|
|
5795
|
+
* * `id` (unless present)
|
|
5796
|
+
* * `_parent`
|
|
5797
|
+
* * `_path`
|
|
5798
|
+
*
|
|
5799
|
+
* @param {any} schema
|
|
5800
|
+
*
|
|
5801
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5802
|
+
* @returns {ImportResult}
|
|
5620
5803
|
*/
|
|
5621
5804
|
importSchema(schema) {
|
|
5622
5805
|
// TODO: Add warnings
|
|
@@ -5641,12 +5824,12 @@ class Importer {
|
|
|
5641
5824
|
this._pathRegistry.clear();
|
|
5642
5825
|
}
|
|
5643
5826
|
|
|
5644
|
-
/**
|
|
5645
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
5646
|
-
* @param {String} [parentId]
|
|
5647
|
-
* @param {number} [index]
|
|
5648
|
-
*
|
|
5649
|
-
* @return {any} field
|
|
5827
|
+
/**
|
|
5828
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
5829
|
+
* @param {String} [parentId]
|
|
5830
|
+
* @param {number} [index]
|
|
5831
|
+
*
|
|
5832
|
+
* @return {any} field
|
|
5650
5833
|
*/
|
|
5651
5834
|
importFormField(fieldAttrs, parentId, index) {
|
|
5652
5835
|
const {
|
|
@@ -5671,11 +5854,11 @@ class Importer {
|
|
|
5671
5854
|
return field;
|
|
5672
5855
|
}
|
|
5673
5856
|
|
|
5674
|
-
/**
|
|
5675
|
-
* @param {Array<any>} components
|
|
5676
|
-
* @param {string} parentId
|
|
5677
|
-
*
|
|
5678
|
-
* @return {Array<any>} imported components
|
|
5857
|
+
/**
|
|
5858
|
+
* @param {Array<any>} components
|
|
5859
|
+
* @param {string} parentId
|
|
5860
|
+
*
|
|
5861
|
+
* @return {Array<any>} imported components
|
|
5679
5862
|
*/
|
|
5680
5863
|
importFormFields(components, parentId) {
|
|
5681
5864
|
return components.map((component, index) => {
|
|
@@ -5686,11 +5869,11 @@ class Importer {
|
|
|
5686
5869
|
Importer.$inject = ['formFieldRegistry', 'pathRegistry', 'fieldFactory', 'formLayouter'];
|
|
5687
5870
|
|
|
5688
5871
|
class FieldFactory {
|
|
5689
|
-
/**
|
|
5690
|
-
* @constructor
|
|
5691
|
-
*
|
|
5692
|
-
* @param formFieldRegistry
|
|
5693
|
-
* @param formFields
|
|
5872
|
+
/**
|
|
5873
|
+
* @constructor
|
|
5874
|
+
*
|
|
5875
|
+
* @param formFieldRegistry
|
|
5876
|
+
* @param formFields
|
|
5694
5877
|
*/
|
|
5695
5878
|
constructor(formFieldRegistry, pathRegistry, formFields) {
|
|
5696
5879
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5772,36 +5955,36 @@ class FieldFactory {
|
|
|
5772
5955
|
}
|
|
5773
5956
|
FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
|
|
5774
5957
|
|
|
5775
|
-
/**
|
|
5776
|
-
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5777
|
-
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5778
|
-
*
|
|
5779
|
-
* Example Tree Structure:
|
|
5780
|
-
*
|
|
5781
|
-
* [
|
|
5782
|
-
* {
|
|
5783
|
-
* segment: 'root',
|
|
5784
|
-
* claimCount: 1,
|
|
5785
|
-
* children: [
|
|
5786
|
-
* {
|
|
5787
|
-
* segment: 'child1',
|
|
5788
|
-
* claimCount: 2,
|
|
5789
|
-
* children: null // A leaf node (closed path)
|
|
5790
|
-
* },
|
|
5791
|
-
* {
|
|
5792
|
-
* segment: 'child2',
|
|
5793
|
-
* claimCount: 1,
|
|
5794
|
-
* children: [
|
|
5795
|
-
* {
|
|
5796
|
-
* segment: 'subChild1',
|
|
5797
|
-
* claimCount: 1,
|
|
5798
|
-
* children: [] // An open node (open path)
|
|
5799
|
-
* }
|
|
5800
|
-
* ]
|
|
5801
|
-
* }
|
|
5802
|
-
* ]
|
|
5803
|
-
* }
|
|
5804
|
-
* ]
|
|
5958
|
+
/**
|
|
5959
|
+
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5960
|
+
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5961
|
+
*
|
|
5962
|
+
* Example Tree Structure:
|
|
5963
|
+
*
|
|
5964
|
+
* [
|
|
5965
|
+
* {
|
|
5966
|
+
* segment: 'root',
|
|
5967
|
+
* claimCount: 1,
|
|
5968
|
+
* children: [
|
|
5969
|
+
* {
|
|
5970
|
+
* segment: 'child1',
|
|
5971
|
+
* claimCount: 2,
|
|
5972
|
+
* children: null // A leaf node (closed path)
|
|
5973
|
+
* },
|
|
5974
|
+
* {
|
|
5975
|
+
* segment: 'child2',
|
|
5976
|
+
* claimCount: 1,
|
|
5977
|
+
* children: [
|
|
5978
|
+
* {
|
|
5979
|
+
* segment: 'subChild1',
|
|
5980
|
+
* claimCount: 1,
|
|
5981
|
+
* children: [] // An open node (open path)
|
|
5982
|
+
* }
|
|
5983
|
+
* ]
|
|
5984
|
+
* }
|
|
5985
|
+
* ]
|
|
5986
|
+
* }
|
|
5987
|
+
* ]
|
|
5805
5988
|
*/
|
|
5806
5989
|
class PathRegistry {
|
|
5807
5990
|
constructor(formFieldRegistry, formFields) {
|
|
@@ -5884,16 +6067,16 @@ class PathRegistry {
|
|
|
5884
6067
|
}
|
|
5885
6068
|
}
|
|
5886
6069
|
|
|
5887
|
-
/**
|
|
5888
|
-
* Applies a function (fn) recursively on a given field and its children.
|
|
5889
|
-
*
|
|
5890
|
-
* - `field`: Starting field object.
|
|
5891
|
-
* - `fn`: Function to apply.
|
|
5892
|
-
* - `context`: Optional object for passing data between calls.
|
|
5893
|
-
*
|
|
5894
|
-
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
5895
|
-
*
|
|
5896
|
-
* @returns {boolean} Success status based on function execution.
|
|
6070
|
+
/**
|
|
6071
|
+
* Applies a function (fn) recursively on a given field and its children.
|
|
6072
|
+
*
|
|
6073
|
+
* - `field`: Starting field object.
|
|
6074
|
+
* - `fn`: Function to apply.
|
|
6075
|
+
* - `context`: Optional object for passing data between calls.
|
|
6076
|
+
*
|
|
6077
|
+
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
6078
|
+
*
|
|
6079
|
+
* @returns {boolean} Success status based on function execution.
|
|
5897
6080
|
*/
|
|
5898
6081
|
executeRecursivelyOnFields(field, fn, context = {}) {
|
|
5899
6082
|
let result = true;
|
|
@@ -5927,15 +6110,15 @@ class PathRegistry {
|
|
|
5927
6110
|
return result;
|
|
5928
6111
|
}
|
|
5929
6112
|
|
|
5930
|
-
/**
|
|
5931
|
-
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
5932
|
-
*
|
|
5933
|
-
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
5934
|
-
* @param {Object} [options={}] - Configuration options.
|
|
5935
|
-
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
5936
|
-
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
5937
|
-
*
|
|
5938
|
-
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
6113
|
+
/**
|
|
6114
|
+
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
6115
|
+
*
|
|
6116
|
+
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
6117
|
+
* @param {Object} [options={}] - Configuration options.
|
|
6118
|
+
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
6119
|
+
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
6120
|
+
*
|
|
6121
|
+
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
5939
6122
|
*/
|
|
5940
6123
|
getValuePath(field, options = {}) {
|
|
5941
6124
|
const {
|
|
@@ -5979,23 +6162,23 @@ const _getNextSegment = (node, segment) => {
|
|
|
5979
6162
|
};
|
|
5980
6163
|
PathRegistry.$inject = ['formFieldRegistry', 'formFields'];
|
|
5981
6164
|
|
|
5982
|
-
/**
|
|
5983
|
-
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
5984
|
-
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6165
|
+
/**
|
|
6166
|
+
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6167
|
+
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
5985
6168
|
*/
|
|
5986
6169
|
|
|
5987
|
-
/**
|
|
5988
|
-
* Maintains the Form layout in a given structure, for example
|
|
5989
|
-
*
|
|
5990
|
-
* [
|
|
5991
|
-
* {
|
|
5992
|
-
* formFieldId: 'FormField_1',
|
|
5993
|
-
* rows: [
|
|
5994
|
-
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
5995
|
-
* ]
|
|
5996
|
-
* }
|
|
5997
|
-
* ]
|
|
5998
|
-
*
|
|
6170
|
+
/**
|
|
6171
|
+
* Maintains the Form layout in a given structure, for example
|
|
6172
|
+
*
|
|
6173
|
+
* [
|
|
6174
|
+
* {
|
|
6175
|
+
* formFieldId: 'FormField_1',
|
|
6176
|
+
* rows: [
|
|
6177
|
+
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
6178
|
+
* ]
|
|
6179
|
+
* }
|
|
6180
|
+
* ]
|
|
6181
|
+
*
|
|
5999
6182
|
*/
|
|
6000
6183
|
class FormLayouter {
|
|
6001
6184
|
constructor(eventBus) {
|
|
@@ -6005,8 +6188,8 @@ class FormLayouter {
|
|
|
6005
6188
|
this._eventBus = eventBus;
|
|
6006
6189
|
}
|
|
6007
6190
|
|
|
6008
|
-
/**
|
|
6009
|
-
* @param {FormRow} row
|
|
6191
|
+
/**
|
|
6192
|
+
* @param {FormRow} row
|
|
6010
6193
|
*/
|
|
6011
6194
|
addRow(formFieldId, row) {
|
|
6012
6195
|
let rowsPerComponent = this._rows.find(r => r.formFieldId === formFieldId);
|
|
@@ -6020,18 +6203,18 @@ class FormLayouter {
|
|
|
6020
6203
|
rowsPerComponent.rows.push(row);
|
|
6021
6204
|
}
|
|
6022
6205
|
|
|
6023
|
-
/**
|
|
6024
|
-
* @param {String} id
|
|
6025
|
-
* @returns {FormRow}
|
|
6206
|
+
/**
|
|
6207
|
+
* @param {String} id
|
|
6208
|
+
* @returns {FormRow}
|
|
6026
6209
|
*/
|
|
6027
6210
|
getRow(id) {
|
|
6028
6211
|
const rows = allRows(this._rows);
|
|
6029
6212
|
return rows.find(r => r.id === id);
|
|
6030
6213
|
}
|
|
6031
6214
|
|
|
6032
|
-
/**
|
|
6033
|
-
* @param {any} formField
|
|
6034
|
-
* @returns {FormRow}
|
|
6215
|
+
/**
|
|
6216
|
+
* @param {any} formField
|
|
6217
|
+
* @returns {FormRow}
|
|
6035
6218
|
*/
|
|
6036
6219
|
getRowForField(formField) {
|
|
6037
6220
|
return allRows(this._rows).find(r => {
|
|
@@ -6042,9 +6225,9 @@ class FormLayouter {
|
|
|
6042
6225
|
});
|
|
6043
6226
|
}
|
|
6044
6227
|
|
|
6045
|
-
/**
|
|
6046
|
-
* @param {String} formFieldId
|
|
6047
|
-
* @returns { Array<FormRow> }
|
|
6228
|
+
/**
|
|
6229
|
+
* @param {String} formFieldId
|
|
6230
|
+
* @returns { Array<FormRow> }
|
|
6048
6231
|
*/
|
|
6049
6232
|
getRows(formFieldId) {
|
|
6050
6233
|
const rowsForField = this._rows.find(r => formFieldId === r.formFieldId);
|
|
@@ -6054,15 +6237,15 @@ class FormLayouter {
|
|
|
6054
6237
|
return rowsForField.rows;
|
|
6055
6238
|
}
|
|
6056
6239
|
|
|
6057
|
-
/**
|
|
6058
|
-
* @returns {string}
|
|
6240
|
+
/**
|
|
6241
|
+
* @returns {string}
|
|
6059
6242
|
*/
|
|
6060
6243
|
nextRowId() {
|
|
6061
6244
|
return this._ids.nextPrefixed('Row_');
|
|
6062
6245
|
}
|
|
6063
6246
|
|
|
6064
|
-
/**
|
|
6065
|
-
* @param {any} formField
|
|
6247
|
+
/**
|
|
6248
|
+
* @param {any} formField
|
|
6066
6249
|
*/
|
|
6067
6250
|
calculateLayout(formField) {
|
|
6068
6251
|
const {
|
|
@@ -6116,9 +6299,9 @@ function groupByRow(components, ids) {
|
|
|
6116
6299
|
});
|
|
6117
6300
|
}
|
|
6118
6301
|
|
|
6119
|
-
/**
|
|
6120
|
-
* @param {Array<FormRows>} formRows
|
|
6121
|
-
* @returns {Array<FormRow>}
|
|
6302
|
+
/**
|
|
6303
|
+
* @param {Array<FormRows>} formRows
|
|
6304
|
+
* @returns {Array<FormRow>}
|
|
6122
6305
|
*/
|
|
6123
6306
|
function allRows(formRows) {
|
|
6124
6307
|
return flatten(formRows.map(c => c.rows));
|
|
@@ -6240,55 +6423,55 @@ var core = {
|
|
|
6240
6423
|
validator: ['type', Validator]
|
|
6241
6424
|
};
|
|
6242
6425
|
|
|
6243
|
-
/**
|
|
6244
|
-
* @typedef { import('./types').Injector } Injector
|
|
6245
|
-
* @typedef { import('./types').Data } Data
|
|
6246
|
-
* @typedef { import('./types').Errors } Errors
|
|
6247
|
-
* @typedef { import('./types').Schema } Schema
|
|
6248
|
-
* @typedef { import('./types').FormProperties } FormProperties
|
|
6249
|
-
* @typedef { import('./types').FormProperty } FormProperty
|
|
6250
|
-
* @typedef { import('./types').FormEvent } FormEvent
|
|
6251
|
-
* @typedef { import('./types').FormOptions } FormOptions
|
|
6252
|
-
*
|
|
6253
|
-
* @typedef { {
|
|
6254
|
-
* data: Data,
|
|
6255
|
-
* initialData: Data,
|
|
6256
|
-
* errors: Errors,
|
|
6257
|
-
* properties: FormProperties,
|
|
6258
|
-
* schema: Schema
|
|
6259
|
-
* } } State
|
|
6260
|
-
*
|
|
6261
|
-
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6262
|
-
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6263
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6426
|
+
/**
|
|
6427
|
+
* @typedef { import('./types').Injector } Injector
|
|
6428
|
+
* @typedef { import('./types').Data } Data
|
|
6429
|
+
* @typedef { import('./types').Errors } Errors
|
|
6430
|
+
* @typedef { import('./types').Schema } Schema
|
|
6431
|
+
* @typedef { import('./types').FormProperties } FormProperties
|
|
6432
|
+
* @typedef { import('./types').FormProperty } FormProperty
|
|
6433
|
+
* @typedef { import('./types').FormEvent } FormEvent
|
|
6434
|
+
* @typedef { import('./types').FormOptions } FormOptions
|
|
6435
|
+
*
|
|
6436
|
+
* @typedef { {
|
|
6437
|
+
* data: Data,
|
|
6438
|
+
* initialData: Data,
|
|
6439
|
+
* errors: Errors,
|
|
6440
|
+
* properties: FormProperties,
|
|
6441
|
+
* schema: Schema
|
|
6442
|
+
* } } State
|
|
6443
|
+
*
|
|
6444
|
+
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6445
|
+
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6446
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6264
6447
|
*/
|
|
6265
6448
|
|
|
6266
6449
|
const ids = new Ids([32, 36, 1]);
|
|
6267
6450
|
|
|
6268
|
-
/**
|
|
6269
|
-
* The form.
|
|
6451
|
+
/**
|
|
6452
|
+
* The form.
|
|
6270
6453
|
*/
|
|
6271
6454
|
class Form {
|
|
6272
|
-
/**
|
|
6273
|
-
* @constructor
|
|
6274
|
-
* @param {FormOptions} options
|
|
6455
|
+
/**
|
|
6456
|
+
* @constructor
|
|
6457
|
+
* @param {FormOptions} options
|
|
6275
6458
|
*/
|
|
6276
6459
|
constructor(options = {}) {
|
|
6277
|
-
/**
|
|
6278
|
-
* @public
|
|
6279
|
-
* @type {OnEventType}
|
|
6460
|
+
/**
|
|
6461
|
+
* @public
|
|
6462
|
+
* @type {OnEventType}
|
|
6280
6463
|
*/
|
|
6281
6464
|
this.on = this._onEvent;
|
|
6282
6465
|
|
|
6283
|
-
/**
|
|
6284
|
-
* @public
|
|
6285
|
-
* @type {String}
|
|
6466
|
+
/**
|
|
6467
|
+
* @public
|
|
6468
|
+
* @type {String}
|
|
6286
6469
|
*/
|
|
6287
6470
|
this._id = ids.next();
|
|
6288
6471
|
|
|
6289
|
-
/**
|
|
6290
|
-
* @private
|
|
6291
|
-
* @type {Element}
|
|
6472
|
+
/**
|
|
6473
|
+
* @private
|
|
6474
|
+
* @type {Element}
|
|
6292
6475
|
*/
|
|
6293
6476
|
this._container = createFormContainer();
|
|
6294
6477
|
const {
|
|
@@ -6297,9 +6480,9 @@ class Form {
|
|
|
6297
6480
|
properties = {}
|
|
6298
6481
|
} = options;
|
|
6299
6482
|
|
|
6300
|
-
/**
|
|
6301
|
-
* @private
|
|
6302
|
-
* @type {State}
|
|
6483
|
+
/**
|
|
6484
|
+
* @private
|
|
6485
|
+
* @type {State}
|
|
6303
6486
|
*/
|
|
6304
6487
|
this._state = {
|
|
6305
6488
|
initialData: null,
|
|
@@ -6323,9 +6506,9 @@ class Form {
|
|
|
6323
6506
|
this._emit('form.clear');
|
|
6324
6507
|
}
|
|
6325
6508
|
|
|
6326
|
-
/**
|
|
6327
|
-
* Destroy the form, removing it from DOM,
|
|
6328
|
-
* if attached.
|
|
6509
|
+
/**
|
|
6510
|
+
* Destroy the form, removing it from DOM,
|
|
6511
|
+
* if attached.
|
|
6329
6512
|
*/
|
|
6330
6513
|
destroy() {
|
|
6331
6514
|
// destroy form services
|
|
@@ -6336,13 +6519,13 @@ class Form {
|
|
|
6336
6519
|
this._detach(false);
|
|
6337
6520
|
}
|
|
6338
6521
|
|
|
6339
|
-
/**
|
|
6340
|
-
* Open a form schema with the given initial data.
|
|
6341
|
-
*
|
|
6342
|
-
* @param {Schema} schema
|
|
6343
|
-
* @param {Data} [data]
|
|
6344
|
-
*
|
|
6345
|
-
* @return Promise<{ warnings: Array<any> }>
|
|
6522
|
+
/**
|
|
6523
|
+
* Open a form schema with the given initial data.
|
|
6524
|
+
*
|
|
6525
|
+
* @param {Schema} schema
|
|
6526
|
+
* @param {Data} [data]
|
|
6527
|
+
*
|
|
6528
|
+
* @return Promise<{ warnings: Array<any> }>
|
|
6346
6529
|
*/
|
|
6347
6530
|
importSchema(schema, data = {}) {
|
|
6348
6531
|
return new Promise((resolve, reject) => {
|
|
@@ -6375,10 +6558,10 @@ class Form {
|
|
|
6375
6558
|
});
|
|
6376
6559
|
}
|
|
6377
6560
|
|
|
6378
|
-
/**
|
|
6379
|
-
* Submit the form, triggering all field validations.
|
|
6380
|
-
*
|
|
6381
|
-
* @returns { { data: Data, errors: Errors } }
|
|
6561
|
+
/**
|
|
6562
|
+
* Submit the form, triggering all field validations.
|
|
6563
|
+
*
|
|
6564
|
+
* @returns { { data: Data, errors: Errors } }
|
|
6382
6565
|
*/
|
|
6383
6566
|
submit() {
|
|
6384
6567
|
const {
|
|
@@ -6404,8 +6587,8 @@ class Form {
|
|
|
6404
6587
|
});
|
|
6405
6588
|
}
|
|
6406
6589
|
|
|
6407
|
-
/**
|
|
6408
|
-
* @returns {Errors}
|
|
6590
|
+
/**
|
|
6591
|
+
* @returns {Errors}
|
|
6409
6592
|
*/
|
|
6410
6593
|
validate() {
|
|
6411
6594
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6435,8 +6618,8 @@ class Form {
|
|
|
6435
6618
|
return filteredErrors;
|
|
6436
6619
|
}
|
|
6437
6620
|
|
|
6438
|
-
/**
|
|
6439
|
-
* @param {Element|string} parentNode
|
|
6621
|
+
/**
|
|
6622
|
+
* @param {Element|string} parentNode
|
|
6440
6623
|
*/
|
|
6441
6624
|
attachTo(parentNode) {
|
|
6442
6625
|
if (!parentNode) {
|
|
@@ -6454,10 +6637,10 @@ class Form {
|
|
|
6454
6637
|
this._detach();
|
|
6455
6638
|
}
|
|
6456
6639
|
|
|
6457
|
-
/**
|
|
6458
|
-
* @private
|
|
6459
|
-
*
|
|
6460
|
-
* @param {boolean} [emit]
|
|
6640
|
+
/**
|
|
6641
|
+
* @private
|
|
6642
|
+
*
|
|
6643
|
+
* @param {boolean} [emit]
|
|
6461
6644
|
*/
|
|
6462
6645
|
_detach(emit = true) {
|
|
6463
6646
|
const container = this._container,
|
|
@@ -6471,9 +6654,9 @@ class Form {
|
|
|
6471
6654
|
parentNode.removeChild(container);
|
|
6472
6655
|
}
|
|
6473
6656
|
|
|
6474
|
-
/**
|
|
6475
|
-
* @param {FormProperty} property
|
|
6476
|
-
* @param {any} value
|
|
6657
|
+
/**
|
|
6658
|
+
* @param {FormProperty} property
|
|
6659
|
+
* @param {any} value
|
|
6477
6660
|
*/
|
|
6478
6661
|
setProperty(property, value) {
|
|
6479
6662
|
const properties = set(this._getState().properties, [property], value);
|
|
@@ -6482,21 +6665,21 @@ class Form {
|
|
|
6482
6665
|
});
|
|
6483
6666
|
}
|
|
6484
6667
|
|
|
6485
|
-
/**
|
|
6486
|
-
* @param {FormEvent} type
|
|
6487
|
-
* @param {Function} handler
|
|
6668
|
+
/**
|
|
6669
|
+
* @param {FormEvent} type
|
|
6670
|
+
* @param {Function} handler
|
|
6488
6671
|
*/
|
|
6489
6672
|
off(type, handler) {
|
|
6490
6673
|
this.get('eventBus').off(type, handler);
|
|
6491
6674
|
}
|
|
6492
6675
|
|
|
6493
|
-
/**
|
|
6494
|
-
* @private
|
|
6495
|
-
*
|
|
6496
|
-
* @param {FormOptions} options
|
|
6497
|
-
* @param {Element} container
|
|
6498
|
-
*
|
|
6499
|
-
* @returns {Injector}
|
|
6676
|
+
/**
|
|
6677
|
+
* @private
|
|
6678
|
+
*
|
|
6679
|
+
* @param {FormOptions} options
|
|
6680
|
+
* @param {Element} container
|
|
6681
|
+
*
|
|
6682
|
+
* @returns {Injector}
|
|
6500
6683
|
*/
|
|
6501
6684
|
_createInjector(options, container) {
|
|
6502
6685
|
const {
|
|
@@ -6515,17 +6698,17 @@ class Form {
|
|
|
6515
6698
|
}, core, ...modules, ...additionalModules]);
|
|
6516
6699
|
}
|
|
6517
6700
|
|
|
6518
|
-
/**
|
|
6519
|
-
* @private
|
|
6701
|
+
/**
|
|
6702
|
+
* @private
|
|
6520
6703
|
*/
|
|
6521
6704
|
_emit(type, data) {
|
|
6522
6705
|
this.get('eventBus').fire(type, data);
|
|
6523
6706
|
}
|
|
6524
6707
|
|
|
6525
|
-
/**
|
|
6526
|
-
* @internal
|
|
6527
|
-
*
|
|
6528
|
-
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6708
|
+
/**
|
|
6709
|
+
* @internal
|
|
6710
|
+
*
|
|
6711
|
+
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6529
6712
|
*/
|
|
6530
6713
|
_update(update) {
|
|
6531
6714
|
const {
|
|
@@ -6547,15 +6730,15 @@ class Form {
|
|
|
6547
6730
|
});
|
|
6548
6731
|
}
|
|
6549
6732
|
|
|
6550
|
-
/**
|
|
6551
|
-
* @internal
|
|
6733
|
+
/**
|
|
6734
|
+
* @internal
|
|
6552
6735
|
*/
|
|
6553
6736
|
_getState() {
|
|
6554
6737
|
return this._state;
|
|
6555
6738
|
}
|
|
6556
6739
|
|
|
6557
|
-
/**
|
|
6558
|
-
* @internal
|
|
6740
|
+
/**
|
|
6741
|
+
* @internal
|
|
6559
6742
|
*/
|
|
6560
6743
|
_setState(state) {
|
|
6561
6744
|
this._state = {
|
|
@@ -6565,22 +6748,22 @@ class Form {
|
|
|
6565
6748
|
this._emit('changed', this._getState());
|
|
6566
6749
|
}
|
|
6567
6750
|
|
|
6568
|
-
/**
|
|
6569
|
-
* @internal
|
|
6751
|
+
/**
|
|
6752
|
+
* @internal
|
|
6570
6753
|
*/
|
|
6571
6754
|
_getModules() {
|
|
6572
6755
|
return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule];
|
|
6573
6756
|
}
|
|
6574
6757
|
|
|
6575
|
-
/**
|
|
6576
|
-
* @internal
|
|
6758
|
+
/**
|
|
6759
|
+
* @internal
|
|
6577
6760
|
*/
|
|
6578
6761
|
_onEvent(type, priority, handler) {
|
|
6579
6762
|
this.get('eventBus').on(type, priority, handler);
|
|
6580
6763
|
}
|
|
6581
6764
|
|
|
6582
|
-
/**
|
|
6583
|
-
* @internal
|
|
6765
|
+
/**
|
|
6766
|
+
* @internal
|
|
6584
6767
|
*/
|
|
6585
6768
|
_getSubmitData() {
|
|
6586
6769
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6608,16 +6791,16 @@ class Form {
|
|
|
6608
6791
|
return filteredSubmitData;
|
|
6609
6792
|
}
|
|
6610
6793
|
|
|
6611
|
-
/**
|
|
6612
|
-
* @internal
|
|
6794
|
+
/**
|
|
6795
|
+
* @internal
|
|
6613
6796
|
*/
|
|
6614
6797
|
_applyConditions(toFilter, data, options = {}) {
|
|
6615
6798
|
const conditionChecker = this.get('conditionChecker');
|
|
6616
6799
|
return conditionChecker.applyConditions(toFilter, data, options);
|
|
6617
6800
|
}
|
|
6618
6801
|
|
|
6619
|
-
/**
|
|
6620
|
-
* @internal
|
|
6802
|
+
/**
|
|
6803
|
+
* @internal
|
|
6621
6804
|
*/
|
|
6622
6805
|
_initializeFieldData(data) {
|
|
6623
6806
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6654,7 +6837,7 @@ class Form {
|
|
|
6654
6837
|
}
|
|
6655
6838
|
}
|
|
6656
6839
|
|
|
6657
|
-
const schemaVersion =
|
|
6840
|
+
const schemaVersion = 12;
|
|
6658
6841
|
|
|
6659
6842
|
/**
|
|
6660
6843
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -6679,5 +6862,5 @@ function createForm(options) {
|
|
|
6679
6862
|
});
|
|
6680
6863
|
}
|
|
6681
6864
|
|
|
6682
|
-
export { Button, Checkbox, Checklist, ConditionChecker, DATETIME_SUBTYPES, DATETIME_SUBTYPES_LABELS, DATETIME_SUBTYPE_PATH, DATE_DISALLOW_PAST_PATH, DATE_LABEL_PATH, Datetime, FormComponent$1 as Default, ExpressionLanguageModule, FeelExpressionLanguage, FeelersTemplating, FieldFactory, Form, FormComponent, FormContext$1 as FormContext, FormField, FormFieldRegistry, FormFields, FormLayouter, FormRenderContext$1 as FormRenderContext, Group, Image, Importer, MINUTES_IN_DAY, MarkdownModule, MarkdownRenderer, Numberfield, PathRegistry, Radio, Select, Spacer, TIME_INTERVAL_PATH, TIME_LABEL_PATH, TIME_SERIALISINGFORMAT_LABELS, TIME_SERIALISING_FORMATS, TIME_SERIALISING_FORMAT_PATH, TIME_USE24H_PATH, Taglist, Text, Textarea, Textfield, VALUES_SOURCES, VALUES_SOURCES_DEFAULTS, VALUES_SOURCES_LABELS, VALUES_SOURCES_PATHS, VALUES_SOURCE_DEFAULT, ViewerCommands, ViewerCommandsModule, clone, createForm, createFormContainer, createInjector, formFields, generateIdForType, generateIndexForType, getSchemaVariables, getValuesSource, iconsByType, isRequired, pathParse, pathsEqual, runRecursively, schemaVersion };
|
|
6865
|
+
export { Button, Checkbox, Checklist, ConditionChecker, DATETIME_SUBTYPES, DATETIME_SUBTYPES_LABELS, DATETIME_SUBTYPE_PATH, DATE_DISALLOW_PAST_PATH, DATE_LABEL_PATH, Datetime, FormComponent$1 as Default, Description, Errors, ExpressionLanguageModule, FeelExpressionLanguage, FeelersTemplating, FieldFactory, Form, FormComponent, FormContext$1 as FormContext, FormField, FormFieldRegistry, FormFields, FormLayouter, FormRenderContext$1 as FormRenderContext, Group, Image, Importer, Label, MINUTES_IN_DAY, MarkdownModule, MarkdownRenderer, Numberfield, PathRegistry, Radio, Select, Separator, Spacer, TIME_INTERVAL_PATH, TIME_LABEL_PATH, TIME_SERIALISINGFORMAT_LABELS, TIME_SERIALISING_FORMATS, TIME_SERIALISING_FORMAT_PATH, TIME_USE24H_PATH, Taglist, Text, Textarea, Textfield, VALUES_SOURCES, VALUES_SOURCES_DEFAULTS, VALUES_SOURCES_LABELS, VALUES_SOURCES_PATHS, VALUES_SOURCE_DEFAULT, ViewerCommands, ViewerCommandsModule, clone, createForm, createFormContainer, createInjector, formFields, generateIdForType, generateIndexForType, getSchemaVariables, getValuesSource, iconsByType, isRequired, pathParse, pathsEqual, runRecursively, sanitizeHTML, sanitizeImageSource, schemaVersion };
|
|
6683
6866
|
//# sourceMappingURL=index.es.js.map
|