@carbon/vue 3.0.10 → 3.0.11
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/README.md +1 -1
- package/dist/carbon-vue-3.common.js +162 -120
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +162 -120
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +2 -2
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/components/CvComboBox/CvComboBox.vue +1 -1
- package/src/components/CvDataTable/CvDataTable.vue +1 -1
- package/src/components/CvDropdown/CvDropdown.stories.mdx +7 -66
- package/src/components/CvDropdown/CvDropdown.vue +7 -18
- package/src/components/CvDropdown/CvDropdownItem.vue +1 -1
- package/src/components/CvFileUploader/CvFileUploader.stories.mdx +79 -14
- package/src/components/CvFileUploader/CvFileUploaderItem.vue +8 -7
- package/src/components/CvLink/CvLink.vue +6 -1
- package/src/components/CvLoading/CvLoading.vue +1 -1
- package/src/components/CvMultiSelect/CvMultiSelect.stories.mdx +8 -18
- package/src/components/CvMultiSelect/CvMultiSelect.vue +13 -18
- package/src/components/CvProgress/CvProgress.stories.mdx +23 -1
- package/src/components/CvProgress/CvProgressSkeleton.vue +37 -0
- package/src/components/CvProgress/CvProgressStep.vue +1 -1
- package/src/components/CvProgress/index.js +3 -1
- package/src/components/CvSearch/CvSearch.stories.mdx +4 -13
- package/src/components/CvSearch/CvSearch.vue +7 -19
- package/src/components/CvTabs/CvTabs.vue +1 -1
- package/src/components/CvTabs/__tests__/__snapshots__/CvTabs.spec.js.snap +3 -3
- package/src/components/CvTooltip/CvInteractiveTooltip.vue +1 -1
- package/dist/web-types.json +0 -5477
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/vue",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.11",
|
|
5
5
|
"description": "A collection of components for the Carbon Design System built using Vue.js",
|
|
6
6
|
"packageManager": "yarn@3.2.0",
|
|
7
7
|
"main": "dist/carbon-vue-3.umd.min.js",
|
|
8
8
|
"types": "src/index.d.ts",
|
|
9
9
|
"web-types": "dist/web-types.json",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"_postinstall": "node prepare.js",
|
|
11
|
+
"_postinstall": "node prepare.js && node .storybook/postinstall.js",
|
|
12
12
|
"prepack": "pinst --disable",
|
|
13
13
|
"postpack": "pinst --enable",
|
|
14
14
|
"build": "vue-cli-service build --target lib --name carbon-vue-3 ./src/index.js --no-clean",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
|
|
175
175
|
},
|
|
176
176
|
"sideEffects": true,
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "1a9b7dd369e0985937b5b1efcc1dea6ce9ce40a5"
|
|
178
178
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<section v-if="hasToolbar" :class="`${carbonPrefix}--table-toolbar`">
|
|
24
24
|
<div
|
|
25
25
|
v-show="hasBatchActions"
|
|
26
|
-
:aria-hidden="!batchActive"
|
|
26
|
+
:aria-hidden="`${!batchActive}`"
|
|
27
27
|
:class="[
|
|
28
28
|
`${carbonPrefix}--batch-actions`,
|
|
29
29
|
{ [`${carbonPrefix}--batch-actions--active`]: batchActive },
|
|
@@ -49,7 +49,7 @@ const defaultTemplate = `
|
|
|
49
49
|
<cv-dropdown
|
|
50
50
|
:light="light"
|
|
51
51
|
:placeholder="placeholder"
|
|
52
|
-
:
|
|
52
|
+
:modelValue="modelValue"
|
|
53
53
|
:up="up"
|
|
54
54
|
:inline="inline"
|
|
55
55
|
:helper-text="helperText"
|
|
@@ -71,7 +71,7 @@ const defaultTemplate = `
|
|
|
71
71
|
const slotsTemplate = `
|
|
72
72
|
<div :style="{width: '300px'}">
|
|
73
73
|
<cv-dropdown
|
|
74
|
-
v-model
|
|
74
|
+
v-model="myValue"
|
|
75
75
|
:light="light"
|
|
76
76
|
:placeholder="placeholder"
|
|
77
77
|
:up="up"
|
|
@@ -101,7 +101,7 @@ const itemsTemplate = `
|
|
|
101
101
|
<cv-dropdown
|
|
102
102
|
:light="light"
|
|
103
103
|
:placeholder="placeholder"
|
|
104
|
-
:
|
|
104
|
+
:modelValue="modelValue"
|
|
105
105
|
:up="up"
|
|
106
106
|
:inline="inline"
|
|
107
107
|
:helper-text="helperText"
|
|
@@ -119,7 +119,7 @@ const itemsTemplate = `
|
|
|
119
119
|
const vmodelTemplate = `
|
|
120
120
|
<div :style="{width: '300px'}">
|
|
121
121
|
<cv-dropdown
|
|
122
|
-
v-model
|
|
122
|
+
v-model="myValue"
|
|
123
123
|
:label="label"
|
|
124
124
|
:placeholder="placeholder"
|
|
125
125
|
@change="onChange">
|
|
@@ -151,10 +151,7 @@ Notes:
|
|
|
151
151
|
|
|
152
152
|
- You can place a Dropdown inline with other content by using the inline variant
|
|
153
153
|
Migration notes:
|
|
154
|
-
|
|
155
|
-
- The `v-model` is different in Vue 3 than Vue 2. You can still specify the `v-model=something` to control the visibility but
|
|
156
|
-
if you specify it like this you will see a deprecation message in the log. Please use `v-model:value=something` instead.
|
|
157
|
-
- Add the `size` option to match Carbon React
|
|
154
|
+
- Added the `size` option to match Carbon React
|
|
158
155
|
- Added the `warningMessage` option to match Carbon React
|
|
159
156
|
|
|
160
157
|
<Canvas>
|
|
@@ -168,21 +165,16 @@ Notes:
|
|
|
168
165
|
'template',
|
|
169
166
|
'change',
|
|
170
167
|
'update:modelValue',
|
|
171
|
-
'update:value',
|
|
172
168
|
'helper-text',
|
|
173
169
|
'invalid-message',
|
|
174
170
|
'warning-message',
|
|
175
171
|
'internal-caption',
|
|
176
|
-
'modelValue',
|
|
177
172
|
],
|
|
178
173
|
},
|
|
179
174
|
docs: { source: { code: defaultTemplate } },
|
|
180
175
|
}}
|
|
181
176
|
args={{
|
|
182
177
|
template: defaultTemplate,
|
|
183
|
-
props: {
|
|
184
|
-
modelValue: undefined,
|
|
185
|
-
},
|
|
186
178
|
label: 'Characters',
|
|
187
179
|
placeholder: 'Choose an ally',
|
|
188
180
|
helperText: 'May the force be with you',
|
|
@@ -273,7 +265,6 @@ Notes:
|
|
|
273
265
|
'template',
|
|
274
266
|
'change',
|
|
275
267
|
'update:modelValue',
|
|
276
|
-
'update:value',
|
|
277
268
|
'helper-text',
|
|
278
269
|
'invalid-message',
|
|
279
270
|
'warning-message',
|
|
@@ -316,32 +307,7 @@ Notes:
|
|
|
316
307
|
name="v-model"
|
|
317
308
|
parameters={{
|
|
318
309
|
controls: {
|
|
319
|
-
|
|
320
|
-
'props',
|
|
321
|
-
'default',
|
|
322
|
-
'template',
|
|
323
|
-
'change',
|
|
324
|
-
'update:modelValue',
|
|
325
|
-
'update:value',
|
|
326
|
-
'helper-text',
|
|
327
|
-
'invalid-message',
|
|
328
|
-
'warning-message',
|
|
329
|
-
'internal-caption',
|
|
330
|
-
'modelValue',
|
|
331
|
-
'ariaLabel',
|
|
332
|
-
'disabled',
|
|
333
|
-
'formItem',
|
|
334
|
-
'helperText',
|
|
335
|
-
'hideSelected',
|
|
336
|
-
'inline',
|
|
337
|
-
'invalidMessage',
|
|
338
|
-
'items',
|
|
339
|
-
'label',
|
|
340
|
-
'placeholder',
|
|
341
|
-
'size',
|
|
342
|
-
'up',
|
|
343
|
-
'value',
|
|
344
|
-
'warningMessage',
|
|
310
|
+
include: [
|
|
345
311
|
],
|
|
346
312
|
},
|
|
347
313
|
docs: { source: { code: vmodelTemplate } },
|
|
@@ -367,32 +333,7 @@ Notes:
|
|
|
367
333
|
name="skeleton"
|
|
368
334
|
parameters={{
|
|
369
335
|
controls: {
|
|
370
|
-
|
|
371
|
-
'props',
|
|
372
|
-
'default',
|
|
373
|
-
'template',
|
|
374
|
-
'change',
|
|
375
|
-
'update:modelValue',
|
|
376
|
-
'update:value',
|
|
377
|
-
'helper-text',
|
|
378
|
-
'invalid-message',
|
|
379
|
-
'warning-message',
|
|
380
|
-
'internal-caption',
|
|
381
|
-
'modelValue',
|
|
382
|
-
'ariaLabel',
|
|
383
|
-
'disabled',
|
|
384
|
-
'formItem',
|
|
385
|
-
'helperText',
|
|
386
|
-
'hideSelected',
|
|
387
|
-
'invalidMessage',
|
|
388
|
-
'items',
|
|
389
|
-
'label',
|
|
390
|
-
'placeholder',
|
|
391
|
-
'size',
|
|
392
|
-
'up',
|
|
393
|
-
'value',
|
|
394
|
-
'warningMessage',
|
|
395
|
-
'inline',
|
|
336
|
+
include: [
|
|
396
337
|
],
|
|
397
338
|
},
|
|
398
339
|
docs: { source: { code: skeletonTemplate } },
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<button
|
|
74
74
|
ref="button"
|
|
75
75
|
:aria-controls="`${uid}-menu`"
|
|
76
|
-
:aria-disabled="disabled"
|
|
76
|
+
:aria-disabled="disabled || null"
|
|
77
77
|
:aria-expanded="open ? 'true' : 'false'"
|
|
78
78
|
:aria-labelledby="ariaLabeledBy"
|
|
79
79
|
:class="`${carbonPrefix}--list-box__field`"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
</div>
|
|
130
130
|
<div
|
|
131
131
|
v-else-if="data.isHelper"
|
|
132
|
-
:aria-disabled="disabled"
|
|
132
|
+
:aria-disabled="disabled || null"
|
|
133
133
|
:class="[
|
|
134
134
|
`${carbonPrefix}--form__helper-text`,
|
|
135
135
|
{ [`${carbonPrefix}--form__helper-text--disabled`]: disabled },
|
|
@@ -228,25 +228,15 @@ const props = defineProps({
|
|
|
228
228
|
* Specify the direction of the dropdown. Can be either true (top) or (false) bottom.
|
|
229
229
|
*/
|
|
230
230
|
up: { type: Boolean, default: false },
|
|
231
|
-
/**
|
|
232
|
-
* Render with a value already selected. Available as `v-model:value`.
|
|
233
|
-
*/
|
|
234
|
-
value: { type: String, default: undefined },
|
|
235
231
|
/**
|
|
236
232
|
* Provide the text that is displayed and put the control in warning state
|
|
237
233
|
*/
|
|
238
234
|
warningMessage: { type: String, default: undefined },
|
|
239
235
|
/**
|
|
240
|
-
*
|
|
236
|
+
* Render with a value already selected. Available as `v-model`.
|
|
241
237
|
*/
|
|
242
238
|
modelValue: {
|
|
243
239
|
type: String,
|
|
244
|
-
validator: val => {
|
|
245
|
-
console.warn(
|
|
246
|
-
`v-model for cv-dropdown is deprecated. Specify "v-model:value" instead [${val}]`
|
|
247
|
-
);
|
|
248
|
-
return true;
|
|
249
|
-
},
|
|
250
240
|
default: undefined,
|
|
251
241
|
},
|
|
252
242
|
|
|
@@ -255,7 +245,7 @@ const props = defineProps({
|
|
|
255
245
|
});
|
|
256
246
|
const uid = useCvId(props, true);
|
|
257
247
|
const isLight = useIsLight(props);
|
|
258
|
-
const dataValue = ref(props.
|
|
248
|
+
const dataValue = ref(props.modelValue);
|
|
259
249
|
provide('dropdown-selected', dataValue);
|
|
260
250
|
const focusItem = ref(undefined);
|
|
261
251
|
provide('dropdown-focus', focusItem);
|
|
@@ -287,16 +277,15 @@ const isWarning = computed(() => {
|
|
|
287
277
|
});
|
|
288
278
|
onMounted(checkSlots);
|
|
289
279
|
onUpdated(checkSlots);
|
|
290
|
-
const emit = defineEmits(['update:
|
|
280
|
+
const emit = defineEmits(['update:modelValue', 'change']);
|
|
291
281
|
watch(
|
|
292
|
-
() => props.
|
|
282
|
+
() => props.modelValue,
|
|
293
283
|
() => {
|
|
294
|
-
dataValue.value = props.
|
|
284
|
+
dataValue.value = props.modelValue;
|
|
295
285
|
}
|
|
296
286
|
);
|
|
297
287
|
watch(dataValue, () => {
|
|
298
288
|
emit('change', dataValue.value);
|
|
299
|
-
emit('update:value', dataValue.value);
|
|
300
289
|
emit('update:modelValue', dataValue.value);
|
|
301
290
|
});
|
|
302
291
|
watch(open, () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Canvas, Meta, Story } from '@storybook/addon-docs';
|
|
1
|
+
import { Canvas, Meta, Story, ArgsTable } from '@storybook/addon-docs';
|
|
2
2
|
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
3
3
|
import { CvFileUploader, CvFileUploaderSkeleton } from '.';
|
|
4
|
-
import { KINDS } from './const';
|
|
4
|
+
import { KINDS, STATES } from './const';
|
|
5
5
|
import { action } from '@storybook/addon-actions';
|
|
6
|
-
import { nextTick, ref } from 'vue';
|
|
6
|
+
import { nextTick, ref, watch, onMounted } from 'vue';
|
|
7
7
|
import { Add16 } from '@carbon/icons-vue';
|
|
8
8
|
import { buttonKinds, buttonSizes } from '../CvButton/consts';
|
|
9
9
|
|
|
@@ -16,7 +16,57 @@ export const Template = args => ({
|
|
|
16
16
|
Add16
|
|
17
17
|
},
|
|
18
18
|
setup() {
|
|
19
|
+
const fileUploader = ref(null);
|
|
20
|
+
const files = ref(storage.files);
|
|
21
|
+
// exposed methods handlers
|
|
22
|
+
function clear() {
|
|
23
|
+
if (args.clear && args.clear > storage.clearCount) {
|
|
24
|
+
storage.clearCount = args.clear;
|
|
25
|
+
fileUploader.value.clear();
|
|
26
|
+
action('cv-file-uploader clear')()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function remove() {
|
|
30
|
+
if (args.remove && args.remove > storage.removeCount && files.value.length > 0) {
|
|
31
|
+
const randomIndex = Math.floor(Math.random() * files.value.length);
|
|
32
|
+
storage.removeCount = args.remove;
|
|
33
|
+
fileUploader.value.remove(randomIndex);
|
|
34
|
+
action('cv-file-uploader remove')(randomIndex)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function setInvalidMessage(index) {
|
|
38
|
+
if (files.value[index].invalidMessage !== args.setInvalidMessage) {
|
|
39
|
+
fileUploader.value.setInvalidMessage(index, args.setInvalidMessage);
|
|
40
|
+
action('cv-file-uploader setInvalidMessage')(index, args.setInvalidMessage);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function setState(index) {
|
|
44
|
+
const newState = setStateOptionMap[args.setState];
|
|
45
|
+
if (files.value[index].state !== newState) {
|
|
46
|
+
fileUploader.value.setState(index, newState);
|
|
47
|
+
action('cv-file-uploader setState')(index, newState);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// exposed methods setState & setInvalidMessage handler
|
|
51
|
+
function changeFiles() {
|
|
52
|
+
const callbacks = [
|
|
53
|
+
typeof args.setState === 'string' ? setState : null,
|
|
54
|
+
typeof args.setInvalidMessage === 'string' ? setInvalidMessage : null,
|
|
55
|
+
];
|
|
56
|
+
files.value.forEach((_, index) => callbacks.forEach(callback => callback && callback(index)));
|
|
57
|
+
}
|
|
58
|
+
watch(() => files.value, (newValue) => {
|
|
59
|
+
storage.files = newValue;
|
|
60
|
+
changeFiles();
|
|
61
|
+
}, { deep: true });
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
clear();
|
|
64
|
+
remove();
|
|
65
|
+
changeFiles();
|
|
66
|
+
});
|
|
19
67
|
return {
|
|
68
|
+
fileUploader,
|
|
69
|
+
files,
|
|
20
70
|
slotContent: args.slot,
|
|
21
71
|
args: {
|
|
22
72
|
...args,
|
|
@@ -26,9 +76,19 @@ export const Template = args => ({
|
|
|
26
76
|
},
|
|
27
77
|
template: args.template,
|
|
28
78
|
});
|
|
79
|
+
const storage = {
|
|
80
|
+
files: [],
|
|
81
|
+
clearCount: 0,
|
|
82
|
+
removeCount: 0,
|
|
83
|
+
};
|
|
84
|
+
const setStateOptionMap = {
|
|
85
|
+
[`Set files status to: None`]: STATES.NONE,
|
|
86
|
+
[`Set files status to: Complete (${STATES.COMPLETE})`]: STATES.COMPLETE,
|
|
87
|
+
[`Set files status to: Uploading (${STATES.UPLOADING})`]: STATES.UPLOADING,
|
|
88
|
+
};
|
|
29
89
|
const defaultTemplate = `
|
|
30
90
|
<div style="display: inline-flex; align-items: flex-start;">
|
|
31
|
-
<cv-file-uploader v-bind="args" />
|
|
91
|
+
<cv-file-uploader v-bind="args" ref="fileUploader" v-model="files" />
|
|
32
92
|
</div>
|
|
33
93
|
`;
|
|
34
94
|
const slotTemplate = `
|
|
@@ -178,7 +238,8 @@ export const argTypes = {
|
|
|
178
238
|
},
|
|
179
239
|
// exposed methods
|
|
180
240
|
clear: {
|
|
181
|
-
control: '
|
|
241
|
+
control: 'button',
|
|
242
|
+
buttonLabel: 'Clear',
|
|
182
243
|
type: 'function',
|
|
183
244
|
table: {
|
|
184
245
|
type: { summary: '() => void' },
|
|
@@ -187,7 +248,8 @@ export const argTypes = {
|
|
|
187
248
|
description: 'Clear file list',
|
|
188
249
|
},
|
|
189
250
|
remove: {
|
|
190
|
-
control: '
|
|
251
|
+
control: 'button',
|
|
252
|
+
buttonLabel: 'Remove a random file',
|
|
191
253
|
type: 'function',
|
|
192
254
|
table: {
|
|
193
255
|
type: { summary: '(index: number) => void' },
|
|
@@ -195,23 +257,24 @@ export const argTypes = {
|
|
|
195
257
|
},
|
|
196
258
|
description: 'Removes an individual file',
|
|
197
259
|
},
|
|
198
|
-
|
|
199
|
-
control: '
|
|
260
|
+
setInvalidMessage: {
|
|
261
|
+
control: 'text',
|
|
200
262
|
type: 'function',
|
|
201
263
|
table: {
|
|
202
|
-
type: { summary: '(index: number,
|
|
264
|
+
type: { summary: '(index: number, invalidMessage: string) => void' },
|
|
203
265
|
category: 'exposed methods',
|
|
204
266
|
},
|
|
205
|
-
description: 'Update the "
|
|
267
|
+
description: 'Update the "invalidMessage" field of a file.',
|
|
206
268
|
},
|
|
207
|
-
|
|
208
|
-
control: '
|
|
269
|
+
setState: {
|
|
270
|
+
control: 'select',
|
|
271
|
+
options: Object.keys(setStateOptionMap),
|
|
209
272
|
type: 'function',
|
|
210
273
|
table: {
|
|
211
|
-
type: { summary: '(index: number,
|
|
274
|
+
type: { summary: '(index: number, state: string) => void' },
|
|
212
275
|
category: 'exposed methods',
|
|
213
276
|
},
|
|
214
|
-
description: 'Update the "
|
|
277
|
+
description: 'Update the "state" field of a file. State must be `""`, `complete` or `uploading`',
|
|
215
278
|
},
|
|
216
279
|
// slots
|
|
217
280
|
'drop-target': {
|
|
@@ -258,6 +321,8 @@ Migration notes:
|
|
|
258
321
|
</Story>
|
|
259
322
|
</Canvas>
|
|
260
323
|
|
|
324
|
+
<ArgsTable story="Default" />
|
|
325
|
+
|
|
261
326
|
# CvFileUploader Button
|
|
262
327
|
|
|
263
328
|
<Canvas>
|
|
@@ -9,8 +9,12 @@
|
|
|
9
9
|
{{ item.file?.name }}
|
|
10
10
|
</p>
|
|
11
11
|
<span :class="`${carbonPrefix}--file__state-container`">
|
|
12
|
+
<WarningFilled16
|
|
13
|
+
v-if="isInvalid"
|
|
14
|
+
:class="`${carbonPrefix}--file--invalid`"
|
|
15
|
+
/>
|
|
12
16
|
<div
|
|
13
|
-
v-if="item.state === 'uploading'"
|
|
17
|
+
v-if="!isInvalid && item.state === 'uploading'"
|
|
14
18
|
:class="`${carbonPrefix}--inline-loading__animation`"
|
|
15
19
|
>
|
|
16
20
|
<div
|
|
@@ -37,15 +41,12 @@
|
|
|
37
41
|
</div>
|
|
38
42
|
</div>
|
|
39
43
|
<CheckmarkFilled16
|
|
40
|
-
v-if="item.state === 'complete'"
|
|
44
|
+
v-else-if="!isInvalid && item.state === 'complete'"
|
|
41
45
|
:class="`${carbonPrefix}--file-complete`"
|
|
42
46
|
/>
|
|
43
|
-
|
|
44
|
-
v-if="isInvalid"
|
|
45
|
-
:class="`${carbonPrefix}--file--invalid`"
|
|
46
|
-
/>
|
|
47
|
+
<!-- "edit" state at react -->
|
|
47
48
|
<button
|
|
48
|
-
v-if="removable"
|
|
49
|
+
v-else-if="removable"
|
|
49
50
|
type="button"
|
|
50
51
|
:class="`${carbonPrefix}--file-close`"
|
|
51
52
|
:alt="removeAriaLabel"
|
|
@@ -58,7 +58,7 @@ export const Template = args => ({
|
|
|
58
58
|
title: args.title,
|
|
59
59
|
label: args.label,
|
|
60
60
|
highlight: args.highlight,
|
|
61
|
-
|
|
61
|
+
modelValue: args.modelValue,
|
|
62
62
|
selectionFeedback: args.selectionFeedback,
|
|
63
63
|
filterable: args.filterable,
|
|
64
64
|
light: args.light,
|
|
@@ -70,7 +70,7 @@ export const Template = args => ({
|
|
|
70
70
|
myValue: myValue,
|
|
71
71
|
onChange: action('change'),
|
|
72
72
|
onFilter: action('filter'),
|
|
73
|
-
onVmodel: action('update:
|
|
73
|
+
onVmodel: action('update:modelValue'),
|
|
74
74
|
};
|
|
75
75
|
},
|
|
76
76
|
template: args.template,
|
|
@@ -93,7 +93,7 @@ const defaultTemplate = `
|
|
|
93
93
|
:options="options"
|
|
94
94
|
:selectionFeedback="selectionFeedback"
|
|
95
95
|
:title="title"
|
|
96
|
-
:
|
|
96
|
+
:modelValue="modelValue"
|
|
97
97
|
:warningMessage="warningMessage"
|
|
98
98
|
@change="onChange"
|
|
99
99
|
@filter="onFilter"
|
|
@@ -123,13 +123,13 @@ const vModelTemplate = `
|
|
|
123
123
|
:label="label"
|
|
124
124
|
:options="options"
|
|
125
125
|
:title="title"
|
|
126
|
-
v-model
|
|
126
|
+
v-model="myValue"
|
|
127
127
|
@change="onChange"
|
|
128
128
|
@filter="onFilter"
|
|
129
129
|
>
|
|
130
130
|
</cv-multi-select>
|
|
131
131
|
<div style="margin-top:2rem">
|
|
132
|
-
<div>v-model
|
|
132
|
+
<div>v-model</div>
|
|
133
133
|
<select name="cars" id="cars" v-model="myValue" multiple>
|
|
134
134
|
<option v-for="opt in options" :key="opt.value" :value="opt.value">{{opt.value}}</option>
|
|
135
135
|
</select>
|
|
@@ -147,8 +147,6 @@ Migration notes:
|
|
|
147
147
|
- Added the `warningMessage` option to match Carbon React
|
|
148
148
|
- Setting `autoFilter` to true now implies `filterable`. Previous versions required `filterable` to
|
|
149
149
|
be explicitly set to `true` for `autoFilter` to work properly.
|
|
150
|
-
- The `v-model` is different in Vue 3 than Vue 2.If you specify it you will see a error deprecation message in the log.
|
|
151
|
-
Please use `v-model:value=something` instead.
|
|
152
150
|
|
|
153
151
|
<Canvas>
|
|
154
152
|
<Story
|
|
@@ -160,10 +158,8 @@ Migration notes:
|
|
|
160
158
|
'filter',
|
|
161
159
|
'helper-text',
|
|
162
160
|
'invalid-message',
|
|
163
|
-
'modelValue',
|
|
164
161
|
'template',
|
|
165
162
|
'update:modelValue',
|
|
166
|
-
'update:value',
|
|
167
163
|
'warning-message',
|
|
168
164
|
],
|
|
169
165
|
},
|
|
@@ -210,7 +206,7 @@ Migration notes:
|
|
|
210
206
|
control: 'inline-radio',
|
|
211
207
|
options: [],
|
|
212
208
|
},
|
|
213
|
-
|
|
209
|
+
modelValue: {
|
|
214
210
|
control: 'multi-select',
|
|
215
211
|
options: pkdValues,
|
|
216
212
|
},
|
|
@@ -242,15 +238,13 @@ Migration notes:
|
|
|
242
238
|
'invalid-message',
|
|
243
239
|
'invalidMessage',
|
|
244
240
|
'light',
|
|
245
|
-
'modelValue',
|
|
246
241
|
'options',
|
|
247
242
|
'selectionFeedback',
|
|
248
243
|
'template',
|
|
249
244
|
'update:modelValue',
|
|
250
|
-
'update:value',
|
|
251
|
-
'value',
|
|
252
245
|
'warning-message',
|
|
253
246
|
'warningMessage',
|
|
247
|
+
'modelValue'
|
|
254
248
|
],
|
|
255
249
|
},
|
|
256
250
|
docs: { source: { code: slotsTemplate } },
|
|
@@ -272,8 +266,6 @@ Migration notes:
|
|
|
272
266
|
|
|
273
267
|
# v-model
|
|
274
268
|
|
|
275
|
-
Note: Specifying `v-model="something"` will not work. Use `v-model:value=something` instead.
|
|
276
|
-
|
|
277
269
|
<Canvas>
|
|
278
270
|
<Story
|
|
279
271
|
name="v-model"
|
|
@@ -300,8 +292,6 @@ Note: Specifying `v-model="something"` will not work. Use `v-model:value=somethi
|
|
|
300
292
|
'selectionFeedback',
|
|
301
293
|
'template',
|
|
302
294
|
'update:modelValue',
|
|
303
|
-
'update:value',
|
|
304
|
-
'value',
|
|
305
295
|
'warning-message',
|
|
306
296
|
'warningMessage',
|
|
307
297
|
],
|
|
@@ -322,7 +312,7 @@ Note: Specifying `v-model="something"` will not work. Use `v-model:value=somethi
|
|
|
322
312
|
control: 'inline-radio',
|
|
323
313
|
options: [],
|
|
324
314
|
},
|
|
325
|
-
|
|
315
|
+
modelValue: {
|
|
326
316
|
control: 'multi-select',
|
|
327
317
|
options: pkdValues,
|
|
328
318
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
ref="elButton"
|
|
66
66
|
type="button"
|
|
67
67
|
:class="`${carbonPrefix}--list-box__field`"
|
|
68
|
-
:aria-disabled="disabled"
|
|
68
|
+
:aria-disabled="disabled || null"
|
|
69
69
|
aria-haspopup="listbox"
|
|
70
70
|
:aria-expanded="data.open ? 'true' : 'false'"
|
|
71
71
|
:aria-owns="uid"
|
|
@@ -342,23 +342,16 @@ const props = defineProps({
|
|
|
342
342
|
* Provide text to be used in a <label> element that is tied to the multiselect via ARIA attributes.
|
|
343
343
|
*/
|
|
344
344
|
title: { type: String, default: undefined },
|
|
345
|
-
/***
|
|
346
|
-
* Allow users to pass in arbitrary items from their collection that are pre-selected
|
|
347
|
-
*/
|
|
348
|
-
value: { type: Array, default: () => [] },
|
|
349
345
|
/**
|
|
350
346
|
* Provide the text that is displayed and put the control in warning state
|
|
351
347
|
*/
|
|
352
348
|
warningMessage: { type: String, default: undefined },
|
|
349
|
+
/***
|
|
350
|
+
* Allow users to pass in arbitrary items from their collection that are pre-selected
|
|
351
|
+
*/
|
|
353
352
|
modelValue: {
|
|
354
353
|
type: Array,
|
|
355
|
-
|
|
356
|
-
console.error(
|
|
357
|
-
`v-model for cv-multi-select is deprecated. Specify "v-model:value" instead [${val}]`
|
|
358
|
-
);
|
|
359
|
-
return true;
|
|
360
|
-
},
|
|
361
|
-
default: undefined,
|
|
354
|
+
default: () => [],
|
|
362
355
|
},
|
|
363
356
|
...propsCvId,
|
|
364
357
|
...propsTheme,
|
|
@@ -379,13 +372,15 @@ const data = reactive({
|
|
|
379
372
|
isWarning: false,
|
|
380
373
|
isInvalid: false,
|
|
381
374
|
});
|
|
382
|
-
const emit = defineEmits(['update:
|
|
375
|
+
const emit = defineEmits(['update:modelValue', 'change', 'filter']);
|
|
383
376
|
watch(
|
|
384
377
|
() => data.selectedItems,
|
|
385
378
|
() => {
|
|
386
|
-
if (
|
|
379
|
+
if (
|
|
380
|
+
JSON.stringify(data.selectedItems) !== JSON.stringify(props.modelValue)
|
|
381
|
+
) {
|
|
387
382
|
emit('change', data.selectedItems);
|
|
388
|
-
emit('update:
|
|
383
|
+
emit('update:modelValue', data.selectedItems);
|
|
389
384
|
}
|
|
390
385
|
},
|
|
391
386
|
{
|
|
@@ -409,7 +404,7 @@ const isFilterable = computed(() => {
|
|
|
409
404
|
});
|
|
410
405
|
|
|
411
406
|
function updateSelectedItems() {
|
|
412
|
-
data.selectedItems = props.
|
|
407
|
+
data.selectedItems = props.modelValue.filter(
|
|
413
408
|
/***
|
|
414
409
|
* @param {string} item
|
|
415
410
|
* @returns {boolean}
|
|
@@ -431,7 +426,7 @@ onUpdated(checkSlots);
|
|
|
431
426
|
onMounted(updateOptions);
|
|
432
427
|
onMounted(updateSelectedItems);
|
|
433
428
|
|
|
434
|
-
watch(() => props.
|
|
429
|
+
watch(() => props.modelValue, updateSelectedItems);
|
|
435
430
|
watch(() => props.options, updateOptions);
|
|
436
431
|
watch(() => props.selectionFeedback, updateOptions);
|
|
437
432
|
|
|
@@ -462,7 +457,7 @@ const highlighted = computed({
|
|
|
462
457
|
},
|
|
463
458
|
});
|
|
464
459
|
onMounted(() => {
|
|
465
|
-
highlighted.value = props.
|
|
460
|
+
highlighted.value = props.modelValue ? props.modelValue : props.highlight; // override highlight with modelValue if provided
|
|
466
461
|
});
|
|
467
462
|
|
|
468
463
|
const internalFilter = computed({
|