vueless 0.0.166 → 0.0.167

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.166",
3
+ "version": "0.0.167",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -31,8 +31,9 @@ export function useAttrs(
31
31
  const stickyHeaderCellAttrsRaw = getAttrs("stickyHeaderCell", {
32
32
  classes: stickyHeaderCellClasses,
33
33
  });
34
- const stickyHeaderCounterAttrs = getAttrs("stickyHeaderCounter");
35
- const stickyHeaderActionsCounterAttrs = getAttrs("stickyHeaderActionsCounter");
34
+ const headerCounterAttrsRaw = getAttrs("headerCounter");
35
+ const stickyHeaderCounterAttrsRaw = getAttrs("stickyHeaderCounter");
36
+ const stickyHeaderActionsCounterAttrsRaw = getAttrs("stickyHeaderActionsCounter");
36
37
  const stickyHeaderCheckboxAttrs = getAttrs("stickyHeaderCheckbox", {
37
38
  isComponent: true,
38
39
  });
@@ -84,7 +85,22 @@ export function useAttrs(
84
85
 
85
86
  const headerCellAttrs = computed(() => (classes) => ({
86
87
  ...headerCellAttrsRaw.value,
87
- class: cx([headerCellAttrsRaw.value.class, classes]),
88
+ class: cx([config.value.headerCellGeneral, headerCellAttrsRaw.value.class, classes]),
89
+ }));
90
+
91
+ const stickyHeaderActionsCounterAttrs = computed(() => ({
92
+ ...stickyHeaderActionsCounterAttrsRaw.value,
93
+ class: cx([config.value.headerCounterGeneral, stickyHeaderActionsCounterAttrsRaw.value.class]),
94
+ }));
95
+
96
+ const stickyHeaderCounterAttrs = computed(() => ({
97
+ ...stickyHeaderCounterAttrsRaw.value,
98
+ class: cx([config.value.headerCounterGeneral, stickyHeaderCounterAttrsRaw.value.class]),
99
+ }));
100
+
101
+ const headerCounterAttrs = computed(() => ({
102
+ ...headerCounterAttrsRaw.value,
103
+ class: cx([config.value.headerCounterGeneral, headerCounterAttrsRaw.value.class]),
88
104
  }));
89
105
 
90
106
  const bodyRowBeforeAttrs = computed(() => ({
@@ -135,7 +151,7 @@ export function useAttrs(
135
151
 
136
152
  const stickyHeaderCellAttrs = computed(() => (classes) => ({
137
153
  ...stickyHeaderCellAttrsRaw.value,
138
- class: cx([stickyHeaderCellAttrsRaw.value.class, classes]),
154
+ class: cx([config.value.headerCellGeneral, stickyHeaderCellAttrsRaw.value.class, classes]),
139
155
  }));
140
156
 
141
157
  const bodyRowDateSeparatorAttrs = (rowIndex) => {
@@ -175,6 +191,7 @@ export function useAttrs(
175
191
  footerCellAttrs,
176
192
  stickyHeaderCounterAttrs,
177
193
  stickyHeaderActionsCounterAttrs,
194
+ headerCounterAttrs,
178
195
  headerCheckboxAttrs,
179
196
  bodyCheckboxAttrs,
180
197
  bodyCellNestedCollapseIconAttrs,
@@ -1,21 +1,24 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative",
3
+ headerCellGeneral: "p-4 text-sm font-normal text-gray-500 text-left",
4
+ headerCounterGeneral: "mr-3 font-medium text-sm text-gray-900",
3
5
  stickyHeader: "fixed top-0 flex items-center z-30 overflow-hidden rounded-none border",
4
6
  stickyHeaderRow: "border-gray-200 bg-white",
5
- stickyHeaderCell: "flex-none text-sm text-gray-500 p-4 whitespace-nowrap",
7
+ stickyHeaderCell: "flex-none whitespace-nowrap",
6
8
  stickyHeaderCheckbox: "",
7
- stickyHeaderCounter: "absolute top-4 left-11 pr-3 font-medium text-sm text-gray-900 bg-gradient-to-r from-white from-80%",
9
+ stickyHeaderCounter: "absolute top-4 left-11 bg-gradient-to-r from-white from-80%",
8
10
  stickyHeaderLoader: "",
9
11
  stickyHeaderActions: "absolute rounded-t-lg border-blue-200 bg-blue-50",
10
12
  stickyHeaderActionsCheckbox: "",
11
- stickyHeaderActionsCounter: "-ml-2.5 mr-3 font-medium text-sm text-gray-900", // style dupliactions
13
+ stickyHeaderActionsCounter: "-ml-2",
12
14
  tableWrapper: "border border-gray-200 rounded-lg bg-white",
13
15
  table: "min-w-full border-none text-sm w-full",
14
16
  header: "border-b border-gray-200",
15
17
  headerRow: "",
16
- headerCell: "p-4 text-sm font-normal text-gray-500 text-left", // style dupliactions
18
+ headerCell: "",
17
19
  headerCellCheckbox: "w-10",
18
20
  headerCheckbox: "",
21
+ headerCounter: "absolute top-4 left-11 bg-gradient-to-r from-white from-80% mt-px ml-px",
19
22
  headerLoader: "absolute !top-auto",
20
23
  body: "group/body divide-none",
21
24
  bodyRow: "hover:bg-gray-50",
@@ -28,7 +31,7 @@ export default /*tw*/ {
28
31
  bodyCell: "",
29
32
  bodyCellSecondary: "mt-1 text-xs text-gray-500",
30
33
  bodyCellSecondaryEmpty: "inline-block",
31
- bodyCellCheckbox: "!px-4", // try to remove important
34
+ bodyCellCheckbox: "first:px-4", // try to remove first
32
35
  bodyCellDateSeparator: "",
33
36
  bodyCellNestedWrapper: "flex items-center",
34
37
  bodyCellNested: "flex relative -top-px",
@@ -48,13 +51,10 @@ export default /*tw*/ {
48
51
  collapse group-[]/footer-fixed:[visibility:inherit]
49
52
  `,
50
53
  i18n: {
51
- noItems: "There is no data in the table yet.",
52
- noResultsForFilters: "No results were found for the specified filters.",
53
- today: "today",
54
- tomorrow: "tomorrow",
54
+ noData: "There is no data in the table.",
55
55
  },
56
56
  defaultVariants: {
57
- nesting: null,
57
+ nesting: false,
58
58
  compact: false,
59
59
  selectable: false,
60
60
  stickyHeader: false,
@@ -98,6 +98,12 @@
98
98
  :data-cy="`${dataCy}-select-all`"
99
99
  v-bind="headerCheckboxAttrs"
100
100
  />
101
+
102
+ <div
103
+ v-if="selectedRows.length"
104
+ v-bind="headerCounterAttrs"
105
+ v-text="selectedRows.length"
106
+ />
101
107
  </th>
102
108
 
103
109
  <th
@@ -169,7 +175,7 @@
169
175
  :data-id="row.id"
170
176
  :value="row.id"
171
177
  size="sm"
172
- :data-cy="`${dataCy}-table-body-checkbox`"
178
+ :data-cy="`${dataCy}-body-checkbox`"
173
179
  v-bind="bodyCheckboxAttrs"
174
180
  @click.stop
175
181
  />
@@ -181,8 +187,9 @@
181
187
  :compact="compact"
182
188
  v-bind="bodyCellAttrs(getCellClasses(key))"
183
189
  >
184
- <template v-if="Boolean($slots[`cell-${key}`])">
190
+ <template v-if="hasSlotContent($slots[`cell-${key}`])">
185
191
  <div
192
+ v-if="isNesting"
186
193
  :style="getNestedShift(row.nestedLevel)"
187
194
  v-bind="bodyCellNestedWrapperAttrs(index)"
188
195
  @click="onClickNestedWrapper(row)"
@@ -207,9 +214,10 @@
207
214
  v-bind="bodyCellNestedCollapseIconAttrs"
208
215
  />
209
216
  </div>
210
- <!-- @slot Use it to customise table cell item (in whole column). -->
211
- <slot :name="`cell-${key}`" :value="value" :row="row" />
212
217
  </div>
218
+
219
+ <!-- @slot Use it to customise table cell item (in whole column). -->
220
+ <slot :name="`cell-${key}`" :value="value" :row="row" />
213
221
  </template>
214
222
 
215
223
  <template v-else-if="value?.hasOwnProperty('secondary')">
@@ -242,7 +250,7 @@
242
250
 
243
251
  <tr v-if="rowIndex === lastRow" v-bind="bodyRowAfterAttrs">
244
252
  <UTableCell
245
- v-if="hasSlotContent(slots['after-last-row'])"
253
+ v-if="hasSlotContent($slots['after-last-row'])"
246
254
  :compact="compact"
247
255
  :colspan="colsCount"
248
256
  v-bind="bodyRowAfterCellAttrs"
@@ -263,7 +271,7 @@
263
271
  <slot name="empty-state">
264
272
  <UEmpty
265
273
  size="sm"
266
- :description="emptyTableMsg"
274
+ :description="currentLocale.noData"
267
275
  :data-cy="`${dataCy}-empty`"
268
276
  v-bind="bodyEmptyStateAttrs"
269
277
  />
@@ -387,18 +395,10 @@ const props = defineProps({
387
395
  * Sets the nesting level from which folding button need to be shown.
388
396
  */
389
397
  nesting: {
390
- type: Number,
398
+ type: [Number, Boolean],
391
399
  default: UIService.get(defaultConfig, UTable).default.nesting,
392
400
  },
393
401
 
394
- /**
395
- * Indicate if filters applied.
396
- */
397
- filters: {
398
- type: Boolean,
399
- default: false,
400
- },
401
-
402
402
  /**
403
403
  * Set loader resource name to activate table top loader exact for that resource.
404
404
  */
@@ -502,12 +502,8 @@ const hasSlotContentBeforeFirstRow = computed(() => {
502
502
  : false;
503
503
  });
504
504
 
505
- const emptyTableMsg = computed(() => {
506
- return props.filters ? currentLocale.value.noResultsForFilters : currentLocale.value.noItems;
507
- });
508
-
509
505
  const isNesting = computed(() => {
510
- return !isNaN(props.nesting) && props.nesting !== null;
506
+ return Boolean(props.nesting) || props.nesting === 0;
511
507
  });
512
508
 
513
509
  const {
@@ -531,6 +527,7 @@ const {
531
527
  stickyHeaderActionsCheckboxAttrs,
532
528
  stickyHeaderCheckboxAttrs,
533
529
  headerCheckboxAttrs,
530
+ headerCounterAttrs,
534
531
  bodyCheckboxAttrs,
535
532
  bodyCellNestedCollapseIconAttrs,
536
533
  bodyCellNestedExpandIconAttrs,
@@ -605,8 +602,9 @@ function onWindowResize() {
605
602
  }
606
603
 
607
604
  function isShownNestedIcon({ index, row }) {
605
+ const nestedLevel = props.nesting === true ? 0 : Number(props.nesting);
606
+ const isWithinNestingLevel = row.nestedLevel >= nestedLevel;
608
607
  const isChildren = row.childrenIds?.length > 0;
609
- const isWithinNestingLevel = row.nestedLevel >= props.nesting;
610
608
 
611
609
  const isFirstRow = index === 0;
612
610
 
@@ -626,8 +624,10 @@ function onClickNestedWrapper(row) {
626
624
  if (row.isHidden && row.childrenIds.length) {
627
625
  hiddenIds.value.push(...row.childrenIds);
628
626
  } else {
627
+ const nestedLevel = props.nesting === true ? 0 : Number(props.nesting);
628
+
629
629
  hiddenIds.value =
630
- row.nestedLevel === props.nesting
630
+ row.nestedLevel === nestedLevel
631
631
  ? row.childrenIds.filter((item) => !hiddenIds.value.includes(item))
632
632
  : hiddenIds.value.filter((item) => item !== firstElement);
633
633
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.166",
4
+ "version": "0.0.167",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -6597,15 +6597,7 @@
6597
6597
  "description": "Sets the nesting level from which folding button need to be shown.",
6598
6598
  "value": {
6599
6599
  "kind": "expression",
6600
- "type": "number"
6601
- }
6602
- },
6603
- {
6604
- "name": "filters",
6605
- "description": "Indicate if filters applied.",
6606
- "value": {
6607
- "kind": "expression",
6608
- "type": "boolean"
6600
+ "type": "number|boolean"
6609
6601
  },
6610
6602
  "default": "false"
6611
6603
  },