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