@react-typed-forms/schemas 11.18.1 → 11.18.3

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,5 +1,5 @@
1
1
  import { CompoundField, FieldOption, FieldType, SchemaField, SchemaMap } from "./types";
2
- type AllowedSchema<T> = T extends string ? SchemaField & {
2
+ export type AllowedSchema<T> = T extends string ? SchemaField & {
3
3
  type: FieldType.String | FieldType.Date | FieldType.DateTime | FieldType.Time;
4
4
  } : T extends number ? SchemaField & {
5
5
  type: FieldType.Int | FieldType.Double;
@@ -20,22 +20,11 @@ type AllowedField<T, K> = (name: string) => (SchemaField & {
20
20
  export declare function buildSchema<T, Custom = "">(def: {
21
21
  [K in keyof T]-?: AllowedField<T[K], Custom>;
22
22
  }): SchemaField[];
23
- export declare function stringField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
24
- field?: string | undefined;
25
- displayName: string | null;
26
- tags?: string[] | null | undefined;
27
- system?: boolean | null | undefined;
28
- collection?: boolean | null | undefined;
29
- onlyForTypes?: string[] | null | undefined;
30
- required?: boolean | null | undefined;
31
- notNullable?: boolean | null | undefined;
32
- defaultValue?: any;
33
- isTypeField?: boolean | null | undefined;
34
- searchable?: boolean | null | undefined;
35
- options?: FieldOption[] | null | undefined;
36
- validators?: import("./types").SchemaValidator[] | null | undefined;
37
- type: FieldType.String;
38
- };
23
+ export type FieldBuilder<T extends FieldType, K> = (name: string) => Omit<SchemaField, "type"> & {
24
+ type: T;
25
+ } & K;
26
+ export declare function stringField(displayName: string): FieldBuilder<FieldType.String, {}>;
27
+ export declare function stringField<S extends Partial<SchemaField>>(displayName: string, options: S): FieldBuilder<FieldType.String, S>;
39
28
  export declare function stringOptionsField(displayName: string, ...options: FieldOption[]): (name: string) => SchemaField & {
40
29
  type: FieldType.String;
41
30
  displayName: string;
@@ -46,18 +35,12 @@ export declare function makeScalarField<S extends Partial<SchemaField>>(options:
46
35
  export declare function makeCompoundField<S extends Partial<CompoundField>>(options: S): (name: string) => CompoundField & {
47
36
  type: FieldType.Compound;
48
37
  } & S;
49
- export declare function intField<S extends Partial<SchemaField>>(displayName: string, options?: S): (name: string) => SchemaField & {
50
- type: FieldType.Int;
51
- displayName: string;
52
- } & S;
53
- export declare function doubleField<S extends Partial<SchemaField>>(displayName: string, options?: S): (name: string) => SchemaField & {
54
- type: FieldType.Double;
55
- displayName: string;
56
- } & S;
57
- export declare function dateField<S extends Partial<SchemaField>>(displayName: string, options?: S): (name: string) => SchemaField & {
58
- type: FieldType.Date;
59
- displayName: string;
60
- } & S;
38
+ export declare function intField(displayName: string): FieldBuilder<FieldType.Int, {}>;
39
+ export declare function intField<S extends Partial<SchemaField>>(displayName: string, options: S): FieldBuilder<FieldType.Int, S>;
40
+ export declare function doubleField(displayName: string): FieldBuilder<FieldType.Double, {}>;
41
+ export declare function doubleField<S extends Partial<SchemaField>>(displayName: string, options: S): FieldBuilder<FieldType.Double, S>;
42
+ export declare function dateField(displayName: string): FieldBuilder<FieldType.Date, {}>;
43
+ export declare function dateField<S extends Partial<SchemaField>>(displayName: string, options: S): FieldBuilder<FieldType.Date, S>;
61
44
  export declare function timeField<S extends Partial<SchemaField>>(displayName: string, options?: S): (name: string) => SchemaField & {
62
45
  type: FieldType.Time;
63
46
  displayName: string;
@@ -66,10 +49,8 @@ export declare function dateTimeField<S extends Partial<SchemaField>>(displayNam
66
49
  type: FieldType.DateTime;
67
50
  displayName: string;
68
51
  } & S;
69
- export declare function boolField<S extends Partial<SchemaField>>(displayName: string, options?: S): (name: string) => SchemaField & {
70
- type: FieldType.Bool;
71
- displayName: string;
72
- } & S;
52
+ export declare function boolField(displayName: string): FieldBuilder<FieldType.Bool, {}>;
53
+ export declare function boolField<S extends Partial<SchemaField>>(displayName: string, options: S): FieldBuilder<FieldType.Bool, S>;
73
54
  export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other?: Other): (name: string) => CompoundField & {
74
55
  collection: Other["collection"];
75
56
  };
package/lib/types.d.ts CHANGED
@@ -156,7 +156,7 @@ export interface TooltipAdornment extends ControlAdornment {
156
156
  export interface AccordionAdornment extends ControlAdornment {
157
157
  type: ControlAdornmentType.Accordion;
158
158
  title: string;
159
- defaultExpanded: boolean;
159
+ defaultExpanded?: boolean | null;
160
160
  }
161
161
  export interface HelpTextAdornment extends ControlAdornment {
162
162
  type: ControlAdornmentType.HelpText;
@@ -344,7 +344,7 @@ export interface CustomDisplay extends DisplayData {
344
344
  export interface ActionControlDefinition extends ControlDefinition {
345
345
  type: ControlDefinitionType.Action;
346
346
  actionId: string;
347
- actionData: string;
347
+ actionData?: string | null;
348
348
  }
349
349
  export declare enum ValidatorType {
350
350
  Jsonata = "Jsonata",
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@react-typed-forms/schemas",
3
- "version": "11.18.1",
3
+ "version": "11.18.3",
4
4
  "description": "",
5
+ "type": "module",
5
6
  "main": "lib/index.js",
6
7
  "types": "lib/index.d.ts",
8
+ "exports": "./lib/index.js",
7
9
  "repository": {
8
10
  "type": "git",
9
11
  "url": "git+https://github.com/doolse/react-typed-forms.git"
@@ -43,8 +45,8 @@
43
45
  },
44
46
  "gitHead": "698e16cd3ab31b7dd0528fc76536f4d3205ce8c6",
45
47
  "scripts": {
46
- "build": "rimraf ./lib/ && microbundle -f cjs --no-compress --jsx React.createElement --jsxFragment React.Fragment",
47
- "watch": "microbundle -w -f cjs --no-compress --jsx React.createElement --jsxFragment React.Fragment",
48
+ "build": "rimraf ./lib/ && microbundle -f modern,cjs --jsx React.createElement --jsxFragment React.Fragment",
49
+ "watch": "microbundle -w -f modern,cjs --no-compress --jsx React.createElement --jsxFragment React.Fragment",
48
50
  "update-readme": "md-magic --path README.md",
49
51
  "gencode": "nswag swagger2tsclient /input:http://localhost:5216/swagger/v1/swagger.json /runtime:Net60 /output:src/types.ts /GenerateClientClasses:false /MarkOptionalProperties:false /Template:Fetch /TypeStyle:Interface /DateTimeType:string"
50
52
  }