@react-typed-forms/schemas 11.0.3 → 11.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,6 +1,7 @@
1
- import { SchemaField, SchemaInterface } from "./types";
1
+ import { FieldOption, SchemaField, SchemaInterface } from "./types";
2
2
  import { Control } from "@react-typed-forms/core";
3
3
  export declare class DefaultSchemaInterface implements SchemaInterface {
4
+ getOptions({ options }: SchemaField): FieldOption[] | null | undefined;
4
5
  isEmptyValue(f: SchemaField, value: any): boolean;
5
6
  textValue(field: SchemaField, value: any, element?: boolean | undefined): string | undefined;
6
7
  controlLength(f: SchemaField, control: Control<any>): number;
package/lib/types.d.ts CHANGED
@@ -52,6 +52,7 @@ export interface SchemaInterface {
52
52
  textValue(field: SchemaField, value: any, element?: boolean): string | undefined;
53
53
  controlLength(field: SchemaField, control: Control<any>): number;
54
54
  valueLength(field: SchemaField, value: any): number;
55
+ getOptions(field: SchemaField): FieldOption[] | undefined | null;
55
56
  }
56
57
  export interface ControlDefinition {
57
58
  type: string;
@@ -152,6 +153,7 @@ export interface DataControlDefinition extends ControlDefinition {
152
153
  renderOptions?: RenderOptions | null;
153
154
  defaultValue?: any;
154
155
  readonly?: boolean | null;
156
+ disabled?: boolean | null;
155
157
  validators?: SchemaValidator[] | null;
156
158
  hideTitle?: boolean | null;
157
159
  dontClearHidden?: boolean | null;
package/lib/util.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare function findNonDataGroups(controls: ControlDefinition[]): Contro
39
39
  export declare function addMissingControls(fields: SchemaField[], controls: ControlDefinition[]): ControlDefinition[];
40
40
  export declare function useUpdatedRef<A>(a: A): MutableRefObject<A>;
41
41
  export declare function isControlReadonly(c: ControlDefinition): boolean;
42
+ export declare function isControlDisabled(c: ControlDefinition): boolean;
42
43
  export declare function getDisplayOnlyOptions(d: ControlDefinition): DisplayOnlyRenderOptions | undefined;
43
44
  export declare function getTypeField(context: ControlDataContext, fieldPath: SchemaField[]): Control<string> | undefined;
44
45
  export declare function visitControlDataArray<A>(controls: ControlDefinition[] | undefined | null, context: ControlDataContext, cb: (definition: DataControlDefinition, field: SchemaField, control: Control<any>, element: boolean) => A | undefined): A | undefined;
@@ -47,7 +48,7 @@ export declare function lookupChildControl(data: DataContext, path: SchemaField[
47
48
  export declare function lookupChildControlPath(data: DataContext, jsonPath: JsonPath[]): Control<any> | undefined;
48
49
  export declare function cleanDataForSchema(v: {
49
50
  [k: string]: any;
50
- } | undefined, fields: SchemaField[]): any;
51
+ } | undefined, fields: SchemaField[], removeIfDefault?: boolean): any;
51
52
  export declare function getAllReferencedClasses(c: ControlDefinition, collectExtra?: (c: ControlDefinition) => (string | undefined | null)[]): string[];
52
53
  export declare function jsonPathString(jsonPath: JsonPath[], customIndex?: (n: number) => string): string;
53
54
  export declare function findChildDefinition(parent: ControlDefinition, childPath: number | number[]): ControlDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-typed-forms/schemas",
3
- "version": "11.0.3",
3
+ "version": "11.2.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",