@react-typed-forms/schemas 15.1.3 → 15.2.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.
@@ -1,10 +1,12 @@
1
1
  import React, {
2
- ComponentType,
2
+ ButtonHTMLAttributes,
3
3
  ElementType,
4
4
  FC,
5
5
  Fragment,
6
6
  HTMLAttributes,
7
+ InputHTMLAttributes,
7
8
  Key,
9
+ LabelHTMLAttributes,
8
10
  ReactElement,
9
11
  ReactNode,
10
12
  useCallback,
@@ -23,7 +25,6 @@ import {
23
25
  useControlEffect,
24
26
  } from "@react-typed-forms/core";
25
27
  import {
26
- ActionStyle,
27
28
  AdornmentPlacement,
28
29
  ArrayActionOptions,
29
30
  ControlActionHandler,
@@ -38,13 +39,14 @@ import {
38
39
  DisplayDataType,
39
40
  DynamicPropertyType,
40
41
  FormContextData,
42
+ FormNode,
41
43
  GroupRenderOptions,
42
- IconPlacement,
43
- IconReference,
44
44
  isActionControl,
45
45
  isDataControl,
46
46
  isDisplayControl,
47
47
  isGroupControl,
48
+ legacyFormNode,
49
+ lookupDataNode,
48
50
  RenderOptions,
49
51
  } from "./controlDefinition";
50
52
  import {
@@ -83,74 +85,24 @@ import {
83
85
  SchemaValidator,
84
86
  ValidatorType,
85
87
  } from "./schemaValidator";
86
- import { FieldOption, SchemaField } from "./schemaField";
87
- import { FormNode, legacyFormNode, lookupDataNode } from "./formNode";
88
- import { SchemaInterface } from "./schemaInterface";
89
- import { makeSchemaDataNode, SchemaDataNode } from "./schemaDataNode";
90
- import { createSchemaTree } from "./schemaNode";
91
-
92
- export interface HtmlIconProperties {
93
- className?: string;
94
- style?: React.CSSProperties;
95
- iconLibrary?: string;
96
- iconName?: string;
97
- }
98
-
99
- export interface HtmlLabelProperties {
100
- htmlFor?: string;
101
- className?: string;
102
- textClass?: string;
103
- children?: ReactNode;
104
- }
105
-
106
- export interface HtmlDivProperties {
107
- id?: string;
108
- className?: string;
109
- textClass?: string;
110
- style?: React.CSSProperties;
111
- children?: ReactNode;
112
- text?: string;
113
- html?: string;
114
- nativeRef?: (e: HTMLElement | null) => void;
115
- inline?: boolean;
116
- }
117
-
118
- export interface HtmlInputProperties {
119
- id?: string;
120
- className?: string;
121
- textClass?: string;
122
- name?: string;
123
- type?: string;
124
- checked?: boolean;
125
- style?: React.CSSProperties;
126
- readOnly?: boolean;
127
- placeholder?: string;
128
- value?: string | number;
129
- onBlur?: () => void;
130
- disabled?: boolean;
131
- inputRef?: (e: HTMLElement | null) => void;
132
- onChangeValue?: (value: string) => void;
133
- onChangeChecked?: (checked: boolean) => void;
134
- }
88
+ import {
89
+ createSchemaLookup,
90
+ FieldOption,
91
+ makeSchemaDataNode,
92
+ SchemaDataNode,
93
+ SchemaField,
94
+ SchemaInterface,
95
+ } from "./schemaField";
135
96
 
136
- export interface HtmlButtonProperties {
137
- className?: string;
138
- textClass?: string;
139
- disabled?: boolean;
140
- style?: React.CSSProperties;
141
- onClick?: () => void;
142
- inline?: boolean;
143
- children?: ReactNode;
144
- }
145
97
  export interface HtmlComponents {
146
- Div: ComponentType<HtmlDivProperties>;
98
+ Div: ElementType<HTMLAttributes<HTMLDivElement>, "div">;
147
99
  Span: ElementType<HTMLAttributes<HTMLSpanElement>>;
148
- Button: ComponentType<HtmlButtonProperties>;
149
- I: ComponentType<HtmlIconProperties>;
150
- Label: ComponentType<HtmlLabelProperties>;
100
+ Button: ElementType<ButtonHTMLAttributes<HTMLButtonElement>>;
101
+ I: ElementType<HTMLAttributes<HTMLElement>>;
102
+ Label: ElementType<LabelHTMLAttributes<HTMLLabelElement>>;
151
103
  B: ElementType<HTMLAttributes<HTMLElement>>;
152
104
  H1: ElementType<HTMLAttributes<HTMLElement>>;
153
- Input: ComponentType<HtmlInputProperties>;
105
+ Input: ElementType<InputHTMLAttributes<HTMLInputElement>, "input">;
154
106
  }
155
107
  /**
156
108
  * Interface for rendering different types of form controls.
@@ -235,6 +187,7 @@ export interface FormRenderer {
235
187
  * @returns A React node.
236
188
  */
237
189
  renderLabelText: (props: ReactNode) => ReactNode;
190
+ renderText: (props: ReactNode, className?: string) => ReactNode;
238
191
 
239
192
  html: HtmlComponents;
240
193
  }
@@ -288,7 +241,6 @@ export interface RenderedLayout {
288
241
  className?: string;
289
242
  style?: React.CSSProperties;
290
243
  wrapLayout: (layout: ReactElement) => ReactElement;
291
- inline?: boolean;
292
244
  }
293
245
 
294
246
  export interface RenderedControl {
@@ -296,7 +248,6 @@ export interface RenderedControl {
296
248
  className?: string;
297
249
  style?: React.CSSProperties;
298
250
  divRef?: (cb: HTMLElement | null) => void;
299
- inline?: boolean;
300
251
  }
301
252
 
302
253
  export interface VisibilityRendererProps extends RenderedControl {
@@ -311,7 +262,6 @@ export interface ControlLayoutProps {
311
262
  processLayout?: (props: ControlLayoutProps) => ControlLayoutProps;
312
263
  className?: string | null;
313
264
  style?: React.CSSProperties;
314
- inline?: boolean;
315
265
  }
316
266
 
317
267
  /**
@@ -368,11 +318,6 @@ export interface LabelRendererProps {
368
318
  * The CSS class name for the label.
369
319
  */
370
320
  className?: string;
371
-
372
- /**
373
- * The CSS class name for the label text.
374
- */
375
- textClass?: string;
376
321
  }
377
322
 
378
323
  /**
@@ -399,13 +344,10 @@ export interface DisplayRendererProps {
399
344
  */
400
345
  className?: string;
401
346
 
402
- textClass?: string;
403
-
404
347
  /**
405
348
  * The CSS styles for the display renderer.
406
349
  */
407
350
  style?: React.CSSProperties;
408
- inline?: boolean;
409
351
  }
410
352
 
411
353
  export type ChildVisibilityFunc = (
@@ -417,7 +359,6 @@ export interface ParentRendererProps {
417
359
  formNode: FormNode;
418
360
  renderChild: ChildRenderer;
419
361
  className?: string;
420
- textClass?: string;
421
362
  style?: React.CSSProperties;
422
363
  dataContext: ControlDataContext;
423
364
  useChildVisibility: ChildVisibilityFunc;
@@ -434,6 +375,7 @@ export interface DataRendererProps extends ParentRendererProps {
434
375
  renderOptions: RenderOptions;
435
376
  definition: DataControlDefinition;
436
377
  field: SchemaField;
378
+ elementIndex?: number;
437
379
  id: string;
438
380
  control: Control<any>;
439
381
  readonly: boolean;
@@ -442,22 +384,16 @@ export interface DataRendererProps extends ParentRendererProps {
442
384
  hidden: boolean;
443
385
  dataNode: SchemaDataNode;
444
386
  displayOnly: boolean;
445
- inline: boolean;
446
387
  }
447
388
 
448
389
  export interface ActionRendererProps {
449
390
  actionId: string;
450
391
  actionText: string;
451
392
  actionData?: any;
452
- actionStyle?: ActionStyle;
453
- icon?: IconReference | null;
454
- iconPlacement?: IconPlacement;
455
393
  onClick: () => void;
456
394
  className?: string | null;
457
- textClass?: string | null;
458
395
  style?: React.CSSProperties;
459
396
  disabled?: boolean;
460
- inline?: boolean;
461
397
  }
462
398
 
463
399
  export interface ControlRenderProps {
@@ -470,13 +406,28 @@ export interface FormContextOptions {
470
406
  hidden?: boolean | null;
471
407
  disabled?: boolean | null;
472
408
  displayOnly?: boolean;
473
- inline?: boolean;
409
+ }
410
+
411
+ export interface DataControlProps {
412
+ formNode: FormNode;
413
+ definition: DataControlDefinition;
414
+ dataContext: ControlDataContext;
415
+ control: Control<any>;
416
+ formOptions: FormContextOptions;
417
+ style?: React.CSSProperties | undefined;
418
+ renderChild: ChildRenderer;
419
+ elementIndex?: number;
420
+ allowedOptions?: Control<any[] | undefined>;
421
+ useChildVisibility: ChildVisibilityFunc;
422
+ useEvalExpression: UseEvalExpressionHook;
423
+ schemaInterface?: SchemaInterface;
424
+ designMode?: boolean;
425
+ styleClass?: string;
426
+ layoutClass?: string;
474
427
  }
475
428
 
476
429
  export type CreateDataProps = (
477
- controlProps: RenderLayoutProps,
478
- definition: DataControlDefinition,
479
- control: Control<any>,
430
+ controlProps: DataControlProps,
480
431
  ) => DataRendererProps;
481
432
 
482
433
  export interface ControlRenderOptions
@@ -499,6 +450,7 @@ export interface ControlRenderOptions
499
450
  ) => ControlLayoutProps;
500
451
  clearHidden?: boolean;
501
452
  schemaInterface?: SchemaInterface;
453
+ elementIndex?: number;
502
454
  formData?: FormContextData;
503
455
  }
504
456
 
@@ -533,10 +485,16 @@ export function useControlRendererComponent(
533
485
  ? [controlOrFormNode.definition, controlOrFormNode]
534
486
  : [controlOrFormNode, legacyFormNode(controlOrFormNode)];
535
487
  const dataProps = options.useDataHook?.(definition) ?? defaultDataProps;
488
+ const elementIndex = options.elementIndex;
536
489
  const schemaInterface = options.schemaInterface ?? defaultSchemaInterface;
537
490
  const useExpr = options.useEvalExpressionHook ?? defaultUseEvalExpressionHook;
538
491
 
539
- let dataNode = lookupDataNode(definition, parentDataNode);
492
+ let dataNode: SchemaDataNode | undefined;
493
+ if (elementIndex != null) {
494
+ dataNode = parentDataNode.getChildElement(elementIndex);
495
+ } else {
496
+ dataNode = lookupDataNode(definition, parentDataNode);
497
+ }
540
498
  const useValidation = useMakeValidationHook(
541
499
  definition,
542
500
  options.useValidationHook,
@@ -565,6 +523,7 @@ export function useControlRendererComponent(
565
523
  const r = useUpdatedRef({
566
524
  options,
567
525
  definition,
526
+ elementIndex,
568
527
  parentDataNode,
569
528
  dataNode,
570
529
  formNode,
@@ -578,6 +537,7 @@ export function useControlRendererComponent(
578
537
  const {
579
538
  definition: c,
580
539
  options,
540
+ elementIndex,
581
541
  parentDataNode: pdn,
582
542
  dataNode: dn,
583
543
  formNode,
@@ -666,7 +626,6 @@ export function useControlRendererComponent(
666
626
  readonly: options.readonly || readonlyControl.value,
667
627
  disabled: options.disabled || disabledControl.value,
668
628
  displayOnly: options.displayOnly || isControlDisplayOnly(c),
669
- inline: options.inline,
670
629
  }));
671
630
  const myOptions = trackedValue(myOptionsControl);
672
631
  useValidation({
@@ -674,17 +633,12 @@ export function useControlRendererComponent(
674
633
  hiddenControl: myOptionsControl.fields.hidden,
675
634
  dataContext,
676
635
  });
677
- const {
678
- styleClass,
679
- labelClass,
680
- layoutClass,
681
- labelTextClass,
682
- textClass,
683
- ...inheritableOptions
684
- } = options;
636
+ const { styleClass, labelClass, layoutClass, ...inheritableOptions } =
637
+ options;
685
638
  const childOptions: ControlRenderOptions = {
686
639
  ...inheritableOptions,
687
640
  ...myOptions,
641
+ elementIndex: undefined,
688
642
  };
689
643
 
690
644
  useEffect(() => {
@@ -695,6 +649,7 @@ export function useControlRendererComponent(
695
649
  )
696
650
  control.disabled = myOptions.disabled;
697
651
  }, [control, myOptions.disabled]);
652
+ if (parentControl.isNull) return <></>;
698
653
 
699
654
  const adornments =
700
655
  definition.adornments?.map((x) =>
@@ -705,9 +660,19 @@ export function useControlRendererComponent(
705
660
  formOptions: myOptions,
706
661
  }),
707
662
  ) ?? [];
663
+ const otherChildNodes =
664
+ definition.childRefId &&
665
+ formNode.tree.getByRefId(definition.childRefId)?.getChildNodes();
708
666
 
709
667
  const labelAndChildren = renderControlLayout({
710
- formNode,
668
+ formNode: otherChildNodes
669
+ ? formNode.tree.createTempNode(
670
+ formNode.id,
671
+ definition,
672
+ otherChildNodes,
673
+ )
674
+ : formNode,
675
+ definition: c,
711
676
  renderer,
712
677
  renderChild: (k, child, options) => {
713
678
  const overrideClasses = getGroupClassOverrides(c);
@@ -733,6 +698,7 @@ export function useControlRendererComponent(
733
698
  formOptions: myOptions,
734
699
  dataContext,
735
700
  control: displayControl ?? control,
701
+ elementIndex,
736
702
  schemaInterface,
737
703
  labelText,
738
704
  displayControl,
@@ -743,7 +709,6 @@ export function useControlRendererComponent(
743
709
  actionOnClick: options.actionOnClick,
744
710
  styleClass: options.styleClass,
745
711
  labelClass: options.labelClass,
746
- textClass: options.textClass,
747
712
  useEvalExpression: useExpr,
748
713
  useChildVisibility: (childDef, parentNode, dontOverride) => {
749
714
  return useEvalVisibilityHook(
@@ -792,7 +757,7 @@ export function ControlRenderer({
792
757
  parentPath?: JsonPath[];
793
758
  }) {
794
759
  const schemaDataNode = makeSchemaDataNode(
795
- createSchemaTree(fields).rootNode,
760
+ createSchemaLookup({ "": fields }).getSchema("")!,
796
761
  control,
797
762
  );
798
763
  const Render = useControlRendererComponent(
@@ -824,23 +789,19 @@ export function NewControlRenderer({
824
789
  return <Render />;
825
790
  }
826
791
 
827
- export function defaultDataProps(
828
- {
829
- formOptions,
830
- style,
831
- allowedOptions,
832
- schemaInterface = defaultSchemaInterface,
833
- styleClass,
834
- textClass: tc,
835
- ...props
836
- }: RenderLayoutProps,
837
- definition: DataControlDefinition,
838
- control: Control<any>,
839
- ): DataRendererProps {
792
+ export function defaultDataProps({
793
+ definition,
794
+ control,
795
+ formOptions,
796
+ style,
797
+ allowedOptions,
798
+ schemaInterface = defaultSchemaInterface,
799
+ styleClass,
800
+ ...props
801
+ }: DataControlProps): DataRendererProps {
840
802
  const dataNode = props.dataContext.dataNode!;
841
803
  const field = dataNode.schema.field;
842
804
  const className = rendererClass(styleClass, definition.styleClass);
843
- const textClass = rendererClass(tc, definition.textClass);
844
805
  const displayOnly = !!formOptions.displayOnly;
845
806
  const required = !!definition.required && !displayOnly;
846
807
  const fieldOptions = schemaInterface.getDataOptions(dataNode);
@@ -852,7 +813,6 @@ export function defaultDataProps(
852
813
  control,
853
814
  field,
854
815
  id: "c" + control.uniqueId,
855
- inline: !!formOptions.inline,
856
816
  options:
857
817
  allowed.length > 0
858
818
  ? allowed
@@ -872,16 +832,15 @@ export function defaultDataProps(
872
832
  required,
873
833
  hidden: !!formOptions.hidden,
874
834
  className,
875
- textClass,
876
835
  style,
877
836
  ...props,
878
837
  };
879
838
  }
880
839
 
881
840
  export interface ChildRendererOptions {
841
+ elementIndex?: number;
882
842
  parentDataNode?: SchemaDataNode;
883
843
  formData?: FormContextData;
884
- inline?: boolean;
885
844
  displayOnly?: boolean;
886
845
  styleClass?: string;
887
846
  layoutClass?: string;
@@ -894,7 +853,8 @@ export type ChildRenderer = (
894
853
  options?: ChildRendererOptions,
895
854
  ) => ReactNode;
896
855
 
897
- export interface RenderLayoutProps {
856
+ export interface RenderControlProps {
857
+ definition: ControlDefinition;
898
858
  formNode: FormNode;
899
859
  renderer: FormRenderer;
900
860
  renderChild: ChildRenderer;
@@ -903,6 +863,7 @@ export interface RenderLayoutProps {
903
863
  dataContext: ControlDataContext;
904
864
  control?: Control<any>;
905
865
  labelText?: Control<string | null | undefined>;
866
+ elementIndex?: number;
906
867
  displayControl?: Control<string | undefined>;
907
868
  style?: React.CSSProperties;
908
869
  allowedOptions?: Control<any[] | undefined>;
@@ -917,14 +878,13 @@ export interface RenderLayoutProps {
917
878
  displayProps: DisplayRendererProps,
918
879
  ) => ReactNode;
919
880
  labelClass?: string;
920
- labelTextClass?: string;
921
881
  styleClass?: string;
922
- textClass?: string;
923
882
  }
924
883
  export function renderControlLayout(
925
- props: RenderLayoutProps,
884
+ props: RenderControlProps,
926
885
  ): ControlLayoutProps {
927
886
  const {
887
+ definition: c,
928
888
  renderer,
929
889
  renderChild,
930
890
  control,
@@ -938,13 +898,10 @@ export function renderControlLayout(
938
898
  customDisplay,
939
899
  useEvalExpression,
940
900
  labelClass,
941
- labelTextClass,
942
901
  styleClass,
943
- textClass,
944
902
  formNode,
945
- formOptions,
946
903
  } = props;
947
- const c = formNode.definition;
904
+
948
905
  if (isDataControl(c)) {
949
906
  return renderData(c);
950
907
  }
@@ -959,7 +916,6 @@ export function renderControlLayout(
959
916
  }
960
917
 
961
918
  return {
962
- inline: formOptions.inline,
963
919
  processLayout: renderer.renderGroup({
964
920
  formNode,
965
921
  definition: c,
@@ -968,7 +924,6 @@ export function renderControlLayout(
968
924
  dataContext,
969
925
  renderOptions: c.groupOptions ?? { type: "Standard" },
970
926
  className: rendererClass(styleClass, c.styleClass),
971
- textClass: rendererClass(textClass, c.textClass),
972
927
  useChildVisibility,
973
928
  style,
974
929
  designMode,
@@ -976,7 +931,6 @@ export function renderControlLayout(
976
931
  label: {
977
932
  label: labelText?.value ?? c.title,
978
933
  className: rendererClass(labelClass, c.labelClass),
979
- textClass: rendererClass(labelTextClass, c.labelTextClass),
980
934
  type: LabelType.Group,
981
935
  hide: c.groupOptions?.hideTitle,
982
936
  },
@@ -985,15 +939,10 @@ export function renderControlLayout(
985
939
  if (isActionControl(c)) {
986
940
  const actionData = props.actionDataControl?.value ?? c.actionData;
987
941
  return {
988
- inline: formOptions.inline,
989
942
  children: renderer.renderAction({
990
943
  actionText: labelText?.value ?? c.title ?? c.actionId,
991
944
  actionId: c.actionId,
992
945
  actionData,
993
- actionStyle: c.actionStyle ?? ActionStyle.Button,
994
- textClass: rendererClass(textClass, c.textClass),
995
- icon: c.icon,
996
- inline: formOptions.inline,
997
946
  onClick:
998
947
  props.actionOnClick?.(c.actionId, actionData, dataContext) ??
999
948
  (() => {}),
@@ -1007,20 +956,16 @@ export function renderControlLayout(
1007
956
  const displayProps = {
1008
957
  data,
1009
958
  className: rendererClass(styleClass, c.styleClass),
1010
- textClass: rendererClass(textClass, c.textClass),
1011
959
  style,
1012
960
  display: displayControl,
1013
961
  dataContext,
1014
- inline: formOptions.inline,
1015
962
  };
1016
963
  if (data.type === DisplayDataType.Custom && customDisplay) {
1017
964
  return {
1018
- inline: formOptions.inline,
1019
965
  children: customDisplay((data as CustomDisplay).customId, displayProps),
1020
966
  };
1021
967
  }
1022
968
  return {
1023
- inline: formOptions.inline,
1024
969
  children: renderer.renderDisplay(displayProps),
1025
970
  };
1026
971
  }
@@ -1028,7 +973,13 @@ export function renderControlLayout(
1028
973
 
1029
974
  function renderData(c: DataControlDefinition): ControlLayoutProps {
1030
975
  if (!control) return { children: "No control for: " + c.field };
1031
- const rendererProps = dataProps(props, c, control);
976
+ const rendererProps = dataProps(
977
+ props as RenderControlProps & {
978
+ definition: DataControlDefinition;
979
+ control: Control<any>;
980
+ },
981
+ );
982
+
1032
983
  const label = !c.hideTitle
1033
984
  ? controlTitle(
1034
985
  labelText?.value ?? c.title,
@@ -1036,7 +987,6 @@ export function renderControlLayout(
1036
987
  )
1037
988
  : undefined;
1038
989
  return {
1039
- inline: formOptions.inline,
1040
990
  processLayout: renderer.renderData(rendererProps),
1041
991
  label: {
1042
992
  type:
@@ -1046,7 +996,6 @@ export function renderControlLayout(
1046
996
  required: c.required && !props.formOptions.displayOnly,
1047
997
  hide: c.hideTitle,
1048
998
  className: rendererClass(labelClass, c.labelClass),
1049
- textClass: rendererClass(labelTextClass, c.labelTextClass),
1050
999
  },
1051
1000
  errorControl: control,
1052
1001
  };
@@ -1061,7 +1010,6 @@ type MarkupKeys = keyof Omit<
1061
1010
  | "wrapLayout"
1062
1011
  | "readonly"
1063
1012
  | "disabled"
1064
- | "inline"
1065
1013
  >;
1066
1014
  export function appendMarkup(
1067
1015
  k: MarkupKeys,
@@ -1123,21 +1071,13 @@ export function renderLayoutParts(
1123
1071
  props: ControlLayoutProps,
1124
1072
  renderer: FormRenderer,
1125
1073
  ): RenderedLayout {
1126
- const {
1127
- className,
1128
- children,
1129
- style,
1130
- errorControl,
1131
- label,
1132
- adornments,
1133
- inline,
1134
- } = props.processLayout?.(props) ?? props;
1074
+ const { className, children, style, errorControl, label, adornments } =
1075
+ props.processLayout?.(props) ?? props;
1135
1076
  const layout: RenderedLayout = {
1136
1077
  children,
1137
1078
  errorControl,
1138
1079
  style,
1139
1080
  className: className!,
1140
- inline,
1141
1081
  wrapLayout: (x) => x,
1142
1082
  };
1143
1083
  (adornments ?? [])
@@ -1330,14 +1270,13 @@ export function applyArrayLengthRestrictions(
1330
1270
 
1331
1271
  export function fieldOptionAdornment(p: DataRendererProps) {
1332
1272
  return (o: FieldOption, i: number, selected: boolean) => (
1333
- <RenderArrayElements
1334
- array={p.formNode.getChildNodes()}
1335
- children={(cd, i) =>
1273
+ <RenderArrayElements array={p.formNode.getChildNodes()}>
1274
+ {(cd, i) =>
1336
1275
  p.renderChild(i, cd, {
1337
1276
  parentDataNode: p.dataContext.parentNode,
1338
1277
  formData: { option: o, optionSelected: selected },
1339
1278
  })
1340
1279
  }
1341
- />
1280
+ </RenderArrayElements>
1342
1281
  );
1343
1282
  }
@@ -59,6 +59,7 @@ export function createFormRenderer(
59
59
  renderLayout,
60
60
  renderVisibility,
61
61
  renderLabelText,
62
+ renderText: defaultRenderers.renderText,
62
63
  html: defaultRenderers.html,
63
64
  };
64
65
 
@@ -124,7 +125,7 @@ export function createFormRenderer(
124
125
  if (noMatch === true) return false;
125
126
  const matchCollection =
126
127
  (x.collection ?? false) ===
127
- (props.dataNode.elementIndex == null && (field.collection ?? false));
128
+ (props.elementIndex == null && (field.collection ?? false));
128
129
  const isSchemaAllowed =
129
130
  !!x.schemaType && renderType == DataRenderType.Standard
130
131
  ? isOneOf(x.schemaType, field.type)
@@ -3,12 +3,12 @@ import {
3
3
  EqualityFunc,
4
4
  FieldOption,
5
5
  FieldType,
6
+ SchemaDataNode,
6
7
  SchemaField,
8
+ SchemaInterface,
9
+ SchemaNode,
7
10
  ValidationMessageType,
8
11
  } from "./schemaField";
9
- import { SchemaInterface } from "./schemaInterface";
10
- import { SchemaDataNode } from "./schemaDataNode";
11
- import { SchemaNode } from "./schemaNode";
12
12
 
13
13
  export class DefaultSchemaInterface implements SchemaInterface {
14
14
  constructor(
@@ -79,23 +79,13 @@ export class DefaultSchemaInterface implements SchemaInterface {
79
79
  return this.textValue(field, value)?.toLowerCase() ?? "";
80
80
  }
81
81
 
82
- textValueForData(dataNode: SchemaDataNode): string | undefined {
83
- const options = this.getDataOptions(dataNode);
84
- return this.textValue(
85
- dataNode.schema.field,
86
- dataNode.control.value,
87
- dataNode.elementIndex != null,
88
- options,
89
- );
90
- }
91
82
  textValue(
92
83
  field: SchemaField,
93
84
  value: any,
94
85
  element?: boolean | undefined,
95
- options?: FieldOption[] | null,
96
86
  ): string | undefined {
97
- const actualOptions = options ?? this.getOptions(field);
98
- const option = actualOptions?.find((x) => x.value === value);
87
+ const options = this.getOptions(field);
88
+ const option = options?.find((x) => x.value === value);
99
89
  if (option) return option.name;
100
90
  switch (field.type) {
101
91
  case FieldType.Date: