@bpmn-io/form-js-viewer 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +189 -164
- package/dist/assets/form-js-base.css +1016 -987
- package/dist/assets/form-js.css +29 -0
- package/dist/index.cjs +831 -642
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +826 -643
- package/dist/index.es.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/render/components/form-fields/Separator.d.ts +12 -0
- package/dist/types/render/components/form-fields/parts/SkipLink.d.ts +1 -0
- package/dist/types/render/components/index.d.ts +6 -1
- package/dist/types/types.d.ts +35 -35
- package/dist/types/util/index.d.ts +34 -3
- package/package.json +2 -2
package/dist/index.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
|
|
@@ -3198,6 +3262,18 @@ function SimpleSelect(props) {
|
|
|
3198
3262
|
e.preventDefault();
|
|
3199
3263
|
}, [isDropdownExpanded]);
|
|
3200
3264
|
const initialFocusIndex = hooks.useMemo(() => value && minDash.findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3265
|
+
const onInputFocus = hooks.useCallback(() => {
|
|
3266
|
+
if (!readonly) {
|
|
3267
|
+
setIsDropdownExpanded(true);
|
|
3268
|
+
onFocus && onFocus();
|
|
3269
|
+
}
|
|
3270
|
+
}, [onFocus, readonly]);
|
|
3271
|
+
const onInputBlur = hooks.useCallback(() => {
|
|
3272
|
+
if (!readonly) {
|
|
3273
|
+
setIsDropdownExpanded(false);
|
|
3274
|
+
onBlur && onBlur();
|
|
3275
|
+
}
|
|
3276
|
+
}, [onBlur, readonly]);
|
|
3201
3277
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3202
3278
|
children: [jsxRuntime.jsxs("div", {
|
|
3203
3279
|
ref: selectRef,
|
|
@@ -3208,11 +3284,8 @@ function SimpleSelect(props) {
|
|
|
3208
3284
|
}, {
|
|
3209
3285
|
'hasErrors': errors.length
|
|
3210
3286
|
}),
|
|
3211
|
-
onFocus:
|
|
3212
|
-
onBlur:
|
|
3213
|
-
setIsDropdownExpanded(false);
|
|
3214
|
-
onBlur();
|
|
3215
|
-
},
|
|
3287
|
+
onFocus: onInputFocus,
|
|
3288
|
+
onBlur: onInputBlur,
|
|
3216
3289
|
onMouseDown: onMouseDown,
|
|
3217
3290
|
children: [jsxRuntime.jsx("div", {
|
|
3218
3291
|
class: classNames('fjs-select-display', {
|
|
@@ -3224,8 +3297,8 @@ function SimpleSelect(props) {
|
|
|
3224
3297
|
id: prefixId(`${id}-search`, formId),
|
|
3225
3298
|
class: "fjs-select-hidden-input",
|
|
3226
3299
|
value: valueLabel,
|
|
3227
|
-
onFocus:
|
|
3228
|
-
onBlur:
|
|
3300
|
+
onFocus: onInputFocus,
|
|
3301
|
+
onBlur: onInputBlur,
|
|
3229
3302
|
"aria-describedby": props['aria-describedby']
|
|
3230
3303
|
}), displayState.displayCross && jsxRuntime.jsx("span", {
|
|
3231
3304
|
class: "fjs-select-cross",
|
|
@@ -3254,12 +3327,13 @@ function SimpleSelect(props) {
|
|
|
3254
3327
|
});
|
|
3255
3328
|
}
|
|
3256
3329
|
|
|
3257
|
-
const type$
|
|
3330
|
+
const type$6 = 'select';
|
|
3258
3331
|
function Select(props) {
|
|
3259
3332
|
const {
|
|
3260
3333
|
disabled,
|
|
3261
3334
|
errors = [],
|
|
3262
3335
|
onBlur,
|
|
3336
|
+
onFocus,
|
|
3263
3337
|
field,
|
|
3264
3338
|
onChange,
|
|
3265
3339
|
readonly,
|
|
@@ -3284,14 +3358,15 @@ function Select(props) {
|
|
|
3284
3358
|
disabled,
|
|
3285
3359
|
errors,
|
|
3286
3360
|
onBlur,
|
|
3361
|
+
onFocus,
|
|
3287
3362
|
field,
|
|
3288
3363
|
value,
|
|
3289
3364
|
onChange,
|
|
3290
3365
|
readonly,
|
|
3291
3366
|
'aria-describedby': errorMessageId
|
|
3292
|
-
}), [disabled, errors, field, id, value, onChange, onBlur, readonly, errorMessageId]);
|
|
3367
|
+
}), [disabled, errors, field, id, value, onChange, onBlur, onFocus, readonly, errorMessageId]);
|
|
3293
3368
|
return jsxRuntime.jsxs("div", {
|
|
3294
|
-
class: formFieldClasses(type$
|
|
3369
|
+
class: formFieldClasses(type$6, {
|
|
3295
3370
|
errors,
|
|
3296
3371
|
disabled,
|
|
3297
3372
|
readonly
|
|
@@ -3319,7 +3394,7 @@ function Select(props) {
|
|
|
3319
3394
|
});
|
|
3320
3395
|
}
|
|
3321
3396
|
Select.config = {
|
|
3322
|
-
type: type$
|
|
3397
|
+
type: type$6,
|
|
3323
3398
|
keyed: true,
|
|
3324
3399
|
label: 'Select',
|
|
3325
3400
|
group: 'selection',
|
|
@@ -3328,6 +3403,23 @@ Select.config = {
|
|
|
3328
3403
|
create: createEmptyOptions
|
|
3329
3404
|
};
|
|
3330
3405
|
|
|
3406
|
+
const type$5 = 'separator';
|
|
3407
|
+
function Separator() {
|
|
3408
|
+
return jsxRuntime.jsx("div", {
|
|
3409
|
+
class: formFieldClasses(type$5),
|
|
3410
|
+
children: jsxRuntime.jsx("hr", {})
|
|
3411
|
+
});
|
|
3412
|
+
}
|
|
3413
|
+
Separator.config = {
|
|
3414
|
+
type: type$5,
|
|
3415
|
+
keyed: false,
|
|
3416
|
+
label: 'Separator',
|
|
3417
|
+
group: 'presentation',
|
|
3418
|
+
create: (options = {}) => ({
|
|
3419
|
+
...options
|
|
3420
|
+
})
|
|
3421
|
+
};
|
|
3422
|
+
|
|
3331
3423
|
const type$4 = 'spacer';
|
|
3332
3424
|
function Spacer(props) {
|
|
3333
3425
|
const {
|
|
@@ -3354,11 +3446,33 @@ Spacer.config = {
|
|
|
3354
3446
|
})
|
|
3355
3447
|
};
|
|
3356
3448
|
|
|
3449
|
+
function SkipLink(props) {
|
|
3450
|
+
const {
|
|
3451
|
+
className,
|
|
3452
|
+
label,
|
|
3453
|
+
onSkip
|
|
3454
|
+
} = props;
|
|
3455
|
+
const onKeyDown = hooks.useCallback(event => {
|
|
3456
|
+
if (event.key === 'Enter') {
|
|
3457
|
+
event.preventDefault();
|
|
3458
|
+
event.stopPropagation();
|
|
3459
|
+
onSkip();
|
|
3460
|
+
}
|
|
3461
|
+
}, [onSkip]);
|
|
3462
|
+
return jsxRuntime.jsx("a", {
|
|
3463
|
+
href: "#",
|
|
3464
|
+
class: classNames('fjs-skip-link', className),
|
|
3465
|
+
onKeyDown: onKeyDown,
|
|
3466
|
+
children: label
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3357
3470
|
const type$3 = 'taglist';
|
|
3358
3471
|
function Taglist(props) {
|
|
3359
3472
|
const {
|
|
3360
3473
|
disabled,
|
|
3361
3474
|
errors = [],
|
|
3475
|
+
onFocus,
|
|
3362
3476
|
onBlur,
|
|
3363
3477
|
field,
|
|
3364
3478
|
readonly,
|
|
@@ -3382,7 +3496,9 @@ function Taglist(props) {
|
|
|
3382
3496
|
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3383
3497
|
const [hasOptionsLeft, setHasOptionsLeft] = hooks.useState(true);
|
|
3384
3498
|
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3385
|
-
const
|
|
3499
|
+
const focusScopeRef = hooks.useRef();
|
|
3500
|
+
const inputRef = hooks.useRef();
|
|
3501
|
+
const eventBus = useService('eventBus');
|
|
3386
3502
|
const {
|
|
3387
3503
|
state: loadState,
|
|
3388
3504
|
values: options
|
|
@@ -3404,12 +3520,6 @@ function Taglist(props) {
|
|
|
3404
3520
|
hooks.useEffect(() => {
|
|
3405
3521
|
setHasOptionsLeft(options.length > values.length);
|
|
3406
3522
|
}, [options.length, values.length]);
|
|
3407
|
-
const onFilterChange = ({
|
|
3408
|
-
target
|
|
3409
|
-
}) => {
|
|
3410
|
-
setIsEscapeClose(false);
|
|
3411
|
-
setFilter(target.value);
|
|
3412
|
-
};
|
|
3413
3523
|
const selectValue = value => {
|
|
3414
3524
|
if (filter) {
|
|
3415
3525
|
setFilter('');
|
|
@@ -3430,6 +3540,16 @@ function Taglist(props) {
|
|
|
3430
3540
|
field
|
|
3431
3541
|
});
|
|
3432
3542
|
};
|
|
3543
|
+
const onInputChange = ({
|
|
3544
|
+
target
|
|
3545
|
+
}) => {
|
|
3546
|
+
setIsEscapeClose(false);
|
|
3547
|
+
setFilter(target.value || '');
|
|
3548
|
+
eventBus.fire('formField.search', {
|
|
3549
|
+
formField: field,
|
|
3550
|
+
value: target.value || ''
|
|
3551
|
+
});
|
|
3552
|
+
};
|
|
3433
3553
|
const onInputKeyDown = e => {
|
|
3434
3554
|
switch (e.key) {
|
|
3435
3555
|
case 'ArrowUp':
|
|
@@ -3452,10 +3572,26 @@ function Taglist(props) {
|
|
|
3452
3572
|
break;
|
|
3453
3573
|
}
|
|
3454
3574
|
};
|
|
3455
|
-
const
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3575
|
+
const onElementBlur = e => {
|
|
3576
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3577
|
+
onBlur && onBlur();
|
|
3578
|
+
};
|
|
3579
|
+
const onElementFocus = e => {
|
|
3580
|
+
if (focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
3581
|
+
onFocus && onFocus();
|
|
3582
|
+
};
|
|
3583
|
+
const onInputBlur = e => {
|
|
3584
|
+
if (!readonly) {
|
|
3585
|
+
setIsDropdownExpanded(false);
|
|
3586
|
+
setFilter('');
|
|
3587
|
+
}
|
|
3588
|
+
onElementBlur(e);
|
|
3589
|
+
};
|
|
3590
|
+
const onInputFocus = e => {
|
|
3591
|
+
if (!readonly) {
|
|
3592
|
+
setIsDropdownExpanded(true);
|
|
3593
|
+
}
|
|
3594
|
+
onElementFocus(e);
|
|
3459
3595
|
};
|
|
3460
3596
|
const onTagRemoveClick = (event, value) => {
|
|
3461
3597
|
const {
|
|
@@ -3466,11 +3602,15 @@ function Taglist(props) {
|
|
|
3466
3602
|
// restore focus if there is no next sibling to focus
|
|
3467
3603
|
const nextTag = target.closest('.fjs-taglist-tag').nextSibling;
|
|
3468
3604
|
if (!nextTag) {
|
|
3469
|
-
|
|
3605
|
+
inputRef.current.focus();
|
|
3470
3606
|
}
|
|
3471
3607
|
};
|
|
3608
|
+
const onSkipToSearch = () => {
|
|
3609
|
+
inputRef.current.focus();
|
|
3610
|
+
};
|
|
3472
3611
|
const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3473
3612
|
return jsxRuntime.jsxs("div", {
|
|
3613
|
+
ref: focusScopeRef,
|
|
3474
3614
|
class: formFieldClasses(type$3, {
|
|
3475
3615
|
errors,
|
|
3476
3616
|
disabled,
|
|
@@ -3486,6 +3626,10 @@ function Taglist(props) {
|
|
|
3486
3626
|
label: label,
|
|
3487
3627
|
required: required,
|
|
3488
3628
|
id: prefixId(`${id}-search`, formId)
|
|
3629
|
+
}), !disabled && !readonly && !!values.length && jsxRuntime.jsx(SkipLink, {
|
|
3630
|
+
className: "fjs-taglist-skip-link",
|
|
3631
|
+
label: "Skip to search",
|
|
3632
|
+
onSkip: onSkipToSearch
|
|
3489
3633
|
}), jsxRuntime.jsxs("div", {
|
|
3490
3634
|
class: classNames('fjs-taglist', {
|
|
3491
3635
|
'fjs-disabled': disabled,
|
|
@@ -3507,6 +3651,8 @@ function Taglist(props) {
|
|
|
3507
3651
|
type: "button",
|
|
3508
3652
|
title: "Remove tag",
|
|
3509
3653
|
class: "fjs-taglist-tag-remove",
|
|
3654
|
+
onFocus: onElementFocus,
|
|
3655
|
+
onBlur: onElementBlur,
|
|
3510
3656
|
onClick: event => onTagRemoveClick(event, v),
|
|
3511
3657
|
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3512
3658
|
})]
|
|
@@ -3516,17 +3662,17 @@ function Taglist(props) {
|
|
|
3516
3662
|
disabled: disabled,
|
|
3517
3663
|
readOnly: readonly,
|
|
3518
3664
|
class: "fjs-taglist-input",
|
|
3519
|
-
ref:
|
|
3665
|
+
ref: inputRef,
|
|
3520
3666
|
id: prefixId(`${id}-search`, formId),
|
|
3521
|
-
onChange:
|
|
3667
|
+
onChange: onInputChange,
|
|
3522
3668
|
type: "text",
|
|
3523
3669
|
value: filter,
|
|
3524
3670
|
placeholder: disabled || readonly ? undefined : 'Search',
|
|
3525
3671
|
autoComplete: "off",
|
|
3526
3672
|
onKeyDown: onInputKeyDown,
|
|
3527
3673
|
onMouseDown: () => setIsEscapeClose(false),
|
|
3528
|
-
onFocus:
|
|
3529
|
-
onBlur:
|
|
3674
|
+
onFocus: onInputFocus,
|
|
3675
|
+
onBlur: onInputBlur,
|
|
3530
3676
|
"aria-describedby": errorMessageId
|
|
3531
3677
|
})]
|
|
3532
3678
|
}), jsxRuntime.jsx("div", {
|
|
@@ -3536,7 +3682,7 @@ function Taglist(props) {
|
|
|
3536
3682
|
getLabel: o => o.label,
|
|
3537
3683
|
onValueSelected: o => selectValue(o.value),
|
|
3538
3684
|
emptyListMessage: hasOptionsLeft ? 'No results' : 'All values selected',
|
|
3539
|
-
listenerElement:
|
|
3685
|
+
listenerElement: inputRef.current
|
|
3540
3686
|
})
|
|
3541
3687
|
}), jsxRuntime.jsx(Description, {
|
|
3542
3688
|
description: description
|
|
@@ -3646,6 +3792,7 @@ function Textfield(props) {
|
|
|
3646
3792
|
disabled,
|
|
3647
3793
|
errors = [],
|
|
3648
3794
|
onBlur,
|
|
3795
|
+
onFocus,
|
|
3649
3796
|
field,
|
|
3650
3797
|
readonly,
|
|
3651
3798
|
value = ''
|
|
@@ -3697,7 +3844,8 @@ function Textfield(props) {
|
|
|
3697
3844
|
readOnly: readonly,
|
|
3698
3845
|
id: prefixId(id, formId),
|
|
3699
3846
|
onInput: onChange,
|
|
3700
|
-
onBlur: onBlur,
|
|
3847
|
+
onBlur: () => onBlur && onBlur(),
|
|
3848
|
+
onFocus: () => onFocus && onFocus(),
|
|
3701
3849
|
type: "text",
|
|
3702
3850
|
value: value,
|
|
3703
3851
|
"aria-describedby": errorMessageId
|
|
@@ -3740,6 +3888,7 @@ function Textarea(props) {
|
|
|
3740
3888
|
disabled,
|
|
3741
3889
|
errors = [],
|
|
3742
3890
|
onBlur,
|
|
3891
|
+
onFocus,
|
|
3743
3892
|
field,
|
|
3744
3893
|
readonly,
|
|
3745
3894
|
value = ''
|
|
@@ -3788,7 +3937,8 @@ function Textarea(props) {
|
|
|
3788
3937
|
readonly: readonly,
|
|
3789
3938
|
id: prefixId(id, formId),
|
|
3790
3939
|
onInput: onInput,
|
|
3791
|
-
onBlur: onBlur,
|
|
3940
|
+
onBlur: () => onBlur && onBlur(),
|
|
3941
|
+
onFocus: () => onFocus && onFocus(),
|
|
3792
3942
|
value: value,
|
|
3793
3943
|
ref: textareaRef,
|
|
3794
3944
|
"aria-describedby": errorMessageId
|
|
@@ -3832,39 +3982,39 @@ const autoSizeTextarea = textarea => {
|
|
|
3832
3982
|
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3833
3983
|
};
|
|
3834
3984
|
|
|
3835
|
-
var _path$
|
|
3836
|
-
function _extends$
|
|
3985
|
+
var _path$d;
|
|
3986
|
+
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
3987
|
var SvgButton = function SvgButton(props) {
|
|
3838
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
3988
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
|
|
3839
3989
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3840
3990
|
width: 54,
|
|
3841
3991
|
height: 54,
|
|
3842
3992
|
fill: "currentcolor"
|
|
3843
|
-
}, props), _path$
|
|
3993
|
+
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3844
3994
|
fillRule: "evenodd",
|
|
3845
3995
|
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
3996
|
})));
|
|
3847
3997
|
};
|
|
3848
3998
|
var ButtonIcon = SvgButton;
|
|
3849
3999
|
|
|
3850
|
-
var _path$
|
|
3851
|
-
function _extends$
|
|
4000
|
+
var _path$c;
|
|
4001
|
+
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
4002
|
var SvgCheckbox = function SvgCheckbox(props) {
|
|
3853
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4003
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$e({
|
|
3854
4004
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3855
4005
|
width: 54,
|
|
3856
4006
|
height: 54,
|
|
3857
4007
|
fill: "currentcolor"
|
|
3858
|
-
}, props), _path$
|
|
4008
|
+
}, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3859
4009
|
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
4010
|
})));
|
|
3861
4011
|
};
|
|
3862
4012
|
var CheckboxIcon = SvgCheckbox;
|
|
3863
4013
|
|
|
3864
4014
|
var _g, _use, _use2, _use3, _defs;
|
|
3865
|
-
function _extends$
|
|
4015
|
+
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
4016
|
var SvgChecklist = function SvgChecklist(props) {
|
|
3867
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4017
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
3868
4018
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3869
4019
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
3870
4020
|
width: 54,
|
|
@@ -3898,18 +4048,18 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3898
4048
|
};
|
|
3899
4049
|
var ChecklistIcon = SvgChecklist;
|
|
3900
4050
|
|
|
3901
|
-
var _path$
|
|
3902
|
-
function _extends$
|
|
4051
|
+
var _path$b, _path2$2, _path3;
|
|
4052
|
+
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
4053
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3904
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4054
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$c({
|
|
3905
4055
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3906
4056
|
width: 54,
|
|
3907
4057
|
height: 54,
|
|
3908
4058
|
fill: "currentcolor"
|
|
3909
|
-
}, props), _path$
|
|
4059
|
+
}, props), _path$b || (_path$b = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3910
4060
|
fillRule: "evenodd",
|
|
3911
4061
|
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$
|
|
4062
|
+
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3913
4063
|
d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
|
|
3914
4064
|
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3915
4065
|
fillRule: "evenodd",
|
|
@@ -3918,27 +4068,27 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3918
4068
|
};
|
|
3919
4069
|
var DatetimeIcon = SvgDatetime;
|
|
3920
4070
|
|
|
3921
|
-
var _path$
|
|
3922
|
-
function _extends$
|
|
4071
|
+
var _path$a, _path2$1;
|
|
4072
|
+
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
4073
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3924
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4074
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$b({
|
|
3925
4075
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3926
4076
|
width: 54,
|
|
3927
4077
|
height: 54,
|
|
3928
4078
|
fill: "currentcolor"
|
|
3929
|
-
}, props), _path$
|
|
4079
|
+
}, props), _path$a || (_path$a = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3930
4080
|
fillRule: "evenodd",
|
|
3931
4081
|
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$
|
|
4082
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3933
4083
|
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
4084
|
})));
|
|
3935
4085
|
};
|
|
3936
4086
|
var TaglistIcon = SvgTaglist;
|
|
3937
4087
|
|
|
3938
4088
|
var _rect, _rect2, _rect3;
|
|
3939
|
-
function _extends$
|
|
4089
|
+
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
4090
|
var SvgForm = function SvgForm(props) {
|
|
3941
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
4091
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$a({
|
|
3942
4092
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3943
4093
|
width: 54,
|
|
3944
4094
|
height: 54
|
|
@@ -3964,9 +4114,24 @@ var SvgForm = function SvgForm(props) {
|
|
|
3964
4114
|
};
|
|
3965
4115
|
var FormIcon = SvgForm;
|
|
3966
4116
|
|
|
4117
|
+
var _path$9;
|
|
4118
|
+
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); }
|
|
4119
|
+
var SvgGroup = function SvgGroup(props) {
|
|
4120
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$9({
|
|
4121
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4122
|
+
width: 54,
|
|
4123
|
+
height: 54,
|
|
4124
|
+
fill: "currentcolor"
|
|
4125
|
+
}, props), _path$9 || (_path$9 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4126
|
+
fillRule: "evenodd",
|
|
4127
|
+
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"
|
|
4128
|
+
})));
|
|
4129
|
+
};
|
|
4130
|
+
var GroupIcon = SvgGroup;
|
|
4131
|
+
|
|
3967
4132
|
var _path$8;
|
|
3968
4133
|
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
|
|
4134
|
+
var SvgNumber = function SvgNumber(props) {
|
|
3970
4135
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$8({
|
|
3971
4136
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3972
4137
|
width: 54,
|
|
@@ -3974,74 +4139,66 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3974
4139
|
fill: "currentcolor"
|
|
3975
4140
|
}, props), _path$8 || (_path$8 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3976
4141
|
fillRule: "evenodd",
|
|
3977
|
-
d: "
|
|
4142
|
+
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
4143
|
})));
|
|
3979
4144
|
};
|
|
3980
|
-
var
|
|
4145
|
+
var NumberIcon = SvgNumber;
|
|
3981
4146
|
|
|
3982
4147
|
var _path$7;
|
|
3983
4148
|
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
|
|
4149
|
+
var SvgRadio = function SvgRadio(props) {
|
|
3985
4150
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$7({
|
|
3986
4151
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3987
4152
|
width: 54,
|
|
3988
4153
|
height: 54,
|
|
3989
4154
|
fill: "currentcolor"
|
|
3990
4155
|
}, 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"
|
|
4156
|
+
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
4157
|
})));
|
|
3994
4158
|
};
|
|
3995
|
-
var
|
|
4159
|
+
var RadioIcon = SvgRadio;
|
|
3996
4160
|
|
|
3997
4161
|
var _path$6;
|
|
3998
4162
|
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
|
|
4163
|
+
var SvgSelect = function SvgSelect(props) {
|
|
4000
4164
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$6({
|
|
4001
4165
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4002
4166
|
width: 54,
|
|
4003
4167
|
height: 54,
|
|
4004
4168
|
fill: "currentcolor"
|
|
4005
4169
|
}, props), _path$6 || (_path$6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4006
|
-
|
|
4170
|
+
fillRule: "evenodd",
|
|
4171
|
+
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
4172
|
})));
|
|
4008
4173
|
};
|
|
4009
|
-
var
|
|
4174
|
+
var SelectIcon = SvgSelect;
|
|
4010
4175
|
|
|
4011
4176
|
var _path$5;
|
|
4012
4177
|
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
|
|
4178
|
+
var SvgSeparator = function SvgSeparator(props) {
|
|
4014
4179
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
4015
4180
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4016
4181
|
width: 54,
|
|
4017
4182
|
height: 54,
|
|
4018
|
-
fill: "
|
|
4183
|
+
fill: "none"
|
|
4019
4184
|
}, props), _path$5 || (_path$5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
4020
|
-
|
|
4021
|
-
d: "
|
|
4185
|
+
fill: "currentColor",
|
|
4186
|
+
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
4187
|
})));
|
|
4023
4188
|
};
|
|
4024
|
-
var
|
|
4189
|
+
var SeparatorIcon = SvgSeparator;
|
|
4025
4190
|
|
|
4026
|
-
var _path$4
|
|
4191
|
+
var _path$4;
|
|
4027
4192
|
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
4193
|
var SvgSpacer = function SvgSpacer(props) {
|
|
4029
4194
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
4030
4195
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4031
4196
|
width: 54,
|
|
4032
4197
|
height: 54,
|
|
4033
|
-
fill: "
|
|
4198
|
+
fill: "none"
|
|
4034
4199
|
}, 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"
|
|
4200
|
+
fill: "currentColor",
|
|
4201
|
+
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
4202
|
})));
|
|
4046
4203
|
};
|
|
4047
4204
|
var SpacerIcon = SvgSpacer;
|
|
@@ -4122,6 +4279,7 @@ const iconsByType = type => {
|
|
|
4122
4279
|
number: NumberIcon,
|
|
4123
4280
|
radio: RadioIcon,
|
|
4124
4281
|
select: SelectIcon,
|
|
4282
|
+
separator: SeparatorIcon,
|
|
4125
4283
|
spacer: SpacerIcon,
|
|
4126
4284
|
taglist: TaglistIcon,
|
|
4127
4285
|
text: TextIcon,
|
|
@@ -4131,7 +4289,7 @@ const iconsByType = type => {
|
|
|
4131
4289
|
}[type];
|
|
4132
4290
|
};
|
|
4133
4291
|
|
|
4134
|
-
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Taglist, Text, Textfield, Textarea];
|
|
4292
|
+
const formFields = [Button, Checkbox, Checklist, FormComponent$1, Group, Image, Numberfield, Datetime, Radio, Select, Spacer, Separator, Taglist, Text, Textfield, Textarea];
|
|
4135
4293
|
|
|
4136
4294
|
class FormFields {
|
|
4137
4295
|
constructor() {
|
|
@@ -4192,10 +4350,10 @@ function createInjector(bootstrapModules) {
|
|
|
4192
4350
|
return injector;
|
|
4193
4351
|
}
|
|
4194
4352
|
|
|
4195
|
-
/**
|
|
4196
|
-
* @param {string?} prefix
|
|
4197
|
-
*
|
|
4198
|
-
* @returns Element
|
|
4353
|
+
/**
|
|
4354
|
+
* @param {string?} prefix
|
|
4355
|
+
*
|
|
4356
|
+
* @returns Element
|
|
4199
4357
|
*/
|
|
4200
4358
|
function createFormContainer(prefix = 'fjs') {
|
|
4201
4359
|
const container = document.createElement('div');
|
|
@@ -4232,22 +4390,47 @@ function generateIdForType(type) {
|
|
|
4232
4390
|
return `${type}${generateIndexForType(type)}`;
|
|
4233
4391
|
}
|
|
4234
4392
|
|
|
4235
|
-
/**
|
|
4236
|
-
* @template T
|
|
4237
|
-
* @param {T} data
|
|
4238
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4239
|
-
* @return {T}
|
|
4393
|
+
/**
|
|
4394
|
+
* @template T
|
|
4395
|
+
* @param {T} data
|
|
4396
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
4397
|
+
* @return {T}
|
|
4240
4398
|
*/
|
|
4241
4399
|
function clone(data, replacer) {
|
|
4242
4400
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
4243
4401
|
}
|
|
4244
4402
|
|
|
4245
|
-
/**
|
|
4246
|
-
*
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
*
|
|
4403
|
+
/**
|
|
4404
|
+
* @typedef { import('../types').Schema } Schema
|
|
4405
|
+
*/
|
|
4406
|
+
|
|
4407
|
+
/**
|
|
4408
|
+
* Parse the schema for variables a form might make use of.
|
|
4409
|
+
*
|
|
4410
|
+
* @example
|
|
4411
|
+
*
|
|
4412
|
+
* // retrieve variables from schema
|
|
4413
|
+
* const variables = getSchemaVariables(schema);
|
|
4414
|
+
*
|
|
4415
|
+
* @example
|
|
4416
|
+
*
|
|
4417
|
+
* // retrieve input variables from schema
|
|
4418
|
+
* const inputVariables = getSchemaVariables(schema, { outputs: false });
|
|
4419
|
+
*
|
|
4420
|
+
* @example
|
|
4421
|
+
*
|
|
4422
|
+
* // retrieve output variables from schema
|
|
4423
|
+
* const outputVariables = getSchemaVariables(schema, { inputs: false });
|
|
4424
|
+
*
|
|
4425
|
+
* @param {Schema} schema
|
|
4426
|
+
* @param {object} [options]
|
|
4427
|
+
* @param {any} [options.expressionLanguage]
|
|
4428
|
+
* @param {any} [options.templating]
|
|
4429
|
+
* @param {any} [options.formFields]
|
|
4430
|
+
* @param {boolean} [options.inputs=true]
|
|
4431
|
+
* @param {boolean} [options.outputs=true]
|
|
4432
|
+
*
|
|
4433
|
+
* @return {string[]}
|
|
4251
4434
|
*/
|
|
4252
4435
|
function getSchemaVariables(schema, options = {}) {
|
|
4253
4436
|
const {
|
|
@@ -4330,9 +4513,9 @@ function runRecursively(formField, fn) {
|
|
|
4330
4513
|
fn(formField);
|
|
4331
4514
|
}
|
|
4332
4515
|
|
|
4333
|
-
/**
|
|
4334
|
-
* @typedef {object} Condition
|
|
4335
|
-
* @property {string} [hide]
|
|
4516
|
+
/**
|
|
4517
|
+
* @typedef {object} Condition
|
|
4518
|
+
* @property {string} [hide]
|
|
4336
4519
|
*/
|
|
4337
4520
|
|
|
4338
4521
|
class ConditionChecker {
|
|
@@ -4342,13 +4525,13 @@ class ConditionChecker {
|
|
|
4342
4525
|
this._eventBus = eventBus;
|
|
4343
4526
|
}
|
|
4344
4527
|
|
|
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]
|
|
4528
|
+
/**
|
|
4529
|
+
* For given data, remove properties based on condition.
|
|
4530
|
+
*
|
|
4531
|
+
* @param {Object<string, any>} properties
|
|
4532
|
+
* @param {Object<string, any>} data
|
|
4533
|
+
* @param {Object} [options]
|
|
4534
|
+
* @param {Function} [options.getFilterPath]
|
|
4352
4535
|
*/
|
|
4353
4536
|
applyConditions(properties, data = {}, options = {}) {
|
|
4354
4537
|
const newProperties = clone(properties);
|
|
@@ -4377,13 +4560,13 @@ class ConditionChecker {
|
|
|
4377
4560
|
return newProperties;
|
|
4378
4561
|
}
|
|
4379
4562
|
|
|
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}
|
|
4563
|
+
/**
|
|
4564
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
4565
|
+
*
|
|
4566
|
+
* @param {string} condition
|
|
4567
|
+
* @param {import('../../types').Data} [data]
|
|
4568
|
+
*
|
|
4569
|
+
* @returns {boolean|null}
|
|
4387
4570
|
*/
|
|
4388
4571
|
check(condition, data = {}) {
|
|
4389
4572
|
if (!condition) {
|
|
@@ -4404,12 +4587,12 @@ class ConditionChecker {
|
|
|
4404
4587
|
}
|
|
4405
4588
|
}
|
|
4406
4589
|
|
|
4407
|
-
/**
|
|
4408
|
-
* Check if hide condition is met.
|
|
4409
|
-
*
|
|
4410
|
-
* @param {Condition} condition
|
|
4411
|
-
* @param {Object<string, any>} data
|
|
4412
|
-
* @returns {boolean}
|
|
4590
|
+
/**
|
|
4591
|
+
* Check if hide condition is met.
|
|
4592
|
+
*
|
|
4593
|
+
* @param {Condition} condition
|
|
4594
|
+
* @param {Object<string, any>} data
|
|
4595
|
+
* @returns {boolean}
|
|
4413
4596
|
*/
|
|
4414
4597
|
_checkHideCondition(condition, data) {
|
|
4415
4598
|
if (!condition.hide) {
|
|
@@ -4445,12 +4628,12 @@ class MarkdownRenderer {
|
|
|
4445
4628
|
this._converter = new showdown.Converter();
|
|
4446
4629
|
}
|
|
4447
4630
|
|
|
4448
|
-
/**
|
|
4449
|
-
* Render markdown to HTML.
|
|
4450
|
-
*
|
|
4451
|
-
* @param {string} markdown - The markdown to render
|
|
4452
|
-
*
|
|
4453
|
-
* @returns {string} HTML
|
|
4631
|
+
/**
|
|
4632
|
+
* Render markdown to HTML.
|
|
4633
|
+
*
|
|
4634
|
+
* @param {string} markdown - The markdown to render
|
|
4635
|
+
*
|
|
4636
|
+
* @returns {string} HTML
|
|
4454
4637
|
*/
|
|
4455
4638
|
render(markdown) {
|
|
4456
4639
|
return this._converter.makeHtml(markdown);
|
|
@@ -5573,8 +5756,8 @@ Validator.$inject = ['expressionLanguage', 'conditionChecker', 'form'];
|
|
|
5573
5756
|
|
|
5574
5757
|
// helpers //////////
|
|
5575
5758
|
|
|
5576
|
-
/**
|
|
5577
|
-
* Helper function to evaluate optional FEEL validation values.
|
|
5759
|
+
/**
|
|
5760
|
+
* Helper function to evaluate optional FEEL validation values.
|
|
5578
5761
|
*/
|
|
5579
5762
|
function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form) {
|
|
5580
5763
|
const evaluatedValidate = {
|
|
@@ -5608,12 +5791,12 @@ function evaluateFEELValues(validate, expressionLanguage, conditionChecker, form
|
|
|
5608
5791
|
}
|
|
5609
5792
|
|
|
5610
5793
|
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
|
|
5794
|
+
/**
|
|
5795
|
+
* @constructor
|
|
5796
|
+
* @param { import('./FormFieldRegistry').default } formFieldRegistry
|
|
5797
|
+
* @param { import('./PathRegistry').default } pathRegistry
|
|
5798
|
+
* @param { import('./FieldFactory').default } fieldFactory
|
|
5799
|
+
* @param { import('./FormLayouter').default } formLayouter
|
|
5617
5800
|
*/
|
|
5618
5801
|
constructor(formFieldRegistry, pathRegistry, fieldFactory, formLayouter) {
|
|
5619
5802
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5622,21 +5805,21 @@ class Importer {
|
|
|
5622
5805
|
this._formLayouter = formLayouter;
|
|
5623
5806
|
}
|
|
5624
5807
|
|
|
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}
|
|
5808
|
+
/**
|
|
5809
|
+
* Import schema creating rows, fields, attaching additional
|
|
5810
|
+
* information to each field and adding fields to the
|
|
5811
|
+
* field registry.
|
|
5812
|
+
*
|
|
5813
|
+
* Additional information attached:
|
|
5814
|
+
*
|
|
5815
|
+
* * `id` (unless present)
|
|
5816
|
+
* * `_parent`
|
|
5817
|
+
* * `_path`
|
|
5818
|
+
*
|
|
5819
|
+
* @param {any} schema
|
|
5820
|
+
*
|
|
5821
|
+
* @typedef {{ warnings: Error[], schema: any }} ImportResult
|
|
5822
|
+
* @returns {ImportResult}
|
|
5640
5823
|
*/
|
|
5641
5824
|
importSchema(schema) {
|
|
5642
5825
|
// TODO: Add warnings
|
|
@@ -5661,12 +5844,12 @@ class Importer {
|
|
|
5661
5844
|
this._pathRegistry.clear();
|
|
5662
5845
|
}
|
|
5663
5846
|
|
|
5664
|
-
/**
|
|
5665
|
-
* @param {{[x: string]: any}} fieldAttrs
|
|
5666
|
-
* @param {String} [parentId]
|
|
5667
|
-
* @param {number} [index]
|
|
5668
|
-
*
|
|
5669
|
-
* @return {any} field
|
|
5847
|
+
/**
|
|
5848
|
+
* @param {{[x: string]: any}} fieldAttrs
|
|
5849
|
+
* @param {String} [parentId]
|
|
5850
|
+
* @param {number} [index]
|
|
5851
|
+
*
|
|
5852
|
+
* @return {any} field
|
|
5670
5853
|
*/
|
|
5671
5854
|
importFormField(fieldAttrs, parentId, index) {
|
|
5672
5855
|
const {
|
|
@@ -5691,11 +5874,11 @@ class Importer {
|
|
|
5691
5874
|
return field;
|
|
5692
5875
|
}
|
|
5693
5876
|
|
|
5694
|
-
/**
|
|
5695
|
-
* @param {Array<any>} components
|
|
5696
|
-
* @param {string} parentId
|
|
5697
|
-
*
|
|
5698
|
-
* @return {Array<any>} imported components
|
|
5877
|
+
/**
|
|
5878
|
+
* @param {Array<any>} components
|
|
5879
|
+
* @param {string} parentId
|
|
5880
|
+
*
|
|
5881
|
+
* @return {Array<any>} imported components
|
|
5699
5882
|
*/
|
|
5700
5883
|
importFormFields(components, parentId) {
|
|
5701
5884
|
return components.map((component, index) => {
|
|
@@ -5706,11 +5889,11 @@ class Importer {
|
|
|
5706
5889
|
Importer.$inject = ['formFieldRegistry', 'pathRegistry', 'fieldFactory', 'formLayouter'];
|
|
5707
5890
|
|
|
5708
5891
|
class FieldFactory {
|
|
5709
|
-
/**
|
|
5710
|
-
* @constructor
|
|
5711
|
-
*
|
|
5712
|
-
* @param formFieldRegistry
|
|
5713
|
-
* @param formFields
|
|
5892
|
+
/**
|
|
5893
|
+
* @constructor
|
|
5894
|
+
*
|
|
5895
|
+
* @param formFieldRegistry
|
|
5896
|
+
* @param formFields
|
|
5714
5897
|
*/
|
|
5715
5898
|
constructor(formFieldRegistry, pathRegistry, formFields) {
|
|
5716
5899
|
this._formFieldRegistry = formFieldRegistry;
|
|
@@ -5792,36 +5975,36 @@ class FieldFactory {
|
|
|
5792
5975
|
}
|
|
5793
5976
|
FieldFactory.$inject = ['formFieldRegistry', 'pathRegistry', 'formFields'];
|
|
5794
5977
|
|
|
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
|
-
* ]
|
|
5978
|
+
/**
|
|
5979
|
+
* The PathRegistry class manages a hierarchical structure of paths associated with form fields.
|
|
5980
|
+
* It enables claiming, unclaiming, and validating paths within this structure.
|
|
5981
|
+
*
|
|
5982
|
+
* Example Tree Structure:
|
|
5983
|
+
*
|
|
5984
|
+
* [
|
|
5985
|
+
* {
|
|
5986
|
+
* segment: 'root',
|
|
5987
|
+
* claimCount: 1,
|
|
5988
|
+
* children: [
|
|
5989
|
+
* {
|
|
5990
|
+
* segment: 'child1',
|
|
5991
|
+
* claimCount: 2,
|
|
5992
|
+
* children: null // A leaf node (closed path)
|
|
5993
|
+
* },
|
|
5994
|
+
* {
|
|
5995
|
+
* segment: 'child2',
|
|
5996
|
+
* claimCount: 1,
|
|
5997
|
+
* children: [
|
|
5998
|
+
* {
|
|
5999
|
+
* segment: 'subChild1',
|
|
6000
|
+
* claimCount: 1,
|
|
6001
|
+
* children: [] // An open node (open path)
|
|
6002
|
+
* }
|
|
6003
|
+
* ]
|
|
6004
|
+
* }
|
|
6005
|
+
* ]
|
|
6006
|
+
* }
|
|
6007
|
+
* ]
|
|
5825
6008
|
*/
|
|
5826
6009
|
class PathRegistry {
|
|
5827
6010
|
constructor(formFieldRegistry, formFields) {
|
|
@@ -5904,16 +6087,16 @@ class PathRegistry {
|
|
|
5904
6087
|
}
|
|
5905
6088
|
}
|
|
5906
6089
|
|
|
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.
|
|
6090
|
+
/**
|
|
6091
|
+
* Applies a function (fn) recursively on a given field and its children.
|
|
6092
|
+
*
|
|
6093
|
+
* - `field`: Starting field object.
|
|
6094
|
+
* - `fn`: Function to apply.
|
|
6095
|
+
* - `context`: Optional object for passing data between calls.
|
|
6096
|
+
*
|
|
6097
|
+
* Stops early if `fn` returns `false`. Useful for traversing the form field tree.
|
|
6098
|
+
*
|
|
6099
|
+
* @returns {boolean} Success status based on function execution.
|
|
5917
6100
|
*/
|
|
5918
6101
|
executeRecursivelyOnFields(field, fn, context = {}) {
|
|
5919
6102
|
let result = true;
|
|
@@ -5947,15 +6130,15 @@ class PathRegistry {
|
|
|
5947
6130
|
return result;
|
|
5948
6131
|
}
|
|
5949
6132
|
|
|
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.
|
|
6133
|
+
/**
|
|
6134
|
+
* Generates an array representing the binding path to an underlying data object for a form field.
|
|
6135
|
+
*
|
|
6136
|
+
* @param {Object} field - The field object with properties: `key`, `path`, `id`, and optionally `_parent`.
|
|
6137
|
+
* @param {Object} [options={}] - Configuration options.
|
|
6138
|
+
* @param {Object} [options.replacements={}] - A map of field IDs to alternative path arrays.
|
|
6139
|
+
* @param {Object} [options.cutoffNode] - The ID of the parent field at which to stop generating the path.
|
|
6140
|
+
*
|
|
6141
|
+
* @returns {(Array<string>|undefined)} An array of strings representing the binding path, or undefined if not determinable.
|
|
5959
6142
|
*/
|
|
5960
6143
|
getValuePath(field, options = {}) {
|
|
5961
6144
|
const {
|
|
@@ -5999,23 +6182,23 @@ const _getNextSegment = (node, segment) => {
|
|
|
5999
6182
|
};
|
|
6000
6183
|
PathRegistry.$inject = ['formFieldRegistry', 'formFields'];
|
|
6001
6184
|
|
|
6002
|
-
/**
|
|
6003
|
-
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6004
|
-
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6185
|
+
/**
|
|
6186
|
+
* @typedef { { id: String, components: Array<String> } } FormRow
|
|
6187
|
+
* @typedef { { formFieldId: String, rows: Array<FormRow> } } FormRows
|
|
6005
6188
|
*/
|
|
6006
6189
|
|
|
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
|
-
*
|
|
6190
|
+
/**
|
|
6191
|
+
* Maintains the Form layout in a given structure, for example
|
|
6192
|
+
*
|
|
6193
|
+
* [
|
|
6194
|
+
* {
|
|
6195
|
+
* formFieldId: 'FormField_1',
|
|
6196
|
+
* rows: [
|
|
6197
|
+
* { id: 'Row_1', components: [ 'Text_1', 'Textdield_1', ... ] }
|
|
6198
|
+
* ]
|
|
6199
|
+
* }
|
|
6200
|
+
* ]
|
|
6201
|
+
*
|
|
6019
6202
|
*/
|
|
6020
6203
|
class FormLayouter {
|
|
6021
6204
|
constructor(eventBus) {
|
|
@@ -6025,8 +6208,8 @@ class FormLayouter {
|
|
|
6025
6208
|
this._eventBus = eventBus;
|
|
6026
6209
|
}
|
|
6027
6210
|
|
|
6028
|
-
/**
|
|
6029
|
-
* @param {FormRow} row
|
|
6211
|
+
/**
|
|
6212
|
+
* @param {FormRow} row
|
|
6030
6213
|
*/
|
|
6031
6214
|
addRow(formFieldId, row) {
|
|
6032
6215
|
let rowsPerComponent = this._rows.find(r => r.formFieldId === formFieldId);
|
|
@@ -6040,18 +6223,18 @@ class FormLayouter {
|
|
|
6040
6223
|
rowsPerComponent.rows.push(row);
|
|
6041
6224
|
}
|
|
6042
6225
|
|
|
6043
|
-
/**
|
|
6044
|
-
* @param {String} id
|
|
6045
|
-
* @returns {FormRow}
|
|
6226
|
+
/**
|
|
6227
|
+
* @param {String} id
|
|
6228
|
+
* @returns {FormRow}
|
|
6046
6229
|
*/
|
|
6047
6230
|
getRow(id) {
|
|
6048
6231
|
const rows = allRows(this._rows);
|
|
6049
6232
|
return rows.find(r => r.id === id);
|
|
6050
6233
|
}
|
|
6051
6234
|
|
|
6052
|
-
/**
|
|
6053
|
-
* @param {any} formField
|
|
6054
|
-
* @returns {FormRow}
|
|
6235
|
+
/**
|
|
6236
|
+
* @param {any} formField
|
|
6237
|
+
* @returns {FormRow}
|
|
6055
6238
|
*/
|
|
6056
6239
|
getRowForField(formField) {
|
|
6057
6240
|
return allRows(this._rows).find(r => {
|
|
@@ -6062,9 +6245,9 @@ class FormLayouter {
|
|
|
6062
6245
|
});
|
|
6063
6246
|
}
|
|
6064
6247
|
|
|
6065
|
-
/**
|
|
6066
|
-
* @param {String} formFieldId
|
|
6067
|
-
* @returns { Array<FormRow> }
|
|
6248
|
+
/**
|
|
6249
|
+
* @param {String} formFieldId
|
|
6250
|
+
* @returns { Array<FormRow> }
|
|
6068
6251
|
*/
|
|
6069
6252
|
getRows(formFieldId) {
|
|
6070
6253
|
const rowsForField = this._rows.find(r => formFieldId === r.formFieldId);
|
|
@@ -6074,15 +6257,15 @@ class FormLayouter {
|
|
|
6074
6257
|
return rowsForField.rows;
|
|
6075
6258
|
}
|
|
6076
6259
|
|
|
6077
|
-
/**
|
|
6078
|
-
* @returns {string}
|
|
6260
|
+
/**
|
|
6261
|
+
* @returns {string}
|
|
6079
6262
|
*/
|
|
6080
6263
|
nextRowId() {
|
|
6081
6264
|
return this._ids.nextPrefixed('Row_');
|
|
6082
6265
|
}
|
|
6083
6266
|
|
|
6084
|
-
/**
|
|
6085
|
-
* @param {any} formField
|
|
6267
|
+
/**
|
|
6268
|
+
* @param {any} formField
|
|
6086
6269
|
*/
|
|
6087
6270
|
calculateLayout(formField) {
|
|
6088
6271
|
const {
|
|
@@ -6136,9 +6319,9 @@ function groupByRow(components, ids) {
|
|
|
6136
6319
|
});
|
|
6137
6320
|
}
|
|
6138
6321
|
|
|
6139
|
-
/**
|
|
6140
|
-
* @param {Array<FormRows>} formRows
|
|
6141
|
-
* @returns {Array<FormRow>}
|
|
6322
|
+
/**
|
|
6323
|
+
* @param {Array<FormRows>} formRows
|
|
6324
|
+
* @returns {Array<FormRow>}
|
|
6142
6325
|
*/
|
|
6143
6326
|
function allRows(formRows) {
|
|
6144
6327
|
return minDash.flatten(formRows.map(c => c.rows));
|
|
@@ -6260,55 +6443,55 @@ var core = {
|
|
|
6260
6443
|
validator: ['type', Validator]
|
|
6261
6444
|
};
|
|
6262
6445
|
|
|
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
|
|
6446
|
+
/**
|
|
6447
|
+
* @typedef { import('./types').Injector } Injector
|
|
6448
|
+
* @typedef { import('./types').Data } Data
|
|
6449
|
+
* @typedef { import('./types').Errors } Errors
|
|
6450
|
+
* @typedef { import('./types').Schema } Schema
|
|
6451
|
+
* @typedef { import('./types').FormProperties } FormProperties
|
|
6452
|
+
* @typedef { import('./types').FormProperty } FormProperty
|
|
6453
|
+
* @typedef { import('./types').FormEvent } FormEvent
|
|
6454
|
+
* @typedef { import('./types').FormOptions } FormOptions
|
|
6455
|
+
*
|
|
6456
|
+
* @typedef { {
|
|
6457
|
+
* data: Data,
|
|
6458
|
+
* initialData: Data,
|
|
6459
|
+
* errors: Errors,
|
|
6460
|
+
* properties: FormProperties,
|
|
6461
|
+
* schema: Schema
|
|
6462
|
+
* } } State
|
|
6463
|
+
*
|
|
6464
|
+
* @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
|
|
6465
|
+
* @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
|
|
6466
|
+
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
6284
6467
|
*/
|
|
6285
6468
|
|
|
6286
6469
|
const ids = new Ids([32, 36, 1]);
|
|
6287
6470
|
|
|
6288
|
-
/**
|
|
6289
|
-
* The form.
|
|
6471
|
+
/**
|
|
6472
|
+
* The form.
|
|
6290
6473
|
*/
|
|
6291
6474
|
class Form {
|
|
6292
|
-
/**
|
|
6293
|
-
* @constructor
|
|
6294
|
-
* @param {FormOptions} options
|
|
6475
|
+
/**
|
|
6476
|
+
* @constructor
|
|
6477
|
+
* @param {FormOptions} options
|
|
6295
6478
|
*/
|
|
6296
6479
|
constructor(options = {}) {
|
|
6297
|
-
/**
|
|
6298
|
-
* @public
|
|
6299
|
-
* @type {OnEventType}
|
|
6480
|
+
/**
|
|
6481
|
+
* @public
|
|
6482
|
+
* @type {OnEventType}
|
|
6300
6483
|
*/
|
|
6301
6484
|
this.on = this._onEvent;
|
|
6302
6485
|
|
|
6303
|
-
/**
|
|
6304
|
-
* @public
|
|
6305
|
-
* @type {String}
|
|
6486
|
+
/**
|
|
6487
|
+
* @public
|
|
6488
|
+
* @type {String}
|
|
6306
6489
|
*/
|
|
6307
6490
|
this._id = ids.next();
|
|
6308
6491
|
|
|
6309
|
-
/**
|
|
6310
|
-
* @private
|
|
6311
|
-
* @type {Element}
|
|
6492
|
+
/**
|
|
6493
|
+
* @private
|
|
6494
|
+
* @type {Element}
|
|
6312
6495
|
*/
|
|
6313
6496
|
this._container = createFormContainer();
|
|
6314
6497
|
const {
|
|
@@ -6317,9 +6500,9 @@ class Form {
|
|
|
6317
6500
|
properties = {}
|
|
6318
6501
|
} = options;
|
|
6319
6502
|
|
|
6320
|
-
/**
|
|
6321
|
-
* @private
|
|
6322
|
-
* @type {State}
|
|
6503
|
+
/**
|
|
6504
|
+
* @private
|
|
6505
|
+
* @type {State}
|
|
6323
6506
|
*/
|
|
6324
6507
|
this._state = {
|
|
6325
6508
|
initialData: null,
|
|
@@ -6343,9 +6526,9 @@ class Form {
|
|
|
6343
6526
|
this._emit('form.clear');
|
|
6344
6527
|
}
|
|
6345
6528
|
|
|
6346
|
-
/**
|
|
6347
|
-
* Destroy the form, removing it from DOM,
|
|
6348
|
-
* if attached.
|
|
6529
|
+
/**
|
|
6530
|
+
* Destroy the form, removing it from DOM,
|
|
6531
|
+
* if attached.
|
|
6349
6532
|
*/
|
|
6350
6533
|
destroy() {
|
|
6351
6534
|
// destroy form services
|
|
@@ -6356,13 +6539,13 @@ class Form {
|
|
|
6356
6539
|
this._detach(false);
|
|
6357
6540
|
}
|
|
6358
6541
|
|
|
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> }>
|
|
6542
|
+
/**
|
|
6543
|
+
* Open a form schema with the given initial data.
|
|
6544
|
+
*
|
|
6545
|
+
* @param {Schema} schema
|
|
6546
|
+
* @param {Data} [data]
|
|
6547
|
+
*
|
|
6548
|
+
* @return Promise<{ warnings: Array<any> }>
|
|
6366
6549
|
*/
|
|
6367
6550
|
importSchema(schema, data = {}) {
|
|
6368
6551
|
return new Promise((resolve, reject) => {
|
|
@@ -6395,10 +6578,10 @@ class Form {
|
|
|
6395
6578
|
});
|
|
6396
6579
|
}
|
|
6397
6580
|
|
|
6398
|
-
/**
|
|
6399
|
-
* Submit the form, triggering all field validations.
|
|
6400
|
-
*
|
|
6401
|
-
* @returns { { data: Data, errors: Errors } }
|
|
6581
|
+
/**
|
|
6582
|
+
* Submit the form, triggering all field validations.
|
|
6583
|
+
*
|
|
6584
|
+
* @returns { { data: Data, errors: Errors } }
|
|
6402
6585
|
*/
|
|
6403
6586
|
submit() {
|
|
6404
6587
|
const {
|
|
@@ -6424,8 +6607,8 @@ class Form {
|
|
|
6424
6607
|
});
|
|
6425
6608
|
}
|
|
6426
6609
|
|
|
6427
|
-
/**
|
|
6428
|
-
* @returns {Errors}
|
|
6610
|
+
/**
|
|
6611
|
+
* @returns {Errors}
|
|
6429
6612
|
*/
|
|
6430
6613
|
validate() {
|
|
6431
6614
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6455,8 +6638,8 @@ class Form {
|
|
|
6455
6638
|
return filteredErrors;
|
|
6456
6639
|
}
|
|
6457
6640
|
|
|
6458
|
-
/**
|
|
6459
|
-
* @param {Element|string} parentNode
|
|
6641
|
+
/**
|
|
6642
|
+
* @param {Element|string} parentNode
|
|
6460
6643
|
*/
|
|
6461
6644
|
attachTo(parentNode) {
|
|
6462
6645
|
if (!parentNode) {
|
|
@@ -6474,10 +6657,10 @@ class Form {
|
|
|
6474
6657
|
this._detach();
|
|
6475
6658
|
}
|
|
6476
6659
|
|
|
6477
|
-
/**
|
|
6478
|
-
* @private
|
|
6479
|
-
*
|
|
6480
|
-
* @param {boolean} [emit]
|
|
6660
|
+
/**
|
|
6661
|
+
* @private
|
|
6662
|
+
*
|
|
6663
|
+
* @param {boolean} [emit]
|
|
6481
6664
|
*/
|
|
6482
6665
|
_detach(emit = true) {
|
|
6483
6666
|
const container = this._container,
|
|
@@ -6491,9 +6674,9 @@ class Form {
|
|
|
6491
6674
|
parentNode.removeChild(container);
|
|
6492
6675
|
}
|
|
6493
6676
|
|
|
6494
|
-
/**
|
|
6495
|
-
* @param {FormProperty} property
|
|
6496
|
-
* @param {any} value
|
|
6677
|
+
/**
|
|
6678
|
+
* @param {FormProperty} property
|
|
6679
|
+
* @param {any} value
|
|
6497
6680
|
*/
|
|
6498
6681
|
setProperty(property, value) {
|
|
6499
6682
|
const properties = minDash.set(this._getState().properties, [property], value);
|
|
@@ -6502,21 +6685,21 @@ class Form {
|
|
|
6502
6685
|
});
|
|
6503
6686
|
}
|
|
6504
6687
|
|
|
6505
|
-
/**
|
|
6506
|
-
* @param {FormEvent} type
|
|
6507
|
-
* @param {Function} handler
|
|
6688
|
+
/**
|
|
6689
|
+
* @param {FormEvent} type
|
|
6690
|
+
* @param {Function} handler
|
|
6508
6691
|
*/
|
|
6509
6692
|
off(type, handler) {
|
|
6510
6693
|
this.get('eventBus').off(type, handler);
|
|
6511
6694
|
}
|
|
6512
6695
|
|
|
6513
|
-
/**
|
|
6514
|
-
* @private
|
|
6515
|
-
*
|
|
6516
|
-
* @param {FormOptions} options
|
|
6517
|
-
* @param {Element} container
|
|
6518
|
-
*
|
|
6519
|
-
* @returns {Injector}
|
|
6696
|
+
/**
|
|
6697
|
+
* @private
|
|
6698
|
+
*
|
|
6699
|
+
* @param {FormOptions} options
|
|
6700
|
+
* @param {Element} container
|
|
6701
|
+
*
|
|
6702
|
+
* @returns {Injector}
|
|
6520
6703
|
*/
|
|
6521
6704
|
_createInjector(options, container) {
|
|
6522
6705
|
const {
|
|
@@ -6535,17 +6718,17 @@ class Form {
|
|
|
6535
6718
|
}, core, ...modules, ...additionalModules]);
|
|
6536
6719
|
}
|
|
6537
6720
|
|
|
6538
|
-
/**
|
|
6539
|
-
* @private
|
|
6721
|
+
/**
|
|
6722
|
+
* @private
|
|
6540
6723
|
*/
|
|
6541
6724
|
_emit(type, data) {
|
|
6542
6725
|
this.get('eventBus').fire(type, data);
|
|
6543
6726
|
}
|
|
6544
6727
|
|
|
6545
|
-
/**
|
|
6546
|
-
* @internal
|
|
6547
|
-
*
|
|
6548
|
-
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6728
|
+
/**
|
|
6729
|
+
* @internal
|
|
6730
|
+
*
|
|
6731
|
+
* @param { { add?: boolean, field: any, remove?: number, value?: any } } update
|
|
6549
6732
|
*/
|
|
6550
6733
|
_update(update) {
|
|
6551
6734
|
const {
|
|
@@ -6567,15 +6750,15 @@ class Form {
|
|
|
6567
6750
|
});
|
|
6568
6751
|
}
|
|
6569
6752
|
|
|
6570
|
-
/**
|
|
6571
|
-
* @internal
|
|
6753
|
+
/**
|
|
6754
|
+
* @internal
|
|
6572
6755
|
*/
|
|
6573
6756
|
_getState() {
|
|
6574
6757
|
return this._state;
|
|
6575
6758
|
}
|
|
6576
6759
|
|
|
6577
|
-
/**
|
|
6578
|
-
* @internal
|
|
6760
|
+
/**
|
|
6761
|
+
* @internal
|
|
6579
6762
|
*/
|
|
6580
6763
|
_setState(state) {
|
|
6581
6764
|
this._state = {
|
|
@@ -6585,22 +6768,22 @@ class Form {
|
|
|
6585
6768
|
this._emit('changed', this._getState());
|
|
6586
6769
|
}
|
|
6587
6770
|
|
|
6588
|
-
/**
|
|
6589
|
-
* @internal
|
|
6771
|
+
/**
|
|
6772
|
+
* @internal
|
|
6590
6773
|
*/
|
|
6591
6774
|
_getModules() {
|
|
6592
6775
|
return [ExpressionLanguageModule, MarkdownModule, ViewerCommandsModule];
|
|
6593
6776
|
}
|
|
6594
6777
|
|
|
6595
|
-
/**
|
|
6596
|
-
* @internal
|
|
6778
|
+
/**
|
|
6779
|
+
* @internal
|
|
6597
6780
|
*/
|
|
6598
6781
|
_onEvent(type, priority, handler) {
|
|
6599
6782
|
this.get('eventBus').on(type, priority, handler);
|
|
6600
6783
|
}
|
|
6601
6784
|
|
|
6602
|
-
/**
|
|
6603
|
-
* @internal
|
|
6785
|
+
/**
|
|
6786
|
+
* @internal
|
|
6604
6787
|
*/
|
|
6605
6788
|
_getSubmitData() {
|
|
6606
6789
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6628,16 +6811,16 @@ class Form {
|
|
|
6628
6811
|
return filteredSubmitData;
|
|
6629
6812
|
}
|
|
6630
6813
|
|
|
6631
|
-
/**
|
|
6632
|
-
* @internal
|
|
6814
|
+
/**
|
|
6815
|
+
* @internal
|
|
6633
6816
|
*/
|
|
6634
6817
|
_applyConditions(toFilter, data, options = {}) {
|
|
6635
6818
|
const conditionChecker = this.get('conditionChecker');
|
|
6636
6819
|
return conditionChecker.applyConditions(toFilter, data, options);
|
|
6637
6820
|
}
|
|
6638
6821
|
|
|
6639
|
-
/**
|
|
6640
|
-
* @internal
|
|
6822
|
+
/**
|
|
6823
|
+
* @internal
|
|
6641
6824
|
*/
|
|
6642
6825
|
_initializeFieldData(data) {
|
|
6643
6826
|
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
@@ -6674,7 +6857,7 @@ class Form {
|
|
|
6674
6857
|
}
|
|
6675
6858
|
}
|
|
6676
6859
|
|
|
6677
|
-
const schemaVersion =
|
|
6860
|
+
const schemaVersion = 12;
|
|
6678
6861
|
|
|
6679
6862
|
/**
|
|
6680
6863
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -6710,6 +6893,8 @@ exports.DATE_DISALLOW_PAST_PATH = DATE_DISALLOW_PAST_PATH;
|
|
|
6710
6893
|
exports.DATE_LABEL_PATH = DATE_LABEL_PATH;
|
|
6711
6894
|
exports.Datetime = Datetime;
|
|
6712
6895
|
exports.Default = FormComponent$1;
|
|
6896
|
+
exports.Description = Description;
|
|
6897
|
+
exports.Errors = Errors;
|
|
6713
6898
|
exports.ExpressionLanguageModule = ExpressionLanguageModule;
|
|
6714
6899
|
exports.FeelExpressionLanguage = FeelExpressionLanguage;
|
|
6715
6900
|
exports.FeelersTemplating = FeelersTemplating;
|
|
@@ -6725,6 +6910,7 @@ exports.FormRenderContext = FormRenderContext$1;
|
|
|
6725
6910
|
exports.Group = Group;
|
|
6726
6911
|
exports.Image = Image;
|
|
6727
6912
|
exports.Importer = Importer;
|
|
6913
|
+
exports.Label = Label;
|
|
6728
6914
|
exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
|
|
6729
6915
|
exports.MarkdownModule = MarkdownModule;
|
|
6730
6916
|
exports.MarkdownRenderer = MarkdownRenderer;
|
|
@@ -6732,6 +6918,7 @@ exports.Numberfield = Numberfield;
|
|
|
6732
6918
|
exports.PathRegistry = PathRegistry;
|
|
6733
6919
|
exports.Radio = Radio;
|
|
6734
6920
|
exports.Select = Select;
|
|
6921
|
+
exports.Separator = Separator;
|
|
6735
6922
|
exports.Spacer = Spacer;
|
|
6736
6923
|
exports.TIME_INTERVAL_PATH = TIME_INTERVAL_PATH;
|
|
6737
6924
|
exports.TIME_LABEL_PATH = TIME_LABEL_PATH;
|
|
@@ -6764,5 +6951,7 @@ exports.isRequired = isRequired;
|
|
|
6764
6951
|
exports.pathParse = pathParse;
|
|
6765
6952
|
exports.pathsEqual = pathsEqual;
|
|
6766
6953
|
exports.runRecursively = runRecursively;
|
|
6954
|
+
exports.sanitizeHTML = sanitizeHTML;
|
|
6955
|
+
exports.sanitizeImageSource = sanitizeImageSource;
|
|
6767
6956
|
exports.schemaVersion = schemaVersion;
|
|
6768
6957
|
//# sourceMappingURL=index.cjs.map
|