@knime/kds-components 7.2.3 → 8.0.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/CHANGELOG.md +18 -0
- package/dist/index.css +5 -5
- package/dist/index.js +44 -28
- package/dist/index.js.map +1 -1
- package/dist/src/components/forms/FileSelector/KdsFileSelector.vue.d.ts +10 -8
- package/dist/src/components/forms/FileSelector/KdsFileSelector.vue.d.ts.map +1 -1
- package/dist/src/components/forms/FileSelector/types.d.ts +19 -8
- package/dist/src/components/forms/FileSelector/types.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @knime/kds-components
|
|
2
2
|
|
|
3
|
+
## 8.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 336b1b4: - `KdsFileSelector`:
|
|
8
|
+
- added `multiple` prop for picking several files at once. The selected names are shown as a comma-separated list, and every picked file is validated against `accept` / `maxSizeBytes` — one invalid file rejects the whole selection.
|
|
9
|
+
- fix the select button's `aria-labelledby` pointing at a non-existent element when the field is labelled through `ariaLabel` instead of `label`.
|
|
10
|
+
|
|
11
|
+
BREAKING CHANGES:
|
|
12
|
+
|
|
13
|
+
- `KdsFileSelector`: the model value is now a `File[]` instead of `File | null` — empty rather than `null` when nothing is selected, so a single-file binding reads `modelValue[0]`.
|
|
14
|
+
- `KdsFileSelector`: the `validation-error` payload is now `{ files: KdsFileSelectorRejectedFile[] }`, listing every rejected file, instead of `{ file, reason }` for the one rejected file.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @knime/kds-styles@8.0.0
|
|
20
|
+
|
|
3
21
|
## 7.2.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -3420,30 +3420,30 @@ textarea[data-v-c4369feb]::-webkit-scrollbar {
|
|
|
3420
3420
|
gap: var(--kds-spacing-container-0-25x);
|
|
3421
3421
|
}
|
|
3422
3422
|
|
|
3423
|
-
.kds-file-selector[data-v-
|
|
3423
|
+
.kds-file-selector[data-v-ade65c6f] {
|
|
3424
3424
|
display: flex;
|
|
3425
3425
|
gap: var(--kds-spacing-container-0-75x);
|
|
3426
3426
|
align-items: center;
|
|
3427
3427
|
height: var(--kds-dimension-component-height-1-75x);
|
|
3428
3428
|
}
|
|
3429
|
-
.file-info[data-v-
|
|
3429
|
+
.file-info[data-v-ade65c6f] {
|
|
3430
3430
|
display: flex;
|
|
3431
3431
|
flex: 1 0 0;
|
|
3432
3432
|
flex-direction: column;
|
|
3433
3433
|
gap: var(--kds-spacing-container-0-12x);
|
|
3434
3434
|
min-width: 0;
|
|
3435
3435
|
}
|
|
3436
|
-
.file-name[data-v-
|
|
3436
|
+
.file-name[data-v-ade65c6f] {
|
|
3437
3437
|
overflow: hidden;
|
|
3438
3438
|
text-overflow: ellipsis;
|
|
3439
3439
|
font: var(--kds-font-base-title-small);
|
|
3440
3440
|
color: var(--kds-color-text-and-icon-subtle);
|
|
3441
3441
|
white-space: nowrap;
|
|
3442
3442
|
}
|
|
3443
|
-
.file-name.has-value[data-v-
|
|
3443
|
+
.file-name.has-value[data-v-ade65c6f] {
|
|
3444
3444
|
color: var(--kds-color-text-and-icon-neutral);
|
|
3445
3445
|
}
|
|
3446
|
-
.requirements[data-v-
|
|
3446
|
+
.requirements[data-v-ade65c6f] {
|
|
3447
3447
|
font: var(--kds-font-base-subtext-xsmall);
|
|
3448
3448
|
color: var(--kds-color-text-and-icon-subtle);
|
|
3449
3449
|
}
|
package/dist/index.js
CHANGED
|
@@ -24175,7 +24175,11 @@ var KdsZonedDateTimeInput_default = /*#__PURE__*/ _plugin_vue_export_helper_defa
|
|
|
24175
24175
|
//#endregion
|
|
24176
24176
|
//#region src/components/forms/FileSelector/KdsFileSelector.vue?vue&type=script&setup=true&lang.ts
|
|
24177
24177
|
var _hoisted_1$30 = { class: "kds-file-selector" };
|
|
24178
|
-
var _hoisted_2$17 = [
|
|
24178
|
+
var _hoisted_2$17 = [
|
|
24179
|
+
"accept",
|
|
24180
|
+
"multiple",
|
|
24181
|
+
"disabled"
|
|
24182
|
+
];
|
|
24179
24183
|
var _hoisted_3$12 = { class: "file-info" };
|
|
24180
24184
|
var _hoisted_4$12 = {
|
|
24181
24185
|
key: 0,
|
|
@@ -24207,27 +24211,29 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24207
24211
|
type: Boolean,
|
|
24208
24212
|
default: false
|
|
24209
24213
|
},
|
|
24214
|
+
multiple: {
|
|
24215
|
+
type: Boolean,
|
|
24216
|
+
default: false
|
|
24217
|
+
},
|
|
24210
24218
|
accept: {},
|
|
24211
24219
|
maxSizeBytes: {},
|
|
24212
24220
|
invalidTypeMessage: { default: "Filetype is not allowed." },
|
|
24213
24221
|
invalidSizeMessage: {},
|
|
24214
|
-
selectLabel: {
|
|
24215
|
-
emptyText: {
|
|
24216
|
-
clearLabel: {
|
|
24222
|
+
selectLabel: {},
|
|
24223
|
+
emptyText: {},
|
|
24224
|
+
clearLabel: {}
|
|
24217
24225
|
}, {
|
|
24218
|
-
"modelValue": { default:
|
|
24226
|
+
"modelValue": { default: () => [] },
|
|
24219
24227
|
"modelModifiers": {}
|
|
24220
24228
|
}),
|
|
24221
24229
|
emits: /*@__PURE__*/ mergeModels(["validation-error"], ["update:modelValue"]),
|
|
24222
24230
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
24223
24231
|
const props = createPropsRestProxy(__props, [
|
|
24224
24232
|
"disabled",
|
|
24233
|
+
"multiple",
|
|
24225
24234
|
"error",
|
|
24226
24235
|
"validating",
|
|
24227
24236
|
"preserveSubTextSpace",
|
|
24228
|
-
"selectLabel",
|
|
24229
|
-
"emptyText",
|
|
24230
|
-
"clearLabel",
|
|
24231
24237
|
"invalidTypeMessage"
|
|
24232
24238
|
]);
|
|
24233
24239
|
const emit = __emit;
|
|
@@ -24244,7 +24250,11 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24244
24250
|
}
|
|
24245
24251
|
return null;
|
|
24246
24252
|
};
|
|
24247
|
-
const
|
|
24253
|
+
const hasSelection = computed(() => modelValue.value.length > 0);
|
|
24254
|
+
const displayName = computed(() => modelValue.value.map(({ name }) => name).join(", "));
|
|
24255
|
+
const effectiveSelectLabel = computed(() => props.selectLabel ?? (__props.multiple ? "Select files" : "Select file"));
|
|
24256
|
+
const effectiveEmptyText = computed(() => props.emptyText ?? (__props.multiple ? "No files selected" : "No file selected"));
|
|
24257
|
+
const effectiveClearLabel = computed(() => props.clearLabel ?? (__props.multiple ? "Remove files" : "Remove file"));
|
|
24248
24258
|
const acceptEntries = computed(() => (props.accept ?? "").split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0));
|
|
24249
24259
|
const fileTypeLabels = computed(() => {
|
|
24250
24260
|
const labels = [];
|
|
@@ -24286,27 +24296,32 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24286
24296
|
const openDialog = () => {
|
|
24287
24297
|
fileInputRef.value?.click();
|
|
24288
24298
|
};
|
|
24299
|
+
const messageFor = (reason) => reason === "type" ? __props.invalidTypeMessage : effectiveInvalidSizeMessage.value;
|
|
24289
24300
|
const onFileChange = (event) => {
|
|
24290
24301
|
const input = event.target;
|
|
24291
|
-
const
|
|
24302
|
+
const files = Array.from(input.files ?? []).slice(0, __props.multiple ? void 0 : 1);
|
|
24292
24303
|
input.value = "";
|
|
24293
|
-
if (
|
|
24294
|
-
const
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
emit("validation-error", {
|
|
24304
|
+
if (files.length === 0) return;
|
|
24305
|
+
const rejected = [];
|
|
24306
|
+
for (const file of files) {
|
|
24307
|
+
const reason = validate(file);
|
|
24308
|
+
if (reason) rejected.push({
|
|
24299
24309
|
file,
|
|
24300
24310
|
reason
|
|
24301
24311
|
});
|
|
24312
|
+
}
|
|
24313
|
+
if (rejected.length > 0) {
|
|
24314
|
+
internalError.value = messageFor(rejected[0].reason);
|
|
24315
|
+
modelValue.value = [];
|
|
24316
|
+
emit("validation-error", { files: rejected });
|
|
24302
24317
|
return;
|
|
24303
24318
|
}
|
|
24304
24319
|
internalError.value = null;
|
|
24305
|
-
modelValue.value =
|
|
24320
|
+
modelValue.value = files;
|
|
24306
24321
|
};
|
|
24307
|
-
const
|
|
24322
|
+
const clearSelection = () => {
|
|
24308
24323
|
internalError.value = null;
|
|
24309
|
-
modelValue.value =
|
|
24324
|
+
modelValue.value = [];
|
|
24310
24325
|
};
|
|
24311
24326
|
__expose({ focus: (options) => selectButtonRef.value?.$el?.focus(options) });
|
|
24312
24327
|
return (_ctx, _cache) => {
|
|
@@ -24326,9 +24341,9 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24326
24341
|
ref: "selectButton",
|
|
24327
24342
|
size: "small",
|
|
24328
24343
|
variant: "filled",
|
|
24329
|
-
label:
|
|
24344
|
+
label: effectiveSelectLabel.value,
|
|
24330
24345
|
disabled: __props.disabled,
|
|
24331
|
-
"aria-labelledby": `${slotProps.ariaLabelledby} ${slotProps.id}
|
|
24346
|
+
"aria-labelledby": slotProps.ariaLabelledby ? `${slotProps.ariaLabelledby} ${slotProps.id}` : void 0,
|
|
24332
24347
|
"aria-describedby": slotProps.ariaDescribedby,
|
|
24333
24348
|
onClick: openDialog
|
|
24334
24349
|
}, null, 8, [
|
|
@@ -24343,22 +24358,23 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24343
24358
|
type: "file",
|
|
24344
24359
|
hidden: "",
|
|
24345
24360
|
accept: __props.accept,
|
|
24361
|
+
multiple: __props.multiple,
|
|
24346
24362
|
disabled: __props.disabled,
|
|
24347
24363
|
onChange: onFileChange
|
|
24348
24364
|
}, null, 40, _hoisted_2$17),
|
|
24349
|
-
createElementVNode("div", _hoisted_3$12, [withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(["file-name", { "has-value":
|
|
24365
|
+
createElementVNode("div", _hoisted_3$12, [withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(["file-name", { "has-value": hasSelection.value }]) }, [createTextVNode(toDisplayString(hasSelection.value ? displayName.value : effectiveEmptyText.value), 1)], 2)), [[
|
|
24350
24366
|
unref(vKdsTooltip),
|
|
24351
|
-
|
|
24367
|
+
hasSelection.value ? displayName.value : void 0,
|
|
24352
24368
|
"truncated"
|
|
24353
|
-
]]), !
|
|
24354
|
-
|
|
24369
|
+
]]), !hasSelection.value && requirementsText.value ? (openBlock(), createElementBlock("span", _hoisted_4$12, toDisplayString(requirementsText.value), 1)) : createCommentVNode("", true)]),
|
|
24370
|
+
hasSelection.value ? (openBlock(), createBlock(KdsButton_default, {
|
|
24355
24371
|
key: 0,
|
|
24356
24372
|
size: "small",
|
|
24357
24373
|
variant: "transparent",
|
|
24358
24374
|
"leading-icon": "trash",
|
|
24359
|
-
ariaLabel:
|
|
24375
|
+
ariaLabel: effectiveClearLabel.value,
|
|
24360
24376
|
disabled: __props.disabled,
|
|
24361
|
-
onClick:
|
|
24377
|
+
onClick: clearSelection
|
|
24362
24378
|
}, null, 8, ["ariaLabel", "disabled"])) : createCommentVNode("", true)
|
|
24363
24379
|
])]),
|
|
24364
24380
|
_: 1
|
|
@@ -24374,7 +24390,7 @@ var KdsFileSelector_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
|
|
|
24374
24390
|
]);
|
|
24375
24391
|
};
|
|
24376
24392
|
}
|
|
24377
|
-
}), [["__scopeId", "data-v-
|
|
24393
|
+
}), [["__scopeId", "data-v-ade65c6f"]]);
|
|
24378
24394
|
//#endregion
|
|
24379
24395
|
//#region src/components/forms/selects/Dropdown/KdsMultiSelectDropdown.vue
|
|
24380
24396
|
var KdsMultiSelectDropdown_default = /* @__PURE__ */ defineComponent({
|