@kong-ui-public/table-data-grid 0.8.5 → 0.8.6-pr.4034.4f13776a5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content,.table-data-grid-cell-slot-content{display:block;min-width:0;width:100%}.table-data-grid-cell-renderer{align-items:center;display:flex;font-feature-settings:"case";font-variant-numeric:tabular-nums;gap:4px;gap:var(--kui-space-20, 4px)}.table-data-grid-cell-label{align-items:center;display:flex;flex:1 1 auto;gap:4px;gap:var(--kui-space-20, 4px);min-width:0}.table-data-grid-cell-label-track{display:grid;flex:1 1 auto;grid-template-columns:minmax(0,1fr);min-width:0}.table-data-grid-cell-label-track>*{grid-area:1/1}.table-data-grid-cell-label-sizer{height:0;visibility:hidden}.table-data-grid-cell-sizer-value:before,.table-data-grid-cell-sizer-relative:before{content:attr(data-text);white-space:nowrap}.table-data-grid-cell-sizer-value{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-renderer--bar{display:grid;grid-template-columns:minmax(0,max-content) minmax(80px,1fr)}.table-data-grid-cell-content,.table-data-grid-cell-slot-content,.table-data-grid-cell-relative{white-space:nowrap}.table-data-grid-cell-relative,.table-data-grid-cell-sizer-relative{flex-shrink:0;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:400;font-weight:var(--kui-font-weight-regular, 400)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-slot-content{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-renderer--text-warning{color:#995c00;color:var(--kui-color-text-warning, #995c00)}.table-data-grid-cell-renderer--text-error{color:#d60027;color:var(--kui-color-text-danger, #d60027)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-content{flex:0 1 auto;width:auto}.table-data-grid-cell-bar{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);border-radius:100px;border-radius:var(--kui-border-radius-round, 100px);display:block;height:8px;min-width:80px;overflow:hidden;width:100%}.table-data-grid-cell-bar-fill{background-color:#6a86d2;border-radius:inherit;display:block;height:100%}.table-data-grid-cell-bar[data-threshold=warning] .table-data-grid-cell-bar-fill{background-color:#995c00;background-color:var(--kui-color-background-warning, #995c00)}.table-data-grid-cell-bar[data-threshold=error] .table-data-grid-cell-bar-fill{background-color:#d60027;background-color:var(--kui-color-background-danger, #d60027)}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-
|
|
1
|
+
.table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content,.table-data-grid-cell-slot-content{display:block;min-width:0;width:100%}.table-data-grid-cell-renderer{align-items:center;display:flex;font-feature-settings:"case";font-variant-numeric:tabular-nums;gap:4px;gap:var(--kui-space-20, 4px)}.table-data-grid-cell-label{align-items:center;display:flex;flex:1 1 auto;gap:4px;gap:var(--kui-space-20, 4px);min-width:0}.table-data-grid-cell-label-track{display:grid;flex:1 1 auto;grid-template-columns:minmax(0,1fr);min-width:0}.table-data-grid-cell-label-track>*{grid-area:1/1}.table-data-grid-cell-label-sizer{height:0;visibility:hidden}.table-data-grid-cell-sizer-value:before,.table-data-grid-cell-sizer-relative:before{content:attr(data-text);white-space:nowrap}.table-data-grid-cell-sizer-value{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-renderer--bar{display:grid;grid-template-columns:minmax(0,max-content) minmax(80px,1fr)}.table-data-grid-cell-content,.table-data-grid-cell-slot-content,.table-data-grid-cell-relative{white-space:nowrap}.table-data-grid-cell-relative,.table-data-grid-cell-sizer-relative{flex-shrink:0;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:400;font-weight:var(--kui-font-weight-regular, 400)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-warning .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-content,.table-data-grid-cell-renderer--text-error .table-data-grid-cell-slot-content{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.table-data-grid-cell-renderer--text-warning{color:#995c00;color:var(--kui-color-text-warning, #995c00)}.table-data-grid-cell-renderer--text-error{color:#d60027;color:var(--kui-color-text-danger, #d60027)}.table-data-grid-cell-renderer--bar .table-data-grid-cell-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--bar .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-slot-content,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-tooltip,.table-data-grid-cell-renderer--percentage .table-data-grid-cell-content{flex:0 1 auto;width:auto}.table-data-grid-cell-bar{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);border-radius:100px;border-radius:var(--kui-border-radius-round, 100px);display:block;height:8px;min-width:80px;overflow:hidden;width:100%}.table-data-grid-cell-bar-fill{background-color:#6a86d2;border-radius:inherit;display:block;height:100%}.table-data-grid-cell-bar[data-threshold=warning] .table-data-grid-cell-bar-fill{background-color:#995c00;background-color:var(--kui-color-background-warning, #995c00)}.table-data-grid-cell-bar[data-threshold=error] .table-data-grid-cell-bar-fill{background-color:#d60027;background-color:var(--kui-color-background-danger, #d60027)}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-82e410f3]{border:none;border-radius:4px;border-radius:var(--kui-border-radius-20, 4px);box-sizing:border-box;display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;width:100%}.kong-ui-public-table-data-grid.fit-to-content[data-v-82e410f3]{height:auto}.table-data-grid-grid[data-v-82e410f3]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-font-size: var(--kui-table-cell-font-size, var(--kui-font-size-30, 14px));--ag-foreground-color: var(--kui-table-cell-color-text, var(--kui-color-text, #0d0e14));--ag-header-background-color: var(--kui-color-background, #ffffff);--ag-header-column-border: 1px solid var(--kui-color-border, #e0e4ea);--ag-header-column-border-height: 30%;--ag-header-column-resize-handle-color: transparent;--ag-header-font-size: var(--kui-table-header-font-size, var(--kui-font-size-30, 14px));--ag-header-font-weight: var(--kui-table-header-font-weight, var(--kui-font-weight-semibold, 600));--ag-header-text-color: var(--kui-table-header-color-text, var(--kui-color-text-neutral, #6c7489));--ag-row-hover-color: var(--kui-table-row-color-background-hover, var(--kui-color-background-primary-weakest, #eefaff));--ag-wrapper-border: none;--ag-wrapper-border-radius: 0;flex:1 1 auto;min-height:0;width:100%}.table-data-grid-grid[data-v-82e410f3] .ag-header{transition:box-shadow .2s ease-in-out;transition:box-shadow var(--kui-animation-duration-20, .2s) ease-in-out;z-index:1}.is-scrolled .table-data-grid-grid[data-v-82e410f3] .ag-header{box-shadow:0 4px 20px #00000014;box-shadow:var(--kui-table-header-shadow-scrolled, var(--kui-shadow, 0px 4px 20px 0px rgba(0, 0, 0, .08)))}.ag-cell{align-items:center;display:flex;min-width:0}.ag-cell-wrapper,.ag-cell-value{min-width:0;width:100%}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { computed as m, watch as
|
|
2
|
-
import { AgGridVue as
|
|
3
|
-
import { ModuleRegistry as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
function
|
|
1
|
+
import { computed as m, watch as A, ref as M, shallowRef as q, readonly as X, shallowReadonly as pe, defineComponent as ue, onMounted as ce, onUnmounted as he, nextTick as ye, resolveComponent as de, openBlock as K, createElementBlock as B, normalizeClass as ve, createElementVNode as j, createBlock as te, resolveDynamicComponent as le, withCtx as ne, createVNode as ae, toDisplayString as re, createCommentVNode as J, normalizeStyle as be, h as Se, renderSlot as Y, useSlots as ke, useTemplateRef as we, onBeforeUnmount as De, toRef as L, unref as D } from "vue";
|
|
2
|
+
import { AgGridVue as Re } from "ag-grid-vue3";
|
|
3
|
+
import { ModuleRegistry as Oe, AllCommunityModule as Te, ClientSideRowModelModule as Ee, InfiniteRowModelModule as xe, themeQuartz as Ke } from "ag-grid-community";
|
|
4
|
+
import { createI18n as Ie, i18nTComponent as Fe } from "@kong-ui-public/i18n";
|
|
5
|
+
var Q = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(Q || {});
|
|
6
|
+
const Ge = (e) => !!e?.length;
|
|
7
|
+
function ze(e, a, t, l = Ge) {
|
|
8
8
|
const o = m(() => l(e.value)), n = m(() => {
|
|
9
9
|
const u = e.value !== void 0, r = a.value !== void 0 && a.value !== null;
|
|
10
10
|
return t.value ? "LOADING" : o.value ? "SUCCESS" : r ? "ERROR" : u ? "SUCCESS" : "PENDING";
|
|
11
11
|
});
|
|
12
12
|
return {
|
|
13
|
-
fetchState:
|
|
13
|
+
fetchState: Q,
|
|
14
14
|
hasData: o,
|
|
15
15
|
state: n
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const Ne = ({
|
|
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
28
|
({ hasData: l, state: o }) => {
|
|
29
|
-
if (o !==
|
|
30
|
-
if (o ===
|
|
29
|
+
if (o !== Q.PENDING) {
|
|
30
|
+
if (o === Q.LOADING) {
|
|
31
31
|
e({
|
|
32
32
|
hasData: l,
|
|
33
33
|
state: "loading"
|
|
34
34
|
});
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
if (o ===
|
|
37
|
+
if (o === Q.ERROR) {
|
|
38
38
|
e({
|
|
39
39
|
hasData: l,
|
|
40
40
|
state: "error"
|
|
@@ -48,13 +48,13 @@ const Ge = ({
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
|
-
},
|
|
51
|
+
}, _e = ({ 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
|
+
}, Be = ({
|
|
58
58
|
startRow: e,
|
|
59
59
|
rowsLength: a,
|
|
60
60
|
pageSize: t,
|
|
@@ -65,14 +65,14 @@ const Ge = ({
|
|
|
65
65
|
return l;
|
|
66
66
|
if (o !== !0 && (o === !1 || a < t))
|
|
67
67
|
return e + a;
|
|
68
|
-
},
|
|
68
|
+
}, Me = ({
|
|
69
69
|
fetcher: e,
|
|
70
70
|
resetKey: a,
|
|
71
71
|
sort: t
|
|
72
72
|
}) => {
|
|
73
|
-
const l = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n =
|
|
74
|
-
let p, R,
|
|
75
|
-
const v = (c) => c === n.value && p === e.value && R === a?.value, S = (c, d) => v(c) && d === g.value &&
|
|
73
|
+
const l = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = M(0), g = M(0), u = q(), r = q(), f = q(), b = M(0), w = M(!1);
|
|
74
|
+
let p, R, V = 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 && V === t?.value?.sortColumnKey && s === t?.value?.sortColumnOrder, $ = (c) => {
|
|
76
76
|
if (!t)
|
|
77
77
|
return !0;
|
|
78
78
|
const d = t.value;
|
|
@@ -80,7 +80,7 @@ const Ge = ({
|
|
|
80
80
|
}, T = () => {
|
|
81
81
|
w.value = b.value > 0;
|
|
82
82
|
}, E = () => {
|
|
83
|
-
g.value += 1,
|
|
83
|
+
g.value += 1, V = t?.value?.sortColumnKey, s = t?.value?.sortColumnOrder;
|
|
84
84
|
for (const c of o.values())
|
|
85
85
|
c.resolve(!1);
|
|
86
86
|
l.clear(), o.clear(), r.value = void 0, f.value = void 0, b.value = 0, T();
|
|
@@ -122,7 +122,7 @@ const Ge = ({
|
|
|
122
122
|
pageSize: y,
|
|
123
123
|
result: k
|
|
124
124
|
}) => {
|
|
125
|
-
k.cursor !== void 0 && l.set(c, k.cursor), C.successCallback(k.data,
|
|
125
|
+
k.cursor !== void 0 && l.set(c, k.cursor), C.successCallback(k.data, Be({
|
|
126
126
|
startRow: C.startRow,
|
|
127
127
|
rowsLength: k.data.length,
|
|
128
128
|
pageSize: y,
|
|
@@ -144,57 +144,57 @@ const Ge = ({
|
|
|
144
144
|
const d = n.value + 1;
|
|
145
145
|
return n.value = d, E(), {
|
|
146
146
|
async getRows(C) {
|
|
147
|
-
if (!v(d) ||
|
|
147
|
+
if (!v(d) || !$(C.sortModel)) {
|
|
148
148
|
C.failCallback();
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
const {
|
|
152
152
|
blockIndex: y,
|
|
153
153
|
pageSize: k
|
|
154
|
-
} =
|
|
154
|
+
} = _e({
|
|
155
155
|
startRow: C.startRow,
|
|
156
156
|
endRow: C.endRow
|
|
157
157
|
});
|
|
158
158
|
y === 0 && o.has(0) && E();
|
|
159
|
-
const z = g.value,
|
|
159
|
+
const z = g.value, N = F(y);
|
|
160
160
|
if (await U({
|
|
161
161
|
blockIndex: y,
|
|
162
|
-
currentBlockCompletion:
|
|
162
|
+
currentBlockCompletion: N,
|
|
163
163
|
datasourceId: d,
|
|
164
164
|
requestGeneration: z
|
|
165
165
|
}) !== "ready" || !S(d, z)) {
|
|
166
|
-
C.failCallback(), O(y,
|
|
166
|
+
C.failCallback(), O(y, N);
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
I();
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
171
|
+
const i = y > 0 ? l.get(y - 1) : void 0, _ = await c({
|
|
172
172
|
mode: "infinite",
|
|
173
173
|
pageSize: k,
|
|
174
|
-
cursor:
|
|
174
|
+
cursor: i,
|
|
175
175
|
// Always read the latest sort, not a stale one.
|
|
176
176
|
sort: t?.value
|
|
177
177
|
});
|
|
178
178
|
if (!S(d, z)) {
|
|
179
|
-
C.failCallback(), O(y,
|
|
179
|
+
C.failCallback(), O(y, N);
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
h({
|
|
183
183
|
blockIndex: y,
|
|
184
|
-
currentBlockCompletion:
|
|
184
|
+
currentBlockCompletion: N,
|
|
185
185
|
getRowsParams: C,
|
|
186
186
|
pageSize: k,
|
|
187
|
-
result:
|
|
187
|
+
result: _
|
|
188
188
|
});
|
|
189
|
-
} catch (
|
|
189
|
+
} catch (i) {
|
|
190
190
|
if (!S(d, z)) {
|
|
191
|
-
C.failCallback(), O(y,
|
|
191
|
+
C.failCallback(), O(y, N);
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
x({
|
|
195
195
|
blockIndex: y,
|
|
196
|
-
currentBlockCompletion:
|
|
197
|
-
fetchError:
|
|
196
|
+
currentBlockCompletion: N,
|
|
197
|
+
fetchError: i,
|
|
198
198
|
getRowsParams: C
|
|
199
199
|
});
|
|
200
200
|
} finally {
|
|
@@ -205,60 +205,60 @@ const Ge = ({
|
|
|
205
205
|
}, W = () => {
|
|
206
206
|
u.value = G();
|
|
207
207
|
};
|
|
208
|
-
return
|
|
208
|
+
return A(
|
|
209
209
|
[e, () => a?.value],
|
|
210
210
|
() => {
|
|
211
211
|
W();
|
|
212
212
|
},
|
|
213
213
|
{ immediate: !0 }
|
|
214
|
-
),
|
|
214
|
+
), A(
|
|
215
215
|
[() => t?.value?.sortColumnKey, () => t?.value?.sortColumnOrder],
|
|
216
216
|
() => E()
|
|
217
217
|
), {
|
|
218
|
-
datasource:
|
|
219
|
-
data:
|
|
220
|
-
error:
|
|
221
|
-
isFetching:
|
|
218
|
+
datasource: X(u),
|
|
219
|
+
data: pe(r),
|
|
220
|
+
error: X(f),
|
|
221
|
+
isFetching: X(w)
|
|
222
222
|
};
|
|
223
|
-
},
|
|
224
|
-
emptyState:
|
|
225
|
-
errorState:
|
|
223
|
+
}, Ae = { title: "No Data", message: "There is no data to display." }, Ve = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, $e = {
|
|
224
|
+
emptyState: Ae,
|
|
225
|
+
errorState: Ve
|
|
226
226
|
};
|
|
227
|
-
function
|
|
228
|
-
const e =
|
|
227
|
+
function me() {
|
|
228
|
+
const e = Ie("en-us", $e);
|
|
229
229
|
return {
|
|
230
230
|
i18n: e,
|
|
231
|
-
i18nT:
|
|
231
|
+
i18nT: Fe(e)
|
|
232
232
|
// Translation component <i18n-t>
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
const { i18n:
|
|
235
|
+
const { i18n: Le } = me(), fe = (e, a) => {
|
|
236
236
|
const t = Reflect.get(a, e.key);
|
|
237
237
|
return e.valueFormatter ? e.valueFormatter(t, a) : String(t ?? "");
|
|
238
|
-
},
|
|
238
|
+
}, Z = (e) => typeof e != "number" ? null : Number.isFinite(e) ? e : null, Pe = (e, a) => e.reduce(
|
|
239
239
|
(t, l) => {
|
|
240
|
-
const o =
|
|
240
|
+
const o = Z(Reflect.get(l, a.key));
|
|
241
241
|
return o === null ? t : {
|
|
242
242
|
sum: t.sum + o,
|
|
243
243
|
max: Math.max(t.max, o)
|
|
244
244
|
};
|
|
245
245
|
},
|
|
246
246
|
{ sum: 0, max: 0 }
|
|
247
|
-
),
|
|
247
|
+
), Ue = (e, a) => {
|
|
248
248
|
const t = (a ?? []).filter((n) => Number.isFinite(n.value) && e >= n.value);
|
|
249
249
|
if (!t.length)
|
|
250
250
|
return;
|
|
251
251
|
const l = Math.max(...t.map((n) => n.value));
|
|
252
252
|
return t.filter((n) => n.value === l).some((n) => n.type === "error") ? "error" : "warning";
|
|
253
|
-
},
|
|
253
|
+
}, We = (e, a, t) => {
|
|
254
254
|
if (e === null)
|
|
255
255
|
return 0;
|
|
256
256
|
const l = t === "relative" ? a.sum : a.max;
|
|
257
257
|
return l > 0 ? Math.min(Math.max(e / l, 0), 1) : 0;
|
|
258
|
-
},
|
|
259
|
-
const a = (t) =>
|
|
258
|
+
}, qe = (e) => {
|
|
259
|
+
const a = (t) => Le.formatNumber(t, { maximumFractionDigits: 2 });
|
|
260
260
|
return e > 0 && e < 0.01 ? `< ${a(0.01)} %` : `${a(e)} %`;
|
|
261
|
-
},
|
|
261
|
+
}, Ce = ({
|
|
262
262
|
value: e,
|
|
263
263
|
stats: a,
|
|
264
264
|
header: t
|
|
@@ -266,44 +266,44 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
266
266
|
if (e === null || a.sum <= 0)
|
|
267
267
|
return;
|
|
268
268
|
const l = e / a.sum * 100;
|
|
269
|
-
return t.percentageFormatter?.(l) ??
|
|
270
|
-
},
|
|
269
|
+
return t.percentageFormatter?.(l) ?? qe(l);
|
|
270
|
+
}, se = (e, a) => a !== void 0 && a.length > (e?.length ?? -1) ? a : e, He = ({
|
|
271
271
|
rows: e,
|
|
272
272
|
header: a,
|
|
273
273
|
stats: t
|
|
274
274
|
}) => e.reduce(
|
|
275
275
|
(l, o) => ({
|
|
276
|
-
value:
|
|
277
|
-
relative: a.showPercentage ?
|
|
278
|
-
value:
|
|
276
|
+
value: se(l.value, fe(a, o)) ?? "",
|
|
277
|
+
relative: a.showPercentage ? se(l.relative, Ce({
|
|
278
|
+
value: Z(Reflect.get(o, a.key)),
|
|
279
279
|
stats: t,
|
|
280
280
|
header: a
|
|
281
281
|
})) : void 0
|
|
282
282
|
}),
|
|
283
283
|
{ value: "" }
|
|
284
|
-
),
|
|
284
|
+
), je = ["data-threshold"], Qe = { class: "table-data-grid-cell-label-track" }, Je = { class: "table-data-grid-cell-label" }, Xe = {
|
|
285
285
|
key: 0,
|
|
286
286
|
class: "table-data-grid-cell-relative",
|
|
287
287
|
"data-testid": "table-data-grid-cell-relative"
|
|
288
|
-
},
|
|
288
|
+
}, Ye = {
|
|
289
289
|
key: 0,
|
|
290
290
|
"aria-hidden": "true",
|
|
291
291
|
class: "table-data-grid-cell-label table-data-grid-cell-label-sizer"
|
|
292
|
-
},
|
|
292
|
+
}, Ze = ["data-text"], et = ["data-text"], tt = ["data-threshold"], at = /* @__PURE__ */ ue({
|
|
293
293
|
name: "TableDataGridCellRenderer",
|
|
294
294
|
__name: "TableDataGridCellRenderer",
|
|
295
295
|
props: {
|
|
296
296
|
params: {}
|
|
297
297
|
},
|
|
298
298
|
setup(e, { expose: a }) {
|
|
299
|
-
const t = q(e.params), l =
|
|
299
|
+
const t = q(e.params), l = M(null), o = M(!1), n = m(() => t.value.headerDef ?? {
|
|
300
300
|
key: "",
|
|
301
301
|
label: ""
|
|
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(() =>
|
|
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(() => Z(f.value)), w = m(() => g.value?.stats[n.value.key]), p = m(() => n.value.showPercentage && w.value ? Ce({
|
|
303
303
|
value: b.value,
|
|
304
304
|
stats: w.value,
|
|
305
305
|
header: n.value
|
|
306
|
-
}) : void 0), R = m(() => !!n.value.bar && !!w.value && (b.value !== null || f.value === null || f.value === void 0)),
|
|
306
|
+
}) : void 0), R = m(() => !!n.value.bar && !!w.value && (b.value !== null || f.value === null || f.value === void 0)), V = m(() => R.value && w.value ? We(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 ? Ue(b.value, n.value.thresholds) : void 0), S = m(() => ({
|
|
307
307
|
column: n.value,
|
|
308
308
|
refreshCell: () => {
|
|
309
309
|
const h = t.value.node;
|
|
@@ -313,16 +313,16 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
313
313
|
rowIndex: t.value.node?.rowIndex ?? 0,
|
|
314
314
|
rowValue: t.value.value,
|
|
315
315
|
selected: t.value.node?.isSelected() ?? !1
|
|
316
|
-
})),
|
|
316
|
+
})), $ = (h, { slots: x }) => {
|
|
317
317
|
const G = t.value.colDef?.colId, W = t.value.context?.cells?.slots;
|
|
318
|
-
return !G || G === "cell-icon" || !W?.[G] ? x.default?.() :
|
|
318
|
+
return !G || G === "cell-icon" || !W?.[G] ? x.default?.() : Se(
|
|
319
319
|
"span",
|
|
320
320
|
{ class: "table-data-grid-cell-slot-content" },
|
|
321
|
-
|
|
321
|
+
Y(W, G, S.value, () => x.default?.() ?? [])
|
|
322
322
|
);
|
|
323
323
|
}, T = () => {
|
|
324
324
|
const h = t.value.context?.cells?.slots;
|
|
325
|
-
return h?.["cell-icon"] ?
|
|
325
|
+
return h?.["cell-icon"] ? Y(h, "cell-icon", S.value) : null;
|
|
326
326
|
};
|
|
327
327
|
let E, I, P = !1;
|
|
328
328
|
const F = () => {
|
|
@@ -340,29 +340,29 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
340
340
|
}
|
|
341
341
|
O();
|
|
342
342
|
};
|
|
343
|
-
return
|
|
343
|
+
return ce(() => {
|
|
344
344
|
E = new ResizeObserver(O), U(l.value);
|
|
345
|
-
}),
|
|
345
|
+
}), A(l, U), he(() => {
|
|
346
346
|
P = !0, E?.disconnect(), I !== void 0 && cancelAnimationFrame(I);
|
|
347
347
|
}), a({
|
|
348
348
|
refresh(h) {
|
|
349
|
-
return t.value = h,
|
|
349
|
+
return t.value = h, ye(O), !0;
|
|
350
350
|
}
|
|
351
351
|
}), (h, x) => {
|
|
352
|
-
const G =
|
|
353
|
-
return K(),
|
|
354
|
-
class:
|
|
352
|
+
const G = de("KTooltip");
|
|
353
|
+
return K(), B("span", {
|
|
354
|
+
class: ve(["table-data-grid-cell-renderer", {
|
|
355
355
|
"table-data-grid-cell-renderer--bar": R.value,
|
|
356
356
|
"table-data-grid-cell-renderer--percentage": !!p.value,
|
|
357
357
|
[`table-data-grid-cell-renderer--text-${v.value}`]: !R.value && !!v.value
|
|
358
358
|
}]),
|
|
359
359
|
"data-threshold": v.value
|
|
360
360
|
}, [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
(K(), te(
|
|
364
|
-
(K(), te(
|
|
365
|
-
default:
|
|
361
|
+
j("span", Qe, [
|
|
362
|
+
j("span", Je, [
|
|
363
|
+
(K(), te(le(T))),
|
|
364
|
+
(K(), te(le($), null, {
|
|
365
|
+
default: ne(() => [
|
|
366
366
|
ae(G, {
|
|
367
367
|
class: "table-data-grid-cell-tooltip",
|
|
368
368
|
disabled: !o.value,
|
|
@@ -372,48 +372,48 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
372
372
|
target: u.value,
|
|
373
373
|
text: r.value
|
|
374
374
|
}, {
|
|
375
|
-
default:
|
|
376
|
-
|
|
375
|
+
default: ne(() => [
|
|
376
|
+
j("span", {
|
|
377
377
|
ref_key: "contentElement",
|
|
378
378
|
ref: l,
|
|
379
379
|
class: "table-data-grid-cell-content"
|
|
380
|
-
},
|
|
380
|
+
}, re(r.value), 513)
|
|
381
381
|
]),
|
|
382
382
|
_: 1
|
|
383
383
|
}, 8, ["disabled", "target", "text"])
|
|
384
384
|
]),
|
|
385
385
|
_: 1
|
|
386
386
|
})),
|
|
387
|
-
p.value ? (K(),
|
|
387
|
+
p.value ? (K(), B("span", Xe, "(" + re(p.value) + ")", 1)) : J("", !0)
|
|
388
388
|
]),
|
|
389
|
-
s.value ? (K(),
|
|
390
|
-
|
|
389
|
+
s.value ? (K(), B("span", Ye, [
|
|
390
|
+
j("span", {
|
|
391
391
|
class: "table-data-grid-cell-sizer-value",
|
|
392
392
|
"data-text": s.value.value
|
|
393
|
-
}, null, 8,
|
|
394
|
-
s.value.relative ? (K(),
|
|
393
|
+
}, null, 8, Ze),
|
|
394
|
+
s.value.relative ? (K(), B("span", {
|
|
395
395
|
key: 0,
|
|
396
396
|
class: "table-data-grid-cell-sizer-relative",
|
|
397
397
|
"data-text": `(${s.value.relative})`
|
|
398
|
-
}, null, 8,
|
|
399
|
-
])) :
|
|
398
|
+
}, null, 8, et)) : J("", !0)
|
|
399
|
+
])) : J("", !0)
|
|
400
400
|
]),
|
|
401
|
-
R.value ? (K(),
|
|
401
|
+
R.value ? (K(), B("span", {
|
|
402
402
|
key: 0,
|
|
403
403
|
class: "table-data-grid-cell-bar",
|
|
404
404
|
"data-testid": "table-data-grid-cell-bar",
|
|
405
405
|
"data-threshold": v.value
|
|
406
406
|
}, [
|
|
407
|
-
|
|
407
|
+
j("span", {
|
|
408
408
|
class: "table-data-grid-cell-bar-fill",
|
|
409
409
|
"data-testid": "table-data-grid-cell-bar-fill",
|
|
410
|
-
style:
|
|
410
|
+
style: be({ width: `${V.value}%` })
|
|
411
411
|
}, null, 4)
|
|
412
|
-
], 8,
|
|
413
|
-
], 10,
|
|
412
|
+
], 8, tt)) : J("", !0)
|
|
413
|
+
], 10, je);
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
|
-
}),
|
|
416
|
+
}), ot = ({
|
|
417
417
|
headers: e,
|
|
418
418
|
slots: a,
|
|
419
419
|
initialSort: t,
|
|
@@ -422,14 +422,14 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
422
422
|
tooltipTarget: n
|
|
423
423
|
}) => {
|
|
424
424
|
const g = l ?? "infinite", u = /* @__PURE__ */ new Set(), r = (s) => !!(s.showPercentage || s.bar || s.thresholds?.length);
|
|
425
|
-
|
|
425
|
+
A([e, () => o?.value], () => {
|
|
426
426
|
e.value.forEach((s) => {
|
|
427
427
|
if (!r(s))
|
|
428
428
|
return;
|
|
429
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((
|
|
431
|
-
const T = Reflect.get(
|
|
432
|
-
return T != null &&
|
|
430
|
+
if (g === "infinite" && (s.showPercentage || s.bar) ? v = "percentage and bar presentation is only supported in unpaginated mode" : g === "unpaginated" && o?.value?.some(($) => {
|
|
431
|
+
const T = Reflect.get($, s.key);
|
|
432
|
+
return T != null && Z(T) === null;
|
|
433
433
|
}) && (v = "contains non-finite or nonnumeric values; numeric presentation skips those values"), !v)
|
|
434
434
|
return;
|
|
435
435
|
const S = `${s.key}:${v}`;
|
|
@@ -441,14 +441,14 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
441
441
|
return {};
|
|
442
442
|
const s = o?.value ?? [];
|
|
443
443
|
return Object.fromEntries(
|
|
444
|
-
e.value.filter((v) => v.showPercentage || v.bar).map((v) => [v.key,
|
|
444
|
+
e.value.filter((v) => v.showPercentage || v.bar).map((v) => [v.key, Pe(s, v)])
|
|
445
445
|
);
|
|
446
446
|
}), w = m(() => {
|
|
447
447
|
if (g !== "unpaginated")
|
|
448
448
|
return {};
|
|
449
449
|
const s = o?.value ?? [];
|
|
450
450
|
return Object.fromEntries(
|
|
451
|
-
e.value.filter((v) => v.bar).map((v) => [v.key,
|
|
451
|
+
e.value.filter((v) => v.bar).map((v) => [v.key, He({
|
|
452
452
|
rows: s,
|
|
453
453
|
header: v,
|
|
454
454
|
stats: b.value[v.key]
|
|
@@ -473,9 +473,9 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
473
473
|
unSortIcon: s.showSortIcon,
|
|
474
474
|
...v ? { initialSort: t?.sortColumnOrder, initialSortIndex: 0 } : {},
|
|
475
475
|
valueGetter: (S) => S.data?.[s.key],
|
|
476
|
-
valueFormatter: (S) => S.data ?
|
|
476
|
+
valueFormatter: (S) => S.data ? fe(s, S.data) : String(S.value ?? ""),
|
|
477
477
|
width: s.width,
|
|
478
|
-
cellRenderer:
|
|
478
|
+
cellRenderer: at,
|
|
479
479
|
// custom params passed to the cell renderer.
|
|
480
480
|
cellRendererParams: { headerDef: s }
|
|
481
481
|
};
|
|
@@ -496,7 +496,7 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
496
496
|
pageSize: e?.pageSize ?? t,
|
|
497
497
|
...e?.fitToContent !== void 0 ? { fitToContent: e.fitToContent } : {}
|
|
498
498
|
};
|
|
499
|
-
},
|
|
499
|
+
}, ie = (e, a) => e.sortColumnKey === a.sortColumnKey && e.sortColumnOrder === a.sortColumnOrder && e.pageSize === a.pageSize && e.fitToContent === a.fitToContent, lt = ({
|
|
500
500
|
headers: e,
|
|
501
501
|
pageSize: a,
|
|
502
502
|
tableConfig: t,
|
|
@@ -504,11 +504,11 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
504
504
|
emitTableConfigUpdate: o,
|
|
505
505
|
onExternalConfigChange: n
|
|
506
506
|
}) => {
|
|
507
|
-
const g = m(() => t.value ? ee({ config: t.value, headers: e.value, pageSize: a.value }) : void 0), u =
|
|
507
|
+
const g = m(() => t.value ? ee({ config: t.value, headers: e.value, pageSize: a.value }) : void 0), u = M(
|
|
508
508
|
g.value ?? ee({ config: void 0, headers: e.value, pageSize: a.value })
|
|
509
509
|
);
|
|
510
|
-
|
|
511
|
-
w && !
|
|
510
|
+
A(g, (w) => {
|
|
511
|
+
w && !ie(w, u.value) && (u.value = w, n?.(w));
|
|
512
512
|
});
|
|
513
513
|
const r = (w) => {
|
|
514
514
|
const p = ee({
|
|
@@ -516,9 +516,9 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
516
516
|
headers: e.value,
|
|
517
517
|
pageSize: a.value
|
|
518
518
|
});
|
|
519
|
-
|
|
519
|
+
ie(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
520
|
};
|
|
521
|
-
|
|
521
|
+
A(e, () => {
|
|
522
522
|
t.value || r({});
|
|
523
523
|
}, { deep: !0 });
|
|
524
524
|
const f = m(() => ({
|
|
@@ -526,12 +526,12 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
526
526
|
sortColumnOrder: u.value.sortColumnOrder
|
|
527
527
|
})), b = m(() => t.value?.pageSize ?? a.value);
|
|
528
528
|
return {
|
|
529
|
-
activeTableConfig:
|
|
529
|
+
activeTableConfig: X(u),
|
|
530
530
|
activeSort: f,
|
|
531
531
|
activePageSize: b,
|
|
532
532
|
patchTableConfig: r
|
|
533
533
|
};
|
|
534
|
-
},
|
|
534
|
+
}, nt = ({
|
|
535
535
|
cellClick: e,
|
|
536
536
|
headers: a,
|
|
537
537
|
rowClick: t
|
|
@@ -558,7 +558,7 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
558
558
|
r.data && !n(r) && t(r.data, r);
|
|
559
559
|
}
|
|
560
560
|
};
|
|
561
|
-
},
|
|
561
|
+
}, rt = ({
|
|
562
562
|
activeSort: e,
|
|
563
563
|
patchTableConfig: a
|
|
564
564
|
}) => {
|
|
@@ -572,15 +572,15 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
572
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
573
|
(u.sortColumnKey !== e.value.sortColumnKey || u.sortColumnOrder !== e.value.sortColumnOrder) && a(u), n.length > 1 && t(o.api, u);
|
|
574
574
|
}, applySortToGrid: t };
|
|
575
|
-
},
|
|
575
|
+
}, st = {
|
|
576
576
|
key: 0,
|
|
577
577
|
class: "table-error-state",
|
|
578
578
|
"data-testid": "table-error-state"
|
|
579
|
-
},
|
|
579
|
+
}, it = {
|
|
580
580
|
key: 1,
|
|
581
581
|
class: "table-empty-state",
|
|
582
582
|
"data-testid": "table-empty-state"
|
|
583
|
-
},
|
|
583
|
+
}, ut = /* @__PURE__ */ ue({
|
|
584
584
|
__name: "TableDataGrid",
|
|
585
585
|
props: {
|
|
586
586
|
headers: {},
|
|
@@ -594,42 +594,42 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
594
594
|
},
|
|
595
595
|
emits: ["grid:ready", "state", "row:click", "cell:click", "sort", "update:tableConfig"],
|
|
596
596
|
setup(e, { emit: a }) {
|
|
597
|
-
|
|
598
|
-
const t = e.mode ?? "infinite", l = a, { i18n: o } =
|
|
597
|
+
Oe.registerModules([Te, Ee, xe]);
|
|
598
|
+
const t = e.mode ?? "infinite", l = a, { i18n: o } = me(), { t: n } = o, g = ke(), u = q(), r = we("rootElement"), f = q("body"), b = () => {
|
|
599
599
|
const i = document.fullscreenElement;
|
|
600
600
|
f.value = i instanceof HTMLElement && i.contains(r.value ?? null) ? i : "body";
|
|
601
601
|
};
|
|
602
|
-
|
|
602
|
+
ce(() => {
|
|
603
603
|
b(), document.addEventListener("fullscreenchange", b);
|
|
604
|
-
}),
|
|
604
|
+
}), De(() => {
|
|
605
605
|
document.removeEventListener("fullscreenchange", b);
|
|
606
606
|
});
|
|
607
|
-
const { activeTableConfig: w, activeSort: p, activePageSize: R, patchTableConfig:
|
|
608
|
-
headers:
|
|
609
|
-
pageSize:
|
|
610
|
-
tableConfig:
|
|
607
|
+
const { activeTableConfig: w, activeSort: p, activePageSize: R, patchTableConfig: V } = lt({
|
|
608
|
+
headers: L(() => e.headers),
|
|
609
|
+
pageSize: L(() => e.pageSize),
|
|
610
|
+
tableConfig: L(() => e.tableConfig),
|
|
611
611
|
emitSort: (i) => l("sort", i),
|
|
612
612
|
emitTableConfigUpdate: (i) => l("update:tableConfig", i),
|
|
613
613
|
onExternalConfigChange: (i) => {
|
|
614
614
|
u.value && v(u.value, i);
|
|
615
615
|
}
|
|
616
|
-
}), { onSortChanged: s, applySortToGrid: v } =
|
|
616
|
+
}), { onSortChanged: s, applySortToGrid: v } = rt({
|
|
617
617
|
activeSort: p,
|
|
618
|
-
patchTableConfig:
|
|
619
|
-
}), S = m(() => t === "unpaginated" && !!w.value.fitToContent),
|
|
618
|
+
patchTableConfig: V
|
|
619
|
+
}), S = m(() => t === "unpaginated" && !!w.value.fitToContent), $ = Ke.withParams({ autoHeightMinBodyHeight: 0 }), { onCellClick: T, onRowClick: E } = nt({
|
|
620
620
|
cellClick: (i) => l("cell:click", i),
|
|
621
|
-
headers:
|
|
622
|
-
rowClick: (i,
|
|
621
|
+
headers: L(() => e.headers),
|
|
622
|
+
rowClick: (i, _) => l("row:click", i, _)
|
|
623
623
|
}), I = {
|
|
624
624
|
resizable: !1,
|
|
625
625
|
sortable: !1,
|
|
626
626
|
suppressMovable: !0
|
|
627
|
-
}, P = m(() => [R.value, e.refreshKey]), F = t === "infinite" ?
|
|
628
|
-
fetcher:
|
|
627
|
+
}, P = m(() => [R.value, e.refreshKey]), F = t === "infinite" ? Me({
|
|
628
|
+
fetcher: L(() => e.fetcher),
|
|
629
629
|
resetKey: P,
|
|
630
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 } =
|
|
632
|
-
headers:
|
|
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 } = ot({
|
|
632
|
+
headers: L(() => e.headers),
|
|
633
633
|
mode: t,
|
|
634
634
|
rows: x,
|
|
635
635
|
slots: g,
|
|
@@ -639,12 +639,12 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
639
639
|
fetchState: c,
|
|
640
640
|
hasData: d,
|
|
641
641
|
state: C
|
|
642
|
-
} =
|
|
642
|
+
} = ze(
|
|
643
643
|
U,
|
|
644
|
-
|
|
644
|
+
L(() => F?.error.value),
|
|
645
645
|
h
|
|
646
646
|
), y = m(() => C.value === c.SUCCESS && !d.value);
|
|
647
|
-
F &&
|
|
647
|
+
F && Ne({
|
|
648
648
|
emitState: (i) => l("state", i),
|
|
649
649
|
fetchLifecycleState: C,
|
|
650
650
|
hasData: d
|
|
@@ -653,37 +653,39 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
653
653
|
const i = u.value;
|
|
654
654
|
if (!i || i.isDestroyed())
|
|
655
655
|
return;
|
|
656
|
-
const
|
|
657
|
-
|
|
656
|
+
const _ = p.value, H = i.getColumnState().find((ge) => ge.sort);
|
|
657
|
+
H?.colId === _.sortColumnKey && (H?.sort ?? void 0) === _.sortColumnOrder || v(i, _);
|
|
658
658
|
};
|
|
659
|
-
|
|
660
|
-
const z = (i) => {
|
|
659
|
+
A([u, p], k);
|
|
660
|
+
const z = M(!1), N = (i) => {
|
|
661
|
+
i.direction === "vertical" && (z.value = i.top > 0);
|
|
662
|
+
}, oe = (i) => {
|
|
661
663
|
u.value = i.api, l("grid:ready", i.api);
|
|
662
664
|
};
|
|
663
|
-
return (i,
|
|
664
|
-
const
|
|
665
|
-
return K(),
|
|
665
|
+
return (i, _) => {
|
|
666
|
+
const H = de("KEmptyState");
|
|
667
|
+
return K(), B("div", {
|
|
666
668
|
ref_key: "rootElement",
|
|
667
669
|
ref: r,
|
|
668
|
-
class:
|
|
670
|
+
class: ve(["kong-ui-public-table-data-grid", { "fit-to-content": S.value, "is-scrolled": z.value }]),
|
|
669
671
|
"data-testid": "table-data-grid"
|
|
670
672
|
}, [
|
|
671
|
-
e.error ? (K(),
|
|
672
|
-
|
|
673
|
-
ae(
|
|
673
|
+
e.error ? (K(), B("div", st, [
|
|
674
|
+
Y(i.$slots, "error-state", {}, () => [
|
|
675
|
+
ae(H, {
|
|
674
676
|
"icon-variant": "error",
|
|
675
677
|
message: D(n)("errorState.message"),
|
|
676
678
|
title: D(n)("errorState.title")
|
|
677
679
|
}, null, 8, ["message", "title"])
|
|
678
680
|
], !0)
|
|
679
|
-
])) : y.value ? (K(),
|
|
680
|
-
|
|
681
|
-
ae(
|
|
681
|
+
])) : y.value ? (K(), B("div", it, [
|
|
682
|
+
Y(i.$slots, "empty-state", {}, () => [
|
|
683
|
+
ae(H, {
|
|
682
684
|
message: D(n)("emptyState.message"),
|
|
683
685
|
title: D(n)("emptyState.title")
|
|
684
686
|
}, null, 8, ["message", "title"])
|
|
685
687
|
], !0)
|
|
686
|
-
])) : (K(), te(D(
|
|
688
|
+
])) : (K(), te(D(Re), {
|
|
687
689
|
key: 2,
|
|
688
690
|
"cache-block-size": D(t) === "infinite" ? D(R) : void 0,
|
|
689
691
|
class: "table-data-grid-grid",
|
|
@@ -698,9 +700,10 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
698
700
|
"row-model-type": D(t) === "unpaginated" ? "clientSide" : "infinite",
|
|
699
701
|
"suppress-cell-focus": !0,
|
|
700
702
|
"suppress-multi-sort": !0,
|
|
701
|
-
theme: D(
|
|
703
|
+
theme: D($),
|
|
704
|
+
onBodyScroll: N,
|
|
702
705
|
onCellClicked: D(T),
|
|
703
|
-
onGridReady:
|
|
706
|
+
onGridReady: oe,
|
|
704
707
|
onNewColumnsLoaded: k,
|
|
705
708
|
onRowClicked: D(E),
|
|
706
709
|
onSortChanged: D(s)
|
|
@@ -708,12 +711,12 @@ const { i18n: Ve } = ve(), me = (e, a) => {
|
|
|
708
711
|
], 2);
|
|
709
712
|
};
|
|
710
713
|
}
|
|
711
|
-
}),
|
|
714
|
+
}), ct = (e, a) => {
|
|
712
715
|
const t = e.__vccOpts || e;
|
|
713
716
|
for (const [l, o] of a)
|
|
714
717
|
t[l] = o;
|
|
715
718
|
return t;
|
|
716
|
-
},
|
|
719
|
+
}, Ct = /* @__PURE__ */ ct(ut, [["__scopeId", "data-v-82e410f3"]]);
|
|
717
720
|
export {
|
|
718
|
-
|
|
721
|
+
Ct as TableDataGrid
|
|
719
722
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x["kong-ui-public-table-data-grid"]={},x.Vue,x.AgGridVue,x.agGridCommunity,x["kong-ui-public-i18n"]))})(this,(function(x,e,Y,L,W){"use strict";var $=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))($||{});const Z=t=>!!t?.length;function ee(t,a,o,n=Z){const l=e.computed(()=>n(t.value)),r=e.computed(()=>{const u=t.value!==void 0,s=a.value!==void 0&&a.value!==null;return o.value?"LOADING":l.value?"SUCCESS":s?"ERROR":u?"SUCCESS":"PENDING"});return{fetchState:$,hasData:l,state:r}}const te=({emitState:t,fetchLifecycleState:a,hasData:o})=>{e.watch(()=>({hasData:o.value,state:a.value}),({hasData:n,state:l})=>{if(l!==$.PENDING){if(l===$.LOADING){t({hasData:n,state:"loading"});return}if(l===$.ERROR){t({hasData:n,state:"error"});return}t({hasData:n,state:"success"})}})},oe=({startRow:t,endRow:a})=>{const o=a-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},ae=({startRow:t,rowsLength:a,pageSize:o,total:n,hasMore:l})=>{if(typeof n=="number")return n;if(l!==!0&&(l===!1||a<o))return t+a},le=({fetcher:t,resetKey:a,sort:o})=>{const n=new Map,l=new Map,r=e.ref(0),g=e.ref(0),u=e.shallowRef(),s=e.shallowRef(),p=e.shallowRef(),b=e.ref(0),w=e.ref(!1);let h,R,z=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;const f=d=>d===r.value&&h===t.value&&R===a?.value,k=(d,m)=>f(d)&&m===g.value&&z===o?.value?.sortColumnKey&&i===o?.value?.sortColumnOrder,G=d=>{if(!o)return!0;const m=o.value;return!m?.sortColumnKey||!m.sortColumnOrder?d.length===0:d.length===1&&d[0].colId===m.sortColumnKey&&d[0].sort===m.sortColumnOrder},E=()=>{w.value=b.value>0},T=()=>{g.value+=1,z=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;for(const d of l.values())d.resolve(!1);n.clear(),l.clear(),s.value=void 0,p.value=void 0,b.value=0,E()},B=()=>{p.value=void 0,b.value+=1,E()},V=()=>{b.value=Math.max(0,b.value-1),E()},K=d=>{const m=l.get(d);if(m)return m;let C;const y={promise:new Promise(S=>{C=S}),resolve:S=>C(S)};return l.set(d,y),y},D=(d,m)=>{m.resolve(!1),l.get(d)===m&&l.delete(d)},M=async({blockIndex:d,currentBlockCompletion:m,datasourceId:C,requestGeneration:y})=>{if(d===0)return"ready";const S=l.get(d-1);if(!S)return D(d,m),"failed";const I=await S.promise;return k(C,y)?I?"ready":(D(d,m),"failed"):(D(d,m),"stale")},v=({blockIndex:d,currentBlockCompletion:m,getRowsParams:C,pageSize:y,result:S})=>{S.cursor!==void 0&&n.set(d,S.cursor),C.successCallback(S.data,ae({startRow:C.startRow,rowsLength:S.data.length,pageSize:y,total:S.total,hasMore:S.hasMore})),C.startRow===0&&(s.value=S.data),m.resolve(!0)},O=({blockIndex:d,currentBlockCompletion:m,fetchError:C,getRowsParams:y})=>{p.value=C,y.failCallback(),D(d,m)},N=()=>{const d=t.value;if(!d)throw new Error("TableDataGrid requires a fetcher in infinite mode");h=d,R=a?.value;const m=r.value+1;return r.value=m,T(),{async getRows(C){if(!f(m)||!G(C.sortModel)){C.failCallback();return}const{blockIndex:y,pageSize:S}=oe({startRow:C.startRow,endRow:C.endRow});y===0&&l.has(0)&&T();const I=g.value,c=K(y);if(await M({blockIndex:y,currentBlockCompletion:c,datasourceId:m,requestGeneration:I})!=="ready"||!k(m,I)){C.failCallback(),D(y,c);return}B();try{const F=y>0?n.get(y-1):void 0,U=await d({mode:"infinite",pageSize:S,cursor:F,sort:o?.value});if(!k(m,I)){C.failCallback(),D(y,c);return}v({blockIndex:y,currentBlockCompletion:c,getRowsParams:C,pageSize:S,result:U})}catch(F){if(!k(m,I)){C.failCallback(),D(y,c);return}O({blockIndex:y,currentBlockCompletion:c,fetchError:F,getRowsParams:C})}finally{k(m,I)&&V()}}}},A=()=>{u.value=N()};return e.watch([t,()=>a?.value],()=>{A()},{immediate:!0}),e.watch([()=>o?.value?.sortColumnKey,()=>o?.value?.sortColumnOrder],()=>T()),{datasource:e.readonly(u),data:e.shallowReadonly(s),error:e.readonly(p),isFetching:e.readonly(w)}},ne={emptyState:{title:"No Data",message:"There is no data to display."},errorState:{title:"An error occurred",message:"Data cannot be displayed due to an error."}};function j(){const t=W.createI18n("en-us",ne);return{i18n:t,i18nT:W.i18nTComponent(t)}}const{i18n:re}=j(),H=(t,a)=>{const o=Reflect.get(a,t.key);return t.valueFormatter?t.valueFormatter(o,a):String(o??"")},q=t=>typeof t!="number"?null:Number.isFinite(t)?t:null,se=(t,a)=>t.reduce((o,n)=>{const l=q(Reflect.get(n,a.key));return l===null?o:{sum:o.sum+l,max:Math.max(o.max,l)}},{sum:0,max:0}),ie=(t,a)=>{const o=(a??[]).filter(r=>Number.isFinite(r.value)&&t>=r.value);if(!o.length)return;const n=Math.max(...o.map(r=>r.value));return o.filter(r=>r.value===n).some(r=>r.type==="error")?"error":"warning"},ce=(t,a,o)=>{if(t===null)return 0;const n=o==="relative"?a.sum:a.max;return n>0?Math.min(Math.max(t/n,0),1):0},ue=t=>{const a=o=>re.formatNumber(o,{maximumFractionDigits:2});return t>0&&t<.01?`< ${a(.01)} %`:`${a(t)} %`},Q=({value:t,stats:a,header:o})=>{if(t===null||a.sum<=0)return;const n=t/a.sum*100;return o.percentageFormatter?.(n)??ue(n)},J=(t,a)=>a!==void 0&&a.length>(t?.length??-1)?a:t,de=({rows:t,header:a,stats:o})=>t.reduce((n,l)=>({value:J(n.value,H(a,l))??"",relative:a.showPercentage?J(n.relative,Q({value:q(Reflect.get(l,a.key)),stats:o,header:a})):void 0}),{value:""}),me=["data-threshold"],fe={class:"table-data-grid-cell-label-track"},pe={class:"table-data-grid-cell-label"},Ce={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},ge={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},he=["data-text"],ve=["data-text"],ye=["data-threshold"],be=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:a}){const o=e.shallowRef(t.params),n=e.ref(null),l=e.ref(!1),r=e.computed(()=>o.value.headerDef??{key:"",label:""}),g=e.computed(()=>o.value.context?.presentation),u=e.computed(()=>o.value.context?.cells?.tooltipTarget?.value??"body"),s=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),p=e.computed(()=>o.value.value),b=e.computed(()=>q(p.value)),w=e.computed(()=>g.value?.stats[r.value.key]),h=e.computed(()=>r.value.showPercentage&&w.value?Q({value:b.value,stats:w.value,header:r.value}):void 0),R=e.computed(()=>!!r.value.bar&&!!w.value&&(b.value!==null||p.value===null||p.value===void 0)),z=e.computed(()=>R.value&&w.value?ce(b.value,w.value,r.value.bar)*100:0),i=e.computed(()=>R.value?g.value?.labelSizers[r.value.key]:void 0),f=e.computed(()=>r.value.thresholds?.length&&b.value!==null?ie(b.value,r.value.thresholds):void 0),k=e.computed(()=>({column:r.value,refreshCell:()=>{const v=o.value.node;v&&o.value.api.refreshCells({force:!0,rowNodes:[v]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),G=(v,{slots:O})=>{const N=o.value.colDef?.colId,A=o.value.context?.cells?.slots;return!N||N==="cell-icon"||!A?.[N]?O.default?.():e.h("span",{class:"table-data-grid-cell-slot-content"},e.renderSlot(A,N,k.value,()=>O.default?.()??[]))},E=()=>{const v=o.value.context?.cells?.slots;return v?.["cell-icon"]?e.renderSlot(v,"cell-icon",k.value):null};let T,B,V=!1;const K=()=>{const v=n.value;l.value=!!v&&v.scrollWidth>v.clientWidth},D=()=>{V||(B!==void 0&&cancelAnimationFrame(B),B=requestAnimationFrame(()=>{B=void 0,K()}))},M=v=>{if(T?.disconnect(),v){T?.observe(v);const O=v.closest(".ag-cell");O&&T?.observe(O)}D()};return e.onMounted(()=>{T=new ResizeObserver(D),M(n.value)}),e.watch(n,M),e.onUnmounted(()=>{V=!0,T?.disconnect(),B!==void 0&&cancelAnimationFrame(B)}),a({refresh(v){return o.value=v,e.nextTick(D),!0}}),(v,O)=>{const N=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":R.value,"table-data-grid-cell-renderer--percentage":!!h.value,[`table-data-grid-cell-renderer--text-${f.value}`]:!R.value&&!!f.value}]),"data-threshold":f.value},[e.createElementVNode("span",fe,[e.createElementVNode("span",pe,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E))),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(G),null,{default:e.withCtx(()=>[e.createVNode(N,{class:"table-data-grid-cell-tooltip",disabled:!l.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:u.value,text:s.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:n,class:"table-data-grid-cell-content"},e.toDisplayString(s.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),h.value?(e.openBlock(),e.createElementBlock("span",Ce,"("+e.toDisplayString(h.value)+")",1)):e.createCommentVNode("",!0)]),i.value?(e.openBlock(),e.createElementBlock("span",ge,[e.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":i.value.value},null,8,he),i.value.relative?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${i.value.relative})`},null,8,ve)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),R.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":f.value},[e.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:e.normalizeStyle({width:`${z.value}%`})},null,4)],8,ye)):e.createCommentVNode("",!0)],10,me)}}}),ke=({headers:t,slots:a,initialSort:o,mode:n,rows:l,tooltipTarget:r})=>{const g=n??"infinite",u=new Set,s=i=>!!(i.showPercentage||i.bar||i.thresholds?.length),p=()=>{t.value.forEach(i=>{if(!s(i))return;let f;if(g==="infinite"&&(i.showPercentage||i.bar)?f="percentage and bar presentation is only supported in unpaginated mode":g==="unpaginated"&&l?.value?.some(G=>{const E=Reflect.get(G,i.key);return E!=null&&q(E)===null})&&(f="contains non-finite or nonnumeric values; numeric presentation skips those values"),!f)return;const k=`${i.key}:${f}`;u.has(k)||(u.add(k),console.warn(`[TableDataGrid] Column "${i.key}" ${f}.`))})};e.watch([t,()=>l?.value],p,{immediate:!0});const b=e.computed(()=>{if(g!=="unpaginated")return{};const i=l?.value??[];return Object.fromEntries(t.value.filter(f=>f.showPercentage||f.bar).map(f=>[f.key,se(i,f)]))}),w=e.computed(()=>{if(g!=="unpaginated")return{};const i=l?.value??[];return Object.fromEntries(t.value.filter(f=>f.bar).map(f=>[f.key,de({rows:i,header:f,stats:b.value[f.key]})]))}),h=e.computed(()=>({cells:{slots:a,tooltipTarget:r},presentation:{stats:b.value,labelSizers:w.value}})),R=i=>{const f=o?.sortColumnKey===i.key;return{colId:i.key,flex:!i.width&&!i.maxWidth?1:void 0,headerName:i.label,maxWidth:i.maxWidth,minWidth:i.minWidth,sortable:i.sortable??!1,unSortIcon:i.showSortIcon,...f?{initialSort:o?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:k=>k.data?.[i.key],valueFormatter:k=>k.data?H(i,k.data):String(k.value??""),width:i.width,cellRenderer:be,cellRendererParams:{headerDef:i}}};return{columnDefs:e.computed(()=>t.value.map(R)),gridContext:h}},P=({config:t,headers:a,pageSize:o})=>{const n=new Set(a.filter(r=>r.sortable).map(r=>r.key)),l=t?.sortColumnKey&&n.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:l,sortColumnOrder:l?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o,...t?.fitToContent!==void 0?{fitToContent:t.fitToContent}:{}}},X=(t,a)=>t.sortColumnKey===a.sortColumnKey&&t.sortColumnOrder===a.sortColumnOrder&&t.pageSize===a.pageSize&&t.fitToContent===a.fitToContent,Se=({headers:t,pageSize:a,tableConfig:o,emitSort:n,emitTableConfigUpdate:l,onExternalConfigChange:r})=>{const g=e.computed(()=>o.value?P({config:o.value,headers:t.value,pageSize:a.value}):void 0),u=e.ref(g.value??P({config:void 0,headers:t.value,pageSize:a.value}));e.watch(g,w=>{w&&!X(w,u.value)&&(u.value=w,r?.(w))});const s=w=>{const h=P({config:{...u.value,...w},headers:t.value,pageSize:a.value});X(h,u.value)||((h.sortColumnKey!==u.value.sortColumnKey||h.sortColumnOrder!==u.value.sortColumnOrder)&&n({sortColumnKey:h.sortColumnKey,sortColumnOrder:h.sortColumnOrder}),u.value=h,l(h))};e.watch(t,()=>{o.value||s({})},{deep:!0});const p=e.computed(()=>({sortColumnKey:u.value.sortColumnKey,sortColumnOrder:u.value.sortColumnOrder})),b=e.computed(()=>o.value?.pageSize??a.value);return{activeTableConfig:e.readonly(u),activeSort:p,activePageSize:b,patchTableConfig:s}},we=({cellClick:t,headers:a,rowClick:o})=>{const n=e.computed(()=>new Set(a.value.filter(s=>s.disableRowClick).map(s=>s.key))),l=s=>{const p=s.event?.target;return p instanceof Element?p.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},r=s=>{const p=l(s);return!!(p&&n.value.has(p))};return{onCellClick:s=>{const p=s.colDef.colId;!s.data||!p||t({columnKey:p,row:s.data,value:s.value})},onRowClick:s=>{s.data&&!r(s)&&o(s.data,s)}}},Re=({activeSort:t,patchTableConfig:a})=>{const o=(l,r)=>{l.applyColumnState({state:r.sortColumnKey?[{colId:r.sortColumnKey,sort:r.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:l=>{const r=l.api.getColumnState().filter(s=>s.sort).sort((s,p)=>(s.sortIndex??0)-(p.sortIndex??0)),g=r[r.length-1],u=g?{sortColumnKey:g.colId,sortColumnOrder:g.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(u.sortColumnKey!==t.value.sortColumnKey||u.sortColumnOrder!==t.value.sortColumnOrder)&&a(u),r.length>1&&o(l.api,u)},applySortToGrid:o}},De={key:0,class:"table-error-state","data-testid":"table-error-state"},Ee={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Te=((t,a)=>{const o=t.__vccOpts||t;for(const[n,l]of a)o[n]=l;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:a}){L.ModuleRegistry.registerModules([L.AllCommunityModule,L.ClientSideRowModelModule,L.InfiniteRowModelModule]);const o=t.mode??"infinite",n=a,{i18n:l}=j(),{t:r}=l,g=e.useSlots(),u=e.shallowRef(),s=e.useTemplateRef("rootElement"),p=e.shallowRef("body"),b=()=>{const c=document.fullscreenElement;p.value=c instanceof HTMLElement&&c.contains(s.value??null)?c:"body"};e.onMounted(()=>{b(),document.addEventListener("fullscreenchange",b)}),e.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",b)});const{activeTableConfig:w,activeSort:h,activePageSize:R,patchTableConfig:z}=Se({headers:e.toRef(()=>t.headers),pageSize:e.toRef(()=>t.pageSize),tableConfig:e.toRef(()=>t.tableConfig),emitSort:c=>n("sort",c),emitTableConfigUpdate:c=>n("update:tableConfig",c),onExternalConfigChange:c=>{u.value&&f(u.value,c)}}),{onSortChanged:i,applySortToGrid:f}=Re({activeSort:h,patchTableConfig:z}),k=e.computed(()=>o==="unpaginated"&&!!w.value.fitToContent),G=L.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:T}=we({cellClick:c=>n("cell:click",c),headers:e.toRef(()=>t.headers),rowClick:(c,_)=>n("row:click",c,_)}),B={resizable:!1,sortable:!1,suppressMovable:!0},V=e.computed(()=>[R.value,t.refreshKey]),K=o==="infinite"?le({fetcher:e.toRef(()=>t.fetcher),resetKey:V,sort:h}):void 0,D=K?.datasource,M=e.computed(()=>K?K.data.value:t.rows),v=e.computed(()=>K?.isFetching.value??!1),O=e.computed(()=>t.rows?Array.from(t.rows):void 0),{columnDefs:N,gridContext:A}=ke({headers:e.toRef(()=>t.headers),mode:o,rows:O,slots:g,tooltipTarget:p,initialSort:h.value}),{fetchState:d,hasData:m,state:C}=ee(M,e.toRef(()=>K?.error.value),v),y=e.computed(()=>C.value===d.SUCCESS&&!m.value);K&&te({emitState:c=>n("state",c),fetchLifecycleState:C,hasData:m});const S=()=>{const c=u.value;if(!c||c.isDestroyed())return;const _=h.value,F=c.getColumnState().find(U=>U.sort);F?.colId===_.sortColumnKey&&(F?.sort??void 0)===_.sortColumnOrder||f(c,_)};e.watch([u,h],S);const I=c=>{u.value=c.api,n("grid:ready",c.api)};return(c,_)=>{const F=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootElement",ref:s,class:e.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":k.value}]),"data-testid":"table-data-grid"},[t.error?(e.openBlock(),e.createElementBlock("div",De,[e.renderSlot(c.$slots,"error-state",{},()=>[e.createVNode(F,{"icon-variant":"error",message:e.unref(r)("errorState.message"),title:e.unref(r)("errorState.title")},null,8,["message","title"])],!0)])):y.value?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(c.$slots,"empty-state",{},()=>[e.createVNode(F,{message:e.unref(r)("emptyState.message"),title:e.unref(r)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(Y.AgGridVue),{key:2,"cache-block-size":e.unref(o)==="infinite"?e.unref(R):void 0,class:"table-data-grid-grid","column-defs":e.unref(N),context:e.unref(A),datasource:e.unref(o)==="infinite"?e.unref(D):void 0,"default-col-def":B,"dom-layout":k.value?"autoHeight":"normal","infinite-initial-row-count":e.unref(o)==="infinite"?1:void 0,loading:v.value,"row-data":e.unref(o)==="unpaginated"?O.value:void 0,"row-model-type":e.unref(o)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(G),onCellClicked:e.unref(E),onGridReady:I,onNewColumnsLoaded:S,onRowClicked:e.unref(T),onSortChanged:e.unref(i)},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"]))],2)}}}),[["__scopeId","data-v-01cd8bcd"]]);x.TableDataGrid=Te,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x["kong-ui-public-table-data-grid"]={},x.Vue,x.AgGridVue,x.agGridCommunity,x["kong-ui-public-i18n"]))})(this,(function(x,e,Z,L,W){"use strict";var $=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))($||{});const ee=t=>!!t?.length;function te(t,a,o,n=ee){const l=e.computed(()=>n(t.value)),r=e.computed(()=>{const u=t.value!==void 0,s=a.value!==void 0&&a.value!==null;return o.value?"LOADING":l.value?"SUCCESS":s?"ERROR":u?"SUCCESS":"PENDING"});return{fetchState:$,hasData:l,state:r}}const oe=({emitState:t,fetchLifecycleState:a,hasData:o})=>{e.watch(()=>({hasData:o.value,state:a.value}),({hasData:n,state:l})=>{if(l!==$.PENDING){if(l===$.LOADING){t({hasData:n,state:"loading"});return}if(l===$.ERROR){t({hasData:n,state:"error"});return}t({hasData:n,state:"success"})}})},ae=({startRow:t,endRow:a})=>{const o=a-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},le=({startRow:t,rowsLength:a,pageSize:o,total:n,hasMore:l})=>{if(typeof n=="number")return n;if(l!==!0&&(l===!1||a<o))return t+a},ne=({fetcher:t,resetKey:a,sort:o})=>{const n=new Map,l=new Map,r=e.ref(0),g=e.ref(0),u=e.shallowRef(),s=e.shallowRef(),p=e.shallowRef(),b=e.ref(0),w=e.ref(!1);let h,R,G=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;const f=d=>d===r.value&&h===t.value&&R===a?.value,k=(d,m)=>f(d)&&m===g.value&&G===o?.value?.sortColumnKey&&i===o?.value?.sortColumnOrder,_=d=>{if(!o)return!0;const m=o.value;return!m?.sortColumnKey||!m.sortColumnOrder?d.length===0:d.length===1&&d[0].colId===m.sortColumnKey&&d[0].sort===m.sortColumnOrder},E=()=>{w.value=b.value>0},T=()=>{g.value+=1,G=o?.value?.sortColumnKey,i=o?.value?.sortColumnOrder;for(const d of l.values())d.resolve(!1);n.clear(),l.clear(),s.value=void 0,p.value=void 0,b.value=0,E()},B=()=>{p.value=void 0,b.value+=1,E()},V=()=>{b.value=Math.max(0,b.value-1),E()},K=d=>{const m=l.get(d);if(m)return m;let C;const y={promise:new Promise(S=>{C=S}),resolve:S=>C(S)};return l.set(d,y),y},D=(d,m)=>{m.resolve(!1),l.get(d)===m&&l.delete(d)},M=async({blockIndex:d,currentBlockCompletion:m,datasourceId:C,requestGeneration:y})=>{if(d===0)return"ready";const S=l.get(d-1);if(!S)return D(d,m),"failed";const I=await S.promise;return k(C,y)?I?"ready":(D(d,m),"failed"):(D(d,m),"stale")},v=({blockIndex:d,currentBlockCompletion:m,getRowsParams:C,pageSize:y,result:S})=>{S.cursor!==void 0&&n.set(d,S.cursor),C.successCallback(S.data,le({startRow:C.startRow,rowsLength:S.data.length,pageSize:y,total:S.total,hasMore:S.hasMore})),C.startRow===0&&(s.value=S.data),m.resolve(!0)},O=({blockIndex:d,currentBlockCompletion:m,fetchError:C,getRowsParams:y})=>{p.value=C,y.failCallback(),D(d,m)},N=()=>{const d=t.value;if(!d)throw new Error("TableDataGrid requires a fetcher in infinite mode");h=d,R=a?.value;const m=r.value+1;return r.value=m,T(),{async getRows(C){if(!f(m)||!_(C.sortModel)){C.failCallback();return}const{blockIndex:y,pageSize:S}=ae({startRow:C.startRow,endRow:C.endRow});y===0&&l.has(0)&&T();const I=g.value,F=K(y);if(await M({blockIndex:y,currentBlockCompletion:F,datasourceId:m,requestGeneration:I})!=="ready"||!k(m,I)){C.failCallback(),D(y,F);return}B();try{const c=y>0?n.get(y-1):void 0,z=await d({mode:"infinite",pageSize:S,cursor:c,sort:o?.value});if(!k(m,I)){C.failCallback(),D(y,F);return}v({blockIndex:y,currentBlockCompletion:F,getRowsParams:C,pageSize:S,result:z})}catch(c){if(!k(m,I)){C.failCallback(),D(y,F);return}O({blockIndex:y,currentBlockCompletion:F,fetchError:c,getRowsParams:C})}finally{k(m,I)&&V()}}}},A=()=>{u.value=N()};return e.watch([t,()=>a?.value],()=>{A()},{immediate:!0}),e.watch([()=>o?.value?.sortColumnKey,()=>o?.value?.sortColumnOrder],()=>T()),{datasource:e.readonly(u),data:e.shallowReadonly(s),error:e.readonly(p),isFetching:e.readonly(w)}},re={emptyState:{title:"No Data",message:"There is no data to display."},errorState:{title:"An error occurred",message:"Data cannot be displayed due to an error."}};function j(){const t=W.createI18n("en-us",re);return{i18n:t,i18nT:W.i18nTComponent(t)}}const{i18n:se}=j(),H=(t,a)=>{const o=Reflect.get(a,t.key);return t.valueFormatter?t.valueFormatter(o,a):String(o??"")},P=t=>typeof t!="number"?null:Number.isFinite(t)?t:null,ie=(t,a)=>t.reduce((o,n)=>{const l=P(Reflect.get(n,a.key));return l===null?o:{sum:o.sum+l,max:Math.max(o.max,l)}},{sum:0,max:0}),ce=(t,a)=>{const o=(a??[]).filter(r=>Number.isFinite(r.value)&&t>=r.value);if(!o.length)return;const n=Math.max(...o.map(r=>r.value));return o.filter(r=>r.value===n).some(r=>r.type==="error")?"error":"warning"},ue=(t,a,o)=>{if(t===null)return 0;const n=o==="relative"?a.sum:a.max;return n>0?Math.min(Math.max(t/n,0),1):0},de=t=>{const a=o=>se.formatNumber(o,{maximumFractionDigits:2});return t>0&&t<.01?`< ${a(.01)} %`:`${a(t)} %`},Q=({value:t,stats:a,header:o})=>{if(t===null||a.sum<=0)return;const n=t/a.sum*100;return o.percentageFormatter?.(n)??de(n)},J=(t,a)=>a!==void 0&&a.length>(t?.length??-1)?a:t,me=({rows:t,header:a,stats:o})=>t.reduce((n,l)=>({value:J(n.value,H(a,l))??"",relative:a.showPercentage?J(n.relative,Q({value:P(Reflect.get(l,a.key)),stats:o,header:a})):void 0}),{value:""}),fe=["data-threshold"],pe={class:"table-data-grid-cell-label-track"},Ce={class:"table-data-grid-cell-label"},ge={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},he={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},ve=["data-text"],ye=["data-text"],be=["data-threshold"],ke=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:a}){const o=e.shallowRef(t.params),n=e.ref(null),l=e.ref(!1),r=e.computed(()=>o.value.headerDef??{key:"",label:""}),g=e.computed(()=>o.value.context?.presentation),u=e.computed(()=>o.value.context?.cells?.tooltipTarget?.value??"body"),s=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),p=e.computed(()=>o.value.value),b=e.computed(()=>P(p.value)),w=e.computed(()=>g.value?.stats[r.value.key]),h=e.computed(()=>r.value.showPercentage&&w.value?Q({value:b.value,stats:w.value,header:r.value}):void 0),R=e.computed(()=>!!r.value.bar&&!!w.value&&(b.value!==null||p.value===null||p.value===void 0)),G=e.computed(()=>R.value&&w.value?ue(b.value,w.value,r.value.bar)*100:0),i=e.computed(()=>R.value?g.value?.labelSizers[r.value.key]:void 0),f=e.computed(()=>r.value.thresholds?.length&&b.value!==null?ce(b.value,r.value.thresholds):void 0),k=e.computed(()=>({column:r.value,refreshCell:()=>{const v=o.value.node;v&&o.value.api.refreshCells({force:!0,rowNodes:[v]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),_=(v,{slots:O})=>{const N=o.value.colDef?.colId,A=o.value.context?.cells?.slots;return!N||N==="cell-icon"||!A?.[N]?O.default?.():e.h("span",{class:"table-data-grid-cell-slot-content"},e.renderSlot(A,N,k.value,()=>O.default?.()??[]))},E=()=>{const v=o.value.context?.cells?.slots;return v?.["cell-icon"]?e.renderSlot(v,"cell-icon",k.value):null};let T,B,V=!1;const K=()=>{const v=n.value;l.value=!!v&&v.scrollWidth>v.clientWidth},D=()=>{V||(B!==void 0&&cancelAnimationFrame(B),B=requestAnimationFrame(()=>{B=void 0,K()}))},M=v=>{if(T?.disconnect(),v){T?.observe(v);const O=v.closest(".ag-cell");O&&T?.observe(O)}D()};return e.onMounted(()=>{T=new ResizeObserver(D),M(n.value)}),e.watch(n,M),e.onUnmounted(()=>{V=!0,T?.disconnect(),B!==void 0&&cancelAnimationFrame(B)}),a({refresh(v){return o.value=v,e.nextTick(D),!0}}),(v,O)=>{const N=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":R.value,"table-data-grid-cell-renderer--percentage":!!h.value,[`table-data-grid-cell-renderer--text-${f.value}`]:!R.value&&!!f.value}]),"data-threshold":f.value},[e.createElementVNode("span",pe,[e.createElementVNode("span",Ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(E))),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_),null,{default:e.withCtx(()=>[e.createVNode(N,{class:"table-data-grid-cell-tooltip",disabled:!l.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:u.value,text:s.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:n,class:"table-data-grid-cell-content"},e.toDisplayString(s.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),h.value?(e.openBlock(),e.createElementBlock("span",ge,"("+e.toDisplayString(h.value)+")",1)):e.createCommentVNode("",!0)]),i.value?(e.openBlock(),e.createElementBlock("span",he,[e.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":i.value.value},null,8,ve),i.value.relative?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${i.value.relative})`},null,8,ye)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),R.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":f.value},[e.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:e.normalizeStyle({width:`${G.value}%`})},null,4)],8,be)):e.createCommentVNode("",!0)],10,fe)}}}),Se=({headers:t,slots:a,initialSort:o,mode:n,rows:l,tooltipTarget:r})=>{const g=n??"infinite",u=new Set,s=i=>!!(i.showPercentage||i.bar||i.thresholds?.length),p=()=>{t.value.forEach(i=>{if(!s(i))return;let f;if(g==="infinite"&&(i.showPercentage||i.bar)?f="percentage and bar presentation is only supported in unpaginated mode":g==="unpaginated"&&l?.value?.some(_=>{const E=Reflect.get(_,i.key);return E!=null&&P(E)===null})&&(f="contains non-finite or nonnumeric values; numeric presentation skips those values"),!f)return;const k=`${i.key}:${f}`;u.has(k)||(u.add(k),console.warn(`[TableDataGrid] Column "${i.key}" ${f}.`))})};e.watch([t,()=>l?.value],p,{immediate:!0});const b=e.computed(()=>{if(g!=="unpaginated")return{};const i=l?.value??[];return Object.fromEntries(t.value.filter(f=>f.showPercentage||f.bar).map(f=>[f.key,ie(i,f)]))}),w=e.computed(()=>{if(g!=="unpaginated")return{};const i=l?.value??[];return Object.fromEntries(t.value.filter(f=>f.bar).map(f=>[f.key,me({rows:i,header:f,stats:b.value[f.key]})]))}),h=e.computed(()=>({cells:{slots:a,tooltipTarget:r},presentation:{stats:b.value,labelSizers:w.value}})),R=i=>{const f=o?.sortColumnKey===i.key;return{colId:i.key,flex:!i.width&&!i.maxWidth?1:void 0,headerName:i.label,maxWidth:i.maxWidth,minWidth:i.minWidth,sortable:i.sortable??!1,unSortIcon:i.showSortIcon,...f?{initialSort:o?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:k=>k.data?.[i.key],valueFormatter:k=>k.data?H(i,k.data):String(k.value??""),width:i.width,cellRenderer:ke,cellRendererParams:{headerDef:i}}};return{columnDefs:e.computed(()=>t.value.map(R)),gridContext:h}},U=({config:t,headers:a,pageSize:o})=>{const n=new Set(a.filter(r=>r.sortable).map(r=>r.key)),l=t?.sortColumnKey&&n.has(t.sortColumnKey)?t.sortColumnKey:void 0;return{sortColumnKey:l,sortColumnOrder:l?t?.sortColumnOrder:void 0,pageSize:t?.pageSize??o,...t?.fitToContent!==void 0?{fitToContent:t.fitToContent}:{}}},X=(t,a)=>t.sortColumnKey===a.sortColumnKey&&t.sortColumnOrder===a.sortColumnOrder&&t.pageSize===a.pageSize&&t.fitToContent===a.fitToContent,we=({headers:t,pageSize:a,tableConfig:o,emitSort:n,emitTableConfigUpdate:l,onExternalConfigChange:r})=>{const g=e.computed(()=>o.value?U({config:o.value,headers:t.value,pageSize:a.value}):void 0),u=e.ref(g.value??U({config:void 0,headers:t.value,pageSize:a.value}));e.watch(g,w=>{w&&!X(w,u.value)&&(u.value=w,r?.(w))});const s=w=>{const h=U({config:{...u.value,...w},headers:t.value,pageSize:a.value});X(h,u.value)||((h.sortColumnKey!==u.value.sortColumnKey||h.sortColumnOrder!==u.value.sortColumnOrder)&&n({sortColumnKey:h.sortColumnKey,sortColumnOrder:h.sortColumnOrder}),u.value=h,l(h))};e.watch(t,()=>{o.value||s({})},{deep:!0});const p=e.computed(()=>({sortColumnKey:u.value.sortColumnKey,sortColumnOrder:u.value.sortColumnOrder})),b=e.computed(()=>o.value?.pageSize??a.value);return{activeTableConfig:e.readonly(u),activeSort:p,activePageSize:b,patchTableConfig:s}},Re=({cellClick:t,headers:a,rowClick:o})=>{const n=e.computed(()=>new Set(a.value.filter(s=>s.disableRowClick).map(s=>s.key))),l=s=>{const p=s.event?.target;return p instanceof Element?p.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},r=s=>{const p=l(s);return!!(p&&n.value.has(p))};return{onCellClick:s=>{const p=s.colDef.colId;!s.data||!p||t({columnKey:p,row:s.data,value:s.value})},onRowClick:s=>{s.data&&!r(s)&&o(s.data,s)}}},De=({activeSort:t,patchTableConfig:a})=>{const o=(l,r)=>{l.applyColumnState({state:r.sortColumnKey?[{colId:r.sortColumnKey,sort:r.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:l=>{const r=l.api.getColumnState().filter(s=>s.sort).sort((s,p)=>(s.sortIndex??0)-(p.sortIndex??0)),g=r[r.length-1],u=g?{sortColumnKey:g.colId,sortColumnOrder:g.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(u.sortColumnKey!==t.value.sortColumnKey||u.sortColumnOrder!==t.value.sortColumnOrder)&&a(u),r.length>1&&o(l.api,u)},applySortToGrid:o}},Ee={key:0,class:"table-error-state","data-testid":"table-error-state"},Te={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Oe=((t,a)=>{const o=t.__vccOpts||t;for(const[n,l]of a)o[n]=l;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(t,{emit:a}){L.ModuleRegistry.registerModules([L.AllCommunityModule,L.ClientSideRowModelModule,L.InfiniteRowModelModule]);const o=t.mode??"infinite",n=a,{i18n:l}=j(),{t:r}=l,g=e.useSlots(),u=e.shallowRef(),s=e.useTemplateRef("rootElement"),p=e.shallowRef("body"),b=()=>{const c=document.fullscreenElement;p.value=c instanceof HTMLElement&&c.contains(s.value??null)?c:"body"};e.onMounted(()=>{b(),document.addEventListener("fullscreenchange",b)}),e.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",b)});const{activeTableConfig:w,activeSort:h,activePageSize:R,patchTableConfig:G}=we({headers:e.toRef(()=>t.headers),pageSize:e.toRef(()=>t.pageSize),tableConfig:e.toRef(()=>t.tableConfig),emitSort:c=>n("sort",c),emitTableConfigUpdate:c=>n("update:tableConfig",c),onExternalConfigChange:c=>{u.value&&f(u.value,c)}}),{onSortChanged:i,applySortToGrid:f}=De({activeSort:h,patchTableConfig:G}),k=e.computed(()=>o==="unpaginated"&&!!w.value.fitToContent),_=L.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:T}=Re({cellClick:c=>n("cell:click",c),headers:e.toRef(()=>t.headers),rowClick:(c,z)=>n("row:click",c,z)}),B={resizable:!1,sortable:!1,suppressMovable:!0},V=e.computed(()=>[R.value,t.refreshKey]),K=o==="infinite"?ne({fetcher:e.toRef(()=>t.fetcher),resetKey:V,sort:h}):void 0,D=K?.datasource,M=e.computed(()=>K?K.data.value:t.rows),v=e.computed(()=>K?.isFetching.value??!1),O=e.computed(()=>t.rows?Array.from(t.rows):void 0),{columnDefs:N,gridContext:A}=Se({headers:e.toRef(()=>t.headers),mode:o,rows:O,slots:g,tooltipTarget:p,initialSort:h.value}),{fetchState:d,hasData:m,state:C}=te(M,e.toRef(()=>K?.error.value),v),y=e.computed(()=>C.value===d.SUCCESS&&!m.value);K&&oe({emitState:c=>n("state",c),fetchLifecycleState:C,hasData:m});const S=()=>{const c=u.value;if(!c||c.isDestroyed())return;const z=h.value,q=c.getColumnState().find(xe=>xe.sort);q?.colId===z.sortColumnKey&&(q?.sort??void 0)===z.sortColumnOrder||f(c,z)};e.watch([u,h],S);const I=e.ref(!1),F=c=>{c.direction==="vertical"&&(I.value=c.top>0)},Y=c=>{u.value=c.api,n("grid:ready",c.api)};return(c,z)=>{const q=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootElement",ref:s,class:e.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":k.value,"is-scrolled":I.value}]),"data-testid":"table-data-grid"},[t.error?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(c.$slots,"error-state",{},()=>[e.createVNode(q,{"icon-variant":"error",message:e.unref(r)("errorState.message"),title:e.unref(r)("errorState.title")},null,8,["message","title"])],!0)])):y.value?(e.openBlock(),e.createElementBlock("div",Te,[e.renderSlot(c.$slots,"empty-state",{},()=>[e.createVNode(q,{message:e.unref(r)("emptyState.message"),title:e.unref(r)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(Z.AgGridVue),{key:2,"cache-block-size":e.unref(o)==="infinite"?e.unref(R):void 0,class:"table-data-grid-grid","column-defs":e.unref(N),context:e.unref(A),datasource:e.unref(o)==="infinite"?e.unref(D):void 0,"default-col-def":B,"dom-layout":k.value?"autoHeight":"normal","infinite-initial-row-count":e.unref(o)==="infinite"?1:void 0,loading:v.value,"row-data":e.unref(o)==="unpaginated"?O.value:void 0,"row-model-type":e.unref(o)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:e.unref(_),onBodyScroll:F,onCellClicked:e.unref(E),onGridReady:Y,onNewColumnsLoaded:S,onRowClicked:e.unref(T),onSortChanged:e.unref(i)},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"]))],2)}}}),[["__scopeId","data-v-82e410f3"]]);x.TableDataGrid=Oe,Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableDataGrid.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGrid.vue"],"names":[],"mappings":"AAoVA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAGV,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAmB1B,QAAA,MAAM,YAAY,GAAK,GAAG,SAAS,MAAM,EACxC,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WAuXO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;;;;;;;KAAmC,CAAC,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC5J,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI;WACtB,GAAG;;qCAnWoB,0BAA0B,CAAC,GAAG,CAAC,KAAK,OAAO;uBAHzD,MAAM,OAAO;uBACb,MAAM,OAAO;qBACf,CAAC,KAAK,EAAE,0BAA0B,CAAC,GAAG,CAAC,KAAK,OAAO;;;YAM5D,YAAY,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI;YACpD,OAAO,WAAW,yBAAyB,GAAG,IAAI;YAClD,WAAW,OAAO,GAAG,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI;YACzD,YAAY,WAAW,6BAA6B,CAAC,GAAG,CAAC,GAAG,IAAI;YAChE,MAAM,WAAW,iBAAiB,GAAG,IAAI;YACzC,oBAAoB,WAAW,mBAAmB,GAAG,IAAI;;EA6V3D,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/table-data-grid",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6-pr.4034.4f13776a5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/table-data-grid.umd.js",
|
|
6
6
|
"module": "./dist/table-data-grid.es.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@kong-ui-public/i18n": "^2.5.1",
|
|
25
|
+
"@kong-ui-public/sandbox-layout": "^2.8.7",
|
|
25
26
|
"@kong/kongponents": "9.66.12",
|
|
26
27
|
"vue": "^3.5.43"
|
|
27
28
|
},
|