@kong-ui-public/table-data-grid 0.3.13 → 0.3.14-pr.3713.ec02931e1.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 +1 -1
- package/dist/table-data-grid.es.js +313 -248
- package/dist/table-data-grid.umd.js +1 -1
- package/dist/types/components/TableDataGrid.vue.d.ts +7 -2
- package/dist/types/components/TableDataGrid.vue.d.ts.map +1 -1
- package/dist/types/components/TableDataGridCellRenderer.vue.d.ts +12 -1
- package/dist/types/components/TableDataGridCellRenderer.vue.d.ts.map +1 -1
- package/dist/types/composables/useFetchInfinite.d.ts.map +1 -1
- package/dist/types/composables/useTableDataGridColumnDefs.d.ts +21 -0
- package/dist/types/composables/useTableDataGridColumnDefs.d.ts.map +1 -0
- package/dist/types/composables/useTableDataGridInteractions.d.ts +17 -0
- package/dist/types/composables/useTableDataGridInteractions.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.table-data-grid-cell-renderer,.table-data-grid-cell-tooltip,.table-data-grid-cell-content{display:block;min-width:0;width:100%}.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{display:block;min-width:0;width:100%}.table-data-grid-cell-content{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-table-data-grid[data-v-e14d8346]{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%}.table-data-grid-grid[data-v-e14d8346]{--ag-background-color: var(--kui-color-background, #ffffff);--ag-border-color: var(--kui-color-border, #e0e4ea);--ag-foreground-color: 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-weight: var(--kui-font-weight-semibold, 600);--ag-header-text-color: var(--kui-color-text-neutral, #6c7489);--ag-wrapper-border: none;--ag-wrapper-border-radius: 0;flex:1 1 auto;min-height:0;width:100%}.ag-cell{align-items:center;display:flex;min-width:0}.ag-cell-wrapper,.ag-cell-value{min-width:0;width:100%}
|
|
@@ -1,276 +1,341 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AgGridVue as
|
|
3
|
-
import { ModuleRegistry as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
const ae = { class: "table-data-grid-cell-renderer" }, oe = /* @__PURE__ */ A({
|
|
6
|
-
name: "TableDataGridCellRenderer",
|
|
7
|
-
__name: "TableDataGridCellRenderer",
|
|
8
|
-
props: {
|
|
9
|
-
params: {}
|
|
10
|
-
},
|
|
11
|
-
setup(e, { expose: i }) {
|
|
12
|
-
const a = N(e.params), t = R(null), r = R(!1), h = k(() => a.value.valueFormatted ?? String(a.value.value ?? ""));
|
|
13
|
-
let f, u, m = !1;
|
|
14
|
-
const C = () => {
|
|
15
|
-
const d = t.value;
|
|
16
|
-
r.value = !!d && d.scrollWidth > d.clientWidth;
|
|
17
|
-
}, p = () => {
|
|
18
|
-
m || (u !== void 0 && cancelAnimationFrame(u), u = requestAnimationFrame(() => {
|
|
19
|
-
u = void 0, C();
|
|
20
|
-
}));
|
|
21
|
-
}, g = (d) => {
|
|
22
|
-
if (f?.disconnect(), d) {
|
|
23
|
-
f?.observe(d);
|
|
24
|
-
const y = d.closest(".ag-cell");
|
|
25
|
-
y && f?.observe(y);
|
|
26
|
-
}
|
|
27
|
-
p();
|
|
28
|
-
};
|
|
29
|
-
return W(() => {
|
|
30
|
-
f = new ResizeObserver(p), g(t.value);
|
|
31
|
-
}), O(t, g, { flush: "post" }), V(() => {
|
|
32
|
-
m = !0, f?.disconnect(), u !== void 0 && cancelAnimationFrame(u);
|
|
33
|
-
}), i({
|
|
34
|
-
refresh(d) {
|
|
35
|
-
return a.value = d, $(p), !0;
|
|
36
|
-
}
|
|
37
|
-
}), (d, y) => {
|
|
38
|
-
const E = T("KTooltip");
|
|
39
|
-
return w(), G("span", ae, [
|
|
40
|
-
I(E, {
|
|
41
|
-
class: "table-data-grid-cell-tooltip",
|
|
42
|
-
disabled: !r.value,
|
|
43
|
-
"kpop-attributes": { popoverDelay: 400 },
|
|
44
|
-
"max-width": "300",
|
|
45
|
-
placement: "bottom-start",
|
|
46
|
-
target: "body",
|
|
47
|
-
text: h.value
|
|
48
|
-
}, {
|
|
49
|
-
default: j(() => [
|
|
50
|
-
q("span", {
|
|
51
|
-
ref_key: "contentElement",
|
|
52
|
-
ref: t,
|
|
53
|
-
class: "table-data-grid-cell-content"
|
|
54
|
-
}, H(h.value), 513)
|
|
55
|
-
]),
|
|
56
|
-
_: 1
|
|
57
|
-
}, 8, ["disabled", "text"])
|
|
58
|
-
]);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
1
|
+
import { computed as g, watch as T, ref as I, shallowRef as N, readonly as G, defineComponent as L, onMounted as $, onUnmounted as P, nextTick as j, resolveComponent as U, openBlock as R, createBlock as V, resolveDynamicComponent as q, createElementBlock as x, createVNode as O, withCtx as H, createElementVNode as Q, toDisplayString as J, useSlots as X, toRef as A, renderSlot as K, unref as C } from "vue";
|
|
2
|
+
import { AgGridVue as Y } from "ag-grid-vue3";
|
|
3
|
+
import { ModuleRegistry as Z, AllCommunityModule as ee, InfiniteRowModelModule as te, themeQuartz as ae } from "ag-grid-community";
|
|
4
|
+
import { createI18n as oe, i18nTComponent as le } from "@kong-ui-public/i18n";
|
|
62
5
|
var F = /* @__PURE__ */ ((e) => (e.PENDING = "PENDING", e.LOADING = "LOADING", e.SUCCESS = "SUCCESS", e.ERROR = "ERROR", e))(F || {});
|
|
63
|
-
const
|
|
64
|
-
function
|
|
65
|
-
const r =
|
|
66
|
-
const
|
|
67
|
-
return
|
|
6
|
+
const ne = (e) => !!e?.length;
|
|
7
|
+
function re(e, c, t, a = ne) {
|
|
8
|
+
const r = g(() => a(e.value)), i = g(() => {
|
|
9
|
+
const y = e.value !== void 0, o = c.value !== void 0 && c.value !== null;
|
|
10
|
+
return t.value ? "LOADING" : r.value ? "SUCCESS" : o ? "ERROR" : y ? "SUCCESS" : "PENDING";
|
|
68
11
|
});
|
|
69
12
|
return {
|
|
70
13
|
fetchState: F,
|
|
71
14
|
hasData: r,
|
|
72
|
-
state:
|
|
15
|
+
state: i
|
|
73
16
|
};
|
|
74
17
|
}
|
|
75
18
|
const se = ({
|
|
76
19
|
emitState: e,
|
|
77
|
-
fetchLifecycleState:
|
|
78
|
-
hasData:
|
|
20
|
+
fetchLifecycleState: c,
|
|
21
|
+
hasData: t
|
|
79
22
|
}) => {
|
|
80
|
-
|
|
23
|
+
T(
|
|
81
24
|
() => ({
|
|
82
|
-
hasData:
|
|
83
|
-
state:
|
|
25
|
+
hasData: t.value,
|
|
26
|
+
state: c.value
|
|
84
27
|
}),
|
|
85
|
-
({ hasData:
|
|
28
|
+
({ hasData: a, state: r }) => {
|
|
86
29
|
if (r !== F.PENDING) {
|
|
87
30
|
if (r === F.LOADING) {
|
|
88
31
|
e({
|
|
89
|
-
hasData:
|
|
32
|
+
hasData: a,
|
|
90
33
|
state: "loading"
|
|
91
34
|
});
|
|
92
35
|
return;
|
|
93
36
|
}
|
|
94
37
|
if (r === F.ERROR) {
|
|
95
38
|
e({
|
|
96
|
-
hasData:
|
|
39
|
+
hasData: a,
|
|
97
40
|
state: "error"
|
|
98
41
|
});
|
|
99
42
|
return;
|
|
100
43
|
}
|
|
101
44
|
e({
|
|
102
|
-
hasData:
|
|
45
|
+
hasData: a,
|
|
103
46
|
state: "success"
|
|
104
47
|
});
|
|
105
48
|
}
|
|
106
49
|
}
|
|
107
50
|
);
|
|
108
|
-
},
|
|
109
|
-
const
|
|
51
|
+
}, ce = ({ startRow: e, endRow: c }) => {
|
|
52
|
+
const t = c - e;
|
|
110
53
|
return {
|
|
111
|
-
blockIndex:
|
|
112
|
-
pageSize:
|
|
54
|
+
blockIndex: t > 0 ? Math.floor(e / t) : 0,
|
|
55
|
+
pageSize: t
|
|
113
56
|
};
|
|
114
57
|
}, ie = ({
|
|
115
58
|
startRow: e,
|
|
116
|
-
rowsLength:
|
|
117
|
-
pageSize:
|
|
118
|
-
total:
|
|
59
|
+
rowsLength: c,
|
|
60
|
+
pageSize: t,
|
|
61
|
+
total: a,
|
|
119
62
|
hasMore: r
|
|
120
63
|
}) => {
|
|
121
|
-
if (typeof
|
|
122
|
-
return
|
|
123
|
-
if (r !== !0 && (r === !1 ||
|
|
124
|
-
return e +
|
|
125
|
-
},
|
|
64
|
+
if (typeof a == "number")
|
|
65
|
+
return a;
|
|
66
|
+
if (r !== !0 && (r === !1 || c < t))
|
|
67
|
+
return e + c;
|
|
68
|
+
}, ue = ({
|
|
126
69
|
fetcher: e,
|
|
127
|
-
resetKey:
|
|
70
|
+
resetKey: c
|
|
128
71
|
}) => {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
139
|
-
let
|
|
140
|
-
const
|
|
141
|
-
promise: new Promise((
|
|
142
|
-
|
|
72
|
+
const t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = I(0), i = N(), v = N(), y = N(), o = I(0), u = I(!1), m = (l) => l === r.value, k = () => {
|
|
73
|
+
u.value = o.value > 0;
|
|
74
|
+
}, E = () => {
|
|
75
|
+
y.value = void 0, o.value += 1, k();
|
|
76
|
+
}, w = () => {
|
|
77
|
+
o.value = Math.max(0, o.value - 1), k();
|
|
78
|
+
}, D = (l) => {
|
|
79
|
+
const s = a.get(l);
|
|
80
|
+
if (s)
|
|
81
|
+
return s;
|
|
82
|
+
let d;
|
|
83
|
+
const h = {
|
|
84
|
+
promise: new Promise((f) => {
|
|
85
|
+
d = f;
|
|
143
86
|
}),
|
|
144
|
-
resolve: (
|
|
87
|
+
resolve: (f) => d(f)
|
|
145
88
|
};
|
|
146
|
-
return
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
blockIndex:
|
|
151
|
-
currentBlockCompletion:
|
|
152
|
-
datasourceId:
|
|
89
|
+
return a.set(l, h), h;
|
|
90
|
+
}, n = (l, s) => {
|
|
91
|
+
s.resolve(!1), a.get(l) === s && a.delete(l);
|
|
92
|
+
}, b = async ({
|
|
93
|
+
blockIndex: l,
|
|
94
|
+
currentBlockCompletion: s,
|
|
95
|
+
datasourceId: d
|
|
153
96
|
}) => {
|
|
154
|
-
if (
|
|
97
|
+
if (l === 0)
|
|
155
98
|
return "ready";
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
158
|
-
return
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
},
|
|
162
|
-
blockIndex:
|
|
163
|
-
currentBlockCompletion:
|
|
164
|
-
getRowsParams:
|
|
165
|
-
pageSize:
|
|
166
|
-
result:
|
|
99
|
+
const h = a.get(l - 1);
|
|
100
|
+
if (!h)
|
|
101
|
+
return n(l, s), "failed";
|
|
102
|
+
const f = await h.promise;
|
|
103
|
+
return m(d) ? f ? "ready" : (n(l, s), "failed") : (n(l, s), "stale");
|
|
104
|
+
}, S = ({
|
|
105
|
+
blockIndex: l,
|
|
106
|
+
currentBlockCompletion: s,
|
|
107
|
+
getRowsParams: d,
|
|
108
|
+
pageSize: h,
|
|
109
|
+
result: f
|
|
167
110
|
}) => {
|
|
168
|
-
|
|
169
|
-
startRow:
|
|
170
|
-
rowsLength:
|
|
171
|
-
pageSize:
|
|
172
|
-
total:
|
|
173
|
-
hasMore:
|
|
174
|
-
})),
|
|
175
|
-
},
|
|
176
|
-
blockIndex:
|
|
177
|
-
currentBlockCompletion:
|
|
178
|
-
fetchError:
|
|
179
|
-
getRowsParams:
|
|
111
|
+
f.cursor !== void 0 && t.set(l, f.cursor), d.successCallback(f.data, ie({
|
|
112
|
+
startRow: d.startRow,
|
|
113
|
+
rowsLength: f.data.length,
|
|
114
|
+
pageSize: h,
|
|
115
|
+
total: f.total,
|
|
116
|
+
hasMore: f.hasMore
|
|
117
|
+
})), d.startRow === 0 && (v.value = f.data), s.resolve(!0);
|
|
118
|
+
}, _ = ({
|
|
119
|
+
blockIndex: l,
|
|
120
|
+
currentBlockCompletion: s,
|
|
121
|
+
fetchError: d,
|
|
122
|
+
getRowsParams: h
|
|
180
123
|
}) => {
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
const
|
|
184
|
-
return r.value =
|
|
185
|
-
async getRows(
|
|
124
|
+
y.value = d, h.failCallback(), n(l, s);
|
|
125
|
+
}, B = () => {
|
|
126
|
+
const l = r.value + 1;
|
|
127
|
+
return r.value = l, t.clear(), a.clear(), v.value = void 0, y.value = void 0, o.value = 0, k(), {
|
|
128
|
+
async getRows(s) {
|
|
186
129
|
const {
|
|
187
|
-
blockIndex:
|
|
188
|
-
pageSize:
|
|
189
|
-
} =
|
|
190
|
-
startRow:
|
|
191
|
-
endRow:
|
|
192
|
-
}),
|
|
193
|
-
blockIndex:
|
|
194
|
-
currentBlockCompletion:
|
|
195
|
-
datasourceId:
|
|
130
|
+
blockIndex: d,
|
|
131
|
+
pageSize: h
|
|
132
|
+
} = ce({
|
|
133
|
+
startRow: s.startRow,
|
|
134
|
+
endRow: s.endRow
|
|
135
|
+
}), f = D(d), z = await b({
|
|
136
|
+
blockIndex: d,
|
|
137
|
+
currentBlockCompletion: f,
|
|
138
|
+
datasourceId: l
|
|
196
139
|
});
|
|
197
140
|
if (z !== "ready") {
|
|
198
|
-
z === "failed" &&
|
|
141
|
+
z === "failed" && s.failCallback();
|
|
199
142
|
return;
|
|
200
143
|
}
|
|
201
|
-
|
|
144
|
+
E();
|
|
202
145
|
try {
|
|
203
|
-
const
|
|
146
|
+
const M = d > 0 ? t.get(d - 1) : void 0, W = await e({
|
|
204
147
|
mode: "infinite",
|
|
205
|
-
pageSize:
|
|
206
|
-
cursor:
|
|
148
|
+
pageSize: h,
|
|
149
|
+
cursor: M
|
|
207
150
|
});
|
|
208
|
-
if (!
|
|
209
|
-
|
|
151
|
+
if (!m(l)) {
|
|
152
|
+
n(d, f);
|
|
210
153
|
return;
|
|
211
154
|
}
|
|
212
|
-
|
|
213
|
-
blockIndex:
|
|
214
|
-
currentBlockCompletion:
|
|
215
|
-
getRowsParams:
|
|
216
|
-
pageSize:
|
|
217
|
-
result:
|
|
155
|
+
S({
|
|
156
|
+
blockIndex: d,
|
|
157
|
+
currentBlockCompletion: f,
|
|
158
|
+
getRowsParams: s,
|
|
159
|
+
pageSize: h,
|
|
160
|
+
result: W
|
|
218
161
|
});
|
|
219
|
-
} catch (
|
|
220
|
-
if (!
|
|
221
|
-
|
|
162
|
+
} catch (M) {
|
|
163
|
+
if (!m(l)) {
|
|
164
|
+
n(d, f);
|
|
222
165
|
return;
|
|
223
166
|
}
|
|
224
|
-
|
|
225
|
-
blockIndex:
|
|
226
|
-
currentBlockCompletion:
|
|
227
|
-
fetchError:
|
|
228
|
-
getRowsParams:
|
|
167
|
+
_({
|
|
168
|
+
blockIndex: d,
|
|
169
|
+
currentBlockCompletion: f,
|
|
170
|
+
fetchError: M,
|
|
171
|
+
getRowsParams: s
|
|
229
172
|
});
|
|
230
173
|
} finally {
|
|
231
|
-
|
|
174
|
+
m(l) && w();
|
|
232
175
|
}
|
|
233
176
|
}
|
|
234
177
|
};
|
|
235
|
-
},
|
|
236
|
-
|
|
178
|
+
}, p = () => {
|
|
179
|
+
i.value = B();
|
|
237
180
|
};
|
|
238
|
-
return
|
|
239
|
-
() =>
|
|
181
|
+
return T(
|
|
182
|
+
() => c?.value,
|
|
240
183
|
() => {
|
|
241
|
-
|
|
184
|
+
p();
|
|
242
185
|
},
|
|
243
186
|
{ immediate: !0 }
|
|
244
187
|
), {
|
|
245
|
-
datasource:
|
|
246
|
-
data:
|
|
247
|
-
error:
|
|
248
|
-
isFetching:
|
|
188
|
+
datasource: G(i),
|
|
189
|
+
data: G(v),
|
|
190
|
+
error: G(y),
|
|
191
|
+
isFetching: G(u)
|
|
192
|
+
};
|
|
193
|
+
}, de = {
|
|
194
|
+
key: 1,
|
|
195
|
+
class: "table-data-grid-cell-renderer"
|
|
196
|
+
}, fe = /* @__PURE__ */ L({
|
|
197
|
+
name: "TableDataGridCellRenderer",
|
|
198
|
+
__name: "TableDataGridCellRenderer",
|
|
199
|
+
props: {
|
|
200
|
+
params: {}
|
|
201
|
+
},
|
|
202
|
+
setup(e, { expose: c }) {
|
|
203
|
+
const t = N(e.params), a = I(null), r = I(!1), i = g(() => t.value.valueFormatted ?? String(t.value.value ?? "")), v = g(() => {
|
|
204
|
+
const n = t.value.colDef?.colId;
|
|
205
|
+
return n ? t.value.context?.cells?.slots?.[n] : void 0;
|
|
206
|
+
}), y = g(() => ({
|
|
207
|
+
column: t.value.headerDef,
|
|
208
|
+
refreshCell: () => {
|
|
209
|
+
const n = t.value.node;
|
|
210
|
+
n && t.value.api.refreshCells({ force: !0, rowNodes: [n] });
|
|
211
|
+
},
|
|
212
|
+
row: t.value.data ?? {},
|
|
213
|
+
rowIndex: t.value.node?.rowIndex ?? 0,
|
|
214
|
+
rowValue: t.value.value,
|
|
215
|
+
selected: t.value.node?.isSelected() ?? !1
|
|
216
|
+
})), o = () => v.value?.(y.value);
|
|
217
|
+
let u, m, k = !1;
|
|
218
|
+
const E = () => {
|
|
219
|
+
const n = a.value;
|
|
220
|
+
r.value = !!n && n.scrollWidth > n.clientWidth;
|
|
221
|
+
}, w = () => {
|
|
222
|
+
k || (m !== void 0 && cancelAnimationFrame(m), m = requestAnimationFrame(() => {
|
|
223
|
+
m = void 0, E();
|
|
224
|
+
}));
|
|
225
|
+
}, D = (n) => {
|
|
226
|
+
if (u?.disconnect(), n) {
|
|
227
|
+
u?.observe(n);
|
|
228
|
+
const b = n.closest(".ag-cell");
|
|
229
|
+
b && u?.observe(b);
|
|
230
|
+
}
|
|
231
|
+
w();
|
|
232
|
+
};
|
|
233
|
+
return $(() => {
|
|
234
|
+
u = new ResizeObserver(w), D(a.value);
|
|
235
|
+
}), T(a, D, { flush: "post" }), P(() => {
|
|
236
|
+
k = !0, u?.disconnect(), m !== void 0 && cancelAnimationFrame(m);
|
|
237
|
+
}), c({
|
|
238
|
+
refresh(n) {
|
|
239
|
+
return t.value = n, j(w), !0;
|
|
240
|
+
}
|
|
241
|
+
}), (n, b) => {
|
|
242
|
+
const S = U("KTooltip");
|
|
243
|
+
return v.value ? (R(), V(q(o), { key: 0 })) : (R(), x("span", de, [
|
|
244
|
+
O(S, {
|
|
245
|
+
class: "table-data-grid-cell-tooltip",
|
|
246
|
+
disabled: !r.value,
|
|
247
|
+
"kpop-attributes": { popoverDelay: 400 },
|
|
248
|
+
"max-width": "300",
|
|
249
|
+
placement: "bottom-start",
|
|
250
|
+
target: "body",
|
|
251
|
+
text: i.value
|
|
252
|
+
}, {
|
|
253
|
+
default: H(() => [
|
|
254
|
+
Q("span", {
|
|
255
|
+
ref_key: "contentElement",
|
|
256
|
+
ref: a,
|
|
257
|
+
class: "table-data-grid-cell-content"
|
|
258
|
+
}, J(i.value), 513)
|
|
259
|
+
]),
|
|
260
|
+
_: 1
|
|
261
|
+
}, 8, ["disabled", "text"])
|
|
262
|
+
]));
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}), me = ({
|
|
266
|
+
headers: e,
|
|
267
|
+
slots: c
|
|
268
|
+
}) => {
|
|
269
|
+
const t = g(() => ({
|
|
270
|
+
cells: { slots: c }
|
|
271
|
+
})), a = (i) => ({
|
|
272
|
+
colId: i.key,
|
|
273
|
+
// Columns with no explicit width constraint share remaining space equally.
|
|
274
|
+
flex: !i.width && !i.maxWidth ? 1 : void 0,
|
|
275
|
+
headerName: i.label,
|
|
276
|
+
maxWidth: i.maxWidth,
|
|
277
|
+
minWidth: i.minWidth,
|
|
278
|
+
valueGetter: (v) => v.data?.[i.key],
|
|
279
|
+
width: i.width,
|
|
280
|
+
cellRenderer: fe,
|
|
281
|
+
// custom params passed to the cell renderer.
|
|
282
|
+
cellRendererParams: { headerDef: i }
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
columnDefs: g(() => e.value.map(a)),
|
|
286
|
+
gridContext: t
|
|
287
|
+
};
|
|
288
|
+
}, ve = ({
|
|
289
|
+
cellClick: e,
|
|
290
|
+
headers: c,
|
|
291
|
+
rowClick: t
|
|
292
|
+
}) => {
|
|
293
|
+
const a = g(() => new Set(
|
|
294
|
+
c.value.filter((o) => o.disableRowClick).map((o) => o.key)
|
|
295
|
+
)), r = (o) => {
|
|
296
|
+
const u = o.event?.target;
|
|
297
|
+
return u instanceof Element ? u.closest(".ag-cell")?.getAttribute("col-id") ?? void 0 : void 0;
|
|
298
|
+
}, i = (o) => {
|
|
299
|
+
const u = r(o);
|
|
300
|
+
return !!(u && a.value.has(u));
|
|
301
|
+
};
|
|
302
|
+
return {
|
|
303
|
+
onCellClick: (o) => {
|
|
304
|
+
const u = o.colDef.colId;
|
|
305
|
+
!o.data || !u || e({
|
|
306
|
+
columnKey: u,
|
|
307
|
+
row: o.data,
|
|
308
|
+
value: o.value
|
|
309
|
+
});
|
|
310
|
+
},
|
|
311
|
+
onRowClick: (o) => {
|
|
312
|
+
o.data && !i(o) && t(o.data, o);
|
|
313
|
+
}
|
|
249
314
|
};
|
|
250
|
-
},
|
|
251
|
-
emptyState:
|
|
252
|
-
errorState:
|
|
315
|
+
}, pe = { title: "No Data", message: "There is no data to display." }, he = { title: "An error occurred", message: "Data cannot be displayed due to an error." }, Ce = {
|
|
316
|
+
emptyState: pe,
|
|
317
|
+
errorState: he
|
|
253
318
|
};
|
|
254
|
-
function
|
|
255
|
-
const e =
|
|
319
|
+
function ye() {
|
|
320
|
+
const e = oe("en-us", Ce);
|
|
256
321
|
return {
|
|
257
322
|
i18n: e,
|
|
258
|
-
i18nT:
|
|
323
|
+
i18nT: le(e)
|
|
259
324
|
// Translation component <i18n-t>
|
|
260
325
|
};
|
|
261
326
|
}
|
|
262
|
-
const
|
|
327
|
+
const ge = {
|
|
263
328
|
class: "kong-ui-public-table-data-grid",
|
|
264
329
|
"data-testid": "table-data-grid"
|
|
265
|
-
},
|
|
330
|
+
}, ke = {
|
|
266
331
|
key: 0,
|
|
267
332
|
class: "table-error-state",
|
|
268
333
|
"data-testid": "table-error-state"
|
|
269
|
-
},
|
|
334
|
+
}, be = {
|
|
270
335
|
key: 1,
|
|
271
336
|
class: "table-empty-state",
|
|
272
337
|
"data-testid": "table-empty-state"
|
|
273
|
-
},
|
|
338
|
+
}, we = /* @__PURE__ */ L({
|
|
274
339
|
__name: "TableDataGrid",
|
|
275
340
|
props: {
|
|
276
341
|
headers: {},
|
|
@@ -279,85 +344,85 @@ const ve = {
|
|
|
279
344
|
pageSize: { default: 25 },
|
|
280
345
|
refreshKey: { type: [String, Number, Boolean] }
|
|
281
346
|
},
|
|
282
|
-
emits: ["grid:ready", "state"],
|
|
283
|
-
setup(e, { emit:
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
|
|
347
|
+
emits: ["grid:ready", "state", "row:click", "cell:click"],
|
|
348
|
+
setup(e, { emit: c }) {
|
|
349
|
+
Z.registerModules([ee, te]);
|
|
350
|
+
const t = c, { i18n: { t: a } } = ye(), r = X(), { columnDefs: i, gridContext: v } = me({
|
|
351
|
+
headers: A(() => e.headers),
|
|
352
|
+
slots: r
|
|
353
|
+
}), { onCellClick: y, onRowClick: o } = ve({
|
|
354
|
+
cellClick: (p) => t("cell:click", p),
|
|
355
|
+
headers: A(() => e.headers),
|
|
356
|
+
rowClick: (p, l) => t("row:click", p, l)
|
|
357
|
+
}), u = {
|
|
287
358
|
resizable: !1,
|
|
288
359
|
sortable: !1,
|
|
289
360
|
suppressMovable: !0
|
|
290
|
-
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
minWidth: c.minWidth,
|
|
297
|
-
valueGetter: (D) => D.data?.[c.key],
|
|
298
|
-
width: c.width
|
|
299
|
-
}))), f = k(() => [e.fetcher, e.pageSize, e.refreshKey]), {
|
|
300
|
-
data: u,
|
|
301
|
-
datasource: m,
|
|
302
|
-
error: C,
|
|
303
|
-
isFetching: p
|
|
304
|
-
} = ce({
|
|
361
|
+
}, m = g(() => [e.fetcher, e.pageSize, e.refreshKey]), {
|
|
362
|
+
data: k,
|
|
363
|
+
datasource: E,
|
|
364
|
+
error: w,
|
|
365
|
+
isFetching: D
|
|
366
|
+
} = ue({
|
|
305
367
|
fetcher: e.fetcher,
|
|
306
|
-
resetKey:
|
|
368
|
+
resetKey: m
|
|
307
369
|
}), {
|
|
308
|
-
fetchState:
|
|
309
|
-
hasData:
|
|
310
|
-
state:
|
|
311
|
-
} =
|
|
370
|
+
fetchState: n,
|
|
371
|
+
hasData: b,
|
|
372
|
+
state: S
|
|
373
|
+
} = re(k, w, D), _ = g(() => S.value === n.SUCCESS && !b.value);
|
|
312
374
|
se({
|
|
313
|
-
emitState: (
|
|
314
|
-
fetchLifecycleState:
|
|
315
|
-
hasData:
|
|
375
|
+
emitState: (p) => t("state", p),
|
|
376
|
+
fetchLifecycleState: S,
|
|
377
|
+
hasData: b
|
|
316
378
|
});
|
|
317
|
-
const
|
|
318
|
-
|
|
379
|
+
const B = (p) => {
|
|
380
|
+
t("grid:ready", p.api);
|
|
319
381
|
};
|
|
320
|
-
return (
|
|
321
|
-
const
|
|
322
|
-
return
|
|
323
|
-
e.error ? (
|
|
324
|
-
|
|
325
|
-
|
|
382
|
+
return (p, l) => {
|
|
383
|
+
const s = U("KEmptyState");
|
|
384
|
+
return R(), x("div", ge, [
|
|
385
|
+
e.error ? (R(), x("div", ke, [
|
|
386
|
+
K(p.$slots, "error-state", {}, () => [
|
|
387
|
+
O(s, {
|
|
326
388
|
"icon-variant": "error",
|
|
327
|
-
message:
|
|
328
|
-
title:
|
|
389
|
+
message: C(a)("errorState.message"),
|
|
390
|
+
title: C(a)("errorState.title")
|
|
329
391
|
}, null, 8, ["message", "title"])
|
|
330
392
|
], !0)
|
|
331
|
-
])) :
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
message:
|
|
335
|
-
title:
|
|
393
|
+
])) : _.value ? (R(), x("div", be, [
|
|
394
|
+
K(p.$slots, "empty-state", {}, () => [
|
|
395
|
+
O(s, {
|
|
396
|
+
message: C(a)("emptyState.message"),
|
|
397
|
+
title: C(a)("emptyState.title")
|
|
336
398
|
}, null, 8, ["message", "title"])
|
|
337
399
|
], !0)
|
|
338
|
-
])) : (
|
|
400
|
+
])) : (R(), V(C(Y), {
|
|
339
401
|
key: 2,
|
|
340
402
|
"cache-block-size": e.pageSize,
|
|
341
403
|
class: "table-data-grid-grid",
|
|
342
|
-
"column-defs":
|
|
343
|
-
|
|
344
|
-
|
|
404
|
+
"column-defs": C(i),
|
|
405
|
+
context: C(v),
|
|
406
|
+
datasource: C(E),
|
|
407
|
+
"default-col-def": u,
|
|
345
408
|
"infinite-initial-row-count": 1,
|
|
346
|
-
loading:
|
|
409
|
+
loading: C(D),
|
|
347
410
|
"row-model-type": "infinite",
|
|
348
411
|
"suppress-cell-focus": !0,
|
|
349
|
-
theme:
|
|
350
|
-
|
|
351
|
-
|
|
412
|
+
theme: C(ae),
|
|
413
|
+
onCellClicked: C(y),
|
|
414
|
+
onGridReady: B,
|
|
415
|
+
onRowClicked: C(o)
|
|
416
|
+
}, null, 8, ["cache-block-size", "column-defs", "context", "datasource", "loading", "theme", "onCellClicked", "onRowClicked"]))
|
|
352
417
|
]);
|
|
353
418
|
};
|
|
354
419
|
}
|
|
355
|
-
}),
|
|
356
|
-
const
|
|
357
|
-
for (const [
|
|
358
|
-
a
|
|
359
|
-
return
|
|
360
|
-
},
|
|
420
|
+
}), De = (e, c) => {
|
|
421
|
+
const t = e.__vccOpts || e;
|
|
422
|
+
for (const [a, r] of c)
|
|
423
|
+
t[a] = r;
|
|
424
|
+
return t;
|
|
425
|
+
}, Fe = /* @__PURE__ */ De(we, [["__scopeId", "data-v-e14d8346"]]);
|
|
361
426
|
export {
|
|
362
|
-
|
|
427
|
+
Fe as TableDataGrid
|
|
363
428
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y["kong-ui-public-table-data-grid"]={},y.Vue,y.AgGridVue,y.agGridCommunity,y["kong-ui-public-i18n"]))})(this,(function(y,e,G,
|
|
1
|
+
(function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y["kong-ui-public-table-data-grid"]={},y.Vue,y.AgGridVue,y.agGridCommunity,y["kong-ui-public-i18n"]))})(this,(function(y,e,G,B,x){"use strict";var v=(t=>(t.PENDING="PENDING",t.LOADING="LOADING",t.SUCCESS="SUCCESS",t.ERROR="ERROR",t))(v||{});const M=t=>!!t?.length;function T(t,i,o,a=M){const s=e.computed(()=>a(t.value)),d=e.computed(()=>{const k=t.value!==void 0,n=i.value!==void 0&&i.value!==null;return o.value?"LOADING":s.value?"SUCCESS":n?"ERROR":k?"SUCCESS":"PENDING"});return{fetchState:v,hasData:s,state:d}}const O=({emitState:t,fetchLifecycleState:i,hasData:o})=>{e.watch(()=>({hasData:o.value,state:i.value}),({hasData:a,state:s})=>{if(s!==v.PENDING){if(s===v.LOADING){t({hasData:a,state:"loading"});return}if(s===v.ERROR){t({hasData:a,state:"error"});return}t({hasData:a,state:"success"})}})},A=({startRow:t,endRow:i})=>{const o=i-t;return{blockIndex:o>0?Math.floor(t/o):0,pageSize:o}},z=({startRow:t,rowsLength:i,pageSize:o,total:a,hasMore:s})=>{if(typeof a=="number")return a;if(s!==!0&&(s===!1||i<o))return t+i},K=({fetcher:t,resetKey:i})=>{const o=new Map,a=new Map,s=e.ref(0),d=e.shallowRef(),h=e.shallowRef(),k=e.shallowRef(),n=e.ref(0),u=e.ref(!1),p=l=>l===s.value,b=()=>{u.value=n.value>0},E=()=>{k.value=void 0,n.value+=1,b()},S=()=>{n.value=Math.max(0,n.value-1),b()},D=l=>{const c=a.get(l);if(c)return c;let f;const g={promise:new Promise(m=>{f=m}),resolve:m=>f(m)};return a.set(l,g),g},r=(l,c)=>{c.resolve(!1),a.get(l)===c&&a.delete(l)},w=async({blockIndex:l,currentBlockCompletion:c,datasourceId:f})=>{if(l===0)return"ready";const g=a.get(l-1);if(!g)return r(l,c),"failed";const m=await g.promise;return p(f)?m?"ready":(r(l,c),"failed"):(r(l,c),"stale")},R=({blockIndex:l,currentBlockCompletion:c,getRowsParams:f,pageSize:g,result:m})=>{m.cursor!==void 0&&o.set(l,m.cursor),f.successCallback(m.data,z({startRow:f.startRow,rowsLength:m.data.length,pageSize:g,total:m.total,hasMore:m.hasMore})),f.startRow===0&&(h.value=m.data),c.resolve(!0)},I=({blockIndex:l,currentBlockCompletion:c,fetchError:f,getRowsParams:g})=>{k.value=f,g.failCallback(),r(l,c)},N=()=>{const l=s.value+1;return s.value=l,o.clear(),a.clear(),h.value=void 0,k.value=void 0,n.value=0,b(),{async getRows(c){const{blockIndex:f,pageSize:g}=A({startRow:c.startRow,endRow:c.endRow}),m=D(f),F=await w({blockIndex:f,currentBlockCompletion:m,datasourceId:l});if(F!=="ready"){F==="failed"&&c.failCallback();return}E();try{const _=f>0?o.get(f-1):void 0,J=await t({mode:"infinite",pageSize:g,cursor:_});if(!p(l)){r(f,m);return}R({blockIndex:f,currentBlockCompletion:m,getRowsParams:c,pageSize:g,result:J})}catch(_){if(!p(l)){r(f,m);return}I({blockIndex:f,currentBlockCompletion:m,fetchError:_,getRowsParams:c})}finally{p(l)&&S()}}}},C=()=>{d.value=N()};return e.watch(()=>i?.value,()=>{C()},{immediate:!0}),{datasource:e.readonly(d),data:e.readonly(h),error:e.readonly(k),isFetching:e.readonly(u)}},V={key:1,class:"table-data-grid-cell-renderer"},L=e.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(t,{expose:i}){const o=e.shallowRef(t.params),a=e.ref(null),s=e.ref(!1),d=e.computed(()=>o.value.valueFormatted??String(o.value.value??"")),h=e.computed(()=>{const r=o.value.colDef?.colId;return r?o.value.context?.cells?.slots?.[r]:void 0}),k=e.computed(()=>({column:o.value.headerDef,refreshCell:()=>{const r=o.value.node;r&&o.value.api.refreshCells({force:!0,rowNodes:[r]})},row:o.value.data??{},rowIndex:o.value.node?.rowIndex??0,rowValue:o.value.value,selected:o.value.node?.isSelected()??!1})),n=()=>h.value?.(k.value);let u,p,b=!1;const E=()=>{const r=a.value;s.value=!!r&&r.scrollWidth>r.clientWidth},S=()=>{b||(p!==void 0&&cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=void 0,E()}))},D=r=>{if(u?.disconnect(),r){u?.observe(r);const w=r.closest(".ag-cell");w&&u?.observe(w)}S()};return e.onMounted(()=>{u=new ResizeObserver(S),D(a.value)}),e.watch(a,D,{flush:"post"}),e.onUnmounted(()=>{b=!0,u?.disconnect(),p!==void 0&&cancelAnimationFrame(p)}),i({refresh(r){return o.value=r,e.nextTick(S),!0}}),(r,w)=>{const R=e.resolveComponent("KTooltip");return h.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n),{key:0})):(e.openBlock(),e.createElementBlock("span",V,[e.createVNode(R,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:"body",text:d.value},{default:e.withCtx(()=>[e.createElementVNode("span",{ref_key:"contentElement",ref:a,class:"table-data-grid-cell-content"},e.toDisplayString(d.value),513)]),_:1},8,["disabled","text"])]))}}}),U=({headers:t,slots:i})=>{const o=e.computed(()=>({cells:{slots:i}})),a=d=>({colId:d.key,flex:!d.width&&!d.maxWidth?1:void 0,headerName:d.label,maxWidth:d.maxWidth,minWidth:d.minWidth,valueGetter:h=>h.data?.[d.key],width:d.width,cellRenderer:L,cellRendererParams:{headerDef:d}});return{columnDefs:e.computed(()=>t.value.map(a)),gridContext:o}},W=({cellClick:t,headers:i,rowClick:o})=>{const a=e.computed(()=>new Set(i.value.filter(n=>n.disableRowClick).map(n=>n.key))),s=n=>{const u=n.event?.target;return u instanceof Element?u.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},d=n=>{const u=s(n);return!!(u&&a.value.has(u))};return{onCellClick:n=>{const u=n.colDef.colId;!n.data||!u||t({columnKey:u,row:n.data,value:n.value})},onRowClick:n=>{n.data&&!d(n)&&o(n.data,n)}}},q={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 $(){const t=x.createI18n("en-us",q);return{i18n:t,i18nT:x.i18nTComponent(t)}}const P={class:"kong-ui-public-table-data-grid","data-testid":"table-data-grid"},j={key:0,class:"table-error-state","data-testid":"table-error-state"},H={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Q=((t,i)=>{const o=t.__vccOpts||t;for(const[a,s]of i)o[a]=s;return o})(e.defineComponent({__name:"TableDataGrid",props:{headers:{},fetcher:{type:Function},error:{type:Boolean,default:!1},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]}},emits:["grid:ready","state","row:click","cell:click"],setup(t,{emit:i}){B.ModuleRegistry.registerModules([B.AllCommunityModule,B.InfiniteRowModelModule]);const o=i,{i18n:{t:a}}=$(),s=e.useSlots(),{columnDefs:d,gridContext:h}=U({headers:e.toRef(()=>t.headers),slots:s}),{onCellClick:k,onRowClick:n}=W({cellClick:C=>o("cell:click",C),headers:e.toRef(()=>t.headers),rowClick:(C,l)=>o("row:click",C,l)}),u={resizable:!1,sortable:!1,suppressMovable:!0},p=e.computed(()=>[t.fetcher,t.pageSize,t.refreshKey]),{data:b,datasource:E,error:S,isFetching:D}=K({fetcher:t.fetcher,resetKey:p}),{fetchState:r,hasData:w,state:R}=T(b,S,D),I=e.computed(()=>R.value===r.SUCCESS&&!w.value);O({emitState:C=>o("state",C),fetchLifecycleState:R,hasData:w});const N=C=>{o("grid:ready",C.api)};return(C,l)=>{const c=e.resolveComponent("KEmptyState");return e.openBlock(),e.createElementBlock("div",P,[t.error?(e.openBlock(),e.createElementBlock("div",j,[e.renderSlot(C.$slots,"error-state",{},()=>[e.createVNode(c,{"icon-variant":"error",message:e.unref(a)("errorState.message"),title:e.unref(a)("errorState.title")},null,8,["message","title"])],!0)])):I.value?(e.openBlock(),e.createElementBlock("div",H,[e.renderSlot(C.$slots,"empty-state",{},()=>[e.createVNode(c,{message:e.unref(a)("emptyState.message"),title:e.unref(a)("emptyState.title")},null,8,["message","title"])],!0)])):(e.openBlock(),e.createBlock(e.unref(G.AgGridVue),{key:2,"cache-block-size":t.pageSize,class:"table-data-grid-grid","column-defs":e.unref(d),context:e.unref(h),datasource:e.unref(E),"default-col-def":u,"infinite-initial-row-count":1,loading:e.unref(D),"row-model-type":"infinite","suppress-cell-focus":!0,theme:e.unref(B.themeQuartz),onCellClicked:e.unref(k),onGridReady:N,onRowClicked:e.unref(n)},null,8,["cache-block-size","column-defs","context","datasource","loading","theme","onCellClicked","onRowClicked"]))])}}}),[["__scopeId","data-v-e14d8346"]]);y.TableDataGrid=Q,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TableDataGridFetcher, TableDataGridHeader, TableDataGridStatePayload } from '../types';
|
|
2
|
-
import type { GridReadyEvent } from 'ag-grid-community';
|
|
1
|
+
import type { TableDataGridCellClickPayload, TableDataGridCellSlotProps, TableDataGridFetcher, TableDataGridHeader, TableDataGridStatePayload } from '../types';
|
|
2
|
+
import type { GridReadyEvent, RowClickedEvent } from 'ag-grid-community';
|
|
3
3
|
declare const __VLS_export: <Row extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
5
5
|
headers: Array<TableDataGridHeader<Row>>;
|
|
@@ -10,18 +10,23 @@ declare const __VLS_export: <Row extends object>(__VLS_props: NonNullable<Awaite
|
|
|
10
10
|
} & {
|
|
11
11
|
onState?: ((payload: TableDataGridStatePayload) => any) | undefined;
|
|
12
12
|
"onGrid:ready"?: ((api: import("ag-grid-community").GridApi<Row>) => any) | undefined;
|
|
13
|
+
"onCell:click"?: ((payload: TableDataGridCellClickPayload<Row>) => any) | undefined;
|
|
14
|
+
"onRow:click"?: ((row: Row, event: RowClickedEvent<Row, any>) => any) | undefined;
|
|
13
15
|
}> & (typeof globalThis extends {
|
|
14
16
|
__VLS_PROPS_FALLBACK: infer P;
|
|
15
17
|
} ? P : {});
|
|
16
18
|
expose: (exposed: {}) => void;
|
|
17
19
|
attrs: any;
|
|
18
20
|
slots: {
|
|
21
|
+
[columnKey: string]: (props: TableDataGridCellSlotProps<Row>) => unknown;
|
|
19
22
|
'empty-state': () => unknown;
|
|
20
23
|
'error-state': () => unknown;
|
|
21
24
|
};
|
|
22
25
|
emit: {
|
|
23
26
|
(e: "grid:ready", api: GridReadyEvent<Row>["api"]): void;
|
|
24
27
|
(e: "state", payload: TableDataGridStatePayload): void;
|
|
28
|
+
(e: "row:click", row: Row, event: RowClickedEvent<Row>): void;
|
|
29
|
+
(e: "cell:click", payload: TableDataGridCellClickPayload<Row>): void;
|
|
25
30
|
};
|
|
26
31
|
}>) => import("vue").VNode & {
|
|
27
32
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -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":"AAmNA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAEV,cAAc,EACd,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAgB1B,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;WA0OO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB,CAAC;iBAtO7C,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;iBAC/B,oBAAoB,CAAC,GAAG,CAAC;gBAC1B,OAAO;mBACJ,MAAM;qBACJ,MAAM,GAAG,MAAM,GAAG,OAAO;;;;;;KAkOmD,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;;qCAtNoB,0BAA0B,CAAC,GAAG,CAAC,KAAK,OAAO;uBAFzD,MAAM,OAAO;uBACb,MAAM,OAAO;;;YAMxB,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;;EAkNlE,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAI,CAAC;wBACvD,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"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import type { TableDataGridHeader } from '../types';
|
|
1
2
|
import type { ICellRendererParams } from 'ag-grid-community';
|
|
2
|
-
type
|
|
3
|
+
import type { Slots } from 'vue';
|
|
4
|
+
type CellRendererParams = ICellRendererParams<Record<string, unknown>> & {
|
|
5
|
+
/** Set internally via `cellRendererParams` so the renderer can resolve the
|
|
6
|
+
* host slot and build its payload without leaking AG Grid's own `column`. */
|
|
7
|
+
headerDef?: TableDataGridHeader;
|
|
8
|
+
context?: {
|
|
9
|
+
cells?: {
|
|
10
|
+
slots?: Slots;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
3
14
|
type __VLS_Props = {
|
|
4
15
|
params: CellRendererParams;
|
|
5
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDataGridCellRenderer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGridCellRenderer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableDataGridCellRenderer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/TableDataGridCellRenderer.vue"],"names":[],"mappings":"AAyKA,OAAO,KAAK,EAA8B,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAGhC,KAAK,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACvE;iFAC6E;IAC7E,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,KAAK,CAAA;SAAE,CAAA;KAAE,CAAA;CACxC,CAAA;AAMD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,kBAAkB,CAAA;CAC3B,CAAC;AAsLF,QAAA,MAAM,YAAY;wBArFI,kBAAkB;oPAwFtC,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchInfinite.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchInfinite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gBAAgB,EACjB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAW9B,UAAU,uBAAuB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB;IACrE;;;OAGG;IACH,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAA;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;CAClC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,wBAGrE,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useFetchInfinite.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchInfinite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gBAAgB,EACjB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAW9B,UAAU,uBAAuB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB;IACrE;;;OAGG;IACH,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAA;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;CAClC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,wBAGrE,uBAAuB,CAAC,GAAG,CAAC;;;;;;;;;;;;;CA6T9B,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TableDataGridHeader, TableDataGridRow } from '../types';
|
|
2
|
+
import type { ColDef } from 'ag-grid-community';
|
|
3
|
+
import type { Ref, Slots } from 'vue';
|
|
4
|
+
/**
|
|
5
|
+
* Converts `headers` into what AG Grid needs to render the table's columns:
|
|
6
|
+
* the column definitions themselves, and the shared grid `context`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTableDataGridColumnDefs: <Row extends object = TableDataGridRow>({ headers, slots, }: {
|
|
9
|
+
headers: Readonly<Ref<Array<TableDataGridHeader<Row>>>>;
|
|
10
|
+
slots: Slots;
|
|
11
|
+
}) => {
|
|
12
|
+
columnDefs: import("vue").ComputedRef<ColDef<Row, any>[]>;
|
|
13
|
+
gridContext: import("vue").ComputedRef<{
|
|
14
|
+
cells: {
|
|
15
|
+
slots: Readonly<{
|
|
16
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useTableDataGridColumnDefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableDataGridColumnDefs.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridColumnDefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAIrC;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,qBAG/E;IACD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,KAAK,EAAE,KAAK,CAAA;CACb;;;;;;;;;CA0BA,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TableDataGridCellClickPayload, TableDataGridHeader, TableDataGridRow, TableDataGridRowClickPayload } from '../types';
|
|
2
|
+
import type { CellClickedEvent, RowClickedEvent } from 'ag-grid-community';
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
|
+
/**
|
|
5
|
+
* Converts AG Grid's row and cell click events into `TableDataGrid`'s own
|
|
6
|
+
* row/cell interaction handlers, and governs how those interactions behave
|
|
7
|
+
* (e.g. suppressing row clicks for columns marked `disableRowClick`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTableDataGridInteractions: <Row extends object = TableDataGridRow>({ cellClick, headers, rowClick, }: {
|
|
10
|
+
cellClick: (payload: TableDataGridCellClickPayload<Row>) => void;
|
|
11
|
+
headers: Readonly<Ref<Array<TableDataGridHeader<Row>>>>;
|
|
12
|
+
rowClick: (row: TableDataGridRowClickPayload<Row>, event: RowClickedEvent<Row>) => void;
|
|
13
|
+
}) => {
|
|
14
|
+
onCellClick: (event: CellClickedEvent<Row>) => void;
|
|
15
|
+
onRowClick: (event: RowClickedEvent<Row>) => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useTableDataGridInteractions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableDataGridInteractions.d.ts","sourceRoot":"","sources":["../../../src/composables/useTableDataGridInteractions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAC7B,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,GAAG,SAAS,MAAM,GAAG,gBAAgB,EAAE,mCAIjF;IACD,SAAS,EAAE,CAAC,OAAO,EAAE,6BAA6B,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;IAChE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,QAAQ,EAAE,CAAC,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;CACxF;yBA0B6B,gBAAgB,CAAC,GAAG,CAAC;wBANtB,eAAe,CAAC,GAAG,CAAC;CAwBhD,CAAA"}
|
|
@@ -6,12 +6,32 @@ export type TableDataGridStatePayload = {
|
|
|
6
6
|
state: TableDataGridState;
|
|
7
7
|
hasData: boolean;
|
|
8
8
|
};
|
|
9
|
+
export type TableDataGridRowClickPayload<Row extends object = TableDataGridRow> = Row;
|
|
10
|
+
export type TableDataGridCellClickPayload<Row extends object = TableDataGridRow> = {
|
|
11
|
+
row: Row;
|
|
12
|
+
columnKey: string;
|
|
13
|
+
value: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type TableDataGridCellSlotProps<Row extends object = TableDataGridRow> = {
|
|
16
|
+
row: Row;
|
|
17
|
+
rowValue: unknown;
|
|
18
|
+
column: TableDataGridHeader<Row>;
|
|
19
|
+
rowIndex: number;
|
|
20
|
+
selected: boolean;
|
|
21
|
+
refreshCell: () => void;
|
|
22
|
+
};
|
|
9
23
|
export type TableDataGridHeader<Row extends object = TableDataGridRow> = {
|
|
10
24
|
key: Extract<keyof Row, string>;
|
|
11
25
|
label: string;
|
|
12
26
|
width?: number;
|
|
13
27
|
minWidth?: number;
|
|
14
28
|
maxWidth?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Disables the `row:click` emit for clicks landing inside this column's
|
|
31
|
+
* cells, e.g. an actions column with its own buttons. AG Grid's own
|
|
32
|
+
* selection/click mechanics are unaffected.
|
|
33
|
+
*/
|
|
34
|
+
disableRowClick?: boolean;
|
|
15
35
|
};
|
|
16
36
|
export interface TableDataGridInfiniteFetcherParams {
|
|
17
37
|
mode: 'infinite';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACtD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IACvE,GAAG,EAAE,OAAO,CAAC,MAAM,GAAG,EAAE,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC1C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACtD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,4BAA4B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,GAAG,CAAA;AAErF,MAAM,MAAM,6BAA6B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IACjF,GAAG,EAAE,GAAG,CAAA;IACR,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,0BAA0B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IAC9E,GAAG,EAAE,GAAG,CAAA;IACR,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IACvE,GAAG,EAAE,OAAO,CAAC,MAAM,GAAG,EAAE,MAAM,CAAC,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,0BAA0B,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI;IAC9E,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,oBAAoB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,CACxE,MAAM,EAAE,kCAAkC,KACvC,OAAO,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAA;AAE7C,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,MAAM,GAAG,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA"}
|