vueless 0.0.327 → 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 +1 -1
- package/ui.data-table/components/TableRow.vue +21 -26
- package/web-types.json +1 -1
package/package.json
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
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>
|