@ghentcdh/json-forms-core 0.6.7 → 0.6.8
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/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +131 -92
- package/lib/{schema.model.d.ts → create-schema.d.ts} +4 -2
- package/lib/layout/control.builder.d.ts +14 -4
- package/lib/layout/layout.builder.d.ts +13 -4
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("zod");var z=(e=>(e.xs="xs",e.sm="sm",e.lg="lg",e.xl="xl",e))(z||{});const j=e=>{const t=e.anyOf;if(!Array.isArray(t)||t.length!==2)return;const s=t.find(o=>o.type!=="null"),r=t.some(o=>o.type==="null");s&&r&&(delete e.anyOf,Object.assign(e,s))},C=e=>{const t=i.toJSONSchema(e,{unrepresentable:"any",target:"draft-07"});t.additionalProperties=!0;const s=t.properties;if(s)for(const r of Object.keys(s))j(s[r]);return t},P=e=>{if(!e.schema)throw new Error("no schema provided");const t=e.schema,s=e.dtoSchema,r=C(s),o=C(t.partial());return{dtoSchema:s,responseSchema:e.responseSchema??s,schema:{form:{uiSchema:e.uiSchema,schema:r,modalSize:e.modalSize??"sm"},table:e.tableSchema?{uiSchema:e.tableSchema,schema:o}:void 0,filter:e.filterSchema?{uiSchema:e.filterSchema,schema:o}:void 0,uri:e.uri,searchUri:e.searchUri??`${e.uri}?filter=`}}},L=(e,t)=>{if(!e.scope)return{id:null,property:null};const s=e.scope?.substring(13),r=t?.properties?.[s]??{};return{id:s,property:r}},k=(e,t)=>{const{id:s,property:r}=L(e,t);return{...e,id:s,label:s,...r}};class p{constructor(t){this.type=t}}class m extends p{constructor(){super(...arguments),this.elements=[]}addControl(t){return this.elements.push(t),this}addControls(...t){return this.elements.push(...t),this}buildElements(){return this.elements.map(t=>t.build())}}const h={HorizontalLayout:"HorizontalLayout",VerticalLayout:"VerticalLayout",CollapseLayout:"CollapseLayout"};class a extends m{constructor(t,s={}){super(t),this.options=s}static horizontal(){return new a(h.HorizontalLayout)}static collapse(){return new a(h.CollapseLayout)}static vertical(){return new a(h.VerticalLayout)}titleKey(t){return this.addOptions({titleKey:t})}title(t){return this.addOptions({title:t})}addOptions(t){return this.options={...this.options,...t},this}build(){return{type:this.type,elements:this.buildElements(),options:this.options}}}class f extends p{constructor(t,s="TextCell"){super(s),this.scope=t}static properties(t){return new f(`#/properties/${t}`)}key(t){return this.options={format:"keyValue",key:t},this}setSortId(t){return this.options={...this.options??{format:"TextCell"},sortId:t},this}build(){return{type:this.type,scope:this.scope,options:this.options}}}class y{constructor(){this.builder=a.horizontal()}static init(){return new y}addControl(t){return this.builder.addControls(t),this}addControls(...t){return this.builder.addControls(...t),this}build(){return this.builder.build()}}const n={number:"number",string:"string",integer:"Integer",autocomplete:"autocomplete",textArea:"textArea",markdown:"markdown",array:"array",custom:"custom"};class l extends p{constructor(t,s="Control"){super(s),this.scope=t,this.options={format:"Control",styles:{control:{wrapper:"w-full"}}}}static asObject(t){return new l(`#/properties/${t}`,"Object")}static properties(t){return new l(`#/properties/${t}`)}static asCustom(t,s){const r=new l(`#/properties/${t}`);return r.options={format:n.custom,type:s},r}detail(t,s){return this._detail=t,this.options={...this.options??{},format:n.array,elementLabelProp:s},this}addAction(t){const s=this.options?.actions??[];return s.push(t),this.options={...this.options??{},actions:s},this}detailFixed(t,s={}){return this._detail=t,this.options={...this.options??{},hideActions:!0,format:n.array,layout:s.layout??"column",elementLabelProp:s.label},this}labelKey(t){return this.options={...this.options??{},labelKey:t},this}readonly(){return this.options={format:n.string,readonly:!0},this}markdown(){return this.options={format:n.markdown},this}textArea(t){return this.options={format:n.textArea,...t??{}},this}autocomplete(t){return this.options={format:n.autocomplete,dataField:"data",...t},this}width(t){const s={xs:"w-12",sm:"w-24",md:"w-36",lg:"w-48",xl:"w-64",full:"w-full"};return this.addOptions({styles:{...this.options?.styles,control:{wrapper:` ${s[t]??s.sm}`}}})}customLabel(t){return this.addOptions({label:t})}placeHolder(t){return this.addOptions({placeholder:t})}hideLabel(){return this.addOptions({hideLabel:!0})}addOptions(t){return this.options={...this.options,...t},this}build(){return{type:this.type,scope:this.scope,options:{...this.options,detail:this._detail?this._detail?.build():void 0}}}}class b extends m{constructor(t){super(t),this.label=t,this.rule={effect:"SHOW",condition:{}}}static label(t){return new b(t)}build(){return{type:"Category",label:this.label,rule:this.rule,elements:this.buildElements()}}}class S extends m{constructor(t){super(t),this.label=t}static label(t){return new S(t)}build(){return{type:"Group",label:this.label,elements:this.buildElements()}}}const u=()=>i.z.coerce.number().int().positive().nonnegative(),v=()=>i.z.string().or(i.z.array(i.z.string())).transform(e=>Array.isArray(e)?e:[e]),A=i.z.enum(["asc","desc"]),g=i.z.object({page:u().optional().default(1),pageSize:u().optional().default(20),sort:i.z.string().optional().default("id"),sortDir:A.optional().default("asc"),filter:v().optional().default([])}),F=g.transform(e=>{const{page:t,pageSize:s,sort:r}=e;return{...e,sort:r||"id",offset:(t-1)*s}}),R=g.extend({count:u(),totalPages:u()}),K=i.z.object({data:i.z.array(i.z.unknown()),request:R}),q=["contains","equals"],E=e=>{const[t,s,r]=e.split(":"),o=q.includes(r)?r:"contains";return{key:t,value:s,operator:o}},T=(e,t)=>{if(e.length===1)return{key:e[0],filterObj:t};const s=e.pop();return T(e,{[s]:t})},N=(e,t)=>w(e.split("."),t),w=(e,t)=>{if(e.length===1)return{[e[0]]:t};const s=e.pop();return w(e,{[s]:t})},$=e=>{const t={};return e?.forEach(s=>{const{key:r,value:o,operator:c}=E(s);if(!r)return;const d=c||"contains",O={[c||"contains"]:o.toLowerCase()};d==="contains"&&(O.mode="insensitive");const x=T(r.split("."),O);t[x.key]=x.filterObj}),t},H=e=>{const t=[];return e.forEach(s=>{const{key:r,value:o,operator:c}=E(s);if(!r)return;const d=r;t.push({label:d,key:r,value:o,operator:c})}),t};exports.CategoryBuilder=b;exports.ControlBuilder=l;exports.ControlType=n;exports.GroupBuilder=S;exports.LayoutBuilder=a;exports.LayoutTypes=h;exports.Operator=q;exports.PositiveRequestNumber=u;exports.RequestSchema=g;exports.RequestSchemaWithOffset=F;exports.ResponseRequestSchema=R;exports.ResponseSchema=K;exports.Size=z;exports.SortDirEnum=A;exports.StringOrArray=v;exports.TableBuilder=y;exports.TextCellBuilder=f;exports.buildFilter=$;exports.buildSort=N;exports.buildSortKey=w;exports.createSchema=P;exports.extractFilters=H;exports.findColumnDef=k;exports.findProperty=L;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import { toJSONSchema as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { toJSONSchema as v, z as n } from "zod";
|
|
2
|
+
var E = /* @__PURE__ */ ((e) => (e.xs = "xs", e.sm = "sm", e.lg = "lg", e.xl = "xl", e))(E || {});
|
|
3
|
+
const j = (e) => {
|
|
4
|
+
const t = e.anyOf;
|
|
5
|
+
if (!Array.isArray(t) || t.length !== 2) return;
|
|
6
|
+
const s = t.find(
|
|
7
|
+
(o) => o.type !== "null"
|
|
8
|
+
), r = t.some(
|
|
9
|
+
(o) => o.type === "null"
|
|
10
|
+
);
|
|
11
|
+
s && r && (delete e.anyOf, Object.assign(e, s));
|
|
12
|
+
}, y = (e) => {
|
|
13
|
+
const t = v(e, {
|
|
14
|
+
unrepresentable: "any",
|
|
15
|
+
target: "draft-07"
|
|
16
|
+
});
|
|
17
|
+
t.additionalProperties = !0;
|
|
18
|
+
const s = t.properties;
|
|
19
|
+
if (s)
|
|
20
|
+
for (const r of Object.keys(s))
|
|
21
|
+
j(s[r]);
|
|
22
|
+
return t;
|
|
23
|
+
}, R = (e) => {
|
|
7
24
|
if (!e.schema)
|
|
8
25
|
throw new Error("no schema provided");
|
|
9
|
-
const t = e.schema, s = e.dtoSchema, r =
|
|
26
|
+
const t = e.schema, s = e.dtoSchema, r = y(s), o = y(t.partial());
|
|
10
27
|
return {
|
|
11
28
|
dtoSchema: s,
|
|
12
29
|
responseSchema: e.responseSchema ?? s,
|
|
@@ -18,31 +35,31 @@ const f = (e) => E(e, {
|
|
|
18
35
|
},
|
|
19
36
|
table: e.tableSchema ? {
|
|
20
37
|
uiSchema: e.tableSchema,
|
|
21
|
-
schema:
|
|
38
|
+
schema: o
|
|
22
39
|
} : void 0,
|
|
23
40
|
filter: e.filterSchema ? {
|
|
24
41
|
uiSchema: e.filterSchema,
|
|
25
|
-
schema:
|
|
42
|
+
schema: o
|
|
26
43
|
} : void 0,
|
|
27
44
|
uri: e.uri,
|
|
28
45
|
searchUri: e.searchUri ?? `${e.uri}?filter=`
|
|
29
46
|
}
|
|
30
47
|
};
|
|
31
|
-
},
|
|
48
|
+
}, k = (e, t) => {
|
|
32
49
|
if (!e.scope)
|
|
33
50
|
return { id: null, property: null };
|
|
34
51
|
const s = e.scope?.substring(13), r = t?.properties?.[s] ?? {};
|
|
35
52
|
return { id: s, property: r };
|
|
36
|
-
},
|
|
37
|
-
const { id: s, property: r } =
|
|
53
|
+
}, $ = (e, t) => {
|
|
54
|
+
const { id: s, property: r } = k(e, t);
|
|
38
55
|
return { ...e, id: s, label: s, ...r };
|
|
39
56
|
};
|
|
40
|
-
class
|
|
57
|
+
class d {
|
|
41
58
|
constructor(t) {
|
|
42
59
|
this.type = t;
|
|
43
60
|
}
|
|
44
61
|
}
|
|
45
|
-
class
|
|
62
|
+
class m extends d {
|
|
46
63
|
constructor() {
|
|
47
64
|
super(...arguments), this.elements = [];
|
|
48
65
|
}
|
|
@@ -56,24 +73,35 @@ class d extends p {
|
|
|
56
73
|
return this.elements.map((t) => t.build());
|
|
57
74
|
}
|
|
58
75
|
}
|
|
59
|
-
|
|
76
|
+
const p = {
|
|
77
|
+
HorizontalLayout: "HorizontalLayout",
|
|
78
|
+
VerticalLayout: "VerticalLayout",
|
|
79
|
+
CollapseLayout: "CollapseLayout"
|
|
80
|
+
};
|
|
81
|
+
class a extends m {
|
|
60
82
|
constructor(t, s = {}) {
|
|
61
83
|
super(t), this.options = s;
|
|
62
84
|
}
|
|
63
85
|
static horizontal() {
|
|
64
|
-
return new a(
|
|
65
|
-
}
|
|
66
|
-
static stepper(t = !1) {
|
|
67
|
-
return new a("Categorization", {
|
|
68
|
-
variant: "stepper",
|
|
69
|
-
showNavButtons: !t
|
|
70
|
-
});
|
|
86
|
+
return new a(p.HorizontalLayout);
|
|
71
87
|
}
|
|
72
|
-
static
|
|
73
|
-
return new a(
|
|
88
|
+
static collapse() {
|
|
89
|
+
return new a(p.CollapseLayout);
|
|
74
90
|
}
|
|
75
91
|
static vertical() {
|
|
76
|
-
return new a(
|
|
92
|
+
return new a(p.VerticalLayout);
|
|
93
|
+
}
|
|
94
|
+
titleKey(t) {
|
|
95
|
+
return this.addOptions({ titleKey: t });
|
|
96
|
+
}
|
|
97
|
+
title(t) {
|
|
98
|
+
return this.addOptions({ title: t });
|
|
99
|
+
}
|
|
100
|
+
addOptions(t) {
|
|
101
|
+
return this.options = {
|
|
102
|
+
...this.options,
|
|
103
|
+
...t
|
|
104
|
+
}, this;
|
|
77
105
|
}
|
|
78
106
|
build() {
|
|
79
107
|
return {
|
|
@@ -83,12 +111,12 @@ class a extends d {
|
|
|
83
111
|
};
|
|
84
112
|
}
|
|
85
113
|
}
|
|
86
|
-
class
|
|
114
|
+
class S extends d {
|
|
87
115
|
constructor(t, s = "TextCell") {
|
|
88
116
|
super(s), this.scope = t;
|
|
89
117
|
}
|
|
90
118
|
static properties(t) {
|
|
91
|
-
return new
|
|
119
|
+
return new S(`#/properties/${t}`);
|
|
92
120
|
}
|
|
93
121
|
key(t) {
|
|
94
122
|
return this.options = {
|
|
@@ -110,12 +138,12 @@ class y extends p {
|
|
|
110
138
|
};
|
|
111
139
|
}
|
|
112
140
|
}
|
|
113
|
-
class
|
|
141
|
+
class g {
|
|
114
142
|
constructor() {
|
|
115
|
-
this.builder = a.
|
|
143
|
+
this.builder = a.horizontal();
|
|
116
144
|
}
|
|
117
145
|
static init() {
|
|
118
|
-
return new
|
|
146
|
+
return new g();
|
|
119
147
|
}
|
|
120
148
|
addControl(t) {
|
|
121
149
|
return this.builder.addControls(t), this;
|
|
@@ -134,11 +162,10 @@ const i = {
|
|
|
134
162
|
autocomplete: "autocomplete",
|
|
135
163
|
textArea: "textArea",
|
|
136
164
|
markdown: "markdown",
|
|
137
|
-
fixedArray: "fixedArray",
|
|
138
165
|
array: "array",
|
|
139
166
|
custom: "custom"
|
|
140
167
|
};
|
|
141
|
-
class
|
|
168
|
+
class u extends d {
|
|
142
169
|
constructor(t, s = "Control") {
|
|
143
170
|
super(s), this.scope = t, this.options = {
|
|
144
171
|
format: "Control",
|
|
@@ -150,16 +177,16 @@ class c extends p {
|
|
|
150
177
|
};
|
|
151
178
|
}
|
|
152
179
|
static asObject(t) {
|
|
153
|
-
return new
|
|
180
|
+
return new u(
|
|
154
181
|
`#/properties/${t}`,
|
|
155
182
|
"Object"
|
|
156
183
|
);
|
|
157
184
|
}
|
|
158
185
|
static properties(t) {
|
|
159
|
-
return new
|
|
186
|
+
return new u(`#/properties/${t}`);
|
|
160
187
|
}
|
|
161
188
|
static asCustom(t, s) {
|
|
162
|
-
const r = new
|
|
189
|
+
const r = new u(
|
|
163
190
|
`#/properties/${t}`
|
|
164
191
|
);
|
|
165
192
|
return r.options = {
|
|
@@ -181,11 +208,13 @@ class c extends p {
|
|
|
181
208
|
actions: s
|
|
182
209
|
}, this;
|
|
183
210
|
}
|
|
184
|
-
detailFixed(t, s) {
|
|
211
|
+
detailFixed(t, s = {}) {
|
|
185
212
|
return this._detail = t, this.options = {
|
|
186
213
|
...this.options ?? {},
|
|
187
|
-
|
|
188
|
-
|
|
214
|
+
hideActions: !0,
|
|
215
|
+
format: i.array,
|
|
216
|
+
layout: s.layout ?? "column",
|
|
217
|
+
elementLabelProp: s.label
|
|
189
218
|
}, this;
|
|
190
219
|
}
|
|
191
220
|
labelKey(t) {
|
|
@@ -222,22 +251,31 @@ class c extends p {
|
|
|
222
251
|
sm: "w-24",
|
|
223
252
|
md: "w-36",
|
|
224
253
|
lg: "w-48",
|
|
225
|
-
xl: "w-64"
|
|
254
|
+
xl: "w-64",
|
|
255
|
+
full: "w-full"
|
|
226
256
|
};
|
|
227
|
-
return this.
|
|
228
|
-
...this.options,
|
|
257
|
+
return this.addOptions({
|
|
229
258
|
styles: {
|
|
230
259
|
...this.options?.styles,
|
|
231
260
|
control: {
|
|
232
|
-
wrapper: s[t] ?? s.sm
|
|
261
|
+
wrapper: ` ${s[t] ?? s.sm}`
|
|
233
262
|
}
|
|
234
263
|
}
|
|
235
|
-
}
|
|
264
|
+
});
|
|
236
265
|
}
|
|
237
266
|
customLabel(t) {
|
|
267
|
+
return this.addOptions({ label: t });
|
|
268
|
+
}
|
|
269
|
+
placeHolder(t) {
|
|
270
|
+
return this.addOptions({ placeholder: t });
|
|
271
|
+
}
|
|
272
|
+
hideLabel() {
|
|
273
|
+
return this.addOptions({ hideLabel: !0 });
|
|
274
|
+
}
|
|
275
|
+
addOptions(t) {
|
|
238
276
|
return this.options = {
|
|
239
277
|
...this.options,
|
|
240
|
-
|
|
278
|
+
...t
|
|
241
279
|
}, this;
|
|
242
280
|
}
|
|
243
281
|
build() {
|
|
@@ -251,7 +289,7 @@ class c extends p {
|
|
|
251
289
|
};
|
|
252
290
|
}
|
|
253
291
|
}
|
|
254
|
-
class w extends
|
|
292
|
+
class w extends m {
|
|
255
293
|
constructor(t) {
|
|
256
294
|
super(t), this.label = t, this.rule = {
|
|
257
295
|
effect: "SHOW",
|
|
@@ -270,12 +308,12 @@ class w extends d {
|
|
|
270
308
|
};
|
|
271
309
|
}
|
|
272
310
|
}
|
|
273
|
-
class
|
|
311
|
+
class x extends m {
|
|
274
312
|
constructor(t) {
|
|
275
313
|
super(t), this.label = t;
|
|
276
314
|
}
|
|
277
315
|
static label(t) {
|
|
278
|
-
return new
|
|
316
|
+
return new x(t);
|
|
279
317
|
}
|
|
280
318
|
build() {
|
|
281
319
|
return {
|
|
@@ -285,83 +323,84 @@ class g extends d {
|
|
|
285
323
|
};
|
|
286
324
|
}
|
|
287
325
|
}
|
|
288
|
-
const
|
|
289
|
-
page:
|
|
290
|
-
pageSize:
|
|
326
|
+
const c = () => n.coerce.number().int().positive().nonnegative(), z = () => n.string().or(n.array(n.string())).transform((e) => Array.isArray(e) ? e : [e]), q = n.enum(["asc", "desc"]), O = n.object({
|
|
327
|
+
page: c().optional().default(1),
|
|
328
|
+
pageSize: c().optional().default(20),
|
|
291
329
|
// TODO add sorting and so
|
|
292
|
-
sort:
|
|
330
|
+
sort: n.string().optional().default("id"),
|
|
293
331
|
sortDir: q.optional().default("asc"),
|
|
294
332
|
// Filter is of the format key:value:operator (e.g. name:john:eq) operator is optional
|
|
295
|
-
filter:
|
|
296
|
-
}),
|
|
333
|
+
filter: z().optional().default([])
|
|
334
|
+
}), H = O.transform((e) => {
|
|
297
335
|
const { page: t, pageSize: s, sort: r } = e;
|
|
298
336
|
return {
|
|
299
337
|
...e,
|
|
300
338
|
sort: r || "id",
|
|
301
339
|
offset: (t - 1) * s
|
|
302
340
|
};
|
|
303
|
-
}),
|
|
304
|
-
count:
|
|
305
|
-
totalPages:
|
|
306
|
-
}),
|
|
307
|
-
data:
|
|
308
|
-
request:
|
|
309
|
-
}),
|
|
310
|
-
const [t, s, r] = e.split(":"),
|
|
311
|
-
return { key: t, value: s, operator:
|
|
312
|
-
},
|
|
341
|
+
}), F = O.extend({
|
|
342
|
+
count: c(),
|
|
343
|
+
totalPages: c()
|
|
344
|
+
}), N = n.object({
|
|
345
|
+
data: n.array(n.unknown()),
|
|
346
|
+
request: F
|
|
347
|
+
}), K = ["contains", "equals"], C = (e) => {
|
|
348
|
+
const [t, s, r] = e.split(":"), o = K.includes(r) ? r : "contains";
|
|
349
|
+
return { key: t, value: s, operator: o };
|
|
350
|
+
}, L = (e, t) => {
|
|
313
351
|
if (e.length === 1)
|
|
314
352
|
return { key: e[0], filterObj: t };
|
|
315
353
|
const s = e.pop();
|
|
316
|
-
return
|
|
317
|
-
},
|
|
354
|
+
return L(e, { [s]: t });
|
|
355
|
+
}, T = (e, t) => A(e.split("."), t), A = (e, t) => {
|
|
318
356
|
if (e.length === 1)
|
|
319
357
|
return { [e[0]]: t };
|
|
320
358
|
const s = e.pop();
|
|
321
359
|
return A(e, { [s]: t });
|
|
322
|
-
},
|
|
360
|
+
}, V = (e) => {
|
|
323
361
|
const t = {};
|
|
324
362
|
return e?.forEach((s) => {
|
|
325
|
-
const { key: r, value:
|
|
363
|
+
const { key: r, value: o, operator: l } = C(s);
|
|
326
364
|
if (!r) return;
|
|
327
|
-
const h = l || "contains",
|
|
328
|
-
[l || "contains"]:
|
|
365
|
+
const h = l || "contains", f = {
|
|
366
|
+
[l || "contains"]: o.toLowerCase()
|
|
329
367
|
};
|
|
330
|
-
h === "contains" && (
|
|
331
|
-
const b =
|
|
368
|
+
h === "contains" && (f.mode = "insensitive");
|
|
369
|
+
const b = L(r.split("."), f);
|
|
332
370
|
t[b.key] = b.filterObj;
|
|
333
371
|
}), t;
|
|
334
|
-
},
|
|
372
|
+
}, W = (e) => {
|
|
335
373
|
const t = [];
|
|
336
374
|
return e.forEach((s) => {
|
|
337
|
-
const { key: r, value:
|
|
375
|
+
const { key: r, value: o, operator: l } = C(s);
|
|
338
376
|
if (!r) return;
|
|
339
377
|
const h = r;
|
|
340
|
-
t.push({ label: h, key: r, value:
|
|
378
|
+
t.push({ label: h, key: r, value: o, operator: l });
|
|
341
379
|
}), t;
|
|
342
380
|
};
|
|
343
381
|
export {
|
|
344
382
|
w as CategoryBuilder,
|
|
345
|
-
|
|
383
|
+
u as ControlBuilder,
|
|
346
384
|
i as ControlType,
|
|
347
|
-
|
|
385
|
+
x as GroupBuilder,
|
|
348
386
|
a as LayoutBuilder,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
387
|
+
p as LayoutTypes,
|
|
388
|
+
K as Operator,
|
|
389
|
+
c as PositiveRequestNumber,
|
|
390
|
+
O as RequestSchema,
|
|
391
|
+
H as RequestSchemaWithOffset,
|
|
392
|
+
F as ResponseRequestSchema,
|
|
393
|
+
N as ResponseSchema,
|
|
394
|
+
E as Size,
|
|
356
395
|
q as SortDirEnum,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
396
|
+
z as StringOrArray,
|
|
397
|
+
g as TableBuilder,
|
|
398
|
+
S as TextCellBuilder,
|
|
399
|
+
V as buildFilter,
|
|
400
|
+
T as buildSort,
|
|
362
401
|
A as buildSortKey,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
402
|
+
R as createSchema,
|
|
403
|
+
W as extractFilters,
|
|
404
|
+
$ as findColumnDef,
|
|
405
|
+
k as findProperty
|
|
367
406
|
};
|
|
@@ -7,9 +7,11 @@ export declare enum Size {
|
|
|
7
7
|
lg = "lg",
|
|
8
8
|
xl = "xl"
|
|
9
9
|
}
|
|
10
|
+
export type SizeType = keyof typeof Size;
|
|
10
11
|
export type JsonFormsLayout = {
|
|
11
12
|
uiSchema: Layout;
|
|
12
|
-
|
|
13
|
+
schema: JsonSchema;
|
|
14
|
+
modalSize?: SizeType;
|
|
13
15
|
};
|
|
14
16
|
export type FormSchemaModel = {
|
|
15
17
|
form: JsonFormsLayout;
|
|
@@ -27,7 +29,7 @@ export declare const createSchema: (props: {
|
|
|
27
29
|
responseSchema?: ZodObject<any>;
|
|
28
30
|
uri: string;
|
|
29
31
|
searchUri?: string;
|
|
30
|
-
modalSize?:
|
|
32
|
+
modalSize?: SizeType;
|
|
31
33
|
}) => {
|
|
32
34
|
dtoSchema: ZodObject<any, import('zod/v4/core').$strip>;
|
|
33
35
|
responseSchema: ZodObject<any, import('zod/v4/core').$strip>;
|
|
@@ -7,7 +7,6 @@ export declare const ControlType: {
|
|
|
7
7
|
readonly autocomplete: "autocomplete";
|
|
8
8
|
readonly textArea: "textArea";
|
|
9
9
|
readonly markdown: "markdown";
|
|
10
|
-
readonly fixedArray: "fixedArray";
|
|
11
10
|
readonly array: "array";
|
|
12
11
|
readonly custom: "custom";
|
|
13
12
|
};
|
|
@@ -15,12 +14,14 @@ export interface TextAreaOptions extends ControlOption {
|
|
|
15
14
|
format: 'textArea';
|
|
16
15
|
}
|
|
17
16
|
export interface DetailOptions extends ControlOption {
|
|
18
|
-
format: '
|
|
17
|
+
format: 'array';
|
|
18
|
+
layout: 'row' | 'column';
|
|
19
19
|
}
|
|
20
20
|
export interface AutocompleteOptions extends ControlOption {
|
|
21
21
|
format: 'autocomplete';
|
|
22
22
|
uri: string;
|
|
23
23
|
dataField?: string;
|
|
24
|
+
skipAuth?: boolean;
|
|
24
25
|
field: {
|
|
25
26
|
id: string;
|
|
26
27
|
label: string;
|
|
@@ -40,6 +41,9 @@ export interface ControlOption {
|
|
|
40
41
|
elementLabelProp?: string;
|
|
41
42
|
labelKey?: string;
|
|
42
43
|
actions?: ArrayAction[];
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
hideLabel?: boolean;
|
|
46
|
+
hideActions?: boolean;
|
|
43
47
|
}
|
|
44
48
|
export type ControlTypes = {
|
|
45
49
|
type: 'Control' | 'Object' | 'TextCell';
|
|
@@ -56,13 +60,19 @@ export declare class ControlBuilder<TYPE, KEY = keyof TYPE> extends Builder<Cont
|
|
|
56
60
|
static asCustom<TYPE>(property: keyof TYPE, type: string): ControlBuilder<TYPE>;
|
|
57
61
|
detail<TYPE>(layoutBuilder: LayoutBuilder<TYPE>, label?: string): this;
|
|
58
62
|
addAction(action: ArrayAction): this;
|
|
59
|
-
detailFixed<TYPE>(layoutBuilder: LayoutBuilder<TYPE>,
|
|
63
|
+
detailFixed<TYPE>(layoutBuilder: LayoutBuilder<TYPE>, options?: {
|
|
64
|
+
label?: string;
|
|
65
|
+
layout?: 'row' | 'column';
|
|
66
|
+
}): this;
|
|
60
67
|
labelKey(labelKey: string): this;
|
|
61
68
|
readonly(): ControlBuilder<TYPE>;
|
|
62
69
|
markdown(): ControlBuilder<TYPE>;
|
|
63
70
|
textArea(options?: Omit<TextAreaOptions, 'format'>): this;
|
|
64
71
|
autocomplete(options: Omit<AutocompleteOptions, 'format'>): this;
|
|
65
|
-
width(width: 'xs' | 'sm' | 'md' | 'lg' | 'xl'): this;
|
|
72
|
+
width(width: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'): this;
|
|
66
73
|
customLabel(label: string): this;
|
|
74
|
+
placeHolder(placeholder: string): this;
|
|
75
|
+
hideLabel(): this;
|
|
76
|
+
private addOptions;
|
|
67
77
|
build(): ControlTypes;
|
|
68
78
|
}
|
|
@@ -4,16 +4,25 @@ import { ControlBuilder, ControlTypes } from './control.builder';
|
|
|
4
4
|
import { GroupBuilder } from './group.builder';
|
|
5
5
|
import { TextCellBuilder } from '../table/builder';
|
|
6
6
|
export type ElementBuilder<TYPE> = ControlBuilder<TYPE> | LayoutBuilder<TYPE> | CategoryBuilder<TYPE> | GroupBuilder<TYPE> | TextCellBuilder<TYPE>;
|
|
7
|
+
export declare const LayoutTypes: {
|
|
8
|
+
readonly HorizontalLayout: "HorizontalLayout";
|
|
9
|
+
readonly VerticalLayout: "VerticalLayout";
|
|
10
|
+
readonly CollapseLayout: "CollapseLayout";
|
|
11
|
+
};
|
|
12
|
+
type _LayoutTypes = (typeof LayoutTypes)[keyof typeof LayoutTypes];
|
|
7
13
|
export type LayoutType = {
|
|
8
|
-
type: '
|
|
14
|
+
type: 'LayoutTypes';
|
|
9
15
|
elements: Array<ControlTypes | LayoutType>;
|
|
10
16
|
};
|
|
11
17
|
export declare class LayoutBuilder<TYPE> extends BuilderWithElements<LayoutType, TYPE> {
|
|
12
18
|
private options;
|
|
13
|
-
protected constructor(type:
|
|
19
|
+
protected constructor(type: _LayoutTypes, options?: {});
|
|
14
20
|
static horizontal<TYPE>(): LayoutBuilder<TYPE>;
|
|
15
|
-
static
|
|
16
|
-
static table(): LayoutBuilder<unknown>;
|
|
21
|
+
static collapse<TYPE>(): LayoutBuilder<TYPE>;
|
|
17
22
|
static vertical<TYPE>(): LayoutBuilder<TYPE>;
|
|
23
|
+
titleKey(titleKey: string): this;
|
|
24
|
+
title(title: string): this;
|
|
25
|
+
private addOptions;
|
|
18
26
|
build(): LayoutType;
|
|
19
27
|
}
|
|
28
|
+
export {};
|