@ibiz-template/mob-vue3-components 0.7.41-alpha.21 → 0.7.41-alpha.22

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 (181) hide show
  1. package/dist/ibiz-markdown-editor-COU_MxNu.js +2 -0
  2. package/dist/ibiz-markdown-editor-COU_MxNu.js.map +1 -0
  3. package/dist/index-Bn7VkqJp.js +76 -0
  4. package/dist/index-Bn7VkqJp.js.map +1 -0
  5. package/dist/{index-BkzKmBm3.js → index-ChdHGLJI.js} +2 -2
  6. package/dist/{index-BkzKmBm3.js.map → index-ChdHGLJI.js.map} +1 -1
  7. package/dist/index-Dd7yiMzY.js +2 -0
  8. package/dist/index-Dd7yiMzY.js.map +1 -0
  9. package/dist/index.es-D0mZvSDS.js +14 -0
  10. package/dist/index.es-D0mZvSDS.js.map +1 -0
  11. package/dist/index.min.css +9 -9
  12. package/dist/index.system.min.js +1 -1
  13. package/dist/{quill-D-355-KZ.js → quill-BOA7ZLOz.js} +2 -2
  14. package/dist/{quill-D-355-KZ.js.map → quill-BOA7ZLOz.js.map} +1 -1
  15. package/dist/{quill-editor-DyVF1l3P.js → quill-editor-DcZd_lqh.js} +2 -2
  16. package/dist/{quill-editor-DyVF1l3P.js.map → quill-editor-DcZd_lqh.js.map} +1 -1
  17. package/dist/quill-editor-preview-DghpeKpg.js +2 -0
  18. package/dist/quill-editor-preview-DghpeKpg.js.map +1 -0
  19. package/dist/{tree-sdPuTW-7.js → tree-BTa0bMPr.js} +2 -2
  20. package/dist/{tree-sdPuTW-7.js.map → tree-BTa0bMPr.js.map} +1 -1
  21. package/dist/xlsx-util-CQaOn5OK.js +105 -0
  22. package/dist/xlsx-util-CQaOn5OK.js.map +1 -0
  23. package/es/_virtual/FileSaver.min.mjs +3 -0
  24. package/es/_virtual/index12.mjs +2 -2
  25. package/es/_virtual/index14.mjs +2 -2
  26. package/es/_virtual/index18.mjs +2 -2
  27. package/es/_virtual/index19.mjs +2 -2
  28. package/es/common/split-trigger/split-trigger.css +1 -1
  29. package/es/common/tab-layout/tab-default-layout/tab-default-layout.mjs +1 -0
  30. package/es/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  31. package/es/common/view-message/view-message.mjs +1 -1
  32. package/es/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  33. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +1 -1
  34. package/es/control/app-menu-list-view/app-menu-list-view.css +1 -1
  35. package/es/control/calendar/calendar.css +1 -1
  36. package/es/control/calendar/calendar.mjs +1 -1
  37. package/es/control/caption-bar/caption-bar.css +1 -1
  38. package/es/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  39. package/es/control/dashboard/dashboard.css +1 -1
  40. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  41. package/es/control/data-view/data-view.css +1 -1
  42. package/es/control/drbar/drbar.css +1 -1
  43. package/es/control/drtab/drtab.controller.mjs +1 -1
  44. package/es/control/drtab/drtab.css +1 -1
  45. package/es/control/list/md-ctrl/md-ctrl.css +1 -1
  46. package/es/control/search-bar/filter-tree/filter-tree.css +1 -1
  47. package/es/control/search-bar/search-bar.css +1 -1
  48. package/es/control/tab-exp-panel/tab-exp-panel.css +1 -1
  49. package/es/control/toolbar/toolbar-render-util.mjs +4 -0
  50. package/es/control/toolbar/toolbar.css +1 -1
  51. package/es/control/tree/tree.css +1 -1
  52. package/es/control/wizard-panel/wizard-panel.css +1 -1
  53. package/es/editor/array/ibiz-array/ibiz-array.css +1 -1
  54. package/es/editor/data-picker/picker-editor.controller.mjs +1 -1
  55. package/es/editor/html/quill-editor/quill-editor.css +1 -1
  56. package/es/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  57. package/es/editor/html/quill-editor-preview/quill-editor-preview.mjs +1 -2
  58. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +3 -1
  59. package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  60. package/es/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  61. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  62. package/es/editor/text-box/input/input.mjs +33 -2
  63. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  64. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +1 -1
  65. package/es/ibiz-vue3.mjs +1 -0
  66. package/es/index.mjs +3 -0
  67. package/es/locale/en/index.mjs +23 -0
  68. package/es/locale/zh-CN/index.mjs +26 -1
  69. package/es/mob-app/components/modal-router-shell/modal-router-shell.mjs +2 -2
  70. package/es/mob-app/guard/auth-guard/auth-guard.mjs +206 -194
  71. package/es/mob-app/guard/auth-guard/dyna-auth-guard.mjs +65 -0
  72. package/es/mob-app/guard/index.mjs +1 -0
  73. package/es/mob-app/index.mjs +1 -0
  74. package/es/mob-app/main.mjs +14 -1
  75. package/es/mob-app/router/index.mjs +6 -4
  76. package/es/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.mjs +1 -1
  77. package/es/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.mjs +4425 -0
  78. package/es/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.mjs +1 -1
  79. package/es/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.mjs +15 -0
  80. package/es/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.mjs +1 -1
  81. package/es/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.mjs +1 -1
  82. package/es/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +24580 -0
  83. package/es/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  84. package/es/panel-component/view-content-panel-container/view-content-panel-container.mjs +18 -4
  85. package/es/util/ai-chat-util/ai-chat-util.mjs +932 -0
  86. package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  87. package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +140 -0
  88. package/es/util/app-drawer/app-drawer-component.mjs +7 -17
  89. package/es/util/app-modal/app-modal-component.mjs +4 -2
  90. package/es/util/app-util/app-util.mjs +76 -6
  91. package/es/util/index.mjs +2 -0
  92. package/es/util/list-util/list-render-util.mjs +1 -1
  93. package/es/util/user-route-util/user-route-util.mjs +55 -0
  94. package/es/util/xlsx-util/xlsx-util.mjs +163 -0
  95. package/es/view/portal-view/portal-view.mjs +3 -2
  96. package/es/view-engine/mob-calendar-view.engine.mjs +4 -0
  97. package/es/view-engine/mob-pickup-md-view.engine.mjs +1 -0
  98. package/lib/_virtual/FileSaver.min.cjs +5 -0
  99. package/lib/_virtual/index12.cjs +2 -2
  100. package/lib/_virtual/index14.cjs +2 -2
  101. package/lib/_virtual/index18.cjs +2 -2
  102. package/lib/_virtual/index19.cjs +2 -2
  103. package/lib/common/split-trigger/split-trigger.css +1 -1
  104. package/lib/common/tab-layout/tab-default-layout/tab-default-layout.cjs +1 -0
  105. package/lib/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  106. package/lib/common/view-message/view-message.cjs +1 -1
  107. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +1 -1
  108. package/lib/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  109. package/lib/control/app-menu-list-view/app-menu-list-view.css +1 -1
  110. package/lib/control/calendar/calendar.cjs +1 -1
  111. package/lib/control/calendar/calendar.css +1 -1
  112. package/lib/control/caption-bar/caption-bar.css +1 -1
  113. package/lib/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  114. package/lib/control/dashboard/dashboard.css +1 -1
  115. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  116. package/lib/control/data-view/data-view.css +1 -1
  117. package/lib/control/drbar/drbar.css +1 -1
  118. package/lib/control/drtab/drtab.controller.cjs +1 -1
  119. package/lib/control/drtab/drtab.css +1 -1
  120. package/lib/control/list/md-ctrl/md-ctrl.css +1 -1
  121. package/lib/control/search-bar/filter-tree/filter-tree.css +1 -1
  122. package/lib/control/search-bar/search-bar.css +1 -1
  123. package/lib/control/tab-exp-panel/tab-exp-panel.css +1 -1
  124. package/lib/control/toolbar/toolbar-render-util.cjs +4 -0
  125. package/lib/control/toolbar/toolbar.css +1 -1
  126. package/lib/control/tree/tree.css +1 -1
  127. package/lib/control/wizard-panel/wizard-panel.css +1 -1
  128. package/lib/editor/array/ibiz-array/ibiz-array.css +1 -1
  129. package/lib/editor/data-picker/picker-editor.controller.cjs +1 -1
  130. package/lib/editor/html/quill-editor/quill-editor.css +1 -1
  131. package/lib/editor/html/quill-editor-preview/quill-editor-preview.cjs +1 -2
  132. package/lib/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  133. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +3 -1
  134. package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  135. package/lib/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  136. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  137. package/lib/editor/text-box/input/input.cjs +32 -1
  138. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +1 -1
  139. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  140. package/lib/ibiz-vue3.cjs +1 -0
  141. package/lib/index.cjs +7 -0
  142. package/lib/locale/en/index.cjs +23 -0
  143. package/lib/locale/zh-CN/index.cjs +26 -1
  144. package/lib/mob-app/components/modal-router-shell/modal-router-shell.cjs +2 -2
  145. package/lib/mob-app/guard/auth-guard/auth-guard.cjs +206 -194
  146. package/lib/mob-app/guard/auth-guard/dyna-auth-guard.cjs +67 -0
  147. package/lib/mob-app/guard/index.cjs +2 -0
  148. package/lib/mob-app/index.cjs +2 -0
  149. package/lib/mob-app/main.cjs +14 -1
  150. package/lib/mob-app/router/index.cjs +6 -4
  151. package/lib/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.cjs +1 -1
  152. package/lib/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs +4427 -0
  153. package/lib/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.cjs +1 -1
  154. package/lib/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.cjs +20 -0
  155. package/lib/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.cjs +1 -1
  156. package/lib/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.cjs +1 -1
  157. package/lib/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.cjs +24599 -0
  158. package/lib/panel-component/view-content-panel-container/view-content-panel-container.cjs +18 -4
  159. package/lib/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  160. package/lib/util/ai-chat-util/ai-chat-util.cjs +934 -0
  161. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +142 -0
  162. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  163. package/lib/util/app-drawer/app-drawer-component.cjs +7 -17
  164. package/lib/util/app-modal/app-modal-component.cjs +4 -2
  165. package/lib/util/app-util/app-util.cjs +75 -5
  166. package/lib/util/index.cjs +5 -0
  167. package/lib/util/list-util/list-render-util.cjs +1 -1
  168. package/lib/util/user-route-util/user-route-util.cjs +58 -0
  169. package/lib/util/xlsx-util/xlsx-util.cjs +166 -0
  170. package/lib/view/portal-view/portal-view.cjs +3 -2
  171. package/lib/view-engine/mob-calendar-view.engine.cjs +4 -0
  172. package/lib/view-engine/mob-pickup-md-view.engine.cjs +1 -0
  173. package/package.json +12 -9
  174. package/dist/ibiz-markdown-editor-DMe7ZdYW.js +0 -2
  175. package/dist/ibiz-markdown-editor-DMe7ZdYW.js.map +0 -1
  176. package/dist/index-CADWRoaa.js +0 -76
  177. package/dist/index-CADWRoaa.js.map +0 -1
  178. package/dist/index-ugd4IDkI.js +0 -2
  179. package/dist/index-ugd4IDkI.js.map +0 -1
  180. package/dist/quill-editor-preview-3eAbHBYz.js +0 -2
  181. package/dist/quill-editor-preview-3eAbHBYz.js.map +0 -1
@@ -1,2 +0,0 @@
1
- System.register(["vue","@ibiz-template/vue3-util","qx-util","cherry-markdown","@ibiz-template/core"],function($){"use strict";var C,s,c,r,d,k,I,f,U,M,P,N,m,w,O,z;return{setters:[function(n){C=n.defineComponent,s=n.createVNode,c=n.resolveComponent,r=n.ref,d=n.watch,k=n.onMounted,I=n.onUnmounted,f=n.nextTick},function(n){U=n.getEditorEmits,M=n.getMarkDownProps,P=n.useNamespace,N=n.useUIStore},function(n){m=n.createUUID},function(n){w=n.default},function(n){O=n.getAppCookie,z=n.CoreConst}],execute:function(){const n=$("default",C({name:"IBizMarkDown",props:M(),emits:U(),setup(i,{emit:J}){const V=P("markdown"),y=i.controller,l=r(""),a=r(null),p=r(null),x=m(),b=m(),A=r({[`${ibiz.env.tokenHeader}Authorization`]:`${ibiz.env.tokenPrefix}Bearer ${O(z.TOKEN)}`}),D=r(""),_=r(""),{UIStore:E}=N(),u=r(E.theme),S=r("editOnly"),g=r(""),j=r({});d(()=>i.data,e=>{if(e){const t={...y.editorParams};t.uploadparams&&(t.uploadParams=JSON.parse(t.uploadparams)),t.exportparams&&(t.exportParams=JSON.parse(t.exportparams));const o=ibiz.util.file.calcFileUpDownUrl(y.context,y.params,e,t);D.value=o.uploadUrl,_.value=o.downloadUrl}},{immediate:!0,deep:!0});const q=async(e,t)=>{const o=await ibiz.util.file.fileUpload(D.value,e,A.value),h=_.value.replace("%fileId%",o.fileid);t(h)},F=()=>{var e;return(e=a.value)==null?void 0:e.getHtml()},v=()=>{var e;return(e=a.value)==null?void 0:e.getMarkdown()},T=e=>{var t,o;(t=a.value)==null||t.setMarkdown(e,!1),(o=p.value)==null||o.setMarkdown(e,!1)},K=e=>{var t;(t=p.value)==null||t.setMarkdown(e,!0)};d(()=>i.value,(e,t)=>{e!==t&&(e?l.value=e:l.value="")},{immediate:!0}),d(l,(e,t)=>{const o=v();e!==t&&o!==e&&T(e)});const W=e=>{K(v()),J("change",v())},L=(e,t)=>({[e]:t}),B={value:l.value,theme:u.value,fileUpload:q,emoji:{useUnicode:!0},header:{anchorStyle:"autonumber"},editor:{height:"100%",defaultModel:S.value,codemirror:{autofocus:!1}},toolbars:{theme:u.value,toolbar:["switchModel","bold","italic","strikethrough","header",{insert:["image","audio","video","link","hr","br","code","formula","toc","table","pdf","word"]},"settings"]}},Q=()=>{const e={id:x,...B,callback:{afterChange:W,beforeImageMounted:L},value:l.value};f(()=>{a.value=new w(e)})},R=()=>{const e={id:b,...B,editor:{defaultModel:"previewOnly"}};f(()=>{p.value=new w(e)})};k(()=>{R()}),d(()=>E.theme,e=>{var t,o;u.value=e,(t=a.value)==null||t.setTheme(u.value),(o=p.value)==null||o.setTheme(u.value)}),I(()=>{a.value=null,p.value=null});const G=r(!1),X=e=>{const t={type:"",url:""};return e.nodeName==="A"?(t.type="A",t.url=e.hash):e.parentNode&&e.parentNode.nodeName==="A"?(t.type="A",t.url=e.parentNode.hash):e.nodeName==="IMG"&&(t.type="IMG",t.url=e.src),t};return{ns:V,currentVal:l,id:x,previewId:b,editor:a,headers:A,theme:u,defaultModel:S,cssVars:j,getCherryHtml:F,getCherryContent:v,setCherryContent:T,openPicker:async e=>{const{target:t}=e;if(t){const o=X(t);if(o.type==="A"&&o.url.startsWith("#")){e.preventDefault(),e.stopPropagation();const h=o.url.slice(1);if(h){if(document.getElementById(b)){const H=document.getElementById(h);H&&H.scrollIntoView({behavior:"smooth"})}return}}if(o.type==="IMG"&&o.url){g.value=o.url;return}}i.disabled||i.readonly||(G.value=!0,a.value||Q())},isOpen:G,previewImage:g,handlePreviewClose:()=>{g.value=""}}},render(){return s("div",{class:[this.ns.b(),this.disabled?this.ns.m("disabled"):"",this.readonly?this.ns.m("readonly"):""]},[s(c("van-field"),{readonly:!0,disabled:this.disabled,onClick:this.openPicker},{input:s("div",{id:this.previewId,style:this.cssVars,class:this.ns.b("cherry")},null)}),s(c("van-popup"),{class:this.ns.b("image-popup"),show:!!this.previewImage,"close-on-popstate":!0,onClose:this.handlePreviewClose},{default:()=>[s(c("iBizPreviewImage"),{url:this.previewImage},null)]}),s(c("van-dialog"),{show:this.isOpen,"onUpdate:show":i=>this.isOpen=i,className:this.ns.b("dialog"),"close-on-popstate":!0},{default:()=>s("div",{id:this.id,style:this.cssVars,class:[this.ns.b("cherry"),this.ns.is("hidden",!this.isOpen)]},null)})])}}))}}});
2
- //# sourceMappingURL=ibiz-markdown-editor-DMe7ZdYW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ibiz-markdown-editor-DMe7ZdYW.js","sources":["../src/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.tsx"],"sourcesContent":["import {\n defineComponent,\n nextTick,\n onMounted,\n onUnmounted,\n Ref,\n ref,\n watch,\n} from 'vue';\nimport {\n getMarkDownProps,\n getEditorEmits,\n useUIStore,\n useNamespace,\n} from '@ibiz-template/vue3-util';\nimport { createUUID } from 'qx-util';\nimport Cherry from 'cherry-markdown';\nimport { CoreConst, getAppCookie } from '@ibiz-template/core';\nimport { MarkDownEditorController } from '../markdown-editor.controller';\nimport './ibiz-markdown-editor.scss';\n\n/**\n * 移动端Markdown编辑框\n * @primary\n * @description 基于cherry-markdown深度定制可扩展的Markdown编辑器,用于Markdown文档编辑。支持编辑器类型包含:`移动端Markdown编辑框`\n * @editorparams {name:uploadparams,parameterType:string,description:上传参数,图片或文件上传时,用于计算上传路径}\n * @editorparams {name:exportparams,parameterType:string,description:下载参数,图片或文件下载时,用于计算下载路径}\n * @editorparams {name:osscat,parameterType:string,description:用于计算上传和下载路径的OSS参数}\n * @editorparams {name:readonly,parameterType:boolean,defaultvalue:false,description:设置编辑器是否为只读态}\n * @ignoreprops autoFocus | overflowMode\n * @ignoreemits blur | focus | infoTextChange | enter\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst IBizMarkDown: any = defineComponent({\n name: 'IBizMarkDown',\n props: getMarkDownProps<MarkDownEditorController>(),\n emits: getEditorEmits(),\n setup(props, { emit }) {\n const ns = useNamespace('markdown');\n\n const c = props.controller!;\n\n const currentVal = ref<string>('');\n\n const editor = ref<Cherry | null>(null);\n const editorPreview = ref<Cherry | null>(null);\n\n const id = createUUID();\n const previewId = createUUID();\n\n // 请求头\n const headers: Ref<IData> = ref({\n [`${ibiz.env.tokenHeader}Authorization`]: `${\n ibiz.env.tokenPrefix\n }Bearer ${getAppCookie(CoreConst.TOKEN)}`,\n });\n\n // 上传文件路径\n const uploadUrl: Ref<string> = ref('');\n\n // 下载文件路径\n const downloadUrl: Ref<string> = ref('');\n\n // 编辑器主题\n const { UIStore } = useUIStore();\n const theme = ref(UIStore.theme);\n\n // 编辑器模式\n const defaultModel = ref('editOnly');\n\n // 预览态预览图片地址\n const previewImage: Ref<string> = ref('');\n\n // 样式变量\n const cssVars = ref({});\n\n // data响应式变更基础路径\n watch(\n () => props.data,\n newVal => {\n if (newVal) {\n const editorParams = { ...c.editorParams };\n if (editorParams.uploadparams) {\n editorParams.uploadParams = JSON.parse(editorParams.uploadparams);\n }\n if (editorParams.exportparams) {\n editorParams.exportParams = JSON.parse(editorParams.exportparams);\n }\n const urls = ibiz.util.file.calcFileUpDownUrl(\n c.context,\n c.params,\n newVal,\n editorParams,\n );\n uploadUrl.value = urls.uploadUrl;\n downloadUrl.value = urls.downloadUrl;\n }\n },\n { immediate: true, deep: true },\n );\n\n // // 自定义图片上传\n const fileUpload = async (file: Blob, callback: (_url: string) => void) => {\n const data = await ibiz.util.file.fileUpload(\n uploadUrl.value,\n file,\n headers.value,\n );\n const url = downloadUrl.value.replace('%fileId%', data.fileid);\n callback(url);\n };\n\n // 获取渲染后html内容\n const getCherryHtml = () => {\n const result = editor.value?.getHtml();\n return result;\n };\n\n // 获取markdown内容\n const getCherryContent = () => {\n const result = editor.value?.getMarkdown();\n return result;\n };\n\n // 设置markdown内容\n const setCherryContent = (val: string) => {\n editor.value?.setMarkdown(val, false);\n editorPreview.value?.setMarkdown(val, false);\n };\n const setCherryContent2 = (val: string) => {\n editorPreview.value?.setMarkdown(val, true);\n };\n watch(\n () => props.value,\n (newVal, oldVal) => {\n if (newVal !== oldVal) {\n if (!newVal) {\n currentVal.value = '';\n } else {\n currentVal.value = newVal;\n }\n }\n },\n { immediate: true },\n );\n\n watch(currentVal, (newVal, oldVal) => {\n const content = getCherryContent();\n if (newVal !== oldVal && content !== newVal) {\n setCherryContent(newVal);\n }\n });\n\n // 变更事件回调\n const afterChange = (_e: IData) => {\n setCherryContent2(getCherryContent()!);\n emit('change', getCherryContent());\n };\n\n // 图片加载回调\n const beforeImageMounted = (e: string, src: string) => {\n return { [e]: src };\n };\n\n const editorOpts = {\n value: currentVal.value,\n theme: theme.value,\n fileUpload,\n emoji: {\n useUnicode: true,\n },\n header: {\n anchorStyle: 'autonumber',\n },\n editor: {\n // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主\n height: '100%',\n // defaultModel 编辑器初始化后的默认模式,一共有三种模式:1、双栏编辑预览模式;2、纯编辑模式;3、预览模式\n // edit&preview: 双栏编辑预览模式\n // editOnly: 纯编辑模式(没有预览,可通过toolbar切换成双栏或预览模式)\n // previewOnly: 预览模式(没有编辑框,toolbar只显示“返回编辑”按钮,可通过toolbar切换成编辑模式)\n defaultModel: defaultModel.value,\n codemirror: {\n // 是否自动focus 默认为true\n autofocus: false,\n },\n },\n toolbars: {\n theme: theme.value,\n toolbar: [\n 'switchModel',\n 'bold',\n 'italic',\n 'strikethrough',\n 'header',\n // 'list',\n {\n insert: [\n 'image',\n 'audio',\n 'video',\n 'link',\n 'hr',\n 'br',\n 'code',\n 'formula',\n 'toc',\n 'table',\n 'pdf',\n 'word',\n ],\n },\n 'settings',\n ],\n },\n };\n\n // 默认编辑态\n const editorInit = () => {\n const cherryOptions = {\n id,\n ...editorOpts,\n callback: {\n afterChange,\n beforeImageMounted,\n },\n value: currentVal.value,\n };\n nextTick(() => {\n editor.value = new Cherry(cherryOptions as IData);\n });\n };\n\n // 初始界面预览态\n const editorPreviewInit = () => {\n const cherryOptions = {\n id: previewId,\n ...editorOpts,\n editor: { defaultModel: 'previewOnly' },\n };\n nextTick(() => {\n editorPreview.value = new Cherry(cherryOptions as IData);\n });\n };\n\n onMounted(() => {\n editorPreviewInit();\n });\n\n watch(\n () => UIStore.theme,\n newVal => {\n theme.value = newVal;\n editor.value?.setTheme(theme.value);\n editorPreview.value?.setTheme(theme.value);\n },\n );\n\n onUnmounted(() => {\n editor.value = null;\n editorPreview.value = null;\n });\n const isOpen = ref(false);\n\n // 计算触发元素类型\n const calcTargetType = (\n target: HTMLElement,\n ): {\n type: string;\n url: string;\n } => {\n const result = {\n type: '',\n url: '',\n };\n if (target.nodeName === 'A') {\n result.type = 'A';\n result.url = (target as HTMLAnchorElement).hash;\n } else if (target.parentNode && target.parentNode.nodeName === 'A') {\n result.type = 'A';\n result.url = (target.parentNode as HTMLAnchorElement).hash;\n } else if (target.nodeName === 'IMG') {\n result.type = 'IMG';\n result.url = (target as HTMLImageElement).src;\n }\n return result;\n };\n\n const openPicker = async (event: TouchEvent) => {\n // 如果点击项是a标签,并且有href,值为#开头,且后续值为页面内的元素的id,就走页面滚动导航\n // 如果是图片,则进行放大预览\n // 其他情况,就走打开编辑界面\n const { target } = event;\n if (target) {\n const result = calcTargetType(target as HTMLElement);\n if (result.type === 'A' && result.url.startsWith('#')) {\n // 点击a标签,本页面内滑动,阻止其他变化\n event.preventDefault();\n event.stopPropagation();\n const targetid = result.url.slice(1);\n if (targetid) {\n const preview = document.getElementById(previewId);\n if (preview) {\n const anchor = document.getElementById(targetid);\n if (anchor) {\n anchor.scrollIntoView({ behavior: 'smooth' });\n }\n }\n return;\n }\n }\n if (result.type === 'IMG' && result.url) {\n // 点击图片,展开预览\n previewImage.value = result.url;\n return;\n }\n }\n if (props.disabled || props.readonly) {\n return;\n }\n // 其他情况打开编辑态\n isOpen.value = true;\n if (!editor.value) {\n editorInit();\n }\n };\n\n // 关闭图片预览时清除预览图片地址\n const handlePreviewClose = () => {\n previewImage.value = '';\n };\n\n return {\n ns,\n currentVal,\n id,\n previewId,\n editor,\n headers,\n theme,\n defaultModel,\n cssVars,\n getCherryHtml,\n getCherryContent,\n setCherryContent,\n openPicker,\n isOpen,\n previewImage,\n handlePreviewClose,\n };\n },\n render() {\n return (\n <div\n class={[\n this.ns.b(),\n this.disabled ? this.ns.m('disabled') : '',\n this.readonly ? this.ns.m('readonly') : '',\n ]}\n >\n <van-field readonly disabled={this.disabled} onClick={this.openPicker}>\n {{\n input: (\n <div\n id={this.previewId}\n style={this.cssVars}\n class={this.ns.b('cherry')}\n ></div>\n ),\n }}\n </van-field>\n\n <van-popup\n class={this.ns.b('image-popup')}\n show={!!this.previewImage}\n close-on-popstate={true}\n onClose={this.handlePreviewClose}\n >\n <iBizPreviewImage url={this.previewImage}></iBizPreviewImage>\n </van-popup>\n <van-dialog\n v-model:show={this.isOpen}\n className={this.ns.b('dialog')}\n close-on-popstate={true}\n >\n {{\n default: () => {\n return (\n <div\n id={this.id}\n style={this.cssVars}\n class={[\n this.ns.b('cherry'),\n this.ns.is('hidden', !this.isOpen),\n ]}\n ></div>\n );\n },\n }}\n </van-dialog>\n </div>\n );\n },\n});\n\nexport default IBizMarkDown;\n"],"names":["IBizMarkDown","exports","defineComponent","getMarkDownProps","getEditorEmits","props","emit","ns","useNamespace","c","currentVal","ref","editor","editorPreview","previewId","createUUID","emits","getAppCookie","CoreConst","setup","downloadUrl","UIStore","useUIStore","id","newVal","headers","ibiz","env","editorParams","uploadUrl","urls","defaultModel","url","data","callback","previewImage","getCherryHtml","cssVars","watch","_a","uploadParams","JSON","_b","exportparams","val","exportParams","setCherryContent2","file","calcFileUpDownUrl","oldVal","immediate","content","getCherryContent","setCherryContent","beforeImageMounted","src","setMarkdown","theme","fileUpload","afterChange","emoji","cherryOptions","useUnicode","editorOpts","header","anchorStyle","height","nextTick","Cherry","value","codemirror","autofocus","toolbars","onMounted","editorPreviewInit","editorInit","calcTargetType","target","result","event","setTheme","targetid","onUnmounted","anchor","hash","nodeName","isOpen","behavior","_createVNode","type","disabled","_resolveComponent","handlePreviewClose","$event"],"mappings":"+fAqBA,MAAAA,EAAAC,EAAA,UAAAC,EAAA,CACA,KAAA,eACA,MAAAC,EAAA,EACA,MAAAC,EAAA,EACA,MAAAC,EAAA,CACA,KAAAC,CACA,EAAA,CACA,MAAAC,EAAAC,EAAA,UAAA,EACAC,EAAAJ,EAAA,WACAK,EAAAC,EAAA,EAAA,EACAC,EAAAD,EAAA,IAAA,EACAE,EAAAF,EAAA,IAAA,EACMX,EAAAA,EAAoBE,EAClBY,EAAcC,EAAA,EACbZ,EAAAA,EAAAA,CACPa,CAAK,GAAEZ,KAAAA,IAAAA,WAAgB,eAAA,EAAA,GAAA,KAAA,IAAA,WAAA,UAAAa,EAAAC,EAAA,KAAA,CAAA,GACvBC,EAAeb,EAAAA,EAAAA,EAAAA,EAAQc,EAAAT,EAAA,EAAA,EACfJ,CAEN,QAAAc,CAEA,EAAAC,EAAMZ,EAEAE,EAAMD,EAAMU,EAAqB,KAAA,EACjCR,EAAaF,EAAM,UAAqB,EAExCY,EAAeZ,EAAE,EAAA,EACjBG,EA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