taro-react-uilib 1.0.26 → 1.0.28

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 (37) hide show
  1. package/dist/components/Dialog/Alert/index.js +1 -1
  2. package/dist/components/Dialog/Alert/index.js.map +1 -1
  3. package/dist/components/Dialog/Confirm/index.js +1 -1
  4. package/dist/components/Dialog/Confirm/index.js.map +1 -1
  5. package/dist/components/DialogComponent/index.js +1 -1
  6. package/dist/components/DialogComponent/index.js.map +1 -1
  7. package/dist/components/DialogRef/index.js +1 -1
  8. package/dist/components/DialogRef/index.js.map +1 -1
  9. package/dist/components/Image/index.js +1 -1
  10. package/dist/components/Image/index.js.map +1 -1
  11. package/dist/components/Toast/Toast.js +1 -1
  12. package/dist/components/Toast/Toast.js.map +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.umd.js +2 -2
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/styles/components/dialog.scss +13 -15
  18. package/dist/styles/components/dialogref.scss +19 -24
  19. package/dist/styles/components/index.scss +0 -2
  20. package/dist/styles/components/toast.scss +9 -13
  21. package/lib/components/Dialog/Alert/index.js +1 -2
  22. package/lib/components/Dialog/Alert/index.js.map +1 -1
  23. package/lib/components/Dialog/Confirm/index.js +3 -5
  24. package/lib/components/Dialog/Confirm/index.js.map +1 -1
  25. package/lib/components/DialogComponent/index.js +9 -2
  26. package/lib/components/DialogComponent/index.js.map +1 -1
  27. package/lib/components/DialogRef/index.js +16 -8
  28. package/lib/components/DialogRef/index.js.map +1 -1
  29. package/lib/components/Image/index.js +3 -3
  30. package/lib/components/Image/index.js.map +1 -1
  31. package/lib/components/Toast/Toast.js +3 -2
  32. package/lib/components/Toast/Toast.js.map +1 -1
  33. package/package.json +1 -1
  34. package/types/components/Dialog/Alert/index.d.ts +0 -1
  35. package/types/components/Dialog/Confirm/index.d.ts +0 -1
  36. package/dist/styles/components/alert.scss +0 -9
  37. package/dist/styles/components/confirm.scss +0 -20
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as t}from"../../node_modules/tslib/tslib.es6.js";import o,{createRef as n}from"react";import r from"react-dom";import{showModal as i}from"@tarojs/taro";import m from"../../DialogComponent/index.js";import c from"../../Button/index.js";var a=function(a){var l=a.title,f=void 0===l?"":l,s=a.content,u=a.confirmText,d=void 0===u?"我知道了":u,p=e(a,["title","content","confirmText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),l=n(),u=o.createElement(c,{className:"xh-alert-button",shape:"rectangle",type:"ghost",size:"full",onClick:function(){r.unmountComponentAtNode(a),e()}},d);r.render(o.createElement(m,{header:f,footer:u,content:s,visible:!0,ref:l}),a)}else i(t({title:f,content:s,showCancel:!1,confirmColor:"#f6ab00",confirmText:d},p)).then((function(){return e()}))}))};export{a as default};
1
+ import{__rest as t,__assign as e}from"../../node_modules/tslib/tslib.es6.js";import o,{createRef as n}from"react";import r from"react-dom";import{showModal as i}from"@tarojs/taro";import m from"../../DialogComponent/index.js";import c from"../../Button/index.js";var a=function(a){var f=a.title,l=void 0===f?"":f,s=a.content,d=a.confirmText,u=void 0===d?"我知道了":d,p=t(a,["title","content","confirmText"]);return new Promise((function(t){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),f=n(),d=o.createElement(c,{className:"xh-alert-button",type:"primary",onClick:function(){r.unmountComponentAtNode(a),t()}},u);r.render(o.createElement(m,{header:l,footer:d,content:s,visible:!0,ref:f}),a)}else i(e({title:l,content:s,showCancel:!1,confirmColor:"#f6ab00",confirmText:u},p)).then((function(){return t()}))}))};export{a as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Alert/index.tsx"],"sourcesContent":["import React, { createRef, ReactNode } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport Dialog, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../../../src/components/Button\";\nimport \"./index.scss\";\n\nexport type AlertProps = {\n title?: string | ReactNode;\n content?: string | ReactNode;\n confirmText?: string | ReactNode;\n} & {\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: () => void;\n /** 提示的标题 */\n title?: string;\n};\n\nconst Alert = (props: AlertProps): Promise<void> => {\n const { title = \"\", content, confirmText = \"我知道了\", ...rest } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <Button\n className=\"xh-alert-button\"\n shape=\"rectangle\"\n type=\"ghost\"\n size=\"full\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve();\n }}\n >\n {confirmText}\n </Button>\n );\n ReactDOM.render(\n <Dialog\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title: title as string,\n content: content as string,\n showCancel: false,\n confirmColor: \"#f6ab00\",\n confirmText: confirmText as string,\n ...rest,\n }).then(() => resolve());\n }\n });\n};\n\nexport default Alert;\n"],"names":["Alert","props","_a","title","content","_b","confirmText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","Button","className","shape","type","size","onClick","ReactDOM","unmountComponentAtNode","render","Dialog","header","footer","visible","ref","showModal","__assign","showCancel","confirmColor","then"],"mappings":"uQA8BM,IAAAA,EAAQ,SAACC,GACL,IAAAC,EAAuDD,EAA7CE,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA2CH,EAApCG,QAAEC,EAAkCJ,EAAdK,YAApBA,OAAW,IAAAD,EAAG,OAAMA,EAAKE,EAASC,EAAAP,EAAzD,CAAA,QAAA,UAAA,gBACN,OAAO,IAAIQ,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAC7BC,EAAYC,IACZC,EACJC,EAAAJ,cAACK,EACC,CAAAC,UAAU,kBACVC,MAAM,YACNC,KAAK,QACLC,KAAK,OACLC,QAAS,WACPC,EAASC,uBAAuBd,GAChCJ,GACF,GAECJ,GAGLqB,EAASE,OACPT,EAACJ,cAAAc,EACC,CAAAC,OAAQ5B,EACR6B,OAAQb,EACRf,QAASA,EACT6B,SACA,EAAAC,IAAKjB,IAEPH,EAEH,MACCqB,EACEC,EAAA,CAAAjC,MAAOA,EACPC,QAASA,EACTiC,YAAY,EACZC,aAAc,UACdhC,YAAaA,GACVC,IACFgC,MAAK,WAAM,OAAA7B,GAAA,GAElB,GACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Alert/index.tsx"],"sourcesContent":["import React, { createRef, ReactNode } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport Dialog, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../../../src/components/Button\";\n\nexport type AlertProps = {\n title?: string | ReactNode;\n content?: string | ReactNode;\n confirmText?: string | ReactNode;\n} & {\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: () => void;\n /** 提示的标题 */\n title?: string;\n};\n\nconst Alert = (props: AlertProps): Promise<void> => {\n const { title = \"\", content, confirmText = \"我知道了\", ...rest } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <Button\n className=\"xh-alert-button\"\n type=\"primary\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve();\n }}\n >\n {confirmText}\n </Button>\n );\n ReactDOM.render(\n <Dialog\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title: title as string,\n content: content as string,\n showCancel: false,\n confirmColor: \"#f6ab00\",\n confirmText: confirmText as string,\n ...rest,\n }).then(() => resolve());\n }\n });\n};\n\nexport default Alert;\n"],"names":["Alert","props","_a","title","content","_b","confirmText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","Button","className","type","onClick","ReactDOM","unmountComponentAtNode","render","Dialog","header","footer","visible","ref","showModal","__assign","showCancel","confirmColor","then"],"mappings":"uQA6BM,IAAAA,EAAQ,SAACC,GACL,IAAAC,EAAuDD,EAA7CE,MAAVA,OAAK,IAAAD,EAAG,GAAEA,EAAEE,EAA2CH,EAApCG,QAAEC,EAAkCJ,EAAdK,YAApBA,OAAW,IAAAD,EAAG,OAAMA,EAAKE,EAASC,EAAAP,EAAzD,CAAA,QAAA,UAAA,gBACN,OAAO,IAAIQ,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAC7BC,EAAYC,IACZC,EACJC,EAAAJ,cAACK,EACC,CAAAC,UAAU,kBACVC,KAAK,UACLC,QAAS,WACPC,EAASC,uBAAuBZ,GAChCJ,GACF,GAECJ,GAGLmB,EAASE,OACPP,EAACJ,cAAAY,EACC,CAAAC,OAAQ1B,EACR2B,OAAQX,EACRf,QAASA,EACT2B,SACA,EAAAC,IAAKf,IAEPH,EAEH,MACCmB,EACEC,EAAA,CAAA/B,MAAOA,EACPC,QAASA,EACT+B,YAAY,EACZC,aAAc,UACd9B,YAAaA,GACVC,IACF8B,MAAK,WAAM,OAAA3B,GAAA,GAElB,GACF"}
@@ -1,2 +1,2 @@
1
- import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import t,{createRef as n}from"react";import r from"react-dom";import{showModal as c}from"@tarojs/taro";import i from"../../DialogComponent/index.js";import m from"../../Button/index.js";var a=function(a){var f=a.title,l=void 0===f?"":f,s=a.content,u=a.confirmText,d=void 0===u?"确定":u,p=a.cancelText,x=void 0===p?"取消":p,h=e(a,["title","content","confirmText","cancelText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var a=document.createElement("div"),f=n(),u=t.createElement("div",{className:"xh-confirm-footer"},t.createElement(m,{shape:"rectangle",type:"ghost",className:"xh-confirm-footer-button xh-confirm-footer-cancel-button",onClick:function(){r.unmountComponentAtNode(a),e({errMsg:"ok",confirm:!1,cancel:!0})}},x),t.createElement(m,{shape:"rectangle",type:"ghost",className:"xh-confirm-footer-button xh-confirm-footer-confirm-button",onClick:function(){r.unmountComponentAtNode(a),e({errMsg:"ok",confirm:!0,cancel:!1})}},d));r.render(t.createElement(i,{header:l,footer:u,content:s,visible:!0,ref:f}),a)}else c(o({title:l,content:s,confirmColor:"#f6ab00",cancelText:x,confirmText:d},h)).then(e)}))};export{a as default};
1
+ import{__rest as e,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import t,{createRef as n}from"react";import r from"react-dom";import{showModal as c}from"@tarojs/taro";import i from"../../DialogComponent/index.js";import m from"../../Button/index.js";var f=function(f){var a=f.title,l=void 0===a?"":a,s=f.content,u=f.confirmText,d=void 0===u?"确定":u,x=f.cancelText,p=void 0===x?"取消":x,v=e(f,["title","content","confirmText","cancelText"]);return new Promise((function(e){if("h5"===process.env.TARO_ENV){var f=document.createElement("div"),a=n(),u=t.createElement("div",{className:"xh-confirm-footer"},t.createElement(m,{className:"xh-confirm-footer-button xh-confirm-footer-cancel-button",onClick:function(){r.unmountComponentAtNode(f),e({errMsg:"ok",confirm:!1,cancel:!0})}},p),t.createElement(m,{type:"primary",className:"xh-confirm-footer-button xh-confirm-footer-confirm-button",onClick:function(){r.unmountComponentAtNode(f),e({errMsg:"ok",confirm:!0,cancel:!1})}},d));r.render(t.createElement(i,{header:l,footer:u,content:s,visible:!0,ref:a}),f)}else c(o({title:l,content:s,confirmColor:"#f6ab00",cancelText:p,cancelColor:"#666",confirmText:d},v)).then(e)}))};export{f as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Confirm/index.tsx"],"sourcesContent":["import React, { createRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport DialogComponent, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../Button\";\nimport \"./index.scss\";\n\nexport type ConfirmProps = {\n title?: string;\n header?: string;\n content: string;\n cancelText?: string;\n confirmText?: string;\n} & {\n /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n cancelColor?: string;\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: (result: ConfirmPropsResult) => void;\n /** 提示的标题 */\n title?: string;\n};\n\nexport type ConfirmPropsResult = {\n /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */\n cancel: boolean;\n /** 为 true 时,表示用户点击了确定按钮 */\n confirm: boolean;\n /** 调用结果 */\n errMsg: string;\n};\nconst Comfirm = (props: ConfirmProps): Promise<ConfirmPropsResult> => {\n const {\n title = \"\",\n content,\n confirmText = \"确定\",\n cancelText = \"取消\",\n ...rest\n } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <div className=\"xh-confirm-footer\">\n <Button\n shape=\"rectangle\"\n type=\"ghost\"\n className=\"xh-confirm-footer-button xh-confirm-footer-cancel-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: false, cancel: true });\n }}\n >\n {cancelText}\n </Button>\n <Button\n shape=\"rectangle\"\n type=\"ghost\"\n className=\"xh-confirm-footer-button xh-confirm-footer-confirm-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: true, cancel: false });\n }}\n >\n {confirmText}\n </Button>\n </div>\n );\n ReactDOM.render(\n <DialogComponent\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title,\n content,\n confirmColor: \"#f6ab00\",\n cancelText,\n confirmText,\n ...rest,\n }).then(resolve);\n }\n });\n};\n\nexport default Comfirm;\n"],"names":["Comfirm","props","_a","title","content","_b","confirmText","_c","cancelText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","className","Button","shape","type","onClick","ReactDOM","unmountComponentAtNode","errMsg","confirm","cancel","render","DialogComponent","header","footer","visible","ref","showModal","__assign","confirmColor","then"],"mappings":"uQA0CM,IAAAA,EAAU,SAACC,GAEb,IAAAC,EAKED,EAAKE,MALPA,aAAQ,GAAED,EACVE,EAIEH,EAAKG,QAHPC,EAGEJ,cAHFK,OAAc,IAAAD,EAAA,OACdE,EAEEN,EAAKO,WAFPA,OAAU,IAAAD,EAAG,KAAIA,EACdE,EAAIC,EACLT,EANE,CAAA,QAAA,UAAA,cAAA,eAON,OAAO,IAAIU,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAE7BC,EAAYC,IACZC,EACJC,EAAKJ,cAAA,MAAA,CAAAK,UAAU,qBACbD,EAAAJ,cAACM,EAAM,CACLC,MAAM,YACNC,KAAK,QACLH,UAAU,2DACVI,QAAS,WACPC,EAASC,uBAAuBb,GAChCJ,EAAQ,CAAEkB,OAAQ,KAAMC,SAAS,EAAOC,QAAQ,GACjD,GAEAxB,GAEHc,EAAAJ,cAACM,EAAM,CACLC,MAAM,YACNC,KAAK,QACLH,UAAU,4DACVI,QAAS,WACPC,EAASC,uBAAuBb,GAChCJ,EAAQ,CAAEkB,OAAQ,KAAMC,SAAS,EAAMC,QAAQ,GACjD,GAEC1B,IAIPsB,EAASK,OACPX,EAACJ,cAAAgB,EACC,CAAAC,OAAQhC,EACRiC,OAAQf,EACRjB,QAASA,EACTiC,SACA,EAAAC,IAAKnB,IAEPH,EAEH,MACCuB,EAASC,EAAA,CACPrC,MAAKA,EACLC,UACAqC,aAAc,UACdjC,aACAF,YAAWA,GACRG,IACFiC,KAAK9B,EAEZ,GACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Dialog/Confirm/index.tsx"],"sourcesContent":["import React, { createRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { showModal } from \"@tarojs/taro\";\nimport DialogComponent, { DialogRef } from \"../../DialogComponent\";\nimport Button from \"../../Button\";\n\nexport type ConfirmProps = {\n title?: string;\n header?: string;\n content: string;\n cancelText?: string;\n confirmText?: string;\n} & {\n /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n cancelColor?: string;\n /** 取消按钮的文字,最多 4 个字符 */\n cancelText?: string;\n /** 接口调用结束的回调函数(调用成功、失败都会执行) */\n complete?: (res: TaroGeneral.CallbackResult) => void;\n /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */\n confirmColor?: string;\n /** 确认按钮的文字,最多 4 个字符 */\n confirmText?: string;\n /** 提示的内容 */\n content?: string;\n /** 接口调用失败的回调函数 */\n fail?: (res: TaroGeneral.CallbackResult) => void;\n /** 接口调用成功的回调函数 */\n success?: (result: ConfirmPropsResult) => void;\n /** 提示的标题 */\n title?: string;\n};\n\nexport type ConfirmPropsResult = {\n /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */\n cancel: boolean;\n /** 为 true 时,表示用户点击了确定按钮 */\n confirm: boolean;\n /** 调用结果 */\n errMsg: string;\n};\nconst Comfirm = (props: ConfirmProps): Promise<ConfirmPropsResult> => {\n const {\n title = \"\",\n content,\n confirmText = \"确定\",\n cancelText = \"取消\",\n ...rest\n } = props;\n return new Promise(resolve => {\n if (process.env.TARO_ENV === \"h5\") {\n const div = document.createElement(\"div\");\n\n const dialogRef = createRef<DialogRef>();\n const alertFooter = (\n <div className=\"xh-confirm-footer\">\n <Button\n className=\"xh-confirm-footer-button xh-confirm-footer-cancel-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: false, cancel: true });\n }}\n >\n {cancelText}\n </Button>\n <Button\n type=\"primary\"\n className=\"xh-confirm-footer-button xh-confirm-footer-confirm-button\"\n onClick={() => {\n ReactDOM.unmountComponentAtNode(div);\n resolve({ errMsg: \"ok\", confirm: true, cancel: false });\n }}\n >\n {confirmText}\n </Button>\n </div>\n );\n ReactDOM.render(\n <DialogComponent\n header={title}\n footer={alertFooter}\n content={content}\n visible\n ref={dialogRef}\n />,\n div\n );\n } else {\n showModal({\n title,\n content,\n confirmColor: \"#f6ab00\",\n cancelText,\n cancelColor: \"#666\",\n confirmText,\n ...rest,\n }).then(resolve);\n }\n });\n};\n\nexport default Comfirm;\n"],"names":["Comfirm","props","_a","title","content","_b","confirmText","_c","cancelText","rest","__rest","Promise","resolve","process","env","TARO_ENV","div_1","document","createElement","dialogRef","createRef","alertFooter","React","className","Button","onClick","ReactDOM","unmountComponentAtNode","errMsg","confirm","cancel","type","render","DialogComponent","header","footer","visible","ref","showModal","__assign","confirmColor","cancelColor","then"],"mappings":"uQAyCM,IAAAA,EAAU,SAACC,GAEb,IAAAC,EAKED,EAAKE,MALPA,aAAQ,GAAED,EACVE,EAIEH,EAAKG,QAHPC,EAGEJ,cAHFK,OAAc,IAAAD,EAAA,OACdE,EAEEN,EAAKO,WAFPA,OAAU,IAAAD,EAAG,KAAIA,EACdE,EAAIC,EACLT,EANE,CAAA,QAAA,UAAA,cAAA,eAON,OAAO,IAAIU,SAAQ,SAAAC,GACjB,GAA6B,OAAzBC,QAAQC,IAAIC,SAAmB,CACjC,IAAMC,EAAMC,SAASC,cAAc,OAE7BC,EAAYC,IACZC,EACJC,EAAKJ,cAAA,MAAA,CAAAK,UAAU,qBACbD,EAAAJ,cAACM,EACC,CAAAD,UAAU,2DACVE,QAAS,WACPC,EAASC,uBAAuBX,GAChCJ,EAAQ,CAAEgB,OAAQ,KAAMC,SAAS,EAAOC,QAAQ,GACjD,GAEAtB,GAEHc,EAACJ,cAAAM,EACC,CAAAO,KAAK,UACLR,UAAU,4DACVE,QAAS,WACPC,EAASC,uBAAuBX,GAChCJ,EAAQ,CAAEgB,OAAQ,KAAMC,SAAS,EAAMC,QAAQ,GACjD,GAECxB,IAIPoB,EAASM,OACPV,EAACJ,cAAAe,EACC,CAAAC,OAAQ/B,EACRgC,OAAQd,EACRjB,QAASA,EACTgC,SACA,EAAAC,IAAKlB,IAEPH,EAEH,MACCsB,EACEC,EAAA,CAAApC,MAAKA,EACLC,QAAOA,EACPoC,aAAc,UACdhC,WAAUA,EACViC,YAAa,OACbnC,YAAWA,GACRG,IACFiC,KAAK9B,EAEZ,GACF"}
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as a,useImperativeHandle as n,useEffect as r}from"react";import m from"react-dom";import s from"classnames";import{View as c}from"@tarojs/components";import l from"../Mask/index.js";import i from"../node_modules/react-transition-group/esm/CSSTransition.js";var d=o((function(o,d){var u=o.header,f=o.content,p=o.footer,x=o.className,E=void 0===x?"":x,h=o.visible,N=e(a(!1),2),g=N[0],v=N[1];n(d,(function(){return{close:function(){v(!1)}}})),r((function(){v(h)}),[h]);var b=s("xh-dialog",E),j=t.createElement(c,{className:b},t.createElement(l,null),t.createElement(i,{in:g,timeout:200,classNames:"scale",unmountOnExit:!0},t.createElement(c,{className:"xh-dialog-content"},t.createElement(c,{className:"xh-dialog-content-header"},u),t.createElement(c,{className:"xh-dialog-content-content"},f),t.createElement(c,{className:"xh-dialog-content-footer"},p))));return m.createPortal(j,document.body)}));export{d as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as a,useImperativeHandle as n,useEffect as r}from"react";import s from"react-dom";import m from"classnames";import{View as c}from"@tarojs/components";import l from"../Mask/index.js";import i from"../node_modules/react-transition-group/esm/CSSTransition.js";var d=o((function(o,d){var u=o.header,f=o.content,p=o.footer,h=o.className,E=void 0===h?"":h,x=o.visible,N=e(a(!1),2),g=N[0],v=N[1];n(d,(function(){return{close:function(){v(!1)}}})),r((function(){v(x)}),[x]);var b=m("xh-dialog",E,{microApp:"h5"!==process.env.TARO_ENV}),j=m("xh-dialog-content-content",{headless:!u}),_=t.createElement(c,{className:b},t.createElement(l,null),t.createElement(i,{in:g,timeout:200,classNames:"scale",unmountOnExit:!0},t.createElement(c,{className:"xh-dialog-content"},t.createElement(c,{className:"xh-dialog-content-header"},u),t.createElement(c,{className:j},f),t.createElement(c,{className:"xh-dialog-content-footer"},p))));return s.createPortal(_,document.body)}));export{d as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className);\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n <View className=\"xh-dialog-content-header\">{header}</View>\n <View className=\"xh-dialog-content-content\">{content}</View>\n <View className=\"xh-dialog-content-footer\">{footer}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","footer","_a","className","visible","_b","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","useEffect","dialogcls","classNames","DialogMain","React","createElement","View","Mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"gWAyBA,IAAMA,EAAYC,GAAmC,SAACC,EAAOC,GACnD,IAAAC,EAAqDF,EAAKE,OAAlDC,EAA6CH,EAAtCG,QAAEC,EAAoCJ,EAAKI,OAAjCC,EAA4BL,EAAKM,UAAjCA,OAAY,IAAAD,EAAA,GAAEA,EAAEE,EAAYP,EAAKO,QAC5DC,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBZ,GAAS,WAAM,MAAC,CAClCa,MAAO,WAELF,GAAe,EAChB,EACD,IAEFG,GAAU,WACRH,EAAeL,EACjB,GAAG,CAACA,IAEJ,IAAMS,EAAYC,EAAW,YAAaX,GAEpCY,EACJC,EAAAC,cAACC,EAAK,CAAAf,UAAWU,GACfG,EAAAC,cAACE,EAAO,MACRH,EAAAC,cAACG,EAAa,CACZC,GAAIb,EACJc,QAAS,IACTR,WAAW,QACXS,eAAa,GAEbP,EAAAC,cAACC,EAAI,CAACf,UAAU,qBACda,EAAAC,cAACC,EAAK,CAAAf,UAAU,4BAA4BJ,GAC5CiB,EAAAC,cAACC,EAAK,CAAAf,UAAU,6BAA6BH,GAC7CgB,EAAAC,cAACC,EAAI,CAACf,UAAU,4BAA4BF,MAMpD,OAAOuB,EAASC,aAAaV,EAAYW,SAASC,KACpD"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/DialogComponent/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: string | ReactNode;\n visible: boolean;\n} & XHComponentCommonProps;\n\nexport type DialogRef = {\n close: () => void;\n};\nconst DialogCom = forwardRef<DialogRef, DialogProps>((props, fromRef) => {\n const { header, content, footer, className = \"\", visible } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close: () => {\n console.log(\"closes\");\n setSelfVisible(false);\n },\n }));\n\n useEffect(() => {\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog\", className, {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n console.log(header);\n console.log(\"title\");\n\n const dialogContent = classNames(\"xh-dialog-content-content\", {\n headless: !header,\n });\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition\n in={selfVisible}\n timeout={200}\n classNames=\"scale\"\n unmountOnExit\n >\n <View className=\"xh-dialog-content\">\n <View className=\"xh-dialog-content-header\">{header}</View>\n <View className={dialogContent}>{content}</View>\n <View className=\"xh-dialog-content-footer\">{footer}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","footer","_a","className","visible","_b","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","useEffect","dialogcls","classNames","microApp","process","env","TARO_ENV","dialogContent","headless","DialogMain","React","createElement","View","Mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"gWAyBA,IAAMA,EAAYC,GAAmC,SAACC,EAAOC,GACnD,IAAAC,EAAqDF,EAAKE,OAAlDC,EAA6CH,EAAtCG,QAAEC,EAAoCJ,EAAKI,OAAjCC,EAA4BL,EAAKM,UAAjCA,OAAY,IAAAD,EAAA,GAAEA,EAAEE,EAAYP,EAAKO,QAC5DC,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBZ,GAAS,WAAM,MAAC,CAClCa,MAAO,WAELF,GAAe,EAChB,EACD,IAEFG,GAAU,WACRH,EAAeL,EACjB,GAAG,CAACA,IAEJ,IAAMS,EAAYC,EAAW,YAAaX,EAAW,CACnDY,SAAmC,OAAzBC,QAAQC,IAAIC,WAKlBC,EAAgBL,EAAW,4BAA6B,CAC5DM,UAAWrB,IAEPsB,EACJC,EAAAC,cAACC,EAAK,CAAArB,UAAWU,GACfS,EAAAC,cAACE,EAAO,MACRH,EAAAC,cAACG,EAAa,CACZC,GAAInB,EACJoB,QAAS,IACTd,WAAW,QACXe,eAAa,GAEbP,EAAAC,cAACC,EAAI,CAACrB,UAAU,qBACdmB,EAAAC,cAACC,EAAK,CAAArB,UAAU,4BAA4BJ,GAC5CuB,EAAAC,cAACC,EAAK,CAAArB,UAAWgB,GAAgBnB,GACjCsB,EAAAC,cAACC,EAAI,CAACrB,UAAU,4BAA4BF,MAMpD,OAAO6B,EAASC,aAAaV,EAAYW,SAASC,KACpD"}
@@ -1,2 +1,2 @@
1
- import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as n,useImperativeHandle as a,useEffect as r}from"react";import c from"classnames";import{View as s}from"@tarojs/components";import l from"../Button/index.js";import i from"../Mask/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var f=o((function(o,f){var d=o.header,u=o.content,h=o.className,p=void 0===h?"":h,g=o.visible,x=o.showCancel,v=void 0===x||x,E=o.confirmText,N=void 0===E?"确定":E,b=o.cancelText,C=void 0===b?"取消":b,j=o.footer,T=void 0!==j&&j,k=o.onConfirm,w=o.onCancel,y=o.onClose,S=e(n(!1),2),_=S[0],B=S[1];a(f,(function(){return{close:M,open:q}}));var M=function(){y&&y(),B(!1)},q=function(){B(!0)};r((function(){g||y&&y(),B(g)}),[g]);var z=c("xh-dialog-ref",p,{show:_}),A=c("xh-dialog-ref-content-footer-button-button"),D=c("xh-dialog-ref-content-footer-button",{"xh-dialog-ref-content-footer-button-center":!v}),F=t.createElement(s,{className:D},v&&t.createElement(l,{type:"ghost",shape:"rectangle",preventTime:0,onClick:function(){w&&w(),M()},className:"xh-dialog-ref-content-footer-button-button"},C),t.createElement(l,{type:"ghost",shape:"rectangle",className:A,onClick:function(){k&&k()},preventTime:0},N));return t.createElement(s,{className:z},t.createElement(i,null),t.createElement(m,{in:_,timeout:200,classNames:"scale"},t.createElement(s,{className:"xh-dialog-ref-content"},t.createElement(s,{className:"xh-dialog-ref-content-header"},d),t.createElement(s,{className:"xh-dialog-ref-content-content"},u),T||t.createElement(s,{className:"xh-dialog-ref-content-footer"},F))))}));export{f as default};
1
+ import{__read as e}from"../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o,useState as n,useImperativeHandle as r,useEffect as a,useMemo as c}from"react";import s from"classnames";import{View as l}from"@tarojs/components";import i from"../Button/index.js";import m from"../Mask/index.js";import f from"../node_modules/react-transition-group/esm/CSSTransition.js";var p=o((function(o,p){var d=o.header,u=o.content,h=o.className,v=void 0===h?"":h,g=o.visible,x=o.showCancel,E=void 0===x||x,N=o.confirmText,C=void 0===N?"确定":N,T=o.cancelText,b=void 0===T?"取消":T,j=o.footer,k=void 0!==j&&j,y=o.onConfirm,_=o.onCancel,A=o.onClose,w=e(n(!1),2),O=w[0],R=w[1];r(p,(function(){return{close:S,open:V}}));var S=function(){A&&A(),R(!1)},V=function(){R(!0)},B=function(){y&&y()},M=function(){_&&_(),S()};a((function(){g||A&&A(),R(g)}),[g]);var q=s("xh-dialog-ref",v,{show:O}),z=s("xh-dialog-ref-content-footer-buttons",{microApp:"h5"!==process.env.TARO_ENV}),D=t.createElement(l,{className:z},E&&t.createElement(i,{type:"ghost",shape:"rectangle",preventTime:0,onClick:M,className:"xh-dialog-ref-content-footer-buttons-microapp-cancel"},b),t.createElement(i,{type:"ghost",shape:"rectangle",className:"xh-dialog-ref-content-footer-buttons-microapp-confirm",onClick:B,preventTime:0},C)),F=t.createElement(l,{className:z},E&&t.createElement(i,{preventTime:0,onClick:M,className:"xh-dialog-ref-content-footer-buttons-h5-cancel"},b),t.createElement(i,{type:"primary",className:"xh-dialog-ref-content-footer-buttons-h5-confirm",onClick:B,preventTime:0},C)),G=c((function(){return"h5"===process.env.TARO_ENV?F:D}),[]);return t.createElement(l,{className:q},t.createElement(m,null),t.createElement(f,{in:O,timeout:200,classNames:"scale"},t.createElement(l,{className:"xh-dialog-ref-content"},t.createElement(l,{className:"xh-dialog-ref-content-header"},d),t.createElement(l,{className:"xh-dialog-ref-content-content"},u),k||t.createElement(l,{className:"xh-dialog-ref-content-footer"},G))))}));export{p as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n const comfirmCls = classNames(\"xh-dialog-ref-content-footer-button-button\");\n const footercls = classNames(\"xh-dialog-ref-content-footer-button\", {\n \"xh-dialog-ref-content-footer-button-center\": !showCancel,\n });\n const dialogFooter = (\n <View className={footercls}>\n {showCancel && (\n <Button\n type=\"ghost\"\n shape=\"rectangle\"\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-button-button\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"ghost\"\n shape=\"rectangle\"\n className={comfirmCls}\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className=\"xh-dialog-ref-content\">\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{dialogFooter}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","useEffect","dialogcls","classNames","show","comfirmCls","footercls","dialogFooter","React","createElement","View","Button","type","shape","preventTime","onClick","Mask","CSSTransition","in","timeout"],"mappings":"yWAgCA,IAAMA,EAAYC,GAAoC,SAACC,EAAOC,GAE1D,IAAAC,EAWEF,EAAKE,OAVPC,EAUEH,EAAKG,QATPC,EASEJ,EATYK,UAAdA,OAAY,IAAAD,EAAA,GAAEA,EACdE,EAQEN,EARKM,QACPC,EAOEP,EAAKQ,WAPPA,cAAiBD,EACjBE,EAMET,EANgBU,YAAlBA,OAAW,IAAAD,EAAG,KAAIA,EAClBE,EAKEX,EALeY,WAAjBA,OAAU,IAAAD,EAAG,KAAIA,EACjBE,EAIEb,SAJFc,OAAS,IAAAD,KACTE,EAGEf,YAFFgB,EAEEhB,WADFiB,EACEjB,UACEkB,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBtB,GAAS,WAAM,MAAC,CAClCuB,MAAKA,EACLC,KAAIA,EACJ,IAEF,IAAMD,EAAQ,WACZP,GAAWA,IACXK,GAAe,EACjB,EAEMG,EAAO,WACXH,GAAe,EACjB,EAWAI,GAAU,WACHpB,GACHW,GAAWA,IAEbK,EAAehB,EACjB,GAAG,CAACA,IAEJ,IAAMqB,EAAYC,EAAW,gBAAiBvB,EAAW,CACvDwB,KAAMR,IAEFS,EAAaF,EAAW,8CACxBG,EAAYH,EAAW,sCAAuC,CAClE,8CAA+CpB,IAE3CwB,EACJC,EAAAC,cAACC,EAAK,CAAA9B,UAAW0B,GACdvB,GACCyB,EAAAC,cAACE,EAAM,CACLC,KAAK,QACLC,MAAM,YACNC,YAAa,EACbC,QA1Ba,WACnBxB,GAAYA,IACZQ,GACF,EAwBQnB,UAAU,8CAETO,GAGLqB,EAACC,cAAAE,EACC,CAAAC,KAAK,QACLC,MAAM,YACNjC,UAAWyB,EACXU,QAxCgB,WACpBzB,GAAaA,GAEf,EAsCMwB,YAAa,GAEZ7B,IAmBP,OAbEuB,EAAAC,cAACC,EAAK,CAAA9B,UAAWsB,GACfM,EAAAC,cAACO,EAAO,MACRR,EAAAC,cAACQ,EAAa,CAACC,GAAItB,EAAauB,QAAS,IAAKhB,WAAW,SACvDK,EAAAC,cAACC,EAAI,CAAC9B,UAAU,yBACd4B,EAAAC,cAACC,EAAK,CAAA9B,UAAU,gCAAgCH,GAChD+B,EAAAC,cAACC,EAAK,CAAA9B,UAAU,iCAAiCF,GAChDW,GACCmB,EAAAC,cAACC,EAAI,CAAC9B,UAAU,gCAAgC2B,KAO5D"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/DialogRef/index.tsx"],"sourcesContent":["import React, {\n ReactNode,\n useState,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useMemo,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport Button from \"../Button\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport \"./index.scss\";\n\nexport type DialogProps = {\n header?: string | ReactNode;\n content: string | ReactNode;\n footer?: ReactNode;\n cancelText?: string;\n confirmText?: string;\n showCancel?: boolean;\n visible: boolean;\n onConfirm?: () => void;\n onCancel?: () => void;\n onClose?: () => void;\n} & XHComponentCommonProps;\n\nexport type IDialogRef = {\n close: () => void;\n open: () => void;\n};\nconst DialogCom = forwardRef<IDialogRef, DialogProps>((props, fromRef) => {\n const {\n header,\n content,\n className = \"\",\n visible,\n showCancel = true,\n confirmText = \"确定\",\n cancelText = \"取消\",\n footer = false,\n onConfirm,\n onCancel,\n onClose,\n } = props;\n const [selfVisible, setSelfVisible] = useState(false);\n\n useImperativeHandle(fromRef, () => ({\n close,\n open,\n }));\n\n const close = () => {\n onClose && onClose();\n setSelfVisible(false);\n };\n\n const open = () => {\n setSelfVisible(true);\n };\n\n const handleConfirm = () => {\n onConfirm && onConfirm();\n // close();\n };\n const handleCancel = () => {\n onCancel && onCancel();\n close();\n };\n\n useEffect(() => {\n if (!visible) {\n onClose && onClose();\n }\n setSelfVisible(visible);\n }, [visible]);\n\n const dialogcls = classNames(\"xh-dialog-ref\", className, {\n show: selfVisible,\n });\n const footercls = classNames(\"xh-dialog-ref-content-footer-buttons\", {\n microApp: process.env.TARO_ENV !== \"h5\",\n });\n const dialogFooterMicroApp = (\n <View className={footercls}>\n {showCancel && (\n <Button\n type=\"ghost\"\n shape=\"rectangle\"\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-buttons-microapp-cancel\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"ghost\"\n shape=\"rectangle\"\n className=\"xh-dialog-ref-content-footer-buttons-microapp-confirm\"\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const dialogFooterH5 = (\n <View className={footercls}>\n {showCancel && (\n <Button\n preventTime={0}\n onClick={handleCancel}\n className=\"xh-dialog-ref-content-footer-buttons-h5-cancel\"\n >\n {cancelText}\n </Button>\n )}\n <Button\n type=\"primary\"\n className=\"xh-dialog-ref-content-footer-buttons-h5-confirm\"\n onClick={handleConfirm}\n preventTime={0}\n >\n {confirmText}\n </Button>\n </View>\n );\n\n const footerRender = useMemo(() => {\n if (process.env.TARO_ENV === \"h5\") {\n return dialogFooterH5;\n }\n return dialogFooterMicroApp;\n }, []);\n\n const DialogMain = (\n <View className={dialogcls}>\n <Mask />\n <CSSTransition in={selfVisible} timeout={200} classNames=\"scale\">\n <View className=\"xh-dialog-ref-content\">\n <View className=\"xh-dialog-ref-content-header\">{header}</View>\n <View className=\"xh-dialog-ref-content-content\">{content}</View>\n {footer || (\n <View className=\"xh-dialog-ref-content-footer\">{footerRender}</View>\n )}\n </View>\n </CSSTransition>\n </View>\n );\n return DialogMain;\n});\n\nexport default DialogCom;\n"],"names":["DialogCom","forwardRef","props","fromRef","header","content","_a","className","visible","_b","showCancel","_c","confirmText","_d","cancelText","_e","footer","onConfirm","onCancel","onClose","_f","__read","useState","selfVisible","setSelfVisible","useImperativeHandle","close","open","handleConfirm","handleCancel","useEffect","dialogcls","classNames","show","footercls","microApp","process","env","TARO_ENV","dialogFooterMicroApp","React","createElement","View","Button","type","shape","preventTime","onClick","dialogFooterH5","footerRender","useMemo","Mask","CSSTransition","in","timeout"],"mappings":"sXAiCA,IAAMA,EAAYC,GAAoC,SAACC,EAAOC,GAE1D,IAAAC,EAWEF,EAAKE,OAVPC,EAUEH,EAAKG,QATPC,EASEJ,EATYK,UAAdA,OAAY,IAAAD,EAAA,GAAEA,EACdE,EAQEN,EARKM,QACPC,EAOEP,EAAKQ,WAPPA,cAAiBD,EACjBE,EAMET,EANgBU,YAAlBA,OAAW,IAAAD,EAAG,KAAIA,EAClBE,EAKEX,EALeY,WAAjBA,OAAU,IAAAD,EAAG,KAAIA,EACjBE,EAIEb,SAJFc,OAAS,IAAAD,KACTE,EAGEf,YAFFgB,EAEEhB,WADFiB,EACEjB,UACEkB,EAAAC,EAAgCC,GAAS,GAAM,GAA9CC,EAAWH,EAAA,GAAEI,OAEpBC,EAAoBtB,GAAS,WAAM,MAAC,CAClCuB,MAAKA,EACLC,KAAIA,EACJ,IAEF,IAAMD,EAAQ,WACZP,GAAWA,IACXK,GAAe,EACjB,EAEMG,EAAO,WACXH,GAAe,EACjB,EAEMI,EAAgB,WACpBX,GAAaA,GAEf,EACMY,EAAe,WACnBX,GAAYA,IACZQ,GACF,EAEAI,GAAU,WACHtB,GACHW,GAAWA,IAEbK,EAAehB,EACjB,GAAG,CAACA,IAEJ,IAAMuB,EAAYC,EAAW,gBAAiBzB,EAAW,CACvD0B,KAAMV,IAEFW,EAAYF,EAAW,uCAAwC,CACnEG,SAAmC,OAAzBC,QAAQC,IAAIC,WAElBC,EACJC,EAAAC,cAACC,EAAK,CAAAnC,UAAW2B,GACdxB,GACC8B,EAAAC,cAACE,EAAM,CACLC,KAAK,QACLC,MAAM,YACNC,YAAa,EACbC,QAASlB,EACTtB,UAAU,wDAETO,GAGL0B,EAACC,cAAAE,EACC,CAAAC,KAAK,QACLC,MAAM,YACNtC,UAAU,wDACVwC,QAASnB,EACTkB,YAAa,GAEZlC,IAKDoC,EACJR,EAAAC,cAACC,EAAK,CAAAnC,UAAW2B,GACdxB,GACC8B,EAAAC,cAACE,EACC,CAAAG,YAAa,EACbC,QAASlB,EACTtB,UAAU,kDAETO,GAGL0B,EAACC,cAAAE,GACCC,KAAK,UACLrC,UAAU,kDACVwC,QAASnB,EACTkB,YAAa,GAEZlC,IAKDqC,EAAeC,GAAQ,WAC3B,MAA6B,OAAzBd,QAAQC,IAAIC,SACPU,EAEFT,CACR,GAAE,IAgBH,OAbEC,EAAAC,cAACC,EAAK,CAAAnC,UAAWwB,GACfS,EAAAC,cAACU,EAAO,MACRX,EAAAC,cAACW,EAAa,CAACC,GAAI9B,EAAa+B,QAAS,IAAKtB,WAAW,SACvDQ,EAAAC,cAACC,EAAI,CAACnC,UAAU,yBACdiC,EAAAC,cAACC,EAAK,CAAAnC,UAAU,gCAAgCH,GAChDoC,EAAAC,cAACC,EAAK,CAAAnC,UAAU,iCAAiCF,GAChDW,GACCwB,EAAAC,cAACC,EAAI,CAACnC,UAAU,gCAAgC0C,KAO5D"}
@@ -1,2 +1,2 @@
1
- import{__read as t}from"../node_modules/tslib/tslib.es6.js";import e,{useState as r,useEffect as s,useMemo as o}from"react";import{Image as c}from"@tarojs/components";import{getImageInfo as a}from"@tarojs/taro";var i=function(i){var n=i.width,m=void 0===n?"":n,h=i.height,l=void 0===h?"":h,f=i.src,d=i.className,u=t(r({}),2),g=u[0],p=u[1];s((function(){"h5"===process.env.TARO_ENV||d||a({src:f,success:function(t){"getImageInfo:ok"===t.errMsg&&p({width:t.width,height:t.height})}})}),[]);var v=o((function(){var t=g||{};return m&&(t.width="".concat(m)),l&&(t.height="".concat(l)),t}),[m,l,g]);return"h5"!==process.env.TARO_ENV?e.createElement(c,{src:f,style:v,className:d}):e.createElement("img",{src:f,alt:"",style:v,className:d})};export{i as default};
1
+ import{__read as t}from"../node_modules/tslib/tslib.es6.js";import e,{useState as r,useEffect as s,useMemo as o}from"react";import{Image as c}from"@tarojs/components";import{getImageInfo as a,pxTransform as i}from"@tarojs/taro";var n=function(n){var m=n.width,h=void 0===m?"":m,l=n.height,f=void 0===l?"":l,d=n.src,u=n.className,g=t(r({}),2),p=g[0],v=g[1];s((function(){"h5"===process.env.TARO_ENV||u||a({src:d,success:function(t){"getImageInfo:ok"===t.errMsg&&v({width:t.width,height:t.height})}})}),[]);var N=o((function(){var t=p||{};return h&&(t.width="".concat(i(h))),f&&(t.height="".concat(i(f))),t}),[h,f,p]);return"h5"!==process.env.TARO_ENV?e.createElement(c,{src:d,style:N,className:u}):e.createElement("img",{src:d,alt:"",style:N,className:u})};export{n as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Image/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from \"react\";\nimport { Image } from \"@tarojs/components\";\nimport { getImageInfo } from \"@tarojs/taro\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nexport type ImageProps = {\n width?: number;\n height?: number;\n src: string;\n} & XHComponentCommonProps;\n\nconst XHImage: FC<ImageProps> = props => {\n const { width = \"\", height = \"\", src, className } = props;\n const [defaultSize, setDefaultSize] = useState<{\n width?: number | string;\n height?: number | string;\n } | null>({});\n\n useEffect(() => {\n if (process.env.TARO_ENV !== \"h5\" && !className) {\n getImageInfo({\n src,\n success: res => {\n if (res.errMsg === \"getImageInfo:ok\") {\n console.log(res);\n setDefaultSize({ width: res.width, height: res.height });\n }\n },\n });\n } else {\n }\n }, []);\n\n const size = useMemo(() => {\n let computedSize = defaultSize || {};\n if (width) {\n (computedSize as any).width = `${width}`;\n }\n if (height) {\n (computedSize as any).height = `${height}`;\n }\n console.log(\"size\");\n\n return computedSize;\n }, [width, height, defaultSize]);\n\n return process.env.TARO_ENV !== \"h5\" ? (\n <Image src={src} style={size} className={className} />\n ) : (\n <img src={src} alt=\"\" style={size} className={className} />\n );\n};\n\nexport default XHImage;\n"],"names":["XHImage","props","_a","width","_b","height","src","className","_c","__read","useState","defaultSize","setDefaultSize","useEffect","process","env","TARO_ENV","getImageInfo","success","res","errMsg","size","useMemo","computedSize","concat","React","Image","style","createElement","alt"],"mappings":"mNAYM,IAAAA,EAA0B,SAAAC,GACtB,IAAAC,EAA4CD,EAAKE,MAAjDA,OAAQ,IAAAD,EAAA,GAAEA,EAAEE,EAAgCH,EAArBI,OAAXA,OAAM,IAAAD,EAAG,GAAEA,EAAEE,EAAmBL,EAAhBK,IAAEC,EAAcN,EAAKM,UACnDC,EAAAC,EAAgCC,EAG5B,CAAE,GAAC,GAHNC,EAAWH,EAAA,GAAEI,OAKpBC,GAAU,WACqB,OAAzBC,QAAQC,IAAIC,UAAsBT,GACpCU,EAAa,CACXX,IAAGA,EACHY,QAAS,SAAAC,GACY,oBAAfA,EAAIC,QAENR,EAAe,CAAET,MAAOgB,EAAIhB,MAAOE,OAAQc,EAAId,QAElD,GAIN,GAAE,IAEH,IAAMgB,EAAOC,GAAQ,WACnB,IAAIC,EAAeZ,GAAe,GASlC,OARIR,IACDoB,EAAqBpB,MAAQ,GAAGqB,OAAArB,IAE/BE,IACDkB,EAAqBlB,OAAS,GAAGmB,OAAAnB,IAI7BkB,CACR,GAAE,CAACpB,EAAOE,EAAQM,IAEnB,MAAgC,OAAzBG,QAAQC,IAAIC,SACjBS,gBAACC,EAAK,CAACpB,IAAKA,EAAKqB,MAAON,EAAMd,UAAWA,IAEzCkB,EAAKG,cAAA,MAAA,CAAAtB,IAAKA,EAAKuB,IAAI,GAAGF,MAAON,EAAMd,UAAWA,GAElD"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Image/index.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from \"react\";\nimport { Image } from \"@tarojs/components\";\nimport { getImageInfo, pxTransform } from \"@tarojs/taro\";\nimport \"./index.scss\";\nimport { XHComponentCommonProps } from \"../../types\";\n\nexport type ImageProps = {\n width?: number;\n height?: number;\n src: string;\n} & XHComponentCommonProps;\n\nconst XHImage: FC<ImageProps> = props => {\n const { width = \"\", height = \"\", src, className } = props;\n const [defaultSize, setDefaultSize] = useState<{\n width?: number | string;\n height?: number | string;\n } | null>({});\n\n useEffect(() => {\n if (process.env.TARO_ENV !== \"h5\" && !className) {\n getImageInfo({\n src,\n success: res => {\n if (res.errMsg === \"getImageInfo:ok\") {\n console.log(res);\n setDefaultSize({ width: res.width, height: res.height });\n }\n },\n });\n } else {\n }\n }, []);\n\n const size = useMemo(() => {\n let computedSize = defaultSize || {};\n if (width) {\n (computedSize as any).width = `${pxTransform(width)}`;\n }\n if (height) {\n (computedSize as any).height = `${pxTransform(height)}`;\n }\n console.log(\"size\");\n\n return computedSize;\n }, [width, height, defaultSize]);\n\n return process.env.TARO_ENV !== \"h5\" ? (\n <Image src={src} style={size} className={className} />\n ) : (\n <img src={src} alt=\"\" style={size} className={className} />\n );\n};\n\nexport default XHImage;\n"],"names":["XHImage","props","_a","width","_b","height","src","className","_c","__read","useState","defaultSize","setDefaultSize","useEffect","process","env","TARO_ENV","getImageInfo","success","res","errMsg","size","useMemo","computedSize","concat","pxTransform","React","Image","style","createElement","alt"],"mappings":"oOAYM,IAAAA,EAA0B,SAAAC,GACtB,IAAAC,EAA4CD,EAAKE,MAAjDA,OAAQ,IAAAD,EAAA,GAAEA,EAAEE,EAAgCH,EAArBI,OAAXA,OAAM,IAAAD,EAAG,GAAEA,EAAEE,EAAmBL,EAAhBK,IAAEC,EAAcN,EAAKM,UACnDC,EAAAC,EAAgCC,EAG5B,CAAE,GAAC,GAHNC,EAAWH,EAAA,GAAEI,OAKpBC,GAAU,WACqB,OAAzBC,QAAQC,IAAIC,UAAsBT,GACpCU,EAAa,CACXX,IAAGA,EACHY,QAAS,SAAAC,GACY,oBAAfA,EAAIC,QAENR,EAAe,CAAET,MAAOgB,EAAIhB,MAAOE,OAAQc,EAAId,QAElD,GAIN,GAAE,IAEH,IAAMgB,EAAOC,GAAQ,WACnB,IAAIC,EAAeZ,GAAe,GASlC,OARIR,IACDoB,EAAqBpB,MAAQ,GAAAqB,OAAGC,EAAYtB,KAE3CE,IACDkB,EAAqBlB,OAAS,GAAAmB,OAAGC,EAAYpB,KAIzCkB,CACR,GAAE,CAACpB,EAAOE,EAAQM,IAEnB,MAAgC,OAAzBG,QAAQC,IAAIC,SACjBU,gBAACC,EAAK,CAACrB,IAAKA,EAAKsB,MAAOP,EAAMd,UAAWA,IAEzCmB,EAAKG,cAAA,MAAA,CAAAvB,IAAKA,EAAKwB,IAAI,GAAGF,MAAOP,EAAMd,UAAWA,GAElD"}
@@ -1,2 +1,2 @@
1
- import e,{useMemo as t}from"react";import o from"react-dom";import a from"classnames";import{View as r}from"@tarojs/components";import s from"../Mask/index.js";import n from"../Image/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var c=function(c){var i=c.title,l=c.className,u=void 0===l?"":l,d=c.icon,f=void 0===d?"success":d,p=c.image,E=void 0===p?"":p,g=a("xh-toast",u),v=a("iconfont",{success:"icon-success_toast",error:"icon-failure_toast",loading:"icon-loading_toast"}[f]),x=t((function(){return E?e.createElement(n,{src:E,width:24,height:24}):f?e.createElement("span",{className:v}):void 0}),[f,E]),h=e.createElement(r,{className:g},e.createElement(s,{mask:"transparent"}),e.createElement(m,{in:!0,timeout:200,classNames:"face",unmountOnExit:!0},e.createElement(r,{className:"xh-toast-content"},x,e.createElement(r,null,i))));return o.createPortal(h,document.body)};export{c as default};
1
+ import e,{useMemo as t}from"react";import o from"react-dom";import a from"classnames";import{View as n}from"@tarojs/components";import r from"../Mask/index.js";import s from"../Image/index.js";import m from"../node_modules/react-transition-group/esm/CSSTransition.js";var i=function(i){var c=i.title,l=i.className,d=void 0===l?"":l,u=i.icon,f=void 0===u?"none":u,p=i.image,E=void 0===p?"":p,g=a("xh-toast",d),v=a("iconfont",{success:"icon-success_toast",error:"icon-failure_toast",loading:"icon-loading_toast",none:""}[f]),x=t((function(){return E?e.createElement(s,{src:E,width:24,height:24}):f?e.createElement("span",{className:v}):void 0}),[f,E]),h=e.createElement(n,{className:g},e.createElement(r,{mask:"transparent"}),e.createElement(m,{in:!0,timeout:200,classNames:"face",unmountOnExit:!0},e.createElement(n,{className:"xh-toast-content"},x,e.createElement(n,null,c))));return o.createPortal(h,document.body)};export{i as default};
2
2
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React, { FC, useMemo } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport Image from \"../Image\";\n\nimport \"./index.scss\";\n\nexport type ToastProps = {\n title: string;\n duration?: number;\n /** 图标\n * 可选值:\n * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'none': 不显示图标,此时 title 文本最多可显示两行 */\n icon?: \"success\" | \"error\" | \"loading\" | \"none\";\n /** 自定义图标的本地路径,image 的优先级高于 icon */\n image?: string;\n /** 是否显示透明蒙层,防止触摸穿透 */\n mask?: boolean;\n} & XHComponentCommonProps;\n\nconst ToastCom: FC<ToastProps> = (props) => {\n const { title, className = \"\", icon = \"success\", image = \"\" } = props;\n\n const toastcls = classNames(\"xh-toast\", className);\n\n // icon-success_toast\n // icon-alert_toast\n // icon-failure_toast\n // icon-loading_toast\n\n const classConfig = {\n success: \"icon-success_toast\",\n error: \"icon-failure_toast\",\n loading: \"icon-loading_toast\",\n };\n const cls = classNames(\"iconfont\", classConfig[icon]);\n const showIcon = useMemo(() => {\n if (image) return <Image src={image} width={24} height={24} />;\n if (icon) return <span className={cls}></span>;\n }, [icon, image]);\n\n const DialogMain = (\n <View className={toastcls}>\n <Mask mask=\"transparent\" />\n <CSSTransition in timeout={200} classNames=\"face\" unmountOnExit>\n <View className=\"xh-toast-content\">\n {showIcon}\n <View>{title}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n};\n\nexport default ToastCom;\n"],"names":["ToastCom","props","title","_a","className","_b","icon","_c","image","toastcls","classNames","cls","success","error","loading","showIcon","useMemo","React","createElement","Image","src","width","height","DialogMain","View","Mask","mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"4QA2BM,IAAAA,EAA2B,SAACC,GACxB,IAAAC,EAAwDD,EAAKC,MAAtDC,EAAiDF,EAAKG,UAAtDA,OAAY,IAAAD,EAAA,KAAIE,EAAiCJ,EAAKK,KAAtCA,OAAO,IAAAD,EAAA,YAAWE,EAAeN,EAAKO,MAApBA,OAAQ,IAAAD,EAAA,KAEnDE,EAAWC,EAAW,WAAYN,GAYlCO,EAAMD,EAAW,WALH,CAClBE,QAAS,qBACTC,MAAO,qBACPC,QAAS,sBAEoCR,IACzCS,EAAWC,GAAQ,WACvB,OAAIR,EAAcS,EAACC,cAAAC,EAAM,CAAAC,IAAKZ,EAAOa,MAAO,GAAIC,OAAQ,KACpDhB,EAAaW,EAAMC,cAAA,OAAA,CAAAd,UAAWO,SAAlC,CACF,GAAG,CAACL,EAAME,IAEJe,EACJN,EAAAC,cAACM,EAAK,CAAApB,UAAWK,GACfQ,EAAAC,cAACO,EAAI,CAACC,KAAK,gBACXT,EAAAC,cAACS,EAAa,CAACC,IAAE,EAACC,QAAS,IAAKnB,WAAW,OAAOoB,eAAa,GAC7Db,EAAAC,cAACM,EAAI,CAACpB,UAAU,oBACbW,EACDE,EAACC,cAAAM,OAAMtB,MAMf,OAAO6B,EAASC,aAAaT,EAAYU,SAASC,KACpD"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React, { FC, useMemo } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport classNames from \"classnames\";\nimport { View } from \"@tarojs/components\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { XHComponentCommonProps } from \"../../types\";\nimport Mask from \"../Mask\";\nimport Image from \"../Image\";\n\nimport \"./index.scss\";\n\nexport type ToastProps = {\n title: string;\n duration?: number;\n /** 图标\n * 可选值:\n * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;\n * - 'none': 不显示图标,此时 title 文本最多可显示两行 */\n icon?: \"success\" | \"error\" | \"loading\" | \"none\";\n /** 自定义图标的本地路径,image 的优先级高于 icon */\n image?: string;\n /** 是否显示透明蒙层,防止触摸穿透 */\n mask?: boolean;\n} & XHComponentCommonProps;\n\nconst ToastCom: FC<ToastProps> = props => {\n const { title, className = \"\", icon = \"none\", image = \"\" } = props;\n\n const toastcls = classNames(\"xh-toast\", className);\n\n // icon-success_toast\n // icon-alert_toast\n // icon-failure_toast\n // icon-loading_toast\n\n const classConfig = {\n success: \"icon-success_toast\",\n error: \"icon-failure_toast\",\n loading: \"icon-loading_toast\",\n none: \"\",\n };\n const cls = classNames(\"iconfont\", classConfig[icon]);\n const showIcon = useMemo(() => {\n if (image) return <Image src={image} width={24} height={24} />;\n if (icon) return <span className={cls}></span>;\n }, [icon, image]);\n\n const DialogMain = (\n <View className={toastcls}>\n <Mask mask=\"transparent\" />\n <CSSTransition in timeout={200} classNames=\"face\" unmountOnExit>\n <View className=\"xh-toast-content\">\n {showIcon}\n <View>{title}</View>\n </View>\n </CSSTransition>\n </View>\n );\n\n return ReactDOM.createPortal(DialogMain, document.body);\n};\n\nexport default ToastCom;\n"],"names":["ToastCom","props","title","_a","className","_b","icon","_c","image","toastcls","classNames","cls","success","error","loading","none","showIcon","useMemo","React","createElement","Image","src","width","height","DialogMain","View","Mask","mask","CSSTransition","in","timeout","unmountOnExit","ReactDOM","createPortal","document","body"],"mappings":"4QA2BM,IAAAA,EAA2B,SAAAC,GACvB,IAAAC,EAAqDD,EAAKC,MAAnDC,EAA8CF,EAAKG,UAAnDA,OAAY,IAAAD,EAAA,KAAIE,EAA8BJ,EAAKK,KAAnCA,OAAO,IAAAD,EAAA,SAAQE,EAAeN,EAAKO,MAApBA,OAAQ,IAAAD,EAAA,KAEhDE,EAAWC,EAAW,WAAYN,GAalCO,EAAMD,EAAW,WANH,CAClBE,QAAS,qBACTC,MAAO,qBACPC,QAAS,qBACTC,KAAM,IAEuCT,IACzCU,EAAWC,GAAQ,WACvB,OAAIT,EAAcU,EAACC,cAAAC,EAAM,CAAAC,IAAKb,EAAOc,MAAO,GAAIC,OAAQ,KACpDjB,EAAaY,EAAMC,cAAA,OAAA,CAAAf,UAAWO,SAAlC,CACF,GAAG,CAACL,EAAME,IAEJgB,EACJN,EAAAC,cAACM,EAAK,CAAArB,UAAWK,GACfS,EAAAC,cAACO,EAAI,CAACC,KAAK,gBACXT,EAAAC,cAACS,EAAa,CAACC,IAAE,EAACC,QAAS,IAAKpB,WAAW,OAAOqB,eAAa,GAC7Db,EAAAC,cAACM,EAAI,CAACrB,UAAU,oBACbY,EACDE,EAACC,cAAAM,OAAMvB,MAMf,OAAO8B,EAASC,aAAaT,EAAYU,SAASC,KACpD"}