vueless 0.0.386 → 0.0.388
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/package.json +2 -2
- package/ui.data-table/UTable.vue +34 -33
- package/ui.data-table/UTableRow.vue +28 -31
- package/ui.data-table/config.js +4 -4
- package/ui.data-table/useAttrs.js +65 -182
- package/ui.form-select/useAttrs.js +1 -1
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.388",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless Component Framework.",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@release-it/bumper": "^6.0.1",
|
|
38
38
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
39
39
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
40
|
-
"@vueless/plugin-vite": "^0.0.
|
|
40
|
+
"@vueless/plugin-vite": "^0.0.63",
|
|
41
41
|
"@vueless/storybook": "^0.0.34",
|
|
42
42
|
"@vueless/web-types": "^0.0.15",
|
|
43
43
|
"autoprefixer": "^10.4.19",
|
package/ui.data-table/UTable.vue
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
v-bind="stickyHeaderAttrs"
|
|
8
8
|
>
|
|
9
9
|
<template v-if="isShownActionsHeader">
|
|
10
|
-
<div v-bind="stickyHeaderCellAttrs
|
|
10
|
+
<div v-bind="stickyHeaderCellAttrs">
|
|
11
11
|
<UCheckbox
|
|
12
12
|
v-if="selectable"
|
|
13
13
|
v-model="selectAll"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</template>
|
|
33
33
|
|
|
34
34
|
<template v-else>
|
|
35
|
-
<div v-bind="stickyHeaderCellAttrs
|
|
35
|
+
<div v-bind="stickyHeaderCellAttrs">
|
|
36
36
|
<UCheckbox
|
|
37
37
|
v-if="selectable"
|
|
38
38
|
v-model="selectAll"
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
<div
|
|
53
53
|
v-for="(column, index) in columns"
|
|
54
54
|
:key="index"
|
|
55
|
-
v-bind="stickyHeaderCellAttrs
|
|
55
|
+
v-bind="stickyHeaderCellAttrs"
|
|
56
|
+
:class="cx([stickyHeaderCellAttrs.class, column.thClass])"
|
|
56
57
|
>
|
|
57
58
|
<template v-if="hasSlotContent($slots[`header-${column.key}`])">
|
|
58
59
|
<!--
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
<td
|
|
91
92
|
v-if="hasSlotContent($slots['before-header'])"
|
|
92
93
|
:colspan="colsCount"
|
|
93
|
-
v-bind="
|
|
94
|
+
v-bind="headerCellBaseAttrs"
|
|
94
95
|
>
|
|
95
96
|
<!--
|
|
96
97
|
@slot Use it to add something before header row.
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
<tr v-if="hasSlotContent($slots['before-header'])" v-bind="headerRowAttrs"></tr>
|
|
104
105
|
|
|
105
106
|
<tr ref="headerRowRef" v-bind="headerRowAttrs">
|
|
106
|
-
<th v-if="selectable" v-bind="
|
|
107
|
+
<th v-if="selectable" v-bind="headerCellCheckboxAttrs">
|
|
107
108
|
<UCheckbox
|
|
108
109
|
v-model="selectAll"
|
|
109
110
|
size="sm"
|
|
@@ -122,7 +123,8 @@
|
|
|
122
123
|
<th
|
|
123
124
|
v-for="(column, index) in normalizedColumns"
|
|
124
125
|
:key="index"
|
|
125
|
-
v-bind="
|
|
126
|
+
v-bind="headerCellBaseAttrs"
|
|
127
|
+
:class="cx([headerCellBaseAttrs.class, column.thClass])"
|
|
126
128
|
>
|
|
127
129
|
<!--
|
|
128
130
|
@slot Use it to customise table column.
|
|
@@ -165,7 +167,11 @@
|
|
|
165
167
|
|
|
166
168
|
<tr
|
|
167
169
|
v-if="isShownDateSeparator(rowIndex) && row.date"
|
|
168
|
-
v-bind="
|
|
170
|
+
v-bind="
|
|
171
|
+
shouldDisplayDateSeparator(rowIndex)
|
|
172
|
+
? bodyRowDateSeparatorCheckedAttrs
|
|
173
|
+
: bodyRowDateSeparatorAttrs
|
|
174
|
+
"
|
|
169
175
|
>
|
|
170
176
|
<td v-bind="bodyCellDateSeparatorAttrs(rowIndex)" :colspan="colsCount">
|
|
171
177
|
<UDivider
|
|
@@ -177,23 +183,14 @@
|
|
|
177
183
|
</tr>
|
|
178
184
|
|
|
179
185
|
<UTableRow
|
|
180
|
-
v-bind="bodyRowAttrs(getRowClasses(row))"
|
|
181
186
|
v-model:selected-rows="selectedRows"
|
|
182
187
|
:selectable="selectable"
|
|
183
188
|
:data-test="`${dataTest}-row`"
|
|
184
189
|
:row="row"
|
|
185
190
|
:columns="columns"
|
|
186
191
|
:config="config"
|
|
187
|
-
:attrs="
|
|
188
|
-
|
|
189
|
-
bodyCellSecondaryAttrs,
|
|
190
|
-
bodyCellSecondaryEmptyAttrs,
|
|
191
|
-
bodyCellNestedCollapseIconAttrs,
|
|
192
|
-
bodyCellNestedExpandIconAttrs,
|
|
193
|
-
bodyCellNestedAttrs,
|
|
194
|
-
bodyCellPrimaryAttrs,
|
|
195
|
-
bodyCheckboxAttrs,
|
|
196
|
-
}"
|
|
192
|
+
:attrs="keysAttrs"
|
|
193
|
+
v-bind="isRowSelected(row) ? bodyRowCheckedAttrs : bodyRowAttrs"
|
|
197
194
|
@click="onClickRow"
|
|
198
195
|
@toggle-row-visibility="onToggleRowVisibility"
|
|
199
196
|
>
|
|
@@ -280,7 +277,7 @@ import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
|
280
277
|
import ULoaderTop from "../ui.loader-top/ULoaderTop.vue";
|
|
281
278
|
import UTableRow from "./UTableRow.vue";
|
|
282
279
|
|
|
283
|
-
import { getDefault } from "../utils/utilUI.js";
|
|
280
|
+
import { getDefault, cx } from "../utils/utilUI.js";
|
|
284
281
|
|
|
285
282
|
import defaultConfig from "./config.js";
|
|
286
283
|
import {
|
|
@@ -421,7 +418,7 @@ const currentLocale = computed(() => merge(defaultConfig.i18n, i18nGlobal, props
|
|
|
421
418
|
const sortedRows = computed(() => {
|
|
422
419
|
const headerKeys = props.columns.map((column) => column.key);
|
|
423
420
|
|
|
424
|
-
return
|
|
421
|
+
return tableRows.value.map((row) => {
|
|
425
422
|
const rowEntries = Object.entries(row);
|
|
426
423
|
|
|
427
424
|
const sortedEntries = new Array(rowEntries.length);
|
|
@@ -501,6 +498,7 @@ const isSelectedAllRows = computed(() => {
|
|
|
501
498
|
|
|
502
499
|
const {
|
|
503
500
|
config,
|
|
501
|
+
keysAttrs,
|
|
504
502
|
wrapperAttrs,
|
|
505
503
|
stickyHeaderCellAttrs,
|
|
506
504
|
stickyHeaderAttrs,
|
|
@@ -511,16 +509,16 @@ const {
|
|
|
511
509
|
bodyRowBeforeAttrs,
|
|
512
510
|
bodyRowBeforeCellAttrs,
|
|
513
511
|
bodyRowAttrs,
|
|
512
|
+
bodyRowCheckedAttrs,
|
|
514
513
|
footerAttrs,
|
|
515
514
|
bodyRowDateSeparatorAttrs,
|
|
516
|
-
|
|
517
|
-
|
|
515
|
+
bodyRowDateSeparatorCheckedAttrs,
|
|
516
|
+
headerCellBaseAttrs,
|
|
517
|
+
headerCellCheckboxAttrs,
|
|
518
518
|
stickyHeaderActionsCheckboxAttrs,
|
|
519
519
|
stickyHeaderCheckboxAttrs,
|
|
520
520
|
headerCheckboxAttrs,
|
|
521
521
|
headerCounterAttrs,
|
|
522
|
-
bodyCellNestedCollapseIconAttrs,
|
|
523
|
-
bodyCellNestedExpandIconAttrs,
|
|
524
522
|
bodyEmptyStateAttrs,
|
|
525
523
|
bodyDateSeparatorAttrs,
|
|
526
524
|
bodyCellDateSeparatorAttrs,
|
|
@@ -530,15 +528,10 @@ const {
|
|
|
530
528
|
tableAttrs,
|
|
531
529
|
headerLoaderAttrs,
|
|
532
530
|
bodyAttrs,
|
|
533
|
-
bodyCellNestedAttrs,
|
|
534
|
-
bodyCellSecondaryAttrs,
|
|
535
|
-
bodyCellSecondaryEmptyAttrs,
|
|
536
531
|
footerRowAttrs,
|
|
537
532
|
stickyFooterRowAttrs,
|
|
538
533
|
hasSlotContent,
|
|
539
534
|
headerAttrs,
|
|
540
|
-
bodyCellPrimaryAttrs,
|
|
541
|
-
bodyCheckboxAttrs,
|
|
542
535
|
} = useAttrs(props, {
|
|
543
536
|
tableRows,
|
|
544
537
|
isShownActionsHeader,
|
|
@@ -594,6 +587,18 @@ function getDateSeparatorLabel(separatorDate) {
|
|
|
594
587
|
: separatorDate;
|
|
595
588
|
}
|
|
596
589
|
|
|
590
|
+
function shouldDisplayDateSeparator(rowIndex) {
|
|
591
|
+
const isPreviousRowChecked = tableRows.value[rowIndex - 1]?.isChecked;
|
|
592
|
+
const isCheckedRowAfter = tableRows.value[rowIndex]?.isChecked;
|
|
593
|
+
const isFirstRowAndNextChecked = rowIndex === 0 && isCheckedRowAfter;
|
|
594
|
+
|
|
595
|
+
return (isPreviousRowChecked && isCheckedRowAfter) || isFirstRowAndNextChecked;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function isRowSelected(row) {
|
|
599
|
+
return Boolean(selectedRows.value.includes(row.id));
|
|
600
|
+
}
|
|
601
|
+
|
|
597
602
|
function setFooterCellWidth(width) {
|
|
598
603
|
const ZERO_WIDTH = 0;
|
|
599
604
|
|
|
@@ -664,10 +669,6 @@ function onClickRow(row) {
|
|
|
664
669
|
emit("clickRow", row);
|
|
665
670
|
}
|
|
666
671
|
|
|
667
|
-
function getRowClasses(row) {
|
|
668
|
-
return selectedRows.value.includes(row.id) ? config.value.bodyRowChecked : "";
|
|
669
|
-
}
|
|
670
|
-
|
|
671
672
|
function onChangeSelectAll(selectAll) {
|
|
672
673
|
if (selectAll && canSelectAll.value) {
|
|
673
674
|
selectedRows.value = getFlatRows(tableRows.value).map((row) => row.id);
|
|
@@ -1,40 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<tr v-bind="$attrs" @click="onClick(props.row)">
|
|
3
|
-
<td
|
|
4
|
-
v-if="selectable"
|
|
5
|
-
:style="getNestedCheckboxShift()"
|
|
6
|
-
v-bind="attrs.bodyCellAttrs(config.bodyCellCheckbox)"
|
|
7
|
-
>
|
|
3
|
+
<td v-if="selectable" :style="getNestedCheckboxShift()" v-bind="bodyCellCheckboxAttrs">
|
|
8
4
|
<UCheckbox
|
|
9
5
|
v-model="selectedRows"
|
|
10
6
|
:data-id="row.id"
|
|
11
7
|
:value="row.id"
|
|
12
8
|
size="sm"
|
|
13
9
|
:data-test="`${dataTest}-body-checkbox`"
|
|
14
|
-
v-bind="
|
|
10
|
+
v-bind="bodyCheckboxAttrs"
|
|
15
11
|
/>
|
|
16
12
|
</td>
|
|
17
13
|
|
|
18
14
|
<td
|
|
19
15
|
v-for="(value, key, index) in getFilteredRow(row, columns)"
|
|
20
16
|
:key="index"
|
|
21
|
-
v-bind="
|
|
17
|
+
v-bind="getCellAttrs(key, row, index)"
|
|
18
|
+
:class="cx([getCellAttrs(key, row, index).class, columns[index].tdClass])"
|
|
22
19
|
>
|
|
23
20
|
<div
|
|
24
21
|
v-if="(row.row || nestedLevel) && index === 0"
|
|
25
22
|
:style="getNestedShift()"
|
|
26
|
-
v-bind="
|
|
23
|
+
v-bind="bodyCellNestedAttrs"
|
|
27
24
|
>
|
|
28
25
|
<UIcon
|
|
29
26
|
v-if="row.row"
|
|
30
27
|
size="xs"
|
|
31
28
|
internal
|
|
32
29
|
interactive
|
|
33
|
-
:name="
|
|
34
|
-
row?.row?.isHidden
|
|
35
|
-
? config.defaults.bodyCellNestedExpandIcon
|
|
36
|
-
: config.defaults.bodyCellNestedCollapseIcon
|
|
37
|
-
"
|
|
30
|
+
:name="row?.row?.isHidden ? config.defaults.expandIcon : config.defaults.collapseIcon"
|
|
38
31
|
color="brand"
|
|
39
32
|
v-bind="toggleIconConfig"
|
|
40
33
|
@click="onClickToggleRowChild(row.row.id)"
|
|
@@ -43,18 +36,14 @@
|
|
|
43
36
|
|
|
44
37
|
<div v-if="value?.hasOwnProperty('secondary')">
|
|
45
38
|
<slot :name="`cell-${key}`" :value="value" :row="row">
|
|
46
|
-
<div
|
|
47
|
-
v-bind="attrs.bodyCellPrimaryAttrs"
|
|
48
|
-
ref="cellRef"
|
|
49
|
-
:data-test="`${dataTest}-${key}-cell`"
|
|
50
|
-
>
|
|
39
|
+
<div v-bind="bodyCellPrimaryAttrs" ref="cellRef" :data-test="`${dataTest}-${key}-cell`">
|
|
51
40
|
{{ value.primary || HYPHEN_SYMBOL }}
|
|
52
41
|
</div>
|
|
53
42
|
|
|
54
|
-
<div v-bind="
|
|
43
|
+
<div v-bind="bodyCellSecondaryAttrs">
|
|
55
44
|
<template v-if="Array.isArray(value.secondary)">
|
|
56
45
|
<div v-for="(secondary, idx) in value.secondary" ref="cellRef" :key="idx">
|
|
57
|
-
<span v-bind="
|
|
46
|
+
<span v-bind="bodyCellSecondaryEmptyAttrs">
|
|
58
47
|
{{ secondary }}
|
|
59
48
|
</span>
|
|
60
49
|
</div>
|
|
@@ -69,11 +58,7 @@
|
|
|
69
58
|
|
|
70
59
|
<template v-else>
|
|
71
60
|
<slot :name="`cell-${key}`" :value="value" :row="row">
|
|
72
|
-
<div
|
|
73
|
-
v-bind="attrs.bodyCellPrimaryAttrs"
|
|
74
|
-
ref="cellRef"
|
|
75
|
-
:data-test="`${dataTest}-${key}-cell`"
|
|
76
|
-
>
|
|
61
|
+
<div v-bind="bodyCellPrimaryAttrs" ref="cellRef" :data-test="`${dataTest}-${key}-cell`">
|
|
77
62
|
{{ value || value === 0 ? value : HYPHEN_SYMBOL }}
|
|
78
63
|
</div>
|
|
79
64
|
</slot>
|
|
@@ -99,6 +84,7 @@
|
|
|
99
84
|
|
|
100
85
|
<script setup>
|
|
101
86
|
import { computed, onMounted, ref } from "vue";
|
|
87
|
+
import { cx } from "../utils/utilUI.js";
|
|
102
88
|
|
|
103
89
|
import { HYPHEN_SYMBOL } from "../constants.js";
|
|
104
90
|
import { getFilteredRow } from "./utilTable.js";
|
|
@@ -158,10 +144,21 @@ const cellRef = ref([]);
|
|
|
158
144
|
|
|
159
145
|
useMutationObserver(cellRef, setCellTitle, { childList: true });
|
|
160
146
|
|
|
147
|
+
const {
|
|
148
|
+
bodyCellPrimaryAttrs,
|
|
149
|
+
bodyCellSecondaryAttrs,
|
|
150
|
+
bodyCellSecondaryEmptyAttrs,
|
|
151
|
+
bodyCellCheckboxAttrs,
|
|
152
|
+
bodyCheckboxAttrs,
|
|
153
|
+
bodyCellNestedAttrs,
|
|
154
|
+
bodyCellNestedExpandIconAttrs,
|
|
155
|
+
bodyCellNestedCollapseIconAttrs,
|
|
156
|
+
bodyCellNestedRowAttrs,
|
|
157
|
+
bodyCellBaseAttrs,
|
|
158
|
+
} = props.attrs;
|
|
159
|
+
|
|
161
160
|
const toggleIconConfig = computed(() =>
|
|
162
|
-
props.row?.row?.isHidden
|
|
163
|
-
? props.attrs.bodyCellNestedExpandIconAttrs
|
|
164
|
-
: props.attrs.bodyCellNestedCollapseIconAttrs,
|
|
161
|
+
props.row?.row?.isHidden ? bodyCellNestedExpandIconAttrs : bodyCellNestedCollapseIconAttrs,
|
|
165
162
|
);
|
|
166
163
|
|
|
167
164
|
const shift = computed(() => (props.row.row ? 1.5 : 2));
|
|
@@ -170,10 +167,10 @@ onMounted(() => {
|
|
|
170
167
|
cellRef.value.forEach(setElementTitle);
|
|
171
168
|
});
|
|
172
169
|
|
|
173
|
-
function
|
|
174
|
-
const isNestedRow = (row.row || props.nestedLevel) && cellIndex === 0;
|
|
170
|
+
function getCellAttrs(key, row, cellIndex) {
|
|
171
|
+
const isNestedRow = (row.row || props.nestedLevel > 0) && cellIndex === 0;
|
|
175
172
|
|
|
176
|
-
return
|
|
173
|
+
return isNestedRow ? bodyCellNestedRowAttrs.value : bodyCellBaseAttrs.value;
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
function getNestedShift() {
|
package/ui.data-table/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative",
|
|
3
|
-
|
|
3
|
+
headerCellBase: {
|
|
4
4
|
base: "p-4 first:p-5 text-sm font-normal text-gray-500 text-left text-nowrap",
|
|
5
5
|
variants: {
|
|
6
6
|
compact: {
|
|
@@ -8,7 +8,7 @@ export default /*tw*/ {
|
|
|
8
8
|
},
|
|
9
9
|
},
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
headerCounterBase: "mr-1.5 pr-1.5 font-medium text-sm text-gray-900",
|
|
12
12
|
stickyHeader: "fixed top-0 flex items-center z-30 overflow-hidden rounded-none border",
|
|
13
13
|
stickyHeaderRow: "border-gray-200 bg-white",
|
|
14
14
|
stickyHeaderCell: "flex-none whitespace-nowrap",
|
|
@@ -29,7 +29,6 @@ export default /*tw*/ {
|
|
|
29
29
|
table: "min-w-full border-none text-sm w-full table-fixed",
|
|
30
30
|
header: "border-b border-gray-200",
|
|
31
31
|
headerRow: "",
|
|
32
|
-
headerCell: "",
|
|
33
32
|
headerCellCheckbox: "w-10",
|
|
34
33
|
headerCheckbox: "{UCheckbox}",
|
|
35
34
|
headerCounter: {
|
|
@@ -49,7 +48,7 @@ export default /*tw*/ {
|
|
|
49
48
|
bodyRowAfter: "!p-0",
|
|
50
49
|
bodyRowAfterCell: "py-1",
|
|
51
50
|
bodyRowDateSeparator: "",
|
|
52
|
-
|
|
51
|
+
bodyCellBase: {
|
|
53
52
|
base: "p-[1.125rem] py-5 first:!p-5 truncate align-top last:p-5",
|
|
54
53
|
variants: {
|
|
55
54
|
compact: {
|
|
@@ -57,6 +56,7 @@ export default /*tw*/ {
|
|
|
57
56
|
},
|
|
58
57
|
},
|
|
59
58
|
},
|
|
59
|
+
bodyCellNestedRow: "flex",
|
|
60
60
|
bodyCellPrimary: "text-ellipsis overflow-hidden",
|
|
61
61
|
bodyCellSecondary: "mt-1 text-xs text-gray-500 overflow-hidden text-ellipsis",
|
|
62
62
|
bodyCellSecondaryEmpty: "inline-block",
|
|
@@ -1,200 +1,83 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../composables/useUI.js";
|
|
3
|
+
|
|
2
4
|
import defaultConfig from "./config.js";
|
|
3
|
-
import { cva, cx } from "../utils/utilUI.js";
|
|
4
|
-
import { computed } from "vue";
|
|
5
5
|
|
|
6
6
|
export default function useAttrs(
|
|
7
7
|
props,
|
|
8
8
|
{ tableRows, isShownActionsHeader, isHeaderSticky, isFooterSticky },
|
|
9
9
|
) {
|
|
10
|
-
const { config,
|
|
10
|
+
const { config, getKeysAttrs, hasSlotContent, getExtendingKeysClasses } = useUI(
|
|
11
11
|
defaultConfig,
|
|
12
12
|
() => props.config,
|
|
13
13
|
);
|
|
14
|
-
const attrs = {};
|
|
15
|
-
|
|
16
|
-
const headerCellGeneralClasses = computed(() => {
|
|
17
|
-
return cva(config.value.headerCellGeneral)({
|
|
18
|
-
...props,
|
|
19
|
-
compact: Boolean(props.compact),
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
14
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
const extendingKeys = [
|
|
16
|
+
"headerCounterBase",
|
|
17
|
+
"stickyHeaderActions",
|
|
18
|
+
"stickyHeaderRow",
|
|
19
|
+
"stickyFooter",
|
|
20
|
+
];
|
|
21
|
+
const extendingKeysClasses = getExtendingKeysClasses([
|
|
22
|
+
...extendingKeys,
|
|
23
|
+
"headerCellBase",
|
|
24
|
+
"bodyCellBase",
|
|
25
|
+
"bodyRowChecked",
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const keysAttrs = getKeysAttrs({}, extendingKeys, {
|
|
29
|
+
stickyHeader: {
|
|
30
|
+
extend: computed(() => [
|
|
31
|
+
isShownActionsHeader.value && extendingKeysClasses.stickyHeaderActions.value,
|
|
32
|
+
isShownActionsHeader.value &&
|
|
33
|
+
isHeaderSticky.value &&
|
|
34
|
+
extendingKeysClasses.stickyHeaderActions.value,
|
|
35
|
+
!isShownActionsHeader.value &&
|
|
36
|
+
isHeaderSticky.value &&
|
|
37
|
+
extendingKeysClasses.stickyHeaderRow.value,
|
|
38
|
+
]),
|
|
39
|
+
},
|
|
40
|
+
stickyHeaderCell: {
|
|
41
|
+
base: computed(() => [extendingKeysClasses.headerCellBase.value]),
|
|
42
|
+
},
|
|
43
|
+
headerCounter: {
|
|
44
|
+
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
45
|
+
},
|
|
46
|
+
stickyHeaderCounter: {
|
|
47
|
+
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
48
|
+
},
|
|
49
|
+
stickyHeaderActionsCounter: {
|
|
50
|
+
base: computed(() => [extendingKeysClasses.headerCounterBase.value]),
|
|
51
|
+
},
|
|
52
|
+
headerCellCheckbox: {
|
|
53
|
+
base: computed(() => [extendingKeysClasses.headerCellBase.value]),
|
|
54
|
+
},
|
|
55
|
+
bodyCellNestedRow: {
|
|
56
|
+
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
57
|
+
},
|
|
58
|
+
bodyCellCheckbox: {
|
|
59
|
+
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
60
|
+
},
|
|
61
|
+
bodyRowBeforeCell: {
|
|
62
|
+
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
63
|
+
},
|
|
64
|
+
bodyRowAfterCell: {
|
|
65
|
+
base: computed(() => [extendingKeysClasses.bodyCellBase.value]),
|
|
66
|
+
},
|
|
67
|
+
footer: {
|
|
68
|
+
extend: computed(() => [isFooterSticky.value && extendingKeysClasses.stickyFooter.value]),
|
|
69
|
+
},
|
|
70
|
+
bodyRowBefore: {
|
|
71
|
+
extend: computed(() => [
|
|
72
|
+
tableRows.value[0]?.isChecked && extendingKeysClasses.bodyRowChecked.value,
|
|
73
|
+
]),
|
|
74
|
+
},
|
|
28
75
|
});
|
|
29
76
|
|
|
30
|
-
for (const key in defaultConfig) {
|
|
31
|
-
if (isSystemKey(key)) continue;
|
|
32
|
-
|
|
33
|
-
const classes = computed(() => {
|
|
34
|
-
let value = config.value[key];
|
|
35
|
-
|
|
36
|
-
if (isCVA(value)) {
|
|
37
|
-
value = cva(value)({
|
|
38
|
-
...props,
|
|
39
|
-
compact: Boolean(props.compact),
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return value;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
47
|
-
|
|
48
|
-
if (key === "stickyHeader") {
|
|
49
|
-
const stickyHeaderAttrs = attrs[`${key}Attrs`];
|
|
50
|
-
|
|
51
|
-
attrs[`${key}Attrs`] = computed(() => {
|
|
52
|
-
const actionHeaderClasses = cx([
|
|
53
|
-
stickyHeaderAttrs.value.class,
|
|
54
|
-
config.value.stickyHeaderActions,
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
const actionHeaderStickyClasses = cx([
|
|
58
|
-
config.value.stickyHeaderActions,
|
|
59
|
-
stickyHeaderAttrs.value.class,
|
|
60
|
-
]);
|
|
61
|
-
|
|
62
|
-
const stickyHeaderRowClasses = cx([
|
|
63
|
-
stickyHeaderAttrs.value.class,
|
|
64
|
-
config.value.stickyHeaderRow,
|
|
65
|
-
]);
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
...stickyHeaderAttrs.value,
|
|
69
|
-
class: cx([
|
|
70
|
-
isShownActionsHeader.value && actionHeaderClasses,
|
|
71
|
-
isShownActionsHeader.value && isHeaderSticky.value && actionHeaderStickyClasses,
|
|
72
|
-
!isShownActionsHeader.value && isHeaderSticky.value && stickyHeaderRowClasses,
|
|
73
|
-
]),
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (key === "stickyHeaderCell") {
|
|
79
|
-
const stickyHeaderCellAttrs = attrs[`${key}Attrs`];
|
|
80
|
-
|
|
81
|
-
attrs[`${key}Attrs`] = computed(() => (classes) => ({
|
|
82
|
-
...stickyHeaderCellAttrs,
|
|
83
|
-
class: cx([headerCellGeneralClasses.value, stickyHeaderCellAttrs.value.class, classes]),
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (key === "headerCounter") {
|
|
88
|
-
const headerCounterAttrs = attrs[`${key}Attrs`];
|
|
89
|
-
|
|
90
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
91
|
-
...headerCounterAttrs.value,
|
|
92
|
-
class: cx([config.value.headerCounterGeneral, headerCounterAttrs.value.class]),
|
|
93
|
-
}));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (key === "stickyHeaderCounter") {
|
|
97
|
-
const stickyHeaderCounterAttrs = attrs[`${key}Attrs`];
|
|
98
|
-
|
|
99
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
100
|
-
...stickyHeaderCounterAttrs.value,
|
|
101
|
-
class: cx([config.value.headerCounterGeneral, stickyHeaderCounterAttrs.value.class]),
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (key === "stickyHeaderActionsCounter") {
|
|
106
|
-
const stickyHeaderActionsCounterAttrs = attrs[`${key}Attrs`];
|
|
107
|
-
|
|
108
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
109
|
-
...stickyHeaderActionsCounterAttrs.value,
|
|
110
|
-
class: cx([config.value.headerCounterGeneral, stickyHeaderActionsCounterAttrs.value.class]),
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (key === "headerCell") {
|
|
115
|
-
const headerCellAttrs = attrs[`${key}Attrs`];
|
|
116
|
-
|
|
117
|
-
attrs[`${key}Attrs`] = computed(() => (classes) => ({
|
|
118
|
-
...headerCellAttrs.value,
|
|
119
|
-
class: cx([headerCellGeneralClasses.value, headerCellAttrs.value.class, classes]),
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (key === "bodyCell") {
|
|
124
|
-
const bodyCellAttrs = attrs[`${key}Attrs`];
|
|
125
|
-
|
|
126
|
-
attrs[`${key}Attrs`] = computed(() => (classes) => ({
|
|
127
|
-
...bodyCellAttrs.value,
|
|
128
|
-
class: cx([bodyCellClasses.value, bodyCellAttrs.value.class, classes]),
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (key === "bodyRowBeforeCell") {
|
|
133
|
-
const bodyRowBeforeCellAttrs = attrs[`${key}Attrs`];
|
|
134
|
-
|
|
135
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
136
|
-
...bodyRowBeforeCellAttrs.value,
|
|
137
|
-
class: cx([bodyCellClasses.value, bodyRowBeforeCellAttrs.value.class]),
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (key === "bodyRowAfterCell") {
|
|
142
|
-
const bodyRowAfterCellAttrs = attrs[`${key}Attrs`];
|
|
143
|
-
|
|
144
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
145
|
-
...bodyRowAfterCellAttrs.value,
|
|
146
|
-
class: cx([bodyCellClasses.value, bodyRowAfterCellAttrs.value.class]),
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (key === "bodyRow") {
|
|
151
|
-
const bodyRowAttrs = attrs[`${key}Attrs`];
|
|
152
|
-
|
|
153
|
-
attrs[`${key}Attrs`] = computed(() => (row) => ({
|
|
154
|
-
...bodyRowAttrs.value,
|
|
155
|
-
class: cx([bodyRowAttrs.value.class, row]),
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (key === "footer") {
|
|
160
|
-
const footerAttrs = attrs[`${key}Attrs`];
|
|
161
|
-
|
|
162
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
163
|
-
...footerAttrs.value,
|
|
164
|
-
class: cx([footerAttrs.value.class, isFooterSticky.value && config.value.stickyFooter]),
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (key === "bodyRowBefore") {
|
|
169
|
-
const bodyRowBeforeAttrs = attrs[`${key}Attrs`];
|
|
170
|
-
|
|
171
|
-
attrs[`${key}Attrs`] = computed(() => ({
|
|
172
|
-
...bodyRowBeforeAttrs.value,
|
|
173
|
-
class: cx([
|
|
174
|
-
bodyRowBeforeAttrs.value.class,
|
|
175
|
-
tableRows.value[0]?.isChecked ? config.value.bodyRowChecked : "",
|
|
176
|
-
]),
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (key === "bodyRowDateSeparator") {
|
|
181
|
-
attrs[`${key}Attrs`] = (rowIndex) => {
|
|
182
|
-
const isCheckedRowBefore = tableRows.value[rowIndex - 1]?.isChecked;
|
|
183
|
-
const isCheckedRowAfter = tableRows.value[rowIndex]?.isChecked;
|
|
184
|
-
|
|
185
|
-
const activeClass =
|
|
186
|
-
(isCheckedRowBefore && isCheckedRowAfter) || (rowIndex === 0 && isCheckedRowAfter)
|
|
187
|
-
? config.value.bodyRowChecked
|
|
188
|
-
: "";
|
|
189
|
-
|
|
190
|
-
return getAttrs("bodyRowDateSeparator", { classes: activeClass }).value;
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
77
|
return {
|
|
196
|
-
...attrs,
|
|
197
78
|
config,
|
|
79
|
+
keysAttrs,
|
|
80
|
+
...keysAttrs,
|
|
198
81
|
hasSlotContent,
|
|
199
82
|
};
|
|
200
83
|
}
|
|
@@ -15,7 +15,7 @@ export default function useAttrs(props, { isTop, isOpen, selectedLabel: selected
|
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
17
|
const extendingKeys = ["caret", "wrapperActive", "labelWrapperActive", "labelWrapperTop"];
|
|
18
|
-
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys);
|
|
18
|
+
const extendingKeysClasses = getExtendingKeysClasses(extendingKeys, mutatedProps);
|
|
19
19
|
|
|
20
20
|
const keysAttrs = getKeysAttrs(mutatedProps, extendingKeys, {
|
|
21
21
|
wrapper: {
|