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