@bpmn-io/form-js-viewer 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -189
- package/dist/assets/form-js-base.css +47 -39
- package/dist/assets/form-js.css +11 -26
- package/dist/index.cjs +222 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +221 -173
- package/dist/index.es.js.map +1 -1
- package/dist/types/Form.d.ts +8 -11
- package/dist/types/core/FormFieldInstanceRegistry.d.ts +15 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/features/expressionField/ExpressionLoopPreventer.d.ts +18 -0
- package/dist/types/features/expressionField/index.d.ts +6 -0
- package/dist/types/features/expressionLanguage/FeelersTemplating.d.ts +4 -4
- package/dist/types/features/index.d.ts +2 -0
- package/dist/types/types.d.ts +34 -36
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ var isEqual = require('lodash/isEqual');
|
|
|
11
11
|
var flatpickr = require('flatpickr');
|
|
12
12
|
var React = require('preact/compat');
|
|
13
13
|
var DOMPurify = require('dompurify');
|
|
14
|
+
var lodash = require('lodash');
|
|
14
15
|
var didi = require('didi');
|
|
15
16
|
var feelin = require('feelin');
|
|
16
17
|
var feelers = require('feelers');
|
|
@@ -372,10 +373,10 @@ class FeelersTemplating {
|
|
|
372
373
|
}
|
|
373
374
|
|
|
374
375
|
/**
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
* @typedef {Object} ExpressionWithDepth
|
|
377
|
+
* @property {number} depth - The depth of the expression in the syntax tree.
|
|
378
|
+
* @property {string} expression - The extracted expression
|
|
379
|
+
*/
|
|
379
380
|
|
|
380
381
|
/**
|
|
381
382
|
* Extracts all feel expressions in the template along with their depth in the syntax tree.
|
|
@@ -1029,11 +1030,11 @@ const getDOMPurifyConfig = sanitizeStyleTags => {
|
|
|
1029
1030
|
};
|
|
1030
1031
|
};
|
|
1031
1032
|
|
|
1032
|
-
/**
|
|
1033
|
-
* A custom hook to build up security attributes from form configuration.
|
|
1034
|
-
*
|
|
1035
|
-
* @param {Object} security - The security configuration.
|
|
1036
|
-
* @returns {Array} - Returns a tuple with sandbox and allow attributes.
|
|
1033
|
+
/**
|
|
1034
|
+
* A custom hook to build up security attributes from form configuration.
|
|
1035
|
+
*
|
|
1036
|
+
* @param {Object} security - The security configuration.
|
|
1037
|
+
* @returns {Array} - Returns a tuple with sandbox and allow attributes.
|
|
1037
1038
|
*/
|
|
1038
1039
|
function useSecurityAttributesMap(security) {
|
|
1039
1040
|
const securityMemoized = useDeepCompareMemoize(security);
|
|
@@ -1960,6 +1961,7 @@ function FormField(props) {
|
|
|
1960
1961
|
} = props;
|
|
1961
1962
|
const formFields = useService('formFields'),
|
|
1962
1963
|
viewerCommands = useService('viewerCommands', false),
|
|
1964
|
+
formFieldInstanceRegistry = useService('formFieldInstanceRegistry', false),
|
|
1963
1965
|
pathRegistry = useService('pathRegistry'),
|
|
1964
1966
|
eventBus = useService('eventBus'),
|
|
1965
1967
|
form = useService('form');
|
|
@@ -1986,6 +1988,7 @@ function FormField(props) {
|
|
|
1986
1988
|
throw new Error(`cannot render field <${field.type}>`);
|
|
1987
1989
|
}
|
|
1988
1990
|
const fieldConfig = FormFieldComponent.config;
|
|
1991
|
+
const localExpressionContext = hooks.useContext(LocalExpressionContext);
|
|
1989
1992
|
const valuePath = hooks.useMemo(() => pathRegistry.getValuePath(field, {
|
|
1990
1993
|
indexes
|
|
1991
1994
|
}), [field, indexes, pathRegistry]);
|
|
@@ -1995,6 +1998,22 @@ function FormField(props) {
|
|
|
1995
1998
|
|
|
1996
1999
|
// add precedence: global readonly > form field disabled
|
|
1997
2000
|
const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
|
|
2001
|
+
const hidden = useCondition(field.conditional && field.conditional.hide || null);
|
|
2002
|
+
|
|
2003
|
+
// register form field instance
|
|
2004
|
+
hooks.useEffect(() => {
|
|
2005
|
+
if (formFieldInstanceRegistry && !hidden) {
|
|
2006
|
+
const instanceId = formFieldInstanceRegistry.add({
|
|
2007
|
+
id: field.id,
|
|
2008
|
+
expressionContextInfo: localExpressionContext,
|
|
2009
|
+
valuePath,
|
|
2010
|
+
indexes
|
|
2011
|
+
});
|
|
2012
|
+
return () => {
|
|
2013
|
+
formFieldInstanceRegistry.remove(instanceId);
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
}, [formFieldInstanceRegistry, field.id, localExpressionContext, valuePath, indexes, hidden]);
|
|
1998
2017
|
|
|
1999
2018
|
// ensures the initial validation behavior can be re-triggered upon form reset
|
|
2000
2019
|
hooks.useEffect(() => {
|
|
@@ -2033,7 +2052,6 @@ function FormField(props) {
|
|
|
2033
2052
|
formField: field
|
|
2034
2053
|
});
|
|
2035
2054
|
}, [eventBus, field]);
|
|
2036
|
-
const hidden = useCondition(field.conditional && field.conditional.hide || null);
|
|
2037
2055
|
const onChangeIndexed = hooks.useCallback(update => {
|
|
2038
2056
|
// any data change will trigger validation
|
|
2039
2057
|
setInitialValidationTrigger(false);
|
|
@@ -2178,7 +2196,7 @@ function RowsRenderer(props) {
|
|
|
2178
2196
|
Row
|
|
2179
2197
|
} = hooks.useContext(FormRenderContext);
|
|
2180
2198
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2181
|
-
children: [
|
|
2199
|
+
children: [' ', rows.map(row => {
|
|
2182
2200
|
const {
|
|
2183
2201
|
components = []
|
|
2184
2202
|
} = row;
|
|
@@ -2204,7 +2222,7 @@ function RowsRenderer(props) {
|
|
|
2204
2222
|
});
|
|
2205
2223
|
})
|
|
2206
2224
|
});
|
|
2207
|
-
}),
|
|
2225
|
+
}), ' ']
|
|
2208
2226
|
});
|
|
2209
2227
|
}
|
|
2210
2228
|
|
|
@@ -2334,23 +2352,23 @@ function InputAdorner(props) {
|
|
|
2334
2352
|
'fjs-disabled': disabled,
|
|
2335
2353
|
'fjs-readonly': readonly
|
|
2336
2354
|
}, {
|
|
2337
|
-
|
|
2355
|
+
hasErrors: hasErrors
|
|
2338
2356
|
}),
|
|
2339
2357
|
ref: rootRef,
|
|
2340
2358
|
children: [pre && jsxRuntime.jsxs("span", {
|
|
2341
2359
|
class: "fjs-input-adornment border-right border-radius-left",
|
|
2342
2360
|
onClick: onAdornmentClick,
|
|
2343
|
-
children: [
|
|
2361
|
+
children: [' ', minDash.isString(pre) ? jsxRuntime.jsx("span", {
|
|
2344
2362
|
class: "fjs-input-adornment-text",
|
|
2345
2363
|
children: pre
|
|
2346
|
-
}) : pre,
|
|
2364
|
+
}) : pre, ' ']
|
|
2347
2365
|
}), children, post && jsxRuntime.jsxs("span", {
|
|
2348
2366
|
class: "fjs-input-adornment border-left border-radius-right",
|
|
2349
2367
|
onClick: onAdornmentClick,
|
|
2350
|
-
children: [
|
|
2368
|
+
children: [' ', minDash.isString(post) ? jsxRuntime.jsx("span", {
|
|
2351
2369
|
class: "fjs-input-adornment-text",
|
|
2352
2370
|
children: post
|
|
2353
|
-
}) : post,
|
|
2371
|
+
}) : post, ' ']
|
|
2354
2372
|
})]
|
|
2355
2373
|
});
|
|
2356
2374
|
}
|
|
@@ -2399,7 +2417,9 @@ function Datepicker(props) {
|
|
|
2399
2417
|
clickOpens: false,
|
|
2400
2418
|
// TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
|
|
2401
2419
|
minDate: disallowPassedDates ? 'today' : '01/01/1900',
|
|
2402
|
-
errorHandler: () => {
|
|
2420
|
+
errorHandler: () => {
|
|
2421
|
+
/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */
|
|
2422
|
+
}
|
|
2403
2423
|
};
|
|
2404
2424
|
const instance = flatpickr(dateInputRef.current, config);
|
|
2405
2425
|
setFlatpickrInstance(instance);
|
|
@@ -2504,7 +2524,7 @@ function Datepicker(props) {
|
|
|
2504
2524
|
});
|
|
2505
2525
|
}
|
|
2506
2526
|
|
|
2507
|
-
var _path$v, _path2$
|
|
2527
|
+
var _path$v, _path2$4;
|
|
2508
2528
|
function _extends$w() { _extends$w = 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$w.apply(this, arguments); }
|
|
2509
2529
|
var SvgClock = function SvgClock(props) {
|
|
2510
2530
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
|
|
@@ -2516,7 +2536,7 @@ var SvgClock = function SvgClock(props) {
|
|
|
2516
2536
|
}, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2517
2537
|
fill: "currentColor",
|
|
2518
2538
|
d: "M13 14.41 18.59 20 20 18.59l-5-5.01V5h-2v9.41Z"
|
|
2519
|
-
})), _path2$
|
|
2539
|
+
})), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2520
2540
|
fill: "currentColor",
|
|
2521
2541
|
fillRule: "evenodd",
|
|
2522
2542
|
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",
|
|
@@ -2607,7 +2627,7 @@ function DropdownList(props) {
|
|
|
2607
2627
|
children: [values.length > 0 && values.map((v, i) => {
|
|
2608
2628
|
return jsxRuntime.jsx("div", {
|
|
2609
2629
|
class: classNames('fjs-dropdownlist-item', {
|
|
2610
|
-
|
|
2630
|
+
focused: focusedValueIndex === i
|
|
2611
2631
|
}),
|
|
2612
2632
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2613
2633
|
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
@@ -2759,11 +2779,9 @@ function Timepicker(props) {
|
|
|
2759
2779
|
disabled: disabled,
|
|
2760
2780
|
readOnly: readonly,
|
|
2761
2781
|
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
2762
|
-
autoComplete: "off"
|
|
2763
|
-
|
|
2764
|
-
// @ts-ignore
|
|
2765
|
-
,
|
|
2782
|
+
autoComplete: "off",
|
|
2766
2783
|
onInput: e => {
|
|
2784
|
+
// @ts-expect-error
|
|
2767
2785
|
setRawValue(e.target.value);
|
|
2768
2786
|
useDropdown && setDropdownIsOpen(false);
|
|
2769
2787
|
},
|
|
@@ -3162,7 +3180,7 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3162
3180
|
};
|
|
3163
3181
|
var ChecklistIcon = SvgChecklist;
|
|
3164
3182
|
|
|
3165
|
-
var _path$r, _path2$
|
|
3183
|
+
var _path$r, _path2$3, _path3;
|
|
3166
3184
|
function _extends$s() { _extends$s = 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$s.apply(this, arguments); }
|
|
3167
3185
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3168
3186
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
|
|
@@ -3173,7 +3191,7 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3173
3191
|
}, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3174
3192
|
fillRule: "evenodd",
|
|
3175
3193
|
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"
|
|
3176
|
-
})), _path2$
|
|
3194
|
+
})), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3177
3195
|
d: "m35.13 37.603 1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984Z"
|
|
3178
3196
|
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3179
3197
|
fillRule: "evenodd",
|
|
@@ -3182,7 +3200,7 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3182
3200
|
};
|
|
3183
3201
|
var DatetimeIcon = SvgDatetime;
|
|
3184
3202
|
|
|
3185
|
-
var _path$q, _path2$
|
|
3203
|
+
var _path$q, _path2$2;
|
|
3186
3204
|
function _extends$r() { _extends$r = 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$r.apply(this, arguments); }
|
|
3187
3205
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3188
3206
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
|
|
@@ -3193,7 +3211,7 @@ var SvgTaglist = function SvgTaglist(props) {
|
|
|
3193
3211
|
}, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3194
3212
|
fillRule: "evenodd",
|
|
3195
3213
|
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"
|
|
3196
|
-
})), _path2$
|
|
3214
|
+
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3197
3215
|
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"
|
|
3198
3216
|
})));
|
|
3199
3217
|
};
|
|
@@ -3235,10 +3253,12 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3235
3253
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3236
3254
|
width: 54,
|
|
3237
3255
|
height: 54,
|
|
3238
|
-
fill: "
|
|
3256
|
+
fill: "none"
|
|
3239
3257
|
}, props), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3258
|
+
fill: "#000",
|
|
3240
3259
|
fillRule: "evenodd",
|
|
3241
|
-
d: "
|
|
3260
|
+
d: "M4.05 42.132v1.164c0 .693.604 1.254 1.35 1.254h1.35v-2.507h-2.7v.09Zm0-2.328h2.7v-2.328h-2.7v2.328Zm0-4.656h2.7V32.82h-2.7v2.328Zm0-4.656h2.7v-2.328h-2.7v2.328Zm0-4.656h2.7v-2.328h-2.7v2.328Zm0-4.656h2.7v-2.328h-2.7v2.328Zm0-4.656h2.7v-2.328h-2.7v2.328Zm0-4.656v.09h2.7V9.45H5.4c-.746 0-1.35.561-1.35 1.254v1.164Zm5.4-2.418v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7V9.45h-2.7Zm5.4 0v2.507h2.7v-1.253c0-.693-.604-1.254-1.35-1.254h-1.35Zm2.7 4.746h-2.7v2.328h2.7v-2.328Zm0 4.656h-2.7v2.328h2.7v-2.328Zm0 4.656h-2.7v2.328h2.7v-2.328Zm0 4.656h-2.7v2.328h2.7v-2.328Zm0 4.656h-2.7v2.328h2.7V32.82Zm0 4.656h-2.7v2.328h2.7v-2.328Zm0 4.656v-.09h-2.7v2.508h1.35c.746 0 1.35-.561 1.35-1.254v-1.164Zm-5.4 2.418v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Zm-5.4 0v-2.507h-2.7v2.507h2.7Z",
|
|
3261
|
+
clipRule: "evenodd"
|
|
3242
3262
|
})));
|
|
3243
3263
|
};
|
|
3244
3264
|
var GroupIcon = SvgGroup;
|
|
@@ -3328,7 +3348,7 @@ var SvgDynamicList = function SvgDynamicList(props) {
|
|
|
3328
3348
|
}, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3329
3349
|
fill: "currentColor",
|
|
3330
3350
|
fillRule: "evenodd",
|
|
3331
|
-
d: "M2.7 43.296v1.254c0 .746.604 1.35 1.35 1.35h1.275v-1.795c.049.14.075.29.075.445v-1.254h-.075V43.2H4.05c.177 0 .347.034.502.096H2.7Zm2.7-2.507v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.015V23.24H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014V13.21H2.7v2.507h2.7Zm-2.7-5.014h1.852a1.346 1.346 0 0 1-.502.096h1.275v-.096H5.4V9.45c0 .156-.026.306-.075.445V8.1H4.05A1.35 1.35 0 0 0 2.7 9.45v1.254Zm5.175.096h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1-2.7v1.795a1.348 1.348 0 0 1-.075-.445v1.254h.075v.096h1.
|
|
3351
|
+
d: "M2.7 43.296v1.254c0 .746.604 1.35 1.35 1.35h1.275v-1.795c.049.14.075.29.075.445v-1.254h-.075V43.2H4.05c.177 0 .347.034.502.096H2.7Zm2.7-2.507v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.015V23.24H2.7v2.507h2.7Zm0-5.014v-2.507H2.7v2.507h2.7Zm0-5.014V13.21H2.7v2.507h2.7Zm-2.7-5.014h1.852a1.346 1.346 0 0 1-.502.096h1.275v-.096H5.4V9.45c0 .156-.026.306-.075.445V8.1H4.05A1.35 1.35 0 0 0 2.7 9.45v1.254Zm5.175.096h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1 0h2.55V8.1h-2.55v2.7Zm5.1-2.7v1.795a1.348 1.348 0 0 1-.075-.445v1.254h.075v.096h1.275a1.35 1.35 0 0 1-.502-.096H51.3V9.45a1.35 1.35 0 0 0-1.35-1.35h-1.275Zm-.075 5.11v2.508h2.7V13.21h-2.7Zm0 5.015v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7V23.24h-2.7Zm0 5.015v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7v-2.507h-2.7Zm0 5.014v2.507h2.7v-2.507h-2.7Zm2.7 5.014h-1.852a1.35 1.35 0 0 1 .502-.096h-1.275v.096H48.6v1.254c0-.156.026-.305.075-.445V45.9h1.275a1.35 1.35 0 0 0 1.35-1.35v-1.254Zm-5.175-.096h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7Zm-5.1 0h-2.55v2.7h2.55v-2.7ZM16.2 17.55a4.05 4.05 0 0 1 4.05 4.05v1.35A4.05 4.05 0 0 1 16.2 27h-1.35a4.05 4.05 0 0 1-4.05-4.05V21.6a4.05 4.05 0 0 1 4.05-4.05h1.35Zm0 2.7h-1.35a1.35 1.35 0 0 0-1.35 1.35v1.35c0 .746.604 1.35 1.35 1.35h1.35a1.35 1.35 0 0 0 1.35-1.35V21.6a1.35 1.35 0 0 0-1.35-1.35Zm27 1.35a4.05 4.05 0 0 0-4.05-4.05H29.7a4.05 4.05 0 0 0-4.05 4.05v1.35A4.05 4.05 0 0 0 29.7 27h9.45a4.05 4.05 0 0 0 4.05-4.05V21.6Zm-13.5-1.35h9.45c.746 0 1.35.604 1.35 1.35v1.35a1.35 1.35 0 0 1-1.35 1.35H29.7a1.35 1.35 0 0 1-1.35-1.35V21.6c0-.746.604-1.35 1.35-1.35ZM43.2 37.8a4.05 4.05 0 0 0-4.05-4.05H29.7a4.05 4.05 0 0 0-4.05 4.05v1.35h2.7V37.8c0-.746.604-1.35 1.35-1.35h9.45c.746 0 1.35.604 1.35 1.35v1.35h2.7V37.8Zm-27-4.05a4.05 4.05 0 0 1 4.05 4.05v1.35h-2.7V37.8a1.35 1.35 0 0 0-1.35-1.35h-1.35a1.35 1.35 0 0 0-1.35 1.35v1.35h-2.7V37.8a4.05 4.05 0 0 1 4.05-4.05h1.35Z",
|
|
3332
3352
|
clipRule: "evenodd"
|
|
3333
3353
|
})));
|
|
3334
3354
|
};
|
|
@@ -3412,7 +3432,7 @@ var SvgTextarea = function SvgTextarea(props) {
|
|
|
3412
3432
|
};
|
|
3413
3433
|
var TextareaIcon = SvgTextarea;
|
|
3414
3434
|
|
|
3415
|
-
var _path$d
|
|
3435
|
+
var _path$d;
|
|
3416
3436
|
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); }
|
|
3417
3437
|
var SvgIFrame = function SvgIFrame(props) {
|
|
3418
3438
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$d({
|
|
@@ -3421,12 +3441,9 @@ var SvgIFrame = function SvgIFrame(props) {
|
|
|
3421
3441
|
height: 54,
|
|
3422
3442
|
fill: "none"
|
|
3423
3443
|
}, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3424
|
-
fill: "
|
|
3425
|
-
d: "M34.467 37.3 41 31l-6.533-6.3-1.32 1.273L38.36 31l-5.213 5.027 1.32 1.273ZM19.533 24.7 13 31l6.533 6.3 1.32-1.273L15.64 31l5.214-5.027-1.32-1.273Zm4.127 14.832 1.805.468 4.875-17.532L28.535 22 23.66 39.532Z"
|
|
3426
|
-
})), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
3427
|
-
fill: "currentcolor",
|
|
3444
|
+
fill: "currentColor",
|
|
3428
3445
|
fillRule: "evenodd",
|
|
3429
|
-
d: "
|
|
3446
|
+
d: "M45.658 9.45c1.625 0 2.942 1.36 2.942 3.039V22.95h-1.961v-4.383H7.36V41.51c0 .56.44 1.013.98 1.013H27v2.026H8.342c-1.625 0-2.942-1.36-2.942-3.039V12.489c0-1.678 1.317-3.039 2.942-3.039h37.316Zm0 2.026H8.342c-.542 0-.98.454-.98 1.013v4.052h39.277v-4.052c0-.56-.44-1.013-.98-1.013ZM31.05 35.775A8.768 8.768 0 0 1 39.825 27a8.768 8.768 0 0 1 8.775 8.775 8.768 8.768 0 0 1-8.775 8.775 8.768 8.768 0 0 1-8.775-8.775Zm12.388-.516h3.097c-.206-2.581-1.858-4.646-4.026-5.678.62 1.548.93 3.613.93 5.678Zm-5.162 2.065c.207 3.303 1.136 4.955 1.549 5.161.413-.206 1.239-1.858 1.445-5.161h-2.994Zm1.446-8.26c-.31.207-1.342 2.272-1.446 6.195h2.994c-.103-3.923-1.135-5.988-1.548-6.194Zm-3.51 6.195c.103-2.065.31-4.13.929-5.678-2.168 1.032-3.82 3.097-4.026 5.678h3.097Zm0 2.065h-2.89c.515 2.064 1.96 3.82 3.819 4.645-.516-1.342-.826-2.994-.93-4.645Zm7.226 0c-.103 1.755-.413 3.303-.929 4.645 1.858-.826 3.304-2.58 3.923-4.645h-2.994Z",
|
|
3430
3447
|
clipRule: "evenodd"
|
|
3431
3448
|
})));
|
|
3432
3449
|
};
|
|
@@ -3797,7 +3814,7 @@ function Numberfield(props) {
|
|
|
3797
3814
|
'fjs-disabled': disabled,
|
|
3798
3815
|
'fjs-readonly': readonly
|
|
3799
3816
|
}, {
|
|
3800
|
-
|
|
3817
|
+
hasErrors: errors.length
|
|
3801
3818
|
}),
|
|
3802
3819
|
children: [jsxRuntime.jsx("input", {
|
|
3803
3820
|
ref: inputRef,
|
|
@@ -3809,7 +3826,6 @@ function Numberfield(props) {
|
|
|
3809
3826
|
onKeyPress: onKeyPress,
|
|
3810
3827
|
onBlur: onInputBlur,
|
|
3811
3828
|
onFocus: onInputFocus
|
|
3812
|
-
|
|
3813
3829
|
// @ts-ignore
|
|
3814
3830
|
,
|
|
3815
3831
|
onInput: e => setValue(e.target.value, true),
|
|
@@ -4118,10 +4134,10 @@ function SearchableSelect(props) {
|
|
|
4118
4134
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4119
4135
|
children: [jsxRuntime.jsxs("div", {
|
|
4120
4136
|
class: classNames('fjs-input-group', {
|
|
4121
|
-
|
|
4122
|
-
|
|
4137
|
+
disabled: disabled,
|
|
4138
|
+
readonly: readonly
|
|
4123
4139
|
}, {
|
|
4124
|
-
|
|
4140
|
+
hasErrors: errors.length
|
|
4125
4141
|
}),
|
|
4126
4142
|
children: [jsxRuntime.jsx("input", {
|
|
4127
4143
|
disabled: disabled,
|
|
@@ -4145,7 +4161,7 @@ function SearchableSelect(props) {
|
|
|
4145
4161
|
setValue(null);
|
|
4146
4162
|
e.preventDefault();
|
|
4147
4163
|
},
|
|
4148
|
-
children: [jsxRuntime.jsx(XMarkIcon, {}),
|
|
4164
|
+
children: [jsxRuntime.jsx(XMarkIcon, {}), ' ']
|
|
4149
4165
|
}), jsxRuntime.jsx("span", {
|
|
4150
4166
|
class: "fjs-select-arrow",
|
|
4151
4167
|
onMouseDown: e => onAngelMouseDown(e),
|
|
@@ -4239,7 +4255,7 @@ function SimpleSelect(props) {
|
|
|
4239
4255
|
disabled,
|
|
4240
4256
|
readonly
|
|
4241
4257
|
}, {
|
|
4242
|
-
|
|
4258
|
+
hasErrors: errors.length
|
|
4243
4259
|
}),
|
|
4244
4260
|
onFocus: onInputFocus,
|
|
4245
4261
|
onBlur: onInputBlur,
|
|
@@ -4969,18 +4985,20 @@ function ExpressionField(props) {
|
|
|
4969
4985
|
const evaluation = useExpressionEvaluation(expression);
|
|
4970
4986
|
const evaluationMemo = useDeepCompareMemoize(evaluation);
|
|
4971
4987
|
const eventBus = useService('eventBus');
|
|
4988
|
+
const expressionLoopPreventer = useService('expressionLoopPreventer');
|
|
4972
4989
|
const sendValue = hooks.useCallback(() => {
|
|
4973
4990
|
onChange && onChange({
|
|
4974
4991
|
field,
|
|
4975
|
-
value: evaluationMemo
|
|
4992
|
+
value: evaluationMemo,
|
|
4993
|
+
shouldNotRecompute: true
|
|
4976
4994
|
});
|
|
4977
4995
|
}, [field, evaluationMemo, onChange]);
|
|
4978
4996
|
hooks.useEffect(() => {
|
|
4979
|
-
if (computeOn !== 'change' || evaluationMemo
|
|
4997
|
+
if (computeOn !== 'change' || lodash.isEqual(evaluationMemo, value) || !expressionLoopPreventer.registerExpressionExecution(this)) {
|
|
4980
4998
|
return;
|
|
4981
4999
|
}
|
|
4982
5000
|
sendValue();
|
|
4983
|
-
}
|
|
5001
|
+
});
|
|
4984
5002
|
hooks.useEffect(() => {
|
|
4985
5003
|
if (computeOn === 'presubmit') {
|
|
4986
5004
|
eventBus.on('presubmit', sendValue);
|
|
@@ -5645,7 +5663,7 @@ function Lightbox(props) {
|
|
|
5645
5663
|
style: "margin: 15px 20px 15px 10px; align-self: center; color: var(--cds-icon-primary, #404040)",
|
|
5646
5664
|
children: jsxRuntime.jsx(Logo, {})
|
|
5647
5665
|
}), jsxRuntime.jsxs("span", {
|
|
5648
|
-
children: ["Web-based tooling for BPMN, DMN, and forms powered by
|
|
5666
|
+
children: ["Web-based tooling for BPMN, DMN, and forms powered by", ' ', jsxRuntime.jsx("a", {
|
|
5649
5667
|
href: "https://bpmn.io",
|
|
5650
5668
|
target: "_blank",
|
|
5651
5669
|
rel: "noopener",
|
|
@@ -5735,7 +5753,12 @@ function FormComponent(props) {
|
|
|
5735
5753
|
});
|
|
5736
5754
|
}
|
|
5737
5755
|
|
|
5738
|
-
const formFields = [
|
|
5756
|
+
const formFields = [/* Input */
|
|
5757
|
+
Textfield, Textarea, Numberfield, Datetime, ExpressionField, /* Selection */
|
|
5758
|
+
Checkbox, Checklist, Radio, Select, Taglist, /* Presentation */
|
|
5759
|
+
Text, Image, Table, Html, Spacer, Separator, /* Containers */
|
|
5760
|
+
Group, DynamicList, IFrame, /* Other */
|
|
5761
|
+
Button, Default];
|
|
5739
5762
|
|
|
5740
5763
|
class FormFields {
|
|
5741
5764
|
constructor() {
|
|
@@ -5905,8 +5928,7 @@ class ConditionChecker {
|
|
|
5905
5928
|
const {
|
|
5906
5929
|
getFilterPath = (field, indexes) => this._pathRegistry.getValuePath(field, {
|
|
5907
5930
|
indexes
|
|
5908
|
-
})
|
|
5909
|
-
leafNodeDeletionOnly = false
|
|
5931
|
+
})
|
|
5910
5932
|
} = options;
|
|
5911
5933
|
const _applyConditionsWithinScope = (rootField, scopeContext, startHidden = false) => {
|
|
5912
5934
|
const {
|
|
@@ -5937,7 +5959,7 @@ class ConditionChecker {
|
|
|
5937
5959
|
context.isHidden = startHidden || context.isHidden || conditional && this._checkHideCondition(conditional, localExpressionContext);
|
|
5938
5960
|
|
|
5939
5961
|
// if a field is repeatable and visible, we need to implement custom recursion on its children
|
|
5940
|
-
if (isRepeatable &&
|
|
5962
|
+
if (isRepeatable && !context.isHidden) {
|
|
5941
5963
|
// prevent the regular recursion behavior of executeRecursivelyOnFields
|
|
5942
5964
|
context.preventRecursion = true;
|
|
5943
5965
|
const repeaterValuePath = this._pathRegistry.getValuePath(field, {
|
|
@@ -5969,7 +5991,7 @@ class ConditionChecker {
|
|
|
5969
5991
|
}
|
|
5970
5992
|
|
|
5971
5993
|
// if we have a hidden repeatable field, and the data structure allows, we clear it directly at the root and stop recursion
|
|
5972
|
-
if (context.isHidden &&
|
|
5994
|
+
if (context.isHidden && isRepeatable) {
|
|
5973
5995
|
context.preventRecursion = true;
|
|
5974
5996
|
this._cleanlyClearDataAtPath(getFilterPath(field, indexes), workingData);
|
|
5975
5997
|
}
|
|
@@ -6059,6 +6081,49 @@ const ExpressionLanguageModule = {
|
|
|
6059
6081
|
conditionChecker: ['type', ConditionChecker]
|
|
6060
6082
|
};
|
|
6061
6083
|
|
|
6084
|
+
class ExpressionLoopPreventer {
|
|
6085
|
+
constructor(eventBus) {
|
|
6086
|
+
this._computedExpressions = [];
|
|
6087
|
+
eventBus.on('field.updated', ({
|
|
6088
|
+
shouldNotRecompute
|
|
6089
|
+
}) => {
|
|
6090
|
+
if (shouldNotRecompute) {
|
|
6091
|
+
return;
|
|
6092
|
+
}
|
|
6093
|
+
this.reset();
|
|
6094
|
+
});
|
|
6095
|
+
eventBus.on('import.done', this.reset.bind(this));
|
|
6096
|
+
eventBus.on('reset', this.reset.bind(this));
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6099
|
+
/**
|
|
6100
|
+
* Checks if the expression field has already been computed, and registers it if not.
|
|
6101
|
+
*
|
|
6102
|
+
* @param {any} expressionField
|
|
6103
|
+
* @returns {boolean} - whether the expression field has already been computed within the current cycle
|
|
6104
|
+
*/
|
|
6105
|
+
registerExpressionExecution(expressionField) {
|
|
6106
|
+
if (this._computedExpressions.includes(expressionField)) {
|
|
6107
|
+
return false;
|
|
6108
|
+
}
|
|
6109
|
+
this._computedExpressions.push(expressionField);
|
|
6110
|
+
return true;
|
|
6111
|
+
}
|
|
6112
|
+
|
|
6113
|
+
/**
|
|
6114
|
+
* Resets the list of computed expressions.
|
|
6115
|
+
*/
|
|
6116
|
+
reset() {
|
|
6117
|
+
this._computedExpressions = [];
|
|
6118
|
+
}
|
|
6119
|
+
}
|
|
6120
|
+
ExpressionLoopPreventer.$inject = ['eventBus'];
|
|
6121
|
+
|
|
6122
|
+
const ExpressionFieldModule = {
|
|
6123
|
+
__init__: ['expressionLoopPreventer'],
|
|
6124
|
+
expressionLoopPreventer: ['type', ExpressionLoopPreventer]
|
|
6125
|
+
};
|
|
6126
|
+
|
|
6062
6127
|
class MarkdownRenderer {
|
|
6063
6128
|
/**
|
|
6064
6129
|
* Render markdown to HTML.
|
|
@@ -8233,6 +8298,62 @@ class FormFieldRegistry {
|
|
|
8233
8298
|
}
|
|
8234
8299
|
FormFieldRegistry.$inject = ['eventBus'];
|
|
8235
8300
|
|
|
8301
|
+
class FormFieldInstanceRegistry {
|
|
8302
|
+
constructor(eventBus, formFieldRegistry, formFields) {
|
|
8303
|
+
this._eventBus = eventBus;
|
|
8304
|
+
this._formFieldRegistry = formFieldRegistry;
|
|
8305
|
+
this._formFields = formFields;
|
|
8306
|
+
this._formFieldInstances = {};
|
|
8307
|
+
eventBus.on('form.clear', () => this.clear());
|
|
8308
|
+
}
|
|
8309
|
+
add(instance) {
|
|
8310
|
+
const {
|
|
8311
|
+
id,
|
|
8312
|
+
expressionContextInfo,
|
|
8313
|
+
valuePath,
|
|
8314
|
+
indexes
|
|
8315
|
+
} = instance;
|
|
8316
|
+
const instanceId = [id, ...Object.values(indexes || {})].join('_');
|
|
8317
|
+
if (this._formFieldInstances[instanceId]) {
|
|
8318
|
+
throw new Error('this form field instance is already registered');
|
|
8319
|
+
}
|
|
8320
|
+
this._formFieldInstances[instanceId] = {
|
|
8321
|
+
id,
|
|
8322
|
+
instanceId,
|
|
8323
|
+
expressionContextInfo,
|
|
8324
|
+
valuePath,
|
|
8325
|
+
indexes
|
|
8326
|
+
};
|
|
8327
|
+
return instanceId;
|
|
8328
|
+
}
|
|
8329
|
+
remove(instanceId) {
|
|
8330
|
+
if (!this._formFieldInstances[instanceId]) {
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
delete this._formFieldInstances[instanceId];
|
|
8334
|
+
}
|
|
8335
|
+
getAll() {
|
|
8336
|
+
return Object.values(this._formFieldInstances);
|
|
8337
|
+
}
|
|
8338
|
+
getAllKeyed() {
|
|
8339
|
+
return this.getAll().filter(({
|
|
8340
|
+
id
|
|
8341
|
+
}) => {
|
|
8342
|
+
const {
|
|
8343
|
+
type
|
|
8344
|
+
} = this._formFieldRegistry.get(id);
|
|
8345
|
+
const {
|
|
8346
|
+
config
|
|
8347
|
+
} = this._formFields.get(type);
|
|
8348
|
+
return config.keyed;
|
|
8349
|
+
});
|
|
8350
|
+
}
|
|
8351
|
+
clear() {
|
|
8352
|
+
this._formFieldInstances = {};
|
|
8353
|
+
}
|
|
8354
|
+
}
|
|
8355
|
+
FormFieldInstanceRegistry.$inject = ['eventBus', 'formFieldRegistry', 'formFields'];
|
|
8356
|
+
|
|
8236
8357
|
function Renderer(config, eventBus, form, injector) {
|
|
8237
8358
|
const App = () => {
|
|
8238
8359
|
const [state, setState] = hooks.useState(form._getState());
|
|
@@ -8297,6 +8418,7 @@ const CoreModule = {
|
|
|
8297
8418
|
importer: ['type', Importer],
|
|
8298
8419
|
fieldFactory: ['type', FieldFactory],
|
|
8299
8420
|
formFieldRegistry: ['type', FormFieldRegistry],
|
|
8421
|
+
formFieldInstanceRegistry: ['type', FormFieldInstanceRegistry],
|
|
8300
8422
|
pathRegistry: ['type', PathRegistry],
|
|
8301
8423
|
formLayouter: ['type', FormLayouter],
|
|
8302
8424
|
validator: ['type', Validator]
|
|
@@ -8471,73 +8593,39 @@ class Form {
|
|
|
8471
8593
|
* @returns {Errors}
|
|
8472
8594
|
*/
|
|
8473
8595
|
validate() {
|
|
8474
|
-
const
|
|
8475
|
-
|
|
8476
|
-
pathRegistry = this.get('pathRegistry'),
|
|
8596
|
+
const formFieldRegistry = this.get('formFieldRegistry'),
|
|
8597
|
+
formFieldInstanceRegistry = this.get('formFieldInstanceRegistry'),
|
|
8477
8598
|
validator = this.get('validator');
|
|
8478
8599
|
const {
|
|
8479
8600
|
data
|
|
8480
8601
|
} = this._getState();
|
|
8481
|
-
const
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
const
|
|
8489
|
-
config: fieldConfig
|
|
8490
|
-
} = formFields.get(type);
|
|
8602
|
+
const errors = {};
|
|
8603
|
+
const getErrorPath = (id, indexes) => [id, ...Object.values(indexes || {})];
|
|
8604
|
+
formFieldInstanceRegistry.getAllKeyed().forEach(({
|
|
8605
|
+
id,
|
|
8606
|
+
valuePath,
|
|
8607
|
+
indexes
|
|
8608
|
+
}) => {
|
|
8609
|
+
const field = formFieldRegistry.get(id);
|
|
8491
8610
|
|
|
8492
8611
|
// (1) Skip disabled fields
|
|
8493
|
-
if (disabled) {
|
|
8612
|
+
if (field.disabled) {
|
|
8494
8613
|
return;
|
|
8495
8614
|
}
|
|
8496
8615
|
|
|
8497
8616
|
// (2) Validate the field
|
|
8498
|
-
const
|
|
8499
|
-
|
|
8500
|
-
});
|
|
8501
|
-
const valueData = minDash.get(data, valuePath);
|
|
8502
|
-
const fieldErrors = validator.validateField(field, valueData);
|
|
8617
|
+
const value = minDash.get(data, valuePath);
|
|
8618
|
+
const fieldErrors = validator.validateField(field, value);
|
|
8503
8619
|
if (fieldErrors.length) {
|
|
8504
|
-
minDash.set(errors, getErrorPath(field, indexes), fieldErrors);
|
|
8505
|
-
}
|
|
8506
|
-
|
|
8507
|
-
// (3) Process parents
|
|
8508
|
-
if (!Array.isArray(field.components)) {
|
|
8509
|
-
return;
|
|
8510
|
-
}
|
|
8511
|
-
|
|
8512
|
-
// (4a) Recurse repeatable parents both across the indexes of repetition and the children
|
|
8513
|
-
if (fieldConfig.repeatable && isRepeating) {
|
|
8514
|
-
if (!Array.isArray(valueData)) {
|
|
8515
|
-
return;
|
|
8516
|
-
}
|
|
8517
|
-
valueData.forEach((_, index) => {
|
|
8518
|
-
field.components.forEach(component => {
|
|
8519
|
-
validateFieldRecursively(errors, component, {
|
|
8520
|
-
...indexes,
|
|
8521
|
-
[field.id]: index
|
|
8522
|
-
});
|
|
8523
|
-
});
|
|
8524
|
-
});
|
|
8525
|
-
return;
|
|
8620
|
+
minDash.set(errors, getErrorPath(field.id, indexes), fieldErrors);
|
|
8526
8621
|
}
|
|
8527
|
-
|
|
8528
|
-
// (4b) Recurse non-repeatable parents only across the children
|
|
8529
|
-
field.components.forEach(component => validateFieldRecursively(errors, component, indexes));
|
|
8530
|
-
}
|
|
8531
|
-
const workingErrors = {};
|
|
8532
|
-
validateFieldRecursively(workingErrors, formFieldRegistry.getForm());
|
|
8533
|
-
const filteredErrors = this._applyConditions(workingErrors, data, {
|
|
8534
|
-
getFilterPath: getErrorPath,
|
|
8535
|
-
leafNodeDeletionOnly: true
|
|
8536
8622
|
});
|
|
8537
8623
|
this._setState({
|
|
8538
|
-
errors
|
|
8624
|
+
errors
|
|
8539
8625
|
});
|
|
8540
|
-
|
|
8626
|
+
|
|
8627
|
+
// @ts-ignore
|
|
8628
|
+
return errors;
|
|
8541
8629
|
}
|
|
8542
8630
|
|
|
8543
8631
|
/**
|
|
@@ -8632,7 +8720,7 @@ class Form {
|
|
|
8632
8720
|
/**
|
|
8633
8721
|
* @internal
|
|
8634
8722
|
*
|
|
8635
|
-
* @param { {
|
|
8723
|
+
* @param { { field: any, indexes: object, value: any } } update
|
|
8636
8724
|
*/
|
|
8637
8725
|
_update(update) {
|
|
8638
8726
|
const {
|
|
@@ -8652,6 +8740,7 @@ class Form {
|
|
|
8652
8740
|
});
|
|
8653
8741
|
minDash.set(data, valuePath, value);
|
|
8654
8742
|
minDash.set(errors, [field.id, ...Object.values(indexes || {})], fieldErrors.length ? fieldErrors : undefined);
|
|
8743
|
+
this._emit('field.updated', update);
|
|
8655
8744
|
this._setState({
|
|
8656
8745
|
data: clone(data),
|
|
8657
8746
|
errors: clone(errors)
|
|
@@ -8677,10 +8766,10 @@ class Form {
|
|
|
8677
8766
|
}
|
|
8678
8767
|
|
|
8679
8768
|
/**
|
|
8680
|
-
|
|
8681
|
-
|
|
8769
|
+
* @internal
|
|
8770
|
+
*/
|
|
8682
8771
|
_getModules() {
|
|
8683
|
-
return [ExpressionLanguageModule, MarkdownRendererModule, ViewerCommandsModule, RepeatRenderModule];
|
|
8772
|
+
return [ExpressionLanguageModule, ExpressionFieldModule, MarkdownRendererModule, ViewerCommandsModule, RepeatRenderModule];
|
|
8684
8773
|
}
|
|
8685
8774
|
|
|
8686
8775
|
/**
|
|
@@ -8695,65 +8784,24 @@ class Form {
|
|
|
8695
8784
|
*/
|
|
8696
8785
|
_getSubmitData() {
|
|
8697
8786
|
const formFieldRegistry = this.get('formFieldRegistry');
|
|
8698
|
-
const
|
|
8699
|
-
const pathRegistry = this.get('pathRegistry');
|
|
8787
|
+
const formFieldInstanceRegistry = this.get('formFieldInstanceRegistry');
|
|
8700
8788
|
const formData = this._getState().data;
|
|
8701
|
-
|
|
8789
|
+
const submitData = {};
|
|
8790
|
+
formFieldInstanceRegistry.getAllKeyed().forEach(formFieldInstance => {
|
|
8702
8791
|
const {
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
} =
|
|
8792
|
+
id,
|
|
8793
|
+
valuePath
|
|
8794
|
+
} = formFieldInstance;
|
|
8706
8795
|
const {
|
|
8707
|
-
|
|
8708
|
-
} =
|
|
8709
|
-
|
|
8710
|
-
// (1) Process keyed fields
|
|
8711
|
-
if (!disabled && fieldConfig.keyed) {
|
|
8712
|
-
const valuePath = pathRegistry.getValuePath(formField, {
|
|
8713
|
-
indexes
|
|
8714
|
-
});
|
|
8715
|
-
const value = minDash.get(formData, valuePath);
|
|
8716
|
-
minDash.set(submitData, valuePath, value);
|
|
8717
|
-
}
|
|
8718
|
-
|
|
8719
|
-
// (2) Process parents
|
|
8720
|
-
if (!Array.isArray(formField.components)) {
|
|
8721
|
-
return;
|
|
8722
|
-
}
|
|
8723
|
-
|
|
8724
|
-
// (3a) Recurse repeatable parents both across the indexes of repetition and the children
|
|
8725
|
-
if (fieldConfig.repeatable && formField.isRepeating) {
|
|
8726
|
-
const valueData = minDash.get(formData, pathRegistry.getValuePath(formField, {
|
|
8727
|
-
indexes
|
|
8728
|
-
}));
|
|
8729
|
-
if (!Array.isArray(valueData)) {
|
|
8730
|
-
return;
|
|
8731
|
-
}
|
|
8732
|
-
valueData.forEach((_, index) => {
|
|
8733
|
-
formField.components.forEach(component => {
|
|
8734
|
-
collectSubmitDataRecursively(submitData, component, {
|
|
8735
|
-
...indexes,
|
|
8736
|
-
[formField.id]: index
|
|
8737
|
-
});
|
|
8738
|
-
});
|
|
8739
|
-
});
|
|
8796
|
+
disabled
|
|
8797
|
+
} = formFieldRegistry.get(id);
|
|
8798
|
+
if (disabled) {
|
|
8740
8799
|
return;
|
|
8741
8800
|
}
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
const workingSubmitData = {};
|
|
8747
|
-
collectSubmitDataRecursively(workingSubmitData, formFieldRegistry.getForm(), {});
|
|
8748
|
-
return this._applyConditions(workingSubmitData, formData);
|
|
8749
|
-
}
|
|
8750
|
-
|
|
8751
|
-
/**
|
|
8752
|
-
* @internal
|
|
8753
|
-
*/
|
|
8754
|
-
_applyConditions(toFilter, data, options = {}) {
|
|
8755
|
-
const conditionChecker = this.get('conditionChecker');
|
|
8756
|
-
return conditionChecker.applyConditions(toFilter, data, options);
|
|
8801
|
+
const value = minDash.get(formData, valuePath);
|
|
8802
|
+
minDash.set(submitData, valuePath, value);
|
|
8803
|
+
});
|
|
8804
|
+
return submitData;
|
|
8757
8805
|
}
|
|
8758
8806
|
|
|
8759
8807
|
/**
|
|
@@ -8848,16 +8896,16 @@ class Form {
|
|
|
8848
8896
|
|
|
8849
8897
|
const schemaVersion = 16;
|
|
8850
8898
|
|
|
8851
|
-
/**
|
|
8852
|
-
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
8899
|
+
/**
|
|
8900
|
+
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
8853
8901
|
*/
|
|
8854
8902
|
|
|
8855
|
-
/**
|
|
8856
|
-
* Create a form.
|
|
8857
|
-
*
|
|
8858
|
-
* @param {CreateFormOptions} options
|
|
8859
|
-
*
|
|
8860
|
-
* @return {Promise<Form>}
|
|
8903
|
+
/**
|
|
8904
|
+
* Create a form.
|
|
8905
|
+
*
|
|
8906
|
+
* @param {CreateFormOptions} options
|
|
8907
|
+
*
|
|
8908
|
+
* @return {Promise<Form>}
|
|
8861
8909
|
*/
|
|
8862
8910
|
function createForm(options) {
|
|
8863
8911
|
const {
|
|
@@ -8887,7 +8935,9 @@ exports.Description = Description;
|
|
|
8887
8935
|
exports.DynamicList = DynamicList;
|
|
8888
8936
|
exports.Errors = Errors;
|
|
8889
8937
|
exports.ExpressionField = ExpressionField;
|
|
8938
|
+
exports.ExpressionFieldModule = ExpressionFieldModule;
|
|
8890
8939
|
exports.ExpressionLanguageModule = ExpressionLanguageModule;
|
|
8940
|
+
exports.ExpressionLoopPreventer = ExpressionLoopPreventer;
|
|
8891
8941
|
exports.FeelExpressionLanguage = FeelExpressionLanguage;
|
|
8892
8942
|
exports.FeelersTemplating = FeelersTemplating;
|
|
8893
8943
|
exports.FieldFactory = FieldFactory;
|