@carbon/vue 3.0.14 → 3.0.16
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/dist/carbon-vue-3.common.js +789 -278
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +789 -278
- 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/dist/web-types.json +21 -3
- package/package.json +12 -9
- package/src/components/CvBreadcrumb/CvBreadcrumb.vue +1 -0
- package/src/components/CvBreadcrumb/CvBreadcrumbItem.vue +1 -0
- package/src/components/CvButton/CvButton.vue +1 -0
- package/src/components/CvButton/CvButtonSet.vue +1 -0
- package/src/components/CvButton/CvIconButton.vue +1 -0
- package/src/components/CvCheckbox/CvCheckbox.vue +2 -2
- package/src/components/CvCodeSnippet/CvCodeSnippet.vue +8 -3
- package/src/components/CvCodeSnippet/_CviCodeSnippetInline.vue +1 -0
- package/src/components/CvCodeSnippet/_CviCodeSnippetMultiline.vue +1 -0
- package/src/components/CvCodeSnippet/_CviCodeSnippetOneline.vue +1 -0
- package/src/components/CvComboBox/CvComboBox.vue +1 -0
- package/src/components/CvDataTable/CvDataTable.stories.mdx +26 -49
- package/src/components/CvDataTable/CvDataTable.vue +45 -45
- package/src/components/CvDataTable/_CvDataTableRowInner.vue +6 -5
- package/src/components/CvDataTable/cvDataTableStore.js +0 -27
- package/src/components/CvDatePicker/CvDatePicker.stories.js +30 -6
- package/src/components/CvDatePicker/CvDatePicker.vue +15 -8
- package/src/components/CvDropdown/CvDropdown.stories.mdx +6 -0
- package/src/components/CvDropdown/CvDropdown.vue +1 -0
- package/src/components/CvList/CvList.vue +1 -0
- package/src/components/CvList/CvListItem.vue +1 -1
- package/src/components/CvNotification/CvInlineNotification.vue +1 -0
- package/src/components/CvNotification/CvToastNotification.vue +1 -0
- package/src/components/CvPagination/CvPagination.stories.mdx +22 -15
- package/src/components/CvPagination/CvPagination.vue +16 -1
- package/src/components/CvTag/CvTag.stories.js +0 -2
- package/src/components/CvTag/CvTag.vue +5 -3
- package/src/index.js +112 -0
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "@carbon/vue",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.15",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -923,6 +923,7 @@
|
|
|
923
923
|
"attributes": [
|
|
924
924
|
{
|
|
925
925
|
"name": "actionBarAriaLabel",
|
|
926
|
+
"description": "Arial label for the action bar.",
|
|
926
927
|
"value": {
|
|
927
928
|
"kind": "expression",
|
|
928
929
|
"type": "string"
|
|
@@ -931,6 +932,7 @@
|
|
|
931
932
|
},
|
|
932
933
|
{
|
|
933
934
|
"name": "collapseAllAriaLabel",
|
|
935
|
+
"description": "Arial label for the \"collapse all\" button in tables with expandable rows\".",
|
|
934
936
|
"value": {
|
|
935
937
|
"kind": "expression",
|
|
936
938
|
"type": "string"
|
|
@@ -939,6 +941,7 @@
|
|
|
939
941
|
},
|
|
940
942
|
{
|
|
941
943
|
"name": "expandAllAriaLabel",
|
|
944
|
+
"description": "Arial label for the \"expand all\" button in tables with expandable rows\".",
|
|
942
945
|
"value": {
|
|
943
946
|
"kind": "expression",
|
|
944
947
|
"type": "string"
|
|
@@ -947,6 +950,7 @@
|
|
|
947
950
|
},
|
|
948
951
|
{
|
|
949
952
|
"name": "selectAllAriaLabel",
|
|
953
|
+
"description": "Arial label for the \"select all\" button in tables with selectable rows\".",
|
|
950
954
|
"value": {
|
|
951
955
|
"kind": "expression",
|
|
952
956
|
"type": "string"
|
|
@@ -1086,7 +1090,7 @@
|
|
|
1086
1090
|
},
|
|
1087
1091
|
{
|
|
1088
1092
|
"name": "zebra",
|
|
1089
|
-
"description": "
|
|
1093
|
+
"description": "`true` to use Zebra style striping.",
|
|
1090
1094
|
"value": {
|
|
1091
1095
|
"kind": "expression",
|
|
1092
1096
|
"type": "boolean"
|
|
@@ -1111,8 +1115,18 @@
|
|
|
1111
1115
|
},
|
|
1112
1116
|
"default": "[]"
|
|
1113
1117
|
},
|
|
1118
|
+
{
|
|
1119
|
+
"name": "stickyBatchActive",
|
|
1120
|
+
"description": "Normally batch actions are hidden if no items are selected. Set this to true to always show batch actions",
|
|
1121
|
+
"value": {
|
|
1122
|
+
"kind": "expression",
|
|
1123
|
+
"type": "boolean"
|
|
1124
|
+
},
|
|
1125
|
+
"default": "false"
|
|
1126
|
+
},
|
|
1114
1127
|
{
|
|
1115
1128
|
"name": "helperText",
|
|
1129
|
+
"description": "subtext on the table",
|
|
1116
1130
|
"value": {
|
|
1117
1131
|
"kind": "expression",
|
|
1118
1132
|
"type": "string"
|
|
@@ -1121,6 +1135,7 @@
|
|
|
1121
1135
|
},
|
|
1122
1136
|
{
|
|
1123
1137
|
"name": "expandingSearch",
|
|
1138
|
+
"description": "Animate the search bar opening",
|
|
1124
1139
|
"value": {
|
|
1125
1140
|
"kind": "expression",
|
|
1126
1141
|
"type": "boolean"
|
|
@@ -1129,6 +1144,7 @@
|
|
|
1129
1144
|
},
|
|
1130
1145
|
{
|
|
1131
1146
|
"name": "skeleton",
|
|
1147
|
+
"description": "Show table loading / skeleton state",
|
|
1132
1148
|
"value": {
|
|
1133
1149
|
"kind": "expression",
|
|
1134
1150
|
"type": "boolean"
|
|
@@ -1137,6 +1153,7 @@
|
|
|
1137
1153
|
},
|
|
1138
1154
|
{
|
|
1139
1155
|
"name": "hasExpandAll",
|
|
1156
|
+
"description": "Should the expand all button be available",
|
|
1140
1157
|
"value": {
|
|
1141
1158
|
"kind": "expression",
|
|
1142
1159
|
"type": "boolean"
|
|
@@ -1154,6 +1171,7 @@
|
|
|
1154
1171
|
},
|
|
1155
1172
|
{
|
|
1156
1173
|
"name": "onSearch",
|
|
1174
|
+
"description": "User defined search action",
|
|
1157
1175
|
"value": {
|
|
1158
1176
|
"kind": "expression",
|
|
1159
1177
|
"type": "func"
|
|
@@ -4740,7 +4758,7 @@
|
|
|
4740
4758
|
"kind": "expression",
|
|
4741
4759
|
"type": "string"
|
|
4742
4760
|
},
|
|
4743
|
-
"default": "
|
|
4761
|
+
"default": "undefined"
|
|
4744
4762
|
},
|
|
4745
4763
|
{
|
|
4746
4764
|
"name": "filter",
|
package/package.json
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/vue",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.16",
|
|
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
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"postinstall": "npx ibmtelemetry --config=telemetry.yml || true",
|
|
12
|
+
"pack_postinstall": "echo removed by packrat.js",
|
|
13
|
+
"prepack": "node packrat.js --disable",
|
|
14
|
+
"postpack": "node packrat.js --enable",
|
|
14
15
|
"build": "vue-cli-service build --target lib --name carbon-vue-3 ./src/index.js --no-clean",
|
|
15
16
|
"lint": "vue-cli-service lint",
|
|
16
17
|
"build-web-types": "vue-docgen-web-types --outFile dist/web-types.json",
|
|
17
|
-
"
|
|
18
|
+
"add-components-exports": "node addNamedComponentExports.js",
|
|
19
|
+
"ci-check": "yarn add-components-exports && yarn format:diff && yarn test && yarn build && yarn build-web-types",
|
|
18
20
|
"format": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{build,es,lib,storybook,ts,umd,.coverage}/**'",
|
|
19
21
|
"format:diff": "prettier --list-different '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
|
|
20
22
|
"format:staged": "prettier --write '**/*.{scss,css,js,md,vue}' '!**/{dist,storybook-static,.coverage}/**'",
|
|
@@ -22,14 +24,15 @@
|
|
|
22
24
|
"lint:es": "eslint src/**/*.{js,vue}",
|
|
23
25
|
"lint:style": "vue-cli-service lint:style",
|
|
24
26
|
"serve:storybook": "cd ./storybook && yarn run serve",
|
|
25
|
-
"test": "vue-cli-service test:unit --no-coverage"
|
|
27
|
+
"test": "vue-cli-service test:unit --no-coverage",
|
|
28
|
+
"dev_postinstall": "node devPreinstall.js && node .storybook/postinstall.js"
|
|
26
29
|
},
|
|
27
30
|
"workspaces": [
|
|
28
31
|
"storybook"
|
|
29
32
|
],
|
|
30
33
|
"dependencies": {
|
|
31
34
|
"@carbon/icons-vue": "^10.60.0",
|
|
32
|
-
"@ibm/telemetry-js": "^1.
|
|
35
|
+
"@ibm/telemetry-js": "^1.5.1",
|
|
33
36
|
"@vueuse/core": "^4.11.2",
|
|
34
37
|
"carbon-components": "^10.58.5",
|
|
35
38
|
"eslint-plugin-prettier-vue": "^4.2.0",
|
|
@@ -41,6 +44,7 @@
|
|
|
41
44
|
"@babel/eslint-parser": "^7.17.0",
|
|
42
45
|
"@commitlint/cli": "^16.3.0",
|
|
43
46
|
"@commitlint/config-conventional": "^16.2.4",
|
|
47
|
+
"@npmcli/package-json": "^5.1.0",
|
|
44
48
|
"@testing-library/dom": "^8.19.0",
|
|
45
49
|
"@testing-library/user-event": "^14.4.3",
|
|
46
50
|
"@testing-library/vue": "^6.6.1",
|
|
@@ -65,7 +69,6 @@
|
|
|
65
69
|
"jest": "^27.5.1",
|
|
66
70
|
"lerna": "^6.5.1",
|
|
67
71
|
"lint-staged": "^12.5.0",
|
|
68
|
-
"pinst": "^3.0.0",
|
|
69
72
|
"postcss": "^8.4.19",
|
|
70
73
|
"postcss-loader": "^6.2.1",
|
|
71
74
|
"prettier": "^2.8.0",
|
|
@@ -176,5 +179,5 @@
|
|
|
176
179
|
"url": "git+https://github.com/carbon-design-system/carbon-components-vue.git"
|
|
177
180
|
},
|
|
178
181
|
"sideEffects": true,
|
|
179
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "64dbb4ba7ebb1c2a27ce3888aa5b7d1526b9c05c"
|
|
180
183
|
}
|
|
@@ -80,10 +80,10 @@ const props = defineProps({
|
|
|
80
80
|
// Track focus
|
|
81
81
|
let hasFocus = ref(false);
|
|
82
82
|
function onFocus() {
|
|
83
|
-
hasFocus = true;
|
|
83
|
+
hasFocus.value = true;
|
|
84
84
|
}
|
|
85
85
|
function onBlur() {
|
|
86
|
-
hasFocus = false;
|
|
86
|
+
hasFocus.value = false;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const cvId = useCvId(props);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
v-bind="subProps"
|
|
5
|
+
class="cv-code-snippet"
|
|
6
|
+
@copy="handleCopy"
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
</component>
|
|
5
10
|
</template>
|
|
6
11
|
|
|
7
12
|
<script>
|
|
@@ -6,7 +6,7 @@ import CvDataTableCell from "./CvDataTableCell.vue";
|
|
|
6
6
|
import CvDataTableAction from "./CvDataTableAction.vue";
|
|
7
7
|
import CvDataTableSkeleton from "./CvDataTableSkeleton.vue";
|
|
8
8
|
import CvButton from '../CvButton/CvButton.vue'
|
|
9
|
-
import { sbCompPrefix } from '../../global/storybook-utils';
|
|
9
|
+
import { sbCompPrefix, storySourceCode } from '../../global/storybook-utils';
|
|
10
10
|
import { action } from '@storybook/addon-actions';
|
|
11
11
|
import { Terminal16 as CompileIcon, Debug16 as DebugIcon, Chip16 as EmbedIcon,
|
|
12
12
|
TrashCan16 as TrashCanIcon} from '@carbon/icons-vue'
|
|
@@ -76,14 +76,14 @@ setup() {
|
|
|
76
76
|
skeletonCols: args.skeletonCols,
|
|
77
77
|
skeletonTitle: args.title,
|
|
78
78
|
skeletonHelper: args.helperText,
|
|
79
|
-
testData
|
|
79
|
+
testData,
|
|
80
80
|
};
|
|
81
81
|
},
|
|
82
82
|
// And then the `args` are bound to your component with `v-bind="args"`
|
|
83
83
|
template: args.template,
|
|
84
84
|
});
|
|
85
85
|
const defaultTemplate = `
|
|
86
|
-
<cv-data-table
|
|
86
|
+
<cv-data-table v-bind="args"
|
|
87
87
|
@search="onSearch"
|
|
88
88
|
@sort="onSort"
|
|
89
89
|
@row-select-change="onRowSelectChange"
|
|
@@ -91,12 +91,11 @@ const defaultTemplate = `
|
|
|
91
91
|
@overflow-menu-click="onOverflowMenuClick"
|
|
92
92
|
@row-expanded="onRowExpanded"
|
|
93
93
|
@pagination="onPagination"
|
|
94
|
-
v-bind="args"
|
|
95
94
|
>
|
|
96
|
-
<template v-if="useBatchActions"
|
|
95
|
+
<template v-if="useBatchActions" #batch-actions>
|
|
97
96
|
<cv-button :icon="trashIcon" @click="onDelete">Delete</cv-button>
|
|
98
97
|
</template>
|
|
99
|
-
<template v-if="useActions"
|
|
98
|
+
<template v-if="useActions" #actions>
|
|
100
99
|
<cv-data-table-action @click="onAction1" aria-label="compile" alt="compile">
|
|
101
100
|
<compile-icon>
|
|
102
101
|
<title>Compile</title>
|
|
@@ -142,6 +141,16 @@ const skeletonTemplate = `
|
|
|
142
141
|
:rows="skeletonRows"
|
|
143
142
|
:title="skeletonTitle"
|
|
144
143
|
:helperText="skeletonHelper">
|
|
144
|
+
<template v-if="useBatchActions" #batch-actions>
|
|
145
|
+
<cv-button :icon="trashIcon" @click="onDelete">Delete</cv-button>
|
|
146
|
+
</template>
|
|
147
|
+
<template v-if="useActions" #actions>
|
|
148
|
+
<cv-data-table-action @click="onAction1" aria-label="compile" alt="compile">
|
|
149
|
+
<compile-icon>
|
|
150
|
+
<title>Compile</title>
|
|
151
|
+
</compile-icon>
|
|
152
|
+
</cv-data-table-action>
|
|
153
|
+
</template>
|
|
145
154
|
</cv-data-table-skeleton>
|
|
146
155
|
`;
|
|
147
156
|
|
|
@@ -184,6 +193,8 @@ completion for it. See [discussion](https://github.com/vuejs/core/issues/3432) f
|
|
|
184
193
|
- The Vue 3 implementation uses an internal store to manage the state of the table. You can see updates
|
|
185
194
|
to the state by setting the debug variable in the local storage. `localStorage.debug="cv:data-table-store"`
|
|
186
195
|
and then reloading the page.
|
|
196
|
+
- If you were using something like `this.$refs.tableEditPath.batchActive = true` to force batch actions to show even
|
|
197
|
+
when no items were select, please now use the new property `stickyBatchActive`.
|
|
187
198
|
|
|
188
199
|
<Canvas>
|
|
189
200
|
<Story
|
|
@@ -206,9 +217,10 @@ and then reloading the page.
|
|
|
206
217
|
'items-selected',
|
|
207
218
|
'of-n-pages',
|
|
208
219
|
'range-text',
|
|
209
|
-
'skeleton'
|
|
220
|
+
'skeleton',
|
|
221
|
+
'update:rowsSelected',
|
|
210
222
|
] },
|
|
211
|
-
docs: { source: { code: defaultTemplate.
|
|
223
|
+
docs: { source: { code: storySourceCode(defaultTemplate, Template.args) } },
|
|
212
224
|
}}
|
|
213
225
|
args={{
|
|
214
226
|
template: defaultTemplate,
|
|
@@ -248,8 +260,9 @@ and then reloading the page.
|
|
|
248
260
|
'of-n-pages',
|
|
249
261
|
'range-text',
|
|
250
262
|
'skeleton',
|
|
263
|
+
'update:rowsSelected',
|
|
251
264
|
] },
|
|
252
|
-
docs: { source: { code: expandingRowsTemplate.
|
|
265
|
+
docs: { source: { code: storySourceCode(expandingRowsTemplate, Template.args) } },
|
|
253
266
|
}}
|
|
254
267
|
args={{
|
|
255
268
|
template: expandingRowsTemplate,
|
|
@@ -273,46 +286,8 @@ and then reloading the page.
|
|
|
273
286
|
<Story
|
|
274
287
|
name="Skeleton"
|
|
275
288
|
parameters={{
|
|
276
|
-
controls: {
|
|
277
|
-
|
|
278
|
-
'actionBarAriaLabel',
|
|
279
|
-
'autoWidth',
|
|
280
|
-
'batchCancelLabel',
|
|
281
|
-
'borderless',
|
|
282
|
-
'collapseAllAriaLabel',
|
|
283
|
-
'expandAllAriaLabel',
|
|
284
|
-
'expandingSearch',
|
|
285
|
-
'hasExpandAll',
|
|
286
|
-
'initialSearchValue',
|
|
287
|
-
'overflowMenu',
|
|
288
|
-
'rowSize',
|
|
289
|
-
'rowsSelected',
|
|
290
|
-
'searchClearLabel',
|
|
291
|
-
'searchLabel',
|
|
292
|
-
'searchPlaceholder',
|
|
293
|
-
'selectAllAriaLabel',
|
|
294
|
-
'skeleton',
|
|
295
|
-
'sortable',
|
|
296
|
-
'staticWidth',
|
|
297
|
-
'stickyHeader',
|
|
298
|
-
'zebra',
|
|
299
|
-
'overflow-menu-click',
|
|
300
|
-
'pagination',
|
|
301
|
-
'row-expanded',
|
|
302
|
-
'actions',
|
|
303
|
-
'batch-actions',
|
|
304
|
-
'data',
|
|
305
|
-
'headings',
|
|
306
|
-
'row-select-change',
|
|
307
|
-
'row-select-changes',
|
|
308
|
-
'sort',
|
|
309
|
-
'helper-text',
|
|
310
|
-
'items-selected',
|
|
311
|
-
'of-n-pages',
|
|
312
|
-
'range-text',
|
|
313
|
-
'columns'
|
|
314
|
-
] },
|
|
315
|
-
docs: { source: { code: skeletonTemplate.replace('v-bind="args"', '') } },
|
|
289
|
+
controls: { include: [ 'skeletonCols', 'skeletonRows', 'title', 'helperText', 'useBatchActions', 'useActions'] },
|
|
290
|
+
docs: { source: { code: storySourceCode(skeletonTemplate, Template.args) } },
|
|
316
291
|
}}
|
|
317
292
|
args={{
|
|
318
293
|
template: skeletonTemplate,
|
|
@@ -320,6 +295,8 @@ and then reloading the page.
|
|
|
320
295
|
helperText: 'Data has been requested...',
|
|
321
296
|
skeletonRows: 5,
|
|
322
297
|
skeletonCols: 5,
|
|
298
|
+
useBatchActions: false,
|
|
299
|
+
useActions: false
|
|
323
300
|
}}
|
|
324
301
|
argTypes={{
|
|
325
302
|
}}
|
|
@@ -157,7 +157,9 @@
|
|
|
157
157
|
v-if="hasBatchActions"
|
|
158
158
|
:class="`${carbonPrefix}--table-column-checkbox`"
|
|
159
159
|
>
|
|
160
|
+
<cv-checkbox-skeleton v-if="isSkeleton" />
|
|
160
161
|
<cv-checkbox
|
|
162
|
+
v-else
|
|
161
163
|
v-model="headingChecked"
|
|
162
164
|
:form-item="false"
|
|
163
165
|
value="headingCheck"
|
|
@@ -229,7 +231,7 @@ import CvDataTableHeading from './CvDataTableHeading.vue';
|
|
|
229
231
|
import CvDataTableRow from './CvDataTableRow.vue';
|
|
230
232
|
import CvDataTableCell from './CvDataTableCell.vue';
|
|
231
233
|
import CvButton from '../CvButton';
|
|
232
|
-
import CvCheckbox from '../CvCheckbox';
|
|
234
|
+
import { CvCheckbox, CvCheckboxSkeleton } from '../CvCheckbox';
|
|
233
235
|
import CvPagination from '../CvPagination';
|
|
234
236
|
import Search16 from '@carbon/icons-vue/es/search/16';
|
|
235
237
|
import Close16 from '@carbon/icons-vue/es/close/16';
|
|
@@ -254,37 +256,31 @@ import store from './cvDataTableStore';
|
|
|
254
256
|
import Empty from '../CvEmpty/_CvEmpty.vue';
|
|
255
257
|
|
|
256
258
|
const props = defineProps({
|
|
259
|
+
/** Arial label for the action bar. */
|
|
257
260
|
actionBarAriaLabel: { type: String, default: 'Table Action Bar' },
|
|
261
|
+
/** Arial label for the "collapse all" button in tables with expandable rows". */
|
|
258
262
|
collapseAllAriaLabel: { type: String, default: 'Collapse all rows' },
|
|
263
|
+
/** Arial label for the "expand all" button in tables with expandable rows". */
|
|
259
264
|
expandAllAriaLabel: { type: String, default: 'Expand all rows' },
|
|
265
|
+
/** Arial label for the "select all" button in tables with selectable rows". */
|
|
260
266
|
selectAllAriaLabel: { type: String, default: 'Select all rows' },
|
|
261
|
-
/**
|
|
262
|
-
* Table will size use auto sizing
|
|
263
|
-
*/
|
|
267
|
+
/** Table will size use auto sizing */
|
|
264
268
|
autoWidth: { type: Boolean, default: false },
|
|
265
|
-
/**
|
|
266
|
-
* Label for the button to cancel batch actions
|
|
267
|
-
*/
|
|
269
|
+
/** Label for the button to cancel batch actions */
|
|
268
270
|
batchCancelLabel: { type: String, default: 'Cancel' },
|
|
269
|
-
/**
|
|
270
|
-
* Table will have no border
|
|
271
|
-
*/
|
|
271
|
+
/** Table will have no border */
|
|
272
272
|
borderless: { type: Boolean, default: false },
|
|
273
273
|
/**
|
|
274
274
|
* An array of overflow menu labels. On click CvDataTable will raise an 'overflow-menu-click' event passing an object containing menuIndex, menuLabel and rowValue
|
|
275
275
|
* - As part of the array pass an object containing props for the overflowMenu. E.g. { label: 'Overflow menu', tipAlignment: 'end', tipPosition: 'top' },
|
|
276
276
|
*/
|
|
277
277
|
overflowMenu: { type: [Boolean, Array], default: () => [] },
|
|
278
|
-
/**
|
|
279
|
-
* can be set to true or an object containing camel case props for a CvPagination component
|
|
280
|
-
*/
|
|
278
|
+
/** can be set to true or an object containing camel case props for a CvPagination component */
|
|
281
279
|
pagination: {
|
|
282
280
|
type: [Boolean, Object],
|
|
283
281
|
default: false,
|
|
284
282
|
},
|
|
285
|
-
/**
|
|
286
|
-
* 'compact', 'small', or 'tall'
|
|
287
|
-
*/
|
|
283
|
+
/** 'compact', 'small', or 'tall' */
|
|
288
284
|
rowSize: {
|
|
289
285
|
type: String,
|
|
290
286
|
default: 'lg',
|
|
@@ -310,13 +306,9 @@ const props = defineProps({
|
|
|
310
306
|
searchLabel: { type: String, default: 'Search' },
|
|
311
307
|
searchPlaceholder: { type: String, default: 'Search' },
|
|
312
308
|
searchClearLabel: { type: String, default: 'Clear search' },
|
|
313
|
-
/**
|
|
314
|
-
* Set text in search bar on table generation
|
|
315
|
-
*/
|
|
309
|
+
/** Set text in search bar on table generation */
|
|
316
310
|
initialSearchValue: { type: String, default: '' },
|
|
317
|
-
/**
|
|
318
|
-
* can be sorted
|
|
319
|
-
*/
|
|
311
|
+
/** can be sorted */
|
|
320
312
|
sortable: { type: Boolean, default: false },
|
|
321
313
|
/** Table will have expandable rows */
|
|
322
314
|
expandable: { type: Boolean, default: false },
|
|
@@ -331,35 +323,39 @@ const props = defineProps({
|
|
|
331
323
|
* - Optionally a sortable property - if any column sets this to true then only columns with sortable set to true are sortable. NOTE: table sortable property not required.
|
|
332
324
|
*/
|
|
333
325
|
columns: { type: Array, default: () => [] },
|
|
334
|
-
/**
|
|
335
|
-
* Two-dimensional array of strings.
|
|
336
|
-
*/
|
|
326
|
+
/** Two-dimensional array of strings. */
|
|
337
327
|
data: { type: Array, default: () => [] },
|
|
338
|
-
/**
|
|
339
|
-
* the table striped
|
|
340
|
-
*/
|
|
328
|
+
/** `true` to use Zebra style striping. */
|
|
341
329
|
zebra: { type: Boolean, default: false },
|
|
342
|
-
/**
|
|
343
|
-
* Specify whether the header should be sticky. Still experimental: may not work with every combination of table props.
|
|
344
|
-
*/
|
|
330
|
+
/** Specify whether the header should be sticky. Still experimental: may not work with every combination of table props. */
|
|
345
331
|
stickyHeader: { type: Boolean, default: false },
|
|
346
|
-
/**
|
|
347
|
-
* An array containing the selected row values. Supports v-model via the row-select-changes event.
|
|
348
|
-
*/
|
|
332
|
+
/** An array containing the selected row values. Supports v-model via the row-select-changes event. */
|
|
349
333
|
rowsSelected: { type: Array, default: () => [] },
|
|
334
|
+
/** Normally batch actions are hidden if no items are selected. Set this to true to always show batch actions */
|
|
335
|
+
stickyBatchActive: { type: Boolean, default: false },
|
|
336
|
+
/** subtext on the table */
|
|
350
337
|
helperText: { type: String, default: undefined },
|
|
338
|
+
/** Animate the search bar opening */
|
|
351
339
|
expandingSearch: { type: Boolean, default: true },
|
|
340
|
+
/** Show table loading / skeleton state */
|
|
352
341
|
skeleton: { type: Boolean, default: false },
|
|
342
|
+
/** Should the expand all button be available */
|
|
353
343
|
hasExpandAll: { type: Boolean, default: false },
|
|
354
|
-
/**
|
|
355
|
-
* Use a width of 'auto' instead of 100%
|
|
356
|
-
*/
|
|
344
|
+
/** Use a width of 'auto' instead of 100% */
|
|
357
345
|
staticWidth: { type: Boolean, default: false },
|
|
346
|
+
/** User defined search action */
|
|
358
347
|
onSearch: { type: Function, default: undefined },
|
|
359
348
|
...propsCvId,
|
|
360
349
|
});
|
|
361
350
|
const uid = useCvId(props, true);
|
|
362
351
|
|
|
352
|
+
const isSkeleton = ref(props.skeleton);
|
|
353
|
+
provide('is-skeleton', isSkeleton);
|
|
354
|
+
watch(
|
|
355
|
+
() => props.skeleton,
|
|
356
|
+
() => (isSkeleton.value = props.skeleton)
|
|
357
|
+
);
|
|
358
|
+
|
|
363
359
|
let bus = undefined;
|
|
364
360
|
onBeforeMount(() => {
|
|
365
361
|
bus = getBus(uid.value);
|
|
@@ -419,12 +415,12 @@ onUpdated(checkSlots);
|
|
|
419
415
|
|
|
420
416
|
const hasActions = ref(false);
|
|
421
417
|
const hasToolbar = ref(false);
|
|
422
|
-
const hasBatchActions =
|
|
423
|
-
|
|
424
|
-
|
|
418
|
+
const hasBatchActions = ref(false);
|
|
419
|
+
provide('has-batch-actions', hasBatchActions);
|
|
420
|
+
|
|
425
421
|
function checkSlots() {
|
|
426
422
|
// NOTE: slots is not reactive so needs to be managed on updated
|
|
427
|
-
|
|
423
|
+
hasBatchActions.value = !!slots['batch-actions'];
|
|
428
424
|
hasActions.value = !!slots.actions;
|
|
429
425
|
hasToolbar.value = !!(
|
|
430
426
|
slots.actions ||
|
|
@@ -531,7 +527,14 @@ function checkSearchExpand(force) {
|
|
|
531
527
|
}
|
|
532
528
|
|
|
533
529
|
const dataRowsSelected = ref(props.rowsSelected);
|
|
534
|
-
const batchActive =
|
|
530
|
+
const batchActive = computed(() => {
|
|
531
|
+
return (
|
|
532
|
+
props.stickyBatchActive ||
|
|
533
|
+
dataRowsSelected.value.length > 0 ||
|
|
534
|
+
headingChecked.value
|
|
535
|
+
);
|
|
536
|
+
});
|
|
537
|
+
|
|
535
538
|
const headingChecked = ref(false);
|
|
536
539
|
|
|
537
540
|
watch(
|
|
@@ -555,7 +558,6 @@ function updateRowsSelected() {
|
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
560
|
headingChecked.value = dataRowsSelected.value.length === rows.length;
|
|
558
|
-
batchActive.value = dataRowsSelected.value.length > 0;
|
|
559
561
|
}
|
|
560
562
|
|
|
561
563
|
const emit = defineEmits([
|
|
@@ -581,7 +583,6 @@ function onClearClick() {
|
|
|
581
583
|
}
|
|
582
584
|
function onHeadingCheckChange() {
|
|
583
585
|
// check /uncheck all children
|
|
584
|
-
batchActive.value = headingChecked.value;
|
|
585
586
|
dataRowsSelected.value = [];
|
|
586
587
|
const rows = store.rows(uid);
|
|
587
588
|
for (const child of rows) {
|
|
@@ -617,7 +618,6 @@ function onRowCheckChange(payload) {
|
|
|
617
618
|
dataRowsSelected.value = Array.from(modelSet);
|
|
618
619
|
const rows = store.rows(uid);
|
|
619
620
|
headingChecked.value = dataRowsSelected.value.length === rows.length;
|
|
620
|
-
batchActive.value = dataRowsSelected.value.length > 0;
|
|
621
621
|
|
|
622
622
|
emit('row-select-change', { value, selected: checked });
|
|
623
623
|
emit('row-select-changes', dataRowsSelected.value);
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
v-if="hasBatchActions"
|
|
27
27
|
:class="`${carbonPrefix}--table-column-checkbox`"
|
|
28
28
|
>
|
|
29
|
+
<cv-checkbox-skeleton v-if="isSkeleton" />
|
|
29
30
|
<cv-checkbox
|
|
31
|
+
v-else
|
|
30
32
|
ref="rowChecked"
|
|
31
33
|
v-model="dataChecked"
|
|
32
34
|
:form-item="false"
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
:label="
|
|
36
38
|
ariaLabelForBatchCheckbox || `Select row ${value} for batch action`
|
|
37
39
|
"
|
|
38
|
-
hide-label
|
|
40
|
+
:hide-label="true"
|
|
39
41
|
@change="onChange"
|
|
40
42
|
/>
|
|
41
43
|
</td>
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
|
|
62
64
|
<script setup>
|
|
63
65
|
import { carbonPrefix } from '../../global/settings';
|
|
64
|
-
import CvCheckbox from '../CvCheckbox';
|
|
66
|
+
import { CvCheckbox, CvCheckboxSkeleton } from '../CvCheckbox';
|
|
65
67
|
import CvOverflowMenu from '../CvOverflowMenu';
|
|
66
68
|
import CvOverflowMenuItem from '../CvOverflowMenu/CvOverflowMenuItem.vue';
|
|
67
69
|
import ChevronRight16 from '@carbon/icons-vue/es/chevron--right/16';
|
|
@@ -89,6 +91,7 @@ const props = defineProps({
|
|
|
89
91
|
rowId: { type: String, default: undefined },
|
|
90
92
|
});
|
|
91
93
|
|
|
94
|
+
const isSkeleton = inject('is-skeleton', ref(false));
|
|
92
95
|
/** @type {Ref<UnwrapRef<Set<>>>} */
|
|
93
96
|
const expandingRowIds = inject('expanding-row-ids', ref(new Set()));
|
|
94
97
|
const dataSomeExpandingRows = computed(() => {
|
|
@@ -132,9 +135,7 @@ onMounted(() => {
|
|
|
132
135
|
bus = getBus(parent);
|
|
133
136
|
} else console.warn('data table not found');
|
|
134
137
|
});
|
|
135
|
-
const hasBatchActions =
|
|
136
|
-
return store.hasBatchActions(parent);
|
|
137
|
-
});
|
|
138
|
+
const hasBatchActions = inject('has-batch-actions', ref(false));
|
|
138
139
|
|
|
139
140
|
function onMenuItemClick(val) {
|
|
140
141
|
bus.emit('cv:click', val);
|