@knime/jsonforms 1.21.1 → 1.21.3

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +6 -0
  3. package/dist/{AnyOfTwinlist-UXM-U6hT.js → AnyOfTwinlist-By12blUM.js} +1 -1
  4. package/dist/{CheckboxControl-QBXVq5Tw.js → CheckboxControl--qMC4yqR.js} +1 -1
  5. package/dist/{CheckboxesControl-2pd974_e.js → CheckboxesControl-BsOG-QR8.js} +2 -2
  6. package/dist/{ColorControl-CDxRfPzc.js → ColorControl-BX93RNbV.js} +1 -1
  7. package/dist/{ColorPreviewControl-Cg99cain.js → ColorPreviewControl-CFVeFXBp.js} +5 -5
  8. package/dist/ComboBoxControl-M5HOJcy2.js +37 -0
  9. package/dist/{DateControl-DqNL8rlX.js → DateControl-PYVPxPvC.js} +1 -1
  10. package/dist/{DateTimeControl-apf8S1y2.js → DateTimeControl-_8d8iizh.js} +1 -1
  11. package/dist/{DateTimeFormatPickerControl-_4b5Jk3w.js → DateTimeFormatPickerControl-xRNNTLIl.js} +1 -1
  12. package/dist/{DateTimeFormatPickerWithTypeControl-B1jOpszt.js → DateTimeFormatPickerWithTypeControl-CZZBe3PC.js} +11 -11
  13. package/dist/{DropdownControl-CesCAa-A.js → DropdownControl-sGxFWX33.js} +2 -2
  14. package/dist/{ExecutorCoresControl-ILXk2Hk6.js → ExecutorCoresControl-6DB4hS8_.js} +2 -2
  15. package/dist/{ExecutorMemoryControl-De46Fxsm.js → ExecutorMemoryControl-xKHl7IXW.js} +2 -2
  16. package/dist/FileUploadControl-Bjgh9vSl.js +210 -0
  17. package/dist/{GridSelectionControl-CGspDoCC.js → GridSelectionControl-DslOwaNV.js} +17 -17
  18. package/dist/{HorizontalLayout-DPuI5hYY.js → HorizontalLayout-Dl9cC50s.js} +1 -1
  19. package/dist/{IntegerControl-BwGzlwkz.js → IntegerControl-DSzPJs4Z.js} +1 -1
  20. package/dist/{IntervalControl-BHeKHuWm.js → IntervalControl-DoWDLPMP.js} +12 -12
  21. package/dist/{LinkControl-D_0AKRJz.js → LinkControl-BuYI03b_.js} +3 -3
  22. package/dist/{LoadingDropdown.vue_vue_type_script_setup_true_lang-BHersnKa.js → LoadingDropdown.vue_vue_type_script_setup_true_lang-DZ90-rk8.js} +5 -5
  23. package/dist/{ManualTwinlistControl-BMSgSIBJ.js → ManualTwinlistControl-mN3zJTMK.js} +3 -3
  24. package/dist/{MultiselectListBox-DpL-Z03B.js → MultiSelectListBoxControl-CnSublPM.js} +103 -78
  25. package/dist/{MultimodeTwinlistControl-DOJD7vUU.js → MultimodeTwinlistControl-CyZQ54SO.js} +1 -1
  26. package/dist/{MultimodeTwinlistControl.vue_vue_type_script_setup_true_lang-BzIvunuA.js → MultimodeTwinlistControl.vue_vue_type_script_setup_true_lang-C9JUTbz1.js} +3 -3
  27. package/dist/{NameFilter-B1LEenoh.js → NameFilter-C1u8qsYQ.js} +1 -1
  28. package/dist/{NumberControl-DVzhX3S9.js → NumberControl-qiTgXs6x.js} +1 -1
  29. package/dist/{NumberControlBase.vue_vue_type_script_setup_true_lang-Bb4FK9RQ.js → NumberControlBase.vue_vue_type_script_setup_true_lang-Bs-H6e08.js} +2 -2
  30. package/dist/{OneOfDropdown-BFOyIhv6.js → OneOfDropdown-Dn6QM81-.js} +4 -4
  31. package/dist/{RadioButtonsWithDescriptionControl-oD8Zab-J.js → RadioButtonsWithDescriptionControl-1X9F9obn.js} +1 -1
  32. package/dist/{RadioControl-D6Wm5j7g.js → RadioControl-BdHtNPFC.js} +2 -2
  33. package/dist/{RadioControlBase.vue_vue_type_script_setup_true_lang-CsEFu5wd.js → RadioControlBase.vue_vue_type_script_setup_true_lang-Cp22r9KZ.js} +2 -2
  34. package/dist/{ResourceControlBase-DRlen7vy.js → ResourceControlBase-CDpi3J6s.js} +2 -2
  35. package/dist/{RichTextControl-DPX_lxfc.js → RichTextControl-5o904Fvx.js} +2185 -2187
  36. package/dist/{SectionHeading-DIs2yBVY.js → SectionHeading-CrGc61FB.js} +1 -1
  37. package/dist/{SectionLayout-6ID4pFDm.js → SectionLayout-B9X7fzQ9.js} +3 -3
  38. package/dist/SettingsSubPanel-WzFrc-mQ.js +5 -0
  39. package/dist/{SettingsSubPanelLayout-bSgzF47m.js → SettingsSubPanelLayout-D8j0-HKD.js} +7 -7
  40. package/dist/{SimpleButtonControl-CpO-Xbws.js → SimpleButtonControl-BS6opqJW.js} +8 -8
  41. package/dist/{SimpleButtonControl.vue_vue_type_style_index_0_scoped_17a4a240_lang-Ssy7Zaqp.js → SimpleButtonControl.vue_vue_type_style_index_0_scoped_17a4a240_lang-BuKsDBUW.js} +11510 -11132
  42. package/dist/{SimpleTwinlistControl-BMKo3T2E.js → SimpleTwinlistControl-RlnzOp0j.js} +2 -2
  43. package/dist/{SingleSelectControl-IDX5QUdR.js → SingleSelectControl-DPPwJUq3.js} +2 -2
  44. package/dist/{SingleSelectListBoxControl-CYGArF9u.js → SingleSelectListBoxControl-EMc8u2ik.js} +3 -3
  45. package/dist/SortListControl-Bw3K37ru.js +103 -0
  46. package/dist/{StyledListItem-DA8cbCw1.js → StyledListItem-Bli2itH-.js} +1 -1
  47. package/dist/{TeamAndSpacesControl-BThkHK2b.js → TeamAndSpacesControl-BlvUuAAA.js} +1 -1
  48. package/dist/{TeamResourceControl-CQgq2Bq5.js → TeamResourceControl-DuLmQ7gc.js} +2 -2
  49. package/dist/{TextAreaControl-ykGD_BnL.js → TextAreaControl-DtfB44mR.js} +1 -1
  50. package/dist/{TextControl-QTuQZi2l.js → TextControl-BlUQLMGo.js} +1 -1
  51. package/dist/{TextControl.vue_vue_type_script_setup_true_lang-C1Cs6NXf.js → TextControl.vue_vue_type_script_setup_true_lang-CBke-957.js} +2 -2
  52. package/dist/{TimeControl-W0VRENnH.js → TimeControl-DWzlpLX-.js} +1 -1
  53. package/dist/{TimePartInput-BHzqB1_B.js → TimePartInput-CRP2YYM0.js} +1 -1
  54. package/dist/{TimeframesControl-C12gkBRu.js → TimeframesControl-O_hzJcX5.js} +2 -2
  55. package/dist/{Tooltip-B0QEjsdY.js → Tooltip-C9vAa0Wb.js} +1 -1
  56. package/dist/{TwinlistControlBase.vue_vue_type_script_setup_true_lang-BlaFr27R.js → TwinlistControlBase.vue_vue_type_script_setup_true_lang-DtphbKhB.js} +2 -2
  57. package/dist/{TypedStringFilter-B-LUMedK.js → TypedStringFilter-ByeMPxR6.js} +1 -1
  58. package/dist/{ValueSwitch-BBO_VXIM.js → ValueSwitch-BV9qUd5x.js} +6 -6
  59. package/dist/{ValueSwitchControl-Jz7xZfY-.js → ValueSwitchControl-nW7WtSSM.js} +1 -1
  60. package/dist/{VerticalLayout-CGtB4d8F.js → VerticalLayout-C7_-yu_D.js} +2 -2
  61. package/dist/{VerticalLayoutBase-JY9q-FO2.js → VerticalLayoutBase-eODyPAoq.js} +1 -1
  62. package/dist/{ZonedDateTimeControl-BatkUEiY.js → ZonedDateTimeControl-DlrvZKe4.js} +2 -2
  63. package/dist/{_Uint8Array-Bbzs2Ov4.js → _Uint8Array-BESS0YjU.js} +14 -14
  64. package/dist/{_baseIteratee-pNDg46VS.js → _baseIteratee-BLvJX4uT.js} +9 -9
  65. package/dist/floating-ui.vue-Fx4CxKut.js +1057 -0
  66. package/dist/knime-jsonforms.css +1 -1
  67. package/dist/knime-jsonforms.js +113 -102
  68. package/dist/{localTimeUtils-B5XTvulp.js → localTimeUtils-Bl9xa5Jk.js} +1292 -1268
  69. package/dist/{popper-D54JdmBM.js → popper-iehk3xNV.js} +224 -210
  70. package/dist/src/renderers/defaultRenderers.d.ts +1 -930
  71. package/dist/src/renderers/sortListRenderer.d.ts +1 -930
  72. package/dist/src/uiComponents/ComboBoxControl.vue.d.ts +2 -2
  73. package/dist/src/uiComponents/SortListControl.vue.d.ts +2 -918
  74. package/dist/src/uiComponents/richTextControl/RichTextControl.vue.d.ts +3 -1
  75. package/dist/testing.js +2589 -2602
  76. package/dist/{toString-GoK24L1U.js → toString-DXFebvWA.js} +1 -1
  77. package/dist/{useBuiltinValidations-LGrGrHzT.js → useBuiltinValidations-ChnQzGRe.js} +1 -1
  78. package/dist/useDropdownNavigation-2Yhk7zes.js +821 -0
  79. package/dist/{usePossibleValues-ItF87hxE.js → usePossibleValues-B8es3DCW.js} +1 -1
  80. package/dist/{useUnknownValuesInTwinlist-B8gDSha9.js → useUnknownValuesInTwinlist-qv0kKHaD.js} +1 -1
  81. package/package.json +4 -4
  82. package/dist/Checkbox-DiIYr1i-.js +0 -75
  83. package/dist/ComboBoxControl-BoQyPwaV.js +0 -616
  84. package/dist/FileUploadControl-CFQSJwkd.js +0 -197
  85. package/dist/MultiSelectListBoxControl-DbJWOUtn.js +0 -31
  86. package/dist/SettingsSubPanel-BUVqvjIE.js +0 -5
  87. package/dist/SortListControl-LWMW3lAc.js +0 -389
  88. package/dist/_baseAssignValue-DV_dpE4l.js +0 -19
  89. package/dist/_baseEach-RTY-xHIc.js +0 -30
  90. package/dist/close-CwP2mh9x.js +0 -17
  91. package/dist/createMissingItem-B00Kg95q.js +0 -4
  92. package/dist/floating-ui.vue-Bk6u3tWN.js +0 -1060
  93. package/dist/navigator-e30QQMkl.js +0 -4
  94. package/dist/useDropdownNavigation-EOwf_fL0.js +0 -946
@@ -1,616 +0,0 @@
1
- import { resolveComponent as f, openBlock as r, createElementBlock as b, withModifiers as a, withKeys as u, normalizeClass as w, renderSlot as F, createElementVNode as p, toDisplayString as S, createVNode as h, withDirectives as C, normalizeStyle as A, Fragment as D, renderList as P, createBlock as E, withCtx as O, createTextVNode as T, vShow as k, defineComponent as x, vModelText as $, toRef as z, computed as y, unref as N } from "vue";
2
- import { u as U } from "./usePossibleValues-ItF87hxE.js";
3
- import { C as L } from "./close-CwP2mh9x.js";
4
- import { _ as B, N as H } from "./SimpleButtonControl.vue_vue_type_style_index_0_scoped_17a4a240_lang-Ssy7Zaqp.js";
5
- /* empty css */
6
- import { A as K } from "./arrow-dropdown-DMFBPPcK.js";
7
- import { C as j } from "./Checkbox-DiIYr1i-.js";
8
- import { c as W } from "./createMissingItem-B00Kg95q.js";
9
- const g = () => {
10
- let e = document?.activeElement;
11
- for (; e?.shadowRoot; )
12
- e = e?.shadowRoot?.activeElement;
13
- return e;
14
- }, v = 1, G = 28.5, X = 8, q = {
15
- name: "Multiselect",
16
- components: {
17
- Checkbox: j,
18
- DropdownIcon: K
19
- },
20
- props: {
21
- /**
22
- * List of possible values. Each item must have an `id` and a `text` property. Optionally it can have:
23
- * - `selectedText` property that is used for displaying the list of selected items.
24
- * If it is omitted, `text` is used instead.
25
- * - `disabled` property for disabling the corresponding checkbox so that the user can not change the value.
26
- * @example
27
- * [{
28
- * id: 'pdf',
29
- * text: 'PDF'
30
- * }, {
31
- * id: 'XLS',
32
- * text: 'Excel',
33
- * selectedText: '.xls'
34
- * }]
35
- */
36
- possibleValues: {
37
- type: Array,
38
- default: () => [],
39
- validator(e) {
40
- return Array.isArray(e) ? e.every(
41
- (t) => t.hasOwnProperty("id") && t.hasOwnProperty("text")
42
- ) : !1;
43
- }
44
- },
45
- /**
46
- * selected value (which is a list of ids of entries)
47
- */
48
- modelValue: {
49
- type: Array,
50
- default: () => []
51
- },
52
- /**
53
- * placeholder to be displayed when nothing is selected
54
- */
55
- placeholder: {
56
- type: String,
57
- default: null
58
- },
59
- isValid: {
60
- type: Boolean,
61
- default: !0
62
- },
63
- /**
64
- * Seperator which seperates selected items in the summary.
65
- */
66
- separator: {
67
- type: String,
68
- default: ", "
69
- },
70
- /**
71
- * Max number of items that will be displayed in the summary.
72
- */
73
- summaryMaxItemCount: {
74
- type: Number,
75
- default: 1 / 0
76
- },
77
- /**
78
- * Name that will be used if summaryMaxItemCount is exceeded.
79
- */
80
- summaryName: {
81
- type: String,
82
- default: null
83
- },
84
- /**
85
- * Use a custom list box (slot: 'listBox') that replaces the standard Multiselect element containing the button
86
- * to toggle the dropdown and the summary
87
- */
88
- useCustomListBox: {
89
- type: Boolean,
90
- default: !1
91
- },
92
- /**
93
- * Limit the number of visible options (more options are reachable by scrolling)
94
- */
95
- sizeVisibleOptions: {
96
- type: Number,
97
- default: 0,
98
- validator(e) {
99
- return e >= 0;
100
- }
101
- },
102
- /**
103
- * Focus element of the parent for which the options don't get closed when it is focussed.
104
- */
105
- parentFocusElement: {
106
- type: Object,
107
- default: () => ({})
108
- },
109
- /**
110
- * The element of the parent to refocus when the options get closed and using a custom listbox.
111
- */
112
- parentRefocusElementOnClose: {
113
- type: Object,
114
- default: () => ({})
115
- },
116
- /**
117
- * Close the dropdown when a value was selected.
118
- */
119
- closeDropdownOnSelection: {
120
- type: Boolean,
121
- default: !1
122
- },
123
- compact: {
124
- type: Boolean,
125
- default: !1
126
- },
127
- disabled: {
128
- type: Boolean,
129
- default: !1
130
- }
131
- },
132
- emits: ["update:modelValue", "focusOutside"],
133
- data() {
134
- return {
135
- collapsed: !0,
136
- focusOptions: []
137
- };
138
- },
139
- computed: {
140
- focusElements() {
141
- return [...this.focusOptions, this.parentFocusElement];
142
- },
143
- summary() {
144
- return this.modelValue.length === 0 ? this.placeholder : this.modelValue.length > this.summaryMaxItemCount ? `${this.modelValue.length} ${this.summaryName}` : this.possibleValues.filter(({ id: e }) => this.modelValue.indexOf(e) > -1).map(({ text: e, selectedText: t = e }) => t).join(this.separator);
145
- },
146
- showOptions() {
147
- return !this.collapsed && this.possibleValues.length > 0;
148
- },
149
- useSpecificOptionsHeight() {
150
- return this.sizeVisibleOptions > 0 && this.sizeVisibleOptions < this.possibleValues.length;
151
- },
152
- optionsHeight() {
153
- return this.useSpecificOptionsHeight ? {
154
- "max-height": `${this.sizeVisibleOptions * G + X}px`
155
- } : {};
156
- },
157
- refocusElementOnClose() {
158
- return this.useCustomListBox ? this.parentRefocusElementOnClose : this.$refs.toggle;
159
- }
160
- },
161
- mounted() {
162
- this.updateFocusOptions();
163
- },
164
- methods: {
165
- emitNewSelection(e) {
166
- this.$emit("update:modelValue", e);
167
- },
168
- /**
169
- * Returns the next HTML Element from the list of items. If the current focused Element is at the top or bottom
170
- * of the list, this method will return the opposite end.
171
- *
172
- * @param {Number} changeInd - the positive or negative index shift for the next Element (usually 1 || -1).
173
- * @returns {Element} - the next option Element in the list of options.
174
- */
175
- getNextElement(e, t = g()) {
176
- return this.focusOptions[this.focusOptions.indexOf(t) + e] || (e < 0 ? this.focusOptions[this.focusOptions.length - 1] : this.focusOptions[0]);
177
- },
178
- onUpdateModelValue(e, t) {
179
- t ? this.modelValue.indexOf(e) === -1 && this.emitNewSelection([...this.modelValue, e]) : this.emitNewSelection(this.modelValue.filter((l) => l !== e)), this.closeDropdownOnSelection && this.closeOptions();
180
- },
181
- toggle() {
182
- this.collapsed = !this.collapsed, setTimeout(() => {
183
- this.$refs.toggle?.focus();
184
- }, v);
185
- },
186
- isChecked(e) {
187
- return this.modelValue.includes(e);
188
- },
189
- /**
190
- * Handle closing the options.
191
- *
192
- * @param {Boolean} [refocusToggle = true] - if the toggle button / parentRefocusElement should be re-focused
193
- * after closing.
194
- * @return {undefined}
195
- */
196
- closeOptions(e = !0) {
197
- this.collapsed = !0, e && setTimeout(() => {
198
- this.refocusElementOnClose.focus();
199
- }, v);
200
- },
201
- /**
202
- * Handle closing the options if necessary and stopping the event if so.
203
- *
204
- * @param {KeyboardEvent} event - the keyboard "Escape" event triggering the close.
205
- * @return {undefined}
206
- */
207
- closeOptionsAndStop(e) {
208
- this.collapsed || (this.closeOptions(), e.stopPropagation(), e.preventDefault());
209
- },
210
- /* Handle arrow key "up" events. */
211
- onUp() {
212
- const e = g();
213
- e !== this.$refs.toggle && this.getNextElement(-1, e).focus();
214
- },
215
- /* Handle arrow key "down" events. */
216
- onDown() {
217
- this.getNextElement(1).focus();
218
- },
219
- /* Handle focus leaving events.
220
- *
221
- * NOTE: focusout bubbles, so we can use this event to close options.
222
- */
223
- onFocusOut() {
224
- setTimeout(() => {
225
- this.focusElements.includes(g()) || (this.closeOptions(!1), this.useCustomListBox && this.$emit("focusOutside"));
226
- }, v);
227
- },
228
- /*
229
- * Manually prevents default event bubbling and propagation for mousedown which can fire blur events that
230
- * interfere with the refocusing behavior. This allows the timeout to be set extremely low.
231
- */
232
- onMousedown(e) {
233
- e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation();
234
- },
235
- /*
236
- * Update focus options when possibleValues change to adapt keyboard navigation (e.g using ComboBox.vue)
237
- * $refs are unordered, suggested solution is to use a data-index
238
- * https://github.com/vuejs/vue/issues/4952#issuecomment-407550765
239
- */
240
- updateFocusOptions() {
241
- this.$refs.option && (this.focusOptions = this.$refs.option.sort(
242
- (e, t) => parseInt(e.$el.dataset.index, 10) - parseInt(t.$el.dataset.index, 10)
243
- ).map((e) => e.$el && e.$el.firstChild));
244
- }
245
- }
246
- }, J = { key: 1 }, Q = ["tabindex"];
247
- function Y(e, t, l, n, c, o) {
248
- const m = f("DropdownIcon"), d = f("Checkbox");
249
- return r(), b("div", {
250
- ref: "multiselect",
251
- class: w([
252
- "multiselect",
253
- { collapsed: c.collapsed, invalid: !l.isValid, compact: l.compact, disabled: l.disabled }
254
- ]),
255
- onKeydown: [
256
- t[2] || (t[2] = u((...s) => o.closeOptionsAndStop && o.closeOptionsAndStop(...s), ["esc"])),
257
- t[3] || (t[3] = u(a((...s) => o.onUp && o.onUp(...s), ["stop", "prevent"]), ["up"])),
258
- t[4] || (t[4] = u(a((...s) => o.onDown && o.onDown(...s), ["stop", "prevent"]), ["down"]))
259
- ],
260
- onFocusout: t[5] || (t[5] = a((...s) => o.onFocusOut && o.onFocusOut(...s), ["stop"])),
261
- onMousedown: t[6] || (t[6] = (...s) => o.onMousedown && o.onMousedown(...s))
262
- }, [
263
- l.useCustomListBox ? F(e.$slots, "listBox", { key: 0 }, void 0, !0) : (r(), b("div", J, [
264
- p("div", {
265
- ref: "toggle",
266
- role: "button",
267
- tabindex: l.disabled ? -1 : 0,
268
- class: w({ placeholder: !l.modelValue.length }),
269
- onClick: t[0] || (t[0] = (...s) => o.toggle && o.toggle(...s)),
270
- onKeydown: t[1] || (t[1] = u(a((...s) => o.toggle && o.toggle(...s), ["prevent"]), ["space"]))
271
- }, S(o.summary), 43, Q),
272
- h(m, { class: "icon" })
273
- ])),
274
- C(p("div", {
275
- class: "options",
276
- style: A(o.optionsHeight)
277
- }, [
278
- (r(!0), b(D, null, P(l.possibleValues, (s, i) => (r(), E(d, {
279
- ref_for: !0,
280
- ref: "option",
281
- key: `multiselect-${s.id}`,
282
- "data-index": i,
283
- "model-value": o.isChecked(s.id),
284
- disabled: s.disabled,
285
- class: "boxes",
286
- "onUpdate:modelValue": (V) => o.onUpdateModelValue(s.id, V)
287
- }, {
288
- default: O(() => [
289
- T(S(s.text), 1)
290
- ]),
291
- _: 2
292
- }, 1032, ["data-index", "model-value", "disabled", "onUpdate:modelValue"]))), 128)),
293
- F(e.$slots, "selectAction", {}, void 0, !0)
294
- ], 4), [
295
- [k, o.showOptions]
296
- ])
297
- ], 34);
298
- }
299
- const Z = /* @__PURE__ */ B(q, [["render", Y], ["__scopeId", "data-v-eeb8fb15"]]), I = "draft-id-combobox-preview-item", _ = x({
300
- name: "ComboBox",
301
- components: {
302
- Multiselect: Z,
303
- FunctionButton: H,
304
- CloseIcon: L
305
- },
306
- props: {
307
- /**
308
- * List of possible values. Each item must have an `id` and a `text` property. Some optional properties
309
- * can be used that are specified in Multiselect.vue.
310
- */
311
- possibleValues: {
312
- type: Array,
313
- default: () => [],
314
- validator(e) {
315
- return Array.isArray(e) ? e.every(
316
- (t) => t.hasOwnProperty("id") && t.hasOwnProperty("text")
317
- ) : !1;
318
- }
319
- },
320
- /**
321
- * List of initial selected ids.
322
- */
323
- modelValue: {
324
- type: Array,
325
- default: () => []
326
- },
327
- /**
328
- * Limit the number of visible options in the dropdown.
329
- */
330
- sizeVisibleOptions: {
331
- type: Number,
332
- default: 5,
333
- validator(e) {
334
- return e >= 0;
335
- }
336
- },
337
- /**
338
- * Close the dropdown when an entry was selected.
339
- */
340
- closeDropdownOnSelection: {
341
- type: Boolean,
342
- default: !1
343
- },
344
- isValid: {
345
- type: Boolean,
346
- default: !0
347
- },
348
- /**
349
- * Allow adding and selecting new tags, not just possible values
350
- */
351
- allowNewValues: {
352
- type: Boolean,
353
- default: !1
354
- },
355
- compact: {
356
- type: Boolean,
357
- default: !1
358
- },
359
- maxCharactersPerItem: {
360
- type: Number,
361
- default: null
362
- },
363
- disabled: {
364
- type: Boolean,
365
- default: !1
366
- }
367
- },
368
- emits: {
369
- "update:modelValue": (e) => !0
370
- },
371
- data() {
372
- return {
373
- searchValue: "",
374
- inputOrOptionsFocussed: !1,
375
- /*
376
- * Multiselect behavior: options close on clickaway except when focussing specific multiselect elements
377
- * When the searchInput of this component is focussed then they shouldn't be closed either, which is why
378
- * it needs to be passed to the Multiselect component.
379
- */
380
- focusElement: null,
381
- refocusElement: null,
382
- allPossibleItems: [...this.possibleValues]
383
- };
384
- },
385
- computed: {
386
- trimmedSearchValue() {
387
- return this.searchValue.trim();
388
- },
389
- trimmedLowerCasedSearchValue() {
390
- return this.trimmedSearchValue.toLowerCase();
391
- },
392
- isSearchEmpty() {
393
- return !this.trimmedSearchValue;
394
- },
395
- searchResults() {
396
- const e = this.allPossibleItems.some(
397
- ({ id: l, text: n }) => l === this.trimmedSearchValue || n === this.trimmedSearchValue
398
- ), t = this.allPossibleItems.filter(
399
- ({ id: l, text: n }) => n.toLowerCase().includes(this.trimmedLowerCasedSearchValue) || l === this.trimmedSearchValue
400
- );
401
- return this.allowNewValues && !e && !this.isSearchEmpty ? [
402
- { id: I, text: `${this.trimmedSearchValue} (new item)` },
403
- ...t
404
- ] : t;
405
- },
406
- hasSelection() {
407
- return this.selectedValues.length > 0;
408
- },
409
- inputWidth() {
410
- return this.inputOrOptionsFocussed && this.searchResults.length > 0 ? {} : { width: "0%" };
411
- },
412
- selectedValues() {
413
- return this.modelValue.map(
414
- (e) => this.allPossibleItems.find((t) => e === t.id) || W(e)
415
- );
416
- },
417
- maxSizeVisibleOptions() {
418
- return this.searchResults.length < this.sizeVisibleOptions ? this.searchResults.length : this.sizeVisibleOptions;
419
- }
420
- },
421
- created() {
422
- this.allowNewValues || this.$watch("possibleValues", (e) => {
423
- this.allPossibleItems = [...e];
424
- });
425
- },
426
- mounted() {
427
- this.focusElement = this.$refs.searchInput, this.refocusElement = this.$refs.listBox;
428
- },
429
- methods: {
430
- emitNewSelection(e) {
431
- this.$emit("update:modelValue", e);
432
- },
433
- focusInput() {
434
- this.$refs.searchInput.focus();
435
- },
436
- onDown() {
437
- this.$refs.combobox.onDown();
438
- },
439
- onEnter() {
440
- this.isSearchEmpty || typeof this.searchResults[0]?.id > "u" || this.modelValue.includes(this.searchResults[0].id) || (this.updateSelectedIds([...this.modelValue, this.searchResults[0].id]), this.searchValue = "");
441
- },
442
- onBackspace() {
443
- this.searchValue || this.emitNewSelection(this.modelValue.slice(0, -1));
444
- },
445
- onFocusOutside() {
446
- this.inputOrOptionsFocussed = !1, this.searchValue = "";
447
- },
448
- onInput() {
449
- this.$refs.combobox.updateFocusOptions();
450
- },
451
- onInputFocus() {
452
- this.inputOrOptionsFocussed || this.$refs.combobox.toggle(), this.inputOrOptionsFocussed = !0, this.$refs.combobox.updateFocusOptions();
453
- },
454
- updateSelectedIds(e) {
455
- if (!e.includes(I)) {
456
- this.emitNewSelection(e);
457
- return;
458
- }
459
- const l = {
460
- id: this.trimmedSearchValue,
461
- text: this.trimmedSearchValue
462
- };
463
- this.allPossibleItems.push(l), this.emitNewSelection(
464
- e.map((n) => n === I ? l.id : n)
465
- );
466
- },
467
- removeTag(e) {
468
- this.emitNewSelection(this.modelValue.filter((t) => t !== e)), this.closeOptions();
469
- },
470
- removeAllTags() {
471
- this.emitNewSelection([]), this.closeOptions();
472
- },
473
- closeOptionsAndStop(e) {
474
- this.$refs.combobox.closeOptionsAndStop(e);
475
- },
476
- closeOptions() {
477
- this.$refs.combobox.closeOptions();
478
- },
479
- validate() {
480
- const e = !this.selectedValues.some(
481
- (t) => t.invalid
482
- );
483
- return {
484
- isValid: e,
485
- errorMessage: e ? null : "One or more of the selected items is invalid."
486
- };
487
- }
488
- }
489
- }), ee = ["tabindex"], te = ["title"], se = ["maxlength", "disabled"], oe = { class: "icon-right" };
490
- function le(e, t, l, n, c, o) {
491
- const m = f("CloseIcon"), d = f("FunctionButton"), s = f("Multiselect");
492
- return r(), E(s, {
493
- ref: "combobox",
494
- "model-value": e.modelValue,
495
- "possible-values": e.searchResults,
496
- "use-custom-list-box": "",
497
- "size-visible-options": e.maxSizeVisibleOptions,
498
- "parent-focus-element": e.focusElement,
499
- "parent-refocus-element-on-close": e.refocusElement,
500
- "close-dropdown-on-selection": e.closeDropdownOnSelection,
501
- "is-valid": e.isValid,
502
- compact: e.compact,
503
- disabled: e.disabled,
504
- onFocusOutside: e.onFocusOutside,
505
- "onUpdate:modelValue": e.updateSelectedIds
506
- }, {
507
- listBox: O(() => [
508
- p("div", {
509
- ref: "listBox",
510
- class: "summary-input-icon-wrapper",
511
- tabindex: e.disabled ? -1 : 0,
512
- onKeydown: t[8] || (t[8] = u(a((...i) => e.focusInput && e.focusInput(...i), ["prevent", "self"]), ["enter"]))
513
- }, [
514
- p("div", {
515
- class: w([
516
- "summary-input-wrapper",
517
- { "with-icon-right": e.hasSelection, compact: e.compact }
518
- ]),
519
- onClick: t[7] || (t[7] = a((...i) => e.focusInput && e.focusInput(...i), ["stop"]))
520
- }, [
521
- (r(!0), b(D, null, P(e.selectedValues, ({ id: i, text: V, invalid: M }, R) => (r(), b("div", {
522
- key: `item.id${R}`,
523
- class: "tag",
524
- title: V
525
- }, [
526
- p("span", {
527
- class: w(["text", { invalid: M }])
528
- }, S(V), 3),
529
- h(d, {
530
- class: "remove-tag-button",
531
- compact: e.compact,
532
- disabled: e.disabled,
533
- onClick: a((ae) => e.removeTag(i), ["stop"])
534
- }, {
535
- default: O(() => [
536
- h(m, { class: "remove-tag-button-icon" })
537
- ]),
538
- _: 1
539
- }, 8, ["compact", "disabled", "onClick"])
540
- ], 8, te))), 128)),
541
- C(p("input", {
542
- ref: "searchInput",
543
- "onUpdate:modelValue": t[0] || (t[0] = (i) => e.searchValue = i),
544
- class: "search-input",
545
- type: "text",
546
- style: A(e.inputWidth),
547
- maxlength: e.maxCharactersPerItem,
548
- disabled: e.disabled,
549
- onFocus: t[1] || (t[1] = (...i) => e.onInputFocus && e.onInputFocus(...i)),
550
- onInput: t[2] || (t[2] = (...i) => e.onInput && e.onInput(...i)),
551
- onKeydown: [
552
- t[3] || (t[3] = u(a((...i) => e.onEnter && e.onEnter(...i), ["prevent"]), ["enter"])),
553
- t[4] || (t[4] = u((...i) => e.onBackspace && e.onBackspace(...i), ["backspace"])),
554
- t[5] || (t[5] = u(a((...i) => e.onDown && e.onDown(...i), ["stop", "prevent"]), ["down"])),
555
- t[6] || (t[6] = u((...i) => e.closeOptionsAndStop && e.closeOptionsAndStop(...i), ["esc"]))
556
- ]
557
- }, null, 44, se), [
558
- [$, e.searchValue]
559
- ])
560
- ], 2),
561
- C(p("div", oe, [
562
- h(d, {
563
- ref: "removeAllTags",
564
- class: "remove-all-tags-button",
565
- compact: e.compact,
566
- disabled: e.disabled,
567
- onClick: a(e.removeAllTags, ["stop"])
568
- }, {
569
- default: O(() => [
570
- h(m)
571
- ]),
572
- _: 1
573
- }, 8, ["compact", "disabled", "onClick"])
574
- ], 512), [
575
- [k, e.hasSelection]
576
- ])
577
- ], 40, ee)
578
- ]),
579
- _: 1
580
- }, 8, ["model-value", "possible-values", "size-visible-options", "parent-focus-element", "parent-refocus-element-on-close", "close-dropdown-on-selection", "is-valid", "compact", "disabled", "onFocusOutside", "onUpdate:modelValue"]);
581
- }
582
- const ie = /* @__PURE__ */ B(_, [["render", le], ["__scopeId", "data-v-b2800209"]]), ne = /* @__PURE__ */ x({
583
- __name: "ComboBoxControl",
584
- props: {
585
- control: {},
586
- handleChange: { type: Function },
587
- changeValue: { type: Function },
588
- disabled: { type: Boolean },
589
- isValid: { type: Boolean },
590
- onRegisterValidation: { type: Function },
591
- labelForId: {}
592
- },
593
- setup(e) {
594
- const t = e, { possibleValues: l } = U(z(t, "control")), n = y(
595
- () => l.value === null || l.value.length === 0
596
- ), c = y(
597
- () => t.control.uischema.providedOptions?.includes("possibleValues") || t.control.uischema.options?.possibleValues !== void 0
598
- ), o = y(
599
- () => t.disabled || n.value && c.value
600
- );
601
- return (m, d) => (r(), E(N(ie), {
602
- id: e.labelForId,
603
- "allow-new-values": !c.value,
604
- "aria-label": e.control.label,
605
- disabled: o.value,
606
- "possible-values": n.value ? e.control.data.map((s) => ({ id: s, text: s })) : N(l),
607
- "model-value": e.control.data,
608
- "is-valid": e.isValid,
609
- compact: "",
610
- "onUpdate:modelValue": d[0] || (d[0] = (s) => e.changeValue(s))
611
- }, null, 8, ["id", "allow-new-values", "aria-label", "disabled", "possible-values", "model-value", "is-valid"]));
612
- }
613
- }), be = /* @__PURE__ */ B(ne, [["__scopeId", "data-v-cb6aa225"]]);
614
- export {
615
- be as default
616
- };