@bpmn-io/form-js-viewer 1.3.3 → 1.5.0-alpha.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 +836 -645
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +831 -646
- 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
|
|
@@ -3144,6 +3208,7 @@ function SimpleSelect(props) {
|
|
|
3144
3208
|
} = useContext(FormContext$1);
|
|
3145
3209
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
3146
3210
|
const selectRef = useRef();
|
|
3211
|
+
const inputRef = useRef();
|
|
3147
3212
|
const {
|
|
3148
3213
|
state: loadState,
|
|
3149
3214
|
values: options
|
|
@@ -3168,16 +3233,28 @@ function SimpleSelect(props) {
|
|
|
3168
3233
|
return ds;
|
|
3169
3234
|
}, [disabled, isDropdownExpanded, loadState, value]);
|
|
3170
3235
|
const onMouseDown = useCallback(e => {
|
|
3171
|
-
const
|
|
3236
|
+
const input = inputRef.current;
|
|
3172
3237
|
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3173
3238
|
if (isDropdownExpanded) {
|
|
3174
|
-
|
|
3239
|
+
input.blur();
|
|
3175
3240
|
} else {
|
|
3176
|
-
|
|
3241
|
+
input.focus();
|
|
3177
3242
|
}
|
|
3178
3243
|
e.preventDefault();
|
|
3179
3244
|
}, [isDropdownExpanded]);
|
|
3180
3245
|
const initialFocusIndex = useMemo(() => value && findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3246
|
+
const onInputFocus = useCallback(() => {
|
|
3247
|
+
if (!readonly) {
|
|
3248
|
+
setIsDropdownExpanded(true);
|
|
3249
|
+
onFocus && onFocus();
|
|
3250
|
+
}
|
|
3251
|
+
}, [onFocus, readonly]);
|
|
3252
|
+
const onInputBlur = useCallback(() => {
|
|
3253
|
+
if (!readonly) {
|
|
3254
|
+
setIsDropdownExpanded(false);
|
|
3255
|
+
onBlur && onBlur();
|
|
3256
|
+
}
|
|
3257
|
+
}, [onBlur, readonly]);
|
|
3181
3258
|
return jsxs(Fragment$1, {
|
|
3182
3259
|
children: [jsxs("div", {
|
|
3183
3260
|
ref: selectRef,
|
|
@@ -3188,11 +3265,8 @@ function SimpleSelect(props) {
|
|
|
3188
3265
|
}, {
|
|
3189
3266
|
'hasErrors': errors.length
|
|
3190
3267
|
}),
|
|
3191
|
-
onFocus:
|
|
3192
|
-
onBlur:
|
|
3193
|
-
setIsDropdownExpanded(false);
|
|
3194
|
-
onBlur();
|
|
3195
|
-
},
|
|
3268
|
+
onFocus: onInputFocus,
|
|
3269
|
+
onBlur: onInputBlur,
|
|
3196
3270
|
onMouseDown: onMouseDown,
|
|
3197
3271
|
children: [jsx("div", {
|
|
3198
3272
|
class: classNames('fjs-select-display', {
|
|
@@ -3201,11 +3275,12 @@ function SimpleSelect(props) {
|
|
|
3201
3275
|
id: prefixId(`${id}-display`, formId),
|
|
3202
3276
|
children: valueLabel || 'Select'
|
|
3203
3277
|
}), !disabled && jsx("input", {
|
|
3278
|
+
ref: inputRef,
|
|
3204
3279
|
id: prefixId(`${id}-search`, formId),
|
|
3205
3280
|
class: "fjs-select-hidden-input",
|
|
3206
3281
|
value: valueLabel,
|
|
3207
|
-
onFocus:
|
|
3208
|
-
onBlur:
|
|
3282
|
+
onFocus: onInputFocus,
|
|
3283
|
+
onBlur: onInputBlur,
|
|
3209
3284
|
"aria-describedby": props['aria-describedby']
|
|
3210
3285
|
}), displayState.displayCross && jsx("span", {
|
|
3211
3286
|
class: "fjs-select-cross",
|
|
@@ -3234,12 +3309,13 @@ function SimpleSelect(props) {
|
|
|
3234
3309
|
});
|
|
3235
3310
|
}
|
|
3236
3311
|
|
|
3237
|
-
const type$
|
|
3312
|
+
const type$6 = 'select';
|
|
3238
3313
|
function Select(props) {
|
|
3239
3314
|
const {
|
|
3240
3315
|
disabled,
|
|
3241
3316
|
errors = [],
|
|
3242
3317
|
onBlur,
|
|
3318
|
+
onFocus,
|
|
3243
3319
|
field,
|
|
3244
3320
|
onChange,
|
|
3245
3321
|
readonly,
|
|
@@ -3264,14 +3340,15 @@ function Select(props) {
|
|
|
3264
3340
|
disabled,
|
|
3265
3341
|
errors,
|
|
3266
3342
|
onBlur,
|
|
3343
|
+
onFocus,
|
|
3267
3344
|
field,
|
|
3268
3345
|
value,
|
|
3269
3346
|
onChange,
|
|
3270
3347
|
readonly,
|
|
3271
3348
|
'aria-describedby': errorMessageId
|
|
3272
|
-
}), [disabled, errors, field, id, value, onChange, onBlur, readonly, errorMessageId]);
|
|
3349
|
+
}), [disabled, errors, field, id, value, onChange, onBlur, onFocus, readonly, errorMessageId]);
|
|
3273
3350
|
return jsxs("div", {
|
|
3274
|
-
class: formFieldClasses(type$
|
|
3351
|
+
class: formFieldClasses(type$6, {
|
|
3275
3352
|
errors,
|
|
3276
3353
|
disabled,
|
|
3277
3354
|
readonly
|
|
@@ -3299,7 +3376,7 @@ function Select(props) {
|
|
|
3299
3376
|
});
|
|
3300
3377
|
}
|
|
3301
3378
|
Select.config = {
|
|
3302
|
-
type: type$
|
|
3379
|
+
type: type$6,
|
|
3303
3380
|
keyed: true,
|
|
3304
3381
|
label: 'Select',
|
|
3305
3382
|
group: 'selection',
|
|
@@ -3308,6 +3385,23 @@ Select.config = {
|
|
|
3308
3385
|
create: createEmptyOptions
|
|
3309
3386
|
};
|
|
3310
3387
|
|
|
3388
|
+
const type$5 = 'separator';
|
|
3389
|
+
function Separator() {
|
|
3390
|
+
return jsx("div", {
|
|
3391
|
+
class: formFieldClasses(type$5),
|
|
3392
|
+
children: jsx("hr", {})
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
Separator.config = {
|
|
3396
|
+
type: type$5,
|
|
3397
|
+
keyed: false,
|
|
3398
|
+
label: 'Separator',
|
|
3399
|
+
group: 'presentation',
|
|
3400
|
+
create: (options = {}) => ({
|
|
3401
|
+
...options
|
|
3402
|
+
})
|
|
3403
|
+
};
|
|
3404
|
+
|
|
3311
3405
|
const type$4 = 'spacer';
|
|
3312
3406
|
function Spacer(props) {
|
|
3313
3407
|
const {
|
|
@@ -3334,11 +3428,33 @@ Spacer.config = {
|
|
|
3334
3428
|
})
|
|
3335
3429
|
};
|
|
3336
3430
|
|
|
3431
|
+
function SkipLink(props) {
|
|
3432
|
+
const {
|
|
3433
|
+
className,
|
|
3434
|
+
label,
|
|
3435
|
+
onSkip
|
|
3436
|
+
} = props;
|
|
3437
|
+
const onKeyDown = useCallback(event => {
|
|
3438
|
+
if (event.key === 'Enter') {
|
|
3439
|
+
event.preventDefault();
|
|
3440
|
+
event.stopPropagation();
|
|
3441
|
+
onSkip();
|
|
3442
|
+
}
|
|
3443
|
+
}, [onSkip]);
|
|
3444
|
+
return jsx("a", {
|
|
3445
|
+
href: "#",
|
|
3446
|
+
class: classNames('fjs-skip-link', className),
|
|
3447
|
+
onKeyDown: onKeyDown,
|
|
3448
|
+
children: label
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3337
3452
|
const type$3 = 'taglist';
|
|
3338
3453
|
function Taglist(props) {
|
|
3339
3454
|
const {
|
|
3340
3455
|
disabled,
|
|
3341
3456
|
errors = [],
|
|
3457
|
+
onFocus,
|
|
3342
3458
|
onBlur,
|
|
3343
3459
|
field,
|
|
3344
3460
|
readonly,
|
|
@@ -3362,7 +3478,9 @@ function Taglist(props) {
|
|
|
3362
3478
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
3363
3479
|
const [hasOptionsLeft, setHasOptionsLeft] = useState(true);
|
|
3364
3480
|
const [isEscapeClosed, setIsEscapeClose] = useState(false);
|
|
3365
|
-
const
|
|
3481
|
+
const focusScopeRef = useRef();
|
|
3482
|
+
const inputRef = useRef();
|
|
3483
|
+
const eventBus = useService('eventBus');
|
|
3366
3484
|
const {
|
|
3367
3485
|
state: loadState,
|
|
3368
3486
|
values: options
|
|
@@ -3384,12 +3502,6 @@ function Taglist(props) {
|
|
|
3384
3502
|
useEffect(() => {
|
|
3385
3503
|
setHasOptionsLeft(options.length > values.length);
|
|
3386
3504
|
}, [options.length, values.length]);
|
|
3387
|
-
const onFilterChange = ({
|
|
3388
|
-
target
|
|
3389
|
-
}) => {
|
|
3390
|
-
setIsEscapeClose(false);
|
|
3391
|
-
setFilter(target.value);
|
|
3392
|
-
};
|
|
3393
3505
|
const selectValue = value => {
|
|
3394
3506
|
if (filter) {
|
|
3395
3507
|
setFilter('');
|
|
@@ -3410,6 +3522,16 @@ function Taglist(props) {
|
|
|
3410
3522
|
field
|
|
3411
3523
|
});
|
|
3412
3524
|
};
|
|
3525
|
+
const onInputChange = ({
|
|
3526
|
+
target
|
|
3527
|
+
}) => {
|
|
3528
|
+
setIsEscapeClose(false);
|
|
3529
|
+
setFilter(target.value || '');
|
|
3530
|
+
eventBus.fire('formField.search', {
|
|
3531
|
+
formField: field,
|
|
3532
|
+
value: target.value || ''
|
|
3533
|
+
});
|
|
3534
|
+
};
|
|
3413
3535
|
const onInputKeyDown = e => {
|
|
3414
3536
|
switch (e.key) {
|
|
3415
3537
|
case 'ArrowUp':
|
|
@@ -3432,10 +3554,26 @@ function Taglist(props) {
|
|
|
3432
3554
|
break;
|
|
3433
3555
|
}
|
|
3434
3556
|
};
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3557
|
+
const onElementBlur = e => {
|
|
3558
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3559
|
+
onBlur && onBlur();
|
|
3560
|
+
};
|
|
3561
|
+
const onElementFocus = e => {
|
|
3562
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3563
|
+
onFocus && onFocus();
|
|
3564
|
+
};
|
|
3565
|
+
const onInputBlur = e => {
|
|
3566
|
+
if (!readonly) {
|
|
3567
|
+
setIsDropdownExpanded(false);
|
|
3568
|
+
setFilter('');
|
|
3569
|
+
}
|
|
3570
|
+
onElementBlur(e);
|
|
3571
|
+
};
|
|
3572
|
+
const onInputFocus = e => {
|
|
3573
|
+
if (!readonly) {
|
|
3574
|
+
setIsDropdownExpanded(true);
|
|
3575
|
+
}
|
|
3576
|
+
onElementFocus(e);
|
|
3439
3577
|
};
|
|
3440
3578
|
const onTagRemoveClick = (event, value) => {
|
|
3441
3579
|
const {
|
|
@@ -3446,11 +3584,15 @@ function Taglist(props) {
|
|
|
3446
3584
|
// restore focus if there is no next sibling to focus
|
|
3447
3585
|
const nextTag = target.closest('.fjs-taglist-tag').nextSibling;
|
|
3448
3586
|
if (!nextTag) {
|
|
3449
|
-
|
|
3587
|
+
inputRef.current.focus();
|
|
3450
3588
|
}
|
|
3451
3589
|
};
|
|
3590
|
+
const onSkipToSearch = () => {
|
|
3591
|
+
inputRef.current.focus();
|
|
3592
|
+
};
|
|
3452
3593
|
const shouldDisplayDropdown = useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3453
3594
|
return jsxs("div", {
|
|
3595
|
+
ref: focusScopeRef,
|
|
3454
3596
|
class: formFieldClasses(type$3, {
|
|
3455
3597
|
errors,
|
|
3456
3598
|
disabled,
|
|
@@ -3466,6 +3608,10 @@ function Taglist(props) {
|
|
|
3466
3608
|
label: label,
|
|
3467
3609
|
required: required,
|
|
3468
3610
|
id: prefixId(`${id}-search`, formId)
|
|
3611
|
+
}), !disabled && !readonly && !!values.length && jsx(SkipLink, {
|
|
3612
|
+
className: "fjs-taglist-skip-link",
|
|
3613
|
+
label: "Skip to search",
|
|
3614
|
+
onSkip: onSkipToSearch
|
|
3469
3615
|
}), jsxs("div", {
|
|
3470
3616
|
class: classNames('fjs-taglist', {
|
|
3471
3617
|
'fjs-disabled': disabled,
|
|
@@ -3487,6 +3633,8 @@ function Taglist(props) {
|
|
|
3487
3633
|
type: "button",
|
|
3488
3634
|
title: "Remove tag",
|
|
3489
3635
|
class: "fjs-taglist-tag-remove",
|
|
3636
|
+
onFocus: onElementFocus,
|
|
3637
|
+
onBlur: onElementBlur,
|
|
3490
3638
|
onClick: event => onTagRemoveClick(event, v),
|
|
3491
3639
|
children: jsx(XMarkIcon, {})
|
|
3492
3640
|
})]
|
|
@@ -3496,17 +3644,17 @@ function Taglist(props) {
|
|
|
3496
3644
|
disabled: disabled,
|
|
3497
3645
|
readOnly: readonly,
|
|
3498
3646
|
class: "fjs-taglist-input",
|
|
3499
|
-
ref:
|
|
3647
|
+
ref: inputRef,
|
|
3500
3648
|
id: prefixId(`${id}-search`, formId),
|
|
3501
|
-
onChange:
|
|
3649
|
+
onChange: onInputChange,
|
|
3502
3650
|
type: "text",
|
|
3503
3651
|
value: filter,
|
|
3504
3652
|
placeholder: disabled || readonly ? undefined : 'Search',
|
|
3505
3653
|
autoComplete: "off",
|
|
3506
3654
|
onKeyDown: onInputKeyDown,
|
|
3507
3655
|
onMouseDown: () => setIsEscapeClose(false),
|
|
3508
|
-
onFocus:
|
|
3509
|
-
onBlur:
|
|
3656
|
+
onFocus: onInputFocus,
|
|
3657
|
+
onBlur: onInputBlur,
|
|
3510
3658
|
"aria-describedby": errorMessageId
|
|
3511
3659
|
})]
|
|
3512
3660
|
}), jsx("div", {
|
|
@@ -3516,7 +3664,7 @@ function Taglist(props) {
|
|
|
3516
3664
|
getLabel: o => o.label,
|
|
3517
3665
|
onValueSelected: o => selectValue(o.value),
|
|
3518
3666
|
emptyListMessage: hasOptionsLeft ? 'No results' : 'All values selected',
|
|
3519
|
-
listenerElement:
|
|
3667
|
+
listenerElement: inputRef.current
|
|
3520
3668
|
})
|
|
3521
3669
|
}), jsx(Description, {
|
|
3522
3670
|
description: description
|
|
@@ -3626,6 +3774,7 @@ function Textfield(props) {
|
|
|
3626
3774
|
disabled,
|
|
3627
3775
|
errors = [],
|
|
3628
3776
|
onBlur,
|
|
3777
|
+
onFocus,
|
|
3629
3778
|
field,
|
|
3630
3779
|
readonly,
|
|
3631
3780
|
value = ''
|
|
@@ -3677,7 +3826,8 @@ function Textfield(props) {
|
|
|
3677
3826
|
readOnly: readonly,
|
|
3678
3827
|
id: prefixId(id, formId),
|
|
3679
3828
|
onInput: onChange,
|
|
3680
|
-
onBlur: onBlur,
|
|
3829
|
+
onBlur: () => onBlur && onBlur(),
|
|
3830
|
+
onFocus: () => onFocus && onFocus(),
|
|
3681
3831
|
type: "text",
|
|
3682
3832
|
value: value,
|
|
3683
3833
|
"aria-describedby": errorMessageId
|
|
@@ -3720,6 +3870,7 @@ function Textarea(props) {
|
|
|
3720
3870
|
disabled,
|
|
3721
3871
|
errors = [],
|
|
3722
3872
|
onBlur,
|
|
3873
|
+
onFocus,
|
|
3723
3874
|
field,
|
|
3724
3875
|
readonly,
|
|
3725
3876
|
value = ''
|
|
@@ -3768,7 +3919,8 @@ function Textarea(props) {
|
|
|
3768
3919
|
readonly: readonly,
|
|
3769
3920
|
id: prefixId(id, formId),
|
|
3770
3921
|
onInput: onInput,
|
|
3771
|
-
onBlur: onBlur,
|
|
3922
|
+
onBlur: () => onBlur && onBlur(),
|
|
3923
|
+
onFocus: () => onFocus && onFocus(),
|
|
3772
3924
|
value: value,
|
|
3773
3925
|
ref: textareaRef,
|
|
3774
3926
|
"aria-describedby": errorMessageId
|
|
@@ -3812,39 +3964,39 @@ const autoSizeTextarea = textarea => {
|
|
|
3812
3964
|
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3813
3965
|
};
|
|
3814
3966
|
|
|
3815
|
-
var _path$
|
|
3816
|
-
function _extends$
|
|
3967
|
+
var _path$d;
|
|
3968
|
+
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
3969
|
var SvgButton = function SvgButton(props) {
|
|
3818
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3970
|
+
return /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
3819
3971
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3820
3972
|
width: 54,
|
|
3821
3973
|
height: 54,
|
|
3822
3974
|
fill: "currentcolor"
|
|
3823
|
-
}, props), _path$
|
|
3975
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
|
|
3824
3976
|
fillRule: "evenodd",
|
|
3825
3977
|
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
3978
|
})));
|
|
3827
3979
|
};
|
|
3828
3980
|
var ButtonIcon = SvgButton;
|
|
3829
3981
|
|
|
3830
|
-
var _path$
|
|
3831
|
-
function _extends$
|
|
3982
|
+
var _path$c;
|
|
3983
|
+
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
3984
|
var SvgCheckbox = function SvgCheckbox(props) {
|
|
3833
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3985
|
+
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
3834
3986
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3835
3987
|
width: 54,
|
|
3836
3988
|
height: 54,
|
|
3837
3989
|
fill: "currentcolor"
|
|
3838
|
-
}, props), _path$
|
|
3990
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
|
|
3839
3991
|
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
3992
|
})));
|
|
3841
3993
|
};
|
|
3842
3994
|
var CheckboxIcon = SvgCheckbox;
|
|
3843
3995
|
|
|
3844
3996
|
var _g, _use, _use2, _use3, _defs;
|
|
3845
|
-
function _extends$
|
|
3997
|
+
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
3998
|
var SvgChecklist = function SvgChecklist(props) {
|
|
3847
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
3999
|
+
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
3848
4000
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3849
4001
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3850
4002
|
width: 54,
|
|
@@ -3878,18 +4030,18 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3878
4030
|
};
|
|
3879
4031
|
var ChecklistIcon = SvgChecklist;
|
|
3880
4032
|
|
|
3881
|
-
var _path$
|
|
3882
|
-
function _extends$
|
|
4033
|
+
var _path$b, _path2$2, _path3;
|
|
4034
|
+
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
4035
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3884
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4036
|
+
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
3885
4037
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3886
4038
|
width: 54,
|
|
3887
4039
|
height: 54,
|
|
3888
4040
|
fill: "currentcolor"
|
|
3889
|
-
}, props), _path$
|
|
4041
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
|
|
3890
4042
|
fillRule: "evenodd",
|
|
3891
4043
|
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$
|
|
4044
|
+
})), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
|
|
3893
4045
|
d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
|
|
3894
4046
|
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
3895
4047
|
fillRule: "evenodd",
|
|
@@ -3898,27 +4050,27 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3898
4050
|
};
|
|
3899
4051
|
var DatetimeIcon = SvgDatetime;
|
|
3900
4052
|
|
|
3901
|
-
var _path$
|
|
3902
|
-
function _extends$
|
|
4053
|
+
var _path$a, _path2$1;
|
|
4054
|
+
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
4055
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3904
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4056
|
+
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3905
4057
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3906
4058
|
width: 54,
|
|
3907
4059
|
height: 54,
|
|
3908
4060
|
fill: "currentcolor"
|
|
3909
|
-
}, props), _path$
|
|
4061
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
|
|
3910
4062
|
fillRule: "evenodd",
|
|
3911
4063
|
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$
|
|
4064
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
3913
4065
|
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
4066
|
})));
|
|
3915
4067
|
};
|
|
3916
4068
|
var TaglistIcon = SvgTaglist;
|
|
3917
4069
|
|
|
3918
4070
|
var _rect, _rect2, _rect3;
|
|
3919
|
-
function _extends$
|
|
4071
|
+
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
4072
|
var SvgForm = function SvgForm(props) {
|
|
3921
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
4073
|
+
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
3922
4074
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3923
4075
|
width: 54,
|
|
3924
4076
|
height: 54
|
|
@@ -3944,9 +4096,24 @@ var SvgForm = function SvgForm(props) {
|
|
|
3944
4096
|
};
|
|
3945
4097
|
var FormIcon = SvgForm;
|
|
3946
4098
|
|
|
4099
|
+
var _path$9;
|
|
4100
|
+
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); }
|
|
4101
|
+
var SvgGroup = function SvgGroup(props) {
|
|
4102
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
4103
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4104
|
+
width: 54,
|
|
4105
|
+
height: 54,
|
|
4106
|
+
fill: "currentcolor"
|
|
4107
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
|
|
4108
|
+
fillRule: "evenodd",
|
|
4109
|
+
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"
|
|
4110
|
+
})));
|
|
4111
|
+
};
|
|
4112
|
+
var GroupIcon = SvgGroup;
|
|
4113
|
+
|
|
3947
4114
|
var _path$8;
|
|
3948
4115
|
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
|
|
4116
|
+
var SvgNumber = function SvgNumber(props) {
|
|
3950
4117
|
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
3951
4118
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3952
4119
|
width: 54,
|
|
@@ -3954,74 +4121,66 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3954
4121
|
fill: "currentcolor"
|
|
3955
4122
|
}, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
|
|
3956
4123
|
fillRule: "evenodd",
|
|
3957
|
-
d: "
|
|
4124
|
+
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
4125
|
})));
|
|
3959
4126
|
};
|
|
3960
|
-
var
|
|
4127
|
+
var NumberIcon = SvgNumber;
|
|
3961
4128
|
|
|
3962
4129
|
var _path$7;
|
|
3963
4130
|
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
|
|
4131
|
+
var SvgRadio = function SvgRadio(props) {
|
|
3965
4132
|
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
3966
4133
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3967
4134
|
width: 54,
|
|
3968
4135
|
height: 54,
|
|
3969
4136
|
fill: "currentcolor"
|
|
3970
4137
|
}, 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"
|
|
4138
|
+
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
4139
|
})));
|
|
3974
4140
|
};
|
|
3975
|
-
var
|
|
4141
|
+
var RadioIcon = SvgRadio;
|
|
3976
4142
|
|
|
3977
4143
|
var _path$6;
|
|
3978
4144
|
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
|
|
4145
|
+
var SvgSelect = function SvgSelect(props) {
|
|
3980
4146
|
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
3981
4147
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3982
4148
|
width: 54,
|
|
3983
4149
|
height: 54,
|
|
3984
4150
|
fill: "currentcolor"
|
|
3985
4151
|
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
3986
|
-
|
|
4152
|
+
fillRule: "evenodd",
|
|
4153
|
+
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
4154
|
})));
|
|
3988
4155
|
};
|
|
3989
|
-
var
|
|
4156
|
+
var SelectIcon = SvgSelect;
|
|
3990
4157
|
|
|
3991
4158
|
var _path$5;
|
|
3992
4159
|
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
|
|
4160
|
+
var SvgSeparator = function SvgSeparator(props) {
|
|
3994
4161
|
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
3995
4162
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3996
4163
|
width: 54,
|
|
3997
4164
|
height: 54,
|
|
3998
|
-
fill: "
|
|
4165
|
+
fill: "none"
|
|
3999
4166
|
}, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
|
|
4000
|
-
|
|
4001
|
-
d: "
|
|
4167
|
+
fill: "currentColor",
|
|
4168
|
+
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
4169
|
})));
|
|
4003
4170
|
};
|
|
4004
|
-
var
|
|
4171
|
+
var SeparatorIcon = SvgSeparator;
|
|
4005
4172
|
|
|
4006
|
-
var _path$4
|
|
4173
|
+
var _path$4;
|
|
4007
4174
|
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
4175
|
var SvgSpacer = function SvgSpacer(props) {
|
|
4009
4176
|
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
4010
4177
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4011
4178
|
width: 54,
|
|
4012
4179
|
height: 54,
|
|
4013
|
-
fill: "
|
|
4180
|
+
fill: "none"
|
|
4014
4181
|
}, 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"
|
|
4182
|
+
fill: "currentColor",
|
|
4183
|
+
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
4184
|
})));
|
|
4026
4185
|
};
|
|
4027
4186
|
var SpacerIcon = SvgSpacer;
|
|
@@ -4102,6 +4261,7 @@ const iconsByType = type => {
|
|
|
4102
4261
|
number: NumberIcon,
|
|
4103
4262
|
radio: RadioIcon,
|
|
4104
4263
|
select: SelectIcon,
|
|
4264
|
+
separator: SeparatorIcon,
|
|
4105
4265
|
spacer: SpacerIcon,
|
|
4106
4266
|
taglist: TaglistIcon,
|
|
4107
4267
|
text: TextIcon,
|
|
@@ -4111,7 +4271,7 @@ const iconsByType = type => {
|
|
|
4111
4271
|
}[type];
|
|
4112
4272
|
};
|
|
4113
4273
|
|
|
4114
|
-
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Taglist, Text, Textfield, Textarea];
|
|
4274
|
+
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, Taglist, Text, Textfield, Textarea];
|
|
4115
4275
|
|
|
4116
4276
|
class FormFields {
|
|
4117
4277
|
constructor() {
|
|
@@ -4172,10 +4332,10 @@ function createInjector(bootstrapModules) {
|
|
|
4172
4332
|
return injector;
|
|
4173
4333
|
}
|
|
4174
4334
|
|
|
4175
|
-
/**
|
|
4176
|
-
* @param {string?} prefix
|
|
4177
|
-
*
|
|
4178
|
-
* @returns Element
|
|
4335
|
+
/**
|
|
4336
|
+
* @param {string?} prefix
|
|
4337
|
+
*
|
|
4338
|
+
* @returns Element
|
|
4179
4339
|
*/
|
|
4180
4340
|
function createFormContainer(prefix = 'fjs') {
|
|
4181
4341
|
const container = document.createElement('div');
|
|
@@ -4212,22 +4372,47 @@ function generateIdForType(type) {
|
|
|
4212
4372
|
return `${type}${generateIndexForType(type)}`;
|
|
4213
4373
|
}
|
|
4214
4374
|
|
|
4215
|
-
/**
|
|
4216
|
-
* @template T
|
|
4217
|
-
* @param {T} data
|
|
4218
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4219
|
-
* @return {T}
|
|
4375
|
+
/**
|
|
4376
|
+
* @template T
|
|
4377
|
+
* @param {T} data
|
|
4378
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4379
|
+
* @return {T}
|
|
4220
4380
|
*/
|
|
4221
4381
|
function clone(data, replacer) {
|
|
4222
4382
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
4223
4383
|
}
|
|
4224
4384
|
|
|
4225
|
-
/**
|
|
4226
|
-
*
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
*
|
|
4385
|
+
/**
|
|
4386
|
+
* @typedef { import('../types').Schema } Schema
|
|
4387
|
+
*/
|
|
4388
|
+
|
|
4389
|
+
/**
|
|
4390
|
+
* Parse the schema for variables a form might make use of.
|
|
4391
|
+
*
|
|
4392
|
+
* @example
|
|
4393
|
+
*
|
|
4394
|
+
* // retrieve variables from schema
|
|
4395
|
+
* const variables = getSchemaVariables(schema);
|
|
4396
|
+
*
|
|
4397
|
+
* @example
|
|
4398
|
+
*
|
|
4399
|
+
* // retrieve input variables from schema
|
|
4400
|
+
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
4401
|
+
*
|
|
4402
|
+
* @example
|
|
4403
|
+
*
|
|
4404
|
+
* // retrieve output variables from schema
|
|
4405
|
+
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
4406
|
+
*
|
|
4407
|
+
* @param {Schema} schema
|
|
4408
|
+
* @param {object} [options]
|
|
4409
|
+
* @param {any} [options.expressionLanguage]
|
|
4410
|
+
* @param {any} [options.templating]
|
|
4411
|
+
* @param {any} [options.formFields]
|
|
4412
|
+
* @param {boolean} [options.inputs=true]
|
|
4413
|
+
* @param {boolean} [options.outputs=true]
|
|
4414
|
+
*
|
|
4415
|
+
* @return {string[]}
|
|
4231
4416
|
*/
|
|
4232
4417
|
function getSchemaVariables(schema, options = {}) {
|
|
4233
4418
|
const {
|
|
@@ -4310,9 +4495,9 @@ function runRecursively(formField, fn) {
|
|
|
4310
4495
|
fn(formField);
|
|
4311
4496
|
}
|
|
4312
4497
|
|
|
4313
|
-
/**
|
|
4314
|
-
* @typedef {object} Condition
|
|
4315
|
-
* @property {string} [hide]
|
|
4498
|
+
/**
|
|
4499
|
+
* @typedef {object} Condition
|
|
4500
|
+
* @property {string} [hide]
|
|
4316
4501
|
*/
|
|
4317
4502
|
|
|
4318
4503
|
class ConditionChecker {
|
|
@@ -4322,13 +4507,13 @@ class ConditionChecker {
|
|
|
4322
4507
|
this._eventBus = eventBus;
|
|
4323
4508
|
}
|
|
4324
4509
|
|
|
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]
|
|
4510
|
+
/**
|
|
4511
|
+
* For given data, remove properties based on condition.
|
|
4512
|
+
*
|
|
4513
|
+
* @param {Object<string, any>} properties
|
|
4514
|
+
* @param {Object<string, any>} data
|
|
4515
|
+
* @param {Object} [options]
|
|
4516
|
+
* @param {Function} [options.getFilterPath]
|
|
4332
4517
|
*/
|
|
4333
4518
|
applyConditions(properties, data = {}, options = {}) {
|
|
4334
4519
|
const newProperties = clone(properties);
|
|
@@ -4357,13 +4542,13 @@ class ConditionChecker {
|
|
|
4357
4542
|
return newProperties;
|
|
4358
4543
|
}
|
|
4359
4544
|
|
|
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}
|
|
4545
|
+
/**
|
|
4546
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4547
|
+
*
|
|
4548
|
+
* @param {string} condition
|
|
4549
|
+
* @param {import('../../types').Data} [data]
|
|
4550
|
+
*
|
|
4551
|
+
* @returns {boolean|null}
|
|
4367
4552
|
*/
|
|
4368
4553
|
check(condition, data = {}) {
|
|
4369
4554
|
if (!condition) {
|
|
@@ -4384,12 +4569,12 @@ class ConditionChecker {
|
|
|
4384
4569
|
}
|
|
4385
4570
|
}
|
|
4386
4571
|
|
|
4387
|
-
/**
|
|
4388
|
-
* Check if hide condition is met.
|
|
4389
|
-
*
|
|
4390
|
-
* @param {Condition} condition
|
|
4391
|
-
* @param {Object<string, any>} data
|
|
4392
|
-
* @returns {boolean}
|
|
4572
|
+
/**
|
|
4573
|
+
* Check if hide condition is met.
|
|
4574
|
+
*
|
|
4575
|
+
* @param {Condition} condition
|
|
4576
|
+
* @param {Object<string, any>} data
|
|
4577
|
+
* @returns {boolean}
|
|
4393
4578
|
*/
|
|
4394
4579
|
_checkHideCondition(condition, data) {
|
|
4395
4580
|
if (!condition.hide) {
|
|
@@ -4425,12 +4610,12 @@ class MarkdownRenderer {
|
|
|
4425
4610
|
this._converter = new showdown.Converter();
|
|
4426
4611
|
}
|
|
4427
4612
|
|
|
4428
|
-
/**
|
|
4429
|
-
* Render markdown to HTML.
|
|
4430
|
-
*
|
|
4431
|
-
* @param {string} markdown - The markdown to render
|
|
4432
|
-
*
|
|
4433
|
-
* @returns {string} HTML
|
|
4613
|
+
/**
|
|
4614
|
+
* Render markdown to HTML.
|
|
4615
|
+
*
|
|
4616
|
+
* @param {string} markdown - The markdown to render
|
|
4617
|
+
*
|
|
4618
|
+
* @returns {string} HTML
|
|
4434
4619
|
*/
|
|
4435
4620
|
render(markdown) {
|
|
4436
4621
|
return this._converter.makeHtml(markdown);
|
|
@@ -5553,8 +5738,8 @@ Validator.$inject = ['expressionLanguage', 'conditionChecker', 'form'];
|
|
|
5553
5738
|
|
|
5554
5739
|
// helpers //////////
|
|
5555
5740
|
|
|
5556
|
-
/**
|
|
5557
|
-
* Helper function to evaluate optional FEEL validation values.
|
|
5741
|
+
/**
|
|
5742
|
+
* Helper function to evaluate optional FEEL validation values.
|
|
5558
5743
|
*/
|
|
5559
5744
|
function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
5560
5745
|
const evaluatedValidate = {
|
|
@@ -5588,12 +5773,12 @@ function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form
|
|
|
5588
5773
|
}
|
|
5589
5774
|
|
|
5590
5775
|
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
|
|
5776
|
+
/**
|
|
5777
|
+
* @constructor
|
|
5778
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5779
|
+
* @param { import('./PathRegistry').default } pathRegistry
|
|
5780
|
+
* @param { import('./FieldFactory').default } fieldFactory
|
|
5781
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
5597
5782
|
*/
|
|
5598
5783
|
constructor(formFieldRegistry, pathRegistry, fieldFactory, formLayouter) {
|
|
5599
5784
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5602,21 +5787,21 @@ class Importer {
|
|
|
5602
5787
|
this._formLayouter = formLayouter;
|
|
5603
5788
|
}
|
|
5604
5789
|
|
|
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}
|
|
5790
|
+
/**
|
|
5791
|
+
* Import schema creating rows, fields, attaching additional
|
|
5792
|
+
* information to each field and adding fields to the
|
|
5793
|
+
* field registry.
|
|
5794
|
+
*
|
|
5795
|
+
* Additional information attached:
|
|
5796
|
+
*
|
|
5797
|
+
* * `id` (unless present)
|
|
5798
|
+
* * `_parent`
|
|
5799
|
+
* * `_path`
|
|
5800
|
+
*
|
|
5801
|
+
* @param {any} schema
|
|
5802
|
+
*
|
|
5803
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5804
|
+
* @returns {ImportResult}
|
|
5620
5805
|
*/
|
|
5621
5806
|
importSchema(schema) {
|
|
5622
5807
|
// TODO: Add warnings
|
|
@@ -5641,12 +5826,12 @@ class Importer {
|
|
|
5641
5826
|
this._pathRegistry.clear();
|
|
5642
5827
|
}
|
|
5643
5828
|
|
|
5644
|
-
/**
|
|
5645
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
5646
|
-
* @param {String} [parentId]
|
|
5647
|
-
* @param {number} [index]
|
|
5648
|
-
*
|
|
5649
|
-
* @return {any} field
|
|
5829
|
+
/**
|
|
5830
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
5831
|
+
* @param {String} [parentId]
|
|
5832
|
+
* @param {number} [index]
|
|
5833
|
+
*
|
|
5834
|
+
* @return {any} field
|
|
5650
5835
|
*/
|
|
5651
5836
|
importFormField(fieldAttrs, parentId, index) {
|
|
5652
5837
|
const {
|
|
@@ -5671,11 +5856,11 @@ class Importer {
|
|
|
5671
5856
|
return field;
|
|
5672
5857
|
}
|
|
5673
5858
|
|
|
5674
|
-
/**
|
|
5675
|
-
* @param {Array<any>} components
|
|
5676
|
-
* @param {string} parentId
|
|
5677
|
-
*
|
|
5678
|
-
* @return {Array<any>} imported components
|
|
5859
|
+
/**
|
|
5860
|
+
* @param {Array<any>} components
|
|
5861
|
+
* @param {string} parentId
|
|
5862
|
+
*
|
|
5863
|
+
* @return {Array<any>} imported components
|
|
5679
5864
|
*/
|
|
5680
5865
|
importFormFields(components, parentId) {
|
|
5681
5866
|
return components.map((component, index) => {
|
|
@@ -5686,11 +5871,11 @@ class Importer {
|
|
|
5686
5871
|
Importer.$inject = ['formFieldRegistry', 'pathRegistry', 'fieldFactory', 'formLayouter'];
|
|
5687
5872
|
|
|
5688
5873
|
class FieldFactory {
|
|
5689
|
-
/**
|
|
5690
|
-
* @constructor
|
|
5691
|
-
*
|
|
5692
|
-
* @param formFieldRegistry
|
|
5693
|
-
* @param formFields
|
|
5874
|
+
/**
|
|
5875
|
+
* @constructor
|
|
5876
|
+
*
|
|
5877
|
+
* @param formFieldRegistry
|
|
5878
|
+
* @param formFields
|
|
5694
5879
|
*/
|
|
5695
5880
|
constructor(formFieldRegistry, pathRegistry, formFields) {
|
|
5696
5881
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5772,36 +5957,36 @@ class FieldFactory {
|
|
|
5772
5957
|
}
|
|
5773
5958
|
FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
|
|
5774
5959
|
|
|
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
|
-
* ]
|
|
5960
|
+
/**
|
|
5961
|
+
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5962
|
+
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5963
|
+
*
|
|
5964
|
+
* Example Tree Structure:
|
|
5965
|
+
*
|
|
5966
|
+
* [
|
|
5967
|
+
* {
|
|
5968
|
+
* segment: 'root',
|
|
5969
|
+
* claimCount: 1,
|
|
5970
|
+
* children: [
|
|
5971
|
+
* {
|
|
5972
|
+
* segment: 'child1',
|
|
5973
|
+
* claimCount: 2,
|
|
5974
|
+
* children: null // A leaf node (closed path)
|
|
5975
|
+
* },
|
|
5976
|
+
* {
|
|
5977
|
+
* segment: 'child2',
|
|
5978
|
+
* claimCount: 1,
|
|
5979
|
+
* children: [
|
|
5980
|
+
* {
|
|
5981
|
+
* segment: 'subChild1',
|
|
5982
|
+
* claimCount: 1,
|
|
5983
|
+
* children: [] // An open node (open path)
|
|
5984
|
+
* }
|
|
5985
|
+
* ]
|
|
5986
|
+
* }
|
|
5987
|
+
* ]
|
|
5988
|
+
* }
|
|
5989
|
+
* ]
|
|
5805
5990
|
*/
|
|
5806
5991
|
class PathRegistry {
|
|
5807
5992
|
constructor(formFieldRegistry, formFields) {
|
|
@@ -5884,16 +6069,16 @@ class PathRegistry {
|
|
|
5884
6069
|
}
|
|
5885
6070
|
}
|
|
5886
6071
|
|
|
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.
|
|
6072
|
+
/**
|
|
6073
|
+
* Applies a function (fn) recursively on a given field and its children.
|
|
6074
|
+
*
|
|
6075
|
+
* - `field`: Starting field object.
|
|
6076
|
+
* - `fn`: Function to apply.
|
|
6077
|
+
* - `context`: Optional object for passing data between calls.
|
|
6078
|
+
*
|
|
6079
|
+
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
6080
|
+
*
|
|
6081
|
+
* @returns {boolean} Success status based on function execution.
|
|
5897
6082
|
*/
|
|
5898
6083
|
executeRecursivelyOnFields(field, fn, context = {}) {
|
|
5899
6084
|
let result = true;
|
|
@@ -5927,15 +6112,15 @@ class PathRegistry {
|
|
|
5927
6112
|
return result;
|
|
5928
6113
|
}
|
|
5929
6114
|
|
|
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.
|
|
6115
|
+
/**
|
|
6116
|
+
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
6117
|
+
*
|
|
6118
|
+
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
6119
|
+
* @param {Object} [options={}] - Configuration options.
|
|
6120
|
+
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
6121
|
+
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
6122
|
+
*
|
|
6123
|
+
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
5939
6124
|
*/
|
|
5940
6125
|
getValuePath(field, options = {}) {
|
|
5941
6126
|
const {
|
|
@@ -5979,23 +6164,23 @@ const _getNextSegment = (node, segment) => {
|
|
|
5979
6164
|
};
|
|
5980
6165
|
PathRegistry.$inject = ['formFieldRegistry', 'formFields'];
|
|
5981
6166
|
|
|
5982
|
-
/**
|
|
5983
|
-
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
5984
|
-
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6167
|
+
/**
|
|
6168
|
+
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6169
|
+
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
5985
6170
|
*/
|
|
5986
6171
|
|
|
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
|
-
*
|
|
6172
|
+
/**
|
|
6173
|
+
* Maintains the Form layout in a given structure, for example
|
|
6174
|
+
*
|
|
6175
|
+
* [
|
|
6176
|
+
* {
|
|
6177
|
+
* formFieldId: 'FormField_1',
|
|
6178
|
+
* rows: [
|
|
6179
|
+
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
6180
|
+
* ]
|
|
6181
|
+
* }
|
|
6182
|
+
* ]
|
|
6183
|
+
*
|
|
5999
6184
|
*/
|
|
6000
6185
|
class FormLayouter {
|
|
6001
6186
|
constructor(eventBus) {
|
|
@@ -6005,8 +6190,8 @@ class FormLayouter {
|
|
|
6005
6190
|
this._eventBus = eventBus;
|
|
6006
6191
|
}
|
|
6007
6192
|
|
|
6008
|
-
/**
|
|
6009
|
-
* @param {FormRow} row
|
|
6193
|
+
/**
|
|
6194
|
+
* @param {FormRow} row
|
|
6010
6195
|
*/
|
|
6011
6196
|
addRow(formFieldId, row) {
|
|
6012
6197
|
let rowsPerComponent = this._rows.find(r => r.formFieldId === formFieldId);
|
|
@@ -6020,18 +6205,18 @@ class FormLayouter {
|
|
|
6020
6205
|
rowsPerComponent.rows.push(row);
|
|
6021
6206
|
}
|
|
6022
6207
|
|
|
6023
|
-
/**
|
|
6024
|
-
* @param {String} id
|
|
6025
|
-
* @returns {FormRow}
|
|
6208
|
+
/**
|
|
6209
|
+
* @param {String} id
|
|
6210
|
+
* @returns {FormRow}
|
|
6026
6211
|
*/
|
|
6027
6212
|
getRow(id) {
|
|
6028
6213
|
const rows = allRows(this._rows);
|
|
6029
6214
|
return rows.find(r => r.id === id);
|
|
6030
6215
|
}
|
|
6031
6216
|
|
|
6032
|
-
/**
|
|
6033
|
-
* @param {any} formField
|
|
6034
|
-
* @returns {FormRow}
|
|
6217
|
+
/**
|
|
6218
|
+
* @param {any} formField
|
|
6219
|
+
* @returns {FormRow}
|
|
6035
6220
|
*/
|
|
6036
6221
|
getRowForField(formField) {
|
|
6037
6222
|
return allRows(this._rows).find(r => {
|
|
@@ -6042,9 +6227,9 @@ class FormLayouter {
|
|
|
6042
6227
|
});
|
|
6043
6228
|
}
|
|
6044
6229
|
|
|
6045
|
-
/**
|
|
6046
|
-
* @param {String} formFieldId
|
|
6047
|
-
* @returns { Array<FormRow> }
|
|
6230
|
+
/**
|
|
6231
|
+
* @param {String} formFieldId
|
|
6232
|
+
* @returns { Array<FormRow> }
|
|
6048
6233
|
*/
|
|
6049
6234
|
getRows(formFieldId) {
|
|
6050
6235
|
const rowsForField = this._rows.find(r => formFieldId === r.formFieldId);
|
|
@@ -6054,15 +6239,15 @@ class FormLayouter {
|
|
|
6054
6239
|
return rowsForField.rows;
|
|
6055
6240
|
}
|
|
6056
6241
|
|
|
6057
|
-
/**
|
|
6058
|
-
* @returns {string}
|
|
6242
|
+
/**
|
|
6243
|
+
* @returns {string}
|
|
6059
6244
|
*/
|
|
6060
6245
|
nextRowId() {
|
|
6061
6246
|
return this._ids.nextPrefixed('Row_');
|
|
6062
6247
|
}
|
|
6063
6248
|
|
|
6064
|
-
/**
|
|
6065
|
-
* @param {any} formField
|
|
6249
|
+
/**
|
|
6250
|
+
* @param {any} formField
|
|
6066
6251
|
*/
|
|
6067
6252
|
calculateLayout(formField) {
|
|
6068
6253
|
const {
|
|
@@ -6116,9 +6301,9 @@ function groupByRow(components, ids) {
|
|
|
6116
6301
|
});
|
|
6117
6302
|
}
|
|
6118
6303
|
|
|
6119
|
-
/**
|
|
6120
|
-
* @param {Array<FormRows>} formRows
|
|
6121
|
-
* @returns {Array<FormRow>}
|
|
6304
|
+
/**
|
|
6305
|
+
* @param {Array<FormRows>} formRows
|
|
6306
|
+
* @returns {Array<FormRow>}
|
|
6122
6307
|
*/
|
|
6123
6308
|
function allRows(formRows) {
|
|
6124
6309
|
return flatten(formRows.map(c => c.rows));
|
|
@@ -6240,55 +6425,55 @@ var core = {
|
|
|
6240
6425
|
validator: ['type', Validator]
|
|
6241
6426
|
};
|
|
6242
6427
|
|
|
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
|
|
6428
|
+
/**
|
|
6429
|
+
* @typedef { import('./types').Injector } Injector
|
|
6430
|
+
* @typedef { import('./types').Data } Data
|
|
6431
|
+
* @typedef { import('./types').Errors } Errors
|
|
6432
|
+
* @typedef { import('./types').Schema } Schema
|
|
6433
|
+
* @typedef { import('./types').FormProperties } FormProperties
|
|
6434
|
+
* @typedef { import('./types').FormProperty } FormProperty
|
|
6435
|
+
* @typedef { import('./types').FormEvent } FormEvent
|
|
6436
|
+
* @typedef { import('./types').FormOptions } FormOptions
|
|
6437
|
+
*
|
|
6438
|
+
* @typedef { {
|
|
6439
|
+
* data: Data,
|
|
6440
|
+
* initialData: Data,
|
|
6441
|
+
* errors: Errors,
|
|
6442
|
+
* properties: FormProperties,
|
|
6443
|
+
* schema: Schema
|
|
6444
|
+
* } } State
|
|
6445
|
+
*
|
|
6446
|
+
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6447
|
+
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6448
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6264
6449
|
*/
|
|
6265
6450
|
|
|
6266
6451
|
const ids = new Ids([32, 36, 1]);
|
|
6267
6452
|
|
|
6268
|
-
/**
|
|
6269
|
-
* The form.
|
|
6453
|
+
/**
|
|
6454
|
+
* The form.
|
|
6270
6455
|
*/
|
|
6271
6456
|
class Form {
|
|
6272
|
-
/**
|
|
6273
|
-
* @constructor
|
|
6274
|
-
* @param {FormOptions} options
|
|
6457
|
+
/**
|
|
6458
|
+
* @constructor
|
|
6459
|
+
* @param {FormOptions} options
|
|
6275
6460
|
*/
|
|
6276
6461
|
constructor(options = {}) {
|
|
6277
|
-
/**
|
|
6278
|
-
* @public
|
|
6279
|
-
* @type {OnEventType}
|
|
6462
|
+
/**
|
|
6463
|
+
* @public
|
|
6464
|
+
* @type {OnEventType}
|
|
6280
6465
|
*/
|
|
6281
6466
|
this.on = this._onEvent;
|
|
6282
6467
|
|
|
6283
|
-
/**
|
|
6284
|
-
* @public
|
|
6285
|
-
* @type {String}
|
|
6468
|
+
/**
|
|
6469
|
+
* @public
|
|
6470
|
+
* @type {String}
|
|
6286
6471
|
*/
|
|
6287
6472
|
this._id = ids.next();
|
|
6288
6473
|
|
|
6289
|
-
/**
|
|
6290
|
-
* @private
|
|
6291
|
-
* @type {Element}
|
|
6474
|
+
/**
|
|
6475
|
+
* @private
|
|
6476
|
+
* @type {Element}
|
|
6292
6477
|
*/
|
|
6293
6478
|
this._container = createFormContainer();
|
|
6294
6479
|
const {
|
|
@@ -6297,9 +6482,9 @@ class Form {
|
|
|
6297
6482
|
properties = {}
|
|
6298
6483
|
} = options;
|
|
6299
6484
|
|
|
6300
|
-
/**
|
|
6301
|
-
* @private
|
|
6302
|
-
* @type {State}
|
|
6485
|
+
/**
|
|
6486
|
+
* @private
|
|
6487
|
+
* @type {State}
|
|
6303
6488
|
*/
|
|
6304
6489
|
this._state = {
|
|
6305
6490
|
initialData: null,
|
|
@@ -6323,9 +6508,9 @@ class Form {
|
|
|
6323
6508
|
this._emit('form.clear');
|
|
6324
6509
|
}
|
|
6325
6510
|
|
|
6326
|
-
/**
|
|
6327
|
-
* Destroy the form, removing it from DOM,
|
|
6328
|
-
* if attached.
|
|
6511
|
+
/**
|
|
6512
|
+
* Destroy the form, removing it from DOM,
|
|
6513
|
+
* if attached.
|
|
6329
6514
|
*/
|
|
6330
6515
|
destroy() {
|
|
6331
6516
|
// destroy form services
|
|
@@ -6336,13 +6521,13 @@ class Form {
|
|
|
6336
6521
|
this._detach(false);
|
|
6337
6522
|
}
|
|
6338
6523
|
|
|
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> }>
|
|
6524
|
+
/**
|
|
6525
|
+
* Open a form schema with the given initial data.
|
|
6526
|
+
*
|
|
6527
|
+
* @param {Schema} schema
|
|
6528
|
+
* @param {Data} [data]
|
|
6529
|
+
*
|
|
6530
|
+
* @return Promise<{ warnings: Array<any> }>
|
|
6346
6531
|
*/
|
|
6347
6532
|
importSchema(schema, data = {}) {
|
|
6348
6533
|
return new Promise((resolve, reject) => {
|
|
@@ -6375,10 +6560,10 @@ class Form {
|
|
|
6375
6560
|
});
|
|
6376
6561
|
}
|
|
6377
6562
|
|
|
6378
|
-
/**
|
|
6379
|
-
* Submit the form, triggering all field validations.
|
|
6380
|
-
*
|
|
6381
|
-
* @returns { { data: Data, errors: Errors } }
|
|
6563
|
+
/**
|
|
6564
|
+
* Submit the form, triggering all field validations.
|
|
6565
|
+
*
|
|
6566
|
+
* @returns { { data: Data, errors: Errors } }
|
|
6382
6567
|
*/
|
|
6383
6568
|
submit() {
|
|
6384
6569
|
const {
|
|
@@ -6404,8 +6589,8 @@ class Form {
|
|
|
6404
6589
|
});
|
|
6405
6590
|
}
|
|
6406
6591
|
|
|
6407
|
-
/**
|
|
6408
|
-
* @returns {Errors}
|
|
6592
|
+
/**
|
|
6593
|
+
* @returns {Errors}
|
|
6409
6594
|
*/
|
|
6410
6595
|
validate() {
|
|
6411
6596
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6435,8 +6620,8 @@ class Form {
|
|
|
6435
6620
|
return filteredErrors;
|
|
6436
6621
|
}
|
|
6437
6622
|
|
|
6438
|
-
/**
|
|
6439
|
-
* @param {Element|string} parentNode
|
|
6623
|
+
/**
|
|
6624
|
+
* @param {Element|string} parentNode
|
|
6440
6625
|
*/
|
|
6441
6626
|
attachTo(parentNode) {
|
|
6442
6627
|
if (!parentNode) {
|
|
@@ -6454,10 +6639,10 @@ class Form {
|
|
|
6454
6639
|
this._detach();
|
|
6455
6640
|
}
|
|
6456
6641
|
|
|
6457
|
-
/**
|
|
6458
|
-
* @private
|
|
6459
|
-
*
|
|
6460
|
-
* @param {boolean} [emit]
|
|
6642
|
+
/**
|
|
6643
|
+
* @private
|
|
6644
|
+
*
|
|
6645
|
+
* @param {boolean} [emit]
|
|
6461
6646
|
*/
|
|
6462
6647
|
_detach(emit = true) {
|
|
6463
6648
|
const container = this._container,
|
|
@@ -6471,9 +6656,9 @@ class Form {
|
|
|
6471
6656
|
parentNode.removeChild(container);
|
|
6472
6657
|
}
|
|
6473
6658
|
|
|
6474
|
-
/**
|
|
6475
|
-
* @param {FormProperty} property
|
|
6476
|
-
* @param {any} value
|
|
6659
|
+
/**
|
|
6660
|
+
* @param {FormProperty} property
|
|
6661
|
+
* @param {any} value
|
|
6477
6662
|
*/
|
|
6478
6663
|
setProperty(property, value) {
|
|
6479
6664
|
const properties = set(this._getState().properties, [property], value);
|
|
@@ -6482,21 +6667,21 @@ class Form {
|
|
|
6482
6667
|
});
|
|
6483
6668
|
}
|
|
6484
6669
|
|
|
6485
|
-
/**
|
|
6486
|
-
* @param {FormEvent} type
|
|
6487
|
-
* @param {Function} handler
|
|
6670
|
+
/**
|
|
6671
|
+
* @param {FormEvent} type
|
|
6672
|
+
* @param {Function} handler
|
|
6488
6673
|
*/
|
|
6489
6674
|
off(type, handler) {
|
|
6490
6675
|
this.get('eventBus').off(type, handler);
|
|
6491
6676
|
}
|
|
6492
6677
|
|
|
6493
|
-
/**
|
|
6494
|
-
* @private
|
|
6495
|
-
*
|
|
6496
|
-
* @param {FormOptions} options
|
|
6497
|
-
* @param {Element} container
|
|
6498
|
-
*
|
|
6499
|
-
* @returns {Injector}
|
|
6678
|
+
/**
|
|
6679
|
+
* @private
|
|
6680
|
+
*
|
|
6681
|
+
* @param {FormOptions} options
|
|
6682
|
+
* @param {Element} container
|
|
6683
|
+
*
|
|
6684
|
+
* @returns {Injector}
|
|
6500
6685
|
*/
|
|
6501
6686
|
_createInjector(options, container) {
|
|
6502
6687
|
const {
|
|
@@ -6515,17 +6700,17 @@ class Form {
|
|
|
6515
6700
|
}, core, ...modules, ...additionalModules]);
|
|
6516
6701
|
}
|
|
6517
6702
|
|
|
6518
|
-
/**
|
|
6519
|
-
* @private
|
|
6703
|
+
/**
|
|
6704
|
+
* @private
|
|
6520
6705
|
*/
|
|
6521
6706
|
_emit(type, data) {
|
|
6522
6707
|
this.get('eventBus').fire(type, data);
|
|
6523
6708
|
}
|
|
6524
6709
|
|
|
6525
|
-
/**
|
|
6526
|
-
* @internal
|
|
6527
|
-
*
|
|
6528
|
-
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6710
|
+
/**
|
|
6711
|
+
* @internal
|
|
6712
|
+
*
|
|
6713
|
+
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6529
6714
|
*/
|
|
6530
6715
|
_update(update) {
|
|
6531
6716
|
const {
|
|
@@ -6547,15 +6732,15 @@ class Form {
|
|
|
6547
6732
|
});
|
|
6548
6733
|
}
|
|
6549
6734
|
|
|
6550
|
-
/**
|
|
6551
|
-
* @internal
|
|
6735
|
+
/**
|
|
6736
|
+
* @internal
|
|
6552
6737
|
*/
|
|
6553
6738
|
_getState() {
|
|
6554
6739
|
return this._state;
|
|
6555
6740
|
}
|
|
6556
6741
|
|
|
6557
|
-
/**
|
|
6558
|
-
* @internal
|
|
6742
|
+
/**
|
|
6743
|
+
* @internal
|
|
6559
6744
|
*/
|
|
6560
6745
|
_setState(state) {
|
|
6561
6746
|
this._state = {
|
|
@@ -6565,22 +6750,22 @@ class Form {
|
|
|
6565
6750
|
this._emit('changed', this._getState());
|
|
6566
6751
|
}
|
|
6567
6752
|
|
|
6568
|
-
/**
|
|
6569
|
-
* @internal
|
|
6753
|
+
/**
|
|
6754
|
+
* @internal
|
|
6570
6755
|
*/
|
|
6571
6756
|
_getModules() {
|
|
6572
6757
|
return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule];
|
|
6573
6758
|
}
|
|
6574
6759
|
|
|
6575
|
-
/**
|
|
6576
|
-
* @internal
|
|
6760
|
+
/**
|
|
6761
|
+
* @internal
|
|
6577
6762
|
*/
|
|
6578
6763
|
_onEvent(type, priority, handler) {
|
|
6579
6764
|
this.get('eventBus').on(type, priority, handler);
|
|
6580
6765
|
}
|
|
6581
6766
|
|
|
6582
|
-
/**
|
|
6583
|
-
* @internal
|
|
6767
|
+
/**
|
|
6768
|
+
* @internal
|
|
6584
6769
|
*/
|
|
6585
6770
|
_getSubmitData() {
|
|
6586
6771
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6608,16 +6793,16 @@ class Form {
|
|
|
6608
6793
|
return filteredSubmitData;
|
|
6609
6794
|
}
|
|
6610
6795
|
|
|
6611
|
-
/**
|
|
6612
|
-
* @internal
|
|
6796
|
+
/**
|
|
6797
|
+
* @internal
|
|
6613
6798
|
*/
|
|
6614
6799
|
_applyConditions(toFilter, data, options = {}) {
|
|
6615
6800
|
const conditionChecker = this.get('conditionChecker');
|
|
6616
6801
|
return conditionChecker.applyConditions(toFilter, data, options);
|
|
6617
6802
|
}
|
|
6618
6803
|
|
|
6619
|
-
/**
|
|
6620
|
-
* @internal
|
|
6804
|
+
/**
|
|
6805
|
+
* @internal
|
|
6621
6806
|
*/
|
|
6622
6807
|
_initializeFieldData(data) {
|
|
6623
6808
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6654,7 +6839,7 @@ class Form {
|
|
|
6654
6839
|
}
|
|
6655
6840
|
}
|
|
6656
6841
|
|
|
6657
|
-
const schemaVersion =
|
|
6842
|
+
const schemaVersion = 12;
|
|
6658
6843
|
|
|
6659
6844
|
/**
|
|
6660
6845
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -6679,5 +6864,5 @@ function createForm(options) {
|
|
|
6679
6864
|
});
|
|
6680
6865
|
}
|
|
6681
6866
|
|
|
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 };
|
|
6867
|
+
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
6868
|
//# sourceMappingURL=index.es.js.map
|