@aplus-frontend/ui 7.19.6 → 7.19.8
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/editable/form-item.vue.mjs +66 -62
- package/es/src/ag-grid/editable/index.vue.mjs +56 -52
- package/es/src/ag-grid/editable/interface.d.ts +9 -0
- package/es/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-editable-api.mjs +117 -99
- package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +125 -107
- package/es/src/ap-button/ap-button.vue.mjs +23 -23
- package/es/src/ap-button/interface.d.ts +1 -1
- package/es/src/ap-button/utils/index.d.ts +1 -1
- package/es/src/ap-button/utils/index.mjs +7 -7
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.mjs +24 -22
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.mjs +49 -47
- package/es/src/business/ag-grid-modal/interface.d.ts +2 -0
- package/es/src/business/ag-grid-modal/wrapper/index.vue.d.ts +4 -0
- package/es/src/business/ag-grid-modal/wrapper/index.vue2.mjs +24 -22
- package/es/src/business/ap-batch-action-group/index.d.ts +3 -3
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ag-grid/editable/index.vue.js +1 -1
- package/lib/src/ag-grid/editable/interface.d.ts +9 -0
- package/lib/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-editable-api.js +1 -1
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -1
- package/lib/src/ap-button/ap-button.vue.js +1 -1
- package/lib/src/ap-button/interface.d.ts +1 -1
- package/lib/src/ap-button/utils/index.d.ts +1 -1
- package/lib/src/ap-button/utils/index.js +1 -1
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.js +1 -1
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.js +1 -1
- package/lib/src/business/ag-grid-modal/interface.d.ts +2 -0
- package/lib/src/business/ag-grid-modal/wrapper/index.vue.d.ts +4 -0
- package/lib/src/business/ag-grid-modal/wrapper/index.vue2.js +1 -1
- package/lib/src/business/ap-batch-action-group/index.d.ts +3 -3
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as B, useSlots as W, ref as z, computed as o, createBlock as L, openBlock as w, unref as
|
|
1
|
+
import { defineComponent as B, useSlots as W, ref as z, computed as o, createBlock as L, openBlock as w, unref as a, mergeProps as P, createSlots as S, renderList as T, withCtx as _, renderSlot as $, normalizeProps as x, guardReactiveProps as M } from "vue";
|
|
2
2
|
import { Button as N } from "@aplus-frontend/antdv";
|
|
3
3
|
import { wait as A } from "@aplus-frontend/utils";
|
|
4
4
|
import { omit as D } from "lodash-unified";
|
|
@@ -34,15 +34,15 @@ const q = 72, E = 300, X = /* @__PURE__ */ B({
|
|
|
34
34
|
onClick: {}
|
|
35
35
|
},
|
|
36
36
|
setup(f) {
|
|
37
|
-
const m = W(), e = f, { b:
|
|
37
|
+
const m = W(), e = f, { b: i } = R("ap-action-button"), y = I("ap-action-button"), l = z(!1), b = o(
|
|
38
38
|
() => e.borderLinkColor || "var(--ap-button-border-link-color)"
|
|
39
|
-
), i = o(
|
|
40
|
-
() => e.type === "borderLink" && !e.disabled ? b.value : void 0
|
|
41
39
|
), s = o(
|
|
42
|
-
() =>
|
|
40
|
+
() => e.type === "borderLink" && !e.disabled ? b.value : void 0
|
|
41
|
+
), u = o(
|
|
42
|
+
() => O(s.value)
|
|
43
43
|
), h = o(() => e.minWidth === !0 ? `${q}px` : typeof e.minWidth == "number" ? `${e.minWidth}px` : typeof e.minWidth == "string" ? e.minWidth : void 0), v = o(
|
|
44
44
|
() => (e.type === "borderLink" ? "default" : e.type) || "default"
|
|
45
|
-
),
|
|
45
|
+
), c = o(() => e.loading ?? l.value ?? !1), d = o(() => e.lazy === !0 ? E : typeof e.lazy == "number" && e.lazy >= 0 ? e.lazy : 0);
|
|
46
46
|
function k() {
|
|
47
47
|
const t = D(e, [
|
|
48
48
|
"type",
|
|
@@ -57,39 +57,39 @@ const q = 72, E = 300, X = /* @__PURE__ */ B({
|
|
|
57
57
|
onclick: g
|
|
58
58
|
} : {};
|
|
59
59
|
}
|
|
60
|
-
async function g() {
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
60
|
+
async function g(t) {
|
|
61
|
+
if (c.value) return;
|
|
62
|
+
const r = j(e.onClick, t), p = Date.now();
|
|
63
63
|
try {
|
|
64
|
-
|
|
64
|
+
r && (l.value = !0, await r);
|
|
65
65
|
} finally {
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
|
|
66
|
+
if (r) {
|
|
67
|
+
const n = Date.now() - p;
|
|
68
|
+
n < d.value && await A(d.value - n), l.value = !1;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
return (t,
|
|
72
|
+
return (t, r) => (w(), L(a(N), P({
|
|
73
73
|
class: {
|
|
74
|
-
[
|
|
75
|
-
[`${
|
|
76
|
-
[`${
|
|
74
|
+
[a(i)()]: !0,
|
|
75
|
+
[`${a(i)()}-border-link`]: u.value,
|
|
76
|
+
[`${a(y)}`]: !0
|
|
77
77
|
}
|
|
78
78
|
}, {
|
|
79
79
|
...t.$attrs,
|
|
80
80
|
...k()
|
|
81
81
|
}, {
|
|
82
82
|
style: {
|
|
83
|
-
color:
|
|
83
|
+
color: s.value,
|
|
84
84
|
minWidth: h.value,
|
|
85
|
-
"--button-border-color":
|
|
85
|
+
"--button-border-color": u.value
|
|
86
86
|
},
|
|
87
|
-
loading:
|
|
87
|
+
loading: c.value
|
|
88
88
|
}), S({ _: 2 }, [
|
|
89
|
-
T(m, (
|
|
90
|
-
name:
|
|
89
|
+
T(m, (p, n) => ({
|
|
90
|
+
name: n,
|
|
91
91
|
fn: _((C) => [
|
|
92
|
-
$(t.$slots,
|
|
92
|
+
$(t.$slots, n, x(M(C || {})))
|
|
93
93
|
])
|
|
94
94
|
}))
|
|
95
95
|
]), 1040, ["class", "style", "loading"]));
|
|
@@ -4,7 +4,7 @@ export type ApButtonProps = Omit<ButtonProps, 'type' | 'onClick'> & {
|
|
|
4
4
|
borderLinkColor?: string;
|
|
5
5
|
minWidth?: boolean | number | string;
|
|
6
6
|
lazy?: boolean | number;
|
|
7
|
-
onClick?: () => any | Promise<any>;
|
|
7
|
+
onClick?: (e: MouseEvent) => any | Promise<any>;
|
|
8
8
|
};
|
|
9
9
|
export type ApActionButtonProps = ApButtonProps;
|
|
10
10
|
export type ApButtonSlots = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalFuncProps } from '@aplus-frontend/antdv';
|
|
2
2
|
export declare function isPromise(fn: any): any;
|
|
3
|
-
export declare const isAsynchronous: (fn: any) => any;
|
|
3
|
+
export declare const isAsynchronous: (fn: any, e: MouseEvent) => any;
|
|
4
4
|
export declare const transferOpacityColor: (thisColor?: string, thisOpacity?: string) => string | undefined;
|
|
5
5
|
export declare const confirmHandle: (ModalFuncProps: ModalFuncProps) => Promise<unknown>;
|
|
@@ -3,36 +3,36 @@ import { omit as a } from "lodash-unified";
|
|
|
3
3
|
function f(o) {
|
|
4
4
|
return typeof o == "object" && typeof o.then == "function" ? o : !1;
|
|
5
5
|
}
|
|
6
|
-
const m = (o) => typeof o == "function" && f(o?.()), h = (o,
|
|
6
|
+
const m = (o, n) => typeof o == "function" && f(o?.(n)), h = (o, n = "0.7") => {
|
|
7
7
|
try {
|
|
8
8
|
let t = o?.toLowerCase();
|
|
9
9
|
if (t && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)) {
|
|
10
10
|
if (t.length === 4) {
|
|
11
11
|
let e = "#";
|
|
12
|
-
for (let
|
|
13
|
-
e += t.slice(
|
|
12
|
+
for (let c = 1; c < 4; c += 1)
|
|
13
|
+
e += t.slice(c, c + 1).concat(t.slice(c, c + 1));
|
|
14
14
|
t = e;
|
|
15
15
|
}
|
|
16
16
|
const r = [];
|
|
17
17
|
for (let e = 1; e < 7; e += 2)
|
|
18
18
|
r.push(parseInt("0x" + t.slice(e, e + 2)));
|
|
19
|
-
return "rgba(" + r.join(",") + "," +
|
|
19
|
+
return "rgba(" + r.join(",") + "," + n + ")";
|
|
20
20
|
}
|
|
21
21
|
if (t && t.startsWith("rgb")) {
|
|
22
22
|
let r = t.match(/(\d(\.\d+)?)+/g);
|
|
23
|
-
return r = r?.slice(0, 3)?.concat(
|
|
23
|
+
return r = r?.slice(0, 3)?.concat(n), "rgba(" + r.join(",") + ")";
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
} catch {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
}, p = (o) => {
|
|
30
|
-
const { onOk:
|
|
30
|
+
const { onOk: n = () => ({}) } = o;
|
|
31
31
|
return new Promise((t, s) => {
|
|
32
32
|
i.confirm({
|
|
33
33
|
onOk: async () => {
|
|
34
34
|
try {
|
|
35
|
-
await
|
|
35
|
+
await n(), t(!0);
|
|
36
36
|
} catch (r) {
|
|
37
37
|
s(r);
|
|
38
38
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { defineComponent as C, ref as P, createVNode as n, mergeProps as
|
|
2
|
-
import { isFunction as
|
|
1
|
+
import { defineComponent as C, ref as P, createVNode as n, mergeProps as H } from "vue";
|
|
2
|
+
import { isFunction as w, isEmpty as g, omitBy as y, isUndefined as I, omit as x } from "lodash-unified";
|
|
3
3
|
import "../../../ag-grid/index.mjs";
|
|
4
|
-
import { ApModal as
|
|
5
|
-
import { genRequest as
|
|
4
|
+
import { ApModal as A } from "../../../ap-modal/index.mjs";
|
|
5
|
+
import { genRequest as M } from "../utils.mjs";
|
|
6
6
|
import "../wrapper/index.vue.mjs";
|
|
7
|
-
import { useAgGridInstance as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import { useAgGridInstance as _ } from "./use-ag-grid-instance.mjs";
|
|
8
|
+
import q from "../wrapper/index.vue2.mjs";
|
|
9
|
+
import G from "../../../ag-grid/index.vue.mjs";
|
|
10
10
|
function j(r) {
|
|
11
11
|
let a = null, l = null;
|
|
12
|
-
const [o,
|
|
12
|
+
const [o, f] = _(), s = M(r.api, r.getRowKey, o.setDataSourceLength), u = (t) => {
|
|
13
13
|
const {
|
|
14
14
|
title: e,
|
|
15
15
|
width: i,
|
|
16
16
|
modalProps: v,
|
|
17
|
-
...
|
|
18
|
-
} =
|
|
19
|
-
|
|
20
|
-
const
|
|
17
|
+
...m
|
|
18
|
+
} = w(t) ? t(r) : t;
|
|
19
|
+
g(m) || l?.(m);
|
|
20
|
+
const d = y({
|
|
21
21
|
title: e,
|
|
22
22
|
width: i,
|
|
23
23
|
modalProps: v
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
},
|
|
24
|
+
}, I);
|
|
25
|
+
g(d) || a?.update(d);
|
|
26
|
+
}, c = /* @__PURE__ */ C({
|
|
27
27
|
name: "AgGridModalPreviewContent",
|
|
28
28
|
props: {
|
|
29
29
|
modalConfig: {
|
|
@@ -38,14 +38,16 @@ function j(r) {
|
|
|
38
38
|
...e.value,
|
|
39
39
|
...i
|
|
40
40
|
};
|
|
41
|
-
}, () => n(
|
|
42
|
-
default: () => [n(
|
|
41
|
+
}, () => n(f, null, {
|
|
42
|
+
default: () => [n(q, {
|
|
43
43
|
height: e.value.height,
|
|
44
|
-
rowHeight: e.value.rowHeight
|
|
44
|
+
rowHeight: e.value.rowHeight,
|
|
45
|
+
minHeight: e.value.minHeight,
|
|
46
|
+
maxHeight: e.value.maxHeight
|
|
45
47
|
}, {
|
|
46
|
-
default: () => [e.value.renderHeader?.(
|
|
48
|
+
default: () => [e.value.renderHeader?.(x(o, "setInstance"), {
|
|
47
49
|
updateProps: u
|
|
48
|
-
}), n(
|
|
50
|
+
}), n(G, H({
|
|
49
51
|
ref: o.setInstance,
|
|
50
52
|
searchForm: {
|
|
51
53
|
sortable: !1,
|
|
@@ -67,7 +69,7 @@ function j(r) {
|
|
|
67
69
|
}
|
|
68
70
|
});
|
|
69
71
|
function h() {
|
|
70
|
-
a =
|
|
72
|
+
a = A.createModal({
|
|
71
73
|
title: r.title,
|
|
72
74
|
width: r.width,
|
|
73
75
|
destroyOnClose: !0,
|
|
@@ -76,7 +78,7 @@ function j(r) {
|
|
|
76
78
|
afterOpenChange(t) {
|
|
77
79
|
t === !1 && (o.setInstance(void 0), o.setDataSourceLength(0), a = null);
|
|
78
80
|
},
|
|
79
|
-
content: n(
|
|
81
|
+
content: n(c, {
|
|
80
82
|
modalConfig: r
|
|
81
83
|
}, null),
|
|
82
84
|
...r.modalProps || {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as O, ref as _, createVNode as i, mergeProps as L, onUnmounted as j } from "vue";
|
|
2
2
|
import { message as q } from "@aplus-frontend/antdv";
|
|
3
|
-
import { isFunction as u, cloneDeep as D, isEmpty as b, omitBy as G, isUndefined as T, omit as
|
|
3
|
+
import { isFunction as u, cloneDeep as D, isEmpty as b, omitBy as G, isUndefined as T, omit as x } from "lodash-unified";
|
|
4
4
|
import "../../../ag-grid/index.mjs";
|
|
5
5
|
import { ApModal as F } from "../../../ap-modal/index.mjs";
|
|
6
6
|
import "../../../config-provider/index.mjs";
|
|
@@ -14,45 +14,45 @@ import { useLocale as Y } from "../../../config-provider/hooks/use-locale.mjs";
|
|
|
14
14
|
import J from "../wrapper/index.vue2.mjs";
|
|
15
15
|
import Q from "../modal-layout/index.vue2.mjs";
|
|
16
16
|
import X from "../../../ag-grid/index.vue.mjs";
|
|
17
|
-
function we(
|
|
17
|
+
function we(o) {
|
|
18
18
|
let d, f = null, g = null;
|
|
19
|
-
const c = new U(), [
|
|
19
|
+
const c = new U(), [S, K] = V(), {
|
|
20
20
|
t: k
|
|
21
21
|
} = Y(), [s, p] = N({
|
|
22
22
|
onSelectedRows(e) {
|
|
23
23
|
K.setCount(e?.length || 0);
|
|
24
24
|
}
|
|
25
|
-
}), w = W(
|
|
25
|
+
}), w = W(o.api, o.getRowKey, s.setDataSourceLength), y = (e) => {
|
|
26
26
|
const {
|
|
27
|
-
title:
|
|
27
|
+
title: t,
|
|
28
28
|
width: l,
|
|
29
29
|
modalProps: n,
|
|
30
30
|
...a
|
|
31
|
-
} = u(e) ? e(D(
|
|
31
|
+
} = u(e) ? e(D(o)) : e;
|
|
32
32
|
b(a) || g?.(a);
|
|
33
33
|
const r = G({
|
|
34
|
-
title:
|
|
34
|
+
title: t,
|
|
35
35
|
width: l,
|
|
36
36
|
modalProps: n
|
|
37
37
|
}, T);
|
|
38
38
|
b(r) || f?.update(r);
|
|
39
|
-
}, m = u(
|
|
40
|
-
const e =
|
|
39
|
+
}, m = u(o.getRowKey) ? o.getRowKey : (e) => e[o.getRowKey], P = () => {
|
|
40
|
+
const e = o.mergeRule || "old", t = s.getSelectedRows() || [];
|
|
41
41
|
return {
|
|
42
|
-
keys:
|
|
43
|
-
rows:
|
|
42
|
+
keys: I(t),
|
|
43
|
+
rows: t.map((a) => {
|
|
44
44
|
const r = m(a);
|
|
45
45
|
return e === "old" && d?.[r] ? d[r] : $(a);
|
|
46
46
|
})
|
|
47
47
|
};
|
|
48
48
|
}, h = async () => {
|
|
49
|
-
const e = P(),
|
|
50
|
-
return e.keys.length >
|
|
51
|
-
maxCount:
|
|
52
|
-
})), Promise.reject()) : (await
|
|
53
|
-
},
|
|
49
|
+
const e = P(), t = o.maxCount || 1 / 0;
|
|
50
|
+
return e.keys.length > t ? (q.warning(k("ap.apTableModal.messageMaxCount", {
|
|
51
|
+
maxCount: t
|
|
52
|
+
})), Promise.reject()) : (await o.beforeOk?.(e), o.finishCallback?.(e), c.resolve(e), e);
|
|
53
|
+
}, v = () => {
|
|
54
54
|
c.reject("modal is closed!");
|
|
55
|
-
},
|
|
55
|
+
}, M = /* @__PURE__ */ O({
|
|
56
56
|
name: "AgGridModalSelectContent",
|
|
57
57
|
props: {
|
|
58
58
|
modalConfig: {
|
|
@@ -65,20 +65,22 @@ function we(t) {
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
setup(e) {
|
|
68
|
-
const
|
|
68
|
+
const t = _(e.modalConfig);
|
|
69
69
|
return g = (l) => {
|
|
70
|
-
|
|
71
|
-
...
|
|
70
|
+
t.value = {
|
|
71
|
+
...t.value,
|
|
72
72
|
...l
|
|
73
73
|
};
|
|
74
74
|
}, () => {
|
|
75
|
-
const l = e.selectedRows?.map((r) => z(r,
|
|
75
|
+
const l = e.selectedRows?.map((r) => z(r, t.value.getRowKey)), n = t.value, a = B(n.modalLayout);
|
|
76
76
|
return i(p, null, {
|
|
77
77
|
default: () => [i(J, {
|
|
78
78
|
height: n.height,
|
|
79
|
-
rowHeight: n.rowHeight
|
|
79
|
+
rowHeight: n.rowHeight,
|
|
80
|
+
minHeight: t.value.minHeight,
|
|
81
|
+
maxHeight: t.value.maxHeight
|
|
80
82
|
}, {
|
|
81
|
-
default: () => [
|
|
83
|
+
default: () => [o.renderHeader?.(x(s, "setInstance"), {
|
|
82
84
|
updateProps: y
|
|
83
85
|
}), i(Q, a.props, {
|
|
84
86
|
default: () => [i(X, L({
|
|
@@ -103,12 +105,12 @@ function we(t) {
|
|
|
103
105
|
fixed: "left",
|
|
104
106
|
columnWidth: 38,
|
|
105
107
|
disabled(r) {
|
|
106
|
-
return u(n.disabledCheckbox) ? n.disabledCheckbox(r,
|
|
108
|
+
return u(n.disabledCheckbox) ? n.disabledCheckbox(r, x(s, "setInstance")) : n.disabledCheckbox ?? !1;
|
|
107
109
|
},
|
|
108
|
-
...
|
|
110
|
+
...o.rowSelection
|
|
109
111
|
},
|
|
110
|
-
autoHeight: !!
|
|
111
|
-
},
|
|
112
|
+
autoHeight: !!t.value.height
|
|
113
|
+
}, o.gridProps), n.gridSlots)],
|
|
112
114
|
...a.slots
|
|
113
115
|
})]
|
|
114
116
|
})]
|
|
@@ -117,49 +119,49 @@ function we(t) {
|
|
|
117
119
|
}
|
|
118
120
|
});
|
|
119
121
|
function C(e) {
|
|
120
|
-
return i(
|
|
121
|
-
modalConfig:
|
|
122
|
+
return i(M, {
|
|
123
|
+
modalConfig: o,
|
|
122
124
|
selectedRows: e
|
|
123
125
|
}, null);
|
|
124
126
|
}
|
|
125
|
-
function
|
|
126
|
-
const e = Object.values(d || {}),
|
|
127
|
+
function H() {
|
|
128
|
+
const e = Object.values(d || {}), t = C(e);
|
|
127
129
|
f = F.createModal({
|
|
128
|
-
title: i(
|
|
129
|
-
title:
|
|
130
|
-
maxCount:
|
|
131
|
-
isShowDefaultSuffix:
|
|
132
|
-
},
|
|
133
|
-
width:
|
|
130
|
+
title: i(S, {
|
|
131
|
+
title: o.title,
|
|
132
|
+
maxCount: o.maxCount || 1 / 0,
|
|
133
|
+
isShowDefaultSuffix: o.mode !== "radio"
|
|
134
|
+
}, o.modalTitleSlots),
|
|
135
|
+
width: o.width,
|
|
134
136
|
destroyOnClose: !0,
|
|
135
137
|
maskClosable: !1,
|
|
136
138
|
onOk: h,
|
|
137
|
-
onCancel:
|
|
139
|
+
onCancel: v,
|
|
138
140
|
afterOpenChange(l) {
|
|
139
141
|
l === !1 && (s.setInstance(void 0), s.setDataSourceLength(0));
|
|
140
142
|
},
|
|
141
|
-
content:
|
|
142
|
-
...
|
|
143
|
+
content: t,
|
|
144
|
+
...o.modalProps || {}
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
|
-
function
|
|
147
|
+
function I(e) {
|
|
146
148
|
return e?.map(m) || [];
|
|
147
149
|
}
|
|
148
|
-
function R(e,
|
|
150
|
+
function R(e, t, l = !1) {
|
|
149
151
|
if (d = e?.reduce((n, a) => {
|
|
150
152
|
const r = m(a);
|
|
151
153
|
return n[r] = a, n;
|
|
152
|
-
}, {}), w.setExtraParams(
|
|
154
|
+
}, {}), w.setExtraParams(t?.extraParams), H(), l)
|
|
153
155
|
return c.buildPromise();
|
|
154
156
|
}
|
|
155
|
-
function
|
|
156
|
-
return R(e,
|
|
157
|
+
function A(e, t) {
|
|
158
|
+
return R(e, t, !0);
|
|
157
159
|
}
|
|
158
160
|
return j(() => {
|
|
159
161
|
c.reject("component is Unmounted!");
|
|
160
162
|
}), {
|
|
161
163
|
open: R,
|
|
162
|
-
asyncOpen:
|
|
164
|
+
asyncOpen: A,
|
|
163
165
|
refresh: s.refresh,
|
|
164
166
|
getAgGridInstance: s.getInstance,
|
|
165
167
|
genContent: C,
|
|
@@ -20,6 +20,8 @@ export interface AgGridModalBasicProps<TableRowType = any> {
|
|
|
20
20
|
}) => VNodeChild;
|
|
21
21
|
rowHeight?: number;
|
|
22
22
|
height?: CSSProperties['height'];
|
|
23
|
+
minHeight?: CSSProperties['height'];
|
|
24
|
+
maxHeight?: CSSProperties['height'];
|
|
23
25
|
}
|
|
24
26
|
/** 刷新方式 */
|
|
25
27
|
export type RefreshType = 'reset' | 'submit' | 'submitWith';
|
|
@@ -2,6 +2,8 @@ import { CSSProperties, DefineComponent, ComponentOptionsMixin, PublicProps, Com
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
rowHeight?: number;
|
|
4
4
|
height?: CSSProperties['height'];
|
|
5
|
+
minHeight?: CSSProperties['height'];
|
|
6
|
+
maxHeight?: CSSProperties['height'];
|
|
5
7
|
};
|
|
6
8
|
declare function __VLS_template(): {
|
|
7
9
|
attrs: Partial<{}>;
|
|
@@ -16,6 +18,8 @@ declare function __VLS_template(): {
|
|
|
16
18
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
19
|
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
20
|
height: import("csstype").Property.Height<string | number>;
|
|
21
|
+
maxHeight: import("csstype").Property.Height<string | number>;
|
|
22
|
+
minHeight: import("csstype").Property.Height<string | number>;
|
|
19
23
|
rowHeight: number;
|
|
20
24
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
21
25
|
wrapperContainer: HTMLDivElement;
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { useAgGridModalInject as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as c, useTemplateRef as g, computed as s, ref as p, watch as d, onMounted as f, createElementBlock as m, openBlock as H, normalizeStyle as v, renderSlot as y } from "vue";
|
|
2
|
+
import { LARGER_HEIGHT as w, SMALL_HEIGHT as S } from "../constants.mjs";
|
|
3
|
+
import { useAgGridModalInject as _ } from "../hooks/use-ag-grid-instance.mjs";
|
|
4
|
+
const E = /* @__PURE__ */ c({
|
|
5
5
|
__name: "index",
|
|
6
6
|
props: {
|
|
7
7
|
rowHeight: { default: 32 },
|
|
8
|
-
height: { default: void 0 }
|
|
8
|
+
height: { default: void 0 },
|
|
9
|
+
minHeight: { default: S },
|
|
10
|
+
maxHeight: { default: w }
|
|
9
11
|
},
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
12
|
-
() =>
|
|
13
|
-
),
|
|
14
|
-
const e =
|
|
12
|
+
setup(h) {
|
|
13
|
+
const t = h, o = g("wrapperContainer"), u = _(), a = s(
|
|
14
|
+
() => u?.dataSourceLength?.value || 0
|
|
15
|
+
), r = p(t.minHeight), l = () => {
|
|
16
|
+
const e = o.value?.clientHeight, i = o.value?.querySelector(
|
|
15
17
|
".ag-body.ag-layout-normal"
|
|
16
18
|
)?.clientHeight;
|
|
17
19
|
let n = 0;
|
|
18
|
-
!e || !
|
|
20
|
+
!e || !i ? n = 0 : n = e - i, a.value * t.rowHeight > 480 - n && (r.value = t.maxHeight);
|
|
19
21
|
};
|
|
20
22
|
return d(
|
|
21
|
-
() =>
|
|
23
|
+
() => a.value,
|
|
22
24
|
() => {
|
|
23
|
-
|
|
25
|
+
l();
|
|
24
26
|
}
|
|
25
|
-
),
|
|
26
|
-
|
|
27
|
-
}), (e,
|
|
27
|
+
), f(() => {
|
|
28
|
+
l();
|
|
29
|
+
}), (e, i) => (H(), m("div", {
|
|
28
30
|
ref_key: "wrapperContainer",
|
|
29
|
-
ref:
|
|
30
|
-
style:
|
|
31
|
-
minHeight: e.height ? "unset" :
|
|
32
|
-
height: e.height ??
|
|
31
|
+
ref: o,
|
|
32
|
+
style: v({
|
|
33
|
+
minHeight: e.height ? "unset" : t.minHeight,
|
|
34
|
+
height: e.height ?? r.value,
|
|
33
35
|
display: "flex",
|
|
34
36
|
flexDirection: "column"
|
|
35
37
|
})
|
|
36
38
|
}, [
|
|
37
|
-
|
|
39
|
+
y(e.$slots, "default")
|
|
38
40
|
], 4));
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
export {
|
|
42
|
-
|
|
44
|
+
E as default
|
|
43
45
|
};
|
|
@@ -76,7 +76,7 @@ declare const ApBatchActionGroup: {
|
|
|
76
76
|
borderLinkColor?: string;
|
|
77
77
|
minWidth?: boolean | number | string;
|
|
78
78
|
lazy?: boolean | number;
|
|
79
|
-
onClick?: () => any | Promise<any>;
|
|
79
|
+
onClick?: (e: MouseEvent) => any | Promise<any>;
|
|
80
80
|
} & {
|
|
81
81
|
content?: VNodeChild;
|
|
82
82
|
}) | ({
|
|
@@ -398,7 +398,7 @@ declare const ApBatchActionGroup: {
|
|
|
398
398
|
borderLinkColor?: string;
|
|
399
399
|
minWidth?: boolean | number | string;
|
|
400
400
|
lazy?: boolean | number;
|
|
401
|
-
onClick?: () => any | Promise<any>;
|
|
401
|
+
onClick?: (e: MouseEvent) => any | Promise<any>;
|
|
402
402
|
} & {
|
|
403
403
|
content?: VNodeChild;
|
|
404
404
|
}) | ({
|
|
@@ -717,7 +717,7 @@ declare const ApBatchActionGroup: {
|
|
|
717
717
|
borderLinkColor?: string;
|
|
718
718
|
minWidth?: boolean | number | string;
|
|
719
719
|
lazy?: boolean | number;
|
|
720
|
-
onClick?: () => any | Promise<any>;
|
|
720
|
+
onClick?: (e: MouseEvent) => any | Promise<any>;
|
|
721
721
|
} & {
|
|
722
722
|
content?: VNodeChild;
|
|
723
723
|
}) | ({
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.19.
|
|
1
|
+
declare const _default: "7.19.8";
|
|
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 o=require("vue"),i=require("lodash-unified"),y=require("../../ap-form/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),i=require("lodash-unified"),y=require("../../ap-form/index.js"),z=require("../../ap-form/context.js"),H=require("../../ap-form/hooks/use-watch.js"),L=require("../../ap-form/utils/get.js"),G=require("../../ap-form/utils/transform.js");require("../../config-provider/index.js");const U=require("../hooks/use-editable-columns.js"),W=require("../hooks/use-editable-form-item-api.js");require("../index.vue2.js");const $=require("../style/editable.js"),J=require("../utils.js"),c=require("./utils.js"),Q=require("../../config-provider/hooks/use-namespace.js"),X=require("../../config-provider/hooks/use-global-config.js"),Y=require("../index.vue.js"),Z=o.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},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:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1},label:{},name:{},formItem:{}},setup(h,{expose:b}){const C=o.useSlots(),a=h,{b:R}=Q.useNamespace("editable-aggrid"),v=$.default("editable-aggrid"),d=o.ref(),{internalInstance:l}=z.useInjectForm();function B(e){const t=c.getColumnTransformOptions(a.columns||[]);if(!Object.keys(t).length||!e?.length)return e;let n=[];for(const u of e)n.push(G.transformValues(u,t));return n}const s=J.getShadowName(a.name);let f=[];o.onMounted(()=>{const e=a.formItem?.initialValue??L.getModelValue(l?.getInitialValues()??{},a.name);e&&(l?.updateInitialModel(s,c.arrayToObject(i.cloneDeep(e),a.rowKey)),f=i.cloneDeep(e),r.value||_(i.cloneDeep(e),"suffix",!0))});const r=o.ref([]),x=H.useWatch(a.name);o.watch(()=>x.value,e=>{i.isEqual(e,r.value)||w(e??i.cloneDeep(f))},{deep:!0,flush:"post",immediate:!0});const S=X.useGlobalConfig("valueTypeMap"),q=U.useGetEditableColumns(a,S,s),{add:F,addMultiple:I,__addMultiple:_,remove:T,removeByKey:E,getRowData:N,getRowsData:V,getRowDataByKey:D,setRowData:j,setRowDataByKey:K,clear:O,refreshRowIds:m}=W.useEditableFormItemApi(a,l,r,s);function M(){const e=d.value?._internalGridApi;if(!m.value?.length||!e)return;const t=m.value.map(n=>e.getRowNode(n)).filter(n=>!!n);a.supressForceRowUpdate||e.refreshCells({rowNodes:t,force:!0}),m.value=[]}function w(e){r.value=[...e];const t=c.arrayToObject(e,a.rowKey);l?.setFieldValue(a.name,[...e]),l?.setFieldValue(s,t)}function g(e,t){const n=e==="end"?r.value.length-1:e;d.value?.scrollToRow(n,t)}function P(e,t){d.value?.scrollToColumn(e,t)}function k(e,t){const n=[s,String(e),t].flat();return l?.validateFields([n])}function A(e){const n=o.unref(r).map((u,p)=>[s,String(c.getRowKey(u,p,a.rowKey)),e].flat());return l?.validateFields(n)}return b({add:F,addMultiple:I,remove:T,removeByKey:E,getRowData:N,getRowsData:V,getRowDataByKey:D,setRowData:j,clear:O,setTableData:w,scrollTo:g,scrollToRow:g,scrollToColumn:P,validateCell:k,validateColumn:A,setRowDataByKey:K,table:d}),(e,t)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(o.unref(y.ApForm).FormItem,{hidden:"",name:e.name,"initial-value":e.formItem?.initialValue,transform:B},null,8,["name","initial-value"]),o.createVNode(o.unref(y.ApForm).FormItem,o.mergeProps({label:e.label},e.formItem),{default:o.withCtx(()=>[o.createVNode(Y.default,o.mergeProps(o.unref(i.omit)(a,["name","maxLength","onChange","defaultValue","formItem"]),{ref_key:"tableRef",ref:d,class:[o.unref(R)(),o.unref(v)],size:"mini",columns:o.unref(q),"data-source":r.value,"search-form":!1,onUpdate:M}),o.createSlots({_:2},[o.renderList(C,(n,u)=>({name:u,fn:o.withCtx(p=>[o.renderSlot(e.$slots,u,o.normalizeProps(o.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=Z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),i=require("lodash-unified"),m=require("../../ap-form/index.js");require("../../config-provider/index.js");require("../../hooks/index.js");const L=require("../hooks/use-editable-api.js"),M=require("../hooks/use-editable-columns.js");require("../index.vue2.js");const W=require("../style/editable.js"),d=require("./utils.js"),$=require("../../config-provider/hooks/use-namespace.js"),J=require("../../hooks/useControllableValue.js"),Q=require("../../config-provider/hooks/use-global-config.js"),X=require("../index.vue.js"),Y=a.defineComponent({name:"EditableGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},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:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1}},emits:["update:value"],setup(R,{expose:v,emit:h}){const C=a.useSlots(),t=R,{b:x}=$.useNamespace("editable-aggrid"),B=W.default("editable-aggrid"),T=h,u=a.ref(),{value:s,updateValue:y}=J.useControllableValue(t,T),l=a.ref(),_=m.ApForm.useWatch(t.name,l);a.watch(s,e=>{const o=d.arrayToObject(e,t.rowKey);i.isEqual(o,a.unref(_))||l.value?.setFieldValue(t.name,o)},{deep:!0});const F=Q.useGlobalConfig("valueTypeMap"),S=M.useGetEditableColumns(t,F),{add:q,addMultiple:A,remove:E,removeByKey:K,getRowData:j,getRowsData:N,getRowDataByKey:V,setRowData:k,setRowDataByKey:D,clear:O,refreshRowIds:c}=L.useEditableApi(t,l,s,y);function I(){const e=u.value?._internalGridApi;if(!c.value?.length||!e)return;const o=c.value.map(n=>e.getRowNode(n)).filter(n=>!!n);t.supressForceRowUpdate||e.refreshCells({rowNodes:o,force:!0}),c.value=[]}function U(){l.value?.resetFields()}function w(e){return e?(i.isArray(e)?e:[e]).map(n=>i.isArray(n)?[t.name,...n]:[t.name,n]):void 0}function g(e){try{const o=Object.keys(e),n=s.value.map(r=>d.getRowKey(r,void 0,t.rowKey));return o.sort((r,p)=>n.findIndex(f=>String(f)===r)-n.findIndex(f=>String(f)===p)),o.map(r=>e[r])}catch{return e}}async function z(e,o){const r=(await l.value?.validateFields(w(e),o))?.[t.name];return g(r)}async function H(e,o){const r=(await l.value?.validateFieldsReturnTransformed(w(e),o))?.[t.name];return g(r)}function P(e){y(e);const o=d.arrayToObject(e,t.rowKey);l.value?.setFieldValue(t.name,o)}function b(e,o){const n=e==="end"?s.value.length-1:e;u.value?.scrollToRow(n,o)}function G(e,o){u.value?.scrollToColumn(e,o)}return v({resetFields:U,validateFields:z,validateFieldsReturnTransformed:H,add:q,addMultiple:A,remove:E,removeByKey:K,getRowData:j,getRowsData:N,setRowData:k,clear:O,setTableData:P,scrollTo:b,scrollToRow:b,scrollToColumn:G,table:u,getRowDataByKey:V,setRowDataByKey:D}),(e,o)=>(a.openBlock(),a.createBlock(a.unref(m.ApForm),{ref_key:"formRef",ref:l,"initial-values":{[t.name]:a.unref(d.arrayToObject)(a.unref(s),t.rowKey)},style:{height:"100%"}},{default:a.withCtx(()=>[a.createVNode(a.unref(m.ApForm).FormItem,{name:e.name,"no-style":""},{default:a.withCtx(()=>[a.createVNode(X.default,a.mergeProps(a.unref(i.omit)(t,["name","value","onUpdate:value","maxLength","onChange","defaultValue"]),{ref_key:"tableRef",ref:u,class:[a.unref(x)(),a.unref(B)],size:"mini",columns:a.unref(S),"data-source":a.unref(s),"search-form":!1,onUpdate:I}),a.createSlots({_:2},[a.renderList(C,(n,r)=>({name:r,fn:a.withCtx(p=>[a.renderSlot(e.$slots,r,a.normalizeProps(a.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=Y;
|
|
@@ -95,6 +95,15 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
|
|
|
95
95
|
remove: (data: RecordType | RecordType[]) => void;
|
|
96
96
|
validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
|
|
97
97
|
table: AgGridExpose;
|
|
98
|
+
getRowDataByKey: (key: string | number) => RecordType | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* 设置表格行数据(通过行key)
|
|
101
|
+
* @param key
|
|
102
|
+
* @param data
|
|
103
|
+
* @param merge 是否进行数据的浅层合并(默认为true)
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
setRowDataByKey: (key: any, data: Partial<RecordType>, merge?: boolean) => void;
|
|
98
107
|
};
|
|
99
108
|
export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'> & {
|
|
100
109
|
/**
|
|
@@ -9,6 +9,7 @@ export declare const useEditableApi: <RecordType>(props: EditableAgGridProps<Rec
|
|
|
9
9
|
removeByKey: (key: Key | Key[]) => void;
|
|
10
10
|
getRowData: (index: number) => RecordType;
|
|
11
11
|
getRowsData: () => RecordType[];
|
|
12
|
+
setRowDataByKey: (key: any, payload: any, merge?: boolean) => void;
|
|
12
13
|
setRowData: (index: string | number, payload: any, merge?: boolean) => void;
|
|
13
14
|
clear: () => void;
|
|
14
15
|
refreshRowIds: ShallowRef<string[], string[]>;
|