@json-layout/vocabulary 0.13.0 → 0.15.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.
- package/package.json +5 -5
- package/src/components/compile-types.js +61 -0
- package/src/components/index.js +226 -0
- package/src/components/types.ts +378 -0
- package/src/index.js +3 -0
- package/src/layout-keyword/index.js +9 -2
- package/src/layout-keyword/schema.js +67 -62
- package/src/layout-keyword/schema.json +35 -50
- package/src/layout-keyword/types.ts +111 -42
- package/src/normalize.js +93 -54
- package/src/normalized-layout/index.js +18 -64
- package/src/normalized-layout/schema.js +247 -766
- package/src/normalized-layout/schema.json +128 -329
- package/src/normalized-layout/types.ts +165 -234
- package/src/types.ts +11 -0
- package/src/validate.js +42 -0
- package/types/components/compile-types.d.ts +13 -0
- package/types/components/compile-types.d.ts.map +1 -0
- package/types/components/index.d.ts +52 -0
- package/types/components/index.d.ts.map +1 -0
- package/types/components/types.d.ts +329 -0
- package/types/components/types.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/layout-keyword/index.d.ts +6 -1
- package/types/layout-keyword/index.d.ts.map +1 -1
- package/types/layout-keyword/schema.d.ts +43 -26
- package/types/layout-keyword/types.d.ts +111 -18
- package/types/layout-keyword/types.d.ts.map +1 -1
- package/types/normalize.d.ts +3 -2
- package/types/normalize.d.ts.map +1 -1
- package/types/normalized-layout/index.d.ts +19 -65
- package/types/normalized-layout/index.d.ts.map +1 -1
- package/types/normalized-layout/schema.d.ts +181 -531
- package/types/normalized-layout/types.d.ts +165 -209
- package/types/normalized-layout/types.d.ts.map +1 -1
- package/types/types.d.ts +10 -0
- package/types/types.d.ts.map +1 -1
- package/types/validate.d.ts +8 -0
- package/types/validate.d.ts.map +1 -0
- package/src/layout-keyword/validate.js +0 -2
- package/src/normalized-layout/validate.js +0 -3
- package/types/layout-keyword/validate.d.ts +0 -23
- package/types/layout-keyword/validate.d.ts.map +0 -1
- package/types/normalized-layout/validate.d.ts +0 -23
- package/types/normalized-layout/validate.d.ts.map +0 -1
|
@@ -1,51 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
transformData?: Expression;
|
|
11
|
-
nullable?: boolean;
|
|
12
|
-
help?: string;
|
|
13
|
-
cols?: ColsObj;
|
|
14
|
-
props?: StateNodePropsLib;
|
|
15
|
-
getProps?: Expression;
|
|
16
|
-
slots?: StateNodeSlotsLib & {
|
|
17
|
-
before?: Slot;
|
|
18
|
-
after?: Slot;
|
|
19
|
-
component?: Slot;
|
|
20
|
-
[k: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
[k: string]: unknown;
|
|
23
|
-
} & (
|
|
24
|
-
| None
|
|
25
|
-
| List
|
|
26
|
-
| TextField
|
|
27
|
-
| NumberField
|
|
28
|
-
| Textarea
|
|
29
|
-
| Markdown
|
|
30
|
-
| Checkbox
|
|
31
|
-
| Switch
|
|
32
|
-
| Slider
|
|
33
|
-
| DatePicker
|
|
34
|
-
| DateTimePicker
|
|
35
|
-
| TimePicker
|
|
36
|
-
| ColorPicker
|
|
37
|
-
| Combobox
|
|
38
|
-
| NumberCombobox
|
|
39
|
-
| Select
|
|
40
|
-
| Autocomplete
|
|
41
|
-
| OneOfSelect
|
|
42
|
-
| Section
|
|
43
|
-
| Tabs
|
|
44
|
-
| VerticalTabs
|
|
45
|
-
| ExpansionPanels
|
|
46
|
-
| Stepper
|
|
47
|
-
| FileInput
|
|
48
|
-
);
|
|
1
|
+
/**
|
|
2
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
3
|
+
* via the `definition` "normalized-layout".
|
|
4
|
+
*/
|
|
5
|
+
export type NormalizedLayout = SwitchStruct | BaseCompObject;
|
|
6
|
+
/**
|
|
7
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
8
|
+
* via the `definition` "state-node-options-base".
|
|
9
|
+
*/
|
|
49
10
|
export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {
|
|
50
11
|
readOnly?: boolean;
|
|
51
12
|
summary?: boolean;
|
|
@@ -56,17 +17,25 @@ export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {
|
|
|
56
17
|
*/
|
|
57
18
|
removeAdditional?: boolean | ("unknown" | "error" | "none");
|
|
58
19
|
validateOn?: "input" | "blur" | "submit";
|
|
20
|
+
updateOn?: "input" | "blur";
|
|
21
|
+
debounceInputMs?: number;
|
|
59
22
|
initialValidation?: "never" | "always" | "withData";
|
|
60
23
|
defaultOn?: "missing" | "empty" | "never";
|
|
61
24
|
autofocus?: boolean;
|
|
62
25
|
readOnlyPropertiesMode?: "remove" | "hide" | "show";
|
|
63
|
-
debounceInputMs?: number;
|
|
64
26
|
[k: string]: unknown;
|
|
65
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
30
|
+
* via the `definition` "cols".
|
|
31
|
+
*/
|
|
66
32
|
export type Cols = number;
|
|
67
33
|
/**
|
|
68
34
|
* This interface was referenced by `StateNodeSlotsLib`'s JSON-Schema definition
|
|
69
35
|
* via the `patternProperty` ".*".
|
|
36
|
+
*
|
|
37
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
38
|
+
* via the `definition` "slot".
|
|
70
39
|
*/
|
|
71
40
|
export type Slot =
|
|
72
41
|
| {
|
|
@@ -78,7 +47,67 @@ export type Slot =
|
|
|
78
47
|
| {
|
|
79
48
|
name: string;
|
|
80
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
52
|
+
* via the `definition` "composite-comp-object".
|
|
53
|
+
*/
|
|
54
|
+
export type CompositeCompObject = BaseCompObject & {
|
|
55
|
+
comp: string;
|
|
56
|
+
title?: string | null;
|
|
57
|
+
subtitle?: string | null;
|
|
58
|
+
children: Children;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
63
|
+
* via the `definition` "child".
|
|
64
|
+
*/
|
|
65
|
+
export type Child = ChildRef | ChildComposite;
|
|
66
|
+
/**
|
|
67
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
68
|
+
* via the `definition` "children".
|
|
69
|
+
*/
|
|
70
|
+
export type Children = Child[];
|
|
71
|
+
/**
|
|
72
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
73
|
+
* via the `definition` "simple-comp-object".
|
|
74
|
+
*/
|
|
75
|
+
export type SimpleCompObject = BaseCompObject & {
|
|
76
|
+
comp: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
[k: string]: unknown;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
82
|
+
* via the `definition` "focusable-comp-object".
|
|
83
|
+
*/
|
|
84
|
+
export type FocusableCompObject = BaseCompObject & {
|
|
85
|
+
comp: string;
|
|
86
|
+
label?: string;
|
|
87
|
+
autofocus?: boolean;
|
|
88
|
+
[k: string]: unknown;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
92
|
+
* via the `definition` "items-based-comp-object".
|
|
93
|
+
*/
|
|
94
|
+
export type ItemsBasedCompObject = BaseCompObject & {
|
|
95
|
+
comp: string;
|
|
96
|
+
items?: SelectItems;
|
|
97
|
+
getItems?: GetItems;
|
|
98
|
+
multiple?: boolean;
|
|
99
|
+
separator?: string;
|
|
100
|
+
[k: string]: unknown;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
104
|
+
* via the `definition` "select-items".
|
|
105
|
+
*/
|
|
81
106
|
export type SelectItems = SelectItem[];
|
|
107
|
+
/**
|
|
108
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
109
|
+
* via the `definition` "get-items".
|
|
110
|
+
*/
|
|
82
111
|
export type GetItems = {
|
|
83
112
|
returnObjects?: boolean;
|
|
84
113
|
itemsResults?: Expression;
|
|
@@ -88,21 +117,59 @@ export type GetItems = {
|
|
|
88
117
|
itemIcon?: Expression;
|
|
89
118
|
[k: string]: unknown;
|
|
90
119
|
} & (Expression | GetItemsFetch);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
120
|
+
/**
|
|
121
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
122
|
+
* via the `definition` "multiple-compat-comp-object".
|
|
123
|
+
*/
|
|
124
|
+
export type MultipleCompatCompObject = BaseCompObject & {
|
|
125
|
+
comp: string;
|
|
126
|
+
multiple?: boolean;
|
|
94
127
|
[k: string]: unknown;
|
|
95
128
|
};
|
|
96
|
-
export type Child1 = unknown | CompositeCompObject;
|
|
97
|
-
export type CompositeCompObject = Section | Tabs | VerticalTabs | ExpansionPanels;
|
|
98
|
-
export type Children = Child[];
|
|
99
129
|
|
|
130
|
+
export interface HttpsJsonLayoutGithubIoNormalizedLayoutKeyword {
|
|
131
|
+
[k: string]: unknown;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
135
|
+
* via the `definition` "switch-struct".
|
|
136
|
+
*/
|
|
100
137
|
export interface SwitchStruct {
|
|
101
|
-
switch:
|
|
138
|
+
switch: BaseCompObject[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
142
|
+
* via the `definition` "base-comp-object".
|
|
143
|
+
*/
|
|
144
|
+
export interface BaseCompObject {
|
|
145
|
+
comp: string;
|
|
146
|
+
if?: Expression;
|
|
147
|
+
options?: StateNodeOptionsBase;
|
|
148
|
+
getOptions?: Expression;
|
|
149
|
+
defaultData?: unknown;
|
|
150
|
+
getDefaultData?: Expression;
|
|
151
|
+
constData?: unknown;
|
|
152
|
+
getConstData?: Expression;
|
|
153
|
+
transformData?: Expression;
|
|
154
|
+
nullable?: boolean;
|
|
155
|
+
help?: string;
|
|
156
|
+
cols?: ColsObj;
|
|
157
|
+
props?: StateNodePropsLib;
|
|
158
|
+
getProps?: Expression;
|
|
159
|
+
slots?: StateNodeSlotsLib & {
|
|
160
|
+
before?: Slot;
|
|
161
|
+
after?: Slot;
|
|
162
|
+
component?: Slot;
|
|
163
|
+
[k: string]: unknown;
|
|
164
|
+
};
|
|
165
|
+
[k: string]: unknown;
|
|
102
166
|
}
|
|
103
167
|
/**
|
|
104
168
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
105
169
|
* via the `patternProperty` ".*".
|
|
170
|
+
*
|
|
171
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
172
|
+
* via the `definition` "expression".
|
|
106
173
|
*/
|
|
107
174
|
export interface Expression {
|
|
108
175
|
type: "js-fn" | "js-eval" | "js-tpl";
|
|
@@ -111,6 +178,10 @@ export interface Expression {
|
|
|
111
178
|
ref?: number;
|
|
112
179
|
[k: string]: unknown;
|
|
113
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
183
|
+
* via the `definition` "state-node-options-base-lib".
|
|
184
|
+
*/
|
|
114
185
|
export interface StateNodeOptionsBaseLib {
|
|
115
186
|
/**
|
|
116
187
|
* This interface was referenced by `StateNodeOptionsBaseLib`'s JSON-Schema definition
|
|
@@ -118,6 +189,10 @@ export interface StateNodeOptionsBaseLib {
|
|
|
118
189
|
*/
|
|
119
190
|
[k: string]: unknown;
|
|
120
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
194
|
+
* via the `definition` "cols-obj".
|
|
195
|
+
*/
|
|
121
196
|
export interface ColsObj {
|
|
122
197
|
xs: number;
|
|
123
198
|
sm?: Cols;
|
|
@@ -126,6 +201,10 @@ export interface ColsObj {
|
|
|
126
201
|
xl?: Cols;
|
|
127
202
|
xxl?: Cols;
|
|
128
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
206
|
+
* via the `definition` "state-node-props-lib".
|
|
207
|
+
*/
|
|
129
208
|
export interface StateNodePropsLib {
|
|
130
209
|
/**
|
|
131
210
|
* This interface was referenced by `StateNodePropsLib`'s JSON-Schema definition
|
|
@@ -133,111 +212,38 @@ export interface StateNodePropsLib {
|
|
|
133
212
|
*/
|
|
134
213
|
[k: string]: unknown;
|
|
135
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
217
|
+
* via the `definition` "state-node-slots-lib".
|
|
218
|
+
*/
|
|
136
219
|
export interface StateNodeSlotsLib {
|
|
137
220
|
[k: string]: Slot;
|
|
138
221
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export interface
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
listEditMode: "inline" | "inline-single" | "menu" | "dialog";
|
|
147
|
-
listActions: ("add" | "edit" | "delete" | "sort" | "duplicate")[];
|
|
148
|
-
itemTitle?: Expression;
|
|
149
|
-
itemSubtitle?: Expression;
|
|
150
|
-
messages?: {
|
|
151
|
-
addItem?: string;
|
|
152
|
-
delete?: string;
|
|
153
|
-
edit?: string;
|
|
154
|
-
duplicate?: string;
|
|
155
|
-
sort?: string;
|
|
156
|
-
};
|
|
157
|
-
[k: string]: unknown;
|
|
158
|
-
}
|
|
159
|
-
export interface TextField {
|
|
160
|
-
comp: "text-field";
|
|
161
|
-
label: string;
|
|
162
|
-
autofocus?: boolean;
|
|
163
|
-
[k: string]: unknown;
|
|
164
|
-
}
|
|
165
|
-
export interface NumberField {
|
|
166
|
-
comp: "number-field";
|
|
167
|
-
label: string;
|
|
168
|
-
autofocus?: boolean;
|
|
169
|
-
step?: number;
|
|
170
|
-
min?: number;
|
|
171
|
-
max?: number;
|
|
172
|
-
[k: string]: unknown;
|
|
173
|
-
}
|
|
174
|
-
export interface Textarea {
|
|
175
|
-
comp: "textarea";
|
|
176
|
-
label: string;
|
|
177
|
-
autofocus?: boolean;
|
|
178
|
-
[k: string]: unknown;
|
|
179
|
-
}
|
|
180
|
-
export interface Markdown {
|
|
181
|
-
comp: "markdown";
|
|
182
|
-
label: string;
|
|
183
|
-
autofocus?: boolean;
|
|
184
|
-
[k: string]: unknown;
|
|
185
|
-
}
|
|
186
|
-
export interface Checkbox {
|
|
187
|
-
comp: "checkbox";
|
|
188
|
-
label: string;
|
|
189
|
-
[k: string]: unknown;
|
|
190
|
-
}
|
|
191
|
-
export interface Switch {
|
|
192
|
-
comp: "switch";
|
|
193
|
-
label: string;
|
|
194
|
-
[k: string]: unknown;
|
|
195
|
-
}
|
|
196
|
-
export interface Slider {
|
|
197
|
-
comp: "slider";
|
|
198
|
-
label: string;
|
|
199
|
-
step?: number;
|
|
200
|
-
min: number;
|
|
201
|
-
max: number;
|
|
202
|
-
[k: string]: unknown;
|
|
203
|
-
}
|
|
204
|
-
export interface DatePicker {
|
|
205
|
-
comp: "date-picker";
|
|
206
|
-
label: string;
|
|
207
|
-
min?: string;
|
|
208
|
-
max?: string;
|
|
209
|
-
format?: "date" | "date-time";
|
|
210
|
-
[k: string]: unknown;
|
|
211
|
-
}
|
|
212
|
-
export interface DateTimePicker {
|
|
213
|
-
comp: "date-time-picker";
|
|
214
|
-
label: string;
|
|
215
|
-
min?: string;
|
|
216
|
-
max?: string;
|
|
217
|
-
[k: string]: unknown;
|
|
218
|
-
}
|
|
219
|
-
export interface TimePicker {
|
|
220
|
-
comp: "time-picker";
|
|
221
|
-
label: string;
|
|
222
|
-
min?: string;
|
|
223
|
-
max?: string;
|
|
224
|
-
[k: string]: unknown;
|
|
225
|
-
}
|
|
226
|
-
export interface ColorPicker {
|
|
227
|
-
comp: "color-picker";
|
|
228
|
-
label: string;
|
|
229
|
-
[k: string]: unknown;
|
|
222
|
+
/**
|
|
223
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
224
|
+
* via the `definition` "child-ref".
|
|
225
|
+
*/
|
|
226
|
+
export interface ChildRef {
|
|
227
|
+
key: string | number;
|
|
228
|
+
cols?: ColsObj;
|
|
230
229
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
230
|
+
/**
|
|
231
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
232
|
+
* via the `definition` "child-composite".
|
|
233
|
+
*/
|
|
234
|
+
export interface ChildComposite {
|
|
235
|
+
key: string | number;
|
|
236
|
+
cols?: ColsObj;
|
|
237
|
+
comp?: string;
|
|
238
|
+
title?: string | null;
|
|
239
|
+
subtitle?: string | null;
|
|
240
|
+
children: Children;
|
|
239
241
|
[k: string]: unknown;
|
|
240
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
245
|
+
* via the `definition` "select-item".
|
|
246
|
+
*/
|
|
241
247
|
export interface SelectItem {
|
|
242
248
|
title: string;
|
|
243
249
|
key: string;
|
|
@@ -245,6 +251,10 @@ export interface SelectItem {
|
|
|
245
251
|
icon?: string;
|
|
246
252
|
[k: string]: unknown;
|
|
247
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
|
|
256
|
+
* via the `definition` "get-items-fetch".
|
|
257
|
+
*/
|
|
248
258
|
export interface GetItemsFetch {
|
|
249
259
|
url: Expression;
|
|
250
260
|
qSearchParam?: string;
|
|
@@ -253,82 +263,3 @@ export interface GetItemsFetch {
|
|
|
253
263
|
};
|
|
254
264
|
[k: string]: unknown;
|
|
255
265
|
}
|
|
256
|
-
export interface NumberCombobox {
|
|
257
|
-
comp: "number-combobox";
|
|
258
|
-
label: string;
|
|
259
|
-
autofocus?: boolean;
|
|
260
|
-
items?: SelectItems;
|
|
261
|
-
getItems?: GetItems;
|
|
262
|
-
multiple?: boolean;
|
|
263
|
-
step?: number;
|
|
264
|
-
min?: number;
|
|
265
|
-
max?: number;
|
|
266
|
-
[k: string]: unknown;
|
|
267
|
-
}
|
|
268
|
-
export interface Select {
|
|
269
|
-
comp: "select";
|
|
270
|
-
label: string;
|
|
271
|
-
autofocus?: boolean;
|
|
272
|
-
items?: SelectItems;
|
|
273
|
-
getItems?: GetItems;
|
|
274
|
-
multiple?: boolean;
|
|
275
|
-
separator?: string;
|
|
276
|
-
[k: string]: unknown;
|
|
277
|
-
}
|
|
278
|
-
export interface Autocomplete {
|
|
279
|
-
comp: "autocomplete";
|
|
280
|
-
label: string;
|
|
281
|
-
autofocus?: boolean;
|
|
282
|
-
items?: SelectItems;
|
|
283
|
-
getItems?: GetItems;
|
|
284
|
-
multiple?: boolean;
|
|
285
|
-
separator?: string;
|
|
286
|
-
[k: string]: unknown;
|
|
287
|
-
}
|
|
288
|
-
export interface OneOfSelect {
|
|
289
|
-
comp: "one-of-select";
|
|
290
|
-
label: string;
|
|
291
|
-
[k: string]: unknown;
|
|
292
|
-
}
|
|
293
|
-
export interface Section {
|
|
294
|
-
comp: "section";
|
|
295
|
-
title?: string | null;
|
|
296
|
-
subtitle?: string | null;
|
|
297
|
-
children: Children;
|
|
298
|
-
[k: string]: unknown;
|
|
299
|
-
}
|
|
300
|
-
export interface Tabs {
|
|
301
|
-
comp: "tabs";
|
|
302
|
-
title?: string | null;
|
|
303
|
-
subtitle?: string | null;
|
|
304
|
-
children: Children;
|
|
305
|
-
[k: string]: unknown;
|
|
306
|
-
}
|
|
307
|
-
export interface VerticalTabs {
|
|
308
|
-
comp: "vertical-tabs";
|
|
309
|
-
title?: string | null;
|
|
310
|
-
subtitle?: string | null;
|
|
311
|
-
children: Children;
|
|
312
|
-
[k: string]: unknown;
|
|
313
|
-
}
|
|
314
|
-
export interface ExpansionPanels {
|
|
315
|
-
comp: "expansion-panels";
|
|
316
|
-
title?: string | null;
|
|
317
|
-
subtitle?: string | null;
|
|
318
|
-
children: Children;
|
|
319
|
-
[k: string]: unknown;
|
|
320
|
-
}
|
|
321
|
-
export interface Stepper {
|
|
322
|
-
comp: "stepper";
|
|
323
|
-
title?: string | null;
|
|
324
|
-
subtitle?: string | null;
|
|
325
|
-
children: Children;
|
|
326
|
-
[k: string]: unknown;
|
|
327
|
-
}
|
|
328
|
-
export interface FileInput {
|
|
329
|
-
comp: "file-input";
|
|
330
|
-
label: string;
|
|
331
|
-
accept?: string;
|
|
332
|
-
multiple?: boolean;
|
|
333
|
-
[k: string]: unknown;
|
|
334
|
-
}
|
package/src/types.ts
CHANGED
|
@@ -20,3 +20,14 @@ export interface SchemaFragment {
|
|
|
20
20
|
formatMaximum?: string
|
|
21
21
|
readOnly?: boolean
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
export interface ComponentInfo {
|
|
25
|
+
name: string
|
|
26
|
+
composite?: boolean
|
|
27
|
+
shouldDebounce?: boolean
|
|
28
|
+
emitsBlur?: boolean
|
|
29
|
+
focusable?: boolean
|
|
30
|
+
itemsBased?: boolean
|
|
31
|
+
multipleCompat?: boolean
|
|
32
|
+
schema?: any
|
|
33
|
+
}
|
package/src/validate.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import ajvModule from 'ajv/dist/2019.js'
|
|
2
|
+
import addFormats from 'ajv-formats'
|
|
3
|
+
import ajvErrors from 'ajv-errors'
|
|
4
|
+
import layoutKeyword from './layout-keyword/schema.js'
|
|
5
|
+
import normalizedLayout from './normalized-layout/schema.js'
|
|
6
|
+
import { getComponentSchema } from './components/index.js'
|
|
7
|
+
|
|
8
|
+
// fix some broken typing of ajv
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const Ajv = /** @type {typeof ajvModule.default} */ (ajvModule)
|
|
11
|
+
|
|
12
|
+
export const ajv = new Ajv({
|
|
13
|
+
code: {
|
|
14
|
+
source: true,
|
|
15
|
+
esm: true
|
|
16
|
+
// optimize: true
|
|
17
|
+
},
|
|
18
|
+
discriminator: true,
|
|
19
|
+
allowMatchingProperties: true,
|
|
20
|
+
allowUnionTypes: true,
|
|
21
|
+
allErrors: true
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
addFormats.default(ajv)
|
|
25
|
+
ajvErrors.default(ajv)
|
|
26
|
+
|
|
27
|
+
ajv.addSchema(layoutKeyword)
|
|
28
|
+
ajv.addSchema(normalizedLayout)
|
|
29
|
+
|
|
30
|
+
/** @type {Record<string, import('ajv').ValidateFunction>} */
|
|
31
|
+
const componentsValidateCache = {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {import('./types.js').ComponentInfo} component
|
|
35
|
+
* @returns {import('ajv').ValidateFunction}
|
|
36
|
+
*/
|
|
37
|
+
export function getComponentValidate (component) {
|
|
38
|
+
if (componentsValidateCache[component.name]) return componentsValidateCache[component.name]
|
|
39
|
+
const schema = getComponentSchema(component)
|
|
40
|
+
componentsValidateCache[component.name] = ajv.compile(schema)
|
|
41
|
+
return componentsValidateCache[component.name]
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} from
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function getComponentTypesCodeImport(from: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* @param {any} schema
|
|
8
|
+
* @param {string} key
|
|
9
|
+
* @param {boolean} standalone
|
|
10
|
+
* @returns {Promise<string>}
|
|
11
|
+
*/
|
|
12
|
+
export function getComponentTypesCode(schema: any, key: string, standalone?: boolean): Promise<string>;
|
|
13
|
+
//# sourceMappingURL=compile-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-types.d.ts","sourceRoot":"","sources":["../../src/components/compile-types.js"],"names":[],"mappings":"AA6BA;;;GAGG;AACH,kDAHW,MAAM,GACJ,MAAM,CAclB;AAED;;;;;GAKG;AACH,8CALW,GAAG,OACH,MAAM,eACN,OAAO,GACL,QAAQ,MAAM,CAAC,CAS3B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('../types.js').ComponentInfo} component
|
|
3
|
+
* @returns {any}
|
|
4
|
+
*/
|
|
5
|
+
export function getComponentSchema(component: import('../types.js').ComponentInfo): any;
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {import('./types.js').Section} Section
|
|
8
|
+
* @typedef {import('./types.js').Select} Select
|
|
9
|
+
* @typedef {import('./types.js').Autocomplete} Autocomplete
|
|
10
|
+
* @typedef {import('./types.js').TextField} TextField
|
|
11
|
+
* @typedef {import('./types.js').Textarea} Textarea
|
|
12
|
+
* @typedef {import('./types.js').NumberField} NumberField
|
|
13
|
+
* @typedef {import('./types.js').Slider} Slider
|
|
14
|
+
* @typedef {import('./types.js').Checkbox} Checkbox
|
|
15
|
+
* @typedef {import('./types.js').Switch} Switch
|
|
16
|
+
* @typedef {import('./types.js').DatePicker} DatePicker
|
|
17
|
+
* @typedef {import('./types.js').TimePicker} TimePicker
|
|
18
|
+
* @typedef {import('./types.js').DateTimePicker} DateTimePicker
|
|
19
|
+
* @typedef {import('./types.js').ColorPicker} ColorPicker
|
|
20
|
+
* @typedef {import('./types.js').OneOfSelect} OneOfSelect
|
|
21
|
+
* @typedef {import('./types.js').Tabs} Tabs
|
|
22
|
+
* @typedef {import('./types.js').VerticalTabs} VerticalTabs
|
|
23
|
+
* @typedef {import('./types.js').ExpansionPanels} ExpansionPanels
|
|
24
|
+
* @typedef {import('./types.js').Stepper} Stepper
|
|
25
|
+
* @typedef {import('./types.js').List} List
|
|
26
|
+
* @typedef {import('./types.js').Combobox} Combobox
|
|
27
|
+
* @typedef {import('./types.js').FileInput} FileInput
|
|
28
|
+
*/
|
|
29
|
+
/** @type {import('../types.js').ComponentInfo[]} */
|
|
30
|
+
export const standardComponents: import('../types.js').ComponentInfo[];
|
|
31
|
+
export type Section = import('./types.js').Section;
|
|
32
|
+
export type Select = import('./types.js').Select;
|
|
33
|
+
export type Autocomplete = import('./types.js').Autocomplete;
|
|
34
|
+
export type TextField = import('./types.js').TextField;
|
|
35
|
+
export type Textarea = import('./types.js').Textarea;
|
|
36
|
+
export type NumberField = import('./types.js').NumberField;
|
|
37
|
+
export type Slider = import('./types.js').Slider;
|
|
38
|
+
export type Checkbox = import('./types.js').Checkbox;
|
|
39
|
+
export type Switch = import('./types.js').Switch;
|
|
40
|
+
export type DatePicker = import('./types.js').DatePicker;
|
|
41
|
+
export type TimePicker = import('./types.js').TimePicker;
|
|
42
|
+
export type DateTimePicker = import('./types.js').DateTimePicker;
|
|
43
|
+
export type ColorPicker = import('./types.js').ColorPicker;
|
|
44
|
+
export type OneOfSelect = import('./types.js').OneOfSelect;
|
|
45
|
+
export type Tabs = import('./types.js').Tabs;
|
|
46
|
+
export type VerticalTabs = import('./types.js').VerticalTabs;
|
|
47
|
+
export type ExpansionPanels = import('./types.js').ExpansionPanels;
|
|
48
|
+
export type Stepper = import('./types.js').Stepper;
|
|
49
|
+
export type List = import('./types.js').List;
|
|
50
|
+
export type Combobox = import('./types.js').Combobox;
|
|
51
|
+
export type FileInput = import('./types.js').FileInput;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.js"],"names":[],"mappings":"AA+LA;;;GAGG;AACH,8CAHW,OAAO,aAAa,EAAE,aAAa,GACjC,GAAG,CAgCf;AAjOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,oDAAoD;AACpD,iCADW,OAAO,aAAa,EAAE,aAAa,EAAE,CAqK/C;sBA5LY,OAAO,YAAY,EAAE,OAAO;qBAC5B,OAAO,YAAY,EAAE,MAAM;2BAC3B,OAAO,YAAY,EAAE,YAAY;wBACjC,OAAO,YAAY,EAAE,SAAS;uBAC9B,OAAO,YAAY,EAAE,QAAQ;0BAC7B,OAAO,YAAY,EAAE,WAAW;qBAChC,OAAO,YAAY,EAAE,MAAM;uBAC3B,OAAO,YAAY,EAAE,QAAQ;qBAC7B,OAAO,YAAY,EAAE,MAAM;yBAC3B,OAAO,YAAY,EAAE,UAAU;yBAC/B,OAAO,YAAY,EAAE,UAAU;6BAC/B,OAAO,YAAY,EAAE,cAAc;0BACnC,OAAO,YAAY,EAAE,WAAW;0BAChC,OAAO,YAAY,EAAE,WAAW;mBAChC,OAAO,YAAY,EAAE,IAAI;2BACzB,OAAO,YAAY,EAAE,YAAY;8BACjC,OAAO,YAAY,EAAE,eAAe;sBACpC,OAAO,YAAY,EAAE,OAAO;mBAC5B,OAAO,YAAY,EAAE,IAAI;uBACzB,OAAO,YAAY,EAAE,QAAQ;wBAC7B,OAAO,YAAY,EAAE,SAAS"}
|