@aplus-frontend/ui 0.5.11 → 0.5.12
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/ap-modal/index.d.ts +9 -2
- package/es/src/ap-modal/index.mjs +23 -8
- package/es/src/ap-modal/interface.d.ts +2 -1
- package/es/src/ap-modal/utils/createModal.mjs +43 -40
- package/es/src/ap-modal/utils/index.d.ts +1 -0
- package/es/src/ap-modal/utils/index.mjs +6 -4
- package/es/src/ap-modal/utils/methods.d.ts +3 -0
- package/es/src/ap-modal/utils/methods.mjs +34 -0
- package/es/src/ap-modal/utils/util.d.ts +1 -0
- package/es/src/ap-modal/utils/util.mjs +4 -0
- package/es/src/utils/config-provider-preset.mjs +21 -17
- package/es/src/utils/index.d.ts +1 -0
- package/es/src/utils/index.mjs +25 -21
- package/lib/src/ap-modal/index.d.ts +9 -2
- package/lib/src/ap-modal/index.js +1 -1
- package/lib/src/ap-modal/interface.d.ts +2 -1
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/ap-modal/utils/index.d.ts +1 -0
- package/lib/src/ap-modal/utils/index.js +1 -1
- package/lib/src/ap-modal/utils/methods.d.ts +3 -0
- package/lib/src/ap-modal/utils/methods.js +1 -0
- package/lib/src/ap-modal/utils/util.d.ts +1 -0
- package/lib/src/ap-modal/utils/util.js +1 -0
- package/lib/src/utils/config-provider-preset.js +1 -1
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Modal as _Modal } from '@aplus-frontend/antdv';
|
|
2
|
-
import {
|
|
2
|
+
import { ModalFunc } from '@aplus-frontend/antdv/es/modal/confirm';
|
|
3
|
+
import { ApModalType, CreateModalFunc, CreateModalStreamFunc } from './interface';
|
|
3
4
|
export * from './interface';
|
|
4
|
-
type ApModalMixedProps = typeof _Modal & {
|
|
5
|
+
type ApModalMixedProps = Omit<typeof _Modal, ApModalType | 'warn'> & {
|
|
5
6
|
createModal: CreateModalFunc;
|
|
6
7
|
createModalStream: CreateModalStreamFunc;
|
|
8
|
+
confirm: ModalFunc;
|
|
9
|
+
warning: ModalFunc;
|
|
10
|
+
warn: ModalFunc;
|
|
11
|
+
error: ModalFunc;
|
|
12
|
+
success: ModalFunc;
|
|
13
|
+
info: ModalFunc;
|
|
7
14
|
};
|
|
8
15
|
declare const ApModal: ApModalMixedProps;
|
|
9
16
|
export { ApModal };
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { Modal as
|
|
1
|
+
import { Modal as a } from "@aplus-frontend/antdv";
|
|
2
2
|
import "./utils/index.mjs";
|
|
3
|
+
import { omit as m } from "lodash-unified";
|
|
3
4
|
import "./interface.mjs";
|
|
4
|
-
import { createModal as
|
|
5
|
-
import { createModalStream as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { createModal as e } from "./utils/createModal.mjs";
|
|
6
|
+
import { createModalStream as n } from "./utils/createModalStream.mjs";
|
|
7
|
+
import { methodsFn as o } from "./utils/methods.mjs";
|
|
8
|
+
const r = m(a, [
|
|
9
|
+
"confirm",
|
|
10
|
+
"warning",
|
|
11
|
+
"warn",
|
|
12
|
+
"error",
|
|
13
|
+
"success",
|
|
14
|
+
"info"
|
|
15
|
+
]);
|
|
16
|
+
r.createModal = e;
|
|
17
|
+
r.createModalStream = n;
|
|
18
|
+
r.confirm = o("confirm");
|
|
19
|
+
r.warning = o("warning");
|
|
20
|
+
r.warn = o("warning");
|
|
21
|
+
r.error = o("error");
|
|
22
|
+
r.success = o("success");
|
|
23
|
+
r.info = o("info");
|
|
24
|
+
r.name = "ApModal";
|
|
10
25
|
export {
|
|
11
|
-
|
|
26
|
+
r as ApModal
|
|
12
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalProps, ModalFuncProps } from '@aplus-frontend/antdv';
|
|
2
|
-
import { ModalFunc } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
2
|
+
import { ModalFunc, ModalStaticFunctions } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
3
3
|
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon'> & Partial<{
|
|
4
4
|
/**
|
|
5
5
|
* 点击取消回调
|
|
@@ -139,3 +139,4 @@ export type CreateModalStreamProps<ModalType extends ModalStreamTypeKey = ModalS
|
|
|
139
139
|
props: (params: any) => Promise<ModalStreamType[ModalType]>;
|
|
140
140
|
} : never;
|
|
141
141
|
export type CreateModalStreamFunc<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = (streamList: CreateModalStreamProps<ModalType>[], firstModalId?: string) => void;
|
|
142
|
+
export type ApModalType = keyof Omit<ModalStaticFunctions, 'warn'>;
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import { render as
|
|
2
|
-
import { Modal as
|
|
3
|
-
import { ConfigProvider as
|
|
4
|
-
import { omit as
|
|
5
|
-
import { isNumeric as
|
|
1
|
+
import { render as g, defineComponent as L, createVNode as u, mergeProps as E, h as H } from "vue";
|
|
2
|
+
import { Modal as M } from "@aplus-frontend/antdv";
|
|
3
|
+
import { ConfigProvider as T, globalConfigCached as O } from "../../config-provider/config-provider.mjs";
|
|
4
|
+
import { omit as D } from "lodash-unified";
|
|
5
|
+
import { isNumeric as U } from "@aplus-frontend/utils";
|
|
6
6
|
import "../../config-provider/index.mjs";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { getContainerDom as w } from "./util.mjs";
|
|
8
|
+
import { getTopWindow as V } from "../../utils/index.mjs";
|
|
9
|
+
import { useNamespace as W } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
const J = (c) => {
|
|
11
|
+
var h, C;
|
|
9
12
|
let n, t;
|
|
10
13
|
const {
|
|
11
|
-
destroyOnClose:
|
|
14
|
+
destroyOnClose: d = !0,
|
|
12
15
|
wrapperOffset: r = !1
|
|
13
|
-
} =
|
|
14
|
-
b:
|
|
15
|
-
} =
|
|
16
|
-
function
|
|
16
|
+
} = c, {
|
|
17
|
+
b: m
|
|
18
|
+
} = W("ap-modal");
|
|
19
|
+
function l() {
|
|
17
20
|
n && n(!1), setTimeout(() => {
|
|
18
21
|
var e;
|
|
19
|
-
|
|
22
|
+
g(null, s), (e = s.parentElement) == null || e.removeChild(s);
|
|
20
23
|
}, 500);
|
|
21
24
|
}
|
|
22
|
-
function
|
|
25
|
+
function y() {
|
|
23
26
|
n && n(!0);
|
|
24
27
|
}
|
|
25
28
|
function f() {
|
|
26
29
|
n && n(!1);
|
|
27
30
|
}
|
|
28
|
-
function
|
|
31
|
+
function v(e) {
|
|
29
32
|
t && t(e);
|
|
30
33
|
}
|
|
31
|
-
const
|
|
34
|
+
const x = /* @__PURE__ */ L({
|
|
32
35
|
data() {
|
|
33
36
|
return {
|
|
34
|
-
open:
|
|
35
|
-
props:
|
|
37
|
+
open: d,
|
|
38
|
+
props: c
|
|
36
39
|
};
|
|
37
40
|
},
|
|
38
41
|
created() {
|
|
@@ -47,25 +50,25 @@ const z = (d) => {
|
|
|
47
50
|
},
|
|
48
51
|
methods: {
|
|
49
52
|
async handleCancel() {
|
|
50
|
-
var e, o, a,
|
|
53
|
+
var e, o, a, i, p;
|
|
51
54
|
if ((e = this.props) != null && e.onCancel) {
|
|
52
|
-
const
|
|
53
|
-
await ((
|
|
55
|
+
const N = ((i = (a = (o = this.props) == null ? void 0 : o.content) == null ? void 0 : a.component) == null ? void 0 : i.exposed) ?? void 0;
|
|
56
|
+
await ((p = this.props) == null ? void 0 : p.onCancel(N));
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
d ? l() : f();
|
|
56
59
|
},
|
|
57
60
|
async handleOk() {
|
|
58
|
-
var e, o, a,
|
|
61
|
+
var e, o, a, i;
|
|
59
62
|
try {
|
|
60
63
|
if (t({
|
|
61
64
|
confirmLoading: !0
|
|
62
65
|
}), (e = this.props) != null && e.onOk) {
|
|
63
|
-
const
|
|
64
|
-
await this.props.onOk(
|
|
66
|
+
const p = ((i = (a = (o = this.props) == null ? void 0 : o.content) == null ? void 0 : a.component) == null ? void 0 : i.exposed) ?? void 0;
|
|
67
|
+
await this.props.onOk(p);
|
|
65
68
|
}
|
|
66
69
|
t({
|
|
67
70
|
confirmLoading: !1
|
|
68
|
-
}),
|
|
71
|
+
}), d ? l() : f();
|
|
69
72
|
} catch {
|
|
70
73
|
t({
|
|
71
74
|
confirmLoading: !1
|
|
@@ -74,12 +77,12 @@ const z = (d) => {
|
|
|
74
77
|
}
|
|
75
78
|
},
|
|
76
79
|
render() {
|
|
77
|
-
const e =
|
|
78
|
-
return
|
|
79
|
-
default: () => [
|
|
80
|
+
const e = D(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon"]);
|
|
81
|
+
return u(T, O.value, {
|
|
82
|
+
default: () => [u(M, E({
|
|
80
83
|
class: {
|
|
81
|
-
[
|
|
82
|
-
[
|
|
84
|
+
[m()]: !0,
|
|
85
|
+
[m("wrapper")]: r
|
|
83
86
|
},
|
|
84
87
|
open: this.open,
|
|
85
88
|
onCancel: this.handleCancel,
|
|
@@ -87,26 +90,26 @@ const z = (d) => {
|
|
|
87
90
|
}, e), {
|
|
88
91
|
default: () => {
|
|
89
92
|
var o;
|
|
90
|
-
return [
|
|
93
|
+
return [u("div", {
|
|
91
94
|
class: {
|
|
92
|
-
[
|
|
95
|
+
[m("body-wrapper")]: r
|
|
93
96
|
},
|
|
94
97
|
style: r === !1 ? {} : {
|
|
95
|
-
maxHeight: `${window.innerHeight - (r === !0 ? 100 :
|
|
98
|
+
maxHeight: `${window.innerHeight - (r === !0 ? 100 : U(r) ? Number(r) : 100) * 2}px`
|
|
96
99
|
}
|
|
97
100
|
}, [(o = this.props) == null ? void 0 : o.content])];
|
|
98
101
|
}
|
|
99
102
|
})]
|
|
100
103
|
});
|
|
101
104
|
}
|
|
102
|
-
}),
|
|
103
|
-
return
|
|
104
|
-
destroy:
|
|
105
|
-
update:
|
|
106
|
-
open:
|
|
105
|
+
}), k = w((C = (h = O) == null ? void 0 : h.value) == null ? void 0 : C.getPopupContainer), P = w(c.getContainer), b = k || P || V().document.body, s = document.createElement("div");
|
|
106
|
+
return b.appendChild(s), g(H(x), s), {
|
|
107
|
+
destroy: l,
|
|
108
|
+
update: v,
|
|
109
|
+
open: y,
|
|
107
110
|
close: f
|
|
108
111
|
};
|
|
109
112
|
};
|
|
110
113
|
export {
|
|
111
|
-
|
|
114
|
+
J as createModal
|
|
112
115
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { createModal as
|
|
2
|
-
import { createModalStream as
|
|
1
|
+
import { createModal as r } from "./createModal.mjs";
|
|
2
|
+
import { createModalStream as a } from "./createModalStream.mjs";
|
|
3
|
+
import { methodsFn as d } from "./methods.mjs";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
r as createModal,
|
|
6
|
+
a as createModalStream,
|
|
7
|
+
d as methodsFn
|
|
6
8
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent as u, createVNode as C, render as f, h as g } from "vue";
|
|
2
|
+
import { Modal as h } from "@aplus-frontend/antdv";
|
|
3
|
+
import { ConfigProvider as x, globalConfigCached as m } from "../../config-provider/config-provider.mjs";
|
|
4
|
+
import { getContainerDom as a } from "./util.mjs";
|
|
5
|
+
import { getTopWindow as v } from "../../utils/index.mjs";
|
|
6
|
+
const D = (i) => (e) => {
|
|
7
|
+
var r, d;
|
|
8
|
+
let n;
|
|
9
|
+
const l = /* @__PURE__ */ u({
|
|
10
|
+
data() {
|
|
11
|
+
const [o, t] = h.useModal();
|
|
12
|
+
return {
|
|
13
|
+
modal: o,
|
|
14
|
+
contextHolder: t
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
mounted() {
|
|
18
|
+
var o, t;
|
|
19
|
+
n = (t = (o = this.modal) == null ? void 0 : o[i]) == null ? void 0 : t.call(o, e);
|
|
20
|
+
},
|
|
21
|
+
render() {
|
|
22
|
+
return C(x, m.value, {
|
|
23
|
+
default: () => {
|
|
24
|
+
var o;
|
|
25
|
+
return [(o = this.contextHolder) == null ? void 0 : o.call(this)];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}), c = a((d = (r = m) == null ? void 0 : r.value) == null ? void 0 : d.getPopupContainer), s = a(e.getContainer), p = c || s || v().document.body;
|
|
30
|
+
return f(g(l), p), n;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
D as methodsFn
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getContainerDom: (params?: HTMLElement | Element | (() => HTMLElement | Element)) => Element | undefined;
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import { isUndefined as
|
|
1
|
+
import { isUndefined as f } from "lodash-unified";
|
|
2
|
+
import { getTopWindow as s } from "./index.mjs";
|
|
2
3
|
function u(e, n) {
|
|
3
4
|
var t, r;
|
|
4
5
|
return e != null && e.parentElement ? e.parentElement.classList.contains(n) ? (t = e.parentElement) != null && t.parentElement ? (r = e.parentElement.parentElement.className) == null ? void 0 : r.includes("basic-table") : !1 : u(e.parentElement, n) : !1;
|
|
5
6
|
}
|
|
6
|
-
const
|
|
7
|
+
const i = (e) => {
|
|
8
|
+
var n, t;
|
|
9
|
+
return u(e, "ant-form") ? (e == null ? void 0 : e.parentNode) || ((n = s().document) == null ? void 0 : n.body) : (t = s().document) == null ? void 0 : t.body;
|
|
10
|
+
}, m = ({ text: e }) => {
|
|
7
11
|
const n = (t) => t == null || t === "";
|
|
8
12
|
return Array.isArray(e) ? n(e[0]) ? "--" : e[0] : n(e) ? "--" : e;
|
|
9
|
-
},
|
|
10
|
-
getPopupContainer:
|
|
11
|
-
transformCellText:
|
|
12
|
-
autoInsertSpaceInButton:
|
|
13
|
+
}, c = !1, a = {
|
|
14
|
+
getPopupContainer: i,
|
|
15
|
+
transformCellText: m,
|
|
16
|
+
autoInsertSpaceInButton: c
|
|
13
17
|
};
|
|
14
|
-
function
|
|
18
|
+
function y(e) {
|
|
15
19
|
const n = {
|
|
16
20
|
...e
|
|
17
21
|
}, t = Object.keys(
|
|
18
|
-
|
|
22
|
+
a
|
|
19
23
|
);
|
|
20
24
|
for (const r of t)
|
|
21
|
-
|
|
25
|
+
f(n[r]) && (n[r] = a[r]);
|
|
22
26
|
return n;
|
|
23
27
|
}
|
|
24
|
-
function
|
|
28
|
+
function d(e, n) {
|
|
25
29
|
const t = {
|
|
26
30
|
...n
|
|
27
31
|
}, r = Object.keys(e);
|
|
28
32
|
for (const o of r)
|
|
29
|
-
|
|
33
|
+
f(e[o]) || (t[o] = e[o]);
|
|
30
34
|
return t;
|
|
31
35
|
}
|
|
32
36
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
a as antdConfigProviderPresets,
|
|
38
|
+
c as autoInsertSpaceInButton,
|
|
39
|
+
i as getPopupContainer,
|
|
40
|
+
y as mergeAntdProvideConfig,
|
|
41
|
+
d as mergeAntdProviderConfigWithCache,
|
|
42
|
+
m as transformCellText
|
|
39
43
|
};
|
package/es/src/utils/index.d.ts
CHANGED
package/es/src/utils/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { unref as s, markRaw as f } from "vue";
|
|
2
2
|
import { isUndefined as l } from "lodash-unified";
|
|
3
|
-
import { isClient as
|
|
3
|
+
import { isClient as d } from "@vueuse/core";
|
|
4
4
|
function m(t) {
|
|
5
5
|
return (t == null ? void 0 : t.parentNode) ?? document.body;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function w(t) {
|
|
8
8
|
return typeof t < "u";
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function g(t) {
|
|
11
11
|
const e = {};
|
|
12
12
|
return Object.keys(t).map((n) => {
|
|
13
13
|
e[n] = s(t[n]);
|
|
14
14
|
}), e;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function h(t, e = [], n) {
|
|
17
17
|
const o = Object.assign({}, t), c = Object.keys(o);
|
|
18
|
-
for (let
|
|
19
|
-
const
|
|
20
|
-
(e.includes(
|
|
18
|
+
for (let r = 0; r < c.length; r += 1) {
|
|
19
|
+
const i = c[r];
|
|
20
|
+
(e.includes(i) || n != null && n(i, o[i])) && delete o[i];
|
|
21
21
|
}
|
|
22
22
|
return o;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function v(t) {
|
|
25
25
|
return /^[A-Z][A-Za-z]*$/.test(t);
|
|
26
26
|
}
|
|
27
27
|
function u(t) {
|
|
@@ -35,36 +35,40 @@ function u(t) {
|
|
|
35
35
|
}
|
|
36
36
|
return t;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function b(t) {
|
|
39
39
|
const e = { ...t };
|
|
40
40
|
for (const n of Object.keys(e))
|
|
41
41
|
l(e[n]) && delete e[n];
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function k(t, ...e) {
|
|
45
45
|
return typeof t == "function" ? t(...e) : t;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function x() {
|
|
48
48
|
const t = "history";
|
|
49
49
|
return typeof window > "u" ? t : window.location.href.includes("#/") ? "hash" : t;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
if (!
|
|
51
|
+
function C() {
|
|
52
|
+
if (!d)
|
|
53
53
|
return 15;
|
|
54
54
|
const t = document.createElement("div");
|
|
55
55
|
t.style.width = "100px", t.style.height = "100px", t.style.overflow = "scroll", t.style.position = "absolute", t.style.top = "-9999px", document.body.appendChild(t);
|
|
56
56
|
const e = t.offsetHeight - t.clientHeight;
|
|
57
57
|
return document.body.removeChild(t), e;
|
|
58
58
|
}
|
|
59
|
+
function R() {
|
|
60
|
+
return (window.top !== window ? window.top : window) ?? window;
|
|
61
|
+
}
|
|
59
62
|
export {
|
|
60
63
|
u as convertReactiveToRaw,
|
|
61
|
-
|
|
64
|
+
g as getDynamicProps,
|
|
62
65
|
m as getPopupContainer,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
x as getRouteType,
|
|
67
|
+
C as getScrollbarSize,
|
|
68
|
+
R as getTopWindow,
|
|
69
|
+
w as isDef,
|
|
70
|
+
v as isPascalCase,
|
|
71
|
+
b as omitUndefined,
|
|
72
|
+
h as omitWhen,
|
|
73
|
+
k as runFunction
|
|
70
74
|
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { Modal as _Modal } from '@aplus-frontend/antdv';
|
|
2
|
-
import {
|
|
2
|
+
import { ModalFunc } from '@aplus-frontend/antdv/es/modal/confirm';
|
|
3
|
+
import { ApModalType, CreateModalFunc, CreateModalStreamFunc } from './interface';
|
|
3
4
|
export * from './interface';
|
|
4
|
-
type ApModalMixedProps = typeof _Modal & {
|
|
5
|
+
type ApModalMixedProps = Omit<typeof _Modal, ApModalType | 'warn'> & {
|
|
5
6
|
createModal: CreateModalFunc;
|
|
6
7
|
createModalStream: CreateModalStreamFunc;
|
|
8
|
+
confirm: ModalFunc;
|
|
9
|
+
warning: ModalFunc;
|
|
10
|
+
warn: ModalFunc;
|
|
11
|
+
error: ModalFunc;
|
|
12
|
+
success: ModalFunc;
|
|
13
|
+
info: ModalFunc;
|
|
7
14
|
};
|
|
8
15
|
declare const ApModal: ApModalMixedProps;
|
|
9
16
|
export { ApModal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@aplus-frontend/antdv");require("./utils/index.js");const n=require("lodash-unified");require("./interface.js");const a=require("./utils/createModal.js"),t=require("./utils/createModalStream.js"),r=require("./utils/methods.js"),e=n.omit(o.Modal,["confirm","warning","warn","error","success","info"]);e.createModal=a.createModal;e.createModalStream=t.createModalStream;e.confirm=r.methodsFn("confirm");e.warning=r.methodsFn("warning");e.warn=r.methodsFn("warning");e.error=r.methodsFn("error");e.success=r.methodsFn("success");e.info=r.methodsFn("info");e.name="ApModal";exports.ApModal=e;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModalProps, ModalFuncProps } from '@aplus-frontend/antdv';
|
|
2
|
-
import { ModalFunc } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
2
|
+
import { ModalFunc, ModalStaticFunctions } from '@aplus-frontend/antdv/lib/modal/confirm';
|
|
3
3
|
export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon'> & Partial<{
|
|
4
4
|
/**
|
|
5
5
|
* 点击取消回调
|
|
@@ -139,3 +139,4 @@ export type CreateModalStreamProps<ModalType extends ModalStreamTypeKey = ModalS
|
|
|
139
139
|
props: (params: any) => Promise<ModalStreamType[ModalType]>;
|
|
140
140
|
} : never;
|
|
141
141
|
export type CreateModalStreamFunc<ModalType extends ModalStreamTypeKey = ModalStreamTypeKey> = (streamList: CreateModalStreamProps<ModalType>[], firstModalId?: string) => void;
|
|
142
|
+
export type ApModalType = keyof Omit<ModalStaticFunctions, 'warn'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),N=require("@aplus-frontend/antdv"),m=require("../../config-provider/config-provider.js"),k=require("lodash-unified"),M=require("@aplus-frontend/utils");require("../../config-provider/index.js");const v=require("./util.js"),L=require("../../utils/index.js"),T=require("../../config-provider/hooks/use-namespace.js"),V=p=>{var C,g;let t,r;const{destroyOnClose:l=!0,wrapperOffset:s=!1}=p,{b:u}=T.useNamespace("ap-modal");function f(){t&&t(!1),setTimeout(()=>{var e;o.render(null,a),(e=a.parentElement)==null||e.removeChild(a)},500)}function y(){t&&t(!0)}function h(){t&&t(!1)}function O(e){r&&r(e)}const q=o.defineComponent({data(){return{open:l,props:p}},created(){t=e=>{this.open=e},r=e=>{this.props={...this.props,...e}}},methods:{async handleCancel(){var e,n,i,c,d;if((e=this.props)!=null&&e.onCancel){const x=((c=(i=(n=this.props)==null?void 0:n.content)==null?void 0:i.component)==null?void 0:c.exposed)??void 0;await((d=this.props)==null?void 0:d.onCancel(x))}l?f():h()},async handleOk(){var e,n,i,c;try{if(r({confirmLoading:!0}),(e=this.props)!=null&&e.onOk){const d=((c=(i=(n=this.props)==null?void 0:n.content)==null?void 0:i.component)==null?void 0:c.exposed)??void 0;await this.props.onOk(d)}r({confirmLoading:!1}),l?f():h()}catch{r({confirmLoading:!1})}}},render(){const e=k.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon"]);return o.createVNode(m.ConfigProvider,m.globalConfigCached.value,{default:()=>[o.createVNode(N.Modal,o.mergeProps({class:{[u()]:!0,[u("wrapper")]:s},open:this.open,onCancel:this.handleCancel,onOk:this.handleOk},e),{default:()=>{var n;return[o.createVNode("div",{class:{[u("body-wrapper")]:s},style:s===!1?{}:{maxHeight:`${window.innerHeight-(s===!0?100:M.isNumeric(s)?Number(s):100)*2}px`}},[(n=this.props)==null?void 0:n.content])]}})]})}}),b=v.getContainerDom((g=(C=m.globalConfigCached)==null?void 0:C.value)==null?void 0:g.getPopupContainer),w=v.getContainerDom(p.getContainer),P=b||w||L.getTopWindow().document.body,a=document.createElement("div");return P.appendChild(a),o.render(o.h(q),a),{destroy:f,update:O,open:y,close:h}};exports.createModal=V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createModal.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createModal.js"),t=require("./createModalStream.js"),r=require("./methods.js");exports.createModal=e.createModal;exports.createModalStream=t.createModalStream;exports.methodsFn=r.methodsFn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),C=require("@aplus-frontend/antdv"),n=require("../../config-provider/config-provider.js"),c=require("./util.js"),h=require("../../utils/index.js"),f=l=>r=>{var a,i;let d;const s=t.defineComponent({data(){const[e,o]=C.Modal.useModal();return{modal:e,contextHolder:o}},mounted(){var e,o;d=(o=(e=this.modal)==null?void 0:e[l])==null?void 0:o.call(e,r)},render(){return t.createVNode(n.ConfigProvider,n.globalConfigCached.value,{default:()=>{var e;return[(e=this.contextHolder)==null?void 0:e.call(this)]}})}}),u=c.getContainerDom((i=(a=n.globalConfigCached)==null?void 0:a.value)==null?void 0:i.getPopupContainer),m=c.getContainerDom(r.getContainer),g=u||m||h.getTopWindow().document.body;return t.render(t.h(s),g),d};exports.methodsFn=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getContainerDom: (params?: HTMLElement | Element | (() => HTMLElement | Element)) => Element | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>typeof t=="function"?t==null?void 0:t():t;exports.getContainerDom=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lodash-unified"),a=require("./index.js");function u(e,n){var t,r;return e!=null&&e.parentElement?e.parentElement.classList.contains(n)?(t=e.parentElement)!=null&&t.parentElement?(r=e.parentElement.parentElement.className)==null?void 0:r.includes("basic-table"):!1:u(e.parentElement,n):!1}const f=e=>{var n,t;return u(e,"ant-form")?(e==null?void 0:e.parentNode)||((n=a.getTopWindow().document)==null?void 0:n.body):(t=a.getTopWindow().document)==null?void 0:t.body},c=({text:e})=>{const n=t=>t==null||t==="";return Array.isArray(e)?n(e[0])?"--":e[0]:n(e)?"--":e},d=!1,s={getPopupContainer:f,transformCellText:c,autoInsertSpaceInButton:d};function l(e){const n={...e},t=Object.keys(s);for(const r of t)i.isUndefined(n[r])&&(n[r]=s[r]);return n}function m(e,n){const t={...n},r=Object.keys(e);for(const o of r)i.isUndefined(e[o])||(t[o]=e[o]);return t}exports.antdConfigProviderPresets=s;exports.autoInsertSpaceInButton=d;exports.getPopupContainer=f;exports.mergeAntdProvideConfig=l;exports.mergeAntdProviderConfigWithCache=m;exports.transformCellText=c;
|
package/lib/src/utils/index.d.ts
CHANGED
package/lib/src/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),f=require("lodash-unified"),l=require("@vueuse/core");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),f=require("lodash-unified"),l=require("@vueuse/core");function d(e){return(e==null?void 0:e.parentNode)??document.body}function a(e){return typeof e<"u"}function y(e){const t={};return Object.keys(e).map(n=>{t[n]=s.unref(e[n])}),t}function p(e,t=[],n){const o=Object.assign({},e),u=Object.keys(o);for(let r=0;r<u.length;r+=1){const i=u[r];(t.includes(i)||n!=null&&n(i,o[i]))&&delete o[i]}return o}function g(e){return/^[A-Z][A-Za-z]*$/.test(e)}function c(e){if(Array.isArray(e))return e.map(t=>c(t));if(typeof e=="object"&&e!==null){const t={};for(const n in e)t[n]=c(e[n]);return s.markRaw(t)}return e}function w(e){const t={...e};for(const n of Object.keys(t))f.isUndefined(t[n])&&delete t[n];return t}function m(e,...t){return typeof e=="function"?e(...t):e}function h(){const e="history";return typeof window>"u"?e:window.location.href.includes("#/")?"hash":e}function v(){if(!l.isClient)return 15;const e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.overflow="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetHeight-e.clientHeight;return document.body.removeChild(e),t}function b(){return(window.top!==window?window.top:window)??window}exports.convertReactiveToRaw=c;exports.getDynamicProps=y;exports.getPopupContainer=d;exports.getRouteType=h;exports.getScrollbarSize=v;exports.getTopWindow=b;exports.isDef=a;exports.isPascalCase=g;exports.omitUndefined=w;exports.omitWhen=p;exports.runFunction=m;
|