nuxt-hs-ui 2.3.2 → 2.4.0
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/dist/module.json
CHANGED
|
@@ -31,11 +31,10 @@ const multiLang = useHsMultiLang();
|
|
|
31
31
|
type Props = {
|
|
32
32
|
columns: any[];
|
|
33
33
|
rows: any[];
|
|
34
|
-
rowCountHeight?: number;
|
|
35
34
|
option?: any;
|
|
36
35
|
};
|
|
37
36
|
const props = withDefaults(defineProps<Props>(), {
|
|
38
|
-
rowCountHeight: 0,
|
|
37
|
+
// rowCountHeight: 0,
|
|
39
38
|
option: () => Option(),
|
|
40
39
|
});
|
|
41
40
|
// [ emit ]
|
|
@@ -54,9 +53,6 @@ const emit = defineEmits<Emits>();
|
|
|
54
53
|
const table = ref<HTMLElement | null>(null); // reference to your table element
|
|
55
54
|
const tabulator = ref<any>(null); // variable to hold your table
|
|
56
55
|
|
|
57
|
-
// const data = computed(() => {
|
|
58
|
-
// return [...props.rows];
|
|
59
|
-
// });
|
|
60
56
|
const data = computed(() => {
|
|
61
57
|
return props.rows;
|
|
62
58
|
});
|
|
@@ -66,13 +62,13 @@ const refreshStopFlag = ref(false);
|
|
|
66
62
|
watch(
|
|
67
63
|
() => props.rows,
|
|
68
64
|
() => {
|
|
69
|
-
// console.log(
|
|
65
|
+
// console.log("watch rows", props.rows);
|
|
70
66
|
if (table.value === null) return;
|
|
71
67
|
if (isInit.value && tabulator.value !== null && !refreshStopFlag.value) {
|
|
72
68
|
tabulator.value.replaceData(data.value as any);
|
|
73
69
|
}
|
|
74
|
-
}
|
|
75
|
-
{ deep: true }
|
|
70
|
+
}
|
|
71
|
+
// // { deep: true }
|
|
76
72
|
);
|
|
77
73
|
|
|
78
74
|
watch(
|
|
@@ -109,15 +105,12 @@ watch(
|
|
|
109
105
|
const initTabulator = () => {
|
|
110
106
|
// console.log(ct, 'initTabulator');
|
|
111
107
|
if (table.value === null) return;
|
|
112
|
-
const option =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
option.columns = props.columns;
|
|
119
|
-
option.data = data.value;
|
|
120
|
-
option.reactiveData = false;
|
|
108
|
+
const option = {
|
|
109
|
+
reactiveData: true,
|
|
110
|
+
...props.option,
|
|
111
|
+
columns: props.columns,
|
|
112
|
+
data: data.value,
|
|
113
|
+
};
|
|
121
114
|
tabulator.value = new Tabulator(table.value, option);
|
|
122
115
|
tabulator.value.on("rowClick", (e: any, row: any) => {
|
|
123
116
|
emit("row-click", row._row.data);
|
|
@@ -135,7 +128,7 @@ const initTabulator = () => {
|
|
|
135
128
|
const afterRows = props.rows.length;
|
|
136
129
|
if (buildingFlag && beforeRows !== afterRows) {
|
|
137
130
|
buildingFlag = false;
|
|
138
|
-
tabulator.value.replaceData(
|
|
131
|
+
tabulator.value.replaceData(props.rows as any);
|
|
139
132
|
}
|
|
140
133
|
isInit.value = true;
|
|
141
134
|
});
|
|
@@ -146,6 +146,8 @@ export const Option = (option) => {
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
layout: "fitColumns",
|
|
149
|
+
maxHeight: "600px",
|
|
150
|
+
virtualDomBuffer: 200,
|
|
149
151
|
downloadConfig: {
|
|
150
152
|
columnHeaders: true,
|
|
151
153
|
// do not include column headers in downloaded table
|
|
@@ -158,11 +160,6 @@ export const Option = (option) => {
|
|
|
158
160
|
dataTree: false
|
|
159
161
|
// do not include data tree in downloaded table
|
|
160
162
|
}
|
|
161
|
-
// pagination: true,
|
|
162
|
-
// paginationSize: 20,
|
|
163
|
-
// paginationSizeSelector: [20, 50, 100],
|
|
164
|
-
// clipboard: true,
|
|
165
|
-
// ...option,
|
|
166
163
|
},
|
|
167
164
|
option
|
|
168
165
|
);
|