vueless 0.0.385 → 0.0.387

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.385",
3
+ "version": "0.0.387",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -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(column.thClass)"
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="headerCellAttrs()"
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="headerCellAttrs(config.headerCellCheckbox)">
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="headerCellAttrs(column.thClass)"
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="bodyRowDateSeparatorAttrs(rowIndex)"
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
- bodyCellAttrs,
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 props.rows.map((row) => {
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
- headerCellAttrs,
517
- bodyCellAttrs,
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="attrs.bodyCheckboxAttrs"
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="attrs.bodyCellAttrs(getCellClasses(key, row, index))"
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="attrs.bodyCellNestedAttrs"
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="attrs.bodyCellSecondaryAttrs">
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="attrs.bodyCellSecondaryEmptyAttrs">
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 getCellClasses(key, row, cellIndex) {
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 [props.columns.find((column) => column.key === key)?.tdClass, isNestedRow && "flex"];
173
+ return isNestedRow ? bodyCellNestedRowAttrs.value : bodyCellBaseAttrs.value;
177
174
  }
178
175
 
179
176
  function getNestedShift() {
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative",
3
- headerCellGeneral: {
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
- headerCounterGeneral: "mr-1.5 pr-1.5 font-medium text-sm text-gray-900",
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
- bodyCell: {
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, getAttrs, hasSlotContent, isSystemKey, isCVA } = useUI(
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 bodyCellClasses = computed(() => {
24
- return cva(config.value.bodyCell)({
25
- ...props,
26
- compact: Boolean(props.compact),
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: {
@@ -17,12 +17,12 @@
17
17
  <slot
18
18
  v-else
19
19
  name="placeholder"
20
- :icon-name="placeholderIcon"
20
+ :icon-name="placeholderIcon || config.defaults.placeholderIcon"
21
21
  :icon-color="componentColor"
22
22
  :icon-size="size"
23
23
  >
24
24
  <UIcon
25
- :name="placeholderIcon"
25
+ :name="placeholderIcon || config.defaults.placeholderIcon"
26
26
  :color="componentColor"
27
27
  :size="size"
28
28
  v-bind="placeholderIconAttrs"
@@ -54,7 +54,7 @@ const props = defineProps({
54
54
  },
55
55
 
56
56
  /**
57
- * Avatar label (user name, nickname, etc.).
57
+ * Avatar label (username, nickname, etc.).
58
58
  */
59
59
  label: {
60
60
  type: String,
@@ -62,7 +62,7 @@ const props = defineProps({
62
62
  },
63
63
 
64
64
  /**
65
- * Avatar icon placeholder.
65
+ * Avatar placeholder icon.
66
66
  */
67
67
  placeholderIcon: {
68
68
  type: String,
@@ -23,19 +23,19 @@ defineOptions({ inheritAttrs: false });
23
23
 
24
24
  const props = defineProps({
25
25
  /**
26
- * Icon SVG data source (svg as a vue component).
26
+ * Icon name.
27
27
  */
28
- src: {
29
- type: [String, Object],
28
+ name: {
29
+ type: String,
30
30
  default: "",
31
31
  },
32
32
 
33
33
  /**
34
- * Name of the icon.
34
+ * Icon source (svg as a vue component).
35
35
  */
36
- name: {
37
- type: String,
38
- default: "",
36
+ src: {
37
+ type: Object,
38
+ default: () => {},
39
39
  },
40
40
 
41
41
  /**
@@ -66,7 +66,7 @@ const props = defineProps({
66
66
  },
67
67
 
68
68
  /**
69
- * Add interactive states to the icon (hover, clicked).
69
+ * Make the icon interactive (cursor pointer, etc.).
70
70
  */
71
71
  interactive: {
72
72
  type: Boolean,
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.385",
4
+ "version": "0.0.387",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -339,7 +339,7 @@
339
339
  },
340
340
  {
341
341
  "name": "label",
342
- "description": "Avatar label (user name, nickname, etc.).",
342
+ "description": "Avatar label (username, nickname, etc.).",
343
343
  "value": {
344
344
  "kind": "expression",
345
345
  "type": "string"
@@ -348,7 +348,7 @@
348
348
  },
349
349
  {
350
350
  "name": "placeholderIcon",
351
- "description": "Avatar icon placeholder.",
351
+ "description": "Avatar placeholder icon.",
352
352
  "value": {
353
353
  "kind": "expression",
354
354
  "type": "string"
@@ -4253,22 +4253,22 @@
4253
4253
  "description": "",
4254
4254
  "attributes": [
4255
4255
  {
4256
- "name": "src",
4257
- "description": "Icon SVG data source (svg as a vue component).",
4256
+ "name": "name",
4257
+ "description": "Icon name.",
4258
4258
  "value": {
4259
4259
  "kind": "expression",
4260
- "type": "string|object"
4260
+ "type": "string"
4261
4261
  },
4262
4262
  "default": "\"\""
4263
4263
  },
4264
4264
  {
4265
- "name": "name",
4266
- "description": "Name of the icon.",
4265
+ "name": "src",
4266
+ "description": "Icon source (svg as a vue component).",
4267
4267
  "value": {
4268
4268
  "kind": "expression",
4269
- "type": "string"
4269
+ "type": "object"
4270
4270
  },
4271
- "default": "\"\""
4271
+ "default": "() => {}"
4272
4272
  },
4273
4273
  {
4274
4274
  "name": "color",
@@ -4299,7 +4299,7 @@
4299
4299
  },
4300
4300
  {
4301
4301
  "name": "interactive",
4302
- "description": "Add interactive states to the icon (hover, clicked).",
4302
+ "description": "Make the icon interactive (cursor pointer, etc.).",
4303
4303
  "value": {
4304
4304
  "kind": "expression",
4305
4305
  "type": "boolean"