@ghentcdh/json-forms-core 0.6.8 → 0.6.9

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 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;
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;
package/index.js CHANGED
@@ -54,12 +54,12 @@ const j = (e) => {
54
54
  const { id: s, property: r } = k(e, t);
55
55
  return { ...e, id: s, label: s, ...r };
56
56
  };
57
- class d {
57
+ class p {
58
58
  constructor(t) {
59
59
  this.type = t;
60
60
  }
61
61
  }
62
- class m extends d {
62
+ class m extends p {
63
63
  constructor() {
64
64
  super(...arguments), this.elements = [];
65
65
  }
@@ -73,7 +73,7 @@ class m extends d {
73
73
  return this.elements.map((t) => t.build());
74
74
  }
75
75
  }
76
- const p = {
76
+ const h = {
77
77
  HorizontalLayout: "HorizontalLayout",
78
78
  VerticalLayout: "VerticalLayout",
79
79
  CollapseLayout: "CollapseLayout"
@@ -83,13 +83,13 @@ class a extends m {
83
83
  super(t), this.options = s;
84
84
  }
85
85
  static horizontal() {
86
- return new a(p.HorizontalLayout);
86
+ return new a(h.HorizontalLayout);
87
87
  }
88
88
  static collapse() {
89
- return new a(p.CollapseLayout);
89
+ return new a(h.CollapseLayout);
90
90
  }
91
91
  static vertical() {
92
- return new a(p.VerticalLayout);
92
+ return new a(h.VerticalLayout);
93
93
  }
94
94
  titleKey(t) {
95
95
  return this.addOptions({ titleKey: t });
@@ -111,7 +111,7 @@ class a extends m {
111
111
  };
112
112
  }
113
113
  }
114
- class S extends d {
114
+ class S extends p {
115
115
  constructor(t, s = "TextCell") {
116
116
  super(s), this.scope = t;
117
117
  }
@@ -138,12 +138,12 @@ class S extends d {
138
138
  };
139
139
  }
140
140
  }
141
- class g {
141
+ class O {
142
142
  constructor() {
143
143
  this.builder = a.horizontal();
144
144
  }
145
145
  static init() {
146
- return new g();
146
+ return new O();
147
147
  }
148
148
  addControl(t) {
149
149
  return this.builder.addControls(t), this;
@@ -163,17 +163,15 @@ const i = {
163
163
  textArea: "textArea",
164
164
  markdown: "markdown",
165
165
  array: "array",
166
- custom: "custom"
166
+ custom: "custom",
167
+ select: "select",
168
+ mutliSelect: "mutliSelect"
167
169
  };
168
- class u extends d {
170
+ class u extends p {
169
171
  constructor(t, s = "Control") {
170
172
  super(s), this.scope = t, this.options = {
171
173
  format: "Control",
172
- styles: {
173
- control: {
174
- wrapper: "w-full"
175
- }
176
- }
174
+ styles: {}
177
175
  };
178
176
  }
179
177
  static asObject(t) {
@@ -189,76 +187,76 @@ class u extends d {
189
187
  const r = new u(
190
188
  `#/properties/${t}`
191
189
  );
192
- return r.options = {
190
+ return r.addOptions({
193
191
  format: i.custom,
194
192
  type: s
195
- }, r;
193
+ }), r;
196
194
  }
197
195
  detail(t, s) {
198
- return this._detail = t, this.options = {
199
- ...this.options ?? {},
196
+ return this._detail = t, this.addOptions({
200
197
  format: i.array,
201
198
  elementLabelProp: s
202
- }, this;
199
+ }), this;
203
200
  }
204
201
  addAction(t) {
205
202
  const s = this.options?.actions ?? [];
206
- return s.push(t), this.options = {
207
- ...this.options ?? {},
208
- actions: s
209
- }, this;
203
+ return s.push(t), this.addOptions({ actions: s });
210
204
  }
211
205
  detailFixed(t, s = {}) {
212
- return this._detail = t, this.options = {
213
- ...this.options ?? {},
206
+ return this._detail = t, this.addOptions({
214
207
  hideActions: !0,
215
208
  format: i.array,
216
209
  layout: s.layout ?? "column",
217
210
  elementLabelProp: s.label
218
- }, this;
211
+ });
219
212
  }
220
213
  labelKey(t) {
221
- return this.options = {
222
- ...this.options ?? {},
223
- labelKey: t
224
- }, this;
214
+ return this.addOptions({ labelKey: t });
225
215
  }
226
216
  readonly() {
227
- return this.options = {
217
+ return this.addOptions({
228
218
  format: i.string,
229
219
  readonly: !0
230
- }, this;
220
+ });
231
221
  }
232
- markdown() {
233
- return this.options = { format: i.markdown }, this;
222
+ markdown(t) {
223
+ return this.addOptions({
224
+ format: i.markdown,
225
+ ...t ?? {}
226
+ });
234
227
  }
235
228
  textArea(t) {
236
- return this.options = {
229
+ return this.addOptions({
237
230
  format: i.textArea,
238
231
  ...t ?? {}
239
- }, this;
232
+ });
240
233
  }
241
234
  autocomplete(t) {
242
- return this.options = {
235
+ return this.addOptions({
243
236
  format: i.autocomplete,
244
237
  dataField: "data",
238
+ ...t ?? {}
239
+ });
240
+ }
241
+ select(t) {
242
+ return this.addOptions({
243
+ format: i.select,
245
244
  ...t
246
- }, this;
245
+ });
246
+ }
247
+ mutliSelect(t) {
248
+ return this.addOptions({
249
+ format: i.mutliSelect,
250
+ ...t
251
+ });
247
252
  }
248
253
  width(t) {
249
- const s = {
250
- xs: "w-12",
251
- sm: "w-24",
252
- md: "w-36",
253
- lg: "w-48",
254
- xl: "w-64",
255
- full: "w-full"
256
- };
257
254
  return this.addOptions({
258
255
  styles: {
259
256
  ...this.options?.styles,
257
+ width: t,
260
258
  control: {
261
- wrapper: ` ${s[t] ?? s.sm}`
259
+ wrapper: `input-${t}`
262
260
  }
263
261
  }
264
262
  });
@@ -289,7 +287,7 @@ class u extends d {
289
287
  };
290
288
  }
291
289
  }
292
- class w extends m {
290
+ class g extends m {
293
291
  constructor(t) {
294
292
  super(t), this.label = t, this.rule = {
295
293
  effect: "SHOW",
@@ -297,7 +295,7 @@ class w extends m {
297
295
  };
298
296
  }
299
297
  static label(t) {
300
- return new w(t);
298
+ return new g(t);
301
299
  }
302
300
  build() {
303
301
  return {
@@ -323,7 +321,7 @@ class x extends m {
323
321
  };
324
322
  }
325
323
  }
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({
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({
327
325
  page: c().optional().default(1),
328
326
  pageSize: c().optional().default(20),
329
327
  // TODO add sorting and so
@@ -331,14 +329,14 @@ const c = () => n.coerce.number().int().positive().nonnegative(), z = () => n.st
331
329
  sortDir: q.optional().default("asc"),
332
330
  // Filter is of the format key:value:operator (e.g. name:john:eq) operator is optional
333
331
  filter: z().optional().default([])
334
- }), H = O.transform((e) => {
332
+ }), H = w.transform((e) => {
335
333
  const { page: t, pageSize: s, sort: r } = e;
336
334
  return {
337
335
  ...e,
338
336
  sort: r || "id",
339
337
  offset: (t - 1) * s
340
338
  };
341
- }), F = O.extend({
339
+ }), F = w.extend({
342
340
  count: c(),
343
341
  totalPages: c()
344
342
  }), N = n.object({
@@ -362,10 +360,10 @@ const c = () => n.coerce.number().int().positive().nonnegative(), z = () => n.st
362
360
  return e?.forEach((s) => {
363
361
  const { key: r, value: o, operator: l } = C(s);
364
362
  if (!r) return;
365
- const h = l || "contains", f = {
363
+ const d = l || "contains", f = {
366
364
  [l || "contains"]: o.toLowerCase()
367
365
  };
368
- h === "contains" && (f.mode = "insensitive");
366
+ d === "contains" && (f.mode = "insensitive");
369
367
  const b = L(r.split("."), f);
370
368
  t[b.key] = b.filterObj;
371
369
  }), t;
@@ -374,27 +372,27 @@ const c = () => n.coerce.number().int().positive().nonnegative(), z = () => n.st
374
372
  return e.forEach((s) => {
375
373
  const { key: r, value: o, operator: l } = C(s);
376
374
  if (!r) return;
377
- const h = r;
378
- t.push({ label: h, key: r, value: o, operator: l });
375
+ const d = r;
376
+ t.push({ label: d, key: r, value: o, operator: l });
379
377
  }), t;
380
378
  };
381
379
  export {
382
- w as CategoryBuilder,
380
+ g as CategoryBuilder,
383
381
  u as ControlBuilder,
384
382
  i as ControlType,
385
383
  x as GroupBuilder,
386
384
  a as LayoutBuilder,
387
- p as LayoutTypes,
385
+ h as LayoutTypes,
388
386
  K as Operator,
389
387
  c as PositiveRequestNumber,
390
- O as RequestSchema,
388
+ w as RequestSchema,
391
389
  H as RequestSchemaWithOffset,
392
390
  F as ResponseRequestSchema,
393
391
  N as ResponseSchema,
394
392
  E as Size,
395
393
  q as SortDirEnum,
396
394
  z as StringOrArray,
397
- g as TableBuilder,
395
+ O as TableBuilder,
398
396
  S as TextCellBuilder,
399
397
  V as buildFilter,
400
398
  T as buildSort,
@@ -9,23 +9,34 @@ export declare const ControlType: {
9
9
  readonly markdown: "markdown";
10
10
  readonly array: "array";
11
11
  readonly custom: "custom";
12
+ readonly select: "select";
13
+ readonly mutliSelect: "mutliSelect";
12
14
  };
13
15
  export interface TextAreaOptions extends ControlOption {
14
16
  format: 'textArea';
15
17
  }
18
+ export interface MarkdownOptions extends ControlOption {
19
+ format: 'markdown';
20
+ minHeight: string;
21
+ }
16
22
  export interface DetailOptions extends ControlOption {
17
23
  format: 'array';
18
24
  layout: 'row' | 'column';
19
25
  }
20
- export interface AutocompleteOptions extends ControlOption {
26
+ export interface SelectOptions extends ControlOption {
27
+ format: 'select' | 'multiselect';
28
+ options: Array<any>;
29
+ labelKey?: string;
30
+ valueKey?: string;
31
+ }
32
+ export interface AutocompleteOptions extends Omit<SelectOptions, 'format'> {
33
+ format: 'autocomplete';
34
+ }
35
+ export interface AutocompleteRemoteOptions extends Omit<SelectOptions, 'format' | 'options'> {
21
36
  format: 'autocomplete';
22
37
  uri: string;
23
38
  dataField?: string;
24
39
  skipAuth?: boolean;
25
- field: {
26
- id: string;
27
- label: string;
28
- };
29
40
  }
30
41
  export type ArrayActionType = 'edit';
31
42
  export type ArrayAction = {
@@ -39,7 +50,7 @@ export interface ControlOption {
39
50
  styles?: Partial<any>;
40
51
  elements?: any;
41
52
  elementLabelProp?: string;
42
- labelKey?: string;
53
+ customLabel?: string;
43
54
  actions?: ArrayAction[];
44
55
  placeholder?: string;
45
56
  hideLabel?: boolean;
@@ -66,9 +77,11 @@ export declare class ControlBuilder<TYPE, KEY = keyof TYPE> extends Builder<Cont
66
77
  }): this;
67
78
  labelKey(labelKey: string): this;
68
79
  readonly(): ControlBuilder<TYPE>;
69
- markdown(): ControlBuilder<TYPE>;
80
+ markdown(options?: Omit<MarkdownOptions, 'format'>): ControlBuilder<TYPE>;
70
81
  textArea(options?: Omit<TextAreaOptions, 'format'>): this;
71
- autocomplete(options: Omit<AutocompleteOptions, 'format'>): this;
82
+ autocomplete(options: Omit<AutocompleteOptions | AutocompleteRemoteOptions, 'format'>): this;
83
+ select(options: Omit<SelectOptions, 'format'>): this;
84
+ mutliSelect(options: Omit<SelectOptions, 'format'>): this;
72
85
  width(width: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'): this;
73
86
  customLabel(label: string): this;
74
87
  placeHolder(placeholder: string): this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghentcdh/json-forms-core",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",