cnhis-design-vue 3.1.52-beta.20 → 3.1.52-beta.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.
- package/es/components/button-print/src/utils/print.d.ts +3 -3
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +2 -0
- package/es/components/form-render/src/components/renderer/select.d.ts +7 -0
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/iho-table/index.d.ts +2 -0
- package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -0
- package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +3 -1
- package/es/components/iho-table/src/plugins/copyPastePlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/copyPastePlugin.js +1 -0
- package/es/components/iho-table/src/plugins/forceArrowKeyPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/forceArrowKeyPlugin.js +1 -0
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +3 -0
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
|
@@ -40,13 +40,13 @@ export declare class Print {
|
|
|
40
40
|
pageCount: any;
|
|
41
41
|
formatId: string;
|
|
42
42
|
};
|
|
43
|
-
_handleEventDirect({ templateId, formatId, params, cmdid, print, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
43
|
+
_handleEventDirect({ templateId, formatId, params, cmdid, print, signature, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
44
44
|
_handleEventEditFormat({ templateId, formatId, params, token, messageTimeout }: AnyObject): Promise<any>;
|
|
45
45
|
_queryProxyOrigin(): Promise<void>;
|
|
46
46
|
_queryPrintFile(formatId: string, params?: string): Promise<any>;
|
|
47
47
|
_browserPrint(result: AnyObject, mode: string): Promise<string | void>;
|
|
48
|
-
preview({ templateId, formatId, params, btnprint, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
|
|
49
|
-
printDirect({ templateId, formatId, params, print, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
48
|
+
preview({ templateId, formatId, params, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: Func, errorCallbackFn?: Func): Promise<any>;
|
|
49
|
+
printDirect({ templateId, formatId, params, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: Func, errorCallbackFn: Func, mode?: string): Promise<any>;
|
|
50
50
|
private _downloadPDF;
|
|
51
51
|
/**
|
|
52
52
|
* 下载pdf
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as n,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const h=t.create({timeout:1e3,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,c=`${m}/fdp-api/print/assembly/printIReport`,u=`${m}/bi-api/reprot/print/open/client/getRemote`,p=`${m}/printService/file`;let w=null;class f{constructor(){var t,e,n;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],w)return w;w=this;const r=window;this.CMonitor=r.$CMonitor;try{this.webview=r.top?null==(t=r.top.chrome)?void 0:t.webview:null==(e=r.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(n=r.chrome)?void 0:n.webview}if(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:s,reject:n}=e;try{s(i.res||"")}catch(t){n(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{h({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}},null==e?void 0:e.messageTimeout):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:s(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(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 s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,n){const r={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(r);return this._handleQueryPrintDataResult(a,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:s,print:n,printdlgshow:r="0",nobillnode:a="1",btnprint:o="1",messageTimeout:l=0}){const h={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:a,printdlgshow:r,btnprint:o,messageTimeout:l};if(n){try{n=JSON.parse(n)}catch(t){}h.print=n}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");h.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(h)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:n=0}){const r={};let a={};try{a=Object.assign({},r,JSON.parse(i))}catch(t){a=r}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:n};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({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,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await n(`${p}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:s,messageTimeout:n=0},l,d){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==d?void 0:d("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==l||l({file:t}))}await this._queryProxyOrigin();const h=await this._testConnection();if(!this._handleResultTest(h,d))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:s,messageTimeout:n}),a=this._handleResult(r,d);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==l||l(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==d||d(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,printdlgshow:n,nobillnode:o,isDownloadFile:l=!0,messageTimeout:d=0},h,m,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==h||h({file:t}))):null==m?void 0:m("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,printdlgshow:n,nobillnode:o,messageTimeout:d}),a=this._handleResult(r,m);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==h||h(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async n=>{if(n||s(null),a(t.formatId))return i(n);const r=this,o=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(n.filedir);i(o,n)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,r);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,r);if(!l)return!1;n&&n(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,r);return!!o&&(n&&n(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,n);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n=0},r,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n}),d=this._handleResult(l,a);if(!d)return!1;r&&r(d)}async addPrintFormat({templateId:t,params:e,token:i},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,n);if(!o)return!1;s&&s(o)}}export{f as Print};
|
|
1
|
+
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as n,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as d}from"date-fns";const h=t.create({timeout:1e3,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,u=`${m}/fdp-api/print/assembly/printIReport`,c=`${m}/bi-api/reprot/print/open/client/getRemote`,p=`${m}/printService/file`;let w=null;class f{constructor(){var t,e,n;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],w)return w;w=this;const r=window;this.CMonitor=r.$CMonitor;try{this.webview=r.top?null==(t=r.top.chrome)?void 0:t.webview:null==(e=r.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(n=r.chrome)?void 0:n.webview}if(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:s,reject:n}=e;try{s(i.res||"")}catch(t){n(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{h({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}},null==e?void 0:e.messageTimeout):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:s(i)}):h({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(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 s={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(s),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,s,n){const r={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(r);return this._handleQueryPrintDataResult(a,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:s,print:n,signature:r,printdlgshow:a="0",nobillnode:o="1",btnprint:l="1",messageTimeout:h=0}){const m={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:o,printdlgshow:a,btnprint:l,messageTimeout:h,...r?{signature:r}:{}};if(n){try{n=JSON.parse(n)}catch(t){}m.print=n}else if(this.isRemote){const t=d(new Date,"yyyyMMddHHmmss");m.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(m)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:n=0}){const r={};let a={};try{a=Object.assign({},r,JSON.parse(i))}catch(t){a=r}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:n};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await h({method:"get",url:c})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await h({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await n(`${p}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",signature:s,btnprint:n,messageTimeout:l=0},d,h){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==h?void 0:h("获取文件失败!");const s=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,s),void(null==d||d({file:t}))}await this._queryProxyOrigin();const m=await this._testConnection();if(!this._handleResultTest(m,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",signature:s,btnprint:n,messageTimeout:l}),a=this._handleResult(r,h);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==d||d(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:s,signature:n,printdlgshow:o,nobillnode:l,isDownloadFile:d=!0,messageTimeout:h=0},m,u,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==m||m({file:t}))):null==u?void 0:u("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,u))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:s,signature:n,printdlgshow:o,nobillnode:l,messageTimeout:h}),a=this._handleResult(r,u);if(!a)return!1;d&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==m||m(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):h.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=d(new Date,"yyyy-MM-dd"),i=l(),s=d(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}this.printDirect(t,(async n=>{if(n||s(null),a(t.formatId))return i(n);const r=this,o=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(n.filedir);i(o,n)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,r);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,r);if(!l)return!1;n&&n(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},n,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,r);return!!o&&(n&&n(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,n);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n=0},r,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:n}),d=this._handleResult(l,a);if(!d)return!1;r&&r(d)}async addPrintFormat({templateId:t,params:e,token:i},s,n){const r=await this._testConnection();if(!this._handleResultTest(r,n))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,n);if(!o)return!1;s&&s(o)}}export{f as Print};
|
|
@@ -2776,6 +2776,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
2776
2776
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
2777
2777
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
2778
2778
|
}) => boolean) | undefined;
|
|
2779
|
+
forceArrowKey?: boolean | undefined;
|
|
2779
2780
|
} | undefined;
|
|
2780
2781
|
clipConfig?: {
|
|
2781
2782
|
isCopy?: boolean | undefined;
|
|
@@ -5277,6 +5278,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
5277
5278
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
5278
5279
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
5279
5280
|
}) => boolean) | undefined;
|
|
5281
|
+
forceArrowKey?: boolean | undefined;
|
|
5280
5282
|
} | undefined;
|
|
5281
5283
|
clipConfig?: {
|
|
5282
5284
|
isCopy?: boolean | undefined;
|
|
@@ -106,6 +106,9 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
106
106
|
type: BooleanConstructor;
|
|
107
107
|
default: boolean;
|
|
108
108
|
};
|
|
109
|
+
selectAll: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
};
|
|
109
112
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "postRecommend")[], "update:value" | "postRecommend", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
110
113
|
value: {
|
|
111
114
|
type: PropType<ArrayAble<string | number> | null>;
|
|
@@ -209,6 +212,9 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
209
212
|
type: BooleanConstructor;
|
|
210
213
|
default: boolean;
|
|
211
214
|
};
|
|
215
|
+
selectAll: {
|
|
216
|
+
type: BooleanConstructor;
|
|
217
|
+
};
|
|
212
218
|
}>> & {
|
|
213
219
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
214
220
|
onPostRecommend?: ((...args: any[]) => any) | undefined;
|
|
@@ -221,6 +227,7 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
221
227
|
lazyRequest: boolean;
|
|
222
228
|
requestCache: boolean;
|
|
223
229
|
deletable: boolean;
|
|
230
|
+
selectAll: boolean;
|
|
224
231
|
shouldSave: boolean;
|
|
225
232
|
recommend: boolean;
|
|
226
233
|
recommendCache: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,computed as l,inject as t,useAttrs as
|
|
1
|
+
import{defineComponent as e,computed as l,inject as t,useAttrs as a,ref as o,createVNode as u,mergeProps as n,toRaw as r,nextTick as s,createTextVNode as i}from"vue";import{arrayed as p}from"../../../../../shared/utils/index.js";import{HelpCircleSharp as m}from"@vicons/ionicons5";import{promiseTimeout as c}from"@vueuse/shared";import{cloneDeep as d,isArray as v,isString as f,isObject as y,omit as h,xor as g}from"lodash-es";import{useCommonInjection as S,useSelectOptionProps as b}from"../../hooks/useCommonInjection.js";import{useComplexOptions as j,useComplexOptionsSpan as C}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as w,InjectionFormUUID as k}from"../../constants/index.js";import"../../../index.js";import"@formily/core";import"@formily/path";import"@vue/shared";import"@vueuse/core";import{NSelect as B,NTooltip as F,NIcon as x,NTag as A,NButton as O}from"naive-ui";import"date-fns";import{assignUpdateValue as H,assignClearBindVisited as P,createVisitedSetter as R}from"../../utils/schema.js";import{useFormField as V}from"../../hooks/useFormField.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"../../hooks/useFormValidator.js";import{connect as K,mapProps as L}from"@formily/vue";import"./index.js";import{useUrlConfigOptions as E,useAutographOptions as _,useRecommendOptions as I,searchContentMatcher as N}from"../../hooks/useFormRenderOptions.js";const q=K(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean}},emits:["update:value","postRecommend"],setup(e,{slots:H,emit:P}){const K=l({get:()=>e.value,async set(e){P("update:value",e),Y(e)}}),L=l((()=>(e.multiple&&e.allowModify&&console.warn("多选模式下不支持allowModify"),!e.multiple&&e.allowModify))),{labelKey:q,valueKey:M,showKey:z,fetchData:W,searchContent:U,fullOptions:D,filterOptions:T,remoteOptions:$,loading:G}=e.urlConfig?E(e,K):_(e,K),{renderComplexOption:J,hasComplexOption:Q}=j(e,K),{getRecommend:X,postRecommend:Y,sortedOptions:Z}=I(e,T,P,q,M),{field:ee,fieldKey:le}=V();t(w).setContext(le.value,(e=>({currentOption:d(function(e){const l=pe(D.value);return v(e)?function(e){const t=l.reduce(((e,l)=>(e[l[M.value]]=l,e)),{});return e.map((e=>t[e]))}(e):(t=e,l.find((e=>e[M.value]===t)));var t}(e))})));const te=async(e="")=>(U.value=e,Promise.allSettled([W(e),X(e)])),{injectValueValidate:ae,injectValueWatchFromEmpty:oe,injectValueBindKey:ue}=S();oe(K,te),ae(K);const ne=ue(K),{menuProps:re,nodeProps:se}=b();function ie(e){const l=e[q.value];if(!l||!f(l))return"";const t=U.value?N(U.value,l):null,a=t?u("section",null,[t.map(((e,l)=>0!==l&&e?u("span",{style:{color:l%2==0?"var(--n-option-text-color-active)":""}},[e]):null))]):l;return e.desc?u("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[a,e.desc?u(F,null,{trigger:()=>u(x,{component:m},null),default:()=>e.desc}):null]):a}function pe(l){return e.allowCreate&&U.value&&!l.some((e=>e[q.value]===U.value))?[...l,{[q.value]:U.value,[M.value]:U.value,created:!0,shouldSave:e.shouldSave}]:l}const me=l((()=>pe(L.value?D.value:Z.value))),ce=a(),de=l((()=>{if(e.allowCreate||e.showCustomValue)return K.value;const l=e.multiple&&v(K.value);return D.value.find((e=>l?K.value.includes(e[M.value]):e[M.value]===K.value))?K.value:null})),ve=o(!1);async function fe(e){e&&await te(),ve.value=e}let ye=null;async function he(l,t){K.value=l,ye&&y(t)&&L.value&&(ye.focus(),await s(),ye.value=t[q.value]||"",ye.dispatchEvent(new CustomEvent("input")),"start"===e.cursorPlacement&&ye.setSelectionRange(0,0)),$.value&&t&&p(t).forEach((e=>{if(!y(e))return;const l=e;l.created&&l.shouldSave&&$.value.push(h(r(l),["created","shouldSave"]))}))}const ge=t(k),{getSpan:Se}=C(),be=R(ee,(async l=>{var t,a,o;L.value&&(ye=l.target,ye&&K.value&&(await s(),ye.value=null!=(o=null!=(a=null==(t=D.value.find((e=>e[M.value]===K.value)))?void 0:t[q.value])?a:K.value)?o:"",ye.dispatchEvent(new CustomEvent("input")),"start"===e.cursorPlacement&&(await c(0),ye.setSelectionRange(0,0))))}));function je(e){if(!L.value)return;if(ye=e.target,!ye)return;if(!ye.value)return K.value=null;const l=D.value.find((e=>e[q.value]===ye.value));l?K.value=l[M.value]:(U.value=ye.value,K.value=ye.value)}const Ce=o("");function we({option:l,handleClose:t}){var a;const o=null!=(a=z.value&&l[z.value])?a:l[q.value];return e.multiple?(Ce.value="",e.deletable?u(A,{closable:!0,onClose:e=>{e.stopPropagation(),t()}},{default:()=>u("span",{title:o},[o])}):`${o} ;`):(Ce.value=o,o)}function ke(l){if(!e.multiple)return;const t=l?me.value.map((e=>e[M.value])):[];g(t,e.value).length&&(K.value=t)}function Be(){return[u(O,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>ke(!0)},{default:()=>[i("全选")]}),u(O,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>ke(!1)},{default:()=>[i("清空")]})]}function Fe(l){let t=H;return e.multiple&&e.selectAll&&(t={action:Be,...H}),u(B,n({title:Ce.value,key:ne.value,multiple:e.multiple,remote:!0,filterable:!0,loading:G.value,value:de.value,onUpdateValue:he,"menu-props":re,"node-props":se,labelField:q.value,valueField:M.value,options:me.value,onSearch:te,show:ve.value,"onUpdate:show":fe,onFocus:be,onBlur:je,renderLabel:ie,renderTag:we},l,ce),t)}return()=>{var e,l;if(!Q.value)return Fe();const t=null!=(l=null==(e=ee.value.decoratorProps)?void 0:e.span)?l:6,a=Se(ge,ee.value.address);return u("section",{class:"form-render__selectChildField",style:{"--column":a+t}},[Fe({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),D.value.map((e=>J({option:e,value:K.value,valueKey:M.value,labelKey:q.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":a}}})))])}}}),L({dataSource:"options"},H,P));export{q as SELECT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as
|
|
1
|
+
import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as i,formRenderLog as r}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as l,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as a}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function d(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function m(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig","wordbook"])})}function u(u){const{createValidatorSchema:f}=a(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=f(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},_=e=>{var o,t,r,s,l,p,a;const c=x(e);e.urlConfig?m(c,e):e.autograph&&d(c,e);const u=!!e.__multiple,f="1"===e.allowModify,_=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(c["x-component-props"],{multiple:u,options:(null==(r=e.componentProps)?void 0:r.options)||e.option,allowModify:f,allowCreate:"1"===e.free_entry||!!c["x-component-props"].allowCreate||f,shouldSave:"1"===e.save_free_entry,showField:null!=(l=e.show_key)?l:null==(s=e.componentProps)?void 0:s.showField,maxTagCount:null!=(a=i(e.multi_select_value))?a:null==(p=c["x-component-props"])?void 0:p.maxTagCount,selectAll:"1"===_||!0===_,...n(e,["lazyRequest","requestCache"])}),u&&(c.type="array"),c},h=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical}),e.urlConfig?m(o,e):e.autograph&&d(o,e),o},g=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},y=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),b=new Map([["LINEBAR",y],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",_],["REMOTE_SEARCH",_],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",h],["CHECKBOX",h],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:i(e.step_length),max:i(e.max_length),min:i(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&r("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?j(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),v=e=>{if(e.suffixConfig)return w(e);return(b.get(e.html_type)||g)(e)},w=o=>{if(!o.suffixConfig&&!o.prefixConfig)return v(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"})))],i=x(o),r=n.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(i,{type:"void",name:l(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...i["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:j(n)}),i},{FieldNormalizeWaterfallHook:C,FieldListNormalizeWaterfallHook:O}=s();function j(o,n={column:9999}){let i=null;return O.call(t(o),n).reduce(((e,o,l)=>{var p;const a=null==(p=(o=C.call(o,n)).validate)?void 0:p.obj_type;return a&&u&&u.collect(a,t(o)),"LINEBAR"===o.html_type?(e[s(o)]=r(y(o),l),i=e[s(o)].properties={}):i?i[s(o)]=r(v(o),l):(i=null,e[s(o)]=r(v(o),l)),e}),{});function r(e,o){return e["x-index"]=o,e}function s(o){return o.suffixConfig?l([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:j}}export{u as useFieldListAdaptor};
|
|
@@ -1880,6 +1880,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1880
1880
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
1881
1881
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
1882
1882
|
}) => boolean) | undefined;
|
|
1883
|
+
forceArrowKey?: boolean | undefined;
|
|
1883
1884
|
} | undefined;
|
|
1884
1885
|
clipConfig?: {
|
|
1885
1886
|
isCopy?: boolean | undefined;
|
|
@@ -4381,6 +4382,7 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4381
4382
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
4382
4383
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
4383
4384
|
}) => boolean) | undefined;
|
|
4385
|
+
forceArrowKey?: boolean | undefined;
|
|
4384
4386
|
} | undefined;
|
|
4385
4387
|
clipConfig?: {
|
|
4386
4388
|
isCopy?: boolean | undefined;
|
|
@@ -1880,6 +1880,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1880
1880
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
1881
1881
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
1882
1882
|
}) => boolean) | undefined;
|
|
1883
|
+
forceArrowKey?: boolean | undefined;
|
|
1883
1884
|
} | undefined;
|
|
1884
1885
|
clipConfig?: {
|
|
1885
1886
|
isCopy?: boolean | undefined;
|
|
@@ -4381,6 +4382,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4381
4382
|
$table: import("vxe-table").VxeTableConstructor & import("vxe-table").VxeTablePrivateMethods;
|
|
4382
4383
|
$grid: import("vxe-table").VxeGridConstructor | null | undefined;
|
|
4383
4384
|
}) => boolean) | undefined;
|
|
4385
|
+
forceArrowKey?: boolean | undefined;
|
|
4384
4386
|
} | undefined;
|
|
4385
4387
|
clipConfig?: {
|
|
4386
4388
|
isCopy?: boolean | undefined;
|
|
@@ -27,7 +27,9 @@ declare class ConfigHooks extends AbstractConfigHooks {
|
|
|
27
27
|
readonly treeConfig: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.TreeConfig | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
28
28
|
readonly mouseConfig: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.MouseConfig | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
29
29
|
readonly menuConfig: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.MenuConfig | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
30
|
-
readonly keyboardConfig: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.KeyboardConfig
|
|
30
|
+
readonly keyboardConfig: SyncWaterfallHook<[(import("vxe-table").VxeTablePropTypes.KeyboardConfig & Partial<import("vxe-table").VxeTablePropTypes.KeyboardConfig & {
|
|
31
|
+
forceArrowKey: boolean;
|
|
32
|
+
}>) | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
31
33
|
readonly scrollY: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.ScrollY | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
32
34
|
readonly scrollX: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.ScrollX | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
33
35
|
readonly editRules: SyncWaterfallHook<[import("vxe-table").VxeTablePropTypes.EditRules | undefined, IhoTableConfig, IhoTableHandlerContext<true>], import("../../../../../../es/shared/utils/tapable").UnsetAdditionalOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function copyPastePlugin(): import("../../../../../es/components/iho-table").TablePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{unref as e}from"vue";import"../../index.js";import{useSessionStorage as t}from"@vueuse/core";import{selectOptionsMap as n}from"./rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{isInvalidDate as o,isInvalidTime as l,IhoTableUtils as i}from"../utils/index.js";import{EDITABLE_WIDGET_TYPE as r}from"../constants/index.js";import{isString as u,trim as d,isEmpty as s,isEqual as a,isFunction as f}from"lodash-es";import{defineTablePlugin as p}from"../hooks/useTablePlugin.js";function c(){const c="copyPastePlugin",m=t("ihoTableClipData","");return p({name:c,apply(t){function p(t,p,c,g,E){var C,b;if(!(null==(C=null==c?void 0:c.keyboardConfig)?void 0:C.isClip))return;if("paste"===t&&!p.getSelectedCell())return;const{row:T,column:x}=p.getSelectedCell()||p.getEditRecord()||{};if(!T||!x||!v(x,r.SELECT)&&e(m)===T[x.field])return;const R=c.uuid&&v(x,r.SELECT)&&n.get(c.uuid)[x.field],y=T[x.field];if("copy"===t){const e=(null==(b=(R||[]).filter((e=>y.includes(e.value))))?void 0:b.map((e=>e.label)).join(","))||y;m.value=e}else{if(u(e(m))&&(m.value=d(e(m)||"")),!e(m)||!function(e){var t;const n=null==(t=e.editRender)?void 0:t.props;return n&&Object.keys(r).includes(i.getCellType(n))}(x)||T.$__SEPARATE||!function(e,t,n,o){var l,i;const{beforeEditMethod:r}=t.editConfig||{},u={rowIndex:null!=(l=e.getRowIndex(n))?l:0,columnIndex:null!=(i=e.getColumnIndex(o))?i:0};return!r||f(r)&&r({row:n,column:o,...u,$table:e,$grid:void 0})}(p,c,T,x))return;if(v(x,r.DATE)&&o(x,T,m))return;if(v(x,r.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(m)||"").toString()))return;if(v(x,r.TIME)&&l(x,m))return;let t=e(m)||"";if(R&&!s(R)){const e=R.filter((e=>t.split(",").includes(e.label))).map((e=>e.value));if(s(e))return;if(function(e){var t,n;const o=null==(t=e.editRender)?void 0:t.props;return v(e,r.SELECT)&&(null==(n=o.componentProps)?void 0:n.multiple)}(x)){if(a(y,e))return;t=e}else{if(e.includes(y))return;t=e[0]}}T[x.field]=t,g("formChange",{column:x,row:T,oldValue:y,value:t,index:p.getRowIndex(T)}),v(x,r.SEPARATE)&&(null==E||E())}}function v(e,t){var n;const o=null==(n=e.editRender)?void 0:n.props;return o&&i.getCellType(o)===t}t.eventHooks.onCopy.tap(c,(({$table:e},t,{emits:n})=>p("copy",e,t,n))),t.eventHooks.onPaste.tap(c,(({$table:e},t,{emits:n,updateTableDataRef:o})=>p("paste",e,t,n,o)))}})}export{c as copyPastePlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function forceArrowKeyPlugin(): import("../../../../../es/components/iho-table").TablePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../index.js";import{EDITABLE_WIDGET_TYPE as e}from"../constants/index.js";import{promiseTimeout as r}from"@vueuse/shared";import{identity as o}from"lodash-es";import{defineTablePlugin as t}from"../hooks/useTablePlugin.js";function n(){const n="forceArrowKeyPlugin",i=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];function s({keyboardConfig:e={}}){return e.isArrow&&e.forceArrowKey}return t({name:n,apply(t){t.eventHooks.onKeydown.tap(n,(async({$event:e,$table:o},t)=>{const n=e;if(!s(t)||!i.includes(n.key))return;const d=o.getEditRecord()||{};if(d.row&&d.column){e.preventDefault();const r="ArrowLeft"===n.key,t="ArrowUp"===n.key,i="ArrowRight"===n.key,s="ArrowDown"===n.key;o.moveSelected(d,r,t,i,s,n)}await r(0);const{row:p,column:l}=o.getSelectedCell()||{};p&&l&&await o.setEditCell(p,l)}));const d={[e.NUMBER]:e=>{var r;return e.editRender.props={...e.editRender.props,componentProps:{keyboard:{ArrowUp:!1,ArrowDown:!1},...null==(r=e.editRender.props)?void 0:r.componentProps}},e}};t.fieldHooks.field.tap(n,((e,r,t)=>{var n;if(!s(t))return e;return(d[null==(n=e.editRender)?void 0:n.name]||o)(e)}))}})}export{n as forceArrowKeyPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"./anchorPlugin/index.js";import*as r from"./bindEventSettingPlugin/index.js";import*as i from"./defaultConfigPlugin/index.js";import*as
|
|
1
|
+
import*as e from"./anchorPlugin/index.js";import*as r from"./bindEventSettingPlugin/index.js";import*as i from"./copyPastePlugin.js";import*as n from"./defaultConfigPlugin/index.js";import*as s from"./defaultValuePlugin.js";import*as t from"./filterDaterangeRenderPlugin/index.js";import*as d from"./filterRenderPlugin/index.js";import*as l from"./filterVisibleEventPlugin.js";import*as g from"./forceArrowKeyPlugin.js";import*as u from"./headerPlugin.js";import*as o from"./highLightSetPlugin.js";import*as a from"./keyboardEventPlugin/index.js";import*as P from"./lowCodeFieldAdaptorPlugin/index.js";import*as m from"./maxCheckSizePlugin.js";import*as x from"./operationalFormPlugin/index.js";import*as f from"./rendererPlugins/editableWidgets/dateRendererPlugin/index.js";import*as p from"./rendererPlugins/editableWidgets/inputRendererPlugin.js";import*as j from"./rendererPlugins/editableWidgets/numberRendererPlugin.js";import*as R from"./rendererPlugins/editableWidgets/radioRendererPlugin.js";import*as b from"./rendererPlugins/editableWidgets/selectRendererPlugin/index.js";import*as w from"./rendererPlugins/editableWidgets/separateRendererPlugin/index.js";import*as c from"./rendererPlugins/editableWidgets/timeRendererPlugin/index.js";import*as h from"./rendererPlugins/widgets/checkRendererPlugin.js";import*as W from"./rendererPlugins/widgets/colorRendererPlugin.js";import*as v from"./rendererPlugins/widgets/defaultRendererPlugin.js";import*as k from"./rendererPlugins/widgets/htmlRendererPlugin.js";import*as C from"./rendererPlugins/widgets/labelRendererPlugin.js";import*as S from"./rendererPlugins/widgets/pictureRendererPlugin.js";import*as y from"./rendererPlugins/widgets/seqRendererPlugin.js";import*as E from"./rowClickPlugin/index.js";import*as A from"./rowDragPlugin/index.js";import*as D from"./rowGroupSettingPlugin/index.js";import*as F from"./varialbleHeightPlugin/index.js";import*as V from"./virtualTreePlugin/index.js";import{separateMetaModule as q}from"../../../../shared/utils/index.js";var z=q(Object.assign({"./anchorPlugin/index.tsx":e,"./bindEventSettingPlugin/index.ts":r,"./copyPastePlugin.ts":i,"./defaultConfigPlugin/index.ts":n,"./defaultValuePlugin.ts":s,"./filterDaterangeRenderPlugin/index.tsx":t,"./filterRenderPlugin/index.tsx":d,"./filterVisibleEventPlugin.ts":l,"./forceArrowKeyPlugin.ts":g,"./headerPlugin.tsx":u,"./highLightSetPlugin.tsx":o,"./keyboardEventPlugin/index.ts":a,"./lowCodeFieldAdaptorPlugin/index.tsx":P,"./maxCheckSizePlugin.ts":m,"./operationalFormPlugin/index.ts":x,"./rendererPlugins/editableWidgets/dateRendererPlugin/index.tsx":f,"./rendererPlugins/editableWidgets/inputRendererPlugin.tsx":p,"./rendererPlugins/editableWidgets/numberRendererPlugin.tsx":j,"./rendererPlugins/editableWidgets/radioRendererPlugin.tsx":R,"./rendererPlugins/editableWidgets/selectRendererPlugin/index.tsx":b,"./rendererPlugins/editableWidgets/separateRendererPlugin/index.tsx":w,"./rendererPlugins/editableWidgets/timeRendererPlugin/index.tsx":c,"./rendererPlugins/widgets/checkRendererPlugin.tsx":h,"./rendererPlugins/widgets/colorRendererPlugin.tsx":W,"./rendererPlugins/widgets/defaultRendererPlugin.tsx":v,"./rendererPlugins/widgets/htmlRendererPlugin.tsx":k,"./rendererPlugins/widgets/labelRendererPlugin.tsx":C,"./rendererPlugins/widgets/pictureRendererPlugin.tsx":S,"./rendererPlugins/widgets/seqRendererPlugin.tsx":y,"./rowClickPlugin/index.ts":E,"./rowDragPlugin/index.ts":A,"./rowGroupSettingPlugin/index.ts":D,"./varialbleHeightPlugin/index.tsx":F,"./virtualTreePlugin/index.ts":V}));export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{promiseTimeout as e}from"@vueuse/shared";import"../../../index.js";import{defineTablePlugin as o}from"../../hooks/useTablePlugin.js";function t(){const t="keyboardEventPlugin";return o({name:t,apply(o){o.eventHooks.onKeydown.tap(t,(async({$event:o,$table:t},n,{emits:r})=>{await e(0);const{row:a,column:i}=t.getSelectedCell()||t.getEditRecord()||{};if(!a||!i)return;r("keyboard",{$table:t,key:o.key,index:t.getRowIndex(a),value:a[i.field],row:a,column:i})}))}})}export{t as keyboardEventPlugin};
|
|
@@ -141,9 +141,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
141
141
|
valueField: string;
|
|
142
142
|
placeholder: string;
|
|
143
143
|
deletable: boolean;
|
|
144
|
+
selectAll: boolean;
|
|
144
145
|
shouldSave: boolean;
|
|
145
146
|
consistentMenuWidth: boolean;
|
|
146
147
|
allowCreate: boolean;
|
|
147
|
-
selectAll: boolean;
|
|
148
148
|
}>;
|
|
149
149
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as l,ref as t,computed as o,onBeforeUnmount as n,watch as a,nextTick as u,createVNode as i,toRaw as r,Fragment as d,createTextVNode as s}from"vue";import{keywordMatcher as c,arrayed as p}from"../../../../../../../shared/utils/index.js";import{NSelect as v,NTooltip as f,NIcon as m,NTag as y,NButton as h}from"naive-ui";import{HelpCircleSharp as b}from"@vicons/ionicons5";import{InjectionIhoTableUUID as w}from"../../../../constants/index.js";import{getSelectOptions as F,selectOptionsMap as g}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as S}from"../../../../utils/index.js";import{useDebounceFn as q}from"@vueuse/core";import{isEmpty as O,isFunction as $,isArray as x,isObject as C,omit as B,cloneDeep as _}from"lodash-es";var
|
|
1
|
+
import{defineComponent as e,inject as l,ref as t,computed as o,onBeforeUnmount as n,watch as a,nextTick as u,createVNode as i,toRaw as r,Fragment as d,createTextVNode as s}from"vue";import{keywordMatcher as c,arrayed as p}from"../../../../../../../shared/utils/index.js";import{NSelect as v,NTooltip as f,NIcon as m,NTag as y,NButton as h}from"naive-ui";import{HelpCircleSharp as b}from"@vicons/ionicons5";import{InjectionIhoTableUUID as w}from"../../../../constants/index.js";import{getSelectOptions as F,selectOptionsMap as g}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as S}from"../../../../utils/index.js";import{useDebounceFn as q}from"@vueuse/core";import{isEmpty as O,isFunction as $,isArray as x,isObject as C,omit as B,cloneDeep as _,xor as j,uniq as k}from"lodash-es";var P=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:"请选择"},allowCreate:{type:Boolean,default:!1},shouldSave:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},aliasField:{type:String},menuProps:{type:Object},multiple:{type:Boolean,default:!1},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean,default:!0}},emits:["update:value"],setup(e,{emit:P}){const M=l("$xetable"),W=t(null);function A(e){W.value=e}const D=t(!1),{emitFormChangeWithParams:E}=S({...e,$table:M}),R=t("");function T(){return z()}const I=t([]),U=o((()=>{let l=O(I.value)?e.options:I.value;return R.value?(l=l.filter((l=>l[e.labelField]&&l[e.labelField].includes(R.value)||c(R.value,l.keyword))),!e.allowCreate||l.some((l=>l[e.labelField]===R.value))?l:[...l,{[e.labelField]:R.value,[e.valueField]:R.value,created:!0,shouldSave:e.shouldSave}]):l})),V=t(!1),z=q((async function(l=""){R.value=l;try{if(V.value=!0,!$(e.queryOptions)||!O(e.options))return;I.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{V.value=!1}}),400),K=l(w);function N(l=!1){e.multiple&&u((()=>{var t,o,n;const{refTableLeftBody:a,refTableBody:u}=M.getRefMaps(),i=null==(t=null==a?void 0:a.value)?void 0:t.$el;if(!i)return;const r=null==(o=null==u?void 0:u.value)?void 0:o.$el,d=M.getRowid(e.row),s=null==(n=r.querySelector(`.vxe-body--row[rowid="${d}"]`))?void 0:n.clientHeight,c=i.querySelector(`.vxe-body--row[rowid="${d}"]`),p=l?"unset":s+"px";c.style.height=p}))}function H(l,t){var o,n;const a=e.value;P("update:value",l);const u=F(K,e.column.field,e.row,M);K&&x(u)&&p(t).forEach((e=>{if(!C(e))return;const l=e;l.created&&l.shouldSave&&u.push(B(r(l),["created","shouldSave"]))}));const i=null==(o=e.column.editRender)?void 0:o.props;if(K&&(null==i?void 0:i.connectField)){const t=null==(n=i.connectField)?void 0:n.split(","),o=g.get(K);t.forEach((async t=>{var n;const{tableColumn:a}=M.reactData,u=a.find((e=>e.field===t)),i=null==(n=null==u?void 0:u.editRender)?void 0:n.props;if(null==i?void 0:i.queryOptions){const n=l?`${t}__${e.column.field}-${l}`:t;if(o[n])return;const a=await i.queryOptions({row:e.row,column:u,isFullData:!0,connectColumn:e.column});o[n]=a}}))}E({oldValue:a,option:_(t)}),N()}function L(e){var l,t;"Tab"===e.key&&W.value&&(null==(t=(l=W.value).handleKeydown)||t.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function G(l){const t=l?U.value.map((l=>l[e.valueField])):[],o=x(e.value)?e.value:[],n=j(t,o),a=l?k(o.concat(n)):[];if(o.length===a.length)return;P("update:value",a);const u=F(K,e.column.field,e.row,M);E({oldValue:o,option:l?u.filter((l=>a.includes(l[e.valueField]))):[]})}function J({node:e,option:l}){return l.desc?i("div",{class:"iho-table__selectOptionWrapper"},[[e,i(f,null,{trigger:()=>i(m,{component:b},null),default:()=>l.desc})]]):e}function Q({option:l,handleClose:t}){var o;const n=null!=(o=e.aliasField&&l[e.aliasField])?o:l[e.labelField];return x(e.value)?e.deletable?i(y,{closable:!0,onClose:e=>{e.stopPropagation(),t()}},{default:()=>n}):`${n} ;`:i(d,null,[n])}function X(){return i(d,null,[i(h,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>G(!0)},{default:()=>[s("全选")]}),i(h,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>G(!1)},{default:()=>[s("清空")]})])}n((()=>{N(!0)})),a((()=>D.value),(e=>{N()}),{immediate:!0});const Y=()=>({class:"iho-table__selectOption"}),Z=o((()=>{var l,t;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(t=null==(l=e.menuProps)?void 0:l.class)?t:""}`}}));return()=>{const l={};return e.multiple&&e.selectAll&&(l.action=X),i(v,{ref:A,show:D.value,"onUpdate:show":e=>D.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,labelField:e.labelField,valueField:e.valueField,loading:V.value,options:U.value,multiple:e.multiple,value:e.value,remote:!0,onSearch:z,clearable:!0,filterable:!0,nodeProps:Y,menuProps:Z.value,renderTag:Q,renderOption:J,onUpdateShow:T,onUpdateValue:H,onKeydown:L},l)}}});export{P as default};
|
|
@@ -39,6 +39,9 @@ export declare type IhoTableConfig = VxeTableProps & Partial<{
|
|
|
39
39
|
disableHeader: boolean;
|
|
40
40
|
useNCheckbox: boolean;
|
|
41
41
|
}>;
|
|
42
|
+
keyboardConfig: Partial<VxeTableProps['keyboardConfig'] & {
|
|
43
|
+
forceArrowKey: boolean;
|
|
44
|
+
}>;
|
|
42
45
|
radioConfig: Partial<VxeTableProps['radioConfig'] & {
|
|
43
46
|
slots: VxeColumnPropTypes.Slots;
|
|
44
47
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.52-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.52-beta.22",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.52-beta.22",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.52-beta.
|
|
3
|
+
"version": "3.1.52-beta.22",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"iOS 7",
|
|
64
64
|
"last 3 iOS versions"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "afbeb24f108bf17bee7980daa388aa62483c544c"
|
|
67
67
|
}
|