@react-typed-forms/schemas-html 3.1.0 → 4.0.1

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/index.js CHANGED
@@ -1,82 +1,68 @@
1
1
  import clsx from 'clsx';
2
- import { DisplayDataType, rendererClass, coerceToString, getOverrideClass, FieldType, createDataRenderer, fieldOptionAdornment, DataRenderType, createLayoutRenderer, renderLayoutParts, createGroupRenderer, GroupRenderType, isTabsRenderer, isSelectChildRenderer, isGridRenderer, isFlexRenderer, createVisibilityRenderer, getJsonPath, useJsonataExpression, getRootDataNode, getLastDefinedValue, getNullToggler, mergeObjects, isArrayRenderer, isCompoundField, ControlDefinitionType, makeHookDepString, createArrayActions, getLengthRestrictions, lookupDataNode, applyArrayLengthRestrictions, buildSchema, stringField, schemaDataForFieldRef, schemaForFieldRef, rootSchemaNode, addMissingControlsForSchema, useControlRendererComponent, groupedControl, makeSchemaDataNode, createAdornmentRenderer, getIsEditing, appendMarkupAt, AdornmentPlacement, wrapMarkup, getAllValues, ControlAdornmentType, getExternalEditData, visitFormDataInContext, validationVisitor, createActionRenderer, isDataGroupRenderer, isDisplayOnlyRenderer, hasOptions, isTextfieldRenderer, isOptionalAdornment, isSetFieldAdornment, useDynamicHooks, wrapLayout, isIconAdornment, isAccordionAdornment, LabelType } from '@react-typed-forms/schemas';
2
+ import { DisplayDataType, rendererClass, coerceToString, getOverrideClass, FieldType, createDataRenderer, fieldOptionAdornment, DataRenderType, createLayoutRenderer, renderLayoutParts, createGroupRenderer, GroupRenderType, fontAwesomeIcon, deepMerge, createAction, IconPlacement, visitFormDataInContext, validationVisitor, ActionStyle, isTabsRenderer, isGridRenderer, isWizardRenderer, isDialogRenderer, isSelectChildRenderer, isFlexRenderer, isInlineRenderer, useExpression, createVisibilityRenderer, getJsonPath, ExpressionType, getLastDefinedValue, getNullToggler, mergeObjects, isArrayRenderer, isCompoundField, ControlDefinitionType, createArrayActions, getLengthRestrictions, applyArrayLengthRestrictions, buildSchema, stringField, boolField, schemaDataForFieldRef, schemaForFieldRef, defaultControlForField, createSchemaTree, useControlRendererComponent, makeSchemaDataNode, createAdornmentRenderer, getIsEditing, appendMarkupAt, AdornmentPlacement, wrapMarkup, getAllValues, ControlAdornmentType, getExternalEditData, createActionRenderer, isDataGroupRenderer, isDisplayOnlyRenderer, hasOptions, isTextfieldRenderer, isOptionalAdornment, isSetFieldAdornment, wrapLayout, isIconAdornment, isAccordionAdornment, LabelType, IconLibrary } from '@react-typed-forms/schemas';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useComponentTracking, formControlProps, useControl, useControlEffect, RenderArrayElements, useComputed, useTrackedComponent, RenderElements, controlValues, removeElement, setFields, newControl, Fcheckbox as Fcheckbox$1 } from '@react-typed-forms/core';
5
- import { useState, useMemo, useEffect, createElement, useRef } from 'react';
4
+ import { useComponentTracking, formControlProps, useControl, useControlEffect, RenderArrayElements, useComputed, RenderElements, controlValues, removeElement, trackedValue, setFields, newControl, Fcheckbox as Fcheckbox$1 } from '@react-typed-forms/core';
5
+ import { useState, useMemo, useEffect, Fragment as Fragment$1, createElement, useRef } from 'react';
6
+ import { createOverlayState, Dialog, Modal } from '@astroapps/aria-base';
6
7
  import { useAutocomplete } from '@mui/base';
7
- import { Modal, Dialog } from '@astroapps/aria-base';
8
8
  import { useOverlayTriggerState } from '@react-stately/overlays';
9
9
 
10
- function _extends() {
11
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
12
- for (var e = 1; e < arguments.length; e++) {
13
- var t = arguments[e];
14
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
15
- }
16
- return n;
17
- }, _extends.apply(null, arguments);
18
- }
19
- function _objectDestructuringEmpty(t) {
20
- if (null == t) throw new TypeError("Cannot destructure " + t);
21
- }
22
- function _objectWithoutPropertiesLoose(r, e) {
23
- if (null == r) return {};
24
- var t = {};
25
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
26
- if (e.includes(n)) continue;
27
- t[n] = r[n];
28
- }
29
- return t;
30
- }
31
-
32
- const _excluded$4 = ["data", "display", "className", "style", "renderer"];
33
10
  function createDefaultDisplayRenderer(options = {}) {
34
11
  return {
35
- render: (props, renderer) => /*#__PURE__*/jsx(DefaultDisplay, _extends({}, options, props, {
12
+ render: (props, renderer) => /*#__PURE__*/jsx(DefaultDisplay, {
13
+ options: options,
14
+ displayProps: props,
36
15
  renderer: renderer
37
- })),
16
+ }),
38
17
  type: "display"
39
18
  };
40
19
  }
41
- function DefaultDisplay(_ref) {
20
+ function DefaultDisplay({
21
+ renderer,
22
+ options,
23
+ displayProps
24
+ }) {
42
25
  var _effect = useComponentTracking();
43
26
  try {
44
- let {
45
- data,
46
- display,
47
- className,
48
- style,
49
- renderer
50
- } = _ref,
51
- options = _objectWithoutPropertiesLoose(_ref, _excluded$4);
27
+ var _iconDisplay$icon, _iconDisplay$icon2;
28
+ const {
29
+ data,
30
+ display,
31
+ className,
32
+ textClass,
33
+ style
34
+ } = displayProps;
52
35
  const {
53
36
  I,
54
37
  Div,
55
- Span,
56
38
  B,
57
- H1
39
+ H1,
40
+ Span
58
41
  } = renderer.html;
59
42
  switch (data.type) {
60
43
  case DisplayDataType.Icon:
44
+ const iconDisplay = data;
61
45
  return /*#__PURE__*/jsx(I, {
62
46
  style: style,
63
- className: clsx(getOverrideClass(className), display ? display.value : data.iconClass)
47
+ className: clsx(getOverrideClass(className), display ? display.value : iconDisplay.iconClass),
48
+ iconName: display ? display.value : (_iconDisplay$icon = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon.name,
49
+ iconLibrary: (_iconDisplay$icon2 = iconDisplay.icon) == null ? void 0 : _iconDisplay$icon2.library
64
50
  });
65
51
  case DisplayDataType.Text:
52
+ const text = display ? coerceToString(display.value) : data.text;
66
53
  return /*#__PURE__*/jsx(Div, {
67
54
  style: style,
68
55
  className: rendererClass(className, options.textClassName),
69
- children: /*#__PURE__*/jsx(Span, {
70
- children: display ? coerceToString(display.value) : data.text
71
- })
56
+ textClass: rendererClass(textClass, options.textTextClass),
57
+ text: text,
58
+ inline: displayProps.inline
72
59
  });
73
60
  case DisplayDataType.Html:
74
61
  return /*#__PURE__*/jsx(Div, {
75
62
  style: style,
76
63
  className: rendererClass(className, options.htmlClassName),
77
- dangerouslySetInnerHTML: {
78
- __html: display ? coerceToString(display.value) : data.html
79
- }
64
+ inline: displayProps.inline,
65
+ html: display ? coerceToString(display.value) : data.html
80
66
  });
81
67
  case DisplayDataType.Custom:
82
68
  return /*#__PURE__*/jsx(Div, {
@@ -94,8 +80,30 @@ function DefaultDisplay(_ref) {
94
80
  }
95
81
  }
96
82
 
97
- const _excluded$3 = ["control", "convert", "renderer"],
98
- _excluded2$1 = ["errorText", "value", "onChange"];
83
+ function _extends() {
84
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
85
+ for (var e = 1; e < arguments.length; e++) {
86
+ var t = arguments[e];
87
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
88
+ }
89
+ return n;
90
+ }, _extends.apply(null, arguments);
91
+ }
92
+ function _objectDestructuringEmpty(t) {
93
+ if (null == t) throw new TypeError("Cannot destructure " + t);
94
+ }
95
+ function _objectWithoutPropertiesLoose(r, e) {
96
+ if (null == r) return {};
97
+ var t = {};
98
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
99
+ if (e.includes(n)) continue;
100
+ t[n] = r[n];
101
+ }
102
+ return t;
103
+ }
104
+
105
+ const _excluded$4 = ["control", "convert", "renderer"],
106
+ _excluded2$2 = ["errorText", "value", "onChange", "ref"];
99
107
  function ControlInput(_ref) {
100
108
  var _effect = useComponentTracking();
101
109
  try {
@@ -104,23 +112,25 @@ function ControlInput(_ref) {
104
112
  convert,
105
113
  renderer
106
114
  } = _ref,
107
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
115
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
108
116
  const _formControlProps = formControlProps(control),
109
117
  {
110
- value
118
+ value,
119
+ ref
111
120
  } = _formControlProps,
112
- inputProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$1);
121
+ inputProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$2);
113
122
  const textValue = useControl(() => toText(value));
114
123
  useControlEffect(() => control.value, v => textValue.value = toText(v));
115
124
  const {
116
125
  Input
117
126
  } = renderer.html;
118
127
  return /*#__PURE__*/jsx(Input, _extends({}, inputProps, {
128
+ inputRef: ref,
119
129
  type: convert[0],
120
130
  value: textValue.value,
121
- onChange: e => {
122
- textValue.value = e.target.value;
123
- const converted = convert[1](e.target.value);
131
+ onChangeValue: e => {
132
+ textValue.value = e;
133
+ const converted = convert[1](e);
124
134
  if (converted !== undefined) control.value = converted;
125
135
  }
126
136
  }, props));
@@ -160,7 +170,7 @@ function createInputConversion(ft) {
160
170
  }
161
171
  }
162
172
 
163
- const _excluded$2 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "readonly"];
173
+ const _excluded$3 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "readonly"];
164
174
  function createSelectRenderer(options = {}) {
165
175
  return createDataRenderer((props, asArray) => {
166
176
  var _props$options;
@@ -192,7 +202,7 @@ function SelectDataRenderer(_ref) {
192
202
  requiredText = "<please select>",
193
203
  readonly
194
204
  } = _ref,
195
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
205
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
196
206
  const {
197
207
  value,
198
208
  disabled
@@ -238,8 +248,8 @@ function createSelectConversion(ft) {
238
248
  }
239
249
  }
240
250
 
241
- const _excluded$1 = ["control", "type", "notValue", "renderer"],
242
- _excluded2 = ["value", "onChange", "errorText"];
251
+ const _excluded$2 = ["control", "type", "notValue", "renderer"],
252
+ _excluded2$1 = ["value", "onChange", "errorText", "ref"];
243
253
  function createRadioRenderer(options = {}) {
244
254
  return createDataRenderer((p, renderer) => /*#__PURE__*/jsx(CheckButtons, _extends({
245
255
  classes: options,
@@ -247,7 +257,10 @@ function createRadioRenderer(options = {}) {
247
257
  }, p, {
248
258
  className: rendererClass(p.className, options.className),
249
259
  isChecked: (control, o) => control.value == o.value,
250
- setChecked: (c, o) => c.value = o.value,
260
+ setChecked: (c, o) => {
261
+ c.setTouched(true);
262
+ c.value = o.value;
263
+ },
251
264
  control: p.control,
252
265
  type: "radio",
253
266
  entryAdornment: fieldOptionAdornment(p),
@@ -267,6 +280,7 @@ function createCheckListRenderer(options = {}) {
267
280
  return Array.isArray(v) ? v.includes(o.value) : false;
268
281
  },
269
282
  setChecked: (c, o, checked) => {
283
+ c.setTouched(true);
270
284
  c.setValue(x => setIncluded(x != null ? x : [], o.value, checked));
271
285
  },
272
286
  control: p.control,
@@ -325,8 +339,8 @@ function CheckButtons({
325
339
  readOnly: readonly,
326
340
  disabled: disabled,
327
341
  checked: checked,
328
- onChange: x => {
329
- !readonly && setChecked(control, o, x.target.checked);
342
+ onChangeChecked: x => {
343
+ !readonly && setChecked(control, o, x);
330
344
  }
331
345
  }), /*#__PURE__*/jsx(Label, {
332
346
  className: classes.labelClass,
@@ -365,7 +379,20 @@ function createCheckboxRenderer(options = {}) {
365
379
  renderType: DataRenderType.Checkbox
366
380
  });
367
381
  }
368
- function CheckBox({
382
+ function createElementSelectedRenderer(options = {}) {
383
+ return createDataRenderer((props, renderer) => p => _extends({}, p, {
384
+ label: undefined,
385
+ children: /*#__PURE__*/jsx(CheckBoxSelected, {
386
+ p: p,
387
+ renderer: renderer,
388
+ options: options,
389
+ props: props
390
+ })
391
+ }), {
392
+ renderType: DataRenderType.ElementSelected
393
+ });
394
+ }
395
+ function CheckBoxSelected({
369
396
  p,
370
397
  props,
371
398
  renderer,
@@ -376,11 +403,24 @@ function CheckBox({
376
403
  const {
377
404
  Div
378
405
  } = renderer.html;
406
+ const elementValue = useControl();
407
+ useEffect(() => {
408
+ props.runExpression(elementValue, props.renderOptions.elementExpression, v => elementValue.value = v);
409
+ });
410
+ const isSelected = useComputed(() => {
411
+ var _props$control$as$val, _props$control$as$val2;
412
+ return (_props$control$as$val = (_props$control$as$val2 = props.control.as().value) == null ? void 0 : _props$control$as$val2.includes(elementValue.current.value)) != null ? _props$control$as$val : false;
413
+ });
414
+ const selControl = useControl(() => isSelected.current.value);
415
+ selControl.value = isSelected.value;
416
+ useControlEffect(() => selControl.value, v => {
417
+ props.control.as().setValue(x => setIncluded(x != null ? x : [], elementValue.value, v));
418
+ });
379
419
  return /*#__PURE__*/jsxs(Div, {
380
420
  className: rendererClass(props.className, options.entryClass),
381
421
  children: [/*#__PURE__*/jsx(Fcheckbox, {
382
422
  id: props.id,
383
- control: props.control.as(),
423
+ control: selControl,
384
424
  style: props.style,
385
425
  className: options.checkClass,
386
426
  renderer: renderer
@@ -390,8 +430,33 @@ function CheckBox({
390
430
  _effect2();
391
431
  }
392
432
  }
393
- function Fcheckbox(_ref) {
433
+ function CheckBox({
434
+ p,
435
+ props,
436
+ renderer,
437
+ options
438
+ }) {
394
439
  var _effect3 = useComponentTracking();
440
+ try {
441
+ const {
442
+ Div
443
+ } = renderer.html;
444
+ return /*#__PURE__*/jsxs(Div, {
445
+ className: rendererClass(props.className, options.entryClass),
446
+ children: [/*#__PURE__*/jsx(Fcheckbox, {
447
+ id: props.id,
448
+ control: props.control.as(),
449
+ style: props.style,
450
+ className: options.checkClass,
451
+ renderer: renderer
452
+ }), p.label && renderer.renderLabel(p.label, undefined, undefined)]
453
+ });
454
+ } finally {
455
+ _effect3();
456
+ }
457
+ }
458
+ function Fcheckbox(_ref) {
459
+ var _effect4 = useComponentTracking();
395
460
  try {
396
461
  let {
397
462
  control,
@@ -399,7 +464,7 @@ function Fcheckbox(_ref) {
399
464
  notValue = false,
400
465
  renderer
401
466
  } = _ref,
402
- others = _objectWithoutPropertiesLoose(_ref, _excluded$1);
467
+ others = _objectWithoutPropertiesLoose(_ref, _excluded$2);
403
468
  const {
404
469
  Input
405
470
  } = renderer.html;
@@ -407,18 +472,18 @@ function Fcheckbox(_ref) {
407
472
  {
408
473
  value
409
474
  } = _formControlProps,
410
- theseProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2);
475
+ theseProps = _objectWithoutPropertiesLoose(_formControlProps, _excluded2$1);
411
476
  return /*#__PURE__*/jsx(Input, _extends({}, theseProps, {
412
477
  checked: !!value !== notValue,
413
- ref: r => control.element = r,
414
- onChange: e => {
478
+ inputRef: r => control.element = r,
479
+ onChangeChecked: e => {
415
480
  control.touched = true;
416
- control.value = e.target.checked !== notValue;
481
+ control.value = e !== notValue;
417
482
  },
418
483
  type: type
419
484
  }, others));
420
485
  } finally {
421
- _effect3();
486
+ _effect4();
422
487
  }
423
488
  }
424
489
 
@@ -431,6 +496,7 @@ function createDefaultLayoutRenderer(options = {}) {
431
496
  }, options, {
432
497
  renderer: renderers
433
498
  }))),
499
+ inline: layout.inline,
434
500
  className: rendererClass(layout.className, options.className),
435
501
  style: layout.style,
436
502
  divRef: e => e && props.errorControl ? props.errorControl.meta.scrollElement = e : undefined
@@ -443,13 +509,12 @@ function DefaultLayout({
443
509
  html: {
444
510
  Div,
445
511
  Span
446
- },
447
- renderText
512
+ }
448
513
  },
449
514
  renderError = e => e && /*#__PURE__*/jsx(Div, {
450
515
  children: /*#__PURE__*/jsx(Span, {
451
516
  className: errorClass,
452
- children: renderText(e)
517
+ children: e
453
518
  })
454
519
  }),
455
520
  layout: {
@@ -473,29 +538,28 @@ function DefaultLayout({
473
538
  }
474
539
 
475
540
  function DefaultDisplayOnly({
476
- control,
541
+ dataNode,
477
542
  className,
478
543
  emptyText,
479
544
  schemaInterface,
480
- field,
481
545
  style,
482
- renderer
546
+ renderer,
547
+ textClass,
548
+ inline
483
549
  }) {
484
550
  var _effect = useComponentTracking();
485
551
  try {
486
552
  var _ref;
487
- const v = control.value;
488
- const text = (_ref = schemaInterface.isEmptyValue(field, v) ? emptyText : schemaInterface.textValue(field, v)) != null ? _ref : "";
553
+ const text = (_ref = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref : "";
489
554
  const {
490
- Div,
491
- Span
555
+ Div
492
556
  } = renderer.html;
493
557
  return /*#__PURE__*/jsx(Div, {
494
558
  style: style,
495
559
  className: className,
496
- children: /*#__PURE__*/jsx(Span, {
497
- children: text
498
- })
560
+ textClass: textClass,
561
+ text: text,
562
+ inline: inline
499
563
  });
500
564
  } finally {
501
565
  _effect();
@@ -508,10 +572,8 @@ function DefaultAccordion({
508
572
  contentStyle,
509
573
  contentClassName,
510
574
  designMode,
511
- iconOpenName,
512
- iconOpenClass,
513
- iconClosedName,
514
- iconClosedClass,
575
+ iconOpen,
576
+ iconClosed,
515
577
  className,
516
578
  renderTitle = t => t,
517
579
  renderToggler,
@@ -539,15 +601,16 @@ function DefaultAccordion({
539
601
  display: "none"
540
602
  });
541
603
  const title = renderers.renderLabelText(renderTitle(accordion.title, open));
604
+ const currentIcon = isOpen ? iconOpen : iconClosed;
542
605
  const toggler = renderToggler ? renderToggler(open, title) : /*#__PURE__*/jsxs(Button, {
543
606
  className: className,
544
607
  onClick: () => open.setValue(x => !x),
545
608
  children: [/*#__PURE__*/jsx(Label, {
546
609
  className: titleClass,
547
610
  children: title
548
- }), /*#__PURE__*/jsx(I, {
549
- title: isOpen ? iconOpenName : iconClosedName,
550
- className: clsx(isOpen ? iconOpenClass : iconClosedClass)
611
+ }), currentIcon && /*#__PURE__*/jsx(I, {
612
+ iconLibrary: currentIcon.library,
613
+ iconName: currentIcon.name
551
614
  })]
552
615
  });
553
616
  return /*#__PURE__*/jsxs(Fragment, {
@@ -565,24 +628,45 @@ function getAccordionState(c) {
565
628
  return c.meta.accordionState;
566
629
  }
567
630
 
631
+ /**
632
+ * @trackControls
633
+ */
634
+ function VisibleChildrenRenderer(props) {
635
+ var _effect = useComponentTracking();
636
+ try {
637
+ const childStates = props.parentFormNode.getChildNodes().map(x => props.parent.getChildState(x));
638
+ return props.render(props.props, i => !childStates[i].hidden);
639
+ } finally {
640
+ _effect();
641
+ }
642
+ }
643
+
568
644
  function createTabsRenderer(options = {}) {
569
- return createGroupRenderer((p, renderer) => /*#__PURE__*/jsx(TabsGroupRenderer, _extends({}, p, {
570
- tabOptions: p.renderOptions,
571
- options: options
572
- })), {
645
+ return createGroupRenderer((p, renderer) => {
646
+ return /*#__PURE__*/jsx(VisibleChildrenRenderer, {
647
+ render: renderAllTabs,
648
+ dataContext: p.dataContext,
649
+ parentFormNode: p.formNode,
650
+ parent: p,
651
+ props: {
652
+ groupProps: p,
653
+ tabOptions: p.renderOptions,
654
+ options: options
655
+ }
656
+ });
657
+ }, {
573
658
  renderType: GroupRenderType.Tabs
574
659
  });
575
- }
576
- function TabsGroupRenderer({
577
- formNode,
578
- className,
579
- options,
580
- renderChild,
581
- designMode,
582
- tabOptions
583
- }) {
584
- var _effect = useComponentTracking();
585
- try {
660
+ function renderAllTabs({
661
+ options,
662
+ groupProps: {
663
+ designMode,
664
+ formNode,
665
+ className,
666
+ renderChild
667
+ },
668
+ tabOptions
669
+ }, isVisible) {
586
670
  const tabIndex = useControl(0);
587
671
  const {
588
672
  tabClass,
@@ -595,7 +679,7 @@ function TabsGroupRenderer({
595
679
  const currentTab = tabIndex.value;
596
680
  return designMode ? /*#__PURE__*/jsx(Fragment, {
597
681
  children: formNode.getChildNodes().map((x, i) => renderTabs([x], i))
598
- }) : renderTabs(formNode.getChildNodes(), 0);
682
+ }) : renderTabs(formNode.getChildNodes().filter((x, i) => isVisible(i)), 0);
599
683
  function renderTabs(tabs, key) {
600
684
  return /*#__PURE__*/jsxs("div", {
601
685
  className: rendererClass(className, options.className),
@@ -615,33 +699,285 @@ function TabsGroupRenderer({
615
699
  })]
616
700
  }, key);
617
701
  }
702
+ }
703
+ }
704
+
705
+ function createGridRenderer(options) {
706
+ return createGroupRenderer((props, formRenderer) => /*#__PURE__*/jsx(VisibleChildrenRenderer, {
707
+ props: _extends({}, props, {
708
+ formRenderer,
709
+ defaultOptions: options
710
+ }),
711
+ render: renderGrid,
712
+ parent: props,
713
+ dataContext: props.dataContext,
714
+ parentFormNode: props.formNode
715
+ }), {
716
+ renderType: GroupRenderType.Grid
717
+ });
718
+ function renderGrid(props, isChildVisible) {
719
+ var _props$defaultOptions, _ref, _gridOptions$columns;
720
+ const filteredChildren = props.formNode.getChildNodes().filter((x, i) => isChildVisible(i));
721
+ const {
722
+ Div
723
+ } = props.formRenderer.html;
724
+ const defaults = (_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {};
725
+ const gridOptions = props.renderOptions;
726
+ const numColumns = (_ref = (_gridOptions$columns = gridOptions.columns) != null ? _gridOptions$columns : defaults.defaultColumns) != null ? _ref : 2;
727
+ const allChildren = filteredChildren.map((x, i) => props.renderChild(i, x));
728
+ // split into numColumns items wrapped a div each
729
+ const rows = [];
730
+ for (let i = 0; i < allChildren.length; i += numColumns) {
731
+ rows.push(allChildren.slice(i, i + numColumns));
732
+ }
733
+ return /*#__PURE__*/jsx(Div, {
734
+ className: rendererClass(props.className, defaults.className),
735
+ children: rows.map((row, rowIndex) => /*#__PURE__*/jsx(Div, {
736
+ className: rendererClass(gridOptions.rowClass, defaults.rowClass),
737
+ children: row
738
+ }, rowIndex))
739
+ });
740
+ }
741
+ }
742
+
743
+ const defaultOptions = {
744
+ classes: {
745
+ className: undefined,
746
+ contentClass: "min-h-96 overflow-auto",
747
+ navContainerClass: "flex justify-between gap-4 my-2"
748
+ },
749
+ actions: {
750
+ nextText: "Next",
751
+ nextIcon: fontAwesomeIcon("chevron-right"),
752
+ nextValidate: true,
753
+ prevText: "Prev",
754
+ prevIcon: fontAwesomeIcon("chevron-left"),
755
+ prevValidate: false
756
+ },
757
+ renderNavigation: defaultNavigationRender
758
+ };
759
+ function defaultNavigationRender({
760
+ formRenderer,
761
+ prev,
762
+ next,
763
+ className
764
+ }) {
765
+ {
766
+ const {
767
+ html: {
768
+ Div
769
+ },
770
+ renderAction
771
+ } = formRenderer;
772
+ return /*#__PURE__*/jsxs(Div, {
773
+ className: className,
774
+ children: [renderAction(prev), renderAction(next)]
775
+ });
776
+ }
777
+ }
778
+ function createWizardRenderer(options) {
779
+ return createGroupRenderer((props, formRenderer) => /*#__PURE__*/jsx(VisibleChildrenRenderer, {
780
+ props: _extends({}, props, {
781
+ formRenderer,
782
+ defaultOptions: options
783
+ }),
784
+ render: renderWizard,
785
+ parent: props,
786
+ dataContext: props.dataContext,
787
+ parentFormNode: props.formNode
788
+ }), {
789
+ renderType: GroupRenderType.Wizard
790
+ });
791
+ }
792
+ function renderWizard(props, isChildVisible) {
793
+ var _props$defaultOptions;
794
+ const mergedOptions = deepMerge((_props$defaultOptions = props.defaultOptions) != null ? _props$defaultOptions : {}, defaultOptions);
795
+ const {
796
+ classes: {
797
+ className,
798
+ contentClass,
799
+ navContainerClass
800
+ },
801
+ actions: {
802
+ nextText,
803
+ nextIcon,
804
+ prevText,
805
+ prevIcon,
806
+ nextValidate,
807
+ prevValidate
808
+ },
809
+ renderNavigation
810
+ } = mergedOptions;
811
+ const {
812
+ html: {
813
+ Div
814
+ }
815
+ } = props.formRenderer;
816
+ const children = props.formNode.getChildNodes();
817
+ const allVisible = children.map((_, i) => isChildVisible(i));
818
+ const page = useControl(0);
819
+ const currentPage = page.value;
820
+ const isValid = useComputed(() => isPageValid());
821
+ const next = createAction("nav", () => nav(1, nextValidate), nextText, {
822
+ hidden: !props.designMode && nextVisibleInDirection(1) == null,
823
+ disabled: !isValid.value,
824
+ icon: nextIcon,
825
+ iconPlacement: IconPlacement.AfterText
826
+ });
827
+ const prev = createAction("nav", () => nav(-1, prevValidate), prevText, {
828
+ disabled: !props.designMode && nextVisibleInDirection(-1) == null,
829
+ icon: prevIcon
830
+ });
831
+ const navElement = renderNavigation({
832
+ formRenderer: props.formRenderer,
833
+ page: countVisibleUntil(currentPage),
834
+ totalPages: countVisibleUntil(children.length),
835
+ prev,
836
+ next: next,
837
+ className: navContainerClass,
838
+ validatePage: async () => validatePage()
839
+ });
840
+ const content = props.designMode ? /*#__PURE__*/jsx(Div, {
841
+ children: children.map((child, i) => props.renderChild(i, child))
842
+ }) : currentPage < children.length ? /*#__PURE__*/jsx(Div, {
843
+ className: contentClass,
844
+ children: props.renderChild(currentPage, children[currentPage])
845
+ }) : /*#__PURE__*/jsx(Fragment$1, {});
846
+ return /*#__PURE__*/jsxs(Div, {
847
+ className: rendererClass(props.className, className),
848
+ children: [content, navElement]
849
+ });
850
+ function countVisibleUntil(untilPage) {
851
+ let count = 0;
852
+ for (let i = 0; i < untilPage && i < allVisible.length; i++) {
853
+ if (allVisible[i]) {
854
+ count++;
855
+ }
856
+ }
857
+ return count;
858
+ }
859
+ function nav(dir, validate) {
860
+ if (validate && !validatePage()) {
861
+ return;
862
+ }
863
+ const next = nextVisibleInDirection(dir);
864
+ if (next != null) {
865
+ page.value = next;
866
+ }
867
+ }
868
+ function nextVisibleInDirection(dir) {
869
+ let next = currentPage + dir;
870
+ while (next >= 0 && next < children.length) {
871
+ if (allVisible[next]) {
872
+ return next;
873
+ }
874
+ next += dir;
875
+ }
876
+ return null;
877
+ }
878
+ function validatePage() {
879
+ const pageNode = children[currentPage];
880
+ let hasErrors = false;
881
+ visitFormDataInContext(props.dataContext.parentNode, pageNode, validationVisitor(() => {
882
+ hasErrors = true;
883
+ }));
884
+ return !hasErrors;
885
+ }
886
+ function isPageValid() {
887
+ const pageNode = children[currentPage];
888
+ let hasErrors = false;
889
+ visitFormDataInContext(props.dataContext.parentNode, pageNode, c => {
890
+ if (!c.control.valid) hasErrors = true;
891
+ });
892
+ return !hasErrors;
893
+ }
894
+ }
895
+
896
+ const defaultDialogOptions = {
897
+ classes: {
898
+ className: "",
899
+ titleClass: "text-2xl font-bold"
900
+ }
901
+ };
902
+ function createDialogRenderer(options) {
903
+ return createGroupRenderer((props, renderer) => /*#__PURE__*/jsx(DefaultDialogRenderer, {
904
+ props: props,
905
+ options: options,
906
+ renderer: renderer,
907
+ renderOptions: props.renderOptions
908
+ }), {
909
+ renderType: GroupRenderType.Dialog
910
+ });
911
+ }
912
+ function DefaultDialogRenderer({
913
+ props,
914
+ renderOptions,
915
+ options,
916
+ renderer
917
+ }) {
918
+ var _effect = useComponentTracking();
919
+ try {
920
+ const {
921
+ classes: {
922
+ titleClass,
923
+ className
924
+ }
925
+ } = deepMerge(options, defaultDialogOptions);
926
+ const open = useControl(false);
927
+ const overlayState = createOverlayState(open);
928
+ const actionOnClick = action => {
929
+ switch (action) {
930
+ case "closeDialog":
931
+ return () => overlayState.close();
932
+ case "openDialog":
933
+ return () => overlayState.open();
934
+ }
935
+ };
936
+ const triggerChildren = props.formNode.getChildNodes().filter(x => x.definition.placement === "trigger");
937
+ const dialogContent = /*#__PURE__*/jsx(Dialog, {
938
+ title: renderOptions.title,
939
+ titleClass: titleClass,
940
+ className: rendererClass(props.className, className),
941
+ children: props.formNode.getChildNodes().filter(x => !x.definition.placement || x.definition.placement === "dialog").map((x, i) => props.renderChild(i, x, {
942
+ actionOnClick
943
+ }))
944
+ });
945
+ return /*#__PURE__*/jsxs(Fragment, {
946
+ children: [triggerChildren.map((x, i) => props.renderChild(i, x, {
947
+ actionOnClick
948
+ })), props.designMode ? designContent() : open.value && /*#__PURE__*/jsx(Modal, {
949
+ state: overlayState,
950
+ isDismissable: true,
951
+ children: dialogContent
952
+ })]
953
+ });
954
+ function designContent() {
955
+ return /*#__PURE__*/jsxs(Fragment, {
956
+ children: [/*#__PURE__*/jsx("div", {
957
+ onClickCapture: () => overlayState.toggle(),
958
+ children: renderer.renderAction(createAction("Toggle Dialog", () => {}, open.value ? "Hide Content" : "Show Content", {
959
+ actionStyle: ActionStyle.Link
960
+ }))
961
+ }), open.value && dialogContent]
962
+ });
963
+ }
618
964
  } finally {
619
965
  _effect();
620
966
  }
621
967
  }
622
968
 
623
969
  function createDefaultGroupRenderer(options) {
970
+ const gridRenderer = createGridRenderer(options == null ? void 0 : options.grid);
624
971
  const tabsRenderer = createTabsRenderer(options == null ? void 0 : options.tabs);
972
+ const wizardRenderer = createWizardRenderer(options == null ? void 0 : options.wizard);
973
+ const dialogRenderer = createDialogRenderer(options == null ? void 0 : options.dialog);
625
974
  const {
626
975
  className,
627
- gridStyles = defaultGridStyles,
628
- defaultGridColumns = 2,
629
- gridClassName,
630
976
  standardClassName,
631
977
  flexClassName,
978
+ inlineClass,
632
979
  defaultFlexGap
633
980
  } = options != null ? options : {};
634
- function defaultGridStyles({
635
- columns = defaultGridColumns
636
- }) {
637
- return {
638
- className: gridClassName,
639
- style: {
640
- display: "grid",
641
- gridTemplateColumns: `repeat(${columns}, 1fr)`
642
- }
643
- };
644
- }
645
981
  function flexStyles(options) {
646
982
  return {
647
983
  className: flexClassName,
@@ -659,6 +995,9 @@ function createDefaultGroupRenderer(options) {
659
995
  formNode
660
996
  } = props;
661
997
  if (isTabsRenderer(renderOptions)) return tabsRenderer.render(props, renderer);
998
+ if (isGridRenderer(renderOptions)) return gridRenderer.render(props, renderer);
999
+ if (isWizardRenderer(renderOptions)) return wizardRenderer.render(props, renderer);
1000
+ if (isDialogRenderer(renderOptions)) return dialogRenderer.render(props, renderer);
662
1001
  if (isSelectChildRenderer(renderOptions) && !props.designMode) {
663
1002
  return /*#__PURE__*/jsx(SelectChildGroupRenderer, _extends({}, props, {
664
1003
  renderOptions: renderOptions
@@ -667,40 +1006,60 @@ function createDefaultGroupRenderer(options) {
667
1006
  const {
668
1007
  style,
669
1008
  className: gcn
670
- } = isGridRenderer(renderOptions) ? gridStyles(renderOptions) : isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : {
1009
+ } = isFlexRenderer(renderOptions) ? flexStyles(renderOptions) : isInlineRenderer(renderOptions) ? {
1010
+ className: inlineClass
1011
+ } : {
671
1012
  className: standardClassName
672
1013
  };
673
1014
  const {
674
1015
  Div
675
1016
  } = renderer.html;
1017
+ const inline = renderOptions.type == GroupRenderType.Inline;
1018
+ const children = formNode.getChildNodes().map((c, i) => renderChild(i, c, {
1019
+ inline
1020
+ }));
676
1021
  return /*#__PURE__*/jsx(Div, {
677
1022
  className: rendererClass(props.className, clsx(className, gcn)),
1023
+ textClass: props.textClass,
678
1024
  style: style,
679
- children: formNode.getChildNodes().map((c, i) => renderChild(i, c))
1025
+ inline: inline,
1026
+ children: children
680
1027
  });
681
1028
  }
1029
+ function renderLayout(props, renderer) {
1030
+ if (props.renderOptions.type === GroupRenderType.Contents) {
1031
+ const {
1032
+ formNode,
1033
+ renderChild
1034
+ } = props;
1035
+ const children = formNode.getChildNodes().map((c, i) => renderChild(i, c));
1036
+ return layout => {
1037
+ return _extends({}, layout, {
1038
+ inline: true,
1039
+ children
1040
+ });
1041
+ };
1042
+ }
1043
+ return render(props, renderer);
1044
+ }
682
1045
  return {
683
1046
  type: "group",
684
- render
1047
+ render: renderLayout
685
1048
  };
686
1049
  }
687
1050
  function SelectChildGroupRenderer(props) {
688
1051
  var _effect = useComponentTracking();
689
1052
  try {
690
1053
  const {
691
- useEvalExpression,
1054
+ runExpression,
692
1055
  renderOptions
693
1056
  } = props;
694
- const dynHook = useEvalExpression(renderOptions == null ? void 0 : renderOptions.childIndexExpression, x => x == "string" ? parseInt(x) : x);
695
- const Render = useTrackedComponent(p => {
696
- const ctrl = dynHook.runHook(p.dataContext, dynHook.state);
697
- const childIndex = ctrl == null ? void 0 : ctrl.value;
698
- const childDefinitions = p.formNode.getChildNodes();
699
- return /*#__PURE__*/jsx("div", {
700
- children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && p.renderChild(childIndex, childDefinitions[childIndex])
701
- });
702
- }, [dynHook.deps]);
703
- return /*#__PURE__*/jsx(Render, _extends({}, props));
1057
+ const ctrl = useExpression(undefined, runExpression, renderOptions == null ? void 0 : renderOptions.childIndexExpression, x => typeof x == "string" ? parseInt(x) : x);
1058
+ const childIndex = ctrl == null ? void 0 : ctrl.value;
1059
+ const childDefinitions = props.formNode.getChildNodes();
1060
+ return /*#__PURE__*/jsx("div", {
1061
+ children: typeof childIndex === "number" && childIndex < childDefinitions.length && childIndex >= 0 && props.renderChild(childIndex, childDefinitions[childIndex])
1062
+ });
704
1063
  } finally {
705
1064
  _effect();
706
1065
  }
@@ -717,7 +1076,8 @@ function DefaultVisibility({
717
1076
  className,
718
1077
  style,
719
1078
  divRef,
720
- renderer
1079
+ renderer,
1080
+ inline
721
1081
  }) {
722
1082
  var _effect = useComponentTracking();
723
1083
  try {
@@ -733,10 +1093,11 @@ function DefaultVisibility({
733
1093
  const {
734
1094
  Div
735
1095
  } = renderer.html;
1096
+ if (inline) return v != null && v.visible ? children : undefined;
736
1097
  return v != null && v.visible ? /*#__PURE__*/jsx(Div, {
737
1098
  className: className,
738
1099
  style: style,
739
- ref: divRef,
1100
+ nativeRef: divRef,
740
1101
  children: children
741
1102
  }) : /*#__PURE__*/jsx(Fragment, {});
742
1103
  } finally {
@@ -751,7 +1112,8 @@ function createJsonataRenderer(className) {
751
1112
  dataNode: p.dataNode,
752
1113
  dataContext: p.dataContext,
753
1114
  control: p.control,
754
- readonly: p.readonly
1115
+ readonly: p.readonly,
1116
+ runExpression: p.runExpression
755
1117
  }), {
756
1118
  renderType: DataRenderType.Jsonata
757
1119
  });
@@ -762,19 +1124,22 @@ function JsonataRenderer({
762
1124
  readonly,
763
1125
  className,
764
1126
  dataContext,
765
- dataNode
1127
+ dataNode,
1128
+ runExpression
766
1129
  }) {
767
1130
  var _effect = useComponentTracking();
768
1131
  try {
769
1132
  const sdn = dataNode.elementIndex != null ? dataNode : dataContext.parentNode;
770
- const bindings = useComputed(() => ({
1133
+ const bindings = useComputed(() => _extends({}, dataContext.variables, {
771
1134
  value: control.value,
772
1135
  readonly,
773
1136
  disabled: control.disabled,
774
- formData: dataContext.formData,
775
1137
  dataPath: getJsonPath(dataNode)
776
1138
  }));
777
- const rendered = useJsonataExpression(renderOptions.expression, getRootDataNode(sdn).control, getJsonPath(sdn), bindings, coerceToString);
1139
+ const rendered = useExpression("", runExpression, {
1140
+ type: ExpressionType.Jsonata,
1141
+ expression: renderOptions.expression
1142
+ }, coerceToString, bindings);
778
1143
  return /*#__PURE__*/jsx("div", {
779
1144
  className: className,
780
1145
  dangerouslySetInnerHTML: {
@@ -786,14 +1151,14 @@ function JsonataRenderer({
786
1151
  }
787
1152
  }
788
1153
 
789
- const _excluded = ["control", "field", "renderOptions"];
1154
+ const _excluded$1 = ["control", "field", "renderOptions"];
790
1155
  function createNullToggleRenderer() {
791
1156
  return createDataRenderer((_ref, renderers) => {
792
1157
  let {
793
1158
  control,
794
1159
  field
795
1160
  } = _ref,
796
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
1161
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
797
1162
  const lastDefined = getLastDefinedValue(control);
798
1163
  if (lastDefined.current.value == null) lastDefined.value = props.definition.defaultValue;
799
1164
  const nullControl = getNullToggler(control);
@@ -824,100 +1189,108 @@ function createDefaultArrayDataRenderer(defaultActions) {
824
1189
  collection: true
825
1190
  });
826
1191
  }
1192
+ /**
1193
+ * @trackControls
1194
+ */
827
1195
  function DataArrayRenderer({
828
1196
  dataProps,
829
1197
  renderers,
830
1198
  defaultActions
831
1199
  }) {
832
- var _definition$children;
833
- const {
834
- renderOptions,
835
- control,
836
- field,
837
- readonly,
838
- designMode,
839
- required,
840
- renderChild,
841
- definition,
842
- className,
843
- style,
844
- useChildVisibility,
845
- dataContext,
846
- formNode
847
- } = dataProps;
848
- const {
849
- addText,
850
- noAdd,
851
- noRemove,
852
- noReorder,
853
- removeText,
854
- editExternal
855
- } = mergeObjects(isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions);
856
- const childOptions = isArrayRenderer(renderOptions) ? renderOptions.childOptions : undefined;
857
- const renderAsElement = !isCompoundField(field);
858
- const childDefinition = formNode.tree.createTempNode(formNode.id + "child", !renderAsElement ? {
859
- type: ControlDefinitionType.Group,
860
- groupOptions: {
861
- type: GroupRenderType.Standard,
1200
+ var _effect = useComponentTracking();
1201
+ try {
1202
+ const {
1203
+ renderOptions,
1204
+ control,
1205
+ field,
1206
+ readonly,
1207
+ designMode,
1208
+ required,
1209
+ renderChild,
1210
+ definition,
1211
+ className,
1212
+ style,
1213
+ dataContext,
1214
+ formNode,
1215
+ getChildState
1216
+ } = dataProps;
1217
+ const {
1218
+ addText,
1219
+ noAdd,
1220
+ noRemove,
1221
+ noReorder,
1222
+ removeText,
1223
+ editExternal
1224
+ } = mergeObjects(isArrayRenderer(renderOptions) ? renderOptions : {}, defaultActions);
1225
+ const childDefs = formNode.getResolvedChildren();
1226
+ const renderAsElement = !isCompoundField(field);
1227
+ const defaultChildDef = {
1228
+ type: ControlDefinitionType.Data,
1229
+ field: ".",
1230
+ renderOptions: {
1231
+ type: DataRenderType.Standard
1232
+ },
862
1233
  hideTitle: true
1234
+ };
1235
+ const childDef = {
1236
+ type: ControlDefinitionType.Group,
1237
+ groupOptions: {
1238
+ type: GroupRenderType.Standard,
1239
+ hideTitle: true
1240
+ },
1241
+ children: renderAsElement && childDefs.length == 0 ? [defaultChildDef] : childDefs
1242
+ };
1243
+ const childNode = formNode.createChildNode("child", childDef);
1244
+ const childNodes = childNode.getChildNodes();
1245
+ const arrayProps = _extends({}, createArrayActions(control.as(), field, {
1246
+ addText,
1247
+ removeText,
1248
+ noAdd,
1249
+ noRemove,
1250
+ readonly,
1251
+ disabled: control.disabled,
1252
+ designMode,
1253
+ editExternal
1254
+ }), {
1255
+ required,
1256
+ renderElement: (i, wrap) => /*#__PURE__*/jsx(RenderEntry, {
1257
+ index: i,
1258
+ renderChildElement: renderChildElement,
1259
+ dataContext: dataContext,
1260
+ wrap: wrap,
1261
+ isChildHidden: dataNode => childNodes.every(x => getChildState(x, dataNode).hidden)
1262
+ }),
1263
+ className: className ? className : undefined,
1264
+ style
1265
+ }, getLengthRestrictions(definition));
1266
+ return renderers.renderArray(arrayProps);
1267
+ function renderChildElement(i, elementNode) {
1268
+ return renderChild(elementNode.control.uniqueId, childNode, {
1269
+ parentDataNode: elementNode
1270
+ });
863
1271
  }
864
- } : {
865
- type: ControlDefinitionType.Data,
866
- field: definition.field,
867
- renderOptions: childOptions != null ? childOptions : {
868
- type: DataRenderType.Standard
869
- },
870
- hideTitle: true
871
- }, formNode.getChildNodes());
872
- const visibilities = ((_definition$children = definition.children) != null ? _definition$children : []).map(x => [useChildVisibility(x, undefined, true), x]);
873
- const deps = makeHookDepString(visibilities, x => x[0].deps);
874
- const Entry = useTrackedComponent(RenderEntry, [deps]);
875
- const arrayProps = _extends({}, createArrayActions(control.as(), field, {
876
- addText,
877
- removeText,
878
- noAdd,
879
- noRemove,
880
- readonly,
881
- disabled: control.disabled,
882
- designMode,
883
- editExternal
884
- }), {
885
- required,
886
- renderElement: (i, wrap) => /*#__PURE__*/jsx(Entry, {
887
- index: i,
888
- renderChildElement: renderChildElement,
889
- dataContext: dataContext,
890
- visibilities: visibilities,
891
- wrap: wrap
892
- }),
893
- className: className ? className : undefined,
894
- style
895
- }, getLengthRestrictions(definition));
896
- return renderers.renderArray(arrayProps);
897
- function renderChildElement(i, elementNode) {
898
- var _control$elements$i$u, _control$elements;
899
- return renderChild((_control$elements$i$u = (_control$elements = control.elements) == null ? void 0 : _control$elements[i].uniqueId) != null ? _control$elements$i$u : i, childDefinition, renderAsElement ? {
900
- elementIndex: i
901
- } : {
902
- parentDataNode: elementNode
903
- });
1272
+ } finally {
1273
+ _effect();
904
1274
  }
905
1275
  }
1276
+ /**
1277
+ * @trackControls
1278
+ */
906
1279
  function RenderEntry({
907
1280
  index: i,
908
1281
  renderChildElement,
909
- visibilities,
910
1282
  wrap,
1283
+ isChildHidden,
911
1284
  dataContext
912
1285
  }) {
913
- const elementNode = dataContext.dataNode.getChildElement(i);
914
- const childVis = visibilities.map(([hook, def]) => hook.runHook(_extends({}, dataContext, {
915
- parentNode: elementNode,
916
- dataNode: lookupDataNode(def, elementNode)
917
- }), hook.state).value);
918
- const anyVisible = childVis.length == 0 || childVis.some(x => x === true);
919
- if (!anyVisible) return undefined;
920
- return wrap(renderChildElement(i, elementNode));
1286
+ var _effect2 = useComponentTracking();
1287
+ try {
1288
+ const elementNode = dataContext.dataNode.getChildElement(i);
1289
+ if (isChildHidden(elementNode)) return undefined;
1290
+ return wrap(renderChildElement(i, elementNode));
1291
+ } finally {
1292
+ _effect2();
1293
+ }
921
1294
  }
922
1295
  function createDefaultArrayRenderer(options) {
923
1296
  return {
@@ -932,7 +1305,7 @@ function createDefaultArrayRenderer(options) {
932
1305
  };
933
1306
  }
934
1307
  function DefaultArrayRenderer(props) {
935
- var _effect = useComponentTracking();
1308
+ var _effect3 = useComponentTracking();
936
1309
  try {
937
1310
  const {
938
1311
  renderElement,
@@ -979,7 +1352,7 @@ function DefaultArrayRenderer(props) {
979
1352
  })]
980
1353
  });
981
1354
  } finally {
982
- _effect();
1355
+ _effect3();
983
1356
  }
984
1357
  }
985
1358
 
@@ -1043,6 +1416,7 @@ function SingleAutocomplete(_ref) {
1043
1416
  } = useAutocomplete(_extends({
1044
1417
  freeSolo: true,
1045
1418
  multiple: false,
1419
+ readOnly,
1046
1420
  value: selectedOptionControl.value,
1047
1421
  inputValue: inputControl.value,
1048
1422
  getOptionLabel: v => typeof v === "string" ? v : v.name,
@@ -1070,7 +1444,8 @@ function SingleAutocomplete(_ref) {
1070
1444
  type: "text"
1071
1445
  }, getInputProps(), {
1072
1446
  placeholder: (_controlClasses$place = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place : "",
1073
- className: inputClass
1447
+ className: inputClass,
1448
+ readOnly: readOnly
1074
1449
  })), /*#__PURE__*/jsx("button", _extends({}, getPopupIndicatorProps(), {
1075
1450
  disabled: disabled || readOnly,
1076
1451
  className: "outline-0 shadow-none border-0 py-0 px-0.5 bg-transparent pr-[10px]",
@@ -1138,6 +1513,7 @@ function MultipleAutocomplete(_ref2) {
1138
1513
  value: (_selectedOptionsContr = selectedOptionsControl.value) != null ? _selectedOptionsContr : [],
1139
1514
  inputValue: inputControl.value,
1140
1515
  freeSolo: true,
1516
+ readOnly,
1141
1517
  multiple: true,
1142
1518
  getOptionLabel: v => typeof v === "string" ? v : v.name,
1143
1519
  filterOptions: (o, s) => o.filter(o => {
@@ -1165,7 +1541,7 @@ function MultipleAutocomplete(_ref2) {
1165
1541
  text: typeof v === "string" ? v : v.name,
1166
1542
  chipContainerClass: chipContainerClass,
1167
1543
  chipCloseButtonClass: chipCloseButtonClass,
1168
- onDeleteClick: () => {
1544
+ onDeleteClick: readOnly || disabled ? undefined : () => {
1169
1545
  const c = selectedOptionsControl.elements.find(x => x.value == v);
1170
1546
  if (c) removeElement(selectedOptionsControl, c);
1171
1547
  }
@@ -1173,7 +1549,8 @@ function MultipleAutocomplete(_ref2) {
1173
1549
  type: "text"
1174
1550
  }, getInputProps(), {
1175
1551
  placeholder: (_controlClasses$place2 = controlClasses == null ? void 0 : controlClasses.placeholder) != null ? _controlClasses$place2 : "",
1176
- className: clsx(inputClass)
1552
+ className: clsx(inputClass),
1553
+ readOnly: readOnly
1177
1554
  }))]
1178
1555
  }), /*#__PURE__*/jsx("button", _extends({}, getPopupIndicatorProps(), {
1179
1556
  disabled: disabled || readOnly,
@@ -1228,7 +1605,9 @@ const ValueForFieldExtension = {
1228
1605
  value: RenderType,
1229
1606
  name: "Value For Field",
1230
1607
  fields: buildSchema({
1231
- fieldRef: stringField("Field Reference")
1608
+ fieldRef: stringField("Field Reference"),
1609
+ noOptions: boolField("No Options"),
1610
+ refIsDirect: boolField("Reference is direct")
1232
1611
  })
1233
1612
  }
1234
1613
  };
@@ -1236,14 +1615,23 @@ function createValueForFieldRenderer(options) {
1236
1615
  return createDataRenderer((o, renderer) => {
1237
1616
  var _schemaDataForFieldRe;
1238
1617
  const {
1239
- fieldRef
1618
+ fieldRef,
1619
+ noOptions,
1620
+ refIsDirect
1240
1621
  } = o.renderOptions;
1241
- const actualFieldRef = fieldRef ? (_schemaDataForFieldRe = schemaDataForFieldRef(fieldRef, o.dataContext.parentNode)) == null || (_schemaDataForFieldRe = _schemaDataForFieldRe.control) == null ? void 0 : _schemaDataForFieldRe.value : undefined;
1242
- const node = actualFieldRef ? schemaForFieldRef(actualFieldRef, options.schema) : undefined;
1243
- return node ? /*#__PURE__*/jsx(ValueForField, {
1622
+ const actualFieldRef = fieldRef ? refIsDirect ? fieldRef : (_schemaDataForFieldRe = schemaDataForFieldRef(fieldRef, o.dataContext.parentNode)) == null || (_schemaDataForFieldRe = _schemaDataForFieldRe.control) == null ? void 0 : _schemaDataForFieldRe.value : ".";
1623
+ let schemaField;
1624
+ if (refIsDirect) {
1625
+ const dataNode = schemaDataForFieldRef(actualFieldRef, o.dataContext.parentNode);
1626
+ schemaField = trackedValue(dataNode.control.as());
1627
+ } else {
1628
+ schemaField = actualFieldRef ? schemaForFieldRef(actualFieldRef, options.schema).field : undefined;
1629
+ }
1630
+ return schemaField ? /*#__PURE__*/jsx(ValueForField, {
1244
1631
  renderer: renderer,
1245
- schema: node,
1246
- control: o.control
1632
+ schemaField: schemaField,
1633
+ control: o.control,
1634
+ noOptions: noOptions
1247
1635
  }) : /*#__PURE__*/jsx(Fragment, {
1248
1636
  children: actualFieldRef ? "No schema node for " + actualFieldRef : ""
1249
1637
  });
@@ -1252,9 +1640,10 @@ function createValueForFieldRenderer(options) {
1252
1640
  });
1253
1641
  }
1254
1642
  function ValueForField({
1255
- schema,
1643
+ schemaField,
1256
1644
  renderer,
1257
- control
1645
+ control,
1646
+ noOptions
1258
1647
  }) {
1259
1648
  var _effect = useComponentTracking();
1260
1649
  try {
@@ -1264,16 +1653,22 @@ function ValueForField({
1264
1653
  default: control
1265
1654
  }));
1266
1655
  const [controls, rootSchema] = useMemo(() => {
1267
- const rootSchema = rootSchemaNode([_extends({}, schema.field, {
1656
+ const adjustedField = _extends({}, schemaField, {
1657
+ collection: noOptions ? false : schemaField.collection,
1658
+ options: noOptions ? undefined : schemaField.options,
1268
1659
  field: "default",
1269
1660
  required: false,
1270
1661
  notNullable: false,
1271
1662
  onlyForTypes: null,
1272
1663
  defaultValue: undefined
1273
- })]);
1274
- return [addMissingControlsForSchema(rootSchema, []), rootSchema];
1275
- }, [schema]);
1276
- const Render = useControlRendererComponent(groupedControl(controls), renderer, {
1664
+ });
1665
+ const control = _extends({}, defaultControlForField(adjustedField), {
1666
+ hideTitle: true
1667
+ });
1668
+ const rootSchema = createSchemaTree([adjustedField]).rootNode;
1669
+ return [control, rootSchema];
1670
+ }, [schemaField]);
1671
+ const Render = useControlRendererComponent(controls, renderer, {
1277
1672
  disabled: control.disabled
1278
1673
  }, makeSchemaDataNode(rootSchema, value));
1279
1674
  return /*#__PURE__*/jsx(Render, {});
@@ -1303,21 +1698,19 @@ function createOptionalAdornment(options = {}) {
1303
1698
  control: editing,
1304
1699
  className: options.checkClass
1305
1700
  }))(rl);
1306
- wrapMarkup("children", children => options.customRender ? options.customRender({
1307
- allValues: getAllValues(dataControl),
1308
- editing,
1309
- children,
1310
- adornment,
1311
- nullToggler,
1312
- dataContext,
1313
- options
1314
- }) : /*#__PURE__*/jsx(OptionalEditRenderer, {
1315
- children: children,
1316
- options: options,
1317
- editing: editing.as(),
1318
- adornment: adornment,
1319
- dataControl: dataControl
1320
- }))(rl);
1701
+ wrapMarkup("children", children => {
1702
+ const props = {
1703
+ allValues: getAllValues(dataControl),
1704
+ editing,
1705
+ children,
1706
+ adornment,
1707
+ nullToggler,
1708
+ dataContext,
1709
+ options,
1710
+ dataControl
1711
+ };
1712
+ return options.customRender ? options.customRender(props) : /*#__PURE__*/jsx(OptionalEditRenderer, _extends({}, props));
1713
+ })(rl);
1321
1714
  },
1322
1715
  priority: 0,
1323
1716
  adornment
@@ -1331,13 +1724,17 @@ function OptionalEditRenderer({
1331
1724
  options,
1332
1725
  adornment,
1333
1726
  editing,
1334
- dataControl
1727
+ renderMultiValues,
1728
+ allValues,
1729
+ nullToggler
1335
1730
  }) {
1336
1731
  var _effect = useComponentTracking();
1337
1732
  try {
1338
- var _options$setNullText, _options$multiValuesT;
1339
- const nullToggler = getNullToggler(dataControl);
1340
- const allValues = getAllValues(dataControl);
1733
+ var _options$setNullText;
1734
+ renderMultiValues != null ? renderMultiValues : renderMultiValues = () => {
1735
+ var _options$multiValuesT;
1736
+ return (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values";
1737
+ };
1341
1738
  const multipleValues = allValues.value.length > 1;
1342
1739
  const nullEdit = adornment.allowNull ? /*#__PURE__*/jsxs("div", {
1343
1740
  className: options.nullWrapperClass,
@@ -1353,7 +1750,7 @@ function OptionalEditRenderer({
1353
1750
  className: options.className,
1354
1751
  children: multipleValues && editing.value === false ? /*#__PURE__*/jsx("div", {
1355
1752
  className: options.multiValuesClass,
1356
- children: (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values"
1753
+ children: renderMultiValues(allValues)
1357
1754
  }) : /*#__PURE__*/jsxs("div", {
1358
1755
  className: options.childWrapperClass,
1359
1756
  children: [nullEdit, children]
@@ -1426,18 +1823,18 @@ function ArrayElementRenderer({
1426
1823
  });
1427
1824
  if (designMode || extData.value !== undefined) {
1428
1825
  const parentDataNode = makeSchemaDataNode(dataProps.dataNode.schema, extData.fields.data);
1429
- const elementGroup = formNode.tree.createTempNode(formNode.id + "group", {
1826
+ const elementGroup = formNode.createChildNode("group", {
1430
1827
  type: ControlDefinitionType.Group,
1431
1828
  groupOptions: {
1432
1829
  type: GroupRenderType.Standard,
1433
1830
  hideTitle: true
1434
- }
1435
- }, formNode.getChildNodes());
1831
+ },
1832
+ children: formNode.getResolvedChildren()
1833
+ });
1436
1834
  const editContent = /*#__PURE__*/jsxs("div", {
1437
1835
  className: rendererClass(dataProps.className, options.className),
1438
1836
  children: [renderChild("", elementGroup, {
1439
- parentDataNode,
1440
- elementIndex: 0
1837
+ parentDataNode
1441
1838
  }), /*#__PURE__*/jsx("div", {
1442
1839
  className: options.actionsClass,
1443
1840
  children: /*#__PURE__*/jsx(RenderElements, {
@@ -1475,29 +1872,64 @@ function ArrayElementRenderer({
1475
1872
  }
1476
1873
 
1477
1874
  function createButtonActionRenderer(actionId, options = {}) {
1478
- return createActionRenderer(actionId, ({
1479
- onClick,
1480
- actionText,
1481
- className,
1482
- style,
1483
- actionId,
1484
- actionData,
1485
- disabled
1486
- }, renderer) => {
1487
- var _options$renderConten;
1875
+ return createActionRenderer(actionId, (props, renderer) => {
1876
+ var _props$icon, _ref, _props$iconPlacement, _options$renderConten;
1488
1877
  const {
1489
- Button
1878
+ key,
1879
+ onClick,
1880
+ actionText,
1881
+ className,
1882
+ style,
1883
+ actionId,
1884
+ actionData,
1885
+ disabled,
1886
+ textClass,
1887
+ actionStyle,
1888
+ inline,
1889
+ actionContent
1890
+ } = props;
1891
+ const icon = (_props$icon = props.icon) != null && _props$icon.name ? props.icon : options.icon;
1892
+ const iconPlacement = (_ref = (_props$iconPlacement = props.iconPlacement) != null ? _props$iconPlacement : options.iconPlacement) != null ? _ref : IconPlacement.BeforeText;
1893
+ const {
1894
+ Button,
1895
+ I,
1896
+ Span
1490
1897
  } = renderer.html;
1491
- const classNames = rendererClass(className, options.className);
1898
+ const isLink = actionStyle == ActionStyle.Link;
1899
+ const isGroup = actionStyle == ActionStyle.Group;
1900
+ const classNames = rendererClass(className, isLink ? options.linkClass : isGroup ? options.groupClass : rendererClass(options.buttonClass, actionStyle == ActionStyle.Secondary ? options.secondaryClass : options.primaryClass));
1901
+ const iconElement = icon && /*#__PURE__*/jsx(I, {
1902
+ iconName: icon.name,
1903
+ iconLibrary: icon.library,
1904
+ className: iconPlacement == IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass
1905
+ });
1906
+ const textClassNames = rendererClass(textClass, isLink ? options.linkTextClass : rendererClass(options.textClass, actionStyle == ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
1907
+ const textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsx(Span, {
1908
+ className: textClassNames,
1909
+ children: actionText
1910
+ });
1492
1911
  return /*#__PURE__*/jsx(Button, {
1493
1912
  className: classNames,
1913
+ textClass: textClassNames,
1494
1914
  disabled: disabled,
1495
1915
  style: style,
1496
1916
  onClick: onClick,
1497
- children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : renderer.renderText(actionText, classNames)
1498
- });
1917
+ inline: inline,
1918
+ nonTextContent: isGroup,
1919
+ title: iconPlacement == IconPlacement.ReplaceText ? actionText : undefined,
1920
+ notWrapInText: options.notWrapInText,
1921
+ androidRippleColor: options.androidRippleColor,
1922
+ children: (_options$renderConten = options.renderContent == null ? void 0 : options.renderContent(actionText, actionId, actionData)) != null ? _options$renderConten : /*#__PURE__*/jsxs(Fragment, {
1923
+ children: [iconPlacement == IconPlacement.BeforeText && iconElement, iconPlacement != IconPlacement.ReplaceText && textElement, iconPlacement != IconPlacement.BeforeText && iconElement]
1924
+ })
1925
+ }, key);
1499
1926
  });
1500
1927
  }
1928
+
1929
+ const _excluded = ["inline", "textClass", "className", "notWrapInText", "androidRippleColor", "onClick", "nonTextContent"],
1930
+ _excluded2 = ["textClass", "className", "onChangeValue", "onChangeChecked", "inputRef"],
1931
+ _excluded3 = ["text", "html", "children", "className", "textClass", "nativeRef", "inline"],
1932
+ _excluded4 = ["textClass", "className"];
1501
1933
  const DefaultBoolOptions = [{
1502
1934
  name: "Yes",
1503
1935
  value: true
@@ -1506,17 +1938,19 @@ const DefaultBoolOptions = [{
1506
1938
  value: false
1507
1939
  }];
1508
1940
  function createDefaultDataRenderer(options = {}) {
1509
- var _options$checkOptions, _options$radioOptions, _options$checkListOpt;
1941
+ var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
1942
+ const elementSelectedRenderer = createElementSelectedRenderer((_options$checkboxOpti = options.checkboxOptions) != null ? _options$checkboxOpti : options.checkOptions);
1510
1943
  const jsonataRenderer = createJsonataRenderer(options.jsonataClass);
1511
1944
  const nullToggler = createNullToggleRenderer();
1512
1945
  const multilineRenderer = createMultilineFieldRenderer(options.multilineClass);
1513
- const checkboxRenderer = createCheckboxRenderer((_options$checkOptions = options.checkOptions) != null ? _options$checkOptions : options.checkboxOptions);
1946
+ const checkboxRenderer = createCheckboxRenderer((_options$checkboxOpti2 = options.checkboxOptions) != null ? _options$checkboxOpti2 : options.checkOptions);
1514
1947
  const selectRenderer = createSelectRenderer(options.selectOptions);
1515
1948
  const radioRenderer = createRadioRenderer((_options$radioOptions = options.radioOptions) != null ? _options$radioOptions : options.checkOptions);
1516
1949
  const checkListRenderer = createCheckListRenderer((_options$checkListOpt = options.checkListOptions) != null ? _options$checkListOpt : options.checkOptions);
1517
1950
  const arrayElementRenderer = createArrayElementRenderer(options.arrayElementOptions);
1518
1951
  const {
1519
1952
  inputClass,
1953
+ inputTextClass,
1520
1954
  booleanOptions,
1521
1955
  optionRenderer,
1522
1956
  displayOnlyClass,
@@ -1534,7 +1968,7 @@ function createDefaultDataRenderer(options = {}) {
1534
1968
  const fieldType = field.type;
1535
1969
  const renderOptions = props.renderOptions;
1536
1970
  let renderType = renderOptions.type;
1537
- if (field.collection && props.elementIndex == null && (renderType == DataRenderType.Standard || renderType == DataRenderType.Array || renderType == DataRenderType.ArrayElement)) {
1971
+ if (field.collection && props.dataNode.elementIndex == null && (renderType == DataRenderType.Standard || renderType == DataRenderType.Array || renderType == DataRenderType.ArrayElement)) {
1538
1972
  if (renderType == DataRenderType.ArrayElement) return arrayElementRenderer.render(props, renderers);
1539
1973
  return arrayRenderer.render(props, renderers);
1540
1974
  }
@@ -1552,11 +1986,12 @@ function createDefaultDataRenderer(options = {}) {
1552
1986
  return _extends({}, p, {
1553
1987
  className: "@ " + rendererClass(p.className, displayOnlyClass),
1554
1988
  children: /*#__PURE__*/jsx(DefaultDisplayOnly, {
1555
- field: props.field,
1989
+ dataNode: props.dataNode,
1556
1990
  schemaInterface: props.dataContext.schemaInterface,
1557
- control: props.control,
1558
1991
  className: props.className,
1992
+ textClass: props.textClass,
1559
1993
  style: props.style,
1994
+ inline: props.inline,
1560
1995
  renderer: renderers,
1561
1996
  emptyText: isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText
1562
1997
  })
@@ -1586,6 +2021,8 @@ function createDefaultDataRenderer(options = {}) {
1586
2021
  return jsonataRenderer.render(props, renderers);
1587
2022
  case DataRenderType.Autocomplete:
1588
2023
  return autocompleteRenderer.render(props, renderers);
2024
+ case DataRenderType.ElementSelected:
2025
+ return elementSelectedRenderer.render(props, renderers);
1589
2026
  }
1590
2027
  if (fieldType == FieldType.Any) {
1591
2028
  var _field$displayName;
@@ -1597,6 +2034,7 @@ function createDefaultDataRenderer(options = {}) {
1597
2034
  const placeholder = isTextfieldRenderer(renderOptions) ? renderOptions.placeholder : undefined;
1598
2035
  return /*#__PURE__*/jsx(ControlInput, {
1599
2036
  className: rendererClass(props.className, inputClass),
2037
+ textClass: rendererClass(props.textClass, inputTextClass),
1600
2038
  style: props.style,
1601
2039
  id: props.id,
1602
2040
  readOnly: props.readonly,
@@ -1619,42 +2057,31 @@ function createDefaultAdornmentRenderer(options = {}) {
1619
2057
  adornment,
1620
2058
  designMode,
1621
2059
  dataContext,
1622
- useExpr
2060
+ runExpression
1623
2061
  } = props;
1624
2062
  return {
1625
2063
  apply: rl => {
1626
- if (isSetFieldAdornment(adornment) && useExpr) {
1627
- const hook = useExpr(adornment.expression, x => x);
1628
- const dynamicHooks = useDynamicHooks({
1629
- value: hook
1630
- });
1631
- const SetFieldWrapper = useTrackedComponent(setFieldWrapper, [dynamicHooks]);
2064
+ if (isSetFieldAdornment(adornment) && runExpression) {
1632
2065
  return wrapLayout(x => /*#__PURE__*/jsx(SetFieldWrapper, {
1633
2066
  children: x,
1634
2067
  parentContext: dataContext,
1635
- adornment: adornment
2068
+ adornment: adornment,
2069
+ runExpression: runExpression
1636
2070
  }))(rl);
1637
- function setFieldWrapper({
1638
- children,
1639
- adornment,
1640
- parentContext
1641
- }) {
1642
- const {
1643
- value
1644
- } = dynamicHooks(parentContext);
1645
- const fieldNode = schemaDataForFieldRef(adornment.field, parentContext.parentNode);
1646
- const otherField = fieldNode.control;
1647
- const always = !adornment.defaultOnly;
1648
- useControlEffect(() => [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null], ([v]) => {
1649
- otherField == null || otherField.setValue(x => always || x == null ? v : x);
1650
- }, true);
1651
- return children;
1652
- }
1653
2071
  }
1654
2072
  if (isIconAdornment(adornment)) {
1655
- var _adornment$placement;
1656
- return appendMarkupAt((_adornment$placement = adornment.placement) != null ? _adornment$placement : AdornmentPlacement.ControlStart, /*#__PURE__*/jsx("i", {
1657
- className: adornment.iconClass
2073
+ const {
2074
+ I
2075
+ } = renderers.html;
2076
+ const {
2077
+ icon,
2078
+ placement,
2079
+ iconClass
2080
+ } = adornment;
2081
+ return appendMarkupAt(placement != null ? placement : AdornmentPlacement.ControlStart, /*#__PURE__*/jsx(I, {
2082
+ className: iconClass,
2083
+ iconName: icon == null ? void 0 : icon.name,
2084
+ iconLibrary: icon == null ? void 0 : icon.library
1658
2085
  }))(rl);
1659
2086
  }
1660
2087
  if (isAccordionAdornment(adornment)) {
@@ -1675,11 +2102,29 @@ function createDefaultAdornmentRenderer(options = {}) {
1675
2102
  }
1676
2103
  };
1677
2104
  }
2105
+ function SetFieldWrapper({
2106
+ children,
2107
+ adornment,
2108
+ parentContext,
2109
+ runExpression
2110
+ }) {
2111
+ const fieldNode = schemaDataForFieldRef(adornment.field, parentContext.parentNode);
2112
+ const otherField = fieldNode.control;
2113
+ const always = !adornment.defaultOnly;
2114
+ const value = useExpression(undefined, runExpression, adornment.expression, x => x);
2115
+ useControlEffect(() => [value == null ? void 0 : value.value, (otherField == null ? void 0 : otherField.value) == null], ([v]) => {
2116
+ otherField == null || otherField.setValue(x => always || x == null ? v : x);
2117
+ }, true);
2118
+ return children;
2119
+ }
1678
2120
  function createDefaultLabelRenderer(options) {
1679
2121
  const {
1680
2122
  className,
2123
+ controlLabelTextClass,
2124
+ groupLabelTextClass,
1681
2125
  groupLabelClass,
1682
2126
  controlLabelClass,
2127
+ textClass,
1683
2128
  labelContainer
1684
2129
  } = _extends({
1685
2130
  labelContainer: c => c
@@ -1688,18 +2133,22 @@ function createDefaultLabelRenderer(options) {
1688
2133
  render: (props, labelStart, labelEnd, renderers) => {
1689
2134
  var _options$requiredElem;
1690
2135
  const {
1691
- Label
2136
+ Label,
2137
+ Span
1692
2138
  } = renderers.html;
1693
2139
  const requiredElement = (_options$requiredElem = options == null ? void 0 : options.requiredElement) != null ? _options$requiredElem : ({
1694
2140
  Span
1695
2141
  }) => /*#__PURE__*/jsx(Span, {
1696
2142
  children: " *"
1697
2143
  });
1698
- if (props.type == LabelType.Text) return renderers.renderText(props.label);
2144
+ if (props.type == LabelType.Text) return /*#__PURE__*/jsx(Span, {
2145
+ children: props.label
2146
+ });
1699
2147
  return labelContainer(/*#__PURE__*/jsxs(Fragment, {
1700
2148
  children: [/*#__PURE__*/jsxs(Label, {
1701
2149
  htmlFor: props.forId,
1702
2150
  className: rendererClass(props.className, clsx(className, props.type === LabelType.Group && groupLabelClass, props.type === LabelType.Control && controlLabelClass)),
2151
+ textClass: rendererClass(props.textClass, clsx(textClass, props.type === LabelType.Group && groupLabelTextClass, props.type === LabelType.Control && controlLabelTextClass)),
1703
2152
  children: [labelStart, renderers.renderLabelText(props.label), props.required && requiredElement(renderers.html)]
1704
2153
  }), labelEnd]
1705
2154
  }));
@@ -1708,17 +2157,127 @@ function createDefaultLabelRenderer(options) {
1708
2157
  };
1709
2158
  }
1710
2159
  const StandardHtmlComponents = {
1711
- Button: "button",
1712
- Label: "label",
1713
- I: "i",
2160
+ Button: DefaultHtmlButtonRenderer,
2161
+ Label: DefaultHtmlLabelRenderer,
2162
+ I: DefaultHtmlIconRenderer,
1714
2163
  Span: "span",
1715
- Div: "div",
2164
+ Div: DefaultHtmlDivRenderer,
1716
2165
  H1: "h1",
1717
2166
  B: "b",
1718
- Input: "input"
2167
+ Input: DefaultHtmlInputRenderer
1719
2168
  };
2169
+ function DefaultHtmlButtonRenderer(_ref2) {
2170
+ var _effect = useComponentTracking();
2171
+ try {
2172
+ let {
2173
+ textClass,
2174
+ className,
2175
+ onClick,
2176
+ nonTextContent
2177
+ } = _ref2,
2178
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded);
2179
+ const Comp = nonTextContent ? "div" : "button";
2180
+ return /*#__PURE__*/jsx(Comp, _extends({
2181
+ role: nonTextContent ? "button" : undefined,
2182
+ onClick: onClick ? e => {
2183
+ e.stopPropagation();
2184
+ onClick();
2185
+ } : undefined,
2186
+ className: nonTextContent ? className : clsx(className, textClass)
2187
+ }, props));
2188
+ } finally {
2189
+ _effect();
2190
+ }
2191
+ }
2192
+ function DefaultHtmlInputRenderer(_ref3) {
2193
+ var _effect2 = useComponentTracking();
2194
+ try {
2195
+ let {
2196
+ textClass,
2197
+ className,
2198
+ onChangeValue,
2199
+ onChangeChecked,
2200
+ inputRef
2201
+ } = _ref3,
2202
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
2203
+ return /*#__PURE__*/jsx("input", _extends({
2204
+ ref: inputRef
2205
+ }, props, {
2206
+ className: clsx(className, textClass),
2207
+ onChange: onChangeValue ? e => onChangeValue(e.target.value) : onChangeChecked ? e => onChangeChecked(e.target.checked) : undefined
2208
+ }));
2209
+ } finally {
2210
+ _effect2();
2211
+ }
2212
+ }
2213
+ function DefaultHtmlDivRenderer(_ref4) {
2214
+ var _effect3 = useComponentTracking();
2215
+ try {
2216
+ let {
2217
+ text,
2218
+ html,
2219
+ children,
2220
+ className,
2221
+ textClass,
2222
+ nativeRef,
2223
+ inline
2224
+ } = _ref4,
2225
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
2226
+ const Tag = inline ? "span" : "div";
2227
+ return /*#__PURE__*/jsx(Tag, _extends({}, props, {
2228
+ ref: nativeRef,
2229
+ className: clsx(className, textClass),
2230
+ children: text != null ? text : children,
2231
+ dangerouslySetInnerHTML: html ? {
2232
+ __html: html
2233
+ } : undefined
2234
+ }));
2235
+ } finally {
2236
+ _effect3();
2237
+ }
2238
+ }
2239
+ function DefaultHtmlLabelRenderer(_ref5) {
2240
+ var _effect4 = useComponentTracking();
2241
+ try {
2242
+ let {
2243
+ textClass,
2244
+ className
2245
+ } = _ref5,
2246
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded4);
2247
+ return /*#__PURE__*/jsx("label", _extends({}, props, {
2248
+ className: clsx(className, textClass)
2249
+ }));
2250
+ } finally {
2251
+ _effect4();
2252
+ }
2253
+ }
2254
+ function DefaultHtmlIconRenderer({
2255
+ iconName,
2256
+ iconLibrary,
2257
+ className,
2258
+ style
2259
+ }) {
2260
+ var _effect5 = useComponentTracking();
2261
+ try {
2262
+ return iconName ? /*#__PURE__*/jsx("i", {
2263
+ className: clsx(className, toIconClass()),
2264
+ style: style
2265
+ }) : undefined;
2266
+ function toIconClass() {
2267
+ if (!iconName) return undefined;
2268
+ switch (iconLibrary) {
2269
+ case IconLibrary.FontAwesome:
2270
+ return "fa fa-" + iconName;
2271
+ default:
2272
+ return iconName;
2273
+ }
2274
+ }
2275
+ } finally {
2276
+ _effect5();
2277
+ }
2278
+ }
1720
2279
  function createDefaultRenderers(options = {}) {
1721
- var _options$extraRendere, _options$renderText, _options$html;
2280
+ var _options$extraRendere, _options$html;
1722
2281
  return {
1723
2282
  data: createDefaultDataRenderer(options.data),
1724
2283
  display: createDefaultDisplayRenderer(options.display),
@@ -1730,7 +2289,6 @@ function createDefaultRenderers(options = {}) {
1730
2289
  renderLayout: createDefaultLayoutRenderer(options.layout),
1731
2290
  visibility: createDefaultVisibilityRenderer(),
1732
2291
  extraRenderers: (_options$extraRendere = options.extraRenderers == null ? void 0 : options.extraRenderers(options)) != null ? _options$extraRendere : [],
1733
- renderText: (_options$renderText = options.renderText) != null ? _options$renderText : x => x,
1734
2292
  html: (_options$html = options.html) != null ? _options$html : StandardHtmlComponents
1735
2293
  };
1736
2294
  }
@@ -1746,7 +2304,7 @@ function createClassStyledRenderers() {
1746
2304
  className: "control-array"
1747
2305
  },
1748
2306
  action: {
1749
- className: "action"
2307
+ buttonClass: "action"
1750
2308
  },
1751
2309
  data: {
1752
2310
  inputClass: "data"
@@ -1776,8 +2334,12 @@ const defaultTailwindTheme = {
1776
2334
  },
1777
2335
  group: {
1778
2336
  standardClassName: "flex flex-col gap-4",
1779
- gridClassName: "gap-x-2 gap-y-4",
2337
+ grid: {
2338
+ className: "flex flex-col gap-4",
2339
+ rowClass: "flex flex-row gap-4 justify-between *:flex-1"
2340
+ },
1780
2341
  flexClassName: "gap-2",
2342
+ inlineClass: "",
1781
2343
  tabs: {
1782
2344
  className: "",
1783
2345
  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",
@@ -1789,7 +2351,11 @@ const defaultTailwindTheme = {
1789
2351
  }
1790
2352
  },
1791
2353
  action: {
1792
- className: "bg-primary-500 rounded-lg p-3 text-white"
2354
+ buttonClass: "rounded-lg p-3 text-white disabled:opacity-75 disabled:cursor-not-allowed",
2355
+ primaryClass: "bg-primary-500",
2356
+ secondaryClass: "bg-secondary-500",
2357
+ iconBeforeClass: "px-2",
2358
+ iconAfterClass: "px-2"
1793
2359
  },
1794
2360
  layout: {
1795
2361
  className: "flex flex-col",
@@ -1800,7 +2366,7 @@ const defaultTailwindTheme = {
1800
2366
  displayOnlyClass: "flex flex-row items-center gap-2",
1801
2367
  checkOptions: {
1802
2368
  className: "flex items-center gap-4",
1803
- entryClass: "flex gap-1 items-center"
2369
+ entryClass: "flex items-center gap-1"
1804
2370
  },
1805
2371
  selectOptions: {
1806
2372
  emptyText: "<select>"
@@ -1821,8 +2387,8 @@ const defaultTailwindTheme = {
1821
2387
  accordion: {
1822
2388
  className: "flex items-center gap-2 my-2",
1823
2389
  titleClass: "cursor-pointer",
1824
- iconOpenClass: "fa fa-chevron-up",
1825
- iconClosedClass: "fa fa-chevron-down"
2390
+ iconOpen: fontAwesomeIcon("chevron-up"),
2391
+ iconClosed: fontAwesomeIcon("chevron-down")
1826
2392
  },
1827
2393
  optional: {
1828
2394
  checkClass: "m-2",
@@ -1833,5 +2399,5 @@ const defaultTailwindTheme = {
1833
2399
  }
1834
2400
  };
1835
2401
 
1836
- export { CheckButtons, ControlInput, DataArrayRenderer, DefaultAccordion, DefaultArrayRenderer, DefaultBoolOptions, DefaultDisplay, DefaultDisplayOnly, DefaultLayout, DefaultVisibility, Fcheckbox, JsonataRenderer, OptionalEditRenderer, SelectDataRenderer, StandardHtmlComponents, ValueForFieldExtension, createAutocompleteRenderer, createButtonActionRenderer, createCheckListRenderer, createCheckboxRenderer, createClassStyledRenderers, createDefaultAdornmentRenderer, createDefaultArrayDataRenderer, createDefaultArrayRenderer, createDefaultDataRenderer, createDefaultDisplayRenderer, createDefaultGroupRenderer, createDefaultLabelRenderer, createDefaultLayoutRenderer, createDefaultRenderers, createDefaultVisibilityRenderer, createInputConversion, createJsonataRenderer, createNullToggleRenderer, createOptionalAdornment, createRadioRenderer, createSelectConversion, createSelectRenderer, createValueForFieldRenderer, defaultTailwindTheme, getAccordionState, setIncluded };
2402
+ export { CheckButtons, ControlInput, DataArrayRenderer, DefaultAccordion, DefaultArrayRenderer, DefaultBoolOptions, DefaultDisplay, DefaultDisplayOnly, DefaultHtmlButtonRenderer, DefaultHtmlDivRenderer, DefaultHtmlIconRenderer, DefaultHtmlInputRenderer, DefaultHtmlLabelRenderer, DefaultLayout, DefaultVisibility, Fcheckbox, JsonataRenderer, OptionalEditRenderer, SelectDataRenderer, StandardHtmlComponents, ValueForFieldExtension, createAutocompleteRenderer, createButtonActionRenderer, createCheckListRenderer, createCheckboxRenderer, createClassStyledRenderers, createDefaultAdornmentRenderer, createDefaultArrayDataRenderer, createDefaultArrayRenderer, createDefaultDataRenderer, createDefaultDisplayRenderer, createDefaultGroupRenderer, createDefaultLabelRenderer, createDefaultLayoutRenderer, createDefaultRenderers, createDefaultVisibilityRenderer, createElementSelectedRenderer, createInputConversion, createJsonataRenderer, createNullToggleRenderer, createOptionalAdornment, createRadioRenderer, createSelectConversion, createSelectRenderer, createValueForFieldRenderer, createWizardRenderer, defaultTailwindTheme, getAccordionState, setIncluded };
1837
2403
  //# sourceMappingURL=index.js.map