@kong-ui-public/table-data-grid 0.7.1 → 0.7.2-pr.3884.49ec4889a.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/README.md +6 -7
- package/dist/style.css +1 -1
- package/dist/table-data-grid.es.js +409 -386
- package/dist/table-data-grid.umd.js +1 -1
- package/dist/types/components/TableDataGrid.vue.d.ts.map +1 -1
- package/dist/types/composables/useFetchInfinite.d.ts +3 -2
- package/dist/types/composables/useFetchInfinite.d.ts.map +1 -1
- package/dist/types/composables/useTableDataGridConfig.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,270 +1,285 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as m, watch as _, ref as $, shallowRef as q, readonly as J, shallowReadonly as Ce, defineComponent as ie, onMounted as ue, onUnmounted as ge, nextTick as pe, resolveComponent as ce, openBlock as O, createElementBlock as N, normalizeClass as de, createElementVNode as H, createBlock as te, resolveDynamicComponent as oe, withCtx as le, createVNode as ae, toDisplayString as ne, createCommentVNode as Q, normalizeStyle as he, h as ye, renderSlot as X, useSlots as be, useTemplateRef as Se, onBeforeUnmount as ke, toRef as V, unref as S } from "vue";
|
|
2
2
|
import { AgGridVue as we } from "ag-grid-vue3";
|
|
3
3
|
import { ModuleRegistry as De, AllCommunityModule as Re, ClientSideRowModelModule as Te, InfiniteRowModelModule as Ee, themeQuartz as xe } from "ag-grid-community";
|
|
4
|
-
import { createI18n as Oe, i18nTComponent as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
return t.value ? "LOADING" :
|
|
4
|
+
import { createI18n as Oe, i18nTComponent as Ke } from "@kong-ui-public/i18n";
|
|
5
|
+
var j = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(j || {});
|
|
6
|
+
const Ie = (e) => !!e?.length;
|
|
7
|
+
function Fe(e, a, t, o = Ie) {
|
|
8
|
+
const l = m(() => o(e.value)), n = m(() => {
|
|
9
|
+
const p = e.value !== void 0, r = a.value !== void 0 && a.value !== null;
|
|
10
|
+
return t.value ? "LOADING" : l.value ? "SUCCESS" : r ? "ERROR" : p ? "SUCCESS" : "PENDING";
|
|
11
11
|
});
|
|
12
12
|
return {
|
|
13
|
-
fetchState:
|
|
14
|
-
hasData:
|
|
15
|
-
state:
|
|
13
|
+
fetchState: j,
|
|
14
|
+
hasData: l,
|
|
15
|
+
state: n
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const Ge = ({
|
|
19
19
|
emitState: e,
|
|
20
20
|
fetchLifecycleState: a,
|
|
21
21
|
hasData: t
|
|
22
22
|
}) => {
|
|
23
|
-
|
|
23
|
+
_(
|
|
24
24
|
() => ({
|
|
25
25
|
hasData: t.value,
|
|
26
26
|
state: a.value
|
|
27
27
|
}),
|
|
28
|
-
({ hasData:
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
28
|
+
({ hasData: o, state: l }) => {
|
|
29
|
+
if (l !== j.PENDING) {
|
|
30
|
+
if (l === j.LOADING) {
|
|
31
31
|
e({
|
|
32
|
-
hasData:
|
|
32
|
+
hasData: o,
|
|
33
33
|
state: "loading"
|
|
34
34
|
});
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
if (
|
|
37
|
+
if (l === j.ERROR) {
|
|
38
38
|
e({
|
|
39
|
-
hasData:
|
|
39
|
+
hasData: o,
|
|
40
40
|
state: "error"
|
|
41
41
|
});
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
e({
|
|
45
|
-
hasData:
|
|
45
|
+
hasData: o,
|
|
46
46
|
state: "success"
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
|
-
},
|
|
51
|
+
}, ze = ({ startRow: e, endRow: a }) => {
|
|
52
52
|
const t = a - e;
|
|
53
53
|
return {
|
|
54
54
|
blockIndex: t > 0 ? Math.floor(e / t) : 0,
|
|
55
55
|
pageSize: t
|
|
56
56
|
};
|
|
57
|
-
},
|
|
57
|
+
}, Ne = ({
|
|
58
58
|
startRow: e,
|
|
59
59
|
rowsLength: a,
|
|
60
60
|
pageSize: t,
|
|
61
|
-
total:
|
|
62
|
-
hasMore:
|
|
61
|
+
total: o,
|
|
62
|
+
hasMore: l
|
|
63
63
|
}) => {
|
|
64
|
-
if (typeof
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
64
|
+
if (typeof o == "number")
|
|
65
|
+
return o;
|
|
66
|
+
if (l !== !0 && (l === !1 || a < t))
|
|
67
67
|
return e + a;
|
|
68
|
-
},
|
|
68
|
+
}, _e = ({
|
|
69
69
|
fetcher: e,
|
|
70
70
|
resetKey: a,
|
|
71
71
|
sort: t
|
|
72
72
|
}) => {
|
|
73
|
-
const
|
|
74
|
-
let
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
const o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), n = $(0), u = $(0), p = q(), r = q(), f = q(), C = $(0), k = $(!1);
|
|
74
|
+
let D, R, M = t?.value?.sortColumnKey, s = t?.value?.sortColumnOrder;
|
|
75
|
+
const v = (c) => c === n.value && D === e.value && R === a?.value, b = (c, d) => v(c) && d === u.value && M === t?.value?.sortColumnKey && s === t?.value?.sortColumnOrder, B = (c) => {
|
|
76
|
+
if (!t)
|
|
77
|
+
return !0;
|
|
78
|
+
const d = t.value;
|
|
79
|
+
return !d?.sortColumnKey || !d.sortColumnOrder ? c.length === 0 : c.length === 1 && c[0].colId === d.sortColumnKey && c[0].sort === d.sortColumnOrder;
|
|
80
|
+
}, E = () => {
|
|
81
|
+
k.value = C.value > 0;
|
|
82
|
+
}, K = () => {
|
|
83
|
+
u.value += 1, M = t?.value?.sortColumnKey, s = t?.value?.sortColumnOrder;
|
|
84
|
+
for (const c of l.values())
|
|
85
|
+
c.resolve(!1);
|
|
86
|
+
o.clear(), l.clear(), r.value = void 0, f.value = void 0, C.value = 0, E();
|
|
87
|
+
}, I = () => {
|
|
88
|
+
f.value = void 0, C.value += 1, E();
|
|
89
|
+
}, L = () => {
|
|
90
|
+
C.value = Math.max(0, C.value - 1), E();
|
|
91
|
+
}, F = (c) => {
|
|
92
|
+
const d = l.get(c);
|
|
93
|
+
if (d)
|
|
94
|
+
return d;
|
|
95
|
+
let h;
|
|
96
|
+
const w = {
|
|
97
|
+
promise: new Promise((g) => {
|
|
98
|
+
h = g;
|
|
89
99
|
}),
|
|
90
|
-
resolve: (
|
|
100
|
+
resolve: (g) => h(g)
|
|
91
101
|
};
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
blockIndex:
|
|
97
|
-
currentBlockCompletion:
|
|
98
|
-
datasourceId:
|
|
102
|
+
return l.set(c, w), w;
|
|
103
|
+
}, T = (c, d) => {
|
|
104
|
+
d.resolve(!1), l.get(c) === d && l.delete(c);
|
|
105
|
+
}, P = async ({
|
|
106
|
+
blockIndex: c,
|
|
107
|
+
currentBlockCompletion: d,
|
|
108
|
+
datasourceId: h,
|
|
109
|
+
requestGeneration: w
|
|
99
110
|
}) => {
|
|
100
|
-
if (
|
|
111
|
+
if (c === 0)
|
|
101
112
|
return "ready";
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
},
|
|
108
|
-
blockIndex:
|
|
109
|
-
currentBlockCompletion:
|
|
110
|
-
getRowsParams:
|
|
111
|
-
pageSize:
|
|
112
|
-
result:
|
|
113
|
+
const g = l.get(c - 1);
|
|
114
|
+
if (!g)
|
|
115
|
+
return T(c, d), "failed";
|
|
116
|
+
const W = await g.promise;
|
|
117
|
+
return b(h, w) ? W ? "ready" : (T(c, d), "failed") : (T(c, d), "stale");
|
|
118
|
+
}, y = ({
|
|
119
|
+
blockIndex: c,
|
|
120
|
+
currentBlockCompletion: d,
|
|
121
|
+
getRowsParams: h,
|
|
122
|
+
pageSize: w,
|
|
123
|
+
result: g
|
|
113
124
|
}) => {
|
|
114
|
-
|
|
115
|
-
startRow:
|
|
116
|
-
rowsLength:
|
|
117
|
-
pageSize:
|
|
118
|
-
total:
|
|
119
|
-
hasMore:
|
|
120
|
-
})),
|
|
125
|
+
g.cursor !== void 0 && o.set(c, g.cursor), h.successCallback(g.data, Ne({
|
|
126
|
+
startRow: h.startRow,
|
|
127
|
+
rowsLength: g.data.length,
|
|
128
|
+
pageSize: w,
|
|
129
|
+
total: g.total,
|
|
130
|
+
hasMore: g.hasMore
|
|
131
|
+
})), h.startRow === 0 && (r.value = g.data), d.resolve(!0);
|
|
121
132
|
}, x = ({
|
|
122
|
-
blockIndex:
|
|
123
|
-
currentBlockCompletion:
|
|
124
|
-
fetchError:
|
|
125
|
-
getRowsParams:
|
|
133
|
+
blockIndex: c,
|
|
134
|
+
currentBlockCompletion: d,
|
|
135
|
+
fetchError: h,
|
|
136
|
+
getRowsParams: w
|
|
126
137
|
}) => {
|
|
127
|
-
|
|
138
|
+
f.value = h, w.failCallback(), T(c, d);
|
|
128
139
|
}, G = () => {
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
140
|
+
const c = e.value;
|
|
141
|
+
if (!c)
|
|
131
142
|
throw new Error("TableDataGrid requires a fetcher in infinite mode");
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
async getRows(
|
|
136
|
-
if (!
|
|
137
|
-
|
|
143
|
+
D = c, R = a?.value;
|
|
144
|
+
const d = n.value + 1;
|
|
145
|
+
return n.value = d, K(), {
|
|
146
|
+
async getRows(h) {
|
|
147
|
+
if (!v(d) || !B(h.sortModel)) {
|
|
148
|
+
h.failCallback();
|
|
138
149
|
return;
|
|
139
150
|
}
|
|
140
|
-
const {
|
|
141
|
-
blockIndex:
|
|
142
|
-
pageSize:
|
|
143
|
-
} =
|
|
144
|
-
startRow:
|
|
145
|
-
endRow:
|
|
146
|
-
}),
|
|
147
|
-
if (await
|
|
148
|
-
blockIndex:
|
|
149
|
-
currentBlockCompletion:
|
|
150
|
-
datasourceId:
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const w = u.value, {
|
|
152
|
+
blockIndex: g,
|
|
153
|
+
pageSize: W
|
|
154
|
+
} = ze({
|
|
155
|
+
startRow: h.startRow,
|
|
156
|
+
endRow: h.endRow
|
|
157
|
+
}), i = F(g);
|
|
158
|
+
if (await P({
|
|
159
|
+
blockIndex: g,
|
|
160
|
+
currentBlockCompletion: i,
|
|
161
|
+
datasourceId: d,
|
|
162
|
+
requestGeneration: w
|
|
163
|
+
}) !== "ready" || !b(d, w)) {
|
|
164
|
+
h.failCallback(), T(g, i);
|
|
153
165
|
return;
|
|
154
166
|
}
|
|
155
|
-
|
|
167
|
+
I();
|
|
156
168
|
try {
|
|
157
|
-
const
|
|
169
|
+
const z = g > 0 ? o.get(g - 1) : void 0, Z = await c({
|
|
158
170
|
mode: "infinite",
|
|
159
|
-
pageSize:
|
|
160
|
-
cursor:
|
|
171
|
+
pageSize: W,
|
|
172
|
+
cursor: z,
|
|
161
173
|
// Always read the latest sort, not a stale one.
|
|
162
174
|
sort: t?.value
|
|
163
175
|
});
|
|
164
|
-
if (!
|
|
165
|
-
|
|
176
|
+
if (!b(d, w)) {
|
|
177
|
+
h.failCallback(), T(g, i);
|
|
166
178
|
return;
|
|
167
179
|
}
|
|
168
|
-
|
|
169
|
-
blockIndex:
|
|
170
|
-
currentBlockCompletion:
|
|
171
|
-
getRowsParams:
|
|
172
|
-
pageSize:
|
|
173
|
-
result:
|
|
180
|
+
y({
|
|
181
|
+
blockIndex: g,
|
|
182
|
+
currentBlockCompletion: i,
|
|
183
|
+
getRowsParams: h,
|
|
184
|
+
pageSize: W,
|
|
185
|
+
result: Z
|
|
174
186
|
});
|
|
175
|
-
} catch (
|
|
176
|
-
if (!
|
|
177
|
-
|
|
187
|
+
} catch (z) {
|
|
188
|
+
if (!b(d, w)) {
|
|
189
|
+
h.failCallback(), T(g, i);
|
|
178
190
|
return;
|
|
179
191
|
}
|
|
180
192
|
x({
|
|
181
|
-
blockIndex:
|
|
182
|
-
currentBlockCompletion:
|
|
183
|
-
fetchError:
|
|
184
|
-
getRowsParams:
|
|
193
|
+
blockIndex: g,
|
|
194
|
+
currentBlockCompletion: i,
|
|
195
|
+
fetchError: z,
|
|
196
|
+
getRowsParams: h
|
|
185
197
|
});
|
|
186
198
|
} finally {
|
|
187
|
-
|
|
199
|
+
b(d, w) && L();
|
|
188
200
|
}
|
|
189
201
|
}
|
|
190
202
|
};
|
|
191
|
-
},
|
|
192
|
-
|
|
203
|
+
}, U = () => {
|
|
204
|
+
p.value = G();
|
|
193
205
|
};
|
|
194
|
-
return
|
|
206
|
+
return _(
|
|
195
207
|
[e, () => a?.value],
|
|
196
208
|
() => {
|
|
197
|
-
|
|
209
|
+
U();
|
|
198
210
|
},
|
|
199
211
|
{ immediate: !0 }
|
|
212
|
+
), _(
|
|
213
|
+
[() => t?.value?.sortColumnKey, () => t?.value?.sortColumnOrder],
|
|
214
|
+
() => K()
|
|
200
215
|
), {
|
|
201
|
-
datasource:
|
|
202
|
-
data:
|
|
203
|
-
error:
|
|
204
|
-
isFetching:
|
|
216
|
+
datasource: J(p),
|
|
217
|
+
data: Ce(r),
|
|
218
|
+
error: J(f),
|
|
219
|
+
isFetching: J(k)
|
|
205
220
|
};
|
|
206
|
-
},
|
|
207
|
-
emptyState:
|
|
221
|
+
}, Me = { title: "No Data", message: "There is no data to display." }, Be = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, Ae = {
|
|
222
|
+
emptyState: Me,
|
|
208
223
|
errorState: Be
|
|
209
224
|
};
|
|
210
|
-
function
|
|
211
|
-
const e = Oe("en-us",
|
|
225
|
+
function ve() {
|
|
226
|
+
const e = Oe("en-us", Ae);
|
|
212
227
|
return {
|
|
213
228
|
i18n: e,
|
|
214
|
-
i18nT:
|
|
229
|
+
i18nT: Ke(e)
|
|
215
230
|
// Translation component <i18n-t>
|
|
216
231
|
};
|
|
217
232
|
}
|
|
218
|
-
const { i18n:
|
|
233
|
+
const { i18n: Ve } = ve(), me = (e, a) => {
|
|
219
234
|
const t = Reflect.get(a, e.key);
|
|
220
235
|
return e.valueFormatter ? e.valueFormatter(t, a) : String(t ?? "");
|
|
221
|
-
},
|
|
222
|
-
(t,
|
|
223
|
-
const
|
|
224
|
-
return
|
|
225
|
-
sum: t.sum +
|
|
226
|
-
max: Math.max(t.max,
|
|
236
|
+
}, Y = (e) => typeof e != "number" ? null : Number.isFinite(e) ? e : null, $e = (e, a) => e.reduce(
|
|
237
|
+
(t, o) => {
|
|
238
|
+
const l = Y(Reflect.get(o, a.key));
|
|
239
|
+
return l === null ? t : {
|
|
240
|
+
sum: t.sum + l,
|
|
241
|
+
max: Math.max(t.max, l)
|
|
227
242
|
};
|
|
228
243
|
},
|
|
229
244
|
{ sum: 0, max: 0 }
|
|
230
245
|
), Le = (e, a) => {
|
|
231
|
-
const t = (a ?? []).filter((
|
|
246
|
+
const t = (a ?? []).filter((n) => Number.isFinite(n.value) && e >= n.value);
|
|
232
247
|
if (!t.length)
|
|
233
248
|
return;
|
|
234
|
-
const
|
|
235
|
-
return t.filter((
|
|
249
|
+
const o = Math.max(...t.map((n) => n.value));
|
|
250
|
+
return t.filter((n) => n.value === o).some((n) => n.type === "error") ? "error" : "warning";
|
|
236
251
|
}, Pe = (e, a, t) => {
|
|
237
252
|
if (e === null)
|
|
238
253
|
return 0;
|
|
239
|
-
const
|
|
240
|
-
return
|
|
254
|
+
const o = t === "relative" ? a.sum : a.max;
|
|
255
|
+
return o > 0 ? Math.min(Math.max(e / o, 0), 1) : 0;
|
|
241
256
|
}, Ue = (e) => {
|
|
242
|
-
const a = (t) =>
|
|
257
|
+
const a = (t) => Ve.formatNumber(t, { maximumFractionDigits: 2 });
|
|
243
258
|
return e > 0 && e < 0.01 ? `< ${a(0.01)} %` : `${a(e)} %`;
|
|
244
|
-
},
|
|
259
|
+
}, fe = ({
|
|
245
260
|
value: e,
|
|
246
261
|
stats: a,
|
|
247
262
|
header: t
|
|
248
263
|
}) => {
|
|
249
264
|
if (e === null || a.sum <= 0)
|
|
250
265
|
return;
|
|
251
|
-
const
|
|
252
|
-
return t.percentageFormatter?.(
|
|
253
|
-
},
|
|
266
|
+
const o = e / a.sum * 100;
|
|
267
|
+
return t.percentageFormatter?.(o) ?? Ue(o);
|
|
268
|
+
}, re = (e, a) => a !== void 0 && a.length > (e?.length ?? -1) ? a : e, We = ({
|
|
254
269
|
rows: e,
|
|
255
270
|
header: a,
|
|
256
271
|
stats: t
|
|
257
272
|
}) => e.reduce(
|
|
258
|
-
(
|
|
259
|
-
value:
|
|
260
|
-
relative: a.showPercentage ?
|
|
261
|
-
value:
|
|
273
|
+
(o, l) => ({
|
|
274
|
+
value: re(o.value, me(a, l)) ?? "",
|
|
275
|
+
relative: a.showPercentage ? re(o.relative, fe({
|
|
276
|
+
value: Y(Reflect.get(l, a.key)),
|
|
262
277
|
stats: t,
|
|
263
278
|
header: a
|
|
264
279
|
})) : void 0
|
|
265
280
|
}),
|
|
266
281
|
{ value: "" }
|
|
267
|
-
),
|
|
282
|
+
), qe = ["data-threshold"], He = { class: "table-data-grid-cell-label-track" }, je = { class: "table-data-grid-cell-label" }, Qe = {
|
|
268
283
|
key: 0,
|
|
269
284
|
class: "table-data-grid-cell-relative",
|
|
270
285
|
"data-testid": "table-data-grid-cell-relative"
|
|
@@ -272,285 +287,289 @@ const { i18n: $e } = ce(), de = (e, a) => {
|
|
|
272
287
|
key: 0,
|
|
273
288
|
"aria-hidden": "true",
|
|
274
289
|
class: "table-data-grid-cell-label table-data-grid-cell-label-sizer"
|
|
275
|
-
}, Xe = ["data-text"], Ye = ["data-text"], Ze = ["data-threshold"], et = /* @__PURE__ */
|
|
290
|
+
}, Xe = ["data-text"], Ye = ["data-text"], Ze = ["data-threshold"], et = /* @__PURE__ */ ie({
|
|
276
291
|
name: "TableDataGridCellRenderer",
|
|
277
292
|
__name: "TableDataGridCellRenderer",
|
|
278
293
|
props: {
|
|
279
294
|
params: {}
|
|
280
295
|
},
|
|
281
296
|
setup(e, { expose: a }) {
|
|
282
|
-
const t =
|
|
297
|
+
const t = q(e.params), o = $(null), l = $(!1), n = m(() => t.value.headerDef ?? {
|
|
283
298
|
key: "",
|
|
284
299
|
label: ""
|
|
285
|
-
}), u =
|
|
286
|
-
value:
|
|
287
|
-
stats:
|
|
288
|
-
header:
|
|
289
|
-
}) : void 0),
|
|
290
|
-
column:
|
|
300
|
+
}), u = m(() => t.value.context?.presentation), p = m(() => t.value.context?.cells?.tooltipTarget?.value ?? "body"), r = m(() => t.value.valueFormatted ?? String(t.value.value ?? "")), f = m(() => t.value.value), C = m(() => Y(f.value)), k = m(() => u.value?.stats[n.value.key]), D = m(() => n.value.showPercentage && k.value ? fe({
|
|
301
|
+
value: C.value,
|
|
302
|
+
stats: k.value,
|
|
303
|
+
header: n.value
|
|
304
|
+
}) : void 0), R = m(() => !!n.value.bar && !!k.value && (C.value !== null || f.value === null || f.value === void 0)), M = m(() => R.value && k.value ? Pe(C.value, k.value, n.value.bar) * 100 : 0), s = m(() => R.value ? u.value?.labelSizers[n.value.key] : void 0), v = m(() => n.value.thresholds?.length && C.value !== null ? Le(C.value, n.value.thresholds) : void 0), b = m(() => ({
|
|
305
|
+
column: n.value,
|
|
291
306
|
refreshCell: () => {
|
|
292
|
-
const
|
|
293
|
-
|
|
307
|
+
const y = t.value.node;
|
|
308
|
+
y && t.value.api.refreshCells({ force: !0, rowNodes: [y] });
|
|
294
309
|
},
|
|
295
310
|
row: t.value.data ?? {},
|
|
296
311
|
rowIndex: t.value.node?.rowIndex ?? 0,
|
|
297
312
|
rowValue: t.value.value,
|
|
298
313
|
selected: t.value.node?.isSelected() ?? !1
|
|
299
|
-
})),
|
|
300
|
-
const
|
|
301
|
-
return !
|
|
314
|
+
})), B = (y, { slots: x }) => {
|
|
315
|
+
const G = t.value.colDef?.colId, U = t.value.context?.cells?.slots;
|
|
316
|
+
return !G || G === "cell-icon" || !U?.[G] ? x.default?.() : ye(
|
|
302
317
|
"span",
|
|
303
318
|
{ class: "table-data-grid-cell-slot-content" },
|
|
304
|
-
U
|
|
319
|
+
X(U, G, b.value, () => x.default?.() ?? [])
|
|
305
320
|
);
|
|
306
|
-
},
|
|
307
|
-
const
|
|
308
|
-
return
|
|
321
|
+
}, E = () => {
|
|
322
|
+
const y = t.value.context?.cells?.slots;
|
|
323
|
+
return y?.["cell-icon"] ? X(y, "cell-icon", b.value) : null;
|
|
309
324
|
};
|
|
310
|
-
let
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
|
|
325
|
+
let K, I, L = !1;
|
|
326
|
+
const F = () => {
|
|
327
|
+
const y = o.value;
|
|
328
|
+
l.value = !!y && y.scrollWidth > y.clientWidth;
|
|
329
|
+
}, T = () => {
|
|
330
|
+
L || (I !== void 0 && cancelAnimationFrame(I), I = requestAnimationFrame(() => {
|
|
331
|
+
I = void 0, F();
|
|
317
332
|
}));
|
|
318
|
-
},
|
|
319
|
-
if (
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
333
|
+
}, P = (y) => {
|
|
334
|
+
if (K?.disconnect(), y) {
|
|
335
|
+
K?.observe(y);
|
|
336
|
+
const x = y.closest(".ag-cell");
|
|
337
|
+
x && K?.observe(x);
|
|
323
338
|
}
|
|
324
|
-
|
|
339
|
+
T();
|
|
325
340
|
};
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
}),
|
|
329
|
-
|
|
341
|
+
return ue(() => {
|
|
342
|
+
K = new ResizeObserver(T), P(o.value);
|
|
343
|
+
}), _(o, P), ge(() => {
|
|
344
|
+
L = !0, K?.disconnect(), I !== void 0 && cancelAnimationFrame(I);
|
|
330
345
|
}), a({
|
|
331
|
-
refresh(
|
|
332
|
-
return t.value =
|
|
346
|
+
refresh(y) {
|
|
347
|
+
return t.value = y, pe(T), !0;
|
|
333
348
|
}
|
|
334
|
-
}), (
|
|
335
|
-
const
|
|
336
|
-
return
|
|
337
|
-
class:
|
|
338
|
-
"table-data-grid-cell-renderer--bar":
|
|
339
|
-
"table-data-grid-cell-renderer--percentage": !!
|
|
340
|
-
[`table-data-grid-cell-renderer--text-${
|
|
349
|
+
}), (y, x) => {
|
|
350
|
+
const G = ce("KTooltip");
|
|
351
|
+
return O(), N("span", {
|
|
352
|
+
class: de(["table-data-grid-cell-renderer", {
|
|
353
|
+
"table-data-grid-cell-renderer--bar": R.value,
|
|
354
|
+
"table-data-grid-cell-renderer--percentage": !!D.value,
|
|
355
|
+
[`table-data-grid-cell-renderer--text-${v.value}`]: !R.value && !!v.value
|
|
341
356
|
}]),
|
|
342
|
-
"data-threshold":
|
|
357
|
+
"data-threshold": v.value
|
|
343
358
|
}, [
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
(
|
|
347
|
-
(
|
|
348
|
-
default:
|
|
349
|
-
|
|
359
|
+
H("span", He, [
|
|
360
|
+
H("span", je, [
|
|
361
|
+
(O(), te(oe(E))),
|
|
362
|
+
(O(), te(oe(B), null, {
|
|
363
|
+
default: le(() => [
|
|
364
|
+
ae(G, {
|
|
350
365
|
class: "table-data-grid-cell-tooltip",
|
|
351
|
-
disabled: !
|
|
366
|
+
disabled: !l.value,
|
|
352
367
|
"kpop-attributes": { popoverDelay: 400 },
|
|
353
368
|
"max-width": "300",
|
|
354
369
|
placement: "bottom-start",
|
|
355
|
-
target:
|
|
370
|
+
target: p.value,
|
|
356
371
|
text: r.value
|
|
357
372
|
}, {
|
|
358
|
-
default:
|
|
359
|
-
|
|
373
|
+
default: le(() => [
|
|
374
|
+
H("span", {
|
|
360
375
|
ref_key: "contentElement",
|
|
361
|
-
ref:
|
|
376
|
+
ref: o,
|
|
362
377
|
class: "table-data-grid-cell-content"
|
|
363
|
-
},
|
|
378
|
+
}, ne(r.value), 513)
|
|
364
379
|
]),
|
|
365
380
|
_: 1
|
|
366
381
|
}, 8, ["disabled", "target", "text"])
|
|
367
382
|
]),
|
|
368
383
|
_: 1
|
|
369
384
|
})),
|
|
370
|
-
|
|
385
|
+
D.value ? (O(), N("span", Qe, "(" + ne(D.value) + ")", 1)) : Q("", !0)
|
|
371
386
|
]),
|
|
372
|
-
|
|
373
|
-
|
|
387
|
+
s.value ? (O(), N("span", Je, [
|
|
388
|
+
H("span", {
|
|
374
389
|
class: "table-data-grid-cell-sizer-value",
|
|
375
|
-
"data-text":
|
|
390
|
+
"data-text": s.value.value
|
|
376
391
|
}, null, 8, Xe),
|
|
377
|
-
|
|
392
|
+
s.value.relative ? (O(), N("span", {
|
|
378
393
|
key: 0,
|
|
379
394
|
class: "table-data-grid-cell-sizer-relative",
|
|
380
|
-
"data-text": `(${
|
|
381
|
-
}, null, 8, Ye)) :
|
|
382
|
-
])) :
|
|
395
|
+
"data-text": `(${s.value.relative})`
|
|
396
|
+
}, null, 8, Ye)) : Q("", !0)
|
|
397
|
+
])) : Q("", !0)
|
|
383
398
|
]),
|
|
384
|
-
|
|
399
|
+
R.value ? (O(), N("span", {
|
|
385
400
|
key: 0,
|
|
386
401
|
class: "table-data-grid-cell-bar",
|
|
387
402
|
"data-testid": "table-data-grid-cell-bar",
|
|
388
|
-
"data-threshold":
|
|
403
|
+
"data-threshold": v.value
|
|
389
404
|
}, [
|
|
390
|
-
|
|
405
|
+
H("span", {
|
|
391
406
|
class: "table-data-grid-cell-bar-fill",
|
|
392
407
|
"data-testid": "table-data-grid-cell-bar-fill",
|
|
393
|
-
style: he({ width: `${
|
|
408
|
+
style: he({ width: `${M.value}%` })
|
|
394
409
|
}, null, 4)
|
|
395
|
-
], 8, Ze)) :
|
|
396
|
-
], 10,
|
|
410
|
+
], 8, Ze)) : Q("", !0)
|
|
411
|
+
], 10, qe);
|
|
397
412
|
};
|
|
398
413
|
}
|
|
399
414
|
}), tt = ({
|
|
400
415
|
headers: e,
|
|
401
416
|
slots: a,
|
|
402
417
|
initialSort: t,
|
|
403
|
-
mode:
|
|
404
|
-
rows:
|
|
405
|
-
tooltipTarget:
|
|
418
|
+
mode: o,
|
|
419
|
+
rows: l,
|
|
420
|
+
tooltipTarget: n
|
|
406
421
|
}) => {
|
|
407
|
-
const u =
|
|
408
|
-
|
|
409
|
-
e.value.forEach((
|
|
410
|
-
if (!r(
|
|
422
|
+
const u = o ?? "infinite", p = /* @__PURE__ */ new Set(), r = (s) => !!(s.showPercentage || s.bar || s.thresholds?.length);
|
|
423
|
+
_([e, () => l?.value], () => {
|
|
424
|
+
e.value.forEach((s) => {
|
|
425
|
+
if (!r(s))
|
|
411
426
|
return;
|
|
412
|
-
let
|
|
413
|
-
if (u === "infinite" && (
|
|
414
|
-
const
|
|
415
|
-
return
|
|
416
|
-
}) && (
|
|
427
|
+
let v;
|
|
428
|
+
if (u === "infinite" && (s.showPercentage || s.bar) ? v = "percentage and bar presentation is only supported in unpaginated mode" : u === "unpaginated" && l?.value?.some((B) => {
|
|
429
|
+
const E = Reflect.get(B, s.key);
|
|
430
|
+
return E != null && Y(E) === null;
|
|
431
|
+
}) && (v = "contains non-finite or nonnumeric values; numeric presentation skips those values"), !v)
|
|
417
432
|
return;
|
|
418
|
-
const
|
|
419
|
-
|
|
433
|
+
const b = `${s.key}:${v}`;
|
|
434
|
+
p.has(b) || (p.add(b), console.warn(`[TableDataGrid] Column "${s.key}" ${v}.`));
|
|
420
435
|
});
|
|
421
436
|
}, { immediate: !0 });
|
|
422
|
-
const
|
|
437
|
+
const C = m(() => {
|
|
423
438
|
if (u !== "unpaginated")
|
|
424
439
|
return {};
|
|
425
|
-
const
|
|
440
|
+
const s = l?.value ?? [];
|
|
426
441
|
return Object.fromEntries(
|
|
427
|
-
e.value.filter((
|
|
442
|
+
e.value.filter((v) => v.showPercentage || v.bar).map((v) => [v.key, $e(s, v)])
|
|
428
443
|
);
|
|
429
|
-
}),
|
|
444
|
+
}), k = m(() => {
|
|
430
445
|
if (u !== "unpaginated")
|
|
431
446
|
return {};
|
|
432
|
-
const
|
|
447
|
+
const s = l?.value ?? [];
|
|
433
448
|
return Object.fromEntries(
|
|
434
|
-
e.value.filter((
|
|
435
|
-
rows:
|
|
436
|
-
header:
|
|
437
|
-
stats:
|
|
449
|
+
e.value.filter((v) => v.bar).map((v) => [v.key, We({
|
|
450
|
+
rows: s,
|
|
451
|
+
header: v,
|
|
452
|
+
stats: C.value[v.key]
|
|
438
453
|
})])
|
|
439
454
|
);
|
|
440
|
-
}),
|
|
441
|
-
cells: { slots: a, tooltipTarget:
|
|
455
|
+
}), D = m(() => ({
|
|
456
|
+
cells: { slots: a, tooltipTarget: n },
|
|
442
457
|
presentation: {
|
|
443
|
-
stats:
|
|
444
|
-
labelSizers:
|
|
458
|
+
stats: C.value,
|
|
459
|
+
labelSizers: k.value
|
|
445
460
|
}
|
|
446
|
-
})),
|
|
447
|
-
const
|
|
461
|
+
})), R = (s) => {
|
|
462
|
+
const v = t?.sortColumnKey === s.key;
|
|
448
463
|
return {
|
|
449
|
-
colId:
|
|
464
|
+
colId: s.key,
|
|
450
465
|
// Columns with no explicit width constraint share remaining space equally.
|
|
451
|
-
flex: !
|
|
452
|
-
headerName:
|
|
453
|
-
maxWidth:
|
|
454
|
-
minWidth:
|
|
455
|
-
sortable:
|
|
456
|
-
unSortIcon:
|
|
457
|
-
...
|
|
458
|
-
valueGetter: (
|
|
459
|
-
valueFormatter: (
|
|
460
|
-
width:
|
|
466
|
+
flex: !s.width && !s.maxWidth ? 1 : void 0,
|
|
467
|
+
headerName: s.label,
|
|
468
|
+
maxWidth: s.maxWidth,
|
|
469
|
+
minWidth: s.minWidth,
|
|
470
|
+
sortable: s.sortable ?? !1,
|
|
471
|
+
unSortIcon: s.showSortIcon,
|
|
472
|
+
...v ? { initialSort: t?.sortColumnOrder, initialSortIndex: 0 } : {},
|
|
473
|
+
valueGetter: (b) => b.data?.[s.key],
|
|
474
|
+
valueFormatter: (b) => b.data ? me(s, b.data) : String(b.value ?? ""),
|
|
475
|
+
width: s.width,
|
|
461
476
|
cellRenderer: et,
|
|
462
477
|
// custom params passed to the cell renderer.
|
|
463
|
-
cellRendererParams: { headerDef:
|
|
478
|
+
cellRendererParams: { headerDef: s }
|
|
464
479
|
};
|
|
465
480
|
};
|
|
466
481
|
return {
|
|
467
|
-
columnDefs:
|
|
468
|
-
gridContext:
|
|
482
|
+
columnDefs: m(() => e.value.map(R)),
|
|
483
|
+
gridContext: D
|
|
469
484
|
};
|
|
470
|
-
},
|
|
485
|
+
}, ee = ({
|
|
471
486
|
config: e,
|
|
472
487
|
headers: a,
|
|
473
488
|
pageSize: t
|
|
474
489
|
}) => {
|
|
475
|
-
const
|
|
490
|
+
const o = new Set(a.filter((n) => n.sortable).map((n) => n.key)), l = e?.sortColumnKey && o.has(e.sortColumnKey) ? e.sortColumnKey : void 0;
|
|
476
491
|
return {
|
|
477
|
-
sortColumnKey:
|
|
478
|
-
sortColumnOrder:
|
|
492
|
+
sortColumnKey: l,
|
|
493
|
+
sortColumnOrder: l ? e?.sortColumnOrder : void 0,
|
|
479
494
|
pageSize: e?.pageSize ?? t,
|
|
480
495
|
...e?.fitToContent !== void 0 ? { fitToContent: e.fitToContent } : {}
|
|
481
496
|
};
|
|
482
|
-
},
|
|
497
|
+
}, se = (e, a) => e.sortColumnKey === a.sortColumnKey && e.sortColumnOrder === a.sortColumnOrder && e.pageSize === a.pageSize && e.fitToContent === a.fitToContent, at = ({
|
|
483
498
|
headers: e,
|
|
484
499
|
pageSize: a,
|
|
485
500
|
tableConfig: t,
|
|
486
|
-
emitTableConfigUpdate:
|
|
487
|
-
onExternalConfigChange:
|
|
501
|
+
emitTableConfigUpdate: o,
|
|
502
|
+
onExternalConfigChange: l
|
|
488
503
|
}) => {
|
|
489
|
-
const
|
|
490
|
-
|
|
504
|
+
const n = m(() => t.value ? ee({ config: t.value, headers: e.value, pageSize: a.value }) : void 0), u = $(
|
|
505
|
+
n.value ?? ee({ config: void 0, headers: e.value, pageSize: a.value })
|
|
491
506
|
);
|
|
492
|
-
|
|
493
|
-
|
|
507
|
+
_(n, (C) => {
|
|
508
|
+
C && !se(C, u.value) && (u.value = C, l?.(C));
|
|
494
509
|
});
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
config: { ...u.value, ...
|
|
510
|
+
const p = (C) => {
|
|
511
|
+
const k = ee({
|
|
512
|
+
config: { ...u.value, ...C },
|
|
498
513
|
headers: e.value,
|
|
499
514
|
pageSize: a.value
|
|
500
515
|
});
|
|
501
|
-
|
|
502
|
-
}
|
|
516
|
+
se(k, u.value) || (u.value = k, o(k));
|
|
517
|
+
};
|
|
518
|
+
_(e, () => {
|
|
519
|
+
t.value || p({});
|
|
520
|
+
}, { deep: !0 });
|
|
521
|
+
const r = m(() => ({
|
|
503
522
|
sortColumnKey: u.value.sortColumnKey,
|
|
504
523
|
sortColumnOrder: u.value.sortColumnOrder
|
|
505
|
-
})),
|
|
524
|
+
})), f = m(() => t.value?.pageSize ?? a.value);
|
|
506
525
|
return {
|
|
507
|
-
activeTableConfig:
|
|
526
|
+
activeTableConfig: J(u),
|
|
508
527
|
activeSort: r,
|
|
509
|
-
activePageSize:
|
|
510
|
-
patchTableConfig:
|
|
528
|
+
activePageSize: f,
|
|
529
|
+
patchTableConfig: p
|
|
511
530
|
};
|
|
512
|
-
},
|
|
531
|
+
}, ot = ({
|
|
513
532
|
cellClick: e,
|
|
514
533
|
headers: a,
|
|
515
534
|
rowClick: t
|
|
516
535
|
}) => {
|
|
517
|
-
const
|
|
536
|
+
const o = m(() => new Set(
|
|
518
537
|
a.value.filter((r) => r.disableRowClick).map((r) => r.key)
|
|
519
|
-
)),
|
|
520
|
-
const
|
|
521
|
-
return
|
|
522
|
-
},
|
|
523
|
-
const
|
|
524
|
-
return !!(
|
|
538
|
+
)), l = (r) => {
|
|
539
|
+
const f = r.event?.target;
|
|
540
|
+
return f instanceof Element ? f.closest(".ag-cell")?.getAttribute("col-id") ?? void 0 : void 0;
|
|
541
|
+
}, n = (r) => {
|
|
542
|
+
const f = l(r);
|
|
543
|
+
return !!(f && o.value.has(f));
|
|
525
544
|
};
|
|
526
545
|
return {
|
|
527
546
|
onCellClick: (r) => {
|
|
528
|
-
const
|
|
529
|
-
!r.data || !
|
|
530
|
-
columnKey:
|
|
547
|
+
const f = r.colDef.colId;
|
|
548
|
+
!r.data || !f || e({
|
|
549
|
+
columnKey: f,
|
|
531
550
|
row: r.data,
|
|
532
551
|
value: r.value
|
|
533
552
|
});
|
|
534
553
|
},
|
|
535
554
|
onRowClick: (r) => {
|
|
536
|
-
r.data && !
|
|
555
|
+
r.data && !n(r) && t(r.data, r);
|
|
537
556
|
}
|
|
538
557
|
};
|
|
539
|
-
},
|
|
558
|
+
}, lt = ({
|
|
540
559
|
activeSort: e,
|
|
541
560
|
emitSort: a,
|
|
542
561
|
patchTableConfig: t
|
|
543
562
|
}) => {
|
|
544
|
-
const
|
|
545
|
-
|
|
563
|
+
const o = (n, u) => {
|
|
564
|
+
n.applyColumnState({
|
|
546
565
|
state: u.sortColumnKey ? [{ colId: u.sortColumnKey, sort: u.sortColumnOrder ?? null, sortIndex: 0 }] : [],
|
|
547
566
|
defaultState: { sort: null, sortIndex: null }
|
|
548
567
|
});
|
|
549
568
|
};
|
|
550
|
-
return { onSortChanged: (
|
|
551
|
-
const u =
|
|
552
|
-
r.sortColumnKey === e.value.sortColumnKey && r.sortColumnOrder === e.value.sortColumnOrder || (a(r), t(r), u.length > 1 &&
|
|
553
|
-
}, applySortToGrid:
|
|
569
|
+
return { onSortChanged: (n) => {
|
|
570
|
+
const u = n.api.getColumnState().filter((f) => f.sort).sort((f, C) => (f.sortIndex ?? 0) - (C.sortIndex ?? 0)), p = u[u.length - 1], r = p ? { sortColumnKey: p.colId, sortColumnOrder: p.sort } : { sortColumnKey: void 0, sortColumnOrder: void 0 };
|
|
571
|
+
r.sortColumnKey === e.value.sortColumnKey && r.sortColumnOrder === e.value.sortColumnOrder || (a(r), t(r), u.length > 1 && o(n.api, r));
|
|
572
|
+
}, applySortToGrid: o };
|
|
554
573
|
}, nt = {
|
|
555
574
|
key: 0,
|
|
556
575
|
class: "table-error-state",
|
|
@@ -559,7 +578,7 @@ const { i18n: $e } = ce(), de = (e, a) => {
|
|
|
559
578
|
key: 1,
|
|
560
579
|
class: "table-empty-state",
|
|
561
580
|
"data-testid": "table-empty-state"
|
|
562
|
-
}, st = /* @__PURE__ */
|
|
581
|
+
}, st = /* @__PURE__ */ ie({
|
|
563
582
|
__name: "TableDataGrid",
|
|
564
583
|
props: {
|
|
565
584
|
headers: {},
|
|
@@ -574,121 +593,125 @@ const { i18n: $e } = ce(), de = (e, a) => {
|
|
|
574
593
|
emits: ["grid:ready", "state", "row:click", "cell:click", "sort", "update:tableConfig"],
|
|
575
594
|
setup(e, { emit: a }) {
|
|
576
595
|
De.registerModules([Re, Te, Ee]);
|
|
577
|
-
const t = e.mode ?? "infinite",
|
|
578
|
-
const
|
|
579
|
-
|
|
596
|
+
const t = e.mode ?? "infinite", o = a, { i18n: l } = ve(), { t: n } = l, u = be(), p = q(), r = Se("rootElement"), f = q("body"), C = () => {
|
|
597
|
+
const i = document.fullscreenElement;
|
|
598
|
+
f.value = i instanceof HTMLElement && i.contains(r.value ?? null) ? i : "body";
|
|
580
599
|
};
|
|
581
|
-
|
|
582
|
-
|
|
600
|
+
ue(() => {
|
|
601
|
+
C(), document.addEventListener("fullscreenchange", C);
|
|
583
602
|
}), ke(() => {
|
|
584
|
-
document.removeEventListener("fullscreenchange",
|
|
603
|
+
document.removeEventListener("fullscreenchange", C);
|
|
585
604
|
});
|
|
586
|
-
const { activeTableConfig:
|
|
587
|
-
headers:
|
|
588
|
-
pageSize:
|
|
589
|
-
tableConfig:
|
|
590
|
-
emitTableConfigUpdate: (
|
|
591
|
-
onExternalConfigChange: (
|
|
592
|
-
|
|
605
|
+
const { activeTableConfig: k, activeSort: D, activePageSize: R, patchTableConfig: M } = at({
|
|
606
|
+
headers: V(() => e.headers),
|
|
607
|
+
pageSize: V(() => e.pageSize),
|
|
608
|
+
tableConfig: V(() => e.tableConfig),
|
|
609
|
+
emitTableConfigUpdate: (i) => o("update:tableConfig", i),
|
|
610
|
+
onExternalConfigChange: (i) => {
|
|
611
|
+
p.value && v(p.value, i);
|
|
593
612
|
}
|
|
594
|
-
}), { onSortChanged:
|
|
595
|
-
activeSort:
|
|
596
|
-
emitSort: (
|
|
597
|
-
patchTableConfig:
|
|
598
|
-
}),
|
|
599
|
-
cellClick: (
|
|
600
|
-
headers:
|
|
601
|
-
rowClick: (
|
|
602
|
-
}),
|
|
613
|
+
}), { onSortChanged: s, applySortToGrid: v } = lt({
|
|
614
|
+
activeSort: D,
|
|
615
|
+
emitSort: (i) => o("sort", i),
|
|
616
|
+
patchTableConfig: M
|
|
617
|
+
}), b = m(() => t === "unpaginated" && !!k.value.fitToContent), B = xe.withParams({ autoHeightMinBodyHeight: 0 }), { onCellClick: E, onRowClick: K } = ot({
|
|
618
|
+
cellClick: (i) => o("cell:click", i),
|
|
619
|
+
headers: V(() => e.headers),
|
|
620
|
+
rowClick: (i, A) => o("row:click", i, A)
|
|
621
|
+
}), I = {
|
|
603
622
|
resizable: !1,
|
|
604
623
|
sortable: !1,
|
|
605
624
|
suppressMovable: !0
|
|
606
|
-
},
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
fetcher: z(() => e.fetcher),
|
|
613
|
-
resetKey: g,
|
|
614
|
-
sort: R
|
|
615
|
-
}) : void 0, s = c?.datasource, f = d(() => c ? c.data.value : e.rows), C = d(() => c?.isFetching.value ?? !1), T = d(() => e.rows ? Array.from(e.rows) : void 0), { columnDefs: J, gridContext: B } = tt({
|
|
616
|
-
headers: z(() => e.headers),
|
|
625
|
+
}, L = m(() => [R.value, e.refreshKey]), F = t === "infinite" ? _e({
|
|
626
|
+
fetcher: V(() => e.fetcher),
|
|
627
|
+
resetKey: L,
|
|
628
|
+
sort: D
|
|
629
|
+
}) : void 0, T = F?.datasource, P = m(() => F ? F.data.value : e.rows), y = m(() => F?.isFetching.value ?? !1), x = m(() => e.rows ? Array.from(e.rows) : void 0), { columnDefs: G, gridContext: U } = tt({
|
|
630
|
+
headers: V(() => e.headers),
|
|
617
631
|
mode: t,
|
|
618
|
-
rows:
|
|
632
|
+
rows: x,
|
|
619
633
|
slots: u,
|
|
620
|
-
tooltipTarget:
|
|
621
|
-
initialSort:
|
|
634
|
+
tooltipTarget: f,
|
|
635
|
+
initialSort: D.value
|
|
622
636
|
}), {
|
|
623
|
-
fetchState:
|
|
624
|
-
hasData:
|
|
625
|
-
state:
|
|
626
|
-
} =
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
),
|
|
631
|
-
|
|
632
|
-
emitState: (
|
|
633
|
-
fetchLifecycleState:
|
|
634
|
-
hasData:
|
|
637
|
+
fetchState: c,
|
|
638
|
+
hasData: d,
|
|
639
|
+
state: h
|
|
640
|
+
} = Fe(
|
|
641
|
+
P,
|
|
642
|
+
V(() => F?.error.value),
|
|
643
|
+
y
|
|
644
|
+
), w = m(() => h.value === c.SUCCESS && !d.value);
|
|
645
|
+
F && Ge({
|
|
646
|
+
emitState: (i) => o("state", i),
|
|
647
|
+
fetchLifecycleState: h,
|
|
648
|
+
hasData: d
|
|
635
649
|
});
|
|
636
|
-
const
|
|
637
|
-
|
|
650
|
+
const g = () => {
|
|
651
|
+
const i = p.value;
|
|
652
|
+
if (!i || i.isDestroyed())
|
|
653
|
+
return;
|
|
654
|
+
const A = D.value, z = i.getColumnState().find((Z) => Z.sort);
|
|
655
|
+
z?.colId === A.sortColumnKey && (z?.sort ?? void 0) === A.sortColumnOrder || v(i, A);
|
|
656
|
+
};
|
|
657
|
+
_([p, D], g);
|
|
658
|
+
const W = (i) => {
|
|
659
|
+
p.value = i.api, o("grid:ready", i.api);
|
|
638
660
|
};
|
|
639
|
-
return (
|
|
640
|
-
const
|
|
641
|
-
return
|
|
661
|
+
return (i, A) => {
|
|
662
|
+
const z = ce("KEmptyState");
|
|
663
|
+
return O(), N("div", {
|
|
642
664
|
ref_key: "rootElement",
|
|
643
665
|
ref: r,
|
|
644
|
-
class:
|
|
666
|
+
class: de(["kong-ui-public-table-data-grid", { "fit-to-content": b.value }]),
|
|
645
667
|
"data-testid": "table-data-grid"
|
|
646
668
|
}, [
|
|
647
|
-
e.error ? (
|
|
648
|
-
|
|
649
|
-
|
|
669
|
+
e.error ? (O(), N("div", nt, [
|
|
670
|
+
X(i.$slots, "error-state", {}, () => [
|
|
671
|
+
ae(z, {
|
|
650
672
|
"icon-variant": "error",
|
|
651
|
-
message: S(
|
|
652
|
-
title: S(
|
|
673
|
+
message: S(n)("errorState.message"),
|
|
674
|
+
title: S(n)("errorState.title")
|
|
653
675
|
}, null, 8, ["message", "title"])
|
|
654
676
|
], !0)
|
|
655
|
-
])) :
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
message: S(
|
|
659
|
-
title: S(
|
|
677
|
+
])) : w.value ? (O(), N("div", rt, [
|
|
678
|
+
X(i.$slots, "empty-state", {}, () => [
|
|
679
|
+
ae(z, {
|
|
680
|
+
message: S(n)("emptyState.message"),
|
|
681
|
+
title: S(n)("emptyState.title")
|
|
660
682
|
}, null, 8, ["message", "title"])
|
|
661
683
|
], !0)
|
|
662
|
-
])) : (
|
|
684
|
+
])) : (O(), te(S(we), {
|
|
663
685
|
key: 2,
|
|
664
|
-
"cache-block-size": S(t) === "infinite" ? S(
|
|
686
|
+
"cache-block-size": S(t) === "infinite" ? S(R) : void 0,
|
|
665
687
|
class: "table-data-grid-grid",
|
|
666
|
-
"column-defs": S(
|
|
667
|
-
context: S(
|
|
668
|
-
datasource: S(t) === "infinite" ? S(
|
|
669
|
-
"default-col-def":
|
|
670
|
-
"dom-layout":
|
|
688
|
+
"column-defs": S(G),
|
|
689
|
+
context: S(U),
|
|
690
|
+
datasource: S(t) === "infinite" ? S(T) : void 0,
|
|
691
|
+
"default-col-def": I,
|
|
692
|
+
"dom-layout": b.value ? "autoHeight" : "normal",
|
|
671
693
|
"infinite-initial-row-count": S(t) === "infinite" ? 1 : void 0,
|
|
672
|
-
loading:
|
|
673
|
-
"row-data": S(t) === "unpaginated" ?
|
|
694
|
+
loading: y.value,
|
|
695
|
+
"row-data": S(t) === "unpaginated" ? x.value : void 0,
|
|
674
696
|
"row-model-type": S(t) === "unpaginated" ? "clientSide" : "infinite",
|
|
675
697
|
"suppress-cell-focus": !0,
|
|
676
698
|
"suppress-multi-sort": !0,
|
|
677
|
-
theme: S(
|
|
678
|
-
onCellClicked: S(
|
|
679
|
-
onGridReady:
|
|
680
|
-
|
|
681
|
-
|
|
699
|
+
theme: S(B),
|
|
700
|
+
onCellClicked: S(E),
|
|
701
|
+
onGridReady: W,
|
|
702
|
+
onNewColumnsLoaded: g,
|
|
703
|
+
onRowClicked: S(K),
|
|
704
|
+
onSortChanged: S(s)
|
|
682
705
|
}, null, 8, ["cache-block-size", "column-defs", "context", "datasource", "dom-layout", "infinite-initial-row-count", "loading", "row-data", "row-model-type", "theme", "onCellClicked", "onRowClicked", "onSortChanged"]))
|
|
683
706
|
], 2);
|
|
684
707
|
};
|
|
685
708
|
}
|
|
686
709
|
}), it = (e, a) => {
|
|
687
710
|
const t = e.__vccOpts || e;
|
|
688
|
-
for (const [
|
|
689
|
-
t[
|
|
711
|
+
for (const [o, l] of a)
|
|
712
|
+
t[o] = l;
|
|
690
713
|
return t;
|
|
691
|
-
}, mt = /* @__PURE__ */ it(st, [["__scopeId", "data-v-
|
|
714
|
+
}, mt = /* @__PURE__ */ it(st, [["__scopeId", "data-v-55b96d28"]]);
|
|
692
715
|
export {
|
|
693
716
|
mt as TableDataGrid
|
|
694
717
|
};
|