@react-typed-forms/schemas-html 4.1.1 → 5.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/adornments/optionalAdornment.d.ts +4 -25
- package/lib/components/ArrayElementRenderer.d.ts +1 -4
- package/lib/components/AutocompleteRenderer.d.ts +1 -7
- package/lib/components/CheckRenderer.d.ts +3 -29
- package/lib/components/ControlInput.d.ts +2 -1
- package/lib/components/DefaultAccordion.d.ts +13 -6
- package/lib/components/DefaultArrayRenderer.d.ts +2 -9
- package/lib/components/DefaultDialogRenderer.d.ts +3 -7
- package/lib/components/DefaultDisplay.d.ts +3 -6
- package/lib/components/DefaultDisplayOnly.d.ts +3 -3
- package/lib/components/DefaultGroupRenderer.d.ts +2 -16
- package/lib/components/DefaultLayout.d.ts +4 -8
- package/lib/components/DefaultVisibility.d.ts +1 -1
- package/lib/components/DefaultWizardRenderer.d.ts +1 -27
- package/lib/components/GridRenderer.d.ts +1 -5
- package/lib/components/HtmlCheckButtons.d.ts +3 -0
- package/lib/components/JsonataRenderer.d.ts +2 -1
- package/lib/components/MultilineTextfield.d.ts +2 -1
- package/lib/components/ScrollListRenderer.d.ts +2 -0
- package/lib/components/SelectDataRenderer.d.ts +3 -6
- package/lib/components/TabsRenderer.d.ts +1 -9
- package/lib/components/ValueForFieldRenderer.d.ts +2 -10
- package/lib/createButtonActionRenderer.d.ts +2 -20
- package/lib/createDefaultRenderers.d.ts +8 -83
- package/lib/index.cjs +727 -553
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +664 -478
- package/lib/index.js.map +1 -1
- package/lib/rendererOptions.d.ts +218 -0
- package/lib/tailwind.d.ts +14 -2
- package/package.json +9 -8
- package/lib/components/VisibleChildrenRenderer.d.ts +0 -14
package/lib/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
var react = require('react');
|
|
1
2
|
var clsx = require('clsx');
|
|
2
3
|
var schemas = require('@react-typed-forms/schemas');
|
|
3
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
5
|
var core = require('@react-typed-forms/core');
|
|
5
|
-
var react = require('react');
|
|
6
6
|
var ariaBase = require('@astroapps/aria-base');
|
|
7
7
|
var base = require('@mui/base');
|
|
8
8
|
var overlays = require('@react-stately/overlays');
|
|
@@ -94,6 +94,9 @@ function _extends() {
|
|
|
94
94
|
return n;
|
|
95
95
|
}, _extends.apply(null, arguments);
|
|
96
96
|
}
|
|
97
|
+
function _inheritsLoose(t, o) {
|
|
98
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
99
|
+
}
|
|
97
100
|
function _objectDestructuringEmpty(t) {
|
|
98
101
|
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
99
102
|
}
|
|
@@ -101,13 +104,18 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
101
104
|
if (null == r) return {};
|
|
102
105
|
var t = {};
|
|
103
106
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
104
|
-
if (e.
|
|
107
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
105
108
|
t[n] = r[n];
|
|
106
109
|
}
|
|
107
110
|
return t;
|
|
108
111
|
}
|
|
112
|
+
function _setPrototypeOf(t, e) {
|
|
113
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
114
|
+
return t.__proto__ = e, t;
|
|
115
|
+
}, _setPrototypeOf(t, e);
|
|
116
|
+
}
|
|
109
117
|
|
|
110
|
-
var _excluded$4 = ["control", "convert", "renderer"],
|
|
118
|
+
var _excluded$4 = ["control", "convert", "renderer", "errorId"],
|
|
111
119
|
_excluded2$2 = ["errorText", "value", "onChange", "ref"];
|
|
112
120
|
function ControlInput(_ref) {
|
|
113
121
|
var _effect = core.useComponentTracking();
|
|
@@ -118,6 +126,7 @@ function ControlInput(_ref) {
|
|
|
118
126
|
var control = _ref.control,
|
|
119
127
|
convert = _ref.convert,
|
|
120
128
|
renderer = _ref.renderer,
|
|
129
|
+
errorId = _ref.errorId,
|
|
121
130
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
122
131
|
var _formControlProps = core.formControlProps(control),
|
|
123
132
|
errorText = _formControlProps.errorText,
|
|
@@ -138,6 +147,8 @@ function ControlInput(_ref) {
|
|
|
138
147
|
inputRef: ref,
|
|
139
148
|
type: convert[0],
|
|
140
149
|
value: textValue.value,
|
|
150
|
+
"aria-describedby": !!errorText ? errorId : undefined,
|
|
151
|
+
"aria-invalid": !!errorText || undefined,
|
|
141
152
|
onChangeValue: function onChangeValue(e) {
|
|
142
153
|
textValue.value = e;
|
|
143
154
|
var converted = convert[1](e);
|
|
@@ -211,7 +222,8 @@ function createSelectRenderer(options) {
|
|
|
211
222
|
options = {};
|
|
212
223
|
}
|
|
213
224
|
return schemas.createDataRenderer(function (props, asArray) {
|
|
214
|
-
var _props$options;
|
|
225
|
+
var _props$options, _renderOptions$requir;
|
|
226
|
+
var renderOptions = props.definition.renderOptions;
|
|
215
227
|
return /*#__PURE__*/jsxRuntime.jsx(SelectDataRenderer, {
|
|
216
228
|
className: schemas.rendererClass(props.className, options.className),
|
|
217
229
|
state: props.control,
|
|
@@ -220,7 +232,7 @@ function createSelectRenderer(options) {
|
|
|
220
232
|
options: (_props$options = props.options) != null ? _props$options : [],
|
|
221
233
|
required: props.required,
|
|
222
234
|
emptyText: options.emptyText,
|
|
223
|
-
requiredText: options.requiredText,
|
|
235
|
+
requiredText: (_renderOptions$requir = renderOptions == null ? void 0 : renderOptions.requiredText) != null ? _renderOptions$requir : options.requiredText,
|
|
224
236
|
convert: createSelectConversion(props.field.type)
|
|
225
237
|
});
|
|
226
238
|
}, {
|
|
@@ -312,7 +324,7 @@ function createRadioRenderer(options) {
|
|
|
312
324
|
options = {};
|
|
313
325
|
}
|
|
314
326
|
return schemas.createDataRenderer(function (p, renderer) {
|
|
315
|
-
return /*#__PURE__*/jsxRuntime.jsx(CheckButtons, _extends({
|
|
327
|
+
return /*#__PURE__*/jsxRuntime.jsx(renderer.html.CheckButtons, _extends({
|
|
316
328
|
classes: options,
|
|
317
329
|
controlClasses: p.renderOptions
|
|
318
330
|
}, p, {
|
|
@@ -338,7 +350,7 @@ function createCheckListRenderer(options) {
|
|
|
338
350
|
options = {};
|
|
339
351
|
}
|
|
340
352
|
return schemas.createDataRenderer(function (p, renderer) {
|
|
341
|
-
return /*#__PURE__*/jsxRuntime.jsx(CheckButtons, _extends({
|
|
353
|
+
return /*#__PURE__*/jsxRuntime.jsx(renderer.html.CheckButtons, _extends({
|
|
342
354
|
classes: options,
|
|
343
355
|
controlClasses: p.renderOptions
|
|
344
356
|
}, p, {
|
|
@@ -350,7 +362,7 @@ function createCheckListRenderer(options) {
|
|
|
350
362
|
setChecked: function setChecked(c, o, checked) {
|
|
351
363
|
c.setTouched(true);
|
|
352
364
|
c.setValue(function (x) {
|
|
353
|
-
return setIncluded(x != null ? x : [], o.value, checked);
|
|
365
|
+
return schemas.setIncluded(x != null ? x : [], o.value, checked);
|
|
354
366
|
});
|
|
355
367
|
},
|
|
356
368
|
control: p.control,
|
|
@@ -363,85 +375,6 @@ function createCheckListRenderer(options) {
|
|
|
363
375
|
renderType: schemas.DataRenderType.CheckList
|
|
364
376
|
});
|
|
365
377
|
}
|
|
366
|
-
function CheckButtons(_ref) {
|
|
367
|
-
var _effect = core.useComponentTracking();
|
|
368
|
-
try {
|
|
369
|
-
var control = _ref.control,
|
|
370
|
-
options = _ref.options,
|
|
371
|
-
readonly = _ref.readonly,
|
|
372
|
-
className = _ref.className,
|
|
373
|
-
id = _ref.id,
|
|
374
|
-
type = _ref.type,
|
|
375
|
-
isChecked = _ref.isChecked,
|
|
376
|
-
setChecked = _ref.setChecked,
|
|
377
|
-
entryAdornment = _ref.entryAdornment,
|
|
378
|
-
classes = _ref.classes,
|
|
379
|
-
_ref$controlClasses = _ref.controlClasses,
|
|
380
|
-
controlClasses = _ref$controlClasses === void 0 ? {} : _ref$controlClasses,
|
|
381
|
-
renderer = _ref.renderer;
|
|
382
|
-
var _renderer$html = renderer.html,
|
|
383
|
-
Button = _renderer$html.Button,
|
|
384
|
-
Input = _renderer$html.Input,
|
|
385
|
-
Label = _renderer$html.Label,
|
|
386
|
-
Div = _renderer$html.Div;
|
|
387
|
-
var disabled = control.disabled;
|
|
388
|
-
var name = "r" + control.uniqueId;
|
|
389
|
-
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
390
|
-
className: className,
|
|
391
|
-
id: id,
|
|
392
|
-
children: /*#__PURE__*/jsxRuntime.jsx(core.RenderArrayElements, {
|
|
393
|
-
array: options == null ? void 0 : options.filter(function (x) {
|
|
394
|
-
return x.value != null;
|
|
395
|
-
}),
|
|
396
|
-
children: function children(o, i) {
|
|
397
|
-
var checked = core.useComputed(function () {
|
|
398
|
-
return isChecked(control, o);
|
|
399
|
-
}).value;
|
|
400
|
-
var selOrUnsel = checked ? schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.selectedClass, classes.selectedClass) : schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.notSelectedClass, classes.notSelectedClass);
|
|
401
|
-
return /*#__PURE__*/jsxRuntime.jsxs(Button, {
|
|
402
|
-
className: clsx__default["default"](schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
|
|
403
|
-
onClick: function onClick() {
|
|
404
|
-
return !readonly && setChecked(control, o, !checked);
|
|
405
|
-
},
|
|
406
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
407
|
-
className: classes.entryClass,
|
|
408
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
409
|
-
id: name + "_" + i,
|
|
410
|
-
className: classes.checkClass,
|
|
411
|
-
type: type,
|
|
412
|
-
name: name,
|
|
413
|
-
readOnly: readonly,
|
|
414
|
-
disabled: disabled,
|
|
415
|
-
checked: checked,
|
|
416
|
-
onChangeChecked: function onChangeChecked(x) {
|
|
417
|
-
!readonly && setChecked(control, o, x);
|
|
418
|
-
}
|
|
419
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
420
|
-
className: classes.labelClass,
|
|
421
|
-
htmlFor: name + "_" + i,
|
|
422
|
-
children: o.name
|
|
423
|
-
})]
|
|
424
|
-
}), entryAdornment == null ? void 0 : entryAdornment(o, i, checked)]
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
})
|
|
428
|
-
});
|
|
429
|
-
} finally {
|
|
430
|
-
_effect();
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
function setIncluded(array, elem, included) {
|
|
434
|
-
var already = array.includes(elem);
|
|
435
|
-
if (included === already) {
|
|
436
|
-
return array;
|
|
437
|
-
}
|
|
438
|
-
if (included) {
|
|
439
|
-
return [].concat(array, [elem]);
|
|
440
|
-
}
|
|
441
|
-
return array.filter(function (e) {
|
|
442
|
-
return e !== elem;
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
378
|
function createCheckboxRenderer(options) {
|
|
446
379
|
if (options === void 0) {
|
|
447
380
|
options = {};
|
|
@@ -482,35 +415,16 @@ function createElementSelectedRenderer(options) {
|
|
|
482
415
|
renderType: schemas.DataRenderType.ElementSelected
|
|
483
416
|
});
|
|
484
417
|
}
|
|
485
|
-
function CheckBoxSelected(
|
|
486
|
-
var
|
|
418
|
+
function CheckBoxSelected(_ref) {
|
|
419
|
+
var _effect = core.useComponentTracking();
|
|
487
420
|
try {
|
|
488
|
-
var
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
421
|
+
var _p$label;
|
|
422
|
+
var p = _ref.p,
|
|
423
|
+
props = _ref.props,
|
|
424
|
+
renderer = _ref.renderer,
|
|
425
|
+
options = _ref.options;
|
|
492
426
|
var Div = renderer.html.Div;
|
|
493
|
-
var
|
|
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
|
-
});
|
|
427
|
+
var selControl = schemas.useElementSelectedRenderer(props);
|
|
514
428
|
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
515
429
|
className: schemas.rendererClass(props.className, options.entryClass),
|
|
516
430
|
children: [/*#__PURE__*/jsxRuntime.jsx(Fcheckbox, {
|
|
@@ -519,19 +433,19 @@ function CheckBoxSelected(_ref2) {
|
|
|
519
433
|
style: props.style,
|
|
520
434
|
className: options.checkClass,
|
|
521
435
|
renderer: renderer
|
|
522
|
-
}), p.label && renderer.renderLabel(p.label, undefined, undefined)]
|
|
436
|
+
}), ((_p$label = p.label) == null ? void 0 : _p$label.label) && renderer.renderLabel(p.label, undefined, undefined)]
|
|
523
437
|
});
|
|
524
438
|
} finally {
|
|
525
|
-
|
|
439
|
+
_effect();
|
|
526
440
|
}
|
|
527
441
|
}
|
|
528
|
-
function CheckBox(
|
|
529
|
-
var
|
|
442
|
+
function CheckBox(_ref2) {
|
|
443
|
+
var _effect2 = core.useComponentTracking();
|
|
530
444
|
try {
|
|
531
|
-
var p =
|
|
532
|
-
props =
|
|
533
|
-
renderer =
|
|
534
|
-
options =
|
|
445
|
+
var p = _ref2.p,
|
|
446
|
+
props = _ref2.props,
|
|
447
|
+
renderer = _ref2.renderer,
|
|
448
|
+
options = _ref2.options;
|
|
535
449
|
var Div = renderer.html.Div;
|
|
536
450
|
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
537
451
|
className: schemas.rendererClass(props.className, options.entryClass),
|
|
@@ -544,19 +458,19 @@ function CheckBox(_ref3) {
|
|
|
544
458
|
}), p.label && renderer.renderLabel(p.label, undefined, undefined)]
|
|
545
459
|
});
|
|
546
460
|
} finally {
|
|
547
|
-
|
|
461
|
+
_effect2();
|
|
548
462
|
}
|
|
549
463
|
}
|
|
550
|
-
function Fcheckbox(
|
|
551
|
-
var
|
|
464
|
+
function Fcheckbox(_ref3) {
|
|
465
|
+
var _effect3 = core.useComponentTracking();
|
|
552
466
|
try {
|
|
553
|
-
var control =
|
|
554
|
-
|
|
555
|
-
type =
|
|
556
|
-
|
|
557
|
-
notValue =
|
|
558
|
-
renderer =
|
|
559
|
-
others = _objectWithoutPropertiesLoose(
|
|
467
|
+
var control = _ref3.control,
|
|
468
|
+
_ref3$type = _ref3.type,
|
|
469
|
+
type = _ref3$type === void 0 ? "checkbox" : _ref3$type,
|
|
470
|
+
_ref3$notValue = _ref3.notValue,
|
|
471
|
+
notValue = _ref3$notValue === void 0 ? false : _ref3$notValue,
|
|
472
|
+
renderer = _ref3.renderer,
|
|
473
|
+
others = _objectWithoutPropertiesLoose(_ref3, _excluded$2);
|
|
560
474
|
var Input = renderer.html.Input;
|
|
561
475
|
var _formControlProps = core.formControlProps(control),
|
|
562
476
|
value = _formControlProps.value,
|
|
@@ -576,7 +490,7 @@ function Fcheckbox(_ref4) {
|
|
|
576
490
|
type: type
|
|
577
491
|
}, others));
|
|
578
492
|
} finally {
|
|
579
|
-
|
|
493
|
+
_effect3();
|
|
580
494
|
}
|
|
581
495
|
}
|
|
582
496
|
|
|
@@ -609,9 +523,10 @@ function DefaultLayout(_ref) {
|
|
|
609
523
|
Div = _ref$renderer$html.Div,
|
|
610
524
|
Span = _ref$renderer$html.Span,
|
|
611
525
|
_ref$renderError = _ref.renderError,
|
|
612
|
-
renderError = _ref$renderError === void 0 ? function (e) {
|
|
526
|
+
renderError = _ref$renderError === void 0 ? function (e, errorId) {
|
|
613
527
|
return e && /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
614
528
|
children: /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
529
|
+
id: errorId,
|
|
615
530
|
className: errorClass,
|
|
616
531
|
children: e
|
|
617
532
|
})
|
|
@@ -622,11 +537,12 @@ function DefaultLayout(_ref) {
|
|
|
622
537
|
controlStart = _ref$layout.controlStart,
|
|
623
538
|
label = _ref$layout.label,
|
|
624
539
|
children = _ref$layout.children,
|
|
625
|
-
errorControl = _ref$layout.errorControl
|
|
540
|
+
errorControl = _ref$layout.errorControl,
|
|
541
|
+
errorId = _ref$layout.errorId;
|
|
626
542
|
var ec = errorControl;
|
|
627
543
|
var errorText = ec && ec.touched ? ec.error : undefined;
|
|
628
544
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
629
|
-
children: [label, controlStart, children, renderError(errorText), controlEnd]
|
|
545
|
+
children: [label, controlStart, children, renderError(errorText, errorId), controlEnd]
|
|
630
546
|
});
|
|
631
547
|
} finally {
|
|
632
548
|
_effect();
|
|
@@ -646,7 +562,8 @@ function DefaultDisplayOnly(_ref) {
|
|
|
646
562
|
textClass = _ref.textClass,
|
|
647
563
|
inline = _ref.inline,
|
|
648
564
|
state = _ref.state;
|
|
649
|
-
var
|
|
565
|
+
var display = state.resolved.display;
|
|
566
|
+
var text = display != null ? display : (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
|
|
650
567
|
var Div = renderer.html.Div;
|
|
651
568
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
652
569
|
style: style,
|
|
@@ -660,135 +577,24 @@ function DefaultDisplayOnly(_ref) {
|
|
|
660
577
|
}
|
|
661
578
|
}
|
|
662
579
|
|
|
663
|
-
function DefaultAccordion(_ref) {
|
|
664
|
-
var _effect = core.useComponentTracking();
|
|
665
|
-
try {
|
|
666
|
-
var _dataContext$dataNode;
|
|
667
|
-
var children = _ref.children,
|
|
668
|
-
accordion = _ref.accordion,
|
|
669
|
-
contentStyle = _ref.contentStyle,
|
|
670
|
-
contentClassName = _ref.contentClassName,
|
|
671
|
-
designMode = _ref.designMode,
|
|
672
|
-
iconOpen = _ref.iconOpen,
|
|
673
|
-
iconClosed = _ref.iconClosed,
|
|
674
|
-
className = _ref.className,
|
|
675
|
-
_ref$renderTitle = _ref.renderTitle,
|
|
676
|
-
renderTitle = _ref$renderTitle === void 0 ? function (t) {
|
|
677
|
-
return t;
|
|
678
|
-
} : _ref$renderTitle,
|
|
679
|
-
renderToggler = _ref.renderToggler,
|
|
680
|
-
renderers = _ref.renderers,
|
|
681
|
-
titleClass = _ref.titleClass,
|
|
682
|
-
useCss = _ref.useCss,
|
|
683
|
-
dataContext = _ref.dataContext;
|
|
684
|
-
var _renderers$html = renderers.html,
|
|
685
|
-
Button = _renderers$html.Button,
|
|
686
|
-
I = _renderers$html.I,
|
|
687
|
-
Div = _renderers$html.Div,
|
|
688
|
-
Label = _renderers$html.Label;
|
|
689
|
-
var dataControl = ((_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode).control;
|
|
690
|
-
var open = core.useControl(!!accordion.defaultExpanded);
|
|
691
|
-
if (dataControl && !dataControl.meta.accordionState) {
|
|
692
|
-
dataControl.meta.accordionState = open;
|
|
693
|
-
}
|
|
694
|
-
var isOpen = open.value;
|
|
695
|
-
var fullContentStyle = isOpen || designMode ? contentStyle : _extends({}, contentStyle, {
|
|
696
|
-
display: "none"
|
|
697
|
-
});
|
|
698
|
-
var title = renderers.renderLabelText(renderTitle(accordion.title, open));
|
|
699
|
-
var currentIcon = isOpen ? iconOpen : iconClosed;
|
|
700
|
-
var toggler = renderToggler ? renderToggler(open, title) : /*#__PURE__*/jsxRuntime.jsxs(Button, {
|
|
701
|
-
className: className,
|
|
702
|
-
onClick: function onClick() {
|
|
703
|
-
return open.setValue(function (x) {
|
|
704
|
-
return !x;
|
|
705
|
-
});
|
|
706
|
-
},
|
|
707
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
708
|
-
className: titleClass,
|
|
709
|
-
children: title
|
|
710
|
-
}), currentIcon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
711
|
-
iconLibrary: currentIcon.library,
|
|
712
|
-
iconName: currentIcon.name
|
|
713
|
-
})]
|
|
714
|
-
});
|
|
715
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
716
|
-
children: [toggler, (useCss || isOpen || designMode) && /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
717
|
-
style: fullContentStyle,
|
|
718
|
-
className: contentClassName,
|
|
719
|
-
children: children
|
|
720
|
-
})]
|
|
721
|
-
});
|
|
722
|
-
} finally {
|
|
723
|
-
_effect();
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
function getAccordionState(c) {
|
|
727
|
-
return c.meta.accordionState;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* @trackControls
|
|
732
|
-
*/
|
|
733
|
-
function VisibleChildrenRenderer(props) {
|
|
734
|
-
var _effect = core.useComponentTracking();
|
|
735
|
-
try {
|
|
736
|
-
var childStates = props.parentFormNode.getChildNodes().map(function (x) {
|
|
737
|
-
return props.parent.getChildState(x);
|
|
738
|
-
});
|
|
739
|
-
return props.render(props.props, function (i) {
|
|
740
|
-
return !childStates[i].hidden;
|
|
741
|
-
});
|
|
742
|
-
} finally {
|
|
743
|
-
_effect();
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
747
580
|
function createTabsRenderer(options) {
|
|
748
581
|
if (options === void 0) {
|
|
749
582
|
options = {};
|
|
750
583
|
}
|
|
751
584
|
return schemas.createGroupRenderer(function (p, renderer) {
|
|
752
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
parent: p,
|
|
757
|
-
props: {
|
|
758
|
-
groupProps: p,
|
|
759
|
-
tabOptions: p.renderOptions,
|
|
760
|
-
options: options
|
|
761
|
-
}
|
|
585
|
+
return /*#__PURE__*/jsxRuntime.jsx(TabsRenderer, {
|
|
586
|
+
groupProps: p,
|
|
587
|
+
tabOptions: p.renderOptions,
|
|
588
|
+
options: options
|
|
762
589
|
});
|
|
763
590
|
}, {
|
|
764
591
|
renderType: schemas.GroupRenderType.Tabs
|
|
765
592
|
});
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
formNode = _ref$groupProps.formNode,
|
|
772
|
-
className = _ref$groupProps.className,
|
|
773
|
-
renderChild = _ref$groupProps.renderChild,
|
|
774
|
-
state = _ref$groupProps.state,
|
|
775
|
-
tabOptions = _ref.tabOptions;
|
|
776
|
-
var tabIndex = state.meta.fields.tabIndex.as();
|
|
777
|
-
var tabClass = options.tabClass,
|
|
778
|
-
labelClass = options.labelClass,
|
|
779
|
-
tabListClass = options.tabListClass,
|
|
780
|
-
inactiveClass = options.inactiveClass,
|
|
781
|
-
activeClass = options.activeClass,
|
|
782
|
-
contentClass = options.contentClass;
|
|
783
|
-
var currentTab = (_tabIndex$value = tabIndex.value) != null ? _tabIndex$value : 0;
|
|
784
|
-
return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
785
|
-
children: formNode.getChildNodes().map(function (x, i) {
|
|
786
|
-
return renderTabs([x], i);
|
|
787
|
-
})
|
|
788
|
-
}) : renderTabs(formNode.getChildNodes().filter(function (x, i) {
|
|
789
|
-
return isVisible(i);
|
|
790
|
-
}), 0);
|
|
791
|
-
function renderTabs(tabs, key) {
|
|
593
|
+
}
|
|
594
|
+
function TabsRenderer(_ref) {
|
|
595
|
+
var _effect = core.useComponentTracking();
|
|
596
|
+
try {
|
|
597
|
+
var renderTabs = function renderTabs(tabs, key) {
|
|
792
598
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
793
599
|
className: schemas.rendererClass(className, options.className),
|
|
794
600
|
children: [/*#__PURE__*/jsxRuntime.jsx("ul", {
|
|
@@ -807,58 +613,116 @@ function createTabsRenderer(options) {
|
|
|
807
613
|
})
|
|
808
614
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
809
615
|
className: schemas.rendererClass(tabOptions.contentClass, contentClass),
|
|
810
|
-
children: renderChild(
|
|
616
|
+
children: renderChild(tabs[currentTab])
|
|
811
617
|
})]
|
|
812
618
|
}, key);
|
|
813
|
-
}
|
|
619
|
+
};
|
|
620
|
+
var options = _ref.options,
|
|
621
|
+
_ref$groupProps = _ref.groupProps,
|
|
622
|
+
designMode = _ref$groupProps.designMode,
|
|
623
|
+
formNode = _ref$groupProps.formNode,
|
|
624
|
+
className = _ref$groupProps.className,
|
|
625
|
+
renderChild = _ref$groupProps.renderChild,
|
|
626
|
+
tabOptions = _ref.tabOptions;
|
|
627
|
+
var tabIndex = core.useControl(0);
|
|
628
|
+
react.useEffect(function () {
|
|
629
|
+
formNode.attachUi(new TabUi(tabIndex, formNode));
|
|
630
|
+
}, [formNode, tabIndex]);
|
|
631
|
+
var tabClass = options.tabClass,
|
|
632
|
+
labelClass = options.labelClass,
|
|
633
|
+
tabListClass = options.tabListClass,
|
|
634
|
+
inactiveClass = options.inactiveClass,
|
|
635
|
+
activeClass = options.activeClass,
|
|
636
|
+
contentClass = options.contentClass;
|
|
637
|
+
var currentTab = tabIndex.value;
|
|
638
|
+
return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
639
|
+
children: formNode.children.map(function (x, i) {
|
|
640
|
+
return renderTabs([x], i);
|
|
641
|
+
})
|
|
642
|
+
}) : renderTabs(formNode.children.filter(function (x, i) {
|
|
643
|
+
return x.visible;
|
|
644
|
+
}), 0);
|
|
645
|
+
} finally {
|
|
646
|
+
_effect();
|
|
814
647
|
}
|
|
815
648
|
}
|
|
649
|
+
var TabUi = /*#__PURE__*/function (_DefaultFormNodeUi) {
|
|
650
|
+
function TabUi(tabIndex, node) {
|
|
651
|
+
var _this;
|
|
652
|
+
_this = _DefaultFormNodeUi.call(this, node) || this;
|
|
653
|
+
_this.tabIndex = void 0;
|
|
654
|
+
_this.tabIndex = tabIndex;
|
|
655
|
+
return _this;
|
|
656
|
+
}
|
|
657
|
+
_inheritsLoose(TabUi, _DefaultFormNodeUi);
|
|
658
|
+
var _proto = TabUi.prototype;
|
|
659
|
+
_proto.ensureChildVisible = function ensureChildVisible(childIndex) {
|
|
660
|
+
this.tabIndex.value = childIndex;
|
|
661
|
+
_DefaultFormNodeUi.prototype.ensureChildVisible.call(this, childIndex);
|
|
662
|
+
};
|
|
663
|
+
return TabUi;
|
|
664
|
+
}(schemas.DefaultFormNodeUi);
|
|
816
665
|
|
|
817
666
|
function createGridRenderer(options) {
|
|
818
667
|
return schemas.createGroupRenderer(function (props, formRenderer) {
|
|
819
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
}),
|
|
824
|
-
render: renderGrid,
|
|
825
|
-
parent: props,
|
|
826
|
-
dataContext: props.dataContext,
|
|
827
|
-
parentFormNode: props.formNode
|
|
668
|
+
return /*#__PURE__*/jsxRuntime.jsx(GridRenderer, {
|
|
669
|
+
groupProps: props,
|
|
670
|
+
formRenderer: formRenderer,
|
|
671
|
+
options: options
|
|
828
672
|
});
|
|
829
673
|
}, {
|
|
830
674
|
renderType: schemas.GroupRenderType.Grid
|
|
831
675
|
});
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
676
|
+
}
|
|
677
|
+
function GridRenderer(props) {
|
|
678
|
+
var _effect = core.useComponentTracking();
|
|
679
|
+
try {
|
|
680
|
+
var _props$options, _ref, _gridOptions$columns;
|
|
681
|
+
var _props$groupProps = props.groupProps,
|
|
682
|
+
formNode = _props$groupProps.formNode,
|
|
683
|
+
renderOptions = _props$groupProps.renderOptions,
|
|
684
|
+
renderChild = _props$groupProps.renderChild,
|
|
685
|
+
className = _props$groupProps.className;
|
|
686
|
+
var filteredChildren = formNode.children.filter(function (x, i) {
|
|
687
|
+
return x.visible;
|
|
836
688
|
});
|
|
837
689
|
var Div = props.formRenderer.html.Div;
|
|
838
|
-
var defaults = (_props$
|
|
839
|
-
var gridOptions =
|
|
690
|
+
var defaults = (_props$options = props.options) != null ? _props$options : {};
|
|
691
|
+
var gridOptions = renderOptions;
|
|
840
692
|
var numColumns = (_ref = (_gridOptions$columns = gridOptions.columns) != null ? _gridOptions$columns : defaults.defaultColumns) != null ? _ref : 2;
|
|
841
|
-
var allChildren = filteredChildren.map(function (x
|
|
842
|
-
return
|
|
693
|
+
var allChildren = filteredChildren.map(function (x) {
|
|
694
|
+
return renderChild(x);
|
|
843
695
|
});
|
|
696
|
+
var cellClass = gridOptions.cellClass ? getCellClassNames(gridOptions.cellClass) : getCellClassNames(defaults.cellClass);
|
|
844
697
|
// split into numColumns items wrapped a div each
|
|
845
698
|
var rows = [];
|
|
846
699
|
for (var i = 0; i < allChildren.length; i += numColumns) {
|
|
847
700
|
rows.push(allChildren.slice(i, i + numColumns));
|
|
848
701
|
}
|
|
849
702
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
850
|
-
className: schemas.rendererClass(
|
|
703
|
+
className: schemas.rendererClass(className, defaults.className),
|
|
851
704
|
children: rows.map(function (row, rowIndex) {
|
|
852
705
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
853
706
|
className: schemas.rendererClass(gridOptions.rowClass, defaults.rowClass),
|
|
854
|
-
children: row
|
|
707
|
+
children: row.map(function (cell, cellIndex) {
|
|
708
|
+
var _cellClass$at;
|
|
709
|
+
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
710
|
+
className: (_cellClass$at = cellClass == null ? void 0 : cellClass.at(cellIndex)) != null ? _cellClass$at : "flex-1",
|
|
711
|
+
children: cell
|
|
712
|
+
}, cellIndex);
|
|
713
|
+
})
|
|
855
714
|
}, rowIndex);
|
|
856
715
|
})
|
|
857
716
|
});
|
|
717
|
+
} finally {
|
|
718
|
+
_effect();
|
|
858
719
|
}
|
|
859
720
|
}
|
|
721
|
+
function getCellClassNames(cellClass) {
|
|
722
|
+
return cellClass == null ? void 0 : cellClass.split(",");
|
|
723
|
+
}
|
|
860
724
|
|
|
861
|
-
var defaultOptions = {
|
|
725
|
+
var defaultOptions$1 = {
|
|
862
726
|
classes: {
|
|
863
727
|
className: undefined,
|
|
864
728
|
contentClass: "min-h-96 overflow-auto",
|
|
@@ -890,136 +754,135 @@ function defaultNavigationRender(_ref) {
|
|
|
890
754
|
}
|
|
891
755
|
function createWizardRenderer(options) {
|
|
892
756
|
return schemas.createGroupRenderer(function (props, formRenderer) {
|
|
893
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
}),
|
|
898
|
-
render: renderWizard,
|
|
899
|
-
parent: props,
|
|
900
|
-
dataContext: props.dataContext,
|
|
901
|
-
parentFormNode: props.formNode
|
|
757
|
+
return /*#__PURE__*/jsxRuntime.jsx(WizardRenderer, {
|
|
758
|
+
groupProps: props,
|
|
759
|
+
formRenderer: formRenderer,
|
|
760
|
+
options: options
|
|
902
761
|
});
|
|
903
762
|
}, {
|
|
904
763
|
renderType: schemas.GroupRenderType.Wizard
|
|
905
764
|
});
|
|
906
765
|
}
|
|
907
|
-
function
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
nextIcon = _mergedOptions$action.nextIcon,
|
|
917
|
-
prevText = _mergedOptions$action.prevText,
|
|
918
|
-
prevIcon = _mergedOptions$action.prevIcon,
|
|
919
|
-
nextValidate = _mergedOptions$action.nextValidate,
|
|
920
|
-
prevValidate = _mergedOptions$action.prevValidate,
|
|
921
|
-
renderNavigation = mergedOptions.renderNavigation;
|
|
922
|
-
var Div = props.formRenderer.html.Div;
|
|
923
|
-
var children = props.formNode.getChildNodes();
|
|
924
|
-
var allVisible = children.map(function (_, i) {
|
|
925
|
-
return isChildVisible(i);
|
|
926
|
-
});
|
|
927
|
-
var page = core.useControl(0);
|
|
928
|
-
var currentPage = page.value;
|
|
929
|
-
var isValid = core.useComputed(function () {
|
|
930
|
-
return isPageValid();
|
|
931
|
-
});
|
|
932
|
-
var next = schemas.createAction("nav", function () {
|
|
933
|
-
return nav(1, nextValidate);
|
|
934
|
-
}, nextText, {
|
|
935
|
-
hidden: !props.designMode && nextVisibleInDirection(1) == null,
|
|
936
|
-
disabled: !isValid.value,
|
|
937
|
-
icon: nextIcon,
|
|
938
|
-
iconPlacement: schemas.IconPlacement.AfterText
|
|
939
|
-
});
|
|
940
|
-
var prev = schemas.createAction("nav", function () {
|
|
941
|
-
return nav(-1, prevValidate);
|
|
942
|
-
}, prevText, {
|
|
943
|
-
disabled: !props.designMode && nextVisibleInDirection(-1) == null,
|
|
944
|
-
icon: prevIcon
|
|
945
|
-
});
|
|
946
|
-
var navElement = renderNavigation({
|
|
947
|
-
formRenderer: props.formRenderer,
|
|
948
|
-
page: countVisibleUntil(currentPage),
|
|
949
|
-
totalPages: countVisibleUntil(children.length),
|
|
950
|
-
prev: prev,
|
|
951
|
-
next: next,
|
|
952
|
-
className: navContainerClass,
|
|
953
|
-
validatePage: function () {
|
|
954
|
-
try {
|
|
955
|
-
return Promise.resolve(_validatePage());
|
|
956
|
-
} catch (e) {
|
|
957
|
-
return Promise.reject(e);
|
|
766
|
+
function WizardRenderer(_ref2) {
|
|
767
|
+
var _effect = core.useComponentTracking();
|
|
768
|
+
try {
|
|
769
|
+
var countVisibleUntil = function countVisibleUntil(untilPage) {
|
|
770
|
+
var count = 0;
|
|
771
|
+
for (var i = 0; i < untilPage && i < childrenLength; i++) {
|
|
772
|
+
if (formNode.getChild(i).visible) {
|
|
773
|
+
count++;
|
|
774
|
+
}
|
|
958
775
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
})
|
|
965
|
-
}) : currentPage < children.length ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
966
|
-
className: contentClass,
|
|
967
|
-
children: props.renderChild(currentPage, children[currentPage])
|
|
968
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {});
|
|
969
|
-
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
970
|
-
className: schemas.rendererClass(props.className, className),
|
|
971
|
-
children: [content, navElement]
|
|
972
|
-
});
|
|
973
|
-
function countVisibleUntil(untilPage) {
|
|
974
|
-
var count = 0;
|
|
975
|
-
for (var i = 0; i < untilPage && i < allVisible.length; i++) {
|
|
976
|
-
if (allVisible[i]) {
|
|
977
|
-
count++;
|
|
776
|
+
return count;
|
|
777
|
+
};
|
|
778
|
+
var nav = function nav(dir, validate) {
|
|
779
|
+
if (validate && !_validatePage()) {
|
|
780
|
+
return;
|
|
978
781
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
function nav(dir, validate) {
|
|
983
|
-
if (validate && !_validatePage()) {
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
var next = nextVisibleInDirection(dir);
|
|
987
|
-
if (next != null) {
|
|
988
|
-
page.value = next;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
function nextVisibleInDirection(dir) {
|
|
992
|
-
var next = currentPage + dir;
|
|
993
|
-
while (next >= 0 && next < children.length) {
|
|
994
|
-
if (allVisible[next]) {
|
|
995
|
-
return next;
|
|
782
|
+
var next = nextVisibleInDirection(dir);
|
|
783
|
+
if (next != null) {
|
|
784
|
+
page.value = next;
|
|
996
785
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
786
|
+
};
|
|
787
|
+
var nextVisibleInDirection = function nextVisibleInDirection(dir) {
|
|
788
|
+
var next = currentPage + dir;
|
|
789
|
+
while (next >= 0 && next < childrenLength) {
|
|
790
|
+
if (formNode.getChild(next).visible) {
|
|
791
|
+
return next;
|
|
792
|
+
}
|
|
793
|
+
next += dir;
|
|
794
|
+
}
|
|
795
|
+
return null;
|
|
796
|
+
};
|
|
797
|
+
var _validatePage = function _validatePage() {
|
|
798
|
+
var pageNode = formNode.getChild(currentPage);
|
|
799
|
+
if (pageNode) {
|
|
800
|
+
var valid = pageNode.validate();
|
|
801
|
+
pageNode.setTouched(true);
|
|
802
|
+
return valid;
|
|
803
|
+
}
|
|
804
|
+
return false;
|
|
805
|
+
};
|
|
806
|
+
var isPageValid = function isPageValid() {
|
|
807
|
+
return formNode.getChild(currentPage).valid;
|
|
808
|
+
};
|
|
809
|
+
var props = _ref2.groupProps,
|
|
810
|
+
formRenderer = _ref2.formRenderer,
|
|
811
|
+
options = _ref2.options;
|
|
812
|
+
var mergedOptions = schemas.deepMerge(options != null ? options : {}, defaultOptions$1);
|
|
813
|
+
var _mergedOptions$classe = mergedOptions.classes,
|
|
814
|
+
className = _mergedOptions$classe.className,
|
|
815
|
+
contentClass = _mergedOptions$classe.contentClass,
|
|
816
|
+
navContainerClass = _mergedOptions$classe.navContainerClass,
|
|
817
|
+
_mergedOptions$action = mergedOptions.actions,
|
|
818
|
+
nextText = _mergedOptions$action.nextText,
|
|
819
|
+
nextIcon = _mergedOptions$action.nextIcon,
|
|
820
|
+
prevText = _mergedOptions$action.prevText,
|
|
821
|
+
prevIcon = _mergedOptions$action.prevIcon,
|
|
822
|
+
nextValidate = _mergedOptions$action.nextValidate,
|
|
823
|
+
prevValidate = _mergedOptions$action.prevValidate,
|
|
824
|
+
renderNavigation = mergedOptions.renderNavigation;
|
|
825
|
+
var formNode = props.formNode,
|
|
826
|
+
designMode = props.designMode,
|
|
827
|
+
renderChild = props.renderChild;
|
|
828
|
+
var Div = formRenderer.html.Div;
|
|
829
|
+
var childrenLength = formNode.getChildCount();
|
|
830
|
+
var page = core.useControl(0);
|
|
831
|
+
var currentPage = page.value;
|
|
832
|
+
var isValid = core.useComputed(function () {
|
|
833
|
+
return isPageValid();
|
|
834
|
+
});
|
|
835
|
+
var next = schemas.createAction("nav", function () {
|
|
836
|
+
return nav(1, nextValidate);
|
|
837
|
+
}, nextText, {
|
|
838
|
+
hidden: !designMode && nextVisibleInDirection(1) == null,
|
|
839
|
+
disabled: !isValid.value,
|
|
840
|
+
icon: nextIcon,
|
|
841
|
+
iconPlacement: schemas.IconPlacement.AfterText
|
|
1014
842
|
});
|
|
1015
|
-
|
|
843
|
+
var prev = schemas.createAction("nav", function () {
|
|
844
|
+
return nav(-1, prevValidate);
|
|
845
|
+
}, prevText, {
|
|
846
|
+
disabled: !designMode && nextVisibleInDirection(-1) == null,
|
|
847
|
+
icon: prevIcon
|
|
848
|
+
});
|
|
849
|
+
var navElement = renderNavigation({
|
|
850
|
+
formRenderer: formRenderer,
|
|
851
|
+
page: countVisibleUntil(currentPage),
|
|
852
|
+
totalPages: countVisibleUntil(childrenLength),
|
|
853
|
+
prev: prev,
|
|
854
|
+
next: next,
|
|
855
|
+
className: navContainerClass,
|
|
856
|
+
validatePage: function validatePage() {
|
|
857
|
+
try {
|
|
858
|
+
return Promise.resolve(_validatePage());
|
|
859
|
+
} catch (e) {
|
|
860
|
+
return Promise.reject(e);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
var content = designMode ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
865
|
+
children: formNode.children.map(function (child) {
|
|
866
|
+
return renderChild(child);
|
|
867
|
+
})
|
|
868
|
+
}) : currentPage < childrenLength ? /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
869
|
+
className: contentClass,
|
|
870
|
+
children: renderChild(formNode.getChild(currentPage))
|
|
871
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {});
|
|
872
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
873
|
+
className: schemas.rendererClass(props.className, className),
|
|
874
|
+
children: [content, navElement]
|
|
875
|
+
});
|
|
876
|
+
} finally {
|
|
877
|
+
_effect();
|
|
1016
878
|
}
|
|
1017
879
|
}
|
|
1018
880
|
|
|
1019
881
|
var defaultDialogOptions = {
|
|
1020
882
|
classes: {
|
|
1021
883
|
className: "",
|
|
1022
|
-
titleClass: "text-2xl font-bold"
|
|
884
|
+
titleClass: "text-2xl font-bold",
|
|
885
|
+
containerClass: "relative m-4 p-4 min-w-[400px] max-w-[80%] rounded-lg bg-white shadow-sm"
|
|
1023
886
|
}
|
|
1024
887
|
};
|
|
1025
888
|
function createDialogRenderer(options) {
|
|
@@ -1056,7 +919,8 @@ function DefaultDialogRenderer(_ref) {
|
|
|
1056
919
|
var _deepMerge = schemas.deepMerge(options, defaultDialogOptions),
|
|
1057
920
|
_deepMerge$classes = _deepMerge.classes,
|
|
1058
921
|
titleClass = _deepMerge$classes.titleClass,
|
|
1059
|
-
className = _deepMerge$classes.className
|
|
922
|
+
className = _deepMerge$classes.className,
|
|
923
|
+
containerClass = _deepMerge$classes.containerClass;
|
|
1060
924
|
var open = core.useControl(false);
|
|
1061
925
|
var overlayState = ariaBase.createOverlayState(open);
|
|
1062
926
|
var actionOnClick = function actionOnClick(action) {
|
|
@@ -1071,29 +935,31 @@ function DefaultDialogRenderer(_ref) {
|
|
|
1071
935
|
};
|
|
1072
936
|
}
|
|
1073
937
|
};
|
|
1074
|
-
var
|
|
938
|
+
var allChildren = props.formNode.children;
|
|
939
|
+
var triggerChildren = allChildren.filter(function (x) {
|
|
1075
940
|
return x.definition.placement === "trigger";
|
|
1076
941
|
});
|
|
1077
942
|
var dialogContent = /*#__PURE__*/jsxRuntime.jsx(ariaBase.Dialog, {
|
|
1078
943
|
title: renderOptions.title,
|
|
1079
944
|
titleClass: titleClass,
|
|
1080
945
|
className: schemas.rendererClass(props.className, className),
|
|
1081
|
-
children:
|
|
946
|
+
children: allChildren.filter(function (x) {
|
|
1082
947
|
return !x.definition.placement || x.definition.placement === "dialog";
|
|
1083
948
|
}).map(function (x, i) {
|
|
1084
|
-
return props.renderChild(
|
|
949
|
+
return props.renderChild(x, {
|
|
1085
950
|
actionOnClick: actionOnClick
|
|
1086
951
|
});
|
|
1087
952
|
})
|
|
1088
953
|
});
|
|
1089
954
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1090
955
|
children: [triggerChildren.map(function (x, i) {
|
|
1091
|
-
return props.renderChild(
|
|
956
|
+
return props.renderChild(x, {
|
|
1092
957
|
actionOnClick: actionOnClick
|
|
1093
958
|
});
|
|
1094
959
|
}), props.designMode ? designContent() : open.value && /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
|
|
1095
960
|
state: overlayState,
|
|
1096
961
|
isDismissable: true,
|
|
962
|
+
containerClass: containerClass,
|
|
1097
963
|
children: dialogContent
|
|
1098
964
|
})]
|
|
1099
965
|
});
|
|
@@ -1102,11 +968,152 @@ function DefaultDialogRenderer(_ref) {
|
|
|
1102
968
|
}
|
|
1103
969
|
}
|
|
1104
970
|
|
|
1105
|
-
function
|
|
971
|
+
function DefaultAccordion(_ref) {
|
|
972
|
+
var _effect = core.useComponentTracking();
|
|
973
|
+
try {
|
|
974
|
+
var _dataContext$dataNode;
|
|
975
|
+
var openCtrl = _ref.openCtrl,
|
|
976
|
+
children = _ref.children,
|
|
977
|
+
contentStyle = _ref.contentStyle,
|
|
978
|
+
className = _ref.className,
|
|
979
|
+
contentClassName = _ref.contentClassName,
|
|
980
|
+
designMode = _ref.designMode,
|
|
981
|
+
renderers = _ref.renderers,
|
|
982
|
+
dataContext = _ref.dataContext,
|
|
983
|
+
title = _ref.title,
|
|
984
|
+
options = _ref.options,
|
|
985
|
+
defaultExpanded = _ref.defaultExpanded,
|
|
986
|
+
isGroup = _ref.isGroup,
|
|
987
|
+
titleTextClass = _ref.titleTextClass;
|
|
988
|
+
var _ref2 = options != null ? options : {},
|
|
989
|
+
iconOpen = _ref2.iconOpen,
|
|
990
|
+
iconClosed = _ref2.iconClosed,
|
|
991
|
+
togglerClass = _ref2.togglerClass,
|
|
992
|
+
_ref2$renderTitle = _ref2.renderTitle,
|
|
993
|
+
renderTitle = _ref2$renderTitle === void 0 ? function (t) {
|
|
994
|
+
return t;
|
|
995
|
+
} : _ref2$renderTitle,
|
|
996
|
+
renderToggler = _ref2.renderToggler,
|
|
997
|
+
useCss = _ref2.useCss;
|
|
998
|
+
var panelId = react.useId();
|
|
999
|
+
var _renderers$html = renderers.html,
|
|
1000
|
+
Button = _renderers$html.Button,
|
|
1001
|
+
I = _renderers$html.I,
|
|
1002
|
+
Div = _renderers$html.Div,
|
|
1003
|
+
Label = _renderers$html.Label;
|
|
1004
|
+
var dataControl = ((_dataContext$dataNode = dataContext.dataNode) != null ? _dataContext$dataNode : dataContext.parentNode).control;
|
|
1005
|
+
var open = core.useControl(!!defaultExpanded, {
|
|
1006
|
+
use: openCtrl
|
|
1007
|
+
});
|
|
1008
|
+
if (dataControl && !dataControl.meta.accordionState) {
|
|
1009
|
+
dataControl.meta.accordionState = open;
|
|
1010
|
+
}
|
|
1011
|
+
var isOpen = open.value;
|
|
1012
|
+
var fullContentStyle = isOpen || designMode ? contentStyle : _extends({}, contentStyle, {
|
|
1013
|
+
display: "none"
|
|
1014
|
+
});
|
|
1015
|
+
var currentIcon = isOpen ? iconOpen : iconClosed;
|
|
1016
|
+
var accordionClassName = schemas.rendererClass(className, options == null ? void 0 : options.className);
|
|
1017
|
+
var accordionTitleTextClass = schemas.rendererClass(titleTextClass, options == null ? void 0 : options.titleTextClass);
|
|
1018
|
+
var accordionTitle = isGroup ? title : /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
1019
|
+
textClass: accordionTitleTextClass,
|
|
1020
|
+
children: title
|
|
1021
|
+
});
|
|
1022
|
+
var toggler = renderToggler ? renderToggler(open, renderTitle(title, open)) : /*#__PURE__*/jsxRuntime.jsxs(Button, {
|
|
1023
|
+
className: accordionClassName,
|
|
1024
|
+
notWrapInText: true,
|
|
1025
|
+
onClick: function onClick() {
|
|
1026
|
+
return open.setValue(function (x) {
|
|
1027
|
+
return !x;
|
|
1028
|
+
});
|
|
1029
|
+
},
|
|
1030
|
+
"aria-expanded": isOpen,
|
|
1031
|
+
"aria-controls": panelId,
|
|
1032
|
+
children: [accordionTitle, currentIcon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
1033
|
+
className: togglerClass,
|
|
1034
|
+
iconLibrary: currentIcon.library,
|
|
1035
|
+
iconName: currentIcon.name
|
|
1036
|
+
})]
|
|
1037
|
+
});
|
|
1038
|
+
// The content class name not currently used since if the content is wrapped in a group, the group will handle the styling
|
|
1039
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1040
|
+
children: [toggler, (useCss || isOpen || designMode) && /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1041
|
+
id: panelId,
|
|
1042
|
+
role: "region",
|
|
1043
|
+
style: fullContentStyle,
|
|
1044
|
+
className: contentClassName,
|
|
1045
|
+
children: children
|
|
1046
|
+
})]
|
|
1047
|
+
});
|
|
1048
|
+
} finally {
|
|
1049
|
+
_effect();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function getAccordionState(c) {
|
|
1053
|
+
return c.meta.accordionState;
|
|
1054
|
+
}
|
|
1055
|
+
function createAccordionGroupRenderer(options) {
|
|
1056
|
+
return schemas.createGroupRenderer(function (p, renderer) {
|
|
1057
|
+
return /*#__PURE__*/jsxRuntime.jsx(AccordionGroupRenderer, {
|
|
1058
|
+
groupProps: p,
|
|
1059
|
+
renderer: renderer,
|
|
1060
|
+
options: options
|
|
1061
|
+
});
|
|
1062
|
+
}, {
|
|
1063
|
+
renderType: schemas.GroupRenderType.Accordion
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function AccordionGroupRenderer(_ref3) {
|
|
1067
|
+
var _effect2 = core.useComponentTracking();
|
|
1068
|
+
try {
|
|
1069
|
+
var groupProps = _ref3.groupProps,
|
|
1070
|
+
renderer = _ref3.renderer,
|
|
1071
|
+
options = _ref3.options;
|
|
1072
|
+
var allChildren = groupProps.formNode.children;
|
|
1073
|
+
var titleChildren = allChildren.filter(function (x) {
|
|
1074
|
+
return x.definition.placement === "title";
|
|
1075
|
+
});
|
|
1076
|
+
var contentChildren = allChildren.filter(function (x) {
|
|
1077
|
+
return x.definition.placement !== "title";
|
|
1078
|
+
});
|
|
1079
|
+
var _groupProps$renderOpt = groupProps.renderOptions,
|
|
1080
|
+
expandStateField = _groupProps$renderOpt.expandStateField,
|
|
1081
|
+
defaultExpanded = _groupProps$renderOpt.defaultExpanded;
|
|
1082
|
+
var expandStateFieldNode = expandStateField ? schemas.schemaDataForFieldRef(expandStateField, groupProps.dataContext.parentNode) : null;
|
|
1083
|
+
var open = expandStateFieldNode == null ? void 0 : expandStateFieldNode.control.as();
|
|
1084
|
+
return /*#__PURE__*/jsxRuntime.jsx(DefaultAccordion, {
|
|
1085
|
+
openCtrl: open,
|
|
1086
|
+
isGroup: true,
|
|
1087
|
+
options: options,
|
|
1088
|
+
children: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1089
|
+
children: contentChildren.map(function (x) {
|
|
1090
|
+
return groupProps.renderChild(x);
|
|
1091
|
+
})
|
|
1092
|
+
}),
|
|
1093
|
+
title: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1094
|
+
children: titleChildren.map(function (x) {
|
|
1095
|
+
return groupProps.renderChild(x);
|
|
1096
|
+
})
|
|
1097
|
+
}),
|
|
1098
|
+
renderers: renderer,
|
|
1099
|
+
className: groupProps.className,
|
|
1100
|
+
dataContext: groupProps.dataContext,
|
|
1101
|
+
designMode: groupProps.designMode,
|
|
1102
|
+
defaultExpanded: defaultExpanded,
|
|
1103
|
+
contentStyle: groupProps.style
|
|
1104
|
+
});
|
|
1105
|
+
} finally {
|
|
1106
|
+
_effect2();
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
function createDefaultGroupRenderer(options, adornmentOptions) {
|
|
1111
|
+
var _options$accordion;
|
|
1106
1112
|
var gridRenderer = createGridRenderer(options == null ? void 0 : options.grid);
|
|
1107
1113
|
var tabsRenderer = createTabsRenderer(options == null ? void 0 : options.tabs);
|
|
1108
1114
|
var wizardRenderer = createWizardRenderer(options == null ? void 0 : options.wizard);
|
|
1109
1115
|
var dialogRenderer = createDialogRenderer(options == null ? void 0 : options.dialog);
|
|
1116
|
+
var accordionRenderer = createAccordionGroupRenderer((_options$accordion = options == null ? void 0 : options.accordion) != null ? _options$accordion : adornmentOptions == null ? void 0 : adornmentOptions.accordion);
|
|
1110
1117
|
var _ref = options != null ? options : {},
|
|
1111
1118
|
className = _ref.className,
|
|
1112
1119
|
standardClassName = _ref.standardClassName,
|
|
@@ -1131,10 +1138,14 @@ function createDefaultGroupRenderer(options) {
|
|
|
1131
1138
|
if (schemas.isGridRenderer(renderOptions)) return gridRenderer.render(props, renderer);
|
|
1132
1139
|
if (schemas.isWizardRenderer(renderOptions)) return wizardRenderer.render(props, renderer);
|
|
1133
1140
|
if (schemas.isDialogRenderer(renderOptions)) return dialogRenderer.render(props, renderer);
|
|
1141
|
+
if (schemas.isAccordionRenderer(renderOptions)) return accordionRenderer.render(props, renderer);
|
|
1134
1142
|
if (schemas.isSelectChildRenderer(renderOptions) && !props.designMode) {
|
|
1135
|
-
return /*#__PURE__*/jsxRuntime.jsx(SelectChildGroupRenderer,
|
|
1136
|
-
|
|
1137
|
-
|
|
1143
|
+
return /*#__PURE__*/jsxRuntime.jsx(SelectChildGroupRenderer, {
|
|
1144
|
+
props: _extends({}, props, {
|
|
1145
|
+
renderOptions: renderOptions
|
|
1146
|
+
}),
|
|
1147
|
+
renderer: renderer
|
|
1148
|
+
});
|
|
1138
1149
|
}
|
|
1139
1150
|
var _ref2 = schemas.isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : schemas.isInlineRenderer(renderOptions) ? {
|
|
1140
1151
|
className: inlineClass
|
|
@@ -1145,8 +1156,8 @@ function createDefaultGroupRenderer(options) {
|
|
|
1145
1156
|
gcn = _ref2.className;
|
|
1146
1157
|
var Div = renderer.html.Div;
|
|
1147
1158
|
var inline = renderOptions.type == schemas.GroupRenderType.Inline;
|
|
1148
|
-
var children = formNode.
|
|
1149
|
-
return renderChild(
|
|
1159
|
+
var children = formNode.children.map(function (c, i) {
|
|
1160
|
+
return renderChild(c, {
|
|
1150
1161
|
inline: inline
|
|
1151
1162
|
});
|
|
1152
1163
|
});
|
|
@@ -1162,8 +1173,8 @@ function createDefaultGroupRenderer(options) {
|
|
|
1162
1173
|
if (props.renderOptions.type === schemas.GroupRenderType.Contents) {
|
|
1163
1174
|
var formNode = props.formNode,
|
|
1164
1175
|
renderChild = props.renderChild;
|
|
1165
|
-
var children = formNode.
|
|
1166
|
-
return renderChild(
|
|
1176
|
+
var children = formNode.children.map(function (c) {
|
|
1177
|
+
return renderChild(c);
|
|
1167
1178
|
});
|
|
1168
1179
|
return function (layout) {
|
|
1169
1180
|
return _extends({}, layout, {
|
|
@@ -1179,18 +1190,21 @@ function createDefaultGroupRenderer(options) {
|
|
|
1179
1190
|
render: renderLayout
|
|
1180
1191
|
};
|
|
1181
1192
|
}
|
|
1182
|
-
function SelectChildGroupRenderer(
|
|
1193
|
+
function SelectChildGroupRenderer(_ref3) {
|
|
1183
1194
|
var _effect = core.useComponentTracking();
|
|
1184
1195
|
try {
|
|
1196
|
+
var props = _ref3.props,
|
|
1197
|
+
renderer = _ref3.renderer;
|
|
1198
|
+
var Div = renderer.html.Div;
|
|
1185
1199
|
var runExpression = props.runExpression,
|
|
1186
1200
|
renderOptions = props.renderOptions;
|
|
1187
1201
|
var ctrl = schemas.useExpression(undefined, runExpression, renderOptions == null ? void 0 : renderOptions.childIndexExpression, function (x) {
|
|
1188
1202
|
return typeof x == "string" ? parseInt(x) : x;
|
|
1189
1203
|
});
|
|
1190
1204
|
var childIndex = ctrl == null ? void 0 : ctrl.value;
|
|
1191
|
-
var
|
|
1192
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
1193
|
-
children: typeof childIndex === "number" && childIndex <
|
|
1205
|
+
var childCount = props.formNode.getChildCount();
|
|
1206
|
+
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1207
|
+
children: typeof childIndex === "number" && childIndex < childCount && childIndex >= 0 && props.renderChild(props.formNode.getChild(childIndex))
|
|
1194
1208
|
});
|
|
1195
1209
|
} finally {
|
|
1196
1210
|
_effect();
|
|
@@ -1263,15 +1277,14 @@ function JsonataRenderer(_ref) {
|
|
|
1263
1277
|
dataContext = _ref.dataContext,
|
|
1264
1278
|
dataNode = _ref.dataNode,
|
|
1265
1279
|
runExpression = _ref.runExpression;
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
value: control.value,
|
|
1280
|
+
var bindings = function bindings(changes) {
|
|
1281
|
+
return {
|
|
1282
|
+
value: core.trackedValue(control, changes),
|
|
1270
1283
|
readonly: readonly,
|
|
1271
1284
|
disabled: control.disabled,
|
|
1272
1285
|
dataPath: schemas.getJsonPath(dataNode)
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1286
|
+
};
|
|
1287
|
+
};
|
|
1275
1288
|
var rendered = schemas.useExpression("", runExpression, {
|
|
1276
1289
|
type: schemas.ExpressionType.Jsonata,
|
|
1277
1290
|
expression: renderOptions.expression
|
|
@@ -1329,11 +1342,6 @@ function createDefaultArrayDataRenderer(defaultActions) {
|
|
|
1329
1342
|
function DataArrayRenderer(_ref) {
|
|
1330
1343
|
var _effect = core.useComponentTracking();
|
|
1331
1344
|
try {
|
|
1332
|
-
var renderChildElement = function renderChildElement(i, elementNode) {
|
|
1333
|
-
return renderChild(elementNode.control.uniqueId, childNode, {
|
|
1334
|
-
parentDataNode: elementNode
|
|
1335
|
-
});
|
|
1336
|
-
};
|
|
1337
1345
|
var dataProps = _ref.dataProps,
|
|
1338
1346
|
renderers = _ref.renderers,
|
|
1339
1347
|
defaultActions = _ref.defaultActions;
|
|
@@ -1348,36 +1356,18 @@ function DataArrayRenderer(_ref) {
|
|
|
1348
1356
|
className = dataProps.className,
|
|
1349
1357
|
style = dataProps.style,
|
|
1350
1358
|
dataContext = dataProps.dataContext,
|
|
1351
|
-
formNode = dataProps.formNode
|
|
1352
|
-
getChildState = dataProps.getChildState;
|
|
1359
|
+
formNode = dataProps.formNode;
|
|
1353
1360
|
var _mergeObjects = schemas.mergeObjects(schemas.isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions),
|
|
1354
1361
|
addText = _mergeObjects.addText,
|
|
1355
1362
|
noAdd = _mergeObjects.noAdd,
|
|
1356
1363
|
noRemove = _mergeObjects.noRemove,
|
|
1357
1364
|
noReorder = _mergeObjects.noReorder,
|
|
1358
1365
|
removeText = _mergeObjects.removeText,
|
|
1359
|
-
editExternal = _mergeObjects.editExternal
|
|
1360
|
-
|
|
1361
|
-
var
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
field: ".",
|
|
1365
|
-
renderOptions: {
|
|
1366
|
-
type: schemas.DataRenderType.Standard
|
|
1367
|
-
},
|
|
1368
|
-
hideTitle: true
|
|
1369
|
-
};
|
|
1370
|
-
var childDef = {
|
|
1371
|
-
type: schemas.ControlDefinitionType.Group,
|
|
1372
|
-
groupOptions: {
|
|
1373
|
-
type: schemas.GroupRenderType.Standard,
|
|
1374
|
-
hideTitle: true
|
|
1375
|
-
},
|
|
1376
|
-
children: renderAsElement && childDefs.length == 0 ? [defaultChildDef] : childDefs
|
|
1377
|
-
};
|
|
1378
|
-
var childNode = formNode.createChildNode("child", childDef);
|
|
1379
|
-
var childNodes = childNode.getChildNodes();
|
|
1380
|
-
var arrayProps = _extends({}, schemas.createArrayActions(control.as(), field, {
|
|
1366
|
+
editExternal = _mergeObjects.editExternal,
|
|
1367
|
+
childOverrideClass = _mergeObjects.childOverrideClass;
|
|
1368
|
+
var arrayProps = _extends({}, schemas.createArrayActions(control.as(), function () {
|
|
1369
|
+
return formNode.getChildCount();
|
|
1370
|
+
}, field, {
|
|
1381
1371
|
addText: addText,
|
|
1382
1372
|
removeText: removeText,
|
|
1383
1373
|
noAdd: noAdd,
|
|
@@ -1387,19 +1377,11 @@ function DataArrayRenderer(_ref) {
|
|
|
1387
1377
|
designMode: designMode,
|
|
1388
1378
|
editExternal: editExternal
|
|
1389
1379
|
}), {
|
|
1380
|
+
childOverrideClass: childOverrideClass,
|
|
1390
1381
|
required: required,
|
|
1391
1382
|
renderElement: function renderElement(i, wrap) {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
renderChildElement: renderChildElement,
|
|
1395
|
-
dataContext: dataContext,
|
|
1396
|
-
wrap: wrap,
|
|
1397
|
-
isChildHidden: function isChildHidden(dataNode) {
|
|
1398
|
-
return childNodes.every(function (x) {
|
|
1399
|
-
return getChildState(x, dataNode).hidden;
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
});
|
|
1383
|
+
var n = formNode.getChild(i);
|
|
1384
|
+
return !n || !n.visible ? undefined : wrap(n.childKey, renderChild(n));
|
|
1403
1385
|
},
|
|
1404
1386
|
className: className ? className : undefined,
|
|
1405
1387
|
style: style
|
|
@@ -1409,29 +1391,11 @@ function DataArrayRenderer(_ref) {
|
|
|
1409
1391
|
_effect();
|
|
1410
1392
|
}
|
|
1411
1393
|
}
|
|
1412
|
-
/**
|
|
1413
|
-
* @trackControls
|
|
1414
|
-
*/
|
|
1415
|
-
function RenderEntry(_ref2) {
|
|
1416
|
-
var _effect2 = core.useComponentTracking();
|
|
1417
|
-
try {
|
|
1418
|
-
var i = _ref2.index,
|
|
1419
|
-
renderChildElement = _ref2.renderChildElement,
|
|
1420
|
-
wrap = _ref2.wrap,
|
|
1421
|
-
isChildHidden = _ref2.isChildHidden,
|
|
1422
|
-
dataContext = _ref2.dataContext;
|
|
1423
|
-
var elementNode = dataContext.dataNode.getChildElement(i);
|
|
1424
|
-
if (isChildHidden(elementNode)) return undefined;
|
|
1425
|
-
return wrap(renderChildElement(i, elementNode));
|
|
1426
|
-
} finally {
|
|
1427
|
-
_effect2();
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
1394
|
function createDefaultArrayRenderer(options) {
|
|
1431
1395
|
return {
|
|
1432
|
-
render: function render(props,
|
|
1433
|
-
var renderAction =
|
|
1434
|
-
html =
|
|
1396
|
+
render: function render(props, _ref2) {
|
|
1397
|
+
var renderAction = _ref2.renderAction,
|
|
1398
|
+
html = _ref2.html;
|
|
1435
1399
|
return /*#__PURE__*/jsxRuntime.jsx(DefaultArrayRenderer, _extends({}, props, options, {
|
|
1436
1400
|
renderAction: renderAction,
|
|
1437
1401
|
html: html
|
|
@@ -1441,16 +1405,17 @@ function createDefaultArrayRenderer(options) {
|
|
|
1441
1405
|
};
|
|
1442
1406
|
}
|
|
1443
1407
|
function DefaultArrayRenderer(props) {
|
|
1444
|
-
var
|
|
1408
|
+
var _effect2 = core.useComponentTracking();
|
|
1445
1409
|
try {
|
|
1446
1410
|
var renderElement = props.renderElement,
|
|
1447
1411
|
className = props.className,
|
|
1448
1412
|
removableClass = props.removableClass,
|
|
1449
1413
|
childClass = props.childClass,
|
|
1450
1414
|
removableChildClass = props.removableChildClass,
|
|
1415
|
+
childOverrideClass = props.childOverrideClass,
|
|
1451
1416
|
removeActionClass = props.removeActionClass,
|
|
1452
1417
|
addActionClass = props.addActionClass,
|
|
1453
|
-
|
|
1418
|
+
getElementCount = props.getElementCount,
|
|
1454
1419
|
renderAction = props.renderAction,
|
|
1455
1420
|
style = props.style,
|
|
1456
1421
|
editAction = props.editAction,
|
|
@@ -1462,24 +1427,27 @@ function DefaultArrayRenderer(props) {
|
|
|
1462
1427
|
style: style,
|
|
1463
1428
|
children: [/*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1464
1429
|
className: clsx__default["default"](className, removeAction && removableClass),
|
|
1465
|
-
children:
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1430
|
+
children: Array.from({
|
|
1431
|
+
length: getElementCount()
|
|
1432
|
+
}, function (_, x) {
|
|
1433
|
+
return /*#__PURE__*/jsxRuntime.jsx(core.RenderControl, {
|
|
1434
|
+
render: function render() {
|
|
1435
|
+
return renderElement(x, function (key, children) {
|
|
1436
|
+
return removeAction || editAction ? /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
1437
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1438
|
+
className: clsx__default["default"](schemas.rendererClass(childOverrideClass, childClass), removableChildClass),
|
|
1439
|
+
children: children
|
|
1440
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Div, {
|
|
1441
|
+
className: removeActionClass,
|
|
1442
|
+
children: [editAction && renderAction(editAction(x)), removeAction && renderAction(removeAction(x))]
|
|
1443
|
+
})]
|
|
1444
|
+
}, key) : /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1445
|
+
className: schemas.rendererClass(childOverrideClass, childClass),
|
|
1472
1446
|
children: children
|
|
1473
|
-
}
|
|
1474
|
-
className: removeActionClass,
|
|
1475
|
-
children: [editAction && renderAction(editAction(x)), removeAction && renderAction(removeAction(x))]
|
|
1476
|
-
})]
|
|
1477
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1478
|
-
className: childClass,
|
|
1479
|
-
children: children
|
|
1447
|
+
}, key);
|
|
1480
1448
|
});
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1449
|
+
}
|
|
1450
|
+
}, x);
|
|
1483
1451
|
})
|
|
1484
1452
|
}), addAction && /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
1485
1453
|
className: addActionClass,
|
|
@@ -1487,7 +1455,7 @@ function DefaultArrayRenderer(props) {
|
|
|
1487
1455
|
})]
|
|
1488
1456
|
});
|
|
1489
1457
|
} finally {
|
|
1490
|
-
|
|
1458
|
+
_effect2();
|
|
1491
1459
|
}
|
|
1492
1460
|
}
|
|
1493
1461
|
|
|
@@ -1809,14 +1777,18 @@ function ValueForField(_ref) {
|
|
|
1809
1777
|
hideTitle: true
|
|
1810
1778
|
});
|
|
1811
1779
|
var rootSchema = schemas.createSchemaTree([adjustedField]).rootNode;
|
|
1812
|
-
return [control, rootSchema];
|
|
1780
|
+
return [schemas.createFormTree([control]), rootSchema];
|
|
1813
1781
|
}, [schemaField]),
|
|
1814
1782
|
controls = _useMemo[0],
|
|
1815
1783
|
rootSchema = _useMemo[1];
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1784
|
+
return /*#__PURE__*/jsxRuntime.jsx(schemas.RenderForm, {
|
|
1785
|
+
form: controls.rootNode,
|
|
1786
|
+
renderer: renderer,
|
|
1787
|
+
data: schemas.createSchemaDataNode(rootSchema, value),
|
|
1788
|
+
options: {
|
|
1789
|
+
disabled: control.disabled
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1820
1792
|
} finally {
|
|
1821
1793
|
_effect();
|
|
1822
1794
|
}
|
|
@@ -1839,7 +1811,7 @@ function createOptionalAdornment(options) {
|
|
|
1839
1811
|
return {
|
|
1840
1812
|
apply: function apply(rl) {
|
|
1841
1813
|
var _ref, _adornment$placement;
|
|
1842
|
-
if (props.
|
|
1814
|
+
if (props.formNode.readonly) return rl;
|
|
1843
1815
|
if (!options.hideEdit && adornment.editSelectable) schemas.appendMarkupAt((_ref = (_adornment$placement = adornment.placement) != null ? _adornment$placement : options.defaultPlacement) != null ? _ref : schemas.AdornmentPlacement.LabelStart, /*#__PURE__*/jsxRuntime.jsx(core.Fcheckbox, {
|
|
1844
1816
|
control: editing,
|
|
1845
1817
|
className: options.checkClass
|
|
@@ -1940,6 +1912,17 @@ function MultilineTextfield(_ref) {
|
|
|
1940
1912
|
}
|
|
1941
1913
|
}
|
|
1942
1914
|
|
|
1915
|
+
// ============================================================================
|
|
1916
|
+
// ADDITIONAL CONSTANTS
|
|
1917
|
+
// ============================================================================
|
|
1918
|
+
var DefaultBoolOptions = [{
|
|
1919
|
+
name: "Yes",
|
|
1920
|
+
value: true
|
|
1921
|
+
}, {
|
|
1922
|
+
name: "No",
|
|
1923
|
+
value: false
|
|
1924
|
+
}];
|
|
1925
|
+
|
|
1943
1926
|
function createArrayElementRenderer(options) {
|
|
1944
1927
|
if (options === void 0) {
|
|
1945
1928
|
options = {};
|
|
@@ -1975,11 +1958,16 @@ function ArrayElementRenderer(_ref) {
|
|
|
1975
1958
|
});
|
|
1976
1959
|
if (designMode || extData.value !== undefined) {
|
|
1977
1960
|
var runValidation = function runValidation(onClick) {
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1961
|
+
// TODO
|
|
1962
|
+
// let hasErrors = false;
|
|
1963
|
+
// visitFormDataInContext(
|
|
1964
|
+
// parentDataNode,
|
|
1965
|
+
// elementGroup,
|
|
1966
|
+
// validationVisitor(() => {
|
|
1967
|
+
// hasErrors = true;
|
|
1968
|
+
// }),
|
|
1969
|
+
// );
|
|
1970
|
+
// if (!hasErrors) onClick();
|
|
1983
1971
|
};
|
|
1984
1972
|
var applyValidation = function applyValidation(_ref2) {
|
|
1985
1973
|
var action = _ref2.action,
|
|
@@ -1991,19 +1979,15 @@ function ArrayElementRenderer(_ref) {
|
|
|
1991
1979
|
});
|
|
1992
1980
|
};
|
|
1993
1981
|
var parentDataNode = schemas.makeSchemaDataNode(dataProps.dataNode.schema, extData.fields.data);
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
});
|
|
2002
|
-
var editContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1982
|
+
// TODO
|
|
1983
|
+
// const elementGroup: FormNode = formNode.createChildNode("group", {
|
|
1984
|
+
// type: ControlDefinitionType.Group,
|
|
1985
|
+
// groupOptions: { type: GroupRenderType.Standard, hideTitle: true },
|
|
1986
|
+
// children: formNode.getResolvedChildren(),
|
|
1987
|
+
// } as GroupedControlsDefinition);
|
|
1988
|
+
var editContent = /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2003
1989
|
className: schemas.rendererClass(dataProps.className, options.className),
|
|
2004
|
-
children:
|
|
2005
|
-
parentDataNode: parentDataNode
|
|
2006
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1990
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2007
1991
|
className: options.actionsClass,
|
|
2008
1992
|
children: /*#__PURE__*/jsxRuntime.jsx(core.RenderElements, {
|
|
2009
1993
|
control: extData.fields.actions,
|
|
@@ -2011,7 +1995,7 @@ function ArrayElementRenderer(_ref) {
|
|
|
2011
1995
|
return formRenderer.renderAction(applyValidation(c.value));
|
|
2012
1996
|
}
|
|
2013
1997
|
})
|
|
2014
|
-
})
|
|
1998
|
+
})
|
|
2015
1999
|
});
|
|
2016
2000
|
if (renderOptions.showInline || designMode) return editContent;
|
|
2017
2001
|
return /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
|
|
@@ -2031,7 +2015,7 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
2031
2015
|
options = {};
|
|
2032
2016
|
}
|
|
2033
2017
|
return schemas.createActionRenderer(actionId, function (props, renderer) {
|
|
2034
|
-
var _props$icon, _ref, _props$iconPlacement, _options$renderConten;
|
|
2018
|
+
var _props$icon, _ref, _props$iconPlacement, _ref2, _props$iconPlacement2, _options$renderConten;
|
|
2035
2019
|
var key = props.key,
|
|
2036
2020
|
onClick = props.onClick,
|
|
2037
2021
|
actionText = props.actionText,
|
|
@@ -2043,9 +2027,14 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
2043
2027
|
textClass = props.textClass,
|
|
2044
2028
|
actionStyle = props.actionStyle,
|
|
2045
2029
|
inline = props.inline,
|
|
2046
|
-
actionContent = props.actionContent
|
|
2047
|
-
|
|
2048
|
-
var
|
|
2030
|
+
actionContent = props.actionContent,
|
|
2031
|
+
busy = props.busy;
|
|
2032
|
+
var busyIcon = props.busy ? options.busyIcon : undefined;
|
|
2033
|
+
var stdIcon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
|
|
2034
|
+
var icon = busyIcon != null ? busyIcon : stdIcon;
|
|
2035
|
+
var stdIconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : schemas.IconPlacement.BeforeText;
|
|
2036
|
+
var busyPlacement = (_ref2 = (_props$iconPlacement2 = props.iconPlacement) != null ? _props$iconPlacement2 : options.busyIconPlacement) != null ? _ref2 : schemas.IconPlacement.ReplaceText;
|
|
2037
|
+
var iconPlacement = busyIcon ? busyPlacement : stdIconPlacement;
|
|
2049
2038
|
var _renderer$html = renderer.html,
|
|
2050
2039
|
Button = _renderer$html.Button,
|
|
2051
2040
|
I = _renderer$html.I,
|
|
@@ -2053,12 +2042,12 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
2053
2042
|
var isLink = actionStyle == schemas.ActionStyle.Link;
|
|
2054
2043
|
var isGroup = actionStyle == schemas.ActionStyle.Group;
|
|
2055
2044
|
var classNames = schemas.rendererClass(className, isLink ? options.linkClass : isGroup ? options.groupClass : schemas.rendererClass(options.buttonClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryClass : options.primaryClass));
|
|
2045
|
+
var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
|
|
2056
2046
|
var iconElement = icon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
2057
2047
|
iconName: icon.name,
|
|
2058
2048
|
iconLibrary: icon.library,
|
|
2059
|
-
className: iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass
|
|
2049
|
+
className: schemas.rendererClass(textClassNames, iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
|
|
2060
2050
|
});
|
|
2061
|
-
var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
|
|
2062
2051
|
var textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
2063
2052
|
className: textClassNames,
|
|
2064
2053
|
children: actionText
|
|
@@ -2074,24 +2063,189 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
2074
2063
|
title: iconPlacement == schemas.IconPlacement.ReplaceText ? actionText : undefined,
|
|
2075
2064
|
notWrapInText: options.notWrapInText,
|
|
2076
2065
|
androidRippleColor: options.androidRippleColor,
|
|
2077
|
-
children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2066
|
+
children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData, busy)) != null ? _options$renderConten : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2078
2067
|
children: [iconPlacement == schemas.IconPlacement.BeforeText && iconElement, iconPlacement != schemas.IconPlacement.ReplaceText && textElement, iconPlacement != schemas.IconPlacement.BeforeText && iconElement]
|
|
2079
2068
|
})
|
|
2080
2069
|
}, key);
|
|
2081
2070
|
});
|
|
2082
2071
|
}
|
|
2083
2072
|
|
|
2073
|
+
var defaultOptions = {
|
|
2074
|
+
spinnerClass: "flex justify-center my-6",
|
|
2075
|
+
className: "flex flex-row",
|
|
2076
|
+
loadingIcon: undefined,
|
|
2077
|
+
iconClass: "text-[36px]"
|
|
2078
|
+
};
|
|
2079
|
+
function createScrollListRenderer(options) {
|
|
2080
|
+
return schemas.createDataRenderer(function (p, renderer) {
|
|
2081
|
+
return /*#__PURE__*/jsxRuntime.jsx(ScrollListRenderer, {
|
|
2082
|
+
dataProps: p,
|
|
2083
|
+
renderer: renderer,
|
|
2084
|
+
options: options
|
|
2085
|
+
});
|
|
2086
|
+
}, {
|
|
2087
|
+
collection: true,
|
|
2088
|
+
renderType: schemas.DataRenderType.ScrollList
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
function ScrollListRenderer(_ref) {
|
|
2092
|
+
var _effect = core.useComponentTracking();
|
|
2093
|
+
try {
|
|
2094
|
+
var spinner = function spinner() {
|
|
2095
|
+
return loadingControl.value && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2096
|
+
className: spinnerClass,
|
|
2097
|
+
ref: function ref(e) {
|
|
2098
|
+
return e == null ? void 0 : e.scrollIntoView({
|
|
2099
|
+
behavior: "smooth"
|
|
2100
|
+
});
|
|
2101
|
+
},
|
|
2102
|
+
children: /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
2103
|
+
iconName: loadingIcon.name,
|
|
2104
|
+
iconLibrary: loadingIcon.library,
|
|
2105
|
+
className: iconClass
|
|
2106
|
+
})
|
|
2107
|
+
});
|
|
2108
|
+
};
|
|
2109
|
+
var _ref$dataProps = _ref.dataProps,
|
|
2110
|
+
formNode = _ref$dataProps.formNode,
|
|
2111
|
+
renderChild = _ref$dataProps.renderChild,
|
|
2112
|
+
dataNode = _ref$dataProps.dataNode,
|
|
2113
|
+
actionOnClick = _ref$dataProps.actionOnClick,
|
|
2114
|
+
renderOptions = _ref$dataProps.renderOptions,
|
|
2115
|
+
dataContext = _ref$dataProps.dataContext,
|
|
2116
|
+
className = _ref$dataProps.className,
|
|
2117
|
+
renderer = _ref.renderer,
|
|
2118
|
+
options = _ref.options;
|
|
2119
|
+
var bottomActionId = renderOptions.bottomActionId;
|
|
2120
|
+
var loadingControl = schemas.getLoadingControl(dataNode.control);
|
|
2121
|
+
var hasMoreControl = schemas.getHasMoreControl(dataNode.control);
|
|
2122
|
+
var handler = bottomActionId ? actionOnClick == null ? void 0 : actionOnClick(bottomActionId, undefined, dataContext) : undefined;
|
|
2123
|
+
var I = renderer.html.I;
|
|
2124
|
+
var _deepMerge = schemas.deepMerge(options, defaultOptions),
|
|
2125
|
+
loadingIcon = _deepMerge.loadingIcon,
|
|
2126
|
+
spinnerClass = _deepMerge.spinnerClass,
|
|
2127
|
+
iconClass = _deepMerge.iconClass;
|
|
2128
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2129
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2130
|
+
className: schemas.rendererClass(className, options == null ? void 0 : options.className),
|
|
2131
|
+
children: formNode.children.map(function (x) {
|
|
2132
|
+
return renderChild(x);
|
|
2133
|
+
})
|
|
2134
|
+
}), (loadingIcon == null ? void 0 : loadingIcon.name) && /*#__PURE__*/jsxRuntime.jsx(core.RenderControl, {
|
|
2135
|
+
render: spinner
|
|
2136
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ScrollTrigger, {
|
|
2137
|
+
hasMoreControl: hasMoreControl,
|
|
2138
|
+
loadingControl: loadingControl,
|
|
2139
|
+
fetchMore: function fetchMore() {
|
|
2140
|
+
return handler == null ? void 0 : handler(schemas.NoOpControlActionContext);
|
|
2141
|
+
}
|
|
2142
|
+
})]
|
|
2143
|
+
});
|
|
2144
|
+
} finally {
|
|
2145
|
+
_effect();
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
function ScrollTrigger(_ref2) {
|
|
2149
|
+
var _effect2 = core.useComponentTracking();
|
|
2150
|
+
try {
|
|
2151
|
+
var hasMoreControl = _ref2.hasMoreControl,
|
|
2152
|
+
loadingControl = _ref2.loadingControl,
|
|
2153
|
+
fetchMore = _ref2.fetchMore;
|
|
2154
|
+
var observerTarget = react.useRef(null);
|
|
2155
|
+
var hasMore = hasMoreControl.value;
|
|
2156
|
+
var loading = loadingControl.value;
|
|
2157
|
+
react.useEffect(function () {
|
|
2158
|
+
var observer = new IntersectionObserver(function (entries) {
|
|
2159
|
+
if (entries[0].isIntersecting && hasMore && !loading) {
|
|
2160
|
+
fetchMore();
|
|
2161
|
+
}
|
|
2162
|
+
}, {
|
|
2163
|
+
threshold: 0.5
|
|
2164
|
+
}); // Trigger when 50% of the target is visible
|
|
2165
|
+
if (observerTarget.current) {
|
|
2166
|
+
observer.observe(observerTarget.current);
|
|
2167
|
+
}
|
|
2168
|
+
return function () {
|
|
2169
|
+
if (observerTarget.current) {
|
|
2170
|
+
observer.unobserve(observerTarget.current);
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
}, [hasMore, loading]); // Re-run effect if hasMore or loading state changes
|
|
2174
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2175
|
+
ref: observerTarget,
|
|
2176
|
+
style: {
|
|
2177
|
+
height: "1px"
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
} finally {
|
|
2181
|
+
_effect2();
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
function HtmlCheckButtons(props) {
|
|
2186
|
+
var _effect = core.useComponentTracking();
|
|
2187
|
+
try {
|
|
2188
|
+
var control = props.control,
|
|
2189
|
+
options = props.options,
|
|
2190
|
+
readonly = props.readonly,
|
|
2191
|
+
className = props.className,
|
|
2192
|
+
id = props.id,
|
|
2193
|
+
type = props.type,
|
|
2194
|
+
isChecked = props.isChecked,
|
|
2195
|
+
setChecked = props.setChecked,
|
|
2196
|
+
entryAdornment = props.entryAdornment,
|
|
2197
|
+
classes = props.classes,
|
|
2198
|
+
_props$controlClasses = props.controlClasses,
|
|
2199
|
+
controlClasses = _props$controlClasses === void 0 ? {} : _props$controlClasses;
|
|
2200
|
+
var disabled = control.disabled;
|
|
2201
|
+
var name = "r" + control.uniqueId;
|
|
2202
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2203
|
+
role: "group",
|
|
2204
|
+
className: className,
|
|
2205
|
+
id: id,
|
|
2206
|
+
children: /*#__PURE__*/jsxRuntime.jsx(core.RenderArrayElements, {
|
|
2207
|
+
array: options == null ? void 0 : options.filter(function (x) {
|
|
2208
|
+
return x.value != null;
|
|
2209
|
+
}),
|
|
2210
|
+
children: function children(o, i) {
|
|
2211
|
+
var checked = core.useComputed(function () {
|
|
2212
|
+
return isChecked(control, o);
|
|
2213
|
+
}).value;
|
|
2214
|
+
var selOrUnsel = checked ? schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.selectedClass, classes.selectedClass) : schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.notSelectedClass, classes.notSelectedClass);
|
|
2215
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2216
|
+
className: clsx.clsx(schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
|
|
2217
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2218
|
+
className: classes.entryClass,
|
|
2219
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("input", {
|
|
2220
|
+
id: name + "_" + i,
|
|
2221
|
+
className: classes.checkClass,
|
|
2222
|
+
type: type,
|
|
2223
|
+
name: name,
|
|
2224
|
+
readOnly: readonly,
|
|
2225
|
+
disabled: disabled,
|
|
2226
|
+
checked: checked,
|
|
2227
|
+
onChange: function onChange(x) {
|
|
2228
|
+
!readonly && setChecked(control, o, x.target.checked);
|
|
2229
|
+
}
|
|
2230
|
+
}), /*#__PURE__*/jsxRuntime.jsx("label", {
|
|
2231
|
+
className: classes.labelClass,
|
|
2232
|
+
htmlFor: name + "_" + i,
|
|
2233
|
+
children: o.name
|
|
2234
|
+
})]
|
|
2235
|
+
}), entryAdornment == null ? void 0 : entryAdornment(o, i, checked)]
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
})
|
|
2239
|
+
});
|
|
2240
|
+
} finally {
|
|
2241
|
+
_effect();
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2084
2245
|
var _excluded = ["inline", "textClass", "className", "notWrapInText", "androidRippleColor", "onClick", "nonTextContent"],
|
|
2085
2246
|
_excluded2 = ["textClass", "className", "onChangeValue", "onChangeChecked", "inputRef"],
|
|
2086
2247
|
_excluded3 = ["text", "html", "children", "className", "textClass", "nativeRef", "inline"],
|
|
2087
2248
|
_excluded4 = ["textClass", "className"];
|
|
2088
|
-
var DefaultBoolOptions = [{
|
|
2089
|
-
name: "Yes",
|
|
2090
|
-
value: true
|
|
2091
|
-
}, {
|
|
2092
|
-
name: "No",
|
|
2093
|
-
value: false
|
|
2094
|
-
}];
|
|
2095
2249
|
function createDefaultDataRenderer(options) {
|
|
2096
2250
|
var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
|
|
2097
2251
|
if (options === void 0) {
|
|
@@ -2118,16 +2272,17 @@ function createDefaultDataRenderer(options) {
|
|
|
2118
2272
|
defaultEmptyText = _optionRenderer$boole.defaultEmptyText;
|
|
2119
2273
|
var arrayRenderer = createDefaultArrayDataRenderer(options.arrayOptions);
|
|
2120
2274
|
var autocompleteRenderer = createAutocompleteRenderer(options.autocompleteOptions);
|
|
2275
|
+
var scrollListRenderer = createScrollListRenderer(options.scrollListOptions);
|
|
2121
2276
|
return schemas.createDataRenderer(function (props, renderers) {
|
|
2122
2277
|
var field = props.field;
|
|
2123
2278
|
var fieldType = field.type;
|
|
2124
2279
|
var renderOptions = props.renderOptions;
|
|
2125
|
-
var renderType = renderOptions.type;
|
|
2280
|
+
var renderType = renderOptions.type ? renderOptions.type : schemas.DataRenderType.Standard;
|
|
2126
2281
|
if (field.collection && props.dataNode.elementIndex == null && (renderType == schemas.DataRenderType.Standard || renderType == schemas.DataRenderType.Array || renderType == schemas.DataRenderType.ArrayElement)) {
|
|
2127
2282
|
if (renderType == schemas.DataRenderType.ArrayElement) return arrayElementRenderer.render(props, renderers);
|
|
2128
2283
|
return arrayRenderer.render(props, renderers);
|
|
2129
2284
|
}
|
|
2130
|
-
if (fieldType === schemas.FieldType.Compound) {
|
|
2285
|
+
if (fieldType === schemas.FieldType.Compound && (schemas.isDataGroupRenderer(renderOptions) || renderType === schemas.DataRenderType.Standard)) {
|
|
2131
2286
|
var _ref;
|
|
2132
2287
|
var groupOptions = (_ref = schemas.isDataGroupRenderer(renderOptions) ? renderOptions.groupOptions : undefined) != null ? _ref : {
|
|
2133
2288
|
type: "Standard",
|
|
@@ -2142,7 +2297,7 @@ function createDefaultDataRenderer(options) {
|
|
|
2142
2297
|
className: "@ " + schemas.rendererClass(p.className, displayOnlyClass),
|
|
2143
2298
|
children: /*#__PURE__*/jsxRuntime.jsx(DefaultDisplayOnly, {
|
|
2144
2299
|
dataNode: props.dataNode,
|
|
2145
|
-
state: props.
|
|
2300
|
+
state: props.formNode,
|
|
2146
2301
|
schemaInterface: props.dataContext.schemaInterface,
|
|
2147
2302
|
className: props.className,
|
|
2148
2303
|
textClass: props.textClass,
|
|
@@ -2167,6 +2322,8 @@ function createDefaultDataRenderer(options) {
|
|
|
2167
2322
|
return nullToggler.render(props, renderers);
|
|
2168
2323
|
case schemas.DataRenderType.CheckList:
|
|
2169
2324
|
return checkListRenderer.render(props, renderers);
|
|
2325
|
+
case schemas.DataRenderType.ScrollList:
|
|
2326
|
+
return scrollListRenderer.render(props, renderers);
|
|
2170
2327
|
case schemas.DataRenderType.Dropdown:
|
|
2171
2328
|
return selectRenderer.render(props, renderers);
|
|
2172
2329
|
case schemas.DataRenderType.Radio:
|
|
@@ -2193,6 +2350,7 @@ function createDefaultDataRenderer(options) {
|
|
|
2193
2350
|
textClass: schemas.rendererClass(props.textClass, inputTextClass),
|
|
2194
2351
|
style: props.style,
|
|
2195
2352
|
id: props.id,
|
|
2353
|
+
errorId: props.errorId,
|
|
2196
2354
|
readOnly: props.readonly,
|
|
2197
2355
|
control: props.control,
|
|
2198
2356
|
placeholder: placeholder != null ? placeholder : undefined,
|
|
@@ -2241,15 +2399,22 @@ function createDefaultAdornmentRenderer(options) {
|
|
|
2241
2399
|
}
|
|
2242
2400
|
if (schemas.isAccordionAdornment(adornment)) {
|
|
2243
2401
|
return schemas.wrapLayout(function (x) {
|
|
2244
|
-
|
|
2402
|
+
var _rl$children$props;
|
|
2403
|
+
var displayProps = /*#__PURE__*/react.isValidElement(rl.children) ? (_rl$children$props = rl.children.props) == null ? void 0 : _rl$children$props.displayProps : undefined;
|
|
2404
|
+
return /*#__PURE__*/jsxRuntime.jsx(DefaultAccordion, {
|
|
2405
|
+
isGroup: false,
|
|
2245
2406
|
renderers: renderers,
|
|
2246
2407
|
children: x,
|
|
2247
|
-
|
|
2408
|
+
className: displayProps == null ? void 0 : displayProps.className,
|
|
2409
|
+
titleTextClass: displayProps == null ? void 0 : displayProps.textClass,
|
|
2410
|
+
title: renderers.renderLabelText(adornment.title),
|
|
2411
|
+
defaultExpanded: adornment.defaultExpanded,
|
|
2248
2412
|
contentStyle: rl.style,
|
|
2249
2413
|
contentClassName: rl.className,
|
|
2250
2414
|
designMode: designMode,
|
|
2251
|
-
dataContext: dataContext
|
|
2252
|
-
|
|
2415
|
+
dataContext: dataContext,
|
|
2416
|
+
options: options.accordion
|
|
2417
|
+
});
|
|
2253
2418
|
})(rl);
|
|
2254
2419
|
}
|
|
2255
2420
|
},
|
|
@@ -2328,7 +2493,8 @@ var StandardHtmlComponents = {
|
|
|
2328
2493
|
Div: DefaultHtmlDivRenderer,
|
|
2329
2494
|
H1: "h1",
|
|
2330
2495
|
B: "b",
|
|
2331
|
-
Input: DefaultHtmlInputRenderer
|
|
2496
|
+
Input: DefaultHtmlInputRenderer,
|
|
2497
|
+
CheckButtons: HtmlCheckButtons
|
|
2332
2498
|
};
|
|
2333
2499
|
function DefaultHtmlButtonRenderer(_ref5) {
|
|
2334
2500
|
var _effect = core.useComponentTracking();
|
|
@@ -2341,9 +2507,9 @@ function DefaultHtmlButtonRenderer(_ref5) {
|
|
|
2341
2507
|
onClick = _ref5.onClick,
|
|
2342
2508
|
nonTextContent = _ref5.nonTextContent,
|
|
2343
2509
|
props = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
2344
|
-
var Comp = nonTextContent ? "div" : "button";
|
|
2510
|
+
var Comp = inline ? "span" : nonTextContent ? "div" : "button";
|
|
2345
2511
|
return /*#__PURE__*/jsxRuntime.jsx(Comp, _extends({
|
|
2346
|
-
role: nonTextContent ? "button" : undefined,
|
|
2512
|
+
role: nonTextContent || inline ? "button" : undefined,
|
|
2347
2513
|
onClick: onClick ? function (e) {
|
|
2348
2514
|
e.stopPropagation();
|
|
2349
2515
|
onClick();
|
|
@@ -2422,8 +2588,11 @@ function DefaultHtmlIconRenderer(_ref9) {
|
|
|
2422
2588
|
switch (iconLibrary) {
|
|
2423
2589
|
case schemas.IconLibrary.FontAwesome:
|
|
2424
2590
|
return "fa fa-" + iconName;
|
|
2425
|
-
|
|
2591
|
+
case schemas.IconLibrary.Material:
|
|
2592
|
+
case schemas.IconLibrary.CssClass:
|
|
2426
2593
|
return iconName;
|
|
2594
|
+
default:
|
|
2595
|
+
return iconLibrary + " fa-" + iconName;
|
|
2427
2596
|
}
|
|
2428
2597
|
};
|
|
2429
2598
|
var iconName = _ref9.iconName,
|
|
@@ -2448,7 +2617,7 @@ function createDefaultRenderers(options) {
|
|
|
2448
2617
|
display: createDefaultDisplayRenderer(options.display),
|
|
2449
2618
|
action: createButtonActionRenderer(undefined, options.action),
|
|
2450
2619
|
array: createDefaultArrayRenderer(options.array),
|
|
2451
|
-
group: createDefaultGroupRenderer(options.group),
|
|
2620
|
+
group: createDefaultGroupRenderer(options.group, options.adornment),
|
|
2452
2621
|
label: createDefaultLabelRenderer(options.label),
|
|
2453
2622
|
adornment: createDefaultAdornmentRenderer(options.adornment),
|
|
2454
2623
|
renderLayout: createDefaultLayoutRenderer(options.layout),
|
|
@@ -2502,7 +2671,8 @@ var defaultTailwindTheme = {
|
|
|
2502
2671
|
standardClassName: "flex flex-col gap-4",
|
|
2503
2672
|
grid: {
|
|
2504
2673
|
className: "flex flex-col gap-4",
|
|
2505
|
-
rowClass: "flex flex-row gap-4 justify-between
|
|
2674
|
+
rowClass: "flex flex-row gap-4 justify-between",
|
|
2675
|
+
cellClass: "flex-1"
|
|
2506
2676
|
},
|
|
2507
2677
|
flexClassName: "gap-2",
|
|
2508
2678
|
inlineClass: "",
|
|
@@ -2521,7 +2691,8 @@ var defaultTailwindTheme = {
|
|
|
2521
2691
|
primaryClass: "bg-primary-500",
|
|
2522
2692
|
secondaryClass: "bg-secondary-500",
|
|
2523
2693
|
iconBeforeClass: "px-2",
|
|
2524
|
-
iconAfterClass: "px-2"
|
|
2694
|
+
iconAfterClass: "px-2",
|
|
2695
|
+
busyIcon: schemas.fontAwesomeIcon("spinner fa-spin")
|
|
2525
2696
|
},
|
|
2526
2697
|
layout: {
|
|
2527
2698
|
className: "flex flex-col",
|
|
@@ -2547,12 +2718,15 @@ var defaultTailwindTheme = {
|
|
|
2547
2718
|
listEntryClass: "list-none p-2 rounded-lg cursor-default last-of-type:border-b-0 hover:cursor-pointer hover:bg-primary-100 aria-selected:bg-primary-200 aria-selected:text-primary-900 focused:bg-surface-100 focus-visible:bg-surface-100 focused:text-surface-900 focus-visible:text-surface-900 focus-visible:shadow-[0_0_0_3px_transparent] focus-visible:shadow-primary-200 focused:aria-selected:bg-primary-200 focus-visible:aria-selected:bg-primary-200 focused:aria-selected:text-primary-900 focus-visible:aria-selected:text-primary-900",
|
|
2548
2719
|
chipContainerClass: "flex flex-row items-center px-3 py-1 rounded-full bg-surface-100 m-1 gap-2 truncate",
|
|
2549
2720
|
chipCloseButtonClass: "fa-solid fa-xmark p-1 bg-surface-300 rounded-full min-w-[24px] flex justify-center text-surface-50 hover:bg-surface-400 hover:text-surface-100 hover:cursor-pointer"
|
|
2721
|
+
},
|
|
2722
|
+
scrollListOptions: {
|
|
2723
|
+
loadingIcon: schemas.fontAwesomeIcon("spinner fa-spin")
|
|
2550
2724
|
}
|
|
2551
2725
|
},
|
|
2552
2726
|
adornment: {
|
|
2553
2727
|
accordion: {
|
|
2554
|
-
className: "flex items-center gap-2 my-2",
|
|
2555
|
-
|
|
2728
|
+
className: "flex items-center gap-2 my-2 w-fit",
|
|
2729
|
+
titleTextClass: "cursor-pointer",
|
|
2556
2730
|
iconOpen: schemas.fontAwesomeIcon("chevron-up"),
|
|
2557
2731
|
iconClosed: schemas.fontAwesomeIcon("chevron-down")
|
|
2558
2732
|
},
|
|
@@ -2565,7 +2739,6 @@ var defaultTailwindTheme = {
|
|
|
2565
2739
|
}
|
|
2566
2740
|
};
|
|
2567
2741
|
|
|
2568
|
-
exports.CheckButtons = CheckButtons;
|
|
2569
2742
|
exports.ControlInput = ControlInput;
|
|
2570
2743
|
exports.DataArrayRenderer = DataArrayRenderer;
|
|
2571
2744
|
exports.DefaultAccordion = DefaultAccordion;
|
|
@@ -2586,6 +2759,7 @@ exports.OptionalEditRenderer = OptionalEditRenderer;
|
|
|
2586
2759
|
exports.SelectDataRenderer = SelectDataRenderer;
|
|
2587
2760
|
exports.StandardHtmlComponents = StandardHtmlComponents;
|
|
2588
2761
|
exports.ValueForFieldExtension = ValueForFieldExtension;
|
|
2762
|
+
exports.createAccordionGroupRenderer = createAccordionGroupRenderer;
|
|
2589
2763
|
exports.createAutocompleteRenderer = createAutocompleteRenderer;
|
|
2590
2764
|
exports.createButtonActionRenderer = createButtonActionRenderer;
|
|
2591
2765
|
exports.createCheckListRenderer = createCheckListRenderer;
|
|
@@ -2607,11 +2781,11 @@ exports.createJsonataRenderer = createJsonataRenderer;
|
|
|
2607
2781
|
exports.createNullToggleRenderer = createNullToggleRenderer;
|
|
2608
2782
|
exports.createOptionalAdornment = createOptionalAdornment;
|
|
2609
2783
|
exports.createRadioRenderer = createRadioRenderer;
|
|
2784
|
+
exports.createScrollListRenderer = createScrollListRenderer;
|
|
2610
2785
|
exports.createSelectConversion = createSelectConversion;
|
|
2611
2786
|
exports.createSelectRenderer = createSelectRenderer;
|
|
2612
2787
|
exports.createValueForFieldRenderer = createValueForFieldRenderer;
|
|
2613
2788
|
exports.createWizardRenderer = createWizardRenderer;
|
|
2614
2789
|
exports.defaultTailwindTheme = defaultTailwindTheme;
|
|
2615
2790
|
exports.getAccordionState = getAccordionState;
|
|
2616
|
-
exports.setIncluded = setIncluded;
|
|
2617
2791
|
//# sourceMappingURL=index.cjs.map
|