@react-typed-forms/schemas 12.0.1 → 12.0.2

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,12 +1,13 @@
1
1
  import { FieldOption, SchemaField, SchemaInterface, ValidationMessageType } from "./types";
2
2
  import { Control } from "@react-typed-forms/core";
3
+ import { SchemaDataNode, SchemaNode } from "./treeNodes";
3
4
  export declare class DefaultSchemaInterface implements SchemaInterface {
4
5
  protected boolStrings: [string, string];
5
6
  constructor(boolStrings?: [string, string]);
6
7
  parseToMillis(field: SchemaField, v: string): number;
7
8
  validationMessageText(field: SchemaField, messageType: ValidationMessageType, actual: any, expected: any): string;
8
9
  getOptions({ options }: SchemaField): FieldOption[] | null | undefined;
9
- getFilterOptions(field: SchemaField): FieldOption[] | undefined | null;
10
+ getFilterOptions(array: SchemaDataNode, field: SchemaNode): FieldOption[] | undefined | null;
10
11
  isEmptyValue(f: SchemaField, value: any): boolean;
11
12
  textValue(field: SchemaField, value: any, element?: boolean | undefined): string | undefined;
12
13
  controlLength(f: SchemaField, control: Control<any>): number;
@@ -41,6 +41,7 @@ export declare function traverseParents<A, B extends {
41
41
  }>(current: B | undefined, get: (b: B) => A, until?: (b: B) => boolean): A[];
42
42
  export declare function getRootDataNode(dataNode: SchemaDataNode): SchemaDataNode;
43
43
  export declare function getJsonPath(dataNode: SchemaDataNode): (string | number)[];
44
+ export declare function getSchemaPath(schemaNode: SchemaNode): SchemaField[];
44
45
  export declare function getSchemaFieldList(schema: SchemaNode): SchemaField[];
45
46
  export declare function rootSchemaNode(fields: SchemaField[], lookup?: SchemaTreeLookup): SchemaNode;
46
47
  export declare function visitControlDataArray<A>(controls: ControlDefinition[] | undefined | null, context: SchemaDataNode, cb: (definition: DataControlDefinition, node: SchemaDataNode) => A | undefined): A | undefined;
package/lib/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Control } from "@react-typed-forms/core";
2
+ import { SchemaDataNode, SchemaNode } from "./treeNodes";
2
3
  export interface SchemaField {
3
4
  type: string;
4
5
  field: string;
@@ -62,7 +63,7 @@ export interface SchemaInterface {
62
63
  controlLength(field: SchemaField, control: Control<any>): number;
63
64
  valueLength(field: SchemaField, value: any): number;
64
65
  getOptions(field: SchemaField): FieldOption[] | undefined | null;
65
- getFilterOptions(field: SchemaField): FieldOption[] | undefined | null;
66
+ getFilterOptions(array: SchemaDataNode, field: SchemaNode): FieldOption[] | undefined | null;
66
67
  parseToMillis(field: SchemaField, v: string): number;
67
68
  validationMessageText(field: SchemaField, messageType: ValidationMessageType, actual: any, expected: any): string;
68
69
  }
package/lib/util.d.ts CHANGED
@@ -1,26 +1,11 @@
1
1
  import { CompoundField, ControlDefinition, DataControlDefinition, DisplayOnlyRenderOptions, FieldOption, SchemaField, SchemaInterface } from "./types";
2
2
  import { MutableRefObject } from "react";
3
- import { Control } from "@react-typed-forms/core";
4
3
  import { SchemaDataNode } from "./treeNodes";
5
4
  export type JsonPath = string | number;
6
- export interface DataContext {
7
- data: Control<any>;
8
- path: JsonPath[];
9
- }
10
- export interface ControlDataContext extends DataContext {
11
- fields: SchemaField[];
12
- schemaInterface: SchemaInterface;
13
- dataNode: SchemaDataNode | undefined;
14
- parentNode: SchemaDataNode;
15
- }
16
- export declare class ControlDataContextImpl implements ControlDataContext {
5
+ export interface ControlDataContext {
17
6
  schemaInterface: SchemaInterface;
18
7
  dataNode: SchemaDataNode | undefined;
19
8
  parentNode: SchemaDataNode;
20
- constructor(schemaInterface: SchemaInterface, dataNode: SchemaDataNode | undefined, parentNode: SchemaDataNode);
21
- get fields(): SchemaField[];
22
- get data(): Control<unknown>;
23
- get path(): (string | number)[];
24
9
  }
25
10
  export declare function applyDefaultValues(v: Record<string, any> | undefined, fields: SchemaField[], doneSet?: Set<Record<string, any>>): any;
26
11
  export declare function applyDefaultForField(v: any, field: SchemaField, parent: SchemaField[], notElement?: boolean, doneSet?: Set<Record<string, any>>): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-typed-forms/schemas",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.cjs",