cnhis-design-vue 3.2.6-release.2 → 3.2.7-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/es/components/button-print/src/utils/print.d.ts +4 -2
  2. package/es/components/button-print/src/utils/print.js +1 -1
  3. package/es/components/fabric-chart/src/constants/index.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useCenter.d.ts +1 -0
  5. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/temperature/useOther.d.ts +2 -2
  7. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  9. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  10. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  11. package/es/components/form-render/index.js +1 -1
  12. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  13. package/es/components/form-render/src/utils/index.d.ts +1 -0
  14. package/es/components/form-render/src/utils/index.js +1 -1
  15. package/es/components/iho-chat/index.d.ts +497 -19
  16. package/es/components/iho-chat/src/Index.vue.d.ts +502 -24
  17. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  18. package/es/components/iho-chat/src/api/index.d.ts +5 -0
  19. package/es/components/iho-chat/src/api/index.js +1 -1
  20. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +89 -0
  21. package/es/components/iho-chat/src/components/ChatAdd.vue.js +1 -0
  22. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -0
  23. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  24. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +94 -4
  25. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  26. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +129 -3
  27. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  28. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +24 -2
  29. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  30. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +0 -1
  31. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +1 -1
  32. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  33. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +16 -1
  34. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  35. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +133 -0
  36. package/es/components/iho-chat/src/components/MultipleVideo.vue.js +1 -0
  37. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -0
  38. package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +15 -1
  39. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  40. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  41. package/es/components/iho-chat/src/components/Video.vue.d.ts +24 -13
  42. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  43. package/es/components/iho-chat/src/constants/index.d.ts +10 -1
  44. package/es/components/iho-chat/src/constants/index.js +1 -1
  45. package/es/components/iho-chat/src/hooks/index.d.ts +1 -0
  46. package/es/components/iho-chat/src/hooks/index.js +1 -1
  47. package/es/components/iho-chat/src/hooks/useSession.d.ts +1 -0
  48. package/es/components/iho-chat/src/hooks/useSession.js +1 -1
  49. package/es/components/iho-chat/src/hooks/useState.d.ts +5 -0
  50. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  51. package/es/components/iho-chat/src/hooks/useVideo.d.ts +24 -0
  52. package/es/components/iho-chat/src/hooks/useVideo.js +1 -0
  53. package/es/components/iho-chat/src/types/index.d.ts +3 -0
  54. package/es/components/iho-chat/src/utils/index.d.ts +2 -1
  55. package/es/components/iho-chat/src/utils/index.js +1 -1
  56. package/es/components/iho-chat/style/index.css +1 -1
  57. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  58. package/es/components/index.css +1 -1
  59. package/es/components/index.js +1 -1
  60. package/es/shared/hooks/useLevelSearchCascader.js +1 -1
  61. package/es/shared/package.json.js +1 -1
  62. package/es/shared/utils/index.d.ts +1 -1
  63. package/package.json +2 -2
@@ -8,6 +8,7 @@ export declare class Print {
8
8
  private instance;
9
9
  private downloadPath;
10
10
  private printOrigin;
11
+ private printDomesticOrigin;
11
12
  private isRemote;
12
13
  private CMonitor;
13
14
  private queryServicesParams;
@@ -18,7 +19,6 @@ export declare class Print {
18
19
  private base64Fragment;
19
20
  private _successCallbackFn;
20
21
  private _errorCallbackFn;
21
- private _isHiprint;
22
22
  constructor();
23
23
  private readonly messageHandlerQueue;
24
24
  private messageHandler;
@@ -33,6 +33,7 @@ export declare class Print {
33
33
  */
34
34
  show(...args: Parameters<IdentityVerificationDialog['show']>): Promise<string>;
35
35
  showPreview(...args: Parameters<PreviewDialog['show']>): Promise<string>;
36
+ _testDomesticSystemConnection(): Promise<unknown>;
36
37
  _testConnection(): Promise<unknown>;
37
38
  resetPrinter(formatId: string): Promise<any>;
38
39
  _queryServicesPrint(params: AnyObject): Promise<any>;
@@ -65,7 +66,8 @@ export declare class Print {
65
66
  _base64ToBlob(fileBase64: string, fileType: string): Blob;
66
67
  preview({ templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
67
68
  printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
68
- printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<any>;
69
+ printDirect({ templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
70
+ printToHiPrint({ templateId, formatId, params, authorizationKey }: any, successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<any>;
69
71
  private _downloadPDF;
70
72
  /**
71
73
  * 下载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 p=String(navigator.platform).toLowerCase().includes("linux"),d=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,u=`${m}/fdp-api/print/assembly/printIReport`,f=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${m}/bi-api/reprot/print/open/client/previewIReport`,w=`${m}/bi-api/reprot/print/open/client/getRemote`,y=`${m}/printService/file`;let v=null;class P{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._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,v)return v;v=this,p&&this._isHiprint&&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","resetprint"].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{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});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",{reconnectionAttempts:3,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=null})),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:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}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)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):d({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_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))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!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,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:p="1",messageTimeout:d=0}){const m={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:p,copies:o,messageTimeout:d,...a?{signature:a}:{}};if(s&&(m.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}m.print=n}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 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:f,params:{id:t,formatId:e,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:g,responseType:"blob",params:{id:t,formatId:e,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(`${y}/${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="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},d,m){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&p&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==m?void 0:m("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==d?void 0:d({file:s})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,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}),n=this._handleResult(r,m);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==d||d(n)}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:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:d=!0,messageTimeout:m=0},u,f,g,w="printDirect"){const y=a(e);if(e=this.getIReportFormatId(y,e),y&&p&&this._isHiprint){if(!this.isConnectHiPrint)return void f({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return f({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=u,this._errorCallbackFn=f,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,f))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:m}),a=this._handleResult(r,f,g);if(!a)return!1;d&&["downloadPDF"].includes(w)&&await this._browserPrint(a,w),null==u||u(a)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==f||f(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,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&p&&this._isHiprint){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)),(t=>{console.log(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{P 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 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 m=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,d=`${p}/fdp-api/print/assembly/printIReport`,u=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${p}/bi-api/reprot/print/open/client/previewIReport`,f=`${p}/bi-api/reprot/print/open/client/getRemote`,w=`${p}/printService/file`;let y=null;class P{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.printDomesticOrigin="http://127.0.0.1:17521",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=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,y)return y;y=this;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","resetprint"].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{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});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(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=h(this.printDomesticOrigin,{reconnection:!1,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=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),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(e){console.log("hiprint系统连接失败",e),t&&t(!1)}}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:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}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)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({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)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_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))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).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)}):m({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,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!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,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:m="1",messageTimeout:p=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:m,copies:o,messageTimeout:p,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}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 m({method:"get",url:f})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:d,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 m({method:"post",url:u,params:{id:t,formatId:e,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 m({method:"post",url:g,responseType:"blob",params:{id:t,formatId:e,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(`${w}/${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="",paramsArr:s,authorizationKey:r,signature:n,btnprint:l,messageTimeout:c=0},h,m){const p=a(e);e=this.getIReportFormatId(p,e),await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,m))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:n,btnprint:l,messageTimeout:c}),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==h||h(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:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:m=!0,messageTimeout:p=0},d,u,g,f="printDirect"){const w=a(e);e=this.getIReportFormatId(w,e),await this._queryProxyOrigin();const y=await this._testConnection();if(!this._handleResultTest(y,u))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:p}),a=this._handleResult(r,u,g);if(!a)return!1;m&&["downloadPDF"].includes(f)&&await this._browserPrint(a,f),null==d||d(a)}catch(t){const e="printDirect"===f?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n){const a=await this._queryPrintForBase64(t,e,i,s);if(!a.success)return n({message:a.resultMsg});const{base64:o,formatId:l}=a.map;this.base64Fragment=o,this._successCallbackFn=r,this._errorCallbackFn=n,this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:l,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.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,"/")}const r=a(t.formatId);t.formatId=this.getIReportFormatId(r,t.formatId),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)),(t=>{console.log(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{P as Print};
@@ -1 +1 @@
1
- const e=[{label:"升温",value:!0,type:"rise"},{label:"药物降温",value:void 0,type:"drugReduce"},{label:"物理降温",value:void 0,type:"physicsReduce"},{label:"不升",value:!0,type:"noRise"}],i=[{label:"药物降痛",value:void 0,type:"drugReduce"},{label:"物理降痛",value:void 0,type:"physicsReduce"}],l=[{label:"修改",type:"change"},{label:"删除",type:"remove"}],r="#2563F4",a="#FF1818",s={yemai:{stroke:a,strokeX:r,strokeWidth:1,strokeWidthX:1,radius:6,angle:45},koumai:{stroke:a,strokeWidth:1,radius:6,radiusCircle:3,fillCircle:r},gangmai:{radius:6,radiusCircle:3,stroke:r,fillCircle:a},xinmai:{radius:6,radiusCircle:3,stroke:a,fillCircle:a},humai:{radius:6,fill:"green"},ermai:{stroke:a,strokeWidth:1,radius:6,radiusCircle:3,fillCircle:r}};var d=(e=>(e[e.SMALLCELLNUMBER=5]="SMALLCELLNUMBER",e[e.MAXLINENUMBER=13]="MAXLINENUMBER",e[e.DEFAULTMAINXCELLVALUE=.2]="DEFAULTMAINXCELLVALUE",e))(d||{});export{d as ECG,l as OTHER_MENU,s as OVERLAP,i as PAIN_MENU,e as TEMPERATURE_MENU};
1
+ const e=[{label:"升温",value:!0,type:"rise"},{label:"药物降温",value:void 0,type:"drugReduce"},{label:"物理降温",value:void 0,type:"physicsReduce"},{label:"不升",value:!0,type:"noRise"}],i=[{label:"药物降痛",value:void 0,type:"drugReduce"},{label:"物理降痛",value:void 0,type:"physicsReduce"}],l=[{label:"修改",type:"change"},{label:"删除",type:"remove"}],r="#2563F4",a="#FF1818",s={yemai:{stroke:a,strokeX:r,strokeWidth:1,strokeWidthX:1,radius:6,angle:45},koumai:{stroke:a,strokeWidth:1,radius:6,radiusCircle:3,fillCircle:r},gangmai:{radius:6,radiusCircle:3,stroke:r,fillCircle:a},xinmai:{radius:6,radiusCircle:3,stroke:a,fillCircle:a},humai:{radius:6,fill:r},ermai:{stroke:a,strokeWidth:1,radius:6,radiusCircle:3,fillCircle:r}};var d=(e=>(e[e.SMALLCELLNUMBER=5]="SMALLCELLNUMBER",e[e.MAXLINENUMBER=13]="MAXLINENUMBER",e[e.DEFAULTMAINXCELLVALUE=.2]="DEFAULTMAINXCELLVALUE",e))(d||{});export{d as ECG,l as OTHER_MENU,s as OVERLAP,i as PAIN_MENU,e as TEMPERATURE_MENU};
@@ -12,4 +12,5 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropIt
12
12
  updateData: (params: AnyObject, mode?: string) => void;
13
13
  redrawPoints: () => void;
14
14
  gridPoints: Set<IObject>;
15
+ fixedNoRisePoints: Set<IObject>;
15
16
  };
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{isOneLine as a,getType as c,isOverlapPoint as d,getFloorNumber as p,isValidValue as f,setOtherType as h,getTime as v,isEffectiveNode as g,getIndex as m,deleteProperty as y}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as E}from"@vueuse/shared";function Y(Y,$,O,T,C,P,A,I,R,V){r(Y,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(Y,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:B,originY:J,endY:K,itemList:N,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue);function ce(){[...ue].forEach((e=>{null==e||e.bringToFront()}))}function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&Y.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){E(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&Y.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}Y.value.add(...e)}ne.add(l),Y.value.add(l)}))}}function pe(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&d(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{Y.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}function fe(e,t,r){var u;const{type:c,riseStyle:d={},noRiseStyle:v={},verifiedStyle:g={},reduceStyle:m={},pacemaker:y={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},dataList:k=[],list:L=[]}=r,{type:S,textStyle:E,showConnectLine:$=!1}=j,P=[],I=[],V=[];let X=null;if(null==(u=e.list)||u.forEach(((u,j)=>{const D=a(c)?k.find((e=>e.key===u.key)):e,z=me(u,r),F=e.list[j+1],_=F?me(F,r):void 0,G=F?a(c)?k.find((e=>e.key===F.key)):e:{},{title:B=""}=D;if("脉搏"===B&&"脉搏"!==G.title||"脉搏"!==B&&"脉搏"===G.title||!z||!_||p(z[0],1)!==p(_[0],1))z&&X&&(z[0]=X),X=null;else{const e=z[0]-W/2;z[0]=e+W/4,_[0]=X=z[0]+W/2}const J={};J.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return V.push(s),{obj:s,top:-q}}(z,u,D),function(e,t,r,u){var a,p;if(!["temperature","pain"].includes(c))return;if(!(null==e?void 0:e.length)&&("pain"===c||"temperature"===c&&!ge(t.time)))return;const{lineAttr:h={}}=r,{value:y}=u,x=T(t.time);let b,j,w,k,S;if(t.noRise&&v.show){const i=M(v,t)?C(c,L,35):(null==e?void 0:e[1])||0;if(v.text)w=l([x,M(v,t)?i:i+5],{value:v.text.split("").join("\n"),originY:"top",...v.style}),t.value||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...v.style})}w&&V.push(w)}if((null==e?void 0:e[1])&&(t.rise&&d.show&&d.text&&(k=l([x,e[1]-(y?q:0)-5],{value:d.text.split("").join("\n"),originY:"bottom",...d.style}),V.push(k)),t.verified&&(S=l([x,e[1]-(y?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),V.push(S)),f(t.physicsReduce)||f(t.drugReduce))){const l=C(c,L,null!=(a=t.physicsReduce)?a:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...h,...m.line,...n}),j=o((null==(p=null==m?void 0:m.point)?void 0:p.type)||"circle",{left:s,top:l,...m.point,...n,originY:l===ie?"bottom":"center"}),b&&V.push(b),j&&V.push(j)}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:v.text?5:2*q,isFixed:M(v,t)},riseText:{obj:k,top:(y?-q:0)-5},verifiedText:{obj:S,top:(y?-q:0)-5},reducePoint:{obj:j,type:"reduce"}})}(z,u,D,J),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;const o=Math.max(...L),r=Math.min(...L);let u,a,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),V.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;a=l([e[0],t],i),V.push(a)}+t.value<r&&(a=l([e[0],e[1]-q],i),V.push(a))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}V.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:a,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(z,u,D,J),function(n,l,s,u,a,d){let p,f;const{pointAttr:v={},lineAttr:g={},title:m="",key:x,type:b="circle"}=a,j=e.list[u+1],w=he(c,e.list[u].value),k=l&&he(c,j.value);if(n&&l&&!s.breakpoint&&(!w&&!k||$)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});V.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const L=s.pacemakerShow&&"pulse"==c?y.value:w&&"number"===S?0:b,M=I[u-1],T={origin:{data:s,title:m,key:x||"",unit:r.unit,type:c,_type:h(m,c),dataIndex:t,index:u},leftLine:M,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==c?y.style:v,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===S?E:{}}:{}};n&&(M?T.leftLine.set("x2",n[0]):T.leftLine=null,p=o(L,{left:n[0],top:w?n[1]-5:n[1],...T}));I.push(f),p&&(x===oe[1]?se.add(p):re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{ve(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(Y.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&ve(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=A(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};Y.value.discardActiveObject(),O("change",n),xe(n,"change")}}))}(p),P.push(p),ue.add(p))}(z,_,u,j,D,J)})),"pulse"===c){const{key:t}=e;let i=null;le.set(t,P.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&p(e.left,1)===p(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const D=I.filter((e=>e));Y.value.add(...D,...P,...V)}function he(e,t){return"pain"===e&&0==t}function ve(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:A(o,e.top);if(f(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(f(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ge(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=v(e);return l>=n&&l<=o}function me(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ge(e.time))return;const n=T(e.time),o=C(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=v(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=v(`${P(e)}:00`);return ee&&l<v(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function xe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=a(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;be()}function be(){var e;ue.size&&(null==(e=Y.value)||e.remove(...function(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),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ue]))),le.clear(),ue.clear(),se.clear(),re.clear(),ae.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||fe(t,i,e)}))})),de(),ce(),pe()}return le.clear(),se.clear(),re.clear(),ae.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=C(e.type,e.list,e.positionLine.value),n=i([G,t,B,t],e.positionLine);Y.value.add(n)}(e),e.dataList.forEach(((t,i)=>{!t.show||a(e.type)&&!t.enable||fe(t,i,e)}))})),de(),ce(),pe(),Y.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=B&&t>=J&&t<=K){V.point={x:e,y:t},V.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(V.list=[...k]),"pain"===o&&(V.list=[...L]),V.target=i;else{V.target=null,V.list=["新增节点"],N.forEach((i=>{if(!X([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&V.list.push({renderItem:I?I(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:c(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==V.list.length||(V.show=!1,1===V.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=B&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),a(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),xe(r,"change")}else{const t={data:{time:P(e.pointer.x),value:A(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),xe(t)}},setPopup:ve,isAddPoint:ye,updateData:xe,redrawPoints:be,gridPoints:ue}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{Y as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,P,V,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:V=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?P(a,S,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=P(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||V)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],P={origin:{data:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?P.leftLine.set("x2",n[0]):P.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...P}));I.push(f),p&&(x===oe[1]?se.add(p):re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||V(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=P(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${V(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.size&&(null==(e=E.value)||e.remove(...function(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),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(o(r,{...i[e]||{},...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=P(e.type,e.list,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:V(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:V(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -1,4 +1,4 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../shared/utils/fabricjs';
3
- import { IPropItems } from '../../../../../components/fabric-chart/src/interface';
4
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, computedX: Function, computedY: Function): void;
3
+ import { IPropItems, IObject } from '../../../../../components/fabric-chart/src/interface';
4
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: Function, computedX: Function, computedY: Function, fixedNoRisePoints: Set<IObject>): void;
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t}from"../useDraw.js";import"date-fns";import{last as i}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function l(l,n,o,r,u){const{left:s,other:h,vitalSignsOriginY:a,xCellWidth:f,yCellHeight:c,endX:g}=n;let v=0;function p(i,n,r,u=!1){const s=[],a=u&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(a).split("").forEach(((l,n)=>{const o=new e.Text(l,{left:0,top:c*n,originX:"center",...t,objectCaching:!1,...i.style||{}});v=(c-(o.height||0))/2,s.push(o)}));const g=new e.Rect({left:0,top:0,width:f,height:c*s.length,fill:"transparent",originX:"center",...t}),{eventHighlight:p=!1}=h||{},d={originX:"center",left:n,top:r+v,baseTop:(i.baseTop||0)*c,trueLeft:n,trueHeight:s.length*c,objectCaching:!1,hoverCursor:"pointer",highlightObject:g,originData:i,selectable:!1,evented:p},m=new e.Group([g,...s],d);return function(e){const{highlightColor:t="#ffff00"}=h||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),l.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),l.value.requestRenderAll()})),e.on("mousedown",(function(){o("eventClick",e.originData)}))}(m),l.value.add(m),m}!function(){var e,t;if(!(null==h?void 0:h.list))return!1;const l=[],n=[];h.list.forEach(((e,t)=>{const i=0===t?"vertical":e.align||"vertical",l=r(e.time,!0);if(l>g)return;const o=n.find((e=>e.left==l));if(o)o[i].push(e);else{const t={left:l,vertical:[],horizontal:[]};t[i].push(e),n.push(t)}}));const o=null==(t=null==(e=s.yScaleValue)?void 0:e.find((e=>"temperature"===e.type)))?void 0:t.list,v=(null==o?void 0:o.length)?u("temperature",o,35):0,d=e=>e.fixed&&v&&String(e.value).length;n.forEach((e=>{let t=a.originY,n=e.left,o=0,r=v;e.vertical.forEach(((u,s)=>{var h,g,v,m,b;const j=(u.baseTop||0)*c,x=(null==(h=i(l))?void 0:h.left)||0;0===s&&e.left<=x&&(n=x+f);if(l.filter((e=>e.trueLeft===n)).length){const e=String(u.value).length;t+=o,t+e*c+j>a.endY&&(t=a.originY,n+=f)}t+=j,String(u.value).length&&(l.push(p(u,n,t)),o=null!=(v=null==(g=i(l))?void 0:g.trueHeight)?v:0),d(u)&&(l.push(p(u,n,r,!0)),r+=null!=(b=null==(m=i(l))?void 0:m.trueHeight)?b:0)})),e.horizontal.forEach(((t,o)=>{var u,s,h;const g=a.originY+(t.baseTop||0)*c,v=(null==(u=i(l))?void 0:u.left)||0;e.left<=v&&(n=v+f),String(t.value).length&&l.push(p(t,n,g)),d(t)&&(l.push(p(t,n,r,!0)),r+=null!=(h=null==(s=i(l))?void 0:s.trueHeight)?h:0)}))}))}()}export{l as useOther};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t}from"../useDraw.js";import"date-fns";import{cloneDeep as i,last as l}from"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function n(n,o,r,u,a,s){const{left:h,other:f,vitalSignsOriginY:c,xCellWidth:g,yCellHeight:v,endX:p}=o;let d=0;function m(i,l,o,u=!1){const a=[],s=u&&i.fixed&&i.fixedValue?i.fixedValue:i.value;String(s).split("").forEach(((l,n)=>{const o=new e.Text(l,{left:0,top:v*n,originX:"center",...t,objectCaching:!1,...i.style||{}});d=(v-(o.height||0))/2,a.push(o)}));const h=new e.Rect({left:0,top:0,width:g,height:v*a.length,fill:"transparent",originX:"center",...t}),{eventHighlight:c=!1}=f||{},p={originX:"center",left:l,top:o+d,baseTop:(i.baseTop||0)*v,trueLeft:l,trueHeight:a.length*v,objectCaching:!1,hoverCursor:"pointer",highlightObject:h,originData:i,selectable:!1,evented:c},m=new e.Group([h,...a],p);return function(e){const{highlightColor:t="#ffff00"}=f||{};e.on("mouseover",(()=>{e.highlightObject.set("fill",t),n.value.requestRenderAll()})),e.on("mouseout",(()=>{e.highlightObject.set("fill","transparent"),n.value.requestRenderAll()})),e.on("mousedown",(function(){r("eventClick",e.originData)}))}(m),n.value.add(m),m}!function(){var e,t;if(!(null==f?void 0:f.list))return!1;const n=[],o=[];i(f.list).forEach(((e,t)=>{e.value=e.value||"";const i=0===t?"vertical":e.align||"vertical",l=u(e.time,!0);if(l>p)return;const n=o.find((e=>e.left==l));if(n)n[i].push(e);else{const t={left:l,vertical:[],horizontal:[]};t[i].push(e),o.push(t)}}));const r=null==(t=null==(e=h.yScaleValue)?void 0:e.find((e=>"temperature"===e.type)))?void 0:t.list,d=(null==r?void 0:r.length)?a("temperature",r,35):0;o.forEach((e=>{let t=c.originY,i=e.left,o=0,r=d,u=i;function a(e,t){var o,a;if((e=>e.fixed&&d&&(e.fixedValue||e.value))(e)){const h=[...s].find((e=>Math.abs(e.left-i)<1));h&&(t||Math.abs(i-u)>1)&&(r=h.top+h.height),u=i,n.push(m(e,i,r,!0)),r+=null!=(a=null==(o=l(n))?void 0:o.trueHeight)?a:0}}e.vertical.forEach(((r,u)=>{var s,h,f;const p=(r.baseTop||0)*v,d=(null==(s=l(n))?void 0:s.left)||0;0===u&&e.left<=d&&(i=d+g);if(n.filter((e=>e.trueLeft===i)).length){const e=String(r.value).length;t+=o,t+e*v+p>c.endY&&(t=c.originY,i+=g)}t+=p,String(r.value).length&&(n.push(m(r,i,t)),o=null!=(f=null==(h=l(n))?void 0:h.trueHeight)?f:0),a(r,0===u)})),e.horizontal.forEach(((t,o)=>{var r,u;const s=c.originY+(t.baseTop||0)*v,h=(null==(r=l(n))?void 0:r.left)||0;e.left<=h&&(i=h+g),String(t.value).length&&n.push(m(t,i,s)),a(t,0===(null==(u=e.vertical)?void 0:u.length)&&0===o)}))}))}()}export{n as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,Y,b,w,C){const x=15,D=e(),j=e(),V=e(),H=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~_.value?e:[0,0]})),X=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===_.value?t[0]=t[0]+H.value[1]:_.value>0&&(t[2]=t[2]+H.value[0]),t})),L=a((()=>0===_.value?[H.value[0],X.value[1],X.value[2],X.value[3]]:_.value>0?[X.value[0],X.value[1],H.value[1],X.value[3]]:X.value)),I=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),M=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),P=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),N=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),W=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+X.value[1]+X.value[3]})),$=a((()=>{const{grid:e}=S.data,a=_.value>0?H.value[1]:H.value[0];return e.mainYCell*e.subYCell+X.value[0]+X.value[2]+a})),k=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),G=a((()=>k.value-X.value[1]*T.value)),R=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+B.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return I.value+t+l+M.value+P.value})),T=a((()=>(k.value-R.value)/W.value)),A=a((()=>(q.value-z.value)/$.value)),B=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=R.value-T.value;const r=t.date.startDate||s(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>ne("breathe"))),J=a((()=>ne("pulse"))),K=a((()=>ne("temperature"))),Q=a((()=>ne("pain"))),U=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a((()=>{const{left:e}=S.data;return v(e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),_=a((()=>{var e,a;const{left:t}=S.data,l=t.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(a=null==(e=t.yScaleValue[l].dataList)?void 0:e[0])?void 0:a.show)?l:-1})),ee=a((()=>{const{grid:e}=S.data;return-1===_.value?0:A.value*e.subYCell})),ae=a((()=>{const{left:e}=S.data,a={originY:z.value+H.value[0]*A.value,endY:q.value-H.value[1]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.endY=a.originY+ee.value:_.value===e.yScaleValue.length-1&&(a.originY=a.endY-ee.value),a})),te=a((()=>{const{left:e}=S.data,a={originY:z.value+X.value[0]*A.value,endY:q.value-X.value[2]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.originY=ae.value.endY+X.value[0]*A.value:_.value===e.yScaleValue.length-1&&(a.endY=ae.value.originY-X.value[2]*A.value),a})),le=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ue=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ie=t({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:I.value,hospitalDaysHeight:M.value,operationDaysHeight:P.value,xScalevalueHeight:N.value,topList:le.value,breathingHeight:O.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:_.value,painHeight:ee.value,painOriginY:ae.value,vitalSignsOriginY:te.value,gridXNumber:W.value,gridYNumber:$.value,iconsWidth:B.value,originX:R.value,originY:z.value,endX:k.value,endXLimit:G.value,endY:q.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,breatheYCell:F.value,pulseYCell:J.value,temperatureYCell:K.value,painYCell:Q.value,event:U.value,itemList:Z.value,getRightInfo:ue.value,config:S.data.config||{},surplusCell:X.value,painSurplusCell:H.value,mainSurplusCell:L.value});function ne(e){const{yScaleValue:a}=S.data.left,t=a.find((a=>a.type===e)),l=(null==t?void 0:t.list)||[];return l.length?A.value/((l[1]-l[0])/t.spaceGridNumber):0}const{computedX:re,computedY:oe,getXValue:ve,getYValue:se}=i(ie);return l((()=>y.value),(e=>{e&&function(){c(y,ie);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i}=g(y,ie,Y,re,oe,ve,se,S.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:r}=p(y,ie,Y,e,w,re,oe,ve,se,a,t,i);h(y,ie,r),m(y,ie),f(y,ie,Y,re,oe);const{select:o}=n(y,ie,Y);D.value=o}()}),{immediate:!0}),{propItems:ie,redrawPoints:j,select:D,clickMenu:V}}export{y as useTemperatureChart};
1
+ import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as r,getFloorNumber as o}from"../../utils/index.js";import{flatten as v}from"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,S,Y,b,w,C){const x=15,D=e(),j=e(),V=e(),H=a((()=>{const{painSurplusCell:e=[0,0]}=S.data.grid||{};return~_.value?e:[0,0]})),X=a((()=>{var e,a;const t=(null==(a=null==(e=S.data.grid)?void 0:e.surplusCell)?void 0:a.slice())||[0,0,0,0];return 0===_.value?t[0]=t[0]+H.value[1]:_.value>0&&(t[2]=t[2]+H.value[0]),t})),L=a((()=>0===_.value?[H.value[0],X.value[1],X.value[2],X.value[3]]:_.value>0?[X.value[0],X.value[1],H.value[1],X.value[3]]:X.value)),P=a((()=>{const{top:e}=S.data;return e.date.show&&(e.date.height||x)||0})),I=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.hospitalDays)?void 0:e.show)&&(a.hospitalDays.height||x)||0})),M=a((()=>{var e;const{top:a}=S.data;return(null==(e=a.operationDays)?void 0:e.show)&&(a.operationDays.height||x)||0})),N=a((()=>{var e,a,t;const{top:l}=S.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(a=l.xScalevalue)?void 0:a.show)&&null!=(t=l.dayHeight)?t:0)})),O=a((()=>{var e;const{bottom:a}=S.data;return(null==(e=null==a?void 0:a.breathing)?void 0:e.show)&&(a.breathing.height||30)||0})),R=a((()=>{const{grid:e}=S.data;return e.mainXCell*e.subXCell+X.value[1]+X.value[3]})),W=a((()=>{const{grid:e}=S.data,a=_.value>0?H.value[1]:H.value[0];return e.mainYCell*e.subYCell+X.value[0]+X.value[2]+a})),$=a((()=>{var e;const{width:a,right:t=null,top:l}=S.data;if(!t)return a;return a-(null!=(e=t.width)?e:0)})),k=a((()=>$.value-X.value[1]*T.value)),G=a((()=>{const{top:e,left:a}=S.data;return e.titleWidth+B.value})),q=a((()=>{const{bottom:e=null,height:a}=S.data;if(!e)return a;return a-(e.height||30)})),z=a((()=>{var e;const{top:a}=S.data,t=a.xScalevalue.show&&(null!=(e=a.dayHeight)?e:0)||0,l=a.xScalevalue.show&&(a.xScalevalue.height||x)||0;return P.value+t+l+I.value+M.value})),T=a((()=>($.value-G.value)/R.value)),A=a((()=>(q.value-z.value)/W.value)),B=a((()=>{var e,a;const{left:t}=S.data;return(null==(e=t.icons)?void 0:e.show)&&((null==(a=t.icons)?void 0:a.width)||100)||0})),E=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=(null==(a=null==(e=t.date.list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],i=t.xScalevalue.times;let n=G.value-T.value;const r=t.date.startDate||s(new Date,"yyyy-MM-dd"),o=u.reduce(((e,a,t)=>0===t?e.concat(r):e.concat(s(d(new Date(r.replace(/-/g,"/")),t),"yyyy-MM-dd"))),[]).map((e=>i.map((a=>{n+=T.value;const t=Date.parse(`${e} ${a.start}`),l=Date.parse(`${e} ${a.end}`);return{start:t,end:l,left:n,center:n+T.value/2,scaleCell:(l-t)/T.value}}))));return v(o)})),F=a((()=>ne("breathe"))),J=a((()=>ne("pulse"))),K=a((()=>ne("temperature"))),Q=a((()=>ne("pain"))),U=a((()=>{var e;return(null==(e=S.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a((()=>{const{left:e}=S.data;return v(e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((a,t)=>({...a,bigType:r(a.title,e.type),unit:e.unit,dataIndex:t}))))))})),_=a((()=>{var e,a;const{left:t}=S.data,l=t.yScaleValue.findIndex((e=>"pain"===e.type));return l>-1&&(null==(a=null==(e=t.yScaleValue[l].dataList)?void 0:e[0])?void 0:a.show)?l:-1})),ee=a((()=>{const{grid:e}=S.data;return-1===_.value?0:A.value*e.subYCell})),ae=a((()=>{const{left:e}=S.data,a={originY:z.value+H.value[0]*A.value,endY:q.value-H.value[1]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.endY=a.originY+ee.value:_.value===e.yScaleValue.length-1&&(a.originY=a.endY-ee.value),a})),te=a((()=>{const{left:e}=S.data,a={originY:z.value+X.value[0]*A.value,endY:q.value-X.value[2]*A.value};return 0===_.value&&e.yScaleValue.length>1?a.originY=ae.value.endY+X.value[0]*A.value:_.value===e.yScaleValue.length-1&&(a.endY=ae.value.originY-X.value[2]*A.value),a})),le=a((()=>{var e,a;const{top:t,grid:l}=S.data,u=[];for(const i in t)t[i].show&&u.push({...t[i],list:(null==(a=null==(e=t[i].list)?void 0:e.slice)?void 0:a.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,a)=>e.seq-a.seq))})),ue=a((()=>{var e;const{left:a,right:t}=S.data,l=a.yScaleValue.find((e=>"temperature"===e.type)),u=(null==t?void 0:t.yScaleValue)||{};if(null==(e=null==l?void 0:l.list)?void 0:e.length){const e=(null==u?void 0:u.showdetailedScale)?l.list.reduce((e=>{const a=e[e.length-1];return a?e.concat([a+1,a+2]):e.concat([92])}),[]):[],a=l.list.map((e=>o(1.8*e+32)));Object.assign(u,{list:a,detailedList:e,spaceGridNumber:l.spaceGridNumber})}return u})),ie=t({canvasWidth:S.data.width,canvasHeight:S.data.height,borderStyle:{...u,...S.data.borderStyle||{}},selectionStyle:S.data.selectionStyle||{},dateHeight:P.value,hospitalDaysHeight:I.value,operationDaysHeight:M.value,xScalevalueHeight:N.value,topList:le.value,breathingHeight:O.value,hospitalizationDate:S.data.hospitalizationDate,grid:S.data.grid,top:S.data.top,left:S.data.left,right:S.data.right,bottom:S.data.bottom,other:S.data.other,painIndex:_.value,painHeight:ee.value,painOriginY:ae.value,vitalSignsOriginY:te.value,gridXNumber:R.value,gridYNumber:W.value,iconsWidth:B.value,originX:G.value,originY:z.value,endX:$.value,endXLimit:k.value,endY:q.value,xCellWidth:T.value,yCellHeight:A.value,xScaleList:E.value,breatheYCell:F.value,pulseYCell:J.value,temperatureYCell:K.value,painYCell:Q.value,event:U.value,itemList:Z.value,getRightInfo:ue.value,config:S.data.config||{},surplusCell:X.value,painSurplusCell:H.value,mainSurplusCell:L.value});function ne(e){const{yScaleValue:a}=S.data.left,t=a.find((a=>a.type===e)),l=(null==t?void 0:t.list)||[];return l.length?A.value/((l[1]-l[0])/t.spaceGridNumber):0}const{computedX:re,computedY:oe,getXValue:ve,getYValue:se}=i(ie);return l((()=>y.value),(e=>{e&&function(){c(y,ie);const{setPopup:e,isAddPoint:a,updateData:t,redrawPoints:l,clickMenu:u,gridPoints:i,fixedNoRisePoints:r}=g(y,ie,Y,re,oe,ve,se,S.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:o}=p(y,ie,Y,e,w,re,oe,ve,se,a,t,i);h(y,ie,o),m(y,ie),f(y,ie,Y,re,oe,r);const{select:v}=n(y,ie,Y);D.value=v}()}),{immediate:!0}),{propItems:ie,redrawPoints:j,select:D,clickMenu:V}}export{y as useTemperatureChart};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},i={stroke:"#000",strokeWidth:1,strokeUniform:!0,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],strokeUniform:!0,...t},r={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,strokeUniform:!0,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,strokeUniform:!0,...t};function c(t,i){return new e.Line(t,{...n,...i})}function l([t,i],n){return new e.Text(String(n.value),{...o,left:t,top:i,...n})}function s([i,n,r],o,s="down"){const a=c([i,n,i,r],{strokeWidth:1,stroke:o.fill}),g=l([i+.5,"up"===s?r-3:r+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===s?180:0,objectCaching:!1,...o});return new e.Group([a,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function a(i,n,c,l=!1){const s=new e.Rect({...r,...i,...l?{}:{stroke:"transparent"}}),{value:a="标题",textAlign:g="center",verticalAlign:u="center"}=n,f=i.width/2,h=i.height/2,d=new e.Text(String(a),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-f:f}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function g(t){return new e.Circle({objectCaching:!1,strokeWidth:t.strokeWidth||1,stroke:t.stroke||"red",radius:t.radius||5,fill:"#fff"})}function u(t="circle",i){var n;const r={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,scale:1,...i},o=i.radius?(i.radius||5)+(i.strokeWidth||1):null!=(n=i.width)?n:0;switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,...r});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,...r});case"image":return new e.Image(i.element,r);case"yemai":{const t=()=>{const t=2*o,n={stroke:i.strokeX||"blue",strokeWidth:i.strokeWidthX||1,originX:"center",originY:"center"},r=new e.Line([0,o,t,o],n),c=new e.Line([o,0,o,t],n);return new e.Group([r,c])};return new e.Group([g(i),t()],r)}case"koumai":{const t=new e.Circle({objectCaching:!1,radius:i.radiusCircle||2,fill:i.fillCircle||"#000",originX:"center",originY:"center",left:o-.5,top:o-.5});return new e.Group([g(i),t],r)}case"circleAndText":{const t=new e.Text(String(i.text),{fontFamily:"微软雅黑",fontSize:12,originX:"center",originY:"center",fill:i.stroke,left:o-.5,top:o-1,objectCaching:!1});return new e.Group([g(i),t],r)}default:return i&&Reflect.deleteProperty(i,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...r})}}function f(i,n,r,o="horizontal"){const c=new e.Text(String(i),{...t,objectCaching:!1,...n.titleStyle||{},originX:"left",originY:"bottom",lineHeight:1,fontSize:12,...r.text}),{top:l,topY:s,left:a,leftX:g}=r.icon,f=null!=l?l:"horizontal"===o?s-(c.height||30)/2-1:s+c.height+3,h=null!=a?a:g+c.width+5;return{text:c,icon:u(n.type,{...n.pointAttr,originY:"center",originX:"left",originLeft:h,originTop:f,...r.icon,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,isMenu:!0,...r.icon.origin},left:h,top:f})}}export{i as defaultBorderStyle,n as defaultLineStyle,r as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,s as drawArrow,c as drawLine,u as drawPoint,l as drawText,f as drawTextAndIconGroup,a as drawTextGroup};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},i={stroke:"#000",strokeWidth:1,strokeUniform:!0,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],strokeUniform:!0,...t},r={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,strokeUniform:!0,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,strokeUniform:!0,...t};function c(t,i){return new e.Line(t,{...n,...i})}function l([t,i],n){return new e.Text(String(n.value),{...o,left:t,top:i,...n})}function s([i,n,r],o,s="down"){const a=c([i,n,i,r],{strokeWidth:1,stroke:o.fill}),g=l([i+.5,"up"===s?r-3:r+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===s?180:0,objectCaching:!1,...o});return new e.Group([a,g],{...t,originX:"center",originY:"top",objectCaching:!1})}function a(i,n,c,l=!1){const s=new e.Rect({...r,...i,...l?{}:{stroke:"transparent"}}),{value:a="标题",textAlign:g="center",verticalAlign:u="center"}=n,f=i.width/2,h=i.height/2,d=new e.Text(String(a),{...o,...n,..."left"==g||"right"==g?{originX:g,left:"left"==g?-f:f}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function g(t){return new e.Circle({objectCaching:!1,strokeWidth:t.strokeWidth||1,stroke:t.stroke||"red",radius:t.radius||5,fill:"#fff"})}function u(t="circle",i){var n;const r={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,scale:1,...i},o=i.radius?(i.radius||5)+(i.strokeWidth||1):null!=(n=i.width)?n:0;switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,...r});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,...r});case"image":return new e.Image(i.element,r);case"yemai":{const t=()=>{const t=2*o,n={stroke:i.strokeX||"blue",strokeWidth:i.strokeWidthX||1,originX:"center",originY:"center"},r=new e.Line([0,o,t,o],n),c=new e.Line([o,0,o,t],n);return new e.Group([r,c])};return new e.Group([g(i),t()],r)}case"koumai":{const t=new e.Circle({objectCaching:!1,radius:i.radiusCircle||2,fill:i.fillCircle||"#000",originX:"center",originY:"center",left:o-.5,top:o-.5});return new e.Group([g(i),t],r)}case"circleAndText":{const t=new e.Text(String(i.text),{fontFamily:"微软雅黑",fontSize:r.fontSize||12,originX:"center",originY:"center",fill:i.stroke,left:o-.5,top:o-1,fontWeight:i.fontWeight||500,objectCaching:!1});return new e.Group([g(i),t],r)}default:return i&&Reflect.deleteProperty(i,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...r})}}function f(i,n,r,o="horizontal"){const c=new e.Text(String(i),{...t,objectCaching:!1,...n.titleStyle||{},originX:"left",originY:"bottom",lineHeight:1,fontSize:12,...r.text}),{top:l,topY:s,left:a,leftX:g}=r.icon,f=null!=l?l:"horizontal"===o?s-(c.height||30)/2-1:s+c.height+3,h=null!=a?a:g+c.width+5;return{text:c,icon:u(n.type,{...n.pointAttr,originY:"center",originX:"left",originLeft:h,originTop:f,...r.icon,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,isMenu:!0,...r.icon.origin},left:h,top:f})}}export{i as defaultBorderStyle,n as defaultLineStyle,r as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,s as drawArrow,c as drawLine,u as drawPoint,l as drawText,f as drawTextAndIconGroup,a as drawTextGroup};
@@ -725,8 +725,8 @@ declare const _default: import("vue").DefineComponent<{
725
725
  showSeq: boolean;
726
726
  footerFlag: boolean;
727
727
  fieldDescribeMode: "column" | "tooltip";
728
- customColumns: FieldSetColumnItem[];
729
728
  showSearch: boolean;
729
+ customColumns: FieldSetColumnItem[];
730
730
  showSortPriority: boolean;
731
731
  showHeadFilter: boolean;
732
732
  }>;
@@ -1 +1 @@
1
- import{COMPONENT_NAMESPACE as e}from"../../shared/global/variable.js";import{safeComponentRegister as o}from"../../shared/utils/index.js";import s from"./src/FormRenderWrapper.vue.js";export{useAnchor}from"./src/hooks/useAnchor.js";export{BusinessCollector,useBusinessBinding}from"./src/hooks/useBusinessBinding.js";export{ContextCollector,useChangeContext}from"./src/hooks/useChangeContext.js";export{useCommonInjection,useSelectOptionProps}from"./src/hooks/useCommonInjection.js";export{useCommonLog}from"./src/hooks/useCommonLog.js";export{useComplexOptions,useComplexOptionsSpan}from"./src/hooks/useComplexOptions.js";export{useFieldListAdaptor}from"./src/hooks/useFieldListAdaptor.js";export{useFieldNormalize}from"./src/hooks/useFieldNormalize.js";export{useFieldVisitor}from"./src/hooks/useFieldVisitor.js";export{useFormContext}from"./src/hooks/useFormContext.js";export{useFormDomEvent,useFormExposeEvent}from"./src/hooks/useFormEvent.js";export{useFormField}from"./src/hooks/useFormField.js";export{useFormGraph}from"./src/hooks/useFormGraph.js";export{FormItemDepsCollector,useFormItemDeps}from"./src/hooks/useFormItemDeps.js";export{useFormRenderLifeCycle}from"./src/hooks/useFormRenderLifeCycle.js";export{useAutographOptions,useRecommendOptions,useUrlConfigOptions}from"./src/hooks/useFormRenderOptions.js";export{useFormValidator,validateMessageLocale}from"./src/hooks/useFormValidator.js";export{useLowCodeEvent}from"./src/hooks/useLowCodeEvent.js";export{useLowCodeReactions}from"./src/hooks/useLowCodeReactions.js";export{useNuiThemeOverrides}from"./src/hooks/useNuiThemeOverrides.js";export{useOperationalForm}from"./src/hooks/useOperationalForm.js";export{usePresetScope}from"./src/hooks/usePresetScope.js";export{useWordbookSetting,wordbookSettingHandler}from"./src/hooks/useWordbookSetting.js";export{useNewLowCodeReactions}from"./src/hooks/useNewLowCodeReactions.js";export{useSelectedSetting}from"./src/hooks/useSelectedSetting.js";export{FieldListFilter,combineExtendKey,createInputSlot,createSlot,editorUnescape,findItemByValCondition,formRenderLog,getAbsoluteKey,injectOrProvide,isNestedFieldType,isNestedType,mergeDeepProperties,parseEnhanceText,parseNumberFromMaybeString,renderDescOption,replace2Any,splitExtendKey,validateMessageParser}from"./src/utils/index.js";export{businessDateParser,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./src/utils/business.js";export{findNextWidget,queryDecoratorByAddress,queryDecoratorByFieldKey,queryInput}from"./src/utils/dom.js";export{assignClearBindVisited,assignUpdateValue,assignValueBindKey,createFieldAddressId,createLinebarId,createObjSchema,createVisitedSetter,dotEscape,fieldKeyEscape,getParentLinebar,traverseDependKey,traverseSchema}from"./src/utils/schema.js";const r=s;r.install=function(s){o(s,r,e+"FormRender")};export{r as default};
1
+ import{COMPONENT_NAMESPACE as e}from"../../shared/global/variable.js";import{safeComponentRegister as o}from"../../shared/utils/index.js";import s from"./src/FormRenderWrapper.vue.js";export{useAnchor}from"./src/hooks/useAnchor.js";export{BusinessCollector,useBusinessBinding}from"./src/hooks/useBusinessBinding.js";export{ContextCollector,useChangeContext}from"./src/hooks/useChangeContext.js";export{useCommonInjection,useSelectOptionProps}from"./src/hooks/useCommonInjection.js";export{useCommonLog}from"./src/hooks/useCommonLog.js";export{useComplexOptions,useComplexOptionsSpan}from"./src/hooks/useComplexOptions.js";export{useFieldListAdaptor}from"./src/hooks/useFieldListAdaptor.js";export{useFieldNormalize}from"./src/hooks/useFieldNormalize.js";export{useFieldVisitor}from"./src/hooks/useFieldVisitor.js";export{useFormContext}from"./src/hooks/useFormContext.js";export{useFormDomEvent,useFormExposeEvent}from"./src/hooks/useFormEvent.js";export{useFormField}from"./src/hooks/useFormField.js";export{useFormGraph}from"./src/hooks/useFormGraph.js";export{FormItemDepsCollector,useFormItemDeps}from"./src/hooks/useFormItemDeps.js";export{useFormRenderLifeCycle}from"./src/hooks/useFormRenderLifeCycle.js";export{useAutographOptions,useRecommendOptions,useUrlConfigOptions}from"./src/hooks/useFormRenderOptions.js";export{useFormValidator,validateMessageLocale}from"./src/hooks/useFormValidator.js";export{useLowCodeEvent}from"./src/hooks/useLowCodeEvent.js";export{useLowCodeReactions}from"./src/hooks/useLowCodeReactions.js";export{useNuiThemeOverrides}from"./src/hooks/useNuiThemeOverrides.js";export{useOperationalForm}from"./src/hooks/useOperationalForm.js";export{usePresetScope}from"./src/hooks/usePresetScope.js";export{useWordbookSetting,wordbookSettingHandler}from"./src/hooks/useWordbookSetting.js";export{useNewLowCodeReactions}from"./src/hooks/useNewLowCodeReactions.js";export{useSelectedSetting}from"./src/hooks/useSelectedSetting.js";export{FieldListFilter,combineExtendKey,createInputSlot,createSlot,editorUnescape,findItemByValCondition,formRenderLog,getAbsoluteKey,injectOrProvide,isEnter,isNestedFieldType,isNestedType,mergeDeepProperties,parseEnhanceText,parseNumberFromMaybeString,renderDescOption,replace2Any,splitExtendKey,validateMessageParser}from"./src/utils/index.js";export{businessDateParser,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./src/utils/business.js";export{findNextWidget,queryDecoratorByAddress,queryDecoratorByFieldKey,queryInput}from"./src/utils/dom.js";export{assignClearBindVisited,assignUpdateValue,assignValueBindKey,createFieldAddressId,createLinebarId,createObjSchema,createVisitedSetter,dotEscape,fieldKeyEscape,getParentLinebar,traverseDependKey,traverseSchema}from"./src/utils/schema.js";const r=s;r.install=function(s){o(s,r,e+"FormRender")};export{r as default};
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t,targetStringIncludes as r}from"../../../../shared/utils/index.js";import{isField as o}from"@formily/core";import{Path as n}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as a}from"@vueuse/shared";import{isFunction as s,isArray as d,isString as l}from"lodash-es";import{nextTick as u}from"vue";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as c}from"../constants/index.js";import{formValueFormatter as m}from"../utils/valueFormatter.js";import{queryDecoratorByAddress as f,queryInput as p,queryDecoratorByFieldKey as g,findNextWidget as v}from"../utils/dom.js";import{validateMessageParser as y,combineExtendKey as h,splitExtendKey as S}from"../utils/index.js";import{getParentLinebar as b}from"../utils/schema.js";import{useSelectedSetting as x}from"./useSelectedSetting.js";function F({formModel:t,formRenderRef:r,formUUID:a,getFieldList:c,formItemDepsCollector:v,businessCollector:F,wordbookSettingHandler:C,operationalFormHandler:E,changeContextCollector:D,emitFormChange:I}){const{applySelectedSetting:j}=x();return{validate(n,{force:u}={}){if(null==n&&(n="*"),s(n)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(n(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();n=e.length?`*(${e.join(",")})`:"*"}const c=[];u&&t.setFieldState(n,(e=>{"visible"===e.display&&"editable"!==e.pattern&&o(e)&&(c.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const m=t.validate(n).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(g,[]):e)));return u&&c.forEach((({pattern:e,state:t})=>t.pattern=e)),m;function g(t,r){if(!i(r))return t;let o=!1;return d(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(v)),o=!0)})),!o&&t.push(v(r)),t}function v(e){if(e.decoratorElement)return e;const o=t.query(e.path),n=o.get("title"),s=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return y(r&&l(r)?r:e,t.fieldItem)}(e,o.get("decoratorProps")))),d=f(e.address,r.value,a);return{...e,messages:s,title:n,decoratorElement:d,...p(d)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=h(c(),r)),r},async setFormValues(e,r){r=Object.assign({avoidDependKeyConnection:!0,needSplitExtendKey:!0,avoidWordbookSettingConnection:!0,avoidOperationalFormConnection:!0,dependKeyKeepValue:!1,avoidBusinessConnection:!1,avoidFormChangeEvent:!1,overwrite:!0},r),F.triggerDisabled=r.avoidBusinessConnection,v.triggerDisabled=r.avoidDependKeyConnection,v.keepValue=r.dependKeyKeepValue,C.triggerDisabled=r.avoidWordbookSettingConnection,E.triggerDisabled=r.avoidOperationalFormConnection,r.needSplitExtendKey&&(e=S(c(),e)),r.avoidFormChangeEvent&&(I.value=!1),t.setFieldState("*",(t=>{o(t)&&(r.overwrite||n.existIn(e,t.path))&&(t.value=n.getIn(e,t.path))})),await u(),I.value=!0,F.triggerDisabled=!1,v.triggerDisabled=!1,C.triggerDisabled=!1,E.triggerDisabled=!1,v.keepValue=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:e=>async function(e,t,o){if(!r.value)return d();const i=g(e,t,a);if(i)return d(i);const s=b(e,o);return s?(v.trigger(n.parse(s),!0),await u(),d(g(e,t,a))):d();function d(e){return{decoratorElement:e,...p(e)}}}(e,r.value,c()),applySelectedSetting(e){const r=t.getFormState().values;j(r,e,((e,r)=>{t.setFieldState(e,(e=>{o(e)&&e.setValue(r)}))}))},getTextFormValues:()=>m(t,D)}}function C({props:e,formRenderRef:o,formModel:n,formUUID:i}){return{onKeydown:async function d(l){var u;if(!l.isComposing)if("Enter"===l.code){if(e.enterToNextWidget&&l.target){if("TEXTAREA"===l.target.tagName&&!l.ctrlKey)return;l.preventDefault()}if(await a(0),Reflect.get(l,"stopCapture")||!e.enterToNextWidget||!o.value)return;const r=t(l.target,(e=>e.classList.contains("form-render__formItem")));if(!r)return;const i=`.form-render__formItem${c.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(o.value.querySelectorAll(i)),p=f.findIndex((e=>e.id===r.id));if(!~p)return;const{widget:g,field:y}=v(f,p,l.target);if(!g)return;if(s(e.enterToNextWidget)){const t=y&&n.query(y).take();!t||e.enterToNextWidget(null==(u=t.decoratorProps)?void 0:u.fieldItem)?m(g,e.autoExpand):d({target:g,code:"Enter"})}else m(g,e.autoExpand)}else if("Tab"===l.code){if(!e.autoExpand)return;await a(0);const t=document.querySelector(":focus");if(!t)return;m(t,!0)}async function m(e,o){if(await a(0),e.focus(),!o)return;if(!t(e,(e=>e.getAttribute("uuid")===i)))return;if(!r(["radio","checkbox"],e.className))if(e.click(),"INPUT"!==e.tagName){const t=e.querySelector("input");if(!t)return;t.focus(),n(t)}else n(e);function n(e){if("INPUT"!==e.tagName)return;const t=e.value;t&&t.match(/^\d{4}-\d{2}/)&&e.setSelectionRange(0,4)}}}}}export{C as useFormDomEvent,F as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t,targetStringIncludes as r}from"../../../../shared/utils/index.js";import{isField as o}from"@formily/core";import{Path as i}from"@formily/path";import{isObject as n}from"@vue/shared";import{promiseTimeout as a}from"@vueuse/shared";import{isFunction as s,isArray as l,castArray as d,isString as u}from"lodash-es";import{nextTick as c}from"vue";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as m}from"../constants/index.js";import{formValueFormatter as f}from"../utils/valueFormatter.js";import{queryDecoratorByAddress as p,queryInput as g,queryDecoratorByFieldKey as v,findNextWidget as y}from"../utils/dom.js";import{validateMessageParser as h,combineExtendKey as S,splitExtendKey as b,isEnter as x}from"../utils/index.js";import{getParentLinebar as F}from"../utils/schema.js";import{useSelectedSetting as C}from"./useSelectedSetting.js";function E({formModel:t,formRenderRef:r,formUUID:a,getFieldList:m,formItemDepsCollector:y,businessCollector:x,wordbookSettingHandler:E,operationalFormHandler:D,changeContextCollector:I,emitFormChange:j}){const{applySelectedSetting:w}=C();return{validate(i,{force:c}={}){if(null==i&&(i="*"),s(i)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(i(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();i=e.length?`*(${e.join(",")})`:"*"}const m=[];c&&t.setFieldState(i,(e=>{"visible"===e.display&&"editable"!==e.pattern&&o(e)&&(m.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const f=t.validate(i).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(v,[]):e)));return c&&m.forEach((({pattern:e,state:t})=>t.pattern=e)),f;function v(t,r){if(!n(r))return t;let o=!1;return l(r.messages)&&r.messages.forEach((r=>{n(r)&&(t.push(...e(r).map(y)),o=!0)})),!o&&t.push(y(r)),t}function y(e){if(e.decoratorElement)return e;const o=t.query(e.path),i=o.get("title"),s=d(e.messages).map((e=>function(e,t){if(!t||!n(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return h(r&&u(r)?r:e,t.fieldItem)}(e,o.get("decoratorProps")))),l=p(e.address,r.value,a);return{...e,messages:s,title:i,decoratorElement:l,...g(l)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=S(m(),r)),r},async setFormValues(e,r){r=Object.assign({avoidDependKeyConnection:!0,needSplitExtendKey:!0,avoidWordbookSettingConnection:!0,avoidOperationalFormConnection:!0,dependKeyKeepValue:!1,avoidBusinessConnection:!1,avoidFormChangeEvent:!1,overwrite:!0},r),x.triggerDisabled=r.avoidBusinessConnection,y.triggerDisabled=r.avoidDependKeyConnection,y.keepValue=r.dependKeyKeepValue,E.triggerDisabled=r.avoidWordbookSettingConnection,D.triggerDisabled=r.avoidOperationalFormConnection,r.needSplitExtendKey&&(e=b(m(),e)),r.avoidFormChangeEvent&&(j.value=!1),t.setFieldState("*",(t=>{o(t)&&(r.overwrite||i.existIn(e,t.path))&&(t.value=i.getIn(e,t.path))})),await c(),j.value=!0,x.triggerDisabled=!1,y.triggerDisabled=!1,E.triggerDisabled=!1,D.triggerDisabled=!1,y.keepValue=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:e=>async function(e,t,o){if(!r.value)return l();const n=v(e,t,a);if(n)return l(n);const s=F(e,o);return s?(y.trigger(i.parse(s),!0),await c(),l(v(e,t,a))):l();function l(e){return{decoratorElement:e,...g(e)}}}(e,r.value,m()),applySelectedSetting(e){const r=t.getFormState().values;w(r,e,((e,r)=>{t.setFieldState(e,(e=>{o(e)&&e.setValue(r)}))}))},getTextFormValues:()=>f(t,I)}}function D({props:e,formRenderRef:o,formModel:i,formUUID:n}){return{onKeydown:async function l(d){var u;if(!d.isComposing)if(x(d)){if(e.enterToNextWidget&&d.target){if("TEXTAREA"===d.target.tagName&&!d.ctrlKey)return;d.preventDefault()}if(await a(0),Reflect.get(d,"stopCapture")||!e.enterToNextWidget||!o.value)return;const r=t(d.target,(e=>e.classList.contains("form-render__formItem")));if(!r)return;const n=`.form-render__formItem${m.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(o.value.querySelectorAll(n)),p=f.findIndex((e=>e.id===r.id));if(!~p)return;const{widget:g,field:v}=y(f,p,d.target);if(!g)return;if(s(e.enterToNextWidget)){const t=v&&i.query(v).take();!t||e.enterToNextWidget(null==(u=t.decoratorProps)?void 0:u.fieldItem)?c(g,e.autoExpand):l({target:g,code:"Enter"})}else c(g,e.autoExpand)}else if("Tab"===d.code){if(!e.autoExpand)return;await a(0);const t=document.querySelector(":focus");if(!t)return;c(t,!0)}async function c(e,o){if(await a(0),e.focus(),!o)return;if(!t(e,(e=>e.getAttribute("uuid")===n)))return;if(!r(["radio","checkbox"],e.className))if(e.click(),"INPUT"!==e.tagName){const t=e.querySelector("input");if(!t)return;t.focus(),i(t)}else i(e);function i(e){if("INPUT"!==e.tagName)return;const t=e.value;t&&t.match(/^\d{4}-\d{2}/)&&e.setSelectionRange(0,4)}}}}}export{D as useFormDomEvent,E as useFormExposeEvent};
@@ -29,3 +29,4 @@ export declare function replace2Any(str: string, replacer: {
29
29
  from: string;
30
30
  to: any;
31
31
  }[]): any[];
32
+ export declare function isEnter(event: KeyboardEvent): boolean;
@@ -1 +1 @@
1
- import{inject as t,provide as n,computed as e,createVNode as r,Fragment as o}from"vue";import{traverse as i,arrayed as u}from"../../../../shared/utils/index.js";import{isGeneralField as c}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as s}from"@vicons/ionicons5";import{isObject as l}from"@vue/shared";import{useMemoize as p}from"@vueuse/core";import{isString as a,isFunction as d,omit as E,castArray as T,flattenDeep as h}from"lodash-es";import{NTooltip as m,NIcon as R}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as v}from"../constants/index.js";import"date-fns";function x(t){console.warn(`[FormRender]: ${t}`)}function y(t,n,e=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function t(n,r){r.forEach((r=>{l(r)&&(null!=c(r)&&null==n[i(r)]&&f.setIn(n,i(r),c(r)),e.forEach((e=>{r[e]&&(n[i(r)]||(n[i(r)]={}),t(n[i(r)],u(r[e])))})))}))}(t,n),t;function i(t){return t[r]}function c(t){return t[o]}}function g(e,r){let o=t(e,null);return o||(o=r(),n(e,o)),o}function I(t){return t&&a(t)?+t:t}function A(t,n,e){if(l(t)&&!d(t)){const e={};return Object.entries(t).forEach((([t,r])=>{d(r)&&(e[t]=()=>r(n))})),e}return{default:()=>d(t)?t(n):e?e(t):[t]}}function W(t,n){return e((()=>{const e={};return t.prefix&&(e.prefix=()=>r(o,null,[A(t.prefix,t,n).default()])),t.suffix&&(e.suffix=()=>r(o,null,[A(t.suffix,t,n).default()])),e}))}function _(t,n){return a(t)&&t?t.replace(/\$\{([^}]*)}/g,(function(t,e){const r=e.split("||");for(const t of r){const e=n[t.trim()];if(e)return e}return""})):""}function D(t){return t.reduce(((t,n)=>(a(n.extendKey)&&n.extendKey&&t.push(n),$(n)&&t.push(...D(n.children||[])),t)),[])}function G(t,n){const e=D(t);if(!e.length)return n;const r={},o=new Map;return Object.entries(n).forEach((([t,i])=>{const u=e.find((n=>n.val_key===t));if(!u)return r[t]=i;const{val_key:c,extendKey:f}=u,s=o.get(f)||{};o.set(f,s),s[c]=n[c]})),[...o.entries()].forEach((([t,n])=>{r[t]=JSON.stringify(n)})),r}function P(t,n){const e=D(t);if(!e.length)return n;const r=p((t=>{try{return l(n[t])?n[t]:JSON.parse(n[t])||{}}catch(t){return{}}})),o=E(n,e.map((t=>t.extendKey)));return e.forEach((({val_key:t,extendKey:n})=>{Reflect.has(o,t)||(o[t]=r(n)[t])})),o}function S(t){return t&&v.includes(t)}function $(t){return S(c(t)?t.componentType:t.html_type)}function w(t,n){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[t,n.desc?r(m,null,{trigger:()=>r(R,{component:s},null),default:()=>n.desc}):null])}function K(t,n){return f.parse(t.startsWith(".")?t:`.${t}`,n).toString()}function X(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function j(t,n){return t.reduce(((t,e)=>(n(e)||(t.push(e),e.properties&&(e.properties=j(e.properties,n)),e.children&&(e.children=j(e.children,n))),t)),[])}function k(t,n){let e=null;return i(t,((t,r)=>{n(t)&&(e=t,r())}),["children","properties"]),e}var O=function(t){return t[t.PREPARE=0]="PREPARE",t[t.TEXT=1]="TEXT",t[t.WIDGET_START=2]="WIDGET_START",t[t.WIDGET=3]="WIDGET",t}(O||{});function b(t){const n=[...t],e=[];let r=O.PREPARE,o="";function i(t){switch(r=t,r){case O.PREPARE:case O.WIDGET_START:case O.WIDGET:o=""}}function u(t="text",n=o){e.push({type:t,content:n})}function c(){const t=e.pop();t&&("text"===t.type?o=t.content:e.push(t))}return n.forEach(((t,e)=>{const f=e===n.length-1;switch(r){case O.PREPARE:return"#"===t?(i(O.WIDGET_START),void(f&&u())):(i(O.TEXT),o=t,void(f&&u()));case O.TEXT:return"#"===t?void(f?(o+=t,u()):(u(),i(O.WIDGET_START))):(o+=t,void(f&&u()));case O.WIDGET_START:return"{"!==t||f?(c(),i(O.TEXT),o+=`#${t}`,void(f&&u())):void i(O.WIDGET);case O.WIDGET:return"}"===t?(u("widget"),void i(O.PREPARE)):"#"===t?(c(),u(),i(O.WIDGET_START),o+=`#${t}`,void(f&&u())):(o+=t,void(f&&u("text",`#{${o}`)))}})),e}function J(t,n){let e=T(t);return n.forEach((({from:t,to:n})=>{e.forEach(((r,o)=>{a(r)&&(e[o]=r.split(t).map(((t,e,r)=>[t,e<r.length-1?n:null])))})),e=h(e)})),e}export{j as FieldListFilter,G as combineExtendKey,W as createInputSlot,A as createSlot,X as editorUnescape,k as findItemByValCondition,x as formRenderLog,K as getAbsoluteKey,g as injectOrProvide,$ as isNestedFieldType,S as isNestedType,y as mergeDeepProperties,b as parseEnhanceText,I as parseNumberFromMaybeString,w as renderDescOption,J as replace2Any,P as splitExtendKey,_ as validateMessageParser};
1
+ import{inject as t,provide as n,computed as e,createVNode as r,Fragment as o}from"vue";import{traverse as i,arrayed as u}from"../../../../shared/utils/index.js";import{isGeneralField as c}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as s}from"@vicons/ionicons5";import{isObject as l}from"@vue/shared";import{useMemoize as p}from"@vueuse/core";import{isString as a,isFunction as d,omit as E,castArray as T,flattenDeep as h}from"lodash-es";import{NTooltip as m,NIcon as R}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as v}from"../constants/index.js";import"date-fns";function x(t){console.warn(`[FormRender]: ${t}`)}function y(t,n,e=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function t(n,r){r.forEach((r=>{l(r)&&(null!=c(r)&&null==n[i(r)]&&f.setIn(n,i(r),c(r)),e.forEach((e=>{r[e]&&(n[i(r)]||(n[i(r)]={}),t(n[i(r)],u(r[e])))})))}))}(t,n),t;function i(t){return t[r]}function c(t){return t[o]}}function g(e,r){let o=t(e,null);return o||(o=r(),n(e,o)),o}function I(t){return t&&a(t)?+t:t}function A(t,n,e){if(l(t)&&!d(t)){const e={};return Object.entries(t).forEach((([t,r])=>{d(r)&&(e[t]=()=>r(n))})),e}return{default:()=>d(t)?t(n):e?e(t):[t]}}function W(t,n){return e((()=>{const e={};return t.prefix&&(e.prefix=()=>r(o,null,[A(t.prefix,t,n).default()])),t.suffix&&(e.suffix=()=>r(o,null,[A(t.suffix,t,n).default()])),e}))}function _(t,n){return a(t)&&t?t.replace(/\$\{([^}]*)}/g,(function(t,e){const r=e.split("||");for(const t of r){const e=n[t.trim()];if(e)return e}return""})):""}function D(t){return t.reduce(((t,n)=>(a(n.extendKey)&&n.extendKey&&t.push(n),$(n)&&t.push(...D(n.children||[])),t)),[])}function G(t,n){const e=D(t);if(!e.length)return n;const r={},o=new Map;return Object.entries(n).forEach((([t,i])=>{const u=e.find((n=>n.val_key===t));if(!u)return r[t]=i;const{val_key:c,extendKey:f}=u,s=o.get(f)||{};o.set(f,s),s[c]=n[c]})),[...o.entries()].forEach((([t,n])=>{r[t]=JSON.stringify(n)})),r}function P(t,n){const e=D(t);if(!e.length)return n;const r=p((t=>{try{return l(n[t])?n[t]:JSON.parse(n[t])||{}}catch(t){return{}}})),o=E(n,e.map((t=>t.extendKey)));return e.forEach((({val_key:t,extendKey:n})=>{Reflect.has(o,t)||(o[t]=r(n)[t])})),o}function S(t){return t&&v.includes(t)}function $(t){return S(c(t)?t.componentType:t.html_type)}function w(t,n){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[t,n.desc?r(m,null,{trigger:()=>r(R,{component:s},null),default:()=>n.desc}):null])}function K(t,n){return f.parse(t.startsWith(".")?t:`.${t}`,n).toString()}function X(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function j(t,n){return t.reduce(((t,e)=>(n(e)||(t.push(e),e.properties&&(e.properties=j(e.properties,n)),e.children&&(e.children=j(e.children,n))),t)),[])}function k(t,n){let e=null;return i(t,((t,r)=>{n(t)&&(e=t,r())}),["children","properties"]),e}var O=function(t){return t[t.PREPARE=0]="PREPARE",t[t.TEXT=1]="TEXT",t[t.WIDGET_START=2]="WIDGET_START",t[t.WIDGET=3]="WIDGET",t}(O||{});function N(t){const n=[...t],e=[];let r=O.PREPARE,o="";function i(t){switch(r=t,r){case O.PREPARE:case O.WIDGET_START:case O.WIDGET:o=""}}function u(t="text",n=o){e.push({type:t,content:n})}function c(){const t=e.pop();t&&("text"===t.type?o=t.content:e.push(t))}return n.forEach(((t,e)=>{const f=e===n.length-1;switch(r){case O.PREPARE:return"#"===t?(i(O.WIDGET_START),void(f&&u())):(i(O.TEXT),o=t,void(f&&u()));case O.TEXT:return"#"===t?void(f?(o+=t,u()):(u(),i(O.WIDGET_START))):(o+=t,void(f&&u()));case O.WIDGET_START:return"{"!==t||f?(c(),i(O.TEXT),o+=`#${t}`,void(f&&u())):void i(O.WIDGET);case O.WIDGET:return"}"===t?(u("widget"),void i(O.PREPARE)):"#"===t?(c(),u(),i(O.WIDGET_START),o+=`#${t}`,void(f&&u())):(o+=t,void(f&&u("text",`#{${o}`)))}})),e}function b(t,n){let e=T(t);return n.forEach((({from:t,to:n})=>{e.forEach(((r,o)=>{a(r)&&(e[o]=r.split(t).map(((t,e,r)=>[t,e<r.length-1?n:null])))})),e=h(e)})),e}function J(t){return"Enter"===t.code||"NumpadEnter"===t.code}export{j as FieldListFilter,G as combineExtendKey,W as createInputSlot,A as createSlot,X as editorUnescape,k as findItemByValCondition,x as formRenderLog,K as getAbsoluteKey,g as injectOrProvide,J as isEnter,$ as isNestedFieldType,S as isNestedType,y as mergeDeepProperties,N as parseEnhanceText,I as parseNumberFromMaybeString,w as renderDescOption,b as replace2Any,P as splitExtendKey,_ as validateMessageParser};