cnhis-design-vue 3.2.1-beta.8 → 3.2.1-release.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/calendar/index.d.ts +11 -1
- package/es/components/calendar/src/Calendar.vue.d.ts +11 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +268 -2
- package/es/components/drag-scroll/src/index.d.ts +3 -3
- package/es/components/drag-scroll/src/index.js +1 -1
- package/es/components/drag-scroll/src/types.d.ts +12 -7
- package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/utils/index.js +1 -1
- package/es/components/form-config/index.d.ts +11 -4
- package/es/components/form-config/src/FormConfig.vue.d.ts +11 -4
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +2 -2
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +5 -2
- package/es/components/form-render/index.d.ts +2 -2
- package/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/FormRender.vue.d.ts +1 -1
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +2 -2
- package/es/components/form-render/src/FormRenderWrapper.vue2.js +1 -1
- package/es/components/form-render/src/components/renderer/combination/tableCombination.d.ts +9 -0
- package/es/components/form-render/src/components/renderer/combination/tableCombination.js +1 -1
- package/es/components/form-render/src/components/renderer/formItem.js +1 -1
- package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
- package/es/components/form-render/src/hooks/index.d.ts +1 -0
- package/es/components/form-render/src/hooks/index.js +1 -1
- package/es/components/form-render/src/hooks/useAutoHidden.d.ts +1 -1
- package/es/components/form-render/src/hooks/useAutoHidden.js +1 -1
- package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
- package/es/components/form-render/src/hooks/useSelectedSetting.d.ts +5 -0
- package/es/components/form-render/src/hooks/useSelectedSetting.js +1 -0
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/form-render/src/types/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/iho-table/index.d.ts +266 -0
- package/es/components/iho-table/src/IhoTable.vue.d.ts +266 -0
- package/es/components/iho-table/src/plugins/dragScrollPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.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 +2 -0
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -1
- package/es/components/info-header/index.d.ts +4 -4
- package/es/components/info-header/src/InfoHeader.vue.d.ts +4 -4
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +2 -2
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +2 -2
- package/es/components/search-cascader/index.d.ts +1 -1
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +1 -1
- package/es/components/search-cascader/src/components/SearchMenu.d.ts +1 -1
- package/es/components/shortcut-setter/index.d.ts +3 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +3 -2
- package/es/shared/assets/img/table_style_1.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/table_style_3.png.js +1 -1
- package/es/shared/assets/img/table_style_4.png.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +15 -6
- package/es/shared/utils/business.d.ts +1 -1
- package/package.json +8 -8
|
@@ -51,7 +51,7 @@ export declare class Print {
|
|
|
51
51
|
pageCount: any;
|
|
52
52
|
formatId: string;
|
|
53
53
|
};
|
|
54
|
-
_handleEventDirect({ templateId, formatId, params, cmdid, print, signature, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
54
|
+
_handleEventDirect({ templateId, formatId, params, paramsArr, cmdid, print, signature, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
|
|
55
55
|
_handleEventEditFormat({ templateId, formatId, params, token, messageTimeout }: AnyObject): Promise<any>;
|
|
56
56
|
_queryProxyOrigin(): Promise<void>;
|
|
57
57
|
_queryPrintFile(formatId: string, params?: string): Promise<any>;
|
|
@@ -60,9 +60,9 @@ export declare class Print {
|
|
|
60
60
|
_queryPrintForPdf(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
|
|
61
61
|
_browserPrint(result: AnyObject, mode: string): Promise<string | void>;
|
|
62
62
|
_base64ToBlob(fileBase64: string, fileType: string): Blob;
|
|
63
|
-
preview({ templateId, formatId, params, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
|
|
63
|
+
preview({ templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
|
|
64
64
|
printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
|
|
65
|
-
printDirect({ templateId, formatId, params, authorizationKey, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, mode?: string): Promise<any>;
|
|
65
|
+
printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, mode?: string): Promise<any>;
|
|
66
66
|
private _downloadPDF;
|
|
67
67
|
/**
|
|
68
68
|
* 下载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 r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const d=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,u=`${m}/fdp-api/print/assembly/printIReport`,p=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${m}/bi-api/reprot/print/open/client/previewIReport`,w=`${m}/bi-api/reprot/print/open/client/getRemote`,y=`${m}/bi-api/reprot/print/open/client/uploadTemplate`,g=`${m}/printService/file`;let P=null;class v{constructor(){var t,e,r;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.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this.messageHandlerQueue=[],P)return P;P=this,this._initDomesticSystem();const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.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:r}=e;try{s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:2,callback:1};const i=await this._queryServicesPrint(this.queryServicesParams);if(i&&i.filebase64&&i.key){const t={templateId:this.queryServicesParams.templateId,formatId:this.queryServicesParams.formatId,fileBase64:i.filebase64,authorizationKey:i.key,params:this.queryServicesParams.params},e=await this._uploadImageServices(t);"success"===(null==e?void 0:e.result)&&console.log("图片上传成功")}}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async _uploadImageServices(t){const e=new FormData;Object.keys(t).forEach((i=>{e.append(i,t[i])}));const{data:i}=await d({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:y,data:e})||{};return i}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=>{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}},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)}):d({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,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_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:r,signature:n,printdlgshow:a="0",nobillnode:o="1",btnprint:l="1",messageTimeout:h=0}){const d={templateId:t,formatId:e,params:i,cmdid:s,nobillnode:o,printdlgshow:a,btnprint:l,messageTimeout:h,...n?{signature:n}:{}};if(r){try{r=JSON.parse(r)}catch(t){}d.print=r}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:u,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:p,params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await d({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}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 r(`${g}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",authorizationKey:s,signature:r,btnprint:l,messageTimeout:c=0},h,d){if(a(e)){const r=await this._queryPrintForPdf(t,e,i,s);if(!r)return null==d?void 0:d("获取文件失败!");const a=n(r,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==h?void 0:h({file:r})}await this._queryProxyOrigin();const m=await this._testConnection();if(!this._handleResultTest(m,d))return!1;try{const s=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",signature:r,btnprint:l,messageTimeout:c}),n=this._handleResult(s,d);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==h||h(n)}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 printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",authorizationKey:s,print:r,signature:n,printdlgshow:o,nobillnode:l,isDownloadFile:c=!0,messageTimeout:h=0},d,m,u="printDirect"){if(a(e)){if(!this.isConnectHiPrint)return void m({message:"请连接hiPrint客户端"});const r=await this._queryPrintForBase64(t,e,i,s);if(!r.success)return m({message:r.resultMsg});const{base64:n,formatId:a}=r.map;return this.base64Fragment=n,this._successCallbackFn=d,this._errorCallbackFn=m,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,m))return!1;try{const s=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:r,signature:n,printdlgshow:o,nobillnode:l,messageTimeout:h}),a=this._handleResult(s,m);if(!a)return!1;c&&["downloadPDF"].includes(u)&&await this._browserPrint(a,u),null==d||d(a)}catch(t){const e="printDirect"===u?"打印失败":"下载失败",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}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async 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=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}if(a(t.formatId)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params,t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,n=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}(t.filedir);i(n,t)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,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:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v 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 r,useBrowserPrint as a,isIReport as n}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const d=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,p=`${m}/fdp-api/print/assembly/printIReport`,u=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${m}/bi-api/reprot/print/open/client/previewIReport`,w=`${m}/bi-api/reprot/print/open/client/getRemote`,y=`${m}/bi-api/reprot/print/open/client/uploadTemplate`,g=`${m}/printService/file`;let P=null;class v{constructor(){var t,e,r;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.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this.messageHandlerQueue=[],P)return P;P=this,this._initDomesticSystem();const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=a.chrome)?void 0:r.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:r}=e;try{s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(t){console.log("hiprint系统连接失败",t)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:2,callback:1};const i=await this._queryServicesPrint(this.queryServicesParams);if(i&&i.filebase64&&i.key){const t={templateId:this.queryServicesParams.templateId,formatId:this.queryServicesParams.formatId,fileBase64:i.filebase64,authorizationKey:i.key,params:this.queryServicesParams.params},e=await this._uploadImageServices(t);"success"===(null==e?void 0:e.result)&&console.log("图片上传成功")}}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async _uploadImageServices(t){const e=new FormData;Object.keys(t).forEach((i=>{e.append(i,t[i])}));const{data:i}=await d({method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},url:y,data:e})||{};return i}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=>{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}},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)}):d({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,r){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,r)}_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,paramsArr:s,cmdid:r,print:a,signature:n,printdlgshow:o="0",nobillnode:l="1",btnprint:h="1",messageTimeout:d=0}){const m={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:l,printdlgshow:o,btnprint:h,messageTimeout:d,...n?{signature:n}:{}};if(s&&(m.paramsArr=s),a){try{a=JSON.parse(a)}catch(t){}m.print=a}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");m.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=m,await this._queryServicesPrint(m)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(n),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:p,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:a}=await d({method:"post",url:u,params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return a}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:a}=await d({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e.split("_")[1],params:this.paramsSerializer(r),authorizationKey:s}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),n=s[s.length-2],o=s[s.length-1],l=await r(`${g}/${n}/${o}`),c=a(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,m){if(n(e)){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==m?void 0:m("获取文件失败!");const n=a(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),a=this._handleResult(r,m);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(a),null==d||d(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==m||m(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:a,signature:o,printdlgshow:l,nobillnode:c,isDownloadFile:h=!0,messageTimeout:d=0},m,p,u="printDirect"){if(n(e)){if(!this.isConnectHiPrint)return void p({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return p({message:s.resultMsg});const{base64:a,formatId:n}=s.map;return this.base64Fragment=a,this._successCallbackFn=m,this._errorCallbackFn=p,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:n,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,p))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:a,signature:o,printdlgshow:l,nobillnode:c,messageTimeout:d}),n=this._handleResult(r,p);if(!n)return!1;h&&["downloadPDF"].includes(u)&&await this._browserPrint(n,u),null==m||m(n)}catch(t){const e="printDirect"===u?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==p||p(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))}async 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=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}if(n(t.formatId)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params,t.authorizationKey);return e?(a(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);const r=this,a=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}(t.filedir);i(a,t)}),(t=>s(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,a);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,r);if(!o)return!1;s&&s(o)}}export{v as Print};
|
|
@@ -228,7 +228,17 @@ declare const Calendar: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
228
228
|
NIcon: any;
|
|
229
229
|
ChevronBackOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
230
230
|
ChevronForwardOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
231
|
-
FullCalendar:
|
|
231
|
+
FullCalendar: import("vue").DefineComponent<{
|
|
232
|
+
options: import("vue").PropType<import("@fullcalendar/core/internal-common").a>;
|
|
233
|
+
}, unknown, {
|
|
234
|
+
renderId: number;
|
|
235
|
+
customRenderingMap: Map<string, import("@fullcalendar/core/internal-common").eF<any>>;
|
|
236
|
+
}, {}, {
|
|
237
|
+
getApi(): import("@fullcalendar/core").Calendar;
|
|
238
|
+
buildOptions(suppliedOptions: import("@fullcalendar/core/internal-common").a | undefined): import("@fullcalendar/core/internal-common").a;
|
|
239
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
240
|
+
options: import("vue").PropType<import("@fullcalendar/core/internal-common").a>;
|
|
241
|
+
}>>, {}>;
|
|
232
242
|
isSameDay: typeof import("date-fns").isSameDay;
|
|
233
243
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange")[], "select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
234
244
|
showDateNavigation: {
|
|
@@ -221,7 +221,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
221
221
|
NIcon: any;
|
|
222
222
|
ChevronBackOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
223
223
|
ChevronForwardOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
224
|
-
FullCalendar:
|
|
224
|
+
FullCalendar: import("vue").DefineComponent<{
|
|
225
|
+
options: PropType<import("@fullcalendar/core/internal-common").a>;
|
|
226
|
+
}, unknown, {
|
|
227
|
+
renderId: number;
|
|
228
|
+
customRenderingMap: Map<string, import("@fullcalendar/core/internal-common").eF<any>>;
|
|
229
|
+
}, {}, {
|
|
230
|
+
getApi(): import("@fullcalendar/core").Calendar;
|
|
231
|
+
buildOptions(suppliedOptions: import("@fullcalendar/core/internal-common").a | undefined): import("@fullcalendar/core/internal-common").a;
|
|
232
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
233
|
+
options: PropType<import("@fullcalendar/core/internal-common").a>;
|
|
234
|
+
}>>, {}>;
|
|
225
235
|
isSameDay: typeof isSameDay;
|
|
226
236
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange")[], "select" | "eventClick" | "eventDrag" | "eventResize" | "dateChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
227
237
|
showDateNavigation: {
|
|
@@ -3,7 +3,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
3
3
|
formRenderRef: import("vue").Ref<import("../../../../../components/form-render").FormRenderExpose | undefined>;
|
|
4
4
|
key: import("vue").Ref<number>;
|
|
5
5
|
reload: () => Promise<void>;
|
|
6
|
-
formRenderExposeKeyList: readonly ["validate", "getFormValues", "setFormValues", "setFieldState", "resetFields", "queryWidget", "getFieldList"];
|
|
6
|
+
formRenderExposeKeyList: readonly ["validate", "getFormValues", "setFormValues", "setFieldState", "resetFields", "queryWidget", "getFieldList", "applySelectedSetting"];
|
|
7
7
|
exposed: Partial<import("../../../../../components/form-render").FormRenderExpose>;
|
|
8
8
|
FormRender: import("vue").DefineComponent<{
|
|
9
9
|
fieldList: {
|
|
@@ -396,7 +396,7 @@ export declare const CallbackMaps: Map<string, {
|
|
|
396
396
|
afterRequest(fieldKey: string, res?: any, payload?: import("../../../..").AnyObject | undefined): import("../../../..").AnyObject[];
|
|
397
397
|
afterOptionInit(fieldKey: string, options: import("../../../..").AnyObject[], payload?: import("../../../..").AnyObject | undefined): void;
|
|
398
398
|
}>>[T]>>;
|
|
399
|
-
triggerAutoHidden: (field: import("@formily/core").GeneralField) => Promise<void>;
|
|
399
|
+
triggerAutoHidden: (field: import("@formily/core").GeneralField, includeLinebar?: boolean) => Promise<void>;
|
|
400
400
|
observeFormGraph: Record<string, import("@formily/core").GeneralField>;
|
|
401
401
|
setGraph: (field: import("@formily/core").GeneralField) => void;
|
|
402
402
|
removeGraph: (field: import("@formily/core").GeneralField) => void;
|
|
@@ -3030,6 +3030,139 @@ export declare const CallbackMaps: Map<string, {
|
|
|
3030
3030
|
isBatchSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
3031
3031
|
isSingleSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
3032
3032
|
dragScroll?: boolean | undefined;
|
|
3033
|
+
dragScrollConfig?: {
|
|
3034
|
+
dragEle?: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | HTMLElement | {
|
|
3035
|
+
[x: string]: any;
|
|
3036
|
+
setup?: ((this: void, props: Readonly<import("@vue/shared").LooseRequired<any>>, ctx: import("vue").SetupContext<any>) => any) | undefined;
|
|
3037
|
+
name?: string | undefined;
|
|
3038
|
+
template?: string | object | undefined;
|
|
3039
|
+
render?: Function | undefined;
|
|
3040
|
+
components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>> | undefined;
|
|
3041
|
+
directives?: Record<string, import("vue").Directive<any, any>> | undefined;
|
|
3042
|
+
inheritAttrs?: boolean | undefined;
|
|
3043
|
+
emits?: any;
|
|
3044
|
+
expose?: string[] | undefined;
|
|
3045
|
+
serverPrefetch?: (() => Promise<any>) | undefined;
|
|
3046
|
+
compilerOptions?: {
|
|
3047
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
3048
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
3049
|
+
comments?: boolean | undefined;
|
|
3050
|
+
delimiters?: [string, string] | undefined;
|
|
3051
|
+
} | undefined;
|
|
3052
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
3053
|
+
__isFragment?: undefined;
|
|
3054
|
+
__isTeleport?: undefined;
|
|
3055
|
+
__isSuspense?: undefined;
|
|
3056
|
+
__defaults?: {} | undefined;
|
|
3057
|
+
compatConfig?: {
|
|
3058
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
3059
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
3060
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
3061
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
3062
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
3063
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
3064
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
3065
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
3066
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
3067
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
3068
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
3069
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
3070
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
3071
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
3072
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
3073
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
3074
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
3075
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
3076
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
3077
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
3078
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
3079
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
3080
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
3081
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
3082
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
3083
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
3084
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
3085
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
3086
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
3087
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
3088
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
3089
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
3090
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
3091
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
3092
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
3093
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
3094
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
3095
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
3096
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
3097
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
3098
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
3099
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
3100
|
+
MODE?: 2 | 3 | ((comp: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | null) => 2 | 3) | undefined;
|
|
3101
|
+
} | undefined;
|
|
3102
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
3103
|
+
computed?: import("vue").ComputedOptions | undefined;
|
|
3104
|
+
methods?: import("vue").MethodOptions | undefined;
|
|
3105
|
+
watch?: {
|
|
3106
|
+
[x: string]: (string | import("vue").WatchCallback<any, any> | ({
|
|
3107
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
3108
|
+
} & import("vue").WatchOptions<boolean>)) | (string | import("vue").WatchCallback<any, any> | ({
|
|
3109
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
3110
|
+
} & import("vue").WatchOptions<boolean>))[];
|
|
3111
|
+
} | undefined;
|
|
3112
|
+
provide?: import("vue").ComponentProvideOptions | undefined;
|
|
3113
|
+
inject?: (string[] | {
|
|
3114
|
+
[x: string]: string | symbol | {
|
|
3115
|
+
from?: string | symbol | undefined;
|
|
3116
|
+
default?: unknown;
|
|
3117
|
+
};
|
|
3118
|
+
[x: symbol]: string | symbol | {
|
|
3119
|
+
from?: string | symbol | undefined;
|
|
3120
|
+
default?: unknown;
|
|
3121
|
+
};
|
|
3122
|
+
}) | undefined;
|
|
3123
|
+
filters?: Record<string, Function> | undefined;
|
|
3124
|
+
mixins?: any[] | undefined;
|
|
3125
|
+
extends?: any;
|
|
3126
|
+
beforeCreate?: (() => void) | undefined;
|
|
3127
|
+
created?: (() => void) | undefined;
|
|
3128
|
+
beforeMount?: (() => void) | undefined;
|
|
3129
|
+
mounted?: (() => void) | undefined;
|
|
3130
|
+
beforeUpdate?: (() => void) | undefined;
|
|
3131
|
+
updated?: (() => void) | undefined;
|
|
3132
|
+
activated?: (() => void) | undefined;
|
|
3133
|
+
deactivated?: (() => void) | undefined;
|
|
3134
|
+
beforeDestroy?: (() => void) | undefined;
|
|
3135
|
+
beforeUnmount?: (() => void) | undefined;
|
|
3136
|
+
destroyed?: (() => void) | undefined;
|
|
3137
|
+
unmounted?: (() => void) | undefined;
|
|
3138
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
3139
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
3140
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
3141
|
+
delimiters?: [string, string] | undefined;
|
|
3142
|
+
__differentiator?: string | number | symbol | undefined;
|
|
3143
|
+
__isBuiltIn?: boolean | undefined;
|
|
3144
|
+
__file?: string | undefined;
|
|
3145
|
+
__name?: string | undefined;
|
|
3146
|
+
} | undefined;
|
|
3147
|
+
changeCursor?: boolean | undefined;
|
|
3148
|
+
scrollTarget?: any;
|
|
3149
|
+
duration?: number | undefined;
|
|
3150
|
+
type?: "px" | "percent" | undefined;
|
|
3151
|
+
isDraggableEle?: ((event: MouseEvent) => boolean) | undefined;
|
|
3152
|
+
getScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined) => {
|
|
3153
|
+
scrollTop: number;
|
|
3154
|
+
scrollLeft: number;
|
|
3155
|
+
}) | undefined;
|
|
3156
|
+
setScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined, state: {
|
|
3157
|
+
scrollTarget: any;
|
|
3158
|
+
scrollTop: number;
|
|
3159
|
+
scrollLeft: number;
|
|
3160
|
+
offsetX: number;
|
|
3161
|
+
offsetY: number;
|
|
3162
|
+
startScrollX: number;
|
|
3163
|
+
startScrollY: number;
|
|
3164
|
+
}) => void) | undefined;
|
|
3165
|
+
} | undefined;
|
|
3033
3166
|
selectType?: "checkbox" | "radio" | null | undefined;
|
|
3034
3167
|
rowDraggable?: boolean | undefined;
|
|
3035
3168
|
showSeq?: boolean | undefined;
|
|
@@ -5494,6 +5627,139 @@ export declare const CallbackMaps: Map<string, {
|
|
|
5494
5627
|
isBatchSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
5495
5628
|
isSingleSelect?: import("../../../..").MaybeString<0 | 1> | undefined;
|
|
5496
5629
|
dragScroll?: boolean | undefined;
|
|
5630
|
+
dragScrollConfig?: {
|
|
5631
|
+
dragEle?: string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | HTMLElement | {
|
|
5632
|
+
[x: string]: any;
|
|
5633
|
+
setup?: ((this: void, props: Readonly<import("@vue/shared").LooseRequired<any>>, ctx: import("vue").SetupContext<any>) => any) | undefined;
|
|
5634
|
+
name?: string | undefined;
|
|
5635
|
+
template?: string | object | undefined;
|
|
5636
|
+
render?: Function | undefined;
|
|
5637
|
+
components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>> | undefined;
|
|
5638
|
+
directives?: Record<string, import("vue").Directive<any, any>> | undefined;
|
|
5639
|
+
inheritAttrs?: boolean | undefined;
|
|
5640
|
+
emits?: any;
|
|
5641
|
+
expose?: string[] | undefined;
|
|
5642
|
+
serverPrefetch?: (() => Promise<any>) | undefined;
|
|
5643
|
+
compilerOptions?: {
|
|
5644
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
5645
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
5646
|
+
comments?: boolean | undefined;
|
|
5647
|
+
delimiters?: [string, string] | undefined;
|
|
5648
|
+
} | undefined;
|
|
5649
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
5650
|
+
__isFragment?: undefined;
|
|
5651
|
+
__isTeleport?: undefined;
|
|
5652
|
+
__isSuspense?: undefined;
|
|
5653
|
+
__defaults?: {} | undefined;
|
|
5654
|
+
compatConfig?: {
|
|
5655
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
5656
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
5657
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
5658
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
5659
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
5660
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
5661
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
5662
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
5663
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
5664
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
5665
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
5666
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
5667
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
5668
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
5669
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
5670
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
5671
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
5672
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
5673
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
5674
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
5675
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
5676
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
5677
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
5678
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
5679
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
5680
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
5681
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
5682
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
5683
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
5684
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
5685
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
5686
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
5687
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
5688
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
5689
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
5690
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
5691
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
5692
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
5693
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
5694
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
5695
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
5696
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
5697
|
+
MODE?: 2 | 3 | ((comp: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | null) => 2 | 3) | undefined;
|
|
5698
|
+
} | undefined;
|
|
5699
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
5700
|
+
computed?: import("vue").ComputedOptions | undefined;
|
|
5701
|
+
methods?: import("vue").MethodOptions | undefined;
|
|
5702
|
+
watch?: {
|
|
5703
|
+
[x: string]: (string | import("vue").WatchCallback<any, any> | ({
|
|
5704
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
5705
|
+
} & import("vue").WatchOptions<boolean>)) | (string | import("vue").WatchCallback<any, any> | ({
|
|
5706
|
+
handler: string | import("vue").WatchCallback<any, any>;
|
|
5707
|
+
} & import("vue").WatchOptions<boolean>))[];
|
|
5708
|
+
} | undefined;
|
|
5709
|
+
provide?: import("vue").ComponentProvideOptions | undefined;
|
|
5710
|
+
inject?: (string[] | {
|
|
5711
|
+
[x: string]: string | symbol | {
|
|
5712
|
+
from?: string | symbol | undefined;
|
|
5713
|
+
default?: unknown;
|
|
5714
|
+
};
|
|
5715
|
+
[x: symbol]: string | symbol | {
|
|
5716
|
+
from?: string | symbol | undefined;
|
|
5717
|
+
default?: unknown;
|
|
5718
|
+
};
|
|
5719
|
+
}) | undefined;
|
|
5720
|
+
filters?: Record<string, Function> | undefined;
|
|
5721
|
+
mixins?: any[] | undefined;
|
|
5722
|
+
extends?: any;
|
|
5723
|
+
beforeCreate?: (() => void) | undefined;
|
|
5724
|
+
created?: (() => void) | undefined;
|
|
5725
|
+
beforeMount?: (() => void) | undefined;
|
|
5726
|
+
mounted?: (() => void) | undefined;
|
|
5727
|
+
beforeUpdate?: (() => void) | undefined;
|
|
5728
|
+
updated?: (() => void) | undefined;
|
|
5729
|
+
activated?: (() => void) | undefined;
|
|
5730
|
+
deactivated?: (() => void) | undefined;
|
|
5731
|
+
beforeDestroy?: (() => void) | undefined;
|
|
5732
|
+
beforeUnmount?: (() => void) | undefined;
|
|
5733
|
+
destroyed?: (() => void) | undefined;
|
|
5734
|
+
unmounted?: (() => void) | undefined;
|
|
5735
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
5736
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
|
|
5737
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | undefined;
|
|
5738
|
+
delimiters?: [string, string] | undefined;
|
|
5739
|
+
__differentiator?: string | number | symbol | undefined;
|
|
5740
|
+
__isBuiltIn?: boolean | undefined;
|
|
5741
|
+
__file?: string | undefined;
|
|
5742
|
+
__name?: string | undefined;
|
|
5743
|
+
} | undefined;
|
|
5744
|
+
changeCursor?: boolean | undefined;
|
|
5745
|
+
scrollTarget?: any;
|
|
5746
|
+
duration?: number | undefined;
|
|
5747
|
+
type?: "px" | "percent" | undefined;
|
|
5748
|
+
isDraggableEle?: ((event: MouseEvent) => boolean) | undefined;
|
|
5749
|
+
getScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined) => {
|
|
5750
|
+
scrollTop: number;
|
|
5751
|
+
scrollLeft: number;
|
|
5752
|
+
}) | undefined;
|
|
5753
|
+
setScrollState?: ((target: import("../../../..").DragScrollTargetType | undefined, state: {
|
|
5754
|
+
scrollTarget: any;
|
|
5755
|
+
scrollTop: number;
|
|
5756
|
+
scrollLeft: number;
|
|
5757
|
+
offsetX: number;
|
|
5758
|
+
offsetY: number;
|
|
5759
|
+
startScrollX: number;
|
|
5760
|
+
startScrollY: number;
|
|
5761
|
+
}) => void) | undefined;
|
|
5762
|
+
} | undefined;
|
|
5497
5763
|
selectType?: "checkbox" | "radio" | null | undefined;
|
|
5498
5764
|
rowDraggable?: boolean | undefined;
|
|
5499
5765
|
showSeq?: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Directive } from 'vue';
|
|
2
|
-
import { DragScrollConfig } from '../../../components/drag-scroll';
|
|
3
|
-
export declare function useDragScroll(uuid: any, config: DragScrollConfig): () => void;
|
|
4
|
-
export declare const DragScroll: Directive<HTMLElement, Partial<DragScrollConfig
|
|
2
|
+
import { DragScrollConfig, DragScrollTargetType } from '../../../components/drag-scroll';
|
|
3
|
+
export declare function useDragScroll<T extends DragScrollTargetType>(uuid: any, config: DragScrollConfig<T>): () => void;
|
|
4
|
+
export declare const DragScroll: Directive<HTMLElement, Partial<DragScrollConfig<any>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{findAncestor as e,isHTMLElement as t}from"../../../shared/utils/index.js";import{useThrottleFn as r}from"@vueuse/core";import{isFunction as
|
|
1
|
+
import{findAncestor as e,isHTMLElement as t}from"../../../shared/utils/index.js";import{useThrottleFn as r}from"@vueuse/core";import{isFunction as l,isObject as s,isString as o,flow as n}from"lodash-es";import{unref as a}from"vue";const c={events:new Map,regist(e,t,r){window.addEventListener(t,r);const l=this.events.get(e)||[];l.push((()=>window.removeEventListener(t,r))),this.events.set(e,l)},stopper(e){var t;n(null!=(t=this.events.get(e))?t:[])(),this.events.delete(e)}};class i{constructor(){this.queue=[],this.lock=!1}add(e){this.queue.push(e),this.execute()}async execute(){if(!this.lock){this.lock=!0;try{for(;this.queue.length;)await this.queue.shift()()}finally{this.lock=!1}}}clear(){this.queue.length=0}}function u(o,n){var a;c.stopper(o);let u=0,g=0,d=0,p=0,f=!1;const m=new i;return c.regist(o,"mousemove",r((r=>{var s;if(!f){const t=h(n.dragEle);if(!t)return;if(!1!==n.changeCursor){const s=r.target;if(!e(s,(e=>e===t)))return;const o=!l(n.isDraggableEle)||n.isDraggableEle(r);t.style.cursor=o?"grab":"default"}return}const{pageX:o,pageY:a}=r,c=o-u,i=a-g;m.add((()=>{let e=Math.max(0,d-c),r=Math.max(0,p-i);const s=h(n.scrollTarget);if("percent"===n.type)if(t(s)){const{scrollWidth:t,scrollHeight:l,clientHeight:o,clientWidth:n}=s;e=Math.max(0,d-c/n*t),r=Math.max(0,p-i/o*l)}else console.warn(`[DragScroll]: scrollTarget ${s} is not HTMLElement`);l(n.setScrollState)?n.setScrollState(n.scrollTarget,{scrollTarget:n.scrollTarget,scrollLeft:e,scrollTop:r,startScrollX:d,startScrollY:p,offsetX:c,offsetY:i}):null==s||s.scrollTo(e,r)})),window.getSelection&&(null==(s=window.getSelection())||s.removeAllRanges())}),null!=(a=n.duration)?a:50)),c.regist(o,"mousedown",(t=>{const r=h(n.dragEle);if(!r)return;const o=t.target;if(!e(o,(e=>e===r)))return;if(!(!l(n.isDraggableEle)||n.isDraggableEle(t)))return;const a=l(n.getScrollState)?n.getScrollState(n.scrollTarget):h(n.scrollTarget);s(a)&&(u=t.pageX,g=t.pageY,d=a.scrollLeft,p=a.scrollTop,f=!0)})),c.regist(o,"mouseup",(()=>{f=!1,m.clear()})),()=>c.stopper(o)}const g={mounted(e,t){u(e,Object.assign({dragEle:e,scrollTarget:e},t.value))},unmounted(e){c.stopper(e)},updated(e,t){c.stopper(e),u(e,Object.assign({dragEle:e,scrollTarget:e},t.value))}};function h(e){return e=a(e),o(e)?document.querySelector(e):t(e)?e:s(e)?Reflect.get(e,"$el"):null}export{g as DragScroll,u as useDragScroll};
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { MaybeRef } from '@vueuse/shared';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
|
-
declare type
|
|
4
|
-
export declare type DragScrollConfig = Partial<{
|
|
5
|
-
dragEle:
|
|
3
|
+
export declare type DragScrollTargetType = MaybeRef<HTMLElement | string | Component>;
|
|
4
|
+
export declare type DragScrollConfig<T extends DragScrollTargetType = any> = Partial<{
|
|
5
|
+
dragEle: DragScrollTargetType;
|
|
6
6
|
changeCursor: boolean;
|
|
7
|
-
scrollTarget:
|
|
7
|
+
scrollTarget: T;
|
|
8
8
|
duration: number;
|
|
9
|
+
type: 'percent' | 'px';
|
|
9
10
|
isDraggableEle: (event: MouseEvent) => boolean;
|
|
10
|
-
getScrollState: (target:
|
|
11
|
+
getScrollState: (target: DragScrollTargetType | undefined) => {
|
|
11
12
|
scrollTop: number;
|
|
12
13
|
scrollLeft: number;
|
|
13
14
|
};
|
|
14
|
-
setScrollState: (target:
|
|
15
|
+
setScrollState: (target: DragScrollTargetType | undefined, state: {
|
|
16
|
+
scrollTarget: T;
|
|
15
17
|
scrollTop: number;
|
|
16
18
|
scrollLeft: number;
|
|
19
|
+
offsetX: number;
|
|
20
|
+
offsetY: number;
|
|
21
|
+
startScrollX: number;
|
|
22
|
+
startScrollY: number;
|
|
17
23
|
}) => void;
|
|
18
24
|
}>;
|
|
19
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,unref as r,watch as u}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{isNumber as o}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as
|
|
1
|
+
import{ref as e,computed as t,reactive as a,unref as r,watch as u}from"vue";import{defaultBorderStyle as l,defaultLineStyle as i,defaultTextStyle as n}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{isNumber as o}from"lodash-es";import"../useEvent.js";import"../temperature/useShadow.js";import{ECG as d}from"../../constants/index.js";import"naive-ui";import"@vueuse/core";import{useElectrocardiogram as m}from"./useElectrocardiogram.js";import{useMeasureInstrument as s}from"./useMeasureInstrument.js";function v(v,c,g,h,f,p){const N=e(),M=e(),b=e(),L=e(),y=t((()=>c.data.width)),x=t((()=>c.data.height)),S=t((()=>(y.value-0)/C.value)),w=t((()=>(x.value-0)/E.value)),C=t((()=>{const{dataList:e,config:t,grid:a}=c.data;if(o(a.gridXNumber))return a.gridXNumber;const r=e[e.length-1].data.length/t.hz;return Math.ceil(r/t.mainXCellValue)})),E=t((()=>{const{config:e,grid:t,dataList:a}=c.data;if(o(t.gridYNumber))return t.gridYNumber;const r=a.length;return Math.ceil(X.value*r*2/e.mainYCellValue)})),X=t((()=>{const{dataList:e,config:t}=c.data,a=e[e.length-1].data,r=Math.max(...a)-Math.min(...a);return"uv"===t.valueUnit?.001*r:"v"===t.valueUnit?1e3*r:r})),j=t((()=>{var e;return(null==(e=c.data.grid)?void 0:e.event)||{selectable:!0,evented:!0}})),R=t((()=>{const{mode:e="2-6"}=c.data,[t,a]=e.split("-").map((e=>+e));return{columnNumber:t,rowNumber:a}})),I=t((()=>{const{rowNumber:e}=R.value,{dataList:t}=c.data,a=t.length;return Math.round(E.value/(e+(a===d.MAXLINENUMBER?1:0)))})),U=t((()=>{const{dataList:e,width:t,config:a,grid:r}=c.data,{columnNumber:u,rowNumber:l}=R.value,i=t/u,n=e.length,o=Math.ceil(I.value/2),m=function(){const{valueUnit:t,mainYCellValue:r}=a,l=e[0].data,i=d(Math.max(...l));if(2!==u)return i;const n=e[6].data,o=d(Math.max(...n));return Math.max(i,o);function d(e){return("uv"===t?.001*e:"v"===t?1e3*e:e)/r*w.value}}(),s=w.value*o,v=1===u||s<m?w.value*Math.ceil(m/w.value):s;return e.map(((e,t)=>{const a=d.MAXLINENUMBER===n&&t===n-1?l:t%l;return{...e,origin:{x:(d.MAXLINENUMBER===n&&t===n-1?0:Math.floor(t/l))*i,y:a*(w.value*I.value)+v,rowIdx:a}}}))})),Y=a({canvasWidth:c.data.width,canvasHeight:c.data.height,borderStyle:{...l,...c.data.borderStyle},lineStyle:{...i,...c.data.lineStyle},titleStyle:{...n,...c.data.titleStyle},measureLineStyle:{...i,...c.data.measureLineStyle},measureTextStyle:{...n,...c.data.measureTextStyle},grid:c.data.grid,originX:0,endX:y.value,originY:0,endY:x.value,xCellWidth:S.value,yCellHeight:w.value,gridXNumber:C.value,gridYNumber:E.value,event:j.value,dataList:U.value,columnNumber:r(R).columnNumber,rowNumber:r(R).rowNumber,config:c.data.config});return u((()=>v.value),(e=>{e&&function(){const{useMeasureRuler:e,flag:t,useCaliper:a,useCaliperRuler:r}=s(v,Y),{updatePolyline:u}=m(v,Y,t);M.value=e,b.value=a,L.value=r,N.value=u}()}),{immediate:!0}),{propItems:Y,updatePolyline:N,useMeasureRuler:M,useCaliper:b,useCaliperRuler:L,getGridInfo:function(){return{cellWidth:S.value,cellHeight:w.value,smallCellNumber:d.SMALLCELLNUMBER}}}}export{v as useElectrocardiogramChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as c,isEffectiveNode as u,getTime as d}from"../../utils/index.js";import{cloneDeep as p,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L){const{computedX:P,computedY:b,getXValue:w,getYValue:A}=r(h),{xCellWidth:I,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:X,event:M,scaleValues:T,xAxis:V,startTime:Y,timeXCell:S,itemList:$,dialog:F}=h,O=new Map,D=new Set,_=p(T);let z=[],N=null;const G=new Set;l(y,h);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:R}=s(y,k,h),{pause:W,resume:B}=g((()=>{!function(){if(!G.size)return;for(const e of G)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function H(){_.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=b(t.type,t.range,n),a=i([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{x.point={...e||{x:a.left,y:a.top}},x.list=[`${o} ${n}${t.unit||""}`],x.show=!0})),a.on("mouseout",(()=>{x.show=!1}))),y.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),ee(t,n,e))}))}))}function Q(e=[]){if(!(null==N?void 0:N.areaPos))return[];const{startPos:t,endPos:n}=N.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:fe()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function U(e){F.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),Z()},onNegativeClick:()=>Z(),onClose:()=>Z()})}function Z(){N&&y.value.remove(N),N=null}function ee(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];O.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,g=u;l.key&&(g=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:b="",key:C,type:K="circle"}=g,j=se(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],X={origin:{data:l,title:b,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...h.event.hovered?h.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:h.event};e&&(E||(X.leftLine=null),p=o(K,{left:e[0],top:e[1],...X}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){M.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ae(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),M.hovered&&re(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/I);if(a>l+I){if(0===z.length){ne(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const u=l+I*c;if(z.every((e=>e.left!==u))){const t=w(u),n=A(f.type,s);z.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),ne(e,[...e.prevPointer,u,s])}if(z.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+I*l,r=z.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=z.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=z[l-1]||{left:n,top:i},f=~~((r.left-(t-I))/I),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:w(t),value:A(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},z.splice(l,0,a),ne(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=O.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=I/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?te(e,"#999"):te(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(z.length>0&&i<z[z.length-1].left){for(const e of D)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(z=z.filter((e=>e.left<=i)),0===z.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(z.length>0){const t=z.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:A(t,e.top)}};if(y.value.discardActiveObject(),z.length>0){const l=_.find((e=>e.type===t));let r=-1;const a=z.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void oe({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...a.at(-1),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ie({...o,data:a,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ie(o,"change")}}))}(p),null==(d=O.get(u.key))||d.push(p))}(se(l,n),l,c,e)})),Promise.all(O.get(e.key)).then((t=>{const n=f.filter((e=>e));R(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||G.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function te(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function ne(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function ie(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=_.find((e=>e.type===r)),u=f.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(o,n),u.list[o-1]&&(u.list[o-1].breakpoint=!0);break;case"change":u.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=c(e,u.list),n=Array.isArray(i)?i:[i];u.list.splice(t,a>-1?a-t+1:0,...n);break}}oe({dataIndex:s,scaleValue:f})}function oe(e){var t,n,i;if(D.size&&(null==(t=y.value)||t.remove(...le([...D]))),D.clear(),z=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...le(O.get(o.key))),O.delete(o.key),ee(o,t,i)}else O.size&&(null==(i=y.value)||i.remove(...le(fe()))),O.clear(),H()}function le(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function re(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;x.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:A(i,e.top)}`;x.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],x.show=!0}function ae(e){e.setCoords();const t=6e4/S,n=e.prevPoint?e.prevPoint.left+t:K,i=j;e.top<E&&e.set("top",E),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function se(e,t){if(u(e)&&function(e){const t=Date.parse(V.list.at(-1)),n=d(e);return n>=Y&&n<=t}(e.time)){const n=P(e.time),i=b(t.type,t.range,e.value);return[n,i<E?E:i>X?X:i]}}function fe(){return v(Array.from(O.values()))}return e((()=>{W()})),H(),function(){if(!M.evented)return;let e=!1,i={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);fe().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),$.forEach((n=>{J(fe(),t,"key",2*I).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=Q();t.length>0?U((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ie(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);k("remove",e)})):a.emit(N)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),y.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;N&&y.value.remove(N),N=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),N.areaPos={startPos:i,endPos:o.pointer},y.value.add(N)}))}(),{redrawPoints:oe,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),ie(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),ie({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ae,setPopup:re,updateData:ie,getGridPoints:fe,getContainPoints:Q,showDialog:U,removeCurrentSelection:Z}}export{y as useCenter};
|
|
1
|
+
import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as c,isEffectiveNode as u,getTime as d}from"../../utils/index.js";import{cloneDeep as p,omit as m,flatten as v}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as g}from"@vueuse/core";function y(y,h,k,x,L){const{computedX:P,computedY:b,getXValue:w,getYValue:A}=r(h),{xCellWidth:I,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:X,event:M,scaleValues:V,xAxis:T,startTime:Y,timeXCell:S,itemList:$,dialog:F}=h,O=new Map,D=new Set,_=p(V);let z=[],N=null;const G=new Set;l(y,h);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:R}=s(y,k,h),{pause:W,resume:B}=g((()=>{!function(){if(!G.size)return;for(const e of G)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function H(){_.forEach((e=>{const{range:t=[],spaceValue:n}=e;n&&(t[0]||t[1])&&e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=b(t.type,t.range,n),a=i([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});M.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{x.point={...e||{x:a.left,y:a.top}},x.list=[`${o} ${n}${t.unit||""}`],x.show=!0})),a.on("mouseout",(()=>{x.show=!1}))),y.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),ee(t,n,e))}))}))}function Q(e=[]){if(!(null==N?void 0:N.areaPos))return[];const{startPos:t,endPos:n}=N.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:fe()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function U(e){F.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),Z()},onNegativeClick:()=>Z(),onClose:()=>Z()})}function Z(){N&&y.value.remove(N),N=null}function ee(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];O.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,g=u;l.key&&(g=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:b="",key:C,type:K="circle"}=g,j=se(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],X={origin:{data:l,title:b,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...h.event.hovered?h.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:h.event};e&&(E||(X.leftLine=null),p=o(K,{left:e[0],top:e[1],...X}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){M.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{x.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ae(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),M.hovered&&re(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/I);if(a>l+I){if(0===z.length){ne(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const u=l+I*c;if(z.every((e=>e.left!==u))){const t=w(u),n=A(f.type,s);z.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),ne(e,[...e.prevPointer,u,s])}if(z.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+I*l,r=z.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=z.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=z[l-1]||{left:n,top:i},f=~~((r.left-(t-I))/I),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:w(t),value:A(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},z.splice(l,0,a),ne(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=O.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=I/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?te(e,"#999"):te(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(z.length>0&&i<z[z.length-1].left){for(const e of D)e.left>i&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(z=z.filter((e=>e.left<=i)),0===z.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(z.length>0){const t=z.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(x.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:A(t,e.top)}};if(y.value.discardActiveObject(),z.length>0){const l=_.find((e=>e.type===t));let r=-1;const a=z.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void oe({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...a.at(-1),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));k("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ie({...o,data:a,coincideIndex:r})}else k("change",{...m(o,["selfKey","lineAttr"]),key:n}),ie(o,"change")}}))}(p),null==(d=O.get(u.key))||d.push(p))}(se(l,n),l,c,e)})),Promise.all(O.get(e.key)).then((t=>{const n=f.filter((e=>e));R(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||G.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function te(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function ne(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function ie(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=_.find((e=>e.type===r)),u=f.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(o,n),u.list[o-1]&&(u.list[o-1].breakpoint=!0);break;case"change":u.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=c(e,u.list),n=Array.isArray(i)?i:[i];u.list.splice(t,a>-1?a-t+1:0,...n);break}}oe({dataIndex:s,scaleValue:f})}function oe(e){var t,n,i;if(D.size&&(null==(t=y.value)||t.remove(...le([...D]))),D.clear(),z=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=y.value)||n.remove(...le(O.get(o.key))),O.delete(o.key),ee(o,t,i)}else O.size&&(null==(i=y.value)||i.remove(...le(fe()))),O.clear(),H()}function le(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function re(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;x.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:A(i,e.top)}`;x.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],x.show=!0}function ae(e){e.setCoords();const t=6e4/S,n=e.prevPoint?e.prevPoint.left+t:K,i=j;e.top<E&&e.set("top",E),e.top>X&&e.set("top",X),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function se(e,t){if(u(e)&&function(e){const t=Date.parse(T.list.at(-1)),n=d(e);return n>=Y&&n<=t}(e.time)){const n=P(e.time),i=b(t.type,t.range,e.value);return[n,i<E?E:i>X?X:i]}}function fe(){return v(Array.from(O.values()))}return e((()=>{W()})),H(),function(){if(!M.evented)return;let e=!1,i={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=X)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);fe().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&L.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===L.list.length&&(L.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),$.forEach((n=>{J(fe(),t,"key",2*I).includes(n.linkKey||n.key)||L.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===L.list.length&&(L.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(L,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=Q();t.length>0?U((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ie(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);k("remove",e)})):a.emit(N)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),y.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;N&&y.value.remove(N),N=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),N.areaPos={startPos:i,endPos:o.pointer},y.value.add(N)}))}(),{redrawPoints:oe,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(k("remove",n),ie(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:A(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),k("add",n),ie({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:ae,setPopup:re,updateData:ie,getGridPoints:fe,getContainPoints:Q,showDialog:U,removeCurrentSelection:Z}}export{y as useCenter};
|