@aplus-frontend/ui 6.41.3 → 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 +71 -70
- package/es/src/ag-grid/index.vue.mjs +1 -0
- package/es/src/ag-grid/interface.d.ts +1 -0
- package/es/src/ap-download/ap-download.vue.d.ts +4 -4
- package/es/src/ap-download/ap-download.vue.mjs +29 -29
- package/es/src/ap-download/interface.d.ts +4 -0
- package/es/src/ap-modal/interface.d.ts +31 -11
- package/es/src/ap-modal/utils/createModal.mjs +52 -45
- package/es/src/business/ap-attachment/ApAttachment.mjs +53 -49
- package/es/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -2
- package/es/src/business/ap-expand-alert/ApExpandAlert.vue2.mjs +56 -48
- package/es/src/business/ap-expand-alert/index.d.ts +5 -2
- package/es/src/business/ap-expand-alert/interface.d.ts +1 -1
- 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/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +1 -0
- package/lib/src/ap-download/ap-download.vue.d.ts +4 -4
- package/lib/src/ap-download/ap-download.vue.js +1 -1
- package/lib/src/ap-download/interface.d.ts +4 -0
- package/lib/src/ap-modal/interface.d.ts +31 -11
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -2
- package/lib/src/business/ap-expand-alert/ApExpandAlert.vue2.js +1 -1
- package/lib/src/business/ap-expand-alert/index.d.ts +5 -2
- package/lib/src/business/ap-expand-alert/interface.d.ts +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
|
|
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,61 +39,61 @@ function M(t, o) {
|
|
|
39
39
|
pinned: t.node?.rowPinned
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
return
|
|
42
|
+
return p(f);
|
|
43
43
|
}
|
|
44
|
-
return
|
|
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
|
-
valueFormatter: (
|
|
61
|
-
value:
|
|
62
|
-
record:
|
|
60
|
+
valueFormatter: (o) => r.renderText({
|
|
61
|
+
value: o.value,
|
|
62
|
+
record: o.data,
|
|
63
63
|
column: r,
|
|
64
|
-
text:
|
|
64
|
+
text: o.value
|
|
65
65
|
})
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const s = r.valueType || "text", e = x[s];
|
|
68
68
|
return e ? {
|
|
69
|
-
valueFormatter: (
|
|
70
|
-
const
|
|
71
|
-
{ ...r, valueType:
|
|
69
|
+
valueFormatter: (o) => {
|
|
70
|
+
const l = c(
|
|
71
|
+
{ ...r, valueType: s },
|
|
72
72
|
{
|
|
73
|
-
value:
|
|
74
|
-
text:
|
|
75
|
-
record:
|
|
76
|
-
column:
|
|
77
|
-
rowIndex:
|
|
78
|
-
pinned:
|
|
73
|
+
value: o.value,
|
|
74
|
+
text: o.value,
|
|
75
|
+
record: o.data,
|
|
76
|
+
column: o.column,
|
|
77
|
+
rowIndex: o.node?.rowIndex,
|
|
78
|
+
pinned: o.node?.rowPinned
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
|
-
return e(
|
|
81
|
+
return e(l);
|
|
82
82
|
}
|
|
83
|
-
} :
|
|
84
|
-
},
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
"--ag-grid-line-clamp":
|
|
88
|
-
},
|
|
89
|
-
lineClamp:
|
|
90
|
-
gridWrapperRef:
|
|
91
|
-
},
|
|
92
|
-
}, g =
|
|
93
|
-
const r =
|
|
94
|
-
function
|
|
95
|
-
return
|
|
96
|
-
const
|
|
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
|
+
return s.map((e) => {
|
|
96
|
+
const o = {
|
|
97
97
|
field: S(e.dataIndex),
|
|
98
98
|
colId: I(e.key) ? String(e.key) : void 0,
|
|
99
99
|
sortable: !!e.sorter,
|
|
@@ -110,44 +110,45 @@ const X = (t, o, n) => {
|
|
|
110
110
|
pinned: e.fixed || null,
|
|
111
111
|
// undefined to null
|
|
112
112
|
colSpan: e.colSpan,
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
spanRows: e.spanRows,
|
|
114
|
+
cellClass: d((l) => {
|
|
115
|
+
const n = e.cellClass || "", T = m(n) ? n(l.data, l.node) : n;
|
|
115
116
|
return [
|
|
116
|
-
`${
|
|
117
|
-
F(e.ellipsis) ?
|
|
118
|
-
|
|
117
|
+
`${f("cell", e.align || "left")}`,
|
|
118
|
+
F(e.ellipsis) ? f("cell", "multiline") : null,
|
|
119
|
+
T
|
|
119
120
|
].flat().filter(Boolean);
|
|
120
121
|
}),
|
|
121
122
|
headerStyle: e.headerStyle,
|
|
122
123
|
headerClass: e.headerClass,
|
|
123
124
|
autoHeight: !0,
|
|
124
125
|
// 设置自动计算高度以自适应多行换行的场景
|
|
125
|
-
...
|
|
126
|
-
...
|
|
126
|
+
...w(e),
|
|
127
|
+
...b(e)
|
|
127
128
|
};
|
|
128
129
|
return e.children?.length ? {
|
|
129
|
-
...
|
|
130
|
-
headerGroupComponent:
|
|
130
|
+
...o,
|
|
131
|
+
headerGroupComponent: h,
|
|
131
132
|
headerGroupComponentParams: {
|
|
132
133
|
column: e
|
|
133
134
|
},
|
|
134
|
-
children:
|
|
135
|
-
} :
|
|
135
|
+
children: i(e.children)
|
|
136
|
+
} : o;
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
return
|
|
139
|
-
}),
|
|
139
|
+
return i(r);
|
|
140
|
+
}), R = y(
|
|
140
141
|
() => ({
|
|
141
|
-
headerComponent:
|
|
142
|
-
resizable:
|
|
142
|
+
headerComponent: h,
|
|
143
|
+
resizable: a.columnResizable,
|
|
143
144
|
suppressMovable: !0,
|
|
144
145
|
cellDataType: !1
|
|
145
146
|
})
|
|
146
147
|
);
|
|
147
148
|
return {
|
|
148
149
|
columnDefs: g,
|
|
149
|
-
defaultColDef:
|
|
150
|
-
gridWrapperRef:
|
|
150
|
+
defaultColDef: R,
|
|
151
|
+
gridWrapperRef: C
|
|
151
152
|
};
|
|
152
153
|
};
|
|
153
154
|
export {
|
|
@@ -507,6 +507,7 @@ const vt = /* @__PURE__ */ io({
|
|
|
507
507
|
"row-class-rules": e.rowClassRules,
|
|
508
508
|
"no-rows-overlay-component": Uo,
|
|
509
509
|
"suppress-cell-focus": "",
|
|
510
|
+
"enable-cell-span": "",
|
|
510
511
|
"dom-layout": e.autoHeight ? "autoHeight" : "normal",
|
|
511
512
|
onSortChanged: Fe,
|
|
512
513
|
onGridReady: r[0] || (r[0] = (a) => s.value = a.api),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApDownLoadProps } from './interface';
|
|
1
|
+
import { ApDownLoadProps, downloadCallbackResponse } from './interface';
|
|
2
2
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
3
|
import { ButtonType } from '@aplus-frontend/antdv/es/button';
|
|
4
4
|
type __VLS_Props = ApDownLoadProps;
|
|
@@ -11,10 +11,10 @@ declare function __VLS_template(): {
|
|
|
11
11
|
rootEl: any;
|
|
12
12
|
};
|
|
13
13
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
14
|
-
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
15
|
-
downloadCallback: (
|
|
14
|
+
declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
15
|
+
downloadCallback: (res?: downloadCallbackResponse | undefined) => any;
|
|
16
16
|
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
-
onDownloadCallback?: ((
|
|
17
|
+
onDownloadCallback?: ((res?: downloadCallbackResponse | undefined) => any) | undefined;
|
|
18
18
|
}>, {
|
|
19
19
|
size: "small" | "large" | "middle";
|
|
20
20
|
type: ButtonType;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as F, ref as L, useSlots as S, computed as
|
|
1
|
+
import { defineComponent as F, ref as L, useSlots as S, computed as a, unref as l, createBlock as x, openBlock as i, mergeProps as A, withCtx as j, createElementVNode as u, normalizeClass as I, createElementBlock as f, createCommentVNode as g, createVNode as M, renderSlot as T, toDisplayString as U } from "vue";
|
|
2
2
|
import { Button as V } from "@aplus-frontend/antdv";
|
|
3
3
|
import { LoadingOutlined as D } from "@ant-design/icons-vue";
|
|
4
4
|
import "../config-provider/index.mjs";
|
|
5
5
|
import { useOssInit as E } from "./hooks/index.mjs";
|
|
6
|
-
import { getFileInfo as
|
|
6
|
+
import { getFileInfo as y } from "./utils/getFileInfo.mjs";
|
|
7
7
|
import { useStyle as P } from "./hooks/useStyle.mjs";
|
|
8
8
|
import { useLocale as G } from "../config-provider/hooks/use-locale.mjs";
|
|
9
9
|
import { useGlobalConfig as r } from "../config-provider/hooks/use-global-config.mjs";
|
|
@@ -43,58 +43,58 @@ const R = {
|
|
|
43
43
|
getOssAccess: {}
|
|
44
44
|
},
|
|
45
45
|
emits: ["downloadCallback"],
|
|
46
|
-
setup(
|
|
47
|
-
const
|
|
46
|
+
setup(C, { emit: b }) {
|
|
47
|
+
const c = b, s = L(!1), { lang: N } = G(), v = S(), w = a(() => N.value === "zh-cn" ? "zh_CN" : "en_US"), h = r("uiMode"), e = C, n = r("apUpload"), d = r(
|
|
48
48
|
"downloadCenterTriggerConfig"
|
|
49
|
-
),
|
|
49
|
+
), p = a(() => e.disabled), _ = a(() => e.color ? e.color : h.value === "aplus" ? "#0070FF" : "#1890FF"), k = a(() => e.size), { getInnerWrapperClass: B } = P(_, k, p), z = a(() => e.getOssAccess || n.value?.getOssAccess), O = async () => {
|
|
50
50
|
if (!e.disabled) {
|
|
51
|
-
|
|
51
|
+
s.value = !0;
|
|
52
52
|
try {
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
e.needName ??
|
|
53
|
+
if (d.value?.trigger) {
|
|
54
|
+
let t = y(
|
|
55
|
+
e.needName ?? n?.value?.needName,
|
|
56
56
|
e.fileName
|
|
57
|
-
).map((
|
|
58
|
-
objectName:
|
|
59
|
-
fileName:
|
|
57
|
+
).map((m) => ({
|
|
58
|
+
objectName: m.path,
|
|
59
|
+
fileName: m.fileName
|
|
60
60
|
}));
|
|
61
|
-
await
|
|
61
|
+
await d.value?.trigger(t), c("downloadCallback", t);
|
|
62
62
|
} else {
|
|
63
|
-
const
|
|
63
|
+
const t = await (await E(
|
|
64
64
|
z.value,
|
|
65
|
-
|
|
65
|
+
l(w)
|
|
66
66
|
)).downloadFile(
|
|
67
|
-
|
|
68
|
-
e.needName ??
|
|
67
|
+
y(
|
|
68
|
+
e.needName ?? n?.value?.needName,
|
|
69
69
|
e.fileName
|
|
70
70
|
)
|
|
71
71
|
);
|
|
72
|
-
|
|
72
|
+
c("downloadCallback", t);
|
|
73
73
|
}
|
|
74
74
|
} catch (o) {
|
|
75
75
|
console.error(o);
|
|
76
76
|
} finally {
|
|
77
|
-
|
|
77
|
+
s.value = !1;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
return (o,
|
|
81
|
+
return (o, t) => (i(), x(l(V), A(e, {
|
|
82
82
|
type: e.type,
|
|
83
83
|
size: e.size,
|
|
84
|
-
disabled:
|
|
84
|
+
disabled: p.value,
|
|
85
85
|
onClick: O
|
|
86
86
|
}), {
|
|
87
87
|
default: j(() => [
|
|
88
|
-
|
|
89
|
-
class: I(
|
|
88
|
+
u("div", {
|
|
89
|
+
class: I(l(B))
|
|
90
90
|
}, [
|
|
91
|
-
|
|
92
|
-
M(
|
|
93
|
-
])) :
|
|
94
|
-
|
|
91
|
+
s.value ? (i(), f("span", R, [
|
|
92
|
+
M(l(D), { spin: !0 })
|
|
93
|
+
])) : g("", !0),
|
|
94
|
+
l(v).icon ? (i(), f("span", W, [
|
|
95
95
|
T(o.$slots, "icon")
|
|
96
|
-
])) :
|
|
97
|
-
|
|
96
|
+
])) : g("", !0),
|
|
97
|
+
u("span", $, U(o.text), 1)
|
|
98
98
|
], 2)
|
|
99
99
|
]),
|
|
100
100
|
_: 3
|
|
@@ -38,4 +38,8 @@ export declare enum ApDownLoadNeedNameKeyDefault {
|
|
|
38
38
|
pathKey = "path"
|
|
39
39
|
}
|
|
40
40
|
export type actionResponse = Awaited<ReturnType<typeof client.downloadFile>>;
|
|
41
|
+
export type downloadCallbackResponse = {
|
|
42
|
+
objectName: string;
|
|
43
|
+
fileName: string;
|
|
44
|
+
}[] | actionResponse;
|
|
41
45
|
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
|
};
|