@ghentcdh/json-forms-core 0.6.9 → 0.7.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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=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 r=t.find(o=>o.type!=="null"),s=t.some(o=>o.type==="null");r&&s&&(delete e.anyOf,Object.assign(e,r))},w=e=>{const t=n.toJSONSchema(e,{unrepresentable:"any",target:"draft-07"});t.additionalProperties=!0;const r=t.properties;if(r)for(const s of Object.keys(r))j(r[s]);return t},P=e=>{if(!e.schema)throw new Error("no schema provided");const t=e.schema,r=e.dtoSchema,s=w(r),o=w(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: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 r=e.scope?.substring(13),s=t?.properties?.[r]??{};return{id:r,property:s}},k=(e,t)=>{const{id:r,property:s}=L(e,t);return{...e,id:r,label:r,...s}};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 d={HorizontalLayout:"HorizontalLayout",VerticalLayout:"VerticalLayout",CollapseLayout:"CollapseLayout"};class a extends m{constructor(t,r={}){super(t),this.options=r}static horizontal(){return new a(d.HorizontalLayout)}static collapse(){return new a(d.CollapseLayout)}static vertical(){return new a(d.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 y extends p{constructor(t,r="TextCell"){super(r),this.scope=t}static properties(t){return new y(`#/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 f{constructor(){this.builder=a.horizontal()}static init(){return new f}addControl(t){return this.builder.addControls(t),this}addControls(...t){return this.builder.addControls(...t),this}build(){return this.builder.build()}}const i={number:"number",string:"string",integer:"Integer",autocomplete:"autocomplete",textArea:"textArea",markdown:"markdown",array:"array",custom:"custom",select:"select",mutliSelect:"mutliSelect"};class l extends p{constructor(t,r="Control"){super(r),this.scope=t,this.options={format:"Control",styles:{}}}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.addOptions({format:i.custom,type:r}),s}detail(t,r){return this._detail=t,this.addOptions({format:i.array,elementLabelProp:r}),this}addAction(t){const r=this.options?.actions??[];return r.push(t),this.addOptions({actions:r})}detailFixed(t,r={}){return this._detail=t,this.addOptions({hideActions:!0,format:i.array,layout:r.layout??"column",elementLabelProp:r.label})}labelKey(t){return this.addOptions({labelKey:t})}readonly(){return this.addOptions({format:i.string,readonly:!0})}markdown(t){return this.addOptions({format:i.markdown,...t??{}})}textArea(t){return this.addOptions({format:i.textArea,...t??{}})}autocomplete(t){return this.addOptions({format:i.autocomplete,dataField:"data",...t??{}})}select(t){return this.addOptions({format:i.select,...t})}mutliSelect(t){return this.addOptions({format:i.mutliSelect,...t})}width(t){return this.addOptions({styles:{...this.options?.styles,width:t,control:{wrapper:`input-${t}`}}})}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=()=>n.z.coerce.number().int().positive().nonnegative(),v=()=>n.z.string().or(n.z.array(n.z.string())).transform(e=>Array.isArray(e)?e:[e]),A=n.z.enum(["asc","desc"]),O=n.z.object({page:u().optional().default(1),pageSize:u().optional().default(20),sort:n.z.string().optional().default("id"),sortDir:A.optional().default("asc"),filter:v().optional().default([])}),F=O.transform(e=>{const{page:t,pageSize:r,sort:s}=e;return{...e,sort:s||"id",offset:(t-1)*r}}),R=O.extend({count:u(),totalPages:u()}),K=n.z.object({data:n.z.array(n.z.unknown()),request:R}),q=["contains","equals"],E=e=>{const[t,r,s]=e.split(":"),o=q.includes(s)?s:"contains";return{key:t,value:r,operator:o}},T=(e,t)=>{if(e.length===1)return{key:e[0],filterObj:t};const r=e.pop();return T(e,{[r]:t})},N=(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})},$=e=>{const t={};return e?.forEach(r=>{const{key:s,value:o,operator:c}=E(r);if(!s)return;const h=c||"contains",x={[c||"contains"]:o.toLowerCase()};h==="contains"&&(x.mode="insensitive");const C=T(s.split("."),x);t[C.key]=C.filterObj}),t},H=e=>{const t=[];return e.forEach(r=>{const{key:s,value:o,operator:c}=E(r);if(!s)return;const h=s;t.push({label:h,key:s,value:o,operator:c})}),t};exports.CategoryBuilder=b;exports.ControlBuilder=l;exports.ControlType=i;exports.GroupBuilder=S;exports.LayoutBuilder=a;exports.LayoutTypes=d;exports.Operator=q;exports.PositiveRequestNumber=u;exports.RequestSchema=O;exports.RequestSchemaWithOffset=F;exports.ResponseRequestSchema=R;exports.ResponseSchema=K;exports.Size=z;exports.SortDirEnum=A;exports.StringOrArray=v;exports.TableBuilder=f;exports.TextCellBuilder=y;exports.buildFilter=$;exports.buildSort=N;exports.buildSortKey=g;exports.createSchema=P;exports.extractFilters=H;exports.findColumnDef=k;exports.findProperty=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=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 r=t.find(o=>o.type!=="null"),s=t.some(o=>o.type==="null");r&&s&&(delete e.anyOf,Object.assign(e,r))},w=e=>{const t=n.toJSONSchema(e,{unrepresentable:"any",target:"draft-07"});t.additionalProperties=!0;const r=t.properties;if(r)for(const s of Object.keys(r))j(r[s]);return t},P=e=>{if(!e.schema)throw new Error("no schema provided");const t=e.schema,r=e.dtoSchema,s=w(r),o=w(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: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 r=e.scope?.substring(13),s=t?.properties?.[r]??{};return{id:r,property:s}},k=(e,t)=>{const{id:r,property:s}=L(e,t);return{...e,id:r,label:r,...s}};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 l={HorizontalLayout:"HorizontalLayout",VerticalLayout:"VerticalLayout",CollapseLayout:"CollapseLayout",GridLayout:"GridLayout"};class a extends m{constructor(t,r={}){super(t),this.options=r}static horizontal(){return new a(l.HorizontalLayout)}static collapse(){return new a(l.CollapseLayout)}static vertical(){return new a(l.VerticalLayout)}static grid(){return new a(l.GridLayout)}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 y extends p{constructor(t,r="TextCell"){super(r),this.scope=t}static properties(t){return new y(`#/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.horizontal()}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 i={number:"number",string:"string",integer:"Integer",autocomplete:"autocomplete",textArea:"textArea",markdown:"markdown",array:"array",custom:"custom",select:"select",mutliSelect:"mutliSelect",boolean:"boolean"};class u extends p{constructor(t,r="Control"){super(r),this.scope=t,this.options={format:"Control",styles:{}}}static asObject(t){return new u(`#/properties/${t}`,"Object")}static properties(t){return new u(`#/properties/${t}`)}static asCustom(t,r){const s=new u(`#/properties/${t}`);return s.addOptions({format:i.custom,type:r}),s}detail(t,r){return this._detail=t,this.addOptions({format:i.array,elementLabelProp:r}),this}addAction(t){const r=this.options?.actions??[];return r.push(t),this.addOptions({actions:r})}detailFixed(t,r={}){return this._detail=t,this.addOptions({hideActions:!0,format:i.array,layout:r.layout??"column",elementLabelProp:r.label})}labelKey(t){return this.addOptions({labelKey:t})}readonly(){return this.addOptions({format:i.string,readonly:!0})}markdown(t){return this.addOptions({format:i.markdown,...t??{}})}textArea(t){return this.addOptions({format:i.textArea,...t??{}})}autocomplete(t){return this.addOptions({format:i.autocomplete,dataField:"data",...t??{}})}control(t,r){return this.addOptions({format:t,...r})}select(t){return this.addOptions({format:i.select,...t})}mutliSelect(t){return this.addOptions({format:i.mutliSelect,...t})}width(t){return this.addOptions({styles:{...this.options?.styles,width:t,control:{wrapper:`input-${t}`}}})}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 f extends m{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 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 c=()=>n.z.coerce.number().int().positive().nonnegative(),v=()=>n.z.string().or(n.z.array(n.z.string())).transform(e=>Array.isArray(e)?e:[e]),A=n.z.enum(["asc","desc"]),O=n.z.object({page:c().optional().default(1),pageSize:c().optional().default(20),sort:n.z.string().optional().default("id"),sortDir:A.optional().default("asc"),filter:v().optional().default([])}),F=O.transform(e=>{const{page:t,pageSize:r,sort:s}=e;return{...e,sort:s||"id",offset:(t-1)*r}}),R=O.extend({count:c(),totalPages:c()}),K=n.z.object({data:n.z.array(n.z.unknown()),request:R}),q=["contains","equals"],E=e=>{const[t,r,s]=e.split(":"),o=q.includes(s)?s:"contains";return{key:t,value:r,operator:o}},T=(e,t)=>{if(e.length===1)return{key:e[0],filterObj:t};const r=e.pop();return T(e,{[r]:t})},N=(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})},$=e=>{const t={};return e?.forEach(r=>{const{key:s,value:o,operator:d}=E(r);if(!s)return;const h=d||"contains",x={[d||"contains"]:o.toLowerCase()};h==="contains"&&(x.mode="insensitive");const C=T(s.split("."),x);t[C.key]=C.filterObj}),t},G=e=>{const t=[];return e.forEach(r=>{const{key:s,value:o,operator:d}=E(r);if(!s)return;const h=s;t.push({label:h,key:s,value:o,operator:d})}),t};exports.CategoryBuilder=f;exports.ControlBuilder=u;exports.ControlType=i;exports.GroupBuilder=S;exports.LayoutBuilder=a;exports.LayoutTypes=l;exports.Operator=q;exports.PositiveRequestNumber=c;exports.RequestSchema=O;exports.RequestSchemaWithOffset=F;exports.ResponseRequestSchema=R;exports.ResponseSchema=K;exports.Size=z;exports.SortDirEnum=A;exports.StringOrArray=v;exports.TableBuilder=b;exports.TextCellBuilder=y;exports.buildFilter=$;exports.buildSort=N;exports.buildSortKey=g;exports.createSchema=P;exports.extractFilters=G;exports.findColumnDef=k;exports.findProperty=L;
package/index.js CHANGED
@@ -3,34 +3,34 @@ var E = /* @__PURE__ */ ((e) => (e.xs = "xs", e.sm = "sm", e.lg = "lg", e.xl = "
3
3
  const j = (e) => {
4
4
  const t = e.anyOf;
5
5
  if (!Array.isArray(t) || t.length !== 2) return;
6
- const s = t.find(
6
+ const r = t.find(
7
7
  (o) => o.type !== "null"
8
- ), r = t.some(
8
+ ), s = t.some(
9
9
  (o) => o.type === "null"
10
10
  );
11
- s && r && (delete e.anyOf, Object.assign(e, s));
11
+ r && s && (delete e.anyOf, Object.assign(e, r));
12
12
  }, y = (e) => {
13
13
  const t = v(e, {
14
14
  unrepresentable: "any",
15
15
  target: "draft-07"
16
16
  });
17
17
  t.additionalProperties = !0;
18
- const s = t.properties;
19
- if (s)
20
- for (const r of Object.keys(s))
21
- j(s[r]);
18
+ const r = t.properties;
19
+ if (r)
20
+ for (const s of Object.keys(r))
21
+ j(r[s]);
22
22
  return t;
23
23
  }, R = (e) => {
24
24
  if (!e.schema)
25
25
  throw new Error("no schema provided");
26
- const t = e.schema, s = e.dtoSchema, r = y(s), o = y(t.partial());
26
+ const t = e.schema, r = e.dtoSchema, s = y(r), o = y(t.partial());
27
27
  return {
28
- dtoSchema: s,
29
- responseSchema: e.responseSchema ?? s,
28
+ dtoSchema: r,
29
+ responseSchema: e.responseSchema ?? r,
30
30
  schema: {
31
31
  form: {
32
32
  uiSchema: e.uiSchema,
33
- schema: r,
33
+ schema: s,
34
34
  modalSize: e.modalSize ?? "sm"
35
35
  },
36
36
  table: e.tableSchema ? {
@@ -48,11 +48,11 @@ const j = (e) => {
48
48
  }, k = (e, t) => {
49
49
  if (!e.scope)
50
50
  return { id: null, property: null };
51
- const s = e.scope?.substring(13), r = t?.properties?.[s] ?? {};
52
- return { id: s, property: r };
51
+ const r = e.scope?.substring(13), s = t?.properties?.[r] ?? {};
52
+ return { id: r, property: s };
53
53
  }, $ = (e, t) => {
54
- const { id: s, property: r } = k(e, t);
55
- return { ...e, id: s, label: s, ...r };
54
+ const { id: r, property: s } = k(e, t);
55
+ return { ...e, id: r, label: r, ...s };
56
56
  };
57
57
  class p {
58
58
  constructor(t) {
@@ -73,23 +73,27 @@ class m extends p {
73
73
  return this.elements.map((t) => t.build());
74
74
  }
75
75
  }
76
- const h = {
76
+ const u = {
77
77
  HorizontalLayout: "HorizontalLayout",
78
78
  VerticalLayout: "VerticalLayout",
79
- CollapseLayout: "CollapseLayout"
79
+ CollapseLayout: "CollapseLayout",
80
+ GridLayout: "GridLayout"
80
81
  };
81
82
  class a extends m {
82
- constructor(t, s = {}) {
83
- super(t), this.options = s;
83
+ constructor(t, r = {}) {
84
+ super(t), this.options = r;
84
85
  }
85
86
  static horizontal() {
86
- return new a(h.HorizontalLayout);
87
+ return new a(u.HorizontalLayout);
87
88
  }
88
89
  static collapse() {
89
- return new a(h.CollapseLayout);
90
+ return new a(u.CollapseLayout);
90
91
  }
91
92
  static vertical() {
92
- return new a(h.VerticalLayout);
93
+ return new a(u.VerticalLayout);
94
+ }
95
+ static grid() {
96
+ return new a(u.GridLayout);
93
97
  }
94
98
  titleKey(t) {
95
99
  return this.addOptions({ titleKey: t });
@@ -111,12 +115,12 @@ class a extends m {
111
115
  };
112
116
  }
113
117
  }
114
- class S extends p {
115
- constructor(t, s = "TextCell") {
116
- super(s), this.scope = t;
118
+ class O extends p {
119
+ constructor(t, r = "TextCell") {
120
+ super(r), this.scope = t;
117
121
  }
118
122
  static properties(t) {
119
- return new S(`#/properties/${t}`);
123
+ return new O(`#/properties/${t}`);
120
124
  }
121
125
  key(t) {
122
126
  return this.options = {
@@ -138,12 +142,12 @@ class S extends p {
138
142
  };
139
143
  }
140
144
  }
141
- class O {
145
+ class S {
142
146
  constructor() {
143
147
  this.builder = a.horizontal();
144
148
  }
145
149
  static init() {
146
- return new O();
150
+ return new S();
147
151
  }
148
152
  addControl(t) {
149
153
  return this.builder.addControls(t), this;
@@ -165,49 +169,50 @@ const i = {
165
169
  array: "array",
166
170
  custom: "custom",
167
171
  select: "select",
168
- mutliSelect: "mutliSelect"
172
+ mutliSelect: "mutliSelect",
173
+ boolean: "boolean"
169
174
  };
170
- class u extends p {
171
- constructor(t, s = "Control") {
172
- super(s), this.scope = t, this.options = {
175
+ class c extends p {
176
+ constructor(t, r = "Control") {
177
+ super(r), this.scope = t, this.options = {
173
178
  format: "Control",
174
179
  styles: {}
175
180
  };
176
181
  }
177
182
  static asObject(t) {
178
- return new u(
183
+ return new c(
179
184
  `#/properties/${t}`,
180
185
  "Object"
181
186
  );
182
187
  }
183
188
  static properties(t) {
184
- return new u(`#/properties/${t}`);
189
+ return new c(`#/properties/${t}`);
185
190
  }
186
- static asCustom(t, s) {
187
- const r = new u(
191
+ static asCustom(t, r) {
192
+ const s = new c(
188
193
  `#/properties/${t}`
189
194
  );
190
- return r.addOptions({
195
+ return s.addOptions({
191
196
  format: i.custom,
192
- type: s
193
- }), r;
197
+ type: r
198
+ }), s;
194
199
  }
195
- detail(t, s) {
200
+ detail(t, r) {
196
201
  return this._detail = t, this.addOptions({
197
202
  format: i.array,
198
- elementLabelProp: s
203
+ elementLabelProp: r
199
204
  }), this;
200
205
  }
201
206
  addAction(t) {
202
- const s = this.options?.actions ?? [];
203
- return s.push(t), this.addOptions({ actions: s });
207
+ const r = this.options?.actions ?? [];
208
+ return r.push(t), this.addOptions({ actions: r });
204
209
  }
205
- detailFixed(t, s = {}) {
210
+ detailFixed(t, r = {}) {
206
211
  return this._detail = t, this.addOptions({
207
212
  hideActions: !0,
208
213
  format: i.array,
209
- layout: s.layout ?? "column",
210
- elementLabelProp: s.label
214
+ layout: r.layout ?? "column",
215
+ elementLabelProp: r.label
211
216
  });
212
217
  }
213
218
  labelKey(t) {
@@ -238,6 +243,12 @@ class u extends p {
238
243
  ...t ?? {}
239
244
  });
240
245
  }
246
+ control(t, r) {
247
+ return this.addOptions({
248
+ format: t,
249
+ ...r
250
+ });
251
+ }
241
252
  select(t) {
242
253
  return this.addOptions({
243
254
  format: i.select,
@@ -306,12 +317,12 @@ class g extends m {
306
317
  };
307
318
  }
308
319
  }
309
- class x extends m {
320
+ class w extends m {
310
321
  constructor(t) {
311
322
  super(t), this.label = t;
312
323
  }
313
324
  static label(t) {
314
- return new x(t);
325
+ return new w(t);
315
326
  }
316
327
  build() {
317
328
  return {
@@ -321,84 +332,84 @@ class x extends m {
321
332
  };
322
333
  }
323
334
  }
324
- 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"]), w = n.object({
325
- page: c().optional().default(1),
326
- pageSize: c().optional().default(20),
335
+ const d = () => 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"]), x = n.object({
336
+ page: d().optional().default(1),
337
+ pageSize: d().optional().default(20),
327
338
  // TODO add sorting and so
328
339
  sort: n.string().optional().default("id"),
329
340
  sortDir: q.optional().default("asc"),
330
341
  // Filter is of the format key:value:operator (e.g. name:john:eq) operator is optional
331
342
  filter: z().optional().default([])
332
- }), H = w.transform((e) => {
333
- const { page: t, pageSize: s, sort: r } = e;
343
+ }), H = x.transform((e) => {
344
+ const { page: t, pageSize: r, sort: s } = e;
334
345
  return {
335
346
  ...e,
336
- sort: r || "id",
337
- offset: (t - 1) * s
347
+ sort: s || "id",
348
+ offset: (t - 1) * r
338
349
  };
339
- }), F = w.extend({
340
- count: c(),
341
- totalPages: c()
350
+ }), F = x.extend({
351
+ count: d(),
352
+ totalPages: d()
342
353
  }), N = n.object({
343
354
  data: n.array(n.unknown()),
344
355
  request: F
345
356
  }), K = ["contains", "equals"], C = (e) => {
346
- const [t, s, r] = e.split(":"), o = K.includes(r) ? r : "contains";
347
- return { key: t, value: s, operator: o };
357
+ const [t, r, s] = e.split(":"), o = K.includes(s) ? s : "contains";
358
+ return { key: t, value: r, operator: o };
348
359
  }, L = (e, t) => {
349
360
  if (e.length === 1)
350
361
  return { key: e[0], filterObj: t };
351
- const s = e.pop();
352
- return L(e, { [s]: t });
362
+ const r = e.pop();
363
+ return L(e, { [r]: t });
353
364
  }, T = (e, t) => A(e.split("."), t), A = (e, t) => {
354
365
  if (e.length === 1)
355
366
  return { [e[0]]: t };
356
- const s = e.pop();
357
- return A(e, { [s]: t });
367
+ const r = e.pop();
368
+ return A(e, { [r]: t });
358
369
  }, V = (e) => {
359
370
  const t = {};
360
- return e?.forEach((s) => {
361
- const { key: r, value: o, operator: l } = C(s);
362
- if (!r) return;
363
- const d = l || "contains", f = {
371
+ return e?.forEach((r) => {
372
+ const { key: s, value: o, operator: l } = C(r);
373
+ if (!s) return;
374
+ const h = l || "contains", f = {
364
375
  [l || "contains"]: o.toLowerCase()
365
376
  };
366
- d === "contains" && (f.mode = "insensitive");
367
- const b = L(r.split("."), f);
377
+ h === "contains" && (f.mode = "insensitive");
378
+ const b = L(s.split("."), f);
368
379
  t[b.key] = b.filterObj;
369
380
  }), t;
370
- }, W = (e) => {
381
+ }, G = (e) => {
371
382
  const t = [];
372
- return e.forEach((s) => {
373
- const { key: r, value: o, operator: l } = C(s);
374
- if (!r) return;
375
- const d = r;
376
- t.push({ label: d, key: r, value: o, operator: l });
383
+ return e.forEach((r) => {
384
+ const { key: s, value: o, operator: l } = C(r);
385
+ if (!s) return;
386
+ const h = s;
387
+ t.push({ label: h, key: s, value: o, operator: l });
377
388
  }), t;
378
389
  };
379
390
  export {
380
391
  g as CategoryBuilder,
381
- u as ControlBuilder,
392
+ c as ControlBuilder,
382
393
  i as ControlType,
383
- x as GroupBuilder,
394
+ w as GroupBuilder,
384
395
  a as LayoutBuilder,
385
- h as LayoutTypes,
396
+ u as LayoutTypes,
386
397
  K as Operator,
387
- c as PositiveRequestNumber,
388
- w as RequestSchema,
398
+ d as PositiveRequestNumber,
399
+ x as RequestSchema,
389
400
  H as RequestSchemaWithOffset,
390
401
  F as ResponseRequestSchema,
391
402
  N as ResponseSchema,
392
403
  E as Size,
393
404
  q as SortDirEnum,
394
405
  z as StringOrArray,
395
- O as TableBuilder,
396
- S as TextCellBuilder,
406
+ S as TableBuilder,
407
+ O as TextCellBuilder,
397
408
  V as buildFilter,
398
409
  T as buildSort,
399
410
  A as buildSortKey,
400
411
  R as createSchema,
401
- W as extractFilters,
412
+ G as extractFilters,
402
413
  $ as findColumnDef,
403
414
  k as findProperty
404
415
  };
@@ -1,5 +1,4 @@
1
- import { JsonSchema } from '@jsonforms/core';
2
- import { Layout } from '@jsonforms/core/src/models/uischema';
1
+ import { JsonSchema, Layout } from '@jsonforms/core';
3
2
  import { ZodObject } from 'zod';
4
3
  export declare enum Size {
5
4
  xs = "xs",
@@ -11,6 +11,7 @@ export declare const ControlType: {
11
11
  readonly custom: "custom";
12
12
  readonly select: "select";
13
13
  readonly mutliSelect: "mutliSelect";
14
+ readonly boolean: "boolean";
14
15
  };
15
16
  export interface TextAreaOptions extends ControlOption {
16
17
  format: 'textArea';
@@ -31,8 +32,10 @@ export interface SelectOptions extends ControlOption {
31
32
  }
32
33
  export interface AutocompleteOptions extends Omit<SelectOptions, 'format'> {
33
34
  format: 'autocomplete';
35
+ freeText?: boolean;
36
+ enableCreate?: boolean;
34
37
  }
35
- export interface AutocompleteRemoteOptions extends Omit<SelectOptions, 'format' | 'options'> {
38
+ export interface AutocompleteRemoteOptions extends Omit<AutocompleteOptions, 'format' | 'options'> {
36
39
  format: 'autocomplete';
37
40
  uri: string;
38
41
  dataField?: string;
@@ -79,7 +82,8 @@ export declare class ControlBuilder<TYPE, KEY = keyof TYPE> extends Builder<Cont
79
82
  readonly(): ControlBuilder<TYPE>;
80
83
  markdown(options?: Omit<MarkdownOptions, 'format'>): ControlBuilder<TYPE>;
81
84
  textArea(options?: Omit<TextAreaOptions, 'format'>): this;
82
- autocomplete(options: Omit<AutocompleteOptions | AutocompleteRemoteOptions, 'format'>): this;
85
+ autocomplete(options: Omit<AutocompleteOptions, 'format'> | Omit<AutocompleteRemoteOptions, 'format'>): this;
86
+ control(format: string, options?: Partial<ControlOption>): this;
83
87
  select(options: Omit<SelectOptions, 'format'>): this;
84
88
  mutliSelect(options: Omit<SelectOptions, 'format'>): this;
85
89
  width(width: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'): this;
@@ -8,6 +8,7 @@ export declare const LayoutTypes: {
8
8
  readonly HorizontalLayout: "HorizontalLayout";
9
9
  readonly VerticalLayout: "VerticalLayout";
10
10
  readonly CollapseLayout: "CollapseLayout";
11
+ readonly GridLayout: "GridLayout";
11
12
  };
12
13
  type _LayoutTypes = (typeof LayoutTypes)[keyof typeof LayoutTypes];
13
14
  export type LayoutType = {
@@ -20,6 +21,7 @@ export declare class LayoutBuilder<TYPE> extends BuilderWithElements<LayoutType,
20
21
  static horizontal<TYPE>(): LayoutBuilder<TYPE>;
21
22
  static collapse<TYPE>(): LayoutBuilder<TYPE>;
22
23
  static vertical<TYPE>(): LayoutBuilder<TYPE>;
24
+ static grid<TYPE>(): LayoutBuilder<TYPE>;
23
25
  titleKey(titleKey: string): this;
24
26
  title(title: string): this;
25
27
  private addOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghentcdh/json-forms-core",
3
- "version": "0.6.9",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",