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