@react-typed-forms/schemas-html 3.0.0 → 4.0.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/lib/components/CheckRenderer.d.ts +6 -8
- package/lib/components/ControlInput.d.ts +9 -2
- package/lib/components/DefaultAccordion.d.ts +1 -1
- package/lib/components/DefaultArrayRenderer.d.ts +5 -1
- package/lib/components/DefaultDialogRenderer.d.ts +20 -0
- package/lib/components/DefaultDisplay.d.ts +4 -1
- package/lib/components/DefaultDisplayOnly.d.ts +5 -5
- package/lib/components/DefaultGroupRenderer.d.ts +8 -10
- package/lib/components/DefaultLayout.d.ts +2 -3
- package/lib/components/DefaultVisibility.d.ts +3 -2
- package/lib/components/DefaultWizardRenderer.d.ts +28 -0
- package/lib/components/GridRenderer.d.ts +6 -0
- package/lib/components/JsonataRenderer.d.ts +3 -2
- package/lib/components/TabsRenderer.d.ts +0 -5
- package/lib/components/ValueForFieldRenderer.d.ts +2 -0
- package/lib/components/VisibleChildrenRenderer.d.ts +14 -0
- package/lib/createButtonActionRenderer.d.ts +21 -0
- package/lib/createDefaultRenderers.d.ts +26 -11
- package/lib/index.cjs +1314 -612
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1238 -543
- package/lib/index.js.map +1 -1
- package/lib/tailwind.d.ts +20 -6
- package/package.json +9 -8
package/lib/index.js
CHANGED
|
@@ -1,86 +1,109 @@
|
|
|
1
|
-
import React, { createElement, useState, useMemo, Fragment, useEffect, useRef } from 'react';
|
|
2
1
|
import clsx from 'clsx';
|
|
3
|
-
import { DisplayDataType, rendererClass, coerceToString, getOverrideClass, FieldType, createDataRenderer, fieldOptionAdornment, DataRenderType, createLayoutRenderer, renderLayoutParts, createGroupRenderer, GroupRenderType,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { DisplayDataType, rendererClass, coerceToString, getOverrideClass, FieldType, createDataRenderer, fieldOptionAdornment, DataRenderType, createLayoutRenderer, renderLayoutParts, createGroupRenderer, GroupRenderType, fontAwesomeIcon, deepMerge, createAction, IconPlacement, visitFormDataInContext, validationVisitor, ActionStyle, isTabsRenderer, isGridRenderer, isWizardRenderer, isDialogRenderer, isSelectChildRenderer, isFlexRenderer, isInlineRenderer, useExpression, createVisibilityRenderer, getJsonPath, ExpressionType, getLastDefinedValue, getNullToggler, mergeObjects, isArrayRenderer, isCompoundField, ControlDefinitionType, createArrayActions, getLengthRestrictions, applyArrayLengthRestrictions, buildSchema, stringField, boolField, schemaDataForFieldRef, schemaForFieldRef, defaultControlForField, createSchemaTree, useControlRendererComponent, makeSchemaDataNode, createAdornmentRenderer, getIsEditing, appendMarkupAt, AdornmentPlacement, wrapMarkup, getAllValues, ControlAdornmentType, getExternalEditData, createActionRenderer, isDataGroupRenderer, isDisplayOnlyRenderer, hasOptions, isTextfieldRenderer, isOptionalAdornment, isSetFieldAdornment, wrapLayout, isIconAdornment, isAccordionAdornment, LabelType, IconLibrary } from '@react-typed-forms/schemas';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useComponentTracking, formControlProps, useControl, useControlEffect, RenderArrayElements, useComputed, RenderElements, controlValues, removeElement, trackedValue, setFields, newControl, Fcheckbox as Fcheckbox$1 } from '@react-typed-forms/core';
|
|
5
|
+
import { useState, useMemo, useEffect, Fragment as Fragment$1, createElement, useRef } from 'react';
|
|
6
|
+
import { createOverlayState, Dialog, Modal } from '@astroapps/aria-base';
|
|
6
7
|
import { useAutocomplete } from '@mui/base';
|
|
7
|
-
import { Modal, Dialog } from '@astroapps/aria-base';
|
|
8
8
|
import { useOverlayTriggerState } from '@react-stately/overlays';
|
|
9
9
|
|
|
10
|
-
function _extends() {
|
|
11
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
12
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
13
|
-
var t = arguments[e];
|
|
14
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
15
|
-
}
|
|
16
|
-
return n;
|
|
17
|
-
}, _extends.apply(null, arguments);
|
|
18
|
-
}
|
|
19
|
-
function _objectDestructuringEmpty(t) {
|
|
20
|
-
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
21
|
-
}
|
|
22
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
23
|
-
if (null == r) return {};
|
|
24
|
-
var t = {};
|
|
25
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
26
|
-
if (e.includes(n)) continue;
|
|
27
|
-
t[n] = r[n];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const _excluded$4 = ["data", "display", "className", "style", "renderer"];
|
|
33
10
|
function createDefaultDisplayRenderer(options = {}) {
|
|
34
11
|
return {
|
|
35
|
-
render: (props, renderer) =>
|
|
12
|
+
render: (props, renderer) => /*#__PURE__*/jsx(DefaultDisplay, {
|
|
13
|
+
options: options,
|
|
14
|
+
displayProps: props,
|
|
36
15
|
renderer: renderer
|
|
37
|
-
})
|
|
16
|
+
}),
|
|
38
17
|
type: "display"
|
|
39
18
|
};
|
|
40
19
|
}
|
|
41
|
-
function DefaultDisplay(
|
|
20
|
+
function DefaultDisplay({
|
|
21
|
+
renderer,
|
|
22
|
+
options,
|
|
23
|
+
displayProps
|
|
24
|
+
}) {
|
|
42
25
|
var _effect = useComponentTracking();
|
|
43
26
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
27
|
+
var _iconDisplay$icon, _iconDisplay$icon2;
|
|
28
|
+
const {
|
|
29
|
+
data,
|
|
30
|
+
display,
|
|
31
|
+
className,
|
|
32
|
+
textClass,
|
|
33
|
+
style
|
|
34
|
+
} = displayProps;
|
|
35
|
+
const {
|
|
36
|
+
I,
|
|
37
|
+
Div,
|
|
38
|
+
B,
|
|
39
|
+
H1,
|
|
40
|
+
Span
|
|
41
|
+
} = renderer.html;
|
|
53
42
|
switch (data.type) {
|
|
54
43
|
case DisplayDataType.Icon:
|
|
55
|
-
|
|
44
|
+
const iconDisplay = data;
|
|
45
|
+
return /*#__PURE__*/jsx(I, {
|
|
56
46
|
style: style,
|
|
57
|
-
className: clsx(getOverrideClass(className), display ? display.value :
|
|
47
|
+
className: clsx(getOverrideClass(className), display ? display.value : iconDisplay.iconClass),
|
|
48
|
+
iconName: display ? display.value : (_iconDisplay$icon = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon.name,
|
|
49
|
+
iconLibrary: (_iconDisplay$icon2 = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon2.library
|
|
58
50
|
});
|
|
59
51
|
case DisplayDataType.Text:
|
|
60
|
-
|
|
52
|
+
const text = display ? coerceToString(display.value) : data.text;
|
|
53
|
+
return /*#__PURE__*/jsx(Div, {
|
|
61
54
|
style: style,
|
|
62
|
-
className: rendererClass(className, options.textClassName)
|
|
63
|
-
|
|
55
|
+
className: rendererClass(className, options.textClassName),
|
|
56
|
+
textClass: rendererClass(textClass, options.textTextClass),
|
|
57
|
+
text: text,
|
|
58
|
+
inline: displayProps.inline
|
|
59
|
+
});
|
|
64
60
|
case DisplayDataType.Html:
|
|
65
|
-
return
|
|
61
|
+
return /*#__PURE__*/jsx(Div, {
|
|
66
62
|
style: style,
|
|
67
63
|
className: rendererClass(className, options.htmlClassName),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
64
|
+
inline: displayProps.inline,
|
|
65
|
+
html: display ? coerceToString(display.value) : data.html
|
|
71
66
|
});
|
|
72
67
|
case DisplayDataType.Custom:
|
|
73
|
-
return
|
|
68
|
+
return /*#__PURE__*/jsx(Div, {
|
|
69
|
+
children: /*#__PURE__*/jsxs(B, {
|
|
70
|
+
children: ["(", data.customId, ")"]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
74
73
|
default:
|
|
75
|
-
return
|
|
74
|
+
return /*#__PURE__*/jsxs(H1, {
|
|
75
|
+
children: ["Unknown display type: ", data.type]
|
|
76
|
+
});
|
|
76
77
|
}
|
|
77
78
|
} finally {
|
|
78
79
|
_effect();
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
function _extends() {
|
|
84
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
85
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
86
|
+
var t = arguments[e];
|
|
87
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
88
|
+
}
|
|
89
|
+
return n;
|
|
90
|
+
}, _extends.apply(null, arguments);
|
|
91
|
+
}
|
|
92
|
+
function _objectDestructuringEmpty(t) {
|
|
93
|
+
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
94
|
+
}
|
|
95
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
96
|
+
if (null == r) return {};
|
|
97
|
+
var t = {};
|
|
98
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
99
|
+
if (e.includes(n)) continue;
|
|
100
|
+
t[n] = r[n];
|
|
101
|
+
}
|
|
102
|
+
return t;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const _excluded$4 = ["control", "convert", "renderer"],
|
|
106
|
+
_excluded2$2 = ["errorText", "value", "onChange", "ref"];
|
|
84
107
|
function ControlInput(_ref) {
|
|
85
108
|
var _effect = useComponentTracking();
|
|
86
109
|
try {
|
|
@@ -89,22 +112,25 @@ function ControlInput(_ref) {
|
|
|
89
112
|
convert,
|
|
90
113
|
renderer
|
|
91
114
|
} = _ref,
|
|
92
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
115
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
93
116
|
const _formControlProps = formControlProps(control),
|
|
94
117
|
{
|
|
95
|
-
value
|
|
118
|
+
value,
|
|
119
|
+
ref
|
|
96
120
|
} = _formControlProps,
|
|
97
|
-
inputProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$
|
|
121
|
+
inputProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$2);
|
|
98
122
|
const textValue = useControl(() => toText(value));
|
|
99
123
|
useControlEffect(() => control.value, v => textValue.value = toText(v));
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
124
|
+
const {
|
|
125
|
+
Input
|
|
126
|
+
} = renderer.html;
|
|
127
|
+
return /*#__PURE__*/jsx(Input, _extends({}, inputProps, {
|
|
128
|
+
inputRef: ref,
|
|
103
129
|
type: convert[0],
|
|
104
130
|
value: textValue.value,
|
|
105
|
-
|
|
106
|
-
textValue.value = e
|
|
107
|
-
const converted = convert[1](e
|
|
131
|
+
onChangeValue: e => {
|
|
132
|
+
textValue.value = e;
|
|
133
|
+
const converted = convert[1](e);
|
|
108
134
|
if (converted !== undefined) control.value = converted;
|
|
109
135
|
}
|
|
110
136
|
}, props));
|
|
@@ -144,11 +170,11 @@ function createInputConversion(ft) {
|
|
|
144
170
|
}
|
|
145
171
|
}
|
|
146
172
|
|
|
147
|
-
const _excluded$
|
|
173
|
+
const _excluded$3 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "readonly"];
|
|
148
174
|
function createSelectRenderer(options = {}) {
|
|
149
175
|
return createDataRenderer((props, asArray) => {
|
|
150
176
|
var _props$options;
|
|
151
|
-
return
|
|
177
|
+
return /*#__PURE__*/jsx(SelectDataRenderer, {
|
|
152
178
|
className: rendererClass(props.className, options.className),
|
|
153
179
|
state: props.control,
|
|
154
180
|
id: props.id,
|
|
@@ -176,7 +202,7 @@ function SelectDataRenderer(_ref) {
|
|
|
176
202
|
requiredText = "<please select>",
|
|
177
203
|
readonly
|
|
178
204
|
} = _ref,
|
|
179
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
205
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
180
206
|
const {
|
|
181
207
|
value,
|
|
182
208
|
disabled
|
|
@@ -184,23 +210,25 @@ function SelectDataRenderer(_ref) {
|
|
|
184
210
|
const [showEmpty] = useState(!required || value == null);
|
|
185
211
|
const optionStringMap = useMemo(() => Object.fromEntries(options.map(x => [convert(x.value), x.value])), [options]);
|
|
186
212
|
const optionGroups = useMemo(() => new Set(options.filter(x => x.group).map(x => x.group)), [options]);
|
|
187
|
-
return
|
|
213
|
+
return /*#__PURE__*/jsxs("select", _extends({}, props, {
|
|
188
214
|
className: className,
|
|
189
215
|
onChange: v => state.value = optionStringMap[v.target.value],
|
|
190
216
|
value: convert(value),
|
|
191
|
-
disabled: disabled || readonly
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
217
|
+
disabled: disabled || readonly,
|
|
218
|
+
children: [showEmpty && /*#__PURE__*/jsx("option", {
|
|
219
|
+
value: "",
|
|
220
|
+
children: required ? requiredText : emptyText
|
|
221
|
+
}), [...optionGroups.keys()].map(x => /*#__PURE__*/jsx("optgroup", {
|
|
222
|
+
label: x,
|
|
223
|
+
children: options.filter(o => o.group === x).map(renderOption)
|
|
224
|
+
}, x)), options.filter(x => !x.group).map(renderOption)]
|
|
225
|
+
}));
|
|
198
226
|
function renderOption(x, i) {
|
|
199
|
-
return
|
|
200
|
-
key: i,
|
|
227
|
+
return /*#__PURE__*/jsx("option", {
|
|
201
228
|
value: convert(x.value),
|
|
202
|
-
disabled: !!x.disabled
|
|
203
|
-
|
|
229
|
+
disabled: !!x.disabled,
|
|
230
|
+
children: x.name
|
|
231
|
+
}, i);
|
|
204
232
|
}
|
|
205
233
|
} finally {
|
|
206
234
|
_effect();
|
|
@@ -220,16 +248,19 @@ function createSelectConversion(ft) {
|
|
|
220
248
|
}
|
|
221
249
|
}
|
|
222
250
|
|
|
223
|
-
const _excluded$
|
|
224
|
-
_excluded2 = ["value", "onChange", "errorText"];
|
|
251
|
+
const _excluded$2 = ["control", "type", "notValue", "renderer"],
|
|
252
|
+
_excluded2$1 = ["value", "onChange", "errorText", "ref"];
|
|
225
253
|
function createRadioRenderer(options = {}) {
|
|
226
|
-
return createDataRenderer((p, renderer) =>
|
|
254
|
+
return createDataRenderer((p, renderer) => /*#__PURE__*/jsx(CheckButtons, _extends({
|
|
227
255
|
classes: options,
|
|
228
256
|
controlClasses: p.renderOptions
|
|
229
257
|
}, p, {
|
|
230
258
|
className: rendererClass(p.className, options.className),
|
|
231
259
|
isChecked: (control, o) => control.value == o.value,
|
|
232
|
-
setChecked: (c, o) =>
|
|
260
|
+
setChecked: (c, o) => {
|
|
261
|
+
c.setTouched(true);
|
|
262
|
+
c.value = o.value;
|
|
263
|
+
},
|
|
233
264
|
control: p.control,
|
|
234
265
|
type: "radio",
|
|
235
266
|
entryAdornment: fieldOptionAdornment(p),
|
|
@@ -239,7 +270,7 @@ function createRadioRenderer(options = {}) {
|
|
|
239
270
|
});
|
|
240
271
|
}
|
|
241
272
|
function createCheckListRenderer(options = {}) {
|
|
242
|
-
return createDataRenderer((p, renderer) =>
|
|
273
|
+
return createDataRenderer((p, renderer) => /*#__PURE__*/jsx(CheckButtons, _extends({
|
|
243
274
|
classes: options,
|
|
244
275
|
controlClasses: p.renderOptions
|
|
245
276
|
}, p, {
|
|
@@ -249,6 +280,7 @@ function createCheckListRenderer(options = {}) {
|
|
|
249
280
|
return Array.isArray(v) ? v.includes(o.value) : false;
|
|
250
281
|
},
|
|
251
282
|
setChecked: (c, o, checked) => {
|
|
283
|
+
c.setTouched(true);
|
|
252
284
|
c.setValue(x => setIncluded(x != null ? x : [], o.value, checked));
|
|
253
285
|
},
|
|
254
286
|
control: p.control,
|
|
@@ -276,40 +308,50 @@ function CheckButtons({
|
|
|
276
308
|
}) {
|
|
277
309
|
var _effect = useComponentTracking();
|
|
278
310
|
try {
|
|
279
|
-
const
|
|
311
|
+
const {
|
|
312
|
+
Button,
|
|
313
|
+
Input,
|
|
314
|
+
Label,
|
|
315
|
+
Div
|
|
316
|
+
} = renderer.html;
|
|
280
317
|
const {
|
|
281
318
|
disabled
|
|
282
319
|
} = control;
|
|
283
320
|
const name = "r" + control.uniqueId;
|
|
284
|
-
return
|
|
321
|
+
return /*#__PURE__*/jsx(Div, {
|
|
285
322
|
className: className,
|
|
286
|
-
id: id
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
323
|
+
id: id,
|
|
324
|
+
children: /*#__PURE__*/jsx(RenderArrayElements, {
|
|
325
|
+
array: options == null ? void 0 : options.filter(x => x.value != null),
|
|
326
|
+
children: (o, i) => {
|
|
327
|
+
const checked = useComputed(() => isChecked(control, o)).value;
|
|
328
|
+
const selOrUnsel = checked ? rendererClass(controlClasses == null ? void 0 : controlClasses.selectedClass, classes.selectedClass) : rendererClass(controlClasses == null ? void 0 : controlClasses.notSelectedClass, classes.notSelectedClass);
|
|
329
|
+
return /*#__PURE__*/jsxs(Button, {
|
|
330
|
+
className: clsx(rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
|
|
331
|
+
onClick: () => !readonly && setChecked(control, o, !checked),
|
|
332
|
+
children: [/*#__PURE__*/jsxs(Div, {
|
|
333
|
+
className: classes.entryClass,
|
|
334
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
335
|
+
id: name + "_" + i,
|
|
336
|
+
className: classes.checkClass,
|
|
337
|
+
type: type,
|
|
338
|
+
name: name,
|
|
339
|
+
readOnly: readonly,
|
|
340
|
+
disabled: disabled,
|
|
341
|
+
checked: checked,
|
|
342
|
+
onChangeChecked: x => {
|
|
343
|
+
!readonly && setChecked(control, o, x);
|
|
344
|
+
}
|
|
345
|
+
}), /*#__PURE__*/jsx(Label, {
|
|
346
|
+
className: classes.labelClass,
|
|
347
|
+
htmlFor: name + "_" + i,
|
|
348
|
+
children: o.name
|
|
349
|
+
})]
|
|
350
|
+
}), entryAdornment == null ? void 0 : entryAdornment(o, i, checked)]
|
|
351
|
+
});
|
|
307
352
|
}
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
htmlFor: name + "_" + i
|
|
311
|
-
}, o.name)), entryAdornment == null ? void 0 : entryAdornment(o, i, checked));
|
|
312
|
-
}));
|
|
353
|
+
})
|
|
354
|
+
});
|
|
313
355
|
} finally {
|
|
314
356
|
_effect();
|
|
315
357
|
}
|
|
@@ -327,7 +369,7 @@ function setIncluded(array, elem, included) {
|
|
|
327
369
|
function createCheckboxRenderer(options = {}) {
|
|
328
370
|
return createDataRenderer((props, renderer) => p => _extends({}, p, {
|
|
329
371
|
label: undefined,
|
|
330
|
-
children:
|
|
372
|
+
children: /*#__PURE__*/jsx(CheckBox, {
|
|
331
373
|
p: p,
|
|
332
374
|
renderer: renderer,
|
|
333
375
|
options: options,
|
|
@@ -337,7 +379,20 @@ function createCheckboxRenderer(options = {}) {
|
|
|
337
379
|
renderType: DataRenderType.Checkbox
|
|
338
380
|
});
|
|
339
381
|
}
|
|
340
|
-
function
|
|
382
|
+
function createElementSelectedRenderer(options = {}) {
|
|
383
|
+
return createDataRenderer((props, renderer) => p => _extends({}, p, {
|
|
384
|
+
label: undefined,
|
|
385
|
+
children: /*#__PURE__*/jsx(CheckBoxSelected, {
|
|
386
|
+
p: p,
|
|
387
|
+
renderer: renderer,
|
|
388
|
+
options: options,
|
|
389
|
+
props: props
|
|
390
|
+
})
|
|
391
|
+
}), {
|
|
392
|
+
renderType: DataRenderType.ElementSelected
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function CheckBoxSelected({
|
|
341
396
|
p,
|
|
342
397
|
props,
|
|
343
398
|
renderer,
|
|
@@ -345,22 +400,63 @@ function CheckBox({
|
|
|
345
400
|
}) {
|
|
346
401
|
var _effect2 = useComponentTracking();
|
|
347
402
|
try {
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
403
|
+
const {
|
|
404
|
+
Div
|
|
405
|
+
} = renderer.html;
|
|
406
|
+
const elementValue = useControl();
|
|
407
|
+
useEffect(() => {
|
|
408
|
+
props.runExpression(elementValue, props.renderOptions.elementExpression, v => elementValue.value = v);
|
|
409
|
+
});
|
|
410
|
+
const isSelected = useComputed(() => {
|
|
411
|
+
var _props$control$as$val, _props$control$as$val2;
|
|
412
|
+
return (_props$control$as$val = (_props$control$as$val2 = props.control.as().value) == null ? void 0 : _props$control$as$val2.includes(elementValue.current.value)) != null ? _props$control$as$val : false;
|
|
413
|
+
});
|
|
414
|
+
const selControl = useControl(() => isSelected.current.value);
|
|
415
|
+
selControl.value = isSelected.value;
|
|
416
|
+
useControlEffect(() => selControl.value, v => {
|
|
417
|
+
props.control.as().setValue(x => setIncluded(x != null ? x : [], elementValue.value, v));
|
|
418
|
+
});
|
|
419
|
+
return /*#__PURE__*/jsxs(Div, {
|
|
420
|
+
className: rendererClass(props.className, options.entryClass),
|
|
421
|
+
children: [/*#__PURE__*/jsx(Fcheckbox, {
|
|
422
|
+
id: props.id,
|
|
423
|
+
control: selControl,
|
|
424
|
+
style: props.style,
|
|
425
|
+
className: options.checkClass,
|
|
426
|
+
renderer: renderer
|
|
427
|
+
}), p.label && renderer.renderLabel(p.label, undefined, undefined)]
|
|
428
|
+
});
|
|
358
429
|
} finally {
|
|
359
430
|
_effect2();
|
|
360
431
|
}
|
|
361
432
|
}
|
|
362
|
-
function
|
|
433
|
+
function CheckBox({
|
|
434
|
+
p,
|
|
435
|
+
props,
|
|
436
|
+
renderer,
|
|
437
|
+
options
|
|
438
|
+
}) {
|
|
363
439
|
var _effect3 = useComponentTracking();
|
|
440
|
+
try {
|
|
441
|
+
const {
|
|
442
|
+
Div
|
|
443
|
+
} = renderer.html;
|
|
444
|
+
return /*#__PURE__*/jsxs(Div, {
|
|
445
|
+
className: rendererClass(props.className, options.entryClass),
|
|
446
|
+
children: [/*#__PURE__*/jsx(Fcheckbox, {
|
|
447
|
+
id: props.id,
|
|
448
|
+
control: props.control.as(),
|
|
449
|
+
style: props.style,
|
|
450
|
+
className: options.checkClass,
|
|
451
|
+
renderer: renderer
|
|
452
|
+
}), p.label && renderer.renderLabel(p.label, undefined, undefined)]
|
|
453
|
+
});
|
|
454
|
+
} finally {
|
|
455
|
+
_effect3();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function Fcheckbox(_ref) {
|
|
459
|
+
var _effect4 = useComponentTracking();
|
|
364
460
|
try {
|
|
365
461
|
let {
|
|
366
462
|
control,
|
|
@@ -368,29 +464,26 @@ function Fcheckbox(_ref) {
|
|
|
368
464
|
notValue = false,
|
|
369
465
|
renderer
|
|
370
466
|
} = _ref,
|
|
371
|
-
others = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// () => control.error,
|
|
376
|
-
// (s) => (control.element as HTMLInputElement)?.setCustomValidity(s ?? ""),
|
|
377
|
-
// );
|
|
467
|
+
others = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
468
|
+
const {
|
|
469
|
+
Input
|
|
470
|
+
} = renderer.html;
|
|
378
471
|
const _formControlProps = formControlProps(control),
|
|
379
472
|
{
|
|
380
473
|
value
|
|
381
474
|
} = _formControlProps,
|
|
382
|
-
theseProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2);
|
|
383
|
-
return
|
|
475
|
+
theseProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$1);
|
|
476
|
+
return /*#__PURE__*/jsx(Input, _extends({}, theseProps, {
|
|
384
477
|
checked: !!value !== notValue,
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
478
|
+
inputRef: r => control.element = r,
|
|
479
|
+
onChangeChecked: e => {
|
|
480
|
+
control.touched = true;
|
|
481
|
+
control.value = e !== notValue;
|
|
388
482
|
},
|
|
389
|
-
onChange: e => control.value = e.target.checked !== notValue,
|
|
390
483
|
type: type
|
|
391
484
|
}, others));
|
|
392
485
|
} finally {
|
|
393
|
-
|
|
486
|
+
_effect4();
|
|
394
487
|
}
|
|
395
488
|
}
|
|
396
489
|
|
|
@@ -398,11 +491,12 @@ function createDefaultLayoutRenderer(options = {}) {
|
|
|
398
491
|
return createLayoutRenderer((props, renderers) => {
|
|
399
492
|
const layout = renderLayoutParts(props, renderers);
|
|
400
493
|
return {
|
|
401
|
-
children: layout.wrapLayout(
|
|
494
|
+
children: layout.wrapLayout(/*#__PURE__*/jsx(DefaultLayout, _extends({
|
|
402
495
|
layout: layout
|
|
403
496
|
}, options, {
|
|
404
497
|
renderer: renderers
|
|
405
498
|
}))),
|
|
499
|
+
inline: layout.inline,
|
|
406
500
|
className: rendererClass(layout.className, options.className),
|
|
407
501
|
style: layout.style,
|
|
408
502
|
divRef: e => e && props.errorControl ? props.errorControl.meta.scrollElement = e : undefined
|
|
@@ -412,12 +506,17 @@ function createDefaultLayoutRenderer(options = {}) {
|
|
|
412
506
|
function DefaultLayout({
|
|
413
507
|
errorClass,
|
|
414
508
|
renderer: {
|
|
415
|
-
|
|
416
|
-
|
|
509
|
+
html: {
|
|
510
|
+
Div,
|
|
511
|
+
Span
|
|
512
|
+
}
|
|
417
513
|
},
|
|
418
|
-
renderError = e => e &&
|
|
419
|
-
|
|
420
|
-
|
|
514
|
+
renderError = e => e && /*#__PURE__*/jsx(Div, {
|
|
515
|
+
children: /*#__PURE__*/jsx(Span, {
|
|
516
|
+
className: errorClass,
|
|
517
|
+
children: e
|
|
518
|
+
})
|
|
519
|
+
}),
|
|
421
520
|
layout: {
|
|
422
521
|
controlEnd,
|
|
423
522
|
controlStart,
|
|
@@ -430,32 +529,38 @@ function DefaultLayout({
|
|
|
430
529
|
try {
|
|
431
530
|
const ec = errorControl;
|
|
432
531
|
const errorText = ec && ec.touched ? ec.error : undefined;
|
|
433
|
-
return
|
|
532
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
533
|
+
children: [label, controlStart, children, renderError(errorText), controlEnd]
|
|
534
|
+
});
|
|
434
535
|
} finally {
|
|
435
536
|
_effect();
|
|
436
537
|
}
|
|
437
538
|
}
|
|
438
539
|
|
|
439
540
|
function DefaultDisplayOnly({
|
|
440
|
-
|
|
541
|
+
dataNode,
|
|
441
542
|
className,
|
|
442
543
|
emptyText,
|
|
443
544
|
schemaInterface,
|
|
444
|
-
field,
|
|
445
545
|
style,
|
|
446
|
-
renderer
|
|
546
|
+
renderer,
|
|
547
|
+
textClass,
|
|
548
|
+
inline
|
|
447
549
|
}) {
|
|
448
550
|
var _effect = useComponentTracking();
|
|
449
551
|
try {
|
|
450
552
|
var _ref;
|
|
451
|
-
const
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
return
|
|
553
|
+
const text = (_ref = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref : "";
|
|
554
|
+
const {
|
|
555
|
+
Div
|
|
556
|
+
} = renderer.html;
|
|
557
|
+
return /*#__PURE__*/jsx(Div, {
|
|
456
558
|
style: style,
|
|
457
|
-
className: className
|
|
458
|
-
|
|
559
|
+
className: className,
|
|
560
|
+
textClass: textClass,
|
|
561
|
+
text: text,
|
|
562
|
+
inline: inline
|
|
563
|
+
});
|
|
459
564
|
} finally {
|
|
460
565
|
_effect();
|
|
461
566
|
}
|
|
@@ -467,8 +572,8 @@ function DefaultAccordion({
|
|
|
467
572
|
contentStyle,
|
|
468
573
|
contentClassName,
|
|
469
574
|
designMode,
|
|
470
|
-
|
|
471
|
-
|
|
575
|
+
iconOpen,
|
|
576
|
+
iconClosed,
|
|
472
577
|
className,
|
|
473
578
|
renderTitle = t => t,
|
|
474
579
|
renderToggler,
|
|
@@ -480,6 +585,12 @@ function DefaultAccordion({
|
|
|
480
585
|
var _effect = useComponentTracking();
|
|
481
586
|
try {
|
|
482
587
|
var _dataContext$dataNode;
|
|
588
|
+
const {
|
|
589
|
+
Button,
|
|
590
|
+
I,
|
|
591
|
+
Div,
|
|
592
|
+
Label
|
|
593
|
+
} = renderers.html;
|
|
483
594
|
const dataControl = ((_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode).control;
|
|
484
595
|
const open = useControl(!!accordion.defaultExpanded);
|
|
485
596
|
if (dataControl && !dataControl.meta.accordionState) {
|
|
@@ -490,18 +601,25 @@ function DefaultAccordion({
|
|
|
490
601
|
display: "none"
|
|
491
602
|
});
|
|
492
603
|
const title = renderers.renderLabelText(renderTitle(accordion.title, open));
|
|
493
|
-
const
|
|
604
|
+
const currentIcon = isOpen ? iconOpen : iconClosed;
|
|
605
|
+
const toggler = renderToggler ? renderToggler(open, title) : /*#__PURE__*/jsxs(Button, {
|
|
494
606
|
className: className,
|
|
495
|
-
onClick: () => open.setValue(x => !x)
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
607
|
+
onClick: () => open.setValue(x => !x),
|
|
608
|
+
children: [/*#__PURE__*/jsx(Label, {
|
|
609
|
+
className: titleClass,
|
|
610
|
+
children: title
|
|
611
|
+
}), currentIcon && /*#__PURE__*/jsx(I, {
|
|
612
|
+
iconLibrary: currentIcon.library,
|
|
613
|
+
iconName: currentIcon.name
|
|
614
|
+
})]
|
|
615
|
+
});
|
|
616
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
617
|
+
children: [toggler, (useCss || isOpen || designMode) && /*#__PURE__*/jsx(Div, {
|
|
618
|
+
style: fullContentStyle,
|
|
619
|
+
className: contentClassName,
|
|
620
|
+
children: children
|
|
621
|
+
})]
|
|
622
|
+
});
|
|
505
623
|
} finally {
|
|
506
624
|
_effect();
|
|
507
625
|
}
|
|
@@ -510,24 +628,45 @@ function getAccordionState(c) {
|
|
|
510
628
|
return c.meta.accordionState;
|
|
511
629
|
}
|
|
512
630
|
|
|
631
|
+
/**
|
|
632
|
+
* @trackControls
|
|
633
|
+
*/
|
|
634
|
+
function VisibleChildrenRenderer(props) {
|
|
635
|
+
var _effect = useComponentTracking();
|
|
636
|
+
try {
|
|
637
|
+
const childStates = props.parentFormNode.getChildNodes().map(x => props.parent.getChildState(x));
|
|
638
|
+
return props.render(props.props, i => !childStates[i].hidden);
|
|
639
|
+
} finally {
|
|
640
|
+
_effect();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
513
644
|
function createTabsRenderer(options = {}) {
|
|
514
|
-
return createGroupRenderer((p, renderer) =>
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
645
|
+
return createGroupRenderer((p, renderer) => {
|
|
646
|
+
return /*#__PURE__*/jsx(VisibleChildrenRenderer, {
|
|
647
|
+
render: renderAllTabs,
|
|
648
|
+
dataContext: p.dataContext,
|
|
649
|
+
parentFormNode: p.formNode,
|
|
650
|
+
parent: p,
|
|
651
|
+
props: {
|
|
652
|
+
groupProps: p,
|
|
653
|
+
tabOptions: p.renderOptions,
|
|
654
|
+
options: options
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}, {
|
|
518
658
|
renderType: GroupRenderType.Tabs
|
|
519
659
|
});
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
try {
|
|
660
|
+
function renderAllTabs({
|
|
661
|
+
options,
|
|
662
|
+
groupProps: {
|
|
663
|
+
designMode,
|
|
664
|
+
formNode,
|
|
665
|
+
className,
|
|
666
|
+
renderChild
|
|
667
|
+
},
|
|
668
|
+
tabOptions
|
|
669
|
+
}, isVisible) {
|
|
531
670
|
const tabIndex = useControl(0);
|
|
532
671
|
const {
|
|
533
672
|
tabClass,
|
|
@@ -538,22 +677,289 @@ function TabsGroupRenderer({
|
|
|
538
677
|
contentClass
|
|
539
678
|
} = options;
|
|
540
679
|
const currentTab = tabIndex.value;
|
|
541
|
-
return designMode ?
|
|
680
|
+
return designMode ? /*#__PURE__*/jsx(Fragment, {
|
|
681
|
+
children: formNode.getChildNodes().map((x, i) => renderTabs([x], i))
|
|
682
|
+
}) : renderTabs(formNode.getChildNodes().filter((x, i) => isVisible(i)), 0);
|
|
542
683
|
function renderTabs(tabs, key) {
|
|
543
|
-
return
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
684
|
+
return /*#__PURE__*/jsxs("div", {
|
|
685
|
+
className: rendererClass(className, options.className),
|
|
686
|
+
children: [/*#__PURE__*/jsx("ul", {
|
|
687
|
+
className: rendererClass(null, tabListClass),
|
|
688
|
+
children: tabs.map((x, i) => /*#__PURE__*/jsx("li", {
|
|
689
|
+
className: rendererClass(null, tabClass),
|
|
690
|
+
onClick: () => tabIndex.value = i,
|
|
691
|
+
children: /*#__PURE__*/jsx("span", {
|
|
692
|
+
className: rendererClass(null, clsx(labelClass, i == currentTab ? activeClass : inactiveClass)),
|
|
693
|
+
children: x.definition.title ? x.definition.title : "<untitled>"
|
|
694
|
+
})
|
|
695
|
+
}, i))
|
|
696
|
+
}), /*#__PURE__*/jsx("div", {
|
|
697
|
+
className: rendererClass(tabOptions.contentClass, contentClass),
|
|
698
|
+
children: renderChild(currentTab, tabs[currentTab])
|
|
699
|
+
})]
|
|
700
|
+
}, key);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function createGridRenderer(options) {
|
|
706
|
+
return createGroupRenderer((props, formRenderer) => /*#__PURE__*/jsx(VisibleChildrenRenderer, {
|
|
707
|
+
props: _extends({}, props, {
|
|
708
|
+
formRenderer,
|
|
709
|
+
defaultOptions: options
|
|
710
|
+
}),
|
|
711
|
+
render: renderGrid,
|
|
712
|
+
parent: props,
|
|
713
|
+
dataContext: props.dataContext,
|
|
714
|
+
parentFormNode: props.formNode
|
|
715
|
+
}), {
|
|
716
|
+
renderType: GroupRenderType.Grid
|
|
717
|
+
});
|
|
718
|
+
function renderGrid(props, isChildVisible) {
|
|
719
|
+
var _props$defaultOptions, _ref, _gridOptions$columns;
|
|
720
|
+
const filteredChildren = props.formNode.getChildNodes().filter((x, i) => isChildVisible(i));
|
|
721
|
+
const {
|
|
722
|
+
Div
|
|
723
|
+
} = props.formRenderer.html;
|
|
724
|
+
const defaults = (_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {};
|
|
725
|
+
const gridOptions = props.renderOptions;
|
|
726
|
+
const numColumns = (_ref = (_gridOptions$columns = gridOptions.columns) != null ? _gridOptions$columns : defaults.defaultColumns) != null ? _ref : 2;
|
|
727
|
+
const allChildren = filteredChildren.map((x, i) => props.renderChild(i, x));
|
|
728
|
+
// split into numColumns items wrapped a div each
|
|
729
|
+
const rows = [];
|
|
730
|
+
for (let i = 0; i < allChildren.length; i += numColumns) {
|
|
731
|
+
rows.push(allChildren.slice(i, i + numColumns));
|
|
732
|
+
}
|
|
733
|
+
return /*#__PURE__*/jsx(Div, {
|
|
734
|
+
className: rendererClass(props.className, defaults.className),
|
|
735
|
+
children: rows.map((row, rowIndex) => /*#__PURE__*/jsx(Div, {
|
|
736
|
+
className: rendererClass(gridOptions.rowClass, defaults.rowClass),
|
|
737
|
+
children: row
|
|
738
|
+
}, rowIndex))
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const defaultOptions = {
|
|
744
|
+
classes: {
|
|
745
|
+
className: undefined,
|
|
746
|
+
contentClass: "min-h-96 overflow-auto",
|
|
747
|
+
navContainerClass: "flex justify-between gap-4 my-2"
|
|
748
|
+
},
|
|
749
|
+
actions: {
|
|
750
|
+
nextText: "Next",
|
|
751
|
+
nextIcon: fontAwesomeIcon("chevron-right"),
|
|
752
|
+
nextValidate: true,
|
|
753
|
+
prevText: "Prev",
|
|
754
|
+
prevIcon: fontAwesomeIcon("chevron-left"),
|
|
755
|
+
prevValidate: false
|
|
756
|
+
},
|
|
757
|
+
renderNavigation: defaultNavigationRender
|
|
758
|
+
};
|
|
759
|
+
function defaultNavigationRender({
|
|
760
|
+
formRenderer,
|
|
761
|
+
prev,
|
|
762
|
+
next,
|
|
763
|
+
className
|
|
764
|
+
}) {
|
|
765
|
+
{
|
|
766
|
+
const {
|
|
767
|
+
html: {
|
|
768
|
+
Div
|
|
769
|
+
},
|
|
770
|
+
renderAction
|
|
771
|
+
} = formRenderer;
|
|
772
|
+
return /*#__PURE__*/jsxs(Div, {
|
|
773
|
+
className: className,
|
|
774
|
+
children: [renderAction(prev), renderAction(next)]
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
function createWizardRenderer(options) {
|
|
779
|
+
return createGroupRenderer((props, formRenderer) => /*#__PURE__*/jsx(VisibleChildrenRenderer, {
|
|
780
|
+
props: _extends({}, props, {
|
|
781
|
+
formRenderer,
|
|
782
|
+
defaultOptions: options
|
|
783
|
+
}),
|
|
784
|
+
render: renderWizard,
|
|
785
|
+
parent: props,
|
|
786
|
+
dataContext: props.dataContext,
|
|
787
|
+
parentFormNode: props.formNode
|
|
788
|
+
}), {
|
|
789
|
+
renderType: GroupRenderType.Wizard
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
function renderWizard(props, isChildVisible) {
|
|
793
|
+
var _props$defaultOptions;
|
|
794
|
+
const mergedOptions = deepMerge((_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {}, defaultOptions);
|
|
795
|
+
const {
|
|
796
|
+
classes: {
|
|
797
|
+
className,
|
|
798
|
+
contentClass,
|
|
799
|
+
navContainerClass
|
|
800
|
+
},
|
|
801
|
+
actions: {
|
|
802
|
+
nextText,
|
|
803
|
+
nextIcon,
|
|
804
|
+
prevText,
|
|
805
|
+
prevIcon,
|
|
806
|
+
nextValidate,
|
|
807
|
+
prevValidate
|
|
808
|
+
},
|
|
809
|
+
renderNavigation
|
|
810
|
+
} = mergedOptions;
|
|
811
|
+
const {
|
|
812
|
+
html: {
|
|
813
|
+
Div
|
|
814
|
+
}
|
|
815
|
+
} = props.formRenderer;
|
|
816
|
+
const children = props.formNode.getChildNodes();
|
|
817
|
+
const allVisible = children.map((_, i) => isChildVisible(i));
|
|
818
|
+
const page = useControl(0);
|
|
819
|
+
const currentPage = page.value;
|
|
820
|
+
const isValid = useComputed(() => isPageValid());
|
|
821
|
+
const next = createAction("nav", () => nav(1, nextValidate), nextText, {
|
|
822
|
+
hidden: !props.designMode && nextVisibleInDirection(1) == null,
|
|
823
|
+
disabled: !isValid.value,
|
|
824
|
+
icon: nextIcon,
|
|
825
|
+
iconPlacement: IconPlacement.AfterText
|
|
826
|
+
});
|
|
827
|
+
const prev = createAction("nav", () => nav(-1, prevValidate), prevText, {
|
|
828
|
+
disabled: !props.designMode && nextVisibleInDirection(-1) == null,
|
|
829
|
+
icon: prevIcon
|
|
830
|
+
});
|
|
831
|
+
const navElement = renderNavigation({
|
|
832
|
+
formRenderer: props.formRenderer,
|
|
833
|
+
page: countVisibleUntil(currentPage),
|
|
834
|
+
totalPages: countVisibleUntil(children.length),
|
|
835
|
+
prev,
|
|
836
|
+
next: next,
|
|
837
|
+
className: navContainerClass,
|
|
838
|
+
validatePage: async () => validatePage()
|
|
839
|
+
});
|
|
840
|
+
const content = props.designMode ? /*#__PURE__*/jsx(Div, {
|
|
841
|
+
children: children.map((child, i) => props.renderChild(i, child))
|
|
842
|
+
}) : currentPage < children.length ? /*#__PURE__*/jsx(Div, {
|
|
843
|
+
className: contentClass,
|
|
844
|
+
children: props.renderChild(currentPage, children[currentPage])
|
|
845
|
+
}) : /*#__PURE__*/jsx(Fragment$1, {});
|
|
846
|
+
return /*#__PURE__*/jsxs(Div, {
|
|
847
|
+
className: rendererClass(props.className, className),
|
|
848
|
+
children: [content, navElement]
|
|
849
|
+
});
|
|
850
|
+
function countVisibleUntil(untilPage) {
|
|
851
|
+
let count = 0;
|
|
852
|
+
for (let i = 0; i < untilPage && i < allVisible.length; i++) {
|
|
853
|
+
if (allVisible[i]) {
|
|
854
|
+
count++;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return count;
|
|
858
|
+
}
|
|
859
|
+
function nav(dir, validate) {
|
|
860
|
+
if (validate && !validatePage()) {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
const next = nextVisibleInDirection(dir);
|
|
864
|
+
if (next != null) {
|
|
865
|
+
page.value = next;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function nextVisibleInDirection(dir) {
|
|
869
|
+
let next = currentPage + dir;
|
|
870
|
+
while (next >= 0 && next < children.length) {
|
|
871
|
+
if (allVisible[next]) {
|
|
872
|
+
return next;
|
|
873
|
+
}
|
|
874
|
+
next += dir;
|
|
875
|
+
}
|
|
876
|
+
return null;
|
|
877
|
+
}
|
|
878
|
+
function validatePage() {
|
|
879
|
+
const pageNode = children[currentPage];
|
|
880
|
+
let hasErrors = false;
|
|
881
|
+
visitFormDataInContext(props.dataContext.parentNode, pageNode, validationVisitor(() => {
|
|
882
|
+
hasErrors = true;
|
|
883
|
+
}));
|
|
884
|
+
return !hasErrors;
|
|
885
|
+
}
|
|
886
|
+
function isPageValid() {
|
|
887
|
+
const pageNode = children[currentPage];
|
|
888
|
+
let hasErrors = false;
|
|
889
|
+
visitFormDataInContext(props.dataContext.parentNode, pageNode, c => {
|
|
890
|
+
if (!c.control.valid) hasErrors = true;
|
|
891
|
+
});
|
|
892
|
+
return !hasErrors;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
const defaultDialogOptions = {
|
|
897
|
+
classes: {
|
|
898
|
+
className: "",
|
|
899
|
+
titleClass: "text-2xl font-bold"
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
function createDialogRenderer(options) {
|
|
903
|
+
return createGroupRenderer((props, renderer) => /*#__PURE__*/jsx(DefaultDialogRenderer, {
|
|
904
|
+
props: props,
|
|
905
|
+
options: options,
|
|
906
|
+
renderer: renderer,
|
|
907
|
+
renderOptions: props.renderOptions
|
|
908
|
+
}), {
|
|
909
|
+
renderType: GroupRenderType.Dialog
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
function DefaultDialogRenderer({
|
|
913
|
+
props,
|
|
914
|
+
renderOptions,
|
|
915
|
+
options,
|
|
916
|
+
renderer
|
|
917
|
+
}) {
|
|
918
|
+
var _effect = useComponentTracking();
|
|
919
|
+
try {
|
|
920
|
+
const {
|
|
921
|
+
classes: {
|
|
922
|
+
titleClass,
|
|
923
|
+
className
|
|
924
|
+
}
|
|
925
|
+
} = deepMerge(options, defaultDialogOptions);
|
|
926
|
+
const open = useControl(false);
|
|
927
|
+
const overlayState = createOverlayState(open);
|
|
928
|
+
const actionOnClick = action => {
|
|
929
|
+
switch (action) {
|
|
930
|
+
case "closeDialog":
|
|
931
|
+
return () => overlayState.close();
|
|
932
|
+
case "openDialog":
|
|
933
|
+
return () => overlayState.open();
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
const triggerChildren = props.formNode.getChildNodes().filter(x => x.definition.placement === "trigger");
|
|
937
|
+
const dialogContent = /*#__PURE__*/jsx(Dialog, {
|
|
938
|
+
title: renderOptions.title,
|
|
939
|
+
titleClass: titleClass,
|
|
940
|
+
className: rendererClass(props.className, className),
|
|
941
|
+
children: props.formNode.getChildNodes().filter(x => !x.definition.placement || x.definition.placement === "dialog").map((x, i) => props.renderChild(i, x, {
|
|
942
|
+
actionOnClick
|
|
943
|
+
}))
|
|
944
|
+
});
|
|
945
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
946
|
+
children: [triggerChildren.map((x, i) => props.renderChild(i, x, {
|
|
947
|
+
actionOnClick
|
|
948
|
+
})), props.designMode ? designContent() : open.value && /*#__PURE__*/jsx(Modal, {
|
|
949
|
+
state: overlayState,
|
|
950
|
+
isDismissable: true,
|
|
951
|
+
children: dialogContent
|
|
952
|
+
})]
|
|
953
|
+
});
|
|
954
|
+
function designContent() {
|
|
955
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
956
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
957
|
+
onClickCapture: () => overlayState.toggle(),
|
|
958
|
+
children: renderer.renderAction(createAction("Toggle Dialog", () => {}, open.value ? "Hide Content" : "Show Content", {
|
|
959
|
+
actionStyle: ActionStyle.Link
|
|
960
|
+
}))
|
|
961
|
+
}), open.value && dialogContent]
|
|
962
|
+
});
|
|
557
963
|
}
|
|
558
964
|
} finally {
|
|
559
965
|
_effect();
|
|
@@ -561,27 +967,17 @@ function TabsGroupRenderer({
|
|
|
561
967
|
}
|
|
562
968
|
|
|
563
969
|
function createDefaultGroupRenderer(options) {
|
|
970
|
+
const gridRenderer = createGridRenderer(options == null ? void 0 : options.grid);
|
|
564
971
|
const tabsRenderer = createTabsRenderer(options == null ? void 0 : options.tabs);
|
|
972
|
+
const wizardRenderer = createWizardRenderer(options == null ? void 0 : options.wizard);
|
|
973
|
+
const dialogRenderer = createDialogRenderer(options == null ? void 0 : options.dialog);
|
|
565
974
|
const {
|
|
566
975
|
className,
|
|
567
|
-
gridStyles = defaultGridStyles,
|
|
568
|
-
defaultGridColumns = 2,
|
|
569
|
-
gridClassName,
|
|
570
976
|
standardClassName,
|
|
571
977
|
flexClassName,
|
|
978
|
+
inlineClass,
|
|
572
979
|
defaultFlexGap
|
|
573
980
|
} = options != null ? options : {};
|
|
574
|
-
function defaultGridStyles({
|
|
575
|
-
columns = defaultGridColumns
|
|
576
|
-
}) {
|
|
577
|
-
return {
|
|
578
|
-
className: gridClassName,
|
|
579
|
-
style: {
|
|
580
|
-
display: "grid",
|
|
581
|
-
gridTemplateColumns: `repeat(${columns}, 1fr)`
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
981
|
function flexStyles(options) {
|
|
586
982
|
return {
|
|
587
983
|
className: flexClassName,
|
|
@@ -599,52 +995,78 @@ function createDefaultGroupRenderer(options) {
|
|
|
599
995
|
formNode
|
|
600
996
|
} = props;
|
|
601
997
|
if (isTabsRenderer(renderOptions)) return tabsRenderer.render(props, renderer);
|
|
998
|
+
if (isGridRenderer(renderOptions)) return gridRenderer.render(props, renderer);
|
|
999
|
+
if (isWizardRenderer(renderOptions)) return wizardRenderer.render(props, renderer);
|
|
1000
|
+
if (isDialogRenderer(renderOptions)) return dialogRenderer.render(props, renderer);
|
|
602
1001
|
if (isSelectChildRenderer(renderOptions) && !props.designMode) {
|
|
603
|
-
return
|
|
1002
|
+
return /*#__PURE__*/jsx(SelectChildGroupRenderer, _extends({}, props, {
|
|
604
1003
|
renderOptions: renderOptions
|
|
605
1004
|
}));
|
|
606
1005
|
}
|
|
607
1006
|
const {
|
|
608
1007
|
style,
|
|
609
1008
|
className: gcn
|
|
610
|
-
} =
|
|
1009
|
+
} = isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : isInlineRenderer(renderOptions) ? {
|
|
1010
|
+
className: inlineClass
|
|
1011
|
+
} : {
|
|
611
1012
|
className: standardClassName
|
|
612
1013
|
};
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
1014
|
+
const {
|
|
1015
|
+
Div
|
|
1016
|
+
} = renderer.html;
|
|
1017
|
+
const inline = renderOptions.type == GroupRenderType.Inline;
|
|
1018
|
+
const children = formNode.getChildNodes().map((c, i) => renderChild(i, c, {
|
|
1019
|
+
inline
|
|
1020
|
+
}));
|
|
1021
|
+
return /*#__PURE__*/jsx(Div, {
|
|
616
1022
|
className: rendererClass(props.className, clsx(className, gcn)),
|
|
617
|
-
|
|
618
|
-
|
|
1023
|
+
textClass: props.textClass,
|
|
1024
|
+
style: style,
|
|
1025
|
+
inline: inline,
|
|
1026
|
+
children: children
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
function renderLayout(props, renderer) {
|
|
1030
|
+
if (props.renderOptions.type === GroupRenderType.Contents) {
|
|
1031
|
+
const {
|
|
1032
|
+
formNode,
|
|
1033
|
+
renderChild
|
|
1034
|
+
} = props;
|
|
1035
|
+
const children = formNode.getChildNodes().map((c, i) => renderChild(i, c));
|
|
1036
|
+
return layout => {
|
|
1037
|
+
return _extends({}, layout, {
|
|
1038
|
+
inline: true,
|
|
1039
|
+
children
|
|
1040
|
+
});
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
return render(props, renderer);
|
|
619
1044
|
}
|
|
620
1045
|
return {
|
|
621
1046
|
type: "group",
|
|
622
|
-
render
|
|
1047
|
+
render: renderLayout
|
|
623
1048
|
};
|
|
624
1049
|
}
|
|
625
1050
|
function SelectChildGroupRenderer(props) {
|
|
626
1051
|
var _effect = useComponentTracking();
|
|
627
1052
|
try {
|
|
628
1053
|
const {
|
|
629
|
-
|
|
1054
|
+
runExpression,
|
|
630
1055
|
renderOptions
|
|
631
1056
|
} = props;
|
|
632
|
-
const
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}, [dynHook.deps]);
|
|
639
|
-
return createElement(Render, props);
|
|
1057
|
+
const ctrl = useExpression(undefined, runExpression, renderOptions == null ? void 0 : renderOptions.childIndexExpression, x => typeof x == "string" ? parseInt(x) : x);
|
|
1058
|
+
const childIndex = ctrl == null ? void 0 : ctrl.value;
|
|
1059
|
+
const childDefinitions = props.formNode.getChildNodes();
|
|
1060
|
+
return /*#__PURE__*/jsx("div", {
|
|
1061
|
+
children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && props.renderChild(childIndex, childDefinitions[childIndex])
|
|
1062
|
+
});
|
|
640
1063
|
} finally {
|
|
641
1064
|
_effect();
|
|
642
1065
|
}
|
|
643
1066
|
}
|
|
644
1067
|
|
|
645
1068
|
function createDefaultVisibilityRenderer() {
|
|
646
|
-
|
|
647
|
-
return createVisibilityRenderer((props, renderer) => h(DefaultVisibility, _extends({}, props, {
|
|
1069
|
+
return createVisibilityRenderer((props, renderer) => /*#__PURE__*/jsx(DefaultVisibility, _extends({}, props, {
|
|
648
1070
|
renderer: renderer
|
|
649
1071
|
})));
|
|
650
1072
|
}
|
|
@@ -654,7 +1076,8 @@ function DefaultVisibility({
|
|
|
654
1076
|
className,
|
|
655
1077
|
style,
|
|
656
1078
|
divRef,
|
|
657
|
-
renderer
|
|
1079
|
+
renderer,
|
|
1080
|
+
inline
|
|
658
1081
|
}) {
|
|
659
1082
|
var _effect = useComponentTracking();
|
|
660
1083
|
try {
|
|
@@ -667,26 +1090,30 @@ function DefaultVisibility({
|
|
|
667
1090
|
}));
|
|
668
1091
|
}
|
|
669
1092
|
}, [v == null ? void 0 : v.visible]);
|
|
670
|
-
const
|
|
671
|
-
|
|
1093
|
+
const {
|
|
1094
|
+
Div
|
|
1095
|
+
} = renderer.html;
|
|
1096
|
+
if (inline) return v != null && v.visible ? children : undefined;
|
|
1097
|
+
return v != null && v.visible ? /*#__PURE__*/jsx(Div, {
|
|
672
1098
|
className: className,
|
|
673
1099
|
style: style,
|
|
674
|
-
|
|
1100
|
+
nativeRef: divRef,
|
|
675
1101
|
children: children
|
|
676
|
-
}) :
|
|
1102
|
+
}) : /*#__PURE__*/jsx(Fragment, {});
|
|
677
1103
|
} finally {
|
|
678
1104
|
_effect();
|
|
679
1105
|
}
|
|
680
1106
|
}
|
|
681
1107
|
|
|
682
1108
|
function createJsonataRenderer(className) {
|
|
683
|
-
return createDataRenderer(p =>
|
|
1109
|
+
return createDataRenderer(p => /*#__PURE__*/jsx(JsonataRenderer, {
|
|
684
1110
|
renderOptions: p.renderOptions,
|
|
685
1111
|
className: rendererClass(p.className, className),
|
|
686
1112
|
dataNode: p.dataNode,
|
|
687
1113
|
dataContext: p.dataContext,
|
|
688
1114
|
control: p.control,
|
|
689
|
-
readonly: p.readonly
|
|
1115
|
+
readonly: p.readonly,
|
|
1116
|
+
runExpression: p.runExpression
|
|
690
1117
|
}), {
|
|
691
1118
|
renderType: DataRenderType.Jsonata
|
|
692
1119
|
});
|
|
@@ -697,20 +1124,23 @@ function JsonataRenderer({
|
|
|
697
1124
|
readonly,
|
|
698
1125
|
className,
|
|
699
1126
|
dataContext,
|
|
700
|
-
dataNode
|
|
1127
|
+
dataNode,
|
|
1128
|
+
runExpression
|
|
701
1129
|
}) {
|
|
702
1130
|
var _effect = useComponentTracking();
|
|
703
1131
|
try {
|
|
704
1132
|
const sdn = dataNode.elementIndex != null ? dataNode : dataContext.parentNode;
|
|
705
|
-
const bindings = useComputed(() => ({
|
|
1133
|
+
const bindings = useComputed(() => _extends({}, dataContext.variables, {
|
|
706
1134
|
value: control.value,
|
|
707
1135
|
readonly,
|
|
708
1136
|
disabled: control.disabled,
|
|
709
|
-
formData: dataContext.formData,
|
|
710
1137
|
dataPath: getJsonPath(dataNode)
|
|
711
1138
|
}));
|
|
712
|
-
const rendered =
|
|
713
|
-
|
|
1139
|
+
const rendered = useExpression("", runExpression, {
|
|
1140
|
+
type: ExpressionType.Jsonata,
|
|
1141
|
+
expression: renderOptions.expression
|
|
1142
|
+
}, coerceToString, bindings);
|
|
1143
|
+
return /*#__PURE__*/jsx("div", {
|
|
714
1144
|
className: className,
|
|
715
1145
|
dangerouslySetInnerHTML: {
|
|
716
1146
|
__html: rendered.value
|
|
@@ -721,14 +1151,14 @@ function JsonataRenderer({
|
|
|
721
1151
|
}
|
|
722
1152
|
}
|
|
723
1153
|
|
|
724
|
-
const _excluded = ["control", "field", "renderOptions"];
|
|
1154
|
+
const _excluded$1 = ["control", "field", "renderOptions"];
|
|
725
1155
|
function createNullToggleRenderer() {
|
|
726
1156
|
return createDataRenderer((_ref, renderers) => {
|
|
727
1157
|
let {
|
|
728
1158
|
control,
|
|
729
1159
|
field
|
|
730
1160
|
} = _ref,
|
|
731
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1161
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
732
1162
|
const lastDefined = getLastDefinedValue(control);
|
|
733
1163
|
if (lastDefined.current.value == null) lastDefined.value = props.definition.defaultValue;
|
|
734
1164
|
const nullControl = getNullToggler(control);
|
|
@@ -749,7 +1179,7 @@ function createNullToggleRenderer() {
|
|
|
749
1179
|
|
|
750
1180
|
function createDefaultArrayDataRenderer(defaultActions) {
|
|
751
1181
|
return createDataRenderer((props, renderers) => {
|
|
752
|
-
return
|
|
1182
|
+
return /*#__PURE__*/jsx(DataArrayRenderer, {
|
|
753
1183
|
dataProps: props,
|
|
754
1184
|
renderers: renderers,
|
|
755
1185
|
defaultActions: defaultActions
|
|
@@ -759,113 +1189,123 @@ function createDefaultArrayDataRenderer(defaultActions) {
|
|
|
759
1189
|
collection: true
|
|
760
1190
|
});
|
|
761
1191
|
}
|
|
1192
|
+
/**
|
|
1193
|
+
* @trackControls
|
|
1194
|
+
*/
|
|
762
1195
|
function DataArrayRenderer({
|
|
763
1196
|
dataProps,
|
|
764
1197
|
renderers,
|
|
765
1198
|
defaultActions
|
|
766
1199
|
}) {
|
|
767
|
-
var
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1200
|
+
var _effect = useComponentTracking();
|
|
1201
|
+
try {
|
|
1202
|
+
const {
|
|
1203
|
+
renderOptions,
|
|
1204
|
+
control,
|
|
1205
|
+
field,
|
|
1206
|
+
readonly,
|
|
1207
|
+
designMode,
|
|
1208
|
+
required,
|
|
1209
|
+
renderChild,
|
|
1210
|
+
definition,
|
|
1211
|
+
className,
|
|
1212
|
+
style,
|
|
1213
|
+
dataContext,
|
|
1214
|
+
formNode,
|
|
1215
|
+
getChildState
|
|
1216
|
+
} = dataProps;
|
|
1217
|
+
const {
|
|
1218
|
+
addText,
|
|
1219
|
+
noAdd,
|
|
1220
|
+
noRemove,
|
|
1221
|
+
noReorder,
|
|
1222
|
+
removeText,
|
|
1223
|
+
editExternal
|
|
1224
|
+
} = mergeObjects(isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions);
|
|
1225
|
+
const childDefs = formNode.getResolvedChildren();
|
|
1226
|
+
const renderAsElement = !isCompoundField(field);
|
|
1227
|
+
const defaultChildDef = {
|
|
1228
|
+
type: ControlDefinitionType.Data,
|
|
1229
|
+
field: ".",
|
|
1230
|
+
renderOptions: {
|
|
1231
|
+
type: DataRenderType.Standard
|
|
1232
|
+
},
|
|
797
1233
|
hideTitle: true
|
|
1234
|
+
};
|
|
1235
|
+
const childDef = {
|
|
1236
|
+
type: ControlDefinitionType.Group,
|
|
1237
|
+
groupOptions: {
|
|
1238
|
+
type: GroupRenderType.Standard,
|
|
1239
|
+
hideTitle: true
|
|
1240
|
+
},
|
|
1241
|
+
children: renderAsElement && childDefs.length == 0 ? [defaultChildDef] : childDefs
|
|
1242
|
+
};
|
|
1243
|
+
const childNode = formNode.createChildNode("child", childDef);
|
|
1244
|
+
const childNodes = childNode.getChildNodes();
|
|
1245
|
+
const arrayProps = _extends({}, createArrayActions(control.as(), field, {
|
|
1246
|
+
addText,
|
|
1247
|
+
removeText,
|
|
1248
|
+
noAdd,
|
|
1249
|
+
noRemove,
|
|
1250
|
+
readonly,
|
|
1251
|
+
disabled: control.disabled,
|
|
1252
|
+
designMode,
|
|
1253
|
+
editExternal
|
|
1254
|
+
}), {
|
|
1255
|
+
required,
|
|
1256
|
+
renderElement: (i, wrap) => /*#__PURE__*/jsx(RenderEntry, {
|
|
1257
|
+
index: i,
|
|
1258
|
+
renderChildElement: renderChildElement,
|
|
1259
|
+
dataContext: dataContext,
|
|
1260
|
+
wrap: wrap,
|
|
1261
|
+
isChildHidden: dataNode => childNodes.every(x => getChildState(x, dataNode).hidden)
|
|
1262
|
+
}),
|
|
1263
|
+
className: className ? className : undefined,
|
|
1264
|
+
style
|
|
1265
|
+
}, getLengthRestrictions(definition));
|
|
1266
|
+
return renderers.renderArray(arrayProps);
|
|
1267
|
+
function renderChildElement(i, elementNode) {
|
|
1268
|
+
return renderChild(elementNode.control.uniqueId, childNode, {
|
|
1269
|
+
parentDataNode: elementNode
|
|
1270
|
+
});
|
|
798
1271
|
}
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
field: definition.field,
|
|
802
|
-
renderOptions: childOptions != null ? childOptions : {
|
|
803
|
-
type: DataRenderType.Standard
|
|
804
|
-
},
|
|
805
|
-
hideTitle: true
|
|
806
|
-
}, formNode.getChildNodes());
|
|
807
|
-
const visibilities = ((_definition$children = definition.children) != null ? _definition$children : []).map(x => [useChildVisibility(x, undefined, true), x]);
|
|
808
|
-
const deps = makeHookDepString(visibilities, x => x[0].deps);
|
|
809
|
-
const Entry = useTrackedComponent(RenderEntry, [deps]);
|
|
810
|
-
const arrayProps = _extends({}, createArrayActions(control.as(), field, {
|
|
811
|
-
addText,
|
|
812
|
-
removeText,
|
|
813
|
-
noAdd,
|
|
814
|
-
noRemove,
|
|
815
|
-
readonly,
|
|
816
|
-
disabled: control.disabled,
|
|
817
|
-
designMode,
|
|
818
|
-
editExternal
|
|
819
|
-
}), {
|
|
820
|
-
required,
|
|
821
|
-
renderElement: (i, wrap) => createElement(Entry, {
|
|
822
|
-
index: i,
|
|
823
|
-
renderChildElement: renderChildElement,
|
|
824
|
-
dataContext: dataContext,
|
|
825
|
-
visibilities: visibilities,
|
|
826
|
-
wrap: wrap
|
|
827
|
-
}),
|
|
828
|
-
className: className ? className : undefined,
|
|
829
|
-
style
|
|
830
|
-
}, getLengthRestrictions(definition));
|
|
831
|
-
return renderers.renderArray(arrayProps);
|
|
832
|
-
function renderChildElement(i, elementNode) {
|
|
833
|
-
var _control$elements$i$u, _control$elements;
|
|
834
|
-
return renderChild((_control$elements$i$u = (_control$elements = control.elements) == null ? void 0 : _control$elements[i].uniqueId) != null ? _control$elements$i$u : i, childDefinition, renderAsElement ? {
|
|
835
|
-
elementIndex: i
|
|
836
|
-
} : {
|
|
837
|
-
parentDataNode: elementNode
|
|
838
|
-
});
|
|
1272
|
+
} finally {
|
|
1273
|
+
_effect();
|
|
839
1274
|
}
|
|
840
1275
|
}
|
|
1276
|
+
/**
|
|
1277
|
+
* @trackControls
|
|
1278
|
+
*/
|
|
841
1279
|
function RenderEntry({
|
|
842
1280
|
index: i,
|
|
843
1281
|
renderChildElement,
|
|
844
|
-
visibilities,
|
|
845
1282
|
wrap,
|
|
1283
|
+
isChildHidden,
|
|
846
1284
|
dataContext
|
|
847
1285
|
}) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
1286
|
+
var _effect2 = useComponentTracking();
|
|
1287
|
+
try {
|
|
1288
|
+
const elementNode = dataContext.dataNode.getChildElement(i);
|
|
1289
|
+
if (isChildHidden(elementNode)) return undefined;
|
|
1290
|
+
return wrap(renderChildElement(i, elementNode));
|
|
1291
|
+
} finally {
|
|
1292
|
+
_effect2();
|
|
1293
|
+
}
|
|
856
1294
|
}
|
|
857
1295
|
function createDefaultArrayRenderer(options) {
|
|
858
1296
|
return {
|
|
859
1297
|
render: (props, {
|
|
860
|
-
renderAction
|
|
861
|
-
|
|
862
|
-
|
|
1298
|
+
renderAction,
|
|
1299
|
+
html
|
|
1300
|
+
}) => /*#__PURE__*/jsx(DefaultArrayRenderer, _extends({}, props, options, {
|
|
1301
|
+
renderAction: renderAction,
|
|
1302
|
+
html: html
|
|
863
1303
|
})),
|
|
864
1304
|
type: "array"
|
|
865
1305
|
};
|
|
866
1306
|
}
|
|
867
1307
|
function DefaultArrayRenderer(props) {
|
|
868
|
-
var
|
|
1308
|
+
var _effect3 = useComponentTracking();
|
|
869
1309
|
try {
|
|
870
1310
|
const {
|
|
871
1311
|
renderElement,
|
|
@@ -878,29 +1318,41 @@ function DefaultArrayRenderer(props) {
|
|
|
878
1318
|
arrayControl,
|
|
879
1319
|
renderAction,
|
|
880
1320
|
style,
|
|
881
|
-
editAction
|
|
1321
|
+
editAction,
|
|
1322
|
+
html: {
|
|
1323
|
+
Div
|
|
1324
|
+
}
|
|
882
1325
|
} = props;
|
|
883
1326
|
const {
|
|
884
1327
|
addAction,
|
|
885
1328
|
removeAction
|
|
886
1329
|
} = applyArrayLengthRestrictions(props);
|
|
887
|
-
return
|
|
888
|
-
style: style
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1330
|
+
return /*#__PURE__*/jsxs(Div, {
|
|
1331
|
+
style: style,
|
|
1332
|
+
children: [/*#__PURE__*/jsx(Div, {
|
|
1333
|
+
className: clsx(className, removeAction && removableClass),
|
|
1334
|
+
children: /*#__PURE__*/jsx(RenderElements, {
|
|
1335
|
+
control: arrayControl,
|
|
1336
|
+
children: (_, x) => renderElement(x, children => removeAction || editAction ? /*#__PURE__*/jsxs(Fragment, {
|
|
1337
|
+
children: [/*#__PURE__*/jsx(Div, {
|
|
1338
|
+
className: clsx(childClass, removableChildClass),
|
|
1339
|
+
children: children
|
|
1340
|
+
}), /*#__PURE__*/jsxs(Div, {
|
|
1341
|
+
className: removeActionClass,
|
|
1342
|
+
children: [editAction && renderAction(editAction(x)), removeAction && renderAction(removeAction(x))]
|
|
1343
|
+
})]
|
|
1344
|
+
}) : /*#__PURE__*/jsx(Div, {
|
|
1345
|
+
className: childClass,
|
|
1346
|
+
children: children
|
|
1347
|
+
}))
|
|
1348
|
+
})
|
|
1349
|
+
}), addAction && /*#__PURE__*/jsx(Div, {
|
|
1350
|
+
className: addActionClass,
|
|
1351
|
+
children: renderAction(addAction)
|
|
1352
|
+
})]
|
|
1353
|
+
});
|
|
902
1354
|
} finally {
|
|
903
|
-
|
|
1355
|
+
_effect3();
|
|
904
1356
|
}
|
|
905
1357
|
}
|
|
906
1358
|
|
|
@@ -908,7 +1360,7 @@ const inputClass = "leading-[1.5] text-surface-900 bg-[inherit] border-0 rounded
|
|
|
908
1360
|
function createAutocompleteRenderer(options = {}) {
|
|
909
1361
|
return createDataRenderer(p => {
|
|
910
1362
|
var _p$options, _p$options2;
|
|
911
|
-
return p.field.collection ?
|
|
1363
|
+
return p.field.collection ? /*#__PURE__*/jsx(MultipleAutocomplete, {
|
|
912
1364
|
options: (_p$options = p.options) != null ? _p$options : [],
|
|
913
1365
|
control: p.control,
|
|
914
1366
|
className: rendererClass(p.className, options.className),
|
|
@@ -916,7 +1368,7 @@ function createAutocompleteRenderer(options = {}) {
|
|
|
916
1368
|
controlClasses: p.renderOptions,
|
|
917
1369
|
readOnly: p.readonly,
|
|
918
1370
|
id: p.id
|
|
919
|
-
}) :
|
|
1371
|
+
}) : /*#__PURE__*/jsx(SingleAutocomplete, {
|
|
920
1372
|
options: (_p$options2 = p.options) != null ? _p$options2 : [],
|
|
921
1373
|
control: p.control,
|
|
922
1374
|
className: rendererClass(p.className, options.className),
|
|
@@ -964,6 +1416,7 @@ function SingleAutocomplete(_ref) {
|
|
|
964
1416
|
} = useAutocomplete(_extends({
|
|
965
1417
|
freeSolo: true,
|
|
966
1418
|
multiple: false,
|
|
1419
|
+
readOnly,
|
|
967
1420
|
value: selectedOptionControl.value,
|
|
968
1421
|
inputValue: inputControl.value,
|
|
969
1422
|
getOptionLabel: v => typeof v === "string" ? v : v.name,
|
|
@@ -981,33 +1434,39 @@ function SingleAutocomplete(_ref) {
|
|
|
981
1434
|
}
|
|
982
1435
|
}
|
|
983
1436
|
}, props));
|
|
984
|
-
return
|
|
1437
|
+
return /*#__PURE__*/jsxs("div", _extends({
|
|
985
1438
|
id: id,
|
|
986
1439
|
className: "relative"
|
|
987
|
-
}, getRootProps()
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1440
|
+
}, getRootProps(), {
|
|
1441
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1442
|
+
className: clsx(className, focused ? "border-primary-400 shadow-[0_0_0_3px_transparent] shadow-primary-200" : "shadow-[0_2px_2px_transparent] shadow-surface-50"),
|
|
1443
|
+
children: [/*#__PURE__*/jsx("input", _extends({
|
|
1444
|
+
type: "text"
|
|
1445
|
+
}, getInputProps(), {
|
|
1446
|
+
placeholder: (_controlClasses$place = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place : "",
|
|
1447
|
+
className: inputClass,
|
|
1448
|
+
readOnly: readOnly
|
|
1449
|
+
})), /*#__PURE__*/jsx("button", _extends({}, getPopupIndicatorProps(), {
|
|
1450
|
+
disabled: disabled || readOnly,
|
|
1451
|
+
className: "outline-0 shadow-none border-0 py-0 px-0.5 bg-transparent pr-[10px]",
|
|
1452
|
+
children: /*#__PURE__*/jsx("li", {
|
|
1453
|
+
className: clsx("fa-solid fa-angle-down", "text-primary-500", popupOpen && "rotate-180")
|
|
1454
|
+
})
|
|
1455
|
+
}))]
|
|
1456
|
+
}), groupedOptions.length > 0 && popupOpen && /*#__PURE__*/jsx("ul", _extends({}, getListboxProps(), {
|
|
1457
|
+
className: listContainerClass,
|
|
1458
|
+
children: groupedOptions.map((option, index) => {
|
|
1459
|
+
const optionProps = getOptionProps({
|
|
1460
|
+
option,
|
|
1461
|
+
index
|
|
1462
|
+
});
|
|
1463
|
+
return /*#__PURE__*/createElement("li", _extends({}, optionProps, {
|
|
1464
|
+
key: optionProps.key,
|
|
1465
|
+
className: listEntryClass
|
|
1466
|
+
}), option.name);
|
|
1467
|
+
})
|
|
1468
|
+
}))]
|
|
1469
|
+
}));
|
|
1011
1470
|
} finally {
|
|
1012
1471
|
_effect();
|
|
1013
1472
|
}
|
|
@@ -1054,6 +1513,7 @@ function MultipleAutocomplete(_ref2) {
|
|
|
1054
1513
|
value: (_selectedOptionsContr = selectedOptionsControl.value) != null ? _selectedOptionsContr : [],
|
|
1055
1514
|
inputValue: inputControl.value,
|
|
1056
1515
|
freeSolo: true,
|
|
1516
|
+
readOnly,
|
|
1057
1517
|
multiple: true,
|
|
1058
1518
|
getOptionLabel: v => typeof v === "string" ? v : v.name,
|
|
1059
1519
|
filterOptions: (o, s) => o.filter(o => {
|
|
@@ -1069,44 +1529,50 @@ function MultipleAutocomplete(_ref2) {
|
|
|
1069
1529
|
}
|
|
1070
1530
|
}
|
|
1071
1531
|
}, props));
|
|
1072
|
-
return
|
|
1532
|
+
return /*#__PURE__*/jsxs("div", _extends({
|
|
1073
1533
|
id: id,
|
|
1074
1534
|
className: "relative"
|
|
1075
|
-
}, getRootProps()
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1535
|
+
}, getRootProps(), {
|
|
1536
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1537
|
+
className: clsx(className, focused ? "border-primary-400 shadow-[0_0_0_3px_transparent] shadow-primary-200" : "shadow-[0_2px_2px_transparent] shadow-surface-50"),
|
|
1538
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1539
|
+
className: "flex flex-1 flex-row flex-wrap",
|
|
1540
|
+
children: [(_selectedOptionsContr2 = selectedOptionsControl.value) == null ? void 0 : _selectedOptionsContr2.map(v => /*#__PURE__*/jsx(Chip, {
|
|
1541
|
+
text: typeof v === "string" ? v : v.name,
|
|
1542
|
+
chipContainerClass: chipContainerClass,
|
|
1543
|
+
chipCloseButtonClass: chipCloseButtonClass,
|
|
1544
|
+
onDeleteClick: readOnly || disabled ? undefined : () => {
|
|
1545
|
+
const c = selectedOptionsControl.elements.find(x => x.value == v);
|
|
1546
|
+
if (c) removeElement(selectedOptionsControl, c);
|
|
1547
|
+
}
|
|
1548
|
+
}, typeof v === "string" ? v : v.name)), /*#__PURE__*/jsx("input", _extends({
|
|
1549
|
+
type: "text"
|
|
1550
|
+
}, getInputProps(), {
|
|
1551
|
+
placeholder: (_controlClasses$place2 = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place2 : "",
|
|
1552
|
+
className: clsx(inputClass),
|
|
1553
|
+
readOnly: readOnly
|
|
1554
|
+
}))]
|
|
1555
|
+
}), /*#__PURE__*/jsx("button", _extends({}, getPopupIndicatorProps(), {
|
|
1556
|
+
disabled: disabled || readOnly,
|
|
1557
|
+
className: "outline-0 shadow-none border-0 py-0 px-0.5 bg-transparent pr-[10px]",
|
|
1558
|
+
children: /*#__PURE__*/jsx("i", {
|
|
1559
|
+
className: clsx("fa-solid fa-angle-down", "text-primary-500", popupOpen && "rotate-180")
|
|
1560
|
+
})
|
|
1561
|
+
}))]
|
|
1562
|
+
}), groupedOptions.length > 0 && popupOpen && /*#__PURE__*/jsx("ul", _extends({}, getListboxProps(), {
|
|
1563
|
+
className: listContainerClass,
|
|
1564
|
+
children: groupedOptions.map((option, index) => {
|
|
1565
|
+
const optionProps = getOptionProps({
|
|
1566
|
+
option,
|
|
1567
|
+
index
|
|
1568
|
+
});
|
|
1569
|
+
return /*#__PURE__*/createElement("li", _extends({}, optionProps, {
|
|
1570
|
+
key: optionProps.key,
|
|
1571
|
+
className: listEntryClass
|
|
1572
|
+
}), option.name);
|
|
1573
|
+
})
|
|
1574
|
+
}))]
|
|
1575
|
+
}));
|
|
1110
1576
|
} finally {
|
|
1111
1577
|
_effect2();
|
|
1112
1578
|
}
|
|
@@ -1119,14 +1585,15 @@ function Chip({
|
|
|
1119
1585
|
}) {
|
|
1120
1586
|
var _effect3 = useComponentTracking();
|
|
1121
1587
|
try {
|
|
1122
|
-
return
|
|
1123
|
-
className: chipContainerClass
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1588
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1589
|
+
className: chipContainerClass,
|
|
1590
|
+
children: [text, /*#__PURE__*/jsx("i", {
|
|
1591
|
+
className: chipCloseButtonClass,
|
|
1592
|
+
onClick: () => {
|
|
1593
|
+
onDeleteClick == null || onDeleteClick();
|
|
1594
|
+
}
|
|
1595
|
+
})]
|
|
1596
|
+
});
|
|
1130
1597
|
} finally {
|
|
1131
1598
|
_effect3();
|
|
1132
1599
|
}
|
|
@@ -1138,7 +1605,9 @@ const ValueForFieldExtension = {
|
|
|
1138
1605
|
value: RenderType,
|
|
1139
1606
|
name: "Value For Field",
|
|
1140
1607
|
fields: buildSchema({
|
|
1141
|
-
fieldRef: stringField("Field Reference")
|
|
1608
|
+
fieldRef: stringField("Field Reference"),
|
|
1609
|
+
noOptions: boolField("No Options"),
|
|
1610
|
+
refIsDirect: boolField("Reference is direct")
|
|
1142
1611
|
})
|
|
1143
1612
|
}
|
|
1144
1613
|
};
|
|
@@ -1146,23 +1615,35 @@ function createValueForFieldRenderer(options) {
|
|
|
1146
1615
|
return createDataRenderer((o, renderer) => {
|
|
1147
1616
|
var _schemaDataForFieldRe;
|
|
1148
1617
|
const {
|
|
1149
|
-
fieldRef
|
|
1618
|
+
fieldRef,
|
|
1619
|
+
noOptions,
|
|
1620
|
+
refIsDirect
|
|
1150
1621
|
} = o.renderOptions;
|
|
1151
|
-
const actualFieldRef = fieldRef ? (_schemaDataForFieldRe = schemaDataForFieldRef(fieldRef, o.dataContext.parentNode)) == null || (_schemaDataForFieldRe = _schemaDataForFieldRe.control) == null ? void 0 : _schemaDataForFieldRe.value :
|
|
1152
|
-
|
|
1153
|
-
|
|
1622
|
+
const actualFieldRef = fieldRef ? refIsDirect ? fieldRef : (_schemaDataForFieldRe = schemaDataForFieldRef(fieldRef, o.dataContext.parentNode)) == null || (_schemaDataForFieldRe = _schemaDataForFieldRe.control) == null ? void 0 : _schemaDataForFieldRe.value : ".";
|
|
1623
|
+
let schemaField;
|
|
1624
|
+
if (refIsDirect) {
|
|
1625
|
+
const dataNode = schemaDataForFieldRef(actualFieldRef, o.dataContext.parentNode);
|
|
1626
|
+
schemaField = trackedValue(dataNode.control.as());
|
|
1627
|
+
} else {
|
|
1628
|
+
schemaField = actualFieldRef ? schemaForFieldRef(actualFieldRef, options.schema).field : undefined;
|
|
1629
|
+
}
|
|
1630
|
+
return schemaField ? /*#__PURE__*/jsx(ValueForField, {
|
|
1154
1631
|
renderer: renderer,
|
|
1155
|
-
|
|
1156
|
-
control: o.control
|
|
1157
|
-
|
|
1632
|
+
schemaField: schemaField,
|
|
1633
|
+
control: o.control,
|
|
1634
|
+
noOptions: noOptions
|
|
1635
|
+
}) : /*#__PURE__*/jsx(Fragment, {
|
|
1636
|
+
children: actualFieldRef ? "No schema node for " + actualFieldRef : ""
|
|
1637
|
+
});
|
|
1158
1638
|
}, {
|
|
1159
1639
|
renderType: RenderType
|
|
1160
1640
|
});
|
|
1161
1641
|
}
|
|
1162
1642
|
function ValueForField({
|
|
1163
|
-
|
|
1643
|
+
schemaField,
|
|
1164
1644
|
renderer,
|
|
1165
|
-
control
|
|
1645
|
+
control,
|
|
1646
|
+
noOptions
|
|
1166
1647
|
}) {
|
|
1167
1648
|
var _effect = useComponentTracking();
|
|
1168
1649
|
try {
|
|
@@ -1172,19 +1653,25 @@ function ValueForField({
|
|
|
1172
1653
|
default: control
|
|
1173
1654
|
}));
|
|
1174
1655
|
const [controls, rootSchema] = useMemo(() => {
|
|
1175
|
-
const
|
|
1656
|
+
const adjustedField = _extends({}, schemaField, {
|
|
1657
|
+
collection: noOptions ? false : schemaField.collection,
|
|
1658
|
+
options: noOptions ? undefined : schemaField.options,
|
|
1176
1659
|
field: "default",
|
|
1177
1660
|
required: false,
|
|
1178
1661
|
notNullable: false,
|
|
1179
1662
|
onlyForTypes: null,
|
|
1180
1663
|
defaultValue: undefined
|
|
1181
|
-
})
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1664
|
+
});
|
|
1665
|
+
const control = _extends({}, defaultControlForField(adjustedField), {
|
|
1666
|
+
hideTitle: true
|
|
1667
|
+
});
|
|
1668
|
+
const rootSchema = createSchemaTree([adjustedField]).rootNode;
|
|
1669
|
+
return [control, rootSchema];
|
|
1670
|
+
}, [schemaField]);
|
|
1671
|
+
const Render = useControlRendererComponent(controls, renderer, {
|
|
1185
1672
|
disabled: control.disabled
|
|
1186
1673
|
}, makeSchemaDataNode(rootSchema, value));
|
|
1187
|
-
return
|
|
1674
|
+
return /*#__PURE__*/jsx(Render, {});
|
|
1188
1675
|
} finally {
|
|
1189
1676
|
_effect();
|
|
1190
1677
|
}
|
|
@@ -1207,7 +1694,7 @@ function createOptionalAdornment(options = {}) {
|
|
|
1207
1694
|
apply: rl => {
|
|
1208
1695
|
var _ref, _adornment$placement;
|
|
1209
1696
|
if (props.formOptions.readonly) return rl;
|
|
1210
|
-
if (!options.hideEdit && adornment.editSelectable) appendMarkupAt((_ref = (_adornment$placement = adornment.placement) != null ? _adornment$placement : options.defaultPlacement) != null ? _ref : AdornmentPlacement.LabelStart,
|
|
1697
|
+
if (!options.hideEdit && adornment.editSelectable) appendMarkupAt((_ref = (_adornment$placement = adornment.placement) != null ? _adornment$placement : options.defaultPlacement) != null ? _ref : AdornmentPlacement.LabelStart, /*#__PURE__*/jsx(Fcheckbox$1, {
|
|
1211
1698
|
control: editing,
|
|
1212
1699
|
className: options.checkClass
|
|
1213
1700
|
}))(rl);
|
|
@@ -1219,7 +1706,7 @@ function createOptionalAdornment(options = {}) {
|
|
|
1219
1706
|
nullToggler,
|
|
1220
1707
|
dataContext,
|
|
1221
1708
|
options
|
|
1222
|
-
}) :
|
|
1709
|
+
}) : /*#__PURE__*/jsx(OptionalEditRenderer, {
|
|
1223
1710
|
children: children,
|
|
1224
1711
|
options: options,
|
|
1225
1712
|
editing: editing.as(),
|
|
@@ -1247,27 +1734,33 @@ function OptionalEditRenderer({
|
|
|
1247
1734
|
const nullToggler = getNullToggler(dataControl);
|
|
1248
1735
|
const allValues = getAllValues(dataControl);
|
|
1249
1736
|
const multipleValues = allValues.value.length > 1;
|
|
1250
|
-
const nullEdit = adornment.allowNull ?
|
|
1251
|
-
className: options.nullWrapperClass
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1737
|
+
const nullEdit = adornment.allowNull ? /*#__PURE__*/jsxs("div", {
|
|
1738
|
+
className: options.nullWrapperClass,
|
|
1739
|
+
children: [/*#__PURE__*/jsx(Fcheckbox$1, {
|
|
1740
|
+
control: nullToggler,
|
|
1741
|
+
className: options.checkClass,
|
|
1742
|
+
notValue: true
|
|
1743
|
+
}), /*#__PURE__*/jsx("span", {
|
|
1744
|
+
children: (_options$setNullText = options.setNullText) != null ? _options$setNullText : "Null"
|
|
1745
|
+
})]
|
|
1746
|
+
}) : undefined;
|
|
1747
|
+
return /*#__PURE__*/jsx("div", {
|
|
1748
|
+
className: options.className,
|
|
1749
|
+
children: multipleValues && editing.value === false ? /*#__PURE__*/jsx("div", {
|
|
1750
|
+
className: options.multiValuesClass,
|
|
1751
|
+
children: (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values"
|
|
1752
|
+
}) : /*#__PURE__*/jsxs("div", {
|
|
1753
|
+
className: options.childWrapperClass,
|
|
1754
|
+
children: [nullEdit, children]
|
|
1755
|
+
})
|
|
1756
|
+
});
|
|
1264
1757
|
} finally {
|
|
1265
1758
|
_effect();
|
|
1266
1759
|
}
|
|
1267
1760
|
}
|
|
1268
1761
|
|
|
1269
1762
|
function createMultilineFieldRenderer(className) {
|
|
1270
|
-
return createDataRenderer(p =>
|
|
1763
|
+
return createDataRenderer(p => /*#__PURE__*/jsx(MultilineTextfield, _extends({}, p, {
|
|
1271
1764
|
className: rendererClass(p.className, className)
|
|
1272
1765
|
})));
|
|
1273
1766
|
}
|
|
@@ -1284,7 +1777,7 @@ function MultilineTextfield({
|
|
|
1284
1777
|
c.textContent = v;
|
|
1285
1778
|
}
|
|
1286
1779
|
}, true);
|
|
1287
|
-
return
|
|
1780
|
+
return /*#__PURE__*/jsx("code", {
|
|
1288
1781
|
contentEditable: !control.disabled,
|
|
1289
1782
|
className: className,
|
|
1290
1783
|
onInput: t => control.value = t.currentTarget.textContent,
|
|
@@ -1296,7 +1789,7 @@ function MultilineTextfield({
|
|
|
1296
1789
|
}
|
|
1297
1790
|
|
|
1298
1791
|
function createArrayElementRenderer(options = {}) {
|
|
1299
|
-
return createDataRenderer((props, formRenderer) =>
|
|
1792
|
+
return createDataRenderer((props, formRenderer) => /*#__PURE__*/jsx(ArrayElementRenderer, {
|
|
1300
1793
|
dataProps: props,
|
|
1301
1794
|
options: options,
|
|
1302
1795
|
formRenderer: formRenderer,
|
|
@@ -1328,29 +1821,33 @@ function ArrayElementRenderer({
|
|
|
1328
1821
|
});
|
|
1329
1822
|
if (designMode || extData.value !== undefined) {
|
|
1330
1823
|
const parentDataNode = makeSchemaDataNode(dataProps.dataNode.schema, extData.fields.data);
|
|
1331
|
-
const elementGroup = formNode.
|
|
1824
|
+
const elementGroup = formNode.createChildNode("group", {
|
|
1332
1825
|
type: ControlDefinitionType.Group,
|
|
1333
1826
|
groupOptions: {
|
|
1334
1827
|
type: GroupRenderType.Standard,
|
|
1335
1828
|
hideTitle: true
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1829
|
+
},
|
|
1830
|
+
children: formNode.getResolvedChildren()
|
|
1831
|
+
});
|
|
1832
|
+
const editContent = /*#__PURE__*/jsxs("div", {
|
|
1833
|
+
className: rendererClass(dataProps.className, options.className),
|
|
1834
|
+
children: [renderChild("", elementGroup, {
|
|
1835
|
+
parentDataNode
|
|
1836
|
+
}), /*#__PURE__*/jsx("div", {
|
|
1837
|
+
className: options.actionsClass,
|
|
1838
|
+
children: /*#__PURE__*/jsx(RenderElements, {
|
|
1839
|
+
control: extData.fields.actions,
|
|
1840
|
+
children: c => formRenderer.renderAction(applyValidation(c.value))
|
|
1841
|
+
})
|
|
1842
|
+
})]
|
|
1843
|
+
});
|
|
1348
1844
|
if (renderOptions.showInline || designMode) return editContent;
|
|
1349
|
-
return
|
|
1350
|
-
state: overlayState
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1845
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
1846
|
+
state: overlayState,
|
|
1847
|
+
children: /*#__PURE__*/jsx(Dialog, {
|
|
1848
|
+
children: editContent
|
|
1849
|
+
})
|
|
1850
|
+
});
|
|
1354
1851
|
function runValidation(onClick) {
|
|
1355
1852
|
let hasErrors = false;
|
|
1356
1853
|
visitFormDataInContext(parentDataNode, elementGroup, validationVisitor(() => {
|
|
@@ -1366,32 +1863,71 @@ function ArrayElementRenderer({
|
|
|
1366
1863
|
onClick: () => runValidation(action.onClick)
|
|
1367
1864
|
});
|
|
1368
1865
|
}
|
|
1369
|
-
} else return
|
|
1866
|
+
} else return /*#__PURE__*/jsx(Fragment, {});
|
|
1370
1867
|
} finally {
|
|
1371
1868
|
_effect();
|
|
1372
1869
|
}
|
|
1373
1870
|
}
|
|
1374
1871
|
|
|
1375
1872
|
function createButtonActionRenderer(actionId, options = {}) {
|
|
1376
|
-
return createActionRenderer(actionId, ({
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1873
|
+
return createActionRenderer(actionId, (props, renderer) => {
|
|
1874
|
+
var _props$icon, _ref, _props$iconPlacement, _options$renderConten;
|
|
1875
|
+
const {
|
|
1876
|
+
key,
|
|
1877
|
+
onClick,
|
|
1878
|
+
actionText,
|
|
1879
|
+
className,
|
|
1880
|
+
style,
|
|
1881
|
+
actionId,
|
|
1882
|
+
actionData,
|
|
1883
|
+
disabled,
|
|
1884
|
+
textClass,
|
|
1885
|
+
actionStyle,
|
|
1886
|
+
inline,
|
|
1887
|
+
actionContent
|
|
1888
|
+
} = props;
|
|
1889
|
+
const icon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
|
|
1890
|
+
const iconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : IconPlacement.BeforeText;
|
|
1891
|
+
const {
|
|
1892
|
+
Button,
|
|
1893
|
+
I,
|
|
1894
|
+
Span
|
|
1895
|
+
} = renderer.html;
|
|
1896
|
+
const isLink = actionStyle == ActionStyle.Link;
|
|
1897
|
+
const isGroup = actionStyle == ActionStyle.Group;
|
|
1898
|
+
const classNames = rendererClass(className, isLink ? options.linkClass : isGroup ? options.groupClass : rendererClass(options.buttonClass, actionStyle == ActionStyle.Secondary ? options.secondaryClass : options.primaryClass));
|
|
1899
|
+
const iconElement = icon && /*#__PURE__*/jsx(I, {
|
|
1900
|
+
iconName: icon.name,
|
|
1901
|
+
iconLibrary: icon.library,
|
|
1902
|
+
className: iconPlacement == IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass
|
|
1903
|
+
});
|
|
1904
|
+
const textClassNames = rendererClass(textClass, isLink ? options.linkTextClass : rendererClass(options.textClass, actionStyle == ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
|
|
1905
|
+
const textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsx(Span, {
|
|
1906
|
+
className: textClassNames,
|
|
1907
|
+
children: actionText
|
|
1908
|
+
});
|
|
1909
|
+
return /*#__PURE__*/jsx(Button, {
|
|
1910
|
+
className: classNames,
|
|
1911
|
+
textClass: textClassNames,
|
|
1389
1912
|
disabled: disabled,
|
|
1390
1913
|
style: style,
|
|
1391
|
-
onClick: onClick
|
|
1392
|
-
|
|
1914
|
+
onClick: onClick,
|
|
1915
|
+
inline: inline,
|
|
1916
|
+
nonTextContent: isGroup,
|
|
1917
|
+
title: iconPlacement == IconPlacement.ReplaceText ? actionText : undefined,
|
|
1918
|
+
notWrapInText: options.notWrapInText,
|
|
1919
|
+
androidRippleColor: options.androidRippleColor,
|
|
1920
|
+
children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : /*#__PURE__*/jsxs(Fragment, {
|
|
1921
|
+
children: [iconPlacement == IconPlacement.BeforeText && iconElement, iconPlacement != IconPlacement.ReplaceText && textElement, iconPlacement != IconPlacement.BeforeText && iconElement]
|
|
1922
|
+
})
|
|
1923
|
+
}, key);
|
|
1393
1924
|
});
|
|
1394
1925
|
}
|
|
1926
|
+
|
|
1927
|
+
const _excluded = ["inline", "textClass", "className", "notWrapInText", "androidRippleColor", "onClick", "nonTextContent"],
|
|
1928
|
+
_excluded2 = ["textClass", "className", "onChangeValue", "onChangeChecked", "inputRef"],
|
|
1929
|
+
_excluded3 = ["text", "html", "children", "className", "textClass", "nativeRef", "inline"],
|
|
1930
|
+
_excluded4 = ["textClass", "className"];
|
|
1395
1931
|
const DefaultBoolOptions = [{
|
|
1396
1932
|
name: "Yes",
|
|
1397
1933
|
value: true
|
|
@@ -1400,18 +1936,19 @@ const DefaultBoolOptions = [{
|
|
|
1400
1936
|
value: false
|
|
1401
1937
|
}];
|
|
1402
1938
|
function createDefaultDataRenderer(options = {}) {
|
|
1403
|
-
var _options$
|
|
1404
|
-
const
|
|
1939
|
+
var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
|
|
1940
|
+
const elementSelectedRenderer = createElementSelectedRenderer((_options$checkboxOpti = options.checkboxOptions) != null ? _options$checkboxOpti : options.checkOptions);
|
|
1405
1941
|
const jsonataRenderer = createJsonataRenderer(options.jsonataClass);
|
|
1406
1942
|
const nullToggler = createNullToggleRenderer();
|
|
1407
1943
|
const multilineRenderer = createMultilineFieldRenderer(options.multilineClass);
|
|
1408
|
-
const checkboxRenderer = createCheckboxRenderer((_options$
|
|
1944
|
+
const checkboxRenderer = createCheckboxRenderer((_options$checkboxOpti2 = options.checkboxOptions) != null ? _options$checkboxOpti2 : options.checkOptions);
|
|
1409
1945
|
const selectRenderer = createSelectRenderer(options.selectOptions);
|
|
1410
1946
|
const radioRenderer = createRadioRenderer((_options$radioOptions = options.radioOptions) != null ? _options$radioOptions : options.checkOptions);
|
|
1411
1947
|
const checkListRenderer = createCheckListRenderer((_options$checkListOpt = options.checkListOptions) != null ? _options$checkListOpt : options.checkOptions);
|
|
1412
1948
|
const arrayElementRenderer = createArrayElementRenderer(options.arrayElementOptions);
|
|
1413
1949
|
const {
|
|
1414
1950
|
inputClass,
|
|
1951
|
+
inputTextClass,
|
|
1415
1952
|
booleanOptions,
|
|
1416
1953
|
optionRenderer,
|
|
1417
1954
|
displayOnlyClass,
|
|
@@ -1429,7 +1966,7 @@ function createDefaultDataRenderer(options = {}) {
|
|
|
1429
1966
|
const fieldType = field.type;
|
|
1430
1967
|
const renderOptions = props.renderOptions;
|
|
1431
1968
|
let renderType = renderOptions.type;
|
|
1432
|
-
if (field.collection && props.elementIndex == null && (renderType == DataRenderType.Standard || renderType == DataRenderType.Array || renderType == DataRenderType.ArrayElement)) {
|
|
1969
|
+
if (field.collection && props.dataNode.elementIndex == null && (renderType == DataRenderType.Standard || renderType == DataRenderType.Array || renderType == DataRenderType.ArrayElement)) {
|
|
1433
1970
|
if (renderType == DataRenderType.ArrayElement) return arrayElementRenderer.render(props, renderers);
|
|
1434
1971
|
return arrayRenderer.render(props, renderers);
|
|
1435
1972
|
}
|
|
@@ -1446,12 +1983,13 @@ function createDefaultDataRenderer(options = {}) {
|
|
|
1446
1983
|
if (props.displayOnly || isDisplayOnlyRenderer(renderOptions)) return p => {
|
|
1447
1984
|
return _extends({}, p, {
|
|
1448
1985
|
className: "@ " + rendererClass(p.className, displayOnlyClass),
|
|
1449
|
-
children:
|
|
1450
|
-
|
|
1986
|
+
children: /*#__PURE__*/jsx(DefaultDisplayOnly, {
|
|
1987
|
+
dataNode: props.dataNode,
|
|
1451
1988
|
schemaInterface: props.dataContext.schemaInterface,
|
|
1452
|
-
control: props.control,
|
|
1453
1989
|
className: props.className,
|
|
1990
|
+
textClass: props.textClass,
|
|
1454
1991
|
style: props.style,
|
|
1992
|
+
inline: props.inline,
|
|
1455
1993
|
renderer: renderers,
|
|
1456
1994
|
emptyText: isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText
|
|
1457
1995
|
})
|
|
@@ -1481,15 +2019,20 @@ function createDefaultDataRenderer(options = {}) {
|
|
|
1481
2019
|
return jsonataRenderer.render(props, renderers);
|
|
1482
2020
|
case DataRenderType.Autocomplete:
|
|
1483
2021
|
return autocompleteRenderer.render(props, renderers);
|
|
2022
|
+
case DataRenderType.ElementSelected:
|
|
2023
|
+
return elementSelectedRenderer.render(props, renderers);
|
|
1484
2024
|
}
|
|
1485
2025
|
if (fieldType == FieldType.Any) {
|
|
1486
2026
|
var _field$displayName;
|
|
1487
|
-
return
|
|
2027
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2028
|
+
children: ["Can't render field: ", (_field$displayName = field.displayName) != null ? _field$displayName : field.field, " (", renderType, ")"]
|
|
2029
|
+
});
|
|
1488
2030
|
}
|
|
1489
2031
|
if (isTextfieldRenderer(renderOptions) && renderOptions.multiline) return multilineRenderer.render(props, renderers);
|
|
1490
2032
|
const placeholder = isTextfieldRenderer(renderOptions) ? renderOptions.placeholder : undefined;
|
|
1491
|
-
return
|
|
2033
|
+
return /*#__PURE__*/jsx(ControlInput, {
|
|
1492
2034
|
className: rendererClass(props.className, inputClass),
|
|
2035
|
+
textClass: rendererClass(props.textClass, inputTextClass),
|
|
1493
2036
|
style: props.style,
|
|
1494
2037
|
id: props.id,
|
|
1495
2038
|
readOnly: props.readonly,
|
|
@@ -1512,46 +2055,35 @@ function createDefaultAdornmentRenderer(options = {}) {
|
|
|
1512
2055
|
adornment,
|
|
1513
2056
|
designMode,
|
|
1514
2057
|
dataContext,
|
|
1515
|
-
|
|
2058
|
+
runExpression
|
|
1516
2059
|
} = props;
|
|
1517
2060
|
return {
|
|
1518
2061
|
apply: rl => {
|
|
1519
|
-
if (isSetFieldAdornment(adornment) &&
|
|
1520
|
-
|
|
1521
|
-
const dynamicHooks = useDynamicHooks({
|
|
1522
|
-
value: hook
|
|
1523
|
-
});
|
|
1524
|
-
const SetFieldWrapper = useTrackedComponent(setFieldWrapper, [dynamicHooks]);
|
|
1525
|
-
return wrapLayout(x => createElement(SetFieldWrapper, {
|
|
2062
|
+
if (isSetFieldAdornment(adornment) && runExpression) {
|
|
2063
|
+
return wrapLayout(x => /*#__PURE__*/jsx(SetFieldWrapper, {
|
|
1526
2064
|
children: x,
|
|
1527
2065
|
parentContext: dataContext,
|
|
1528
|
-
adornment: adornment
|
|
2066
|
+
adornment: adornment,
|
|
2067
|
+
runExpression: runExpression
|
|
1529
2068
|
}))(rl);
|
|
1530
|
-
function setFieldWrapper({
|
|
1531
|
-
children,
|
|
1532
|
-
adornment,
|
|
1533
|
-
parentContext
|
|
1534
|
-
}) {
|
|
1535
|
-
const {
|
|
1536
|
-
value
|
|
1537
|
-
} = dynamicHooks(parentContext);
|
|
1538
|
-
const fieldNode = schemaDataForFieldRef(adornment.field, parentContext.parentNode);
|
|
1539
|
-
const otherField = fieldNode.control;
|
|
1540
|
-
const always = !adornment.defaultOnly;
|
|
1541
|
-
useControlEffect(() => [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null], ([v]) => {
|
|
1542
|
-
otherField == null || otherField.setValue(x => always || x == null ? v : x);
|
|
1543
|
-
}, true);
|
|
1544
|
-
return children;
|
|
1545
|
-
}
|
|
1546
2069
|
}
|
|
1547
2070
|
if (isIconAdornment(adornment)) {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
2071
|
+
const {
|
|
2072
|
+
I
|
|
2073
|
+
} = renderers.html;
|
|
2074
|
+
const {
|
|
2075
|
+
icon,
|
|
2076
|
+
placement,
|
|
2077
|
+
iconClass
|
|
2078
|
+
} = adornment;
|
|
2079
|
+
return appendMarkupAt(placement != null ? placement : AdornmentPlacement.ControlStart, /*#__PURE__*/jsx(I, {
|
|
2080
|
+
className: iconClass,
|
|
2081
|
+
iconName: icon == null ? void 0 : icon.name,
|
|
2082
|
+
iconLibrary: icon == null ? void 0 : icon.library
|
|
1551
2083
|
}))(rl);
|
|
1552
2084
|
}
|
|
1553
2085
|
if (isAccordionAdornment(adornment)) {
|
|
1554
|
-
return wrapLayout(x =>
|
|
2086
|
+
return wrapLayout(x => /*#__PURE__*/jsx(DefaultAccordion, _extends({
|
|
1555
2087
|
renderers: renderers,
|
|
1556
2088
|
children: x,
|
|
1557
2089
|
accordion: adornment,
|
|
@@ -1568,11 +2100,29 @@ function createDefaultAdornmentRenderer(options = {}) {
|
|
|
1568
2100
|
}
|
|
1569
2101
|
};
|
|
1570
2102
|
}
|
|
2103
|
+
function SetFieldWrapper({
|
|
2104
|
+
children,
|
|
2105
|
+
adornment,
|
|
2106
|
+
parentContext,
|
|
2107
|
+
runExpression
|
|
2108
|
+
}) {
|
|
2109
|
+
const fieldNode = schemaDataForFieldRef(adornment.field, parentContext.parentNode);
|
|
2110
|
+
const otherField = fieldNode.control;
|
|
2111
|
+
const always = !adornment.defaultOnly;
|
|
2112
|
+
const value = useExpression(undefined, runExpression, adornment.expression, x => x);
|
|
2113
|
+
useControlEffect(() => [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null], ([v]) => {
|
|
2114
|
+
otherField == null || otherField.setValue(x => always || x == null ? v : x);
|
|
2115
|
+
}, true);
|
|
2116
|
+
return children;
|
|
2117
|
+
}
|
|
1571
2118
|
function createDefaultLabelRenderer(options) {
|
|
1572
2119
|
const {
|
|
1573
2120
|
className,
|
|
2121
|
+
controlLabelTextClass,
|
|
2122
|
+
groupLabelTextClass,
|
|
1574
2123
|
groupLabelClass,
|
|
1575
2124
|
controlLabelClass,
|
|
2125
|
+
textClass,
|
|
1576
2126
|
labelContainer
|
|
1577
2127
|
} = _extends({
|
|
1578
2128
|
labelContainer: c => c
|
|
@@ -1580,19 +2130,152 @@ function createDefaultLabelRenderer(options) {
|
|
|
1580
2130
|
return {
|
|
1581
2131
|
render: (props, labelStart, labelEnd, renderers) => {
|
|
1582
2132
|
var _options$requiredElem;
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
}
|
|
2133
|
+
const {
|
|
2134
|
+
Label,
|
|
2135
|
+
Span
|
|
2136
|
+
} = renderers.html;
|
|
2137
|
+
const requiredElement = (_options$requiredElem = options == null ? void 0 : options.requiredElement) != null ? _options$requiredElem : ({
|
|
2138
|
+
Span
|
|
2139
|
+
}) => /*#__PURE__*/jsx(Span, {
|
|
2140
|
+
children: " *"
|
|
2141
|
+
});
|
|
2142
|
+
if (props.type == LabelType.Text) return /*#__PURE__*/jsx(Span, {
|
|
2143
|
+
children: props.label
|
|
2144
|
+
});
|
|
2145
|
+
return labelContainer(/*#__PURE__*/jsxs(Fragment, {
|
|
2146
|
+
children: [/*#__PURE__*/jsxs(Label, {
|
|
2147
|
+
htmlFor: props.forId,
|
|
2148
|
+
className: rendererClass(props.className, clsx(className, props.type === LabelType.Group && groupLabelClass, props.type === LabelType.Control && controlLabelClass)),
|
|
2149
|
+
textClass: rendererClass(props.textClass, clsx(textClass, props.type === LabelType.Group && groupLabelTextClass, props.type === LabelType.Control && controlLabelTextClass)),
|
|
2150
|
+
children: [labelStart, renderers.renderLabelText(props.label), props.required && requiredElement(renderers.html)]
|
|
2151
|
+
}), labelEnd]
|
|
2152
|
+
}));
|
|
1590
2153
|
},
|
|
1591
2154
|
type: "label"
|
|
1592
2155
|
};
|
|
1593
2156
|
}
|
|
2157
|
+
const StandardHtmlComponents = {
|
|
2158
|
+
Button: DefaultHtmlButtonRenderer,
|
|
2159
|
+
Label: DefaultHtmlLabelRenderer,
|
|
2160
|
+
I: DefaultHtmlIconRenderer,
|
|
2161
|
+
Span: "span",
|
|
2162
|
+
Div: DefaultHtmlDivRenderer,
|
|
2163
|
+
H1: "h1",
|
|
2164
|
+
B: "b",
|
|
2165
|
+
Input: DefaultHtmlInputRenderer
|
|
2166
|
+
};
|
|
2167
|
+
function DefaultHtmlButtonRenderer(_ref2) {
|
|
2168
|
+
var _effect = useComponentTracking();
|
|
2169
|
+
try {
|
|
2170
|
+
let {
|
|
2171
|
+
textClass,
|
|
2172
|
+
className,
|
|
2173
|
+
onClick,
|
|
2174
|
+
nonTextContent
|
|
2175
|
+
} = _ref2,
|
|
2176
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
2177
|
+
const Comp = nonTextContent ? "div" : "button";
|
|
2178
|
+
return /*#__PURE__*/jsx(Comp, _extends({
|
|
2179
|
+
role: nonTextContent ? "button" : undefined,
|
|
2180
|
+
onClick: onClick ? e => {
|
|
2181
|
+
e.stopPropagation();
|
|
2182
|
+
onClick();
|
|
2183
|
+
} : undefined,
|
|
2184
|
+
className: nonTextContent ? className : clsx(className, textClass)
|
|
2185
|
+
}, props));
|
|
2186
|
+
} finally {
|
|
2187
|
+
_effect();
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
function DefaultHtmlInputRenderer(_ref3) {
|
|
2191
|
+
var _effect2 = useComponentTracking();
|
|
2192
|
+
try {
|
|
2193
|
+
let {
|
|
2194
|
+
textClass,
|
|
2195
|
+
className,
|
|
2196
|
+
onChangeValue,
|
|
2197
|
+
onChangeChecked,
|
|
2198
|
+
inputRef
|
|
2199
|
+
} = _ref3,
|
|
2200
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
|
|
2201
|
+
return /*#__PURE__*/jsx("input", _extends({
|
|
2202
|
+
ref: inputRef
|
|
2203
|
+
}, props, {
|
|
2204
|
+
className: clsx(className, textClass),
|
|
2205
|
+
onChange: onChangeValue ? e => onChangeValue(e.target.value) : onChangeChecked ? e => onChangeChecked(e.target.checked) : undefined
|
|
2206
|
+
}));
|
|
2207
|
+
} finally {
|
|
2208
|
+
_effect2();
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
function DefaultHtmlDivRenderer(_ref4) {
|
|
2212
|
+
var _effect3 = useComponentTracking();
|
|
2213
|
+
try {
|
|
2214
|
+
let {
|
|
2215
|
+
text,
|
|
2216
|
+
html,
|
|
2217
|
+
children,
|
|
2218
|
+
className,
|
|
2219
|
+
textClass,
|
|
2220
|
+
nativeRef,
|
|
2221
|
+
inline
|
|
2222
|
+
} = _ref4,
|
|
2223
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
|
|
2224
|
+
const Tag = inline ? "span" : "div";
|
|
2225
|
+
return /*#__PURE__*/jsx(Tag, _extends({}, props, {
|
|
2226
|
+
ref: nativeRef,
|
|
2227
|
+
className: clsx(className, textClass),
|
|
2228
|
+
children: text != null ? text : children,
|
|
2229
|
+
dangerouslySetInnerHTML: html ? {
|
|
2230
|
+
__html: html
|
|
2231
|
+
} : undefined
|
|
2232
|
+
}));
|
|
2233
|
+
} finally {
|
|
2234
|
+
_effect3();
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
function DefaultHtmlLabelRenderer(_ref5) {
|
|
2238
|
+
var _effect4 = useComponentTracking();
|
|
2239
|
+
try {
|
|
2240
|
+
let {
|
|
2241
|
+
textClass,
|
|
2242
|
+
className
|
|
2243
|
+
} = _ref5,
|
|
2244
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded4);
|
|
2245
|
+
return /*#__PURE__*/jsx("label", _extends({}, props, {
|
|
2246
|
+
className: clsx(className, textClass)
|
|
2247
|
+
}));
|
|
2248
|
+
} finally {
|
|
2249
|
+
_effect4();
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
function DefaultHtmlIconRenderer({
|
|
2253
|
+
iconName,
|
|
2254
|
+
iconLibrary,
|
|
2255
|
+
className,
|
|
2256
|
+
style
|
|
2257
|
+
}) {
|
|
2258
|
+
var _effect5 = useComponentTracking();
|
|
2259
|
+
try {
|
|
2260
|
+
return iconName ? /*#__PURE__*/jsx("i", {
|
|
2261
|
+
className: clsx(className, toIconClass()),
|
|
2262
|
+
style: style
|
|
2263
|
+
}) : undefined;
|
|
2264
|
+
function toIconClass() {
|
|
2265
|
+
if (!iconName) return undefined;
|
|
2266
|
+
switch (iconLibrary) {
|
|
2267
|
+
case IconLibrary.FontAwesome:
|
|
2268
|
+
return "fa fa-" + iconName;
|
|
2269
|
+
default:
|
|
2270
|
+
return iconName;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
} finally {
|
|
2274
|
+
_effect5();
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
1594
2277
|
function createDefaultRenderers(options = {}) {
|
|
1595
|
-
var _options$
|
|
2278
|
+
var _options$extraRendere, _options$html;
|
|
1596
2279
|
return {
|
|
1597
2280
|
data: createDefaultDataRenderer(options.data),
|
|
1598
2281
|
display: createDefaultDisplayRenderer(options.display),
|
|
@@ -1603,8 +2286,8 @@ function createDefaultRenderers(options = {}) {
|
|
|
1603
2286
|
adornment: createDefaultAdornmentRenderer(options.adornment),
|
|
1604
2287
|
renderLayout: createDefaultLayoutRenderer(options.layout),
|
|
1605
2288
|
visibility: createDefaultVisibilityRenderer(),
|
|
1606
|
-
|
|
1607
|
-
|
|
2289
|
+
extraRenderers: (_options$extraRendere = options.extraRenderers == null ? void 0 : options.extraRenderers(options)) != null ? _options$extraRendere : [],
|
|
2290
|
+
html: (_options$html = options.html) != null ? _options$html : StandardHtmlComponents
|
|
1608
2291
|
};
|
|
1609
2292
|
}
|
|
1610
2293
|
function createClassStyledRenderers() {
|
|
@@ -1619,7 +2302,7 @@ function createClassStyledRenderers() {
|
|
|
1619
2302
|
className: "control-array"
|
|
1620
2303
|
},
|
|
1621
2304
|
action: {
|
|
1622
|
-
|
|
2305
|
+
buttonClass: "action"
|
|
1623
2306
|
},
|
|
1624
2307
|
data: {
|
|
1625
2308
|
inputClass: "data"
|
|
@@ -1634,9 +2317,12 @@ function createClassStyledRenderers() {
|
|
|
1634
2317
|
const defaultTailwindTheme = {
|
|
1635
2318
|
label: {
|
|
1636
2319
|
groupLabelClass: "font-bold",
|
|
1637
|
-
requiredElement:
|
|
1638
|
-
|
|
1639
|
-
},
|
|
2320
|
+
requiredElement: ({
|
|
2321
|
+
Span
|
|
2322
|
+
}) => /*#__PURE__*/jsx(Span, {
|
|
2323
|
+
className: "text-red-500",
|
|
2324
|
+
children: " *"
|
|
2325
|
+
})
|
|
1640
2326
|
},
|
|
1641
2327
|
array: {
|
|
1642
2328
|
removableClass: "grid grid-cols-[1fr_auto] items-center gap-x-2",
|
|
@@ -1646,8 +2332,12 @@ const defaultTailwindTheme = {
|
|
|
1646
2332
|
},
|
|
1647
2333
|
group: {
|
|
1648
2334
|
standardClassName: "flex flex-col gap-4",
|
|
1649
|
-
|
|
2335
|
+
grid: {
|
|
2336
|
+
className: "flex flex-col gap-4",
|
|
2337
|
+
rowClass: "flex flex-row gap-4 justify-between *:flex-1"
|
|
2338
|
+
},
|
|
1650
2339
|
flexClassName: "gap-2",
|
|
2340
|
+
inlineClass: "",
|
|
1651
2341
|
tabs: {
|
|
1652
2342
|
className: "",
|
|
1653
2343
|
tabListClass: "flex flex-wrap text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:border-gray-700 dark:text-gray-400",
|
|
@@ -1659,17 +2349,22 @@ const defaultTailwindTheme = {
|
|
|
1659
2349
|
}
|
|
1660
2350
|
},
|
|
1661
2351
|
action: {
|
|
1662
|
-
|
|
2352
|
+
buttonClass: "rounded-lg p-3 text-white disabled:opacity-75 disabled:cursor-not-allowed",
|
|
2353
|
+
primaryClass: "bg-primary-500",
|
|
2354
|
+
secondaryClass: "bg-secondary-500",
|
|
2355
|
+
iconBeforeClass: "px-2",
|
|
2356
|
+
iconAfterClass: "px-2"
|
|
1663
2357
|
},
|
|
1664
2358
|
layout: {
|
|
1665
2359
|
className: "flex flex-col",
|
|
1666
2360
|
errorClass: "text-sm text-red-500"
|
|
1667
2361
|
},
|
|
1668
2362
|
data: {
|
|
2363
|
+
inputClass: "form-control",
|
|
1669
2364
|
displayOnlyClass: "flex flex-row items-center gap-2",
|
|
1670
2365
|
checkOptions: {
|
|
1671
2366
|
className: "flex items-center gap-4",
|
|
1672
|
-
entryClass: "flex gap-1
|
|
2367
|
+
entryClass: "flex items-center gap-1"
|
|
1673
2368
|
},
|
|
1674
2369
|
selectOptions: {
|
|
1675
2370
|
emptyText: "<select>"
|
|
@@ -1690,8 +2385,8 @@ const defaultTailwindTheme = {
|
|
|
1690
2385
|
accordion: {
|
|
1691
2386
|
className: "flex items-center gap-2 my-2",
|
|
1692
2387
|
titleClass: "cursor-pointer",
|
|
1693
|
-
|
|
1694
|
-
|
|
2388
|
+
iconOpen: fontAwesomeIcon("chevron-up"),
|
|
2389
|
+
iconClosed: fontAwesomeIcon("chevron-down")
|
|
1695
2390
|
},
|
|
1696
2391
|
optional: {
|
|
1697
2392
|
checkClass: "m-2",
|
|
@@ -1702,5 +2397,5 @@ const defaultTailwindTheme = {
|
|
|
1702
2397
|
}
|
|
1703
2398
|
};
|
|
1704
2399
|
|
|
1705
|
-
export { CheckButtons, ControlInput, DataArrayRenderer, DefaultAccordion, DefaultArrayRenderer, DefaultBoolOptions, DefaultDisplay, DefaultDisplayOnly, DefaultLayout, DefaultVisibility, Fcheckbox, JsonataRenderer, OptionalEditRenderer, SelectDataRenderer, ValueForFieldExtension, createAutocompleteRenderer, createButtonActionRenderer, createCheckListRenderer, createCheckboxRenderer, createClassStyledRenderers, createDefaultAdornmentRenderer, createDefaultArrayDataRenderer, createDefaultArrayRenderer, createDefaultDataRenderer, createDefaultDisplayRenderer, createDefaultGroupRenderer, createDefaultLabelRenderer, createDefaultLayoutRenderer, createDefaultRenderers, createDefaultVisibilityRenderer, createInputConversion, createJsonataRenderer, createNullToggleRenderer, createOptionalAdornment, createRadioRenderer, createSelectConversion, createSelectRenderer, createValueForFieldRenderer, defaultTailwindTheme, getAccordionState, setIncluded };
|
|
2400
|
+
export { CheckButtons, ControlInput, DataArrayRenderer, DefaultAccordion, DefaultArrayRenderer, DefaultBoolOptions, DefaultDisplay, DefaultDisplayOnly, DefaultHtmlButtonRenderer, DefaultHtmlDivRenderer, DefaultHtmlIconRenderer, DefaultHtmlInputRenderer, DefaultHtmlLabelRenderer, DefaultLayout, DefaultVisibility, Fcheckbox, JsonataRenderer, OptionalEditRenderer, SelectDataRenderer, StandardHtmlComponents, ValueForFieldExtension, createAutocompleteRenderer, createButtonActionRenderer, createCheckListRenderer, createCheckboxRenderer, createClassStyledRenderers, createDefaultAdornmentRenderer, createDefaultArrayDataRenderer, createDefaultArrayRenderer, createDefaultDataRenderer, createDefaultDisplayRenderer, createDefaultGroupRenderer, createDefaultLabelRenderer, createDefaultLayoutRenderer, createDefaultRenderers, createDefaultVisibilityRenderer, createElementSelectedRenderer, createInputConversion, createJsonataRenderer, createNullToggleRenderer, createOptionalAdornment, createRadioRenderer, createSelectConversion, createSelectRenderer, createValueForFieldRenderer, createWizardRenderer, defaultTailwindTheme, getAccordionState, setIncluded };
|
|
1706
2401
|
//# sourceMappingURL=index.js.map
|