vueless 0.0.155 → 0.0.156

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.155",
3
+ "version": "0.0.156",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -31,6 +31,7 @@ export default /*tw*/ {
31
31
  },
32
32
  defaultVariants: {
33
33
  animationDuration: 200,
34
+ labelKey: "label",
34
35
  nesting: false,
35
36
  upperlined: false,
36
37
  },
@@ -2,4 +2,4 @@
2
2
  This const is needed to prevent the issue in script setup:
3
3
  `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
4
  */
5
- export const UDataListName = "UDataList";
5
+ export const UDataList = "UDataList";
@@ -30,7 +30,7 @@
30
30
  <div v-bind="labelAttrs(element.isActive)">
31
31
  <!-- @slot Use it to modify label. -->
32
32
  <slot name="label" :item="element">
33
- {{ element.label }}
33
+ {{ element[labelKey] }}
34
34
  </slot>
35
35
  </div>
36
36
 
@@ -52,7 +52,7 @@
52
52
  :data-cy="`${dataCy}-delete`"
53
53
  :tooltip="currentLocale.delete"
54
54
  v-bind="deleteIconAttrs"
55
- @click="onClickDelete(element.id, element.label)"
55
+ @click="onClickDelete(element.id, element[labelKey])"
56
56
  />
57
57
 
58
58
  <UIcon
@@ -64,7 +64,7 @@
64
64
  :data-cy="`${dataCy}-edit`"
65
65
  :tooltip="currentLocale.edit"
66
66
  v-bind="editIconAttrs"
67
- @click="onClickEdit(element.id, element.label)"
67
+ @click="onClickEdit(element.id, element[labelKey])"
68
68
  />
69
69
  </template>
70
70
  </div>
@@ -81,9 +81,9 @@
81
81
  @click-edit="onClickEdit"
82
82
  @drag-sort="onDragEnd"
83
83
  >
84
- <template #default="{ item }">
85
- <slot :item="item">
86
- <div v-bind="labelAttrs" v-text="item.label" />
84
+ <template #label="{ item }">
85
+ <slot name="label" :item="item">
86
+ <div v-bind="labelAttrs" v-text="item[labelKey]" />
87
87
  </slot>
88
88
  </template>
89
89
 
@@ -108,7 +108,7 @@ import UEmpty from "../ui.text-empty";
108
108
  import UDivider from "../ui.container-divider";
109
109
  import UIService from "../service.ui";
110
110
 
111
- import { UDataListName } from "./constants";
111
+ import { UDataList as UDataListName } from "./constants";
112
112
  import defaultConfig from "./configs/default.config";
113
113
  import { useAttrs } from "./composables/attrs.composable";
114
114
  import { useLocale } from "../composable.locale";
@@ -133,6 +133,14 @@ const props = defineProps({
133
133
  default: "",
134
134
  },
135
135
 
136
+ /**
137
+ * Label key in the item object of options.
138
+ */
139
+ labelKey: {
140
+ type: String,
141
+ default: UIService.get(defaultConfig, UDataListName).default.labelKey,
142
+ },
143
+
136
144
  /**
137
145
  * Empty state title.
138
146
  */
@@ -237,12 +245,12 @@ function onDragEnd() {
237
245
  emit("dragSort", sortData);
238
246
  }
239
247
 
240
- function onClickEdit(id) {
241
- emit("clickEdit", id);
248
+ function onClickEdit(id, label) {
249
+ emit("clickEdit", id, label);
242
250
  }
243
251
 
244
- function onClickDelete(id, title) {
245
- emit("clickDelete", id, title);
252
+ function onClickDelete(id, label) {
253
+ emit("clickDelete", id, label);
246
254
  }
247
255
 
248
256
  function prepareSortData(list, parentId) {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.155",
4
+ "version": "0.0.156",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -1401,6 +1401,15 @@
1401
1401
  },
1402
1402
  "default": "\"\""
1403
1403
  },
1404
+ {
1405
+ "name": "labelKey",
1406
+ "description": "Label key in the item object of options.",
1407
+ "value": {
1408
+ "kind": "expression",
1409
+ "type": "string"
1410
+ },
1411
+ "default": "label"
1412
+ },
1404
1413
  {
1405
1414
  "name": "emptyTitle",
1406
1415
  "description": "Empty state title.",
@@ -1493,9 +1502,6 @@
1493
1502
  {
1494
1503
  "name": "actions",
1495
1504
  "description": "Use it to add custom actions."
1496
- },
1497
- {
1498
- "name": "default"
1499
1505
  }
1500
1506
  ],
1501
1507
  "source": {