vueless 0.0.210 → 0.0.211

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.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/ui.container-group/configs/default.config.js +19 -1
  3. package/ui.container-group/index.vue +26 -1
  4. package/ui.container-row/configs/default.config.js +21 -3
  5. package/ui.container-row/index.vue +27 -2
  6. package/ui.data-list/composables/attrs.composable.js +39 -36
  7. package/ui.data-list/configs/default.config.js +6 -4
  8. package/ui.data-list/index.stories.js +2 -4
  9. package/ui.data-list/index.vue +34 -5
  10. package/ui.data-table/composables/attrs.composable.js +180 -245
  11. package/ui.data-table/configs/default.config.js +10 -10
  12. package/ui.data-table/index.vue +52 -12
  13. package/ui.form-checkbox/composables/attrs.composable.js +28 -43
  14. package/ui.form-checkbox/configs/default.config.js +2 -2
  15. package/ui.form-checkbox/index.stories.js +2 -4
  16. package/ui.form-checkbox/index.vue +16 -4
  17. package/ui.form-checkbox-group/composables/attrs.composable.js +24 -9
  18. package/ui.form-checkbox-group/configs/default.config.js +2 -2
  19. package/ui.form-checkbox-group/index.vue +8 -2
  20. package/ui.form-checkbox-multi-state/composables/attrs.composable.js +34 -12
  21. package/ui.form-checkbox-multi-state/configs/default.config.js +1 -1
  22. package/ui.form-checkbox-multi-state/index.vue +8 -2
  23. package/ui.form-input-file/composables/attrs.composable.js +19 -62
  24. package/ui.form-input-file/configs/default.config.js +7 -7
  25. package/ui.form-input-file/index.vue +15 -3
  26. package/ui.form-input-money/composables/attrs.composable.js +23 -4
  27. package/ui.form-input-money/configs/default.config.js +1 -1
  28. package/ui.form-input-money/index.stories.js +2 -4
  29. package/ui.form-input-number/composables/attrs.composable.js +22 -36
  30. package/ui.form-input-number/configs/default.config.js +4 -4
  31. package/ui.form-input-number/index.vue +8 -2
  32. package/ui.form-input-rating/composables/attrs.composable.js +10 -11
  33. package/ui.form-input-rating/index.vue +2 -2
  34. package/ui.form-input-search/composables/attrs.composable.js +26 -11
  35. package/ui.form-input-search/configs/default.config.js +4 -4
  36. package/ui.form-input-search/index.stories.js +2 -4
  37. package/ui.form-input-search/index.vue +21 -4
  38. package/ui.form-label/composables/attrs.composable.js +22 -49
  39. package/ui.form-label/index.vue +9 -2
  40. package/ui.form-radio/composables/attrs.composable.js +29 -22
  41. package/ui.form-radio/configs/default.config.js +1 -1
  42. package/ui.form-radio/index.stories.js +2 -4
  43. package/ui.form-radio/index.vue +8 -2
  44. package/ui.form-radio-group/composables/attrs.composable.js +20 -15
  45. package/ui.form-radio-group/configs/default.config.js +2 -1
  46. package/ui.form-radio-group/index.vue +8 -2
  47. package/ui.form-switch/composables/attrs.composable.js +25 -61
  48. package/ui.form-switch/configs/default.config.js +2 -2
  49. package/ui.form-switch/index.vue +8 -2
  50. package/ui.form-textarea/composables/attrs.composable.js +25 -36
  51. package/ui.form-textarea/configs/default.config.js +1 -1
  52. package/ui.form-textarea/index.stories.js +3 -5
  53. package/ui.form-textarea/index.vue +35 -4
  54. package/ui.navigation-pagination/composables/attrs.composable.js +41 -31
  55. package/ui.navigation-pagination/configs/default.config.js +2 -2
  56. package/ui.navigation-pagination/index.vue +22 -6
  57. package/ui.navigation-progress/components/StepperProgress.vue +1 -1
  58. package/ui.navigation-progress/composables/attrs.composable.js +19 -22
  59. package/ui.navigation-progress/index.vue +14 -1
  60. package/ui.navigation-tab/composables/attrs.composable.js +25 -20
  61. package/ui.navigation-tab/index.vue +1 -1
  62. package/ui.navigation-tabs/composables/attrs.composable.js +19 -13
  63. package/ui.navigation-tabs/configs/default.config.js +1 -1
  64. package/ui.navigation-tabs/index.vue +9 -2
  65. package/ui.text-file/configs/default.config.js +3 -0
  66. package/ui.text-file/index.vue +36 -25
  67. package/ui.text-files/index.vue +8 -0
  68. package/ui.text-header/configs/default.config.js +1 -0
  69. package/ui.text-header/index.stories.js +2 -2
  70. package/ui.text-header/index.vue +16 -12
  71. package/web-types.json +383 -62
@@ -3,263 +3,198 @@ import defaultConfig from "../configs/default.config";
3
3
  import { cva, cx } from "../../service.ui";
4
4
  import { computed } from "vue";
5
5
 
6
- export function useAttrs(
6
+ export default function useAttrs(
7
7
  props,
8
8
  { tableRows, isShownActionsHeader, isHeaderSticky, isFooterSticky },
9
9
  ) {
10
- const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
11
- const {
12
- stickyHeaderCell,
13
- headerCell,
14
- footerRow,
15
- bodyCell,
16
- headerCellGeneral,
17
- stickyHeaderCounter,
18
- headerCounter,
19
- } = config.value;
20
-
21
- const cvaHeaderCellGeneral = cva({
22
- base: headerCellGeneral.base,
23
- variants: headerCellGeneral.variants,
24
- compoundVariants: headerCellGeneral.compoundVariants,
25
- });
26
-
27
- const cvaCustomHeaderItem = cva({
28
- base: stickyHeaderCell.base,
29
- variants: stickyHeaderCell.variants,
30
- compoundVariants: stickyHeaderCell.compoundVariants,
31
- });
32
-
33
- const cvaHeaderCell = cva({
34
- base: headerCell.base,
35
- variants: headerCell.variants,
36
- compoundVariants: headerCell.compoundVariants,
37
- });
38
-
39
- const cvaFooterRow = cva({
40
- base: footerRow.base,
41
- variants: footerRow.variants,
42
- compoundVariants: footerRow.compoundVariants,
43
- });
44
-
45
- const cvaBodyCell = cva({
46
- base: bodyCell.base,
47
- variants: bodyCell.variants,
48
- compoundVariants: bodyCell.compoundVariants,
49
- });
50
-
51
- const cvaStickyHeaderCounter = cva({
52
- base: stickyHeaderCounter.base,
53
- variants: stickyHeaderCounter.variants,
54
- compoundVariants: stickyHeaderCounter.compoundVariants,
55
- });
56
-
57
- const cvaHeaderCounter = cva({
58
- base: headerCounter.base,
59
- variants: headerCounter.variants,
60
- compoundVariants: headerCounter.compoundVariants,
61
- });
62
-
63
- const stickyHeaderCellClasses = computed(() => cvaCustomHeaderItem({ compact: props.compact }));
64
- const headerCellClasses = computed(() => cvaHeaderCell({ compact: props.compact }));
65
- const footerRowClasses = computed(() => cvaFooterRow({ compact: props.compact }));
66
- const bodyCellClasses = computed(() => cvaBodyCell({ compact: props.compact }));
67
- const headerCellGeneralClasses = computed(() => cvaHeaderCellGeneral({ compact: props.compact }));
68
- const headerCounterClasses = computed(() => cvaHeaderCounter({ compact: props.compact }));
69
- const stickyHeaderCounterClasses = computed(() =>
70
- cvaStickyHeaderCounter({ compact: props.compact }),
10
+ const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
11
+ defaultConfig,
12
+ () => props.config,
71
13
  );
14
+ const attrs = {};
72
15
 
73
- const wrapperAttrs = getAttrs("wrapper");
74
- const stickyHeaderAttrsRaw = getAttrs("stickyHeader");
75
- const stickyHeaderCellAttrsRaw = getAttrs("stickyHeaderCell", {
76
- classes: stickyHeaderCellClasses,
77
- });
78
- const headerCounterAttrsRaw = getAttrs("headerCounter", { classes: headerCounterClasses });
79
- const stickyHeaderCounterAttrsRaw = getAttrs("stickyHeaderCounter", {
80
- classes: stickyHeaderCounterClasses,
81
- });
82
- const stickyHeaderActionsCounterAttrsRaw = getAttrs("stickyHeaderActionsCounter");
83
- const stickyHeaderCheckboxAttrs = getAttrs("stickyHeaderCheckbox", {
84
- isComponent: true,
85
- });
86
- const stickyHeaderActionsCheckboxAttrs = getAttrs("stickyHeaderActionsCheckbox", {
87
- isComponent: true,
88
- });
89
- const stickyHeaderLoaderAttrs = getAttrs("stickyHeaderLoader", { isComponent: true });
90
- const tableWrapperAttrs = getAttrs("tableWrapper");
91
- const tableAttrs = getAttrs("table");
92
- const headerAttrs = getAttrs("header");
93
- const headerRowAttrsRaw = getAttrs("headerRow");
94
- const headerCellAttrsRaw = getAttrs("headerCell", { classes: headerCellClasses });
95
- const headerCheckboxAttrs = getAttrs("headerCheckbox", { isComponent: true });
96
- const headerLoaderAttrs = getAttrs("headerLoader", { isComponent: true });
97
- const bodyCellNestedExpandIconAttrs = getAttrs("bodyCellNestedExpandIcon", { isComponent: true });
98
- const bodyCellNestedCollapseIconAttrs = getAttrs("bodyCellNestedCollapseIcon", {
99
- isComponent: true,
100
- });
101
- const bodyAttrs = getAttrs("body");
102
- const bodyCellAttrsRaw = getAttrs("bodyCell", { classes: bodyCellClasses });
103
- const bodyCheckboxAttrs = getAttrs("bodyCheckbox", { isComponent: true });
104
- const bodyCellDateSeparatorAttrs = getAttrs("bodyCellDateSeparator");
105
- const bodyDateSeparatorAttrs = getAttrs("bodyDateSeparator", { isComponent: true });
106
- const bodyCellNestedAttrs = getAttrs("bodyCellNested");
107
- const bodyCellSecondaryAttrs = getAttrs("bodyCellSecondary");
108
- const bodyCellSecondaryEmptyAttrs = getAttrs("bodyCellSecondaryEmpty");
109
- const footerAttrsRaw = getAttrs("footer");
110
- const footerRowAttrs = getAttrs("footerRow", { classes: footerRowClasses });
111
- const stickyFooterRowAttrs = getAttrs("stickyFooterRow");
112
- const bodyEmptyStateAttrs = getAttrs("bodyEmptyState", { isComponent: true });
113
- const bodyRowBeforeAttrsRaw = getAttrs("bodyRowBefore");
114
- const bodyRowBeforeCellAttrsRaw = getAttrs("bodyRowBeforeCell");
115
- const bodyRowAfterAttrs = getAttrs("bodyRowAfter");
116
- const bodyRowAfterCellAttrsRaw = getAttrs("bodyRowAfterCell");
117
- const bodyCellPrimaryAttrs = getAttrs("bodyCellPrimary");
118
-
119
- const bodyRowAttrsRaw = getAttrs("bodyRow");
120
-
121
- const bodyCellAttrs = computed(() => (classes) => ({
122
- ...bodyCellAttrsRaw.value,
123
- class: cx([bodyCellAttrsRaw.value.class, classes || ""]),
124
- }));
125
-
126
- const bodyRowBeforeCellAttrs = computed(() => ({
127
- ...bodyRowBeforeAttrsRaw.value,
128
- class: cx([bodyCellAttrs.value().class, bodyRowBeforeCellAttrsRaw.value.class]),
129
- }));
130
-
131
- const bodyRowAfterCellAttrs = computed(() => ({
132
- ...bodyRowAfterCellAttrsRaw.value,
133
- class: cx([bodyCellAttrs.value().class, bodyRowAfterCellAttrsRaw.value.class]),
134
- }));
135
-
136
- const bodyRowAttrs = computed(() => (row) => ({
137
- ...bodyRowAttrsRaw.value,
138
- class: cx([bodyRowAttrsRaw.value.class, row]),
139
- }));
140
-
141
- const headerCellAttrs = computed(() => (classes) => ({
142
- ...headerCellAttrsRaw.value,
143
- class: cx([headerCellGeneralClasses.value, headerCellAttrsRaw.value.class, classes]),
144
- }));
145
-
146
- const stickyHeaderActionsCounterAttrs = computed(() => ({
147
- ...stickyHeaderActionsCounterAttrsRaw.value,
148
- class: cx([config.value.headerCounterGeneral, stickyHeaderActionsCounterAttrsRaw.value.class]),
149
- }));
150
-
151
- const stickyHeaderCounterAttrs = computed(() => ({
152
- ...stickyHeaderCounterAttrsRaw.value,
153
- class: cx([config.value.headerCounterGeneral, stickyHeaderCounterAttrsRaw.value.class]),
154
- }));
155
-
156
- const headerCounterAttrs = computed(() => ({
157
- ...headerCounterAttrsRaw.value,
158
- class: cx([config.value.headerCounterGeneral, headerCounterAttrsRaw.value.class]),
159
- }));
160
-
161
- const bodyRowBeforeAttrs = computed(() => ({
162
- ...bodyRowBeforeAttrsRaw.value,
163
- class: cx([
164
- bodyRowBeforeAttrsRaw.value.class,
165
- tableRows.value[0]?.isChecked ? config.value.bodyRowChecked : "",
166
- ]),
167
- }));
168
-
169
- const headerRowAttrs = computed(() => {
170
- return {
171
- ...headerRowAttrsRaw.value,
172
- class: cx([headerRowAttrsRaw.value.class]),
173
- };
16
+ const headerCellGeneralClasses = computed(() => {
17
+ return cva(config.value.headerCellGeneral)({
18
+ ...props,
19
+ compact: Boolean(props.compact),
20
+ });
174
21
  });
175
22
 
176
- const stickyHeaderAttrs = computed(() => {
177
- const actionHeaderClasses = cx([
178
- stickyHeaderAttrsRaw.value.class,
179
- config.value.stickyHeaderActions,
180
- ]);
181
-
182
- const actionHeaderStickyClasses = cx([
183
- config.value.stickyHeaderActions,
184
- stickyHeaderAttrsRaw.value.class,
185
- ]);
186
-
187
- const stickyHeaderRowClasses = cx([
188
- stickyHeaderAttrsRaw.value.class,
189
- config.value.stickyHeaderRow,
190
- ]);
191
-
192
- return {
193
- ...stickyHeaderAttrsRaw.value,
194
- class: cx([
195
- isShownActionsHeader.value && actionHeaderClasses,
196
- isShownActionsHeader.value && isHeaderSticky.value && actionHeaderStickyClasses,
197
- !isShownActionsHeader.value && isHeaderSticky.value && stickyHeaderRowClasses,
198
- ]),
199
- };
23
+ const bodyCellClasses = computed(() => {
24
+ return cva(config.value.bodyCell)({
25
+ ...props,
26
+ compact: Boolean(props.compact),
27
+ });
200
28
  });
201
29
 
202
- const footerClassesAttrs = computed(() => ({
203
- ...footerAttrsRaw.value,
204
- class: cx([footerAttrsRaw.value.class, isFooterSticky.value && config.value.stickyFooter]),
205
- }));
206
-
207
- const stickyHeaderCellAttrs = computed(() => (classes) => ({
208
- ...stickyHeaderCellAttrsRaw.value,
209
- class: cx([headerCellGeneralClasses.value, stickyHeaderCellAttrsRaw.value.class, classes]),
210
- }));
211
-
212
- const bodyRowDateSeparatorAttrs = (rowIndex) => {
213
- const isCheckedRowBefore = tableRows.value[rowIndex - 1]?.isChecked;
214
- const isCheckedRowAfter = tableRows.value[rowIndex]?.isChecked;
215
-
216
- const activeClass =
217
- (isCheckedRowBefore && isCheckedRowAfter) || (rowIndex === 0 && isCheckedRowAfter)
218
- ? config.value.bodyRowChecked
219
- : "";
220
-
221
- return getAttrs("bodyRowDateSeparator", { classes: activeClass }).value;
222
- };
30
+ for (const key in defaultConfig) {
31
+ if (isSystemKey(key)) continue;
32
+
33
+ const classes = computed(() => {
34
+ const value = config.value[key];
35
+
36
+ if (value.variants || value.compoundVariants) {
37
+ return cva(value)({
38
+ ...props,
39
+ compact: Boolean(props.compact),
40
+ });
41
+ }
42
+
43
+ return "";
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,
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,
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,
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,
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
+ }
223
194
 
224
195
  return {
196
+ ...attrs,
225
197
  config,
226
- wrapperAttrs,
227
- stickyHeaderCellAttrs,
228
- stickyHeaderAttrs,
229
- tableWrapperAttrs,
230
- headerCellAttrs,
231
- headerRowAttrs,
232
- bodyRowAttrs,
233
- footerClassesAttrs,
234
- bodyRowAfterAttrs,
235
- bodyRowAfterCellAttrs,
236
- bodyRowBeforeAttrs,
237
- bodyRowBeforeCellAttrs,
238
- bodyRowDateSeparatorAttrs,
239
- bodyCellAttrs,
240
- stickyHeaderCounterAttrs,
241
- stickyHeaderActionsCounterAttrs,
242
- headerCounterAttrs,
243
- headerCheckboxAttrs,
244
- bodyCheckboxAttrs,
245
- bodyCellNestedCollapseIconAttrs,
246
- bodyCellNestedExpandIconAttrs,
247
- bodyEmptyStateAttrs,
248
- bodyDateSeparatorAttrs,
249
- bodyCellDateSeparatorAttrs,
250
- stickyHeaderCheckboxAttrs,
251
- stickyHeaderActionsCheckboxAttrs,
252
- stickyHeaderLoaderAttrs,
253
- tableAttrs,
254
- headerLoaderAttrs,
255
- bodyAttrs,
256
- bodyCellNestedAttrs,
257
- bodyCellSecondaryAttrs,
258
- bodyCellSecondaryEmptyAttrs,
259
- footerRowAttrs,
260
- stickyFooterRowAttrs,
261
198
  hasSlotContent,
262
- headerAttrs,
263
- bodyCellPrimaryAttrs,
264
199
  };
265
200
  }
@@ -12,7 +12,7 @@ export default /*tw*/ {
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",
15
- stickyHeaderCheckbox: "",
15
+ stickyHeaderCheckbox: "{UCheckbox}",
16
16
  stickyHeaderCounter: {
17
17
  base: "absolute top-5 left-11 bg-gradient-to-r from-white from-80%",
18
18
  variants: {
@@ -21,9 +21,9 @@ export default /*tw*/ {
21
21
  },
22
22
  },
23
23
  },
24
- stickyHeaderLoader: "",
24
+ stickyHeaderLoader: "{ULoader}",
25
25
  stickyHeaderActions: "absolute rounded-t-lg border-blue-200 bg-blue-50",
26
- stickyHeaderActionsCheckbox: "",
26
+ stickyHeaderActionsCheckbox: "{UCheckbox}",
27
27
  stickyHeaderActionsCounter: "-ml-2",
28
28
  tableWrapper: "border border-gray-200 rounded-lg bg-white",
29
29
  table: "min-w-full border-none text-sm w-full table-fixed",
@@ -31,7 +31,7 @@ export default /*tw*/ {
31
31
  headerRow: "",
32
32
  headerCell: "",
33
33
  headerCellCheckbox: "w-10",
34
- headerCheckbox: "",
34
+ headerCheckbox: "{UCheckbox}",
35
35
  headerCounter: {
36
36
  base: "absolute top-5 mt-px left-11 bg-gradient-to-r from-white from-80% ml-px",
37
37
  variants: {
@@ -40,7 +40,7 @@ export default /*tw*/ {
40
40
  },
41
41
  },
42
42
  },
43
- headerLoader: "absolute !top-auto",
43
+ headerLoader: "{ULoader} absolute !top-auto",
44
44
  body: "group/body divide-none",
45
45
  bodyRow: "hover:bg-gray-50",
46
46
  bodyRowChecked: "bg-gray-100 transition",
@@ -64,18 +64,18 @@ export default /*tw*/ {
64
64
  bodyCellDateSeparator: "",
65
65
  bodyCellNested: "mr-2 mt-0.5",
66
66
  bodyCellNestedExpandIcon: {
67
- wrapper: "rounded-sm",
67
+ wrapper: "{UIcon} rounded-sm",
68
68
  container: "bg-gray-200",
69
69
  },
70
70
  bodyCellNestedExpandIconName: "add",
71
71
  bodyCellNestedCollapseIcon: {
72
- wrapper: "rounded-sm",
72
+ wrapper: "{UIcon} rounded-sm",
73
73
  container: "bg-gray-200",
74
74
  },
75
75
  bodyCellNestedCollapseIconName: "remove",
76
- bodyCheckbox: "",
77
- bodyDateSeparator: "",
78
- bodyEmptyState: "my-8",
76
+ bodyCheckbox: "{UCheckbox}",
77
+ bodyDateSeparator: "{UDivider}",
78
+ bodyEmptyState: "{UEmpty} my-8",
79
79
  footer: "group/footer border-t border-solid border-gray-200",
80
80
  footerRow: {
81
81
  base: "[&_td]:p-[1.125rem] [&_td]:py-5 first:[&_td]:p-5",
@@ -24,7 +24,10 @@
24
24
  v-text="selectedRows.length"
25
25
  />
26
26
 
27
- <!-- @slot Use it to add action buttons instead of table row when some rows are selected. -->
27
+ <!--
28
+ @slot Use it to add action buttons instead of table row when some rows are selected.
29
+ @binding {array} selected-rows
30
+ -->
28
31
  <slot name="header-actions" :selected-rows="selectedRows" />
29
32
  </template>
30
33
 
@@ -52,7 +55,11 @@
52
55
  v-bind="stickyHeaderCellAttrs(column.thClass)"
53
56
  >
54
57
  <template v-if="hasSlotContent($slots[`header-${column.key}`])">
55
- <!-- @slot Use it to customise table column. -->
58
+ <!--
59
+ @slot Use it to customise table column.
60
+ @binding {string} name
61
+ @binding {number} column
62
+ -->
56
63
  <slot :name="`header-${column.key}`" :column="column" />
57
64
  </template>
58
65
 
@@ -60,7 +67,11 @@
60
67
  {{ column.label }}
61
68
  </template>
62
69
 
63
- <!-- @slot Use it to add content after table column. -->
70
+ <!--
71
+ @slot Use it to add something after the table column.
72
+ @binding {string} name
73
+ @binding {number} column
74
+ -->
64
75
  <slot :name="`header-${column.key}-after`" :column="column" />
65
76
  </div>
66
77
  </template>
@@ -81,7 +92,10 @@
81
92
  :colspan="colsCount"
82
93
  v-bind="headerCellAttrs()"
83
94
  >
84
- <!-- @slot Use it to add something before header row. -->
95
+ <!--
96
+ @slot Use it to add something before header row.
97
+ @binding {number} cols-count
98
+ -->
85
99
  <slot name="before-header" :cols-count="colsCount" />
86
100
  </td>
87
101
  </tr>
@@ -110,7 +124,11 @@
110
124
  :key="index"
111
125
  v-bind="headerCellAttrs(column.thClass)"
112
126
  >
113
- <!-- @slot Use it to customise table column. -->
127
+ <!--
128
+ @slot Use it to customise table column.
129
+ @binding {string} name
130
+ @binding {number} column
131
+ -->
114
132
  <slot
115
133
  v-if="hasSlotContent($slots[`header-${column.key}`])"
116
134
  :name="`header-${column.key}`"
@@ -121,7 +139,11 @@
121
139
  {{ column.label }}
122
140
  </template>
123
141
 
124
- <!-- @slot Use it to add content after table column. -->
142
+ <!--
143
+ @slot Use it to add something after the table column.
144
+ @binding {string} name
145
+ @binding {number} column
146
+ -->
125
147
  <slot :name="`header-${column.key}-after`" :column="column" />
126
148
  </th>
127
149
  </tr>
@@ -211,18 +233,24 @@
211
233
  </tr>
212
234
  </tbody>
213
235
 
214
- <tfoot v-if="hasSlotContent($slots['footer'])" v-bind="footerClassesAttrs">
236
+ <tfoot v-if="hasSlotContent($slots['footer'])" v-bind="footerAttrs">
215
237
  <tr ref="footerRowRef" v-bind="footerRowAttrs">
216
238
  <td v-if="selectable" />
217
239
 
218
- <!-- @slot Use it to add something in table footer. -->
240
+ <!--
241
+ @slot Use it to add something into the table footer.
242
+ @binding {number} cols-count
243
+ -->
219
244
  <slot name="footer" :cols-count="colsCount" />
220
245
  </tr>
221
246
 
222
247
  <tr ref="stickyFooterRowRef" :style="tableRowWidthStyle" v-bind="stickyFooterRowAttrs">
223
248
  <td v-if="selectable" />
224
249
 
225
- <!-- @slot Use it to add something in table footer. -->
250
+ <!--
251
+ @slot Use it to add something into the table footer.
252
+ @binding {number} cols-count
253
+ -->
226
254
  <slot name="footer" :cols-count="colsCount" />
227
255
  </tr>
228
256
  </tfoot>
@@ -265,7 +293,7 @@ import {
265
293
 
266
294
  import { PX_IN_REM } from "../service.ui";
267
295
  import { UTable } from "./constants";
268
- import { useAttrs } from "./composables/attrs.composable";
296
+ import useAttrs from "./composables/attrs.composable";
269
297
  import { useLocale } from "../composable.locale";
270
298
 
271
299
  /* Should be a string for correct web-types gen */
@@ -353,7 +381,19 @@ const props = defineProps({
353
381
  },
354
382
  });
355
383
 
356
- const emit = defineEmits(["clickRow", "update:rows"]);
384
+ const emit = defineEmits([
385
+ /**
386
+ * Triggers when the row is clicked.
387
+ * @property {object} row
388
+ */
389
+ "clickRow",
390
+
391
+ /**
392
+ * Triggers when table rows are updated.
393
+ * @property {array} tableRows
394
+ */
395
+ "update:rows",
396
+ ]);
357
397
 
358
398
  defineExpose({ clearSelectedItems });
359
399
 
@@ -444,7 +484,7 @@ const {
444
484
  bodyRowBeforeAttrs,
445
485
  bodyRowBeforeCellAttrs,
446
486
  bodyRowAttrs,
447
- footerClassesAttrs,
487
+ footerAttrs,
448
488
  bodyRowDateSeparatorAttrs,
449
489
  headerCellAttrs,
450
490
  bodyCellAttrs,