@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.
Files changed (31) hide show
  1. package/es/src/ag-grid/hooks/use-columns-def.mjs +71 -70
  2. package/es/src/ag-grid/index.vue.mjs +1 -0
  3. package/es/src/ag-grid/interface.d.ts +1 -0
  4. package/es/src/ap-download/ap-download.vue.d.ts +4 -4
  5. package/es/src/ap-download/ap-download.vue.mjs +29 -29
  6. package/es/src/ap-download/interface.d.ts +4 -0
  7. package/es/src/ap-modal/interface.d.ts +31 -11
  8. package/es/src/ap-modal/utils/createModal.mjs +52 -45
  9. package/es/src/business/ap-attachment/ApAttachment.mjs +53 -49
  10. package/es/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -2
  11. package/es/src/business/ap-expand-alert/ApExpandAlert.vue2.mjs +56 -48
  12. package/es/src/business/ap-expand-alert/index.d.ts +5 -2
  13. package/es/src/business/ap-expand-alert/interface.d.ts +1 -1
  14. package/es/src/version.d.ts +1 -1
  15. package/es/src/version.mjs +1 -1
  16. package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
  17. package/lib/src/ag-grid/index.vue.js +1 -1
  18. package/lib/src/ag-grid/interface.d.ts +1 -0
  19. package/lib/src/ap-download/ap-download.vue.d.ts +4 -4
  20. package/lib/src/ap-download/ap-download.vue.js +1 -1
  21. package/lib/src/ap-download/interface.d.ts +4 -0
  22. package/lib/src/ap-modal/interface.d.ts +31 -11
  23. package/lib/src/ap-modal/utils/createModal.js +1 -1
  24. package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
  25. package/lib/src/business/ap-expand-alert/ApExpandAlert.vue.d.ts +3 -2
  26. package/lib/src/business/ap-expand-alert/ApExpandAlert.vue2.js +1 -1
  27. package/lib/src/business/ap-expand-alert/index.d.ts +5 -2
  28. package/lib/src/business/ap-expand-alert/interface.d.ts +1 -1
  29. package/lib/src/version.d.ts +1 -1
  30. package/lib/src/version.js +1 -1
  31. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { getTableRenderProps as y, objectToString as P } from "../../ap-table/utils.mjs";
2
- import { rendererMap as h } from "../renderer/index.mjs";
3
- import { isNumber as f, isFunction as m } from "lodash-unified";
4
- import { ref as R, unref as x, computed as T } from "vue";
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 v from "../components/header-cell/index.vue2.mjs";
15
+ import h from "../components/header-cell/index.vue2.mjs";
16
16
  function F(t) {
17
- return f(t) && t > 1;
17
+ return u(t) && t > 1;
18
18
  }
19
- function M(t, o) {
20
- if (o.bodyCellTooltip)
21
- return m(o.bodyCellTooltip) ? o.bodyCellTooltip(t.value, t.data) : o.bodyCellTooltip;
22
- if (o.renderText)
23
- return o.renderText({
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: o,
26
+ column: a,
27
27
  text: t.value
28
28
  });
29
- const n = o.valueType || "text", d = h[n];
30
- if (d) {
31
- const p = y(
32
- { ...o, valueType: n },
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 d(p);
42
+ return p(f);
43
43
  }
44
- return P(t.value);
44
+ return D(t.value);
45
45
  }
46
- const X = (t, o, n) => {
47
- const d = _("valueTypeMap"), u = R(), { em: p } = G("ag-grid"), c = (r) => {
48
- const a = {
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: x(d),
53
- rowKey: o.rowKey
52
+ extraValueType: v(p),
53
+ rowKey: a.rowKey
54
54
  }
55
55
  };
56
56
  if (r.customRender)
57
- return a;
57
+ return i;
58
58
  if (r.renderText)
59
59
  return {
60
- valueFormatter: (i) => r.renderText({
61
- value: i.value,
62
- record: i.data,
60
+ valueFormatter: (o) => r.renderText({
61
+ value: o.value,
62
+ record: o.data,
63
63
  column: r,
64
- text: i.value
64
+ text: o.value
65
65
  })
66
66
  };
67
- const l = r.valueType || "text", e = h[l];
67
+ const s = r.valueType || "text", e = x[s];
68
68
  return e ? {
69
- valueFormatter: (i) => {
70
- const s = y(
71
- { ...r, valueType: l },
69
+ valueFormatter: (o) => {
70
+ const l = c(
71
+ { ...r, valueType: s },
72
72
  {
73
- value: i.value,
74
- text: i.value,
75
- record: i.data,
76
- column: i.column,
77
- rowIndex: i.node?.rowIndex,
78
- pinned: i.node?.rowPinned
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(s);
81
+ return e(l);
82
82
  }
83
- } : a;
84
- }, b = (r) => {
85
- const a = {}, l = r.bodyCellTooltip || !r.customRender && (r.ellipsis === !0 || r.ellipsis === "tooltip" || f(r.ellipsis)), e = f(r.ellipsis) && r.ellipsis > 1, i = f(r.ellipsis) ? r.ellipsis : 1;
86
- return a.tooltipValueGetter = l ? (s) => M(s, r) : void 0, a.wrapText = !r.ellipsis || e, a.cellStyle = {
87
- "--ag-grid-line-clamp": i
88
- }, a.tooltipComponent = z, a.tooltipComponentParams = {
89
- lineClamp: i,
90
- gridWrapperRef: u
91
- }, a;
92
- }, g = T(() => {
93
- const r = x(t);
94
- function a(l) {
95
- return l.map((e) => {
96
- const i = {
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
- cellClass: n((s) => {
114
- const C = e.cellClass || "", D = m(C) ? C(s.data, s.node) : C;
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
- `${p("cell", e.align || "left")}`,
117
- F(e.ellipsis) ? p("cell", "multiline") : null,
118
- D
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
- ...b(e),
126
- ...c(e)
126
+ ...w(e),
127
+ ...b(e)
127
128
  };
128
129
  return e.children?.length ? {
129
- ...i,
130
- headerGroupComponent: v,
130
+ ...o,
131
+ headerGroupComponent: h,
131
132
  headerGroupComponentParams: {
132
133
  column: e
133
134
  },
134
- children: a(e.children)
135
- } : i;
135
+ children: i(e.children)
136
+ } : o;
136
137
  });
137
138
  }
138
- return a(r);
139
- }), w = T(
139
+ return i(r);
140
+ }), R = y(
140
141
  () => ({
141
- headerComponent: v,
142
- resizable: o.columnResizable,
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: w,
150
- gridWrapperRef: u
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),
@@ -90,6 +90,7 @@ export type AgGridColumnType<RecordType = any, ExtraValueType = 'text', ValueTyp
90
90
  minWidth?: number;
91
91
  maxWidth?: number;
92
92
  colSpan?: ColDef<RecordType>['colSpan'];
93
+ spanRows?: ColDef<RecordType>['spanRows'];
93
94
  /**
94
95
  * 为当前单元格添加类名
95
96
  * @returns
@@ -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: (...args: any[]) => void;
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?: ((...args: any[]) => any) | undefined;
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 t, unref as a, createBlock as x, openBlock as i, mergeProps as A, withCtx as j, createElementVNode as m, normalizeClass as I, createElementBlock as u, createCommentVNode as f, createVNode as M, renderSlot as T, toDisplayString as U } from "vue";
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 g } from "./utils/getFileInfo.mjs";
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(y, { emit: C }) {
47
- const N = C, n = L(!1), { lang: b } = G(), v = S(), h = t(() => b.value === "zh-cn" ? "zh_CN" : "en_US"), w = r("uiMode"), e = y, l = r("apUpload"), c = r(
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
- ), d = t(() => e.disabled), _ = t(() => e.color ? e.color : w.value === "aplus" ? "#0070FF" : "#1890FF"), k = t(() => e.size), { getInnerWrapperClass: B } = P(_, k, d), z = t(() => e.getOssAccess || l.value?.getOssAccess), O = async () => {
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
- n.value = !0;
51
+ s.value = !0;
52
52
  try {
53
- if (c.value?.trigger) {
54
- let s = g(
55
- e.needName ?? l?.value?.needName,
53
+ if (d.value?.trigger) {
54
+ let t = y(
55
+ e.needName ?? n?.value?.needName,
56
56
  e.fileName
57
- ).map((p) => ({
58
- objectName: p.path,
59
- fileName: p.fileName
57
+ ).map((m) => ({
58
+ objectName: m.path,
59
+ fileName: m.fileName
60
60
  }));
61
- await c.value?.trigger(s);
61
+ await d.value?.trigger(t), c("downloadCallback", t);
62
62
  } else {
63
- const s = await (await E(
63
+ const t = await (await E(
64
64
  z.value,
65
- a(h)
65
+ l(w)
66
66
  )).downloadFile(
67
- g(
68
- e.needName ?? l?.value?.needName,
67
+ y(
68
+ e.needName ?? n?.value?.needName,
69
69
  e.fileName
70
70
  )
71
71
  );
72
- N("downloadCallback", s);
72
+ c("downloadCallback", t);
73
73
  }
74
74
  } catch (o) {
75
75
  console.error(o);
76
76
  } finally {
77
- n.value = !1;
77
+ s.value = !1;
78
78
  }
79
79
  }
80
80
  };
81
- return (o, s) => (i(), x(a(V), A(e, {
81
+ return (o, t) => (i(), x(l(V), A(e, {
82
82
  type: e.type,
83
83
  size: e.size,
84
- disabled: d.value,
84
+ disabled: p.value,
85
85
  onClick: O
86
86
  }), {
87
87
  default: j(() => [
88
- m("div", {
89
- class: I(a(B))
88
+ u("div", {
89
+ class: I(l(B))
90
90
  }, [
91
- n.value ? (i(), u("span", R, [
92
- M(a(D), { spin: !0 })
93
- ])) : f("", !0),
94
- a(v).icon ? (i(), u("span", W, [
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
- ])) : f("", !0),
97
- m("span", $, U(o.text), 1)
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: (params: ContentRecord) => any | Promise<any>;
10
+ onCancel: (contentExposed: ContentRecord) => any | Promise<any>;
11
11
  /**
12
12
  * 点击确定回调
13
13
  * @param params content组件内使用defineExpose导出的对象
14
14
  * @returns
15
15
  */
16
- onOk: (params: ContentRecord) => any | Promise<any>;
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 params content组件内使用defineExpose导出的对象
144
+ * * @param contentExposed content组件内使用defineExpose导出的对象
125
145
  * @param next 下一步
126
146
  * @returns
127
147
  */
128
- onOk?: (params: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
148
+ onOk?: (contentExposed: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
129
149
  /**
130
150
  * 点击取消回调
131
- * * @param params content组件内使用defineExpose导出的对象
151
+ * * @param contentExposed content组件内使用defineExpose导出的对象
132
152
  * @param next 下一步
133
153
  * @returns
134
154
  */
135
- onCancel?: (params: any, next: ModalStreamNextFunc<ModalType>) => any | Promise<any>;
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 m, defineComponent as b, createVNode as l, mergeProps as k, h as w } from "vue";
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 f } from "../../config-provider/config-provider.mjs";
4
- import { omit as L } from "lodash-unified";
5
- import { isNumeric as M } from "@aplus-frontend/utils";
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 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;
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: a = !0,
14
- wrapperOffset: n = !1
15
- } = p, {
16
- b: s
17
- } = T("ap-modal");
18
- function i() {
19
- o && o(!1), setTimeout(() => {
20
- m(null, r), r.parentElement?.removeChild(r);
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
- o && o(!0);
24
+ t && t(!0);
25
25
  }
26
- function c() {
27
- o && o(!1);
26
+ function d() {
27
+ t && t(!1);
28
28
  }
29
29
  function C(e) {
30
- t && t(e);
30
+ n && n(e);
31
31
  }
32
32
  const g = /* @__PURE__ */ b({
33
33
  data() {
34
34
  return {
35
- open: a,
36
- props: p
35
+ open: i,
36
+ props: o
37
37
  };
38
38
  },
39
39
  created() {
40
- o = (e) => {
40
+ t = (e) => {
41
41
  this.open = e;
42
- }, t = (e) => {
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
- a ? i() : c();
55
+ i ? s() : d();
56
56
  },
57
57
  async handleOk() {
58
58
  try {
59
- if (t({
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
- t({
65
+ n({
66
66
  confirmLoading: !1
67
- }), a ? i() : c();
67
+ }), i ? s() : d();
68
68
  } catch {
69
- t({
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 = L(this.props, ["onCancel", "onOk", "open", "onUpdate:open", "getContainer", "icon"]);
77
- return l(N, f.value, {
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
- [s()]: !0,
81
- [s("wrapper")]: n
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
- [s("body-wrapper")]: n
98
+ [p("body-wrapper")]: r
92
99
  },
93
- style: n === !1 ? {} : {
94
- maxHeight: `calc(100vh - ${(n === !0 ? 100 : M(n) ? Number(n) : 100) * 2}px)`
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(f?.value?.getPopupContainer), v = u(p.getContainer), O = x || v || E().document.body, r = document.createElement("div");
101
- O.appendChild(r);
102
- const d = w(g), y = A();
103
- return d.appContext = p.appContext || y || d.appContext, m(d, r), {
104
- destroy: i,
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: c
114
+ close: d
108
115
  };
109
116
  };
110
117
  export {
111
- z as createModal
118
+ q as createModal
112
119
  };