@ghentcdh/json-forms-vue 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.js CHANGED
@@ -5,6 +5,7 @@ const ui = require("@ghentcdh/ui");
5
5
  const core = require("@jsonforms/core");
6
6
  const vue = require("vue");
7
7
  const vue$1 = require("@jsonforms/vue");
8
+ const axios = require("axios");
8
9
  const vueVanilla = require("@jsonforms/vue-vanilla");
9
10
  const lodashEs = require("lodash-es");
10
11
  const testers = require("@jsonforms/core/src/testers/testers");
@@ -52,12 +53,14 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
52
53
  return {
53
54
  ...vanillaControl.controlWrapper.value,
54
55
  ...lodashEs.omit(vanillaControl.appliedOptions.value, "styles"),
56
+ ...lodashEs.pick(vanillaControl.appliedOptions.value.styles, ["width"]),
55
57
  isFocused: isFocused.value,
56
58
  isTouched: isTouched.value
57
59
  };
58
60
  });
59
61
  return {
60
62
  ...vanillaControl,
63
+ appliedOptions: vanillaControl.appliedOptions,
61
64
  controlWrapper,
62
65
  isFocused,
63
66
  isTouched,
@@ -66,7 +69,49 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
66
69
  // handleChange,
67
70
  };
68
71
  };
69
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
72
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
73
+ __name: "AutocompleteControlRenderer",
74
+ props: { ...vue$1.rendererProps() },
75
+ setup(__props) {
76
+ const props = __props;
77
+ const {
78
+ control,
79
+ handleChange: _handleChange,
80
+ appliedOptions,
81
+ onFocus,
82
+ onBlur,
83
+ controlWrapper
84
+ } = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
85
+ const bindProperties = vue.computed(() => ({
86
+ ...controlWrapper.value,
87
+ ...appliedOptions.value
88
+ }));
89
+ const fetchOptions = vue.computed(() => {
90
+ const options = appliedOptions.value;
91
+ if (!options.uri) return null;
92
+ return () => {
93
+ const fetch = options.skipAuth ? axios : toolsVue.useApi();
94
+ return fetch.get(options.uri).then((data) => data.data[options.dataField ?? "data"]);
95
+ };
96
+ });
97
+ const handleChange = (result) => {
98
+ const { path } = control.value;
99
+ _handleChange(path, result);
100
+ };
101
+ return (_ctx, _cache) => {
102
+ return vue.openBlock(), vue.createBlock(vue.unref(ui.Autocomplete), vue.mergeProps(bindProperties.value, {
103
+ modelValue: vue.unref(control).data,
104
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
105
+ enabled: vue.unref(control).enabled,
106
+ "fetch-options": fetchOptions.value,
107
+ onChange: handleChange,
108
+ onFocus: vue.unref(onFocus),
109
+ onBlur: vue.unref(onBlur)
110
+ }), null, 16, ["modelValue", "enabled", "fetch-options", "onFocus", "onBlur"]);
111
+ };
112
+ }
113
+ });
114
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
70
115
  __name: "BooleanControlRenderer",
71
116
  props: { ...vue$1.rendererProps() },
72
117
  setup(__props) {
@@ -87,7 +132,7 @@ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
87
132
  };
88
133
  }
89
134
  });
90
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
135
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
91
136
  __name: "IntegerControlRenderer",
92
137
  props: { ...vue$1.rendererProps() },
93
138
  setup(__props) {
@@ -111,7 +156,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
111
156
  };
112
157
  }
113
158
  });
114
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
159
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
115
160
  __name: "MarkdownControlRenderer",
116
161
  props: { ...vue$1.rendererProps() },
117
162
  setup(__props) {
@@ -140,6 +185,34 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
140
185
  };
141
186
  }
142
187
  });
188
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
189
+ __name: "MultiSelectControlRender",
190
+ props: { ...vue$1.rendererProps() },
191
+ setup(__props) {
192
+ const props = __props;
193
+ const {
194
+ control,
195
+ handleChange: _handleChange,
196
+ onFocus,
197
+ onBlur,
198
+ controlWrapper
199
+ } = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
200
+ const handleChange = (result) => {
201
+ const { path } = control.value;
202
+ _handleChange(path, result);
203
+ };
204
+ return (_ctx, _cache) => {
205
+ return vue.openBlock(), vue.createBlock(vue.unref(ui.MultiSelect), vue.mergeProps(vue.unref(controlWrapper), {
206
+ modelValue: vue.unref(control).data,
207
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
208
+ enabled: vue.unref(control).enabled,
209
+ onChange: handleChange,
210
+ onFocus: vue.unref(onFocus),
211
+ onBlur: vue.unref(onBlur)
212
+ }), null, 16, ["modelValue", "enabled", "onFocus", "onBlur"]);
213
+ };
214
+ }
215
+ });
143
216
  const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
144
217
  __name: "NumberControlRenderer",
145
218
  props: { ...vue$1.rendererProps() },
@@ -165,6 +238,36 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
165
238
  }
166
239
  });
167
240
  const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
241
+ __name: "SelectControlRender",
242
+ props: { ...vue$1.rendererProps() },
243
+ setup(__props) {
244
+ const props = __props;
245
+ const {
246
+ control,
247
+ handleChange: _handleChange,
248
+ appliedOptions,
249
+ onFocus,
250
+ onBlur,
251
+ controlWrapper
252
+ } = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
253
+ const handleChange = (result) => {
254
+ const { path } = control.value;
255
+ _handleChange(path, result);
256
+ };
257
+ return (_ctx, _cache) => {
258
+ return vue.openBlock(), vue.createBlock(vue.unref(ui.SelectComponent), vue.mergeProps(vue.unref(controlWrapper), {
259
+ modelValue: vue.unref(control).data,
260
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
261
+ enabled: vue.unref(control).enabled,
262
+ options: vue.unref(appliedOptions)?.options,
263
+ onChange: handleChange,
264
+ onFocus: vue.unref(onFocus),
265
+ onBlur: vue.unref(onBlur)
266
+ }), null, 16, ["modelValue", "enabled", "options", "onFocus", "onBlur"]);
267
+ };
268
+ }
269
+ });
270
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
168
271
  __name: "StringControlRenderer",
169
272
  props: { ...vue$1.rendererProps() },
170
273
  setup(__props) {
@@ -192,7 +295,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
192
295
  };
193
296
  }
194
297
  });
195
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
298
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
196
299
  __name: "TextAreaControlRenderer",
197
300
  props: { ...vue$1.rendererProps() },
198
301
  setup(__props) {
@@ -237,61 +340,41 @@ const isCustomControl = (customType) => {
237
340
  testers.optionIs("type", customType)
238
341
  );
239
342
  };
240
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
241
- __name: "AutocompleteControlRenderer",
242
- props: { ...vue$1.rendererProps() },
243
- setup(__props) {
244
- const props = __props;
245
- const {
246
- control,
247
- handleChange: _handleChange,
248
- appliedOptions,
249
- onFocus,
250
- onBlur,
251
- controlWrapper
252
- } = useVanillaControlCustom(vue$1.useJsonFormsControl(props));
253
- const field = vue.computed(() => appliedOptions.value.field);
254
- const handleChange = (result) => {
255
- const { path } = control.value;
256
- _handleChange(path, result);
257
- };
258
- return (_ctx, _cache) => {
259
- return vue.openBlock(), vue.createBlock(vue.unref(ui.Autocomplete), vue.mergeProps(vue.unref(controlWrapper), {
260
- modelValue: vue.unref(control).data,
261
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(control).data = $event),
262
- enabled: vue.unref(control).enabled,
263
- config: vue.unref(appliedOptions),
264
- "label-key": field.value?.label,
265
- "value-key": field.value?.id,
266
- onChange: handleChange,
267
- onFocus: vue.unref(onFocus),
268
- onBlur: vue.unref(onBlur)
269
- }), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onFocus", "onBlur"]);
270
- };
271
- }
272
- });
343
+ const isMultiselectControl = testers.and(
344
+ core.uiTypeIs("Control"),
345
+ testers.optionIs("format", jsonFormsCore.ControlType.mutliSelect)
346
+ );
347
+ const isSelectControl = testers.and(
348
+ core.uiTypeIs("Control"),
349
+ testers.optionIs("format", jsonFormsCore.ControlType.select)
350
+ );
273
351
  const controlRenderers = [
274
352
  // First custom renderers on format
275
353
  {
276
354
  tester: core.rankWith(10, isMarkdownControl),
277
- renderer: _sfc_main$e
355
+ renderer: _sfc_main$f
278
356
  },
279
357
  {
280
358
  tester: core.rankWith(10, isAutoCompleteControl),
281
- renderer: _sfc_main$a
359
+ renderer: _sfc_main$i
282
360
  },
283
361
  {
284
362
  tester: core.rankWith(10, isTextAreaControl),
285
- renderer: _sfc_main$b
363
+ renderer: _sfc_main$a
286
364
  },
287
365
  // Renderers based on type if no format is provided
288
- { tester: core.rankWith(10, isStringFormat), renderer: _sfc_main$c },
366
+ { tester: core.rankWith(10, isStringFormat), renderer: _sfc_main$b },
367
+ { tester: core.rankWith(10, isSelectControl), renderer: _sfc_main$c },
368
+ {
369
+ tester: core.rankWith(10, isMultiselectControl),
370
+ renderer: _sfc_main$e
371
+ },
289
372
  { tester: core.rankWith(10, core.isNumberControl), renderer: _sfc_main$d },
290
373
  {
291
374
  tester: core.rankWith(10, core.isIntegerControl),
292
- renderer: _sfc_main$f
375
+ renderer: _sfc_main$g
293
376
  },
294
- { tester: core.rankWith(10, core.isBooleanControl), renderer: _sfc_main$g }
377
+ { tester: core.rankWith(10, core.isBooleanControl), renderer: _sfc_main$h }
295
378
  ];
296
379
  const actionMap = {
297
380
  edit: (router, action) => ({
@@ -1048,7 +1131,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
1048
1131
  return vue.openBlock(), vue.createBlock(vue.unref(ui.Collapse), { title: title.value }, {
1049
1132
  default: vue.withCtx(() => [
1050
1133
  vue.createVNode(_sfc_main$2, {
1051
- id: `form_${properties.id}`,
1134
+ id: `form_${__props.id}`,
1052
1135
  modelValue: formData.value,
1053
1136
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
1054
1137
  schema: __props.formSchema.form.schema,
@@ -1256,17 +1339,19 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
1256
1339
  return { create, patch, createMulti, delete: _delete, get };
1257
1340
  };
1258
1341
  exports.ArrayRenderer = _sfc_main$9;
1259
- exports.AutocompleteControlRenderer = _sfc_main$a;
1260
- exports.BooleanControlRenderer = _sfc_main$g;
1342
+ exports.AutocompleteControlRenderer = _sfc_main$i;
1343
+ exports.BooleanControlRenderer = _sfc_main$h;
1261
1344
  exports.FormComponent = _sfc_main$2;
1262
1345
  exports.FormModal = _sfc_main;
1263
1346
  exports.FormModalService = FormModalService;
1264
1347
  exports.FormStore = FormStore;
1265
1348
  exports.FormWithActions = _sfc_main$1;
1266
1349
  exports.FormWithTableComponent = _sfc_main$3;
1267
- exports.IntegerControlRenderer = _sfc_main$f;
1350
+ exports.IntegerControlRenderer = _sfc_main$g;
1351
+ exports.MultiSelectControlRender = _sfc_main$e;
1268
1352
  exports.NumberControlRenderer = _sfc_main$d;
1269
- exports.StringControlRenderer = _sfc_main$c;
1353
+ exports.SelectControlRender = _sfc_main$c;
1354
+ exports.StringControlRenderer = _sfc_main$b;
1270
1355
  exports.TableComponent = _sfc_main$4;
1271
1356
  exports.arrayRenderers = arrayRenderers;
1272
1357
  exports.controlRenderers = controlRenderers;
@@ -1275,8 +1360,10 @@ exports.isArrayRenderer = isArrayRenderer;
1275
1360
  exports.isAutoCompleteControl = isAutoCompleteControl;
1276
1361
  exports.isCustomControl = isCustomControl;
1277
1362
  exports.isMarkdownControl = isMarkdownControl;
1363
+ exports.isMultiselectControl = isMultiselectControl;
1364
+ exports.isSelectControl = isSelectControl;
1278
1365
  exports.isStringFormat = isStringFormat;
1279
1366
  exports.isTextAreaControl = isTextAreaControl;
1280
1367
  exports.layoutRenderers = layoutRenderers;
1281
- exports.markdownControlRenderer = _sfc_main$e;
1368
+ exports.markdownControlRenderer = _sfc_main$f;
1282
1369
  exports.useFormState = useFormState;
package/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  import { useApi, Debugger } from "@ghentcdh/tools-vue";
2
- import { NotificationService, Checkbox, InputNumber, Markdown, Input, Textarea, Autocomplete, IconEnum, Btn, Collapse, BtnBadge, TextCell, Table, hasCustomEventListener, Card, ModalService, myStyles, Alert, Color, Modal } from "@ghentcdh/ui";
2
+ import { NotificationService, Autocomplete, Checkbox, InputNumber, Markdown, MultiSelect, SelectComponent, Input, Textarea, IconEnum, Btn, Collapse, BtnBadge, TextCell, Table, hasCustomEventListener, Card, ModalService, myStyles, Alert, Color, Modal } from "@ghentcdh/ui";
3
3
  import { uiTypeIs, rankWith, isNumberControl, isIntegerControl, isBooleanControl, createDefaultValue, composePaths } from "@jsonforms/core";
4
4
  import { ref, computed, defineComponent, openBlock, createBlock, unref, mergeProps, createElementBlock, createElementVNode, normalizeClass, Fragment, renderList, createVNode, createCommentVNode, withCtx, createTextVNode, watch, toDisplayString, useModel, provide, mergeModels, renderSlot } from "vue";
5
5
  import { useJsonFormsControl, rendererProps, useJsonFormsArrayControl, DispatchRenderer, useJsonFormsLayout, JsonForms } from "@jsonforms/vue";
6
+ import axios from "axios";
6
7
  import { useVanillaControl, useVanillaArrayControl, vanillaRenderers } from "@jsonforms/vue-vanilla";
7
- import { omit, isArray } from "lodash-es";
8
+ import { pick, omit, isArray } from "lodash-es";
8
9
  import { and, optionIs, or, schemaTypeIs } from "@jsonforms/core/src/testers/testers";
9
10
  import { ControlType, LayoutTypes, RequestSchema, extractFilters, findColumnDef } from "@ghentcdh/json-forms-core";
10
11
  import { useRouter, useRoute } from "vue-router";
@@ -50,12 +51,14 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
50
51
  return {
51
52
  ...vanillaControl.controlWrapper.value,
52
53
  ...omit(vanillaControl.appliedOptions.value, "styles"),
54
+ ...pick(vanillaControl.appliedOptions.value.styles, ["width"]),
53
55
  isFocused: isFocused.value,
54
56
  isTouched: isTouched.value
55
57
  };
56
58
  });
57
59
  return {
58
60
  ...vanillaControl,
61
+ appliedOptions: vanillaControl.appliedOptions,
59
62
  controlWrapper,
60
63
  isFocused,
61
64
  isTouched,
@@ -64,7 +67,49 @@ const useVanillaControlCustom = (input, adaptTarget = (v) => v.value) => {
64
67
  // handleChange,
65
68
  };
66
69
  };
67
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
70
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
71
+ __name: "AutocompleteControlRenderer",
72
+ props: { ...rendererProps() },
73
+ setup(__props) {
74
+ const props = __props;
75
+ const {
76
+ control,
77
+ handleChange: _handleChange,
78
+ appliedOptions,
79
+ onFocus,
80
+ onBlur,
81
+ controlWrapper
82
+ } = useVanillaControlCustom(useJsonFormsControl(props));
83
+ const bindProperties = computed(() => ({
84
+ ...controlWrapper.value,
85
+ ...appliedOptions.value
86
+ }));
87
+ const fetchOptions = computed(() => {
88
+ const options = appliedOptions.value;
89
+ if (!options.uri) return null;
90
+ return () => {
91
+ const fetch = options.skipAuth ? axios : useApi();
92
+ return fetch.get(options.uri).then((data) => data.data[options.dataField ?? "data"]);
93
+ };
94
+ });
95
+ const handleChange = (result) => {
96
+ const { path } = control.value;
97
+ _handleChange(path, result);
98
+ };
99
+ return (_ctx, _cache) => {
100
+ return openBlock(), createBlock(unref(Autocomplete), mergeProps(bindProperties.value, {
101
+ modelValue: unref(control).data,
102
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
103
+ enabled: unref(control).enabled,
104
+ "fetch-options": fetchOptions.value,
105
+ onChange: handleChange,
106
+ onFocus: unref(onFocus),
107
+ onBlur: unref(onBlur)
108
+ }), null, 16, ["modelValue", "enabled", "fetch-options", "onFocus", "onBlur"]);
109
+ };
110
+ }
111
+ });
112
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
68
113
  __name: "BooleanControlRenderer",
69
114
  props: { ...rendererProps() },
70
115
  setup(__props) {
@@ -85,7 +130,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
85
130
  };
86
131
  }
87
132
  });
88
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
133
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
89
134
  __name: "IntegerControlRenderer",
90
135
  props: { ...rendererProps() },
91
136
  setup(__props) {
@@ -109,7 +154,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
109
154
  };
110
155
  }
111
156
  });
112
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
157
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
113
158
  __name: "MarkdownControlRenderer",
114
159
  props: { ...rendererProps() },
115
160
  setup(__props) {
@@ -138,6 +183,34 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
138
183
  };
139
184
  }
140
185
  });
186
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
187
+ __name: "MultiSelectControlRender",
188
+ props: { ...rendererProps() },
189
+ setup(__props) {
190
+ const props = __props;
191
+ const {
192
+ control,
193
+ handleChange: _handleChange,
194
+ onFocus,
195
+ onBlur,
196
+ controlWrapper
197
+ } = useVanillaControlCustom(useJsonFormsControl(props));
198
+ const handleChange = (result) => {
199
+ const { path } = control.value;
200
+ _handleChange(path, result);
201
+ };
202
+ return (_ctx, _cache) => {
203
+ return openBlock(), createBlock(unref(MultiSelect), mergeProps(unref(controlWrapper), {
204
+ modelValue: unref(control).data,
205
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
206
+ enabled: unref(control).enabled,
207
+ onChange: handleChange,
208
+ onFocus: unref(onFocus),
209
+ onBlur: unref(onBlur)
210
+ }), null, 16, ["modelValue", "enabled", "onFocus", "onBlur"]);
211
+ };
212
+ }
213
+ });
141
214
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
142
215
  __name: "NumberControlRenderer",
143
216
  props: { ...rendererProps() },
@@ -163,6 +236,36 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
163
236
  }
164
237
  });
165
238
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
239
+ __name: "SelectControlRender",
240
+ props: { ...rendererProps() },
241
+ setup(__props) {
242
+ const props = __props;
243
+ const {
244
+ control,
245
+ handleChange: _handleChange,
246
+ appliedOptions,
247
+ onFocus,
248
+ onBlur,
249
+ controlWrapper
250
+ } = useVanillaControlCustom(useJsonFormsControl(props));
251
+ const handleChange = (result) => {
252
+ const { path } = control.value;
253
+ _handleChange(path, result);
254
+ };
255
+ return (_ctx, _cache) => {
256
+ return openBlock(), createBlock(unref(SelectComponent), mergeProps(unref(controlWrapper), {
257
+ modelValue: unref(control).data,
258
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
259
+ enabled: unref(control).enabled,
260
+ options: unref(appliedOptions)?.options,
261
+ onChange: handleChange,
262
+ onFocus: unref(onFocus),
263
+ onBlur: unref(onBlur)
264
+ }), null, 16, ["modelValue", "enabled", "options", "onFocus", "onBlur"]);
265
+ };
266
+ }
267
+ });
268
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
166
269
  __name: "StringControlRenderer",
167
270
  props: { ...rendererProps() },
168
271
  setup(__props) {
@@ -190,7 +293,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
190
293
  };
191
294
  }
192
295
  });
193
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
296
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
194
297
  __name: "TextAreaControlRenderer",
195
298
  props: { ...rendererProps() },
196
299
  setup(__props) {
@@ -235,61 +338,41 @@ const isCustomControl = (customType) => {
235
338
  optionIs("type", customType)
236
339
  );
237
340
  };
238
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
239
- __name: "AutocompleteControlRenderer",
240
- props: { ...rendererProps() },
241
- setup(__props) {
242
- const props = __props;
243
- const {
244
- control,
245
- handleChange: _handleChange,
246
- appliedOptions,
247
- onFocus,
248
- onBlur,
249
- controlWrapper
250
- } = useVanillaControlCustom(useJsonFormsControl(props));
251
- const field = computed(() => appliedOptions.value.field);
252
- const handleChange = (result) => {
253
- const { path } = control.value;
254
- _handleChange(path, result);
255
- };
256
- return (_ctx, _cache) => {
257
- return openBlock(), createBlock(unref(Autocomplete), mergeProps(unref(controlWrapper), {
258
- modelValue: unref(control).data,
259
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(control).data = $event),
260
- enabled: unref(control).enabled,
261
- config: unref(appliedOptions),
262
- "label-key": field.value?.label,
263
- "value-key": field.value?.id,
264
- onChange: handleChange,
265
- onFocus: unref(onFocus),
266
- onBlur: unref(onBlur)
267
- }), null, 16, ["modelValue", "enabled", "config", "label-key", "value-key", "onFocus", "onBlur"]);
268
- };
269
- }
270
- });
341
+ const isMultiselectControl = and(
342
+ uiTypeIs("Control"),
343
+ optionIs("format", ControlType.mutliSelect)
344
+ );
345
+ const isSelectControl = and(
346
+ uiTypeIs("Control"),
347
+ optionIs("format", ControlType.select)
348
+ );
271
349
  const controlRenderers = [
272
350
  // First custom renderers on format
273
351
  {
274
352
  tester: rankWith(10, isMarkdownControl),
275
- renderer: _sfc_main$e
353
+ renderer: _sfc_main$f
276
354
  },
277
355
  {
278
356
  tester: rankWith(10, isAutoCompleteControl),
279
- renderer: _sfc_main$a
357
+ renderer: _sfc_main$i
280
358
  },
281
359
  {
282
360
  tester: rankWith(10, isTextAreaControl),
283
- renderer: _sfc_main$b
361
+ renderer: _sfc_main$a
284
362
  },
285
363
  // Renderers based on type if no format is provided
286
- { tester: rankWith(10, isStringFormat), renderer: _sfc_main$c },
364
+ { tester: rankWith(10, isStringFormat), renderer: _sfc_main$b },
365
+ { tester: rankWith(10, isSelectControl), renderer: _sfc_main$c },
366
+ {
367
+ tester: rankWith(10, isMultiselectControl),
368
+ renderer: _sfc_main$e
369
+ },
287
370
  { tester: rankWith(10, isNumberControl), renderer: _sfc_main$d },
288
371
  {
289
372
  tester: rankWith(10, isIntegerControl),
290
- renderer: _sfc_main$f
373
+ renderer: _sfc_main$g
291
374
  },
292
- { tester: rankWith(10, isBooleanControl), renderer: _sfc_main$g }
375
+ { tester: rankWith(10, isBooleanControl), renderer: _sfc_main$h }
293
376
  ];
294
377
  const actionMap = {
295
378
  edit: (router, action) => ({
@@ -1046,7 +1129,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1046
1129
  return openBlock(), createBlock(unref(Collapse), { title: title.value }, {
1047
1130
  default: withCtx(() => [
1048
1131
  createVNode(_sfc_main$2, {
1049
- id: `form_${properties.id}`,
1132
+ id: `form_${__props.id}`,
1050
1133
  modelValue: formData.value,
1051
1134
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value = $event),
1052
1135
  schema: __props.formSchema.form.schema,
@@ -1255,17 +1338,19 @@ const createRepository = (formSchemaModel, httpRequest, options = {}) => {
1255
1338
  };
1256
1339
  export {
1257
1340
  _sfc_main$9 as ArrayRenderer,
1258
- _sfc_main$a as AutocompleteControlRenderer,
1259
- _sfc_main$g as BooleanControlRenderer,
1341
+ _sfc_main$i as AutocompleteControlRenderer,
1342
+ _sfc_main$h as BooleanControlRenderer,
1260
1343
  _sfc_main$2 as FormComponent,
1261
1344
  _sfc_main as FormModal,
1262
1345
  FormModalService,
1263
1346
  FormStore,
1264
1347
  _sfc_main$1 as FormWithActions,
1265
1348
  _sfc_main$3 as FormWithTableComponent,
1266
- _sfc_main$f as IntegerControlRenderer,
1349
+ _sfc_main$g as IntegerControlRenderer,
1350
+ _sfc_main$e as MultiSelectControlRender,
1267
1351
  _sfc_main$d as NumberControlRenderer,
1268
- _sfc_main$c as StringControlRenderer,
1352
+ _sfc_main$c as SelectControlRender,
1353
+ _sfc_main$b as StringControlRenderer,
1269
1354
  _sfc_main$4 as TableComponent,
1270
1355
  arrayRenderers,
1271
1356
  controlRenderers,
@@ -1274,9 +1359,11 @@ export {
1274
1359
  isAutoCompleteControl,
1275
1360
  isCustomControl,
1276
1361
  isMarkdownControl,
1362
+ isMultiselectControl,
1363
+ isSelectControl,
1277
1364
  isStringFormat,
1278
1365
  isTextAreaControl,
1279
1366
  layoutRenderers,
1280
- _sfc_main$e as markdownControlRenderer,
1367
+ _sfc_main$f as markdownControlRenderer,
1281
1368
  useFormState
1282
1369
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghentcdh/json-forms-vue",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "types": "./index.d.ts",
@@ -67,8 +67,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
67
67
  };
68
68
  }>> & Readonly<{}>, {
69
69
  enabled: boolean;
70
- config: Record<string, any>;
71
70
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
72
71
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
72
+ config: Record<string, any>;
73
73
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
74
74
  export default _default;
@@ -69,8 +69,8 @@ export declare const arrayRenderers: readonly [{
69
69
  };
70
70
  }>> & Readonly<{}>, {
71
71
  enabled: boolean;
72
- config: Record<string, any>;
73
72
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
74
73
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
74
+ config: Record<string, any>;
75
75
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
76
76
  }];
@@ -67,8 +67,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
67
67
  };
68
68
  }>> & Readonly<{}>, {
69
69
  enabled: boolean;
70
- config: Record<string, any>;
71
70
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
72
71
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
73
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLFieldSetElement>;
72
+ config: Record<string, any>;
73
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
74
74
  export default _default;
@@ -67,8 +67,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
67
67
  };
68
68
  }>> & Readonly<{}>, {
69
69
  enabled: boolean;
70
- config: Record<string, any>;
71
70
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
72
71
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
72
+ config: Record<string, any>;
73
73
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
74
74
  export default _default;
@@ -67,8 +67,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
67
67
  };
68
68
  }>> & Readonly<{}>, {
69
69
  enabled: boolean;
70
- config: Record<string, any>;
71
70
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
72
71
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
72
+ config: Record<string, any>;
73
73
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLFieldSetElement>;
74
74
  export default _default;
@@ -67,8 +67,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
67
67
  };
68
68
  }>> & Readonly<{}>, {
69
69
  enabled: boolean;
70
- config: Record<string, any>;
71
70
  renderers: import('@jsonforms/core').JsonFormsRendererRegistryEntry[];
72
71
  cells: import('@jsonforms/core').JsonFormsCellRendererRegistryEntry[];
72
+ config: Record<string, any>;
73
73
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLFieldSetElement>;
74
74
  export default _default;