@carbon/vue 3.0.22 → 3.0.23
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 +2 -3
- package/dist/carbon-vue-3.common.js +64 -7
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +64 -7
- package/dist/carbon-vue-3.umd.js.map +1 -1
- package/dist/carbon-vue-3.umd.min.js +4 -4
- package/dist/carbon-vue-3.umd.min.js.map +1 -1
- package/package.json +7 -4
- package/src/components/CvDataTable/CvDataTable.stories.mdx +6 -22
- package/src/components/CvDataTable/CvDataTable.vue +2 -6
- package/src/components/CvDataTable/CvDataTableRow.vue +6 -1
- package/src/components/CvUIShell/CvContent.stories.js +22 -0
- package/src/components/CvUIShell/CvContent.vue +14 -0
- package/src/index.js +1 -0
- package/telemetry.yml +1 -1
- package/dist/web-types.json +0 -5555
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/vue",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.23",
|
|
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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@vue/cli-plugin-unit-jest": "^5.0.8",
|
|
52
52
|
"@vue/cli-service": "^5.0.8",
|
|
53
53
|
"@vue/compiler-sfc": "^3.3.4",
|
|
54
|
-
"@vue/eslint-config-prettier": "^
|
|
54
|
+
"@vue/eslint-config-prettier": "^10.1.0",
|
|
55
55
|
"@vue/test-utils": "^2.2.4",
|
|
56
56
|
"@vue/vue3-jest": "^27.0.0",
|
|
57
57
|
"accessibility-checker": "^3.1.59",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"husky": "^7.0.4",
|
|
67
67
|
"jest": "^27.5.1",
|
|
68
68
|
"lerna": "^6.5.1",
|
|
69
|
-
"lint-staged": "^
|
|
69
|
+
"lint-staged": "^15.2.10",
|
|
70
70
|
"postcss": "^8.4.19",
|
|
71
71
|
"postcss-loader": "^8.1.1",
|
|
72
72
|
"prettier": "^2.8.0",
|
|
@@ -170,7 +170,10 @@
|
|
|
170
170
|
},
|
|
171
171
|
"lint-staged": {
|
|
172
172
|
"*.{scss,css,js,md,vue}": [
|
|
173
|
-
"
|
|
173
|
+
"prettier --write"
|
|
174
|
+
],
|
|
175
|
+
"*.{js,vue}": [
|
|
176
|
+
"eslint --fix --max-warnings 0"
|
|
174
177
|
]
|
|
175
178
|
},
|
|
176
179
|
"repository": {
|
|
@@ -154,7 +154,7 @@ const defaultTemplate = `
|
|
|
154
154
|
const expandingRowsTemplate = defaultTemplate.replace(
|
|
155
155
|
"<!-- Add optional expanding data here -->",
|
|
156
156
|
`<template #expandedContent>{{row.desc}}</template>`)
|
|
157
|
-
.replace('@search="onSearch"', '')
|
|
157
|
+
.replace('@search="onSearch"', ':expandable="true"')
|
|
158
158
|
.replace('testData', 'originalTestData')
|
|
159
159
|
const skeletonTemplate = `
|
|
160
160
|
<cv-data-table-skeleton
|
|
@@ -213,6 +213,7 @@ const vModelTemplate = defaultTemplate
|
|
|
213
213
|
}
|
|
214
214
|
```
|
|
215
215
|
- The search bar appears only if the search event is listened for.
|
|
216
|
+
- If your table has expanding rows, you MUST set the `expandable` property on CvTable to `true`. `<cv-table :expandable="true" ...`
|
|
216
217
|
|
|
217
218
|
**Row attributes:**
|
|
218
219
|
- aria-label-for-batch-checkbox: Aria label for batch checkbox. default 'Select row N for batch action'.
|
|
@@ -283,34 +284,17 @@ when no items were select, please now use the new property `stickyBatchActive`.
|
|
|
283
284
|
<Story
|
|
284
285
|
name="Expanding rows"
|
|
285
286
|
parameters={{
|
|
286
|
-
controls: {
|
|
287
|
-
'template',
|
|
288
|
-
'overflow-menu-click',
|
|
289
|
-
'row-expanded',
|
|
290
|
-
'row-select-change',
|
|
291
|
-
'row-select-changes',
|
|
292
|
-
'search',
|
|
293
|
-
'sort',
|
|
294
|
-
'actions',
|
|
295
|
-
'batch-actions',
|
|
296
|
-
'data',
|
|
297
|
-
'headings',
|
|
298
|
-
'helper-text',
|
|
299
|
-
'items-selected',
|
|
300
|
-
'of-n-pages',
|
|
301
|
-
'range-text',
|
|
302
|
-
'skeleton',
|
|
303
|
-
'update:rowsSelected',
|
|
304
|
-
] },
|
|
287
|
+
controls: { include: [ "helperText", "title", "hasExpandAll"] },
|
|
305
288
|
docs: { source: { code: storySourceCode(expandingRowsTemplate, Template.args) } },
|
|
306
289
|
}}
|
|
307
290
|
args={{
|
|
308
291
|
template: expandingRowsTemplate,
|
|
309
|
-
title: 'Table with expanding rows',
|
|
292
|
+
title: 'Table with expanding rows - NOTE: expandable property must be set to true',
|
|
310
293
|
helperText: 'Click row to expand',
|
|
311
294
|
useActions: false,
|
|
312
295
|
useBatchActions: false,
|
|
313
|
-
usePagination: true
|
|
296
|
+
usePagination: true,
|
|
297
|
+
expandable: true
|
|
314
298
|
}}
|
|
315
299
|
argTypes={{
|
|
316
300
|
rowSize: { control: 'select', default: 'standard', options: ['compact', 'short', 'standard', 'tall'] },
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
<thead>
|
|
133
133
|
<tr>
|
|
134
134
|
<th
|
|
135
|
-
v-if="
|
|
135
|
+
v-if="expandable"
|
|
136
136
|
:class="`${carbonPrefix}--table-expand`"
|
|
137
137
|
:data-previous-value="
|
|
138
138
|
dataExpandAll ? 'collapsed' : 'expanded'
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
</tr>
|
|
184
184
|
</thead>
|
|
185
185
|
|
|
186
|
-
<component :is="
|
|
186
|
+
<component :is="expandable ? Empty : 'tbody'">
|
|
187
187
|
<slot name="data">
|
|
188
188
|
<cv-data-table-row
|
|
189
189
|
v-for="(row, rowIndex) in data"
|
|
@@ -360,11 +360,7 @@ const search = ref(null);
|
|
|
360
360
|
|
|
361
361
|
/** @type {Ref<Set<String>>} */
|
|
362
362
|
const expandingRowIds = ref(new Set());
|
|
363
|
-
const hasExpandingRows = computed(() => {
|
|
364
|
-
return expandingRowIds.value.size > 0;
|
|
365
|
-
});
|
|
366
363
|
provide('expanding-row-ids', expandingRowIds);
|
|
367
|
-
provide('has-expanding-rows', hasExpandingRows);
|
|
368
364
|
onMounted(() => {
|
|
369
365
|
if (props.expandable) expandingRowIds.value.add('table-expand-row');
|
|
370
366
|
});
|
|
@@ -78,7 +78,12 @@ watch(
|
|
|
78
78
|
/** @type {Ref<Set<String>>} */
|
|
79
79
|
const expandingRowIds = inject('expanding-row-ids', ref(new Set()));
|
|
80
80
|
const dataExpandable = ref(false);
|
|
81
|
-
watch(dataExpandable,
|
|
81
|
+
watch(dataExpandable, value => {
|
|
82
|
+
if (value && !expandingRowIds.value.has('table-expand-row')) {
|
|
83
|
+
console.warn(
|
|
84
|
+
`row ${cvId.value} is expandable but the expandable property is not set to true on the table`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
82
87
|
if (dataExpandable.value) expandingRowIds.value.add(cvId.value);
|
|
83
88
|
else expandingRowIds.value?.delete(cvId.value);
|
|
84
89
|
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { storyParametersObject } from '../../global/storybook-utils';
|
|
2
|
+
import CvContent from './CvContent.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Component/ui-select/CvContent',
|
|
6
|
+
component: CvContent,
|
|
7
|
+
argTypes: {},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const template = `<cv-content>Hello main</cv-content>`;
|
|
11
|
+
const Template = () => {
|
|
12
|
+
return {
|
|
13
|
+
template,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
18
|
+
Default.parameters = storyParametersObject(
|
|
19
|
+
Default.parameters,
|
|
20
|
+
template,
|
|
21
|
+
Default.args
|
|
22
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { carbonPrefix } from '../../global/settings';
|
|
3
|
+
defineProps({
|
|
4
|
+
tagType: { type: String, default: 'main' },
|
|
5
|
+
});
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<component :is="tagType" :class="`${carbonPrefix}--content`">
|
|
10
|
+
<slot />
|
|
11
|
+
</component>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped lang="scss"></style>
|
package/src/index.js
CHANGED
|
@@ -138,6 +138,7 @@ export { default as CvToggle } from './components/CvToggle/CvToggle.vue';
|
|
|
138
138
|
export { default as CvDefinitionTooltip } from './components/CvTooltip/CvDefinitionTooltip.vue';
|
|
139
139
|
export { default as CvInteractiveTooltip } from './components/CvTooltip/CvInteractiveTooltip.vue';
|
|
140
140
|
export { default as CvTooltip } from './components/CvTooltip/CvTooltip.vue';
|
|
141
|
+
export { default as CvContent } from './components/CvUIShell/CvContent.vue';
|
|
141
142
|
export { default as CvHeader } from './components/CvUIShell/CvHeader.vue';
|
|
142
143
|
export { default as CvHeaderGlobalAction } from './components/CvUIShell/CvHeaderGlobalAction.vue';
|
|
143
144
|
export { default as CvHeaderMenu } from './components/CvUIShell/CvHeaderMenu.vue';
|
package/telemetry.yml
CHANGED