@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.
@@ -1,9 +1,16 @@
1
1
  import { Modal as _Modal } from '@aplus-frontend/antdv';
2
- import { CreateModalFunc, CreateModalStreamFunc } from './interface';
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 r } from "@aplus-frontend/antdv";
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 a } from "./utils/createModal.mjs";
5
- import { createModalStream as t } from "./utils/createModalStream.mjs";
6
- const o = r;
7
- o.createModal = a;
8
- o.createModalStream = t;
9
- o.name = "ApModal";
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
- o as ApModal
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 u, defineComponent as x, createVNode as h, mergeProps as k, h as v } from "vue";
2
- import { Modal as b } from "@aplus-frontend/antdv";
3
- import { ConfigProvider as P, globalConfigCached as N } from "../../config-provider/config-provider.mjs";
4
- import { omit as L } from "lodash-unified";
5
- import { isNumeric as E } from "@aplus-frontend/utils";
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 { useNamespace as H } from "../../config-provider/hooks/use-namespace.mjs";
8
- const z = (d) => {
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: c = !0,
14
+ destroyOnClose: d = !0,
12
15
  wrapperOffset: r = !1
13
- } = d, {
14
- b: l
15
- } = H("ap-modal");
16
- function m() {
16
+ } = c, {
17
+ b: m
18
+ } = W("ap-modal");
19
+ function l() {
17
20
  n && n(!1), setTimeout(() => {
18
21
  var e;
19
- u(null, s), (e = s.parentElement) == null || e.removeChild(s);
22
+ g(null, s), (e = s.parentElement) == null || e.removeChild(s);
20
23
  }, 500);
21
24
  }
22
- function C() {
25
+ function y() {
23
26
  n && n(!0);
24
27
  }
25
28
  function f() {
26
29
  n && n(!1);
27
30
  }
28
- function g(e) {
31
+ function v(e) {
29
32
  t && t(e);
30
33
  }
31
- const O = /* @__PURE__ */ x({
34
+ const x = /* @__PURE__ */ L({
32
35
  data() {
33
36
  return {
34
- open: c,
35
- props: d
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, p, i;
53
+ var e, o, a, i, p;
51
54
  if ((e = this.props) != null && e.onCancel) {
52
- const w = ((p = (a = (o = this.props) == null ? void 0 : o.content) == null ? void 0 : a.component) == null ? void 0 : p.exposed) ?? void 0;
53
- await ((i = this.props) == null ? void 0 : i.onCancel(w));
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
- c ? m() : f();
58
+ d ? l() : f();
56
59
  },
57
60
  async handleOk() {
58
- var e, o, a, p;
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 i = ((p = (a = (o = this.props) == null ? void 0 : o.content) == null ? void 0 : a.component) == null ? void 0 : p.exposed) ?? void 0;
64
- await this.props.onOk(i);
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
- }), c ? m() : f();
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 = L(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon"]);
78
- return h(P, N.value, {
79
- default: () => [h(b, k({
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
- [l()]: !0,
82
- [l("wrapper")]: r
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 [h("div", {
93
+ return [u("div", {
91
94
  class: {
92
- [l("body-wrapper")]: r
95
+ [m("body-wrapper")]: r
93
96
  },
94
97
  style: r === !1 ? {} : {
95
- maxHeight: `${window.innerHeight - (r === !0 ? 100 : E(r) ? Number(r) : 100) * 2}px`
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
- }), y = d.getContainer || document.body, s = document.createElement("div");
103
- return y.appendChild(s), u(v(O), s), {
104
- destroy: m,
105
- update: g,
106
- open: C,
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
- z as createModal
114
+ J as createModal
112
115
  };
@@ -1,2 +1,3 @@
1
1
  export * from './createModal';
2
2
  export * from './createModalStream';
3
+ export * from './methods';
@@ -1,6 +1,8 @@
1
- import { createModal as o } from "./createModal.mjs";
2
- import { createModalStream as t } from "./createModalStream.mjs";
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
- o as createModal,
5
- t as createModalStream
5
+ r as createModal,
6
+ a as createModalStream,
7
+ d as methodsFn
6
8
  };
@@ -0,0 +1,3 @@
1
+ import { ModalFunc } from '@aplus-frontend/antdv/es/modal/confirm';
2
+ import { ApModalType } from '../interface';
3
+ export declare const methodsFn: (modalType: ApModalType) => ModalFunc;
@@ -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;
@@ -0,0 +1,4 @@
1
+ const n = (t) => typeof t == "function" ? t == null ? void 0 : t() : t;
2
+ export {
3
+ n as getContainerDom
4
+ };
@@ -1,39 +1,43 @@
1
- import { isUndefined as a } from "lodash-unified";
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 f = (e) => u(e, "ant-form") && (e == null ? void 0 : e.parentNode) || (document == null ? void 0 : document.body), c = ({ text: e }) => {
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
- }, i = !1, s = {
10
- getPopupContainer: f,
11
- transformCellText: c,
12
- autoInsertSpaceInButton: i
13
+ }, c = !1, a = {
14
+ getPopupContainer: i,
15
+ transformCellText: m,
16
+ autoInsertSpaceInButton: c
13
17
  };
14
- function l(e) {
18
+ function y(e) {
15
19
  const n = {
16
20
  ...e
17
21
  }, t = Object.keys(
18
- s
22
+ a
19
23
  );
20
24
  for (const r of t)
21
- a(n[r]) && (n[r] = s[r]);
25
+ f(n[r]) && (n[r] = a[r]);
22
26
  return n;
23
27
  }
24
- function p(e, n) {
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
- a(e[o]) || (t[o] = e[o]);
33
+ f(e[o]) || (t[o] = e[o]);
30
34
  return t;
31
35
  }
32
36
  export {
33
- s as antdConfigProviderPresets,
34
- i as autoInsertSpaceInButton,
35
- f as getPopupContainer,
36
- l as mergeAntdProvideConfig,
37
- p as mergeAntdProviderConfigWithCache,
38
- c as transformCellText
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
  };
@@ -40,3 +40,4 @@ export declare function runFunction<T extends any[]>(func: any, ...restParams: T
40
40
  */
41
41
  export declare function getRouteType(): "history" | "hash";
42
42
  export declare function getScrollbarSize(): number;
43
+ export declare function getTopWindow(): Window;
@@ -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 a } from "@vueuse/core";
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 g(t) {
7
+ function w(t) {
8
8
  return typeof t < "u";
9
9
  }
10
- function h(t) {
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 v(t, e = [], n) {
16
+ function h(t, e = [], n) {
17
17
  const o = Object.assign({}, t), c = Object.keys(o);
18
- for (let i = 0; i < c.length; i += 1) {
19
- const r = c[i];
20
- (e.includes(r) || n != null && n(r, o[r])) && delete o[r];
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 b(t) {
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 k(t) {
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 x(t, ...e) {
44
+ function k(t, ...e) {
45
45
  return typeof t == "function" ? t(...e) : t;
46
46
  }
47
- function C() {
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 R() {
52
- if (!a)
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
- h as getDynamicProps,
64
+ g as getDynamicProps,
62
65
  m as getPopupContainer,
63
- C as getRouteType,
64
- R as getScrollbarSize,
65
- g as isDef,
66
- b as isPascalCase,
67
- k as omitUndefined,
68
- v as omitWhen,
69
- x as runFunction
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 { CreateModalFunc, CreateModalStreamFunc } from './interface';
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 a=require("@aplus-frontend/antdv");require("./utils/index.js");require("./interface.js");const r=require("./utils/createModal.js"),t=require("./utils/createModalStream.js"),e=a.Modal;e.createModal=r.createModal;e.createModalStream=t.createModalStream;e.name="ApModal";exports.ApModal=e;
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"),b=require("@aplus-frontend/antdv"),m=require("../../config-provider/config-provider.js"),q=require("lodash-unified"),w=require("@aplus-frontend/utils");require("../../config-provider/index.js");const N=require("../../config-provider/hooks/use-namespace.js"),P=p=>{let t,r;const{destroyOnClose:l=!0,wrapperOffset:s=!1}=p,{b:u}=N.useNamespace("ap-modal");function f(){t&&t(!1),setTimeout(()=>{var e;o.render(null,a),(e=a.parentElement)==null||e.removeChild(a)},500)}function C(){t&&t(!0)}function h(){t&&t(!1)}function g(e){r&&r(e)}const v=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 O=((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(O))}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=q.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon"]);return o.createVNode(m.ConfigProvider,m.globalConfigCached.value,{default:()=>[o.createVNode(b.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:w.isNumeric(s)?Number(s):100)*2}px`}},[(n=this.props)==null?void 0:n.content])]}})]})}}),y=p.getContainer||document.body,a=document.createElement("div");return y.appendChild(a),o.render(o.h(v),a),{destroy:f,update:g,open:C,close:h}};exports.createModal=P;
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,2 +1,3 @@
1
1
  export * from './createModal';
2
2
  export * from './createModalStream';
3
+ export * from './methods';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./createModal.js"),a=require("./createModalStream.js");exports.createModal=e.createModal;exports.createModalStream=a.createModalStream;
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,3 @@
1
+ import { ModalFunc } from '@aplus-frontend/antdv/es/modal/confirm';
2
+ import { ApModalType } from '../interface';
3
+ export declare const methodsFn: (modalType: ApModalType) => ModalFunc;
@@ -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 a=require("lodash-unified");function i(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:i(e.parentElement,n):!1}const u=e=>i(e,"ant-form")&&(e==null?void 0:e.parentNode)||(document==null?void 0:document.body),f=({text:e})=>{const n=t=>t==null||t==="";return Array.isArray(e)?n(e[0])?"--":e[0]:n(e)?"--":e},c=!1,s={getPopupContainer:u,transformCellText:f,autoInsertSpaceInButton:c};function l(e){const n={...e},t=Object.keys(s);for(const r of t)a.isUndefined(n[r])&&(n[r]=s[r]);return n}function d(e,n){const t={...n},r=Object.keys(e);for(const o of r)a.isUndefined(e[o])||(t[o]=e[o]);return t}exports.antdConfigProviderPresets=s;exports.autoInsertSpaceInButton=c;exports.getPopupContainer=u;exports.mergeAntdProvideConfig=l;exports.mergeAntdProviderConfigWithCache=d;exports.transformCellText=f;
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;
@@ -40,3 +40,4 @@ export declare function runFunction<T extends any[]>(func: any, ...restParams: T
40
40
  */
41
41
  export declare function getRouteType(): "history" | "hash";
42
42
  export declare function getScrollbarSize(): number;
43
+ export declare function getTopWindow(): Window;
@@ -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 a(e){return(e==null?void 0:e.parentNode)??document.body}function d(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 m(e){const t={...e};for(const n of Object.keys(t))f.isUndefined(t[n])&&delete t[n];return t}function h(e,...t){return typeof e=="function"?e(...t):e}function v(){const e="history";return typeof window>"u"?e:window.location.href.includes("#/")?"hash":e}function b(){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}exports.convertReactiveToRaw=c;exports.getDynamicProps=y;exports.getPopupContainer=a;exports.getRouteType=v;exports.getScrollbarSize=b;exports.isDef=d;exports.isPascalCase=g;exports.omitUndefined=m;exports.omitWhen=p;exports.runFunction=h;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [