@aplus-frontend/ui 6.32.0 → 6.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/es/index.mjs +39 -37
  2. package/es/src/ag-grid/editable/form-item.vue.d.ts +16 -0
  3. package/es/src/ag-grid/editable/form-item.vue.mjs +215 -0
  4. package/es/src/ag-grid/editable/form-item.vue2.mjs +4 -0
  5. package/es/src/ag-grid/hooks/use-editable-api.mjs +39 -39
  6. package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +2 -1
  7. package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +174 -0
  8. package/es/src/ag-grid/index.d.ts +2 -1
  9. package/es/src/ag-grid/index.mjs +1 -0
  10. package/es/src/ap-drawer/interface.d.ts +5 -0
  11. package/es/src/ap-drawer/utils/createDrawer.mjs +22 -19
  12. package/es/src/ap-modal/index.d.ts +1 -0
  13. package/es/src/ap-modal/index.mjs +29 -27
  14. package/es/src/ap-modal/interface.d.ts +5 -0
  15. package/es/src/ap-modal/utils/confirm.mjs +35 -34
  16. package/es/src/ap-modal/utils/createModal.mjs +39 -37
  17. package/es/src/ap-modal/utils/util.d.ts +3 -0
  18. package/es/src/ap-modal/utils/util.mjs +8 -2
  19. package/es/src/business/ap-view/ap-view.vue2.mjs +20 -18
  20. package/es/src/business/ap-view/interface.d.ts +4 -0
  21. package/es/src/config-provider/config-provider.mjs +32 -24
  22. package/es/src/index.mjs +15 -13
  23. package/es/src/version.d.ts +1 -1
  24. package/es/src/version.mjs +1 -1
  25. package/lib/index.js +1 -1
  26. package/lib/src/ag-grid/editable/form-item.vue.d.ts +16 -0
  27. package/lib/src/ag-grid/editable/form-item.vue.js +1 -0
  28. package/lib/src/ag-grid/editable/form-item.vue2.js +1 -0
  29. package/lib/src/ag-grid/hooks/use-editable-api.js +1 -1
  30. package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +2 -1
  31. package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -0
  32. package/lib/src/ag-grid/index.d.ts +2 -1
  33. package/lib/src/ag-grid/index.js +1 -1
  34. package/lib/src/ap-drawer/interface.d.ts +5 -0
  35. package/lib/src/ap-drawer/utils/createDrawer.js +1 -1
  36. package/lib/src/ap-modal/index.d.ts +1 -0
  37. package/lib/src/ap-modal/index.js +1 -1
  38. package/lib/src/ap-modal/interface.d.ts +5 -0
  39. package/lib/src/ap-modal/utils/confirm.js +1 -1
  40. package/lib/src/ap-modal/utils/createModal.js +1 -1
  41. package/lib/src/ap-modal/utils/util.d.ts +3 -0
  42. package/lib/src/ap-modal/utils/util.js +1 -1
  43. package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
  44. package/lib/src/business/ap-view/interface.d.ts +4 -0
  45. package/lib/src/config-provider/config-provider.js +1 -1
  46. package/lib/src/index.js +1 -1
  47. package/lib/src/version.d.ts +1 -1
  48. package/lib/src/version.js +1 -1
  49. package/package.json +1 -1
  50. package/theme/ag-grid/index.css +2 -1
  51. package/theme/ag-grid/index.less +1 -0
  52. package/theme/ap-form/ap-form-item.css +1 -1
  53. package/theme/ap-form/ap-form-item.less +1 -1
  54. package/theme/ap-form/index.css +1 -1
  55. package/theme/ap-form/search-form.css +1 -1
  56. package/theme/ap-grid/index.css +1 -1
  57. package/theme/ap-table/ap-table.css +1 -1
  58. package/theme/ap-table-modal/index.css +1 -1
  59. package/theme/css-var.css +2 -0
  60. package/theme/css-var.less +4 -0
  61. package/theme/editable-table/index.css +1 -1
  62. package/theme/index.css +4 -1
@@ -0,0 +1,174 @@
1
+ import { shallowRef as E, unref as d } from "vue";
2
+ import { isDef as F } from "../../utils/index.mjs";
3
+ import { isFunction as x, isUndefined as V, isNumber as h, cloneDeep as S, isArray as R } from "lodash-unified";
4
+ import { getRowKey as y, arrayToObject as U } from "../editable/utils.mjs";
5
+ let $ = 0;
6
+ function I() {
7
+ return `_ag_grid${$++}`;
8
+ }
9
+ const J = (l, v, n, w) => {
10
+ const K = E([]);
11
+ function j(s, t) {
12
+ const r = d(n)?.length || 0;
13
+ if (F(l.maxLength) && r >= l.maxLength || !s && x(l.rowKey))
14
+ return;
15
+ const f = {
16
+ ...s || { [l.rowKey]: I() }
17
+ };
18
+ v?.setFieldValue(
19
+ w,
20
+ f,
21
+ !1,
22
+ (i, c) => {
23
+ const e = y(f, void 0, l.rowKey);
24
+ i[c] ? i[c][e] = f : i[c] = { [e]: f }, n.value ? V(t) ? n.value.push(f) : (K.value = n.value.map(
25
+ (u, o) => o < t ? null : y(u, o, l.rowKey)
26
+ ).filter(Boolean), n.value.splice(t, 0, f)) : n.value = [f], v?.setFieldValue(
27
+ l.name,
28
+ f,
29
+ !0,
30
+ (u, o) => {
31
+ if (!u[o]) {
32
+ u[o] = [f];
33
+ return;
34
+ }
35
+ V(t) ? u[o].push(f) : u[o].splice(t, 0, f);
36
+ }
37
+ );
38
+ }
39
+ );
40
+ }
41
+ function k(s, t = "suffix") {
42
+ const r = d(n)?.length || 0, f = h(s) ? s : s.length;
43
+ if (F(l.maxLength) && r + f > l.maxLength || h(s) && x(l.rowKey))
44
+ return;
45
+ const i = h(s) ? new Array(s).fill(0).map(() => ({ [l.rowKey]: I() })) : S(s), c = U(i, l.rowKey);
46
+ v?.setFieldValue(
47
+ w,
48
+ c,
49
+ !1,
50
+ (e, u) => {
51
+ e[u] ? Object.assign(e[u], c) : e[u] = c, n.value ? t === "suffix" ? n.value.push(...i) : (K.value = n.value.map(
52
+ (o, g) => y(o, g, l.rowKey)
53
+ ), n.value.unshift(...i)) : n.value = [...i], v?.setFieldValue(
54
+ l.name,
55
+ i,
56
+ !0,
57
+ (o, g) => {
58
+ if (!o[g]) {
59
+ o[g] = [...i];
60
+ return;
61
+ }
62
+ t === "suffix" ? o[g].push(...i) : o[g].unshift(...i);
63
+ }
64
+ );
65
+ }
66
+ );
67
+ }
68
+ function L(s) {
69
+ const t = R(s) ? s : [s];
70
+ v?.setFieldValue(
71
+ w,
72
+ void 0,
73
+ !1,
74
+ (r, f) => {
75
+ for (const e of t) {
76
+ const u = y(e, void 0, l.rowKey);
77
+ delete r[f][u];
78
+ }
79
+ const i = n.value.filter(
80
+ (e) => !t.includes(e)
81
+ ), c = n.value.findIndex(
82
+ (e) => t.includes(e)
83
+ );
84
+ K.value = n.value.map(
85
+ (e, u) => u <= c ? null : y(e, u, l.rowKey)
86
+ ).filter(Boolean), i.length ? n.value = i : n.value.splice(0, n.value.length), v.setFieldValue(
87
+ l.name,
88
+ void 0,
89
+ !0,
90
+ (e, u) => {
91
+ e[u] = i;
92
+ }
93
+ );
94
+ }
95
+ );
96
+ }
97
+ function O(s) {
98
+ const t = new Set(R(s) ? s : [s]);
99
+ t.size !== 0 && v?.setFieldValue(
100
+ w,
101
+ void 0,
102
+ !1,
103
+ (r, f) => {
104
+ for (const e of t)
105
+ delete r[f][e];
106
+ const i = n.value.filter(
107
+ (e, u) => !t.has(y(e, u, l.rowKey))
108
+ ), c = n.value.findIndex(
109
+ (e, u) => t.has(y(e, u, l.rowKey))
110
+ );
111
+ K.value = n.value.map(
112
+ (e, u) => u <= c ? null : y(e, u, l.rowKey)
113
+ ).filter(Boolean), i.length ? n.value = i : n.value.splice(0, n.value.length), v.setFieldValue(
114
+ l.name,
115
+ void 0,
116
+ !0,
117
+ (e, u) => {
118
+ e[u] = i;
119
+ }
120
+ );
121
+ }
122
+ );
123
+ }
124
+ function T(s) {
125
+ return d(n)?.[s];
126
+ }
127
+ function B() {
128
+ return d(n);
129
+ }
130
+ function _(s, t, r = !0) {
131
+ v?.setFieldValue?.(
132
+ w,
133
+ void 0,
134
+ !1,
135
+ (f, i) => {
136
+ const c = n.value.findIndex(
137
+ (u, o) => s === o
138
+ );
139
+ if (!~c)
140
+ return;
141
+ const e = y(
142
+ n.value[c],
143
+ c,
144
+ l.rowKey
145
+ );
146
+ if (e && !(!f[i] || !f[i][e])) {
147
+ if (!r) {
148
+ const u = Object.keys(f[i][e]);
149
+ for (const o of u)
150
+ o !== l.rowKey && delete f[i][e][o];
151
+ }
152
+ Object.assign(f[i][e], { ...t });
153
+ }
154
+ }
155
+ );
156
+ }
157
+ function z() {
158
+ v?.setFieldValue(w, {}), v?.setFieldValue(l.name, []);
159
+ }
160
+ return {
161
+ add: j,
162
+ addMultiple: k,
163
+ remove: L,
164
+ removeByKey: O,
165
+ getRowData: T,
166
+ getRowsData: B,
167
+ setRowData: _,
168
+ clear: z,
169
+ refreshRowIds: K
170
+ };
171
+ };
172
+ export {
173
+ J as useEditableFormItemApi
174
+ };
@@ -1,5 +1,6 @@
1
1
  import { default as AgGrid } from './index.vue';
2
2
  import { default as EditableAgGrid } from './editable/index.vue';
3
- export { AgGrid, EditableAgGrid };
3
+ import { default as EditableAgGridFormItem } from './editable/form-item.vue';
4
+ export { AgGrid, EditableAgGrid, EditableAgGridFormItem };
4
5
  export * from './interface';
5
6
  export * from './editable/interface';
@@ -1,4 +1,5 @@
1
1
  import "./index.vue2.mjs";
2
2
  import "./editable/index.vue2.mjs";
3
+ import "./editable/form-item.vue2.mjs";
3
4
  import "./interface.mjs";
4
5
  import "./editable/interface.mjs";
@@ -1,4 +1,5 @@
1
1
  import { DrawerProps } from '@aplus-frontend/antdv';
2
+ import { AppContext } from 'vue';
2
3
  export type CreateDrawerFuncProps<ContentRecord = any> = Omit<DrawerProps, 'visible' | 'onUpdate:visible' | 'afterVisibleChange' | 'onAfterVisibleOChange' | 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onClose' | 'getContainer' | 'extra' | 'footer'> & Partial<{
3
4
  onClose: (params: ContentRecord) => any | Promise<any>;
4
5
  getContainer: HTMLElement;
@@ -6,6 +7,10 @@ export type CreateDrawerFuncProps<ContentRecord = any> = Omit<DrawerProps, 'visi
6
7
  destroyOnClose: boolean;
7
8
  extra: (params: ContentRecord, close: () => void) => any;
8
9
  footer: (params: ContentRecord, close: () => void) => any;
10
+ /**
11
+ * 抽屉的上下文,一般用于获取全局注册组件、vuex 等内容
12
+ */
13
+ appContext: AppContext;
9
14
  }>;
10
15
  export type CreateDrawerFuncReturn = {
11
16
  destroy: () => void;
@@ -1,29 +1,30 @@
1
- import { render as c, defineComponent as C, createVNode as a, mergeProps as g, h as x } from "vue";
2
- import { Drawer as v } from "@aplus-frontend/antdv";
3
- import { ConfigProvider as b, globalConfigCached as w } from "../../config-provider/config-provider.mjs";
4
- import { omit as P } from "lodash-unified";
1
+ import { render as m, defineComponent as g, createVNode as l, mergeProps as b, h as v } from "vue";
2
+ import { Drawer as w } from "@aplus-frontend/antdv";
3
+ import { ConfigProvider as P, globalConfigCached as y } from "../../config-provider/config-provider.mjs";
4
+ import { omit as A } from "lodash-unified";
5
5
  import "../components/ApDrawerClose.vue.mjs";
6
- import y from "../components/ApDrawerClose.vue2.mjs";
7
- const _ = (n) => {
6
+ import { getModalGlobalAppContext as D } from "../../ap-modal/utils/util.mjs";
7
+ import O from "../components/ApDrawerClose.vue2.mjs";
8
+ const N = (n) => {
8
9
  let o, s;
9
10
  const {
10
11
  destroyOnClose: r = !0
11
12
  } = n;
12
13
  function p() {
13
14
  o && o(!1), setTimeout(() => {
14
- c(null, t), t.parentElement?.removeChild(t);
15
+ m(null, t), t.parentElement?.removeChild(t);
15
16
  }, 500);
16
17
  }
17
- function h() {
18
+ function f() {
18
19
  o && o(!0);
19
20
  }
20
21
  function i() {
21
22
  o && o(!1);
22
23
  }
23
- function m(e) {
24
+ function h(e) {
24
25
  s && s(e);
25
26
  }
26
- const f = /* @__PURE__ */ C({
27
+ const C = /* @__PURE__ */ g({
27
28
  data() {
28
29
  return {
29
30
  open: r,
@@ -50,29 +51,31 @@ const _ = (n) => {
50
51
  }
51
52
  },
52
53
  render() {
53
- const e = P(this.props, ["onClose", "extra", "footer", "visible", "onUpdate:visible", "afterVisibleChange", "onAfterVisibleOChange", "open", "onUpdate:open", "getContainer"]), l = this.props?.content?.component?.exposed ?? void 0, d = () => r ? p() : i();
54
- return a(b, w.value, {
55
- default: () => [a(v, g({
54
+ const e = A(this.props, ["onClose", "extra", "footer", "visible", "onUpdate:visible", "afterVisibleChange", "onAfterVisibleOChange", "open", "onUpdate:open", "getContainer"]), d = this.props?.content?.component?.exposed ?? void 0, c = () => r ? p() : i();
55
+ return l(P, y.value, {
56
+ default: () => [l(w, b({
56
57
  open: this.open,
57
58
  onClose: this.handleClose,
58
59
  closeIcon: this.props?.closeIcon ?? null,
59
- extra: this.props?.extra ? this.props?.extra?.(l, d) : a(y, {
60
+ extra: this.props?.extra ? this.props?.extra?.(d, c) : l(O, {
60
61
  onClose: this.handleClose
61
62
  }, null),
62
- footer: this.props?.footer?.(l, d)
63
+ footer: this.props?.footer?.(d, c)
63
64
  }, e), {
64
65
  default: () => [this.props?.content]
65
66
  })]
66
67
  });
67
68
  }
68
69
  }), u = n.getContainer || document.body, t = document.createElement("div");
69
- return u.appendChild(t), c(x(f), t), {
70
+ u.appendChild(t);
71
+ const a = v(C), x = D();
72
+ return a.appContext = n.appContext || x || a.appContext, m(a, t), {
70
73
  destroy: p,
71
- update: m,
72
- open: h,
74
+ update: h,
75
+ open: f,
73
76
  close: i
74
77
  };
75
78
  };
76
79
  export {
77
- _ as createDrawer
80
+ N as createDrawer
78
81
  };
@@ -11,6 +11,7 @@ type ApModalMixedProps = Omit<typeof _Modal, ApModalType | 'warn'> & {
11
11
  error: ModalFunc;
12
12
  success: ModalFunc;
13
13
  info: ModalFunc;
14
+ setModalGlobalAppContext: (appContext: any) => void;
14
15
  };
15
16
  declare const ApModal: ApModalMixedProps;
16
17
  export { ApModal };
@@ -1,12 +1,13 @@
1
- import { Modal as c } from "@aplus-frontend/antdv";
1
+ import { Modal as m } from "@aplus-frontend/antdv";
2
2
  import "./utils/index.mjs";
3
- import { omit as m } from "lodash-unified";
4
- import t, { withWarn as f, withInfo as a, withSuccess as s, withError as l, withConfirm as u } from "./utils/confirm.mjs";
5
- import i from "./utils/destroyFns.mjs";
3
+ import { omit as a } from "lodash-unified";
4
+ import t, { withWarn as c, withInfo as f, withSuccess as l, withError as s, withConfirm as p } from "./utils/confirm.mjs";
5
+ import e from "./utils/destroyFns.mjs";
6
+ import { setModalGlobalAppContext as u } from "./utils/util.mjs";
6
7
  import "./interface.mjs";
7
- import { createModal as p } from "./utils/createModal.mjs";
8
- import { createModalStream as d } from "./utils/createModalStream.mjs";
9
- const o = m(c, [
8
+ import { createModal as d } from "./utils/createModal.mjs";
9
+ import { createModalStream as w } from "./utils/createModalStream.mjs";
10
+ const r = a(m, [
10
11
  "confirm",
11
12
  "warning",
12
13
  "warn",
@@ -14,32 +15,33 @@ const o = m(c, [
14
15
  "success",
15
16
  "info"
16
17
  ]);
17
- o.createModal = p;
18
- o.createModalStream = d;
19
- function e(n) {
20
- return t(f(n));
18
+ r.createModal = d;
19
+ r.createModalStream = w;
20
+ function i(n) {
21
+ return t(c(n));
21
22
  }
22
- o.info = function(r) {
23
- return t(a(r));
23
+ r.info = function(o) {
24
+ return t(f(o));
24
25
  };
25
- o.success = function(r) {
26
- return t(s(r));
26
+ r.success = function(o) {
27
+ return t(l(o));
27
28
  };
28
- o.error = function(r) {
29
- return t(l(r));
29
+ r.error = function(o) {
30
+ return t(s(o));
30
31
  };
31
- o.warning = e;
32
- o.warn = e;
33
- o.confirm = function(r) {
34
- return t(u(r));
32
+ r.warning = i;
33
+ r.warn = i;
34
+ r.confirm = function(o) {
35
+ return t(p(o));
35
36
  };
36
- o.destroyAll = function() {
37
- for (; i.length; ) {
38
- const r = i.pop();
39
- r && r();
37
+ r.destroyAll = function() {
38
+ for (; e.length; ) {
39
+ const o = e.pop();
40
+ o && o();
40
41
  }
41
42
  };
42
- o.name = "ApModal";
43
+ r.setModalGlobalAppContext = u;
44
+ r.name = "ApModal";
43
45
  export {
44
- o as ApModal
46
+ r as ApModal
45
47
  };
@@ -1,5 +1,6 @@
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';
3
4
  export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open' | 'onUpdate:open' | 'destroyOnClose' | 'onCancel' | 'onOk' | 'getContainer' | 'icon'> & Partial<{
4
5
  /**
5
6
  * 点击取消回调
@@ -29,6 +30,10 @@ export type CreateModalFuncProps<ContentRecord = any> = Omit<ModalProps, 'open'
29
30
  * 自适应高度
30
31
  */
31
32
  wrapperOffset: boolean | number;
33
+ /**
34
+ * 弹窗的上下文,一般用于获取全局注册组件、vuex 等内容
35
+ */
36
+ appContext: AppContext;
32
37
  }>;
33
38
  export type CreateModalFuncReturn = {
34
39
  /**
@@ -1,76 +1,77 @@
1
- import { render as s, cloneVNode as h, createVNode as a, mergeProps as m } from "vue";
2
- import P from "@aplus-frontend/antdv/es/modal/ConfirmDialog";
3
- import { omit as b } from "lodash-unified";
1
+ import { render as s, cloneVNode as h, createVNode as p, mergeProps as m } from "vue";
2
+ import b from "@aplus-frontend/antdv/es/modal/ConfirmDialog";
3
+ import { omit as P } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
5
  import { getConfirmLocale as w } from "@aplus-frontend/antdv/es/modal/locale";
6
6
  import { globalConfigForApi as v } from "@aplus-frontend/antdv/es/config-provider";
7
7
  import c from "./destroyFns.mjs";
8
+ import { getModalGlobalAppContext as A } from "./util.mjs";
8
9
  import { globalConfigCached as D, ConfigProvider as F } from "../../config-provider/config-provider.mjs";
9
- const A = (e) => {
10
+ const G = (e) => {
10
11
  const f = document.createDocumentFragment();
11
12
  let n = {
12
- ...b(e, ["parentContext", "appContext"]),
13
+ ...P(e, ["parentContext", "appContext"]),
13
14
  close: l,
14
15
  open: !0,
15
16
  centered: !0
16
17
  }, i = null;
17
- function x(...t) {
18
+ function x(...o) {
18
19
  i && (s(null, f), i = null);
19
- const r = t.some((o) => o && o.triggerCancel);
20
+ const r = o.some((t) => t && t.triggerCancel);
20
21
  e.onCancel && r && e.onCancel(() => {
21
- }, ...t.slice(1));
22
- for (let o = 0; o < c.length; o++)
23
- if (c[o] === l) {
24
- c.splice(o, 1);
22
+ }, ...o.slice(1));
23
+ for (let t = 0; t < c.length; t++)
24
+ if (c[t] === l) {
25
+ c.splice(t, 1);
25
26
  break;
26
27
  }
27
28
  }
28
- function l(...t) {
29
+ function l(...o) {
29
30
  n = {
30
31
  ...n,
31
32
  open: !1,
32
33
  afterClose: () => {
33
- typeof e.afterClose == "function" && e.afterClose(), x.apply(this, t);
34
+ typeof e.afterClose == "function" && e.afterClose(), x.apply(this, o);
34
35
  }
35
- }, n.visible && delete n.visible, p(n);
36
+ }, n.visible && delete n.visible, a(n);
36
37
  }
37
- function p(t) {
38
- typeof t == "function" ? n = t(n) : n = {
38
+ function a(o) {
39
+ typeof o == "function" ? n = o(n) : n = {
39
40
  ...n,
40
- ...t
41
+ ...o
41
42
  }, i && s(h(i, {
42
43
  ...n
43
44
  }), f);
44
45
  }
45
- const d = (t) => {
46
+ const d = (o) => {
46
47
  const r = {
47
48
  ...v,
48
49
  ...D.value
49
- }, o = r.prefixCls, u = t.prefixCls || `${o}-modal`, g = r.iconPrefixCls, C = w();
50
- return a(F, m(r, {
51
- prefixCls: o
50
+ }, t = r.prefixCls, u = o.prefixCls || `${t}-modal`, y = r.iconPrefixCls, C = w();
51
+ return p(F, m(r, {
52
+ prefixCls: t
52
53
  }), {
53
- default: () => [a(P, m(t, {
54
- rootPrefixCls: o,
54
+ default: () => [p(b, m(o, {
55
+ rootPrefixCls: t,
55
56
  prefixCls: u,
56
- iconPrefixCls: g,
57
+ iconPrefixCls: y,
57
58
  locale: C,
58
- cancelText: t.cancelText || C.cancelText
59
+ cancelText: o.cancelText || C.cancelText
59
60
  }), null)]
60
61
  });
61
62
  };
62
- function y(t) {
63
- const r = a(d, {
64
- ...t
63
+ function g(o) {
64
+ const r = A(), t = p(d, {
65
+ ...o
65
66
  });
66
- return r.appContext = e.parentContext || e.appContext || r.appContext, s(r, f), r;
67
+ return t.appContext = e.appContext || r || t.appContext, s(t, f), t;
67
68
  }
68
- return i = y(n), c.push(l), {
69
+ return i = g(n), c.push(l), {
69
70
  destroy: l,
70
- update: p
71
+ update: a
71
72
  };
72
73
  };
73
- function E(e) {
74
+ function M(e) {
74
75
  return {
75
76
  ...e,
76
77
  type: "warning"
@@ -101,10 +102,10 @@ function z(e) {
101
102
  };
102
103
  }
103
104
  export {
104
- A as default,
105
+ G as default,
105
106
  z as withConfirm,
106
107
  q as withError,
107
108
  S as withInfo,
108
109
  j as withSuccess,
109
- E as withWarn
110
+ M as withWarn
110
111
  };
@@ -1,45 +1,45 @@
1
- import { render as m, defineComponent as y, createVNode as d, mergeProps as x, h as k } from "vue";
2
- import { Modal as w } from "@aplus-frontend/antdv";
3
- import { ConfigProvider as P, globalConfigCached as l } from "../../config-provider/config-provider.mjs";
4
- import { omit as b } from "lodash-unified";
5
- import { isNumeric as N } from "@aplus-frontend/utils";
1
+ import { render as m, defineComponent as b, createVNode as l, mergeProps as k, h as w } from "vue";
2
+ import { Modal as P } from "@aplus-frontend/antdv";
3
+ import { ConfigProvider as N, globalConfigCached as f } from "../../config-provider/config-provider.mjs";
4
+ import { omit as L } from "lodash-unified";
5
+ import { isNumeric as M } from "@aplus-frontend/utils";
6
6
  import "../../config-provider/index.mjs";
7
- import { getContainerDom as f } from "./util.mjs";
8
- import { getTopWindow as L } from "../../utils/index.mjs";
9
- import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
10
- const q = (s) => {
11
- let o, n;
7
+ import { getContainerDom as u, getModalGlobalAppContext as A } from "./util.mjs";
8
+ import { getTopWindow as E } from "../../utils/index.mjs";
9
+ import { useNamespace as T } from "../../config-provider/hooks/use-namespace.mjs";
10
+ const z = (p) => {
11
+ let o, t;
12
12
  const {
13
13
  destroyOnClose: a = !0,
14
- wrapperOffset: t = !1
15
- } = s, {
16
- b: p
17
- } = E("ap-modal");
14
+ wrapperOffset: n = !1
15
+ } = p, {
16
+ b: s
17
+ } = T("ap-modal");
18
18
  function i() {
19
19
  o && o(!1), setTimeout(() => {
20
20
  m(null, r), r.parentElement?.removeChild(r);
21
21
  }, 500);
22
22
  }
23
- function u() {
23
+ function h() {
24
24
  o && o(!0);
25
25
  }
26
26
  function c() {
27
27
  o && o(!1);
28
28
  }
29
- function h(e) {
30
- n && n(e);
29
+ function C(e) {
30
+ t && t(e);
31
31
  }
32
- const C = /* @__PURE__ */ y({
32
+ const g = /* @__PURE__ */ b({
33
33
  data() {
34
34
  return {
35
35
  open: a,
36
- props: s
36
+ props: p
37
37
  };
38
38
  },
39
39
  created() {
40
40
  o = (e) => {
41
41
  this.open = e;
42
- }, n = (e) => {
42
+ }, t = (e) => {
43
43
  this.props = {
44
44
  ...this.props,
45
45
  ...e
@@ -56,54 +56,56 @@ const q = (s) => {
56
56
  },
57
57
  async handleOk() {
58
58
  try {
59
- if (n({
59
+ if (t({
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
- n({
65
+ t({
66
66
  confirmLoading: !1
67
67
  }), a ? i() : c();
68
68
  } catch {
69
- n({
69
+ t({
70
70
  confirmLoading: !1
71
71
  });
72
72
  }
73
73
  }
74
74
  },
75
75
  render() {
76
- const e = b(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon"]);
77
- return d(P, l.value, {
78
- default: () => [d(w, x({
76
+ const e = L(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon"]);
77
+ return l(N, f.value, {
78
+ default: () => [l(P, k({
79
79
  class: {
80
- [p()]: !0,
81
- [p("wrapper")]: t
80
+ [s()]: !0,
81
+ [s("wrapper")]: n
82
82
  },
83
83
  open: this.open,
84
84
  onCancel: this.handleCancel,
85
85
  onOk: this.handleOk,
86
86
  centered: !0
87
87
  }, e), {
88
- default: () => [d("div", {
88
+ default: () => [l("div", {
89
89
  class: {
90
- [p("body-wrapper")]: t
90
+ [s("body-wrapper")]: n
91
91
  },
92
- style: t === !1 ? {} : {
93
- maxHeight: `calc(100vh - ${(t === !0 ? 100 : N(t) ? Number(t) : 100) * 2}px)`
92
+ style: n === !1 ? {} : {
93
+ maxHeight: `calc(100vh - ${(n === !0 ? 100 : M(n) ? Number(n) : 100) * 2}px)`
94
94
  }
95
95
  }, [this.props?.content])]
96
96
  })]
97
97
  });
98
98
  }
99
- }), g = f(l?.value?.getPopupContainer), O = f(s.getContainer), v = g || O || L().document.body, r = document.createElement("div");
100
- return v.appendChild(r), m(k(C), r), {
99
+ }), x = u(f?.value?.getPopupContainer), v = u(p.getContainer), O = x || v || E().document.body, r = document.createElement("div");
100
+ O.appendChild(r);
101
+ const d = w(g), y = A();
102
+ return d.appContext = p.appContext || y || d.appContext, m(d, r), {
101
103
  destroy: i,
102
- update: h,
103
- open: u,
104
+ update: C,
105
+ open: h,
104
106
  close: c
105
107
  };
106
108
  };
107
109
  export {
108
- q as createModal
110
+ z as createModal
109
111
  };
@@ -1 +1,4 @@
1
+ import { AppContext } from 'vue';
1
2
  export declare const getContainerDom: (params?: HTMLElement | Element | (() => HTMLElement | Element)) => Element | undefined;
3
+ export declare const setModalGlobalAppContext: (appContext: AppContext) => void;
4
+ export declare const getModalGlobalAppContext: () => AppContext;
@@ -1,4 +1,10 @@
1
- const n = (t) => typeof t == "function" ? t?.() : t;
1
+ const e = (t) => typeof t == "function" ? t?.() : t;
2
+ let o;
3
+ const n = (t) => {
4
+ o = t;
5
+ }, l = () => o;
2
6
  export {
3
- n as getContainerDom
7
+ e as getContainerDom,
8
+ l as getModalGlobalAppContext,
9
+ n as setModalGlobalAppContext
4
10
  };