@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.cjs
CHANGED
|
@@ -73,26 +73,26 @@ const getFlavouredFeelVariableNames = (feelString, feelFlavour = 'expression', o
|
|
|
73
73
|
return [...new Set(variables)];
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
* Get the variable name at the specified index in a given path expression.
|
|
78
|
-
*
|
|
79
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
80
|
-
* @param {number} index - The index of the variable name to retrieve.
|
|
81
|
-
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
76
|
+
/**
|
|
77
|
+
* Get the variable name at the specified index in a given path expression.
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
80
|
+
* @param {number} index - The index of the variable name to retrieve.
|
|
81
|
+
* @returns {string|null} The variable name at the specified index or null if index is out of bounds.
|
|
82
82
|
*/
|
|
83
83
|
const _getVariableNameAtPathIndex = (root, index) => {
|
|
84
84
|
const nodes = _linearizePathExpression(root);
|
|
85
85
|
return nodes[index].variableName || null;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* Extracts the variables which are required of the external context for a given path expression.
|
|
90
|
-
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
91
|
-
*
|
|
92
|
-
* @param {Object} node - The root node of the path expression tree.
|
|
93
|
-
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
94
|
-
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
95
|
-
* @returns {Set} - A set containing the extracted variable names.
|
|
88
|
+
/**
|
|
89
|
+
* Extracts the variables which are required of the external context for a given path expression.
|
|
90
|
+
* This is done by traversing the path expression tree and keeping track of the current depth relative to the external context.
|
|
91
|
+
*
|
|
92
|
+
* @param {Object} node - The root node of the path expression tree.
|
|
93
|
+
* @param {number} initialDepth - The depth at which the root node is located in the outer context.
|
|
94
|
+
* @param {Object} specialDepthAccessors - Definitions of special keywords which represent more complex accesses of the outer context.
|
|
95
|
+
* @returns {Set} - A set containing the extracted variable names.
|
|
96
96
|
*/
|
|
97
97
|
const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) => {
|
|
98
98
|
// depth info represents the previous (initialised as null) and current depth of the current accessor in the path expression
|
|
@@ -138,11 +138,11 @@ const _smartExtractVariableNames = (node, initialDepth, specialDepthAccessors) =
|
|
|
138
138
|
return new Set(extractedVariables);
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
* Deconstructs a path expression tree into an array of components.
|
|
143
|
-
*
|
|
144
|
-
* @param {Object} root - The root node of the path expression tree.
|
|
145
|
-
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
141
|
+
/**
|
|
142
|
+
* Deconstructs a path expression tree into an array of components.
|
|
143
|
+
*
|
|
144
|
+
* @param {Object} root - The root node of the path expression tree.
|
|
145
|
+
* @returns {Array<object>} An array of components in the path expression, in the correct order.
|
|
146
146
|
*/
|
|
147
147
|
const _linearizePathExpression = root => {
|
|
148
148
|
let node = root;
|
|
@@ -161,13 +161,13 @@ const _linearizePathExpression = root => {
|
|
|
161
161
|
return parts.reverse();
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
166
|
-
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
167
|
-
*
|
|
168
|
-
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
169
|
-
* @param {string} feelString - The feel string used for parsing.
|
|
170
|
-
* @returns {Object} The simplified feel structure tree.
|
|
164
|
+
/**
|
|
165
|
+
* Builds a simplified feel structure tree from the given parse tree and feel string.
|
|
166
|
+
* The nodes follow this structure: `{ name: string, children: Array, variableName?: string }`
|
|
167
|
+
*
|
|
168
|
+
* @param {Object} parseTree - The parse tree generated by a parser.
|
|
169
|
+
* @param {string} feelString - The feel string used for parsing.
|
|
170
|
+
* @returns {Object} The simplified feel structure tree.
|
|
171
171
|
*/
|
|
172
172
|
const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
173
173
|
const stack = [{
|
|
@@ -193,9 +193,9 @@ const _buildSimpleFeelStructureTree = (parseTree, feelString) => {
|
|
|
193
193
|
return _extractFilterExpressions(stack[0].children[0]);
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
/**
|
|
197
|
-
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
198
|
-
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
196
|
+
/**
|
|
197
|
+
* Restructure the tree in such a way to bring filters (which create new contexts) to the root of the tree.
|
|
198
|
+
* This is done to simplify the extraction of variables and match the context hierarchy.
|
|
199
199
|
*/
|
|
200
200
|
const _extractFilterExpressions = tree => {
|
|
201
201
|
const flattenedExpressionTree = {
|
|
@@ -236,25 +236,25 @@ class FeelExpressionLanguage {
|
|
|
236
236
|
this._eventBus = eventBus;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
/**
|
|
240
|
-
* Determines if the given value is a FEEL expression.
|
|
241
|
-
*
|
|
242
|
-
* @param {any} value
|
|
243
|
-
* @returns {boolean}
|
|
244
|
-
*
|
|
239
|
+
/**
|
|
240
|
+
* Determines if the given value is a FEEL expression.
|
|
241
|
+
*
|
|
242
|
+
* @param {any} value
|
|
243
|
+
* @returns {boolean}
|
|
244
|
+
*
|
|
245
245
|
*/
|
|
246
246
|
isExpression(value) {
|
|
247
247
|
return minDash.isString(value) && value.startsWith('=');
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
/**
|
|
251
|
-
* Retrieve variable names from a given FEEL expression.
|
|
252
|
-
*
|
|
253
|
-
* @param {string} expression
|
|
254
|
-
* @param {object} [options]
|
|
255
|
-
* @param {string} [options.type]
|
|
256
|
-
*
|
|
257
|
-
* @returns {string[]}
|
|
250
|
+
/**
|
|
251
|
+
* Retrieve variable names from a given FEEL expression.
|
|
252
|
+
*
|
|
253
|
+
* @param {string} expression
|
|
254
|
+
* @param {object} [options]
|
|
255
|
+
* @param {string} [options.type]
|
|
256
|
+
*
|
|
257
|
+
* @returns {string[]}
|
|
258
258
|
*/
|
|
259
259
|
getVariableNames(expression, options = {}) {
|
|
260
260
|
const {
|
|
@@ -269,13 +269,13 @@ class FeelExpressionLanguage {
|
|
|
269
269
|
return getFlavouredFeelVariableNames(expression, type);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
/**
|
|
273
|
-
* Evaluate an expression.
|
|
274
|
-
*
|
|
275
|
-
* @param {string} expression
|
|
276
|
-
* @param {import('../../types').Data} [data]
|
|
277
|
-
*
|
|
278
|
-
* @returns {any}
|
|
272
|
+
/**
|
|
273
|
+
* Evaluate an expression.
|
|
274
|
+
*
|
|
275
|
+
* @param {string} expression
|
|
276
|
+
* @param {import('../../types').Data} [data]
|
|
277
|
+
*
|
|
278
|
+
* @returns {any}
|
|
279
279
|
*/
|
|
280
280
|
evaluate(expression, data = {}) {
|
|
281
281
|
if (!expression) {
|
|
@@ -300,23 +300,23 @@ FeelExpressionLanguage.$inject = ['eventBus'];
|
|
|
300
300
|
class FeelersTemplating {
|
|
301
301
|
constructor() {}
|
|
302
302
|
|
|
303
|
-
/**
|
|
304
|
-
* Determines if the given value is a feelers template.
|
|
305
|
-
*
|
|
306
|
-
* @param {any} value
|
|
307
|
-
* @returns {boolean}
|
|
308
|
-
*
|
|
303
|
+
/**
|
|
304
|
+
* Determines if the given value is a feelers template.
|
|
305
|
+
*
|
|
306
|
+
* @param {any} value
|
|
307
|
+
* @returns {boolean}
|
|
308
|
+
*
|
|
309
309
|
*/
|
|
310
310
|
isTemplate(value) {
|
|
311
311
|
return minDash.isString(value) && (value.startsWith('=') || /{{.*?}}/.test(value));
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
/**
|
|
315
|
-
* Retrieve variable names from a given feelers template.
|
|
316
|
-
*
|
|
317
|
-
* @param {string} template
|
|
318
|
-
*
|
|
319
|
-
* @returns {string[]}
|
|
314
|
+
/**
|
|
315
|
+
* Retrieve variable names from a given feelers template.
|
|
316
|
+
*
|
|
317
|
+
* @param {string} template
|
|
318
|
+
*
|
|
319
|
+
* @returns {string[]}
|
|
320
320
|
*/
|
|
321
321
|
getVariableNames(template) {
|
|
322
322
|
if (!this.isTemplate(template)) {
|
|
@@ -342,17 +342,17 @@ class FeelersTemplating {
|
|
|
342
342
|
}, []);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
/**
|
|
346
|
-
* Evaluate a template.
|
|
347
|
-
*
|
|
348
|
-
* @param {string} template
|
|
349
|
-
* @param {Object<string, any>} context
|
|
350
|
-
* @param {Object} options
|
|
351
|
-
* @param {boolean} [options.debug = false]
|
|
352
|
-
* @param {boolean} [options.strict = false]
|
|
353
|
-
* @param {Function} [options.buildDebugString]
|
|
354
|
-
*
|
|
355
|
-
* @returns
|
|
345
|
+
/**
|
|
346
|
+
* Evaluate a template.
|
|
347
|
+
*
|
|
348
|
+
* @param {string} template
|
|
349
|
+
* @param {Object<string, any>} context
|
|
350
|
+
* @param {Object} options
|
|
351
|
+
* @param {boolean} [options.debug = false]
|
|
352
|
+
* @param {boolean} [options.strict = false]
|
|
353
|
+
* @param {Function} [options.buildDebugString]
|
|
354
|
+
*
|
|
355
|
+
* @returns
|
|
356
356
|
*/
|
|
357
357
|
evaluate(template, context = {}, options = {}) {
|
|
358
358
|
const {
|
|
@@ -367,22 +367,22 @@ class FeelersTemplating {
|
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
/**
|
|
371
|
-
* @typedef {Object} ExpressionWithDepth
|
|
372
|
-
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
373
|
-
* @property {string} expression - The extracted expression
|
|
370
|
+
/**
|
|
371
|
+
* @typedef {Object} ExpressionWithDepth
|
|
372
|
+
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
373
|
+
* @property {string} expression - The extracted expression
|
|
374
374
|
*/
|
|
375
375
|
|
|
376
|
-
/**
|
|
377
|
-
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
378
|
-
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
379
|
-
|
|
380
|
-
* @param {string} template - A feelers template string.
|
|
381
|
-
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
382
|
-
*
|
|
383
|
-
* @example
|
|
384
|
-
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
385
|
-
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
376
|
+
/**
|
|
377
|
+
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
378
|
+
* The depth is incremented for child expressions of loops to account for context drilling.
|
|
379
|
+
* @name extractExpressionsWithDepth
|
|
380
|
+
* @param {string} template - A feelers template string.
|
|
381
|
+
* @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
|
|
385
|
+
* const extractedExpressions = _extractExpressionsWithDepth(template);
|
|
386
386
|
*/
|
|
387
387
|
_extractExpressionsWithDepth(template) {
|
|
388
388
|
// build simplified feelers syntax tree
|
|
@@ -445,27 +445,31 @@ function prefixId(id, formId) {
|
|
|
445
445
|
return `fjs-form-${id}`;
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
const type$
|
|
448
|
+
const type$d = 'button';
|
|
449
449
|
function Button(props) {
|
|
450
450
|
const {
|
|
451
451
|
disabled,
|
|
452
|
+
onFocus,
|
|
453
|
+
onBlur,
|
|
452
454
|
field
|
|
453
455
|
} = props;
|
|
454
456
|
const {
|
|
455
457
|
action = 'submit'
|
|
456
458
|
} = field;
|
|
457
459
|
return jsxRuntime.jsx("div", {
|
|
458
|
-
class: formFieldClasses(type$
|
|
460
|
+
class: formFieldClasses(type$d),
|
|
459
461
|
children: jsxRuntime.jsx("button", {
|
|
460
462
|
class: "fjs-button",
|
|
461
463
|
type: action,
|
|
462
464
|
disabled: disabled,
|
|
465
|
+
onFocus: () => onFocus && onFocus(),
|
|
466
|
+
onBlur: () => onBlur && onBlur(),
|
|
463
467
|
children: field.label
|
|
464
468
|
})
|
|
465
469
|
});
|
|
466
470
|
}
|
|
467
471
|
Button.config = {
|
|
468
|
-
type: type$
|
|
472
|
+
type: type$d,
|
|
469
473
|
keyed: false,
|
|
470
474
|
label: 'Button',
|
|
471
475
|
group: 'action',
|
|
@@ -516,11 +520,11 @@ const FormRenderContext = preact.createContext({
|
|
|
516
520
|
});
|
|
517
521
|
var FormRenderContext$1 = FormRenderContext;
|
|
518
522
|
|
|
519
|
-
/**
|
|
520
|
-
* @param {string} type
|
|
521
|
-
* @param {boolean} [strict]
|
|
522
|
-
*
|
|
523
|
-
* @returns {any}
|
|
523
|
+
/**
|
|
524
|
+
* @param {string} type
|
|
525
|
+
* @param {boolean} [strict]
|
|
526
|
+
*
|
|
527
|
+
* @returns {any}
|
|
524
528
|
*/
|
|
525
529
|
function getService(type, strict) {}
|
|
526
530
|
const FormContext = preact.createContext({
|
|
@@ -536,10 +540,10 @@ function useService(type, strict) {
|
|
|
536
540
|
return getService(type, strict);
|
|
537
541
|
}
|
|
538
542
|
|
|
539
|
-
/**
|
|
540
|
-
* Returns the conditionally filtered data of a form reactively.
|
|
541
|
-
* Memoised to minimize re-renders
|
|
542
|
-
*
|
|
543
|
+
/**
|
|
544
|
+
* Returns the conditionally filtered data of a form reactively.
|
|
545
|
+
* Memoised to minimize re-renders
|
|
546
|
+
*
|
|
543
547
|
*/
|
|
544
548
|
function useFilteredFormData() {
|
|
545
549
|
const {
|
|
@@ -556,12 +560,12 @@ function useFilteredFormData() {
|
|
|
556
560
|
}, [conditionChecker, data, initialData]);
|
|
557
561
|
}
|
|
558
562
|
|
|
559
|
-
/**
|
|
560
|
-
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
561
|
-
*
|
|
562
|
-
* @param {string | undefined} condition
|
|
563
|
-
*
|
|
564
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
563
|
+
/**
|
|
564
|
+
* Evaluate if condition is met reactively based on the conditionChecker and form data.
|
|
565
|
+
*
|
|
566
|
+
* @param {string | undefined} condition
|
|
567
|
+
*
|
|
568
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
565
569
|
*/
|
|
566
570
|
function useCondition(condition) {
|
|
567
571
|
const conditionChecker = useService('conditionChecker', false);
|
|
@@ -571,13 +575,13 @@ function useCondition(condition) {
|
|
|
571
575
|
}, [conditionChecker, condition, filteredData]);
|
|
572
576
|
}
|
|
573
577
|
|
|
574
|
-
/**
|
|
575
|
-
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
576
|
-
* If the string is not an expression, it is returned as is.
|
|
577
|
-
* Memoised to minimize re-renders.
|
|
578
|
-
*
|
|
579
|
-
* @param {string} value
|
|
580
|
-
*
|
|
578
|
+
/**
|
|
579
|
+
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
580
|
+
* If the string is not an expression, it is returned as is.
|
|
581
|
+
* Memoised to minimize re-renders.
|
|
582
|
+
*
|
|
583
|
+
* @param {string} value
|
|
584
|
+
*
|
|
581
585
|
*/
|
|
582
586
|
function useExpressionEvaluation(value) {
|
|
583
587
|
const formData = useFilteredFormData();
|
|
@@ -606,16 +610,16 @@ function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
|
606
610
|
});
|
|
607
611
|
}
|
|
608
612
|
|
|
609
|
-
/**
|
|
610
|
-
* Retrieve readonly value of a form field, given it can be an
|
|
611
|
-
* expression optionally or configured globally.
|
|
612
|
-
*
|
|
613
|
-
* @typedef { import('../../types').FormProperties } FormProperties
|
|
614
|
-
*
|
|
615
|
-
* @param {any} formField
|
|
616
|
-
* @param {FormProperties} properties
|
|
617
|
-
*
|
|
618
|
-
* @returns {boolean}
|
|
613
|
+
/**
|
|
614
|
+
* Retrieve readonly value of a form field, given it can be an
|
|
615
|
+
* expression optionally or configured globally.
|
|
616
|
+
*
|
|
617
|
+
* @typedef { import('../../types').FormProperties } FormProperties
|
|
618
|
+
*
|
|
619
|
+
* @param {any} formField
|
|
620
|
+
* @param {FormProperties} properties
|
|
621
|
+
*
|
|
622
|
+
* @returns {boolean}
|
|
619
623
|
*/
|
|
620
624
|
function useReadonly(formField, properties = {}) {
|
|
621
625
|
const expressionLanguage = useService('expressionLanguage');
|
|
@@ -639,12 +643,12 @@ function usePrevious(value, defaultValue, dependencies) {
|
|
|
639
643
|
return ref.current;
|
|
640
644
|
}
|
|
641
645
|
|
|
642
|
-
/**
|
|
643
|
-
* A custom hook to manage state changes with deep comparison.
|
|
644
|
-
*
|
|
645
|
-
* @param {any} value - The current value to manage.
|
|
646
|
-
* @param {any} defaultValue - The initial default value for the state.
|
|
647
|
-
* @returns {any} - Returns the current state.
|
|
646
|
+
/**
|
|
647
|
+
* A custom hook to manage state changes with deep comparison.
|
|
648
|
+
*
|
|
649
|
+
* @param {any} value - The current value to manage.
|
|
650
|
+
* @param {any} defaultValue - The initial default value for the state.
|
|
651
|
+
* @returns {any} - Returns the current state.
|
|
648
652
|
*/
|
|
649
653
|
function useDeepCompareState(value, defaultValue) {
|
|
650
654
|
const [state, setState] = hooks.useState(defaultValue);
|
|
@@ -664,16 +668,16 @@ function compare(a, b) {
|
|
|
664
668
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
665
669
|
}
|
|
666
670
|
|
|
667
|
-
/**
|
|
668
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
669
|
-
* Memoised to minimize re-renders
|
|
670
|
-
*
|
|
671
|
-
* @param {string} value
|
|
672
|
-
* @param {Object} options
|
|
673
|
-
* @param {boolean} [options.debug = false]
|
|
674
|
-
* @param {boolean} [options.strict = false]
|
|
675
|
-
* @param {Function} [options.buildDebugString]
|
|
676
|
-
*
|
|
671
|
+
/**
|
|
672
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
673
|
+
* Memoised to minimize re-renders
|
|
674
|
+
*
|
|
675
|
+
* @param {string} value
|
|
676
|
+
* @param {Object} options
|
|
677
|
+
* @param {boolean} [options.debug = false]
|
|
678
|
+
* @param {boolean} [options.strict = false]
|
|
679
|
+
* @param {Function} [options.buildDebugString]
|
|
680
|
+
*
|
|
677
681
|
*/
|
|
678
682
|
function useTemplateEvaluation(value, options) {
|
|
679
683
|
const filteredData = useFilteredFormData();
|
|
@@ -686,17 +690,17 @@ function useTemplateEvaluation(value, options) {
|
|
|
686
690
|
}, [filteredData, templating, value, options]);
|
|
687
691
|
}
|
|
688
692
|
|
|
689
|
-
/**
|
|
690
|
-
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
691
|
-
* If the string contains multiple lines, only the first line is returned.
|
|
692
|
-
* Memoised to minimize re-renders
|
|
693
|
-
*
|
|
694
|
-
* @param {string} value
|
|
695
|
-
* @param {Object} [options]
|
|
696
|
-
* @param {boolean} [options.debug = false]
|
|
697
|
-
* @param {boolean} [options.strict = false]
|
|
698
|
-
* @param {Function} [options.buildDebugString]
|
|
699
|
-
*
|
|
693
|
+
/**
|
|
694
|
+
* Template a string reactively based on form data. If the string is not a template, it is returned as is.
|
|
695
|
+
* If the string contains multiple lines, only the first line is returned.
|
|
696
|
+
* Memoised to minimize re-renders
|
|
697
|
+
*
|
|
698
|
+
* @param {string} value
|
|
699
|
+
* @param {Object} [options]
|
|
700
|
+
* @param {boolean} [options.debug = false]
|
|
701
|
+
* @param {boolean} [options.strict = false]
|
|
702
|
+
* @param {Function} [options.buildDebugString]
|
|
703
|
+
*
|
|
700
704
|
*/
|
|
701
705
|
function useSingleLineTemplateEvaluation(value, options = {}) {
|
|
702
706
|
const evaluatedTemplate = useTemplateEvaluation(value, options);
|
|
@@ -763,12 +767,13 @@ function Label(props) {
|
|
|
763
767
|
});
|
|
764
768
|
}
|
|
765
769
|
|
|
766
|
-
const type$
|
|
770
|
+
const type$c = 'checkbox';
|
|
767
771
|
function Checkbox(props) {
|
|
768
772
|
const {
|
|
769
773
|
disabled,
|
|
770
774
|
errors = [],
|
|
771
775
|
onBlur,
|
|
776
|
+
onFocus,
|
|
772
777
|
field,
|
|
773
778
|
readonly,
|
|
774
779
|
value = false
|
|
@@ -795,7 +800,7 @@ function Checkbox(props) {
|
|
|
795
800
|
} = hooks.useContext(FormContext$1);
|
|
796
801
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
797
802
|
return jsxRuntime.jsxs("div", {
|
|
798
|
-
class: classNames(formFieldClasses(type$
|
|
803
|
+
class: classNames(formFieldClasses(type$c, {
|
|
799
804
|
errors,
|
|
800
805
|
disabled,
|
|
801
806
|
readonly
|
|
@@ -814,7 +819,8 @@ function Checkbox(props) {
|
|
|
814
819
|
id: prefixId(id, formId),
|
|
815
820
|
type: "checkbox",
|
|
816
821
|
onChange: onChange,
|
|
817
|
-
onBlur: onBlur,
|
|
822
|
+
onBlur: () => onBlur && onBlur(),
|
|
823
|
+
onFocus: () => onFocus && onFocus(),
|
|
818
824
|
"aria-describedby": errorMessageId
|
|
819
825
|
})
|
|
820
826
|
}), jsxRuntime.jsx(Description, {
|
|
@@ -826,7 +832,7 @@ function Checkbox(props) {
|
|
|
826
832
|
});
|
|
827
833
|
}
|
|
828
834
|
Checkbox.config = {
|
|
829
|
-
type: type$
|
|
835
|
+
type: type$c,
|
|
830
836
|
keyed: true,
|
|
831
837
|
label: 'Checkbox',
|
|
832
838
|
group: 'selection',
|
|
@@ -900,8 +906,8 @@ function createEmptyOptions(options = {}) {
|
|
|
900
906
|
};
|
|
901
907
|
}
|
|
902
908
|
|
|
903
|
-
/**
|
|
904
|
-
* @enum { String }
|
|
909
|
+
/**
|
|
910
|
+
* @enum { String }
|
|
905
911
|
*/
|
|
906
912
|
const LOAD_STATES = {
|
|
907
913
|
LOADING: 'loading',
|
|
@@ -909,17 +915,17 @@ const LOAD_STATES = {
|
|
|
909
915
|
ERROR: 'error'
|
|
910
916
|
};
|
|
911
917
|
|
|
912
|
-
/**
|
|
913
|
-
* @typedef {Object} ValuesGetter
|
|
914
|
-
* @property {Object[]} values - The values data
|
|
915
|
-
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
918
|
+
/**
|
|
919
|
+
* @typedef {Object} ValuesGetter
|
|
920
|
+
* @property {Object[]} values - The values data
|
|
921
|
+
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
916
922
|
*/
|
|
917
923
|
|
|
918
|
-
/**
|
|
919
|
-
* A hook to load values for single and multiselect components.
|
|
920
|
-
*
|
|
921
|
-
* @param {Object} field - The form field to handle values for
|
|
922
|
-
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
924
|
+
/**
|
|
925
|
+
* A hook to load values for single and multiselect components.
|
|
926
|
+
*
|
|
927
|
+
* @param {Object} field - The form field to handle values for
|
|
928
|
+
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
923
929
|
*/
|
|
924
930
|
function useValuesAsync (field) {
|
|
925
931
|
const {
|
|
@@ -1213,12 +1219,13 @@ function sanitizeMultiSelectValue(options) {
|
|
|
1213
1219
|
}
|
|
1214
1220
|
}
|
|
1215
1221
|
|
|
1216
|
-
const type$
|
|
1222
|
+
const type$b = 'checklist';
|
|
1217
1223
|
function Checklist(props) {
|
|
1218
1224
|
const {
|
|
1219
1225
|
disabled,
|
|
1220
1226
|
errors = [],
|
|
1221
1227
|
onBlur,
|
|
1228
|
+
onFocus,
|
|
1222
1229
|
field,
|
|
1223
1230
|
readonly,
|
|
1224
1231
|
value = []
|
|
@@ -1249,7 +1256,13 @@ function Checklist(props) {
|
|
|
1249
1256
|
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
1250
1257
|
return;
|
|
1251
1258
|
}
|
|
1252
|
-
onBlur();
|
|
1259
|
+
onBlur && onBlur();
|
|
1260
|
+
};
|
|
1261
|
+
const onCheckboxFocus = e => {
|
|
1262
|
+
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
onFocus && onFocus();
|
|
1253
1266
|
};
|
|
1254
1267
|
const {
|
|
1255
1268
|
state: loadState,
|
|
@@ -1260,7 +1273,7 @@ function Checklist(props) {
|
|
|
1260
1273
|
} = hooks.useContext(FormContext$1);
|
|
1261
1274
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
1262
1275
|
return jsxRuntime.jsxs("div", {
|
|
1263
|
-
class: classNames(formFieldClasses(type$
|
|
1276
|
+
class: classNames(formFieldClasses(type$b, {
|
|
1264
1277
|
errors,
|
|
1265
1278
|
disabled,
|
|
1266
1279
|
readonly
|
|
@@ -1286,6 +1299,7 @@ function Checklist(props) {
|
|
|
1286
1299
|
type: "checkbox",
|
|
1287
1300
|
onClick: () => toggleCheckbox(v.value),
|
|
1288
1301
|
onBlur: onCheckboxBlur,
|
|
1302
|
+
onFocus: onCheckboxFocus,
|
|
1289
1303
|
"aria-describedby": errorMessageId
|
|
1290
1304
|
})
|
|
1291
1305
|
}, `${id}-${index}`);
|
|
@@ -1298,7 +1312,7 @@ function Checklist(props) {
|
|
|
1298
1312
|
});
|
|
1299
1313
|
}
|
|
1300
1314
|
Checklist.config = {
|
|
1301
|
-
type: type$
|
|
1315
|
+
type: type$b,
|
|
1302
1316
|
keyed: true,
|
|
1303
1317
|
label: 'Checklist',
|
|
1304
1318
|
group: 'selection',
|
|
@@ -1316,6 +1330,7 @@ function FormField(props) {
|
|
|
1316
1330
|
const formFields = useService('formFields'),
|
|
1317
1331
|
viewerCommands = useService('viewerCommands', false),
|
|
1318
1332
|
pathRegistry = useService('pathRegistry'),
|
|
1333
|
+
eventBus = useService('eventBus'),
|
|
1319
1334
|
form = useService('form');
|
|
1320
1335
|
const {
|
|
1321
1336
|
initialData,
|
|
@@ -1343,7 +1358,15 @@ function FormField(props) {
|
|
|
1343
1358
|
if (viewerCommands) {
|
|
1344
1359
|
viewerCommands.updateFieldValidation(field, value);
|
|
1345
1360
|
}
|
|
1346
|
-
|
|
1361
|
+
eventBus.fire('formField.blur', {
|
|
1362
|
+
formField: field
|
|
1363
|
+
});
|
|
1364
|
+
}, [eventBus, viewerCommands, field, value]);
|
|
1365
|
+
const onFocus = hooks.useCallback(() => {
|
|
1366
|
+
eventBus.fire('formField.focus', {
|
|
1367
|
+
formField: field
|
|
1368
|
+
});
|
|
1369
|
+
}, [eventBus, field]);
|
|
1347
1370
|
hooks.useEffect(() => {
|
|
1348
1371
|
if (viewerCommands && initialValue) {
|
|
1349
1372
|
viewerCommands.updateFieldValidation(field, initialValue);
|
|
@@ -1365,6 +1388,7 @@ function FormField(props) {
|
|
|
1365
1388
|
errors: errors[field.id],
|
|
1366
1389
|
onChange: disabled || readonly ? noop$1 : onChange,
|
|
1367
1390
|
onBlur: disabled || readonly ? noop$1 : onBlur,
|
|
1391
|
+
onFocus: disabled || readonly ? noop$1 : onFocus,
|
|
1368
1392
|
readonly: readonly,
|
|
1369
1393
|
value: value
|
|
1370
1394
|
})
|
|
@@ -1440,16 +1464,16 @@ FormComponent$1.config = {
|
|
|
1440
1464
|
})
|
|
1441
1465
|
};
|
|
1442
1466
|
|
|
1443
|
-
var _path$
|
|
1444
|
-
function _extends$
|
|
1467
|
+
var _path$i;
|
|
1468
|
+
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); }
|
|
1445
1469
|
var SvgCalendar = function SvgCalendar(props) {
|
|
1446
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
1470
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
|
|
1447
1471
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1448
1472
|
width: 14,
|
|
1449
1473
|
height: 15,
|
|
1450
1474
|
fill: "none",
|
|
1451
1475
|
viewBox: "0 0 28 30"
|
|
1452
|
-
}, props), _path$
|
|
1476
|
+
}, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1453
1477
|
fill: "currentColor",
|
|
1454
1478
|
fillRule: "evenodd",
|
|
1455
1479
|
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",
|
|
@@ -1458,12 +1482,12 @@ var SvgCalendar = function SvgCalendar(props) {
|
|
|
1458
1482
|
};
|
|
1459
1483
|
var CalendarIcon = SvgCalendar;
|
|
1460
1484
|
|
|
1461
|
-
/**
|
|
1462
|
-
* Returns date format for the provided locale.
|
|
1463
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1464
|
-
*
|
|
1465
|
-
* @param {string} [locale] - The locale to get date format for.
|
|
1466
|
-
* @returns {string} The date format for the locale.
|
|
1485
|
+
/**
|
|
1486
|
+
* Returns date format for the provided locale.
|
|
1487
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1488
|
+
*
|
|
1489
|
+
* @param {string} [locale] - The locale to get date format for.
|
|
1490
|
+
* @returns {string} The date format for the locale.
|
|
1467
1491
|
*/
|
|
1468
1492
|
function getLocaleDateFormat(locale = 'default') {
|
|
1469
1493
|
const parts = new Intl.DateTimeFormat(locale).formatToParts(new Date(Date.UTC(2020, 5, 5)));
|
|
@@ -1482,12 +1506,12 @@ function getLocaleDateFormat(locale = 'default') {
|
|
|
1482
1506
|
}).join('');
|
|
1483
1507
|
}
|
|
1484
1508
|
|
|
1485
|
-
/**
|
|
1486
|
-
* Returns readable date format for the provided locale.
|
|
1487
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1488
|
-
*
|
|
1489
|
-
* @param {string} [locale] - The locale to get readable date format for.
|
|
1490
|
-
* @returns {string} The readable date format for the locale.
|
|
1509
|
+
/**
|
|
1510
|
+
* Returns readable date format for the provided locale.
|
|
1511
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1512
|
+
*
|
|
1513
|
+
* @param {string} [locale] - The locale to get readable date format for.
|
|
1514
|
+
* @returns {string} The readable date format for the locale.
|
|
1491
1515
|
*/
|
|
1492
1516
|
function getLocaleReadableDateFormat(locale) {
|
|
1493
1517
|
let format = getLocaleDateFormat(locale).toLowerCase();
|
|
@@ -1504,12 +1528,12 @@ function getLocaleReadableDateFormat(locale) {
|
|
|
1504
1528
|
return format;
|
|
1505
1529
|
}
|
|
1506
1530
|
|
|
1507
|
-
/**
|
|
1508
|
-
* Returns flatpickr config for the provided locale.
|
|
1509
|
-
* If the locale is not provided, uses the browser's locale.
|
|
1510
|
-
*
|
|
1511
|
-
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1512
|
-
* @returns {object} The flatpickr config for the locale.
|
|
1531
|
+
/**
|
|
1532
|
+
* Returns flatpickr config for the provided locale.
|
|
1533
|
+
* If the locale is not provided, uses the browser's locale.
|
|
1534
|
+
*
|
|
1535
|
+
* @param {string} [locale] - The locale to get flatpickr config for.
|
|
1536
|
+
* @returns {object} The flatpickr config for the locale.
|
|
1513
1537
|
*/
|
|
1514
1538
|
function getLocaleDateFlatpickrConfig(locale) {
|
|
1515
1539
|
return flatpickerizeDateFormat(getLocaleDateFormat(locale));
|
|
@@ -1570,6 +1594,7 @@ function Datepicker(props) {
|
|
|
1570
1594
|
label,
|
|
1571
1595
|
collapseLabelOnEmpty,
|
|
1572
1596
|
onDateTimeBlur,
|
|
1597
|
+
onDateTimeFocus,
|
|
1573
1598
|
formId,
|
|
1574
1599
|
required,
|
|
1575
1600
|
disabled,
|
|
@@ -1657,13 +1682,17 @@ function Datepicker(props) {
|
|
|
1657
1682
|
const onInputFocus = hooks.useCallback(e => {
|
|
1658
1683
|
if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget) || readonly) return;
|
|
1659
1684
|
flatpickrInstance.open();
|
|
1660
|
-
|
|
1685
|
+
onDateTimeFocus(e);
|
|
1686
|
+
}, [flatpickrInstance, readonly, onDateTimeFocus]);
|
|
1661
1687
|
|
|
1662
1688
|
// simulate an enter press on blur to make sure the date value is submitted in all scenarios
|
|
1663
1689
|
const onInputBlur = hooks.useCallback(e => {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1690
|
+
const isFalseBlur = e.relatedTarget && e.relatedTarget.classList.contains('flatpickr-day');
|
|
1691
|
+
if (isFalseBlur) return;
|
|
1692
|
+
if (isInputDirty) {
|
|
1693
|
+
dateInputRef.current.dispatchEvent(ENTER_KEYDOWN_EVENT);
|
|
1694
|
+
setIsInputDirty(false);
|
|
1695
|
+
}
|
|
1667
1696
|
onDateTimeBlur(e);
|
|
1668
1697
|
}, [isInputDirty, onDateTimeBlur]);
|
|
1669
1698
|
const fullId = `${prefixId(id, formId)}--date`;
|
|
@@ -1695,9 +1724,9 @@ function Datepicker(props) {
|
|
|
1695
1724
|
placeholder: getLocaleReadableDateFormat(),
|
|
1696
1725
|
autoComplete: "off",
|
|
1697
1726
|
onFocus: onInputFocus,
|
|
1727
|
+
onBlur: onInputBlur,
|
|
1698
1728
|
onKeyDown: onInputKeyDown,
|
|
1699
1729
|
onMouseDown: () => !flatpickrInstance.isOpen && !readonly && flatpickrInstance.open(),
|
|
1700
|
-
onBlur: onInputBlur,
|
|
1701
1730
|
onInput: () => setIsInputDirty(true),
|
|
1702
1731
|
"data-input": true,
|
|
1703
1732
|
"aria-describedby": props['aria-describedby']
|
|
@@ -1707,19 +1736,19 @@ function Datepicker(props) {
|
|
|
1707
1736
|
});
|
|
1708
1737
|
}
|
|
1709
1738
|
|
|
1710
|
-
var _path$
|
|
1711
|
-
function _extends$
|
|
1739
|
+
var _path$h, _path2$3;
|
|
1740
|
+
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); }
|
|
1712
1741
|
var SvgClock = function SvgClock(props) {
|
|
1713
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
1742
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
1714
1743
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1715
1744
|
width: 16,
|
|
1716
1745
|
height: 16,
|
|
1717
1746
|
fill: "none",
|
|
1718
1747
|
viewBox: "0 0 28 29"
|
|
1719
|
-
}, props), _path$
|
|
1748
|
+
}, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1720
1749
|
fill: "currentColor",
|
|
1721
1750
|
d: "M13 14.41 18.59 20 20 18.59l-5-5.01V5h-2v9.41Z"
|
|
1722
|
-
})), _path2$
|
|
1751
|
+
})), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1723
1752
|
fill: "currentColor",
|
|
1724
1753
|
fillRule: "evenodd",
|
|
1725
1754
|
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",
|
|
@@ -1830,6 +1859,7 @@ function Timepicker(props) {
|
|
|
1830
1859
|
label,
|
|
1831
1860
|
collapseLabelOnEmpty,
|
|
1832
1861
|
onDateTimeBlur,
|
|
1862
|
+
onDateTimeFocus,
|
|
1833
1863
|
formId,
|
|
1834
1864
|
required,
|
|
1835
1865
|
disabled,
|
|
@@ -1931,6 +1961,10 @@ function Timepicker(props) {
|
|
|
1931
1961
|
propagateRawToMinute();
|
|
1932
1962
|
onDateTimeBlur(e);
|
|
1933
1963
|
};
|
|
1964
|
+
const onInputFocus = e => {
|
|
1965
|
+
onDateTimeFocus(e);
|
|
1966
|
+
!readonly && useDropdown && setDropdownIsOpen(true);
|
|
1967
|
+
};
|
|
1934
1968
|
const onDropdownValueSelected = value => {
|
|
1935
1969
|
setDropdownIsOpen(false);
|
|
1936
1970
|
propagateRawToMinute(value);
|
|
@@ -1959,9 +1993,7 @@ function Timepicker(props) {
|
|
|
1959
1993
|
disabled: disabled,
|
|
1960
1994
|
readOnly: readonly,
|
|
1961
1995
|
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
1962
|
-
autoComplete: "off"
|
|
1963
|
-
onFocus: () => !readonly && useDropdown && setDropdownIsOpen(true),
|
|
1964
|
-
onClick: () => !readonly && useDropdown && setDropdownIsOpen(true)
|
|
1996
|
+
autoComplete: "off"
|
|
1965
1997
|
|
|
1966
1998
|
// @ts-ignore
|
|
1967
1999
|
,
|
|
@@ -1970,6 +2002,8 @@ function Timepicker(props) {
|
|
|
1970
2002
|
useDropdown && setDropdownIsOpen(false);
|
|
1971
2003
|
},
|
|
1972
2004
|
onBlur: onInputBlur,
|
|
2005
|
+
onFocus: onInputFocus,
|
|
2006
|
+
onClick: () => !readonly && useDropdown && setDropdownIsOpen(true),
|
|
1973
2007
|
onKeyDown: onInputKeyDown,
|
|
1974
2008
|
"data-input": true,
|
|
1975
2009
|
"aria-describedby": props['aria-describedby']
|
|
@@ -1985,12 +2019,13 @@ function Timepicker(props) {
|
|
|
1985
2019
|
});
|
|
1986
2020
|
}
|
|
1987
2021
|
|
|
1988
|
-
const type$
|
|
2022
|
+
const type$a = 'datetime';
|
|
1989
2023
|
function Datetime(props) {
|
|
1990
2024
|
const {
|
|
1991
2025
|
disabled,
|
|
1992
2026
|
errors = [],
|
|
1993
2027
|
onBlur,
|
|
2028
|
+
onFocus,
|
|
1994
2029
|
field,
|
|
1995
2030
|
onChange,
|
|
1996
2031
|
readonly,
|
|
@@ -2029,8 +2064,14 @@ function Datetime(props) {
|
|
|
2029
2064
|
if (e.relatedTarget && dateTimeGroupRef.current.contains(e.relatedTarget)) {
|
|
2030
2065
|
return;
|
|
2031
2066
|
}
|
|
2032
|
-
onBlur();
|
|
2067
|
+
onBlur && onBlur();
|
|
2033
2068
|
}, [onBlur]);
|
|
2069
|
+
const onDateTimeFocus = hooks.useCallback(e => {
|
|
2070
|
+
if (e.relatedTarget && dateTimeGroupRef.current.contains(e.relatedTarget)) {
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
onFocus && onFocus();
|
|
2074
|
+
}, [onFocus]);
|
|
2034
2075
|
hooks.useEffect(() => {
|
|
2035
2076
|
let {
|
|
2036
2077
|
date,
|
|
@@ -2123,6 +2164,7 @@ function Datetime(props) {
|
|
|
2123
2164
|
label: dateLabel,
|
|
2124
2165
|
collapseLabelOnEmpty: !timeLabel,
|
|
2125
2166
|
onDateTimeBlur,
|
|
2167
|
+
onDateTimeFocus,
|
|
2126
2168
|
formId,
|
|
2127
2169
|
required,
|
|
2128
2170
|
disabled,
|
|
@@ -2137,6 +2179,7 @@ function Datetime(props) {
|
|
|
2137
2179
|
label: timeLabel,
|
|
2138
2180
|
collapseLabelOnEmpty: !dateLabel,
|
|
2139
2181
|
onDateTimeBlur,
|
|
2182
|
+
onDateTimeFocus,
|
|
2140
2183
|
formId,
|
|
2141
2184
|
required,
|
|
2142
2185
|
disabled,
|
|
@@ -2148,7 +2191,7 @@ function Datetime(props) {
|
|
|
2148
2191
|
'aria-describedby': errorMessageId
|
|
2149
2192
|
};
|
|
2150
2193
|
return jsxRuntime.jsxs("div", {
|
|
2151
|
-
class: formFieldClasses(type$
|
|
2194
|
+
class: formFieldClasses(type$a, {
|
|
2152
2195
|
errors: allErrors,
|
|
2153
2196
|
disabled,
|
|
2154
2197
|
readonly
|
|
@@ -2172,7 +2215,7 @@ function Datetime(props) {
|
|
|
2172
2215
|
});
|
|
2173
2216
|
}
|
|
2174
2217
|
Datetime.config = {
|
|
2175
|
-
type: type$
|
|
2218
|
+
type: type$a,
|
|
2176
2219
|
keyed: true,
|
|
2177
2220
|
label: 'Date time',
|
|
2178
2221
|
group: 'basic-input',
|
|
@@ -2189,10 +2232,10 @@ Datetime.config = {
|
|
|
2189
2232
|
}
|
|
2190
2233
|
};
|
|
2191
2234
|
|
|
2192
|
-
/**
|
|
2193
|
-
* This file must not be changed or exchanged.
|
|
2194
|
-
*
|
|
2195
|
-
* @see http://bpmn.io/license for more information.
|
|
2235
|
+
/**
|
|
2236
|
+
* This file must not be changed or exchanged.
|
|
2237
|
+
*
|
|
2238
|
+
* @see http://bpmn.io/license for more information.
|
|
2196
2239
|
*/
|
|
2197
2240
|
function Logo() {
|
|
2198
2241
|
return jsxRuntime.jsxs("svg", {
|
|
@@ -2370,11 +2413,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
2370
2413
|
|
|
2371
2414
|
const FORM_ELEMENT = document.createElement('form');
|
|
2372
2415
|
|
|
2373
|
-
/**
|
|
2374
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2375
|
-
*
|
|
2376
|
-
* @param {string} html
|
|
2377
|
-
* @return {string}
|
|
2416
|
+
/**
|
|
2417
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
2418
|
+
*
|
|
2419
|
+
* @param {string} html
|
|
2420
|
+
* @return {string}
|
|
2378
2421
|
*/
|
|
2379
2422
|
|
|
2380
2423
|
// see https://github.com/developit/snarkdown/issues/70
|
|
@@ -2392,29 +2435,29 @@ function sanitizeHTML(html) {
|
|
|
2392
2435
|
}
|
|
2393
2436
|
}
|
|
2394
2437
|
|
|
2395
|
-
/**
|
|
2396
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2397
|
-
* that start with http(s).
|
|
2398
|
-
*
|
|
2399
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2400
|
-
*
|
|
2401
|
-
* @param {string} src
|
|
2402
|
-
* @returns {string}
|
|
2438
|
+
/**
|
|
2439
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
2440
|
+
* that start with http(s).
|
|
2441
|
+
*
|
|
2442
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
2443
|
+
*
|
|
2444
|
+
* @param {string} src
|
|
2445
|
+
* @returns {string}
|
|
2403
2446
|
*/
|
|
2404
2447
|
function sanitizeImageSource(src) {
|
|
2405
2448
|
const valid = ALLOWED_IMAGE_SRC_PATTERN.test(src);
|
|
2406
2449
|
return valid ? src : '';
|
|
2407
2450
|
}
|
|
2408
2451
|
|
|
2409
|
-
/**
|
|
2410
|
-
* Recursively sanitize a HTML node, potentially
|
|
2411
|
-
* removing it, its children or attributes.
|
|
2412
|
-
*
|
|
2413
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2414
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2415
|
-
* for our use-case.
|
|
2416
|
-
*
|
|
2417
|
-
* @param {Element} node
|
|
2452
|
+
/**
|
|
2453
|
+
* Recursively sanitize a HTML node, potentially
|
|
2454
|
+
* removing it, its children or attributes.
|
|
2455
|
+
*
|
|
2456
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
2457
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
2458
|
+
* for our use-case.
|
|
2459
|
+
*
|
|
2460
|
+
* @param {Element} node
|
|
2418
2461
|
*/
|
|
2419
2462
|
function sanitizeNode(node) {
|
|
2420
2463
|
// allow text nodes
|
|
@@ -2458,13 +2501,13 @@ function sanitizeNode(node) {
|
|
|
2458
2501
|
}
|
|
2459
2502
|
}
|
|
2460
2503
|
|
|
2461
|
-
/**
|
|
2462
|
-
* Validates attributes for validity.
|
|
2463
|
-
*
|
|
2464
|
-
* @param {string} lcTag
|
|
2465
|
-
* @param {string} lcName
|
|
2466
|
-
* @param {string} value
|
|
2467
|
-
* @return {boolean}
|
|
2504
|
+
/**
|
|
2505
|
+
* Validates attributes for validity.
|
|
2506
|
+
*
|
|
2507
|
+
* @param {string} lcTag
|
|
2508
|
+
* @param {string} lcName
|
|
2509
|
+
* @param {string} value
|
|
2510
|
+
* @return {boolean}
|
|
2468
2511
|
*/
|
|
2469
2512
|
function isValidAttribute(lcTag, lcName, value) {
|
|
2470
2513
|
// disallow most attributes based on whitelist
|
|
@@ -2487,9 +2530,9 @@ function isValidAttribute(lcTag, lcName, value) {
|
|
|
2487
2530
|
return true;
|
|
2488
2531
|
}
|
|
2489
2532
|
|
|
2490
|
-
function _extends$
|
|
2533
|
+
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); }
|
|
2491
2534
|
var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
|
|
2492
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
2535
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
2493
2536
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2494
2537
|
xmlSpace: "preserve",
|
|
2495
2538
|
width: 64,
|
|
@@ -2528,7 +2571,7 @@ var SvgImagePlaceholder = function SvgImagePlaceholder(props) {
|
|
|
2528
2571
|
};
|
|
2529
2572
|
var ImagePlaceholder = SvgImagePlaceholder;
|
|
2530
2573
|
|
|
2531
|
-
const type$
|
|
2574
|
+
const type$9 = 'image';
|
|
2532
2575
|
function Image(props) {
|
|
2533
2576
|
const {
|
|
2534
2577
|
field
|
|
@@ -2549,7 +2592,7 @@ function Image(props) {
|
|
|
2549
2592
|
formId
|
|
2550
2593
|
} = hooks.useContext(FormContext$1);
|
|
2551
2594
|
return jsxRuntime.jsx("div", {
|
|
2552
|
-
class: formFieldClasses(type$
|
|
2595
|
+
class: formFieldClasses(type$9),
|
|
2553
2596
|
children: jsxRuntime.jsxs("div", {
|
|
2554
2597
|
class: "fjs-image-container",
|
|
2555
2598
|
children: [safeSource && jsxRuntime.jsx("img", {
|
|
@@ -2567,7 +2610,7 @@ function Image(props) {
|
|
|
2567
2610
|
});
|
|
2568
2611
|
}
|
|
2569
2612
|
Image.config = {
|
|
2570
|
-
type: type$
|
|
2613
|
+
type: type$9,
|
|
2571
2614
|
keyed: false,
|
|
2572
2615
|
label: 'Image view',
|
|
2573
2616
|
group: 'presentation',
|
|
@@ -2594,14 +2637,14 @@ function TemplatedInputAdorner(props) {
|
|
|
2594
2637
|
});
|
|
2595
2638
|
}
|
|
2596
2639
|
|
|
2597
|
-
var _path$
|
|
2598
|
-
function _extends$
|
|
2640
|
+
var _path$g;
|
|
2641
|
+
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); }
|
|
2599
2642
|
var SvgAngelDown = function SvgAngelDown(props) {
|
|
2600
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
2643
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
|
|
2601
2644
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2602
2645
|
width: 8,
|
|
2603
2646
|
height: 8
|
|
2604
|
-
}, props), _path$
|
|
2647
|
+
}, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2605
2648
|
fill: "currentColor",
|
|
2606
2649
|
fillRule: "evenodd",
|
|
2607
2650
|
stroke: "currentColor",
|
|
@@ -2612,14 +2655,14 @@ var SvgAngelDown = function SvgAngelDown(props) {
|
|
|
2612
2655
|
};
|
|
2613
2656
|
var AngelDownIcon = SvgAngelDown;
|
|
2614
2657
|
|
|
2615
|
-
var _path$
|
|
2616
|
-
function _extends$
|
|
2658
|
+
var _path$f;
|
|
2659
|
+
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); }
|
|
2617
2660
|
var SvgAngelUp = function SvgAngelUp(props) {
|
|
2618
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
2661
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
|
|
2619
2662
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2620
2663
|
width: 8,
|
|
2621
2664
|
height: 8
|
|
2622
|
-
}, props), _path$
|
|
2665
|
+
}, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2623
2666
|
fill: "currentColor",
|
|
2624
2667
|
fillRule: "evenodd",
|
|
2625
2668
|
stroke: "currentColor",
|
|
@@ -2655,12 +2698,13 @@ function isNullEquivalentValue(value) {
|
|
|
2655
2698
|
return value === undefined || value === null || value === '';
|
|
2656
2699
|
}
|
|
2657
2700
|
|
|
2658
|
-
const type$
|
|
2701
|
+
const type$8 = 'number';
|
|
2659
2702
|
function Numberfield(props) {
|
|
2660
2703
|
const {
|
|
2661
2704
|
disabled,
|
|
2662
2705
|
errors = [],
|
|
2663
2706
|
onBlur,
|
|
2707
|
+
onFocus,
|
|
2664
2708
|
field,
|
|
2665
2709
|
value,
|
|
2666
2710
|
readonly,
|
|
@@ -2793,7 +2837,7 @@ function Numberfield(props) {
|
|
|
2793
2837
|
} = hooks.useContext(FormContext$1);
|
|
2794
2838
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
2795
2839
|
return jsxRuntime.jsxs("div", {
|
|
2796
|
-
class: formFieldClasses(type$
|
|
2840
|
+
class: formFieldClasses(type$8, {
|
|
2797
2841
|
errors,
|
|
2798
2842
|
disabled,
|
|
2799
2843
|
readonly
|
|
@@ -2822,7 +2866,8 @@ function Numberfield(props) {
|
|
|
2822
2866
|
id: prefixId(id, formId),
|
|
2823
2867
|
onKeyDown: onKeyDown,
|
|
2824
2868
|
onKeyPress: onKeyPress,
|
|
2825
|
-
onBlur: onBlur
|
|
2869
|
+
onBlur: () => onBlur && onBlur(),
|
|
2870
|
+
onFocus: () => onFocus && onFocus()
|
|
2826
2871
|
|
|
2827
2872
|
// @ts-ignore
|
|
2828
2873
|
,
|
|
@@ -2865,7 +2910,7 @@ function Numberfield(props) {
|
|
|
2865
2910
|
});
|
|
2866
2911
|
}
|
|
2867
2912
|
Numberfield.config = {
|
|
2868
|
-
type: type$
|
|
2913
|
+
type: type$8,
|
|
2869
2914
|
keyed: true,
|
|
2870
2915
|
label: 'Number',
|
|
2871
2916
|
group: 'basic-input',
|
|
@@ -2888,12 +2933,13 @@ Numberfield.config = {
|
|
|
2888
2933
|
})
|
|
2889
2934
|
};
|
|
2890
2935
|
|
|
2891
|
-
const type$
|
|
2936
|
+
const type$7 = 'radio';
|
|
2892
2937
|
function Radio(props) {
|
|
2893
2938
|
const {
|
|
2894
2939
|
disabled,
|
|
2895
2940
|
errors = [],
|
|
2896
2941
|
onBlur,
|
|
2942
|
+
onFocus,
|
|
2897
2943
|
field,
|
|
2898
2944
|
readonly,
|
|
2899
2945
|
value
|
|
@@ -2918,7 +2964,13 @@ function Radio(props) {
|
|
|
2918
2964
|
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
2919
2965
|
return;
|
|
2920
2966
|
}
|
|
2921
|
-
onBlur();
|
|
2967
|
+
onBlur && onBlur();
|
|
2968
|
+
};
|
|
2969
|
+
const onRadioFocus = e => {
|
|
2970
|
+
if (outerDivRef.current.contains(e.relatedTarget)) {
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
onFocus && onFocus();
|
|
2922
2974
|
};
|
|
2923
2975
|
const {
|
|
2924
2976
|
state: loadState,
|
|
@@ -2929,7 +2981,7 @@ function Radio(props) {
|
|
|
2929
2981
|
} = hooks.useContext(FormContext$1);
|
|
2930
2982
|
const errorMessageId = errors.length === 0 ? undefined : `${prefixId(id, formId)}-error-message`;
|
|
2931
2983
|
return jsxRuntime.jsxs("div", {
|
|
2932
|
-
class: formFieldClasses(type$
|
|
2984
|
+
class: formFieldClasses(type$7, {
|
|
2933
2985
|
errors,
|
|
2934
2986
|
disabled,
|
|
2935
2987
|
readonly
|
|
@@ -2955,6 +3007,7 @@ function Radio(props) {
|
|
|
2955
3007
|
type: "radio",
|
|
2956
3008
|
onClick: () => onChange(option.value),
|
|
2957
3009
|
onBlur: onRadioBlur,
|
|
3010
|
+
onFocus: onRadioFocus,
|
|
2958
3011
|
"aria-describedby": errorMessageId
|
|
2959
3012
|
})
|
|
2960
3013
|
}, `${id}-${index}`);
|
|
@@ -2967,7 +3020,7 @@ function Radio(props) {
|
|
|
2967
3020
|
});
|
|
2968
3021
|
}
|
|
2969
3022
|
Radio.config = {
|
|
2970
|
-
type: type$
|
|
3023
|
+
type: type$7,
|
|
2971
3024
|
keyed: true,
|
|
2972
3025
|
label: 'Radio',
|
|
2973
3026
|
group: 'selection',
|
|
@@ -2976,14 +3029,14 @@ Radio.config = {
|
|
|
2976
3029
|
create: createEmptyOptions
|
|
2977
3030
|
};
|
|
2978
3031
|
|
|
2979
|
-
var _path$
|
|
2980
|
-
function _extends$
|
|
3032
|
+
var _path$e;
|
|
3033
|
+
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); }
|
|
2981
3034
|
var SvgXMark = function SvgXMark(props) {
|
|
2982
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
3035
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
|
|
2983
3036
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2984
3037
|
width: 8,
|
|
2985
3038
|
height: 8
|
|
2986
|
-
}, props), _path$
|
|
3039
|
+
}, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2987
3040
|
fill: "currentColor",
|
|
2988
3041
|
fillRule: "evenodd",
|
|
2989
3042
|
stroke: "currentColor",
|
|
@@ -3000,6 +3053,7 @@ function SearchableSelect(props) {
|
|
|
3000
3053
|
disabled,
|
|
3001
3054
|
errors,
|
|
3002
3055
|
onBlur,
|
|
3056
|
+
onFocus,
|
|
3003
3057
|
field,
|
|
3004
3058
|
readonly,
|
|
3005
3059
|
value
|
|
@@ -3012,6 +3066,7 @@ function SearchableSelect(props) {
|
|
|
3012
3066
|
const [shouldApplyFilter, setShouldApplyFilter] = hooks.useState(true);
|
|
3013
3067
|
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3014
3068
|
const searchbarRef = hooks.useRef();
|
|
3069
|
+
const eventBus = useService('eventBus');
|
|
3015
3070
|
const {
|
|
3016
3071
|
state: loadState,
|
|
3017
3072
|
values: options
|
|
@@ -3033,14 +3088,6 @@ function SearchableSelect(props) {
|
|
|
3033
3088
|
}
|
|
3034
3089
|
return [];
|
|
3035
3090
|
}, [filter, loadState, options, shouldApplyFilter]);
|
|
3036
|
-
const onChange = ({
|
|
3037
|
-
target
|
|
3038
|
-
}) => {
|
|
3039
|
-
setIsEscapeClose(false);
|
|
3040
|
-
setIsDropdownExpanded(true);
|
|
3041
|
-
setShouldApplyFilter(true);
|
|
3042
|
-
setFilter(target.value || '');
|
|
3043
|
-
};
|
|
3044
3091
|
const setValue = hooks.useCallback(option => {
|
|
3045
3092
|
setFilter(option && option.label || '');
|
|
3046
3093
|
props.onChange({
|
|
@@ -3048,6 +3095,32 @@ function SearchableSelect(props) {
|
|
|
3048
3095
|
field
|
|
3049
3096
|
});
|
|
3050
3097
|
}, [field, props]);
|
|
3098
|
+
const displayState = hooks.useMemo(() => {
|
|
3099
|
+
const ds = {};
|
|
3100
|
+
ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
|
|
3101
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3102
|
+
ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
|
|
3103
|
+
return ds;
|
|
3104
|
+
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
|
|
3105
|
+
const onAngelMouseDown = hooks.useCallback(e => {
|
|
3106
|
+
setIsEscapeClose(false);
|
|
3107
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3108
|
+
const searchbar = searchbarRef.current;
|
|
3109
|
+
isDropdownExpanded ? searchbar.blur() : searchbar.focus();
|
|
3110
|
+
e.preventDefault();
|
|
3111
|
+
}, [isDropdownExpanded]);
|
|
3112
|
+
const onInputChange = ({
|
|
3113
|
+
target
|
|
3114
|
+
}) => {
|
|
3115
|
+
setIsEscapeClose(false);
|
|
3116
|
+
setIsDropdownExpanded(true);
|
|
3117
|
+
setShouldApplyFilter(true);
|
|
3118
|
+
setFilter(target.value || '');
|
|
3119
|
+
eventBus.fire('formField.search', {
|
|
3120
|
+
formField: field,
|
|
3121
|
+
value: target.value || ''
|
|
3122
|
+
});
|
|
3123
|
+
};
|
|
3051
3124
|
const onInputKeyDown = hooks.useCallback(keyDownEvent => {
|
|
3052
3125
|
switch (keyDownEvent.key) {
|
|
3053
3126
|
case 'ArrowUp':
|
|
@@ -3072,20 +3145,21 @@ function SearchableSelect(props) {
|
|
|
3072
3145
|
break;
|
|
3073
3146
|
}
|
|
3074
3147
|
}, [isDropdownExpanded, isEscapeClosed]);
|
|
3075
|
-
const
|
|
3076
|
-
const ds = {};
|
|
3077
|
-
ds.componentReady = !disabled && !readonly && loadState === LOAD_STATES.LOADED;
|
|
3078
|
-
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3079
|
-
ds.displayDropdown = !disabled && !readonly && isDropdownExpanded && !isEscapeClosed;
|
|
3080
|
-
return ds;
|
|
3081
|
-
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, readonly, value]);
|
|
3082
|
-
const onAngelMouseDown = hooks.useCallback(e => {
|
|
3148
|
+
const onInputMouseDown = hooks.useCallback(() => {
|
|
3083
3149
|
setIsEscapeClose(false);
|
|
3084
|
-
setIsDropdownExpanded(
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3150
|
+
setIsDropdownExpanded(true);
|
|
3151
|
+
setShouldApplyFilter(false);
|
|
3152
|
+
}, []);
|
|
3153
|
+
const onInputFocus = hooks.useCallback(() => {
|
|
3154
|
+
setIsEscapeClose(false);
|
|
3155
|
+
setIsDropdownExpanded(true);
|
|
3156
|
+
onFocus && onFocus();
|
|
3157
|
+
}, [onFocus]);
|
|
3158
|
+
const onInputBlur = hooks.useCallback(() => {
|
|
3159
|
+
setIsDropdownExpanded(false);
|
|
3160
|
+
setFilter(valueLabel);
|
|
3161
|
+
onBlur && onBlur();
|
|
3162
|
+
}, [onBlur, valueLabel]);
|
|
3089
3163
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3090
3164
|
children: [jsxRuntime.jsxs("div", {
|
|
3091
3165
|
id: prefixId(`${id}`, formId),
|
|
@@ -3101,26 +3175,15 @@ function SearchableSelect(props) {
|
|
|
3101
3175
|
class: "fjs-input",
|
|
3102
3176
|
ref: searchbarRef,
|
|
3103
3177
|
id: prefixId(`${id}-search`, formId),
|
|
3104
|
-
onChange:
|
|
3178
|
+
onChange: onInputChange,
|
|
3105
3179
|
type: "text",
|
|
3106
3180
|
value: filter,
|
|
3107
3181
|
placeholder: 'Search',
|
|
3108
3182
|
autoComplete: "off",
|
|
3109
|
-
onKeyDown:
|
|
3110
|
-
onMouseDown:
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
setShouldApplyFilter(false);
|
|
3114
|
-
},
|
|
3115
|
-
onFocus: () => {
|
|
3116
|
-
setIsDropdownExpanded(true);
|
|
3117
|
-
setShouldApplyFilter(false);
|
|
3118
|
-
},
|
|
3119
|
-
onBlur: () => {
|
|
3120
|
-
setIsDropdownExpanded(false);
|
|
3121
|
-
setFilter(valueLabel);
|
|
3122
|
-
onBlur();
|
|
3123
|
-
},
|
|
3183
|
+
onKeyDown: onInputKeyDown,
|
|
3184
|
+
onMouseDown: onInputMouseDown,
|
|
3185
|
+
onFocus: onInputFocus,
|
|
3186
|
+
onBlur: onInputBlur,
|
|
3124
3187
|
"aria-describedby": props['aria-describedby']
|
|
3125
3188
|
}), displayState.displayCross && jsxRuntime.jsxs("span", {
|
|
3126
3189
|
class: "fjs-select-cross",
|
|
@@ -3155,6 +3218,7 @@ function SimpleSelect(props) {
|
|
|
3155
3218
|
disabled,
|
|
3156
3219
|
errors,
|
|
3157
3220
|
onBlur,
|
|
3221
|
+
onFocus,
|
|
3158
3222
|
field,
|
|
3159
3223
|
readonly,
|
|
3160
3224
|
value
|
|
@@ -3164,6 +3228,7 @@ function SimpleSelect(props) {
|
|
|
3164
3228
|
} = hooks.useContext(FormContext$1);
|
|
3165
3229
|
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3166
3230
|
const selectRef = hooks.useRef();
|
|
3231
|
+
const inputRef = hooks.useRef();
|
|
3167
3232
|
const {
|
|
3168
3233
|
state: loadState,
|
|
3169
3234
|
values: options
|
|
@@ -3188,16 +3253,28 @@ function SimpleSelect(props) {
|
|
|
3188
3253
|
return ds;
|
|
3189
3254
|
}, [disabled, isDropdownExpanded, loadState, value]);
|
|
3190
3255
|
const onMouseDown = hooks.useCallback(e => {
|
|
3191
|
-
const
|
|
3256
|
+
const input = inputRef.current;
|
|
3192
3257
|
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3193
3258
|
if (isDropdownExpanded) {
|
|
3194
|
-
|
|
3259
|
+
input.blur();
|
|
3195
3260
|
} else {
|
|
3196
|
-
|
|
3261
|
+
input.focus();
|
|
3197
3262
|
}
|
|
3198
3263
|
e.preventDefault();
|
|
3199
3264
|
}, [isDropdownExpanded]);
|
|
3200
3265
|
const initialFocusIndex = hooks.useMemo(() => value && minDash.findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3266
|
+
const onInputFocus = hooks.useCallback(() => {
|
|
3267
|
+
if (!readonly) {
|
|
3268
|
+
setIsDropdownExpanded(true);
|
|
3269
|
+
onFocus && onFocus();
|
|
3270
|
+
}
|
|
3271
|
+
}, [onFocus, readonly]);
|
|
3272
|
+
const onInputBlur = hooks.useCallback(() => {
|
|
3273
|
+
if (!readonly) {
|
|
3274
|
+
setIsDropdownExpanded(false);
|
|
3275
|
+
onBlur && onBlur();
|
|
3276
|
+
}
|
|
3277
|
+
}, [onBlur, readonly]);
|
|
3201
3278
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3202
3279
|
children: [jsxRuntime.jsxs("div", {
|
|
3203
3280
|
ref: selectRef,
|
|
@@ -3208,11 +3285,8 @@ function SimpleSelect(props) {
|
|
|
3208
3285
|
}, {
|
|
3209
3286
|
'hasErrors': errors.length
|
|
3210
3287
|
}),
|
|
3211
|
-
onFocus:
|
|
3212
|
-
onBlur:
|
|
3213
|
-
setIsDropdownExpanded(false);
|
|
3214
|
-
onBlur();
|
|
3215
|
-
},
|
|
3288
|
+
onFocus: onInputFocus,
|
|
3289
|
+
onBlur: onInputBlur,
|
|
3216
3290
|
onMouseDown: onMouseDown,
|
|
3217
3291
|
children: [jsxRuntime.jsx("div", {
|
|
3218
3292
|
class: classNames('fjs-select-display', {
|
|
@@ -3221,11 +3295,12 @@ function SimpleSelect(props) {
|
|
|
3221
3295
|
id: prefixId(`${id}-display`, formId),
|
|
3222
3296
|
children: valueLabel || 'Select'
|
|
3223
3297
|
}), !disabled && jsxRuntime.jsx("input", {
|
|
3298
|
+
ref: inputRef,
|
|
3224
3299
|
id: prefixId(`${id}-search`, formId),
|
|
3225
3300
|
class: "fjs-select-hidden-input",
|
|
3226
3301
|
value: valueLabel,
|
|
3227
|
-
onFocus:
|
|
3228
|
-
onBlur:
|
|
3302
|
+
onFocus: onInputFocus,
|
|
3303
|
+
onBlur: onInputBlur,
|
|
3229
3304
|
"aria-describedby": props['aria-describedby']
|
|
3230
3305
|
}), displayState.displayCross && jsxRuntime.jsx("span", {
|
|
3231
3306
|
class: "fjs-select-cross",
|
|
@@ -3254,12 +3329,13 @@ function SimpleSelect(props) {
|
|
|
3254
3329
|
});
|
|
3255
3330
|
}
|
|
3256
3331
|
|
|
3257
|
-
const type$
|
|
3332
|
+
const type$6 = 'select';
|
|
3258
3333
|
function Select(props) {
|
|
3259
3334
|
const {
|
|
3260
3335
|
disabled,
|
|
3261
3336
|
errors = [],
|
|
3262
3337
|
onBlur,
|
|
3338
|
+
onFocus,
|
|
3263
3339
|
field,
|
|
3264
3340
|
onChange,
|
|
3265
3341
|
readonly,
|
|
@@ -3284,14 +3360,15 @@ function Select(props) {
|
|
|
3284
3360
|
disabled,
|
|
3285
3361
|
errors,
|
|
3286
3362
|
onBlur,
|
|
3363
|
+
onFocus,
|
|
3287
3364
|
field,
|
|
3288
3365
|
value,
|
|
3289
3366
|
onChange,
|
|
3290
3367
|
readonly,
|
|
3291
3368
|
'aria-describedby': errorMessageId
|
|
3292
|
-
}), [disabled, errors, field, id, value, onChange, onBlur, readonly, errorMessageId]);
|
|
3369
|
+
}), [disabled, errors, field, id, value, onChange, onBlur, onFocus, readonly, errorMessageId]);
|
|
3293
3370
|
return jsxRuntime.jsxs("div", {
|
|
3294
|
-
class: formFieldClasses(type$
|
|
3371
|
+
class: formFieldClasses(type$6, {
|
|
3295
3372
|
errors,
|
|
3296
3373
|
disabled,
|
|
3297
3374
|
readonly
|
|
@@ -3319,7 +3396,7 @@ function Select(props) {
|
|
|
3319
3396
|
});
|
|
3320
3397
|
}
|
|
3321
3398
|
Select.config = {
|
|
3322
|
-
type: type$
|
|
3399
|
+
type: type$6,
|
|
3323
3400
|
keyed: true,
|
|
3324
3401
|
label: 'Select',
|
|
3325
3402
|
group: 'selection',
|
|
@@ -3328,6 +3405,23 @@ Select.config = {
|
|
|
3328
3405
|
create: createEmptyOptions
|
|
3329
3406
|
};
|
|
3330
3407
|
|
|
3408
|
+
const type$5 = 'separator';
|
|
3409
|
+
function Separator() {
|
|
3410
|
+
return jsxRuntime.jsx("div", {
|
|
3411
|
+
class: formFieldClasses(type$5),
|
|
3412
|
+
children: jsxRuntime.jsx("hr", {})
|
|
3413
|
+
});
|
|
3414
|
+
}
|
|
3415
|
+
Separator.config = {
|
|
3416
|
+
type: type$5,
|
|
3417
|
+
keyed: false,
|
|
3418
|
+
label: 'Separator',
|
|
3419
|
+
group: 'presentation',
|
|
3420
|
+
create: (options = {}) => ({
|
|
3421
|
+
...options
|
|
3422
|
+
})
|
|
3423
|
+
};
|
|
3424
|
+
|
|
3331
3425
|
const type$4 = 'spacer';
|
|
3332
3426
|
function Spacer(props) {
|
|
3333
3427
|
const {
|
|
@@ -3354,11 +3448,33 @@ Spacer.config = {
|
|
|
3354
3448
|
})
|
|
3355
3449
|
};
|
|
3356
3450
|
|
|
3451
|
+
function SkipLink(props) {
|
|
3452
|
+
const {
|
|
3453
|
+
className,
|
|
3454
|
+
label,
|
|
3455
|
+
onSkip
|
|
3456
|
+
} = props;
|
|
3457
|
+
const onKeyDown = hooks.useCallback(event => {
|
|
3458
|
+
if (event.key === 'Enter') {
|
|
3459
|
+
event.preventDefault();
|
|
3460
|
+
event.stopPropagation();
|
|
3461
|
+
onSkip();
|
|
3462
|
+
}
|
|
3463
|
+
}, [onSkip]);
|
|
3464
|
+
return jsxRuntime.jsx("a", {
|
|
3465
|
+
href: "#",
|
|
3466
|
+
class: classNames('fjs-skip-link', className),
|
|
3467
|
+
onKeyDown: onKeyDown,
|
|
3468
|
+
children: label
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3357
3472
|
const type$3 = 'taglist';
|
|
3358
3473
|
function Taglist(props) {
|
|
3359
3474
|
const {
|
|
3360
3475
|
disabled,
|
|
3361
3476
|
errors = [],
|
|
3477
|
+
onFocus,
|
|
3362
3478
|
onBlur,
|
|
3363
3479
|
field,
|
|
3364
3480
|
readonly,
|
|
@@ -3382,7 +3498,9 @@ function Taglist(props) {
|
|
|
3382
3498
|
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3383
3499
|
const [hasOptionsLeft, setHasOptionsLeft] = hooks.useState(true);
|
|
3384
3500
|
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3385
|
-
const
|
|
3501
|
+
const focusScopeRef = hooks.useRef();
|
|
3502
|
+
const inputRef = hooks.useRef();
|
|
3503
|
+
const eventBus = useService('eventBus');
|
|
3386
3504
|
const {
|
|
3387
3505
|
state: loadState,
|
|
3388
3506
|
values: options
|
|
@@ -3404,12 +3522,6 @@ function Taglist(props) {
|
|
|
3404
3522
|
hooks.useEffect(() => {
|
|
3405
3523
|
setHasOptionsLeft(options.length > values.length);
|
|
3406
3524
|
}, [options.length, values.length]);
|
|
3407
|
-
const onFilterChange = ({
|
|
3408
|
-
target
|
|
3409
|
-
}) => {
|
|
3410
|
-
setIsEscapeClose(false);
|
|
3411
|
-
setFilter(target.value);
|
|
3412
|
-
};
|
|
3413
3525
|
const selectValue = value => {
|
|
3414
3526
|
if (filter) {
|
|
3415
3527
|
setFilter('');
|
|
@@ -3430,6 +3542,16 @@ function Taglist(props) {
|
|
|
3430
3542
|
field
|
|
3431
3543
|
});
|
|
3432
3544
|
};
|
|
3545
|
+
const onInputChange = ({
|
|
3546
|
+
target
|
|
3547
|
+
}) => {
|
|
3548
|
+
setIsEscapeClose(false);
|
|
3549
|
+
setFilter(target.value || '');
|
|
3550
|
+
eventBus.fire('formField.search', {
|
|
3551
|
+
formField: field,
|
|
3552
|
+
value: target.value || ''
|
|
3553
|
+
});
|
|
3554
|
+
};
|
|
3433
3555
|
const onInputKeyDown = e => {
|
|
3434
3556
|
switch (e.key) {
|
|
3435
3557
|
case 'ArrowUp':
|
|
@@ -3452,10 +3574,26 @@ function Taglist(props) {
|
|
|
3452
3574
|
break;
|
|
3453
3575
|
}
|
|
3454
3576
|
};
|
|
3455
|
-
const
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3577
|
+
const onElementBlur = e => {
|
|
3578
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3579
|
+
onBlur && onBlur();
|
|
3580
|
+
};
|
|
3581
|
+
const onElementFocus = e => {
|
|
3582
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3583
|
+
onFocus && onFocus();
|
|
3584
|
+
};
|
|
3585
|
+
const onInputBlur = e => {
|
|
3586
|
+
if (!readonly) {
|
|
3587
|
+
setIsDropdownExpanded(false);
|
|
3588
|
+
setFilter('');
|
|
3589
|
+
}
|
|
3590
|
+
onElementBlur(e);
|
|
3591
|
+
};
|
|
3592
|
+
const onInputFocus = e => {
|
|
3593
|
+
if (!readonly) {
|
|
3594
|
+
setIsDropdownExpanded(true);
|
|
3595
|
+
}
|
|
3596
|
+
onElementFocus(e);
|
|
3459
3597
|
};
|
|
3460
3598
|
const onTagRemoveClick = (event, value) => {
|
|
3461
3599
|
const {
|
|
@@ -3466,11 +3604,15 @@ function Taglist(props) {
|
|
|
3466
3604
|
// restore focus if there is no next sibling to focus
|
|
3467
3605
|
const nextTag = target.closest('.fjs-taglist-tag').nextSibling;
|
|
3468
3606
|
if (!nextTag) {
|
|
3469
|
-
|
|
3607
|
+
inputRef.current.focus();
|
|
3470
3608
|
}
|
|
3471
3609
|
};
|
|
3610
|
+
const onSkipToSearch = () => {
|
|
3611
|
+
inputRef.current.focus();
|
|
3612
|
+
};
|
|
3472
3613
|
const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3473
3614
|
return jsxRuntime.jsxs("div", {
|
|
3615
|
+
ref: focusScopeRef,
|
|
3474
3616
|
class: formFieldClasses(type$3, {
|
|
3475
3617
|
errors,
|
|
3476
3618
|
disabled,
|
|
@@ -3486,6 +3628,10 @@ function Taglist(props) {
|
|
|
3486
3628
|
label: label,
|
|
3487
3629
|
required: required,
|
|
3488
3630
|
id: prefixId(`${id}-search`, formId)
|
|
3631
|
+
}), !disabled && !readonly && !!values.length && jsxRuntime.jsx(SkipLink, {
|
|
3632
|
+
className: "fjs-taglist-skip-link",
|
|
3633
|
+
label: "Skip to search",
|
|
3634
|
+
onSkip: onSkipToSearch
|
|
3489
3635
|
}), jsxRuntime.jsxs("div", {
|
|
3490
3636
|
class: classNames('fjs-taglist', {
|
|
3491
3637
|
'fjs-disabled': disabled,
|
|
@@ -3507,6 +3653,8 @@ function Taglist(props) {
|
|
|
3507
3653
|
type: "button",
|
|
3508
3654
|
title: "Remove tag",
|
|
3509
3655
|
class: "fjs-taglist-tag-remove",
|
|
3656
|
+
onFocus: onElementFocus,
|
|
3657
|
+
onBlur: onElementBlur,
|
|
3510
3658
|
onClick: event => onTagRemoveClick(event, v),
|
|
3511
3659
|
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3512
3660
|
})]
|
|
@@ -3516,17 +3664,17 @@ function Taglist(props) {
|
|
|
3516
3664
|
disabled: disabled,
|
|
3517
3665
|
readOnly: readonly,
|
|
3518
3666
|
class: "fjs-taglist-input",
|
|
3519
|
-
ref:
|
|
3667
|
+
ref: inputRef,
|
|
3520
3668
|
id: prefixId(`${id}-search`, formId),
|
|
3521
|
-
onChange:
|
|
3669
|
+
onChange: onInputChange,
|
|
3522
3670
|
type: "text",
|
|
3523
3671
|
value: filter,
|
|
3524
3672
|
placeholder: disabled || readonly ? undefined : 'Search',
|
|
3525
3673
|
autoComplete: "off",
|
|
3526
3674
|
onKeyDown: onInputKeyDown,
|
|
3527
3675
|
onMouseDown: () => setIsEscapeClose(false),
|
|
3528
|
-
onFocus:
|
|
3529
|
-
onBlur:
|
|
3676
|
+
onFocus: onInputFocus,
|
|
3677
|
+
onBlur: onInputBlur,
|
|
3530
3678
|
"aria-describedby": errorMessageId
|
|
3531
3679
|
})]
|
|
3532
3680
|
}), jsxRuntime.jsx("div", {
|
|
@@ -3536,7 +3684,7 @@ function Taglist(props) {
|
|
|
3536
3684
|
getLabel: o => o.label,
|
|
3537
3685
|
onValueSelected: o => selectValue(o.value),
|
|
3538
3686
|
emptyListMessage: hasOptionsLeft ? 'No results' : 'All values selected',
|
|
3539
|
-
listenerElement:
|
|
3687
|
+
listenerElement: inputRef.current
|
|
3540
3688
|
})
|
|
3541
3689
|
}), jsxRuntime.jsx(Description, {
|
|
3542
3690
|
description: description
|
|
@@ -3646,6 +3794,7 @@ function Textfield(props) {
|
|
|
3646
3794
|
disabled,
|
|
3647
3795
|
errors = [],
|
|
3648
3796
|
onBlur,
|
|
3797
|
+
onFocus,
|
|
3649
3798
|
field,
|
|
3650
3799
|
readonly,
|
|
3651
3800
|
value = ''
|
|
@@ -3697,7 +3846,8 @@ function Textfield(props) {
|
|
|
3697
3846
|
readOnly: readonly,
|
|
3698
3847
|
id: prefixId(id, formId),
|
|
3699
3848
|
onInput: onChange,
|
|
3700
|
-
onBlur: onBlur,
|
|
3849
|
+
onBlur: () => onBlur && onBlur(),
|
|
3850
|
+
onFocus: () => onFocus && onFocus(),
|
|
3701
3851
|
type: "text",
|
|
3702
3852
|
value: value,
|
|
3703
3853
|
"aria-describedby": errorMessageId
|
|
@@ -3740,6 +3890,7 @@ function Textarea(props) {
|
|
|
3740
3890
|
disabled,
|
|
3741
3891
|
errors = [],
|
|
3742
3892
|
onBlur,
|
|
3893
|
+
onFocus,
|
|
3743
3894
|
field,
|
|
3744
3895
|
readonly,
|
|
3745
3896
|
value = ''
|
|
@@ -3788,7 +3939,8 @@ function Textarea(props) {
|
|
|
3788
3939
|
readonly: readonly,
|
|
3789
3940
|
id: prefixId(id, formId),
|
|
3790
3941
|
onInput: onInput,
|
|
3791
|
-
onBlur: onBlur,
|
|
3942
|
+
onBlur: () => onBlur && onBlur(),
|
|
3943
|
+
onFocus: () => onFocus && onFocus(),
|
|
3792
3944
|
value: value,
|
|
3793
3945
|
ref: textareaRef,
|
|
3794
3946
|
"aria-describedby": errorMessageId
|
|
@@ -3832,39 +3984,39 @@ const autoSizeTextarea = textarea => {
|
|
|
3832
3984
|
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3833
3985
|
};
|
|
3834
3986
|
|
|
3835
|
-
var _path$
|
|
3836
|
-
function _extends$
|
|
3987
|
+
var _path$d;
|
|
3988
|
+
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); }
|
|
3837
3989
|
var SvgButton = function SvgButton(props) {
|
|
3838
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
3990
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
|
|
3839
3991
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3840
3992
|
width: 54,
|
|
3841
3993
|
height: 54,
|
|
3842
3994
|
fill: "currentcolor"
|
|
3843
|
-
}, props), _path$
|
|
3995
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3844
3996
|
fillRule: "evenodd",
|
|
3845
3997
|
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"
|
|
3846
3998
|
})));
|
|
3847
3999
|
};
|
|
3848
4000
|
var ButtonIcon = SvgButton;
|
|
3849
4001
|
|
|
3850
|
-
var _path$
|
|
3851
|
-
function _extends$
|
|
4002
|
+
var _path$c;
|
|
4003
|
+
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); }
|
|
3852
4004
|
var SvgCheckbox = function SvgCheckbox(props) {
|
|
3853
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4005
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
3854
4006
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3855
4007
|
width: 54,
|
|
3856
4008
|
height: 54,
|
|
3857
4009
|
fill: "currentcolor"
|
|
3858
|
-
}, props), _path$
|
|
4010
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3859
4011
|
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"
|
|
3860
4012
|
})));
|
|
3861
4013
|
};
|
|
3862
4014
|
var CheckboxIcon = SvgCheckbox;
|
|
3863
4015
|
|
|
3864
4016
|
var _g, _use, _use2, _use3, _defs;
|
|
3865
|
-
function _extends$
|
|
4017
|
+
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); }
|
|
3866
4018
|
var SvgChecklist = function SvgChecklist(props) {
|
|
3867
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4019
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
3868
4020
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3869
4021
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3870
4022
|
width: 54,
|
|
@@ -3898,18 +4050,18 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3898
4050
|
};
|
|
3899
4051
|
var ChecklistIcon = SvgChecklist;
|
|
3900
4052
|
|
|
3901
|
-
var _path$
|
|
3902
|
-
function _extends$
|
|
4053
|
+
var _path$b, _path2$2, _path3;
|
|
4054
|
+
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); }
|
|
3903
4055
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3904
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4056
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
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$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3910
4062
|
fillRule: "evenodd",
|
|
3911
4063
|
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"
|
|
3912
|
-
})), _path2$
|
|
4064
|
+
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3913
4065
|
d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
|
|
3914
4066
|
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3915
4067
|
fillRule: "evenodd",
|
|
@@ -3918,27 +4070,27 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3918
4070
|
};
|
|
3919
4071
|
var DatetimeIcon = SvgDatetime;
|
|
3920
4072
|
|
|
3921
|
-
var _path$
|
|
3922
|
-
function _extends$
|
|
4073
|
+
var _path$a, _path2$1;
|
|
4074
|
+
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); }
|
|
3923
4075
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3924
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4076
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
3925
4077
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3926
4078
|
width: 54,
|
|
3927
4079
|
height: 54,
|
|
3928
4080
|
fill: "currentcolor"
|
|
3929
|
-
}, props), _path$
|
|
4081
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3930
4082
|
fillRule: "evenodd",
|
|
3931
4083
|
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"
|
|
3932
|
-
})), _path2$
|
|
4084
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3933
4085
|
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"
|
|
3934
4086
|
})));
|
|
3935
4087
|
};
|
|
3936
4088
|
var TaglistIcon = SvgTaglist;
|
|
3937
4089
|
|
|
3938
4090
|
var _rect, _rect2, _rect3;
|
|
3939
|
-
function _extends$
|
|
4091
|
+
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); }
|
|
3940
4092
|
var SvgForm = function SvgForm(props) {
|
|
3941
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4093
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
3942
4094
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3943
4095
|
width: 54,
|
|
3944
4096
|
height: 54
|
|
@@ -3964,9 +4116,24 @@ var SvgForm = function SvgForm(props) {
|
|
|
3964
4116
|
};
|
|
3965
4117
|
var FormIcon = SvgForm;
|
|
3966
4118
|
|
|
4119
|
+
var _path$9;
|
|
4120
|
+
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); }
|
|
4121
|
+
var SvgGroup = function SvgGroup(props) {
|
|
4122
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
4123
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4124
|
+
width: 54,
|
|
4125
|
+
height: 54,
|
|
4126
|
+
fill: "currentcolor"
|
|
4127
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4128
|
+
fillRule: "evenodd",
|
|
4129
|
+
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"
|
|
4130
|
+
})));
|
|
4131
|
+
};
|
|
4132
|
+
var GroupIcon = SvgGroup;
|
|
4133
|
+
|
|
3967
4134
|
var _path$8;
|
|
3968
4135
|
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); }
|
|
3969
|
-
var
|
|
4136
|
+
var SvgNumber = function SvgNumber(props) {
|
|
3970
4137
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
3971
4138
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3972
4139
|
width: 54,
|
|
@@ -3974,74 +4141,66 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3974
4141
|
fill: "currentcolor"
|
|
3975
4142
|
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3976
4143
|
fillRule: "evenodd",
|
|
3977
|
-
d: "
|
|
4144
|
+
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"
|
|
3978
4145
|
})));
|
|
3979
4146
|
};
|
|
3980
|
-
var
|
|
4147
|
+
var NumberIcon = SvgNumber;
|
|
3981
4148
|
|
|
3982
4149
|
var _path$7;
|
|
3983
4150
|
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); }
|
|
3984
|
-
var
|
|
4151
|
+
var SvgRadio = function SvgRadio(props) {
|
|
3985
4152
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
3986
4153
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3987
4154
|
width: 54,
|
|
3988
4155
|
height: 54,
|
|
3989
4156
|
fill: "currentcolor"
|
|
3990
4157
|
}, props), _path$7 || (_path$7 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3991
|
-
|
|
3992
|
-
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"
|
|
4158
|
+
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"
|
|
3993
4159
|
})));
|
|
3994
4160
|
};
|
|
3995
|
-
var
|
|
4161
|
+
var RadioIcon = SvgRadio;
|
|
3996
4162
|
|
|
3997
4163
|
var _path$6;
|
|
3998
4164
|
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); }
|
|
3999
|
-
var
|
|
4165
|
+
var SvgSelect = function SvgSelect(props) {
|
|
4000
4166
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
4001
4167
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4002
4168
|
width: 54,
|
|
4003
4169
|
height: 54,
|
|
4004
4170
|
fill: "currentcolor"
|
|
4005
4171
|
}, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4006
|
-
|
|
4172
|
+
fillRule: "evenodd",
|
|
4173
|
+
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"
|
|
4007
4174
|
})));
|
|
4008
4175
|
};
|
|
4009
|
-
var
|
|
4176
|
+
var SelectIcon = SvgSelect;
|
|
4010
4177
|
|
|
4011
4178
|
var _path$5;
|
|
4012
4179
|
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); }
|
|
4013
|
-
var
|
|
4180
|
+
var SvgSeparator = function SvgSeparator(props) {
|
|
4014
4181
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
4015
4182
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4016
4183
|
width: 54,
|
|
4017
4184
|
height: 54,
|
|
4018
|
-
fill: "
|
|
4185
|
+
fill: "none"
|
|
4019
4186
|
}, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4020
|
-
|
|
4021
|
-
d: "
|
|
4187
|
+
fill: "currentColor",
|
|
4188
|
+
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"
|
|
4022
4189
|
})));
|
|
4023
4190
|
};
|
|
4024
|
-
var
|
|
4191
|
+
var SeparatorIcon = SvgSeparator;
|
|
4025
4192
|
|
|
4026
|
-
var _path$4
|
|
4193
|
+
var _path$4;
|
|
4027
4194
|
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); }
|
|
4028
4195
|
var SvgSpacer = function SvgSpacer(props) {
|
|
4029
4196
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
4030
4197
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4031
4198
|
width: 54,
|
|
4032
4199
|
height: 54,
|
|
4033
|
-
fill: "
|
|
4200
|
+
fill: "none"
|
|
4034
4201
|
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
strokeWidth: 2,
|
|
4038
|
-
d: "M9 23h36M9 31h36"
|
|
4039
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4040
|
-
stroke: "currentcolor",
|
|
4041
|
-
strokeLinecap: "round",
|
|
4042
|
-
strokeLinejoin: "round",
|
|
4043
|
-
strokeWidth: 2,
|
|
4044
|
-
d: "m23 17 4-4 4 4M31 37l-4 4-4-4"
|
|
4202
|
+
fill: "currentColor",
|
|
4203
|
+
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"
|
|
4045
4204
|
})));
|
|
4046
4205
|
};
|
|
4047
4206
|
var SpacerIcon = SvgSpacer;
|
|
@@ -4122,6 +4281,7 @@ const iconsByType = type => {
|
|
|
4122
4281
|
number: NumberIcon,
|
|
4123
4282
|
radio: RadioIcon,
|
|
4124
4283
|
select: SelectIcon,
|
|
4284
|
+
separator: SeparatorIcon,
|
|
4125
4285
|
spacer: SpacerIcon,
|
|
4126
4286
|
taglist: TaglistIcon,
|
|
4127
4287
|
text: TextIcon,
|
|
@@ -4131,7 +4291,7 @@ const iconsByType = type => {
|
|
|
4131
4291
|
}[type];
|
|
4132
4292
|
};
|
|
4133
4293
|
|
|
4134
|
-
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Taglist, Text, Textfield, Textarea];
|
|
4294
|
+
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, Taglist, Text, Textfield, Textarea];
|
|
4135
4295
|
|
|
4136
4296
|
class FormFields {
|
|
4137
4297
|
constructor() {
|
|
@@ -4192,10 +4352,10 @@ function createInjector(bootstrapModules) {
|
|
|
4192
4352
|
return injector;
|
|
4193
4353
|
}
|
|
4194
4354
|
|
|
4195
|
-
/**
|
|
4196
|
-
* @param {string?} prefix
|
|
4197
|
-
*
|
|
4198
|
-
* @returns Element
|
|
4355
|
+
/**
|
|
4356
|
+
* @param {string?} prefix
|
|
4357
|
+
*
|
|
4358
|
+
* @returns Element
|
|
4199
4359
|
*/
|
|
4200
4360
|
function createFormContainer(prefix = 'fjs') {
|
|
4201
4361
|
const container = document.createElement('div');
|
|
@@ -4232,22 +4392,47 @@ function generateIdForType(type) {
|
|
|
4232
4392
|
return `${type}${generateIndexForType(type)}`;
|
|
4233
4393
|
}
|
|
4234
4394
|
|
|
4235
|
-
/**
|
|
4236
|
-
* @template T
|
|
4237
|
-
* @param {T} data
|
|
4238
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4239
|
-
* @return {T}
|
|
4395
|
+
/**
|
|
4396
|
+
* @template T
|
|
4397
|
+
* @param {T} data
|
|
4398
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4399
|
+
* @return {T}
|
|
4240
4400
|
*/
|
|
4241
4401
|
function clone(data, replacer) {
|
|
4242
4402
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
4243
4403
|
}
|
|
4244
4404
|
|
|
4245
|
-
/**
|
|
4246
|
-
*
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
*
|
|
4405
|
+
/**
|
|
4406
|
+
* @typedef { import('../types').Schema } Schema
|
|
4407
|
+
*/
|
|
4408
|
+
|
|
4409
|
+
/**
|
|
4410
|
+
* Parse the schema for variables a form might make use of.
|
|
4411
|
+
*
|
|
4412
|
+
* @example
|
|
4413
|
+
*
|
|
4414
|
+
* // retrieve variables from schema
|
|
4415
|
+
* const variables = getSchemaVariables(schema);
|
|
4416
|
+
*
|
|
4417
|
+
* @example
|
|
4418
|
+
*
|
|
4419
|
+
* // retrieve input variables from schema
|
|
4420
|
+
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
4421
|
+
*
|
|
4422
|
+
* @example
|
|
4423
|
+
*
|
|
4424
|
+
* // retrieve output variables from schema
|
|
4425
|
+
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
4426
|
+
*
|
|
4427
|
+
* @param {Schema} schema
|
|
4428
|
+
* @param {object} [options]
|
|
4429
|
+
* @param {any} [options.expressionLanguage]
|
|
4430
|
+
* @param {any} [options.templating]
|
|
4431
|
+
* @param {any} [options.formFields]
|
|
4432
|
+
* @param {boolean} [options.inputs=true]
|
|
4433
|
+
* @param {boolean} [options.outputs=true]
|
|
4434
|
+
*
|
|
4435
|
+
* @return {string[]}
|
|
4251
4436
|
*/
|
|
4252
4437
|
function getSchemaVariables(schema, options = {}) {
|
|
4253
4438
|
const {
|
|
@@ -4330,9 +4515,9 @@ function runRecursively(formField, fn) {
|
|
|
4330
4515
|
fn(formField);
|
|
4331
4516
|
}
|
|
4332
4517
|
|
|
4333
|
-
/**
|
|
4334
|
-
* @typedef {object} Condition
|
|
4335
|
-
* @property {string} [hide]
|
|
4518
|
+
/**
|
|
4519
|
+
* @typedef {object} Condition
|
|
4520
|
+
* @property {string} [hide]
|
|
4336
4521
|
*/
|
|
4337
4522
|
|
|
4338
4523
|
class ConditionChecker {
|
|
@@ -4342,13 +4527,13 @@ class ConditionChecker {
|
|
|
4342
4527
|
this._eventBus = eventBus;
|
|
4343
4528
|
}
|
|
4344
4529
|
|
|
4345
|
-
/**
|
|
4346
|
-
* For given data, remove properties based on condition.
|
|
4347
|
-
*
|
|
4348
|
-
* @param {Object<string, any>} properties
|
|
4349
|
-
* @param {Object<string, any>} data
|
|
4350
|
-
* @param {Object} [options]
|
|
4351
|
-
* @param {Function} [options.getFilterPath]
|
|
4530
|
+
/**
|
|
4531
|
+
* For given data, remove properties based on condition.
|
|
4532
|
+
*
|
|
4533
|
+
* @param {Object<string, any>} properties
|
|
4534
|
+
* @param {Object<string, any>} data
|
|
4535
|
+
* @param {Object} [options]
|
|
4536
|
+
* @param {Function} [options.getFilterPath]
|
|
4352
4537
|
*/
|
|
4353
4538
|
applyConditions(properties, data = {}, options = {}) {
|
|
4354
4539
|
const newProperties = clone(properties);
|
|
@@ -4377,13 +4562,13 @@ class ConditionChecker {
|
|
|
4377
4562
|
return newProperties;
|
|
4378
4563
|
}
|
|
4379
4564
|
|
|
4380
|
-
/**
|
|
4381
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4382
|
-
*
|
|
4383
|
-
* @param {string} condition
|
|
4384
|
-
* @param {import('../../types').Data} [data]
|
|
4385
|
-
*
|
|
4386
|
-
* @returns {boolean|null}
|
|
4565
|
+
/**
|
|
4566
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4567
|
+
*
|
|
4568
|
+
* @param {string} condition
|
|
4569
|
+
* @param {import('../../types').Data} [data]
|
|
4570
|
+
*
|
|
4571
|
+
* @returns {boolean|null}
|
|
4387
4572
|
*/
|
|
4388
4573
|
check(condition, data = {}) {
|
|
4389
4574
|
if (!condition) {
|
|
@@ -4404,12 +4589,12 @@ class ConditionChecker {
|
|
|
4404
4589
|
}
|
|
4405
4590
|
}
|
|
4406
4591
|
|
|
4407
|
-
/**
|
|
4408
|
-
* Check if hide condition is met.
|
|
4409
|
-
*
|
|
4410
|
-
* @param {Condition} condition
|
|
4411
|
-
* @param {Object<string, any>} data
|
|
4412
|
-
* @returns {boolean}
|
|
4592
|
+
/**
|
|
4593
|
+
* Check if hide condition is met.
|
|
4594
|
+
*
|
|
4595
|
+
* @param {Condition} condition
|
|
4596
|
+
* @param {Object<string, any>} data
|
|
4597
|
+
* @returns {boolean}
|
|
4413
4598
|
*/
|
|
4414
4599
|
_checkHideCondition(condition, data) {
|
|
4415
4600
|
if (!condition.hide) {
|
|
@@ -4445,12 +4630,12 @@ class MarkdownRenderer {
|
|
|
4445
4630
|
this._converter = new showdown.Converter();
|
|
4446
4631
|
}
|
|
4447
4632
|
|
|
4448
|
-
/**
|
|
4449
|
-
* Render markdown to HTML.
|
|
4450
|
-
*
|
|
4451
|
-
* @param {string} markdown - The markdown to render
|
|
4452
|
-
*
|
|
4453
|
-
* @returns {string} HTML
|
|
4633
|
+
/**
|
|
4634
|
+
* Render markdown to HTML.
|
|
4635
|
+
*
|
|
4636
|
+
* @param {string} markdown - The markdown to render
|
|
4637
|
+
*
|
|
4638
|
+
* @returns {string} HTML
|
|
4454
4639
|
*/
|
|
4455
4640
|
render(markdown) {
|
|
4456
4641
|
return this._converter.makeHtml(markdown);
|
|
@@ -5573,8 +5758,8 @@ Validator.$inject = ['expressionLanguage', 'conditionChecker', 'form'];
|
|
|
5573
5758
|
|
|
5574
5759
|
// helpers //////////
|
|
5575
5760
|
|
|
5576
|
-
/**
|
|
5577
|
-
* Helper function to evaluate optional FEEL validation values.
|
|
5761
|
+
/**
|
|
5762
|
+
* Helper function to evaluate optional FEEL validation values.
|
|
5578
5763
|
*/
|
|
5579
5764
|
function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
5580
5765
|
const evaluatedValidate = {
|
|
@@ -5608,12 +5793,12 @@ function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form
|
|
|
5608
5793
|
}
|
|
5609
5794
|
|
|
5610
5795
|
class Importer {
|
|
5611
|
-
/**
|
|
5612
|
-
* @constructor
|
|
5613
|
-
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5614
|
-
* @param { import('./PathRegistry').default } pathRegistry
|
|
5615
|
-
* @param { import('./FieldFactory').default } fieldFactory
|
|
5616
|
-
* @param { import('./FormLayouter').default } formLayouter
|
|
5796
|
+
/**
|
|
5797
|
+
* @constructor
|
|
5798
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5799
|
+
* @param { import('./PathRegistry').default } pathRegistry
|
|
5800
|
+
* @param { import('./FieldFactory').default } fieldFactory
|
|
5801
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
5617
5802
|
*/
|
|
5618
5803
|
constructor(formFieldRegistry, pathRegistry, fieldFactory, formLayouter) {
|
|
5619
5804
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5622,21 +5807,21 @@ class Importer {
|
|
|
5622
5807
|
this._formLayouter = formLayouter;
|
|
5623
5808
|
}
|
|
5624
5809
|
|
|
5625
|
-
/**
|
|
5626
|
-
* Import schema creating rows, fields, attaching additional
|
|
5627
|
-
* information to each field and adding fields to the
|
|
5628
|
-
* field registry.
|
|
5629
|
-
*
|
|
5630
|
-
* Additional information attached:
|
|
5631
|
-
*
|
|
5632
|
-
* * `id` (unless present)
|
|
5633
|
-
* * `_parent`
|
|
5634
|
-
* * `_path`
|
|
5635
|
-
*
|
|
5636
|
-
* @param {any} schema
|
|
5637
|
-
*
|
|
5638
|
-
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5639
|
-
* @returns {ImportResult}
|
|
5810
|
+
/**
|
|
5811
|
+
* Import schema creating rows, fields, attaching additional
|
|
5812
|
+
* information to each field and adding fields to the
|
|
5813
|
+
* field registry.
|
|
5814
|
+
*
|
|
5815
|
+
* Additional information attached:
|
|
5816
|
+
*
|
|
5817
|
+
* * `id` (unless present)
|
|
5818
|
+
* * `_parent`
|
|
5819
|
+
* * `_path`
|
|
5820
|
+
*
|
|
5821
|
+
* @param {any} schema
|
|
5822
|
+
*
|
|
5823
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5824
|
+
* @returns {ImportResult}
|
|
5640
5825
|
*/
|
|
5641
5826
|
importSchema(schema) {
|
|
5642
5827
|
// TODO: Add warnings
|
|
@@ -5661,12 +5846,12 @@ class Importer {
|
|
|
5661
5846
|
this._pathRegistry.clear();
|
|
5662
5847
|
}
|
|
5663
5848
|
|
|
5664
|
-
/**
|
|
5665
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
5666
|
-
* @param {String} [parentId]
|
|
5667
|
-
* @param {number} [index]
|
|
5668
|
-
*
|
|
5669
|
-
* @return {any} field
|
|
5849
|
+
/**
|
|
5850
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
5851
|
+
* @param {String} [parentId]
|
|
5852
|
+
* @param {number} [index]
|
|
5853
|
+
*
|
|
5854
|
+
* @return {any} field
|
|
5670
5855
|
*/
|
|
5671
5856
|
importFormField(fieldAttrs, parentId, index) {
|
|
5672
5857
|
const {
|
|
@@ -5691,11 +5876,11 @@ class Importer {
|
|
|
5691
5876
|
return field;
|
|
5692
5877
|
}
|
|
5693
5878
|
|
|
5694
|
-
/**
|
|
5695
|
-
* @param {Array<any>} components
|
|
5696
|
-
* @param {string} parentId
|
|
5697
|
-
*
|
|
5698
|
-
* @return {Array<any>} imported components
|
|
5879
|
+
/**
|
|
5880
|
+
* @param {Array<any>} components
|
|
5881
|
+
* @param {string} parentId
|
|
5882
|
+
*
|
|
5883
|
+
* @return {Array<any>} imported components
|
|
5699
5884
|
*/
|
|
5700
5885
|
importFormFields(components, parentId) {
|
|
5701
5886
|
return components.map((component, index) => {
|
|
@@ -5706,11 +5891,11 @@ class Importer {
|
|
|
5706
5891
|
Importer.$inject = ['formFieldRegistry', 'pathRegistry', 'fieldFactory', 'formLayouter'];
|
|
5707
5892
|
|
|
5708
5893
|
class FieldFactory {
|
|
5709
|
-
/**
|
|
5710
|
-
* @constructor
|
|
5711
|
-
*
|
|
5712
|
-
* @param formFieldRegistry
|
|
5713
|
-
* @param formFields
|
|
5894
|
+
/**
|
|
5895
|
+
* @constructor
|
|
5896
|
+
*
|
|
5897
|
+
* @param formFieldRegistry
|
|
5898
|
+
* @param formFields
|
|
5714
5899
|
*/
|
|
5715
5900
|
constructor(formFieldRegistry, pathRegistry, formFields) {
|
|
5716
5901
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5792,36 +5977,36 @@ class FieldFactory {
|
|
|
5792
5977
|
}
|
|
5793
5978
|
FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
|
|
5794
5979
|
|
|
5795
|
-
/**
|
|
5796
|
-
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5797
|
-
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5798
|
-
*
|
|
5799
|
-
* Example Tree Structure:
|
|
5800
|
-
*
|
|
5801
|
-
* [
|
|
5802
|
-
* {
|
|
5803
|
-
* segment: 'root',
|
|
5804
|
-
* claimCount: 1,
|
|
5805
|
-
* children: [
|
|
5806
|
-
* {
|
|
5807
|
-
* segment: 'child1',
|
|
5808
|
-
* claimCount: 2,
|
|
5809
|
-
* children: null // A leaf node (closed path)
|
|
5810
|
-
* },
|
|
5811
|
-
* {
|
|
5812
|
-
* segment: 'child2',
|
|
5813
|
-
* claimCount: 1,
|
|
5814
|
-
* children: [
|
|
5815
|
-
* {
|
|
5816
|
-
* segment: 'subChild1',
|
|
5817
|
-
* claimCount: 1,
|
|
5818
|
-
* children: [] // An open node (open path)
|
|
5819
|
-
* }
|
|
5820
|
-
* ]
|
|
5821
|
-
* }
|
|
5822
|
-
* ]
|
|
5823
|
-
* }
|
|
5824
|
-
* ]
|
|
5980
|
+
/**
|
|
5981
|
+
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5982
|
+
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5983
|
+
*
|
|
5984
|
+
* Example Tree Structure:
|
|
5985
|
+
*
|
|
5986
|
+
* [
|
|
5987
|
+
* {
|
|
5988
|
+
* segment: 'root',
|
|
5989
|
+
* claimCount: 1,
|
|
5990
|
+
* children: [
|
|
5991
|
+
* {
|
|
5992
|
+
* segment: 'child1',
|
|
5993
|
+
* claimCount: 2,
|
|
5994
|
+
* children: null // A leaf node (closed path)
|
|
5995
|
+
* },
|
|
5996
|
+
* {
|
|
5997
|
+
* segment: 'child2',
|
|
5998
|
+
* claimCount: 1,
|
|
5999
|
+
* children: [
|
|
6000
|
+
* {
|
|
6001
|
+
* segment: 'subChild1',
|
|
6002
|
+
* claimCount: 1,
|
|
6003
|
+
* children: [] // An open node (open path)
|
|
6004
|
+
* }
|
|
6005
|
+
* ]
|
|
6006
|
+
* }
|
|
6007
|
+
* ]
|
|
6008
|
+
* }
|
|
6009
|
+
* ]
|
|
5825
6010
|
*/
|
|
5826
6011
|
class PathRegistry {
|
|
5827
6012
|
constructor(formFieldRegistry, formFields) {
|
|
@@ -5904,16 +6089,16 @@ class PathRegistry {
|
|
|
5904
6089
|
}
|
|
5905
6090
|
}
|
|
5906
6091
|
|
|
5907
|
-
/**
|
|
5908
|
-
* Applies a function (fn) recursively on a given field and its children.
|
|
5909
|
-
*
|
|
5910
|
-
* - `field`: Starting field object.
|
|
5911
|
-
* - `fn`: Function to apply.
|
|
5912
|
-
* - `context`: Optional object for passing data between calls.
|
|
5913
|
-
*
|
|
5914
|
-
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
5915
|
-
*
|
|
5916
|
-
* @returns {boolean} Success status based on function execution.
|
|
6092
|
+
/**
|
|
6093
|
+
* Applies a function (fn) recursively on a given field and its children.
|
|
6094
|
+
*
|
|
6095
|
+
* - `field`: Starting field object.
|
|
6096
|
+
* - `fn`: Function to apply.
|
|
6097
|
+
* - `context`: Optional object for passing data between calls.
|
|
6098
|
+
*
|
|
6099
|
+
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
6100
|
+
*
|
|
6101
|
+
* @returns {boolean} Success status based on function execution.
|
|
5917
6102
|
*/
|
|
5918
6103
|
executeRecursivelyOnFields(field, fn, context = {}) {
|
|
5919
6104
|
let result = true;
|
|
@@ -5947,15 +6132,15 @@ class PathRegistry {
|
|
|
5947
6132
|
return result;
|
|
5948
6133
|
}
|
|
5949
6134
|
|
|
5950
|
-
/**
|
|
5951
|
-
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
5952
|
-
*
|
|
5953
|
-
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
5954
|
-
* @param {Object} [options={}] - Configuration options.
|
|
5955
|
-
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
5956
|
-
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
5957
|
-
*
|
|
5958
|
-
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
6135
|
+
/**
|
|
6136
|
+
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
6137
|
+
*
|
|
6138
|
+
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
6139
|
+
* @param {Object} [options={}] - Configuration options.
|
|
6140
|
+
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
6141
|
+
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
6142
|
+
*
|
|
6143
|
+
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
5959
6144
|
*/
|
|
5960
6145
|
getValuePath(field, options = {}) {
|
|
5961
6146
|
const {
|
|
@@ -5999,23 +6184,23 @@ const _getNextSegment = (node, segment) => {
|
|
|
5999
6184
|
};
|
|
6000
6185
|
PathRegistry.$inject = ['formFieldRegistry', 'formFields'];
|
|
6001
6186
|
|
|
6002
|
-
/**
|
|
6003
|
-
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6004
|
-
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6187
|
+
/**
|
|
6188
|
+
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6189
|
+
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6005
6190
|
*/
|
|
6006
6191
|
|
|
6007
|
-
/**
|
|
6008
|
-
* Maintains the Form layout in a given structure, for example
|
|
6009
|
-
*
|
|
6010
|
-
* [
|
|
6011
|
-
* {
|
|
6012
|
-
* formFieldId: 'FormField_1',
|
|
6013
|
-
* rows: [
|
|
6014
|
-
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
6015
|
-
* ]
|
|
6016
|
-
* }
|
|
6017
|
-
* ]
|
|
6018
|
-
*
|
|
6192
|
+
/**
|
|
6193
|
+
* Maintains the Form layout in a given structure, for example
|
|
6194
|
+
*
|
|
6195
|
+
* [
|
|
6196
|
+
* {
|
|
6197
|
+
* formFieldId: 'FormField_1',
|
|
6198
|
+
* rows: [
|
|
6199
|
+
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
6200
|
+
* ]
|
|
6201
|
+
* }
|
|
6202
|
+
* ]
|
|
6203
|
+
*
|
|
6019
6204
|
*/
|
|
6020
6205
|
class FormLayouter {
|
|
6021
6206
|
constructor(eventBus) {
|
|
@@ -6025,8 +6210,8 @@ class FormLayouter {
|
|
|
6025
6210
|
this._eventBus = eventBus;
|
|
6026
6211
|
}
|
|
6027
6212
|
|
|
6028
|
-
/**
|
|
6029
|
-
* @param {FormRow} row
|
|
6213
|
+
/**
|
|
6214
|
+
* @param {FormRow} row
|
|
6030
6215
|
*/
|
|
6031
6216
|
addRow(formFieldId, row) {
|
|
6032
6217
|
let rowsPerComponent = this._rows.find(r => r.formFieldId === formFieldId);
|
|
@@ -6040,18 +6225,18 @@ class FormLayouter {
|
|
|
6040
6225
|
rowsPerComponent.rows.push(row);
|
|
6041
6226
|
}
|
|
6042
6227
|
|
|
6043
|
-
/**
|
|
6044
|
-
* @param {String} id
|
|
6045
|
-
* @returns {FormRow}
|
|
6228
|
+
/**
|
|
6229
|
+
* @param {String} id
|
|
6230
|
+
* @returns {FormRow}
|
|
6046
6231
|
*/
|
|
6047
6232
|
getRow(id) {
|
|
6048
6233
|
const rows = allRows(this._rows);
|
|
6049
6234
|
return rows.find(r => r.id === id);
|
|
6050
6235
|
}
|
|
6051
6236
|
|
|
6052
|
-
/**
|
|
6053
|
-
* @param {any} formField
|
|
6054
|
-
* @returns {FormRow}
|
|
6237
|
+
/**
|
|
6238
|
+
* @param {any} formField
|
|
6239
|
+
* @returns {FormRow}
|
|
6055
6240
|
*/
|
|
6056
6241
|
getRowForField(formField) {
|
|
6057
6242
|
return allRows(this._rows).find(r => {
|
|
@@ -6062,9 +6247,9 @@ class FormLayouter {
|
|
|
6062
6247
|
});
|
|
6063
6248
|
}
|
|
6064
6249
|
|
|
6065
|
-
/**
|
|
6066
|
-
* @param {String} formFieldId
|
|
6067
|
-
* @returns { Array<FormRow> }
|
|
6250
|
+
/**
|
|
6251
|
+
* @param {String} formFieldId
|
|
6252
|
+
* @returns { Array<FormRow> }
|
|
6068
6253
|
*/
|
|
6069
6254
|
getRows(formFieldId) {
|
|
6070
6255
|
const rowsForField = this._rows.find(r => formFieldId === r.formFieldId);
|
|
@@ -6074,15 +6259,15 @@ class FormLayouter {
|
|
|
6074
6259
|
return rowsForField.rows;
|
|
6075
6260
|
}
|
|
6076
6261
|
|
|
6077
|
-
/**
|
|
6078
|
-
* @returns {string}
|
|
6262
|
+
/**
|
|
6263
|
+
* @returns {string}
|
|
6079
6264
|
*/
|
|
6080
6265
|
nextRowId() {
|
|
6081
6266
|
return this._ids.nextPrefixed('Row_');
|
|
6082
6267
|
}
|
|
6083
6268
|
|
|
6084
|
-
/**
|
|
6085
|
-
* @param {any} formField
|
|
6269
|
+
/**
|
|
6270
|
+
* @param {any} formField
|
|
6086
6271
|
*/
|
|
6087
6272
|
calculateLayout(formField) {
|
|
6088
6273
|
const {
|
|
@@ -6136,9 +6321,9 @@ function groupByRow(components, ids) {
|
|
|
6136
6321
|
});
|
|
6137
6322
|
}
|
|
6138
6323
|
|
|
6139
|
-
/**
|
|
6140
|
-
* @param {Array<FormRows>} formRows
|
|
6141
|
-
* @returns {Array<FormRow>}
|
|
6324
|
+
/**
|
|
6325
|
+
* @param {Array<FormRows>} formRows
|
|
6326
|
+
* @returns {Array<FormRow>}
|
|
6142
6327
|
*/
|
|
6143
6328
|
function allRows(formRows) {
|
|
6144
6329
|
return minDash.flatten(formRows.map(c => c.rows));
|
|
@@ -6260,55 +6445,55 @@ var core = {
|
|
|
6260
6445
|
validator: ['type', Validator]
|
|
6261
6446
|
};
|
|
6262
6447
|
|
|
6263
|
-
/**
|
|
6264
|
-
* @typedef { import('./types').Injector } Injector
|
|
6265
|
-
* @typedef { import('./types').Data } Data
|
|
6266
|
-
* @typedef { import('./types').Errors } Errors
|
|
6267
|
-
* @typedef { import('./types').Schema } Schema
|
|
6268
|
-
* @typedef { import('./types').FormProperties } FormProperties
|
|
6269
|
-
* @typedef { import('./types').FormProperty } FormProperty
|
|
6270
|
-
* @typedef { import('./types').FormEvent } FormEvent
|
|
6271
|
-
* @typedef { import('./types').FormOptions } FormOptions
|
|
6272
|
-
*
|
|
6273
|
-
* @typedef { {
|
|
6274
|
-
* data: Data,
|
|
6275
|
-
* initialData: Data,
|
|
6276
|
-
* errors: Errors,
|
|
6277
|
-
* properties: FormProperties,
|
|
6278
|
-
* schema: Schema
|
|
6279
|
-
* } } State
|
|
6280
|
-
*
|
|
6281
|
-
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6282
|
-
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6283
|
-
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6448
|
+
/**
|
|
6449
|
+
* @typedef { import('./types').Injector } Injector
|
|
6450
|
+
* @typedef { import('./types').Data } Data
|
|
6451
|
+
* @typedef { import('./types').Errors } Errors
|
|
6452
|
+
* @typedef { import('./types').Schema } Schema
|
|
6453
|
+
* @typedef { import('./types').FormProperties } FormProperties
|
|
6454
|
+
* @typedef { import('./types').FormProperty } FormProperty
|
|
6455
|
+
* @typedef { import('./types').FormEvent } FormEvent
|
|
6456
|
+
* @typedef { import('./types').FormOptions } FormOptions
|
|
6457
|
+
*
|
|
6458
|
+
* @typedef { {
|
|
6459
|
+
* data: Data,
|
|
6460
|
+
* initialData: Data,
|
|
6461
|
+
* errors: Errors,
|
|
6462
|
+
* properties: FormProperties,
|
|
6463
|
+
* schema: Schema
|
|
6464
|
+
* } } State
|
|
6465
|
+
*
|
|
6466
|
+
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6467
|
+
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6468
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6284
6469
|
*/
|
|
6285
6470
|
|
|
6286
6471
|
const ids = new Ids([32, 36, 1]);
|
|
6287
6472
|
|
|
6288
|
-
/**
|
|
6289
|
-
* The form.
|
|
6473
|
+
/**
|
|
6474
|
+
* The form.
|
|
6290
6475
|
*/
|
|
6291
6476
|
class Form {
|
|
6292
|
-
/**
|
|
6293
|
-
* @constructor
|
|
6294
|
-
* @param {FormOptions} options
|
|
6477
|
+
/**
|
|
6478
|
+
* @constructor
|
|
6479
|
+
* @param {FormOptions} options
|
|
6295
6480
|
*/
|
|
6296
6481
|
constructor(options = {}) {
|
|
6297
|
-
/**
|
|
6298
|
-
* @public
|
|
6299
|
-
* @type {OnEventType}
|
|
6482
|
+
/**
|
|
6483
|
+
* @public
|
|
6484
|
+
* @type {OnEventType}
|
|
6300
6485
|
*/
|
|
6301
6486
|
this.on = this._onEvent;
|
|
6302
6487
|
|
|
6303
|
-
/**
|
|
6304
|
-
* @public
|
|
6305
|
-
* @type {String}
|
|
6488
|
+
/**
|
|
6489
|
+
* @public
|
|
6490
|
+
* @type {String}
|
|
6306
6491
|
*/
|
|
6307
6492
|
this._id = ids.next();
|
|
6308
6493
|
|
|
6309
|
-
/**
|
|
6310
|
-
* @private
|
|
6311
|
-
* @type {Element}
|
|
6494
|
+
/**
|
|
6495
|
+
* @private
|
|
6496
|
+
* @type {Element}
|
|
6312
6497
|
*/
|
|
6313
6498
|
this._container = createFormContainer();
|
|
6314
6499
|
const {
|
|
@@ -6317,9 +6502,9 @@ class Form {
|
|
|
6317
6502
|
properties = {}
|
|
6318
6503
|
} = options;
|
|
6319
6504
|
|
|
6320
|
-
/**
|
|
6321
|
-
* @private
|
|
6322
|
-
* @type {State}
|
|
6505
|
+
/**
|
|
6506
|
+
* @private
|
|
6507
|
+
* @type {State}
|
|
6323
6508
|
*/
|
|
6324
6509
|
this._state = {
|
|
6325
6510
|
initialData: null,
|
|
@@ -6343,9 +6528,9 @@ class Form {
|
|
|
6343
6528
|
this._emit('form.clear');
|
|
6344
6529
|
}
|
|
6345
6530
|
|
|
6346
|
-
/**
|
|
6347
|
-
* Destroy the form, removing it from DOM,
|
|
6348
|
-
* if attached.
|
|
6531
|
+
/**
|
|
6532
|
+
* Destroy the form, removing it from DOM,
|
|
6533
|
+
* if attached.
|
|
6349
6534
|
*/
|
|
6350
6535
|
destroy() {
|
|
6351
6536
|
// destroy form services
|
|
@@ -6356,13 +6541,13 @@ class Form {
|
|
|
6356
6541
|
this._detach(false);
|
|
6357
6542
|
}
|
|
6358
6543
|
|
|
6359
|
-
/**
|
|
6360
|
-
* Open a form schema with the given initial data.
|
|
6361
|
-
*
|
|
6362
|
-
* @param {Schema} schema
|
|
6363
|
-
* @param {Data} [data]
|
|
6364
|
-
*
|
|
6365
|
-
* @return Promise<{ warnings: Array<any> }>
|
|
6544
|
+
/**
|
|
6545
|
+
* Open a form schema with the given initial data.
|
|
6546
|
+
*
|
|
6547
|
+
* @param {Schema} schema
|
|
6548
|
+
* @param {Data} [data]
|
|
6549
|
+
*
|
|
6550
|
+
* @return Promise<{ warnings: Array<any> }>
|
|
6366
6551
|
*/
|
|
6367
6552
|
importSchema(schema, data = {}) {
|
|
6368
6553
|
return new Promise((resolve, reject) => {
|
|
@@ -6395,10 +6580,10 @@ class Form {
|
|
|
6395
6580
|
});
|
|
6396
6581
|
}
|
|
6397
6582
|
|
|
6398
|
-
/**
|
|
6399
|
-
* Submit the form, triggering all field validations.
|
|
6400
|
-
*
|
|
6401
|
-
* @returns { { data: Data, errors: Errors } }
|
|
6583
|
+
/**
|
|
6584
|
+
* Submit the form, triggering all field validations.
|
|
6585
|
+
*
|
|
6586
|
+
* @returns { { data: Data, errors: Errors } }
|
|
6402
6587
|
*/
|
|
6403
6588
|
submit() {
|
|
6404
6589
|
const {
|
|
@@ -6424,8 +6609,8 @@ class Form {
|
|
|
6424
6609
|
});
|
|
6425
6610
|
}
|
|
6426
6611
|
|
|
6427
|
-
/**
|
|
6428
|
-
* @returns {Errors}
|
|
6612
|
+
/**
|
|
6613
|
+
* @returns {Errors}
|
|
6429
6614
|
*/
|
|
6430
6615
|
validate() {
|
|
6431
6616
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6455,8 +6640,8 @@ class Form {
|
|
|
6455
6640
|
return filteredErrors;
|
|
6456
6641
|
}
|
|
6457
6642
|
|
|
6458
|
-
/**
|
|
6459
|
-
* @param {Element|string} parentNode
|
|
6643
|
+
/**
|
|
6644
|
+
* @param {Element|string} parentNode
|
|
6460
6645
|
*/
|
|
6461
6646
|
attachTo(parentNode) {
|
|
6462
6647
|
if (!parentNode) {
|
|
@@ -6474,10 +6659,10 @@ class Form {
|
|
|
6474
6659
|
this._detach();
|
|
6475
6660
|
}
|
|
6476
6661
|
|
|
6477
|
-
/**
|
|
6478
|
-
* @private
|
|
6479
|
-
*
|
|
6480
|
-
* @param {boolean} [emit]
|
|
6662
|
+
/**
|
|
6663
|
+
* @private
|
|
6664
|
+
*
|
|
6665
|
+
* @param {boolean} [emit]
|
|
6481
6666
|
*/
|
|
6482
6667
|
_detach(emit = true) {
|
|
6483
6668
|
const container = this._container,
|
|
@@ -6491,9 +6676,9 @@ class Form {
|
|
|
6491
6676
|
parentNode.removeChild(container);
|
|
6492
6677
|
}
|
|
6493
6678
|
|
|
6494
|
-
/**
|
|
6495
|
-
* @param {FormProperty} property
|
|
6496
|
-
* @param {any} value
|
|
6679
|
+
/**
|
|
6680
|
+
* @param {FormProperty} property
|
|
6681
|
+
* @param {any} value
|
|
6497
6682
|
*/
|
|
6498
6683
|
setProperty(property, value) {
|
|
6499
6684
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -6502,21 +6687,21 @@ class Form {
|
|
|
6502
6687
|
});
|
|
6503
6688
|
}
|
|
6504
6689
|
|
|
6505
|
-
/**
|
|
6506
|
-
* @param {FormEvent} type
|
|
6507
|
-
* @param {Function} handler
|
|
6690
|
+
/**
|
|
6691
|
+
* @param {FormEvent} type
|
|
6692
|
+
* @param {Function} handler
|
|
6508
6693
|
*/
|
|
6509
6694
|
off(type, handler) {
|
|
6510
6695
|
this.get('eventBus').off(type, handler);
|
|
6511
6696
|
}
|
|
6512
6697
|
|
|
6513
|
-
/**
|
|
6514
|
-
* @private
|
|
6515
|
-
*
|
|
6516
|
-
* @param {FormOptions} options
|
|
6517
|
-
* @param {Element} container
|
|
6518
|
-
*
|
|
6519
|
-
* @returns {Injector}
|
|
6698
|
+
/**
|
|
6699
|
+
* @private
|
|
6700
|
+
*
|
|
6701
|
+
* @param {FormOptions} options
|
|
6702
|
+
* @param {Element} container
|
|
6703
|
+
*
|
|
6704
|
+
* @returns {Injector}
|
|
6520
6705
|
*/
|
|
6521
6706
|
_createInjector(options, container) {
|
|
6522
6707
|
const {
|
|
@@ -6535,17 +6720,17 @@ class Form {
|
|
|
6535
6720
|
}, core, ...modules, ...additionalModules]);
|
|
6536
6721
|
}
|
|
6537
6722
|
|
|
6538
|
-
/**
|
|
6539
|
-
* @private
|
|
6723
|
+
/**
|
|
6724
|
+
* @private
|
|
6540
6725
|
*/
|
|
6541
6726
|
_emit(type, data) {
|
|
6542
6727
|
this.get('eventBus').fire(type, data);
|
|
6543
6728
|
}
|
|
6544
6729
|
|
|
6545
|
-
/**
|
|
6546
|
-
* @internal
|
|
6547
|
-
*
|
|
6548
|
-
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6730
|
+
/**
|
|
6731
|
+
* @internal
|
|
6732
|
+
*
|
|
6733
|
+
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6549
6734
|
*/
|
|
6550
6735
|
_update(update) {
|
|
6551
6736
|
const {
|
|
@@ -6567,15 +6752,15 @@ class Form {
|
|
|
6567
6752
|
});
|
|
6568
6753
|
}
|
|
6569
6754
|
|
|
6570
|
-
/**
|
|
6571
|
-
* @internal
|
|
6755
|
+
/**
|
|
6756
|
+
* @internal
|
|
6572
6757
|
*/
|
|
6573
6758
|
_getState() {
|
|
6574
6759
|
return this._state;
|
|
6575
6760
|
}
|
|
6576
6761
|
|
|
6577
|
-
/**
|
|
6578
|
-
* @internal
|
|
6762
|
+
/**
|
|
6763
|
+
* @internal
|
|
6579
6764
|
*/
|
|
6580
6765
|
_setState(state) {
|
|
6581
6766
|
this._state = {
|
|
@@ -6585,22 +6770,22 @@ class Form {
|
|
|
6585
6770
|
this._emit('changed', this._getState());
|
|
6586
6771
|
}
|
|
6587
6772
|
|
|
6588
|
-
/**
|
|
6589
|
-
* @internal
|
|
6773
|
+
/**
|
|
6774
|
+
* @internal
|
|
6590
6775
|
*/
|
|
6591
6776
|
_getModules() {
|
|
6592
6777
|
return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule];
|
|
6593
6778
|
}
|
|
6594
6779
|
|
|
6595
|
-
/**
|
|
6596
|
-
* @internal
|
|
6780
|
+
/**
|
|
6781
|
+
* @internal
|
|
6597
6782
|
*/
|
|
6598
6783
|
_onEvent(type, priority, handler) {
|
|
6599
6784
|
this.get('eventBus').on(type, priority, handler);
|
|
6600
6785
|
}
|
|
6601
6786
|
|
|
6602
|
-
/**
|
|
6603
|
-
* @internal
|
|
6787
|
+
/**
|
|
6788
|
+
* @internal
|
|
6604
6789
|
*/
|
|
6605
6790
|
_getSubmitData() {
|
|
6606
6791
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6628,16 +6813,16 @@ class Form {
|
|
|
6628
6813
|
return filteredSubmitData;
|
|
6629
6814
|
}
|
|
6630
6815
|
|
|
6631
|
-
/**
|
|
6632
|
-
* @internal
|
|
6816
|
+
/**
|
|
6817
|
+
* @internal
|
|
6633
6818
|
*/
|
|
6634
6819
|
_applyConditions(toFilter, data, options = {}) {
|
|
6635
6820
|
const conditionChecker = this.get('conditionChecker');
|
|
6636
6821
|
return conditionChecker.applyConditions(toFilter, data, options);
|
|
6637
6822
|
}
|
|
6638
6823
|
|
|
6639
|
-
/**
|
|
6640
|
-
* @internal
|
|
6824
|
+
/**
|
|
6825
|
+
* @internal
|
|
6641
6826
|
*/
|
|
6642
6827
|
_initializeFieldData(data) {
|
|
6643
6828
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6674,7 +6859,7 @@ class Form {
|
|
|
6674
6859
|
}
|
|
6675
6860
|
}
|
|
6676
6861
|
|
|
6677
|
-
const schemaVersion =
|
|
6862
|
+
const schemaVersion = 12;
|
|
6678
6863
|
|
|
6679
6864
|
/**
|
|
6680
6865
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -6710,6 +6895,8 @@ exports.DATE_DISALLOW_PAST_PATH = DATE_DISALLOW_PAST_PATH;
|
|
|
6710
6895
|
exports.DATE_LABEL_PATH = DATE_LABEL_PATH;
|
|
6711
6896
|
exports.Datetime = Datetime;
|
|
6712
6897
|
exports.Default = FormComponent$1;
|
|
6898
|
+
exports.Description = Description;
|
|
6899
|
+
exports.Errors = Errors;
|
|
6713
6900
|
exports.ExpressionLanguageModule = ExpressionLanguageModule;
|
|
6714
6901
|
exports.FeelExpressionLanguage = FeelExpressionLanguage;
|
|
6715
6902
|
exports.FeelersTemplating = FeelersTemplating;
|
|
@@ -6725,6 +6912,7 @@ exports.FormRenderContext = FormRenderContext$1;
|
|
|
6725
6912
|
exports.Group = Group;
|
|
6726
6913
|
exports.Image = Image;
|
|
6727
6914
|
exports.Importer = Importer;
|
|
6915
|
+
exports.Label = Label;
|
|
6728
6916
|
exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
|
|
6729
6917
|
exports.MarkdownModule = MarkdownModule;
|
|
6730
6918
|
exports.MarkdownRenderer = MarkdownRenderer;
|
|
@@ -6732,6 +6920,7 @@ exports.Numberfield = Numberfield;
|
|
|
6732
6920
|
exports.PathRegistry = PathRegistry;
|
|
6733
6921
|
exports.Radio = Radio;
|
|
6734
6922
|
exports.Select = Select;
|
|
6923
|
+
exports.Separator = Separator;
|
|
6735
6924
|
exports.Spacer = Spacer;
|
|
6736
6925
|
exports.TIME_INTERVAL_PATH = TIME_INTERVAL_PATH;
|
|
6737
6926
|
exports.TIME_LABEL_PATH = TIME_LABEL_PATH;
|
|
@@ -6764,5 +6953,7 @@ exports.isRequired = isRequired;
|
|
|
6764
6953
|
exports.pathParse = pathParse;
|
|
6765
6954
|
exports.pathsEqual = pathsEqual;
|
|
6766
6955
|
exports.runRecursively = runRecursively;
|
|
6956
|
+
exports.sanitizeHTML = sanitizeHTML;
|
|
6957
|
+
exports.sanitizeImageSource = sanitizeImageSource;
|
|
6767
6958
|
exports.schemaVersion = schemaVersion;
|
|
6768
6959
|
//# sourceMappingURL=index.cjs.map
|