@carbon/vue 3.0.21 → 3.0.22
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 +686 -1162
- package/dist/carbon-vue-3.common.js.map +1 -1
- package/dist/carbon-vue-3.umd.js +686 -1162
- 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 +1 -1
- package/package.json +4 -4
- package/src/components/CvAspectRatio/CvAspectRatio.stories.js +2 -5
- package/src/components/CvBreadcrumb/CvBreadcrumb.stories.js +2 -5
- package/src/components/CvButton/CvButton.stories.js +1 -3
- package/src/components/CvButton/CvButtonSet.stories.js +2 -6
- package/src/components/CvButton/CvButtonSkeleton.stories.js +1 -3
- package/src/components/CvButton/CvIconButton.stories.js +1 -3
- package/src/components/CvCheckbox/CvCheckbox.stories.js +1 -2
- package/src/components/CvCodeSnippet/CvCodeSnippet.stories.js +1 -2
- package/src/components/CvComboBox/CvComboBox.stories.js +2 -5
- package/src/components/CvCopyButton/CvCopyButton.stories.js +2 -5
- package/src/components/CvDataTable/CvDataTable.stories.mdx +56 -9
- package/src/components/CvDataTable/CvDataTable.vue +71 -97
- package/src/components/CvDataTable/CvDataTableHeading.vue +25 -45
- package/src/components/CvDataTable/CvDataTableRow.vue +46 -50
- package/src/components/CvDataTable/_CvDataTableRowInner.vue +9 -18
- package/src/components/CvDatePicker/CvDatePicker.stories.js +2 -5
- package/src/components/CvDatePicker/CvDatePicker.vue +1 -1
- package/src/components/CvLink/CvLink.stories.js +1 -2
- package/src/components/CvList/CvList.stories.js +2 -5
- package/src/components/CvLoading/CvLoading.stories.js +2 -5
- package/src/components/CvMultiSelect/CvMultiSelect.vue +4 -1
- package/src/components/CvNotification/CvInlineNotification.stories.js +2 -2
- package/src/components/CvNotification/CvToastNotification.stories.js +2 -2
- package/src/components/CvNumberInput/CvNumberInput.stories.js +2 -6
- package/src/components/CvNumberInput/CvNumberInputSkeleton.stories.js +2 -6
- package/src/components/CvRadioButton/CvRadioButton.stories.js +2 -5
- package/src/components/CvSkeletonText/CvSkeletonText.stories.js +2 -5
- package/src/components/CvSlider/CvSlider.stories.js +2 -6
- package/src/components/CvSlider/CvSliderSkeleton.stories.js +2 -6
- package/src/components/CvStructuredList/CvStructuredList.stories.js +2 -5
- package/src/components/CvTag/CvTag.stories.js +2 -5
- package/src/components/CvTag/CvTagSkeleton.stories.js +2 -5
- package/src/components/CvTextArea/CvTextArea.stories.js +2 -6
- package/src/components/CvTextArea/CvTextAreaSkeleton.stories.js +2 -6
- package/src/components/CvTextInput/CvTextInput.stories.js +2 -5
- package/src/components/CvToggle/CvToggle.stories.js +2 -5
- package/src/components/CvTooltip/CvDefinitionTooltip.stories.js +2 -6
- package/src/components/CvTooltip/CvInteractiveTooltip.stories.js +2 -6
- package/src/components/CvTooltip/CvTooltip.stories.js +2 -6
- package/src/use/overflow.js +2 -2
- package/src/components/CvDataTable/cvDataTableStore.js +0 -314
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sbCompPrefix,
|
|
3
|
-
storyParametersObject,
|
|
4
|
-
} from '../../global/storybook-utils';
|
|
1
|
+
import { storyParametersObject } from '../../global/storybook-utils';
|
|
5
2
|
|
|
6
3
|
import { CvToggle } from '.';
|
|
7
4
|
import { CvToggleSkeleton } from '.';
|
|
@@ -20,7 +17,7 @@ const initArgsMinimal = {
|
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
export default {
|
|
23
|
-
title:
|
|
20
|
+
title: 'Component/CvToggle',
|
|
24
21
|
component: CvToggle,
|
|
25
22
|
parameters: {
|
|
26
23
|
a11y: {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import CvDefinitionTooltip from './CvDefinitionTooltip.vue';
|
|
2
|
-
import {
|
|
3
|
-
sbCompPrefix,
|
|
4
|
-
storyParametersObject,
|
|
5
|
-
} from '../../global/storybook-utils';
|
|
2
|
+
import { storyParametersObject } from '../../global/storybook-utils';
|
|
6
3
|
import { alignments, directions } from './consts';
|
|
7
|
-
import { sbTooltipPrefix } from './sbTooltipPrefix';
|
|
8
4
|
|
|
9
5
|
export default {
|
|
10
|
-
title:
|
|
6
|
+
title: 'Component/CvDefinitionTooltip',
|
|
11
7
|
component: CvDefinitionTooltip,
|
|
12
8
|
argTypes: {
|
|
13
9
|
alignment: {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import CvInteractiveTooltip from './CvInteractiveTooltip.vue';
|
|
2
|
-
import {
|
|
3
|
-
sbCompPrefix,
|
|
4
|
-
storyParametersObject,
|
|
5
|
-
} from '../../global/storybook-utils';
|
|
2
|
+
import { storyParametersObject } from '../../global/storybook-utils';
|
|
6
3
|
import { alignments, directions } from './consts';
|
|
7
|
-
import { sbTooltipPrefix } from './sbTooltipPrefix';
|
|
8
4
|
import Filter16 from '@carbon/icons-vue/es/filter/16';
|
|
9
5
|
|
|
10
6
|
export default {
|
|
11
|
-
title:
|
|
7
|
+
title: 'Component/CvInteractiveTooltip',
|
|
12
8
|
component: CvInteractiveTooltip,
|
|
13
9
|
argTypes: {
|
|
14
10
|
alignment: {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import CvTooltip from './CvTooltip.vue';
|
|
2
|
-
import {
|
|
3
|
-
sbCompPrefix,
|
|
4
|
-
storyParametersObject,
|
|
5
|
-
} from '../../global/storybook-utils';
|
|
2
|
+
import { storyParametersObject } from '../../global/storybook-utils';
|
|
6
3
|
import { alignments, directions } from './consts';
|
|
7
|
-
import { sbTooltipPrefix } from './sbTooltipPrefix';
|
|
8
4
|
|
|
9
5
|
export default {
|
|
10
|
-
title:
|
|
6
|
+
title: 'Component/CvTooltip',
|
|
11
7
|
component: CvTooltip,
|
|
12
8
|
argTypes: {
|
|
13
9
|
alignment: {
|
package/src/use/overflow.js
CHANGED
|
@@ -13,8 +13,8 @@ export const useElementHasOverflow = element => {
|
|
|
13
13
|
const scrollWidth = ref(0);
|
|
14
14
|
|
|
15
15
|
const updateStaticValues = () => {
|
|
16
|
-
clientWidth.value = element.value
|
|
17
|
-
scrollWidth.value = element.value
|
|
16
|
+
clientWidth.value = element.value?.clientWidth;
|
|
17
|
+
scrollWidth.value = element.value?.scrollWidth;
|
|
18
18
|
};
|
|
19
19
|
const debouncedUpdateStaticValues = useDebounceFn(
|
|
20
20
|
updateStaticValues,
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
//TODO: Remove this store and replace with provide/inject
|
|
2
|
-
import { reactive, unref } from 'vue';
|
|
3
|
-
let loggerEnabled = false;
|
|
4
|
-
try {
|
|
5
|
-
loggerEnabled = localStorage
|
|
6
|
-
?.getItem('debug')
|
|
7
|
-
?.split(' ')
|
|
8
|
-
.includes('cv:data-table-store');
|
|
9
|
-
} catch (e) {
|
|
10
|
-
// ignore
|
|
11
|
-
}
|
|
12
|
-
// eslint-disable-next-line no-console
|
|
13
|
-
const logger = loggerEnabled ? console.debug : () => {};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {string|ComputedRef<string>|Ref<string>} CvTableDataString
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Row Data
|
|
21
|
-
* @typedef {Object} CvRowData
|
|
22
|
-
* @property {CvTableDataString} id - row id
|
|
23
|
-
* @property {string} value? - used to determine which rows are selected
|
|
24
|
-
* @property {boolean} expandable - True if the row can be expended via a click
|
|
25
|
-
* @property {boolean} isExpanded - True if the row is currently expanded
|
|
26
|
-
* @property {boolean} isChecked - True is the row is currently selected via the checkbox in the row
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Row update data
|
|
31
|
-
* @typedef {Object} CvRowDataChecked
|
|
32
|
-
* @property {CvTableDataString} id - heading id
|
|
33
|
-
* @property {boolean} isChecked - True is the row is currently selected via the checkbox in the row
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Row update data
|
|
38
|
-
* @typedef {Object} CvRowDataExpanded
|
|
39
|
-
* @property {CvTableDataString} id - heading id
|
|
40
|
-
* @property {boolean} isExpanded - True if the row is currently expanded
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Row update data
|
|
45
|
-
* @typedef {Object} CvRowDataExpandable
|
|
46
|
-
* @property {CvTableDataString} id - heading id
|
|
47
|
-
* @property {boolean} expandable - True if the row can be expended via a click
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {CvRowData|CvRowDataChecked|CvRowDataExpanded|CvRowDataExpandable} CvRowDataUpdate
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Heading data
|
|
56
|
-
* @typedef {Object} CvHeadingData
|
|
57
|
-
* @property {CvTableDataString} id - heading id
|
|
58
|
-
* @property {string} name? - name of the heading which can be used by sort
|
|
59
|
-
* @property {CvTableDataString} order - sort order for this heading
|
|
60
|
-
* @property {boolean} sortable - Is the heading sortable?
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Heading update data
|
|
65
|
-
* @typedef {Object} CvHeadingDataSortable
|
|
66
|
-
* @property {CvTableDataString} id - heading id
|
|
67
|
-
* @property {boolean} sortable - Is the heading sortable?
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Heading update data
|
|
72
|
-
* @typedef {Object} CvHeadingDataOrder
|
|
73
|
-
* @property {CvTableDataString} id - heading id
|
|
74
|
-
* @property {CvTableDataString} order - sort order for this heading
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @typedef {CvHeadingData|CvHeadingDataSortable|CvHeadingDataOrder} CvHeadingDataUpdate
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Table data
|
|
83
|
-
* @typedef {Object} CvTableData
|
|
84
|
-
* @property {Array<CvRowData>} rows - table row data
|
|
85
|
-
* @property {Array<CvHeadingData>} headings - table heading data
|
|
86
|
-
* @property {boolean} hasExpandable - At least some rows are expandable
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
export default reactive({
|
|
90
|
-
state: { global: { rows: [], headings: [] } },
|
|
91
|
-
/**
|
|
92
|
-
* Add a new table using the table's id
|
|
93
|
-
* @param {CvTableDataString} tableId
|
|
94
|
-
*/
|
|
95
|
-
addTable(tableId) {
|
|
96
|
-
const table = unref(tableId);
|
|
97
|
-
this.state[table] = {
|
|
98
|
-
rows: [],
|
|
99
|
-
headings: [],
|
|
100
|
-
hasExpandable: false,
|
|
101
|
-
};
|
|
102
|
-
logger(`added table:${table}`);
|
|
103
|
-
},
|
|
104
|
-
/**
|
|
105
|
-
* Remove a table using the table's id
|
|
106
|
-
* @param {CvTableDataString} tableId
|
|
107
|
-
*/
|
|
108
|
-
removeTable(tableId) {
|
|
109
|
-
const table = unref(tableId);
|
|
110
|
-
delete this.state[table];
|
|
111
|
-
logger(`added table:${table}`);
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Get data for a table
|
|
115
|
-
* @param {CvTableDataString} tableId
|
|
116
|
-
* @returns {CvTableData}
|
|
117
|
-
*/
|
|
118
|
-
getTable(tableId) {
|
|
119
|
-
const table = unref(tableId);
|
|
120
|
-
if (!this.state[table]) this.addTable(table);
|
|
121
|
-
return this.state[table];
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Find a heading by table + heading id
|
|
125
|
-
* @param {CvTableDataString} tableId
|
|
126
|
-
* @param {CvTableDataString} headingId
|
|
127
|
-
* @returns {CvHeadingData|undefined}
|
|
128
|
-
*/
|
|
129
|
-
findHeading(tableId, headingId) {
|
|
130
|
-
const table = unref(tableId);
|
|
131
|
-
const id = unref(headingId);
|
|
132
|
-
|
|
133
|
-
const headings = this.headings(table);
|
|
134
|
-
return headings.find(heading => heading.id === id);
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* Get all headings for a table
|
|
138
|
-
* @param {CvTableDataString} tableId
|
|
139
|
-
* @returns {Array<CvHeadingData>}
|
|
140
|
-
*/
|
|
141
|
-
headings(tableId) {
|
|
142
|
-
const table = unref(tableId);
|
|
143
|
-
return this.state[table]?.headings || [];
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* Get all rows for a table
|
|
147
|
-
* @param {CvTableDataString} tableId
|
|
148
|
-
* @returns {Array<CvRowData>}
|
|
149
|
-
*/
|
|
150
|
-
rows(tableId) {
|
|
151
|
-
const table = unref(tableId);
|
|
152
|
-
return this.state[table]?.rows || [];
|
|
153
|
-
},
|
|
154
|
-
/**
|
|
155
|
-
* Are any header sortable
|
|
156
|
-
* @param {CvTableDataString} tableId
|
|
157
|
-
* @returns {boolean}
|
|
158
|
-
*/
|
|
159
|
-
someSortableHeadings(tableId) {
|
|
160
|
-
const table = unref(tableId);
|
|
161
|
-
const headings = this.state[table]?.headings;
|
|
162
|
-
const some = headings?.some(column => column.sortable);
|
|
163
|
-
logger(`get someSortableHeadings:${table} result:${some}`);
|
|
164
|
-
return some;
|
|
165
|
-
},
|
|
166
|
-
/**
|
|
167
|
-
* Update a heading
|
|
168
|
-
* @param {CvTableDataString} tableId
|
|
169
|
-
* @param {CvHeadingDataUpdate} update
|
|
170
|
-
*/
|
|
171
|
-
updateHeading(tableId, update) {
|
|
172
|
-
const table = unref(tableId);
|
|
173
|
-
|
|
174
|
-
if (!this.state[table]) return;
|
|
175
|
-
const headings = this.state[table].headings;
|
|
176
|
-
const index = headings.findIndex(heading => heading.id === update.id);
|
|
177
|
-
if (index === -1) {
|
|
178
|
-
headings.push(update);
|
|
179
|
-
logger(`update heading:${table} payload:${JSON.stringify(update)}`);
|
|
180
|
-
} else {
|
|
181
|
-
const current = headings[index];
|
|
182
|
-
const changes = { ...current, ...update };
|
|
183
|
-
const changed =
|
|
184
|
-
current.name !== changes.name ||
|
|
185
|
-
current.order !== changes.order ||
|
|
186
|
-
current.sortable !== changes.sortable;
|
|
187
|
-
if (changed) {
|
|
188
|
-
headings.splice(index, 1, changes);
|
|
189
|
-
logger(`update heading:${table} payload:${JSON.stringify(update)}`);
|
|
190
|
-
logger(
|
|
191
|
-
`update heading:${table} result:${JSON.stringify(headings[index])}`
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
/**
|
|
197
|
-
* Remove a heading data object from the table
|
|
198
|
-
* @param {CvTableDataString} tableId
|
|
199
|
-
* @param {CvTableDataString} headingId
|
|
200
|
-
*/
|
|
201
|
-
removeHeading(tableId, headingId) {
|
|
202
|
-
const table = unref(tableId);
|
|
203
|
-
const id = unref(headingId);
|
|
204
|
-
logger(`remove heading:${table} payload:${id}`);
|
|
205
|
-
if (!this.state[table]) return;
|
|
206
|
-
const headings = this.state[table].headings;
|
|
207
|
-
const index = headings.findIndex(heading => heading.id === id);
|
|
208
|
-
if (index > -1) headings.splice(index, 1);
|
|
209
|
-
else logger(`remove heading:${table} payload:${id} - heading not found`);
|
|
210
|
-
},
|
|
211
|
-
/**
|
|
212
|
-
* Find a row for using the table & row ids
|
|
213
|
-
* @param {CvTableDataString} tableId
|
|
214
|
-
* @param {CvTableDataString} rowId
|
|
215
|
-
* @returns {CvRowData|undefined}
|
|
216
|
-
*/
|
|
217
|
-
findRow(tableId, rowId) {
|
|
218
|
-
const table = unref(tableId);
|
|
219
|
-
const id = unref(rowId);
|
|
220
|
-
if (!this.state[table]) return undefined;
|
|
221
|
-
return this.state[table].rows.find(row => row.id === id);
|
|
222
|
-
},
|
|
223
|
-
/**
|
|
224
|
-
* Is the given row expanded
|
|
225
|
-
* @param {CvTableDataString} tableId
|
|
226
|
-
* @param {CvTableDataString} rowId
|
|
227
|
-
* @returns {boolean}
|
|
228
|
-
*/
|
|
229
|
-
isRowExpanded(tableId, rowId) {
|
|
230
|
-
const row = this.findRow(tableId, rowId);
|
|
231
|
-
return row?.isExpanded;
|
|
232
|
-
},
|
|
233
|
-
/**
|
|
234
|
-
* Set if any rows are expandable
|
|
235
|
-
* @param {CvTableDataString} tableId
|
|
236
|
-
*/
|
|
237
|
-
setSomeExpandingRows(tableId) {
|
|
238
|
-
const table = unref(tableId);
|
|
239
|
-
if (!this.state[table]) return;
|
|
240
|
-
const rows = this.state[table].rows;
|
|
241
|
-
const some = rows?.some(item => item.expandable);
|
|
242
|
-
logger(`set someExpandingRows:${table} result:${some}`);
|
|
243
|
-
this.state[table].hasExpandable = some;
|
|
244
|
-
},
|
|
245
|
-
/**
|
|
246
|
-
* Are any rows expandable in the given table
|
|
247
|
-
* @param {CvTableDataString} tableId
|
|
248
|
-
* @returns {boolean}
|
|
249
|
-
*/
|
|
250
|
-
someExpandingRows(tableId) {
|
|
251
|
-
const table = unref(tableId);
|
|
252
|
-
if (!table) return false;
|
|
253
|
-
const some = this.state[table]?.hasExpandable;
|
|
254
|
-
logger(`get someExpandingRows:${table} result:${some}`);
|
|
255
|
-
return some;
|
|
256
|
-
},
|
|
257
|
-
/**
|
|
258
|
-
* Are all the table rows expanded
|
|
259
|
-
* @param {CvTableDataString} tableId
|
|
260
|
-
* @returns {boolean}
|
|
261
|
-
*/
|
|
262
|
-
allExpandedRows(tableId) {
|
|
263
|
-
const table = unref(tableId);
|
|
264
|
-
if (!table) return false;
|
|
265
|
-
const rows = this.state[table].rows;
|
|
266
|
-
const every = rows?.every(item => item.isExpanded);
|
|
267
|
-
logger(`get allExpandedRows:${table} result:${every}`);
|
|
268
|
-
return every;
|
|
269
|
-
},
|
|
270
|
-
/**
|
|
271
|
-
* Add or update a row in the table
|
|
272
|
-
* @param {CvTableDataString} tableId
|
|
273
|
-
* @param {CvRowDataUpdate} update
|
|
274
|
-
*/
|
|
275
|
-
updateRow(tableId, update) {
|
|
276
|
-
const table = unref(tableId);
|
|
277
|
-
|
|
278
|
-
if (!this.state[table]) return;
|
|
279
|
-
const rows = this.state[table].rows;
|
|
280
|
-
const index = rows.findIndex(row => row.id === update.id);
|
|
281
|
-
if (index === -1) {
|
|
282
|
-
rows.push(update);
|
|
283
|
-
logger(`update row:${table} payload:${JSON.stringify(update)}`);
|
|
284
|
-
} else {
|
|
285
|
-
const current = rows[index];
|
|
286
|
-
const changes = { ...current, ...update };
|
|
287
|
-
const changed =
|
|
288
|
-
current.value !== changes.value ||
|
|
289
|
-
current.expandable !== changes.expandable ||
|
|
290
|
-
current.isExpanded !== changes.isExpanded ||
|
|
291
|
-
current.isChecked !== changes.isChecked;
|
|
292
|
-
if (changed) {
|
|
293
|
-
rows.splice(index, 1, changes);
|
|
294
|
-
logger(`update row:${table} payload:${JSON.stringify(update)}`);
|
|
295
|
-
logger(`update row:${table} result:${JSON.stringify(rows[index])}`);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
/**
|
|
300
|
-
* Remove a row from the table
|
|
301
|
-
* @param {CvTableDataString} tableId
|
|
302
|
-
* @param {CvTableDataString} rowId
|
|
303
|
-
*/
|
|
304
|
-
removeRow(tableId, rowId) {
|
|
305
|
-
const table = unref(tableId);
|
|
306
|
-
const id = unref(rowId);
|
|
307
|
-
logger(`remove row:${table} payload:${id}`);
|
|
308
|
-
if (!this.state[table]) return;
|
|
309
|
-
const rows = this.state[table].rows;
|
|
310
|
-
const index = rows.findIndex(row => row.id === id);
|
|
311
|
-
if (index > -1) rows.splice(index, 1);
|
|
312
|
-
else logger(`remove row:${table} payload:${id} - row not found`);
|
|
313
|
-
},
|
|
314
|
-
});
|