@react-typed-forms/schemas-html 3.1.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 -3
- package/lib/components/ControlInput.d.ts +9 -2
- package/lib/components/DefaultAccordion.d.ts +1 -1
- package/lib/components/DefaultArrayRenderer.d.ts +3 -0
- 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 +1 -1
- 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 +13 -11
- package/lib/index.cjs +949 -355
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +873 -309
- package/lib/index.js.map +1 -1
- package/lib/tailwind.d.ts +18 -4
- package/package.json +7 -6
package/lib/index.cjs
CHANGED
|
@@ -3,46 +3,25 @@ var schemas = require('@react-typed-forms/schemas');
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var core = require('@react-typed-forms/core');
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var base = require('@mui/base');
|
|
7
6
|
var ariaBase = require('@astroapps/aria-base');
|
|
7
|
+
var base = require('@mui/base');
|
|
8
8
|
var overlays = require('@react-stately/overlays');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
12
|
var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
|
|
13
13
|
|
|
14
|
-
function _extends() {
|
|
15
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
16
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
17
|
-
var t = arguments[e];
|
|
18
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
19
|
-
}
|
|
20
|
-
return n;
|
|
21
|
-
}, _extends.apply(null, arguments);
|
|
22
|
-
}
|
|
23
|
-
function _objectDestructuringEmpty(t) {
|
|
24
|
-
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
25
|
-
}
|
|
26
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
27
|
-
if (null == r) return {};
|
|
28
|
-
var t = {};
|
|
29
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
30
|
-
if (e.includes(n)) continue;
|
|
31
|
-
t[n] = r[n];
|
|
32
|
-
}
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var _excluded$4 = ["data", "display", "className", "style", "renderer"];
|
|
37
14
|
function createDefaultDisplayRenderer(options) {
|
|
38
15
|
if (options === void 0) {
|
|
39
16
|
options = {};
|
|
40
17
|
}
|
|
41
18
|
return {
|
|
42
19
|
render: function render(props, renderer) {
|
|
43
|
-
return /*#__PURE__*/jsxRuntime.jsx(DefaultDisplay,
|
|
20
|
+
return /*#__PURE__*/jsxRuntime.jsx(DefaultDisplay, {
|
|
21
|
+
options: options,
|
|
22
|
+
displayProps: props,
|
|
44
23
|
renderer: renderer
|
|
45
|
-
})
|
|
24
|
+
});
|
|
46
25
|
},
|
|
47
26
|
type: "display"
|
|
48
27
|
};
|
|
@@ -50,39 +29,45 @@ function createDefaultDisplayRenderer(options) {
|
|
|
50
29
|
function DefaultDisplay(_ref) {
|
|
51
30
|
var _effect = core.useComponentTracking();
|
|
52
31
|
try {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
var _iconDisplay$icon, _iconDisplay$icon2;
|
|
33
|
+
var renderer = _ref.renderer,
|
|
34
|
+
options = _ref.options,
|
|
35
|
+
displayProps = _ref.displayProps;
|
|
36
|
+
var data = displayProps.data,
|
|
37
|
+
display = displayProps.display,
|
|
38
|
+
className = displayProps.className,
|
|
39
|
+
textClass = displayProps.textClass,
|
|
40
|
+
style = displayProps.style;
|
|
59
41
|
var _renderer$html = renderer.html,
|
|
60
42
|
I = _renderer$html.I,
|
|
61
43
|
Div = _renderer$html.Div,
|
|
62
|
-
Span = _renderer$html.Span,
|
|
63
44
|
B = _renderer$html.B,
|
|
64
|
-
H1 = _renderer$html.H1
|
|
45
|
+
H1 = _renderer$html.H1,
|
|
46
|
+
Span = _renderer$html.Span;
|
|
65
47
|
switch (data.type) {
|
|
66
48
|
case schemas.DisplayDataType.Icon:
|
|
49
|
+
var iconDisplay = data;
|
|
67
50
|
return /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
68
51
|
style: style,
|
|
69
|
-
className: clsx__default["default"](schemas.getOverrideClass(className), display ? display.value :
|
|
52
|
+
className: clsx__default["default"](schemas.getOverrideClass(className), display ? display.value : iconDisplay.iconClass),
|
|
53
|
+
iconName: display ? display.value : (_iconDisplay$icon = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon.name,
|
|
54
|
+
iconLibrary: (_iconDisplay$icon2 = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon2.library
|
|
70
55
|
});
|
|
71
56
|
case schemas.DisplayDataType.Text:
|
|
57
|
+
var text = display ? schemas.coerceToString(display.value) : data.text;
|
|
72
58
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
73
59
|
style: style,
|
|
74
60
|
className: schemas.rendererClass(className, options.textClassName),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
textClass: schemas.rendererClass(textClass, options.textTextClass),
|
|
62
|
+
text: text,
|
|
63
|
+
inline: displayProps.inline
|
|
78
64
|
});
|
|
79
65
|
case schemas.DisplayDataType.Html:
|
|
80
66
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
81
67
|
style: style,
|
|
82
68
|
className: schemas.rendererClass(className, options.htmlClassName),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
69
|
+
inline: displayProps.inline,
|
|
70
|
+
html: display ? schemas.coerceToString(display.value) : data.html
|
|
86
71
|
});
|
|
87
72
|
case schemas.DisplayDataType.Custom:
|
|
88
73
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
@@ -100,8 +85,30 @@ function DefaultDisplay(_ref) {
|
|
|
100
85
|
}
|
|
101
86
|
}
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
function _extends() {
|
|
89
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
90
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
91
|
+
var t = arguments[e];
|
|
92
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
93
|
+
}
|
|
94
|
+
return n;
|
|
95
|
+
}, _extends.apply(null, arguments);
|
|
96
|
+
}
|
|
97
|
+
function _objectDestructuringEmpty(t) {
|
|
98
|
+
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
99
|
+
}
|
|
100
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
101
|
+
if (null == r) return {};
|
|
102
|
+
var t = {};
|
|
103
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
104
|
+
if (e.includes(n)) continue;
|
|
105
|
+
t[n] = r[n];
|
|
106
|
+
}
|
|
107
|
+
return t;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var _excluded$4 = ["control", "convert", "renderer"],
|
|
111
|
+
_excluded2$2 = ["errorText", "value", "onChange", "ref"];
|
|
105
112
|
function ControlInput(_ref) {
|
|
106
113
|
var _effect = core.useComponentTracking();
|
|
107
114
|
try {
|
|
@@ -111,12 +118,13 @@ function ControlInput(_ref) {
|
|
|
111
118
|
var control = _ref.control,
|
|
112
119
|
convert = _ref.convert,
|
|
113
120
|
renderer = _ref.renderer,
|
|
114
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
121
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
115
122
|
var _formControlProps = core.formControlProps(control),
|
|
116
123
|
errorText = _formControlProps.errorText,
|
|
117
124
|
value = _formControlProps.value,
|
|
118
125
|
onChange = _formControlProps.onChange,
|
|
119
|
-
|
|
126
|
+
ref = _formControlProps.ref,
|
|
127
|
+
inputProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$2);
|
|
120
128
|
var textValue = core.useControl(function () {
|
|
121
129
|
return toText(value);
|
|
122
130
|
});
|
|
@@ -127,11 +135,12 @@ function ControlInput(_ref) {
|
|
|
127
135
|
});
|
|
128
136
|
var Input = renderer.html.Input;
|
|
129
137
|
return /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, inputProps, {
|
|
138
|
+
inputRef: ref,
|
|
130
139
|
type: convert[0],
|
|
131
140
|
value: textValue.value,
|
|
132
|
-
|
|
133
|
-
textValue.value = e
|
|
134
|
-
var converted = convert[1](e
|
|
141
|
+
onChangeValue: function onChangeValue(e) {
|
|
142
|
+
textValue.value = e;
|
|
143
|
+
var converted = convert[1](e);
|
|
135
144
|
if (converted !== undefined) control.value = converted;
|
|
136
145
|
}
|
|
137
146
|
}, props));
|
|
@@ -196,7 +205,7 @@ function createInputConversion(ft) {
|
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
var _excluded$
|
|
208
|
+
var _excluded$3 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "readonly"];
|
|
200
209
|
function createSelectRenderer(options) {
|
|
201
210
|
if (options === void 0) {
|
|
202
211
|
options = {};
|
|
@@ -238,7 +247,7 @@ function SelectDataRenderer(_ref) {
|
|
|
238
247
|
_ref$requiredText = _ref.requiredText,
|
|
239
248
|
requiredText = _ref$requiredText === void 0 ? "<please select>" : _ref$requiredText,
|
|
240
249
|
readonly = _ref.readonly,
|
|
241
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
250
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
242
251
|
var value = state.value,
|
|
243
252
|
disabled = state.disabled;
|
|
244
253
|
var _useState = react.useState(!required || value == null),
|
|
@@ -296,8 +305,8 @@ function createSelectConversion(ft) {
|
|
|
296
305
|
}
|
|
297
306
|
}
|
|
298
307
|
|
|
299
|
-
var _excluded$
|
|
300
|
-
_excluded2 = ["value", "onChange", "errorText"];
|
|
308
|
+
var _excluded$2 = ["control", "type", "notValue", "renderer"],
|
|
309
|
+
_excluded2$1 = ["value", "onChange", "errorText", "ref"];
|
|
301
310
|
function createRadioRenderer(options) {
|
|
302
311
|
if (options === void 0) {
|
|
303
312
|
options = {};
|
|
@@ -312,7 +321,8 @@ function createRadioRenderer(options) {
|
|
|
312
321
|
return control.value == o.value;
|
|
313
322
|
},
|
|
314
323
|
setChecked: function setChecked(c, o) {
|
|
315
|
-
|
|
324
|
+
c.setTouched(true);
|
|
325
|
+
c.value = o.value;
|
|
316
326
|
},
|
|
317
327
|
control: p.control,
|
|
318
328
|
type: "radio",
|
|
@@ -338,6 +348,7 @@ function createCheckListRenderer(options) {
|
|
|
338
348
|
return Array.isArray(v) ? v.includes(o.value) : false;
|
|
339
349
|
},
|
|
340
350
|
setChecked: function setChecked(c, o, checked) {
|
|
351
|
+
c.setTouched(true);
|
|
341
352
|
c.setValue(function (x) {
|
|
342
353
|
return setIncluded(x != null ? x : [], o.value, checked);
|
|
343
354
|
});
|
|
@@ -402,8 +413,8 @@ function CheckButtons(_ref) {
|
|
|
402
413
|
readOnly: readonly,
|
|
403
414
|
disabled: disabled,
|
|
404
415
|
checked: checked,
|
|
405
|
-
|
|
406
|
-
!readonly && setChecked(control, o, x
|
|
416
|
+
onChangeChecked: function onChangeChecked(x) {
|
|
417
|
+
!readonly && setChecked(control, o, x);
|
|
407
418
|
}
|
|
408
419
|
}), /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
409
420
|
className: classes.labelClass,
|
|
@@ -451,7 +462,27 @@ function createCheckboxRenderer(options) {
|
|
|
451
462
|
renderType: schemas.DataRenderType.Checkbox
|
|
452
463
|
});
|
|
453
464
|
}
|
|
454
|
-
function
|
|
465
|
+
function createElementSelectedRenderer(options) {
|
|
466
|
+
if (options === void 0) {
|
|
467
|
+
options = {};
|
|
468
|
+
}
|
|
469
|
+
return schemas.createDataRenderer(function (props, renderer) {
|
|
470
|
+
return function (p) {
|
|
471
|
+
return _extends({}, p, {
|
|
472
|
+
label: undefined,
|
|
473
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CheckBoxSelected, {
|
|
474
|
+
p: p,
|
|
475
|
+
renderer: renderer,
|
|
476
|
+
options: options,
|
|
477
|
+
props: props
|
|
478
|
+
})
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
}, {
|
|
482
|
+
renderType: schemas.DataRenderType.ElementSelected
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
function CheckBoxSelected(_ref2) {
|
|
455
486
|
var _effect2 = core.useComponentTracking();
|
|
456
487
|
try {
|
|
457
488
|
var p = _ref2.p,
|
|
@@ -459,11 +490,32 @@ function CheckBox(_ref2) {
|
|
|
459
490
|
renderer = _ref2.renderer,
|
|
460
491
|
options = _ref2.options;
|
|
461
492
|
var Div = renderer.html.Div;
|
|
493
|
+
var elementValue = core.useControl();
|
|
494
|
+
react.useEffect(function () {
|
|
495
|
+
props.runExpression(elementValue, props.renderOptions.elementExpression, function (v) {
|
|
496
|
+
return elementValue.value = v;
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
var isSelected = core.useComputed(function () {
|
|
500
|
+
var _props$control$as$val, _props$control$as$val2;
|
|
501
|
+
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;
|
|
502
|
+
});
|
|
503
|
+
var selControl = core.useControl(function () {
|
|
504
|
+
return isSelected.current.value;
|
|
505
|
+
});
|
|
506
|
+
selControl.value = isSelected.value;
|
|
507
|
+
core.useControlEffect(function () {
|
|
508
|
+
return selControl.value;
|
|
509
|
+
}, function (v) {
|
|
510
|
+
props.control.as().setValue(function (x) {
|
|
511
|
+
return setIncluded(x != null ? x : [], elementValue.value, v);
|
|
512
|
+
});
|
|
513
|
+
});
|
|
462
514
|
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
463
515
|
className: schemas.rendererClass(props.className, options.entryClass),
|
|
464
516
|
children: [/*#__PURE__*/jsxRuntime.jsx(Fcheckbox, {
|
|
465
517
|
id: props.id,
|
|
466
|
-
control:
|
|
518
|
+
control: selControl,
|
|
467
519
|
style: props.style,
|
|
468
520
|
className: options.checkClass,
|
|
469
521
|
renderer: renderer
|
|
@@ -473,35 +525,58 @@ function CheckBox(_ref2) {
|
|
|
473
525
|
_effect2();
|
|
474
526
|
}
|
|
475
527
|
}
|
|
476
|
-
function
|
|
528
|
+
function CheckBox(_ref3) {
|
|
477
529
|
var _effect3 = core.useComponentTracking();
|
|
478
530
|
try {
|
|
479
|
-
var
|
|
480
|
-
|
|
481
|
-
type = _ref3$type === void 0 ? "checkbox" : _ref3$type,
|
|
482
|
-
_ref3$notValue = _ref3.notValue,
|
|
483
|
-
notValue = _ref3$notValue === void 0 ? false : _ref3$notValue,
|
|
531
|
+
var p = _ref3.p,
|
|
532
|
+
props = _ref3.props,
|
|
484
533
|
renderer = _ref3.renderer,
|
|
485
|
-
|
|
534
|
+
options = _ref3.options;
|
|
535
|
+
var Div = renderer.html.Div;
|
|
536
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
537
|
+
className: schemas.rendererClass(props.className, options.entryClass),
|
|
538
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Fcheckbox, {
|
|
539
|
+
id: props.id,
|
|
540
|
+
control: props.control.as(),
|
|
541
|
+
style: props.style,
|
|
542
|
+
className: options.checkClass,
|
|
543
|
+
renderer: renderer
|
|
544
|
+
}), p.label && renderer.renderLabel(p.label, undefined, undefined)]
|
|
545
|
+
});
|
|
546
|
+
} finally {
|
|
547
|
+
_effect3();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function Fcheckbox(_ref4) {
|
|
551
|
+
var _effect4 = core.useComponentTracking();
|
|
552
|
+
try {
|
|
553
|
+
var control = _ref4.control,
|
|
554
|
+
_ref4$type = _ref4.type,
|
|
555
|
+
type = _ref4$type === void 0 ? "checkbox" : _ref4$type,
|
|
556
|
+
_ref4$notValue = _ref4.notValue,
|
|
557
|
+
notValue = _ref4$notValue === void 0 ? false : _ref4$notValue,
|
|
558
|
+
renderer = _ref4.renderer,
|
|
559
|
+
others = _objectWithoutPropertiesLoose(_ref4, _excluded$2);
|
|
486
560
|
var Input = renderer.html.Input;
|
|
487
561
|
var _formControlProps = core.formControlProps(control),
|
|
488
562
|
value = _formControlProps.value,
|
|
489
563
|
onChange = _formControlProps.onChange,
|
|
490
564
|
errorText = _formControlProps.errorText,
|
|
491
|
-
|
|
565
|
+
ref = _formControlProps.ref,
|
|
566
|
+
theseProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$1);
|
|
492
567
|
return /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, theseProps, {
|
|
493
568
|
checked: !!value !== notValue,
|
|
494
|
-
|
|
569
|
+
inputRef: function inputRef(r) {
|
|
495
570
|
return control.element = r;
|
|
496
571
|
},
|
|
497
|
-
|
|
572
|
+
onChangeChecked: function onChangeChecked(e) {
|
|
498
573
|
control.touched = true;
|
|
499
|
-
control.value = e
|
|
574
|
+
control.value = e !== notValue;
|
|
500
575
|
},
|
|
501
576
|
type: type
|
|
502
577
|
}, others));
|
|
503
578
|
} finally {
|
|
504
|
-
|
|
579
|
+
_effect4();
|
|
505
580
|
}
|
|
506
581
|
}
|
|
507
582
|
|
|
@@ -517,6 +592,7 @@ function createDefaultLayoutRenderer(options) {
|
|
|
517
592
|
}, options, {
|
|
518
593
|
renderer: renderers
|
|
519
594
|
}))),
|
|
595
|
+
inline: layout.inline,
|
|
520
596
|
className: schemas.rendererClass(layout.className, options.className),
|
|
521
597
|
style: layout.style,
|
|
522
598
|
divRef: function divRef(e) {
|
|
@@ -529,17 +605,15 @@ function DefaultLayout(_ref) {
|
|
|
529
605
|
var _effect = core.useComponentTracking();
|
|
530
606
|
try {
|
|
531
607
|
var errorClass = _ref.errorClass,
|
|
532
|
-
_ref$renderer = _ref.renderer,
|
|
533
|
-
_ref$renderer$html = _ref$renderer.html,
|
|
608
|
+
_ref$renderer$html = _ref.renderer.html,
|
|
534
609
|
Div = _ref$renderer$html.Div,
|
|
535
610
|
Span = _ref$renderer$html.Span,
|
|
536
|
-
renderText = _ref$renderer.renderText,
|
|
537
611
|
_ref$renderError = _ref.renderError,
|
|
538
612
|
renderError = _ref$renderError === void 0 ? function (e) {
|
|
539
613
|
return e && /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
540
614
|
children: /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
541
615
|
className: errorClass,
|
|
542
|
-
children:
|
|
616
|
+
children: e
|
|
543
617
|
})
|
|
544
618
|
});
|
|
545
619
|
} : _ref$renderError,
|
|
@@ -563,24 +637,22 @@ function DefaultDisplayOnly(_ref) {
|
|
|
563
637
|
var _effect = core.useComponentTracking();
|
|
564
638
|
try {
|
|
565
639
|
var _ref2;
|
|
566
|
-
var
|
|
640
|
+
var dataNode = _ref.dataNode,
|
|
567
641
|
className = _ref.className,
|
|
568
642
|
emptyText = _ref.emptyText,
|
|
569
643
|
schemaInterface = _ref.schemaInterface,
|
|
570
|
-
field = _ref.field,
|
|
571
644
|
style = _ref.style,
|
|
572
|
-
renderer = _ref.renderer
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
var
|
|
576
|
-
|
|
577
|
-
Span = _renderer$html.Span;
|
|
645
|
+
renderer = _ref.renderer,
|
|
646
|
+
textClass = _ref.textClass,
|
|
647
|
+
inline = _ref.inline;
|
|
648
|
+
var text = (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
|
|
649
|
+
var Div = renderer.html.Div;
|
|
578
650
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
579
651
|
style: style,
|
|
580
652
|
className: className,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
653
|
+
textClass: textClass,
|
|
654
|
+
text: text,
|
|
655
|
+
inline: inline
|
|
584
656
|
});
|
|
585
657
|
} finally {
|
|
586
658
|
_effect();
|
|
@@ -596,10 +668,8 @@ function DefaultAccordion(_ref) {
|
|
|
596
668
|
contentStyle = _ref.contentStyle,
|
|
597
669
|
contentClassName = _ref.contentClassName,
|
|
598
670
|
designMode = _ref.designMode,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
iconClosedName = _ref.iconClosedName,
|
|
602
|
-
iconClosedClass = _ref.iconClosedClass,
|
|
671
|
+
iconOpen = _ref.iconOpen,
|
|
672
|
+
iconClosed = _ref.iconClosed,
|
|
603
673
|
className = _ref.className,
|
|
604
674
|
_ref$renderTitle = _ref.renderTitle,
|
|
605
675
|
renderTitle = _ref$renderTitle === void 0 ? function (t) {
|
|
@@ -625,6 +695,7 @@ function DefaultAccordion(_ref) {
|
|
|
625
695
|
display: "none"
|
|
626
696
|
});
|
|
627
697
|
var title = renderers.renderLabelText(renderTitle(accordion.title, open));
|
|
698
|
+
var currentIcon = isOpen ? iconOpen : iconClosed;
|
|
628
699
|
var toggler = renderToggler ? renderToggler(open, title) : /*#__PURE__*/jsxRuntime.jsxs(Button, {
|
|
629
700
|
className: className,
|
|
630
701
|
onClick: function onClick() {
|
|
@@ -635,9 +706,9 @@ function DefaultAccordion(_ref) {
|
|
|
635
706
|
children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
636
707
|
className: titleClass,
|
|
637
708
|
children: title
|
|
638
|
-
}), /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
639
|
-
|
|
640
|
-
|
|
709
|
+
}), currentIcon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
710
|
+
iconLibrary: currentIcon.library,
|
|
711
|
+
iconName: currentIcon.name
|
|
641
712
|
})]
|
|
642
713
|
});
|
|
643
714
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -655,23 +726,66 @@ function getAccordionState(c) {
|
|
|
655
726
|
return c.meta.accordionState;
|
|
656
727
|
}
|
|
657
728
|
|
|
729
|
+
/**
|
|
730
|
+
* @trackControls
|
|
731
|
+
*/
|
|
732
|
+
function VisibleChildrenRenderer(props) {
|
|
733
|
+
var _effect = core.useComponentTracking();
|
|
734
|
+
try {
|
|
735
|
+
var childStates = props.parentFormNode.getChildNodes().map(function (x) {
|
|
736
|
+
return props.parent.getChildState(x);
|
|
737
|
+
});
|
|
738
|
+
return props.render(props.props, function (i) {
|
|
739
|
+
return !childStates[i].hidden;
|
|
740
|
+
});
|
|
741
|
+
} finally {
|
|
742
|
+
_effect();
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
658
746
|
function createTabsRenderer(options) {
|
|
659
747
|
if (options === void 0) {
|
|
660
748
|
options = {};
|
|
661
749
|
}
|
|
662
750
|
return schemas.createGroupRenderer(function (p, renderer) {
|
|
663
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
751
|
+
return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
|
|
752
|
+
render: renderAllTabs,
|
|
753
|
+
dataContext: p.dataContext,
|
|
754
|
+
parentFormNode: p.formNode,
|
|
755
|
+
parent: p,
|
|
756
|
+
props: {
|
|
757
|
+
groupProps: p,
|
|
758
|
+
tabOptions: p.renderOptions,
|
|
759
|
+
options: options
|
|
760
|
+
}
|
|
761
|
+
});
|
|
667
762
|
}, {
|
|
668
763
|
renderType: schemas.GroupRenderType.Tabs
|
|
669
764
|
});
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
765
|
+
function renderAllTabs(_ref, isVisible) {
|
|
766
|
+
var options = _ref.options,
|
|
767
|
+
_ref$groupProps = _ref.groupProps,
|
|
768
|
+
designMode = _ref$groupProps.designMode,
|
|
769
|
+
formNode = _ref$groupProps.formNode,
|
|
770
|
+
className = _ref$groupProps.className,
|
|
771
|
+
renderChild = _ref$groupProps.renderChild,
|
|
772
|
+
tabOptions = _ref.tabOptions;
|
|
773
|
+
var tabIndex = core.useControl(0);
|
|
774
|
+
var tabClass = options.tabClass,
|
|
775
|
+
labelClass = options.labelClass,
|
|
776
|
+
tabListClass = options.tabListClass,
|
|
777
|
+
inactiveClass = options.inactiveClass,
|
|
778
|
+
activeClass = options.activeClass,
|
|
779
|
+
contentClass = options.contentClass;
|
|
780
|
+
var currentTab = tabIndex.value;
|
|
781
|
+
return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
782
|
+
children: formNode.getChildNodes().map(function (x, i) {
|
|
783
|
+
return renderTabs([x], i);
|
|
784
|
+
})
|
|
785
|
+
}) : renderTabs(formNode.getChildNodes().filter(function (x, i) {
|
|
786
|
+
return isVisible(i);
|
|
787
|
+
}), 0);
|
|
788
|
+
function renderTabs(tabs, key) {
|
|
675
789
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
676
790
|
className: schemas.rendererClass(className, options.className),
|
|
677
791
|
children: [/*#__PURE__*/jsxRuntime.jsx("ul", {
|
|
@@ -693,54 +807,309 @@ function TabsGroupRenderer(_ref) {
|
|
|
693
807
|
children: renderChild(currentTab, tabs[currentTab])
|
|
694
808
|
})]
|
|
695
809
|
}, key);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function createGridRenderer(options) {
|
|
815
|
+
return schemas.createGroupRenderer(function (props, formRenderer) {
|
|
816
|
+
return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
|
|
817
|
+
props: _extends({}, props, {
|
|
818
|
+
formRenderer: formRenderer,
|
|
819
|
+
defaultOptions: options
|
|
820
|
+
}),
|
|
821
|
+
render: renderGrid,
|
|
822
|
+
parent: props,
|
|
823
|
+
dataContext: props.dataContext,
|
|
824
|
+
parentFormNode: props.formNode
|
|
825
|
+
});
|
|
826
|
+
}, {
|
|
827
|
+
renderType: schemas.GroupRenderType.Grid
|
|
828
|
+
});
|
|
829
|
+
function renderGrid(props, isChildVisible) {
|
|
830
|
+
var _props$defaultOptions, _ref, _gridOptions$columns;
|
|
831
|
+
var filteredChildren = props.formNode.getChildNodes().filter(function (x, i) {
|
|
832
|
+
return isChildVisible(i);
|
|
833
|
+
});
|
|
834
|
+
var Div = props.formRenderer.html.Div;
|
|
835
|
+
var defaults = (_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {};
|
|
836
|
+
var gridOptions = props.renderOptions;
|
|
837
|
+
var numColumns = (_ref = (_gridOptions$columns = gridOptions.columns) != null ? _gridOptions$columns : defaults.defaultColumns) != null ? _ref : 2;
|
|
838
|
+
var allChildren = filteredChildren.map(function (x, i) {
|
|
839
|
+
return props.renderChild(i, x);
|
|
840
|
+
});
|
|
841
|
+
// split into numColumns items wrapped a div each
|
|
842
|
+
var rows = [];
|
|
843
|
+
for (var i = 0; i < allChildren.length; i += numColumns) {
|
|
844
|
+
rows.push(allChildren.slice(i, i + numColumns));
|
|
845
|
+
}
|
|
846
|
+
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
847
|
+
className: schemas.rendererClass(props.className, defaults.className),
|
|
848
|
+
children: rows.map(function (row, rowIndex) {
|
|
849
|
+
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
850
|
+
className: schemas.rendererClass(gridOptions.rowClass, defaults.rowClass),
|
|
851
|
+
children: row
|
|
852
|
+
}, rowIndex);
|
|
853
|
+
})
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
var defaultOptions = {
|
|
859
|
+
classes: {
|
|
860
|
+
className: undefined,
|
|
861
|
+
contentClass: "min-h-96 overflow-auto",
|
|
862
|
+
navContainerClass: "flex justify-between gap-4 my-2"
|
|
863
|
+
},
|
|
864
|
+
actions: {
|
|
865
|
+
nextText: "Next",
|
|
866
|
+
nextIcon: schemas.fontAwesomeIcon("chevron-right"),
|
|
867
|
+
nextValidate: true,
|
|
868
|
+
prevText: "Prev",
|
|
869
|
+
prevIcon: schemas.fontAwesomeIcon("chevron-left"),
|
|
870
|
+
prevValidate: false
|
|
871
|
+
},
|
|
872
|
+
renderNavigation: defaultNavigationRender
|
|
873
|
+
};
|
|
874
|
+
function defaultNavigationRender(_ref) {
|
|
875
|
+
var formRenderer = _ref.formRenderer,
|
|
876
|
+
prev = _ref.prev,
|
|
877
|
+
next = _ref.next,
|
|
878
|
+
className = _ref.className;
|
|
879
|
+
{
|
|
880
|
+
var Div = formRenderer.html.Div,
|
|
881
|
+
renderAction = formRenderer.renderAction;
|
|
882
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
883
|
+
className: className,
|
|
884
|
+
children: [renderAction(prev), renderAction(next)]
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
function createWizardRenderer(options) {
|
|
889
|
+
return schemas.createGroupRenderer(function (props, formRenderer) {
|
|
890
|
+
return /*#__PURE__*/jsxRuntime.jsx(VisibleChildrenRenderer, {
|
|
891
|
+
props: _extends({}, props, {
|
|
892
|
+
formRenderer: formRenderer,
|
|
893
|
+
defaultOptions: options
|
|
894
|
+
}),
|
|
895
|
+
render: renderWizard,
|
|
896
|
+
parent: props,
|
|
897
|
+
dataContext: props.dataContext,
|
|
898
|
+
parentFormNode: props.formNode
|
|
899
|
+
});
|
|
900
|
+
}, {
|
|
901
|
+
renderType: schemas.GroupRenderType.Wizard
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
function renderWizard(props, isChildVisible) {
|
|
905
|
+
var _props$defaultOptions;
|
|
906
|
+
var mergedOptions = schemas.deepMerge((_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {}, defaultOptions);
|
|
907
|
+
var _mergedOptions$classe = mergedOptions.classes,
|
|
908
|
+
className = _mergedOptions$classe.className,
|
|
909
|
+
contentClass = _mergedOptions$classe.contentClass,
|
|
910
|
+
navContainerClass = _mergedOptions$classe.navContainerClass,
|
|
911
|
+
_mergedOptions$action = mergedOptions.actions,
|
|
912
|
+
nextText = _mergedOptions$action.nextText,
|
|
913
|
+
nextIcon = _mergedOptions$action.nextIcon,
|
|
914
|
+
prevText = _mergedOptions$action.prevText,
|
|
915
|
+
prevIcon = _mergedOptions$action.prevIcon,
|
|
916
|
+
nextValidate = _mergedOptions$action.nextValidate,
|
|
917
|
+
prevValidate = _mergedOptions$action.prevValidate,
|
|
918
|
+
renderNavigation = mergedOptions.renderNavigation;
|
|
919
|
+
var Div = props.formRenderer.html.Div;
|
|
920
|
+
var children = props.formNode.getChildNodes();
|
|
921
|
+
var allVisible = children.map(function (_, i) {
|
|
922
|
+
return isChildVisible(i);
|
|
923
|
+
});
|
|
924
|
+
var page = core.useControl(0);
|
|
925
|
+
var currentPage = page.value;
|
|
926
|
+
var isValid = core.useComputed(function () {
|
|
927
|
+
return isPageValid();
|
|
928
|
+
});
|
|
929
|
+
var next = schemas.createAction("nav", function () {
|
|
930
|
+
return nav(1, nextValidate);
|
|
931
|
+
}, nextText, {
|
|
932
|
+
hidden: !props.designMode && nextVisibleInDirection(1) == null,
|
|
933
|
+
disabled: !isValid.value,
|
|
934
|
+
icon: nextIcon,
|
|
935
|
+
iconPlacement: schemas.IconPlacement.AfterText
|
|
936
|
+
});
|
|
937
|
+
var prev = schemas.createAction("nav", function () {
|
|
938
|
+
return nav(-1, prevValidate);
|
|
939
|
+
}, prevText, {
|
|
940
|
+
disabled: !props.designMode && nextVisibleInDirection(-1) == null,
|
|
941
|
+
icon: prevIcon
|
|
942
|
+
});
|
|
943
|
+
var navElement = renderNavigation({
|
|
944
|
+
formRenderer: props.formRenderer,
|
|
945
|
+
page: countVisibleUntil(currentPage),
|
|
946
|
+
totalPages: countVisibleUntil(children.length),
|
|
947
|
+
prev: prev,
|
|
948
|
+
next: next,
|
|
949
|
+
className: navContainerClass,
|
|
950
|
+
validatePage: function () {
|
|
951
|
+
try {
|
|
952
|
+
return Promise.resolve(_validatePage());
|
|
953
|
+
} catch (e) {
|
|
954
|
+
return Promise.reject(e);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
var content = props.designMode ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
959
|
+
children: children.map(function (child, i) {
|
|
960
|
+
return props.renderChild(i, child);
|
|
961
|
+
})
|
|
962
|
+
}) : currentPage < children.length ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
963
|
+
className: contentClass,
|
|
964
|
+
children: props.renderChild(currentPage, children[currentPage])
|
|
965
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {});
|
|
966
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
967
|
+
className: schemas.rendererClass(props.className, className),
|
|
968
|
+
children: [content, navElement]
|
|
969
|
+
});
|
|
970
|
+
function countVisibleUntil(untilPage) {
|
|
971
|
+
var count = 0;
|
|
972
|
+
for (var i = 0; i < untilPage && i < allVisible.length; i++) {
|
|
973
|
+
if (allVisible[i]) {
|
|
974
|
+
count++;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
return count;
|
|
978
|
+
}
|
|
979
|
+
function nav(dir, validate) {
|
|
980
|
+
if (validate && !_validatePage()) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
var next = nextVisibleInDirection(dir);
|
|
984
|
+
if (next != null) {
|
|
985
|
+
page.value = next;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
function nextVisibleInDirection(dir) {
|
|
989
|
+
var next = currentPage + dir;
|
|
990
|
+
while (next >= 0 && next < children.length) {
|
|
991
|
+
if (allVisible[next]) {
|
|
992
|
+
return next;
|
|
993
|
+
}
|
|
994
|
+
next += dir;
|
|
995
|
+
}
|
|
996
|
+
return null;
|
|
997
|
+
}
|
|
998
|
+
function _validatePage() {
|
|
999
|
+
var pageNode = children[currentPage];
|
|
1000
|
+
var hasErrors = false;
|
|
1001
|
+
schemas.visitFormDataInContext(props.dataContext.parentNode, pageNode, schemas.validationVisitor(function () {
|
|
1002
|
+
hasErrors = true;
|
|
1003
|
+
}));
|
|
1004
|
+
return !hasErrors;
|
|
1005
|
+
}
|
|
1006
|
+
function isPageValid() {
|
|
1007
|
+
var pageNode = children[currentPage];
|
|
1008
|
+
var hasErrors = false;
|
|
1009
|
+
schemas.visitFormDataInContext(props.dataContext.parentNode, pageNode, function (c) {
|
|
1010
|
+
if (!c.control.valid) hasErrors = true;
|
|
1011
|
+
});
|
|
1012
|
+
return !hasErrors;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
var defaultDialogOptions = {
|
|
1017
|
+
classes: {
|
|
1018
|
+
className: "",
|
|
1019
|
+
titleClass: "text-2xl font-bold"
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
function createDialogRenderer(options) {
|
|
1023
|
+
return schemas.createGroupRenderer(function (props, renderer) {
|
|
1024
|
+
return /*#__PURE__*/jsxRuntime.jsx(DefaultDialogRenderer, {
|
|
1025
|
+
props: props,
|
|
1026
|
+
options: options,
|
|
1027
|
+
renderer: renderer,
|
|
1028
|
+
renderOptions: props.renderOptions
|
|
1029
|
+
});
|
|
1030
|
+
}, {
|
|
1031
|
+
renderType: schemas.GroupRenderType.Dialog
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
function DefaultDialogRenderer(_ref) {
|
|
1035
|
+
var _effect = core.useComponentTracking();
|
|
1036
|
+
try {
|
|
1037
|
+
var designContent = function designContent() {
|
|
1038
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1039
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1040
|
+
onClickCapture: function onClickCapture() {
|
|
1041
|
+
return overlayState.toggle();
|
|
1042
|
+
},
|
|
1043
|
+
children: renderer.renderAction(schemas.createAction("Toggle Dialog", function () {}, open.value ? "Hide Content" : "Show Content", {
|
|
1044
|
+
actionStyle: schemas.ActionStyle.Link
|
|
1045
|
+
}))
|
|
1046
|
+
}), open.value && dialogContent]
|
|
1047
|
+
});
|
|
696
1048
|
};
|
|
697
|
-
var
|
|
698
|
-
|
|
1049
|
+
var props = _ref.props,
|
|
1050
|
+
renderOptions = _ref.renderOptions,
|
|
699
1051
|
options = _ref.options,
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1052
|
+
renderer = _ref.renderer;
|
|
1053
|
+
var _deepMerge = schemas.deepMerge(options, defaultDialogOptions),
|
|
1054
|
+
_deepMerge$classes = _deepMerge.classes,
|
|
1055
|
+
titleClass = _deepMerge$classes.titleClass,
|
|
1056
|
+
className = _deepMerge$classes.className;
|
|
1057
|
+
var open = core.useControl(false);
|
|
1058
|
+
var overlayState = ariaBase.createOverlayState(open);
|
|
1059
|
+
var actionOnClick = function actionOnClick(action) {
|
|
1060
|
+
switch (action) {
|
|
1061
|
+
case "closeDialog":
|
|
1062
|
+
return function () {
|
|
1063
|
+
return overlayState.close();
|
|
1064
|
+
};
|
|
1065
|
+
case "openDialog":
|
|
1066
|
+
return function () {
|
|
1067
|
+
return overlayState.open();
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
var triggerChildren = props.formNode.getChildNodes().filter(function (x) {
|
|
1072
|
+
return x.definition.placement === "trigger";
|
|
1073
|
+
});
|
|
1074
|
+
var dialogContent = /*#__PURE__*/jsxRuntime.jsx(ariaBase.Dialog, {
|
|
1075
|
+
title: renderOptions.title,
|
|
1076
|
+
titleClass: titleClass,
|
|
1077
|
+
className: schemas.rendererClass(props.className, className),
|
|
1078
|
+
children: props.formNode.getChildNodes().filter(function (x) {
|
|
1079
|
+
return !x.definition.placement || x.definition.placement === "dialog";
|
|
1080
|
+
}).map(function (x, i) {
|
|
1081
|
+
return props.renderChild(i, x, {
|
|
1082
|
+
actionOnClick: actionOnClick
|
|
1083
|
+
});
|
|
714
1084
|
})
|
|
715
|
-
})
|
|
1085
|
+
});
|
|
1086
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1087
|
+
children: [triggerChildren.map(function (x, i) {
|
|
1088
|
+
return props.renderChild(i, x, {
|
|
1089
|
+
actionOnClick: actionOnClick
|
|
1090
|
+
});
|
|
1091
|
+
}), props.designMode ? designContent() : open.value && /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
|
|
1092
|
+
state: overlayState,
|
|
1093
|
+
isDismissable: true,
|
|
1094
|
+
children: dialogContent
|
|
1095
|
+
})]
|
|
1096
|
+
});
|
|
716
1097
|
} finally {
|
|
717
1098
|
_effect();
|
|
718
1099
|
}
|
|
719
1100
|
}
|
|
720
1101
|
|
|
721
1102
|
function createDefaultGroupRenderer(options) {
|
|
1103
|
+
var gridRenderer = createGridRenderer(options == null ? void 0 : options.grid);
|
|
722
1104
|
var tabsRenderer = createTabsRenderer(options == null ? void 0 : options.tabs);
|
|
1105
|
+
var wizardRenderer = createWizardRenderer(options == null ? void 0 : options.wizard);
|
|
1106
|
+
var dialogRenderer = createDialogRenderer(options == null ? void 0 : options.dialog);
|
|
723
1107
|
var _ref = options != null ? options : {},
|
|
724
1108
|
className = _ref.className,
|
|
725
|
-
_ref$gridStyles = _ref.gridStyles,
|
|
726
|
-
gridStyles = _ref$gridStyles === void 0 ? defaultGridStyles : _ref$gridStyles,
|
|
727
|
-
_ref$defaultGridColum = _ref.defaultGridColumns,
|
|
728
|
-
defaultGridColumns = _ref$defaultGridColum === void 0 ? 2 : _ref$defaultGridColum,
|
|
729
|
-
gridClassName = _ref.gridClassName,
|
|
730
1109
|
standardClassName = _ref.standardClassName,
|
|
731
1110
|
flexClassName = _ref.flexClassName,
|
|
1111
|
+
inlineClass = _ref.inlineClass,
|
|
732
1112
|
defaultFlexGap = _ref.defaultFlexGap;
|
|
733
|
-
function defaultGridStyles(_ref2) {
|
|
734
|
-
var _ref2$columns = _ref2.columns,
|
|
735
|
-
columns = _ref2$columns === void 0 ? defaultGridColumns : _ref2$columns;
|
|
736
|
-
return {
|
|
737
|
-
className: gridClassName,
|
|
738
|
-
style: {
|
|
739
|
-
display: "grid",
|
|
740
|
-
gridTemplateColumns: "repeat(" + columns + ", 1fr)"
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
1113
|
function flexStyles(options) {
|
|
745
1114
|
return {
|
|
746
1115
|
className: flexClassName,
|
|
@@ -756,47 +1125,70 @@ function createDefaultGroupRenderer(options) {
|
|
|
756
1125
|
renderOptions = props.renderOptions,
|
|
757
1126
|
formNode = props.formNode;
|
|
758
1127
|
if (schemas.isTabsRenderer(renderOptions)) return tabsRenderer.render(props, renderer);
|
|
1128
|
+
if (schemas.isGridRenderer(renderOptions)) return gridRenderer.render(props, renderer);
|
|
1129
|
+
if (schemas.isWizardRenderer(renderOptions)) return wizardRenderer.render(props, renderer);
|
|
1130
|
+
if (schemas.isDialogRenderer(renderOptions)) return dialogRenderer.render(props, renderer);
|
|
759
1131
|
if (schemas.isSelectChildRenderer(renderOptions) && !props.designMode) {
|
|
760
1132
|
return /*#__PURE__*/jsxRuntime.jsx(SelectChildGroupRenderer, _extends({}, props, {
|
|
761
1133
|
renderOptions: renderOptions
|
|
762
1134
|
}));
|
|
763
1135
|
}
|
|
764
|
-
var
|
|
1136
|
+
var _ref2 = schemas.isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : schemas.isInlineRenderer(renderOptions) ? {
|
|
1137
|
+
className: inlineClass
|
|
1138
|
+
} : {
|
|
765
1139
|
className: standardClassName
|
|
766
1140
|
},
|
|
767
|
-
style =
|
|
768
|
-
gcn =
|
|
1141
|
+
style = _ref2.style,
|
|
1142
|
+
gcn = _ref2.className;
|
|
769
1143
|
var Div = renderer.html.Div;
|
|
1144
|
+
var inline = renderOptions.type == schemas.GroupRenderType.Inline;
|
|
1145
|
+
var children = formNode.getChildNodes().map(function (c, i) {
|
|
1146
|
+
return renderChild(i, c, {
|
|
1147
|
+
inline: inline
|
|
1148
|
+
});
|
|
1149
|
+
});
|
|
770
1150
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
771
1151
|
className: schemas.rendererClass(props.className, clsx__default["default"](className, gcn)),
|
|
1152
|
+
textClass: props.textClass,
|
|
772
1153
|
style: style,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
})
|
|
1154
|
+
inline: inline,
|
|
1155
|
+
children: children
|
|
776
1156
|
});
|
|
777
1157
|
}
|
|
1158
|
+
function renderLayout(props, renderer) {
|
|
1159
|
+
if (props.renderOptions.type === schemas.GroupRenderType.Contents) {
|
|
1160
|
+
var formNode = props.formNode,
|
|
1161
|
+
renderChild = props.renderChild;
|
|
1162
|
+
var children = formNode.getChildNodes().map(function (c, i) {
|
|
1163
|
+
return renderChild(i, c);
|
|
1164
|
+
});
|
|
1165
|
+
return function (layout) {
|
|
1166
|
+
return _extends({}, layout, {
|
|
1167
|
+
inline: true,
|
|
1168
|
+
children: children
|
|
1169
|
+
});
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
return render(props, renderer);
|
|
1173
|
+
}
|
|
778
1174
|
return {
|
|
779
1175
|
type: "group",
|
|
780
|
-
render:
|
|
1176
|
+
render: renderLayout
|
|
781
1177
|
};
|
|
782
1178
|
}
|
|
783
1179
|
function SelectChildGroupRenderer(props) {
|
|
784
1180
|
var _effect = core.useComponentTracking();
|
|
785
1181
|
try {
|
|
786
|
-
var
|
|
1182
|
+
var runExpression = props.runExpression,
|
|
787
1183
|
renderOptions = props.renderOptions;
|
|
788
|
-
var
|
|
789
|
-
return x == "string" ? parseInt(x) : x;
|
|
1184
|
+
var ctrl = schemas.useExpression(undefined, runExpression, renderOptions == null ? void 0 : renderOptions.childIndexExpression, function (x) {
|
|
1185
|
+
return typeof x == "string" ? parseInt(x) : x;
|
|
1186
|
+
});
|
|
1187
|
+
var childIndex = ctrl == null ? void 0 : ctrl.value;
|
|
1188
|
+
var childDefinitions = props.formNode.getChildNodes();
|
|
1189
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1190
|
+
children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && props.renderChild(childIndex, childDefinitions[childIndex])
|
|
790
1191
|
});
|
|
791
|
-
var Render = core.useTrackedComponent(function (p) {
|
|
792
|
-
var ctrl = dynHook.runHook(p.dataContext, dynHook.state);
|
|
793
|
-
var childIndex = ctrl == null ? void 0 : ctrl.value;
|
|
794
|
-
var childDefinitions = p.formNode.getChildNodes();
|
|
795
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
796
|
-
children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && p.renderChild(childIndex, childDefinitions[childIndex])
|
|
797
|
-
});
|
|
798
|
-
}, [dynHook.deps]);
|
|
799
|
-
return /*#__PURE__*/jsxRuntime.jsx(Render, _extends({}, props));
|
|
800
1192
|
} finally {
|
|
801
1193
|
_effect();
|
|
802
1194
|
}
|
|
@@ -817,7 +1209,8 @@ function DefaultVisibility(_ref) {
|
|
|
817
1209
|
className = _ref.className,
|
|
818
1210
|
style = _ref.style,
|
|
819
1211
|
divRef = _ref.divRef,
|
|
820
|
-
renderer = _ref.renderer
|
|
1212
|
+
renderer = _ref.renderer,
|
|
1213
|
+
inline = _ref.inline;
|
|
821
1214
|
var v = visibility.value;
|
|
822
1215
|
react.useEffect(function () {
|
|
823
1216
|
if (v) {
|
|
@@ -830,10 +1223,11 @@ function DefaultVisibility(_ref) {
|
|
|
830
1223
|
}
|
|
831
1224
|
}, [v == null ? void 0 : v.visible]);
|
|
832
1225
|
var Div = renderer.html.Div;
|
|
1226
|
+
if (inline) return v != null && v.visible ? children : undefined;
|
|
833
1227
|
return v != null && v.visible ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
834
1228
|
className: className,
|
|
835
1229
|
style: style,
|
|
836
|
-
|
|
1230
|
+
nativeRef: divRef,
|
|
837
1231
|
children: children
|
|
838
1232
|
}) : /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
839
1233
|
} finally {
|
|
@@ -849,7 +1243,8 @@ function createJsonataRenderer(className) {
|
|
|
849
1243
|
dataNode: p.dataNode,
|
|
850
1244
|
dataContext: p.dataContext,
|
|
851
1245
|
control: p.control,
|
|
852
|
-
readonly: p.readonly
|
|
1246
|
+
readonly: p.readonly,
|
|
1247
|
+
runExpression: p.runExpression
|
|
853
1248
|
});
|
|
854
1249
|
}, {
|
|
855
1250
|
renderType: schemas.DataRenderType.Jsonata
|
|
@@ -863,18 +1258,21 @@ function JsonataRenderer(_ref) {
|
|
|
863
1258
|
readonly = _ref.readonly,
|
|
864
1259
|
className = _ref.className,
|
|
865
1260
|
dataContext = _ref.dataContext,
|
|
866
|
-
dataNode = _ref.dataNode
|
|
1261
|
+
dataNode = _ref.dataNode,
|
|
1262
|
+
runExpression = _ref.runExpression;
|
|
867
1263
|
var sdn = dataNode.elementIndex != null ? dataNode : dataContext.parentNode;
|
|
868
1264
|
var bindings = core.useComputed(function () {
|
|
869
|
-
return {
|
|
1265
|
+
return _extends({}, dataContext.variables, {
|
|
870
1266
|
value: control.value,
|
|
871
1267
|
readonly: readonly,
|
|
872
1268
|
disabled: control.disabled,
|
|
873
|
-
formData: dataContext.formData,
|
|
874
1269
|
dataPath: schemas.getJsonPath(dataNode)
|
|
875
|
-
};
|
|
1270
|
+
});
|
|
876
1271
|
});
|
|
877
|
-
var rendered = schemas.
|
|
1272
|
+
var rendered = schemas.useExpression("", runExpression, {
|
|
1273
|
+
type: schemas.ExpressionType.Jsonata,
|
|
1274
|
+
expression: renderOptions.expression
|
|
1275
|
+
}, schemas.coerceToString, bindings);
|
|
878
1276
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
879
1277
|
className: className,
|
|
880
1278
|
dangerouslySetInnerHTML: {
|
|
@@ -886,12 +1284,12 @@ function JsonataRenderer(_ref) {
|
|
|
886
1284
|
}
|
|
887
1285
|
}
|
|
888
1286
|
|
|
889
|
-
var _excluded = ["control", "field", "renderOptions"];
|
|
1287
|
+
var _excluded$1 = ["control", "field", "renderOptions"];
|
|
890
1288
|
function createNullToggleRenderer() {
|
|
891
1289
|
return schemas.createDataRenderer(function (_ref, renderers) {
|
|
892
1290
|
var control = _ref.control,
|
|
893
1291
|
field = _ref.field,
|
|
894
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1292
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
895
1293
|
var lastDefined = schemas.getLastDefinedValue(control);
|
|
896
1294
|
if (lastDefined.current.value == null) lastDefined.value = props.definition.defaultValue;
|
|
897
1295
|
var nullControl = schemas.getNullToggler(control);
|
|
@@ -922,112 +1320,115 @@ function createDefaultArrayDataRenderer(defaultActions) {
|
|
|
922
1320
|
collection: true
|
|
923
1321
|
});
|
|
924
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* @trackControls
|
|
1325
|
+
*/
|
|
925
1326
|
function DataArrayRenderer(_ref) {
|
|
926
|
-
var
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
control = dataProps.control,
|
|
932
|
-
field = dataProps.field,
|
|
933
|
-
readonly = dataProps.readonly,
|
|
934
|
-
designMode = dataProps.designMode,
|
|
935
|
-
required = dataProps.required,
|
|
936
|
-
renderChild = dataProps.renderChild,
|
|
937
|
-
definition = dataProps.definition,
|
|
938
|
-
className = dataProps.className,
|
|
939
|
-
style = dataProps.style,
|
|
940
|
-
useChildVisibility = dataProps.useChildVisibility,
|
|
941
|
-
dataContext = dataProps.dataContext,
|
|
942
|
-
formNode = dataProps.formNode;
|
|
943
|
-
var _mergeObjects = schemas.mergeObjects(schemas.isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions),
|
|
944
|
-
addText = _mergeObjects.addText,
|
|
945
|
-
noAdd = _mergeObjects.noAdd,
|
|
946
|
-
noRemove = _mergeObjects.noRemove,
|
|
947
|
-
removeText = _mergeObjects.removeText,
|
|
948
|
-
editExternal = _mergeObjects.editExternal;
|
|
949
|
-
var childOptions = schemas.isArrayRenderer(renderOptions) ? renderOptions.childOptions : undefined;
|
|
950
|
-
var renderAsElement = !schemas.isCompoundField(field);
|
|
951
|
-
var childDefinition = formNode.tree.createTempNode(formNode.id + "child", !renderAsElement ? {
|
|
952
|
-
type: schemas.ControlDefinitionType.Group,
|
|
953
|
-
groupOptions: {
|
|
954
|
-
type: schemas.GroupRenderType.Standard,
|
|
955
|
-
hideTitle: true
|
|
956
|
-
}
|
|
957
|
-
} : {
|
|
958
|
-
type: schemas.ControlDefinitionType.Data,
|
|
959
|
-
field: definition.field,
|
|
960
|
-
renderOptions: childOptions != null ? childOptions : {
|
|
961
|
-
type: schemas.DataRenderType.Standard
|
|
962
|
-
},
|
|
963
|
-
hideTitle: true
|
|
964
|
-
}, formNode.getChildNodes());
|
|
965
|
-
var visibilities = ((_definition$children = definition.children) != null ? _definition$children : []).map(function (x) {
|
|
966
|
-
return [useChildVisibility(x, undefined, true), x];
|
|
967
|
-
});
|
|
968
|
-
var deps = schemas.makeHookDepString(visibilities, function (x) {
|
|
969
|
-
return x[0].deps;
|
|
970
|
-
});
|
|
971
|
-
var Entry = core.useTrackedComponent(RenderEntry, [deps]);
|
|
972
|
-
var arrayProps = _extends({}, schemas.createArrayActions(control.as(), field, {
|
|
973
|
-
addText: addText,
|
|
974
|
-
removeText: removeText,
|
|
975
|
-
noAdd: noAdd,
|
|
976
|
-
noRemove: noRemove,
|
|
977
|
-
readonly: readonly,
|
|
978
|
-
disabled: control.disabled,
|
|
979
|
-
designMode: designMode,
|
|
980
|
-
editExternal: editExternal
|
|
981
|
-
}), {
|
|
982
|
-
required: required,
|
|
983
|
-
renderElement: function renderElement(i, wrap) {
|
|
984
|
-
return /*#__PURE__*/jsxRuntime.jsx(Entry, {
|
|
985
|
-
index: i,
|
|
986
|
-
renderChildElement: renderChildElement,
|
|
987
|
-
dataContext: dataContext,
|
|
988
|
-
visibilities: visibilities,
|
|
989
|
-
wrap: wrap
|
|
1327
|
+
var _effect = core.useComponentTracking();
|
|
1328
|
+
try {
|
|
1329
|
+
var renderChildElement = function renderChildElement(i, elementNode) {
|
|
1330
|
+
return renderChild(elementNode.control.uniqueId, childNode, {
|
|
1331
|
+
parentDataNode: elementNode
|
|
990
1332
|
});
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1333
|
+
};
|
|
1334
|
+
var dataProps = _ref.dataProps,
|
|
1335
|
+
renderers = _ref.renderers,
|
|
1336
|
+
defaultActions = _ref.defaultActions;
|
|
1337
|
+
var renderOptions = dataProps.renderOptions,
|
|
1338
|
+
control = dataProps.control,
|
|
1339
|
+
field = dataProps.field,
|
|
1340
|
+
readonly = dataProps.readonly,
|
|
1341
|
+
designMode = dataProps.designMode,
|
|
1342
|
+
required = dataProps.required,
|
|
1343
|
+
renderChild = dataProps.renderChild,
|
|
1344
|
+
definition = dataProps.definition,
|
|
1345
|
+
className = dataProps.className,
|
|
1346
|
+
style = dataProps.style,
|
|
1347
|
+
dataContext = dataProps.dataContext,
|
|
1348
|
+
formNode = dataProps.formNode,
|
|
1349
|
+
getChildState = dataProps.getChildState;
|
|
1350
|
+
var _mergeObjects = schemas.mergeObjects(schemas.isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions),
|
|
1351
|
+
addText = _mergeObjects.addText,
|
|
1352
|
+
noAdd = _mergeObjects.noAdd,
|
|
1353
|
+
noRemove = _mergeObjects.noRemove,
|
|
1354
|
+
noReorder = _mergeObjects.noReorder,
|
|
1355
|
+
removeText = _mergeObjects.removeText,
|
|
1356
|
+
editExternal = _mergeObjects.editExternal;
|
|
1357
|
+
var childDefs = formNode.getResolvedChildren();
|
|
1358
|
+
var renderAsElement = !schemas.isCompoundField(field);
|
|
1359
|
+
var defaultChildDef = {
|
|
1360
|
+
type: schemas.ControlDefinitionType.Data,
|
|
1361
|
+
field: ".",
|
|
1362
|
+
renderOptions: {
|
|
1363
|
+
type: schemas.DataRenderType.Standard
|
|
1364
|
+
},
|
|
1365
|
+
hideTitle: true
|
|
1366
|
+
};
|
|
1367
|
+
var childDef = {
|
|
1368
|
+
type: schemas.ControlDefinitionType.Group,
|
|
1369
|
+
groupOptions: {
|
|
1370
|
+
type: schemas.GroupRenderType.Standard,
|
|
1371
|
+
hideTitle: true
|
|
1372
|
+
},
|
|
1373
|
+
children: renderAsElement && childDefs.length == 0 ? [defaultChildDef] : childDefs
|
|
1374
|
+
};
|
|
1375
|
+
var childNode = formNode.createChildNode("child", childDef);
|
|
1376
|
+
var childNodes = childNode.getChildNodes();
|
|
1377
|
+
var arrayProps = _extends({}, schemas.createArrayActions(control.as(), field, {
|
|
1378
|
+
addText: addText,
|
|
1379
|
+
removeText: removeText,
|
|
1380
|
+
noAdd: noAdd,
|
|
1381
|
+
noRemove: noRemove,
|
|
1382
|
+
readonly: readonly,
|
|
1383
|
+
disabled: control.disabled,
|
|
1384
|
+
designMode: designMode,
|
|
1385
|
+
editExternal: editExternal
|
|
1386
|
+
}), {
|
|
1387
|
+
required: required,
|
|
1388
|
+
renderElement: function renderElement(i, wrap) {
|
|
1389
|
+
return /*#__PURE__*/jsxRuntime.jsx(RenderEntry, {
|
|
1390
|
+
index: i,
|
|
1391
|
+
renderChildElement: renderChildElement,
|
|
1392
|
+
dataContext: dataContext,
|
|
1393
|
+
wrap: wrap,
|
|
1394
|
+
isChildHidden: function isChildHidden(dataNode) {
|
|
1395
|
+
return childNodes.every(function (x) {
|
|
1396
|
+
return getChildState(x, dataNode).hidden;
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
},
|
|
1401
|
+
className: className ? className : undefined,
|
|
1402
|
+
style: style
|
|
1403
|
+
}, schemas.getLengthRestrictions(definition));
|
|
1404
|
+
return renderers.renderArray(arrayProps);
|
|
1405
|
+
} finally {
|
|
1406
|
+
_effect();
|
|
1003
1407
|
}
|
|
1004
1408
|
}
|
|
1409
|
+
/**
|
|
1410
|
+
* @trackControls
|
|
1411
|
+
*/
|
|
1005
1412
|
function RenderEntry(_ref2) {
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
var
|
|
1014
|
-
|
|
1015
|
-
return
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
});
|
|
1020
|
-
var anyVisible = childVis.length == 0 || childVis.some(function (x) {
|
|
1021
|
-
return x === true;
|
|
1022
|
-
});
|
|
1023
|
-
if (!anyVisible) return undefined;
|
|
1024
|
-
return wrap(renderChildElement(i, elementNode));
|
|
1413
|
+
var _effect2 = core.useComponentTracking();
|
|
1414
|
+
try {
|
|
1415
|
+
var i = _ref2.index,
|
|
1416
|
+
renderChildElement = _ref2.renderChildElement,
|
|
1417
|
+
wrap = _ref2.wrap,
|
|
1418
|
+
isChildHidden = _ref2.isChildHidden,
|
|
1419
|
+
dataContext = _ref2.dataContext;
|
|
1420
|
+
var elementNode = dataContext.dataNode.getChildElement(i);
|
|
1421
|
+
if (isChildHidden(elementNode)) return undefined;
|
|
1422
|
+
return wrap(renderChildElement(i, elementNode));
|
|
1423
|
+
} finally {
|
|
1424
|
+
_effect2();
|
|
1425
|
+
}
|
|
1025
1426
|
}
|
|
1026
1427
|
function createDefaultArrayRenderer(options) {
|
|
1027
1428
|
return {
|
|
1028
|
-
render: function render(props,
|
|
1029
|
-
var renderAction =
|
|
1030
|
-
html =
|
|
1429
|
+
render: function render(props, _ref3) {
|
|
1430
|
+
var renderAction = _ref3.renderAction,
|
|
1431
|
+
html = _ref3.html;
|
|
1031
1432
|
return /*#__PURE__*/jsxRuntime.jsx(DefaultArrayRenderer, _extends({}, props, options, {
|
|
1032
1433
|
renderAction: renderAction,
|
|
1033
1434
|
html: html
|
|
@@ -1037,7 +1438,7 @@ function createDefaultArrayRenderer(options) {
|
|
|
1037
1438
|
};
|
|
1038
1439
|
}
|
|
1039
1440
|
function DefaultArrayRenderer(props) {
|
|
1040
|
-
var
|
|
1441
|
+
var _effect3 = core.useComponentTracking();
|
|
1041
1442
|
try {
|
|
1042
1443
|
var renderElement = props.renderElement,
|
|
1043
1444
|
className = props.className,
|
|
@@ -1083,7 +1484,7 @@ function DefaultArrayRenderer(props) {
|
|
|
1083
1484
|
})]
|
|
1084
1485
|
});
|
|
1085
1486
|
} finally {
|
|
1086
|
-
|
|
1487
|
+
_effect3();
|
|
1087
1488
|
}
|
|
1088
1489
|
}
|
|
1089
1490
|
|
|
@@ -1139,6 +1540,7 @@ function SingleAutocomplete(_ref) {
|
|
|
1139
1540
|
var _useAutocomplete = base.useAutocomplete(_extends({
|
|
1140
1541
|
freeSolo: true,
|
|
1141
1542
|
multiple: false,
|
|
1543
|
+
readOnly: readOnly,
|
|
1142
1544
|
value: selectedOptionControl.value,
|
|
1143
1545
|
inputValue: inputControl.value,
|
|
1144
1546
|
getOptionLabel: function getOptionLabel(v) {
|
|
@@ -1178,7 +1580,8 @@ function SingleAutocomplete(_ref) {
|
|
|
1178
1580
|
type: "text"
|
|
1179
1581
|
}, getInputProps(), {
|
|
1180
1582
|
placeholder: (_controlClasses$place = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place : "",
|
|
1181
|
-
className: inputClass
|
|
1583
|
+
className: inputClass,
|
|
1584
|
+
readOnly: readOnly
|
|
1182
1585
|
})), /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, getPopupIndicatorProps(), {
|
|
1183
1586
|
disabled: disabled || readOnly,
|
|
1184
1587
|
className: "outline-0 shadow-none border-0 py-0 px-0.5 bg-transparent pr-[10px]",
|
|
@@ -1235,6 +1638,7 @@ function MultipleAutocomplete(_ref3) {
|
|
|
1235
1638
|
value: (_selectedOptionsContr = selectedOptionsControl.value) != null ? _selectedOptionsContr : [],
|
|
1236
1639
|
inputValue: inputControl.value,
|
|
1237
1640
|
freeSolo: true,
|
|
1641
|
+
readOnly: readOnly,
|
|
1238
1642
|
multiple: true,
|
|
1239
1643
|
getOptionLabel: function getOptionLabel(v) {
|
|
1240
1644
|
return typeof v === "string" ? v : v.name;
|
|
@@ -1275,7 +1679,7 @@ function MultipleAutocomplete(_ref3) {
|
|
|
1275
1679
|
text: typeof v === "string" ? v : v.name,
|
|
1276
1680
|
chipContainerClass: chipContainerClass,
|
|
1277
1681
|
chipCloseButtonClass: chipCloseButtonClass,
|
|
1278
|
-
onDeleteClick: function
|
|
1682
|
+
onDeleteClick: readOnly || disabled ? undefined : function () {
|
|
1279
1683
|
var c = selectedOptionsControl.elements.find(function (x) {
|
|
1280
1684
|
return x.value == v;
|
|
1281
1685
|
});
|
|
@@ -1286,7 +1690,8 @@ function MultipleAutocomplete(_ref3) {
|
|
|
1286
1690
|
type: "text"
|
|
1287
1691
|
}, getInputProps(), {
|
|
1288
1692
|
placeholder: (_controlClasses$place2 = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place2 : "",
|
|
1289
|
-
className: clsx__default["default"](inputClass)
|
|
1693
|
+
className: clsx__default["default"](inputClass),
|
|
1694
|
+
readOnly: readOnly
|
|
1290
1695
|
}))]
|
|
1291
1696
|
}), /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, getPopupIndicatorProps(), {
|
|
1292
1697
|
disabled: disabled || readOnly,
|
|
@@ -1340,20 +1745,32 @@ var ValueForFieldExtension = {
|
|
|
1340
1745
|
value: RenderType,
|
|
1341
1746
|
name: "Value For Field",
|
|
1342
1747
|
fields: schemas.buildSchema({
|
|
1343
|
-
fieldRef: schemas.stringField("Field Reference")
|
|
1748
|
+
fieldRef: schemas.stringField("Field Reference"),
|
|
1749
|
+
noOptions: schemas.boolField("No Options"),
|
|
1750
|
+
refIsDirect: schemas.boolField("Reference is direct")
|
|
1344
1751
|
})
|
|
1345
1752
|
}
|
|
1346
1753
|
};
|
|
1347
1754
|
function createValueForFieldRenderer(options) {
|
|
1348
1755
|
return schemas.createDataRenderer(function (o, renderer) {
|
|
1349
1756
|
var _schemaDataForFieldRe;
|
|
1350
|
-
var
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1757
|
+
var _o$renderOptions = o.renderOptions,
|
|
1758
|
+
fieldRef = _o$renderOptions.fieldRef,
|
|
1759
|
+
noOptions = _o$renderOptions.noOptions,
|
|
1760
|
+
refIsDirect = _o$renderOptions.refIsDirect;
|
|
1761
|
+
var actualFieldRef = fieldRef ? refIsDirect ? fieldRef : (_schemaDataForFieldRe = schemas.schemaDataForFieldRef(fieldRef, o.dataContext.parentNode)) == null || (_schemaDataForFieldRe = _schemaDataForFieldRe.control) == null ? void 0 : _schemaDataForFieldRe.value : ".";
|
|
1762
|
+
var schemaField;
|
|
1763
|
+
if (refIsDirect) {
|
|
1764
|
+
var dataNode = schemas.schemaDataForFieldRef(actualFieldRef, o.dataContext.parentNode);
|
|
1765
|
+
schemaField = core.trackedValue(dataNode.control.as());
|
|
1766
|
+
} else {
|
|
1767
|
+
schemaField = actualFieldRef ? schemas.schemaForFieldRef(actualFieldRef, options.schema).field : undefined;
|
|
1768
|
+
}
|
|
1769
|
+
return schemaField ? /*#__PURE__*/jsxRuntime.jsx(ValueForField, {
|
|
1354
1770
|
renderer: renderer,
|
|
1355
|
-
|
|
1356
|
-
control: o.control
|
|
1771
|
+
schemaField: schemaField,
|
|
1772
|
+
control: o.control,
|
|
1773
|
+
noOptions: noOptions
|
|
1357
1774
|
}) : /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1358
1775
|
children: actualFieldRef ? "No schema node for " + actualFieldRef : ""
|
|
1359
1776
|
});
|
|
@@ -1364,9 +1781,10 @@ function createValueForFieldRenderer(options) {
|
|
|
1364
1781
|
function ValueForField(_ref) {
|
|
1365
1782
|
var _effect = core.useComponentTracking();
|
|
1366
1783
|
try {
|
|
1367
|
-
var
|
|
1784
|
+
var schemaField = _ref.schemaField,
|
|
1368
1785
|
renderer = _ref.renderer,
|
|
1369
|
-
control = _ref.control
|
|
1786
|
+
control = _ref.control,
|
|
1787
|
+
noOptions = _ref.noOptions;
|
|
1370
1788
|
var value = core.useControl({
|
|
1371
1789
|
"default": undefined
|
|
1372
1790
|
}, undefined, function (e) {
|
|
@@ -1375,18 +1793,24 @@ function ValueForField(_ref) {
|
|
|
1375
1793
|
});
|
|
1376
1794
|
});
|
|
1377
1795
|
var _useMemo = react.useMemo(function () {
|
|
1378
|
-
var
|
|
1796
|
+
var adjustedField = _extends({}, schemaField, {
|
|
1797
|
+
collection: noOptions ? false : schemaField.collection,
|
|
1798
|
+
options: noOptions ? undefined : schemaField.options,
|
|
1379
1799
|
field: "default",
|
|
1380
1800
|
required: false,
|
|
1381
1801
|
notNullable: false,
|
|
1382
1802
|
onlyForTypes: null,
|
|
1383
1803
|
defaultValue: undefined
|
|
1384
|
-
})
|
|
1385
|
-
|
|
1386
|
-
|
|
1804
|
+
});
|
|
1805
|
+
var control = _extends({}, schemas.defaultControlForField(adjustedField), {
|
|
1806
|
+
hideTitle: true
|
|
1807
|
+
});
|
|
1808
|
+
var rootSchema = schemas.createSchemaTree([adjustedField]).rootNode;
|
|
1809
|
+
return [control, rootSchema];
|
|
1810
|
+
}, [schemaField]),
|
|
1387
1811
|
controls = _useMemo[0],
|
|
1388
1812
|
rootSchema = _useMemo[1];
|
|
1389
|
-
var Render = schemas.useControlRendererComponent(
|
|
1813
|
+
var Render = schemas.useControlRendererComponent(controls, renderer, {
|
|
1390
1814
|
disabled: control.disabled
|
|
1391
1815
|
}, schemas.makeSchemaDataNode(rootSchema, value));
|
|
1392
1816
|
return /*#__PURE__*/jsxRuntime.jsx(Render, {});
|
|
@@ -1564,18 +1988,18 @@ function ArrayElementRenderer(_ref) {
|
|
|
1564
1988
|
});
|
|
1565
1989
|
};
|
|
1566
1990
|
var parentDataNode = schemas.makeSchemaDataNode(dataProps.dataNode.schema, extData.fields.data);
|
|
1567
|
-
var elementGroup = formNode.
|
|
1991
|
+
var elementGroup = formNode.createChildNode("group", {
|
|
1568
1992
|
type: schemas.ControlDefinitionType.Group,
|
|
1569
1993
|
groupOptions: {
|
|
1570
1994
|
type: schemas.GroupRenderType.Standard,
|
|
1571
1995
|
hideTitle: true
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1996
|
+
},
|
|
1997
|
+
children: formNode.getResolvedChildren()
|
|
1998
|
+
});
|
|
1574
1999
|
var editContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1575
2000
|
className: schemas.rendererClass(dataProps.className, options.className),
|
|
1576
2001
|
children: [renderChild("", elementGroup, {
|
|
1577
|
-
parentDataNode: parentDataNode
|
|
1578
|
-
elementIndex: 0
|
|
2002
|
+
parentDataNode: parentDataNode
|
|
1579
2003
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1580
2004
|
className: options.actionsClass,
|
|
1581
2005
|
children: /*#__PURE__*/jsxRuntime.jsx(core.RenderElements, {
|
|
@@ -1603,26 +2027,61 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
1603
2027
|
if (options === void 0) {
|
|
1604
2028
|
options = {};
|
|
1605
2029
|
}
|
|
1606
|
-
return schemas.createActionRenderer(actionId, function (
|
|
1607
|
-
var _options$renderConten;
|
|
1608
|
-
var
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
2030
|
+
return schemas.createActionRenderer(actionId, function (props, renderer) {
|
|
2031
|
+
var _props$icon, _ref, _props$iconPlacement, _options$renderConten;
|
|
2032
|
+
var key = props.key,
|
|
2033
|
+
onClick = props.onClick,
|
|
2034
|
+
actionText = props.actionText,
|
|
2035
|
+
className = props.className,
|
|
2036
|
+
style = props.style,
|
|
2037
|
+
actionId = props.actionId,
|
|
2038
|
+
actionData = props.actionData,
|
|
2039
|
+
disabled = props.disabled,
|
|
2040
|
+
textClass = props.textClass,
|
|
2041
|
+
actionStyle = props.actionStyle,
|
|
2042
|
+
inline = props.inline,
|
|
2043
|
+
actionContent = props.actionContent;
|
|
2044
|
+
var icon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
|
|
2045
|
+
var iconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : schemas.IconPlacement.BeforeText;
|
|
2046
|
+
var _renderer$html = renderer.html,
|
|
2047
|
+
Button = _renderer$html.Button,
|
|
2048
|
+
I = _renderer$html.I,
|
|
2049
|
+
Span = _renderer$html.Span;
|
|
2050
|
+
var isLink = actionStyle == schemas.ActionStyle.Link;
|
|
2051
|
+
var isGroup = actionStyle == schemas.ActionStyle.Group;
|
|
2052
|
+
var classNames = schemas.rendererClass(className, isLink ? options.linkClass : isGroup ? options.groupClass : schemas.rendererClass(options.buttonClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryClass : options.primaryClass));
|
|
2053
|
+
var iconElement = icon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
2054
|
+
iconName: icon.name,
|
|
2055
|
+
iconLibrary: icon.library,
|
|
2056
|
+
className: iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass
|
|
2057
|
+
});
|
|
2058
|
+
var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
|
|
2059
|
+
var textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
2060
|
+
className: textClassNames,
|
|
2061
|
+
children: actionText
|
|
2062
|
+
});
|
|
1617
2063
|
return /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
1618
2064
|
className: classNames,
|
|
2065
|
+
textClass: textClassNames,
|
|
1619
2066
|
disabled: disabled,
|
|
1620
2067
|
style: style,
|
|
1621
2068
|
onClick: onClick,
|
|
1622
|
-
|
|
1623
|
-
|
|
2069
|
+
inline: inline,
|
|
2070
|
+
nonTextContent: isGroup,
|
|
2071
|
+
title: iconPlacement == schemas.IconPlacement.ReplaceText ? actionText : undefined,
|
|
2072
|
+
notWrapInText: options.notWrapInText,
|
|
2073
|
+
androidRippleColor: options.androidRippleColor,
|
|
2074
|
+
children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2075
|
+
children: [iconPlacement == schemas.IconPlacement.BeforeText && iconElement, iconPlacement != schemas.IconPlacement.ReplaceText && textElement, iconPlacement != schemas.IconPlacement.BeforeText && iconElement]
|
|
2076
|
+
})
|
|
2077
|
+
}, key);
|
|
1624
2078
|
});
|
|
1625
2079
|
}
|
|
2080
|
+
|
|
2081
|
+
var _excluded = ["inline", "textClass", "className", "notWrapInText", "androidRippleColor", "onClick", "nonTextContent"],
|
|
2082
|
+
_excluded2 = ["textClass", "className", "onChangeValue", "onChangeChecked", "inputRef"],
|
|
2083
|
+
_excluded3 = ["text", "html", "children", "className", "textClass", "nativeRef", "inline"],
|
|
2084
|
+
_excluded4 = ["textClass", "className"];
|
|
1626
2085
|
var DefaultBoolOptions = [{
|
|
1627
2086
|
name: "Yes",
|
|
1628
2087
|
value: true
|
|
@@ -1631,14 +2090,15 @@ var DefaultBoolOptions = [{
|
|
|
1631
2090
|
value: false
|
|
1632
2091
|
}];
|
|
1633
2092
|
function createDefaultDataRenderer(options) {
|
|
1634
|
-
var _options$
|
|
2093
|
+
var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
|
|
1635
2094
|
if (options === void 0) {
|
|
1636
2095
|
options = {};
|
|
1637
2096
|
}
|
|
2097
|
+
var elementSelectedRenderer = createElementSelectedRenderer((_options$checkboxOpti = options.checkboxOptions) != null ? _options$checkboxOpti : options.checkOptions);
|
|
1638
2098
|
var jsonataRenderer = createJsonataRenderer(options.jsonataClass);
|
|
1639
2099
|
var nullToggler = createNullToggleRenderer();
|
|
1640
2100
|
var multilineRenderer = createMultilineFieldRenderer(options.multilineClass);
|
|
1641
|
-
var checkboxRenderer = createCheckboxRenderer((_options$
|
|
2101
|
+
var checkboxRenderer = createCheckboxRenderer((_options$checkboxOpti2 = options.checkboxOptions) != null ? _options$checkboxOpti2 : options.checkOptions);
|
|
1642
2102
|
var selectRenderer = createSelectRenderer(options.selectOptions);
|
|
1643
2103
|
var radioRenderer = createRadioRenderer((_options$radioOptions = options.radioOptions) != null ? _options$radioOptions : options.checkOptions);
|
|
1644
2104
|
var checkListRenderer = createCheckListRenderer((_options$checkListOpt = options.checkListOptions) != null ? _options$checkListOpt : options.checkOptions);
|
|
@@ -1648,6 +2108,7 @@ function createDefaultDataRenderer(options) {
|
|
|
1648
2108
|
booleanOptions: DefaultBoolOptions
|
|
1649
2109
|
}, options),
|
|
1650
2110
|
inputClass = _optionRenderer$boole.inputClass,
|
|
2111
|
+
inputTextClass = _optionRenderer$boole.inputTextClass,
|
|
1651
2112
|
booleanOptions = _optionRenderer$boole.booleanOptions,
|
|
1652
2113
|
optionRenderer = _optionRenderer$boole.optionRenderer,
|
|
1653
2114
|
displayOnlyClass = _optionRenderer$boole.displayOnlyClass,
|
|
@@ -1659,13 +2120,13 @@ function createDefaultDataRenderer(options) {
|
|
|
1659
2120
|
var fieldType = field.type;
|
|
1660
2121
|
var renderOptions = props.renderOptions;
|
|
1661
2122
|
var renderType = renderOptions.type;
|
|
1662
|
-
if (field.collection && props.elementIndex == null && (renderType == schemas.DataRenderType.Standard || renderType == schemas.DataRenderType.Array || renderType == schemas.DataRenderType.ArrayElement)) {
|
|
2123
|
+
if (field.collection && props.dataNode.elementIndex == null && (renderType == schemas.DataRenderType.Standard || renderType == schemas.DataRenderType.Array || renderType == schemas.DataRenderType.ArrayElement)) {
|
|
1663
2124
|
if (renderType == schemas.DataRenderType.ArrayElement) return arrayElementRenderer.render(props, renderers);
|
|
1664
2125
|
return arrayRenderer.render(props, renderers);
|
|
1665
2126
|
}
|
|
1666
2127
|
if (fieldType === schemas.FieldType.Compound) {
|
|
1667
|
-
var
|
|
1668
|
-
var groupOptions = (
|
|
2128
|
+
var _ref;
|
|
2129
|
+
var groupOptions = (_ref = schemas.isDataGroupRenderer(renderOptions) ? renderOptions.groupOptions : undefined) != null ? _ref : {
|
|
1669
2130
|
type: "Standard",
|
|
1670
2131
|
hideTitle: true
|
|
1671
2132
|
};
|
|
@@ -1677,11 +2138,12 @@ function createDefaultDataRenderer(options) {
|
|
|
1677
2138
|
return _extends({}, p, {
|
|
1678
2139
|
className: "@ " + schemas.rendererClass(p.className, displayOnlyClass),
|
|
1679
2140
|
children: /*#__PURE__*/jsxRuntime.jsx(DefaultDisplayOnly, {
|
|
1680
|
-
|
|
2141
|
+
dataNode: props.dataNode,
|
|
1681
2142
|
schemaInterface: props.dataContext.schemaInterface,
|
|
1682
|
-
control: props.control,
|
|
1683
2143
|
className: props.className,
|
|
2144
|
+
textClass: props.textClass,
|
|
1684
2145
|
style: props.style,
|
|
2146
|
+
inline: props.inline,
|
|
1685
2147
|
renderer: renderers,
|
|
1686
2148
|
emptyText: schemas.isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText
|
|
1687
2149
|
})
|
|
@@ -1711,6 +2173,8 @@ function createDefaultDataRenderer(options) {
|
|
|
1711
2173
|
return jsonataRenderer.render(props, renderers);
|
|
1712
2174
|
case schemas.DataRenderType.Autocomplete:
|
|
1713
2175
|
return autocompleteRenderer.render(props, renderers);
|
|
2176
|
+
case schemas.DataRenderType.ElementSelected:
|
|
2177
|
+
return elementSelectedRenderer.render(props, renderers);
|
|
1714
2178
|
}
|
|
1715
2179
|
if (fieldType == schemas.FieldType.Any) {
|
|
1716
2180
|
var _field$displayName;
|
|
@@ -1722,6 +2186,7 @@ function createDefaultDataRenderer(options) {
|
|
|
1722
2186
|
var placeholder = schemas.isTextfieldRenderer(renderOptions) ? renderOptions.placeholder : undefined;
|
|
1723
2187
|
return /*#__PURE__*/jsxRuntime.jsx(ControlInput, {
|
|
1724
2188
|
className: schemas.rendererClass(props.className, inputClass),
|
|
2189
|
+
textClass: schemas.rendererClass(props.textClass, inputTextClass),
|
|
1725
2190
|
style: props.style,
|
|
1726
2191
|
id: props.id,
|
|
1727
2192
|
readOnly: props.readonly,
|
|
@@ -1746,48 +2211,28 @@ function createDefaultAdornmentRenderer(options) {
|
|
|
1746
2211
|
var adornment = props.adornment,
|
|
1747
2212
|
designMode = props.designMode,
|
|
1748
2213
|
dataContext = props.dataContext,
|
|
1749
|
-
|
|
2214
|
+
runExpression = props.runExpression;
|
|
1750
2215
|
return {
|
|
1751
2216
|
apply: function apply(rl) {
|
|
1752
|
-
if (schemas.isSetFieldAdornment(adornment) &&
|
|
1753
|
-
var setFieldWrapper = function setFieldWrapper(_ref3) {
|
|
1754
|
-
var children = _ref3.children,
|
|
1755
|
-
adornment = _ref3.adornment,
|
|
1756
|
-
parentContext = _ref3.parentContext;
|
|
1757
|
-
var _dynamicHooks = dynamicHooks(parentContext),
|
|
1758
|
-
value = _dynamicHooks.value;
|
|
1759
|
-
var fieldNode = schemas.schemaDataForFieldRef(adornment.field, parentContext.parentNode);
|
|
1760
|
-
var otherField = fieldNode.control;
|
|
1761
|
-
var always = !adornment.defaultOnly;
|
|
1762
|
-
core.useControlEffect(function () {
|
|
1763
|
-
return [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null];
|
|
1764
|
-
}, function (_ref4) {
|
|
1765
|
-
var v = _ref4[0];
|
|
1766
|
-
otherField == null || otherField.setValue(function (x) {
|
|
1767
|
-
return always || x == null ? v : x;
|
|
1768
|
-
});
|
|
1769
|
-
}, true);
|
|
1770
|
-
return children;
|
|
1771
|
-
};
|
|
1772
|
-
var hook = useExpr(adornment.expression, function (x) {
|
|
1773
|
-
return x;
|
|
1774
|
-
});
|
|
1775
|
-
var dynamicHooks = schemas.useDynamicHooks({
|
|
1776
|
-
value: hook
|
|
1777
|
-
});
|
|
1778
|
-
var SetFieldWrapper = core.useTrackedComponent(setFieldWrapper, [dynamicHooks]);
|
|
2217
|
+
if (schemas.isSetFieldAdornment(adornment) && runExpression) {
|
|
1779
2218
|
return schemas.wrapLayout(function (x) {
|
|
1780
2219
|
return /*#__PURE__*/jsxRuntime.jsx(SetFieldWrapper, {
|
|
1781
2220
|
children: x,
|
|
1782
2221
|
parentContext: dataContext,
|
|
1783
|
-
adornment: adornment
|
|
2222
|
+
adornment: adornment,
|
|
2223
|
+
runExpression: runExpression
|
|
1784
2224
|
});
|
|
1785
2225
|
})(rl);
|
|
1786
2226
|
}
|
|
1787
2227
|
if (schemas.isIconAdornment(adornment)) {
|
|
1788
|
-
var
|
|
1789
|
-
|
|
1790
|
-
|
|
2228
|
+
var I = renderers.html.I;
|
|
2229
|
+
var icon = adornment.icon,
|
|
2230
|
+
placement = adornment.placement,
|
|
2231
|
+
iconClass = adornment.iconClass;
|
|
2232
|
+
return schemas.appendMarkupAt(placement != null ? placement : schemas.AdornmentPlacement.ControlStart, /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
2233
|
+
className: iconClass,
|
|
2234
|
+
iconName: icon == null ? void 0 : icon.name,
|
|
2235
|
+
iconLibrary: icon == null ? void 0 : icon.library
|
|
1791
2236
|
}))(rl);
|
|
1792
2237
|
}
|
|
1793
2238
|
if (schemas.isAccordionAdornment(adornment)) {
|
|
@@ -1810,6 +2255,27 @@ function createDefaultAdornmentRenderer(options) {
|
|
|
1810
2255
|
}
|
|
1811
2256
|
};
|
|
1812
2257
|
}
|
|
2258
|
+
function SetFieldWrapper(_ref2) {
|
|
2259
|
+
var children = _ref2.children,
|
|
2260
|
+
adornment = _ref2.adornment,
|
|
2261
|
+
parentContext = _ref2.parentContext,
|
|
2262
|
+
runExpression = _ref2.runExpression;
|
|
2263
|
+
var fieldNode = schemas.schemaDataForFieldRef(adornment.field, parentContext.parentNode);
|
|
2264
|
+
var otherField = fieldNode.control;
|
|
2265
|
+
var always = !adornment.defaultOnly;
|
|
2266
|
+
var value = schemas.useExpression(undefined, runExpression, adornment.expression, function (x) {
|
|
2267
|
+
return x;
|
|
2268
|
+
});
|
|
2269
|
+
core.useControlEffect(function () {
|
|
2270
|
+
return [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null];
|
|
2271
|
+
}, function (_ref3) {
|
|
2272
|
+
var v = _ref3[0];
|
|
2273
|
+
otherField == null || otherField.setValue(function (x) {
|
|
2274
|
+
return always || x == null ? v : x;
|
|
2275
|
+
});
|
|
2276
|
+
}, true);
|
|
2277
|
+
return children;
|
|
2278
|
+
}
|
|
1813
2279
|
function createDefaultLabelRenderer(options) {
|
|
1814
2280
|
var _labelContainer$optio = _extends({
|
|
1815
2281
|
labelContainer: function labelContainer(c) {
|
|
@@ -1817,24 +2283,32 @@ function createDefaultLabelRenderer(options) {
|
|
|
1817
2283
|
}
|
|
1818
2284
|
}, options),
|
|
1819
2285
|
className = _labelContainer$optio.className,
|
|
2286
|
+
controlLabelTextClass = _labelContainer$optio.controlLabelTextClass,
|
|
2287
|
+
groupLabelTextClass = _labelContainer$optio.groupLabelTextClass,
|
|
1820
2288
|
groupLabelClass = _labelContainer$optio.groupLabelClass,
|
|
1821
2289
|
controlLabelClass = _labelContainer$optio.controlLabelClass,
|
|
2290
|
+
textClass = _labelContainer$optio.textClass,
|
|
1822
2291
|
labelContainer = _labelContainer$optio.labelContainer;
|
|
1823
2292
|
return {
|
|
1824
2293
|
render: function render(props, labelStart, labelEnd, renderers) {
|
|
1825
2294
|
var _options$requiredElem;
|
|
1826
|
-
var
|
|
1827
|
-
|
|
1828
|
-
|
|
2295
|
+
var _renderers$html = renderers.html,
|
|
2296
|
+
Label = _renderers$html.Label,
|
|
2297
|
+
Span = _renderers$html.Span;
|
|
2298
|
+
var requiredElement = (_options$requiredElem = options == null ? void 0 : options.requiredElement) != null ? _options$requiredElem : function (_ref4) {
|
|
2299
|
+
var Span = _ref4.Span;
|
|
1829
2300
|
return /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
1830
2301
|
children: " *"
|
|
1831
2302
|
});
|
|
1832
2303
|
};
|
|
1833
|
-
if (props.type == schemas.LabelType.Text) return
|
|
2304
|
+
if (props.type == schemas.LabelType.Text) return /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
2305
|
+
children: props.label
|
|
2306
|
+
});
|
|
1834
2307
|
return labelContainer(/*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1835
2308
|
children: [/*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
1836
2309
|
htmlFor: props.forId,
|
|
1837
2310
|
className: schemas.rendererClass(props.className, clsx__default["default"](className, props.type === schemas.LabelType.Group && groupLabelClass, props.type === schemas.LabelType.Control && controlLabelClass)),
|
|
2311
|
+
textClass: schemas.rendererClass(props.textClass, clsx__default["default"](textClass, props.type === schemas.LabelType.Group && groupLabelTextClass, props.type === schemas.LabelType.Control && controlLabelTextClass)),
|
|
1838
2312
|
children: [labelStart, renderers.renderLabelText(props.label), props.required && requiredElement(renderers.html)]
|
|
1839
2313
|
}), labelEnd]
|
|
1840
2314
|
}));
|
|
@@ -1843,17 +2317,125 @@ function createDefaultLabelRenderer(options) {
|
|
|
1843
2317
|
};
|
|
1844
2318
|
}
|
|
1845
2319
|
var StandardHtmlComponents = {
|
|
1846
|
-
Button:
|
|
1847
|
-
Label:
|
|
1848
|
-
I:
|
|
2320
|
+
Button: DefaultHtmlButtonRenderer,
|
|
2321
|
+
Label: DefaultHtmlLabelRenderer,
|
|
2322
|
+
I: DefaultHtmlIconRenderer,
|
|
1849
2323
|
Span: "span",
|
|
1850
|
-
Div:
|
|
2324
|
+
Div: DefaultHtmlDivRenderer,
|
|
1851
2325
|
H1: "h1",
|
|
1852
2326
|
B: "b",
|
|
1853
|
-
Input:
|
|
2327
|
+
Input: DefaultHtmlInputRenderer
|
|
1854
2328
|
};
|
|
2329
|
+
function DefaultHtmlButtonRenderer(_ref5) {
|
|
2330
|
+
var _effect = core.useComponentTracking();
|
|
2331
|
+
try {
|
|
2332
|
+
var inline = _ref5.inline,
|
|
2333
|
+
textClass = _ref5.textClass,
|
|
2334
|
+
className = _ref5.className,
|
|
2335
|
+
notWrapInText = _ref5.notWrapInText,
|
|
2336
|
+
androidRippleColor = _ref5.androidRippleColor,
|
|
2337
|
+
onClick = _ref5.onClick,
|
|
2338
|
+
nonTextContent = _ref5.nonTextContent,
|
|
2339
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
2340
|
+
var Comp = nonTextContent ? "div" : "button";
|
|
2341
|
+
return /*#__PURE__*/jsxRuntime.jsx(Comp, _extends({
|
|
2342
|
+
role: nonTextContent ? "button" : undefined,
|
|
2343
|
+
onClick: onClick ? function (e) {
|
|
2344
|
+
e.stopPropagation();
|
|
2345
|
+
onClick();
|
|
2346
|
+
} : undefined,
|
|
2347
|
+
className: nonTextContent ? className : clsx__default["default"](className, textClass)
|
|
2348
|
+
}, props));
|
|
2349
|
+
} finally {
|
|
2350
|
+
_effect();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
function DefaultHtmlInputRenderer(_ref6) {
|
|
2354
|
+
var _effect2 = core.useComponentTracking();
|
|
2355
|
+
try {
|
|
2356
|
+
var textClass = _ref6.textClass,
|
|
2357
|
+
className = _ref6.className,
|
|
2358
|
+
onChangeValue = _ref6.onChangeValue,
|
|
2359
|
+
onChangeChecked = _ref6.onChangeChecked,
|
|
2360
|
+
inputRef = _ref6.inputRef,
|
|
2361
|
+
props = _objectWithoutPropertiesLoose(_ref6, _excluded2);
|
|
2362
|
+
return /*#__PURE__*/jsxRuntime.jsx("input", _extends({
|
|
2363
|
+
ref: inputRef
|
|
2364
|
+
}, props, {
|
|
2365
|
+
className: clsx__default["default"](className, textClass),
|
|
2366
|
+
onChange: onChangeValue ? function (e) {
|
|
2367
|
+
return onChangeValue(e.target.value);
|
|
2368
|
+
} : onChangeChecked ? function (e) {
|
|
2369
|
+
return onChangeChecked(e.target.checked);
|
|
2370
|
+
} : undefined
|
|
2371
|
+
}));
|
|
2372
|
+
} finally {
|
|
2373
|
+
_effect2();
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
function DefaultHtmlDivRenderer(_ref7) {
|
|
2377
|
+
var _effect3 = core.useComponentTracking();
|
|
2378
|
+
try {
|
|
2379
|
+
var text = _ref7.text,
|
|
2380
|
+
html = _ref7.html,
|
|
2381
|
+
children = _ref7.children,
|
|
2382
|
+
className = _ref7.className,
|
|
2383
|
+
textClass = _ref7.textClass,
|
|
2384
|
+
nativeRef = _ref7.nativeRef,
|
|
2385
|
+
inline = _ref7.inline,
|
|
2386
|
+
props = _objectWithoutPropertiesLoose(_ref7, _excluded3);
|
|
2387
|
+
var Tag = inline ? "span" : "div";
|
|
2388
|
+
return /*#__PURE__*/jsxRuntime.jsx(Tag, _extends({}, props, {
|
|
2389
|
+
ref: nativeRef,
|
|
2390
|
+
className: clsx__default["default"](className, textClass),
|
|
2391
|
+
children: text != null ? text : children,
|
|
2392
|
+
dangerouslySetInnerHTML: html ? {
|
|
2393
|
+
__html: html
|
|
2394
|
+
} : undefined
|
|
2395
|
+
}));
|
|
2396
|
+
} finally {
|
|
2397
|
+
_effect3();
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
function DefaultHtmlLabelRenderer(_ref8) {
|
|
2401
|
+
var _effect4 = core.useComponentTracking();
|
|
2402
|
+
try {
|
|
2403
|
+
var textClass = _ref8.textClass,
|
|
2404
|
+
className = _ref8.className,
|
|
2405
|
+
props = _objectWithoutPropertiesLoose(_ref8, _excluded4);
|
|
2406
|
+
return /*#__PURE__*/jsxRuntime.jsx("label", _extends({}, props, {
|
|
2407
|
+
className: clsx__default["default"](className, textClass)
|
|
2408
|
+
}));
|
|
2409
|
+
} finally {
|
|
2410
|
+
_effect4();
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
function DefaultHtmlIconRenderer(_ref9) {
|
|
2414
|
+
var _effect5 = core.useComponentTracking();
|
|
2415
|
+
try {
|
|
2416
|
+
var toIconClass = function toIconClass() {
|
|
2417
|
+
if (!iconName) return undefined;
|
|
2418
|
+
switch (iconLibrary) {
|
|
2419
|
+
case schemas.IconLibrary.FontAwesome:
|
|
2420
|
+
return "fa fa-" + iconName;
|
|
2421
|
+
default:
|
|
2422
|
+
return iconName;
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
var iconName = _ref9.iconName,
|
|
2426
|
+
iconLibrary = _ref9.iconLibrary,
|
|
2427
|
+
className = _ref9.className,
|
|
2428
|
+
style = _ref9.style;
|
|
2429
|
+
return iconName ? /*#__PURE__*/jsxRuntime.jsx("i", {
|
|
2430
|
+
className: clsx__default["default"](className, toIconClass()),
|
|
2431
|
+
style: style
|
|
2432
|
+
}) : undefined;
|
|
2433
|
+
} finally {
|
|
2434
|
+
_effect5();
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
1855
2437
|
function createDefaultRenderers(options) {
|
|
1856
|
-
var _options$extraRendere, _options$
|
|
2438
|
+
var _options$extraRendere, _options$html;
|
|
1857
2439
|
if (options === void 0) {
|
|
1858
2440
|
options = {};
|
|
1859
2441
|
}
|
|
@@ -1868,9 +2450,6 @@ function createDefaultRenderers(options) {
|
|
|
1868
2450
|
renderLayout: createDefaultLayoutRenderer(options.layout),
|
|
1869
2451
|
visibility: createDefaultVisibilityRenderer(),
|
|
1870
2452
|
extraRenderers: (_options$extraRendere = options.extraRenderers == null ? void 0 : options.extraRenderers(options)) != null ? _options$extraRendere : [],
|
|
1871
|
-
renderText: (_options$renderText = options.renderText) != null ? _options$renderText : function (x) {
|
|
1872
|
-
return x;
|
|
1873
|
-
},
|
|
1874
2453
|
html: (_options$html = options.html) != null ? _options$html : StandardHtmlComponents
|
|
1875
2454
|
};
|
|
1876
2455
|
}
|
|
@@ -1886,7 +2465,7 @@ function createClassStyledRenderers() {
|
|
|
1886
2465
|
className: "control-array"
|
|
1887
2466
|
},
|
|
1888
2467
|
action: {
|
|
1889
|
-
|
|
2468
|
+
buttonClass: "action"
|
|
1890
2469
|
},
|
|
1891
2470
|
data: {
|
|
1892
2471
|
inputClass: "data"
|
|
@@ -1917,8 +2496,12 @@ var defaultTailwindTheme = {
|
|
|
1917
2496
|
},
|
|
1918
2497
|
group: {
|
|
1919
2498
|
standardClassName: "flex flex-col gap-4",
|
|
1920
|
-
|
|
2499
|
+
grid: {
|
|
2500
|
+
className: "flex flex-col gap-4",
|
|
2501
|
+
rowClass: "flex flex-row gap-4 justify-between *:flex-1"
|
|
2502
|
+
},
|
|
1921
2503
|
flexClassName: "gap-2",
|
|
2504
|
+
inlineClass: "",
|
|
1922
2505
|
tabs: {
|
|
1923
2506
|
className: "",
|
|
1924
2507
|
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",
|
|
@@ -1930,7 +2513,11 @@ var defaultTailwindTheme = {
|
|
|
1930
2513
|
}
|
|
1931
2514
|
},
|
|
1932
2515
|
action: {
|
|
1933
|
-
|
|
2516
|
+
buttonClass: "rounded-lg p-3 text-white disabled:opacity-75 disabled:cursor-not-allowed",
|
|
2517
|
+
primaryClass: "bg-primary-500",
|
|
2518
|
+
secondaryClass: "bg-secondary-500",
|
|
2519
|
+
iconBeforeClass: "px-2",
|
|
2520
|
+
iconAfterClass: "px-2"
|
|
1934
2521
|
},
|
|
1935
2522
|
layout: {
|
|
1936
2523
|
className: "flex flex-col",
|
|
@@ -1941,7 +2528,7 @@ var defaultTailwindTheme = {
|
|
|
1941
2528
|
displayOnlyClass: "flex flex-row items-center gap-2",
|
|
1942
2529
|
checkOptions: {
|
|
1943
2530
|
className: "flex items-center gap-4",
|
|
1944
|
-
entryClass: "flex gap-1
|
|
2531
|
+
entryClass: "flex items-center gap-1"
|
|
1945
2532
|
},
|
|
1946
2533
|
selectOptions: {
|
|
1947
2534
|
emptyText: "<select>"
|
|
@@ -1962,8 +2549,8 @@ var defaultTailwindTheme = {
|
|
|
1962
2549
|
accordion: {
|
|
1963
2550
|
className: "flex items-center gap-2 my-2",
|
|
1964
2551
|
titleClass: "cursor-pointer",
|
|
1965
|
-
|
|
1966
|
-
|
|
2552
|
+
iconOpen: schemas.fontAwesomeIcon("chevron-up"),
|
|
2553
|
+
iconClosed: schemas.fontAwesomeIcon("chevron-down")
|
|
1967
2554
|
},
|
|
1968
2555
|
optional: {
|
|
1969
2556
|
checkClass: "m-2",
|
|
@@ -1982,6 +2569,11 @@ exports.DefaultArrayRenderer = DefaultArrayRenderer;
|
|
|
1982
2569
|
exports.DefaultBoolOptions = DefaultBoolOptions;
|
|
1983
2570
|
exports.DefaultDisplay = DefaultDisplay;
|
|
1984
2571
|
exports.DefaultDisplayOnly = DefaultDisplayOnly;
|
|
2572
|
+
exports.DefaultHtmlButtonRenderer = DefaultHtmlButtonRenderer;
|
|
2573
|
+
exports.DefaultHtmlDivRenderer = DefaultHtmlDivRenderer;
|
|
2574
|
+
exports.DefaultHtmlIconRenderer = DefaultHtmlIconRenderer;
|
|
2575
|
+
exports.DefaultHtmlInputRenderer = DefaultHtmlInputRenderer;
|
|
2576
|
+
exports.DefaultHtmlLabelRenderer = DefaultHtmlLabelRenderer;
|
|
1985
2577
|
exports.DefaultLayout = DefaultLayout;
|
|
1986
2578
|
exports.DefaultVisibility = DefaultVisibility;
|
|
1987
2579
|
exports.Fcheckbox = Fcheckbox;
|
|
@@ -2005,6 +2597,7 @@ exports.createDefaultLabelRenderer = createDefaultLabelRenderer;
|
|
|
2005
2597
|
exports.createDefaultLayoutRenderer = createDefaultLayoutRenderer;
|
|
2006
2598
|
exports.createDefaultRenderers = createDefaultRenderers;
|
|
2007
2599
|
exports.createDefaultVisibilityRenderer = createDefaultVisibilityRenderer;
|
|
2600
|
+
exports.createElementSelectedRenderer = createElementSelectedRenderer;
|
|
2008
2601
|
exports.createInputConversion = createInputConversion;
|
|
2009
2602
|
exports.createJsonataRenderer = createJsonataRenderer;
|
|
2010
2603
|
exports.createNullToggleRenderer = createNullToggleRenderer;
|
|
@@ -2013,6 +2606,7 @@ exports.createRadioRenderer = createRadioRenderer;
|
|
|
2013
2606
|
exports.createSelectConversion = createSelectConversion;
|
|
2014
2607
|
exports.createSelectRenderer = createSelectRenderer;
|
|
2015
2608
|
exports.createValueForFieldRenderer = createValueForFieldRenderer;
|
|
2609
|
+
exports.createWizardRenderer = createWizardRenderer;
|
|
2016
2610
|
exports.defaultTailwindTheme = defaultTailwindTheme;
|
|
2017
2611
|
exports.getAccordionState = getAccordionState;
|
|
2018
2612
|
exports.setIncluded = setIncluded;
|