@aplus-frontend/ui 7.19.1 → 7.19.3
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/es/src/ag-grid/index.vue.mjs +166 -161
- package/es/src/ag-grid/interface.d.ts +7 -4
- package/es/src/business/ap-tag/ap-tag-group.vue.mjs +83 -60
- package/es/src/business/ap-tag/interface.d.ts +4 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +88 -87
- package/es/src/business/ap-view/hooks/use-send-to-url.d.ts +2 -1
- package/es/src/business/ap-view/hooks/use-send-to-url.mjs +25 -24
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +7 -4
- package/lib/src/business/ap-tag/ap-tag-group.vue.js +1 -1
- package/lib/src/business/ap-tag/interface.d.ts +4 -0
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/hooks/use-send-to-url.d.ts +2 -1
- package/lib/src/business/ap-view/hooks/use-send-to-url.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ko, useSlots as xo, ref as h, toRef as x, computed as i, unref as r, nextTick as A, watch as W, createElementBlock as U, openBlock as y, normalizeStyle as _, normalizeClass as R, createCommentVNode as fe, createElementVNode as T, createVNode as Mo, mergeProps as j, createSlots as Fo, withCtx as ge, Fragment as Bo, renderList as Io, createBlock as $, resolveDynamicComponent as Ao, renderSlot as we } from "vue";
|
|
2
2
|
import { AG_GRID_LOCALE_EN as To, AG_GRID_LOCALE_CN as Eo } from "@ag-grid-community/locale";
|
|
3
3
|
import { Pagination as No } from "@aplus-frontend/antdv";
|
|
4
|
-
import { useToken as
|
|
5
|
-
import { ModuleRegistry as
|
|
4
|
+
import { useToken as zo } from "@aplus-frontend/antdv/es/theme/internal";
|
|
5
|
+
import { ModuleRegistry as Do, ValidationModule as Po, ColumnAutoSizeModule as Oo, PinnedRowModule as Vo, RowAutoHeightModule as Ko, RowStyleModule as Go, CellSpanModule as Lo, CellStyleModule as Ho, TooltipModule as Wo, RowSelectionModule as Uo, LocaleModule as _o, ValueCacheModule as jo, GridStateModule as $o, ColumnApiModule as qo, RowApiModule as Jo, CellApiModule as Qo, RenderApiModule as Xo, EventApiModule as Yo, ScrollApiModule as Zo, ClientSideRowModelApiModule as et, ClientSideRowModelModule as ot } from "ag-grid-community";
|
|
6
6
|
import { AgGridVue as tt } from "ag-grid-vue3";
|
|
7
|
-
import { isUndefined as
|
|
7
|
+
import { isUndefined as M, isFunction as E, omit as rt } from "lodash-unified";
|
|
8
8
|
import { DEFAULT_ROW_SELECTION_CONFIG as Se, sizeReverseMap as nt, sizeMap as at } from "../ap-grid/constants.mjs";
|
|
9
9
|
import { useProvideApTable as lt } from "../ap-table/context.mjs";
|
|
10
10
|
import { useTablePaging as st } from "../ap-table/hooks/use-table-paging-ng.mjs";
|
|
@@ -25,17 +25,17 @@ import St from "./hooks/use-row-selection.mjs";
|
|
|
25
25
|
import { useSearchForm as Ct } from "./hooks/use-search-form.mjs";
|
|
26
26
|
import ht from "./hooks/use-selection-col-def.mjs";
|
|
27
27
|
import yt from "./hooks/use-virtual-config.mjs";
|
|
28
|
-
import
|
|
29
|
-
import { useTheme as
|
|
30
|
-
import { runPipelineHooks as bt, runEffectHooks as q, mergeProps as
|
|
31
|
-
import { useNamespace as
|
|
32
|
-
import { useLocale as
|
|
28
|
+
import Rt from "./style/index.mjs";
|
|
29
|
+
import { useTheme as vt } from "./theme.mjs";
|
|
30
|
+
import { runPipelineHooks as bt, runEffectHooks as q, mergeProps as kt } from "./utils.mjs";
|
|
31
|
+
import { useNamespace as xt } from "../config-provider/hooks/use-namespace.mjs";
|
|
32
|
+
import { useLocale as Mt } from "../config-provider/hooks/use-locale.mjs";
|
|
33
33
|
import { useGlobalConfig as Ft } from "../config-provider/hooks/use-global-config.mjs";
|
|
34
34
|
import { isDef as Bt } from "../utils/is.mjs";
|
|
35
35
|
import It from "./components/row/index.vue2.mjs";
|
|
36
36
|
import At from "./components/loading/index.vue2.mjs";
|
|
37
37
|
import Tt from "./components/empty/index.vue2.mjs";
|
|
38
|
-
const gr = /* @__PURE__ */
|
|
38
|
+
const gr = /* @__PURE__ */ ko({
|
|
39
39
|
name: "AgGrid",
|
|
40
40
|
__name: "index",
|
|
41
41
|
props: {
|
|
@@ -121,15 +121,15 @@ const gr = /* @__PURE__ */ xo({
|
|
|
121
121
|
"zh-cn": Eo,
|
|
122
122
|
en: To
|
|
123
123
|
};
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
Do.registerModules([
|
|
125
|
+
Po,
|
|
126
126
|
Oo,
|
|
127
127
|
Vo,
|
|
128
128
|
Ko,
|
|
129
129
|
Go,
|
|
130
130
|
Lo,
|
|
131
|
-
Wo,
|
|
132
131
|
Ho,
|
|
132
|
+
Wo,
|
|
133
133
|
Uo,
|
|
134
134
|
_o,
|
|
135
135
|
jo,
|
|
@@ -143,32 +143,32 @@ const gr = /* @__PURE__ */ xo({
|
|
|
143
143
|
et,
|
|
144
144
|
ot
|
|
145
145
|
]);
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
),
|
|
151
|
-
|
|
152
|
-
),
|
|
153
|
-
let b = !!
|
|
154
|
-
async function
|
|
146
|
+
const o = Ce, N = xo(), { e: z, b: c, be: Re } = xt("ag-grid"), { lang: J } = Mt(), ve = Rt("ag-grid"), v = h(o.size), be = vt(
|
|
147
|
+
v,
|
|
148
|
+
x(o, "rowHeight"),
|
|
149
|
+
x(o, "theme")
|
|
150
|
+
), ke = yt(x(o, "virtual")), { rowPinnedGridConfig: Q, getRowPinnedCellClass: xe } = wt(
|
|
151
|
+
x(o, "summary")
|
|
152
|
+
), Me = Ft("apGrid"), s = h(), [, Fe] = zo();
|
|
153
|
+
let b = !!o.dataSource;
|
|
154
|
+
async function D(e, t = {}) {
|
|
155
155
|
const n = await bt(
|
|
156
|
-
|
|
156
|
+
o.plugins,
|
|
157
157
|
e,
|
|
158
158
|
(a) => a.beforeApplyColumnState?.bind(a)
|
|
159
159
|
);
|
|
160
|
-
s.value.applyColumnState({ state: n, ...
|
|
160
|
+
s.value.applyColumnState({ state: n, ...t });
|
|
161
161
|
}
|
|
162
|
-
const X = Ct(
|
|
162
|
+
const X = Ct(o), {
|
|
163
163
|
shownColumns: w,
|
|
164
164
|
columns: Y,
|
|
165
165
|
columnKeys: Be,
|
|
166
166
|
getTargetColumnByKey: Ie,
|
|
167
167
|
defaultSortOrder: F
|
|
168
|
-
} = ft(
|
|
168
|
+
} = ft(o), { defaultColDef: Ae, columnDefs: Z, gridWrapperRef: Te } = gt(
|
|
169
169
|
Y,
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
o,
|
|
171
|
+
xe,
|
|
172
172
|
N.headerCell
|
|
173
173
|
), Ee = {
|
|
174
174
|
asc: "ascend",
|
|
@@ -183,10 +183,10 @@ const gr = /* @__PURE__ */ xo({
|
|
|
183
183
|
[e.colKey]: ee[e.order]
|
|
184
184
|
} : {};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
const e = oe.value,
|
|
188
|
-
if (
|
|
189
|
-
return
|
|
186
|
+
function ze() {
|
|
187
|
+
const e = oe.value, t = F.value;
|
|
188
|
+
if (t && e.includes(t.field))
|
|
189
|
+
return t;
|
|
190
190
|
}
|
|
191
191
|
const B = h(Ne());
|
|
192
192
|
mt({
|
|
@@ -195,13 +195,13 @@ const gr = /* @__PURE__ */ xo({
|
|
|
195
195
|
B.value = e;
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
|
-
function
|
|
199
|
-
const e = s.value.getColumns()?.filter((
|
|
198
|
+
function De() {
|
|
199
|
+
const e = s.value.getColumns()?.filter((m) => m.getSort() != null), t = r(B) || {};
|
|
200
200
|
let n = e?.[0];
|
|
201
|
-
const a = Object.keys(
|
|
202
|
-
if (a.length && a.every((
|
|
203
|
-
const
|
|
204
|
-
|
|
201
|
+
const a = Object.keys(t);
|
|
202
|
+
if (a.length && a.every((m) => t[m] === null)) {
|
|
203
|
+
const m = Object.keys(t)[0];
|
|
204
|
+
m && (n = s.value?.getColumn(m));
|
|
205
205
|
}
|
|
206
206
|
if (!n)
|
|
207
207
|
return;
|
|
@@ -215,27 +215,27 @@ const gr = /* @__PURE__ */ xo({
|
|
|
215
215
|
const oe = i(() => it(r(w), (e) => {
|
|
216
216
|
if (e.sorter === !0)
|
|
217
217
|
return e.field ?? e.dataIndex ?? e.key;
|
|
218
|
-
}).filter(Boolean)),
|
|
218
|
+
}).filter(Boolean)), Pe = () => {
|
|
219
219
|
B.value = {};
|
|
220
220
|
const e = s.value;
|
|
221
221
|
if (!e)
|
|
222
222
|
return;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
pt({ expandable:
|
|
223
|
+
const t = e.getColumnState()?.map((n) => ({ ...n, sort: null }));
|
|
224
|
+
D(t);
|
|
225
|
+
}, P = h({});
|
|
226
|
+
pt({ expandable: P });
|
|
227
227
|
function Oe(e) {
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
...
|
|
231
|
-
[
|
|
228
|
+
const t = e.columnGroup;
|
|
229
|
+
t && (P.value = {
|
|
230
|
+
...P.value,
|
|
231
|
+
[t.getGroupId()]: t.isExpanded()
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
|
-
const O = h(!0), Ve = i(() => Bt(
|
|
234
|
+
const O = h(!0), Ve = i(() => Bt(o.manual) ? o.manual : dt(N.searchFormExtra?.() || []).some((t) => t.type?.name === "ApView")), {
|
|
235
235
|
formRef: S,
|
|
236
236
|
submit: V,
|
|
237
237
|
reset: K,
|
|
238
|
-
data:
|
|
238
|
+
data: p,
|
|
239
239
|
tableProps: te,
|
|
240
240
|
handleTableChangeOptional: re,
|
|
241
241
|
submitWith: ne,
|
|
@@ -243,41 +243,41 @@ const gr = /* @__PURE__ */ xo({
|
|
|
243
243
|
getPaging: Ke,
|
|
244
244
|
setPaging: Ge,
|
|
245
245
|
setDataSource: Le,
|
|
246
|
-
getLastParams:
|
|
246
|
+
getLastParams: He
|
|
247
247
|
} = st({
|
|
248
248
|
async request(e) {
|
|
249
|
-
if (b = !1, C.value && !C.value.preserveSelectedRowKeys &&
|
|
249
|
+
if (b = !1, C.value && !C.value.preserveSelectedRowKeys && M(o.dataSource) && !O.value && H(), O.value && (O.value = !1), !M(o.dataSource)) {
|
|
250
250
|
const n = e.pageSize * (e.current - 1);
|
|
251
251
|
return {
|
|
252
|
-
data: (
|
|
253
|
-
total:
|
|
252
|
+
data: (o.pagination === !1 ? o.dataSource : o.dataSource.slice(n, n + e.pageSize)) || [],
|
|
253
|
+
total: o.dataSource.length || 0
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const t = await o.request?.(e);
|
|
257
257
|
return {
|
|
258
|
-
data:
|
|
259
|
-
total:
|
|
258
|
+
data: t?.data || [],
|
|
259
|
+
total: t?.total || 0
|
|
260
260
|
};
|
|
261
261
|
},
|
|
262
262
|
namespace: "ap-grid",
|
|
263
263
|
filterFields: h([]),
|
|
264
|
-
params:
|
|
265
|
-
defaultData:
|
|
264
|
+
params: x(o, "params"),
|
|
265
|
+
defaultData: o.defaultData,
|
|
266
266
|
manual: r(Ve),
|
|
267
|
-
formatParams:
|
|
268
|
-
pagination:
|
|
267
|
+
formatParams: o.beforeSearchSubmit,
|
|
268
|
+
pagination: o.pagination,
|
|
269
269
|
sortFields: oe,
|
|
270
|
-
onClickReset:
|
|
271
|
-
defaultSortOrder:
|
|
270
|
+
onClickReset: Pe,
|
|
271
|
+
defaultSortOrder: ze()
|
|
272
272
|
}), C = i(() => {
|
|
273
|
-
const e =
|
|
273
|
+
const e = o.rowSelection || Me.value?.rowSelection;
|
|
274
274
|
if (e)
|
|
275
275
|
return e === !0 ? Se : {
|
|
276
276
|
...Se,
|
|
277
277
|
...e
|
|
278
278
|
};
|
|
279
|
-
}),
|
|
280
|
-
() =>
|
|
279
|
+
}), We = ht(o, w), Ue = i(
|
|
280
|
+
() => M(o.dataSource) ? p.records : o.dataSource
|
|
281
281
|
), {
|
|
282
282
|
select: _e,
|
|
283
283
|
unSelect: je,
|
|
@@ -290,7 +290,7 @@ const gr = /* @__PURE__ */ xo({
|
|
|
290
290
|
} = St({
|
|
291
291
|
...C.value,
|
|
292
292
|
dataSource: Ue,
|
|
293
|
-
rowKey:
|
|
293
|
+
rowKey: o.rowKey
|
|
294
294
|
}), Ye = {
|
|
295
295
|
checkbox: "multiRow",
|
|
296
296
|
radio: "singleRow"
|
|
@@ -298,27 +298,27 @@ const gr = /* @__PURE__ */ xo({
|
|
|
298
298
|
const e = C.value;
|
|
299
299
|
if (!e)
|
|
300
300
|
return;
|
|
301
|
-
const { type:
|
|
301
|
+
const { type: t = "checkbox", disabled: n } = e;
|
|
302
302
|
return {
|
|
303
|
-
mode: Ye[
|
|
303
|
+
mode: Ye[t],
|
|
304
304
|
isRowSelectable: (a) => n ? !n(a.data) : !0,
|
|
305
305
|
hideDisabledCheckboxes: e.hideDisabled ?? !1
|
|
306
306
|
};
|
|
307
307
|
});
|
|
308
308
|
function L(e) {
|
|
309
|
-
return E(
|
|
309
|
+
return E(o.rowKey) ? o.rowKey(e) : e[o.rowKey];
|
|
310
310
|
}
|
|
311
311
|
const I = ({
|
|
312
312
|
api: e = s.value
|
|
313
313
|
}) => {
|
|
314
|
-
if (
|
|
314
|
+
if (o.onUpdate?.(), !C.value)
|
|
315
315
|
return;
|
|
316
|
-
const
|
|
316
|
+
const t = G.value || [];
|
|
317
317
|
b = !1;
|
|
318
318
|
const n = [];
|
|
319
319
|
e.forEachNode((a) => {
|
|
320
|
-
const
|
|
321
|
-
|
|
320
|
+
const d = a.data, u = L(d), f = a.isSelected();
|
|
321
|
+
t.find((g) => L(g) === u) ? !f && n.push(a) : f && a.setSelected(!1);
|
|
322
322
|
}), e.setNodesSelected({ nodes: n, newValue: !0 }), setTimeout(() => {
|
|
323
323
|
b = !0;
|
|
324
324
|
}, 0);
|
|
@@ -334,12 +334,12 @@ const gr = /* @__PURE__ */ xo({
|
|
|
334
334
|
const e = s.value;
|
|
335
335
|
if (!e || !F.value)
|
|
336
336
|
return;
|
|
337
|
-
const
|
|
337
|
+
const t = e.getColumnState(), { colKey: n, order: a } = F.value, d = t.map((u) => ({
|
|
338
338
|
...u,
|
|
339
339
|
sort: u.colId === n ? ee[a] : null
|
|
340
340
|
}));
|
|
341
|
-
|
|
342
|
-
},
|
|
341
|
+
D(d);
|
|
342
|
+
}, H = () => {
|
|
343
343
|
qe(), s.value?.deselectAll();
|
|
344
344
|
};
|
|
345
345
|
function to(e) {
|
|
@@ -348,7 +348,7 @@ const gr = /* @__PURE__ */ xo({
|
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
const ro = i(() => {
|
|
351
|
-
const e =
|
|
351
|
+
const e = o.customRow;
|
|
352
352
|
return e ? {
|
|
353
353
|
isFullWidthRow: e.isCustomRow,
|
|
354
354
|
fullWidthCellRenderer: It,
|
|
@@ -368,8 +368,8 @@ const gr = /* @__PURE__ */ xo({
|
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
function le(e = !1) {
|
|
371
|
-
const
|
|
372
|
-
return S.value?.apForm?.[
|
|
371
|
+
const t = e ? "getFieldsValueTransformed" : "getFieldsValue";
|
|
372
|
+
return S.value?.apForm?.[t]?.(!0);
|
|
373
373
|
}
|
|
374
374
|
function se(e) {
|
|
375
375
|
S.value?.apForm?.setFieldsValue?.(e);
|
|
@@ -387,53 +387,53 @@ const gr = /* @__PURE__ */ xo({
|
|
|
387
387
|
return e && String(e);
|
|
388
388
|
}
|
|
389
389
|
function lo(e) {
|
|
390
|
-
const
|
|
391
|
-
if (!
|
|
390
|
+
const t = s.value;
|
|
391
|
+
if (!t)
|
|
392
392
|
return;
|
|
393
|
-
const n =
|
|
393
|
+
const n = t.getColumnState() || [], a = e.map((l) => l.key ? String(l.key) : l.key).filter(Boolean), d = n.map((l) => {
|
|
394
394
|
if (!Be.value.includes(l.colId))
|
|
395
395
|
return l;
|
|
396
|
-
const
|
|
396
|
+
const k = !a.includes(l.colId), me = {
|
|
397
397
|
...l,
|
|
398
|
-
hide:
|
|
398
|
+
hide: k
|
|
399
399
|
}, pe = e.find(
|
|
400
400
|
(bo) => ce(bo.key) === l.colId
|
|
401
401
|
);
|
|
402
402
|
return pe && (me.pinned = pe.fixed || null), me;
|
|
403
403
|
}), u = new Map(
|
|
404
|
-
e.map((l,
|
|
405
|
-
), f =
|
|
406
|
-
(l,
|
|
404
|
+
e.map((l, k) => [ce(l.key), k])
|
|
405
|
+
), f = d.filter((l) => u.has(l.colId)).sort(
|
|
406
|
+
(l, k) => u.get(l.colId) - u.get(k.colId)
|
|
407
407
|
), g = [];
|
|
408
|
-
let
|
|
409
|
-
for (const l of
|
|
410
|
-
u.has(l.colId) ? g.push(f[
|
|
411
|
-
|
|
408
|
+
let m = 0;
|
|
409
|
+
for (const l of d)
|
|
410
|
+
u.has(l.colId) ? g.push(f[m++]) : g.push(l);
|
|
411
|
+
D(g, { applyOrder: !0 });
|
|
412
412
|
}
|
|
413
413
|
lt({
|
|
414
414
|
columns: i(() => w.value),
|
|
415
415
|
columnsBackup: i(() => Y.value),
|
|
416
|
-
size: i(() => at[
|
|
416
|
+
size: i(() => at[v.value]),
|
|
417
417
|
updateColumns(e) {
|
|
418
|
-
w.value = e,
|
|
418
|
+
w.value = e, o.onShownColumnsChange?.(e), ut(
|
|
419
419
|
() => s.value?.getColumnState(),
|
|
420
420
|
() => {
|
|
421
421
|
lo(e);
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
424
|
interval: 17,
|
|
425
|
-
check: (
|
|
425
|
+
check: (t) => !!(t && t.length > 0)
|
|
426
426
|
}
|
|
427
427
|
);
|
|
428
428
|
},
|
|
429
429
|
updateSize(e) {
|
|
430
|
-
|
|
430
|
+
v.value = nt[e];
|
|
431
431
|
},
|
|
432
432
|
renderConfig: i(() => ({
|
|
433
|
-
className:
|
|
433
|
+
className: Re("table-header", "title"),
|
|
434
434
|
color: Fe.value.colorTextTertiary
|
|
435
435
|
})),
|
|
436
|
-
dataSource: i(() => r(
|
|
436
|
+
dataSource: i(() => r(p).records),
|
|
437
437
|
getSearchFormValues: le,
|
|
438
438
|
setSearchFormValues: se,
|
|
439
439
|
submit: V,
|
|
@@ -443,36 +443,36 @@ const gr = /* @__PURE__ */ xo({
|
|
|
443
443
|
getSearchFormSorterItems: ie,
|
|
444
444
|
setSearchFormSorterItems: ue,
|
|
445
445
|
resetSearchFormSorterItems: de,
|
|
446
|
-
getLastParams:
|
|
446
|
+
getLastParams: He
|
|
447
447
|
});
|
|
448
|
-
const so = i(() => (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
448
|
+
const so = i(() => (M(o.loading) ? p.loading : o.loading) || Z.value.length === 0), io = i(() => [
|
|
449
|
+
c(),
|
|
450
|
+
o.card ? null : c("wrapper"),
|
|
451
|
+
c("adaptive"),
|
|
452
|
+
c(`size-${v.value}`),
|
|
453
|
+
o.autoHeight && p.records.length ? c("auto-height") : null,
|
|
454
|
+
ve.value
|
|
455
455
|
].filter(Boolean)), uo = i(() => ({
|
|
456
456
|
height: "100%",
|
|
457
|
-
...
|
|
458
|
-
})), co = (e,
|
|
459
|
-
re({ current: e, pageSize:
|
|
457
|
+
...o.tableStyle || {}
|
|
458
|
+
})), co = (e, t) => {
|
|
459
|
+
re({ current: e, pageSize: t });
|
|
460
460
|
};
|
|
461
461
|
function mo(e) {
|
|
462
|
-
const
|
|
463
|
-
return L(
|
|
462
|
+
const t = e.data;
|
|
463
|
+
return L(t);
|
|
464
464
|
}
|
|
465
|
-
function po(e,
|
|
466
|
-
(E(e) ? s.value?.ensureNodeVisible : s.value?.ensureIndexVisible)?.(e,
|
|
465
|
+
function po(e, t) {
|
|
466
|
+
(E(e) ? s.value?.ensureNodeVisible : s.value?.ensureIndexVisible)?.(e, t);
|
|
467
467
|
}
|
|
468
|
-
function fo(e,
|
|
469
|
-
s.value?.ensureColumnVisible(e,
|
|
468
|
+
function fo(e, t) {
|
|
469
|
+
s.value?.ensureColumnVisible(e, t);
|
|
470
470
|
}
|
|
471
471
|
function go(e) {
|
|
472
|
-
|
|
472
|
+
o.onRowClicked?.(e.data, e.event);
|
|
473
473
|
}
|
|
474
474
|
function wo(e) {
|
|
475
|
-
|
|
475
|
+
o.onScrollEnd?.(e.direction);
|
|
476
476
|
}
|
|
477
477
|
function So(e) {
|
|
478
478
|
return s.value?.refreshCells(e);
|
|
@@ -480,49 +480,54 @@ const gr = /* @__PURE__ */ xo({
|
|
|
480
480
|
function Co(e) {
|
|
481
481
|
return s.value?.redrawRows(e);
|
|
482
482
|
}
|
|
483
|
-
function ho({
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
483
|
+
function ho({
|
|
484
|
+
finished: e,
|
|
485
|
+
columns: t,
|
|
486
|
+
source: n
|
|
487
|
+
}) {
|
|
488
|
+
if (!e || n !== "uiColumnResized")
|
|
489
|
+
return;
|
|
490
|
+
const a = (t || []).map((d) => ({
|
|
491
|
+
key: d.getColId(),
|
|
492
|
+
width: d.getActualWidth()
|
|
493
|
+
}));
|
|
494
|
+
q(o.plugins, (d) => d.onColumnResized?.bind(d), a), o.onColumnResized?.(a);
|
|
490
495
|
}
|
|
491
496
|
const yo = (e) => {
|
|
492
|
-
const
|
|
497
|
+
const t = [
|
|
493
498
|
Q.value.getRowClass?.(e)
|
|
494
499
|
];
|
|
495
500
|
if (!e.node.rowPinned) {
|
|
496
|
-
const n = E(
|
|
497
|
-
|
|
501
|
+
const n = E(o.rowClassName) ? o.rowClassName(e.data, e.rowIndex) : o.rowClassName;
|
|
502
|
+
t.push(n);
|
|
498
503
|
}
|
|
499
|
-
return
|
|
500
|
-
},
|
|
501
|
-
s.value = e, q(
|
|
502
|
-
},
|
|
504
|
+
return t.flat().filter(Boolean);
|
|
505
|
+
}, Ro = ({ api: e }) => {
|
|
506
|
+
s.value = e, q(o.plugins, (t) => t.init?.bind(t), e);
|
|
507
|
+
}, vo = (e, t, n) => {
|
|
503
508
|
q(
|
|
504
|
-
|
|
509
|
+
o.plugins,
|
|
505
510
|
(a) => a.searchParamsChange?.bind(this),
|
|
506
|
-
|
|
507
|
-
),
|
|
511
|
+
t
|
|
512
|
+
), o.searchForm && o.searchForm.onValuesChange?.(e, t, n);
|
|
508
513
|
};
|
|
509
|
-
return
|
|
510
|
-
() =>
|
|
514
|
+
return W(
|
|
515
|
+
() => o.dataSource,
|
|
511
516
|
(e) => {
|
|
512
517
|
A(() => {
|
|
513
518
|
Le(e, !0);
|
|
514
519
|
});
|
|
515
520
|
},
|
|
516
521
|
{ immediate: !0, deep: !0 }
|
|
517
|
-
),
|
|
518
|
-
() =>
|
|
522
|
+
), W(
|
|
523
|
+
() => o.size,
|
|
519
524
|
(e) => {
|
|
520
|
-
|
|
525
|
+
v.value = e;
|
|
521
526
|
}
|
|
522
|
-
),
|
|
523
|
-
() => r(
|
|
527
|
+
), W(
|
|
528
|
+
() => r(p).loading,
|
|
524
529
|
(e) => {
|
|
525
|
-
|
|
530
|
+
o.onLoadingChange?.(e);
|
|
526
531
|
}
|
|
527
532
|
), he({
|
|
528
533
|
submit: V,
|
|
@@ -536,12 +541,12 @@ const gr = /* @__PURE__ */ xo({
|
|
|
536
541
|
selectedRows: i(() => G.value),
|
|
537
542
|
setSelectedRowKeys: to,
|
|
538
543
|
setSelectedRows: no,
|
|
539
|
-
clearAll:
|
|
544
|
+
clearAll: H,
|
|
540
545
|
unSelectRows: ao
|
|
541
546
|
},
|
|
542
547
|
scrollToRow: po,
|
|
543
548
|
scrollToColumn: fo,
|
|
544
|
-
getDataSource: () => r(
|
|
549
|
+
getDataSource: () => r(p.records),
|
|
545
550
|
getPaging: Ke,
|
|
546
551
|
setPaging: Ge,
|
|
547
552
|
getSearchFormSorterItems: ie,
|
|
@@ -550,23 +555,23 @@ const gr = /* @__PURE__ */ xo({
|
|
|
550
555
|
refreshCells: So,
|
|
551
556
|
redrawRows: Co,
|
|
552
557
|
_internalGridApi: i(() => s.value)
|
|
553
|
-
}), (e,
|
|
554
|
-
class:
|
|
558
|
+
}), (e, t) => (y(), U("div", {
|
|
559
|
+
class: R(io.value),
|
|
555
560
|
style: _(e.wrapperStyle)
|
|
556
561
|
}, [
|
|
557
|
-
r(
|
|
562
|
+
r(M)(e.dataSource) && e.searchForm !== !1 && r(X).length > 0 ? (y(), U("div", {
|
|
558
563
|
key: 0,
|
|
559
|
-
class:
|
|
564
|
+
class: R(e.card ? r(z)("search-wrapper") : null),
|
|
560
565
|
style: _(e.searchFormWrapperStyle)
|
|
561
566
|
}, [
|
|
562
|
-
|
|
567
|
+
Mo(r(ct).SearchForm, j(r(rt)(e.searchForm || {}, ["onValuesChange"]), {
|
|
563
568
|
ref_key: "formRef",
|
|
564
569
|
ref: S,
|
|
565
570
|
"custom-reset": "",
|
|
566
571
|
"submit-loading": r(te).loading,
|
|
567
572
|
onSubmit: r(V),
|
|
568
573
|
onReset: r(K),
|
|
569
|
-
onValuesChange:
|
|
574
|
+
onValuesChange: vo
|
|
570
575
|
}), Fo({
|
|
571
576
|
default: ge(() => [
|
|
572
577
|
(y(!0), U(Bo, null, Io(r(X), (n) => (y(), $(Ao(n.renderNode), {
|
|
@@ -585,39 +590,39 @@ const gr = /* @__PURE__ */ xo({
|
|
|
585
590
|
]), 1040, ["submit-loading", "onSubmit", "onReset"])
|
|
586
591
|
], 6)) : fe("", !0),
|
|
587
592
|
T("div", {
|
|
588
|
-
class:
|
|
593
|
+
class: R([r(z)("table-wrapper"), e.card ? r(z)("table-wrapper-card") : null]),
|
|
589
594
|
style: _(e.tableWrapperStyle)
|
|
590
595
|
}, [
|
|
591
596
|
T("div", {
|
|
592
|
-
class:
|
|
597
|
+
class: R(r(c)("header-wrapper"))
|
|
593
598
|
}, [
|
|
594
599
|
we(e.$slots, "title", {
|
|
595
600
|
selectedRows: r(G),
|
|
596
601
|
selectedRowKeys: r($e),
|
|
597
602
|
shownColumns: r(w),
|
|
598
|
-
clearAll:
|
|
603
|
+
clearAll: H
|
|
599
604
|
})
|
|
600
605
|
], 2),
|
|
601
606
|
T("div", {
|
|
602
607
|
ref_key: "gridWrapperRef",
|
|
603
608
|
ref: Te,
|
|
604
|
-
class:
|
|
609
|
+
class: R(r(c)("grid-wrapper"))
|
|
605
610
|
}, [
|
|
606
611
|
(y(), $(r(tt), j(
|
|
607
|
-
r(
|
|
612
|
+
r(kt)(r(ke), r(Q), ro.value),
|
|
608
613
|
{
|
|
609
614
|
key: r(J),
|
|
610
615
|
"animate-rows": e.animateRows,
|
|
611
616
|
"get-row-class": yo,
|
|
612
617
|
style: uo.value,
|
|
613
|
-
"row-data": r(
|
|
618
|
+
"row-data": r(p).records,
|
|
614
619
|
"column-defs": r(Z),
|
|
615
620
|
"default-col-def": r(Ae),
|
|
616
621
|
"suppress-loading-overlay": "",
|
|
617
622
|
"row-selection": Ze.value,
|
|
618
|
-
"selection-column-def": r(
|
|
623
|
+
"selection-column-def": r(We),
|
|
619
624
|
"get-row-id": mo,
|
|
620
|
-
"get-row-height":
|
|
625
|
+
"get-row-height": o.getRowHeight,
|
|
621
626
|
theme: r(be),
|
|
622
627
|
"tooltip-show-delay": 500,
|
|
623
628
|
"enable-browser-tooltips": e.browserTooltips,
|
|
@@ -632,8 +637,8 @@ const gr = /* @__PURE__ */ xo({
|
|
|
632
637
|
"enable-cell-span": "",
|
|
633
638
|
"dom-layout": e.autoHeight ? "autoHeight" : "normal",
|
|
634
639
|
"locale-text": ye[r(J)],
|
|
635
|
-
onSortChanged:
|
|
636
|
-
onGridReady:
|
|
640
|
+
onSortChanged: De,
|
|
641
|
+
onGridReady: Ro,
|
|
637
642
|
onRowDataUpdated: I,
|
|
638
643
|
onRowSelected: eo,
|
|
639
644
|
onFirstDataRendered: oo,
|
|
@@ -645,11 +650,11 @@ const gr = /* @__PURE__ */ xo({
|
|
|
645
650
|
), null, 16, ["animate-rows", "style", "row-data", "column-defs", "default-col-def", "row-selection", "selection-column-def", "get-row-height", "theme", "enable-browser-tooltips", "row-class-rules", "no-rows-overlay-component-params", "loading", "dom-layout", "locale-text"]))
|
|
646
651
|
], 2),
|
|
647
652
|
T("div", {
|
|
648
|
-
class:
|
|
653
|
+
class: R(r(c)("pagination-wrapper"))
|
|
649
654
|
}, [
|
|
650
655
|
e.pagination !== !1 ? (y(), $(r(No), j({
|
|
651
656
|
key: 0,
|
|
652
|
-
class: r(
|
|
657
|
+
class: r(c)("pagination")
|
|
653
658
|
}, r(te).pagination, { onChange: co }), null, 16, ["class"])) : fe("", !0)
|
|
654
659
|
], 2)
|
|
655
660
|
], 6)
|
|
@@ -364,7 +364,7 @@ export type AgGridProps<RecordType = any, ParamsType = any> = Omit<TableProps<Re
|
|
|
364
364
|
* @param width
|
|
365
365
|
* @returns
|
|
366
366
|
*/
|
|
367
|
-
onColumnResized?: (
|
|
367
|
+
onColumnResized?: (changes: AgGridColumnResizedOption[]) => void;
|
|
368
368
|
/**
|
|
369
369
|
* 是否允许行动画(默认为true)
|
|
370
370
|
* @description 详见https://www.ag-grid.com/vue-data-grid/row-animation/
|
|
@@ -525,6 +525,10 @@ export type AgGridSlots<RecordType> = {
|
|
|
525
525
|
column: Omit<AgColumn, keyof AgGridColumnType> & AgGridColumnType;
|
|
526
526
|
}) => void;
|
|
527
527
|
};
|
|
528
|
+
export type AgGridColumnResizedOption = {
|
|
529
|
+
key: string;
|
|
530
|
+
width: number;
|
|
531
|
+
};
|
|
528
532
|
export interface AgGridPluginType {
|
|
529
533
|
/**
|
|
530
534
|
* AgGrid 初始化完成
|
|
@@ -553,9 +557,8 @@ export interface AgGridPluginType {
|
|
|
553
557
|
searchParamsChange?: (params: Recordable) => void;
|
|
554
558
|
/**
|
|
555
559
|
* 列宽拖动变化后
|
|
556
|
-
* @param
|
|
557
|
-
* @param width 当前列宽
|
|
560
|
+
* @param changes 变更,可能是批量的
|
|
558
561
|
* @returns
|
|
559
562
|
*/
|
|
560
|
-
onColumnResized?: (
|
|
563
|
+
onColumnResized?: (changes: AgGridColumnResizedOption[]) => void;
|
|
561
564
|
}
|