@aplus-frontend/ui 6.35.0 → 6.35.2
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 +17 -16
- package/es/src/ag-grid/interface.d.ts +4 -0
- package/es/src/ap-form/item/index.vue.mjs +13 -12
- package/es/src/business/hooks/useKeepAliveFlag.d.ts +3 -0
- package/es/src/business/hooks/useKeepAliveFlag.mjs +10 -7
- package/es/src/business/hooks/usePageListAgGrid.d.ts +1 -2
- package/es/src/business/hooks/usePageListAgGrid.mjs +29 -38
- 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 +4 -0
- package/lib/src/ap-form/item/index.vue.js +1 -1
- package/lib/src/business/hooks/useKeepAliveFlag.d.ts +3 -0
- package/lib/src/business/hooks/useKeepAliveFlag.js +1 -1
- package/lib/src/business/hooks/usePageListAgGrid.d.ts +1 -2
- package/lib/src/business/hooks/usePageListAgGrid.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
- package/theme/ag-grid/index.css +3 -0
- package/theme/ag-grid/index.less +3 -0
- package/theme/index.css +3 -0
|
@@ -17,8 +17,8 @@ import { useTheme as ko } from "./theme.mjs";
|
|
|
17
17
|
import { useColumns as xo } from "./hooks/use-columns.mjs";
|
|
18
18
|
import { useColumnsDef as Io } from "./hooks/use-columns-def.mjs";
|
|
19
19
|
import { isDef as To } from "../utils/index.mjs";
|
|
20
|
-
import { getValidVNodeList as
|
|
21
|
-
import { useSearchForm as
|
|
20
|
+
import { getValidVNodeList as Do } from "../utils/slot.mjs";
|
|
21
|
+
import { useSearchForm as No } from "./hooks/use-search-form.mjs";
|
|
22
22
|
import "./components/empty/index.vue.mjs";
|
|
23
23
|
import Eo from "./hooks/use-virtual-config.mjs";
|
|
24
24
|
import { usePinnedRow as Ko } from "./hooks/use-pinned-row.mjs";
|
|
@@ -105,7 +105,7 @@ const mt = /* @__PURE__ */ oo({
|
|
|
105
105
|
T(o, "summary")
|
|
106
106
|
), ge = Ao("apGrid"), s = I(), [, we] = Fo();
|
|
107
107
|
let p = !!o.dataSource;
|
|
108
|
-
const L =
|
|
108
|
+
const L = No(o), { shownColumns: f, columns: U, columnKeys: Se, getTargetColumnByKey: ye } = xo(o), { defaultColDef: Ce, columnDefs: he, gridWrapperRef: ve } = Io(U, o, fe), x = I({});
|
|
109
109
|
vo({
|
|
110
110
|
sorter: x,
|
|
111
111
|
setSorter(e) {
|
|
@@ -143,10 +143,10 @@ const mt = /* @__PURE__ */ oo({
|
|
|
143
143
|
return;
|
|
144
144
|
const r = e.getColumnState()?.map((a) => ({ ...a, sort: null }));
|
|
145
145
|
e.applyColumnState({ state: r });
|
|
146
|
-
}, ke = l(() => To(o.manual) ? o.manual :
|
|
146
|
+
}, ke = l(() => To(o.manual) ? o.manual : Do(W.searchFormExtra?.() || []).some((r) => r.type?.name === "ApView")), {
|
|
147
147
|
formRef: g,
|
|
148
|
-
submit:
|
|
149
|
-
reset:
|
|
148
|
+
submit: D,
|
|
149
|
+
reset: N,
|
|
150
150
|
data: w,
|
|
151
151
|
tableProps: j,
|
|
152
152
|
handleTableChangeOptional: $,
|
|
@@ -186,7 +186,7 @@ const mt = /* @__PURE__ */ oo({
|
|
|
186
186
|
...ie,
|
|
187
187
|
...e
|
|
188
188
|
};
|
|
189
|
-
}),
|
|
189
|
+
}), De = Po(o, f), Ne = l(
|
|
190
190
|
() => F(o.dataSource) ? w.records : o.dataSource
|
|
191
191
|
), {
|
|
192
192
|
select: Ee,
|
|
@@ -197,7 +197,7 @@ const mt = /* @__PURE__ */ oo({
|
|
|
197
197
|
selectMultiByKeys: Ae
|
|
198
198
|
} = ho({
|
|
199
199
|
...S,
|
|
200
|
-
dataSource:
|
|
200
|
+
dataSource: Ne,
|
|
201
201
|
rowKey: o.rowKey
|
|
202
202
|
}), Ve = {
|
|
203
203
|
checkbox: "multiRow",
|
|
@@ -209,7 +209,8 @@ const mt = /* @__PURE__ */ oo({
|
|
|
209
209
|
const { type: r = "checkbox", disabled: a } = e;
|
|
210
210
|
return {
|
|
211
211
|
mode: Ve[r],
|
|
212
|
-
isRowSelectable: (d) => a ? !a(d.data) : !0
|
|
212
|
+
isRowSelectable: (d) => a ? !a(d.data) : !0,
|
|
213
|
+
hideDisabledCheckboxes: e.hideDisabled ?? !1
|
|
213
214
|
};
|
|
214
215
|
});
|
|
215
216
|
function K(e) {
|
|
@@ -315,9 +316,9 @@ const mt = /* @__PURE__ */ oo({
|
|
|
315
316
|
dataSource: l(() => t(w).records),
|
|
316
317
|
getSearchFormValues: X,
|
|
317
318
|
setSearchFormValues: Y,
|
|
318
|
-
submit:
|
|
319
|
+
submit: D,
|
|
319
320
|
submitWith: q,
|
|
320
|
-
reset:
|
|
321
|
+
reset: N,
|
|
321
322
|
refresh: J,
|
|
322
323
|
getSearchFormSorterItems: Z,
|
|
323
324
|
setSearchFormSorterItems: _,
|
|
@@ -382,8 +383,8 @@ const mt = /* @__PURE__ */ oo({
|
|
|
382
383
|
o.onLoadingChange?.(e);
|
|
383
384
|
}
|
|
384
385
|
), ue({
|
|
385
|
-
submit:
|
|
386
|
-
reset:
|
|
386
|
+
submit: D,
|
|
387
|
+
reset: N,
|
|
387
388
|
refresh: J,
|
|
388
389
|
submitWith: q,
|
|
389
390
|
setSearchFormValues: Y,
|
|
@@ -418,8 +419,8 @@ const mt = /* @__PURE__ */ oo({
|
|
|
418
419
|
ref: g,
|
|
419
420
|
"custom-reset": "",
|
|
420
421
|
"submit-loading": t(j).loading,
|
|
421
|
-
onSubmit: t(
|
|
422
|
-
onReset: t(
|
|
422
|
+
onSubmit: t(D),
|
|
423
|
+
onReset: t(N)
|
|
423
424
|
}), ao({
|
|
424
425
|
default: ne(() => [
|
|
425
426
|
(b(!0), A(no, null, lo(t(L), (a) => (b(), le(so(a.renderNode), {
|
|
@@ -464,7 +465,7 @@ const mt = /* @__PURE__ */ oo({
|
|
|
464
465
|
"default-col-def": t(Ce),
|
|
465
466
|
"suppress-loading-overlay": "",
|
|
466
467
|
"row-selection": Me.value,
|
|
467
|
-
"selection-column-def": t(
|
|
468
|
+
"selection-column-def": t(De),
|
|
468
469
|
"get-row-id": qe,
|
|
469
470
|
theme: t(me),
|
|
470
471
|
"tooltip-show-delay": 500,
|
|
@@ -119,6 +119,10 @@ export type AgGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>,
|
|
|
119
119
|
* 行选择列自定义tooltip
|
|
120
120
|
*/
|
|
121
121
|
tooltip?: string | ((checked: boolean, disabled: boolean, rowNode: IRowNode) => string | any);
|
|
122
|
+
/**
|
|
123
|
+
* 是否隐藏不可选中的元素
|
|
124
|
+
*/
|
|
125
|
+
hideDisabled?: boolean;
|
|
122
126
|
};
|
|
123
127
|
export type AgGridVirtualConfig = {
|
|
124
128
|
row?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as D, useSlots as L, ref as c, onMounted as _, computed as M, unref as l, cloneVNode as $, createBlock as
|
|
1
|
+
import { defineComponent as D, useSlots as L, ref as c, onMounted as _, computed as M, unref as l, cloneVNode as $, createBlock as b, openBlock as v, mergeProps as j, createSlots as q, withCtx as a, resolveDynamicComponent as E, renderList as K, createElementVNode as O, normalizeClass as Q, createVNode as d, normalizeStyle as U, renderSlot as Y, normalizeProps as G, guardReactiveProps as H } from "vue";
|
|
2
2
|
import { Form as J, Tooltip as W, TypographyText as X } from "@aplus-frontend/antdv";
|
|
3
3
|
import { useToken as Z } from "@aplus-frontend/antdv/es/theme/internal";
|
|
4
|
-
import { isFunction as
|
|
4
|
+
import { isFunction as y, cloneDeep as ee, isArray as oe, omit as F } from "lodash-unified";
|
|
5
5
|
import { apFormItemColPropKeys as le } from "../constant.mjs";
|
|
6
6
|
import { QuestionCircleOutlined as te } from "@ant-design/icons-vue";
|
|
7
7
|
import "../../config-provider/index.mjs";
|
|
@@ -57,9 +57,9 @@ const Ve = /* @__PURE__ */ D({
|
|
|
57
57
|
disabled: { type: Boolean }
|
|
58
58
|
},
|
|
59
59
|
setup(V, { expose: g }) {
|
|
60
|
-
const e = V,
|
|
60
|
+
const e = V, u = L(), { model: m, updateModel: B, internalInstance: h } = re(), { m: i, b: C } = ie("ap-form-item"), s = c(!1), r = c(), [, k] = Z();
|
|
61
61
|
_(async () => {
|
|
62
|
-
let o =
|
|
62
|
+
let o = y(e.initialValue) ? e.initialValue() : e.initialValue;
|
|
63
63
|
ae(o) && (o = await o), h?.registerField({
|
|
64
64
|
name: e.name,
|
|
65
65
|
initialValue: ee(o),
|
|
@@ -68,7 +68,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
68
68
|
});
|
|
69
69
|
const f = M(() => e.name ? oe(e.name) ? e.name.reduce((o, t) => o?.[t], l(m)) : m?.value[e.name] : null);
|
|
70
70
|
function x() {
|
|
71
|
-
const o =
|
|
71
|
+
const o = u.default?.() || [];
|
|
72
72
|
if (!e.name)
|
|
73
73
|
return o[0];
|
|
74
74
|
const t = ne(o)[0];
|
|
@@ -76,6 +76,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
76
76
|
[e.valuePropName]: l(f),
|
|
77
77
|
[`onUpdate:${e.valuePropName}`]: N,
|
|
78
78
|
variant: e.bordered ? "borderless" : t?.props?.variant,
|
|
79
|
+
bordered: e.bordered ? !1 : t?.props?.bordered,
|
|
79
80
|
onFocus: P,
|
|
80
81
|
onBlur: I
|
|
81
82
|
}) : null;
|
|
@@ -105,7 +106,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
105
106
|
const t = l(f);
|
|
106
107
|
if (!o || !e.transform)
|
|
107
108
|
return t;
|
|
108
|
-
const n =
|
|
109
|
+
const n = y(e.transform) ? e.transform : e.transform.transformer;
|
|
109
110
|
return e.transform ? n(t) : t;
|
|
110
111
|
}
|
|
111
112
|
return g({
|
|
@@ -114,7 +115,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
114
115
|
clearValidate: w,
|
|
115
116
|
resetField: z,
|
|
116
117
|
getFieldValue: R
|
|
117
|
-
}), (o, t) => (
|
|
118
|
+
}), (o, t) => (v(), b(l(J).Item, j(
|
|
118
119
|
{
|
|
119
120
|
ref_key: "formItemRef",
|
|
120
121
|
ref: r
|
|
@@ -131,7 +132,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
131
132
|
}
|
|
132
133
|
), q({
|
|
133
134
|
default: a(() => [
|
|
134
|
-
(
|
|
135
|
+
(v(), b(E(x())))
|
|
135
136
|
]),
|
|
136
137
|
_: 2
|
|
137
138
|
}, [
|
|
@@ -141,11 +142,11 @@ const Ve = /* @__PURE__ */ D({
|
|
|
141
142
|
O("span", {
|
|
142
143
|
class: Q(n)
|
|
143
144
|
}, [
|
|
144
|
-
|
|
145
|
+
d(l(W), {
|
|
145
146
|
title: e.tooltip
|
|
146
147
|
}, {
|
|
147
148
|
default: a(() => [
|
|
148
|
-
|
|
149
|
+
d(l(te), {
|
|
149
150
|
style: U({
|
|
150
151
|
color: l(k).colorTextTertiary,
|
|
151
152
|
fontSize: "14px",
|
|
@@ -162,7 +163,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
162
163
|
o.label ? {
|
|
163
164
|
name: "label",
|
|
164
165
|
fn: a(() => [
|
|
165
|
-
|
|
166
|
+
d(l(X), {
|
|
166
167
|
content: o.label,
|
|
167
168
|
ellipsis: { tooltip: o.label },
|
|
168
169
|
style: { "min-width": "0px", flex: "1" }
|
|
@@ -170,7 +171,7 @@ const Ve = /* @__PURE__ */ D({
|
|
|
170
171
|
]),
|
|
171
172
|
key: "1"
|
|
172
173
|
} : void 0,
|
|
173
|
-
K(l(F)(
|
|
174
|
+
K(l(F)(u, "default"), (n, p) => ({
|
|
174
175
|
name: p,
|
|
175
176
|
fn: a((A) => [
|
|
176
177
|
Y(o.$slots, p, G(H(A || {})))
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface UseKeepAliveFlagOptions {
|
|
2
2
|
/** 状态切换到deactivated时触发 */
|
|
3
3
|
afterDeactivated?: () => void;
|
|
4
|
+
/** 状态切换到activated时触发 */
|
|
5
|
+
afterActivated?: () => void;
|
|
4
6
|
}
|
|
5
7
|
/**
|
|
6
8
|
* 获取keepAliveFlag
|
|
@@ -10,5 +12,6 @@ export declare function useKeepAliveFlag(options?: UseKeepAliveFlagOptions): {
|
|
|
10
12
|
isDeactivated: () => boolean;
|
|
11
13
|
isActivated: () => boolean;
|
|
12
14
|
registerAfterDeactivated: (fn: UseKeepAliveFlagOptions["afterDeactivated"]) => void;
|
|
15
|
+
registerAfterActivated: (fn: UseKeepAliveFlagOptions["afterActivated"]) => void;
|
|
13
16
|
};
|
|
14
17
|
export {};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { onActivated as v, onDeactivated as c } from "vue";
|
|
2
|
-
function
|
|
3
|
-
let e = "notKeepAlive", t =
|
|
2
|
+
function s(i) {
|
|
3
|
+
let e = "notKeepAlive", r = i?.afterDeactivated, t = i?.afterActivated;
|
|
4
4
|
return v(() => {
|
|
5
|
-
e = "activated";
|
|
5
|
+
t && e === "deactivated" && Promise.resolve().then(t), e = "activated";
|
|
6
6
|
}), c(() => {
|
|
7
|
-
e = "deactivated",
|
|
7
|
+
e = "deactivated", r?.();
|
|
8
8
|
}), {
|
|
9
9
|
isDeactivated: () => e === "deactivated",
|
|
10
10
|
isActivated: () => e === "activated",
|
|
11
|
-
registerAfterDeactivated: (
|
|
12
|
-
|
|
11
|
+
registerAfterDeactivated: (a) => {
|
|
12
|
+
r = a;
|
|
13
|
+
},
|
|
14
|
+
registerAfterActivated: (a) => {
|
|
15
|
+
t = a;
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
export {
|
|
17
|
-
|
|
20
|
+
s as useKeepAliveFlag
|
|
18
21
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UseTableRefreshOption } from '..';
|
|
2
1
|
import { AgGridExpose, AgGridProps } from '../../ag-grid';
|
|
3
2
|
export interface UsePageListAgGrid extends AgGridProps {
|
|
4
3
|
/** 是否显示默认的行选择配置
|
|
@@ -18,7 +17,7 @@ export interface UsePageListAgGrid extends AgGridProps {
|
|
|
18
17
|
/**
|
|
19
18
|
* 表格刷新相关
|
|
20
19
|
*/
|
|
21
|
-
tableRefresh?: boolean |
|
|
20
|
+
tableRefresh?: boolean | (() => boolean);
|
|
22
21
|
/** 是否需要在deactivated的时候清空数据
|
|
23
22
|
* @default true
|
|
24
23
|
*/
|
|
@@ -1,53 +1,49 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import {
|
|
3
|
-
import { ref as F } from "vue";
|
|
1
|
+
import { isFunction as g, merge as A, cloneDeep as F } from "lodash-unified";
|
|
2
|
+
import { ref as w } from "vue";
|
|
4
3
|
import { useKeepAliveFlag as R } from "./useKeepAliveFlag.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
clearSelectionOnRequest: i = !0,
|
|
4
|
+
function O(l) {
|
|
5
|
+
const r = w(null), {
|
|
6
|
+
isShowRowSelection: u = !0,
|
|
7
|
+
clearSelectionOnRequest: d = !0,
|
|
10
8
|
transformSearchFormValues: o,
|
|
11
|
-
api:
|
|
12
|
-
tableRefresh:
|
|
13
|
-
clearDataOnDeactivated:
|
|
9
|
+
api: a,
|
|
10
|
+
tableRefresh: s = !0,
|
|
11
|
+
clearDataOnDeactivated: f = !0,
|
|
14
12
|
...m
|
|
15
|
-
} =
|
|
13
|
+
} = l || {};
|
|
16
14
|
let n = null;
|
|
17
|
-
const
|
|
15
|
+
const i = () => {
|
|
18
16
|
r.value?.rowSelection?.clearAll();
|
|
19
|
-
}
|
|
20
|
-
w({
|
|
21
|
-
...V(f),
|
|
22
|
-
apTableRef: r
|
|
23
|
-
});
|
|
24
|
-
const u = (e) => {
|
|
17
|
+
}, c = (e) => {
|
|
25
18
|
r.value?.submitWith(e);
|
|
26
19
|
}, p = () => {
|
|
27
20
|
r.value?.reset();
|
|
28
21
|
}, { isDeactivated: h } = R({
|
|
29
|
-
|
|
22
|
+
afterActivated() {
|
|
23
|
+
(g(s) ? s() : s) && c();
|
|
24
|
+
},
|
|
25
|
+
afterDeactivated: c
|
|
30
26
|
});
|
|
31
|
-
return [
|
|
27
|
+
return [A(
|
|
32
28
|
{
|
|
33
29
|
// scroll,tableLayout,columnResizable设置表格可拖动
|
|
34
30
|
columnResizable: !0,
|
|
35
|
-
request:
|
|
36
|
-
if (h() &&
|
|
31
|
+
request: a ? async (e) => {
|
|
32
|
+
if (h() && f)
|
|
37
33
|
return {
|
|
38
34
|
data: [],
|
|
39
35
|
total: 0
|
|
40
36
|
};
|
|
41
37
|
n = e.sort;
|
|
42
38
|
const t = o ? o(e) : e;
|
|
43
|
-
if (!
|
|
44
|
-
const { records:
|
|
45
|
-
return
|
|
46
|
-
data:
|
|
47
|
-
total:
|
|
39
|
+
if (!a) throw new Error("api is not defined");
|
|
40
|
+
const { records: v, total: S } = await a(t);
|
|
41
|
+
return d && i(), {
|
|
42
|
+
data: v,
|
|
43
|
+
total: S
|
|
48
44
|
};
|
|
49
45
|
} : void 0,
|
|
50
|
-
rowSelection:
|
|
46
|
+
rowSelection: u ? {
|
|
51
47
|
fixed: "left",
|
|
52
48
|
columnWidth: 38
|
|
53
49
|
} : void 0,
|
|
@@ -59,7 +55,7 @@ function y(a) {
|
|
|
59
55
|
},
|
|
60
56
|
m
|
|
61
57
|
), {
|
|
62
|
-
reload:
|
|
58
|
+
reload: c,
|
|
63
59
|
reset: p,
|
|
64
60
|
getSearchFormValues: (e = !0) => {
|
|
65
61
|
const t = r.value?.getSearchFormValues(!!e) || {};
|
|
@@ -68,16 +64,11 @@ function y(a) {
|
|
|
68
64
|
getAgGridInstance: () => r.value,
|
|
69
65
|
getSearchFormValuesAndSorted: (e = !0) => {
|
|
70
66
|
const t = r.value?.getSearchFormValues(!!e) || {};
|
|
71
|
-
return t.sort = n &&
|
|
67
|
+
return t.sort = n && F(n), o ? o(t) : t;
|
|
72
68
|
},
|
|
73
|
-
clearSelection:
|
|
69
|
+
clearSelection: i
|
|
74
70
|
}];
|
|
75
71
|
}
|
|
76
|
-
function V(a) {
|
|
77
|
-
return a === !0 ? {} : a === !1 ? {
|
|
78
|
-
refreshBefore: () => !1
|
|
79
|
-
} : a;
|
|
80
|
-
}
|
|
81
72
|
export {
|
|
82
|
-
|
|
73
|
+
O as usePageListAgGrid
|
|
83
74
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.35.
|
|
1
|
+
declare const _default: "6.35.2";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),Ue=require("ag-grid-vue3"),j=require("ag-grid-community"),Ge=require("./utils.js"),$=require("@aplus-frontend/antdv"),d=require("lodash-unified");require("../config-provider/index.js");const We=require("../ap-form/index.js"),Le=require("../ap-table/utils.js"),_e=require("../ap-table/hooks/use-table-paging-ng.js"),He=require("./hooks/use-row-selection.js"),je=require("./context.js"),$e=require("../ap-table/context.js"),B=require("../ap-grid/constants.js"),Je=require("@aplus-frontend/antdv/es/theme/internal"),Qe=require("./theme.js"),Xe=require("./hooks/use-columns.js"),Ye=require("./hooks/use-columns-def.js"),Ze=require("../utils/index.js"),eo=require("../utils/slot.js"),oo=require("./hooks/use-search-form.js");require("./components/empty/index.vue.js");const to=require("./hooks/use-virtual-config.js"),ro=require("./hooks/use-pinned-row.js"),no=require("./hooks/use-selection-col-def.js"),ao=require("../config-provider/hooks/use-namespace.js"),lo=require("../config-provider/hooks/use-global-config.js"),so=require("./components/empty/index.vue2.js"),uo=e.defineComponent({name:"AgGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},columns:{},rowSelection:{type:Boolean},card:{type:Boolean},params:{},request:{},defaultData:{},dataSource:{},onLoadingChange:{},onShownColumnsChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},manual:{type:Boolean,default:void 0},size:{default:"mini"},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{}},setup(J,{expose:Q}){j.ModuleRegistry.registerModules([j.AllCommunityModule]);const t=J,I=e.useSlots(),{e:R,b:i,be:X}=ao.useNamespace("ag-grid"),y=e.ref(t.size),Y=Qe.useTheme(y,e.toRef(t,"rowHeight")),Z=to.default(e.toRef(t,"virtual")),{rowPinnedGridConfig:E,getRowPinnedCellClass:ee}=ro.usePinnedRow(e.toRef(t,"summary")),oe=lo.useGlobalConfig("apGrid"),l=e.ref(),[,te]=Je.useToken();let f=!!t.dataSource;const T=oo.useSearchForm(t),{shownColumns:p,columns:z,columnKeys:re,getTargetColumnByKey:ne}=Xe.useColumns(t),{defaultColDef:ae,columnDefs:le,gridWrapperRef:se}=Ye.useColumnsDef(z,t,ee),b=e.ref({});je.useProvideSorter({sorter:b,setSorter(o){b.value=o}});const ue={asc:"ascend",desc:"descend"};function ie(){const o=l.value.getColumns()?.filter(c=>c.getSort()!==void 0),r=e.unref(b)||{};let n=o?.[0];const u=Object.keys(r);if(u.length&&u.every(c=>r[c]===null)){const c=Object.keys(r)[0];c&&(n=l.value?.getColumn(c))}if(!n)return;const s=n.getColDef(),S=n.getSort(),h=ne(s.colId);V(void 0,void 0,{column:s,field:h?.field??s.field??s.colId,order:S?ue[S]:null})}const ce=e.computed(()=>Le.recursionApColumns(e.unref(p),o=>{if(o.sorter===!0)return o.field??o.dataIndex??o.key}).filter(Boolean)),de=()=>{b.value={};const o=l.value;if(!o)return;const r=o.getColumnState()?.map(n=>({...n,sort:null}));o.applyColumnState({state:r})},fe=e.computed(()=>Ze.isDef(t.manual)?t.manual:eo.getValidVNodeList(I.searchFormExtra?.()||[]).some(r=>r.type?.name==="ApView")),{formRef:m,submit:k,reset:F,data:g,tableProps:D,handleTableChangeOptional:V,submitWith:P,refresh:K,getPaging:pe,setPaging:me,setDataSource:ge}=_e.useTablePaging({async request(o){if(f=!1,w.value&&!w.value.preserveSelectedRowKeys&&d.isUndefined(t.dataSource)&&q(),!d.isUndefined(t.dataSource)){const n=o.pageSize*(o.current-1);return{data:(t.pagination===!1?t.dataSource:t.dataSource.slice(n,n+o.pageSize))||[],total:t.dataSource.length||0}}const r=await t.request?.(o);return{data:r?.data||[],total:r?.total||0}},namespace:"ap-grid",filterFields:e.ref([]),params:e.toRef(t,"params"),defaultData:t.defaultData,manual:e.unref(fe),formatParams:t.beforeSearchSubmit,pagination:t.pagination,sortFields:ce,onClickReset:de}),w=e.computed(()=>{const o=t.rowSelection||oe.value?.rowSelection;if(o)return o===!0?B.DEFAULT_ROW_SELECTION_CONFIG:{...B.DEFAULT_ROW_SELECTION_CONFIG,...o}}),we=no.default(t,p),Se=e.computed(()=>d.isUndefined(t.dataSource)?g.records:t.dataSource),{select:ye,unSelect:Ce,selectedRows:N,selectedRowKeys:he,clearAll:ve,selectMultiByKeys:Re}=He.default({...w,dataSource:Se,rowKey:t.rowKey}),be={checkbox:"multiRow",radio:"singleRow"},Be=e.computed(()=>{const o=w.value;if(!o)return;const{type:r="checkbox",disabled:n}=o;return{mode:be[r],isRowSelectable:u=>n?!n(u.data):!0}});function x(o){return d.isFunction(t.rowKey)?t.rowKey(o):o[t.rowKey]}const A=({api:o=l.value})=>{if(t.onUpdate?.(),!w.value)return;const r=N.value;if(!r.length){setTimeout(()=>{f=!0},0);return}f=!1;const n=[];o.forEachNode(u=>{const C=u.data,s=x(C);r.find(S=>x(S)===s)&&n.push(u)}),o.setNodesSelected({nodes:n,newValue:!0}),setTimeout(()=>{f=!0},0)},ke=o=>{f&&(o.node.isSelected()?ye(o.data):Ce(o.data),d.isFunction(w.value?.tooltip)&&o.api.refreshCells({rowNodes:[o.node],columns:["ag-Grid-SelectionColumn"],force:!0}))},Fe=()=>{f=!0},q=()=>{ve(),l.value?.deselectAll()};function Ne(o){Re(o),e.nextTick(()=>{A({})})}function O(o=!1){const r=o?"getFieldsValueTransformed":"getFieldsValue";return m.value?.apForm?.[r]?.(!0)}function M(o){m.value?.apForm?.setFieldsValue?.(o)}function U(){return m.value?.getSorterItems()||[]}function G(o){m.value?.setSorterItems(o)}function W(){m.value?.resetSorterItems()}function L(o){return o&&String(o)}function xe(o){const r=l.value;if(!r)return;const n=r.getColumnState()||[],u=o.map(a=>a.key?String(a.key):a.key).filter(Boolean),C=n.map(a=>{if(!re.value.includes(a.colId))return a;const v=!u.includes(a.colId),_={...a,hide:v},H=o.find(Me=>L(Me.key)===a.colId);return H&&(_.pinned=H.fixed||null),_}),s=new Map(o.map((a,v)=>[L(a.key),v])),S=C.filter(a=>s.has(a.colId)).sort((a,v)=>s.get(a.colId)-s.get(v.colId)),h=[];let c=0;for(const a of C)s.has(a.colId)?h.push(S[c++]):h.push(a);r.applyColumnState({state:h,applyOrder:!0})}$e.useProvideApTable({columns:e.computed(()=>p.value),columnsBackup:e.computed(()=>z.value),size:e.computed(()=>B.sizeMap[y.value]),updateColumns(o){p.value=o,t.onShownColumnsChange?.(o),xe(o)},updateSize(o){y.value=B.sizeReverseMap[o]},renderConfig:e.computed(()=>({className:X("table-header","title"),color:te.value.colorTextTertiary})),dataSource:e.computed(()=>e.unref(g).records),getSearchFormValues:O,setSearchFormValues:M,submit:k,submitWith:P,reset:F,refresh:K,getSearchFormSorterItems:U,setSearchFormSorterItems:G,resetSearchFormSorterItems:W});const qe=e.computed(()=>d.isUndefined(t.loading)?g.loading:t.loading),Ie=e.computed(()=>[i(),t.card?null:i("wrapper"),i("adaptive"),i(`size-${y.value}`)].filter(Boolean)),Ee=e.computed(()=>({height:"100%",...t.tableStyle||{}})),Te=(o,r)=>{V({current:o,pageSize:r})};function ze(o){const r=o.data;return x(r)}function De(o,r){l.value?.ensureIndexVisible(o,r)}function Ve(o){t.onRowClicked?.(o.data,o.event)}function Pe(o){t.onScrollEnd?.(o.direction)}function Ke(o){return l.value?.refreshCells(o)}function Ae(o){return l.value?.redrawRows(o)}const Oe=o=>{const r=[E.value.getRowClass?.(o)];if(!o.node.rowPinned){const n=d.isFunction(t.rowClassName)?t.rowClassName(o.data,o.rowIndex):t.rowClassName;r.push(n)}return r.flat().filter(Boolean)};return e.watch(()=>t.dataSource,o=>{ge(o)},{immediate:!0,deep:!0}),e.watch(()=>t.size,o=>{y.value=o}),e.watch(()=>e.unref(g).loading,o=>{t.onLoadingChange?.(o)}),Q({submit:k,reset:F,refresh:K,submitWith:P,setSearchFormValues:M,getSearchFormValues:O,getShowColumns:()=>e.unref(p),rowSelection:{selectedRows:e.computed(()=>N.value),setSelectedRowKeys:Ne,clearAll:q},scrollToRow:De,getDataSource:()=>e.unref(g.records),getPaging:pe,setPaging:me,getSearchFormSorterItems:U,setSearchFormSorterItems:G,resetSearchFormSorterItems:W,refreshCells:Ke,redrawRows:Ae,_internalGridApi:e.computed(()=>l.value)}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(Ie.value),style:e.normalizeStyle(o.wrapperStyle)},[e.unref(d.isUndefined)(o.dataSource)&&o.searchForm!==!1&&e.unref(T).length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(o.card?e.unref(R)("search-wrapper"):null),style:e.normalizeStyle(o.searchFormWrapperStyle)},[e.createVNode(e.unref(We.ApForm).SearchForm,e.mergeProps(o.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"","submit-loading":e.unref(D).loading,onSubmit:e.unref(k),onReset:e.unref(F)}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(T),n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),{key:n.dataIndex}))),128))]),_:2},[I.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["submit-loading","onSubmit","onReset"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(R)("table-wrapper"),o.card?e.unref(R)("table-wrapper-card"):null]),style:e.normalizeStyle(o.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i)("header-wrapper"))},[e.renderSlot(o.$slots,"title",{selectedRows:e.unref(N),selectedRowKeys:e.unref(he),shownColumns:e.unref(p),clearAll:q})],2),e.createElementVNode("div",{ref_key:"gridWrapperRef",ref:se,class:e.normalizeClass(e.unref(i)("grid-wrapper"))},[e.createVNode(e.unref(Ue.AgGridVue),e.mergeProps(e.unref(Ge.mergeProps)(e.unref(Z),e.unref(E)),{"get-row-class":Oe,style:Ee.value,"row-data":e.unref(g).records,"column-defs":e.unref(le),"default-col-def":e.unref(ae),"suppress-loading-overlay":"","row-selection":Be.value,"selection-column-def":e.unref(we),"get-row-id":ze,theme:e.unref(Y),"tooltip-show-delay":500,"enable-browser-tooltips":o.browserTooltips,"tooltip-interaction":"","row-class-rules":o.rowClassRules,"no-rows-overlay-component":so.default,"suppress-cell-focus":"","dom-layout":o.autoHeight?"autoHeight":"normal",onSortChanged:ie,onGridReady:r[0]||(r[0]=n=>l.value=n.api),onRowDataUpdated:A,onRowSelected:ke,onFirstDataRendered:Fe,onRowClicked:Ve,onBodyScrollEnd:Pe}),null,16,["style","row-data","column-defs","default-col-def","row-selection","selection-column-def","theme","enable-browser-tooltips","row-class-rules","dom-layout"]),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(R)("table-loading-wrapper"))},[e.createVNode(e.unref($.Spin),{delay:300})],2),[[e.vShow,qe.value]])],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i)("pagination-wrapper"))},[o.pagination!==!1?(e.openBlock(),e.createBlock(e.unref($.Pagination),e.mergeProps({key:0,class:e.unref(i)("pagination")},e.unref(D).pagination,{onChange:Te}),null,16,["class"])):e.createCommentVNode("",!0)],2)],6)],6))}});exports.default=uo;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),Ue=require("ag-grid-vue3"),j=require("ag-grid-community"),Ge=require("./utils.js"),$=require("@aplus-frontend/antdv"),d=require("lodash-unified");require("../config-provider/index.js");const We=require("../ap-form/index.js"),Le=require("../ap-table/utils.js"),_e=require("../ap-table/hooks/use-table-paging-ng.js"),He=require("./hooks/use-row-selection.js"),je=require("./context.js"),$e=require("../ap-table/context.js"),B=require("../ap-grid/constants.js"),Je=require("@aplus-frontend/antdv/es/theme/internal"),Qe=require("./theme.js"),Xe=require("./hooks/use-columns.js"),Ye=require("./hooks/use-columns-def.js"),Ze=require("../utils/index.js"),eo=require("../utils/slot.js"),oo=require("./hooks/use-search-form.js");require("./components/empty/index.vue.js");const to=require("./hooks/use-virtual-config.js"),ro=require("./hooks/use-pinned-row.js"),no=require("./hooks/use-selection-col-def.js"),ao=require("../config-provider/hooks/use-namespace.js"),lo=require("../config-provider/hooks/use-global-config.js"),so=require("./components/empty/index.vue2.js"),uo=e.defineComponent({name:"AgGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},columns:{},rowSelection:{type:Boolean},card:{type:Boolean},params:{},request:{},defaultData:{},dataSource:{},onLoadingChange:{},onShownColumnsChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},manual:{type:Boolean,default:void 0},size:{default:"mini"},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{}},setup(J,{expose:Q}){j.ModuleRegistry.registerModules([j.AllCommunityModule]);const t=J,I=e.useSlots(),{e:R,b:i,be:X}=ao.useNamespace("ag-grid"),y=e.ref(t.size),Y=Qe.useTheme(y,e.toRef(t,"rowHeight")),Z=to.default(e.toRef(t,"virtual")),{rowPinnedGridConfig:E,getRowPinnedCellClass:ee}=ro.usePinnedRow(e.toRef(t,"summary")),oe=lo.useGlobalConfig("apGrid"),l=e.ref(),[,te]=Je.useToken();let f=!!t.dataSource;const T=oo.useSearchForm(t),{shownColumns:p,columns:D,columnKeys:re,getTargetColumnByKey:ne}=Xe.useColumns(t),{defaultColDef:ae,columnDefs:le,gridWrapperRef:se}=Ye.useColumnsDef(D,t,ee),b=e.ref({});je.useProvideSorter({sorter:b,setSorter(o){b.value=o}});const ue={asc:"ascend",desc:"descend"};function ie(){const o=l.value.getColumns()?.filter(c=>c.getSort()!==void 0),r=e.unref(b)||{};let n=o?.[0];const u=Object.keys(r);if(u.length&&u.every(c=>r[c]===null)){const c=Object.keys(r)[0];c&&(n=l.value?.getColumn(c))}if(!n)return;const s=n.getColDef(),S=n.getSort(),h=ne(s.colId);V(void 0,void 0,{column:s,field:h?.field??s.field??s.colId,order:S?ue[S]:null})}const ce=e.computed(()=>Le.recursionApColumns(e.unref(p),o=>{if(o.sorter===!0)return o.field??o.dataIndex??o.key}).filter(Boolean)),de=()=>{b.value={};const o=l.value;if(!o)return;const r=o.getColumnState()?.map(n=>({...n,sort:null}));o.applyColumnState({state:r})},fe=e.computed(()=>Ze.isDef(t.manual)?t.manual:eo.getValidVNodeList(I.searchFormExtra?.()||[]).some(r=>r.type?.name==="ApView")),{formRef:m,submit:k,reset:F,data:g,tableProps:z,handleTableChangeOptional:V,submitWith:P,refresh:K,getPaging:pe,setPaging:me,setDataSource:ge}=_e.useTablePaging({async request(o){if(f=!1,w.value&&!w.value.preserveSelectedRowKeys&&d.isUndefined(t.dataSource)&&q(),!d.isUndefined(t.dataSource)){const n=o.pageSize*(o.current-1);return{data:(t.pagination===!1?t.dataSource:t.dataSource.slice(n,n+o.pageSize))||[],total:t.dataSource.length||0}}const r=await t.request?.(o);return{data:r?.data||[],total:r?.total||0}},namespace:"ap-grid",filterFields:e.ref([]),params:e.toRef(t,"params"),defaultData:t.defaultData,manual:e.unref(fe),formatParams:t.beforeSearchSubmit,pagination:t.pagination,sortFields:ce,onClickReset:de}),w=e.computed(()=>{const o=t.rowSelection||oe.value?.rowSelection;if(o)return o===!0?B.DEFAULT_ROW_SELECTION_CONFIG:{...B.DEFAULT_ROW_SELECTION_CONFIG,...o}}),we=no.default(t,p),Se=e.computed(()=>d.isUndefined(t.dataSource)?g.records:t.dataSource),{select:ye,unSelect:Ce,selectedRows:x,selectedRowKeys:he,clearAll:ve,selectMultiByKeys:Re}=He.default({...w,dataSource:Se,rowKey:t.rowKey}),be={checkbox:"multiRow",radio:"singleRow"},Be=e.computed(()=>{const o=w.value;if(!o)return;const{type:r="checkbox",disabled:n}=o;return{mode:be[r],isRowSelectable:u=>n?!n(u.data):!0,hideDisabledCheckboxes:o.hideDisabled??!1}});function N(o){return d.isFunction(t.rowKey)?t.rowKey(o):o[t.rowKey]}const A=({api:o=l.value})=>{if(t.onUpdate?.(),!w.value)return;const r=x.value;if(!r.length){setTimeout(()=>{f=!0},0);return}f=!1;const n=[];o.forEachNode(u=>{const C=u.data,s=N(C);r.find(S=>N(S)===s)&&n.push(u)}),o.setNodesSelected({nodes:n,newValue:!0}),setTimeout(()=>{f=!0},0)},ke=o=>{f&&(o.node.isSelected()?ye(o.data):Ce(o.data),d.isFunction(w.value?.tooltip)&&o.api.refreshCells({rowNodes:[o.node],columns:["ag-Grid-SelectionColumn"],force:!0}))},Fe=()=>{f=!0},q=()=>{ve(),l.value?.deselectAll()};function xe(o){Re(o),e.nextTick(()=>{A({})})}function O(o=!1){const r=o?"getFieldsValueTransformed":"getFieldsValue";return m.value?.apForm?.[r]?.(!0)}function M(o){m.value?.apForm?.setFieldsValue?.(o)}function U(){return m.value?.getSorterItems()||[]}function G(o){m.value?.setSorterItems(o)}function W(){m.value?.resetSorterItems()}function L(o){return o&&String(o)}function Ne(o){const r=l.value;if(!r)return;const n=r.getColumnState()||[],u=o.map(a=>a.key?String(a.key):a.key).filter(Boolean),C=n.map(a=>{if(!re.value.includes(a.colId))return a;const v=!u.includes(a.colId),_={...a,hide:v},H=o.find(Me=>L(Me.key)===a.colId);return H&&(_.pinned=H.fixed||null),_}),s=new Map(o.map((a,v)=>[L(a.key),v])),S=C.filter(a=>s.has(a.colId)).sort((a,v)=>s.get(a.colId)-s.get(v.colId)),h=[];let c=0;for(const a of C)s.has(a.colId)?h.push(S[c++]):h.push(a);r.applyColumnState({state:h,applyOrder:!0})}$e.useProvideApTable({columns:e.computed(()=>p.value),columnsBackup:e.computed(()=>D.value),size:e.computed(()=>B.sizeMap[y.value]),updateColumns(o){p.value=o,t.onShownColumnsChange?.(o),Ne(o)},updateSize(o){y.value=B.sizeReverseMap[o]},renderConfig:e.computed(()=>({className:X("table-header","title"),color:te.value.colorTextTertiary})),dataSource:e.computed(()=>e.unref(g).records),getSearchFormValues:O,setSearchFormValues:M,submit:k,submitWith:P,reset:F,refresh:K,getSearchFormSorterItems:U,setSearchFormSorterItems:G,resetSearchFormSorterItems:W});const qe=e.computed(()=>d.isUndefined(t.loading)?g.loading:t.loading),Ie=e.computed(()=>[i(),t.card?null:i("wrapper"),i("adaptive"),i(`size-${y.value}`)].filter(Boolean)),Ee=e.computed(()=>({height:"100%",...t.tableStyle||{}})),Te=(o,r)=>{V({current:o,pageSize:r})};function De(o){const r=o.data;return N(r)}function ze(o,r){l.value?.ensureIndexVisible(o,r)}function Ve(o){t.onRowClicked?.(o.data,o.event)}function Pe(o){t.onScrollEnd?.(o.direction)}function Ke(o){return l.value?.refreshCells(o)}function Ae(o){return l.value?.redrawRows(o)}const Oe=o=>{const r=[E.value.getRowClass?.(o)];if(!o.node.rowPinned){const n=d.isFunction(t.rowClassName)?t.rowClassName(o.data,o.rowIndex):t.rowClassName;r.push(n)}return r.flat().filter(Boolean)};return e.watch(()=>t.dataSource,o=>{ge(o)},{immediate:!0,deep:!0}),e.watch(()=>t.size,o=>{y.value=o}),e.watch(()=>e.unref(g).loading,o=>{t.onLoadingChange?.(o)}),Q({submit:k,reset:F,refresh:K,submitWith:P,setSearchFormValues:M,getSearchFormValues:O,getShowColumns:()=>e.unref(p),rowSelection:{selectedRows:e.computed(()=>x.value),setSelectedRowKeys:xe,clearAll:q},scrollToRow:ze,getDataSource:()=>e.unref(g.records),getPaging:pe,setPaging:me,getSearchFormSorterItems:U,setSearchFormSorterItems:G,resetSearchFormSorterItems:W,refreshCells:Ke,redrawRows:Ae,_internalGridApi:e.computed(()=>l.value)}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(Ie.value),style:e.normalizeStyle(o.wrapperStyle)},[e.unref(d.isUndefined)(o.dataSource)&&o.searchForm!==!1&&e.unref(T).length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(o.card?e.unref(R)("search-wrapper"):null),style:e.normalizeStyle(o.searchFormWrapperStyle)},[e.createVNode(e.unref(We.ApForm).SearchForm,e.mergeProps(o.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"","submit-loading":e.unref(z).loading,onSubmit:e.unref(k),onReset:e.unref(F)}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(T),n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),{key:n.dataIndex}))),128))]),_:2},[I.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["submit-loading","onSubmit","onReset"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(R)("table-wrapper"),o.card?e.unref(R)("table-wrapper-card"):null]),style:e.normalizeStyle(o.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(i)("header-wrapper"))},[e.renderSlot(o.$slots,"title",{selectedRows:e.unref(x),selectedRowKeys:e.unref(he),shownColumns:e.unref(p),clearAll:q})],2),e.createElementVNode("div",{ref_key:"gridWrapperRef",ref:se,class:e.normalizeClass(e.unref(i)("grid-wrapper"))},[e.createVNode(e.unref(Ue.AgGridVue),e.mergeProps(e.unref(Ge.mergeProps)(e.unref(Z),e.unref(E)),{"get-row-class":Oe,style:Ee.value,"row-data":e.unref(g).records,"column-defs":e.unref(le),"default-col-def":e.unref(ae),"suppress-loading-overlay":"","row-selection":Be.value,"selection-column-def":e.unref(we),"get-row-id":De,theme:e.unref(Y),"tooltip-show-delay":500,"enable-browser-tooltips":o.browserTooltips,"tooltip-interaction":"","row-class-rules":o.rowClassRules,"no-rows-overlay-component":so.default,"suppress-cell-focus":"","dom-layout":o.autoHeight?"autoHeight":"normal",onSortChanged:ie,onGridReady:r[0]||(r[0]=n=>l.value=n.api),onRowDataUpdated:A,onRowSelected:ke,onFirstDataRendered:Fe,onRowClicked:Ve,onBodyScrollEnd:Pe}),null,16,["style","row-data","column-defs","default-col-def","row-selection","selection-column-def","theme","enable-browser-tooltips","row-class-rules","dom-layout"]),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(R)("table-loading-wrapper"))},[e.createVNode(e.unref($.Spin),{delay:300})],2),[[e.vShow,qe.value]])],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(i)("pagination-wrapper"))},[o.pagination!==!1?(e.openBlock(),e.createBlock(e.unref($.Pagination),e.mergeProps({key:0,class:e.unref(i)("pagination")},e.unref(z).pagination,{onChange:Te}),null,16,["class"])):e.createCommentVNode("",!0)],2)],6)],6))}});exports.default=uo;
|
|
@@ -119,6 +119,10 @@ export type AgGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>,
|
|
|
119
119
|
* 行选择列自定义tooltip
|
|
120
120
|
*/
|
|
121
121
|
tooltip?: string | ((checked: boolean, disabled: boolean, rowNode: IRowNode) => string | any);
|
|
122
|
+
/**
|
|
123
|
+
* 是否隐藏不可选中的元素
|
|
124
|
+
*/
|
|
125
|
+
hideDisabled?: boolean;
|
|
122
126
|
};
|
|
123
127
|
export type AgGridVirtualConfig = {
|
|
124
128
|
row?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("@aplus-frontend/antdv"),S=require("@aplus-frontend/antdv/es/theme/internal"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("@aplus-frontend/antdv"),S=require("@aplus-frontend/antdv/es/theme/internal"),n=require("lodash-unified"),I=require("../constant.js"),T=require("@ant-design/icons-vue");require("../../config-provider/index.js");const _=require("../context.js"),z=require("@fruits-chain/utils"),M=require("../../utils/slot.js"),R=require("../../config-provider/hooks/use-namespace.js"),A=e.defineComponent({name:"ApFormItem",__name:"index",props:{htmlFor:{},prefixCls:{},label:{},help:{},extra:{},labelCol:{},wrapperCol:{},hasFeedback:{type:Boolean,default:!1},colon:{type:Boolean,default:void 0},labelAlign:{},prop:{},name:{},rules:{},autoLink:{type:Boolean,default:!0},required:{type:Boolean,default:void 0},validateFirst:{type:Boolean,default:void 0},validateStatus:{},validateTrigger:{},messageVariables:{},hidden:{type:Boolean},noStyle:{type:Boolean},tooltip:{},span:{},order:{},offset:{},push:{},pull:{},xs:{},sm:{},md:{},lg:{},xl:{},xxl:{},flex:{},bordered:{type:Boolean,default:!1},valuePropName:{default:"value"},initialValue:{},_signal:{},transform:{},description:{},customFilled:{},disabled:{type:Boolean}},setup(m,{expose:v}){const t=m,d=e.useSlots(),{model:f,updateModel:b,internalInstance:y}=_.useInjectForm(),{m:i,b:F}=R.useNamespace("ap-form-item"),s=e.ref(!1),l=e.ref(),[,V]=S.useToken();e.onMounted(async()=>{let o=n.isFunction(t.initialValue)?t.initialValue():t.initialValue;z.isPromise(o)&&(o=await o),y?.registerField({name:t.name,initialValue:n.cloneDeep(o),transform:t.transform})});const c=e.computed(()=>t.name?n.isArray(t.name)?t.name.reduce((o,r)=>o?.[r],e.unref(f)):f?.value[t.name]:null);function g(){const o=d.default?.()||[];if(!t.name)return o[0];const r=M.getValidVNodeList(o)[0];return r?e.cloneVNode(r,{[t.valuePropName]:e.unref(c),[`onUpdate:${t.valuePropName}`]:h,variant:t.bordered?"borderless":r?.props?.variant,bordered:t.bordered?!1:r?.props?.bordered,onFocus:B,onBlur:C}):null}function h(o){b?.(t.name,o)}function B(){s.value=!0}function C(){s.value=!1}function x(){l.value?.onFieldBlur()}function q(){l.value?.onFieldChange()}function k(){l.value?.clearValidate()}function N(){l.value?.resetField()}function w(o=!1){const r=e.unref(c);if(!o||!t.transform)return r;const a=n.isFunction(t.transform)?t.transform:t.transform.transformer;return t.transform?a(r):r}return v({onFieldBlur:x,onFieldChange:q,clearValidate:k,resetField:N,getFieldValue:w}),(o,r)=>(e.openBlock(),e.createBlock(e.unref(u.Form).Item,e.mergeProps({ref_key:"formItemRef",ref:l},e.unref(n.omit)(t,[...e.unref(I.apFormItemColPropKeys),"tooltip","label","description"]),{class:{[e.unref(i)("bordered")]:o.bordered,[e.unref(i)("focused")]:o.bordered&&s.value,[e.unref(i)("disabled")]:o.bordered&&o.disabled,[e.unref(F)()]:!0},colon:o.bordered?!1:t.colon}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g())))]),_:2},[t.tooltip?{name:"tooltip",fn:e.withCtx(({class:a})=>[e.createElementVNode("span",{class:e.normalizeClass(a)},[e.createVNode(e.unref(u.Tooltip),{title:t.tooltip},{default:e.withCtx(()=>[e.createVNode(e.unref(T.QuestionCircleOutlined),{style:e.normalizeStyle({color:e.unref(V).colorTextTertiary,fontSize:"14px",transform:"translateY(1px)"})},null,8,["style"])]),_:1},8,["title"])],2)]),key:"0"}:void 0,o.label?{name:"label",fn:e.withCtx(()=>[e.createVNode(e.unref(u.TypographyText),{content:o.label,ellipsis:{tooltip:o.label},style:{"min-width":"0px",flex:"1"}},null,8,["content","ellipsis"])]),key:"1"}:void 0,e.renderList(e.unref(n.omit)(d,"default"),(a,p)=>({name:p,fn:e.withCtx(P=>[e.renderSlot(o.$slots,p,e.normalizeProps(e.guardReactiveProps(P||{})))])}))]),1040,["class","colon"]))}});exports.default=A;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface UseKeepAliveFlagOptions {
|
|
2
2
|
/** 状态切换到deactivated时触发 */
|
|
3
3
|
afterDeactivated?: () => void;
|
|
4
|
+
/** 状态切换到activated时触发 */
|
|
5
|
+
afterActivated?: () => void;
|
|
4
6
|
}
|
|
5
7
|
/**
|
|
6
8
|
* 获取keepAliveFlag
|
|
@@ -10,5 +12,6 @@ export declare function useKeepAliveFlag(options?: UseKeepAliveFlagOptions): {
|
|
|
10
12
|
isDeactivated: () => boolean;
|
|
11
13
|
isActivated: () => boolean;
|
|
12
14
|
registerAfterDeactivated: (fn: UseKeepAliveFlagOptions["afterDeactivated"]) => void;
|
|
15
|
+
registerAfterActivated: (fn: UseKeepAliveFlagOptions["afterActivated"]) => void;
|
|
13
16
|
};
|
|
14
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue");function c(i){let e="notKeepAlive",r=i?.afterDeactivated,t=i?.afterActivated;return v.onActivated(()=>{t&&e==="deactivated"&&Promise.resolve().then(t),e="activated"}),v.onDeactivated(()=>{e="deactivated",r?.()}),{isDeactivated:()=>e==="deactivated",isActivated:()=>e==="activated",registerAfterDeactivated:a=>{r=a},registerAfterActivated:a=>{t=a}}}exports.useKeepAliveFlag=c;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UseTableRefreshOption } from '..';
|
|
2
1
|
import { AgGridExpose, AgGridProps } from '../../ag-grid';
|
|
3
2
|
export interface UsePageListAgGrid extends AgGridProps {
|
|
4
3
|
/** 是否显示默认的行选择配置
|
|
@@ -18,7 +17,7 @@ export interface UsePageListAgGrid extends AgGridProps {
|
|
|
18
17
|
/**
|
|
19
18
|
* 表格刷新相关
|
|
20
19
|
*/
|
|
21
|
-
tableRefresh?: boolean |
|
|
20
|
+
tableRefresh?: boolean | (() => boolean);
|
|
22
21
|
/** 是否需要在deactivated的时候清空数据
|
|
23
22
|
* @default true
|
|
24
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash-unified"),F=require("vue"),q=require("./useKeepAliveFlag.js");function w(u){const r=F.ref(null),{isShowRowSelection:d=!0,clearSelectionOnRequest:f=!0,transformSearchFormValues:o,api:a,tableRefresh:s=!0,clearDataOnDeactivated:g=!0,...v}=u||{};let n=null;const l=()=>{r.value?.rowSelection?.clearAll()},i=e=>{r.value?.submitWith(e)},S=()=>{r.value?.reset()},{isDeactivated:h}=q.useKeepAliveFlag({afterActivated(){(c.isFunction(s)?s():s)&&i()},afterDeactivated:i}),p=async e=>{if(h()&&g)return{data:[],total:0};n=e.sort;const t=o?o(e):e;if(!a)throw new Error("api is not defined");const{records:m,total:A}=await a(t);return f&&l(),{data:m,total:A}};return[c.merge({columnResizable:!0,request:a?p:void 0,rowSelection:d?{fixed:"left",columnWidth:38}:void 0,ref(e){r.value=e},card:!0},v),{reload:i,reset:S,getSearchFormValues:(e=!0)=>{const t=r.value?.getSearchFormValues(!!e)||{};return o?o(t):t},getAgGridInstance:()=>r.value,getSearchFormValuesAndSorted:(e=!0)=>{const t=r.value?.getSearchFormValues(!!e)||{};return t.sort=n&&c.cloneDeep(n),o?o(t):t},clearSelection:l}]}exports.usePageListAgGrid=w;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.35.
|
|
1
|
+
declare const _default: "6.35.2";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.35.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.35.2";exports.default=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "6.35.
|
|
3
|
+
"version": "6.35.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"@aplus-frontend/hooks": "1.0.7"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@aplus-frontend/antdv": "^1.2.
|
|
44
|
+
"@aplus-frontend/antdv": "^1.2.11",
|
|
45
45
|
"@aplus-frontend/icon": "^1.2.6",
|
|
46
46
|
"@aplus-frontend/oss": "^1.1.2",
|
|
47
47
|
"vue": "^3.5.17",
|
|
48
48
|
"vxe-table": "^4.13.37"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@aplus-frontend/antdv": "^1.2.
|
|
51
|
+
"@aplus-frontend/antdv": "^1.2.11",
|
|
52
52
|
"@aplus-frontend/icon": "^1.2.6",
|
|
53
53
|
"@aplus-frontend/oss": "^1.1.2",
|
|
54
54
|
"@types/sortablejs": "^1.15.8",
|
package/theme/ag-grid/index.css
CHANGED
package/theme/ag-grid/index.less
CHANGED
package/theme/index.css
CHANGED
|
@@ -4423,6 +4423,9 @@ div.aplus-ap-info-layout-admin__header-shadow.aplus-ap-info-layout-admin__sticky
|
|
|
4423
4423
|
user-select: text;
|
|
4424
4424
|
-webkit-user-select: text;
|
|
4425
4425
|
}
|
|
4426
|
+
.aplus-ag-grid .ag-checkbox.ag-labeled[disabled] .ag-input-field-input[disabled] {
|
|
4427
|
+
cursor: not-allowed;
|
|
4428
|
+
}
|
|
4426
4429
|
.aplus-ap-value-select-card {
|
|
4427
4430
|
position: relative;
|
|
4428
4431
|
margin-top: 8px;
|