cnhis-design-vue 3.1.46-beta.32 → 3.1.46-beta.34

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 (46) hide show
  1. package/es/components/button-print/src/utils/print.js +1 -1
  2. package/es/components/form-config/index.d.ts +2 -2
  3. package/es/components/form-config/src/FormConfig.vue.d.ts +2 -2
  4. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -1
  5. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -1
  6. package/es/components/form-render/index.d.ts +1 -1
  7. package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
  8. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +1 -1
  9. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  10. package/es/components/form-render/src/hooks/useFormEvent.d.ts +1 -1
  11. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  12. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
  13. package/es/components/iho-table/src/plugins/operationalFormPlugin/index.js +1 -1
  14. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  15. package/es/components/iho-table/src/types/index.d.ts +3 -2
  16. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  17. package/es/components/iho-table/src/utils/index.js +1 -1
  18. package/es/components/info-header/index.d.ts +2 -2
  19. package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -2
  20. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +1 -1
  21. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +1 -1
  22. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  23. package/es/components/search-cascader/src/components/SearchMenu.js +1 -1
  24. package/es/components/select-person/index.d.ts +20 -23
  25. package/es/components/select-person/src/SelectPerson.vue.d.ts +20 -23
  26. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  27. package/es/components/shortcut-setter/index.d.ts +1 -1
  28. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
  29. package/es/shared/package.json.js +1 -1
  30. package/es/shared/utils/tapableLess.d.ts +28 -0
  31. package/es/shared/utils/tapableLess.js +1 -0
  32. package/package.json +2 -2
  33. package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -77
  34. package/es/components/form-render/src/components/renderer/dist/searchCascade.d.ts +0 -93
  35. package/es/components/iho-table/src/plugins/dist/highLightSetPlugin.d.ts +0 -3
  36. package/es/components/iho-table/src/plugins/filterRenderPlugin/dist/index.d.ts +0 -3
  37. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
  38. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/defaultRendererPlugin.d.ts +0 -3
  39. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/dist/seqRendererPlugin.d.ts +0 -3
  40. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/dist/index.d.ts +0 -3
  41. package/es/components/iho-table/src/utils/dist/index.d.ts +0 -44
  42. package/es/components/scale-view/src/components/formitem/dist/r-address.d.ts +0 -36
  43. package/es/components/scale-view/src/components/formitem/dist/r-sign.d.ts +0 -36
  44. package/es/components/scale-view/src/components/formitem/dist/standard-modal.d.ts +0 -82
  45. package/es/components/search-cascader/src/components/dist/SearchMenu.d.ts +0 -57
  46. package/es/components/search-cascader/src/components/dist/SearchMenu1.d.ts +0 -57
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${m}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){let e=l(new Date,"yyyyMMddHHmmss");t.customFileName&&(e=`${e}${t.customFileName}`),t.print.filename=`${this.downloadPath}/${e}`.replace(/\\/g,"/")}this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="0",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${m}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){let e=l(new Date,"yyyyMMddHHmmss");t.customFileName&&(e=`${e}${t.customFileName}`),t.print.filename=`${this.downloadPath}/${e}`.replace(/\\/g,"/")}this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -7448,7 +7448,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
7448
7448
  "x-read-pretty"?: boolean | undefined;
7449
7449
  "x-compile-omitted"?: string[] | undefined;
7450
7450
  }>>;
7451
- onKeydown: (event: KeyboardEvent) => void;
7451
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
7452
7452
  clearSpan: (uuid: string) => void;
7453
7453
  exposeEvent: {
7454
7454
  validate(path?: string): Promise<void>;
@@ -13475,7 +13475,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
13475
13475
  "x-read-pretty"?: boolean | undefined;
13476
13476
  "x-compile-omitted"?: string[] | undefined;
13477
13477
  }>>;
13478
- onKeydown: (event: KeyboardEvent) => void;
13478
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
13479
13479
  clearSpan: (uuid: string) => void;
13480
13480
  exposeEvent: {
13481
13481
  validate(path?: string): Promise<void>;
@@ -7450,7 +7450,7 @@ declare const _default: import("vue").DefineComponent<{
7450
7450
  "x-read-pretty"?: boolean | undefined;
7451
7451
  "x-compile-omitted"?: string[] | undefined;
7452
7452
  }>>;
7453
- onKeydown: (event: KeyboardEvent) => void;
7453
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
7454
7454
  clearSpan: (uuid: string) => void;
7455
7455
  exposeEvent: {
7456
7456
  validate(path?: string): Promise<void>;
@@ -13477,7 +13477,7 @@ declare const _default: import("vue").DefineComponent<{
13477
13477
  "x-read-pretty"?: boolean | undefined;
13478
13478
  "x-compile-omitted"?: string[] | undefined;
13479
13479
  }>>;
13480
- onKeydown: (event: KeyboardEvent) => void;
13480
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
13481
13481
  clearSpan: (uuid: string) => void;
13482
13482
  exposeEvent: {
13483
13483
  validate(path?: string): Promise<void>;
@@ -463,7 +463,7 @@ declare const _default: import("vue").DefineComponent<{}, {
463
463
  "x-read-pretty"?: boolean | undefined;
464
464
  "x-compile-omitted"?: string[] | undefined;
465
465
  }>>;
466
- onKeydown: (event: KeyboardEvent) => void;
466
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
467
467
  clearSpan: (uuid: string) => void;
468
468
  exposeEvent: {
469
469
  validate(path?: string): Promise<void>;
@@ -5594,7 +5594,7 @@ declare const _default: import("vue").DefineComponent<{
5594
5594
  "x-read-pretty"?: boolean | undefined;
5595
5595
  "x-compile-omitted"?: string[] | undefined;
5596
5596
  }>>;
5597
- onKeydown: (event: KeyboardEvent) => void;
5597
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
5598
5598
  clearSpan: (uuid: string) => void;
5599
5599
  exposeEvent: {
5600
5600
  validate(path?: string): Promise<void>;
@@ -450,7 +450,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
450
450
  "x-read-pretty"?: boolean | undefined;
451
451
  "x-compile-omitted"?: string[] | undefined;
452
452
  }>>;
453
- onKeydown: (event: KeyboardEvent) => void;
453
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
454
454
  clearSpan: (uuid: string) => void;
455
455
  exposeEvent: {
456
456
  validate(path?: string): Promise<void>;
@@ -444,7 +444,7 @@ declare const _default: import("vue").DefineComponent<{
444
444
  "x-read-pretty"?: boolean | undefined;
445
445
  "x-compile-omitted"?: string[] | undefined;
446
446
  }>>;
447
- onKeydown: (event: KeyboardEvent) => void;
447
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
448
448
  clearSpan: (uuid: string) => void;
449
449
  exposeEvent: {
450
450
  validate(path?: string): Promise<void>;
@@ -448,7 +448,7 @@ declare const _default: import("vue").DefineComponent<{}, {
448
448
  "x-read-pretty"?: boolean | undefined;
449
449
  "x-compile-omitted"?: string[] | undefined;
450
450
  }>>;
451
- onKeydown: (event: KeyboardEvent) => void;
451
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
452
452
  clearSpan: (uuid: string) => void;
453
453
  exposeEvent: {
454
454
  validate(path?: string): Promise<void>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,computed as t,inject as o,watch as a,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as l,isArray as i,isString as s,isNumber as c,isEmpty as d,isFunction as v,omit as p,cloneDeep as f}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as m}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as h}from"../../utils/index.js";import{connect as k,mapProps as j}from"@formily/vue";import g from"../../../../search-cascader/index.js";import w from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as F}from"../../hooks/useFormRequest.js";const K=k(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:k}){const j=u(e,"value",k),_=r(!1),K=r([]),{field:O,fieldKey:q}=b(),S=t((()=>{var r,t,o;return null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?o:e.labelField})),x=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),C=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),L=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),V=o(m),{getSearchRequestInfo:A}=F(),I=r(150),P=r();async function R(r,t){var o;if(i(e.value)&&e.value.length&&!r&&!t){const[r,t]=function(e){if(!e.length)return[];const r=[(e=f(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const o=e[r];o&&(t.children=[o],o.parent=t,t=o)}return[e,r]}(e.value);K.value=t;const o=r[Math.max(0,r.length-2)];return await R(o),o}try{if(r&&!r.__keyword&&r.isLeaf)return a(r);if(null==r?void 0:r.__keyword){if(!s(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));c(L.value)&&L.value!==1/0&&t.splice(L.value);const o=await async function(r){if(!A().primaryKeyUrl)return[];try{return await V.addAsync(t(e.wordbook,e.autograph,r,q.value))}catch(e){s(e)&&h(e)}function t(r,t,o,a){const n=A();return{key:a,params:{autograph:t,tableId:r.id,primaryKeyValue:o.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!o)return Promise.reject();const{lastOption:a,options:n}=function(e,r){let t=e[0];return{options:r.reduce(((r,a,n)=>{const u=o(e,a);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=L.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[x.value]===r))}}(o,t);return n.length<L.value&&(await R(a),d(a.children))?(j.value=function(e,r){return r.map((r=>e.find((e=>e[x.value]===r))))}(o,t),_.value=!1,Promise.reject()):(K.value=n,a)}{const u=await V.addAsync(function(r,o,a,n,u){const l={autograph:()=>o,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[x.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(l).reduce(((e,[t,o])=>(e[t]=s(o)?r[o]:v(o)?o():void 0,e)),{});return{...A(),params:i,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,O.value,r,q.value));if(r){if(!u.length)return a(r);r.children=u.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:n(r)+1>=t}}(e,r,L.value)))}else K.value=u.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[S.value]=e[C.value||S.value]||e[S.value]);return e}(e,t))),I.value=t&&(null==(o=P.value)?void 0:o.getWidth())||150}}catch(e){s(e)&&h(e)}function a(e){return j.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function n(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){I.value=150}a((()=>e.wordbook),((r,t)=>{l(r,t)||(K.value=[],r&&(j.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:B,injectValueWatchFromEmpty:N,injectValueBindKey:W}=y();N(j,R),B(j);const z=W(j);return()=>n(g,{ref:P,value:j.value,"onUpdate:value":e=>j.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:K.value,key:z.value,labelKey:S.value,valueKey:x.value,search:R,onFocus:U,menuWidth:I.value},{empty:()=>n(w,null,null)})}}),j({dataSource:"options"},_));export{K as LEVEL_SEARCH_CASCADER};
1
+ import{defineComponent as e,ref as r,computed as t,inject as a,watch as o,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as l,isArray as i,isString as s,isNumber as c,isEmpty as d,isFunction as v,omit as p,cloneDeep as f}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as m}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as h}from"../../utils/index.js";import{connect as k,mapProps as j}from"@formily/vue";import g from"../../../../search-cascader/index.js";import w from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as F}from"../../hooks/useFormRequest.js";const K=k(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:k}){const j=u(e,"value",k),_=r(!1),K=r([]),{field:O,fieldKey:q}=b(),S=t((()=>{var r,t,a;return null!=(a=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?a:e.labelField})),C=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),L=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),V=a(m),{getSearchRequestInfo:A}=F(),I=r(150),P=r();async function R(r,t){var a,o,n;if(I.value=t&&(null==(a=P.value)?void 0:a.getWidth())||150,i(e.value)&&e.value.length&&!r&&!t){const[r,t]=function(e){if(!e.length)return[];const r=[(e=f(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const a=e[r];a&&(t.children=[a],a.parent=t,t=a)}return[e,r]}(e.value);K.value=t;const a=r[Math.max(0,r.length-2)];return await R(a),a}try{if(r&&!r.__keyword&&r.isLeaf)return u(r);if(null==r?void 0:r.__keyword){if(!s(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));c(L.value)&&L.value!==1/0&&t.splice(L.value);const a=await async function(r){if(!A().primaryKeyUrl)return[];try{return await V.addAsync(t(e.wordbook,e.autograph,r,q.value))}catch(e){s(e)&&h(e)}function t(r,t,a,o){const n=A();return{key:o,params:{autograph:t,tableId:r.id,primaryKeyValue:a.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!a)return Promise.reject();const{lastOption:o,options:u}=function(e,r){let t=e[0];return{options:r.reduce(((r,o,n)=>{const u=a(e,o);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=L.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function a(e,r){return e.find((e=>e[C.value]===r))}}(a,t);return u.length<L.value&&(await R(o),d(o.children))?(j.value=function(e,r){return r.map((r=>e.find((e=>e[C.value]===r))))}(a,t),_.value=!1,Promise.reject()):(K.value=u,null==(n=P.value)||n.setCursor(o),o)}{const a=await V.addAsync(function(r,a,o,n,u){const l={autograph:()=>a,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[C.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(l).reduce(((e,[t,a])=>(e[t]=s(a)?r[a]:v(a)?a():void 0,e)),{});return{...A(),params:i,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,O.value,r,q.value));if(r){if(!a.length)return u(r);r.children=a.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:l(r)+1>=t}}(e,r,L.value)))}else K.value=a.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[S.value]=e[x.value||S.value]||e[S.value]);return e}(e,t))),t&&(null==(o=P.value)||o.setCursor(K.value[0]))}}catch(e){s(e)&&h(e)}function u(e){return j.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function l(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){I.value=150}o((()=>e.wordbook),((r,t)=>{l(r,t)||(K.value=[],r&&(j.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:B,injectValueWatchFromEmpty:N,injectValueBindKey:W}=y();N(j,R),B(j);const z=W(j);return()=>n(g,{ref:P,value:j.value,"onUpdate:value":e=>j.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:K.value,key:z.value,labelKey:S.value,valueKey:C.value,search:R,onFocus:U,menuWidth:I.value},{empty:()=>n(w,null,null)})}}),j({dataSource:"options"},_));export{K as LEVEL_SEARCH_CASCADER};
@@ -25,5 +25,5 @@ export declare function useFormDomEvent({ props, formRenderRef, formModel }: {
25
25
  formRenderRef: Ref<HTMLElement | undefined>;
26
26
  formModel: Form;
27
27
  }): {
28
- onKeydown: (event: KeyboardEvent) => void;
28
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
29
29
  };
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as s,isFunction as a}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as u,NESTED_FORM_ITEM_TYPE as f}from"../constants/index.js";import{queryDecoratorByAddress as l,queryInput as d,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";function I({formModel:t,formRenderRef:n,formUUID:a,getFieldList:f,formItemDepsCollector:p}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),s=e.messages.map((e=>function(e,t){var r;return t&&i(t.fieldItem)?g(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=l(e.address,n.value,a);return{...e,messages:s,title:o,decoratorElement:m,...d(m)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(f(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=y(f(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const o=c(e,t,a);if(o)return s(o);const i=h(e,r);return i?(p.trigger(u+i,!0),await m(),s(c(e,t,a))):s();function s(e){return{decoratorElement:e,...d(e)}}}(e,n.value,f()):null}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:function i(s){var m;if(!e.enterToNextWidget||!r.value)return;const u=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!u)return;const l=`.form-render__formItem${f.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(l)),c=d.findIndex((e=>e.id===u.id));if(!~c)return;const{widget:g,field:v}=p(d,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(m=t.decoratorProps)?void 0:m.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{x as useFormDomEvent,I as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isArray as s,isFunction as a}from"lodash-es";import{nextTick as m}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as u,NESTED_FORM_ITEM_TYPE as f}from"../constants/index.js";import{queryDecoratorByAddress as l,queryInput as d,queryDecoratorByFieldKey as c,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as g,combineExtendKey as v,splitExtendKey as y}from"../utils/index.js";import{getParentLinebar as h}from"../utils/schema.js";function I({formModel:t,formRenderRef:n,formUUID:a,getFieldList:f,formItemDepsCollector:p}){return{validate(r="*"){return t.validate(r).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(o,[]):e)));function o(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(m)),o=!0)})),!o&&t.push(m(r)),t}function m(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),s=e.messages.map((e=>function(e,t){var r;return t&&i(t.fieldItem)?g(null!=(r=t.fieldItem.defined_error_msg)?r:e,t.fieldItem):e}(e,r.get("decoratorProps")))),m=l(e.address,n.value,a);return{...e,messages:s,title:o,decoratorElement:m,...d(m)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=v(f(),r)),r},setFormValues(e,i=!0,n=!0){i&&(e=y(f(),e)),t.setFieldState("*",(t=>{r(t)&&(n||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))}))},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const o=c(e,t,a);if(o)return s(o);const i=h(e,r);return i?(p.trigger(u+i,!0),await m(),s(c(e,t,a))):s();function s(e){return{decoratorElement:e,...d(e)}}}(e,n.value,f()):null}}function x({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var m;if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const u=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!u)return;const l=`.form-render__formItem${f.map((e=>`:not([widget-type=${e}])`)).join("")}`,d=Array.from(r.value.querySelectorAll(l)),c=d.findIndex((e=>e.id===u.id));if(!~c)return;const{widget:g,field:v}=p(d,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(m=t.decoratorProps)?void 0:m.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{x as useFormDomEvent,I as useFormExposeEvent};
@@ -1 +1 @@
1
- import{unref as e}from"vue";import{promiseTimeout as n}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as t}from"@vueuse/core";import{isString as o,trim as i,isEmpty as r,isEqual as l,isFunction as u}from"lodash-es";import{selectOptionsMap as d}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as a}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as s}from"../../constants/index.js";import{parse as c,isValid as p,compareDesc as f}from"date-fns";import{defineTablePlugin as m}from"../../hooks/useTablePlugin.js";function v(){const v="keyboardEventPlugin",g=t("ihoTableClipData","");return m({name:v,apply(t){function m(n,t,m,v,w){var b,y;if(!(null==(b=null==m?void 0:m.keyboardConfig)?void 0:b.isClip))return;const{row:C,column:R}=t.getSelectedCell()||t.getEditRecord()||{};if(!C||!R||!E(R,s.SELECT)&&e(g)===C[R.field])return;const x=m.uuid&&E(R,s.SELECT)&&d.get(m.uuid)[R.field],T=C[R.field];if("copy"===n){const e=(null==(y=(x||[]).filter((e=>T.includes(e.value))))?void 0:y.map((e=>e.label)).join(","))||T;g.value=e}else{if(o(e(g))&&(g.value=i(e(g)||"")),!e(g)||!function(e){var n;const t=null==(n=e.editRender)?void 0:n.props;return t&&Object.keys(s).includes(a.getCellType(t))}(R)||C.$__SEPARATE||!function(e,n,t,o){var i,r;const{beforeEditMethod:l}=n.editConfig||{},d={rowIndex:null!=(i=e.getRowIndex(t))?i:0,columnIndex:null!=(r=e.getColumnIndex(o))?r:0};return!l||u(l)&&l({row:t,column:o,...d,$table:e,$grid:void 0})}(t,m,C,R))return;if(E(R,s.DATE)&&function(n,t){var i;const r=null==(i=n.editRender)?void 0:i.props,l=e(g)||"";return!p(new Date(l))||o(r.connectField)&&t[r.connectField]&&(r.isStartDate&&f(new Date(l),new Date(t[r.connectField]))<0||r.isEndDate&&f(new Date(l),new Date(t[r.connectField]))>0)}(R,C))return;if(E(R,s.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,s.TIME)&&function(n){var t,o;const i=e(g)||"",r=null==(t=n.editRender)?void 0:t.props,l=c(i,(null==(o=null==r?void 0:r.componentProps)?void 0:o.valueFormat)||"HH:mm",new Date);return!p(l)}(R))return;let n=e(g)||"";if(x&&!r(x)){const e=x.filter((e=>n.split(",").includes(e.label))).map((e=>e.value));if(r(e))return;if(function(e){var n,t;const o=null==(n=e.editRender)?void 0:n.props;return E(e,s.SELECT)&&(null==(t=o.componentProps)?void 0:t.multiple)}(R)){if(l(T,e))return;n=e}else{if(e.includes(T))return;n=e[0]}}C[R.field]=n,v("formChange",{column:R,row:C,oldValue:T,value:n,index:t.getRowIndex(C)}),E(R,s.SEPARATE)&&(null==w||w())}}function E(e,n){var t;const o=null==(t=e.editRender)?void 0:t.props;return o&&a.getCellType(o)===n}t.eventHooks.onCopy.tap(v,(({$table:e},n,{emits:t})=>m("copy",e,n,t))),t.eventHooks.onPaste.tap(v,(({$table:e},n,{emits:t,updateTableDataRef:o})=>m("paste",e,n,t,o))),t.eventHooks.onKeydown.tap(v,(async({$event:e,$table:t},o,{emits:i})=>{await n(0);const{row:r,column:l}=t.getSelectedCell()||t.getEditRecord()||{};if(!r||!l)return;i("keyboard",{key:e.key,index:t.getRowIndex(r),value:r[l.field],row:r,column:l})}))}})}export{v as keyboardEventPlugin};
1
+ import{unref as e}from"vue";import{promiseTimeout as n}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as t}from"@vueuse/core";import{isString as o,trim as i,isEmpty as l,isEqual as r,isFunction as u}from"lodash-es";import{selectOptionsMap as d}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as a}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as s}from"../../constants/index.js";import{parse as c,isValid as p,compareDesc as f}from"date-fns";import{defineTablePlugin as m}from"../../hooks/useTablePlugin.js";function v(){const v="keyboardEventPlugin",g=t("ihoTableClipData","");return m({name:v,apply(t){function m(n,t,m,v,w){var b,y;if(!(null==(b=null==m?void 0:m.keyboardConfig)?void 0:b.isClip))return;const{row:C,column:R}=t.getSelectedCell()||t.getEditRecord()||{};if(!C||!R||!E(R,s.SELECT)&&e(g)===C[R.field])return;const x=m.uuid&&E(R,s.SELECT)&&d.get(m.uuid)[R.field],T=C[R.field];if("copy"===n){const e=(null==(y=(x||[]).filter((e=>T.includes(e.value))))?void 0:y.map((e=>e.label)).join(","))||T;g.value=e}else{if(o(e(g))&&(g.value=i(e(g)||"")),!e(g)||!function(e){var n;const t=null==(n=e.editRender)?void 0:n.props;return t&&Object.keys(s).includes(a.getCellType(t))}(R)||C.$__SEPARATE||!function(e,n,t,o){var i,l;const{beforeEditMethod:r}=n.editConfig||{},d={rowIndex:null!=(i=e.getRowIndex(t))?i:0,columnIndex:null!=(l=e.getColumnIndex(o))?l:0};return!r||u(r)&&r({row:t,column:o,...d,$table:e,$grid:void 0})}(t,m,C,R))return;if(E(R,s.DATE)&&function(n,t){var i;const l=null==(i=n.editRender)?void 0:i.props,r=e(g)||"";return!p(new Date(r))||o(l.connectField)&&t[l.connectField]&&(l.isStartDate&&f(new Date(r),new Date(t[l.connectField]))<0||l.isEndDate&&f(new Date(r),new Date(t[l.connectField]))>0)}(R,C))return;if(E(R,s.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,s.TIME)&&function(n){var t,o;const i=e(g)||"",l=null==(t=n.editRender)?void 0:t.props,r=c(i,(null==(o=null==l?void 0:l.componentProps)?void 0:o.valueFormat)||"HH:mm",new Date);return!p(r)}(R))return;let n=e(g)||"";if(x&&!l(x)){const e=x.filter((e=>n.split(",").includes(e.label))).map((e=>e.value));if(l(e))return;if(function(e){var n,t;const o=null==(n=e.editRender)?void 0:n.props;return E(e,s.SELECT)&&(null==(t=o.componentProps)?void 0:t.multiple)}(R)){if(r(T,e))return;n=e}else{if(e.includes(T))return;n=e[0]}}C[R.field]=n,v("formChange",{column:R,row:C,oldValue:T,value:n,index:t.getRowIndex(C)}),E(R,s.SEPARATE)&&(null==w||w())}}function E(e,n){var t;const o=null==(t=e.editRender)?void 0:t.props;return o&&a.getCellType(o)===n}t.eventHooks.onCopy.tap(v,(({$table:e},n,{emits:t})=>m("copy",e,n,t))),t.eventHooks.onPaste.tap(v,(({$table:e},n,{emits:t,updateTableDataRef:o})=>m("paste",e,n,t,o))),t.eventHooks.onKeydown.tap(v,(async({$event:e,$table:t},o,{emits:i})=>{await n(0);const{row:l,column:r}=t.getSelectedCell()||t.getEditRecord()||{};if(!l||!r)return;i("keyboard",{$table:t,key:e.key,index:t.getRowIndex(l),value:l[r.field],row:l,column:r})}))}})}export{v as keyboardEventPlugin};
@@ -1 +1 @@
1
- import"../../../../../shared/utils/index.js";import"../../../index.js";import{isFunction as o}from"lodash-es";import{defineTablePlugin as n}from"../../hooks/useTablePlugin.js";import{getOperationalFormHandler as r}from"../../../../../shared/utils/business.js";function i(){const i="operationalFormPlugin";return n({name:i,apply(n){n.configHooks.config.tap(i,(n=>{const i=n.onFormChange;return n.onFormChange=function(t){const{column:e,row:s}=t;!function(o){return r(n.operationForm,(n=>o[n]),((n,r)=>o[n]=r)).operationalFormHandler}(s)(e.field),o(i)&&i(t)},n}))}})}export{i as operationalFormPlugin};
1
+ import"../../../../../shared/utils/index.js";import"../../../index.js";import{isFunction as o}from"lodash-es";import{defineTablePlugin as n}from"../../hooks/useTablePlugin.js";import{getOperationalFormHandler as r}from"../../../../../shared/utils/business.js";function e(){const e="operationalFormPlugin";return n({name:e,apply(n){n.configHooks.config.tap(e,(n=>{const e=n.onFormChange;return n.onFormChange=function(t){const{column:i,row:s,$table:m}=t;!function(o,e){return r(n.operationForm,(n=>o[n]),((n,r)=>{e.getColumns().some((o=>o.field===n))&&(o[n]=r)})).operationalFormHandler}(s,m)(i.field),o(e)&&e(t)},n}))}})}export{e as operationalFormPlugin};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,reactive as t,watch as n,createVNode as r,mergeProps as l}from"vue";import{NSelect as a}from"naive-ui";import{useIhoTableFormEvent as u}from"../../../../utils/index.js";import{useDebounceFn as i}from"@vueuse/core";import{isFunction as s,isArray as c,trim as p}from"lodash-es";var d=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"}},emits:["update:value"],setup(e,{emit:d}){const m=o(null);function f(e){m.value=e}const y=o(!1),{emitFormChangeWithParams:v}=u(e),h=t({options:e.options,loading:!1,remote:!1,onSearch:null}),w=i((async function(o=""){h.loading=!0;try{if(!s(e.queryOptions))return;h.options=await e.queryOptions({keyword:o,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(o){console.log(`获取${e.column.field}options错误`)}finally{h.loading=!1}}),400);function b(o){const t=e.value;d("update:value",o),v({oldValue:t})}function g(e){var o,t;"Tab"===e.key&&m.value&&(null==(t=(o=m.value).handleKeydown)||t.call(o,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function S(e,o){if(!e||!o)return!1;const t=p(e);if(!t)return!0;const{label:n="",keyword:r=""}=o;return n.includes(t)||r.split(",").some((e=>e.includes(t)))}n((()=>e.options),(e=>{if(c(e)&&e.length)return h.options=e,h.remote=!1,void(h.onSearch=null);h.remote=!0,h.onSearch=w,h.onSearch()}),{immediate:!0});const q=()=>({class:"iho-table__selectOption"}),O={class:"iho-table__selectMenu"};return()=>r(a,l({ref:f,show:y.value,"onUpdate:show":e=>y.value=e,placeholder:e.placeholder},h,{value:e.value,clearable:!0,filterable:!0,filter:S,nodeProps:q,menuProps:O,onUpdateValue:b,onKeydown:g}),null)}});export{d as default};
1
+ import{defineComponent as e,inject as o,ref as t,reactive as n,watch as r,createVNode as l,mergeProps as a}from"vue";import{NSelect as u}from"naive-ui";import{useIhoTableFormEvent as i}from"../../../../utils/index.js";import{useDebounceFn as s}from"@vueuse/core";import{isFunction as c,isArray as p,trim as d}from"lodash-es";var m=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"}},emits:["update:value"],setup(e,{emit:m}){const f=o("$xetable"),y=t(null);function v(e){y.value=e}const h=t(!1),{emitFormChangeWithParams:b}=i({...e,$table:f}),w=n({options:e.options,loading:!1,remote:!1,onSearch:null}),g=s((async function(o=""){w.loading=!0;try{if(!c(e.queryOptions))return;w.options=await e.queryOptions({keyword:o,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(o){console.log(`获取${e.column.field}options错误`)}finally{w.loading=!1}}),400);function S(o){const t=e.value;m("update:value",o),b({oldValue:t})}function q(e){var o,t;"Tab"===e.key&&y.value&&(null==(t=(o=y.value).handleKeydown)||t.call(o,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function x(e,o){if(!e||!o)return!1;const t=d(e);if(!t)return!0;const{label:n="",keyword:r=""}=o;return n.includes(t)||r.split(",").some((e=>e.includes(t)))}r((()=>e.options),(e=>{if(p(e)&&e.length)return w.options=e,w.remote=!1,void(w.onSearch=null);w.remote=!0,w.onSearch=g,w.onSearch()}),{immediate:!0});const O=()=>({class:"iho-table__selectOption"}),k={class:"iho-table__selectMenu"};return()=>l(u,a({ref:v,show:h.value,"onUpdate:show":e=>h.value=e,placeholder:e.placeholder},w,{value:e.value,clearable:!0,filterable:!0,filter:x,nodeProps:O,menuProps:k,onUpdateValue:S,onKeydown:q}),null)}});export{m as default};
@@ -1,6 +1,6 @@
1
1
  import { AnyObject, ArrayAble, BindEventSettingItem, FormOperationalConfig, LOW_CODE_VALUE_RELATION, MaybeString, TupleToUnion } from '../../../../../es/shared/types';
2
- import { VxeTableProps, VxeTableDefines, VxeTableInstance, VxeColumnPropTypes, VxeTablePropTypes } from 'vxe-table';
3
- import { VxeTableListeners } from 'vxe-table/types/table';
2
+ import { VxeTableProps, VxeTableDefines, VxeTableInstance, VxeColumnPropTypes, VxeTablePropTypes, VxeTableConstructor } from 'vxe-table';
3
+ import { VxeTableListeners, VxeTablePrivateMethods } from 'vxe-table/types/table';
4
4
  import { IHO_TABLE_STRING_STATUS, IhoTableEventNameTuple, IhoTableRowGroupSequence } from '../../../../../es/components/iho-table/src/constants';
5
5
  import Sortable from 'sortablejs';
6
6
  export * from './pluginType';
@@ -134,6 +134,7 @@ export declare type IhoTableFormChangePayload = {
134
134
  index: number;
135
135
  type?: string;
136
136
  oldValue?: unknown;
137
+ $table: VxeTableConstructor & VxeTablePrivateMethods;
137
138
  };
138
139
  export declare type IhoTableEmits = <T extends typeof IhoTableEventNameTuple[number]>(event: T, ...args: IhoTableEmitPayload<T>) => void;
139
140
  export declare type EventListenerToEventName<T extends string> = T extends `on${infer R}` ? R extends `${infer F}${infer L}` ? `${Lowercase<F>}${L}` : never : never;
@@ -18,7 +18,7 @@ export declare function useUUIDMap<T>(creator: () => T, isReactive?: boolean): {
18
18
  removeItemFromUUID: (uuid: string) => void;
19
19
  };
20
20
  export declare function getColumnRenderWidth(column: AnyObject, $table: MaybeRef<Nullable<VxeTableInstance>>): Promise<number>;
21
- export declare function useIhoTableFormEvent(payload: Pick<VxeGlobalRendererHandles.RenderEditParams, 'row' | 'rowIndex' | 'column'> & {
21
+ export declare function useIhoTableFormEvent(payload: Pick<VxeGlobalRendererHandles.RenderEditParams, 'row' | 'rowIndex' | 'column' | '$table'> & {
22
22
  $rowIndex?: number;
23
23
  }): {
24
24
  emitFormChange: () => void;
@@ -1 +1 @@
1
- import{reactive as e,inject as n,unref as t,toRaw as r,createVNode as i}from"vue";import{jsonParse as o,arrayed as u,findAncestor as l}from"../../../../shared/utils/index.js";import{promiseTimeout as c}from"@vueuse/shared";import{isNumber as a,isString as d,isObject as s,isArray as f,cloneDeep as m}from"lodash-es";import{InjectionIhoTableConfig as p,InjectionIhoTableEmits as v,IHO_TABLE_STRING_STATUS as g,IHO_TABLE_NUMBER_STATUS as E,IHO_TABLE_TREE_TYPE as I}from"../constants/index.js";function h(e){return console.warn(`[IhoTable]: ${e}`)}const T=Object.freeze({getCellType(e){var n;return((null==(n=e.settingObj)?void 0:n.attr)||e.formType||"DEFAULT").toUpperCase()}});function C(){var e,t,r;const i=n(p);return i||h("this function(getRowHeight) only can be used in setup environment"),null!=(r=null==(t=null==(e=null==i?void 0:i.value)?void 0:e.rowConfig)?void 0:t.height)?r:32}function R(e){const n=e.slice(2);return`${n[0].toLowerCase()}${n.slice(1)}`}function S(e){return`on${e[0].toUpperCase()}${e.slice(1)}`}function w(n,t=!0){const r=t?e(new Map):new Map;return{getItemFromUUID:function(e){return r.set(e,r.get(e)||n()).get(e)},setItemFromUUID:function(e,n){r.set(e,n)},removeItemFromUUID:function(e){r.delete(e)}}}async function O(e,n){return r()||await c(0),r()||function(){const n=+e.colWidth;return a(n)?n:64}();function r(){var r,i;return null==(i=null==(r=t(n))?void 0:r.getColumnByField(e.field))?void 0:i.renderWidth}}function F(e){const t=n(v);function i(){var n;return{value:e.row[e.column.field],row:e.row,column:{...e.column,...null==(n=e.column.editRender)?void 0:n.props},index:e.rowIndex>-1?e.rowIndex:e.$rowIndex}}function o(e={}){t("formChange",{...i(),...m(r(e))})}function u(e={}){t("formClick",{...i(),...m(r(e))})}return{emitFormChange:function(){o()},emitFormClick:function(){u()},emitFormChangeWithParams:o,emitFormClickWithParams:u}}const P=Object.freeze({createDefaultRenderCell:function(){return function(e,{row:n,column:t}){return[i("span",null,[n[t.field]])]}},createRenderEdit:function(e){return function({props:n},t){return e({...t,fieldItem:n||{},...F(t)})}},isEditableColumn(e,n){var t;return!1!==(null==(t=e.editConfig)?void 0:t.showIcon)&&n.editRender&&!1!==n.editRender.enabled},hasFilter(e){if(y(e))return!0;let n=e.fieldSetting;return d(n)&&(n=o(n||"")),s(n)&&((t=n).notParticipatingSearch!==g.POSITIVE&&"manual"===(null==(r=t.mapping)?void 0:r.type));var t,r},hasDateFiler(e){var n;return null==(n=null==e?void 0:e.filterSetting)?void 0:n.daterange}}),A=Object.freeze({isPositive:e=>e===E.POSITIVE||e===g.POSITIVE,isNegative:e=>e===E.NEGATIVE||e===g.NEGATIVE,notPositive:e=>e!==E.POSITIVE&&e!==g.POSITIVE,notNegative:e=>e!==E.NEGATIVE&&e!==g.NEGATIVE}),N=(e,n)=>({$event:t,column:r})=>{var i;if(!u(e).includes(null==(i=r.editRender)?void 0:i.name))return!0;const o=null==t?void 0:t.target;return!s(o)||!l(o,n)};function V(e){return[I.TRANSFORM_WITH_SPAN_METHOD,I.TRANSFORM_TREE_TYPE].includes(`${e.isTree}`)}function $(e){return d(e)&&!!e.match(/^###\{[^{}]+}$/)}function x(e){try{return JSON.parse(e.replace(/^###/,""))}catch(e){return{}}}function U(e,n){if(e.$__SEPARATE||!n.editRender||!n.editRender.props)return e[n.field];const{fieldSetting:t}=n.editRender.props;if(!d(t))return e[n.field];const{mergedFeildExpression:r}=o(t);return r&&d(r)?r.replace(/#{(.+?)}/g,(function(n,t){let r=t?e[t.trim()]:null;$(r)&&(r=x(r).change_text);return r||(null==r?"--":r)})):e[n.field]}const b=["SEARCH","SELECT","RADIO","CHECKBOX"];function y(e){return e.notParticipatingSearch===E.NEGATIVE&&b.includes(T.getCellType(e))&&f(e.options)&&e.options.length}export{P as IhoTableRenderHelper,A as IhoTableStatusHelper,T as IhoTableUtils,h as IhoTableWarn,N as createIhoTableClearActivedInterceptor,R as eventListener2EventName,S as eventName2EventListener,O as getColumnRenderWidth,C as getRowHeight,y as isCompatibleColumn,$ as isRichContent,V as isTransformTreeType,U as parseMergeField,x as parseRichContent,F as useIhoTableFormEvent,w as useUUIDMap};
1
+ import{reactive as e,inject as n,unref as t,toRaw as r,createVNode as i}from"vue";import{jsonParse as o,arrayed as u,findAncestor as l}from"../../../../shared/utils/index.js";import{promiseTimeout as c}from"@vueuse/shared";import{isNumber as a,isString as d,isObject as s,isArray as f,cloneDeep as m}from"lodash-es";import{InjectionIhoTableConfig as p,InjectionIhoTableEmits as v,IHO_TABLE_STRING_STATUS as g,IHO_TABLE_NUMBER_STATUS as E,IHO_TABLE_TREE_TYPE as I}from"../constants/index.js";function h(e){return console.warn(`[IhoTable]: ${e}`)}const T=Object.freeze({getCellType(e){var n;return((null==(n=e.settingObj)?void 0:n.attr)||e.formType||"DEFAULT").toUpperCase()}});function C(){var e,t,r;const i=n(p);return i||h("this function(getRowHeight) only can be used in setup environment"),null!=(r=null==(t=null==(e=null==i?void 0:i.value)?void 0:e.rowConfig)?void 0:t.height)?r:32}function R(e){const n=e.slice(2);return`${n[0].toLowerCase()}${n.slice(1)}`}function S(e){return`on${e[0].toUpperCase()}${e.slice(1)}`}function w(n,t=!0){const r=t?e(new Map):new Map;return{getItemFromUUID:function(e){return r.set(e,r.get(e)||n()).get(e)},setItemFromUUID:function(e,n){r.set(e,n)},removeItemFromUUID:function(e){r.delete(e)}}}async function O(e,n){return r()||await c(0),r()||function(){const n=+e.colWidth;return a(n)?n:64}();function r(){var r,i;return null==(i=null==(r=t(n))?void 0:r.getColumnByField(e.field))?void 0:i.renderWidth}}function F(e){const t=n(v);function i(){var n;return{$table:e.$table,value:e.row[e.column.field],row:e.row,column:{...e.column,...null==(n=e.column.editRender)?void 0:n.props},index:e.rowIndex>-1?e.rowIndex:e.$rowIndex}}function o(e={}){t("formChange",{...i(),...m(r(e))})}function u(e={}){t("formClick",{...i(),...m(r(e))})}return{emitFormChange:function(){o()},emitFormClick:function(){u()},emitFormChangeWithParams:o,emitFormClickWithParams:u}}const P=Object.freeze({createDefaultRenderCell:function(){return function(e,{row:n,column:t}){return[i("span",null,[n[t.field]])]}},createRenderEdit:function(e){return function({props:n},t){return e({...t,fieldItem:n||{},...F(t)})}},isEditableColumn(e,n){var t;return!1!==(null==(t=e.editConfig)?void 0:t.showIcon)&&n.editRender&&!1!==n.editRender.enabled},hasFilter(e){if(y(e))return!0;let n=e.fieldSetting;return d(n)&&(n=o(n||"")),s(n)&&((t=n).notParticipatingSearch!==g.POSITIVE&&"manual"===(null==(r=t.mapping)?void 0:r.type));var t,r},hasDateFiler(e){var n;return null==(n=null==e?void 0:e.filterSetting)?void 0:n.daterange}}),A=Object.freeze({isPositive:e=>e===E.POSITIVE||e===g.POSITIVE,isNegative:e=>e===E.NEGATIVE||e===g.NEGATIVE,notPositive:e=>e!==E.POSITIVE&&e!==g.POSITIVE,notNegative:e=>e!==E.NEGATIVE&&e!==g.NEGATIVE}),$=(e,n)=>({$event:t,column:r})=>{var i;if(!u(e).includes(null==(i=r.editRender)?void 0:i.name))return!0;const o=null==t?void 0:t.target;return!s(o)||!l(o,n)};function N(e){return[I.TRANSFORM_WITH_SPAN_METHOD,I.TRANSFORM_TREE_TYPE].includes(`${e.isTree}`)}function b(e){return d(e)&&!!e.match(/^###\{[^{}]+}$/)}function V(e){try{return JSON.parse(e.replace(/^###/,""))}catch(e){return{}}}function x(e,n){if(e.$__SEPARATE||!n.editRender||!n.editRender.props)return e[n.field];const{fieldSetting:t}=n.editRender.props;if(!d(t))return e[n.field];const{mergedFeildExpression:r}=o(t);return r&&d(r)?r.replace(/#{(.+?)}/g,(function(n,t){let r=t?e[t.trim()]:null;b(r)&&(r=V(r).change_text);return r||(null==r?"--":r)})):e[n.field]}const U=["SEARCH","SELECT","RADIO","CHECKBOX"];function y(e){return e.notParticipatingSearch===E.NEGATIVE&&U.includes(T.getCellType(e))&&f(e.options)&&e.options.length}export{P as IhoTableRenderHelper,A as IhoTableStatusHelper,T as IhoTableUtils,h as IhoTableWarn,$ as createIhoTableClearActivedInterceptor,R as eventListener2EventName,S as eventName2EventListener,O as getColumnRenderWidth,C as getRowHeight,y as isCompatibleColumn,b as isRichContent,N as isTransformTreeType,x as parseMergeField,V as parseRichContent,F as useIhoTableFormEvent,w as useUUIDMap};
@@ -2917,7 +2917,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
2917
2917
  "x-read-pretty"?: boolean | undefined;
2918
2918
  "x-compile-omitted"?: string[] | undefined;
2919
2919
  }>>;
2920
- onKeydown: (event: KeyboardEvent) => void;
2920
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
2921
2921
  clearSpan: (uuid: string) => void;
2922
2922
  exposeEvent: {
2923
2923
  validate(path?: string): Promise<void>;
@@ -3804,7 +3804,7 @@ declare const InfoHeader: SFCWithInstall<import("vue").DefineComponent<{
3804
3804
  "x-read-pretty"?: boolean | undefined;
3805
3805
  "x-compile-omitted"?: string[] | undefined;
3806
3806
  }>>;
3807
- onKeydown: (event: KeyboardEvent) => void;
3807
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
3808
3808
  clearSpan: (uuid: string) => void;
3809
3809
  exposeEvent: {
3810
3810
  validate(path?: string): Promise<void>;
@@ -2911,7 +2911,7 @@ declare const _default: import("vue").DefineComponent<{
2911
2911
  "x-read-pretty"?: boolean | undefined;
2912
2912
  "x-compile-omitted"?: string[] | undefined;
2913
2913
  }>>;
2914
- onKeydown: (event: KeyboardEvent) => void;
2914
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
2915
2915
  clearSpan: (uuid: string) => void;
2916
2916
  exposeEvent: {
2917
2917
  validate(path?: string): Promise<void>;
@@ -3798,7 +3798,7 @@ declare const _default: import("vue").DefineComponent<{
3798
3798
  "x-read-pretty"?: boolean | undefined;
3799
3799
  "x-compile-omitted"?: string[] | undefined;
3800
3800
  }>>;
3801
- onKeydown: (event: KeyboardEvent) => void;
3801
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
3802
3802
  clearSpan: (uuid: string) => void;
3803
3803
  exposeEvent: {
3804
3804
  validate(path?: string): Promise<void>;
@@ -2484,7 +2484,7 @@ declare const _default: import("vue").DefineComponent<{
2484
2484
  "x-read-pretty"?: boolean | undefined;
2485
2485
  "x-compile-omitted"?: string[] | undefined;
2486
2486
  }>>;
2487
- onKeydown: (event: KeyboardEvent) => void;
2487
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
2488
2488
  clearSpan: (uuid: string) => void;
2489
2489
  exposeEvent: {
2490
2490
  validate(path?: string): Promise<void>;
@@ -496,7 +496,7 @@ declare const _default: import("vue").DefineComponent<{
496
496
  "x-read-pretty"?: boolean | undefined;
497
497
  "x-compile-omitted"?: string[] | undefined;
498
498
  }>>;
499
- onKeydown: (event: KeyboardEvent) => void;
499
+ onKeydown: (event: KeyboardEvent) => Promise<void>;
500
500
  clearSpan: (uuid: string) => void;
501
501
  exposeEvent: {
502
502
  validate(path?: string): Promise<void>;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as a,provide as l,ref as t,nextTick as o,watch as r,openBlock as u,createBlock as n,unref as s,isRef as i,normalizeStyle as c,withCtx as v,createVNode as d,createElementVNode as p,renderSlot as f}from"vue";import{useTheme as h}from"../../../shared/hooks/useTheme.js";import{useDebounceFn as y,useEventBus as m,useVModel as g,onClickOutside as b}from"@vueuse/core";import"date-fns";import{isString as w,isArray as k,isObject as S,isFunction as K}from"lodash-es";import{uuidGenerator as _}from"../../../shared/utils/index.js";import{NOOP as N}from"@vue/shared";import{NPopover as C,NInput as P}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as j,InjectionKeyboardEventBus as x,InjectionSearchCascaderLoadingNode as A,InjectionSearchCascaderValue as U}from"./constants/index.js";import{SearchMenu as W}from"./components/SearchMenu.js";const F=["id"];var L=e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function},menuWidth:{type:[Number,String],default:150}},emits:["update:value","focus","update:show"],setup(e,{expose:L,emit:T}){const V=e,B=h();function E(){var e;e=[],Promise.resolve(K(V.beforeSetValue)?V.beforeSetValue(e):e).then((e=>T("update:value",e)),N)}function I(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&O()}const R=y((e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||z.value?M.emit(e.key):O()}),50),$=a((()=>({"--menu-width":V.menuWidth}))),M=m("cascaderKeydown"),q=_(),z=g(V,"show",T);l(j,a((()=>V.checkAbleLevel))),l(x,M);const D=t(""),G=a((()=>w(V.value)&&V.value?V.value:k(V.value)&&V.value.length?V.value.map((e=>S(e)?e[V.labelKey]:e)).join(" / "):V.editPlaceholder)),H=a({get:()=>z.value?D.value:w(V.value)?V.value:k(V.value)?V.value.reduce(((e,a,l)=>0===l?a[V.labelKey]:e+" / "+a[V.labelKey]),""):"",set(e){D.value=e,le(void 0,e)}});function J(e){T("focus",e)}function O(){z.value||(z.value=!0,D.value="",le())}async function Q(){var e;z.value=!1,null==(e=X.value)||e.blur()}const X=t();b(X,(e=>{var a;if(!z.value)return;const l=e;if(!l.target)return Q();!function(e){let a=!1,l=e;for(;l;){if(l.id===q){a=!0;break}l=l.parentElement}return a}(l.target)?Q():null==(a=X.value)||a.focus()}));const Y=t(),Z=t(),ee=t(),ae=t(null);l(A,ae),l(U,a((()=>V.value)));const le=y((async(e,a)=>{var l;const{type:t,node:r}=e||{};try{if("update"===t)return void(K(V.search)&&V.search({...r,isLeaf:!0}));ae.value=r;const e=await(K(V.search)&&V.search(r,a));Z.value=S(e)||k(e)?e:r,console.log("current_node_value=>",Z.value)}finally{ae.value=null,await o(),null==(l=Y.value)||l.syncPosition()}}),400),te=e=>{ee.value=e};return r((()=>V.show),(e=>{e&&(ee.value={})})),r((()=>V.options),(e=>{e.length>0&&H.value?ee.value=e[0]:ee.value={}})),L({getWidth(){var e;if(!X.value)return 0;const a=null==(e=X.value)?void 0:e.$el;return a?a.clientWidth:void 0}}),(a,l)=>(u(),n(s(C),{class:"search-cascader",trigger:"manual",show:s(z),"onUpdate:show":l[1]||(l[1]=e=>i(z)?z.value=e:null),"show-arrow":!1,placement:"bottom-start",style:c(s($)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Y},{trigger:v((()=>[d(s(P),{class:"search-cascader__input",placeholder:s(z)?s(G):e.placeholder,clearable:e.clearable,onClear:E,value:s(H),"onUpdate:value":l[0]||(l[0]=e=>i(H)?H.value=e:null),ref_key:"inputRef",ref:X,onFocus:J,onClick:I,onKeydown:s(R)},null,8,["placeholder","clearable","value","onKeydown"])])),default:v((()=>[p("section",{id:s(q)},[d(s(W),{style:c(s(B)),"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(le),onChangeCursor:te,"current-node":Z.value,"cursor-node":ee.value},{empty:v((()=>[f(a.$slots,"empty")])),_:3},8,["style","label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,F)])),_:3},8,["show","style","width"]))}});export{L as default};
1
+ import{defineComponent as e,computed as a,provide as l,ref as t,nextTick as r,watch as o,openBlock as u,createBlock as n,unref as s,isRef as i,normalizeStyle as c,withCtx as v,createVNode as d,createElementVNode as p,renderSlot as f}from"vue";import{useTheme as h}from"../../../shared/hooks/useTheme.js";import{useEventBus as y,useVModel as m,onClickOutside as g,useDebounceFn as b}from"@vueuse/core";import"date-fns";import{isString as w,isArray as k,isObject as S,isFunction as K}from"lodash-es";import{uuidGenerator as C}from"../../../shared/utils/index.js";import{NOOP as N}from"@vue/shared";import{NPopover as _,NInput as P}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as j,InjectionKeyboardEventBus as x,InjectionSearchCascaderLoadingNode as A,InjectionSearchCascaderValue as U}from"./constants/index.js";import{SearchMenu as W}from"./components/SearchMenu.js";const F=["id"];var L=e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function},menuWidth:{type:[Number,String],default:150}},emits:["update:value","focus","update:show"],setup(e,{expose:L,emit:T}){const V=e,B=h();function E(){var e;e=[],Promise.resolve(K(V.beforeSetValue)?V.beforeSetValue(e):e).then((e=>T("update:value",e)),N)}function I(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&O()}const R=e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||z.value?M.emit(e.key,e):O()},$=a((()=>({"--menu-width":V.menuWidth}))),M=y("cascaderKeydown"),q=C(),z=m(V,"show",T);l(j,a((()=>V.checkAbleLevel))),l(x,M);const D=t(""),G=a((()=>w(V.value)&&V.value?V.value:k(V.value)&&V.value.length?V.value.map((e=>S(e)?e[V.labelKey]:e)).join(" / "):V.editPlaceholder)),H=a({get:()=>z.value?D.value:w(V.value)?V.value:k(V.value)?V.value.reduce(((e,a,l)=>0===l?a[V.labelKey]:e+" / "+a[V.labelKey]),""):"",set(e){D.value=e,le(void 0,e)}});function J(e){T("focus",e)}function O(){z.value||(z.value=!0,D.value="",le())}async function Q(){var e;z.value=!1,null==(e=X.value)||e.blur()}const X=t();g(X,(e=>{var a;if(!z.value)return;const l=e;if(!l.target)return Q();!function(e){let a=!1,l=e;for(;l;){if(l.id===q){a=!0;break}l=l.parentElement}return a}(l.target)?Q():null==(a=X.value)||a.focus()}));const Y=t(),Z=t(),ee=t(),ae=t(null);l(A,ae),l(U,a((()=>V.value)));const le=b((async(e,a)=>{var l;const{type:t,node:o}=e||{};try{if("update"===t)return void(K(V.search)&&V.search({...o,isLeaf:!0}));ae.value=o;const e=await(K(V.search)&&V.search(o,a));Z.value=S(e)||k(e)?e:o}finally{ae.value=null,await r(),null==(l=Y.value)||l.syncPosition()}}),400),te=e=>{ee.value=e};return o((()=>V.show),(e=>{e&&(ee.value={})})),L({getWidth(){var e;if(!X.value)return 0;const a=null==(e=X.value)?void 0:e.$el;return a?a.clientWidth:void 0},setCursor(e){ee.value=e}}),(a,l)=>(u(),n(s(_),{class:"search-cascader",trigger:"manual",show:s(z),"onUpdate:show":l[1]||(l[1]=e=>i(z)?z.value=e:null),"show-arrow":!1,placement:"bottom-start",style:c(s($)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Y},{trigger:v((()=>[d(s(P),{class:"search-cascader__input",placeholder:s(z)?s(G):e.placeholder,clearable:e.clearable,onClear:E,value:s(H),"onUpdate:value":l[0]||(l[0]=e=>i(H)?H.value=e:null),ref_key:"inputRef",ref:X,onFocus:J,onClick:I,onKeydown:R},null,8,["placeholder","clearable","value"])])),default:v((()=>[p("section",{id:s(q)},[d(s(W),{style:c(s(B)),"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(le),onChangeCursor:te,"current-node":Z.value,"cursor-node":ee.value},{empty:v((()=>[f(a.$slots,"empty")])),_:3},8,["style","label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,F)])),_:3},8,["show","style","width"]))}});export{L as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,createVNode as t,createTextVNode as o,computed as n,inject as a,withModifiers as l}from"vue";import{traverse as c}from"../../../../shared/utils/index.js";import{Reload as s,ChevronForward as u}from"@vicons/ionicons5";import{NOOP as i}from"@vue/shared";import{useVirtualList as d}from"@vueuse/core";import{isArray as p,isFunction as f,isNumber as v,isEqual as y,isString as h}from"lodash-es";import{NCheckbox as m}from"naive-ui";import{InjectionSearchCascaderLoadingNode as g,InjectionSearchCascaderValue as N,InjectionSearchCascaderCheckAbleLevel as C,InjectionKeyboardEventBus as b}from"../constants/index.js";const k=e({props:{options:{type:Array,default:()=>[]},activeNodes:{type:Array,default:()=>[]},level:{type:Number,required:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},cursorNode:{type:Object,default:()=>({})}},emits:["nodeClick","changeCursor"],setup(e,{emit:r}){const o=n((()=>e.options)),{list:c,containerProps:f,wrapperProps:k}=d(o,{itemHeight:32,overscan:5}),K=a(g),_=a(N),x=a(C),A=a(b),S=n((()=>v(x.value)&&x.value<=e.level));function j(e){return Object.keys(e).length<=0}function w(r){return e.cursorNode==r}function I(r){const t=function(e){const r=[e];let t=e;for(;t.parent;)t=t.parent,r.unshift(t);return r}(r);if(p(_.value))return y(o(t,e.valueKey),o(_.value,e.valueKey));if(h(_.value)){const r=_.value.split("/").map((e=>e.trim()));return y(r,o(t,e.labelKey))}return!1;function o(e,r){return e.map((e=>e[r]))}}function O(e){const r=f.ref.value;if(r){const t=32*e-(null==r?void 0:r.clientHeight);r.scrollTo(0,t>0?t:0)}}return A.on((function(t){if("ArrowUp"===t){if(j(e.cursorNode))return;const t=o.value.findIndex((r=>r===e.cursorNode));if(t>=0){const e=0===t?o.value.length-1:t-1,n=o.value[e];r("changeCursor",n),O(e+3)}}if("ArrowRight"===t){if(j(e.cursorNode))return;r("nodeClick",{type:"search",node:e.cursorNode}),r("changeCursor",{})}if("ArrowDown"===t){if(j(e.cursorNode))return r("changeCursor",o.value[0]);const t=o.value.findIndex((r=>r===e.cursorNode));if(t>=0){const e=t>=o.value.length-1?0:t+1,n=o.value[e];r("changeCursor",n),O(e+1)}}if("ArrowLeft"===t&&e.activeNodes.length){const t=e.activeNodes.slice(-1);r("changeCursor",t[0])}"Enter"===t&&(S.value?r("nodeClick",{type:"update",node:e.cursorNode}):r("nodeClick",{type:"search",node:e.cursorNode}))})),()=>t("div",{class:"search-cascader__optionWrapper",ref:f.ref,style:f.style,onScroll:f.onScroll},[t("div",{style:k.value.style},[c.value.map((o=>{return t("div",{class:["search-cascader__option",{"search-cascader__option--active":(n=o.data,(null==(a=e.activeNodes)?void 0:a.includes(n))||w(o.data))}],onClick:()=>r("nodeClick",{type:"search",node:o.data}),title:o.data[e.labelKey]},[t("div",{class:"search-cascader__optionText"},[S.value?t(m,{style:{marginRight:"8px"},checked:I(o.data),onClick:l(i,["stop"]),onUpdateChecked:e=>e&&function(e){r("nodeClick",{type:"update",node:e})}(o.data)},null):null,t("span",{class:{"search-cascader__optionText--active":I(o.data)}},[o.data[e.labelKey]])]),K.value===o.data?t(s,{class:"rotate"},null):o.data.isLeaf?null:t(u,null,null)]);var n,a}))])])}}),K=e({props:{childKey:{type:String,default:"children"},options:{type:Array,default:()=>[]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},currentNode:{type:Object},cursorNode:{type:Object}},emits:["nodeClick","changeCursor"],setup(e,{slots:n,emit:a}){const l=r([]);function s(r,o){return t(k,{level:o+1,labelKey:e.labelKey,valueKey:e.valueKey,activeNodes:l.value,onNodeClick:e=>a("nodeClick",e),onChangeCursor:e=>a("changeCursor",e),options:r,cursorNode:e.cursorNode},null)}function u(r){let t=!1;return c(r,((r,o)=>{e.currentNode===r&&(t=!0,o())}),["children"]),console.log("node_result=>",r,t,e.currentNode),t}function i(){if(!p(e.options)||!e.currentNode)return[];const r=[e.options];let t=e.options;for(l.value.length=0;p(t);){const o=t.find(u);if(!o)break;l.value.push(o),t=o[e.childKey],r.push(t)}if(e.cursorNode){const t=r.findIndex((r=>(r&&r.findIndex((r=>r===e.cursorNode)))>=0));if(t>=0){const e=r.slice(0,t+1);return l.value.splice(t,r.length),e}}return r}return()=>t("section",{class:"search-cascader__menuWrapper"},[p(e.options)&&e.options.length?e.currentNode?i().map(s):s(e.options,0):t("section",{class:"search-cascader__emptyWrapper"},[f(n.empty)?n.empty():t("section",null,[o("empty")])])])}});export{K as SearchMenu};
1
+ import{defineComponent as e,ref as r,createVNode as t,createTextVNode as o,computed as n,inject as a,onBeforeUnmount as l,withModifiers as c}from"vue";import{traverse as s}from"../../../../shared/utils/index.js";import{Reload as u,ChevronForward as i}from"@vicons/ionicons5";import{NOOP as d}from"@vue/shared";import{useVirtualList as p}from"@vueuse/core";import{isArray as f,isFunction as v,isNumber as y,isEqual as h,isString as m}from"lodash-es";import{NCheckbox as N}from"naive-ui";import{InjectionSearchCascaderLoadingNode as g,InjectionSearchCascaderValue as C,InjectionSearchCascaderCheckAbleLevel as b,InjectionKeyboardEventBus as k}from"../constants/index.js";const K=e({props:{options:{type:Array,default:()=>[]},activeNodes:{type:Array,default:()=>[]},level:{type:Number,required:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},cursorNode:{type:Object,default:()=>({})}},emits:["nodeClick","changeCursor"],setup(e,{emit:r}){const o=n((()=>e.options)),{list:s,containerProps:v,wrapperProps:K}=p(o,{itemHeight:32,overscan:5}),_=a(g),x=a(C),A=a(b),S=a(k),j=n((()=>y(A.value)&&A.value<=e.level));function w(e){return Object.keys(e).length<=0}function I(r){return e.cursorNode==r}function O(r){const t=function(e){const r=[e];let t=e;for(;t.parent;)t=t.parent,r.unshift(t);return r}(r);if(f(x.value))return h(o(t,e.valueKey),o(x.value,e.valueKey));if(m(x.value)){const r=x.value.split("/").map((e=>e.trim()));return h(r,o(t,e.labelKey))}return!1;function o(e,r){return e.map((e=>e[r]))}}function R(e){const r=v.ref.value;if(r){const t=32*e-(null==r?void 0:r.clientHeight);r.scrollTo(0,t>0?t:0)}}function T(t,n){if("ArrowUp"===t){if(w(e.cursorNode))return;const t=o.value.findIndex((r=>r===e.cursorNode));if(t>=0){const e=0===t?o.value.length-1:t-1,n=o.value[e];r("changeCursor",n),R(e+3)}}if("ArrowRight"===t){if(w(e.cursorNode))return;r("nodeClick",{type:"search",node:e.cursorNode}),r("changeCursor",{})}if("ArrowDown"===t){if(w(e.cursorNode))return r("changeCursor",o.value[0]);const t=o.value.findIndex((r=>r===e.cursorNode));if(t>=0){const e=t>=o.value.length-1?0:t+1,n=o.value[e];r("changeCursor",n),R(e+1)}}if("ArrowLeft"===t&&e.activeNodes.length){const t=e.activeNodes.slice(-1);r("changeCursor",t[0])}"Enter"===t&&function(){if(!w(e.cursorNode))Reflect.set(n,"stopCapture",!0),j.value?r("nodeClick",{type:"update",node:e.cursorNode}):r("nodeClick",{type:"search",node:e.cursorNode})}()}return l((()=>{S.off(T)})),S.on(T),()=>t("div",{class:"search-cascader__optionWrapper",ref:v.ref,style:v.style,onScroll:v.onScroll},[t("div",{style:K.value.style},[s.value.map((o=>{return t("div",{class:["search-cascader__option",{"search-cascader__option--active":(n=o.data,(null==(a=e.activeNodes)?void 0:a.includes(n))||I(o.data))}],onClick:()=>r("nodeClick",{type:"search",node:o.data}),title:o.data[e.labelKey]},[t("div",{class:"search-cascader__optionText"},[j.value?t(N,{style:{marginRight:"8px"},checked:O(o.data),onClick:c(d,["stop"]),onUpdateChecked:e=>e&&function(e){r("nodeClick",{type:"update",node:e})}(o.data)},null):null,t("span",{class:{"search-cascader__optionText--active":O(o.data)}},[o.data[e.labelKey]])]),_.value===o.data?t(u,{class:"rotate"},null):o.data.isLeaf?null:t(i,null,null)]);var n,a}))])])}}),_=e({props:{childKey:{type:String,default:"children"},options:{type:Array,default:()=>[]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},currentNode:{type:Object},cursorNode:{type:Object}},emits:["nodeClick","changeCursor"],setup(e,{slots:n,emit:a}){const l=r([]);function c(r,o){return t(K,{level:o+1,labelKey:e.labelKey,valueKey:e.valueKey,activeNodes:l.value,onNodeClick:e=>a("nodeClick",e),onChangeCursor:e=>a("changeCursor",e),options:r,cursorNode:e.cursorNode},null)}function u(r){let t=!1;return s(r,((r,o)=>{e.currentNode===r&&(t=!0,o())}),["children"]),t}function i(){var r,t;if(!f(e.options)||!e.currentNode)return[];const o=[e.options];let n=e.options;for(l.value.length=0;f(n);){const r=n.find(u);if(!r)break;l.value.push(r),n=r[e.childKey],o.push(n)}if(e.cursorNode){const n=o.findIndex((r=>(r&&r.findIndex((r=>r===e.cursorNode)))>=0));if(n>=0&&!(null==(t=null==(r=e.cursorNode)?void 0:r.children)?void 0:t.length)){const e=o.slice(0,n+1);return l.value.splice(n,o.length),e}}return o}return()=>t("section",{class:"search-cascader__menuWrapper"},[f(e.options)&&e.options.length?e.currentNode?i().map(c):c(e.options,0):t("section",{class:"search-cascader__emptyWrapper"},[v(n.empty)?n.empty():t("section",null,[o("empty")])])])}});export{_ as SearchMenu};
@@ -54,13 +54,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
54
54
  default: boolean;
55
55
  };
56
56
  searchFilter: {
57
- type: ObjectConstructor;
58
- default: () => {
59
- isOpen: boolean;
60
- multiple: boolean;
61
- customTitles: string[];
62
- itemHeight: number;
63
- };
57
+ type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
58
+ default: () => {};
64
59
  };
65
60
  treeSetting: {
66
61
  type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
@@ -77,6 +72,12 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
77
72
  default: () => Promise<never[]>;
78
73
  };
79
74
  }, {
75
+ searchFilterBase: {
76
+ isOpen: boolean;
77
+ multiple: boolean;
78
+ customTitles: string[];
79
+ itemHeight: number;
80
+ };
80
81
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
81
82
  defaultList: {
82
83
  type: import("vue").PropType<((string | number) | {
@@ -132,13 +133,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
132
133
  default: boolean;
133
134
  };
134
135
  searchFilter: {
135
- type: ObjectConstructor;
136
- default: () => {
137
- isOpen: boolean;
138
- multiple: boolean;
139
- customTitles: string[];
140
- itemHeight: number;
141
- };
136
+ type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
137
+ default: () => {};
142
138
  };
143
139
  treeSetting: {
144
140
  type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
@@ -189,7 +185,13 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
189
185
  allCheckedKeys: (string | number)[];
190
186
  isRemote: import("vue").ComputedRef<boolean>;
191
187
  checkStrategyResult: import("vue").ComputedRef<any>;
192
- isSearchFilter: import("vue").ComputedRef<any>;
188
+ isSearchFilter: import("vue").ComputedRef<boolean>;
189
+ mergeSearchFilter: import("vue").ComputedRef<{
190
+ isOpen: boolean;
191
+ multiple: boolean;
192
+ customTitles: string[];
193
+ itemHeight: number;
194
+ }>;
193
195
  caculateTagData: import("vue").ComputedRef<any[]>;
194
196
  init: () => void;
195
197
  getallCheckedKeysWithChild: (item: import("naive-ui").TreeOption) => void;
@@ -624,13 +626,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
624
626
  default: boolean;
625
627
  };
626
628
  searchFilter: {
627
- type: ObjectConstructor;
628
- default: () => {
629
- isOpen: boolean;
630
- multiple: boolean;
631
- customTitles: string[];
632
- itemHeight: number;
633
- };
629
+ type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
630
+ default: () => {};
634
631
  };
635
632
  treeSetting: {
636
633
  type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
@@ -673,7 +670,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
673
670
  showClear: boolean;
674
671
  multiple: boolean;
675
672
  searchInner: boolean;
676
- searchFilter: Record<string, any>;
673
+ searchFilter: import("../../../es/shared/types").AnyObject;
677
674
  treeSetting: import("naive-ui/es/tree/src/interface").TreeOptionBase & {
678
675
  [k: string]: unknown;
679
676
  } & import("../../../es/shared/types").AnyObject;
@@ -59,13 +59,8 @@ declare const _default: import("vue").DefineComponent<{
59
59
  default: boolean;
60
60
  };
61
61
  searchFilter: {
62
- type: ObjectConstructor;
63
- default: () => {
64
- isOpen: boolean;
65
- multiple: boolean;
66
- customTitles: string[];
67
- itemHeight: number;
68
- };
62
+ type: PropType<AnyObject>;
63
+ default: () => {};
69
64
  };
70
65
  treeSetting: {
71
66
  type: PropType<ITreeOption>;
@@ -80,6 +75,12 @@ declare const _default: import("vue").DefineComponent<{
80
75
  default: () => Promise<never[]>;
81
76
  };
82
77
  }, {
78
+ searchFilterBase: {
79
+ isOpen: boolean;
80
+ multiple: boolean;
81
+ customTitles: string[];
82
+ itemHeight: number;
83
+ };
83
84
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
84
85
  defaultList: {
85
86
  type: PropType<(IKey | ITag)[]>;
@@ -122,13 +123,8 @@ declare const _default: import("vue").DefineComponent<{
122
123
  default: boolean;
123
124
  };
124
125
  searchFilter: {
125
- type: ObjectConstructor;
126
- default: () => {
127
- isOpen: boolean;
128
- multiple: boolean;
129
- customTitles: string[];
130
- itemHeight: number;
131
- };
126
+ type: PropType<AnyObject>;
127
+ default: () => {};
132
128
  };
133
129
  treeSetting: {
134
130
  type: PropType<ITreeOption>;
@@ -177,7 +173,13 @@ declare const _default: import("vue").DefineComponent<{
177
173
  allCheckedKeys: IKey[];
178
174
  isRemote: import("vue").ComputedRef<boolean>;
179
175
  checkStrategyResult: import("vue").ComputedRef<any>;
180
- isSearchFilter: import("vue").ComputedRef<any>;
176
+ isSearchFilter: import("vue").ComputedRef<boolean>;
177
+ mergeSearchFilter: import("vue").ComputedRef<{
178
+ isOpen: boolean;
179
+ multiple: boolean;
180
+ customTitles: string[];
181
+ itemHeight: number;
182
+ }>;
181
183
  caculateTagData: import("vue").ComputedRef<any[]>;
182
184
  init: () => void;
183
185
  getallCheckedKeysWithChild: (item: TreeOption) => void;
@@ -587,13 +589,8 @@ declare const _default: import("vue").DefineComponent<{
587
589
  default: boolean;
588
590
  };
589
591
  searchFilter: {
590
- type: ObjectConstructor;
591
- default: () => {
592
- isOpen: boolean;
593
- multiple: boolean;
594
- customTitles: string[];
595
- itemHeight: number;
596
- };
592
+ type: PropType<AnyObject>;
593
+ default: () => {};
597
594
  };
598
595
  treeSetting: {
599
596
  type: PropType<ITreeOption>;
@@ -621,7 +618,7 @@ declare const _default: import("vue").DefineComponent<{
621
618
  showClear: boolean;
622
619
  multiple: boolean;
623
620
  searchInner: boolean;
624
- searchFilter: Record<string, any>;
621
+ searchFilter: AnyObject;
625
622
  treeSetting: ITreeOption;
626
623
  queryLoadChildData: (node: TreeOption) => Promise<AnyObject>;
627
624
  queryTreeSearch: (keyWork: string) => Promise<Array<AnyObject>>;