vueless 0.0.425 → 0.0.426

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.425",
3
+ "version": "0.0.426",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -18,9 +18,9 @@
18
18
  <td
19
19
  v-for="(value, key, index) in getFilteredRow(row, columns)"
20
20
  :key="index"
21
- v-bind="getCellAttrs(key, row, index)"
21
+ v-bind="getCellAttrs(row, index)"
22
22
  :class="
23
- cx([getCellAttrs(key, row, index).class, columns[index].tdClass, getCellClasses(row, key)])
23
+ cx([getCellAttrs(row, index).class, columns[index].tdClass, getCellClasses(row, key)])
24
24
  "
25
25
  >
26
26
  <div
@@ -40,38 +40,16 @@
40
40
  />
41
41
  </div>
42
42
 
43
- <div
44
- v-if="isCellObject(value)"
45
- :class="cx([bodyCellPrimaryAttrs.class, getCellContentClasses(row, key)])"
46
- >
47
- <slot :name="`cell-${key}`" :value="value" :row="row">
48
- <div v-bind="bodyCellPrimaryAttrs" ref="cellRef" :data-test="`${dataTest}-${key}-cell`">
49
- {{ getCellPrimaryContent(value) }}
50
- </div>
51
-
52
- <div v-bind="bodyCellSecondaryAttrs">
53
- <template v-if="Array.isArray(value.secondary)">
54
- <div v-for="(secondary, idx) in value.secondary" ref="cellRef" :key="idx">
55
- <span v-bind="bodyCellSecondaryEmptyAttrs">
56
- {{ secondary }}
57
- </span>
58
- </div>
59
- </template>
60
-
61
- <div v-else ref="cellRef">
62
- {{ value.secondary }}
63
- </div>
64
- </div>
65
- </slot>
66
- </div>
67
-
68
- <template v-else>
69
- <slot :name="`cell-${key}`" :value="value" :row="row">
70
- <div v-bind="bodyCellPrimaryAttrs" ref="cellRef" :data-test="`${dataTest}-${key}-cell`">
71
- {{ value || value === 0 ? value : HYPHEN_SYMBOL }}
72
- </div>
73
- </slot>
74
- </template>
43
+ <slot :name="`cell-${key}`" :value="value" :row="row" :index="index">
44
+ <div
45
+ v-bind="bodyCellContentAttrs"
46
+ ref="cellRef"
47
+ :class="cx([bodyCellContentAttrs.class, getCellContentClasses(row, key)])"
48
+ :data-test="`${dataTest}-${key}-cell`"
49
+ >
50
+ {{ value.value || value || HYPHEN_SYMBOL }}
51
+ </div>
52
+ </slot>
75
53
  </td>
76
54
  </tr>
77
55
 
@@ -188,9 +166,7 @@ const cellRef = ref([]);
188
166
  useMutationObserver(cellRef, setCellTitle, { childList: true });
189
167
 
190
168
  const {
191
- bodyCellPrimaryAttrs,
192
- bodyCellSecondaryAttrs,
193
- bodyCellSecondaryEmptyAttrs,
169
+ bodyCellContentAttrs,
194
170
  bodyCellCheckboxAttrs,
195
171
  bodyCheckboxAttrs,
196
172
  bodyCellNestedAttrs,
@@ -230,19 +206,7 @@ function getCellContentClasses(row, key) {
230
206
  return typeof cellClasses === "function" ? cellClasses(row[key].value, row) : cellClasses;
231
207
  }
232
208
 
233
- function isCellObject(value) {
234
- return typeof value === "object" && value !== null && ("primary" in value || "value" in value);
235
- }
236
-
237
- function getCellPrimaryContent(value) {
238
- if (typeof value === "object" && value !== null) {
239
- return value.primary || value.value || HYPHEN_SYMBOL;
240
- }
241
-
242
- return value || HYPHEN_SYMBOL;
243
- }
244
-
245
- function getCellAttrs(key, row, cellIndex) {
209
+ function getCellAttrs(row, cellIndex) {
246
210
  const isNestedRow = (row.row || row.nestedData || props.nestedLevel > 0) && cellIndex === 0;
247
211
 
248
212
  return isNestedRow ? bodyCellNestedRowAttrs.value : bodyCellBaseAttrs.value;
@@ -57,9 +57,7 @@ export default /*tw*/ {
57
57
  },
58
58
  },
59
59
  bodyCellNestedRow: "flex",
60
- bodyCellPrimary: "text-ellipsis overflow-hidden",
61
- bodyCellSecondary: "mt-1 text-xs text-gray-500 overflow-hidden text-ellipsis",
62
- bodyCellSecondaryEmpty: "inline-block",
60
+ bodyCellContent: "text-ellipsis overflow-hidden",
63
61
  bodyCellCheckbox: "first:px-4", // try to remove first
64
62
  bodyCellDateDivider: "",
65
63
  bodyCellNested: "mr-2 mt-0.5",
@@ -20,12 +20,13 @@ Keys you have/may to provide to component in row object.
20
20
 
21
21
  <Markdown>
22
22
  {`
23
- | Key name | Description | Type | Required |
24
- | ------------------| ------------------------------ | ---------------| ------------ |
25
- | id | A unique identifier for row | String, Number | true |
26
- | isChecked | Indicates if row checked | Boolean | false |
27
- | isHidden | Indicated if nested row hidden | Boolean | false |
28
- | rowDate | Row date for date divider | String, Date | false |
23
+ | Key name | Description | Type | Required |
24
+ | ------------------| ---------------------------------- | ---------------| ------------ |
25
+ | id | A unique identifier for row | String, Number | true |
26
+ | content | Content to be rendered in the cell | Any | false |
27
+ | isChecked | Indicates if row checked | Boolean | false |
28
+ | isHidden | Indicated if nested row hidden | Boolean | false |
29
+ | rowDate | Row date for date divider | String, Date | false |
29
30
  `}
30
31
  </Markdown>
31
32
 
@@ -277,72 +277,6 @@ RowAndCellClasses.args = {
277
277
  ],
278
278
  };
279
279
 
280
- export const PrimaryAndSecondaryContent = DefaultTemplate.bind({});
281
- PrimaryAndSecondaryContent.args = {
282
- rows: [
283
- {
284
- id: getRandomId(),
285
- isChecked: false,
286
- key_1: {
287
- primary: "Primary",
288
- secondary: "Secondary",
289
- },
290
- key_2: {
291
- primary: "Primary",
292
- secondary: "Secondary",
293
- },
294
- key_3: {
295
- primary: "Primary",
296
- secondary: "Secondary",
297
- },
298
- key_4: {
299
- primary: "Primary",
300
- secondary: "Secondary",
301
- },
302
- },
303
- {
304
- id: getRandomId(),
305
- isChecked: false,
306
- key_1: {
307
- primary: "Primary",
308
- secondary: "Secondary",
309
- },
310
- key_2: {
311
- primary: "Primary",
312
- secondary: "Secondary",
313
- },
314
- key_3: {
315
- primary: "Primary",
316
- secondary: "Secondary",
317
- },
318
- key_4: {
319
- primary: "Primary",
320
- secondary: "Secondary",
321
- },
322
- },
323
- {
324
- id: getRandomId(),
325
- isChecked: false,
326
- key_1: {
327
- primary: "Primary",
328
- secondary: "Secondary",
329
- },
330
- key_2: {
331
- primary: "Primary",
332
- secondary: "Secondary",
333
- },
334
- key_3: {
335
- primary: "Primary",
336
- secondary: "Secondary",
337
- },
338
- key_4: {
339
- primary: "Primary",
340
- secondary: "Secondary",
341
- },
342
- },
343
- ],
344
- };
345
-
346
280
  export const Empty = EmptyTemplate.bind({});
347
281
  Empty.args = {};
348
282
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.425",
4
+ "version": "0.0.426",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -8498,6 +8498,9 @@
8498
8498
  },
8499
8499
  {
8500
8500
  "name": "row"
8501
+ },
8502
+ {
8503
+ "name": "index"
8501
8504
  }
8502
8505
  ]
8503
8506
  },