@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,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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),y=require("@aplus-frontend/antdv"),u=require("../../config-provider/config-provider.js"),O=require("lodash-unified"),q=require("@aplus-frontend/utils");require("../../config-provider/index.js");const f=require("./util.js"),P=require("../../utils/index.js"),N=require("../../config-provider/hooks/use-namespace.js"),k=s=>{let o,t;const{destroyOnClose:i=!0,wrapperOffset:r=!1}=s,{b:c}=N.useNamespace("ap-modal");function p(){o&&o(!1),setTimeout(()=>{n.render(null,a),a.parentElement?.removeChild(a)},500)}function C(){o&&o(!0)}function d(){o&&o(!1)}function h(e){t&&t(e)}const m=n.defineComponent({data(){return{open:i,props:s}},created(){o=e=>{this.open=e},t=e=>{this.props={...this.props,...e}}},methods:{async handleCancel(){if(this.props?.onCancel){const e=this.props?.content?.component?.exposed??void 0;await this.props?.onCancel(e)}i?p():d()},async handleOk(){try{if(t({confirmLoading:!0}),this.props?.onOk){const e=this.props?.content?.component?.exposed??void 0;await this.props.onOk(e)}t({confirmLoading:!1}),i?p():d()}catch{t({confirmLoading:!1})}}},render(){const e=O.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon"]);return n.createVNode(u.ConfigProvider,u.globalConfigCached.value,{default:()=>[n.createVNode(y.Modal,n.mergeProps({class:{[c()]:!0,[c("wrapper")]:r},centered:!0},e,{open:this.open,onCancel:this.handleCancel,onOk:this.handleOk}),{default:()=>[n.createVNode("div",{class:{[c("body-wrapper")]:r},style:r===!1?{}:{maxHeight:`calc(100vh - ${(r===!0?100:q.isNumeric(r)?Number(r):100)*2}px)`}},[this.props?.content])]})]})}}),g=f.getContainerDom(u.globalConfigCached?.value?.getPopupContainer),v=f.getContainerDom(s.getContainer),x=g||v||P.getTopWindow().document.body,a=document.createElement("div");x.appendChild(a);const l=n.h(m),b=f.getModalGlobalAppContext();return l.appContext=s.appContext||b||l.appContext,n.render(l,a),{destroy:p,update:h,open:C,close:d}};exports.createModal=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),b=require("@aplus-frontend/antdv"),u=require("../../config-provider/config-provider.js"),O=require("lodash-unified"),q=require("@aplus-frontend/utils");require("../../config-provider/index.js");const f=require("./util.js"),N=require("../../utils/index.js"),P=require("../../config-provider/hooks/use-namespace.js"),k=o=>{let t,r;const{destroyOnClose:i=!0,wrapperOffset:a=!1}=o,{b:c}=P.useNamespace("ap-modal");function d(){t&&t(!1),setTimeout(()=>{n.render(null,s),s.parentElement?.removeChild(s)},500)}function h(){t&&t(!0)}function p(){t&&t(!1)}function C(e){r&&r(e)}const m=n.defineComponent({data(){return{open:i,props:o}},created(){t=e=>{this.open=e},r=e=>{this.props={...this.props,...e}}},methods:{async handleCancel(){if(this.props?.onCancel){const e=this.props?.content?.component?.exposed??void 0;await this.props?.onCancel(e)}i?d():p()},async handleOk(){try{if(r({confirmLoading:!0}),this.props?.onOk){const e=this.props?.content?.component?.exposed??void 0;await this.props.onOk(e)}r({confirmLoading:!1}),i?d():p()}catch{r({confirmLoading:!1})}},handleFooter(e){return o?.footer!==void 0?typeof o.footer=="function"?o.footer({...e,contentExposed:this.props?.content?.component?.exposed??void 0}):o.footer:e?.originNode}},render(){const e=O.omit(this.props,["onCancel","onOk","open","onUpdate:open","getContainer","icon","footer"]);return n.createVNode(u.ConfigProvider,u.globalConfigCached.value,{default:()=>[n.createVNode(b.Modal,n.mergeProps({class:{[c()]:!0,[c("wrapper")]:a},centered:!0},e,{open:this.open,onCancel:this.handleCancel,onOk:this.handleOk,footer:this?.handleFooter}),{default:()=>[n.createVNode("div",{class:{[c("body-wrapper")]:a},style:a===!1?{}:{maxHeight:`calc(100vh - ${(a===!0?100:q.isNumeric(a)?Number(a):100)*2}px)`}},[this.props?.content])]})]})}}),g=f.getContainerDom(u.globalConfigCached?.value?.getPopupContainer),x=f.getContainerDom(o.getContainer),v=g||x||N.getTopWindow().document.body,s=document.createElement("div");v.appendChild(s);const l=n.h(m),y=f.getModalGlobalAppContext();return l.appContext=o.appContext||y||l.appContext,n.render(l,s),{destroy:d,update:C,open:h,close:p}};exports.createModal=k;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("@aplus-frontend/antdv");require("../../config-provider/index.js");const M=require("./constans.js"),m=require("../../ap-download/utils/getFileInfo.js"),S=require("../../ap-download/hooks/index.js"),w=require("lodash-unified"),f=require("@ant-design/icons-vue"),_=require("../../utils/warning.js"),k=require("../../config-provider/hooks/use-namespace.js"),g=require("../../config-provider/hooks/use-global-config.js"),G=require("../../config-provider/hooks/use-locale.js"),U=e.defineComponent({name:"ApAttachment",props:M.ApAttachmentProps(),setup(t){const{b:F,e:a}=k.useNamespace("ap-attachment"),y=g.useGlobalConfig("uiMode"),A=g.useGlobalConfig("apUpload"),v=g.useGlobalConfig("downloadCenterTriggerConfig"),{lang:b,t:s}=G.useLocale(),o=e.ref(!1),c=e.ref(""),u=e.useSlots(),q=e.computed(()=>b.value==="zh-cn"?"zh_CN":"en_US"),r=e.computed(()=>t.attachmentList.length===1),N=e.computed(()=>t.needName?t.attachmentList.length>0&&t.needName&&t.needName.nameKey?t.attachmentList[0][t.needName.nameKey]:"":t.attachmentList.length>0?t.attachmentList[0].fileName:""),O=e.computed(()=>r.value?N.value:s("ap.apAttachment.downloadall")),h=e.computed(()=>t.color?t.color:y.value==="aplus"?"#0070FF":"#1890FF"),L=e.computed(()=>({"--download-main-color":h.value,"--download-main-color-opacity":m.getHexWithOpacity(h.value,.6)})),p=e.computed(()=>t.getOssAccess||A.value?.getOssAccess),T=e.computed(()=>{const l=u.default?u.default()[0]:null;return l?e.cloneVNode(l,{style:{"font-size":"16px"}}):null}),d=w.debounce(async(l,i)=>{if(!t.disabled){o.value=!0,i&&(c.value=i);try{const n=w.isArray(e.toRaw(l))?e.toRaw(l):[e.toRaw(l)];if(v.value?.trigger){const P=m.getFileInfo(t.needName,n).map(V=>({objectName:V.path,fileName:V.fileName}));v.value?.trigger(P)}else await(await S.useOssInit(p.value,e.unref(q))).downloadFile(m.getFileInfo(t.needName,n))}catch(n){_.warning(!1,n)}finally{o.value=!1,c.value=""}}},500),x=l=>l&&l.length>0?e.createVNode("ul",{class:[a("file-list")],style:L.value},[l.map((i,n)=>e.createVNode("li",{key:n,class:[a("file-item")],onClick:()=>d(i,n+1)},[o.value&&c.value===n+1?e.createVNode("span",{class:[a("spin")]},[e.createVNode(f.LoadingOutlined,{spin:!0},null)]):null,i.fileName])),e.createVNode("li",{class:[a("down-load-all")],onClick:()=>d(t.attachmentList,"all")},[o.value&&c.value==="all"?e.createVNode("span",{class:[a("spin")]},[e.createVNode(f.LoadingOutlined,{spin:!0},null)]):null,s("ap.apAttachment.downloadall")])]):null;return()=>t.attachmentList?.length>0&&e.createVNode("div",{class:[F()],style:[L.value]},[e.createVNode(C.Tooltip,{title:O.value,placement:t.textToolTipPlacement,color:t.toolTipBgColor},{default:()=>[e.createVNode("div",{class:[a("content")],onClick:()=>d(r.value?t.attachmentList[0]:t.attachmentList,"global")},[o.value&&c.value==="global"?e.createVNode("div",{class:[a("spin")]},[e.createVNode(f.LoadingOutlined,{spin:!0},null)]):null,u.default?e.createVNode("div",{class:[a("text-render")]},[T.value,e.createTextVNode(" ")]):null,e.createVNode("div",{class:[a("text-inner")],style:{"max-width":t.maxWidth?t.maxWidth+"px":"auto"}},[N.value])])]}),e.createVNode(C.Popover,{content:x(t.attachmentList),placement:t.fileMorePopoverPlacement,color:"#fff"},{default:()=>[!r.value&&e.createVNode("div",{class:[a("more")]},[s("ap.apAttachment.more")])]})])}});exports.default=U;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),b=require("@aplus-frontend/antdv");require("../../config-provider/index.js");const M=require("./constans.js"),f=require("../../ap-download/utils/getFileInfo.js"),S=require("../../ap-download/hooks/index.js"),F=require("lodash-unified"),g=require("@ant-design/icons-vue"),_=require("../../utils/warning.js"),G=require("../../config-provider/hooks/use-namespace.js"),v=require("../../config-provider/hooks/use-global-config.js"),R=require("../../config-provider/hooks/use-locale.js"),U=e.defineComponent({name:"ApAttachment",props:M.ApAttachmentProps(),setup(t,{emit:N}){const{b:y,e:a}=G.useNamespace("ap-attachment"),A=v.useGlobalConfig("uiMode"),q=v.useGlobalConfig("apUpload"),h=v.useGlobalConfig("downloadCenterTriggerConfig"),{lang:O,t:u}=R.useLocale(),o=e.ref(!1),c=e.ref(""),d=e.useSlots(),p=e.computed(()=>O.value==="zh-cn"?"zh_CN":"en_US"),r=e.computed(()=>t.attachmentList.length===1),C=e.computed(()=>t.needName?t.attachmentList.length>0&&t.needName&&t.needName.nameKey?t.attachmentList[0][t.needName.nameKey]:"":t.attachmentList.length>0?t.attachmentList[0].fileName:""),T=e.computed(()=>r.value?C.value:u("ap.apAttachment.downloadall")),L=e.computed(()=>t.color?t.color:A.value==="aplus"?"#0070FF":"#1890FF"),w=e.computed(()=>({"--download-main-color":L.value,"--download-main-color-opacity":f.getHexWithOpacity(L.value,.6)})),x=e.computed(()=>t.getOssAccess||q.value?.getOssAccess),k=e.computed(()=>{const l=d.default?d.default()[0]:null;return l?e.cloneVNode(l,{style:{"font-size":"16px"}}):null}),m=F.debounce(async(l,i)=>{if(!t.disabled){o.value=!0,i&&(c.value=i);try{const n=F.isArray(e.toRaw(l))?e.toRaw(l):[e.toRaw(l)];if(h.value?.trigger){const s=f.getFileInfo(t.needName,n).map(V=>({objectName:V.path,fileName:V.fileName}));h.value?.trigger(s),N("downloadCallback",s)}else{const s=await(await S.useOssInit(x.value,e.unref(p))).downloadFile(f.getFileInfo(t.needName,n));N("downloadCallback",s)}}catch(n){_.warning(!1,n)}finally{o.value=!1,c.value=""}}},500),I=l=>l&&l.length>0?e.createVNode("ul",{class:[a("file-list")],style:w.value},[l.map((i,n)=>e.createVNode("li",{key:n,class:[a("file-item")],onClick:()=>m(i,n+1)},[o.value&&c.value===n+1?e.createVNode("span",{class:[a("spin")]},[e.createVNode(g.LoadingOutlined,{spin:!0},null)]):null,i.fileName])),e.createVNode("li",{class:[a("down-load-all")],onClick:()=>m(t.attachmentList,"all")},[o.value&&c.value==="all"?e.createVNode("span",{class:[a("spin")]},[e.createVNode(g.LoadingOutlined,{spin:!0},null)]):null,u("ap.apAttachment.downloadall")])]):null;return()=>t.attachmentList?.length>0&&e.createVNode("div",{class:[y()],style:[w.value]},[e.createVNode(b.Tooltip,{title:T.value,placement:t.textToolTipPlacement,color:t.toolTipBgColor},{default:()=>[e.createVNode("div",{class:[a("content")],onClick:()=>m(r.value?t.attachmentList[0]:t.attachmentList,"global")},[o.value&&c.value==="global"?e.createVNode("div",{class:[a("spin")]},[e.createVNode(g.LoadingOutlined,{spin:!0},null)]):null,d.default?e.createVNode("div",{class:[a("text-render")]},[k.value,e.createTextVNode(" ")]):null,e.createVNode("div",{class:[a("text-inner")],style:{"max-width":t.maxWidth?t.maxWidth+"px":"auto"}},[C.value])])]}),e.createVNode(b.Popover,{content:I(t.attachmentList),placement:t.fileMorePopoverPlacement,color:"#fff"},{default:()=>[!r.value&&e.createVNode("div",{class:[a("more")]},[u("ap.apAttachment.more")])]})])}});exports.default=U;
@@ -2,9 +2,10 @@ import { ApExpandAlertProps } from './interface';
2
2
  import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, VNode } from 'vue';
3
3
  declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
+ readonly onClose?: ((args_0: MouseEvent) => any) | undefined;
5
6
  readonly onExpand?: ((args_0: "collapse" | "expand") => any) | undefined;
6
7
  readonly onChoose?: ((args_0: T) => any) | undefined;
7
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onExpand" | "onChoose"> & ApExpandAlertProps<T> & Partial<{}>> & PublicProps;
8
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, "onClose" | "onExpand" | "onChoose"> & ApExpandAlertProps<T> & Partial<{}>> & PublicProps;
8
9
  expose(exposed: ShallowUnwrapRef<{
9
10
  setExpand: (state?: boolean) => void;
10
11
  }>): void;
@@ -22,7 +23,7 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
22
23
  index: number;
23
24
  }): any;
24
25
  };
25
- emit: ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
26
+ emit: ((evt: "close", args_0: MouseEvent) => void) & ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
26
27
  }>) => VNode & {
27
28
  __ctx?: Awaited<typeof __VLS_setup>;
28
29
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),z=require("@ant-design/icons-vue"),h=require("@aplus-frontend/antdv"),N=require("../../ap-action/index.js");require("../../config-provider/index.js");const i=require("lodash-unified"),T=require("../../config-provider/hooks/use-locale.js"),$=require("../../config-provider/hooks/use-namespace.js"),q=require("../../config-provider/hooks/use-global-config.js"),A=["onClick"],D=e.defineComponent({__name:"ApExpandAlert",props:{type:{default:"warning"},data:{default:()=>[]},prefix:{default:""},tipTitle:{default:""},mapLabel:{},separator:{default:"|"},separatorStyle:{default:()=>({})},contentStyle:{default:()=>({})},prefixStyle:{default:()=>({})},rows:{default:2},defaultExpand:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0}},emits:["choose","expand"],setup(g,{expose:v,emit:B}){const f=B,r=g,{t:m}=T.useLocale(),S=e.computed(()=>{if(r.type!="card")return r.type}),l=e.ref(""),s=e.ref(null),w=e.computed(()=>({fontWeight:"400",wordBreak:"break-all",overflow:"hidden",display:"-webkit-box",webkitLineClamp:l.value,webkitBoxOrient:"vertical",lineHeight:"18px"}));function C(){l.value==="1"?(l.value="",f("expand","expand")):(l.value="1",f("expand","collapse"))}const x=e.computed(()=>l.value==="1"?m("ap.apExpandAlert.expand"):m("ap.apExpandAlert.collapse")),u=e.ref(!0),y=e.computed(()=>l.value!=="1");function c(t){t?l.value="":l.value="1"}e.watch(()=>r.data,()=>{l.value="",e.nextTick(()=>{if(s.value){const t=Number(s.value.clientHeight),o=Number(parseInt(s.value.style.lineHeight));t<o*Number(r.rows)&&y.value?u.value=!1:u.value=!0}})},{immediate:!0}),e.watch(()=>r.defaultExpand,t=>{t?e.nextTick(()=>{c(t)}):e.nextTick(()=>{c(t)})},{immediate:!0}),e.onMounted(()=>{e.watch(()=>r.contentStyle,t=>{i.isNil(t.lineHeight)||e.nextTick(()=>{const o=document.querySelector(`#${p} .ant-alert-action`),a=document.querySelector(`#${p} .ant-alert-icon`);o&&o.setAttribute("style",`line-height: ${t.lineHeight}`),a&&a.setAttribute("style",`line-height: ${t.lineHeight}`)})},{deep:!0,immediate:!0,flush:"post"})});const{b:k,e:n,m:E}=$.useNamespace("ap-expand-alert"),p=`${k()}-key-${Date.now()}-${(Math.random()*1e6).toFixed(0)}`,b=q.useGlobalConfig("uiMode","aplus");return v({setExpand:c}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{id:p,class:e.normalizeClass([e.unref(k)(),`${e.unref(E)(e.unref(b))}`])},[e.createVNode(e.unref(h.Alert),{type:S.value,"show-icon":t.showIcon,class:e.normalizeClass([e.unref(n)("antAlert"),t.type=="card"?"card-alert":""])},{action:e.withCtx(()=>[u.value?(e.openBlock(),e.createBlock(e.unref(N.ApActionItem),{key:0,size:"small",style:{"font-size":"12px","padding-left":"16px"},onClick:o[0]||(o[0]=a=>C())},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n)("expandText"))},e.toDisplayString(x.value),3),e.createVNode(e.unref(z.DownOutlined),{class:e.normalizeClass(y.value?e.unref(n)("expandIcon"):e.unref(n)("collapseIcon"))},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)]),message:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"ellipsisBoxRef",ref:s,style:e.normalizeStyle({...w.value,...t.contentStyle}),class:e.normalizeClass(e.unref(n)("alertContent"))},[e.renderSlot(t.$slots,"default",{},()=>[e.unref(i.isString)(t.prefix)?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n)("prefix")),style:e.normalizeStyle(t.prefixStyle)},e.toDisplayString(t.prefix),7)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.prefix),{key:1,style:e.normalizeStyle(t.prefixStyle)},null,8,["style"])),e.unref(i.isString)(t.data)?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(e.unref(n)("text"))},e.toDisplayString(t.data),3)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:3},e.renderList(t.data,(a,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[e.createVNode(e.unref(h.Tooltip),{title:t.tipTitle?t.tipTitle:null},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"item",{record:a,index:d},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n)("showItem")),onClick:V=>t.$emit("choose",a)},e.toDisplayString(t.mapLabel?a[t.mapLabel]:a),11,A)])]),_:2},1032,["title"]),d!==t.data.length-1?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n)("spliter")),style:e.normalizeStyle(t.separatorStyle)},[e.unref(i.isString)(t.separator)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.separator),1)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.separator),{key:1}))],6)):e.createCommentVNode("",!0)],64))),128))])],6)]),_:3},8,["type","show-icon","class"])],2))}});exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("@ant-design/icons-vue"),h=require("@aplus-frontend/antdv"),T=require("../../ap-action/index.js");require("../../config-provider/index.js");const i=require("lodash-unified"),$=require("../../config-provider/hooks/use-locale.js"),q=require("../../config-provider/hooks/use-namespace.js"),A=require("../../config-provider/hooks/use-global-config.js"),D=["onClick"],V=e.defineComponent({__name:"ApExpandAlert",props:{type:{default:"warning"},data:{default:()=>[]},prefix:{default:""},tipTitle:{default:""},mapLabel:{},separator:{default:"|"},separatorStyle:{default:()=>({})},contentStyle:{default:()=>({})},prefixStyle:{default:()=>({})},rows:{default:2},defaultExpand:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},closable:{type:Boolean},afterClose:{}},emits:["choose","expand","close"],setup(g,{expose:v,emit:C}){const u=C,r=g,{t:m}=$.useLocale(),B=e.computed(()=>{if(r.type!="card")return r.type}),l=e.ref(""),s=e.ref(null),S=e.computed(()=>({fontWeight:"400",wordBreak:"break-all",overflow:"hidden",display:"-webkit-box",webkitLineClamp:l.value,webkitBoxOrient:"vertical",lineHeight:"18px"}));function w(){l.value==="1"?(l.value="",u("expand","expand")):(l.value="1",u("expand","collapse"))}const b=e.computed(()=>l.value==="1"?m("ap.apExpandAlert.expand"):m("ap.apExpandAlert.collapse")),c=e.ref(!0),y=e.computed(()=>l.value!=="1");function p(t){t?l.value="":l.value="1"}function x(t){u("close",t)}e.watch(()=>r.data,()=>{l.value="",e.nextTick(()=>{if(s.value){const t=Number(s.value.clientHeight),o=Number(parseInt(s.value.style.lineHeight));t<o*Number(r.rows)&&y.value?c.value=!1:c.value=!0}})},{immediate:!0}),e.watch(()=>r.defaultExpand,t=>{t?e.nextTick(()=>{p(t)}):e.nextTick(()=>{p(t)})},{immediate:!0}),e.onMounted(()=>{e.watch(()=>r.contentStyle,t=>{i.isNil(t.lineHeight)||e.nextTick(()=>{const o=document.querySelector(`#${d} .ant-alert-action`),a=document.querySelector(`#${d} .ant-alert-icon`);o&&o.setAttribute("style",`line-height: ${t.lineHeight}`),a&&a.setAttribute("style",`line-height: ${t.lineHeight}`)})},{deep:!0,immediate:!0,flush:"post"})});const{b:k,e:n,m:E}=q.useNamespace("ap-expand-alert"),d=`${k()}-key-${Date.now()}-${(Math.random()*1e6).toFixed(0)}`,z=A.useGlobalConfig("uiMode","aplus");return v({setExpand:p}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{id:d,class:e.normalizeClass([e.unref(k)(),`${e.unref(E)(e.unref(z))}`])},[e.createVNode(e.unref(h.Alert),{type:B.value,"show-icon":t.showIcon,closable:t.closable,class:e.normalizeClass([e.unref(n)("antAlert"),t.type=="card"?"card-alert":""]),"after-close":t.afterClose,onClose:x},{action:e.withCtx(()=>[c.value?(e.openBlock(),e.createBlock(e.unref(T.ApActionItem),{key:0,size:"small",style:{"font-size":"12px","padding-left":"16px"},onClick:o[0]||(o[0]=a=>w())},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n)("expandText"))},e.toDisplayString(b.value),3),e.createVNode(e.unref(N.DownOutlined),{class:e.normalizeClass(y.value?e.unref(n)("expandIcon"):e.unref(n)("collapseIcon"))},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)]),message:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"ellipsisBoxRef",ref:s,style:e.normalizeStyle({...S.value,...t.contentStyle}),class:e.normalizeClass(e.unref(n)("alertContent"))},[e.renderSlot(t.$slots,"default",{},()=>[e.unref(i.isString)(t.prefix)?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n)("prefix")),style:e.normalizeStyle(t.prefixStyle)},e.toDisplayString(t.prefix),7)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.prefix),{key:1,style:e.normalizeStyle(t.prefixStyle)},null,8,["style"])),e.unref(i.isString)(t.data)?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(e.unref(n)("text"))},e.toDisplayString(t.data),3)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:3},e.renderList(t.data,(a,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[e.createVNode(e.unref(h.Tooltip),{title:t.tipTitle?t.tipTitle:null},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"item",{record:a,index:f},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n)("showItem")),onClick:H=>t.$emit("choose",a)},e.toDisplayString(t.mapLabel?a[t.mapLabel]:a),11,D)])]),_:2},1032,["title"]),f!==t.data.length-1?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n)("spliter")),style:e.normalizeStyle(t.separatorStyle)},[e.unref(i.isString)(t.separator)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.separator),1)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.separator),{key:1}))],6)):e.createCommentVNode("",!0)],64))),128))])],6)]),_:3},8,["type","show-icon","closable","class","after-close"])],2))}});exports.default=V;
@@ -15,9 +15,10 @@ declare const ApExpandAlert: (<T extends Record<string, any>>(__VLS_props: NonNu
15
15
  index: number;
16
16
  }): any;
17
17
  };
18
- emit: ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
18
+ emit: ((evt: "close", args_0: MouseEvent) => void) & ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
19
19
  }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
20
20
  props: {
21
+ readonly onClose?: ((args_0: MouseEvent) => any) | undefined;
21
22
  readonly onExpand?: ((args_0: "collapse" | "expand") => any) | undefined;
22
23
  readonly onChoose?: ((args_0: T) => any) | undefined;
23
24
  type?: "warning" | "error" | "success" | "info" | "card" | undefined | undefined;
@@ -31,6 +32,8 @@ declare const ApExpandAlert: (<T extends Record<string, any>>(__VLS_props: NonNu
31
32
  prefixStyle?: CSSProperties | undefined;
32
33
  rows?: string | number | undefined;
33
34
  defaultExpand?: boolean | undefined;
35
+ closable?: boolean | undefined;
36
+ afterClose?: (() => void) | undefined;
34
37
  showIcon?: boolean | undefined;
35
38
  } & PublicProps;
36
39
  expose(exposed: ShallowUnwrapRef<{
@@ -50,7 +53,7 @@ declare const ApExpandAlert: (<T extends Record<string, any>>(__VLS_props: NonNu
50
53
  index: number;
51
54
  }): any;
52
55
  };
53
- emit: ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
56
+ emit: ((evt: "close", args_0: MouseEvent) => void) & ((evt: "expand", args_0: "collapse" | "expand") => void) & ((evt: "choose", args_0: T) => void);
54
57
  }>) => VNode & {
55
58
  __ctx?: Awaited<typeof __VLS_setup>;
56
59
  }) & ( Plugin & (new (...args: any[]) => {
@@ -45,4 +45,4 @@ export type ApExpandAlertProps<T> = {
45
45
  * 默认是否展开
46
46
  */
47
47
  defaultExpand?: boolean;
48
- } & Pick<AlertProps, 'showIcon'>;
48
+ } & Pick<AlertProps, 'showIcon' | 'closable' | 'afterClose'>;
@@ -1,2 +1,2 @@
1
- declare const _default: "6.41.3";
1
+ declare const _default: "6.42.1";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.41.3";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.42.1";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "6.41.3",
3
+ "version": "6.42.1",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [