@aplus-frontend/ui 6.42.0 → 6.42.1
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/hooks/use-columns-def.mjs +53 -53
- package/es/src/ap-modal/interface.d.ts +31 -11
- package/es/src/ap-modal/utils/createModal.mjs +52 -45
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
- package/lib/src/ap-modal/interface.d.ts +31 -11
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getTableRenderProps as
|
|
2
|
-
import { rendererMap as
|
|
3
|
-
import { isNumber as
|
|
4
|
-
import { ref as P, unref as
|
|
1
|
+
import { getTableRenderProps as c, objectToString as D } from "../../ap-table/utils.mjs";
|
|
2
|
+
import { rendererMap as x } from "../renderer/index.mjs";
|
|
3
|
+
import { isNumber as u, isFunction as m } from "lodash-unified";
|
|
4
|
+
import { ref as P, unref as v, computed as y } from "vue";
|
|
5
5
|
import "../components/body-cell/index.vue.mjs";
|
|
6
6
|
import "../components/header-cell/index.vue.mjs";
|
|
7
7
|
import "../components/tooltip/index.vue.mjs";
|
|
@@ -12,24 +12,24 @@ import { useGlobalConfig as _ } from "../../config-provider/hooks/use-global-con
|
|
|
12
12
|
import { useNamespace as G } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
13
|
import W from "../components/body-cell/index.vue2.mjs";
|
|
14
14
|
import z from "../components/tooltip/index.vue2.mjs";
|
|
15
|
-
import
|
|
15
|
+
import h from "../components/header-cell/index.vue2.mjs";
|
|
16
16
|
function F(t) {
|
|
17
|
-
return
|
|
17
|
+
return u(t) && t > 1;
|
|
18
18
|
}
|
|
19
|
-
function M(t,
|
|
20
|
-
if (
|
|
21
|
-
return m(
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
19
|
+
function M(t, a) {
|
|
20
|
+
if (a.bodyCellTooltip)
|
|
21
|
+
return m(a.bodyCellTooltip) ? a.bodyCellTooltip(t.value, t.data) : a.bodyCellTooltip;
|
|
22
|
+
if (a.renderText)
|
|
23
|
+
return a.renderText({
|
|
24
24
|
value: t.value,
|
|
25
25
|
record: t.data,
|
|
26
|
-
column:
|
|
26
|
+
column: a,
|
|
27
27
|
text: t.value
|
|
28
28
|
});
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
{ ...
|
|
29
|
+
const d = a.valueType || "text", p = x[d];
|
|
30
|
+
if (p) {
|
|
31
|
+
const f = c(
|
|
32
|
+
{ ...a, valueType: d },
|
|
33
33
|
{
|
|
34
34
|
value: t.value,
|
|
35
35
|
text: t.value,
|
|
@@ -39,22 +39,22 @@ function M(t, i) {
|
|
|
39
39
|
pinned: t.node?.rowPinned
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
return
|
|
42
|
+
return p(f);
|
|
43
43
|
}
|
|
44
44
|
return D(t.value);
|
|
45
45
|
}
|
|
46
|
-
const X = (t,
|
|
47
|
-
const
|
|
48
|
-
const
|
|
46
|
+
const X = (t, a, d) => {
|
|
47
|
+
const p = _("valueTypeMap"), C = P(), { em: f } = G("ag-grid"), b = (r) => {
|
|
48
|
+
const i = {
|
|
49
49
|
cellRenderer: W,
|
|
50
50
|
cellRendererParams: {
|
|
51
51
|
column: r,
|
|
52
|
-
extraValueType:
|
|
53
|
-
rowKey:
|
|
52
|
+
extraValueType: v(p),
|
|
53
|
+
rowKey: a.rowKey
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
if (r.customRender)
|
|
57
|
-
return
|
|
57
|
+
return i;
|
|
58
58
|
if (r.renderText)
|
|
59
59
|
return {
|
|
60
60
|
valueFormatter: (o) => r.renderText({
|
|
@@ -64,10 +64,10 @@ const X = (t, i, n) => {
|
|
|
64
64
|
text: o.value
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
|
-
const s = r.valueType || "text", e =
|
|
67
|
+
const s = r.valueType || "text", e = x[s];
|
|
68
68
|
return e ? {
|
|
69
69
|
valueFormatter: (o) => {
|
|
70
|
-
const l =
|
|
70
|
+
const l = c(
|
|
71
71
|
{ ...r, valueType: s },
|
|
72
72
|
{
|
|
73
73
|
value: o.value,
|
|
@@ -80,18 +80,18 @@ const X = (t, i, n) => {
|
|
|
80
80
|
);
|
|
81
81
|
return e(l);
|
|
82
82
|
}
|
|
83
|
-
} :
|
|
84
|
-
},
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
"--ag-grid-line-clamp":
|
|
88
|
-
},
|
|
89
|
-
lineClamp:
|
|
90
|
-
gridWrapperRef:
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
const r =
|
|
94
|
-
function
|
|
83
|
+
} : i;
|
|
84
|
+
}, w = (r) => {
|
|
85
|
+
const i = r.valueType || "text", s = x[i], e = {}, o = r.bodyCellTooltip || !r.customRender && s && (r.ellipsis === !0 || r.ellipsis === "tooltip" || u(r.ellipsis)), l = u(r.ellipsis) && r.ellipsis > 1, n = u(r.ellipsis) ? r.ellipsis : 1;
|
|
86
|
+
return e.tooltipValueGetter = o ? (T) => M(T, r) : void 0, e.wrapText = !r.ellipsis || l, e.cellStyle = {
|
|
87
|
+
"--ag-grid-line-clamp": n
|
|
88
|
+
}, e.tooltipComponent = z, e.tooltipComponentParams = {
|
|
89
|
+
lineClamp: n,
|
|
90
|
+
gridWrapperRef: C
|
|
91
|
+
}, e;
|
|
92
|
+
}, g = y(() => {
|
|
93
|
+
const r = v(t);
|
|
94
|
+
function i(s) {
|
|
95
95
|
return s.map((e) => {
|
|
96
96
|
const o = {
|
|
97
97
|
field: S(e.dataIndex),
|
|
@@ -111,44 +111,44 @@ const X = (t, i, n) => {
|
|
|
111
111
|
// undefined to null
|
|
112
112
|
colSpan: e.colSpan,
|
|
113
113
|
spanRows: e.spanRows,
|
|
114
|
-
cellClass:
|
|
115
|
-
const
|
|
114
|
+
cellClass: d((l) => {
|
|
115
|
+
const n = e.cellClass || "", T = m(n) ? n(l.data, l.node) : n;
|
|
116
116
|
return [
|
|
117
|
-
`${
|
|
118
|
-
F(e.ellipsis) ?
|
|
119
|
-
|
|
117
|
+
`${f("cell", e.align || "left")}`,
|
|
118
|
+
F(e.ellipsis) ? f("cell", "multiline") : null,
|
|
119
|
+
T
|
|
120
120
|
].flat().filter(Boolean);
|
|
121
121
|
}),
|
|
122
122
|
headerStyle: e.headerStyle,
|
|
123
123
|
headerClass: e.headerClass,
|
|
124
124
|
autoHeight: !0,
|
|
125
125
|
// 设置自动计算高度以自适应多行换行的场景
|
|
126
|
-
...
|
|
127
|
-
...
|
|
126
|
+
...w(e),
|
|
127
|
+
...b(e)
|
|
128
128
|
};
|
|
129
129
|
return e.children?.length ? {
|
|
130
130
|
...o,
|
|
131
|
-
headerGroupComponent:
|
|
131
|
+
headerGroupComponent: h,
|
|
132
132
|
headerGroupComponentParams: {
|
|
133
133
|
column: e
|
|
134
134
|
},
|
|
135
|
-
children:
|
|
135
|
+
children: i(e.children)
|
|
136
136
|
} : o;
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
return
|
|
140
|
-
}),
|
|
139
|
+
return i(r);
|
|
140
|
+
}), R = y(
|
|
141
141
|
() => ({
|
|
142
|
-
headerComponent:
|
|
143
|
-
resizable:
|
|
142
|
+
headerComponent: h,
|
|
143
|
+
resizable: a.columnResizable,
|
|
144
144
|
suppressMovable: !0,
|
|
145
145
|
cellDataType: !1
|
|
146
146
|
})
|
|
147
147
|
);
|
|
148
148
|
return {
|
|
149
|
-
columnDefs:
|
|
150
|
-
defaultColDef:
|
|
151
|
-
gridWrapperRef:
|
|
149
|
+
columnDefs: g,
|
|
150
|
+
defaultColDef: R,
|
|
151
|
+
gridWrapperRef: C
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
export {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ModalProps, ModalFuncProps } from '@aplus-frontend/antdv';
|
|
2
2
|
import { ModalFunc, ModalStaticFunctions } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
3
|
-
import { AppContext } from 'vue';
|
|
4
|
-
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon'> & Partial<{
|
|
3
|
+
import { AppContext, VNodeChild } from 'vue';
|
|
4
|
+
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon' | 'footer'> & Partial<{
|
|
5
5
|
/**
|
|
6
6
|
* 点击取消回调
|
|
7
7
|
* @param params content组件内使用defineExpose导出的对象
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
onCancel: (
|
|
10
|
+
onCancel: (contentExposed: ContentRecord) => any | Promise<any>;
|
|
11
11
|
/**
|
|
12
12
|
* 点击确定回调
|
|
13
13
|
* @param params content组件内使用defineExpose导出的对象
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
onOk: (
|
|
16
|
+
onOk: (contentExposed: ContentRecord) => any | Promise<any>;
|
|
17
17
|
/**
|
|
18
18
|
* 指定弹框挂载的 HTML 节点
|
|
19
19
|
*/
|
|
@@ -34,8 +34,28 @@ export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open'
|
|
|
34
34
|
* 弹窗的上下文,一般用于获取全局注册组件、vuex 等内容
|
|
35
35
|
*/
|
|
36
36
|
appContext: AppContext;
|
|
37
|
+
/**
|
|
38
|
+
* 底部内容,当不需要默认底部按钮时,可以设为 :footer="null"
|
|
39
|
+
*/
|
|
40
|
+
footer: ((params: {
|
|
41
|
+
/**
|
|
42
|
+
* 原始的底部内容
|
|
43
|
+
*/
|
|
44
|
+
originNode: VNodeChild;
|
|
45
|
+
/**
|
|
46
|
+
* 底部按钮
|
|
47
|
+
*/
|
|
48
|
+
extra: {
|
|
49
|
+
okBtn: VNodeChild;
|
|
50
|
+
cancelBtn: VNodeChild;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* content组件内使用defineExpose导出的对象
|
|
54
|
+
*/
|
|
55
|
+
contentExposed: ContentRecord;
|
|
56
|
+
}) => VNodeChild) | VNodeChild;
|
|
37
57
|
}>;
|
|
38
|
-
export type CreateModalFuncReturn = {
|
|
58
|
+
export type CreateModalFuncReturn<ContentRecord = any> = {
|
|
39
59
|
/**
|
|
40
60
|
* 销毁弹框
|
|
41
61
|
* @returns
|
|
@@ -46,7 +66,7 @@ export type CreateModalFuncReturn = {
|
|
|
46
66
|
* @param newConfig
|
|
47
67
|
* @returns
|
|
48
68
|
*/
|
|
49
|
-
update: (newConfig: CreateModalFuncProps) => void;
|
|
69
|
+
update: (newConfig: CreateModalFuncProps<ContentRecord>) => void;
|
|
50
70
|
/**
|
|
51
71
|
* 打开弹框
|
|
52
72
|
* @returns
|
|
@@ -58,7 +78,7 @@ export type CreateModalFuncReturn = {
|
|
|
58
78
|
*/
|
|
59
79
|
close: () => void;
|
|
60
80
|
};
|
|
61
|
-
export type CreateModalFunc = (props: CreateModalFuncProps) => CreateModalFuncReturn
|
|
81
|
+
export type CreateModalFunc = <ContentRecord = any>(props: CreateModalFuncProps<ContentRecord>) => CreateModalFuncReturn<ContentRecord>;
|
|
62
82
|
export type ModalStreamNextFunc<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = (option?: {
|
|
63
83
|
/**
|
|
64
84
|
* 下一步弹框的id
|
|
@@ -121,18 +141,18 @@ export type ModalFuncStream<ModalType extends ModalStreamTypeKey = ModalStreamTy
|
|
|
121
141
|
export type CreateModalStream<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = Omit<CreateModalFuncProps, 'destroyOnClose' | 'onOk' | 'onCancel'> & {
|
|
122
142
|
/**
|
|
123
143
|
* 点击确定回调
|
|
124
|
-
* * @param
|
|
144
|
+
* * @param contentExposed content组件内使用defineExpose导出的对象
|
|
125
145
|
* @param next 下一步
|
|
126
146
|
* @returns
|
|
127
147
|
*/
|
|
128
|
-
onOk?: (
|
|
148
|
+
onOk?: (contentExposed: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
|
|
129
149
|
/**
|
|
130
150
|
* 点击取消回调
|
|
131
|
-
* * @param
|
|
151
|
+
* * @param contentExposed content组件内使用defineExpose导出的对象
|
|
132
152
|
* @param next 下一步
|
|
133
153
|
* @returns
|
|
134
154
|
*/
|
|
135
|
-
onCancel?: (
|
|
155
|
+
onCancel?: (contentExposed: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
|
|
136
156
|
};
|
|
137
157
|
export type ModalStreamTypeKey = keyof ModalStreamType;
|
|
138
158
|
export type CreateModalStreamProps<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = ModalType extends ModalStreamTypeKey ? {
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { render as
|
|
1
|
+
import { render as f, defineComponent as b, createVNode as l, mergeProps as k, h as w } from "vue";
|
|
2
2
|
import { Modal as P } from "@aplus-frontend/antdv";
|
|
3
|
-
import { ConfigProvider as N, globalConfigCached as
|
|
4
|
-
import { omit as
|
|
5
|
-
import { isNumeric as
|
|
3
|
+
import { ConfigProvider as N, globalConfigCached as m } from "../../config-provider/config-provider.mjs";
|
|
4
|
+
import { omit as E } from "lodash-unified";
|
|
5
|
+
import { isNumeric as L } from "@aplus-frontend/utils";
|
|
6
6
|
import "../../config-provider/index.mjs";
|
|
7
|
-
import { getContainerDom as u, getModalGlobalAppContext as
|
|
8
|
-
import { getTopWindow as
|
|
9
|
-
import { useNamespace as
|
|
10
|
-
const
|
|
11
|
-
let
|
|
7
|
+
import { getContainerDom as u, getModalGlobalAppContext as M } from "./util.mjs";
|
|
8
|
+
import { getTopWindow as A } from "../../utils/index.mjs";
|
|
9
|
+
import { useNamespace as F } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
const q = (o) => {
|
|
11
|
+
let t, n;
|
|
12
12
|
const {
|
|
13
|
-
destroyOnClose:
|
|
14
|
-
wrapperOffset:
|
|
15
|
-
} =
|
|
16
|
-
b:
|
|
17
|
-
} =
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
destroyOnClose: i = !0,
|
|
14
|
+
wrapperOffset: r = !1
|
|
15
|
+
} = o, {
|
|
16
|
+
b: p
|
|
17
|
+
} = F("ap-modal");
|
|
18
|
+
function s() {
|
|
19
|
+
t && t(!1), setTimeout(() => {
|
|
20
|
+
f(null, a), a.parentElement?.removeChild(a);
|
|
21
21
|
}, 500);
|
|
22
22
|
}
|
|
23
23
|
function h() {
|
|
24
|
-
|
|
24
|
+
t && t(!0);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
function d() {
|
|
27
|
+
t && t(!1);
|
|
28
28
|
}
|
|
29
29
|
function C(e) {
|
|
30
|
-
|
|
30
|
+
n && n(e);
|
|
31
31
|
}
|
|
32
32
|
const g = /* @__PURE__ */ b({
|
|
33
33
|
data() {
|
|
34
34
|
return {
|
|
35
|
-
open:
|
|
36
|
-
props:
|
|
35
|
+
open: i,
|
|
36
|
+
props: o
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
39
|
created() {
|
|
40
|
-
|
|
40
|
+
t = (e) => {
|
|
41
41
|
this.open = e;
|
|
42
|
-
},
|
|
42
|
+
}, n = (e) => {
|
|
43
43
|
this.props = {
|
|
44
44
|
...this.props,
|
|
45
45
|
...e
|
|
@@ -52,61 +52,68 @@ const z = (p) => {
|
|
|
52
52
|
const e = this.props?.content?.component?.exposed ?? void 0;
|
|
53
53
|
await this.props?.onCancel(e);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
i ? s() : d();
|
|
56
56
|
},
|
|
57
57
|
async handleOk() {
|
|
58
58
|
try {
|
|
59
|
-
if (
|
|
59
|
+
if (n({
|
|
60
60
|
confirmLoading: !0
|
|
61
61
|
}), this.props?.onOk) {
|
|
62
62
|
const e = this.props?.content?.component?.exposed ?? void 0;
|
|
63
63
|
await this.props.onOk(e);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
n({
|
|
66
66
|
confirmLoading: !1
|
|
67
|
-
}),
|
|
67
|
+
}), i ? s() : d();
|
|
68
68
|
} catch {
|
|
69
|
-
|
|
69
|
+
n({
|
|
70
70
|
confirmLoading: !1
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
},
|
|
74
|
+
handleFooter(e) {
|
|
75
|
+
return o?.footer !== void 0 ? typeof o.footer == "function" ? o.footer({
|
|
76
|
+
...e,
|
|
77
|
+
contentExposed: this.props?.content?.component?.exposed ?? void 0
|
|
78
|
+
}) : o.footer : e?.originNode;
|
|
73
79
|
}
|
|
74
80
|
},
|
|
75
81
|
render() {
|
|
76
|
-
const e =
|
|
77
|
-
return l(N,
|
|
82
|
+
const e = E(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon", "footer"]);
|
|
83
|
+
return l(N, m.value, {
|
|
78
84
|
default: () => [l(P, k({
|
|
79
85
|
class: {
|
|
80
|
-
[
|
|
81
|
-
[
|
|
86
|
+
[p()]: !0,
|
|
87
|
+
[p("wrapper")]: r
|
|
82
88
|
},
|
|
83
89
|
centered: !0
|
|
84
90
|
}, e, {
|
|
85
91
|
open: this.open,
|
|
86
92
|
onCancel: this.handleCancel,
|
|
87
|
-
onOk: this.handleOk
|
|
93
|
+
onOk: this.handleOk,
|
|
94
|
+
footer: this?.handleFooter
|
|
88
95
|
}), {
|
|
89
96
|
default: () => [l("div", {
|
|
90
97
|
class: {
|
|
91
|
-
[
|
|
98
|
+
[p("body-wrapper")]: r
|
|
92
99
|
},
|
|
93
|
-
style:
|
|
94
|
-
maxHeight: `calc(100vh - ${(
|
|
100
|
+
style: r === !1 ? {} : {
|
|
101
|
+
maxHeight: `calc(100vh - ${(r === !0 ? 100 : L(r) ? Number(r) : 100) * 2}px)`
|
|
95
102
|
}
|
|
96
103
|
}, [this.props?.content])]
|
|
97
104
|
})]
|
|
98
105
|
});
|
|
99
106
|
}
|
|
100
|
-
}), x = u(
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
destroy:
|
|
107
|
+
}), x = u(m?.value?.getPopupContainer), v = u(o.getContainer), y = x || v || A().document.body, a = document.createElement("div");
|
|
108
|
+
y.appendChild(a);
|
|
109
|
+
const c = w(g), O = M();
|
|
110
|
+
return c.appContext = o.appContext || O || c.appContext, f(c, a), {
|
|
111
|
+
destroy: s,
|
|
105
112
|
update: C,
|
|
106
113
|
open: h,
|
|
107
|
-
close:
|
|
114
|
+
close: d
|
|
108
115
|
};
|
|
109
116
|
};
|
|
110
117
|
export {
|
|
111
|
-
|
|
118
|
+
q as createModal
|
|
112
119
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.42.
|
|
1
|
+
declare const _default: "6.42.1";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../ap-table/utils.js"),T=require("../renderer/index.js"),d=require("lodash-unified"),u=require("vue");require("../components/body-cell/index.vue.js");require("../components/header-cell/index.vue.js");require("../components/tooltip/index.vue.js");require("../../config-provider/index.js");const q=require("../../ap-grid/utils/col.js"),w=require("../../utils/index.js"),R=require("../../config-provider/hooks/use-global-config.js"),P=require("../../config-provider/hooks/use-namespace.js"),S=require("../components/body-cell/index.vue2.js"),D=require("../components/tooltip/index.vue2.js"),y=require("../components/header-cell/index.vue2.js");function I(t){return d.isNumber(t)&&t>1}function M(t,i){if(i.bodyCellTooltip)return d.isFunction(i.bodyCellTooltip)?i.bodyCellTooltip(t.value,t.data):i.bodyCellTooltip;if(i.renderText)return i.renderText({value:t.value,record:t.data,column:i,text:t.value});const p=i.valueType||"text",f=T.rendererMap[p];if(f){const c=C.getTableRenderProps({...i,valueType:p},{value:t.value,text:t.value,record:t.data,column:t.column,rowIndex:t.node?.rowIndex,pinned:t.node?.rowPinned});return f(c)}return C.objectToString(t.value)}const G=(t,i,p)=>{const f=R.useGlobalConfig("valueTypeMap"),v=u.ref(),{em:c}=P.useNamespace("ag-grid"),b=r=>{const a={cellRenderer:S.default,cellRendererParams:{column:r,extraValueType:u.unref(f),rowKey:i.rowKey}};if(r.customRender)return a;if(r.renderText)return{valueFormatter:s=>r.renderText({value:s.value,record:s.data,column:r,text:s.value})};const l=r.valueType||"text",e=T.rendererMap[l];return e?{valueFormatter:s=>{const n=C.getTableRenderProps({...r,valueType:l},{value:s.value,text:s.value,record:s.data,column:s.column,rowIndex:s.node?.rowIndex,pinned:s.node?.rowPinned});return e(n)}}:a},h=r=>{const a=r.valueType||"text",l=T.rendererMap[a],e={},s=r.bodyCellTooltip||!r.customRender&&l&&(r.ellipsis===!0||r.ellipsis==="tooltip"||d.isNumber(r.ellipsis)),n=d.isNumber(r.ellipsis)&&r.ellipsis>1,o=d.isNumber(r.ellipsis)?r.ellipsis:1;return e.tooltipValueGetter=s?x=>M(x,r):void 0,e.wrapText=!r.ellipsis||n,e.cellStyle={"--ag-grid-line-clamp":o},e.tooltipComponent=D.default,e.tooltipComponentParams={lineClamp:o,gridWrapperRef:v},e},_=u.computed(()=>{const r=u.unref(t);function a(l){return l.map(e=>{const s={field:q.dataIndexToField(e.dataIndex),colId:w.isDef(e.key)?String(e.key):void 0,sortable:!!e.sorter,comparator:e.sorter===!0?()=>0:e.sorter,headerComponentParams:{column:e},resizable:e.resizable,width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth,flex:e.width?void 0:1,pinned:e.fixed||null,colSpan:e.colSpan,spanRows:e.spanRows,cellClass:p(n=>{const o=e.cellClass||"",x=d.isFunction(o)?o(n.data,n.node):o;return[`${c("cell",e.align||"left")}`,I(e.ellipsis)?c("cell","multiline"):null,x].flat().filter(Boolean)}),headerStyle:e.headerStyle,headerClass:e.headerClass,autoHeight:!0,...h(e),...b(e)};return e.children?.length?{...s,headerGroupComponent:y.default,headerGroupComponentParams:{column:e},children:a(e.children)}:s})}return a(r)}),g=u.computed(()=>({headerComponent:y.default,resizable:i.columnResizable,suppressMovable:!0,cellDataType:!1}));return{columnDefs:_,defaultColDef:g,gridWrapperRef:v}};exports.useColumnsDef=G;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ModalProps, ModalFuncProps } from '@aplus-frontend/antdv';
|
|
2
2
|
import { ModalFunc, ModalStaticFunctions } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
3
|
-
import { AppContext } from 'vue';
|
|
4
|
-
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon'> & Partial<{
|
|
3
|
+
import { AppContext, VNodeChild } from 'vue';
|
|
4
|
+
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon' | 'footer'> & Partial<{
|
|
5
5
|
/**
|
|
6
6
|
* 点击取消回调
|
|
7
7
|
* @param params content组件内使用defineExpose导出的对象
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
onCancel: (
|
|
10
|
+
onCancel: (contentExposed: ContentRecord) => any | Promise<any>;
|
|
11
11
|
/**
|
|
12
12
|
* 点击确定回调
|
|
13
13
|
* @param params content组件内使用defineExpose导出的对象
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
onOk: (
|
|
16
|
+
onOk: (contentExposed: ContentRecord) => any | Promise<any>;
|
|
17
17
|
/**
|
|
18
18
|
* 指定弹框挂载的 HTML 节点
|
|
19
19
|
*/
|
|
@@ -34,8 +34,28 @@ export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open'
|
|
|
34
34
|
* 弹窗的上下文,一般用于获取全局注册组件、vuex 等内容
|
|
35
35
|
*/
|
|
36
36
|
appContext: AppContext;
|
|
37
|
+
/**
|
|
38
|
+
* 底部内容,当不需要默认底部按钮时,可以设为 :footer="null"
|
|
39
|
+
*/
|
|
40
|
+
footer: ((params: {
|
|
41
|
+
/**
|
|
42
|
+
* 原始的底部内容
|
|
43
|
+
*/
|
|
44
|
+
originNode: VNodeChild;
|
|
45
|
+
/**
|
|
46
|
+
* 底部按钮
|
|
47
|
+
*/
|
|
48
|
+
extra: {
|
|
49
|
+
okBtn: VNodeChild;
|
|
50
|
+
cancelBtn: VNodeChild;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* content组件内使用defineExpose导出的对象
|
|
54
|
+
*/
|
|
55
|
+
contentExposed: ContentRecord;
|
|
56
|
+
}) => VNodeChild) | VNodeChild;
|
|
37
57
|
}>;
|
|
38
|
-
export type CreateModalFuncReturn = {
|
|
58
|
+
export type CreateModalFuncReturn<ContentRecord = any> = {
|
|
39
59
|
/**
|
|
40
60
|
* 销毁弹框
|
|
41
61
|
* @returns
|
|
@@ -46,7 +66,7 @@ export type CreateModalFuncReturn = {
|
|
|
46
66
|
* @param newConfig
|
|
47
67
|
* @returns
|
|
48
68
|
*/
|
|
49
|
-
update: (newConfig: CreateModalFuncProps) => void;
|
|
69
|
+
update: (newConfig: CreateModalFuncProps<ContentRecord>) => void;
|
|
50
70
|
/**
|
|
51
71
|
* 打开弹框
|
|
52
72
|
* @returns
|
|
@@ -58,7 +78,7 @@ export type CreateModalFuncReturn = {
|
|
|
58
78
|
*/
|
|
59
79
|
close: () => void;
|
|
60
80
|
};
|
|
61
|
-
export type CreateModalFunc = (props: CreateModalFuncProps) => CreateModalFuncReturn
|
|
81
|
+
export type CreateModalFunc = <ContentRecord = any>(props: CreateModalFuncProps<ContentRecord>) => CreateModalFuncReturn<ContentRecord>;
|
|
62
82
|
export type ModalStreamNextFunc<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = (option?: {
|
|
63
83
|
/**
|
|
64
84
|
* 下一步弹框的id
|
|
@@ -121,18 +141,18 @@ export type ModalFuncStream<ModalType extends ModalStreamTypeKey = ModalStreamTy
|
|
|
121
141
|
export type CreateModalStream<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = Omit<CreateModalFuncProps, 'destroyOnClose' | 'onOk' | 'onCancel'> & {
|
|
122
142
|
/**
|
|
123
143
|
* 点击确定回调
|
|
124
|
-
* * @param
|
|
144
|
+
* * @param contentExposed content组件内使用defineExpose导出的对象
|
|
125
145
|
* @param next 下一步
|
|
126
146
|
* @returns
|
|
127
147
|
*/
|
|
128
|
-
onOk?: (
|
|
148
|
+
onOk?: (contentExposed: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
|
|
129
149
|
/**
|
|
130
150
|
* 点击取消回调
|
|
131
|
-
* * @param
|
|
151
|
+
* * @param contentExposed content组件内使用defineExpose导出的对象
|
|
132
152
|
* @param next 下一步
|
|
133
153
|
* @returns
|
|
134
154
|
*/
|
|
135
|
-
onCancel?: (
|
|
155
|
+
onCancel?: (contentExposed: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
|
|
136
156
|
};
|
|
137
157
|
export type ModalStreamTypeKey = keyof ModalStreamType;
|
|
138
158
|
export type CreateModalStreamProps<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = ModalType extends ModalStreamTypeKey ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),b=require("@aplus-frontend/antdv"),u=require("../../config-provider/config-provider.js"),O=require("lodash-unified"),q=require("@aplus-frontend/utils");require("../../config-provider/index.js");const f=require("./util.js"),N=require("../../utils/index.js"),P=require("../../config-provider/hooks/use-namespace.js"),k=o=>{let t,r;const{destroyOnClose:i=!0,wrapperOffset:a=!1}=o,{b:c}=P.useNamespace("ap-modal");function d(){t&&t(!1),setTimeout(()=>{n.render(null,s),s.parentElement?.removeChild(s)},500)}function h(){t&&t(!0)}function p(){t&&t(!1)}function C(e){r&&r(e)}const m=n.defineComponent({data(){return{open:i,props:o}},created(){t=e=>{this.open=e},r=e=>{this.props={...this.props,...e}}},methods:{async handleCancel(){if(this.props?.onCancel){const e=this.props?.content?.component?.exposed??void 0;await this.props?.onCancel(e)}i?d():p()},async handleOk(){try{if(r({confirmLoading:!0}),this.props?.onOk){const e=this.props?.content?.component?.exposed??void 0;await this.props.onOk(e)}r({confirmLoading:!1}),i?d():p()}catch{r({confirmLoading:!1})}},handleFooter(e){return o?.footer!==void 0?typeof o.footer=="function"?o.footer({...e,contentExposed:this.props?.content?.component?.exposed??void 0}):o.footer:e?.originNode}},render(){const e=O.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon","footer"]);return n.createVNode(u.ConfigProvider,u.globalConfigCached.value,{default:()=>[n.createVNode(b.Modal,n.mergeProps({class:{[c()]:!0,[c("wrapper")]:a},centered:!0},e,{open:this.open,onCancel:this.handleCancel,onOk:this.handleOk,footer:this?.handleFooter}),{default:()=>[n.createVNode("div",{class:{[c("body-wrapper")]:a},style:a===!1?{}:{maxHeight:`calc(100vh - ${(a===!0?100:q.isNumeric(a)?Number(a):100)*2}px)`}},[this.props?.content])]})]})}}),g=f.getContainerDom(u.globalConfigCached?.value?.getPopupContainer),x=f.getContainerDom(o.getContainer),v=g||x||N.getTopWindow().document.body,s=document.createElement("div");v.appendChild(s);const l=n.h(m),y=f.getModalGlobalAppContext();return l.appContext=o.appContext||y||l.appContext,n.render(l,s),{destroy:d,update:C,open:h,close:p}};exports.createModal=k;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.42.
|
|
1
|
+
declare const _default: "6.42.1";
|
|
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.42.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.42.1";exports.default=e;
|