@aplus-frontend/ui 6.37.0 → 6.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +215 -218
- package/es/src/ag-grid/components/row/index.vue.d.ts +6 -0
- package/es/src/ag-grid/components/row/index.vue.mjs +4 -0
- package/es/src/ag-grid/components/row/index.vue2.mjs +14 -0
- package/es/src/ag-grid/editable/form-item.vue.mjs +10 -9
- package/es/src/ag-grid/editable/index.vue.mjs +17 -16
- package/es/src/ag-grid/hooks/use-columns-def.mjs +73 -71
- package/es/src/ag-grid/hooks/use-row-selection.d.ts +1 -1
- package/es/src/ag-grid/hooks/use-row-selection.mjs +81 -68
- package/es/src/ag-grid/index.vue.d.ts +2 -1
- package/es/src/ag-grid/index.vue.mjs +282 -257
- package/es/src/ag-grid/interface.d.ts +54 -3
- package/es/src/ap-action/group/index.vue.mjs +24 -21
- package/es/src/ap-action/item/index.vue2.mjs +28 -20
- package/es/src/ap-table/components/setting/modal/index.vue2.mjs +72 -71
- package/es/src/ap-table/interface.d.ts +6 -0
- package/es/src/business/ag-grid-modal/constants.d.ts +4 -0
- package/es/src/business/ag-grid-modal/constants.mjs +6 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-instance.d.ts +33 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-instance.mjs +50 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.d.ts +3 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.mjs +58 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.d.ts +2 -0
- package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.mjs +122 -0
- package/es/src/business/ag-grid-modal/hooks/use-modal-title.d.ts +24 -0
- package/es/src/business/ag-grid-modal/hooks/use-modal-title.mjs +49 -0
- package/es/src/business/ag-grid-modal/index.d.ts +2 -0
- package/es/src/business/ag-grid-modal/index.mjs +6 -0
- package/es/src/business/ag-grid-modal/interface.d.ts +130 -0
- package/es/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +43 -0
- package/es/src/business/ag-grid-modal/modal-layout/index.vue.mjs +4 -0
- package/es/src/business/ag-grid-modal/modal-layout/index.vue2.mjs +102 -0
- package/es/src/business/ag-grid-modal/style/css.js +1 -0
- package/es/src/business/ag-grid-modal/style/index.js +1 -0
- package/es/src/business/ag-grid-modal/utils.d.ts +52 -0
- package/es/src/business/ag-grid-modal/utils.mjs +72 -0
- package/es/src/business/ag-grid-modal/wrapper/index.vue.d.ts +23 -0
- package/es/src/business/ag-grid-modal/wrapper/index.vue.mjs +4 -0
- package/es/src/business/ag-grid-modal/wrapper/index.vue2.mjs +25 -0
- package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -0
- package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +1 -0
- package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +1 -0
- package/es/src/business/ap-table-modal/index.d.ts +3 -0
- package/es/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/es/src/business/hooks/usePageListApTable.d.ts +1 -0
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +55 -54
- package/es/src/index.d.ts +0 -1
- package/es/src/index.mjs +280 -284
- package/es/src/path-map.mjs +3 -2
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ag-grid/components/row/index.vue.d.ts +6 -0
- package/lib/src/ag-grid/components/row/index.vue.js +1 -0
- package/lib/src/ag-grid/components/row/index.vue2.js +1 -0
- 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/hooks/use-columns-def.js +1 -1
- package/lib/src/ag-grid/hooks/use-row-selection.d.ts +1 -1
- package/lib/src/ag-grid/hooks/use-row-selection.js +1 -1
- package/lib/src/ag-grid/index.vue.d.ts +2 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +54 -3
- package/lib/src/ap-action/group/index.vue.js +1 -1
- package/lib/src/ap-action/item/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
- package/lib/src/ap-table/interface.d.ts +6 -0
- package/lib/src/business/ag-grid-modal/constants.d.ts +4 -0
- package/lib/src/business/ag-grid-modal/constants.js +1 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-instance.d.ts +33 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-instance.js +1 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.d.ts +3 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.js +1 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.d.ts +2 -0
- package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.js +1 -0
- package/lib/src/business/ag-grid-modal/hooks/use-modal-title.d.ts +24 -0
- package/lib/src/business/ag-grid-modal/hooks/use-modal-title.js +1 -0
- package/lib/src/business/ag-grid-modal/index.d.ts +2 -0
- package/lib/src/business/ag-grid-modal/index.js +1 -0
- package/lib/src/business/ag-grid-modal/interface.d.ts +130 -0
- package/lib/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +43 -0
- package/lib/src/business/ag-grid-modal/modal-layout/index.vue.js +1 -0
- package/lib/src/business/ag-grid-modal/modal-layout/index.vue2.js +1 -0
- package/lib/src/business/ag-grid-modal/style/css.cjs +1 -0
- package/lib/src/business/ag-grid-modal/style/index.cjs +1 -0
- package/lib/src/business/ag-grid-modal/utils.d.ts +52 -0
- package/lib/src/business/ag-grid-modal/utils.js +1 -0
- package/lib/src/business/ag-grid-modal/wrapper/index.vue.d.ts +23 -0
- package/lib/src/business/ag-grid-modal/wrapper/index.vue.js +1 -0
- package/lib/src/business/ag-grid-modal/wrapper/index.vue2.js +1 -0
- package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +1 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +1 -0
- package/lib/src/business/ap-table-modal/index.d.ts +3 -0
- package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/lib/src/business/hooks/usePageListApTable.d.ts +1 -0
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/index.d.ts +0 -1
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
- package/theme/ag-grid/index.css +3 -0
- package/theme/ag-grid-modal/index.css +773 -0
- package/theme/ag-grid-modal/index.less +58 -0
- package/theme/ap-form/ap-form-item.css +3 -0
- package/theme/ap-form/ap-form-item.less +3 -0
- package/theme/ap-form/index.css +3 -0
- package/theme/ap-form/search-form.css +3 -0
- package/theme/ap-grid/index.css +3 -0
- package/theme/ap-table/ap-table.css +3 -0
- package/theme/ap-table-modal/index.css +3 -0
- package/theme/ap-upload/index.css +5 -0
- package/theme/ap-upload/multiple-file.css +5 -0
- package/theme/ap-upload/multiple-file.less +6 -0
- package/theme/editable-table/index.css +3 -0
- package/theme/index.css +54 -3
- package/theme/index.less +1 -1
- package/es/src/work-order-modal/createWorkOrder.d.ts +0 -3
- package/es/src/work-order-modal/createWorkOrder.mjs +0 -32
- package/es/src/work-order-modal/help-message.vue.d.ts +0 -3
- package/es/src/work-order-modal/help-message.vue.mjs +0 -4
- package/es/src/work-order-modal/help-message.vue2.mjs +0 -36
- package/es/src/work-order-modal/index.d.ts +0 -4
- package/es/src/work-order-modal/index.mjs +0 -8
- package/es/src/work-order-modal/interfaces.d.ts +0 -31
- package/es/src/work-order-modal/interfaces.mjs +0 -9
- package/es/src/work-order-modal/style/css.js +0 -4
- package/es/src/work-order-modal/style/index.js +0 -4
- package/es/src/work-order-modal/work-order-modal.vue.d.ts +0 -846
- package/es/src/work-order-modal/work-order-modal.vue.mjs +0 -192
- package/es/src/work-order-modal/work-order-modal.vue2.mjs +0 -4
- package/lib/src/work-order-modal/createWorkOrder.d.ts +0 -3
- package/lib/src/work-order-modal/createWorkOrder.js +0 -1
- package/lib/src/work-order-modal/help-message.vue.d.ts +0 -3
- package/lib/src/work-order-modal/help-message.vue.js +0 -1
- package/lib/src/work-order-modal/help-message.vue2.js +0 -1
- package/lib/src/work-order-modal/index.d.ts +0 -4
- package/lib/src/work-order-modal/index.js +0 -1
- package/lib/src/work-order-modal/interfaces.d.ts +0 -31
- package/lib/src/work-order-modal/interfaces.js +0 -1
- package/lib/src/work-order-modal/style/css.cjs +0 -4
- package/lib/src/work-order-modal/style/index.cjs +0 -4
- package/lib/src/work-order-modal/work-order-modal.vue.d.ts +0 -846
- package/lib/src/work-order-modal/work-order-modal.vue.js +0 -1
- package/lib/src/work-order-modal/work-order-modal.vue2.js +0 -1
- /package/es/src/{work-order-modal → business/ag-grid-modal}/style/css.d.ts +0 -0
- /package/es/src/{work-order-modal → business/ag-grid-modal}/style/index.d.ts +0 -0
- /package/lib/src/{work-order-modal → business/ag-grid-modal}/style/css.d.ts +0 -0
- /package/lib/src/{work-order-modal → business/ag-grid-modal}/style/index.d.ts +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createVNode as r } from "vue";
|
|
2
|
+
import { ApModal as m } from "../../../ap-modal/index.mjs";
|
|
3
|
+
import "../../../ag-grid/index.mjs";
|
|
4
|
+
import { genRequest as d } from "../utils.mjs";
|
|
5
|
+
import { useAgGridInstance as l } from "./use-ag-grid-instance.mjs";
|
|
6
|
+
import { omit as c } from "lodash-unified";
|
|
7
|
+
import "../wrapper/index.vue.mjs";
|
|
8
|
+
import f from "../wrapper/index.vue2.mjs";
|
|
9
|
+
import u from "../../../ag-grid/index.vue.mjs";
|
|
10
|
+
function C(e) {
|
|
11
|
+
const [t, n] = l(), o = d(e.api, e.getRowKey, t.setDataSourceLength);
|
|
12
|
+
function a() {
|
|
13
|
+
m.createModal({
|
|
14
|
+
title: e.title,
|
|
15
|
+
width: e.width,
|
|
16
|
+
destroyOnClose: !0,
|
|
17
|
+
maskClosable: !1,
|
|
18
|
+
footer: null,
|
|
19
|
+
onCancel() {
|
|
20
|
+
t.setInstance(void 0), t.setDataSourceLength(0);
|
|
21
|
+
},
|
|
22
|
+
content: r(n, null, {
|
|
23
|
+
default: () => [r(f, {
|
|
24
|
+
rowHeight: e.rowHeight
|
|
25
|
+
}, {
|
|
26
|
+
default: () => [e.renderHeader?.(c(t, "setInstance")), r(u, {
|
|
27
|
+
ref: t.setInstance,
|
|
28
|
+
searchForm: {
|
|
29
|
+
sortable: !1,
|
|
30
|
+
resize: {
|
|
31
|
+
target: "form"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
rowKey: e.getRowKey,
|
|
35
|
+
request: o.request,
|
|
36
|
+
style: {
|
|
37
|
+
padding: "0px"
|
|
38
|
+
},
|
|
39
|
+
rowHeight: e.rowHeight,
|
|
40
|
+
columns: e.columns
|
|
41
|
+
}, e.gridSlots)]
|
|
42
|
+
})]
|
|
43
|
+
}),
|
|
44
|
+
...e.modalProps || {}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function i(s) {
|
|
48
|
+
o.setExtraParams(s?.extraParams), a();
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
open: i,
|
|
52
|
+
refresh: t.refresh,
|
|
53
|
+
getAgGridInstance: t.getInstance
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
C as useAgGridModal
|
|
58
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createVNode as r, onUnmounted as O } from "vue";
|
|
2
|
+
import { ApModal as _ } from "../../../ap-modal/index.mjs";
|
|
3
|
+
import "../../../ag-grid/index.mjs";
|
|
4
|
+
import { AsyncCallback as L, genRequest as P, delRowKeyField as H, getModalLayoutConfig as T, addRowKeyField as j } from "../utils.mjs";
|
|
5
|
+
import { useAgGridInstance as q } from "./use-ag-grid-instance.mjs";
|
|
6
|
+
import { isFunction as u, omit as h } from "lodash-unified";
|
|
7
|
+
import { ROW_KEY as v } from "../constants.mjs";
|
|
8
|
+
import { useModalTitle as F } from "./use-modal-title.mjs";
|
|
9
|
+
import { message as G } from "@aplus-frontend/antdv";
|
|
10
|
+
import "../../../config-provider/index.mjs";
|
|
11
|
+
import "../modal-layout/index.vue.mjs";
|
|
12
|
+
import "../wrapper/index.vue.mjs";
|
|
13
|
+
import { useLocale as D } from "../../../config-provider/hooks/use-locale.mjs";
|
|
14
|
+
import E from "../wrapper/index.vue2.mjs";
|
|
15
|
+
import U from "../modal-layout/index.vue2.mjs";
|
|
16
|
+
import W from "../../../ag-grid/index.vue.mjs";
|
|
17
|
+
function le(e) {
|
|
18
|
+
let i;
|
|
19
|
+
const c = new L(), [C, b] = F(), {
|
|
20
|
+
t: K
|
|
21
|
+
} = D(), [n, k] = q({
|
|
22
|
+
onSelectedRows(t) {
|
|
23
|
+
b.setCount(t?.length || 0);
|
|
24
|
+
}
|
|
25
|
+
}), f = P(e.api, e.getRowKey, n.setDataSourceLength), d = u(e.getRowKey) ? e.getRowKey : (t) => t[e.getRowKey], x = () => {
|
|
26
|
+
const t = e.mergeRule || "old", o = n.getSelectedRows() || [];
|
|
27
|
+
return {
|
|
28
|
+
keys: M(o),
|
|
29
|
+
rows: o.map((l) => {
|
|
30
|
+
const s = d(l);
|
|
31
|
+
return t === "old" && i?.[s] ? i[s] : H(l);
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
}, g = async () => {
|
|
35
|
+
const t = x(), o = e.maxCount || 1 / 0;
|
|
36
|
+
return t.keys.length > o ? (G.warning(K("ap.apTableModal.messageMaxCount", {
|
|
37
|
+
maxCount: o
|
|
38
|
+
})), Promise.reject()) : (await e.beforeOk?.(t), e.finishCallback?.(t), c.resolve(t), t);
|
|
39
|
+
}, S = () => {
|
|
40
|
+
c.reject("modal is closed!"), n.setInstance(void 0), n.setDataSourceLength(0);
|
|
41
|
+
}, w = T(e.modalLayout);
|
|
42
|
+
function y(t) {
|
|
43
|
+
const o = t?.map((a) => j(a, e.getRowKey));
|
|
44
|
+
return r(k, null, {
|
|
45
|
+
default: () => [r(E, {
|
|
46
|
+
rowHeight: e.rowHeight
|
|
47
|
+
}, {
|
|
48
|
+
default: () => [e.renderHeader?.(h(n, "setInstance")), r(U, w.props, {
|
|
49
|
+
default: () => [r(W, {
|
|
50
|
+
ref: n.setInstance,
|
|
51
|
+
searchForm: {
|
|
52
|
+
sortable: !1,
|
|
53
|
+
resize: {
|
|
54
|
+
target: "form"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
rowKey: u(e.getRowKey) ? v : e.getRowKey,
|
|
58
|
+
request: f.request,
|
|
59
|
+
style: {
|
|
60
|
+
padding: "0px"
|
|
61
|
+
},
|
|
62
|
+
rowHeight: e.rowHeight,
|
|
63
|
+
columns: e.columns,
|
|
64
|
+
rowSelection: {
|
|
65
|
+
defaultSelectedRows: o,
|
|
66
|
+
preserveSelectedRowKeys: !0,
|
|
67
|
+
type: e.mode || "checkbox",
|
|
68
|
+
fixed: "left",
|
|
69
|
+
columnWidth: 38,
|
|
70
|
+
disabled(a) {
|
|
71
|
+
return u(e.disabledCheckbox) ? e.disabledCheckbox(a, h(n, "setInstance")) : e.disabledCheckbox ?? !1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, e.gridSlots)],
|
|
75
|
+
...w.slots
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function I() {
|
|
81
|
+
const t = Object.values(i || {}), o = y(t);
|
|
82
|
+
_.createModal({
|
|
83
|
+
title: r(C, {
|
|
84
|
+
title: e.title,
|
|
85
|
+
maxCount: e.maxCount || 1 / 0
|
|
86
|
+
}, e.modalTitleSlots),
|
|
87
|
+
width: e.width,
|
|
88
|
+
destroyOnClose: !0,
|
|
89
|
+
maskClosable: !1,
|
|
90
|
+
onOk: g,
|
|
91
|
+
onCancel: S,
|
|
92
|
+
content: o,
|
|
93
|
+
...e.modalProps || {}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function M(t) {
|
|
97
|
+
return t?.map(d) || [];
|
|
98
|
+
}
|
|
99
|
+
function R(t, o, a = !1) {
|
|
100
|
+
if (i = t?.reduce((m, l) => {
|
|
101
|
+
const s = d(l);
|
|
102
|
+
return m[s] = l, m;
|
|
103
|
+
}, {}), f.setExtraParams(o?.extraParams), I(), a)
|
|
104
|
+
return c.buildPromise();
|
|
105
|
+
}
|
|
106
|
+
function A(t, o) {
|
|
107
|
+
return R(t, o, !0);
|
|
108
|
+
}
|
|
109
|
+
return O(() => {
|
|
110
|
+
c.reject("component is Unmounted!");
|
|
111
|
+
}), {
|
|
112
|
+
open: R,
|
|
113
|
+
asyncOpen: A,
|
|
114
|
+
refresh: n.refresh,
|
|
115
|
+
getAgGridInstance: n.getInstance,
|
|
116
|
+
genContent: y,
|
|
117
|
+
validate: g
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
le as useAgGridSelectModal
|
|
122
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
export declare function useModalTitle(): readonly [ DefineComponent<ExtractPropTypes<{
|
|
3
|
+
title: {
|
|
4
|
+
type: any;
|
|
5
|
+
default: null;
|
|
6
|
+
};
|
|
7
|
+
maxCount: {
|
|
8
|
+
type: NumberConstructor;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
12
|
+
title: {
|
|
13
|
+
type: any;
|
|
14
|
+
default: null;
|
|
15
|
+
};
|
|
16
|
+
maxCount: {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
|
+
title: any;
|
|
22
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
23
|
+
readonly setCount: (data: number) => void;
|
|
24
|
+
}];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ref as n, defineComponent as u, createVNode as a } from "vue";
|
|
2
|
+
import "../../../config-provider/index.mjs";
|
|
3
|
+
import { useLocale as i } from "../../../config-provider/hooks/use-locale.mjs";
|
|
4
|
+
function d() {
|
|
5
|
+
const e = n(0);
|
|
6
|
+
return [/* @__PURE__ */ u({
|
|
7
|
+
props: {
|
|
8
|
+
title: {
|
|
9
|
+
type: null,
|
|
10
|
+
default: null
|
|
11
|
+
},
|
|
12
|
+
maxCount: {
|
|
13
|
+
type: Number,
|
|
14
|
+
required: !0
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
setup(t, {
|
|
18
|
+
slots: l
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
t: o
|
|
22
|
+
} = i();
|
|
23
|
+
return () => a("div", null, [t.title, l.default ? l.default({
|
|
24
|
+
maxCount: t.maxCount,
|
|
25
|
+
count: e.value
|
|
26
|
+
}) : a("span", {
|
|
27
|
+
style: {
|
|
28
|
+
color: "var(--ap-text-color-3)",
|
|
29
|
+
fontSize: "12px",
|
|
30
|
+
fontWeight: "normal",
|
|
31
|
+
marginLeft: "12px"
|
|
32
|
+
}
|
|
33
|
+
}, [isFinite(t.maxCount) ? o("ap.apTableModal.titleSuffixOne", {
|
|
34
|
+
maxCount: t.maxCount
|
|
35
|
+
}) : "", o("ap.apTableModal.titleSuffixTwo"), a("span", {
|
|
36
|
+
style: {
|
|
37
|
+
color: "var(--ap-color-primary)"
|
|
38
|
+
}
|
|
39
|
+
}, [e.value]), o("ap.apTableModal.titleSuffixThree")])]);
|
|
40
|
+
}
|
|
41
|
+
}), {
|
|
42
|
+
setCount: (t) => {
|
|
43
|
+
e.value = t;
|
|
44
|
+
}
|
|
45
|
+
}];
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
d as useModalTitle
|
|
49
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { StyleValue, VNodeChild } from 'vue';
|
|
2
|
+
import { AgGridColumnType, AgGridExpose, AgGridProps, AgGridSlots } from '../../ag-grid';
|
|
3
|
+
import { CreateModalFuncProps } from '../../ap-modal';
|
|
4
|
+
import { Recordable } from '../../type';
|
|
5
|
+
import { GridApi } from './hooks/use-ag-grid-instance';
|
|
6
|
+
export type GetRowKey<TableRowType> = ((record: TableRowType) => string | number) | string;
|
|
7
|
+
/** AgGridModal 基础类型 */
|
|
8
|
+
export interface AgGridModalBasicProps<TableRowType = any> {
|
|
9
|
+
title: VNodeChild;
|
|
10
|
+
width?: string | number;
|
|
11
|
+
modalProps?: Omit<CreateModalFuncProps, 'content'>;
|
|
12
|
+
columns: AgGridColumnType[];
|
|
13
|
+
getRowKey: GetRowKey<TableRowType>;
|
|
14
|
+
api?: (params: any) => Promise<RequestReturn<TableRowType>>;
|
|
15
|
+
/** 渲染头部信息 */
|
|
16
|
+
renderHeader?: (gridApi: Omit<GridApi, 'setInstance'>) => VNodeChild;
|
|
17
|
+
rowHeight?: number;
|
|
18
|
+
}
|
|
19
|
+
/** 刷新方式 */
|
|
20
|
+
export type RefreshType = 'reset' | 'submit' | 'submitWith';
|
|
21
|
+
/** 只读模式 */
|
|
22
|
+
export interface AgGridPreviewModalProps<RowType = any> extends AgGridModalBasicProps<RowType> {
|
|
23
|
+
/** ag-grid 插槽 */
|
|
24
|
+
gridSlots?: AgGridSlots<RowType>;
|
|
25
|
+
}
|
|
26
|
+
/** 只读模式返回值 */
|
|
27
|
+
export interface PreviewModalReturnType {
|
|
28
|
+
/** 打开弹框 */
|
|
29
|
+
open(opt?: OpenOptions): void;
|
|
30
|
+
/** 刷新表格数据 */
|
|
31
|
+
refresh: (type: RefreshType) => void;
|
|
32
|
+
/** 获取ag-grid实例 */
|
|
33
|
+
getAgGridInstance: () => AgGridExpose | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface OpenOptions {
|
|
36
|
+
/** 发起网络请求携带的额外参数 */
|
|
37
|
+
extraParams?: Recordable;
|
|
38
|
+
}
|
|
39
|
+
/** 可选模式 */
|
|
40
|
+
export interface AgGridSelectModalProps<RowType = any> extends AgGridModalBasicProps<RowType> {
|
|
41
|
+
/** ag-grid 插槽 */
|
|
42
|
+
gridSlots?: AgGridSlots<RowType>;
|
|
43
|
+
/**
|
|
44
|
+
* 选择模式
|
|
45
|
+
* - radio: 单选模式
|
|
46
|
+
* - checkbox: 多选模式
|
|
47
|
+
* @default 'checkbox'
|
|
48
|
+
*/
|
|
49
|
+
mode?: 'radio' | 'checkbox';
|
|
50
|
+
/**
|
|
51
|
+
* 合并规则
|
|
52
|
+
* - old 老数据优先
|
|
53
|
+
* - new 新数据优先
|
|
54
|
+
* @default 'old'
|
|
55
|
+
*/
|
|
56
|
+
mergeRule?: 'old' | 'new';
|
|
57
|
+
/** 点击确认后执行的回调 */
|
|
58
|
+
finishCallback?: (data: OpenReturnType<RowType>) => void;
|
|
59
|
+
/** 最多选择多少条 */
|
|
60
|
+
maxCount?: number;
|
|
61
|
+
/** 禁用选项 */
|
|
62
|
+
disabledCheckbox?: boolean | ((record: RowType, actions: Omit<GridApi, 'setInstance'>) => boolean);
|
|
63
|
+
/** 额外的rowSelection配置 */
|
|
64
|
+
rowSelection?: Omit<AgGridProps['rowSelection'], 'disabled'>;
|
|
65
|
+
/** modal标题插槽 */
|
|
66
|
+
modalTitleSlots?: ModalTitleSlots;
|
|
67
|
+
/** 在finishCallback执行前执行,返回reject终止后续执行 */
|
|
68
|
+
beforeOk?: (data: OpenReturnType<RowType>) => Promise<any> | void;
|
|
69
|
+
/** 设置是否是复杂布局 */
|
|
70
|
+
modalLayout?: ModalLayoutConfig<RowType>;
|
|
71
|
+
}
|
|
72
|
+
export interface SelectModalReturnType<T = any> {
|
|
73
|
+
/** 打开弹框 */
|
|
74
|
+
open: (selectRows?: T[], options?: OpenOptions, isAsync?: boolean) => Promise<OpenReturnType<T>> | undefined;
|
|
75
|
+
/** 异步打开弹框 */
|
|
76
|
+
asyncOpen: (selectRows?: T[], options?: OpenOptions) => Promise<OpenReturnType<T>>;
|
|
77
|
+
/** 刷新表格数据 */
|
|
78
|
+
refresh: (type?: RefreshType) => void;
|
|
79
|
+
/** 获取表格实例 */
|
|
80
|
+
getAgGridInstance: () => AgGridExpose | undefined;
|
|
81
|
+
/** 获取原子化内容 */
|
|
82
|
+
genContent: (selectedRows?: T[]) => VNodeChild;
|
|
83
|
+
/** 获取数据并校验 */
|
|
84
|
+
validate: () => Promise<OpenReturnType<T>>;
|
|
85
|
+
}
|
|
86
|
+
export interface RequestReturn<T = any> {
|
|
87
|
+
records: T[];
|
|
88
|
+
total: number;
|
|
89
|
+
}
|
|
90
|
+
/** open打开方法返回的值的类型 */
|
|
91
|
+
export interface OpenReturnType<RowType> {
|
|
92
|
+
keys: (string | number)[];
|
|
93
|
+
rows: RowType[];
|
|
94
|
+
}
|
|
95
|
+
/** modal-title slots */
|
|
96
|
+
export interface ModalTitleSlots {
|
|
97
|
+
/** 标题 suffix 插槽 */
|
|
98
|
+
default: (props: {
|
|
99
|
+
maxCount: number;
|
|
100
|
+
count: number;
|
|
101
|
+
}) => VNodeChild;
|
|
102
|
+
}
|
|
103
|
+
/** 弹框布局props */
|
|
104
|
+
export interface ModalLayoutProps {
|
|
105
|
+
/** 左侧标题 */
|
|
106
|
+
leftTitle?: string | VNodeChild;
|
|
107
|
+
/** 右侧内容样式 */
|
|
108
|
+
rightContentStyle?: StyleValue;
|
|
109
|
+
/** 中间分割线向上偏移量 */
|
|
110
|
+
dividerOffset?: number;
|
|
111
|
+
}
|
|
112
|
+
/** modal-layout配置 */
|
|
113
|
+
export interface ModalLayoutConfig<T = any> extends ModalLayoutProps {
|
|
114
|
+
/** 右侧标题插槽 */
|
|
115
|
+
rightTitle?: (selectedCount: number) => any;
|
|
116
|
+
/** 右侧底部插槽 */
|
|
117
|
+
rightBottom?: (props: {
|
|
118
|
+
records: T[];
|
|
119
|
+
actions: {
|
|
120
|
+
deleteItem: (record: T) => void;
|
|
121
|
+
};
|
|
122
|
+
}) => any;
|
|
123
|
+
/** 已经选择item渲染, 选择项渲染插槽 */
|
|
124
|
+
renderSelectedItem: (props: {
|
|
125
|
+
record: T;
|
|
126
|
+
actions: {
|
|
127
|
+
deleteItem: (record: T) => void;
|
|
128
|
+
};
|
|
129
|
+
}) => any;
|
|
130
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ModalLayoutProps } from '../interface';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, VNodeArrayChildren, VNode, RendererNode, RendererElement, ComponentProvideOptions } from 'vue';
|
|
3
|
+
type __VLS_Props = ModalLayoutProps & {
|
|
4
|
+
layoutType?: 'two-column';
|
|
5
|
+
};
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
default?(_: {}): any;
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
rightTitle?(_: {
|
|
12
|
+
count: number;
|
|
13
|
+
}): any;
|
|
14
|
+
renderSelectedItem?(_: {
|
|
15
|
+
record: any;
|
|
16
|
+
actions: {
|
|
17
|
+
deleteItem: (record: any) => void;
|
|
18
|
+
};
|
|
19
|
+
}): any;
|
|
20
|
+
rightBottom?(_: {
|
|
21
|
+
records: any[];
|
|
22
|
+
actions: {
|
|
23
|
+
deleteItem: (record: any) => void;
|
|
24
|
+
};
|
|
25
|
+
}): any;
|
|
26
|
+
};
|
|
27
|
+
refs: {};
|
|
28
|
+
rootEl: any;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
31
|
+
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
32
|
+
leftTitle: string | number | boolean | void | VNodeArrayChildren | VNode<RendererNode, RendererElement, {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}> | null;
|
|
35
|
+
layoutType: "two-column";
|
|
36
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent as B, computed as N, createElementBlock as y, renderSlot as r, openBlock as a, normalizeStyle as g, normalizeClass as n, unref as e, createElementVNode as i, createBlock as c, createCommentVNode as v, withCtx as s, resolveDynamicComponent as O, h as x, Fragment as h, createVNode as b, createTextVNode as S, toDisplayString as T, renderList as I } from "vue";
|
|
2
|
+
import "../../../config-provider/index.mjs";
|
|
3
|
+
import { ApTitle as k } from "../../ap-title/index.mjs";
|
|
4
|
+
import { Button as M, Empty as C } from "@aplus-frontend/antdv";
|
|
5
|
+
import { useAgGridModalInject as V } from "../hooks/use-ag-grid-instance.mjs";
|
|
6
|
+
import { useLocale as w } from "../../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
import { useNamespace as L } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
+
const q = /* @__PURE__ */ B({
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
leftTitle: { type: [String, Object, Number, Boolean, null, Array], default: "" },
|
|
12
|
+
rightContentStyle: { type: [Boolean, null, String, Object, Array] },
|
|
13
|
+
dividerOffset: {},
|
|
14
|
+
layoutType: { default: void 0 }
|
|
15
|
+
},
|
|
16
|
+
setup(E) {
|
|
17
|
+
const { t: p } = w(), d = V(), l = N(() => d?.selectedRows?.value || []), u = E, $ = () => {
|
|
18
|
+
if (console.log("props.dividerOffset", u), u.dividerOffset != null)
|
|
19
|
+
return {
|
|
20
|
+
"--ag-grid-modal-layout-divider-offset": `${u.dividerOffset}px`
|
|
21
|
+
};
|
|
22
|
+
}, A = () => {
|
|
23
|
+
d?.clearAllSelected();
|
|
24
|
+
}, m = (t) => {
|
|
25
|
+
d?.removeSelected(t);
|
|
26
|
+
}, { m: o } = L("ag-grid-modal");
|
|
27
|
+
return (t, j) => t.layoutType === "two-column" ? (a(), y("div", {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: n(e(o)("table-layout")),
|
|
30
|
+
style: g($())
|
|
31
|
+
}, [
|
|
32
|
+
i("div", {
|
|
33
|
+
class: n(e(o)("table-layout-left"))
|
|
34
|
+
}, [
|
|
35
|
+
t.leftTitle ? (a(), c(e(k), {
|
|
36
|
+
key: 0,
|
|
37
|
+
style: { "margin-bottom": "16px" }
|
|
38
|
+
}, {
|
|
39
|
+
prefix: s(() => [
|
|
40
|
+
(a(), c(O(x(h, [t.leftTitle]))))
|
|
41
|
+
]),
|
|
42
|
+
_: 1
|
|
43
|
+
})) : v("", !0),
|
|
44
|
+
i("div", {
|
|
45
|
+
class: n(e(o)("table-layout-left-content"))
|
|
46
|
+
}, [
|
|
47
|
+
r(t.$slots, "default")
|
|
48
|
+
], 2)
|
|
49
|
+
], 2),
|
|
50
|
+
i("div", {
|
|
51
|
+
class: n(e(o)("table-layout-right")),
|
|
52
|
+
style: g(t.rightContentStyle)
|
|
53
|
+
}, [
|
|
54
|
+
b(e(k), null, {
|
|
55
|
+
prefix: s(() => [
|
|
56
|
+
r(t.$slots, "rightTitle", {
|
|
57
|
+
count: l.value.length
|
|
58
|
+
}, () => [
|
|
59
|
+
S(T(`${e(p)("ap.apTableModal.selected")} (${l.value.length})`), 1)
|
|
60
|
+
])
|
|
61
|
+
]),
|
|
62
|
+
suffix: s(() => [
|
|
63
|
+
b(e(M), {
|
|
64
|
+
type: "link",
|
|
65
|
+
style: { padding: "0px", height: "22px", "border-width": "0px" },
|
|
66
|
+
onClick: A
|
|
67
|
+
}, {
|
|
68
|
+
default: s(() => [
|
|
69
|
+
S(T(e(p)("ap.apTableModal.clear")), 1)
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
})
|
|
73
|
+
]),
|
|
74
|
+
_: 3
|
|
75
|
+
}),
|
|
76
|
+
i("div", {
|
|
77
|
+
class: n(e(o)("table-layout-right-content"))
|
|
78
|
+
}, [
|
|
79
|
+
(a(!0), y(h, null, I(l.value, (f) => r(t.$slots, "renderSelectedItem", {
|
|
80
|
+
key: f,
|
|
81
|
+
record: f,
|
|
82
|
+
actions: { deleteItem: m }
|
|
83
|
+
})), 128)),
|
|
84
|
+
l.value.length === 0 ? (a(), c(e(C), {
|
|
85
|
+
key: 0,
|
|
86
|
+
image: e(C).PRESENTED_IMAGE_SIMPLE,
|
|
87
|
+
style: { "margin-top": "100px" }
|
|
88
|
+
}, null, 8, ["image"])) : v("", !0)
|
|
89
|
+
], 2),
|
|
90
|
+
i("div", null, [
|
|
91
|
+
r(t.$slots, "rightBottom", {
|
|
92
|
+
records: l.value,
|
|
93
|
+
actions: { deleteItem: m }
|
|
94
|
+
})
|
|
95
|
+
])
|
|
96
|
+
], 6)
|
|
97
|
+
], 6)) : r(t.$slots, "default", { key: 1 });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
export {
|
|
101
|
+
q as default
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/ag-grid-modal/index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/ag-grid-modal/index.less';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Recordable } from '../../type';
|
|
2
|
+
import { GetRowKey, ModalLayoutConfig, RequestReturn } from './interface';
|
|
3
|
+
import { VNodeChild, StyleValue } from 'vue';
|
|
4
|
+
export declare function genRequest(api: ((params: any) => Promise<RequestReturn<any>>) | undefined, gerRowKey: GetRowKey<any>, callback?: (length: number) => void): {
|
|
5
|
+
request: (params: any) => Promise<{
|
|
6
|
+
data: any[];
|
|
7
|
+
total: number;
|
|
8
|
+
}>;
|
|
9
|
+
setExtraParams: (params?: Recordable) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function addRowKeyField(row: any, gerRowKey: GetRowKey<any>): any;
|
|
12
|
+
export declare function delRowKeyField(row: any): any;
|
|
13
|
+
/** 解析props */
|
|
14
|
+
export declare function getModalLayoutConfig(props?: ModalLayoutConfig): {
|
|
15
|
+
props: {
|
|
16
|
+
readonly layoutType: "two-column" | undefined;
|
|
17
|
+
readonly leftTitle?: string | VNodeChild;
|
|
18
|
+
readonly rightContentStyle?: StyleValue;
|
|
19
|
+
readonly dividerOffset?: number;
|
|
20
|
+
};
|
|
21
|
+
slots: {
|
|
22
|
+
renderSelectedItem: ((props: {
|
|
23
|
+
record: any;
|
|
24
|
+
actions: {
|
|
25
|
+
deleteItem: (record: any) => void;
|
|
26
|
+
};
|
|
27
|
+
}) => any) | undefined;
|
|
28
|
+
rightTitle: ((selectedCount: number) => any) | undefined;
|
|
29
|
+
rightBottom: ((props: {
|
|
30
|
+
records: any[];
|
|
31
|
+
actions: {
|
|
32
|
+
deleteItem: (record: any) => void;
|
|
33
|
+
};
|
|
34
|
+
}) => any) | undefined;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* 异步回调
|
|
39
|
+
* buildPromise 构建异步回调
|
|
40
|
+
* resolve reject 兑现或拒绝回调
|
|
41
|
+
*/
|
|
42
|
+
export declare class AsyncCallback<T = any> {
|
|
43
|
+
private p;
|
|
44
|
+
private operateFn;
|
|
45
|
+
constructor();
|
|
46
|
+
buildPromise(): Promise<T>;
|
|
47
|
+
clear(): void;
|
|
48
|
+
/** 兑现回调 */
|
|
49
|
+
resolve(data: T): void;
|
|
50
|
+
/** 拒绝回调 */
|
|
51
|
+
reject(error?: string): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ROW_KEY as a } from "./constants.mjs";
|
|
2
|
+
import { isFunction as p } from "lodash-unified";
|
|
3
|
+
function m(t, e, r) {
|
|
4
|
+
let n = null;
|
|
5
|
+
return { request: async (s) => {
|
|
6
|
+
const i = t;
|
|
7
|
+
if (!i)
|
|
8
|
+
return r?.(0), {
|
|
9
|
+
data: [],
|
|
10
|
+
total: 0
|
|
11
|
+
};
|
|
12
|
+
n && (s = Object.assign(s, n));
|
|
13
|
+
const { records: l, total: u } = await i(Object.assign({}, s));
|
|
14
|
+
return r?.(l.length || 0), {
|
|
15
|
+
data: l.map((c) => h(c, e)),
|
|
16
|
+
total: u
|
|
17
|
+
};
|
|
18
|
+
}, setExtraParams: (s) => {
|
|
19
|
+
n = s || null;
|
|
20
|
+
} };
|
|
21
|
+
}
|
|
22
|
+
function h(t, e) {
|
|
23
|
+
return p(e) ? {
|
|
24
|
+
...t,
|
|
25
|
+
[a]: e(t)
|
|
26
|
+
} : t;
|
|
27
|
+
}
|
|
28
|
+
function g(t) {
|
|
29
|
+
return Reflect.deleteProperty(t, a), t;
|
|
30
|
+
}
|
|
31
|
+
function y(t) {
|
|
32
|
+
const { renderSelectedItem: e, rightTitle: r, rightBottom: n, ...o } = t || {};
|
|
33
|
+
return console.log("props", o), {
|
|
34
|
+
props: { ...o, layoutType: t && "two-column" },
|
|
35
|
+
slots: {
|
|
36
|
+
renderSelectedItem: e,
|
|
37
|
+
rightTitle: r,
|
|
38
|
+
rightBottom: n
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
class P {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.p = null, this.operateFn = null;
|
|
45
|
+
}
|
|
46
|
+
buildPromise() {
|
|
47
|
+
return this.operateFn && this.operateFn.reject("reuse"), this.p = new Promise((e, r) => {
|
|
48
|
+
this.operateFn = {
|
|
49
|
+
reject: r,
|
|
50
|
+
resolve: e
|
|
51
|
+
};
|
|
52
|
+
}), this.p;
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
this.p = null, this.operateFn = null;
|
|
56
|
+
}
|
|
57
|
+
/** 兑现回调 */
|
|
58
|
+
resolve(e) {
|
|
59
|
+
this.operateFn && (this.operateFn.resolve(e), this.clear());
|
|
60
|
+
}
|
|
61
|
+
/** 拒绝回调 */
|
|
62
|
+
reject(e) {
|
|
63
|
+
this.operateFn && (this.operateFn.reject(e), this.clear());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
P as AsyncCallback,
|
|
68
|
+
h as addRowKeyField,
|
|
69
|
+
g as delRowKeyField,
|
|
70
|
+
m as genRequest,
|
|
71
|
+
y as getModalLayoutConfig
|
|
72
|
+
};
|