@bpmn-io/form-js-viewer 1.11.0-alpha.0 → 1.11.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/README.md +1 -0
- package/dist/assets/form-js-base.css +5 -0
- package/dist/assets/form-js.css +5 -0
- package/dist/index.cjs +316 -427
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +316 -427
- package/dist/index.es.js.map +1 -1
- package/dist/types/Form.d.ts +1 -2
- package/dist/types/core/FieldFactory.d.ts +1 -1
- package/dist/types/core/FormFieldInstanceRegistry.d.ts +2 -3
- package/dist/types/core/index.d.ts +0 -1
- package/dist/types/features/repeatRender/RepeatRenderManager.d.ts +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/types/render/components/Util.d.ts +1 -0
- package/dist/types/render/components/form-fields/Button.d.ts +2 -1
- package/dist/types/render/components/form-fields/Checkbox.d.ts +4 -2
- package/dist/types/render/components/form-fields/Checklist.d.ts +2 -3
- package/dist/types/render/components/form-fields/Datetime.d.ts +3 -2
- package/dist/types/render/components/form-fields/Default.d.ts +1 -0
- package/dist/types/render/components/form-fields/DynamicList.d.ts +2 -1
- package/dist/types/render/components/form-fields/ExpressionField.d.ts +1 -1
- package/dist/types/render/components/form-fields/FilePicker.d.ts +5 -4
- package/dist/types/render/components/form-fields/Group.d.ts +2 -1
- package/dist/types/render/components/form-fields/Html.d.ts +1 -1
- package/dist/types/render/components/form-fields/IFrame.d.ts +2 -1
- package/dist/types/render/components/form-fields/Image.d.ts +2 -1
- package/dist/types/render/components/form-fields/Number.d.ts +4 -2
- package/dist/types/render/components/form-fields/Radio.d.ts +2 -3
- package/dist/types/render/components/form-fields/Select.d.ts +2 -3
- package/dist/types/render/components/form-fields/Separator.d.ts +1 -1
- package/dist/types/render/components/form-fields/Spacer.d.ts +1 -1
- package/dist/types/render/components/form-fields/Table.d.ts +2 -1
- package/dist/types/render/components/form-fields/Taglist.d.ts +2 -3
- package/dist/types/render/components/form-fields/Text.d.ts +2 -1
- package/dist/types/render/components/form-fields/Textarea.d.ts +4 -2
- package/dist/types/render/components/form-fields/Textfield.d.ts +4 -2
- package/dist/types/render/components/index.d.ts +1 -1
- package/dist/types/render/hooks/index.d.ts +0 -1
- package/dist/types/render/hooks/useExpressionEvaluation.d.ts +4 -3
- package/dist/types/render/hooks/useService.d.ts +1 -7
- package/dist/types/render/index.d.ts +0 -2
- package/dist/types/util/expressions.d.ts +4 -3
- package/package.json +8 -8
- package/dist/types/render/FileRegistry.d.ts +0 -52
- package/dist/types/render/hooks/useBooleanExpressionEvaluation.d.ts +0 -9
- package/dist/types/util/constants/FilePickerConstants.d.ts +0 -1
- package/dist/types/util/extractFileReferencesFromRemovedData.d.ts +0 -7
package/dist/index.es.js
CHANGED
|
@@ -571,6 +571,18 @@ function gridColumnClasses(formField) {
|
|
|
571
571
|
// always fall back to top-down on smallest screens
|
|
572
572
|
'cds--col-sm-16', 'cds--col-md-16');
|
|
573
573
|
}
|
|
574
|
+
function textToLabel(text) {
|
|
575
|
+
if (typeof text != 'string') return null;
|
|
576
|
+
for (const line of text.split('\n')) {
|
|
577
|
+
const displayLine = line.trim();
|
|
578
|
+
|
|
579
|
+
// we use the first non-whitespace line in the text as label
|
|
580
|
+
if (displayLine !== '') {
|
|
581
|
+
return displayLine;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
574
586
|
function prefixId(id, formId, indexes) {
|
|
575
587
|
let result = 'fjs-form';
|
|
576
588
|
if (formId) {
|
|
@@ -645,12 +657,6 @@ const FormContext = createContext({
|
|
|
645
657
|
formId: null
|
|
646
658
|
});
|
|
647
659
|
|
|
648
|
-
/**
|
|
649
|
-
* @template T
|
|
650
|
-
* @param {string} type
|
|
651
|
-
* @param {boolean} [strict=true]
|
|
652
|
-
* @returns {T | null}
|
|
653
|
-
*/
|
|
654
660
|
function useService(type, strict) {
|
|
655
661
|
const {
|
|
656
662
|
getService
|
|
@@ -729,10 +735,11 @@ function buildExpressionContext(context) {
|
|
|
729
735
|
}
|
|
730
736
|
|
|
731
737
|
/**
|
|
732
|
-
*
|
|
738
|
+
* Evaluate a string based on the expressionLanguage and context information.
|
|
739
|
+
* If the string is not an expression, it is returned as is.
|
|
733
740
|
*
|
|
734
741
|
* @param {any} expressionLanguage - The expression language to use.
|
|
735
|
-
* @param {
|
|
742
|
+
* @param {string} value - The string to evaluate.
|
|
736
743
|
* @param {Object} expressionContextInfo - The context information to use.
|
|
737
744
|
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
738
745
|
*/
|
|
@@ -863,10 +870,11 @@ function _isAllowedValue(value) {
|
|
|
863
870
|
}
|
|
864
871
|
|
|
865
872
|
/**
|
|
866
|
-
*
|
|
873
|
+
* Evaluate a string reactively based on the expressionLanguage and form data.
|
|
874
|
+
* If the string is not an expression, it is returned as is.
|
|
867
875
|
* The function is memoized to minimize re-renders.
|
|
868
876
|
*
|
|
869
|
-
* @param {
|
|
877
|
+
* @param {string} value - The string to evaluate.
|
|
870
878
|
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
871
879
|
*/
|
|
872
880
|
function useExpressionEvaluation(value) {
|
|
@@ -883,6 +891,7 @@ function useExpressionEvaluation(value) {
|
|
|
883
891
|
* @returns {T} - Returns the current state.
|
|
884
892
|
*/
|
|
885
893
|
function useDeepCompareMemoize(value) {
|
|
894
|
+
/** @type {import("preact").RefObject<T>} */
|
|
886
895
|
const ref = useRef();
|
|
887
896
|
if (!isEqual(value, ref.current)) {
|
|
888
897
|
ref.current = value;
|
|
@@ -1106,7 +1115,7 @@ function _isElementScrollable(el) {
|
|
|
1106
1115
|
}
|
|
1107
1116
|
|
|
1108
1117
|
const EMPTY_OBJECT = {};
|
|
1109
|
-
const EMPTY_ARRAY
|
|
1118
|
+
const EMPTY_ARRAY = [];
|
|
1110
1119
|
|
|
1111
1120
|
/**
|
|
1112
1121
|
* Custom hook to scroll an element within a scrollable container.
|
|
@@ -1122,7 +1131,7 @@ const EMPTY_ARRAY$2 = [];
|
|
|
1122
1131
|
*/
|
|
1123
1132
|
function useScrollIntoView(scrolledElementRef, deps, scrollOptions, flagRefs) {
|
|
1124
1133
|
const _scrollOptions = scrollOptions || EMPTY_OBJECT;
|
|
1125
|
-
const _flagRefs = flagRefs || EMPTY_ARRAY
|
|
1134
|
+
const _flagRefs = flagRefs || EMPTY_ARRAY;
|
|
1126
1135
|
useEffect(() => {
|
|
1127
1136
|
// return early if flags are not raised, or component is not mounted
|
|
1128
1137
|
if (some(_flagRefs, ref => !ref.current) || !scrolledElementRef.current) {
|
|
@@ -1176,23 +1185,6 @@ function _getTopOffset(item, scrollContainer, options) {
|
|
|
1176
1185
|
return 0;
|
|
1177
1186
|
}
|
|
1178
1187
|
|
|
1179
|
-
/**
|
|
1180
|
-
* If the value is a valid expression, we evaluate it. Otherwise, we continue with the value as-is.
|
|
1181
|
-
* If the resulting value isn't a boolean, we return 'false'
|
|
1182
|
-
* The function is memoized to minimize re-renders.
|
|
1183
|
-
*
|
|
1184
|
-
* @param {boolean | string} value - A static boolean or expression to evaluate.
|
|
1185
|
-
* @returns {boolean} - Evaluated boolean result.
|
|
1186
|
-
*/
|
|
1187
|
-
function useBooleanExpressionEvaluation(value) {
|
|
1188
|
-
const expressionLanguage = useService('expressionLanguage');
|
|
1189
|
-
const expressionContextInfo = useContext(LocalExpressionContext);
|
|
1190
|
-
return useMemo(() => {
|
|
1191
|
-
const evaluationResult = runExpressionEvaluation(expressionLanguage, value, expressionContextInfo);
|
|
1192
|
-
return typeof evaluationResult === 'boolean' ? evaluationResult : false;
|
|
1193
|
-
}, [expressionLanguage, expressionContextInfo, value]);
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
1188
|
/**
|
|
1197
1189
|
* Returns the conditionally filtered data of a form reactively.
|
|
1198
1190
|
* Memoised to minimize re-renders
|
|
@@ -1706,9 +1698,10 @@ function Button(props) {
|
|
|
1706
1698
|
Button.config = {
|
|
1707
1699
|
type: type$i,
|
|
1708
1700
|
keyed: false,
|
|
1709
|
-
|
|
1701
|
+
name: 'Button',
|
|
1710
1702
|
group: 'action',
|
|
1711
1703
|
create: (options = {}) => ({
|
|
1704
|
+
label: 'Button',
|
|
1712
1705
|
action: 'submit',
|
|
1713
1706
|
...options
|
|
1714
1707
|
})
|
|
@@ -1816,11 +1809,9 @@ function Checkbox(props) {
|
|
|
1816
1809
|
}), {
|
|
1817
1810
|
'fjs-checked': value
|
|
1818
1811
|
}),
|
|
1819
|
-
children: [
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
required: required,
|
|
1823
|
-
children: jsx("input", {
|
|
1812
|
+
children: [jsxs("div", {
|
|
1813
|
+
class: "fjs-inline-label",
|
|
1814
|
+
children: [jsx("input", {
|
|
1824
1815
|
checked: value,
|
|
1825
1816
|
class: "fjs-input",
|
|
1826
1817
|
disabled: disabled,
|
|
@@ -1833,7 +1824,11 @@ function Checkbox(props) {
|
|
|
1833
1824
|
required: required,
|
|
1834
1825
|
"aria-invalid": errors.length > 0,
|
|
1835
1826
|
"aria-describedby": [descriptionId, errorMessageId].join(' ')
|
|
1836
|
-
})
|
|
1827
|
+
}), jsx(Label, {
|
|
1828
|
+
htmlFor: domId,
|
|
1829
|
+
label: label,
|
|
1830
|
+
required: required
|
|
1831
|
+
})]
|
|
1837
1832
|
}), jsx(Description, {
|
|
1838
1833
|
id: descriptionId,
|
|
1839
1834
|
description: description
|
|
@@ -1846,13 +1841,14 @@ function Checkbox(props) {
|
|
|
1846
1841
|
Checkbox.config = {
|
|
1847
1842
|
type: type$h,
|
|
1848
1843
|
keyed: true,
|
|
1849
|
-
|
|
1844
|
+
name: 'Checkbox',
|
|
1850
1845
|
group: 'selection',
|
|
1851
1846
|
emptyValue: false,
|
|
1852
1847
|
sanitizeValue: ({
|
|
1853
1848
|
value
|
|
1854
1849
|
}) => value === true,
|
|
1855
1850
|
create: (options = {}) => ({
|
|
1851
|
+
label: 'Checkbox',
|
|
1856
1852
|
...options
|
|
1857
1853
|
})
|
|
1858
1854
|
};
|
|
@@ -1874,6 +1870,8 @@ function Checklist(props) {
|
|
|
1874
1870
|
label,
|
|
1875
1871
|
validate = {}
|
|
1876
1872
|
} = field;
|
|
1873
|
+
|
|
1874
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
1877
1875
|
const outerDivRef = useRef();
|
|
1878
1876
|
const {
|
|
1879
1877
|
required
|
|
@@ -1919,31 +1917,32 @@ function Checklist(props) {
|
|
|
1919
1917
|
children: [jsx(Label, {
|
|
1920
1918
|
label: label,
|
|
1921
1919
|
required: required
|
|
1922
|
-
}), loadState == LOAD_STATES.LOADED && options.map((
|
|
1920
|
+
}), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
|
|
1923
1921
|
const itemDomId = `${domId}-${index}`;
|
|
1924
|
-
const isChecked = hasEqualValue(
|
|
1925
|
-
return
|
|
1926
|
-
|
|
1927
|
-
label: o.label,
|
|
1928
|
-
class: classNames({
|
|
1922
|
+
const isChecked = hasEqualValue(option.value, values);
|
|
1923
|
+
return jsxs("div", {
|
|
1924
|
+
className: classNames('fjs-inline-label', {
|
|
1929
1925
|
'fjs-checked': isChecked
|
|
1930
1926
|
}),
|
|
1931
|
-
|
|
1932
|
-
children: jsx("input", {
|
|
1927
|
+
children: [jsx("input", {
|
|
1933
1928
|
checked: isChecked,
|
|
1934
1929
|
class: "fjs-input",
|
|
1935
1930
|
disabled: disabled,
|
|
1936
1931
|
readOnly: readonly,
|
|
1937
1932
|
id: itemDomId,
|
|
1938
1933
|
type: "checkbox",
|
|
1939
|
-
onClick: () => toggleCheckbox(
|
|
1934
|
+
onClick: () => toggleCheckbox(option.value),
|
|
1940
1935
|
onBlur: onCheckboxBlur,
|
|
1941
1936
|
onFocus: onCheckboxFocus,
|
|
1942
1937
|
required: required,
|
|
1943
1938
|
"aria-invalid": errors.length > 0,
|
|
1944
1939
|
"aria-describedby": [descriptionId, errorMessageId].join(' ')
|
|
1945
|
-
})
|
|
1946
|
-
|
|
1940
|
+
}), jsx(Label, {
|
|
1941
|
+
htmlFor: itemDomId,
|
|
1942
|
+
label: option.label,
|
|
1943
|
+
required: false
|
|
1944
|
+
})]
|
|
1945
|
+
}, option.value);
|
|
1947
1946
|
}), jsx(Description, {
|
|
1948
1947
|
id: descriptionId,
|
|
1949
1948
|
description: description
|
|
@@ -1956,17 +1955,18 @@ function Checklist(props) {
|
|
|
1956
1955
|
Checklist.config = {
|
|
1957
1956
|
type: type$g,
|
|
1958
1957
|
keyed: true,
|
|
1959
|
-
|
|
1958
|
+
name: 'Checkbox group',
|
|
1960
1959
|
group: 'selection',
|
|
1961
1960
|
emptyValue: [],
|
|
1962
1961
|
sanitizeValue: sanitizeMultiSelectValue,
|
|
1963
|
-
create:
|
|
1962
|
+
create: (options = {}) => ({
|
|
1963
|
+
label: 'Checkbox group',
|
|
1964
|
+
...createEmptyOptions(options)
|
|
1965
|
+
})
|
|
1964
1966
|
};
|
|
1965
1967
|
|
|
1966
1968
|
const noop$1 = () => false;
|
|
1967
|
-
const ids$2 = new Ids([32, 36, 1]);
|
|
1968
1969
|
function FormField(props) {
|
|
1969
|
-
const instanceIdRef = useRef(ids$2.next());
|
|
1970
1970
|
const {
|
|
1971
1971
|
field,
|
|
1972
1972
|
indexes,
|
|
@@ -2012,28 +2012,22 @@ function FormField(props) {
|
|
|
2012
2012
|
// add precedence: global readonly > form field disabled
|
|
2013
2013
|
const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
|
|
2014
2014
|
const hidden = useCondition(field.conditional && field.conditional.hide || null);
|
|
2015
|
-
const
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
expressionContextInfo: localExpressionContext,
|
|
2022
|
-
valuePath,
|
|
2023
|
-
value,
|
|
2024
|
-
indexes,
|
|
2025
|
-
hidden
|
|
2026
|
-
});
|
|
2027
|
-
}, [formFieldInstanceRegistry, field.id, localExpressionContext, valuePath, value, indexes, hidden]);
|
|
2028
|
-
const fieldInstance = instanceId ? formFieldInstanceRegistry.get(instanceId) : null;
|
|
2015
|
+
const fieldInstance = useMemo(() => ({
|
|
2016
|
+
id: field.id,
|
|
2017
|
+
expressionContextInfo: localExpressionContext,
|
|
2018
|
+
valuePath,
|
|
2019
|
+
indexes
|
|
2020
|
+
}), [field.id, valuePath, localExpressionContext, indexes]);
|
|
2029
2021
|
|
|
2030
|
-
//
|
|
2022
|
+
// register form field instance
|
|
2031
2023
|
useEffect(() => {
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
return () =>
|
|
2024
|
+
if (formFieldInstanceRegistry && !hidden) {
|
|
2025
|
+
const instanceId = formFieldInstanceRegistry.add(fieldInstance);
|
|
2026
|
+
return () => {
|
|
2027
|
+
formFieldInstanceRegistry.remove(instanceId);
|
|
2028
|
+
};
|
|
2035
2029
|
}
|
|
2036
|
-
}, [formFieldInstanceRegistry]);
|
|
2030
|
+
}, [fieldInstance, formFieldInstanceRegistry, hidden]);
|
|
2037
2031
|
|
|
2038
2032
|
// ensures the initial validation behavior can be re-triggered upon form reset
|
|
2039
2033
|
useEffect(() => {
|
|
@@ -2266,11 +2260,12 @@ Default.config = {
|
|
|
2266
2260
|
create: (options = {}) => ({
|
|
2267
2261
|
components: [],
|
|
2268
2262
|
...options
|
|
2269
|
-
})
|
|
2263
|
+
}),
|
|
2264
|
+
getSubheading: field => field.id
|
|
2270
2265
|
};
|
|
2271
2266
|
|
|
2272
2267
|
var _path$x;
|
|
2273
|
-
function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (
|
|
2268
|
+
function _extends$y() { return _extends$y = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$y.apply(null, arguments); }
|
|
2274
2269
|
var SvgCalendar = function SvgCalendar(props) {
|
|
2275
2270
|
return /*#__PURE__*/React.createElement("svg", _extends$y({
|
|
2276
2271
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2406,7 +2401,11 @@ function Datepicker(props) {
|
|
|
2406
2401
|
readonly,
|
|
2407
2402
|
setDate
|
|
2408
2403
|
} = props;
|
|
2404
|
+
|
|
2405
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
2409
2406
|
const dateInputRef = useRef();
|
|
2407
|
+
|
|
2408
|
+
/** @type {import("preact").RefObject<HTMLElement>} */
|
|
2410
2409
|
const focusScopeRef = useRef();
|
|
2411
2410
|
const [flatpickrInstance, setFlatpickrInstance] = useState(null);
|
|
2412
2411
|
const [isInputDirty, setIsInputDirty] = useState(false);
|
|
@@ -2544,7 +2543,7 @@ function Datepicker(props) {
|
|
|
2544
2543
|
}
|
|
2545
2544
|
|
|
2546
2545
|
var _path$w, _path2$4;
|
|
2547
|
-
function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (
|
|
2546
|
+
function _extends$x() { return _extends$x = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$x.apply(null, arguments); }
|
|
2548
2547
|
var SvgClock = function SvgClock(props) {
|
|
2549
2548
|
return /*#__PURE__*/React.createElement("svg", _extends$x({
|
|
2550
2549
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2578,7 +2577,11 @@ function DropdownList(props) {
|
|
|
2578
2577
|
const [mouseControl, setMouseControl] = useState(false);
|
|
2579
2578
|
const [focusedValueIndex, setFocusedValueIndex] = useState(initialFocusIndex);
|
|
2580
2579
|
const [smoothScrolling, setSmoothScrolling] = useState(false);
|
|
2580
|
+
|
|
2581
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
2581
2582
|
const dropdownContainer = useRef();
|
|
2583
|
+
|
|
2584
|
+
/** @type {import("preact").RefObject<{ x: number, y: number }>} */
|
|
2582
2585
|
const mouseScreenPos = useRef();
|
|
2583
2586
|
const focusedItem = useMemo(() => values.length ? values[focusedValueIndex] : null, [focusedValueIndex, values]);
|
|
2584
2587
|
const changeFocusedValueIndex = useCallback(delta => {
|
|
@@ -2796,7 +2799,7 @@ function Timepicker(props) {
|
|
|
2796
2799
|
value: rawValue,
|
|
2797
2800
|
disabled: disabled,
|
|
2798
2801
|
readOnly: readonly,
|
|
2799
|
-
placeholder: use24h ? 'hh:mm' : 'hh:mm
|
|
2802
|
+
placeholder: use24h ? 'hh:mm' : 'hh:mm --',
|
|
2800
2803
|
autoComplete: "off",
|
|
2801
2804
|
onInput: e => {
|
|
2802
2805
|
// @ts-expect-error
|
|
@@ -2852,6 +2855,8 @@ function Datetime(props) {
|
|
|
2852
2855
|
const {
|
|
2853
2856
|
formId
|
|
2854
2857
|
} = useContext(FormContext);
|
|
2858
|
+
|
|
2859
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
2855
2860
|
const dateTimeGroupRef = useRef();
|
|
2856
2861
|
const [dateTime, setDateTime] = useState(getNullDateTime());
|
|
2857
2862
|
const [dateTimeUpdateRequest, setDateTimeUpdateRequest] = useState(null);
|
|
@@ -3017,18 +3022,23 @@ function Datetime(props) {
|
|
|
3017
3022
|
Datetime.config = {
|
|
3018
3023
|
type: type$f,
|
|
3019
3024
|
keyed: true,
|
|
3020
|
-
|
|
3025
|
+
name: 'Date time',
|
|
3021
3026
|
group: 'basic-input',
|
|
3022
3027
|
emptyValue: null,
|
|
3023
3028
|
sanitizeValue: sanitizeDateTimePickerValue,
|
|
3024
|
-
create: (options = {}) => {
|
|
3029
|
+
create: (options = {}, isNewField) => {
|
|
3025
3030
|
const defaults = {};
|
|
3026
3031
|
set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
|
|
3027
|
-
|
|
3032
|
+
if (isNewField) {
|
|
3033
|
+
set(defaults, DATE_LABEL_PATH, 'Date');
|
|
3034
|
+
}
|
|
3028
3035
|
return {
|
|
3029
3036
|
...defaults,
|
|
3030
3037
|
...options
|
|
3031
3038
|
};
|
|
3039
|
+
},
|
|
3040
|
+
getSubheading: field => {
|
|
3041
|
+
return field.dateLabel || field.timeLabel;
|
|
3032
3042
|
}
|
|
3033
3043
|
};
|
|
3034
3044
|
|
|
@@ -3066,9 +3076,10 @@ function Group(props) {
|
|
|
3066
3076
|
Group.config = {
|
|
3067
3077
|
type: 'group',
|
|
3068
3078
|
pathed: true,
|
|
3069
|
-
|
|
3079
|
+
name: 'Group',
|
|
3070
3080
|
group: 'container',
|
|
3071
3081
|
create: (options = {}) => ({
|
|
3082
|
+
label: 'Group',
|
|
3072
3083
|
components: [],
|
|
3073
3084
|
showOutline: true,
|
|
3074
3085
|
...options
|
|
@@ -3142,9 +3153,10 @@ function IFramePlaceholder(props) {
|
|
|
3142
3153
|
IFrame.config = {
|
|
3143
3154
|
type: type$e,
|
|
3144
3155
|
keyed: false,
|
|
3145
|
-
|
|
3156
|
+
name: 'iFrame',
|
|
3146
3157
|
group: 'container',
|
|
3147
3158
|
create: (options = {}) => ({
|
|
3159
|
+
label: 'iFrame',
|
|
3148
3160
|
security: {
|
|
3149
3161
|
allowScripts: true
|
|
3150
3162
|
},
|
|
@@ -3153,7 +3165,7 @@ IFrame.config = {
|
|
|
3153
3165
|
};
|
|
3154
3166
|
|
|
3155
3167
|
var _path$v;
|
|
3156
|
-
function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (
|
|
3168
|
+
function _extends$w() { return _extends$w = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$w.apply(null, arguments); }
|
|
3157
3169
|
var SvgButton = function SvgButton(props) {
|
|
3158
3170
|
return /*#__PURE__*/React.createElement("svg", _extends$w({
|
|
3159
3171
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3167,7 +3179,7 @@ var SvgButton = function SvgButton(props) {
|
|
|
3167
3179
|
};
|
|
3168
3180
|
|
|
3169
3181
|
var _path$u;
|
|
3170
|
-
function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (
|
|
3182
|
+
function _extends$v() { return _extends$v = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$v.apply(null, arguments); }
|
|
3171
3183
|
var SvgCheckbox = function SvgCheckbox(props) {
|
|
3172
3184
|
return /*#__PURE__*/React.createElement("svg", _extends$v({
|
|
3173
3185
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3180,7 +3192,7 @@ var SvgCheckbox = function SvgCheckbox(props) {
|
|
|
3180
3192
|
};
|
|
3181
3193
|
|
|
3182
3194
|
var _path$t;
|
|
3183
|
-
function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (
|
|
3195
|
+
function _extends$u() { return _extends$u = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$u.apply(null, arguments); }
|
|
3184
3196
|
var SvgChecklist = function SvgChecklist(props) {
|
|
3185
3197
|
return /*#__PURE__*/React.createElement("svg", _extends$u({
|
|
3186
3198
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3196,7 +3208,7 @@ var SvgChecklist = function SvgChecklist(props) {
|
|
|
3196
3208
|
};
|
|
3197
3209
|
|
|
3198
3210
|
var _path$s, _path2$3, _path3;
|
|
3199
|
-
function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (
|
|
3211
|
+
function _extends$t() { return _extends$t = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$t.apply(null, arguments); }
|
|
3200
3212
|
var SvgDatetime = function SvgDatetime(props) {
|
|
3201
3213
|
return /*#__PURE__*/React.createElement("svg", _extends$t({
|
|
3202
3214
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3215,7 +3227,7 @@ var SvgDatetime = function SvgDatetime(props) {
|
|
|
3215
3227
|
};
|
|
3216
3228
|
|
|
3217
3229
|
var _path$r, _path2$2;
|
|
3218
|
-
function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (
|
|
3230
|
+
function _extends$s() { return _extends$s = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$s.apply(null, arguments); }
|
|
3219
3231
|
var SvgTaglist = function SvgTaglist(props) {
|
|
3220
3232
|
return /*#__PURE__*/React.createElement("svg", _extends$s({
|
|
3221
3233
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3231,7 +3243,7 @@ var SvgTaglist = function SvgTaglist(props) {
|
|
|
3231
3243
|
};
|
|
3232
3244
|
|
|
3233
3245
|
var _rect, _rect2, _rect3;
|
|
3234
|
-
function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (
|
|
3246
|
+
function _extends$r() { return _extends$r = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$r.apply(null, arguments); }
|
|
3235
3247
|
var SvgForm = function SvgForm(props) {
|
|
3236
3248
|
return /*#__PURE__*/React.createElement("svg", _extends$r({
|
|
3237
3249
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3259,7 +3271,7 @@ var SvgForm = function SvgForm(props) {
|
|
|
3259
3271
|
};
|
|
3260
3272
|
|
|
3261
3273
|
var _path$q;
|
|
3262
|
-
function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (
|
|
3274
|
+
function _extends$q() { return _extends$q = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$q.apply(null, arguments); }
|
|
3263
3275
|
var SvgGroup = function SvgGroup(props) {
|
|
3264
3276
|
return /*#__PURE__*/React.createElement("svg", _extends$q({
|
|
3265
3277
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3275,7 +3287,7 @@ var SvgGroup = function SvgGroup(props) {
|
|
|
3275
3287
|
};
|
|
3276
3288
|
|
|
3277
3289
|
var _path$p;
|
|
3278
|
-
function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (
|
|
3290
|
+
function _extends$p() { return _extends$p = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$p.apply(null, arguments); }
|
|
3279
3291
|
var SvgNumber = function SvgNumber(props) {
|
|
3280
3292
|
return /*#__PURE__*/React.createElement("svg", _extends$p({
|
|
3281
3293
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3289,7 +3301,7 @@ var SvgNumber = function SvgNumber(props) {
|
|
|
3289
3301
|
};
|
|
3290
3302
|
|
|
3291
3303
|
var _path$o;
|
|
3292
|
-
function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (
|
|
3304
|
+
function _extends$o() { return _extends$o = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$o.apply(null, arguments); }
|
|
3293
3305
|
var SvgRadio = function SvgRadio(props) {
|
|
3294
3306
|
return /*#__PURE__*/React.createElement("svg", _extends$o({
|
|
3295
3307
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3302,7 +3314,7 @@ var SvgRadio = function SvgRadio(props) {
|
|
|
3302
3314
|
};
|
|
3303
3315
|
|
|
3304
3316
|
var _path$n;
|
|
3305
|
-
function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (
|
|
3317
|
+
function _extends$n() { return _extends$n = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$n.apply(null, arguments); }
|
|
3306
3318
|
var SvgSelect = function SvgSelect(props) {
|
|
3307
3319
|
return /*#__PURE__*/React.createElement("svg", _extends$n({
|
|
3308
3320
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3316,7 +3328,7 @@ var SvgSelect = function SvgSelect(props) {
|
|
|
3316
3328
|
};
|
|
3317
3329
|
|
|
3318
3330
|
var _path$m;
|
|
3319
|
-
function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (
|
|
3331
|
+
function _extends$m() { return _extends$m = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$m.apply(null, arguments); }
|
|
3320
3332
|
var SvgSeparator = function SvgSeparator(props) {
|
|
3321
3333
|
return /*#__PURE__*/React.createElement("svg", _extends$m({
|
|
3322
3334
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3330,7 +3342,7 @@ var SvgSeparator = function SvgSeparator(props) {
|
|
|
3330
3342
|
};
|
|
3331
3343
|
|
|
3332
3344
|
var _path$l;
|
|
3333
|
-
function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (
|
|
3345
|
+
function _extends$l() { return _extends$l = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$l.apply(null, arguments); }
|
|
3334
3346
|
var SvgSpacer = function SvgSpacer(props) {
|
|
3335
3347
|
return /*#__PURE__*/React.createElement("svg", _extends$l({
|
|
3336
3348
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3344,7 +3356,7 @@ var SvgSpacer = function SvgSpacer(props) {
|
|
|
3344
3356
|
};
|
|
3345
3357
|
|
|
3346
3358
|
var _path$k;
|
|
3347
|
-
function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (
|
|
3359
|
+
function _extends$k() { return _extends$k = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$k.apply(null, arguments); }
|
|
3348
3360
|
var SvgDynamicList = function SvgDynamicList(props) {
|
|
3349
3361
|
return /*#__PURE__*/React.createElement("svg", _extends$k({
|
|
3350
3362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3360,7 +3372,7 @@ var SvgDynamicList = function SvgDynamicList(props) {
|
|
|
3360
3372
|
};
|
|
3361
3373
|
|
|
3362
3374
|
var _path$j;
|
|
3363
|
-
function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (
|
|
3375
|
+
function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
|
|
3364
3376
|
var SvgText = function SvgText(props) {
|
|
3365
3377
|
return /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
3366
3378
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3373,7 +3385,7 @@ var SvgText = function SvgText(props) {
|
|
|
3373
3385
|
};
|
|
3374
3386
|
|
|
3375
3387
|
var _path$i;
|
|
3376
|
-
function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (
|
|
3388
|
+
function _extends$i() { return _extends$i = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$i.apply(null, arguments); }
|
|
3377
3389
|
var SvgHtml = function SvgHtml(props) {
|
|
3378
3390
|
return /*#__PURE__*/React.createElement("svg", _extends$i({
|
|
3379
3391
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3389,7 +3401,7 @@ var SvgHtml = function SvgHtml(props) {
|
|
|
3389
3401
|
};
|
|
3390
3402
|
|
|
3391
3403
|
var _path$h;
|
|
3392
|
-
function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (
|
|
3404
|
+
function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
|
|
3393
3405
|
var SvgExpressionField = function SvgExpressionField(props) {
|
|
3394
3406
|
return /*#__PURE__*/React.createElement("svg", _extends$h({
|
|
3395
3407
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3405,7 +3417,7 @@ var SvgExpressionField = function SvgExpressionField(props) {
|
|
|
3405
3417
|
};
|
|
3406
3418
|
|
|
3407
3419
|
var _path$g;
|
|
3408
|
-
function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (
|
|
3420
|
+
function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
|
|
3409
3421
|
var SvgTextfield = function SvgTextfield(props) {
|
|
3410
3422
|
return /*#__PURE__*/React.createElement("svg", _extends$g({
|
|
3411
3423
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3419,7 +3431,7 @@ var SvgTextfield = function SvgTextfield(props) {
|
|
|
3419
3431
|
};
|
|
3420
3432
|
|
|
3421
3433
|
var _path$f;
|
|
3422
|
-
function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (
|
|
3434
|
+
function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
|
|
3423
3435
|
var SvgTextarea = function SvgTextarea(props) {
|
|
3424
3436
|
return /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
3425
3437
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3433,7 +3445,7 @@ var SvgTextarea = function SvgTextarea(props) {
|
|
|
3433
3445
|
};
|
|
3434
3446
|
|
|
3435
3447
|
var _path$e;
|
|
3436
|
-
function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (
|
|
3448
|
+
function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
|
|
3437
3449
|
var SvgIFrame = function SvgIFrame(props) {
|
|
3438
3450
|
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
3439
3451
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3449,7 +3461,7 @@ var SvgIFrame = function SvgIFrame(props) {
|
|
|
3449
3461
|
};
|
|
3450
3462
|
|
|
3451
3463
|
var _path$d, _path2$1;
|
|
3452
|
-
function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (
|
|
3464
|
+
function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
|
|
3453
3465
|
var SvgImage = function SvgImage(props) {
|
|
3454
3466
|
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
3455
3467
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3468,7 +3480,7 @@ var SvgImage = function SvgImage(props) {
|
|
|
3468
3480
|
};
|
|
3469
3481
|
|
|
3470
3482
|
var _path$c;
|
|
3471
|
-
function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (
|
|
3483
|
+
function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
|
|
3472
3484
|
var SvgTable = function SvgTable(props) {
|
|
3473
3485
|
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
3474
3486
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3483,7 +3495,7 @@ var SvgTable = function SvgTable(props) {
|
|
|
3483
3495
|
};
|
|
3484
3496
|
|
|
3485
3497
|
var _path$b;
|
|
3486
|
-
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (
|
|
3498
|
+
function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
|
|
3487
3499
|
var SvgFilePicker = function SvgFilePicker(props) {
|
|
3488
3500
|
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3489
3501
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3574,11 +3586,10 @@ function Image(props) {
|
|
|
3574
3586
|
Image.config = {
|
|
3575
3587
|
type: type$d,
|
|
3576
3588
|
keyed: false,
|
|
3577
|
-
|
|
3589
|
+
name: 'Image view',
|
|
3578
3590
|
group: 'presentation',
|
|
3579
|
-
create: (options = {}) =>
|
|
3580
|
-
|
|
3581
|
-
})
|
|
3591
|
+
create: (options = {}) => options,
|
|
3592
|
+
getSubheading: field => field.alt
|
|
3582
3593
|
};
|
|
3583
3594
|
|
|
3584
3595
|
function TemplatedInputAdorner(props) {
|
|
@@ -3600,7 +3611,7 @@ function TemplatedInputAdorner(props) {
|
|
|
3600
3611
|
}
|
|
3601
3612
|
|
|
3602
3613
|
var _path$a;
|
|
3603
|
-
function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (
|
|
3614
|
+
function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
|
|
3604
3615
|
var SvgAngelDown = function SvgAngelDown(props) {
|
|
3605
3616
|
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
3606
3617
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3617,7 +3628,7 @@ var SvgAngelDown = function SvgAngelDown(props) {
|
|
|
3617
3628
|
};
|
|
3618
3629
|
|
|
3619
3630
|
var _path$9;
|
|
3620
|
-
function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (
|
|
3631
|
+
function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
|
|
3621
3632
|
var SvgAngelUp = function SvgAngelUp(props) {
|
|
3622
3633
|
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
3623
3634
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3689,6 +3700,8 @@ function Numberfield(props) {
|
|
|
3689
3700
|
const {
|
|
3690
3701
|
required
|
|
3691
3702
|
} = validate;
|
|
3703
|
+
|
|
3704
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
3692
3705
|
const inputRef = useRef();
|
|
3693
3706
|
const [cachedValue, setCachedValue] = useState(value);
|
|
3694
3707
|
const [displayValue, setDisplayValue] = useState(value);
|
|
@@ -3885,7 +3898,7 @@ function Numberfield(props) {
|
|
|
3885
3898
|
Numberfield.config = {
|
|
3886
3899
|
type: type$c,
|
|
3887
3900
|
keyed: true,
|
|
3888
|
-
|
|
3901
|
+
name: 'Number',
|
|
3889
3902
|
group: 'basic-input',
|
|
3890
3903
|
emptyValue: null,
|
|
3891
3904
|
sanitizeValue: ({
|
|
@@ -3899,6 +3912,7 @@ Numberfield.config = {
|
|
|
3899
3912
|
return formField.serializeToString ? value.toString() : Number(value);
|
|
3900
3913
|
},
|
|
3901
3914
|
create: (options = {}) => ({
|
|
3915
|
+
label: 'Number',
|
|
3902
3916
|
...options
|
|
3903
3917
|
})
|
|
3904
3918
|
};
|
|
@@ -3920,6 +3934,8 @@ function Radio(props) {
|
|
|
3920
3934
|
label,
|
|
3921
3935
|
validate = {}
|
|
3922
3936
|
} = field;
|
|
3937
|
+
|
|
3938
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
3923
3939
|
const outerDivRef = useRef();
|
|
3924
3940
|
const {
|
|
3925
3941
|
required
|
|
@@ -3967,18 +3983,16 @@ function Radio(props) {
|
|
|
3967
3983
|
}), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
|
|
3968
3984
|
const itemDomId = `${domId}-${index}`;
|
|
3969
3985
|
const isChecked = isEqual(option.value, value);
|
|
3970
|
-
return
|
|
3971
|
-
|
|
3972
|
-
label: option.label,
|
|
3973
|
-
class: classNames({
|
|
3986
|
+
return jsxs("div", {
|
|
3987
|
+
className: classNames('fjs-inline-label', {
|
|
3974
3988
|
'fjs-checked': isChecked
|
|
3975
3989
|
}),
|
|
3976
|
-
|
|
3977
|
-
children: jsx("input", {
|
|
3990
|
+
children: [jsx("input", {
|
|
3978
3991
|
checked: isChecked,
|
|
3979
3992
|
class: "fjs-input",
|
|
3980
3993
|
disabled: disabled,
|
|
3981
3994
|
readOnly: readonly,
|
|
3995
|
+
name: domId,
|
|
3982
3996
|
id: itemDomId,
|
|
3983
3997
|
type: "radio",
|
|
3984
3998
|
onClick: () => onChange(option.value),
|
|
@@ -3987,8 +4001,15 @@ function Radio(props) {
|
|
|
3987
4001
|
"aria-describedby": [descriptionId, errorMessageId].join(' '),
|
|
3988
4002
|
required: required,
|
|
3989
4003
|
"aria-invalid": errors.length > 0
|
|
3990
|
-
})
|
|
3991
|
-
|
|
4004
|
+
}), jsx(Label, {
|
|
4005
|
+
htmlFor: itemDomId,
|
|
4006
|
+
label: option.label,
|
|
4007
|
+
class: classNames({
|
|
4008
|
+
'fjs-checked': isChecked
|
|
4009
|
+
}),
|
|
4010
|
+
required: false
|
|
4011
|
+
})]
|
|
4012
|
+
}, option.value);
|
|
3992
4013
|
}), jsx(Description, {
|
|
3993
4014
|
id: descriptionId,
|
|
3994
4015
|
description: description
|
|
@@ -4001,15 +4022,18 @@ function Radio(props) {
|
|
|
4001
4022
|
Radio.config = {
|
|
4002
4023
|
type: type$b,
|
|
4003
4024
|
keyed: true,
|
|
4004
|
-
|
|
4025
|
+
name: 'Radio group',
|
|
4005
4026
|
group: 'selection',
|
|
4006
4027
|
emptyValue: null,
|
|
4007
4028
|
sanitizeValue: sanitizeSingleSelectValue,
|
|
4008
|
-
create:
|
|
4029
|
+
create: (options = {}) => ({
|
|
4030
|
+
label: 'Radio group',
|
|
4031
|
+
...createEmptyOptions(options)
|
|
4032
|
+
})
|
|
4009
4033
|
};
|
|
4010
4034
|
|
|
4011
4035
|
var _path$8;
|
|
4012
|
-
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (
|
|
4036
|
+
function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
|
|
4013
4037
|
var SvgXMark = function SvgXMark(props) {
|
|
4014
4038
|
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
4015
4039
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4040,6 +4064,8 @@ function SearchableSelect(props) {
|
|
|
4040
4064
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
4041
4065
|
const [isFilterActive, setIsFilterActive] = useState(true);
|
|
4042
4066
|
const [isEscapeClosed, setIsEscapeClose] = useState(false);
|
|
4067
|
+
|
|
4068
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
4043
4069
|
const searchbarRef = useRef();
|
|
4044
4070
|
const eventBus = useService('eventBus');
|
|
4045
4071
|
const {
|
|
@@ -4067,9 +4093,9 @@ function SearchableSelect(props) {
|
|
|
4067
4093
|
if (!filter || !isFilterActive) {
|
|
4068
4094
|
return options;
|
|
4069
4095
|
}
|
|
4070
|
-
return options.filter(
|
|
4096
|
+
return options.filter(option => option.label && option.value && option.label.toLowerCase().includes(filter.toLowerCase()));
|
|
4071
4097
|
}, [filter, loadState, options, isFilterActive]);
|
|
4072
|
-
const
|
|
4098
|
+
const pickOption = useCallback(option => {
|
|
4073
4099
|
setFilter(option && option.label || '');
|
|
4074
4100
|
props.onChange({
|
|
4075
4101
|
value: option && option.value || null
|
|
@@ -4167,7 +4193,7 @@ function SearchableSelect(props) {
|
|
|
4167
4193
|
}), displayState.displayCross && jsxs("span", {
|
|
4168
4194
|
class: "fjs-select-cross",
|
|
4169
4195
|
onMouseDown: e => {
|
|
4170
|
-
|
|
4196
|
+
pickOption(null);
|
|
4171
4197
|
e.preventDefault();
|
|
4172
4198
|
},
|
|
4173
4199
|
children: [jsx(SvgXMark, {}), ' ']
|
|
@@ -4180,9 +4206,9 @@ function SearchableSelect(props) {
|
|
|
4180
4206
|
class: "fjs-select-anchor",
|
|
4181
4207
|
children: displayState.displayDropdown && jsx(DropdownList, {
|
|
4182
4208
|
values: filteredOptions,
|
|
4183
|
-
getLabel:
|
|
4184
|
-
onValueSelected:
|
|
4185
|
-
|
|
4209
|
+
getLabel: option => option.label,
|
|
4210
|
+
onValueSelected: option => {
|
|
4211
|
+
pickOption(option);
|
|
4186
4212
|
setIsDropdownExpanded(false);
|
|
4187
4213
|
},
|
|
4188
4214
|
listenerElement: searchbarRef.current
|
|
@@ -4204,6 +4230,8 @@ function SimpleSelect(props) {
|
|
|
4204
4230
|
} = props;
|
|
4205
4231
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
4206
4232
|
const selectRef = useRef();
|
|
4233
|
+
|
|
4234
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
4207
4235
|
const inputRef = useRef();
|
|
4208
4236
|
const {
|
|
4209
4237
|
loadState,
|
|
@@ -4218,7 +4246,7 @@ function SimpleSelect(props) {
|
|
|
4218
4246
|
});
|
|
4219
4247
|
const getLabelCorrelation = useGetLabelCorrelation(options);
|
|
4220
4248
|
const valueLabel = useMemo(() => value && getLabelCorrelation(value), [value, getLabelCorrelation]);
|
|
4221
|
-
const
|
|
4249
|
+
const pickOption = useCallback(option => {
|
|
4222
4250
|
props.onChange({
|
|
4223
4251
|
value: option && option.value || null
|
|
4224
4252
|
});
|
|
@@ -4243,7 +4271,7 @@ function SimpleSelect(props) {
|
|
|
4243
4271
|
}
|
|
4244
4272
|
e.preventDefault();
|
|
4245
4273
|
}, [disabled, isDropdownExpanded]);
|
|
4246
|
-
const initialFocusIndex = useMemo(() => value && findIndex(options,
|
|
4274
|
+
const initialFocusIndex = useMemo(() => value && findIndex(options, option => option.value === value) || 0, [options, value]);
|
|
4247
4275
|
const onInputFocus = useCallback(() => {
|
|
4248
4276
|
if (!readonly) {
|
|
4249
4277
|
setIsDropdownExpanded(true);
|
|
@@ -4285,7 +4313,7 @@ function SimpleSelect(props) {
|
|
|
4285
4313
|
}), displayState.displayCross && jsx("span", {
|
|
4286
4314
|
class: "fjs-select-cross",
|
|
4287
4315
|
onMouseDown: e => {
|
|
4288
|
-
|
|
4316
|
+
pickOption(null);
|
|
4289
4317
|
e.stopPropagation();
|
|
4290
4318
|
},
|
|
4291
4319
|
children: jsx(SvgXMark, {})
|
|
@@ -4297,10 +4325,10 @@ function SimpleSelect(props) {
|
|
|
4297
4325
|
class: "fjs-select-anchor",
|
|
4298
4326
|
children: displayState.displayDropdown && jsx(DropdownList, {
|
|
4299
4327
|
values: options,
|
|
4300
|
-
getLabel:
|
|
4328
|
+
getLabel: option => option.label,
|
|
4301
4329
|
initialFocusIndex: initialFocusIndex,
|
|
4302
|
-
onValueSelected:
|
|
4303
|
-
|
|
4330
|
+
onValueSelected: option => {
|
|
4331
|
+
pickOption(option);
|
|
4304
4332
|
setIsDropdownExpanded(false);
|
|
4305
4333
|
},
|
|
4306
4334
|
listenerElement: selectRef.current
|
|
@@ -4379,11 +4407,14 @@ function Select(props) {
|
|
|
4379
4407
|
Select.config = {
|
|
4380
4408
|
type: type$a,
|
|
4381
4409
|
keyed: true,
|
|
4382
|
-
|
|
4410
|
+
name: 'Select',
|
|
4383
4411
|
group: 'selection',
|
|
4384
4412
|
emptyValue: null,
|
|
4385
4413
|
sanitizeValue: sanitizeSingleSelectValue,
|
|
4386
|
-
create:
|
|
4414
|
+
create: (options = {}) => ({
|
|
4415
|
+
label: 'Select',
|
|
4416
|
+
...createEmptyOptions(options)
|
|
4417
|
+
})
|
|
4387
4418
|
};
|
|
4388
4419
|
|
|
4389
4420
|
const type$9 = 'separator';
|
|
@@ -4396,7 +4427,7 @@ function Separator() {
|
|
|
4396
4427
|
Separator.config = {
|
|
4397
4428
|
type: type$9,
|
|
4398
4429
|
keyed: false,
|
|
4399
|
-
|
|
4430
|
+
name: 'Separator',
|
|
4400
4431
|
group: 'presentation',
|
|
4401
4432
|
create: (options = {}) => ({
|
|
4402
4433
|
...options
|
|
@@ -4421,7 +4452,7 @@ function Spacer(props) {
|
|
|
4421
4452
|
Spacer.config = {
|
|
4422
4453
|
type: type$8,
|
|
4423
4454
|
keyed: false,
|
|
4424
|
-
|
|
4455
|
+
name: 'Spacer',
|
|
4425
4456
|
group: 'presentation',
|
|
4426
4457
|
create: (options = {}) => ({
|
|
4427
4458
|
height: 60,
|
|
@@ -4467,9 +4498,10 @@ DynamicList.config = {
|
|
|
4467
4498
|
type: 'dynamiclist',
|
|
4468
4499
|
pathed: true,
|
|
4469
4500
|
repeatable: true,
|
|
4470
|
-
|
|
4501
|
+
name: 'Dynamic list',
|
|
4471
4502
|
group: 'container',
|
|
4472
4503
|
create: (options = {}) => ({
|
|
4504
|
+
label: 'Dynamic list',
|
|
4473
4505
|
components: [],
|
|
4474
4506
|
showOutline: true,
|
|
4475
4507
|
isRepeating: true,
|
|
@@ -4523,7 +4555,11 @@ function Taglist(props) {
|
|
|
4523
4555
|
const [filter, setFilter] = useState('');
|
|
4524
4556
|
const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);
|
|
4525
4557
|
const [isEscapeClosed, setIsEscapeClose] = useState(false);
|
|
4558
|
+
|
|
4559
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
4526
4560
|
const focusScopeRef = useRef();
|
|
4561
|
+
|
|
4562
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
4527
4563
|
const inputRef = useRef();
|
|
4528
4564
|
const eventBus = useService('eventBus');
|
|
4529
4565
|
const {
|
|
@@ -4712,8 +4748,8 @@ function Taglist(props) {
|
|
|
4712
4748
|
class: "fjs-taglist-anchor",
|
|
4713
4749
|
children: shouldDisplayDropdown && jsx(DropdownList, {
|
|
4714
4750
|
values: filteredOptions,
|
|
4715
|
-
getLabel:
|
|
4716
|
-
onValueSelected:
|
|
4751
|
+
getLabel: option => option.label,
|
|
4752
|
+
onValueSelected: option => selectValue(option.value),
|
|
4717
4753
|
emptyListMessage: hasOptionsLeft ? 'No results' : 'All values selected',
|
|
4718
4754
|
listenerElement: inputRef.current
|
|
4719
4755
|
})
|
|
@@ -4729,11 +4765,14 @@ function Taglist(props) {
|
|
|
4729
4765
|
Taglist.config = {
|
|
4730
4766
|
type: type$7,
|
|
4731
4767
|
keyed: true,
|
|
4732
|
-
|
|
4768
|
+
name: 'Tag list',
|
|
4733
4769
|
group: 'selection',
|
|
4734
4770
|
emptyValue: [],
|
|
4735
4771
|
sanitizeValue: sanitizeMultiSelectValue,
|
|
4736
|
-
create:
|
|
4772
|
+
create: (options = {}) => ({
|
|
4773
|
+
label: 'Tag list',
|
|
4774
|
+
...createEmptyOptions(options)
|
|
4775
|
+
})
|
|
4737
4776
|
};
|
|
4738
4777
|
|
|
4739
4778
|
const NODE_TYPE_TEXT = 3,
|
|
@@ -4758,7 +4797,7 @@ function sanitizeHTML(html) {
|
|
|
4758
4797
|
doc.normalize();
|
|
4759
4798
|
const element = doc.body.firstChild;
|
|
4760
4799
|
if (element) {
|
|
4761
|
-
sanitizeNode(
|
|
4800
|
+
sanitizeNode(/** @type Element */element);
|
|
4762
4801
|
return /** @type Element */element.innerHTML;
|
|
4763
4802
|
} else {
|
|
4764
4803
|
// handle the case that document parsing
|
|
@@ -4815,7 +4854,7 @@ function sanitizeNode(node) {
|
|
|
4815
4854
|
node.setAttribute('rel', 'noopener');
|
|
4816
4855
|
}
|
|
4817
4856
|
for (let i = node.childNodes.length; i--;) {
|
|
4818
|
-
sanitizeNode(
|
|
4857
|
+
sanitizeNode(/** @type Element */node.childNodes[i]);
|
|
4819
4858
|
}
|
|
4820
4859
|
}
|
|
4821
4860
|
|
|
@@ -4902,12 +4941,15 @@ function Text(props) {
|
|
|
4902
4941
|
Text.config = {
|
|
4903
4942
|
type: type$6,
|
|
4904
4943
|
keyed: false,
|
|
4905
|
-
|
|
4944
|
+
name: 'Text view',
|
|
4906
4945
|
group: 'presentation',
|
|
4907
4946
|
create: (options = {}) => ({
|
|
4908
4947
|
text: '# Text',
|
|
4909
4948
|
...options
|
|
4910
|
-
})
|
|
4949
|
+
}),
|
|
4950
|
+
getSubheading: field => {
|
|
4951
|
+
textToLabel(field.text);
|
|
4952
|
+
}
|
|
4911
4953
|
};
|
|
4912
4954
|
|
|
4913
4955
|
const type$5 = 'html';
|
|
@@ -4968,7 +5010,7 @@ function Html(props) {
|
|
|
4968
5010
|
Html.config = {
|
|
4969
5011
|
type: type$5,
|
|
4970
5012
|
keyed: false,
|
|
4971
|
-
|
|
5013
|
+
name: 'HTML view',
|
|
4972
5014
|
group: 'presentation',
|
|
4973
5015
|
create: (options = {}) => ({
|
|
4974
5016
|
content: '',
|
|
@@ -5014,7 +5056,7 @@ function ExpressionField(props) {
|
|
|
5014
5056
|
}
|
|
5015
5057
|
ExpressionField.config = {
|
|
5016
5058
|
type: type$4,
|
|
5017
|
-
|
|
5059
|
+
name: 'Expression',
|
|
5018
5060
|
group: 'basic-input',
|
|
5019
5061
|
keyed: true,
|
|
5020
5062
|
emptyValue: null,
|
|
@@ -5107,7 +5149,7 @@ function Textfield(props) {
|
|
|
5107
5149
|
Textfield.config = {
|
|
5108
5150
|
type: type$3,
|
|
5109
5151
|
keyed: true,
|
|
5110
|
-
|
|
5152
|
+
name: 'Text field',
|
|
5111
5153
|
group: 'basic-input',
|
|
5112
5154
|
emptyValue: '',
|
|
5113
5155
|
sanitizeValue: ({
|
|
@@ -5124,6 +5166,7 @@ Textfield.config = {
|
|
|
5124
5166
|
return String(value);
|
|
5125
5167
|
},
|
|
5126
5168
|
create: (options = {}) => ({
|
|
5169
|
+
label: 'Text field',
|
|
5127
5170
|
...options
|
|
5128
5171
|
})
|
|
5129
5172
|
};
|
|
@@ -5212,13 +5255,14 @@ function Textarea(props) {
|
|
|
5212
5255
|
Textarea.config = {
|
|
5213
5256
|
type: type$2,
|
|
5214
5257
|
keyed: true,
|
|
5215
|
-
|
|
5258
|
+
name: 'Text area',
|
|
5216
5259
|
group: 'basic-input',
|
|
5217
5260
|
emptyValue: '',
|
|
5218
5261
|
sanitizeValue: ({
|
|
5219
5262
|
value
|
|
5220
5263
|
}) => isArray(value) || isObject(value) || isNil(value) ? '' : String(value),
|
|
5221
5264
|
create: (options = {}) => ({
|
|
5265
|
+
label: 'Text area',
|
|
5222
5266
|
...options
|
|
5223
5267
|
})
|
|
5224
5268
|
};
|
|
@@ -5242,7 +5286,7 @@ const autoSizeTextarea = textarea => {
|
|
|
5242
5286
|
};
|
|
5243
5287
|
|
|
5244
5288
|
var _path$7;
|
|
5245
|
-
function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (
|
|
5289
|
+
function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
|
|
5246
5290
|
var SvgArrowDown = function SvgArrowDown(props) {
|
|
5247
5291
|
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
5248
5292
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5254,7 +5298,7 @@ var SvgArrowDown = function SvgArrowDown(props) {
|
|
|
5254
5298
|
};
|
|
5255
5299
|
|
|
5256
5300
|
var _path$6;
|
|
5257
|
-
function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (
|
|
5301
|
+
function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
|
|
5258
5302
|
var SvgArrowUp = function SvgArrowUp(props) {
|
|
5259
5303
|
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
5260
5304
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5266,7 +5310,7 @@ var SvgArrowUp = function SvgArrowUp(props) {
|
|
|
5266
5310
|
};
|
|
5267
5311
|
|
|
5268
5312
|
var _path$5;
|
|
5269
|
-
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (
|
|
5313
|
+
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
5270
5314
|
var SvgCaretLeft = function SvgCaretLeft(props) {
|
|
5271
5315
|
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
5272
5316
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5279,7 +5323,7 @@ var SvgCaretLeft = function SvgCaretLeft(props) {
|
|
|
5279
5323
|
};
|
|
5280
5324
|
|
|
5281
5325
|
var _path$4;
|
|
5282
|
-
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (
|
|
5326
|
+
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
5283
5327
|
var SvgCaretRight = function SvgCaretRight(props) {
|
|
5284
5328
|
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
5285
5329
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5330,9 +5374,7 @@ function Table(props) {
|
|
|
5330
5374
|
id,
|
|
5331
5375
|
label
|
|
5332
5376
|
} = field;
|
|
5333
|
-
|
|
5334
|
-
/** @type {[(null|Sorting), import("preact/hooks").StateUpdater<null|Sorting>]} */
|
|
5335
|
-
const [sortBy, setSortBy] = useState(null);
|
|
5377
|
+
const [sortBy, setSortBy] = useState(/** @type {Sorting | null} */null);
|
|
5336
5378
|
const evaluatedColumns = useEvaluatedColumns(columnsExpression || '', columns);
|
|
5337
5379
|
const columnKeys = evaluatedColumns.map(({
|
|
5338
5380
|
key
|
|
@@ -5348,6 +5390,12 @@ function Table(props) {
|
|
|
5348
5390
|
useEffect(() => {
|
|
5349
5391
|
setCurrentPage(0);
|
|
5350
5392
|
}, [rowCount, sortBy]);
|
|
5393
|
+
const serializeCellData = cellData => {
|
|
5394
|
+
if (cellData !== null && typeof cellData === 'object') {
|
|
5395
|
+
return JSON.stringify(cellData);
|
|
5396
|
+
}
|
|
5397
|
+
return cellData;
|
|
5398
|
+
};
|
|
5351
5399
|
|
|
5352
5400
|
/** @param {string} key */
|
|
5353
5401
|
function toggleSortBy(key) {
|
|
@@ -5431,7 +5479,7 @@ function Table(props) {
|
|
|
5431
5479
|
class: "fjs-table-tr",
|
|
5432
5480
|
children: columnKeys.map(key => jsx("td", {
|
|
5433
5481
|
class: "fjs-table-td",
|
|
5434
|
-
children: row[key]
|
|
5482
|
+
children: serializeCellData(row[key])
|
|
5435
5483
|
}, key))
|
|
5436
5484
|
}, index))
|
|
5437
5485
|
})]
|
|
@@ -5467,7 +5515,7 @@ function Table(props) {
|
|
|
5467
5515
|
Table.config = {
|
|
5468
5516
|
type: type$1,
|
|
5469
5517
|
keyed: false,
|
|
5470
|
-
|
|
5518
|
+
name: 'Table',
|
|
5471
5519
|
group: 'presentation',
|
|
5472
5520
|
create: (options = {}) => {
|
|
5473
5521
|
const {
|
|
@@ -5496,6 +5544,7 @@ Table.config = {
|
|
|
5496
5544
|
}
|
|
5497
5545
|
return {
|
|
5498
5546
|
...remainingOptions,
|
|
5547
|
+
label: 'Table',
|
|
5499
5548
|
rowCount: 10,
|
|
5500
5549
|
columns: [{
|
|
5501
5550
|
label: 'ID',
|
|
@@ -5617,11 +5666,7 @@ function getHeaderAriaLabel(sortBy, key, label) {
|
|
|
5617
5666
|
return `Click to sort by ${label} ascending`;
|
|
5618
5667
|
}
|
|
5619
5668
|
|
|
5620
|
-
const FILE_PICKER_FILE_KEY_PREFIX = 'files::';
|
|
5621
|
-
|
|
5622
5669
|
const type = 'filepicker';
|
|
5623
|
-
const ids$1 = new Ids();
|
|
5624
|
-
const EMPTY_ARRAY$1 = [];
|
|
5625
5670
|
|
|
5626
5671
|
/**
|
|
5627
5672
|
* @typedef Props
|
|
@@ -5635,8 +5680,7 @@ const EMPTY_ARRAY$1 = [];
|
|
|
5635
5680
|
* @property {string} field.id
|
|
5636
5681
|
* @property {string} [field.label]
|
|
5637
5682
|
* @property {string} [field.accept]
|
|
5638
|
-
* @property {
|
|
5639
|
-
* @property {string} [value]
|
|
5683
|
+
* @property {boolean} [field.multiple]
|
|
5640
5684
|
*
|
|
5641
5685
|
* @param {Props} props
|
|
5642
5686
|
* @returns {import("preact").JSX.Element}
|
|
@@ -5644,8 +5688,9 @@ const EMPTY_ARRAY$1 = [];
|
|
|
5644
5688
|
function FilePicker(props) {
|
|
5645
5689
|
/** @type {import("preact/hooks").Ref<HTMLInputElement>} */
|
|
5646
5690
|
const fileInputRef = useRef(null);
|
|
5647
|
-
/** @type {import(
|
|
5648
|
-
const
|
|
5691
|
+
/** @type {[File[],import("preact/hooks").StateUpdater<File[]>]} */
|
|
5692
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
5693
|
+
const eventBus = useService('eventBus');
|
|
5649
5694
|
const {
|
|
5650
5695
|
field,
|
|
5651
5696
|
onChange,
|
|
@@ -5653,59 +5698,33 @@ function FilePicker(props) {
|
|
|
5653
5698
|
errors = [],
|
|
5654
5699
|
disabled,
|
|
5655
5700
|
readonly,
|
|
5656
|
-
required
|
|
5657
|
-
value: filesKey = ''
|
|
5701
|
+
required
|
|
5658
5702
|
} = props;
|
|
5659
5703
|
const {
|
|
5660
5704
|
label,
|
|
5661
|
-
multiple =
|
|
5662
|
-
accept = ''
|
|
5705
|
+
multiple = '',
|
|
5706
|
+
accept = '',
|
|
5707
|
+
id
|
|
5663
5708
|
} = field;
|
|
5664
|
-
/** @type {string} */
|
|
5665
5709
|
const evaluatedAccept = useSingleLineTemplateEvaluation(accept);
|
|
5666
|
-
const evaluatedMultiple =
|
|
5710
|
+
const evaluatedMultiple = useSingleLineTemplateEvaluation(typeof multiple === 'string' ? multiple : multiple.toString()) === 'true';
|
|
5667
5711
|
const errorMessageId = `${domId}-error-message`;
|
|
5668
|
-
/** @type {File[]} */
|
|
5669
|
-
const selectedFiles = fileRegistry === null ? EMPTY_ARRAY$1 : fileRegistry.getFiles(filesKey);
|
|
5670
|
-
useEffect(() => {
|
|
5671
|
-
if (filesKey && fileRegistry !== null && !fileRegistry.hasKey(filesKey)) {
|
|
5672
|
-
onChange({
|
|
5673
|
-
value: null
|
|
5674
|
-
});
|
|
5675
|
-
}
|
|
5676
|
-
}, [fileRegistry, filesKey, onChange, selectedFiles.length]);
|
|
5677
5712
|
useEffect(() => {
|
|
5678
|
-
const
|
|
5679
|
-
|
|
5680
|
-
fileInputRef.current.files = data.files;
|
|
5681
|
-
}, [selectedFiles]);
|
|
5682
|
-
|
|
5683
|
-
/**
|
|
5684
|
-
* @type import("preact").JSX.GenericEventHandler<HTMLInputElement>
|
|
5685
|
-
*/
|
|
5686
|
-
const onFileChange = event => {
|
|
5687
|
-
const input = /** @type {HTMLInputElement} */event.target;
|
|
5688
|
-
|
|
5689
|
-
// if we have an associated file key but no files are selected, clear the file key and associated files
|
|
5690
|
-
if ((input.files === null || input.files.length === 0) && filesKey !== '') {
|
|
5691
|
-
fileRegistry.deleteFiles(filesKey);
|
|
5713
|
+
const reset = () => {
|
|
5714
|
+
setSelectedFiles([]);
|
|
5692
5715
|
onChange({
|
|
5693
5716
|
value: null
|
|
5694
5717
|
});
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
value: updatedFilesKey
|
|
5704
|
-
});
|
|
5705
|
-
};
|
|
5706
|
-
const isInputDisabled = disabled || readonly || fileRegistry === null;
|
|
5718
|
+
};
|
|
5719
|
+
eventBus.on('import.done', reset);
|
|
5720
|
+
eventBus.on('reset', reset);
|
|
5721
|
+
return () => {
|
|
5722
|
+
eventBus.off('import.done', reset);
|
|
5723
|
+
eventBus.off('reset', reset);
|
|
5724
|
+
};
|
|
5725
|
+
}, [eventBus, onChange]);
|
|
5707
5726
|
return jsxs("div", {
|
|
5708
|
-
|
|
5727
|
+
class: formFieldClasses(type, {
|
|
5709
5728
|
errors,
|
|
5710
5729
|
disabled,
|
|
5711
5730
|
readonly
|
|
@@ -5720,17 +5739,29 @@ function FilePicker(props) {
|
|
|
5720
5739
|
ref: fileInputRef,
|
|
5721
5740
|
id: domId,
|
|
5722
5741
|
name: domId,
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5742
|
+
multiple: evaluatedMultiple === false ? undefined : evaluatedMultiple,
|
|
5743
|
+
accept: evaluatedAccept === '' ? undefined : evaluatedAccept,
|
|
5744
|
+
onChange: event => {
|
|
5745
|
+
const input = /** @type {HTMLInputElement} */event.target;
|
|
5746
|
+
if (input.files === null || input.files.length === 0) {
|
|
5747
|
+
onChange({
|
|
5748
|
+
value: null
|
|
5749
|
+
});
|
|
5750
|
+
return;
|
|
5751
|
+
}
|
|
5752
|
+
const files = Array.from(input.files);
|
|
5753
|
+
onChange({
|
|
5754
|
+
value: `${id}_value_key`
|
|
5755
|
+
});
|
|
5756
|
+
setSelectedFiles(files);
|
|
5757
|
+
}
|
|
5727
5758
|
}), jsxs("div", {
|
|
5728
5759
|
className: "fjs-filepicker-container",
|
|
5729
5760
|
children: [jsx("button", {
|
|
5730
5761
|
type: "button",
|
|
5731
|
-
disabled:
|
|
5762
|
+
disabled: disabled,
|
|
5732
5763
|
readonly: readonly,
|
|
5733
|
-
|
|
5764
|
+
class: "fjs-button",
|
|
5734
5765
|
onClick: () => {
|
|
5735
5766
|
fileInputRef.current.click();
|
|
5736
5767
|
},
|
|
@@ -5751,6 +5782,11 @@ FilePicker.config = {
|
|
|
5751
5782
|
label: 'File picker',
|
|
5752
5783
|
group: 'basic-input',
|
|
5753
5784
|
emptyValue: null,
|
|
5785
|
+
sanitizeValue: ({
|
|
5786
|
+
value
|
|
5787
|
+
}) => {
|
|
5788
|
+
return value;
|
|
5789
|
+
},
|
|
5754
5790
|
create: (options = {}) => ({
|
|
5755
5791
|
...options
|
|
5756
5792
|
})
|
|
@@ -5929,7 +5965,7 @@ class FormFields {
|
|
|
5929
5965
|
}
|
|
5930
5966
|
}
|
|
5931
5967
|
|
|
5932
|
-
const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url', 'dataSource', 'columnsExpression', 'expression'
|
|
5968
|
+
const EXPRESSION_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'conditional.hide', 'description', 'label', 'source', 'readonly', 'text', 'validate.min', 'validate.max', 'validate.minLength', 'validate.maxLength', 'valuesExpression', 'url', 'dataSource', 'columnsExpression', 'expression'];
|
|
5933
5969
|
const TEMPLATE_PROPERTIES = ['alt', 'appearance.prefixAdorner', 'appearance.suffixAdorner', 'description', 'label', 'source', 'text', 'content', 'url'];
|
|
5934
5970
|
|
|
5935
5971
|
/**
|
|
@@ -6147,21 +6183,11 @@ class ConditionChecker {
|
|
|
6147
6183
|
// if we have a hidden repeatable field, and the data structure allows, we clear it directly at the root and stop recursion
|
|
6148
6184
|
if (context.isHidden && isRepeatable) {
|
|
6149
6185
|
context.preventRecursion = true;
|
|
6150
|
-
this._eventBus.fire('conditionChecker.remove', {
|
|
6151
|
-
item: {
|
|
6152
|
-
[field.key]: get(workingData, getFilterPath(field, indexes))
|
|
6153
|
-
}
|
|
6154
|
-
});
|
|
6155
6186
|
this._cleanlyClearDataAtPath(getFilterPath(field, indexes), workingData);
|
|
6156
6187
|
}
|
|
6157
6188
|
|
|
6158
6189
|
// for simple leaf fields, we always clear
|
|
6159
6190
|
if (context.isHidden && isClosed) {
|
|
6160
|
-
this._eventBus.fire('conditionChecker.remove', {
|
|
6161
|
-
item: {
|
|
6162
|
-
[field.key]: get(workingData, getFilterPath(field, indexes))
|
|
6163
|
-
}
|
|
6164
|
-
});
|
|
6165
6191
|
this._cleanlyClearDataAtPath(getFilterPath(field, indexes), workingData);
|
|
6166
6192
|
}
|
|
6167
6193
|
});
|
|
@@ -6893,7 +6919,7 @@ const ViewerCommandsModule = {
|
|
|
6893
6919
|
};
|
|
6894
6920
|
|
|
6895
6921
|
var _path$3;
|
|
6896
|
-
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (
|
|
6922
|
+
function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
|
|
6897
6923
|
var SvgExpand = function SvgExpand(props) {
|
|
6898
6924
|
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
6899
6925
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6907,7 +6933,7 @@ var SvgExpand = function SvgExpand(props) {
|
|
|
6907
6933
|
};
|
|
6908
6934
|
|
|
6909
6935
|
var _path$2;
|
|
6910
|
-
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (
|
|
6936
|
+
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
6911
6937
|
var SvgCollapse = function SvgCollapse(props) {
|
|
6912
6938
|
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
6913
6939
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6921,7 +6947,7 @@ var SvgCollapse = function SvgCollapse(props) {
|
|
|
6921
6947
|
};
|
|
6922
6948
|
|
|
6923
6949
|
var _path$1, _path2;
|
|
6924
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
6950
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
6925
6951
|
var SvgAdd = function SvgAdd(props) {
|
|
6926
6952
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
6927
6953
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6938,7 +6964,7 @@ var SvgAdd = function SvgAdd(props) {
|
|
|
6938
6964
|
};
|
|
6939
6965
|
|
|
6940
6966
|
var _path;
|
|
6941
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
6967
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
6942
6968
|
var SvgDelete = function SvgDelete(props) {
|
|
6943
6969
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
6944
6970
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6955,16 +6981,11 @@ var SvgDelete = function SvgDelete(props) {
|
|
|
6955
6981
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
6956
6982
|
|
|
6957
6983
|
class RepeatRenderManager {
|
|
6958
|
-
constructor(form, formFields, formFieldRegistry, pathRegistry
|
|
6984
|
+
constructor(form, formFields, formFieldRegistry, pathRegistry) {
|
|
6959
6985
|
this._form = form;
|
|
6960
|
-
/** @type {import('../../render/FormFields').FormFields} */
|
|
6961
6986
|
this._formFields = formFields;
|
|
6962
|
-
/** @type {import('../../core/FormFieldRegistry').FormFieldRegistry} */
|
|
6963
6987
|
this._formFieldRegistry = formFieldRegistry;
|
|
6964
|
-
/** @type {import('../../core/PathRegistry').PathRegistry} */
|
|
6965
6988
|
this._pathRegistry = pathRegistry;
|
|
6966
|
-
/** @type {import('../../core/EventBus').EventBus} */
|
|
6967
|
-
this._eventBus = eventBus;
|
|
6968
6989
|
this.Repeater = this.Repeater.bind(this);
|
|
6969
6990
|
this.RepeatFooter = this.RepeatFooter.bind(this);
|
|
6970
6991
|
}
|
|
@@ -7004,18 +7025,11 @@ class RepeatRenderManager {
|
|
|
7004
7025
|
const isCollapsed = collapseEnabled && sharedRepeatState.isCollapsed;
|
|
7005
7026
|
const hasChildren = repeaterField.components && repeaterField.components.length > 0;
|
|
7006
7027
|
const showRemove = repeaterField.allowAddRemove && hasChildren;
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
* @param {number} index
|
|
7010
|
-
*/
|
|
7028
|
+
const displayValues = isCollapsed ? values.slice(0, nonCollapsedItems) : values;
|
|
7029
|
+
const hiddenValues = isCollapsed ? values.slice(nonCollapsedItems) : [];
|
|
7011
7030
|
const onDeleteItem = index => {
|
|
7012
7031
|
const updatedValues = values.slice();
|
|
7013
|
-
|
|
7014
|
-
this._eventBus.fire('repeatRenderManager.remove', {
|
|
7015
|
-
dataPath,
|
|
7016
|
-
index,
|
|
7017
|
-
item: removedItem
|
|
7018
|
-
});
|
|
7032
|
+
updatedValues.splice(index, 1);
|
|
7019
7033
|
props.onChange({
|
|
7020
7034
|
field: repeaterField,
|
|
7021
7035
|
value: updatedValues,
|
|
@@ -7023,13 +7037,21 @@ class RepeatRenderManager {
|
|
|
7023
7037
|
});
|
|
7024
7038
|
};
|
|
7025
7039
|
const parentExpressionContextInfo = useContext(LocalExpressionContext);
|
|
7026
|
-
return
|
|
7027
|
-
children:
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7040
|
+
return jsxs(Fragment, {
|
|
7041
|
+
children: [displayValues.map((itemValue, itemIndex) => jsx(RepetitionScaffold, {
|
|
7042
|
+
itemIndex: itemIndex,
|
|
7043
|
+
itemValue: itemValue,
|
|
7044
|
+
parentExpressionContextInfo: parentExpressionContextInfo,
|
|
7045
|
+
repeaterField: repeaterField,
|
|
7046
|
+
RowsRenderer: RowsRenderer,
|
|
7047
|
+
indexes: indexes,
|
|
7048
|
+
onDeleteItem: onDeleteItem,
|
|
7049
|
+
showRemove: showRemove,
|
|
7050
|
+
...restProps
|
|
7051
|
+
}, itemIndex)), hiddenValues.length > 0 ? jsx("div", {
|
|
7052
|
+
className: "fjs-repeat-row-collapsed",
|
|
7053
|
+
children: hiddenValues.map((itemValue, itemIndex) => jsx(RepetitionScaffold, {
|
|
7054
|
+
itemIndex: itemIndex + nonCollapsedItems,
|
|
7033
7055
|
itemValue: itemValue,
|
|
7034
7056
|
parentExpressionContextInfo: parentExpressionContextInfo,
|
|
7035
7057
|
repeaterField: repeaterField,
|
|
@@ -7038,8 +7060,8 @@ class RepeatRenderManager {
|
|
|
7038
7060
|
onDeleteItem: onDeleteItem,
|
|
7039
7061
|
showRemove: showRemove,
|
|
7040
7062
|
...restProps
|
|
7041
|
-
})
|
|
7042
|
-
})
|
|
7063
|
+
}, itemIndex))
|
|
7064
|
+
}) : null]
|
|
7043
7065
|
});
|
|
7044
7066
|
}
|
|
7045
7067
|
RepeatFooter(props) {
|
|
@@ -7082,11 +7104,6 @@ class RepeatRenderManager {
|
|
|
7082
7104
|
});
|
|
7083
7105
|
updatedValues.push(newItem);
|
|
7084
7106
|
shouldScroll.current = true;
|
|
7085
|
-
this._eventBus.fire('repeatRenderManager.add', {
|
|
7086
|
-
dataPath,
|
|
7087
|
-
index: updatedValues.length - 1,
|
|
7088
|
-
item: newItem
|
|
7089
|
-
});
|
|
7090
7107
|
props.onChange({
|
|
7091
7108
|
value: updatedValues
|
|
7092
7109
|
});
|
|
@@ -7119,7 +7136,7 @@ class RepeatRenderManager {
|
|
|
7119
7136
|
class: "fjs-repeat-render-collapse",
|
|
7120
7137
|
onClick: toggle,
|
|
7121
7138
|
children: isCollapsed ? jsxs(Fragment, {
|
|
7122
|
-
children: [jsx(SvgExpand, {}), " ", `Expand all (${values.length
|
|
7139
|
+
children: [jsx(SvgExpand, {}), " ", `Expand all (${values.length})`]
|
|
7123
7140
|
}) : jsxs(Fragment, {
|
|
7124
7141
|
children: [jsx(SvgCollapse, {}), " ", 'Collapse']
|
|
7125
7142
|
})
|
|
@@ -7143,7 +7160,7 @@ class RepeatRenderManager {
|
|
|
7143
7160
|
* @param {Object} props.itemValue
|
|
7144
7161
|
* @param {Object} props.parentExpressionContextInfo
|
|
7145
7162
|
* @param {Object} props.repeaterField
|
|
7146
|
-
* @param {
|
|
7163
|
+
* @param {import('preact').FunctionComponent} props.RowsRenderer
|
|
7147
7164
|
* @param {Object} props.indexes
|
|
7148
7165
|
* @param {Function} props.onDeleteItem
|
|
7149
7166
|
* @param {boolean} props.showRemove
|
|
@@ -7204,7 +7221,7 @@ const RepetitionScaffold = props => {
|
|
|
7204
7221
|
})]
|
|
7205
7222
|
});
|
|
7206
7223
|
};
|
|
7207
|
-
RepeatRenderManager.$inject = ['form', 'formFields', 'formFieldRegistry', 'pathRegistry'
|
|
7224
|
+
RepeatRenderManager.$inject = ['form', 'formFields', 'formFieldRegistry', 'pathRegistry'];
|
|
7208
7225
|
|
|
7209
7226
|
const RepeatRenderModule = {
|
|
7210
7227
|
__init__: ['repeatRenderManager'],
|
|
@@ -8027,7 +8044,7 @@ class FieldFactory {
|
|
|
8027
8044
|
this._pathRegistry = pathRegistry;
|
|
8028
8045
|
this._formFields = formFields;
|
|
8029
8046
|
}
|
|
8030
|
-
create(attrs,
|
|
8047
|
+
create(attrs, isNewField = true) {
|
|
8031
8048
|
const {
|
|
8032
8049
|
id,
|
|
8033
8050
|
type,
|
|
@@ -8066,13 +8083,12 @@ class FieldFactory {
|
|
|
8066
8083
|
})) {
|
|
8067
8084
|
throw new Error(`binding path '${[...parentPath, ...path.split('.')].join('.')}' is already claimed`);
|
|
8068
8085
|
}
|
|
8069
|
-
const labelAttrs = applyDefaults && config.label ? {
|
|
8070
|
-
label: config.label
|
|
8071
|
-
} : {};
|
|
8072
8086
|
const field = config.create({
|
|
8073
|
-
...
|
|
8087
|
+
...(config.label ? {
|
|
8088
|
+
label: config.label
|
|
8089
|
+
} : {}),
|
|
8074
8090
|
...attrs
|
|
8075
|
-
});
|
|
8091
|
+
}, isNewField);
|
|
8076
8092
|
this._ensureId(field);
|
|
8077
8093
|
if (config.keyed) {
|
|
8078
8094
|
this._ensureKey(field);
|
|
@@ -8595,52 +8611,39 @@ class FormFieldInstanceRegistry {
|
|
|
8595
8611
|
this._formFieldInstances = {};
|
|
8596
8612
|
eventBus.on('form.clear', () => this.clear());
|
|
8597
8613
|
}
|
|
8598
|
-
|
|
8614
|
+
add(instance) {
|
|
8599
8615
|
const {
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
...restInfo
|
|
8609
|
-
};
|
|
8610
|
-
this._eventBus.fire('formFieldInstance.added', {
|
|
8611
|
-
instanceId
|
|
8612
|
-
});
|
|
8613
|
-
} else if (!isInstanceExpected && doesInstanceExist) {
|
|
8614
|
-
delete this._formFieldInstances[instanceId];
|
|
8615
|
-
this._eventBus.fire('formFieldInstance.removed', {
|
|
8616
|
-
instanceId
|
|
8617
|
-
});
|
|
8618
|
-
} else if (isInstanceExpected && doesInstanceExist) {
|
|
8619
|
-
const wasInstanceChaged = Object.keys(restInfo).some(key => {
|
|
8620
|
-
return this._formFieldInstances[instanceId][key] !== restInfo[key];
|
|
8621
|
-
});
|
|
8622
|
-
if (wasInstanceChaged) {
|
|
8623
|
-
this._formFieldInstances[instanceId] = {
|
|
8624
|
-
instanceId,
|
|
8625
|
-
...restInfo
|
|
8626
|
-
};
|
|
8627
|
-
this._eventBus.fire('formFieldInstance.changed', {
|
|
8628
|
-
instanceId
|
|
8629
|
-
});
|
|
8630
|
-
}
|
|
8616
|
+
id,
|
|
8617
|
+
expressionContextInfo,
|
|
8618
|
+
valuePath,
|
|
8619
|
+
indexes
|
|
8620
|
+
} = instance;
|
|
8621
|
+
const instanceId = [id, ...Object.values(indexes || {})].join('_');
|
|
8622
|
+
if (this._formFieldInstances[instanceId]) {
|
|
8623
|
+
throw new Error('this form field instance is already registered');
|
|
8631
8624
|
}
|
|
8625
|
+
this._formFieldInstances[instanceId] = {
|
|
8626
|
+
id,
|
|
8627
|
+
instanceId,
|
|
8628
|
+
expressionContextInfo,
|
|
8629
|
+
valuePath,
|
|
8630
|
+
indexes
|
|
8631
|
+
};
|
|
8632
|
+
this._eventBus.fire('formFieldInstanceRegistry.changed', {
|
|
8633
|
+
instanceId,
|
|
8634
|
+
action: 'added'
|
|
8635
|
+
});
|
|
8632
8636
|
return instanceId;
|
|
8633
8637
|
}
|
|
8634
|
-
|
|
8635
|
-
if (this._formFieldInstances[instanceId]) {
|
|
8636
|
-
|
|
8637
|
-
this._eventBus.fire('formFieldInstance.removed', {
|
|
8638
|
-
instanceId
|
|
8639
|
-
});
|
|
8638
|
+
remove(instanceId) {
|
|
8639
|
+
if (!this._formFieldInstances[instanceId]) {
|
|
8640
|
+
return;
|
|
8640
8641
|
}
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8642
|
+
delete this._formFieldInstances[instanceId];
|
|
8643
|
+
this._eventBus.fire('formFieldInstanceRegistry.changed', {
|
|
8644
|
+
instanceId,
|
|
8645
|
+
action: 'removed'
|
|
8646
|
+
});
|
|
8644
8647
|
}
|
|
8645
8648
|
getAll() {
|
|
8646
8649
|
return Object.values(this._formFieldInstances);
|
|
@@ -8720,122 +8723,10 @@ function Renderer(config, eventBus, form, injector) {
|
|
|
8720
8723
|
}
|
|
8721
8724
|
Renderer.$inject = ['config.renderer', 'eventBus', 'form', 'injector'];
|
|
8722
8725
|
|
|
8723
|
-
/**
|
|
8724
|
-
* @typedef {Record<PropertyKey, unknown>} RemovedData
|
|
8725
|
-
* @param {RemovedData} removedData
|
|
8726
|
-
* @returns {string[]}
|
|
8727
|
-
*/
|
|
8728
|
-
const extractFileReferencesFromRemovedData = removedData => {
|
|
8729
|
-
/** @type {string[]} */
|
|
8730
|
-
const fileReferences = [];
|
|
8731
|
-
if (removedData === null) {
|
|
8732
|
-
return fileReferences;
|
|
8733
|
-
}
|
|
8734
|
-
Object.values(removedData).forEach(value => {
|
|
8735
|
-
if (value === null) {
|
|
8736
|
-
return;
|
|
8737
|
-
}
|
|
8738
|
-
if (typeof value === 'object') {
|
|
8739
|
-
fileReferences.push(...extractFileReferencesFromRemovedData( /** @type {RemovedData} */value));
|
|
8740
|
-
} else if (Array.isArray(value)) {
|
|
8741
|
-
fileReferences.push(...value.map(extractFileReferencesFromRemovedData).flat());
|
|
8742
|
-
} else if (typeof value === 'string' && value.startsWith(FILE_PICKER_FILE_KEY_PREFIX)) {
|
|
8743
|
-
fileReferences.push(value);
|
|
8744
|
-
}
|
|
8745
|
-
});
|
|
8746
|
-
return fileReferences;
|
|
8747
|
-
};
|
|
8748
|
-
|
|
8749
|
-
const fileRegistry = Symbol('fileRegistry');
|
|
8750
|
-
const eventBusSymbol = Symbol('eventBus');
|
|
8751
|
-
const formFieldRegistrySymbol = Symbol('formFieldRegistry');
|
|
8752
|
-
const formFieldInstanceRegistrySymbol = Symbol('formFieldInstanceRegistry');
|
|
8753
|
-
const EMPTY_ARRAY = [];
|
|
8754
|
-
class FileRegistry {
|
|
8755
|
-
/**
|
|
8756
|
-
* @param {import('../core/EventBus').EventBus} eventBus
|
|
8757
|
-
* @param {import('../core/FormFieldRegistry').FormFieldRegistry} formFieldRegistry
|
|
8758
|
-
* @param {import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry} formFieldInstanceRegistry
|
|
8759
|
-
*/
|
|
8760
|
-
constructor(eventBus, formFieldRegistry, formFieldInstanceRegistry) {
|
|
8761
|
-
/** @type {Map<string, File[]>} */
|
|
8762
|
-
this[fileRegistry] = new Map();
|
|
8763
|
-
/** @type {import('../core/EventBus').EventBus} */
|
|
8764
|
-
this[eventBusSymbol] = eventBus;
|
|
8765
|
-
/** @type {import('../core/FormFieldRegistry').FormFieldRegistry} */
|
|
8766
|
-
this[formFieldRegistrySymbol] = formFieldRegistry;
|
|
8767
|
-
/** @type {import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry} */
|
|
8768
|
-
this[formFieldInstanceRegistrySymbol] = formFieldInstanceRegistry;
|
|
8769
|
-
const removeFileHandler = ({
|
|
8770
|
-
item
|
|
8771
|
-
}) => {
|
|
8772
|
-
const fileReferences = extractFileReferencesFromRemovedData(item);
|
|
8773
|
-
|
|
8774
|
-
// Remove all file references from the registry
|
|
8775
|
-
fileReferences.forEach(fileReference => {
|
|
8776
|
-
this.deleteFiles(fileReference);
|
|
8777
|
-
});
|
|
8778
|
-
};
|
|
8779
|
-
eventBus.on('form.clear', () => this.clear());
|
|
8780
|
-
eventBus.on('conditionChecker.remove', removeFileHandler);
|
|
8781
|
-
eventBus.on('repeatRenderManager.remove', removeFileHandler);
|
|
8782
|
-
}
|
|
8783
|
-
|
|
8784
|
-
/**
|
|
8785
|
-
* @param {string} id
|
|
8786
|
-
* @param {File[]} files
|
|
8787
|
-
*/
|
|
8788
|
-
setFiles(id, files) {
|
|
8789
|
-
this[fileRegistry].set(id, files);
|
|
8790
|
-
}
|
|
8791
|
-
|
|
8792
|
-
/**
|
|
8793
|
-
* @param {string} id
|
|
8794
|
-
* @returns {File[]}
|
|
8795
|
-
*/
|
|
8796
|
-
getFiles(id) {
|
|
8797
|
-
return this[fileRegistry].get(id) || EMPTY_ARRAY;
|
|
8798
|
-
}
|
|
8799
|
-
|
|
8800
|
-
/**
|
|
8801
|
-
* @returns {string[]}
|
|
8802
|
-
*/
|
|
8803
|
-
getKeys() {
|
|
8804
|
-
return Array.from(this[fileRegistry].keys());
|
|
8805
|
-
}
|
|
8806
|
-
|
|
8807
|
-
/**
|
|
8808
|
-
* @param {string} id
|
|
8809
|
-
* @returns {boolean}
|
|
8810
|
-
*/
|
|
8811
|
-
hasKey(id) {
|
|
8812
|
-
return this[fileRegistry].has(id);
|
|
8813
|
-
}
|
|
8814
|
-
|
|
8815
|
-
/**
|
|
8816
|
-
* @param {string} id
|
|
8817
|
-
*/
|
|
8818
|
-
deleteFiles(id) {
|
|
8819
|
-
this[fileRegistry].delete(id);
|
|
8820
|
-
}
|
|
8821
|
-
|
|
8822
|
-
/**
|
|
8823
|
-
* @returns {Map<string, File[]>}
|
|
8824
|
-
*/
|
|
8825
|
-
getAllFiles() {
|
|
8826
|
-
return new Map(this[fileRegistry]);
|
|
8827
|
-
}
|
|
8828
|
-
clear() {
|
|
8829
|
-
this[fileRegistry].clear();
|
|
8830
|
-
}
|
|
8831
|
-
}
|
|
8832
|
-
FileRegistry.$inject = ['eventBus', 'formFieldRegistry', 'formFieldInstanceRegistry'];
|
|
8833
|
-
|
|
8834
8726
|
const RenderModule = {
|
|
8835
8727
|
__init__: ['formFields', 'renderer'],
|
|
8836
8728
|
formFields: ['type', FormFields],
|
|
8837
|
-
renderer: ['type', Renderer]
|
|
8838
|
-
fileRegistry: ['type', FileRegistry]
|
|
8729
|
+
renderer: ['type', Renderer]
|
|
8839
8730
|
};
|
|
8840
8731
|
|
|
8841
8732
|
const CoreModule = {
|
|
@@ -8988,7 +8879,7 @@ class Form {
|
|
|
8988
8879
|
/**
|
|
8989
8880
|
* Submit the form, triggering all field validations.
|
|
8990
8881
|
*
|
|
8991
|
-
* @returns { { data: Data, errors: Errors
|
|
8882
|
+
* @returns { { data: Data, errors: Errors } }
|
|
8992
8883
|
*/
|
|
8993
8884
|
submit() {
|
|
8994
8885
|
const {
|
|
@@ -9000,11 +8891,9 @@ class Form {
|
|
|
9000
8891
|
this._emit('presubmit');
|
|
9001
8892
|
const data = this._getSubmitData();
|
|
9002
8893
|
const errors = this.validate();
|
|
9003
|
-
const files = this.get('fileRegistry').getAllFiles();
|
|
9004
8894
|
const result = {
|
|
9005
8895
|
data,
|
|
9006
|
-
errors
|
|
9007
|
-
files
|
|
8896
|
+
errors
|
|
9008
8897
|
};
|
|
9009
8898
|
this._emit('submit', result);
|
|
9010
8899
|
return result;
|
|
@@ -9323,7 +9212,7 @@ class Form {
|
|
|
9323
9212
|
}
|
|
9324
9213
|
}
|
|
9325
9214
|
|
|
9326
|
-
const schemaVersion =
|
|
9215
|
+
const schemaVersion = 17;
|
|
9327
9216
|
|
|
9328
9217
|
/**
|
|
9329
9218
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|