vueless 0.0.326 → 0.0.328

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.326",
3
+ "version": "0.0.328",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -46,7 +46,6 @@
46
46
  <div
47
47
  v-bind="attrs.bodyCellPrimaryAttrs"
48
48
  ref="cellRef"
49
- :title="isElementOverflown(cellRef?.[index]) ? value.primary : ''"
50
49
  :data-test="`${dataTest}-${key}-cell`"
51
50
  >
52
51
  {{ value.primary || HYPHEN_SYMBOL }}
@@ -54,23 +53,14 @@
54
53
 
55
54
  <div v-bind="attrs.bodyCellSecondaryAttrs">
56
55
  <template v-if="Array.isArray(value.secondary)">
57
- <div
58
- v-for="(secondary, idx) in value.secondary"
59
- ref="cellRef"
60
- :key="idx"
61
- :title="isElementOverflown(cellRef?.[index]) ? value.secondary : ''"
62
- >
56
+ <div v-for="(secondary, idx) in value.secondary" ref="cellRef" :key="idx">
63
57
  <span v-bind="attrs.bodyCellSecondaryEmptyAttrs">
64
58
  {{ secondary }}
65
59
  </span>
66
60
  </div>
67
61
  </template>
68
62
 
69
- <div
70
- v-else
71
- ref="cellRef"
72
- :title="isElementOverflown(cellRef?.[index]) ? value.secondary : ''"
73
- >
63
+ <div v-else ref="cellRef">
74
64
  {{ value.secondary }}
75
65
  </div>
76
66
  </div>
@@ -82,7 +72,6 @@
82
72
  <div
83
73
  v-bind="attrs.bodyCellPrimaryAttrs"
84
74
  ref="cellRef"
85
- :title="isElementOverflown(cellRef?.[index]) ? value : ''"
86
75
  :data-test="`${dataTest}-${key}-cell`"
87
76
  >
88
77
  {{ value || value === 0 ? value : HYPHEN_SYMBOL }}
@@ -109,7 +98,7 @@
109
98
  </template>
110
99
 
111
100
  <script setup>
112
- import { computed, ref } from "vue";
101
+ import { computed, onMounted, ref } from "vue";
113
102
 
114
103
  import { HYPHEN_SYMBOL } from "../../constants";
115
104
  import { getFilteredRow } from "../services/table.service.js";
@@ -158,7 +147,7 @@ const emit = defineEmits(["toggleRowVisibility", "click"]);
158
147
 
159
148
  const selectedRows = defineModel("selectedRows", { type: Array, default: () => [] });
160
149
 
161
- const cellRef = ref(null);
150
+ const cellRef = ref([]);
162
151
 
163
152
  useMutationObserver(cellRef, setCellTitle, { childList: true });
164
153
 
@@ -170,6 +159,10 @@ const toggleIconConfig = computed(() =>
170
159
 
171
160
  const shift = computed(() => (props.row.row ? 1.5 : 2));
172
161
 
162
+ onMounted(() => {
163
+ cellRef.value.forEach(setElementTitle);
164
+ });
165
+
173
166
  function getCellClasses(key, row, cellIndex) {
174
167
  const isNestedRow = (row.row || props.nestedLevel) && cellIndex === 0;
175
168
 
@@ -196,21 +189,23 @@ function setCellTitle(mutations) {
196
189
  mutations.forEach((mutation) => {
197
190
  const { target } = mutation;
198
191
 
199
- const isOverflown = isElementOverflown(target);
200
-
201
- if (isOverflown) {
202
- target.setAttribute("title", target.textContent);
203
- }
204
-
205
- if (!isOverflown && target.hasAttribute("title")) {
206
- target.removeAttribute("title");
207
- }
192
+ setElementTitle(target);
208
193
  });
209
194
  }
210
195
 
211
196
  function isElementOverflown(element) {
212
- if (!cellRef.value) return false;
213
-
214
197
  return element.clientWidth < element.scrollWidth || element.clientHeight < element.scrollHeight;
215
198
  }
199
+
200
+ function setElementTitle(element) {
201
+ const isOverflown = isElementOverflown(element);
202
+
203
+ if (isOverflown) {
204
+ element.setAttribute("title", element.textContent);
205
+ }
206
+
207
+ if (!isOverflown && element.hasAttribute("title")) {
208
+ element.removeAttribute("title");
209
+ }
210
+ }
216
211
  </script>
@@ -72,7 +72,7 @@
72
72
  @binding {string} emptyStyles
73
73
  -->
74
74
  <slot name="empty" :empty-styles="optionClasses">
75
- <span v-if="!options.length" v-bind="optionAttrs()">
75
+ <span v-if="!options.length" v-bind="optionAttrs">
76
76
  <span v-bind="optionContentAttrs" v-text="currentLocale.noDataToShow" />
77
77
  </span>
78
78
  </slot>
@@ -98,6 +98,8 @@
98
98
  </template>
99
99
  </ul>
100
100
  </div>
101
+
102
+ <!-- {{ !options.length }} -->
101
103
  </template>
102
104
 
103
105
  <script setup>
@@ -249,6 +251,8 @@ const addOptionKeyCombination = computed(() => {
249
251
  });
250
252
 
251
253
  const wrapperHeight = computed(() => {
254
+ if (!optionsRef.value.length) return "auto";
255
+
252
256
  const maxHeight = optionsRef.value
253
257
  .slice(0, props.visibleOptions)
254
258
  .map((el) => el.getBoundingClientRect().height)
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.326",
4
+ "version": "0.0.328",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",