@v1nt1248/3nclient-lib 0.2.66 → 0.2.68
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,4 +1,4 @@
|
|
|
1
|
-
import { computed,
|
|
1
|
+
import { computed, type Ref, ref, watch, UnwrapRef } from 'vue';
|
|
2
2
|
import { get, isEmpty, size } from 'lodash';
|
|
3
3
|
import {
|
|
4
4
|
Ui3nTableBodyBaseItem,
|
|
@@ -34,21 +34,20 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
34
34
|
);
|
|
35
35
|
const showGroupActionsRow = computed(() => props.config?.selectable === 'multiple' && hasGroupActionsRow.value);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const tableColumnWidth = computed(() => {
|
|
38
|
+
if (!tableEl.value) {
|
|
39
|
+
return '100%';
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
function setColumnWidth(el: HTMLDivElement) {
|
|
42
42
|
const { config = {}, head } = props;
|
|
43
43
|
const { columnStyle } = config;
|
|
44
44
|
const keys = head.map(h => h.key);
|
|
45
|
-
|
|
45
|
+
return keys.reduce((res, key, index) => {
|
|
46
46
|
const width = get(columnStyle, [key, 'width'], '1fr');
|
|
47
47
|
res = index === 0 ? `${width}` : `${res} ${width}`;
|
|
48
48
|
return res;
|
|
49
49
|
}, '');
|
|
50
|
-
|
|
51
|
-
}
|
|
50
|
+
});
|
|
52
51
|
|
|
53
52
|
function setFieldAsRowKey() {
|
|
54
53
|
const { config = {}, body } = props;
|
|
@@ -186,6 +185,17 @@ export function useTable<T extends Ui3nTableBodyBaseItem>(props: Ui3nTableProps<
|
|
|
186
185
|
currentConfig.value.sortOrder?.field && emits('change:sort', currentConfig.value.sortOrder as Ui3nTableSort<T>);
|
|
187
186
|
}
|
|
188
187
|
|
|
188
|
+
watch(
|
|
189
|
+
tableColumnWidth,
|
|
190
|
+
(val, oVal) => {
|
|
191
|
+
if (val && val !== oVal) {
|
|
192
|
+
tableEl.value && tableEl.value.style.setProperty('--ui3n-table-columns-width', val);
|
|
193
|
+
}
|
|
194
|
+
}, {
|
|
195
|
+
immediate: true,
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
|
|
189
199
|
watch(
|
|
190
200
|
() => selectedRowsSize.value,
|
|
191
201
|
(val, oldVal) => {
|