cnhis-design-vue 3.1.42-beta.2 → 3.1.42-beta.21

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 (155) hide show
  1. package/es/components/annotation-edit/src/AnnotationEdit.js +1 -1
  2. package/es/components/base-search/src/index.vue.js +1 -1
  3. package/es/components/base-search/style/index.css +1 -1
  4. package/es/components/big-table/index.d.ts +3 -4
  5. package/es/components/big-table/src/BigTable.vue.d.ts +3 -4
  6. package/es/components/big-table/src/BigTable.vue2.js +1 -1
  7. package/es/components/big-table/style/index.css +1 -1
  8. package/es/components/button-print/index.d.ts +4 -4
  9. package/es/components/button-print/src/ButtonPrint.vue.d.ts +4 -4
  10. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  11. package/es/components/button-print/src/components/EditFormat.vue.d.ts +4 -4
  12. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +4 -4
  13. package/es/components/button-print/src/utils/print.js +1 -1
  14. package/es/components/config-provider/src/ConfigProvider.js +1 -1
  15. package/es/components/config-provider/src/interface.d.ts +4 -4
  16. package/es/components/date-picker/index.d.ts +4 -0
  17. package/es/components/date-picker/src/DatePicker.vue.d.ts +4 -0
  18. package/es/components/date-picker/src/DatePicker.vue.js +1 -1
  19. package/es/components/fabric-chart/index.d.ts +2 -2
  20. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +2 -2
  21. package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +1 -0
  22. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
  24. package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
  25. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  26. package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +16 -0
  27. package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -0
  28. package/es/components/field-set/index.d.ts +84 -15
  29. package/es/components/field-set/src/FieldSet.vue.d.ts +80 -29
  30. package/es/components/field-set/src/types/index.d.ts +18 -0
  31. package/es/components/field-set/src/types/index.js +1 -0
  32. package/es/components/form-config/index.d.ts +28 -25
  33. package/es/components/form-config/src/FormConfig.vue.d.ts +28 -25
  34. package/es/components/form-config/src/FormConfig.vue.js +1 -1
  35. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +12 -12
  36. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +14 -13
  37. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  38. package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
  39. package/es/components/form-config/src/constants/index.d.ts +12 -1
  40. package/es/components/form-config/src/constants/index.js +1 -1
  41. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  42. package/es/components/form-config/src/types/index.d.ts +1 -0
  43. package/es/components/form-render/index.d.ts +12 -12
  44. package/es/components/form-render/index.js +1 -1
  45. package/es/components/form-render/src/FormRender.vue.d.ts +12 -12
  46. package/es/components/form-render/src/FormRender.vue.js +1 -1
  47. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +12 -12
  48. package/es/components/form-render/src/components/renderer/complex.d.ts +1 -1
  49. package/es/components/form-render/src/components/renderer/date.js +1 -1
  50. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -1
  51. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -1
  52. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +2 -2
  53. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  54. package/es/components/form-render/src/components/renderer/select.js +1 -1
  55. package/es/components/form-render/src/hooks/index.d.ts +1 -1
  56. package/es/components/form-render/src/hooks/index.js +1 -1
  57. package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +16 -0
  58. package/es/components/form-render/src/hooks/useFormAsyncQueue.js +1 -0
  59. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  60. package/es/components/form-render/src/types/index.d.ts +2 -1
  61. package/es/components/iho-table/index.d.ts +7 -2
  62. package/es/components/iho-table/src/IhoTable.vue.d.ts +7 -2
  63. package/es/components/iho-table/src/IhoTable.vue.js +1 -1
  64. package/es/components/iho-table/src/constants/index.d.ts +2 -1
  65. package/es/components/iho-table/src/constants/index.js +1 -1
  66. package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +5 -5
  67. package/es/components/iho-table/src/hooks/tapHooks/index.js +1 -1
  68. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +22 -21
  69. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.js +1 -1
  70. package/es/components/iho-table/src/hooks/tapHooks/useDataHooks.d.ts +3 -1
  71. package/es/components/iho-table/src/hooks/tapHooks/useDataHooks.js +1 -1
  72. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  73. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  74. package/es/components/iho-table/src/plugins/highLightSetPlugin.d.ts +1 -0
  75. package/es/components/iho-table/src/plugins/highLightSetPlugin.js +1 -0
  76. package/es/components/iho-table/src/plugins/index.js +1 -1
  77. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
  78. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  79. package/es/components/iho-table/src/plugins/maxCheckSizePlugin.d.ts +1 -0
  80. package/es/components/iho-table/src/plugins/maxCheckSizePlugin.js +1 -0
  81. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +4 -0
  82. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  83. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  84. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.d.ts +1 -1
  85. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
  86. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  87. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.d.ts +1 -0
  88. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -0
  89. package/es/components/iho-table/src/types/index.d.ts +3 -1
  90. package/es/components/iho-table/src/types/pluginType.d.ts +9 -4
  91. package/es/components/iho-table/src/utils/index.d.ts +3 -0
  92. package/es/components/iho-table/src/utils/index.js +1 -1
  93. package/es/components/iho-table/style/index.css +1 -1
  94. package/es/components/index.css +1 -1
  95. package/es/components/index.d.ts +1 -0
  96. package/es/components/index.js +1 -1
  97. package/es/components/info-header/index.d.ts +28 -28
  98. package/es/components/info-header/src/InfoHeader.vue.d.ts +28 -28
  99. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +3 -3
  100. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +3 -3
  101. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.d.ts +2 -2
  102. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -1
  103. package/es/components/info-header/src/components/infoDescription/InfoEllipsis.vue.d.ts +1 -1
  104. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +15 -15
  105. package/es/components/info-header/src/components/infoDescription/index.vue.js +1 -1
  106. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +12 -12
  107. package/es/components/info-header/style/index.css +1 -1
  108. package/es/components/keyboard/index.d.ts +1 -1
  109. package/es/components/keyboard/src/Keyboard.vue.d.ts +1 -1
  110. package/es/components/keyboard/src/Keyboard.vue.js +1 -1
  111. package/es/components/keyboard/src/constants/index.js +1 -1
  112. package/es/components/keyboard/style/index.css +1 -1
  113. package/es/components/scale-view/index.d.ts +25 -66
  114. package/es/components/scale-view/src/ScaleView.vue.d.ts +25 -66
  115. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  116. package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +1 -1
  117. package/es/components/scale-view/style/index.css +1 -1
  118. package/es/components/select-person/index.d.ts +1 -1
  119. package/es/components/select-person/src/SelectPerson.vue.d.ts +1 -1
  120. package/es/components/shortcut-setter/index.d.ts +12 -12
  121. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +12 -12
  122. package/es/components/steps-wheel/src/StepsWheel.vue.js +1 -1
  123. package/es/components/steps-wheel/src/constants/index.js +1 -1
  124. package/es/components/steps-wheel/style/index.css +1 -1
  125. package/es/components/table-filter/index.d.ts +0 -1
  126. package/es/components/table-filter/index.js +1 -1
  127. package/es/components/table-filter/src/components/render-widget/components/CheckboxGroup.vue.d.ts +1 -1
  128. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +1 -1
  129. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  130. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  131. package/es/components/table-filter/src/tool/baseOptions.d.ts +0 -10
  132. package/es/components/table-filter/src/tool/baseOptions.js +1 -1
  133. package/es/components/table-filter/src/tool/generateDefOptions.d.ts +0 -7
  134. package/es/components/table-filter/src/tool/generateDefOptions.js +1 -1
  135. package/es/components/table-filter/src/types/index.d.ts +0 -74
  136. package/es/components/time-picker/src/TimePicker.vue.js +1 -1
  137. package/es/shared/{mixins → hooks}/index.d.ts +1 -0
  138. package/es/shared/{mixins → hooks}/index.js +1 -1
  139. package/es/{components/form-render/src → shared}/hooks/useAsyncQueue.d.ts +0 -14
  140. package/es/shared/hooks/useAsyncQueue.js +1 -0
  141. package/es/shared/{mixins → hooks}/useDateTime.d.ts +2 -2
  142. package/es/shared/hooks/useDateTime.js +1 -0
  143. package/package.json +2 -2
  144. package/es/components/form-render/src/hooks/useAsyncQueue.js +0 -1
  145. package/es/components/scale-view/src/hooks/scaleview-props.d.ts +0 -115
  146. package/es/components/scale-view/src/hooks/scaleview-props.js +0 -1
  147. package/es/components/table-filter/src/hooks/export.d.ts +0 -1
  148. package/es/components/table-filter/src/hooks/export.js +0 -1
  149. package/es/components/table-filter/src/tool/getWidgetType.d.ts +0 -1
  150. package/es/components/table-filter/src/tool/getWidgetType.js +0 -1
  151. package/es/shared/mixins/useDateTime.js +0 -1
  152. package/es/shared/utils/colorLog.d.ts +0 -31
  153. package/es/shared/utils/colorLog.js +0 -1
  154. /package/es/shared/{mixins → hooks}/useTheme.d.ts +0 -0
  155. /package/es/shared/{mixins → hooks}/useTheme.js +0 -0
@@ -720,7 +720,7 @@ declare const _default: import("vue").DefineComponent<{
720
720
  NUpload: any;
721
721
  NUploadDragger: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
722
722
  NP: import("vue").DefineComponent<{
723
- depth: import("vue").PropType<2 | 1 | 3 | "1" | "2" | "3">;
723
+ depth: import("vue").PropType<2 | 1 | "1" | "2" | 3 | "3">;
724
724
  theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Typography", {
725
725
  aTextColor: string;
726
726
  blockquoteTextColor: string;
@@ -931,7 +931,7 @@ declare const _default: import("vue").DefineComponent<{
931
931
  themeClass: import("vue").Ref<string> | undefined;
932
932
  onRender: (() => void) | undefined;
933
933
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
934
- depth: import("vue").PropType<2 | 1 | 3 | "1" | "2" | "3">;
934
+ depth: import("vue").PropType<2 | 1 | "1" | "2" | 3 | "3">;
935
935
  theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Typography", {
936
936
  aTextColor: string;
937
937
  blockquoteTextColor: string;
@@ -1142,7 +1142,7 @@ declare const _default: import("vue").DefineComponent<{
1142
1142
  readonly strong: BooleanConstructor;
1143
1143
  readonly italic: BooleanConstructor;
1144
1144
  readonly underline: BooleanConstructor;
1145
- readonly depth: import("vue").PropType<2 | 1 | 3 | "1" | "2" | "3">;
1145
+ readonly depth: import("vue").PropType<2 | 1 | "1" | "2" | 3 | "3">;
1146
1146
  readonly tag: StringConstructor;
1147
1147
  readonly as: {
1148
1148
  readonly type: StringConstructor;
@@ -1372,7 +1372,7 @@ declare const _default: import("vue").DefineComponent<{
1372
1372
  readonly strong: BooleanConstructor;
1373
1373
  readonly italic: BooleanConstructor;
1374
1374
  readonly underline: BooleanConstructor;
1375
- readonly depth: import("vue").PropType<2 | 1 | 3 | "1" | "2" | "3">;
1375
+ readonly depth: import("vue").PropType<2 | 1 | "1" | "2" | 3 | "3">;
1376
1376
  readonly tag: StringConstructor;
1377
1377
  readonly as: {
1378
1378
  readonly type: StringConstructor;
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):d({url:this.printOrigin+"/services/print",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:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),null==d||d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,p=`${h}/bi-api/reprot/print/open/client/getRemote`,u=`${h}/printService/file`;let m=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.messageHandlerQueue=[],m)return m;m=this;const e=window;this.webview=null==(t=e.chrome)?void 0:t.webview,this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler),this.postMessage({exec:"config",data:""}))}messageHandler(t){var e;const i=this.messageHandlerQueue.shift();if(!i)return console.log("当前回执",t,"没有可用的handler");const{resolve:n,reject:s}=i;try{const{exec:i}=JSON.parse(t.data);"config"===i&&(this.downloadPath=(null==(e=JSON.parse(t.data).res)?void 0:e.downloadpath)||""),console.log(t),n(JSON.parse(t.data).res)}catch(t){s(t)}}async postMessage(t){return this.webview?new Promise(((e,i)=>{this.messageHandlerQueue.push({resolve:e,reject:i}),this.webview.postMessage(t)})):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleResult(t,e){if("success"!==t.result){const i={type:"printError",message:t.message||t.Message,result:t.result,errinfo:t.errinfo};return null==e||e(i),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,cmdid:n,print:s,printdlgshow:r="1",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:p})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${u}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;const h=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n});if(!h)return!1;const c=this._handleResult(h,l);if(!c)return!1;if(this.isRemote){const t=await this._browserPrint(c,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}s&&s(c)}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const p=await this._testConnection();if(!this._handleResultTest(p,h))return!1;const u=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o});if(!u)return!1;const m=this._handleResult(u,h);if(!m)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(m,c),null==d||d(m)}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){this.webview&&this.downloadPath&&(t.print.filename=this.downloadPath.replace(/\\/g,"/")),this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as r,provide as t,createVNode as o,resolveComponent as i,mergeProps as n,isVNode as s}from"vue";import{NConfigProvider as m}from"naive-ui";import{cloneDeep as d}from"lodash-es";import{addPrefix as p}from"./utils/index.js";var a=e({name:"ConfigProvider",inheritAttrs:!1,components:{NConfigProvider:m},props:{themeOverrides:{type:Object}},emits:[],setup(e,{attrs:m,slots:a,emit:f}){const v=r((()=>({...d(e.themeOverrides),...p(e.themeOverrides,["IhoTable","Keyboard","IhoTable","StepsWheel"])})));return t("themeOverridesInjectRef",v),{renderVN:()=>{return[o(i("n-config-provider"),n(m,e),(r=a,"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!s(r)?a:{default:()=>[a]}))];var r}}},render(){return this.renderVN()}});export{a as default};
1
+ import{defineComponent as e,computed as r,provide as t,createVNode as o,resolveComponent as i,mergeProps as n,isVNode as s}from"vue";import{NConfigProvider as m}from"naive-ui";import{cloneDeep as d}from"lodash-es";import{addPrefix as p}from"./utils/index.js";var a=e({name:"ConfigProvider",inheritAttrs:!1,components:{NConfigProvider:m},props:{themeOverrides:{type:Object}},emits:[],setup(e,{attrs:m,slots:a,emit:f}){const v=r((()=>({...d(e.themeOverrides),...p(e.themeOverrides,["IhoTable","Keyboard","StepsWheel"])})));return t("themeOverridesInjectRef",v),{renderVN:()=>{return[o(i("n-config-provider"),n(m,e),(r=a,"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!s(r)?a:{default:()=>[a]}))];var r}}},render(){return this.renderVN()}});export{a as default};
@@ -3,12 +3,12 @@ interface IhoTableStyle {
3
3
  borderColor: string;
4
4
  }
5
5
  interface KeyboardStyle {
6
- colorHover: string;
7
- colorPressed: string;
6
+ primaryColorHover: string;
7
+ primaryColorPressed: string;
8
8
  }
9
9
  interface StepsWheelStyle {
10
- colorPrimary: string;
11
- colorFinish: string;
10
+ primaryColor: string;
11
+ successColor: string;
12
12
  }
13
13
  export declare type CComponentThemeOverrides = Partial<{
14
14
  IhoTable: IhoTableStyle;
@@ -4,9 +4,13 @@ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{}, {
4
4
  [x: string]: unknown;
5
5
  };
6
6
  datePickerRef: import("vue").Ref<import("../../../es/shared/types").AnyObject | null>;
7
+ panelInstRef: import("vue").Ref<null>;
8
+ isDateTime: import("vue").ComputedRef<boolean>;
7
9
  formatRef: import("vue").ComputedRef<string>;
10
+ panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
8
11
  focus: () => any;
9
12
  blur: () => any;
13
+ onUpdateShow: (show: boolean) => void;
10
14
  NDatePicker: any;
11
15
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
12
16
  export default DatePicker;
@@ -4,9 +4,13 @@ declare const _default: import("vue").DefineComponent<{}, {
4
4
  [x: string]: unknown;
5
5
  };
6
6
  datePickerRef: import("vue").Ref<AnyObject | null>;
7
+ panelInstRef: import("vue").Ref<null>;
8
+ isDateTime: import("vue").ComputedRef<boolean>;
7
9
  formatRef: import("vue").ComputedRef<string>;
10
+ panelFormatRef: import("vue").ComputedRef<string | [string, string]>;
8
11
  focus: () => any;
9
12
  blur: () => any;
13
+ onUpdateShow: (show: boolean) => void;
10
14
  NDatePicker: any;
11
15
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
12
16
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as r,ref as t,computed as s,openBlock as i,createBlock as o,unref as a,mergeProps as m,createSlots as u,renderList as y,withCtx as n,renderSlot as f}from"vue";import{NDatePicker as d}from"naive-ui";import"../../../shared/utils/index.js";import"lodash-es";import{useDateTime as l}from"../../../shared/mixins/useDateTime.js";import p from"../../../_virtual/plugin-vue_export-helper.js";var c=p(e({__name:"DatePicker",setup(e,{expose:p}){const c=r(),_=t(null),v=s((()=>{if(c.format)return c.format;const e=c.type||"";return["datetime","datetimerange"].includes(e)?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),{focus:M,blur:h}=l(_,v);return p({$datePicker:_,focus:M,blur:h}),(e,r)=>(i(),o(a(d),m({ref_key:"datePickerRef",ref:_},e.$attrs),u({_:2},[y(e.$slots,((r,t)=>({name:t,fn:n((()=>[f(e.$slots,t)]))})))]),1040))}}),[["__file","DatePicker.vue"]]);export{c as default};
1
+ import{defineComponent as e,useAttrs as t,ref as r,computed as a,openBlock as o,createBlock as s,unref as u,mergeProps as l,createSlots as i,renderList as n,withCtx as m,renderSlot as y,nextTick as f}from"vue";import{NDatePicker as p}from"naive-ui";import"../../../shared/utils/index.js";import"lodash-es";import{useDateTime as d}from"../../../shared/hooks/useDateTime.js";import v from"../../../_virtual/plugin-vue_export-helper.js";var c=v(e({__name:"DatePicker",setup(e,{expose:v}){const c=t(),_=r(null),h=r(null),k=a((()=>{const e=c.type||"";return["datetime","datetimerange"].includes(e)})),M=a((()=>{if(c.format)return c.format;const e=c.type||"";return k.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),x=a((()=>k.value?M.value.split(" "):"")),{focus:P,blur:$}=d(_,M);function j(e){e&&k.value&&f((()=>{var e;h.value=null==(e=_.value)?void 0:e.panelInstRef,d(h,x)}))}return v({$datePicker:_,focus:P,blur:$}),(e,t)=>(o(),s(u(p),l({ref_key:"datePickerRef",ref:_},e.$attrs,{"onUpdate:show":j}),i({_:2},[n(e.$slots,((t,r)=>({name:r,fn:m((()=>[y(e.$slots,r)]))})))]),1040))}}),[["__file","DatePicker.vue"]]);export{c as default};
@@ -30,7 +30,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
30
30
  onAdd?: ((...args: any[]) => any) | undefined;
31
31
  onRemove?: ((...args: any[]) => any) | undefined;
32
32
  }>>;
33
- emits: (event: "add" | "change" | "remove" | "select", ...args: any[]) => void;
33
+ emits: (event: "change" | "add" | "remove" | "select", ...args: any[]) => void;
34
34
  isTemperature: import("vue").ComputedRef<boolean>;
35
35
  canvasRef: any;
36
36
  canvas: import("vue").Ref<any>;
@@ -182,7 +182,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
182
182
  show: boolean;
183
183
  list: unknown[];
184
184
  }>;
185
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("add" | "change" | "remove" | "select")[], "remove" | "add" | "change" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
185
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add" | "remove" | "select")[], "remove" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
186
186
  type: {
187
187
  type: import("vue").PropType<import("./src/interface").IType>;
188
188
  default: string;
@@ -32,7 +32,7 @@ declare const _default: import("vue").DefineComponent<{
32
32
  onAdd?: ((...args: any[]) => any) | undefined;
33
33
  onRemove?: ((...args: any[]) => any) | undefined;
34
34
  }>>;
35
- emits: (event: "add" | "change" | "remove" | "select", ...args: any[]) => void;
35
+ emits: (event: "change" | "add" | "remove" | "select", ...args: any[]) => void;
36
36
  isTemperature: import("vue").ComputedRef<boolean>;
37
37
  canvasRef: any;
38
38
  canvas: import("vue").Ref<any>;
@@ -184,7 +184,7 @@ declare const _default: import("vue").DefineComponent<{
184
184
  show: boolean;
185
185
  list: unknown[];
186
186
  }>;
187
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("add" | "change" | "remove" | "select")[], "remove" | "add" | "change" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
187
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add" | "remove" | "select")[], "remove" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
188
188
  type: {
189
189
  type: PropType<IType>;
190
190
  default: string;
@@ -6,4 +6,5 @@ export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: A
6
6
  item: any;
7
7
  target: any;
8
8
  }) => void;
9
+ redrawPoints: () => void;
9
10
  };
@@ -1 +1 @@
1
- import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{fabric as u}from"../utils/index.js";import{getIndex as c,isEffectiveNode as f}from"../utils/utils.js";import{cloneDeep as d}from"lodash-es";import{format as p}from"date-fns";function h(h,g,v,m,y,k){const{cumputedX:w,cumputedY:x,getXValue:b,getYValue:T}=t(g),{getEqualXTypes:S,repeatTip:j}=k,{xAxis:C,grid:E,originX:P,originY:Y,xCellWidth:G,endY:L,startTime:M,leftAddAreaWidth:A,leftScales:X,rightScales:H,yCellHeight:I,endX:D,scaleValues:O,canvasWidth:V,borderStyle:W,rightAddAreaWidth:R,event:$,originYCervix:B,other:F,canvasHeight:q}=g,z=d(O),N=new Set;function J(){z.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,d){let p,y;const{pointAttr:k={},lineAttr:w={},title:x="",key:S,type:j="circle",childbirthStyle:C={}}=t,E=t.data[d+1],P=Z(E,t);if(s&&P&&!f.breakpoint)y=n([...s,...P],{...w});else if(s&&!P&&!f.breakpoint){const e=Z(E,t);y=e?n([...s,...e],{...w}):null}let Y,L;if(f.childbirth){const t=s[1]+I;Y=o([s[0],s[1],t],C),c.push(Y),L=i([s[0]+G/2,t-I/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...C}),c.push(L)}const M=u[d-1],A={origin:{data:f,title:x,key:S||"",dataIndex:e,index:d},leftLine:M,rightLine:y,arrowGroup:Y,arrowGroupText:L,...k,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};M?p=l(j,{left:M.get("x2"),top:M.get("y2"),...A}):s&&(A.leftLine=null,p=l(j,{left:s[0],top:s[1],...A}));u.push(y),p&&(!function(t){$.hovered&&(t.on("mouseover",(()=>{U(t)})),t.on("mouseout",(()=>{m.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{Q(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+G/2,top:t.top+I/2})}(t),$.hovered&&U(t)})),t.on("mouseup",(e=>{if(m.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:b(t.left),value:T(e,t.top)}};h.value.discardActiveObject(),v("change",n),K(n,"change")}}))}(p),a.push(p),N.add(p))}(Z(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{h.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function K(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=z.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=c(o.time,l.data);l.data.splice(t,0,o);break}}var s;N.size&&(null==(s=h.value)||s.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...N]))),N.clear(),J()}function Q(t){const e=t.prevPoint?t.prevPoint.left:P,n=t.nextPoint?t.nextPoint.left:D;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<B&&t.set("top",B),t.top<Y&&t.set("top",Y),t.top>L&&t.set("top",L),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function U(t){const{title:e,key:n}=t.origin;m.point={x:t.left,y:t.top},m.list=[`${e} ${T(n,t.top)}`,`时间 ${b(t.left).slice(-5)}`],m.show=!0}function Z(t,e){if(f(t)&&function(t){const e=M+864e5,n=new Date(t).getTime();return n>=M&&n<=e}(t.time)){const n=w(t.time),o=x(e.key,e.range,t.value);return[n,o<Y?Y:o>L?L:o]}}function _(t,e){return t+1>e[1]?e[0]:t+1}return e(h,g,!0),function(){const t=new u.Rect({...W,width:V-A-R-1,height:L-1,left:A,top:0,fill:"transparent"});h.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?A:D;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:c,title:f,titleStyle:d,key:p,scaleNumberStyle:g={}}=t,v=[],m=n+c/2,y=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l);y.forEach(((t,e)=>{const n=0===e?L-8:e!==y.length-1||Y||B&&"FHR"!==p?L-e*I:Y+8;v.push(i([m,n],{value:String(t),...r,...g}))}));const k=new u.Rect({...a,width:c,height:L,left:m,top:L/2}),w=i([m,Y>0?Y-I/2:I/2],{value:String(f),...r,...d}),x=new u.Group([...v,k,...w?[w]:[]],{objectCaching:!1,...s});h.value.add(x),x.sendToBack(),n+=c}))}t(X),t(H,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=C.time,{show:a,range:c=[0,23],position:f,style:d}=C.processTime;if(t||a){const p=[],g=[],v=[],m=[],y=P+G/2,k=I/2;for(let s=0;s<E.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):_(p.at(-1),n);p.push(t);const a="top"===o?Y-k:L+k;v.push(i([y+s*G,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?c[0]:g.at(-1)+1;g.push(t);const e="top"===f?k:q-k;m.push(i([y+s*G,e],{value:String(t),...r,...d||{}}))}}const w=new u.Group([...v,...m],{objectCaching:!1,...s});h.value.add(w),h.value.sendToBack(w)}}(),function(){var t;const e=Object.values(F),o=[],i={},r=z.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=x(n,o,10),l=[0,e],s=[-e/t,0],a=[(L-i-e)/t,L-i],u=[D-P,t*(D-P)+e];let c=[],f=[];function d([n,o]){return Math.abs(o-t*n-e)<=1}function p([t,e]){const[n,o]=[...h([t,e])];return n>=P&&n<=D&&o>=i&&o<=L}function h([t,e]){return[P+t,L-e]}return d(l)&&p(l)&&(c=h(l)),d(s)&&p(s)&&(c=h(s)),d(a)&&p(a)&&(f=h(a)),d(u)&&p(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=z.find((t=>t.key===e));if(r){const r=x(e,i,0);o.push(n([P,r,D,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:p(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,d]=[w(l.time)-P,L-x(e,a,l.value)],[h,g]=[w(c.time)-P,L-x(e,a,c.value)],v=(g-d)/(h-f),m=d-f*v,y=s(v,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:v,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(w(p(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-w(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),h.value.add(...o)}(),J(),function(){function t(t,e){const n=z.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}g.event.evented&&h.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=P&&n<=D&&o>=Y&&o<=L&&(y.point={x:n,y:o},y.show=!0,e.target?(y.target=e.target,y.list=["删除节点"],h.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&y.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(y.target=null,y.list=["新增节点"],z.filter((t=>t.show)).forEach((i=>{if(!S(n,"key",G).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<B)return;y.list.push(t(i,e.pointer))}})),1===y.list.length&&(y.show=!1,j(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=V-R/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=O.findIndex((e=>e.key===t.key)),a=new u.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),c=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...g.event});o+=a.height+c.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=P&&e<=D&&n>=Y&&n<=L}t.on("moving",(()=>{t.set("originY","center"),e(t)?(Q(t),U(t)):m.show=!1})),t.on("mouseup:before",(n=>{if(m.show=!1,0===n.e.button&&e(t))if(S(t.left,"key",G).includes(t.origin.key))j();else{const e={data:{time:b(t.left),value:T(t.origin.key,t.top)},...t.origin};v("add",e),K(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(c),i.push(a,c)})),n(i),h.value.add(...i)}function n(t){const e=t.at(-1),n=(L-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(X,A/2),e(H,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(v("remove",n),K(n,"remove")):(Object.assign(n,{data:{time:b(t.pointer.x),value:T(t.origin.key,t.pointer.y)}}),v("add",n),K(n))}}}export{h as useBirthProcess};
1
+ import{useBirthProcessCumputedPoint as t}from"./useCumputedPoint.js";import e from"./useGrid.js";import{drawLine as n,drawArrow as o,drawText as i,defaultTextStyle as r,drawPoint as l,defaultStyle as s,defaultRectStyle as a}from"./useDraw.js";import{getScaleInfo as u,drawScaleNumber as c,drawScaleLine as f}from"./useScaleColumn.js";import{fabric as p}from"../utils/index.js";import{getIndex as d,isEffectiveNode as h}from"../utils/utils.js";import{cloneDeep as g}from"lodash-es";import{format as v}from"date-fns";function m(m,y,k,w,x,b){const{cumputedX:T,cumputedY:S,getXValue:j,getYValue:C}=t(y),{getEqualXTypes:M,repeatTip:P}=b,{xAxis:E,grid:G,originX:L,originY:Y,xCellWidth:X,endY:A,startTime:H,leftAddAreaWidth:I,leftScales:D,rightScales:O,yCellHeight:V,endX:W,scaleValues:N,canvasWidth:R,borderStyle:$,rightAddAreaWidth:B,event:F,originYCervix:q,other:z,canvasHeight:J}=y,K=g(N),Q=new Set;function U(){K.filter((t=>t.show)).forEach(((t,e)=>{var s;const a=[],u=[],c=[];null==(s=t.data)||s.forEach(((s,f)=>{!function(s,f,p){let d,h;const{pointAttr:g={},lineAttr:v={},title:x="",key:b,type:T="circle",childbirthStyle:S={}}=t,M=t.data[p+1],P=nt(M,t);if(s&&P&&!f.breakpoint)h=n([...s,...P],{...v});else if(s&&!P&&!f.breakpoint){const e=nt(M,t);h=e?n([...s,...e],{...v}):null}let E,G;if(f.childbirth){const t=s[1]+V;E=o([s[0],s[1],t],S),c.push(E),G=i([s[0]+X/2,t-V/2],{value:String(f.childbirth),...r,originX:"left",originY:"center",...S}),c.push(G)}const L=u[p-1],Y={origin:{data:f,title:x,key:b||"",dataIndex:e,index:p},leftLine:L,rightLine:h,arrowGroup:E,arrowGroupText:G,...g,...y.event.hovered?y.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:y.event};L?d=l(T,{left:L.get("x2"),top:L.get("y2"),...Y}):s&&(Y.leftLine=null,d=l(T,{left:s[0],top:s[1],...Y}));u.push(h),d&&(!function(t){F.hovered&&(t.on("mouseover",(()=>{et(t)})),t.on("mouseout",(()=>{w.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{tt(t),function(t){var e,n,o,i;null==(e=t.leftLine)||e.setCoords().set({x2:t.left,y2:t.top}),null==(n=t.rightLine)||n.setCoords().set({x1:t.left,y1:t.top}),null==(o=t.arrowGroup)||o.setCoords().set({left:t.left,top:t.top}),null==(i=t.arrowGroupText)||i.setCoords().set({left:t.left+X/2,top:t.top+V/2})}(t),F.hovered&&et(t)})),t.on("mouseup",(e=>{if(w.show=!1,1===e.button){const{key:e}=t.origin,n={...t.origin,data:{...t.origin.data,time:j(t.left),value:C(e,t.top)}};m.value.discardActiveObject(),k("change",n),Z(n,"change")}}))}(d),a.push(d),Q.add(d))}(nt(s,t),s,f)})),Promise.all(a).then((t=>{const e=u.filter((t=>t));let n=null;t=t.filter((t=>(t&&n&&(n.nextPoint=t,t.prevPoint=n),n=t||n,t))),Promise.all(c).then((n=>{m.value.add(...e,...t,...n),t.forEach((t=>{null==t||t.bringToFront()}))}))}))}))}function Z(t,e="add"){const{dataIndex:n,data:o,index:i,key:r}=t,l=K.find((t=>t.key===r));switch(e){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const t=d(o.time,l.data);l.data.splice(t,0,o);break}}_()}function _(){var t;Q.size&&(null==(t=m.value)||t.remove(...function(t){const e=[];return t.forEach((t=>{t&&e.push(t),(null==t?void 0:t.leftLine)&&e.push(null==t?void 0:t.leftLine),(null==t?void 0:t.rightLine)&&e.push(null==t?void 0:t.rightLine),(null==t?void 0:t.arrowGroup)&&e.push(null==t?void 0:t.arrowGroup),(null==t?void 0:t.arrowGroupText)&&e.push(null==t?void 0:t.arrowGroupText)})),e}([...Q]))),Q.clear(),U()}function tt(t){const e=t.prevPoint?t.prevPoint.left:L,n=t.nextPoint?t.nextPoint.left:W;t.setCoords(),["cervix","fetalPresentation"].includes(t.origin.key)&&t.top<q&&t.set("top",q),t.top<Y&&t.set("top",Y),t.top>A&&t.set("top",A),t.left<e&&t.set("left",e),t.left>n&&t.set("left",n)}function et(t){const{title:e,key:n}=t.origin;w.point={x:t.left,y:t.top},w.list=[`${e} ${C(n,t.top)}`,`时间 ${j(t.left).slice(-5)}`],w.show=!0}function nt(t,e){if(h(t)&&function(t){const e=H+864e5,n=new Date(t).getTime();return n>=H&&n<=e}(t.time)){const n=T(t.time),o=S(e.key,e.range,t.value);return[n,o<Y?Y:o>A?A:o]}}function ot(t,e){return t+1>e[1]?e[0]:t+1}return e(m,y,!0),function(){const t=new p.Rect({...$,width:R-I-B-1,height:A-1,left:I,top:0,fill:"transparent"});m.value.add(t)}(),function(){function t(t,e="left"){let n="left"===e?I:W;t.forEach(((t,e)=>{const{range:o,spaceValue:l,width:d,title:h,titleStyle:g,key:v,position:y="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:x}=t,b=[],T=[],S=n+d/2,j=function(t,e){const n=[],[o,i]=t;for(let t=o;e>0?t<=i:t>=i;t+=e)n.push(t);return n}(o,l),C=j.length;j.forEach(((e,o)=>{const{lineXMain:i,lineXSub:r,textLeft:l}=u(y,n,d),s=A-o*V*k,a=0===o?A-8:o!==j.length-1||Y||q&&"FHR"!==v?s:Y+8;!w||(0===o||o===C-1)&&!x||b.push(c(String(e),t,l,a)),T.push(...f(t,o,i,r,s,V,Y,C))}));const M=new p.Rect({...a,width:d,height:A,left:S,top:A/2}),P=i([S,Y>0?Y-V/2:V/2],{value:String(h),...r,...g}),E=new p.Group([...T,...b,M,...P?[P]:[]],{objectCaching:!1,...s});m.value.add(E),E.sendToBack(),n+=d}))}t(D),t(O,"right")}(),function(){const{show:t,startTime:e,range:n=[0,23],position:o="top",style:l}=E.time,{show:a,range:u=[0,23],position:c,style:f}=E.processTime;if(t||a){const d=[],h=[],g=[],v=[],y=L+X/2,k=V/2;for(let s=0;s<G.mainXCell;s++){if(t){const t=0===s?+e.slice(11,13):ot(d.at(-1),n);d.push(t);const a="top"===o?Y-k:A+k;g.push(i([y+s*X,a],{value:String(t),...r,...l||{}}))}if(a){const t=0===s?u[0]:h.at(-1)+1;h.push(t);const e="top"===c?k:J-k;v.push(i([y+s*X,e],{value:String(t),...r,...f||{}}))}}const w=new p.Group([...g,...v],{objectCaching:!1,...s});m.value.add(w),m.value.sendToBack(w)}}(),function(){var t;const e=Object.values(z),o=[],i={},r=K.find((t=>"cervix"===t.key&&t.show)),l=null==(t=null==r?void 0:r.data)?void 0:t.find((t=>3==+t.value));function s(t,e){const{key:n,range:o}=r||{},i=S(n,o,10),l=[0,e],s=[-e/t,0],a=[(A-i-e)/t,A-i],u=[W-L,t*(W-L)+e];let c=[],f=[];function p([n,o]){return Math.abs(o-t*n-e)<=1}function d([t,e]){const[n,o]=[...h([t,e])];return n>=L&&n<=W&&o>=i&&o<=A}function h([t,e]){return[L+t,A-e]}return p(l)&&d(l)&&(c=h(l)),p(s)&&d(s)&&(c=h(s)),p(a)&&d(a)&&(f=h(a)),p(u)&&d(u)&&(f=h(u)),[...c,...f]}e.forEach((t=>{if(!t.show)return;const{key:e}=t;switch(e){case"fetalPresentation":{const{range:i,show:r}=K.find((t=>t.key===e));if(r){const r=S(e,i,0);o.push(n([L,r,W,r],{...t}))}break}case"alert":if(l){const{key:e,range:a}=r||{},u=216e5,c={time:v(new Date(new Date(l.time).getTime()+u),"yyyy-MM-dd HH:mm"),value:10},[f,p]=[T(l.time)-L,A-S(e,a,l.value)],[d,h]=[T(c.time)-L,A-S(e,a,c.value)],g=(h-p)/(d-f),m=p-f*g,y=s(g,m);y.length>0&&(o.push(n(y,{...t})),Object.assign(i,{k:g,b:m}))}break;case"handling":if(l){const{k:e,b:r}=i,a=144e5,u=s(e,r-(T(v(new Date(new Date(l.time).getTime()+a),"yyyy-MM-dd HH:mm"))-T(l.time))*e);u.length>0&&o.push(n(u,{...t}))}}})),m.value.add(...o)}(),U(),function(){function t(t,e){const n=K.findIndex((e=>e.key===t.key));return{renderItem:()=>t.title,origin:{title:t.title,unit:t.unit,dataIndex:n,key:t.key},pointer:e}}y.event.evented&&m.value.on("mouse:up",(e=>{if(3===e.button){const{x:n=0,y:o=0}=e.pointer||{};n>=L&&n<=W&&o>=Y&&o<=A&&(x.point={x:n,y:o},x.show=!0,e.target?(x.target=e.target,x.list=["删除节点"],m.value.forEachObject((t=>{t.origin&&t.left===e.target.left&&t.top===e.target.top&&x.list.push({renderItem:()=>t.origin.title,origin:{...t.origin},mode:"remove",pointer:e.pointer})}))):(x.target=null,x.list=["新增节点"],K.filter((t=>t.show)).forEach((i=>{if(!M(n,"key",X).includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<q)return;x.list.push(t(i,e.pointer))}})),1===x.list.length&&(x.show=!1,P(),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const t=R-B/2;function e(t,e){if(!t.length)return;let o=Y;const i=[];t.forEach((t=>{const n=t.title.split("").join("\n"),s=N.findIndex((e=>e.key===t.key)),a=new p.Text(String(n),{...r,...t.titleStyle||{},originY:"top",left:e,top:o,lineHeight:1}),u=l(t.type,{left:e,top:o+a.height+3,...t.pointAttr,originY:"top",origin:{title:t.title,unit:t.unit,type:t.type,dataIndex:s,key:t.key,isMenu:!0},originLeft:e,originTop:o+a.height+3,...y.event});o+=a.height+u.height+15,function(t){function e(t){const{left:e,top:n}=t;return e>=L&&e<=W&&n>=Y&&n<=A}t.on("moving",(()=>{t.set("originY","center"),e(t)?(tt(t),et(t)):w.show=!1})),t.on("mouseup:before",(n=>{if(w.show=!1,0===n.e.button&&e(t))if(M(t.left,"key",X).includes(t.origin.key))P();else{const e={data:{time:j(t.left),value:C(t.origin.key,t.top)},...t.origin};k("add",e),Z(e)}!function(t){t.setCoords().set({originY:"top",left:t.originLeft,top:t.originTop})}(t)}))}(u),i.push(a,u)})),n(i),m.value.add(...i)}function n(t){const e=t.at(-1),n=(A-Y)/2,o=(e.height+e.top-Y)/2;t.forEach((t=>{const e=t.top+n-o;t.set({top:e,originTop:e})}))}e(D,I/2),e(O,t)}(),{clickMenu:function({item:t,target:e}){const n={...t.origin};"remove"===t.mode?(k("remove",n),Z(n,"remove")):(Object.assign(n,{data:{time:j(t.pointer.x),value:C(t.origin.key,t.pointer.y)}}),k("add",n),Z(n))},redrawPoints:_}}export{m as useBirthProcess};
@@ -1 +1 @@
1
- import{ref as e,reactive as a,computed as t,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"../utils/index.js";import"lodash-es";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as o}from"./useBirthProcess.js";import{useCommon as n}from"./useCommon.js";function d(d,v,c,h){const m=e(),p=e(),f=e(),g=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=t((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=t((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=t((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),A=t((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),C=t((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),b=t((()=>v.data.grid.mainXCell)),j=t((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=t((()=>(C.value-A.value)/b.value)),Y=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+t)})),S=t((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),H=t((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!S.value)return S.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return P.value-l*u*Y.value})),P=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=t((()=>new Date(v.data.xAxis.time.startTime).getTime())),F=t((()=>36e5/k.value)),R=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),T=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/Y.value})),W=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),M=t((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),O=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...r,...v.data.borderStyle},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:A.value,endX:C.value,originY:S.value,endY:P.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:b.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:T.value,fetalPresentationYCell:W.value,scaleValues:v.data.scaleValues,event:M.value,originYCervix:H.value}),D=n(d);return l((()=>{u((()=>{const{clickMenu:e}=o(d,O,c,g,x,D);f.value=e,i(h.value);const{select:a}=s(d,O,c);m.value=a}))})),{propItems:O,redrawPoints:p,select:m,pointTipProps:g,pointMenuProps:x,clickMenu:f}}export{d as default};
1
+ import{ref as e,reactive as a,computed as t,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as r}from"./useDraw.js";import"date-fns";import"../utils/index.js";import"lodash-es";import"./useShadow.js";import{useEvent as i,useCanvasEvent as s}from"./useEvent.js";import{useBirthProcess as o}from"./useBirthProcess.js";import{useCommon as n}from"./useCommon.js";function d(d,v,c,h){const m=e(),p=e(),f=e(),g=a({show:!1,point:{x:0,y:0},list:[]}),x=a({show:!1,point:{x:0,y:0},list:[],target:null}),w=t((()=>v.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),y=t((()=>v.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),V=t((()=>{var e;return(null==(e=y.value)?void 0:e.length)?30:0})),A=t((()=>{var e;return 30+(null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),C=t((()=>{var e;const{width:a}=v.data,t=null==(e=y.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-V.value-t})),b=t((()=>v.data.grid.mainXCell)),j=t((()=>{const e=v.data.grid.mainYCell||14;return v.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),k=t((()=>(C.value-A.value)/b.value)),Y=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+t)})),P=t((()=>{const{xAxis:e}=v.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return Y.value*a})),S=t((()=>{var e;const{scaleValues:a}=v.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!P.value)return P.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return H.value-l*u*Y.value})),H=t((()=>{const{xAxis:e,height:a}=v.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-Y.value*t})),X=t((()=>new Date(v.data.xAxis.time.startTime).getTime())),F=t((()=>36e5/k.value)),R=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"cervix"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),T=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"FHR"===e.key));return((null==a?void 0:a.spaceValue)||10)/Y.value})),W=t((()=>{const{scaleValues:e}=v.data,a=e.find((e=>"fetalPresentation"===e.key));return((null==a?void 0:a.spaceValue)||1)/Y.value})),M=t((()=>{var e;return(null==(e=v.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),O=a({canvasWidth:v.data.width,canvasHeight:v.data.height,borderStyle:{...r,...v.data.borderStyle},selectionStyle:v.data.selectionStyle||{},grid:v.data.grid,other:v.data.other,originX:A.value,endX:C.value,originY:P.value,endY:H.value,xCellWidth:k.value,yCellHeight:Y.value,gridXNumber:b.value,gridYNumber:j.value,xAxis:v.data.xAxis,leftScales:w.value,rightScales:y.value,leftAddAreaWidth:30,rightAddAreaWidth:V.value,startTime:X.value,timeXCell:F.value,cervixYCell:R.value,FHRYCell:T.value,fetalPresentationYCell:W.value,scaleValues:v.data.scaleValues,event:M.value,originYCervix:S.value}),D=n(d);return l((()=>{u((()=>{const{clickMenu:e,redrawPoints:a}=o(d,O,c,g,x,D);p.value=a,f.value=e,i(h.value);const{select:t}=s(d,O,c);m.value=t}))})),{propItems:O,redrawPoints:p,select:m,pointTipProps:g,pointMenuProps:x,clickMenu:f}}export{d as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as g,isEffectiveNode as v,getIndex as y,deleteProperty as m}from"../utils/utils.js";function x(x,b,w,L,j,k,Y,S,E,$,T){s(x,b);const{getEqualXTypes:P,repeatTip:O,maxLimitTip:M,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=b,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&x.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[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)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),v()}}else c?(l.push(c),v()):f?(s.push(f),v()):v()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),x.value.add(...e)}N.add(c),x.value.add(c)}))}}function oe(){var e;const t=ie.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 o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{x.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],P=[];null==(a=e.list)||a.forEach(((a,O)=>{const M=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-X}}(I,a,M),function(e,s,a,d){var g,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:x}=d;let b,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),P.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),P.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(x?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),P.push(Y));s.verified&&(S=o([e[0],e[1]-(x?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),P.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(g=s.physicsReduce)?g:s.drugReduce);b=t([...e,e[0],o],{...m,...v.line,...i}),w=n((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:o,...v.point,...i,originY:o===K?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(d,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(x?-X:0)-5},verifiedText:{obj:S,top:(x?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,M,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),P.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),P.push(a)}t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),P.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,M,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:v="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),P=se(u,e.list[l].value),O=S&&se(u,j.value);!i||!S||o.breakpoint||P||O||i[0]===S[0]||(d=t([...i,...S],{...h}));const M=o.pacemakerShow&&"pulse"==u?y.value:P?0:L,I=T[l-1],A={origin:{data:o,title:v,key:m||"",unit:r.unit,type:u,_type:g(v,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...b.event,...P?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(M,{left:I.get("x2"),top:P?e-5:e,...A})}else i&&(A.leftLine=null,c=n(M,{left:i[0],top:P?i[1]-5:i[1],...A}));T.push(d),c&&(v.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};x.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,O,M,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{x.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&x.value.remove(e.leftLine),e.rightLine&&x.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{value:l=Y(n,e.top),drugReduce:s,physicsReduce:r}=o||{};if(h(s))return`药物降${"pain"==n?"痛":"温"} ${l}—>${s}${i||""}`;if(h(r))return`物理降${"pain"==n?"痛":"温"} ${l}—>${r}${i||""}`;return`${t} ${l}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(v(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(M(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=x.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}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);x.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),b.event.evented&&x.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!P(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&O())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{x as useCenter};
1
+ import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as g,isEffectiveNode as v,getIndex as y,deleteProperty as m}from"../utils/utils.js";function x(x,b,w,L,j,k,Y,S,E,$,T){s(x,b);const{getEqualXTypes:P,repeatTip:O,maxLimitTip:M,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=b,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&x.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[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)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),v()}}else c?(l.push(c),v()):f?(s.push(f),v()):v()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),x.value.add(...e)}N.add(c),x.value.add(c)}))}}function oe(){var e;const t=ie.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 o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{x.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],P=[];null==(a=e.list)||a.forEach(((a,O)=>{const M=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-X}}(I,a,M),function(e,s,a,d){var g,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:x}=d;let b,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),P.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),P.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(x?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),P.push(Y));s.verified&&(S=o([e[0],e[1]-(x?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),P.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(g=s.physicsReduce)?g:s.drugReduce);b=t([...e,e[0],o],{...m,...v.line,...i}),w=n((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:o,...v.point,...i,originY:o===K?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(d,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(x?-X:0)-5},verifiedText:{obj:S,top:(x?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,M,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),P.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),P.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),P.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,M,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:v="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),P=se(u,e.list[l].value),O=S&&se(u,j.value);!i||!S||o.breakpoint||P||O||i[0]===S[0]||(d=t([...i,...S],{...h}));const M=o.pacemakerShow&&"pulse"==u?y.value:P?0:L,I=T[l-1],A={origin:{data:o,title:v,key:m||"",unit:r.unit,type:u,_type:g(v,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...b.event,...P?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(M,{left:I.get("x2"),top:P?e-5:e,...A})}else i&&(A.leftLine=null,c=n(M,{left:i[0],top:P?i[1]-5:i[1],...A}));T.push(d),c&&(v.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;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}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};x.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,O,M,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{x.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&x.value.remove(e.leftLine),e.rightLine&&x.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(v(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(M(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=x.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}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);x.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),b.event.evented&&x.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!P(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&O())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{x as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o,drawTextGroup as l,defaultRectStyle as r}from"./useDraw.js";import{getType as s,isOneLine as u}from"../utils/utils.js";function h(h,a,c,g,p,f,d,y,w,v,S,b){var m,Y;const{getEqualXTypes:x,repeatTip:X}=b,{originY:T,endY:N,originX:L,endX:M,xCellWidth:V,yCellHeight:C,left:j,vitalSignsOriginY:k,painOriginY:E,painHeight:I,iconsWidth:G,itemList:H,painIndex:O,right:W,canvasWidth:A,canvasHeight:R,getRightInfo:_}=a;function B(e,n,o,l){const{position:r}=n;return new t.Text(String(e),{...i,originX:"left"==r?"right":"right"==r?"left":"center",left:o,top:l,...n.style})}function J(t="center",e,i){let n=e+i/2,o=[n-4.5,n+4.5],l=[n-2.5,n+2.5],r=n;return"right"===t&&(n=e,o=[n,n+9],l=[n,n+5],r=o[1]),"left"===t&&(n=e+i,o=[n-9,n],l=[n-5,n],r=o[0]),{lineXMain:o,lineXSub:l,textLeft:r}}function $(o){var s;if(!(null==o?void 0:o.length))return;const{layout:u}=o[0];let a=G,c=L;"right"===u&&(a=M,c=M+(null!=(s=null==W?void 0:W.width)?s:0));const g=[],p=I&&"right"!==u?o.length-1:o.length,f=(c-a)/p,d=f+(c-a)%p;o.forEach(((o,s)=>{var c,p;if("pain"===o.type)return void function(n){const o=l({width:L-G,height:I,...r},{value:`${n.title}`,...i,...n.style||{}},{left:G,top:E.originY}),s=[];if(n.showScale||n.showNumber){const{lineXMain:i,textLeft:o}=J(n.position,G,L-G),l=n.list.length;n.list.forEach(((r,u)=>{let h=E.endY-u*C*n.spaceGridNumber;0===u&&(h=N-5);const a=0===u||u===l-1;if(!n.showNumber||a&&!n.showMaxMinNumber||s.push(B(r,n,o,h)),n.showScale&&0!==u){const[o,l]=i,r=new t.Line([o,h,l,h],{...e,...n.style});s.push(r)}}))}h.value.add(o,...s),o.sendToBack()}(o);const y=[];function w(i){const n=new t.Line(i,{...e,...o.style});y.push(n)}const v=0===s?d:f,S=0===s?a:d+a+(s-1)*f,b="right"===u?0:k.originY,m="right"===u?R:k.endY,Y=s>0?new t.Line([S,b,S,m],{...e}):null;Y&&y.push(Y);const x=S+v/2,X=o.spaceGridNumber||5;if(o.showScale||o.showNumber){const t=X*C/5,e=o.position||"center",{lineXMain:i,lineXSub:n,textLeft:l}=J(o.position,S,v),r=null==(c=o.list)?void 0:c.length;null==(p=null==o?void 0:o.list)||p.forEach(((s,u)=>{const h=k.endY-u*C*X,a=0===u||u===r-1;if(o.showNumber&&(!a||o.showMaxMinNumber)){const t=0==u?h-5:h,e=B(s,o,l,t),i=k.originY+e.height/2;t<i&&e.set({top:i}),y.push(e)}if(o.showScale&&u!==r-1)for(let l=0;l<5;l++)if(l>0||!o.showNumber||"center"!==e){const e=0==l?i[0]:n[0],o=0==l?i[1]:n[1],s=h-l*t;s>k.originY&&(w([e,s,o,s]),u==r-2&&4==l&&w([i[0],s-t,i[1],s-t]))}}))}let T=o.title||"";o.unit&&(T+="\n"+o.unit),T&&y.push(new t.Text(String(T),{...i,left:x,top:k.originY+C*X/2,textAlign:"center",...o.style}));const M=new t.Group(y,{...n,objectCaching:!1});g.push(M)}));const y=g.length>0?new t.Group([...g],{...n,objectCaching:!1}):null;y&&h.value.add(y),y&&y.sendToBack()}function q(t){return t.left>=L&&t.left<M&&t.top>=T&&t.top<=N}G&&function(){const e=JSON.parse(JSON.stringify(H));let i=N;const l=G-j.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const f=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),d=o(e.type,{left:l,top:i-(f.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:s(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:i-(f.height||30)/2-1,...a.event});var b;i-=f.height||30,(b=d).on("moving",(()=>{b.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?E:k;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(b),q(b)?g(b):p.show=!1})),b.on("mouseup:before",(t=>{if(p.show=!1,0===t.e.button&&q(b)){const t=x(b.left,"_type",V).includes(b.origin._type),e=v(b.left);if(!e||t)t&&e&&X();else{const t={data:{time:y(b.left),value:w(b.origin.type,b.top),...u(b.origin.type)?{key:b.origin.key}:{}},...b.origin};c("add",t),S(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(b)})),h.value.add(f,d)}))}();const z=j.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==W?void 0:W.width)&&"left"===(null==(m=null==W?void 0:W.yScaleValue)?void 0:m.layout)&&(null==(Y=null==W?void 0:W.yScaleValue)?void 0:Y.show)&&z.push(_),O>0&&j.yScaleValue[O].show){const t=j.yScaleValue[O];0===O&&j.yScaleValue.length>1&&z.unshift(t),O==j.yScaleValue.length-1&&z.push(t)}const D=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),F=z[D];return D>-1&&z.splice(D,0,{...F,title:(null==F?void 0:F.doubleTitle)||(null==F?void 0:F.title)}),$(z),h.value.add(new t.Rect({left:G,top:0,width:A-G-1,height:R-1,fill:"transparent",...e})),{drawScaleValue:$}}export{h as useLeft};
1
+ import{fabric as t}from"../utils/index.js";import{defaultBorderStyle as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o,drawTextGroup as l,defaultRectStyle as r}from"./useDraw.js";import{getScaleInfo as s,drawScaleNumber as u,drawScaleLine as a}from"./useScaleColumn.js";import{getType as h,isOneLine as g}from"../utils/utils.js";function c(c,p,d,f,y,w,v,m,S,Y,b,x){var T,X;const{getEqualXTypes:C,repeatTip:N}=x,{originY:V,endY:j,originX:L,endX:M,xCellWidth:k,yCellHeight:E,left:I,vitalSignsOriginY:G,painOriginY:H,painHeight:O,iconsWidth:W,itemList:A,painIndex:R,right:_,canvasWidth:B,canvasHeight:J,getRightInfo:$}=p;function q(o){var h;if(!(null==o?void 0:o.length))return;const{layout:g}=o[0];let p=W,d=L;"right"===g&&(p=M,d=M+(null!=(h=null==_?void 0:_.width)?h:0));const f=[],y=O&&"right"!==g?o.length-1:o.length,w=(d-p)/y,v=w+(d-p)%y;o.forEach(((o,h)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:a=5,showScale:h,showNumber:g,position:p,showMaxMinNumber:d,style:f,title:y}=n,w=l({width:L-W,height:O,...r},{value:`${y}`,...i,...f||{}},{left:W,top:H.originY}),v=[];if(h||g){const{lineXMain:i,textLeft:l}=s(p,W,L-W),r=o.length;o.forEach(((o,s)=>{let c=H.endY-s*E*a;if(0===s&&(c=j-5),!g||(0===s||s===r-1)&&!d||v.push(u(o,n,l,c)),h&&0!==s){const[n,o]=i,l=new t.Line([n,c,o,c],{...e,...f});v.push(l)}}))}c.value.add(w,...v),w.sendToBack()}(o);const d=[],y=0===h?v:w,m=0===h?p:v+p+(h-1)*w,S="right"===g?0:G.originY,Y="right"===g?J:G.endY,b=h>0?new t.Line([m,S,m,Y],{...e}):null;b&&d.push(b);const x=m+y/2,{list:T=[],spaceGridNumber:X=5,showScale:C,showNumber:N,position:V,showMaxMinNumber:M}=o;if(C||N){const{lineXMain:t,lineXSub:e,textLeft:i}=s(V,m,y),n=T.length;T.forEach(((l,r)=>{const s=G.endY-r*E*X;if(N&&(!(0===r||r===n-1)||M)){const t=0==r?s-5:s,e=u(l,o,i,t),n=G.originY+e.height/2;t<n&&e.set({top:n}),d.push(e)}d.push(...a(o,r,t,e,s,E,G.originY))}))}let k=o.title||"";o.unit&&(k+="\n"+o.unit),k&&d.push(new t.Text(String(k),{...i,left:x,top:G.originY+E*X/2,textAlign:"center",...o.style}));const I=new t.Group(d,{...n,objectCaching:!1});f.push(I)}));const m=f.length>0?new t.Group([...f],{...n,objectCaching:!1}):null;m&&c.value.add(m),m&&m.sendToBack()}function z(t){return t.left>=L&&t.left<M&&t.top>=V&&t.top<=j}W&&function(){const e=JSON.parse(JSON.stringify(A));let i=j;const l=W-I.icons.marginRight;e.reverse().forEach((e=>{i-=10;let r=e.title.replace(/(.{2})/g,"$1\n");r.endsWith("\n")&&(r=r.slice(0,r.length-1));const s=new t.Text(String(r),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),u=o(e.type,{left:l,top:i-(s.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:h(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:i-(s.height||30)/2-1,...p.event});var a;i-=s.height||30,(a=u).on("moving",(()=>{a.set("originX","center"),function(t){if(t.left>=L&&t.left<=M){t.setCoords();const e="pain"===t.origin.type?H:G;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(a),z(a)?f(a):y.show=!1})),a.on("mouseup:before",(t=>{if(y.show=!1,0===t.e.button&&z(a)){const t=C(a.left,"_type",k).includes(a.origin._type),e=Y(a.left);if(!e||t)t&&e&&N();else{const t={data:{time:m(a.left),value:S(a.origin.type,a.top),...g(a.origin.type)?{key:a.origin.key}:{}},...a.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(a)})),c.value.add(s,u)}))}();const D=I.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==_?void 0:_.width)&&"left"===(null==(T=null==_?void 0:_.yScaleValue)?void 0:T.layout)&&(null==(X=null==_?void 0:_.yScaleValue)?void 0:X.show)&&D.push($),R>0&&I.yScaleValue[R].show){const t=I.yScaleValue[R];0===R&&I.yScaleValue.length>1&&D.unshift(t),R==I.yScaleValue.length-1&&D.push(t)}const F=D.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=D[F];return F>-1&&D.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),q(D),c.value.add(new t.Rect({left:W,top:0,width:B-W-1,height:J-1,fill:"transparent",...e})),{drawScaleValue:q}}export{c as useLeft};
@@ -0,0 +1,16 @@
1
+ import { fabric } from '../utils';
2
+ import { AnyObject } from '../../../../../es/shared/types';
3
+ /**
4
+ * @description 获取一些刻度坐标信息
5
+ * @param position {'left'|'center'|'right'} 刻度位置
6
+ * @param x {number} 绘制刻度空间矩形的left坐标值
7
+ * @param width {number} 会子刻度空间矩形的宽度值
8
+ * @return { lineXMain, lineXSub, textLeft } {主刻度线的x1、x2坐标值, 副刻度线的x1、x2坐标值, 刻度数值的left坐标值}
9
+ */
10
+ export declare function getScaleInfo(position: string | undefined, x: number, width: number): {
11
+ lineXMain: number[];
12
+ lineXSub: number[];
13
+ textLeft: number;
14
+ };
15
+ export declare function drawScaleNumber(text: string | number, item: AnyObject, left: number, top: number): fabric.Text;
16
+ export declare function drawScaleLine(item: AnyObject, i: number, lineXMain: number[], lineXSub: number[], baseTop: number, yCellHeight: number, originY: number, _listLen?: number): Array<fabric.Object | fabric.Line>;
@@ -0,0 +1 @@
1
+ import{fabric as t}from"../utils/index.js";import{defaultTextStyle as e,defaultBorderStyle as n}from"./useDraw.js";function i(t="center",e,n){let i=e+n/2,r=[i-4.5,i+4.5],o=[i-2.5,i+2.5],l=i;return"right"===t&&(i=e,r=[i,i+9],o=[i,i+5],l=r[1]),"left"===t&&(i=e+n,r=[i-9,i],o=[i-5,i],l=r[0]),{lineXMain:r,lineXSub:o,textLeft:l}}function r(n,i,r,o){const{position:l,style:s,scaleNumberStyle:c}=i;return new t.Text(String(n),{...e,originX:"left"==l?"right":"right"==l?"left":"center",left:r,top:o,...s||c||{}})}function o(e,i,r){const o=new t.Line(i,{...n,...e.style||e.scaleLineStyle||{}});r.push(o)}function l(t,e,n,i,r,l,s,c){var u;const f=[],p=c||(null==(u=t.list)?void 0:u.length),a=t.position||"center",h=(t.spaceGridNumber||(c?1:5))*l/5;if(t.showScale&&e!==p-1)for(let l=0;l<5;l++)if(l>0||!t.showNumber||"center"!==a){const c=0==l?n[0]:i[0],u=0==l?n[1]:i[1],a=r-l*h;a>s&&(o(t,[c,a,u,a],f),e==p-2&&4==l&&o(t,[n[0],a-h,n[1],a-h],f))}return f}export{l as drawScaleLine,r as drawScaleNumber,i as getScaleInfo};
@@ -1,7 +1,25 @@
1
1
  import { SFCWithInstall } from '../../../es/shared/types';
2
+ export * from './src/types';
2
3
  declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
3
4
  fields: {
4
- type: import("vue").PropType<any[]>;
5
+ type: import("vue").PropType<Partial<{
6
+ [key: string]: any;
7
+ id: string;
8
+ name: string;
9
+ show: boolean;
10
+ sort: boolean;
11
+ sortDirection: "NONE" | "ASC" | "DESC";
12
+ title: string;
13
+ alias: string;
14
+ fixedShow: boolean;
15
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
16
+ columnWidth: number | null;
17
+ editable: boolean;
18
+ editableDisable: boolean;
19
+ required: boolean;
20
+ requiredDisable: boolean;
21
+ hide: boolean;
22
+ }>[]>;
5
23
  default: () => never[];
6
24
  };
7
25
  footerFlag: {
@@ -23,11 +41,28 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
23
41
  label: string;
24
42
  value: string;
25
43
  }[];
26
- emit: (event: "reset" | "onSave" | "onClose", ...args: any[]) => void;
44
+ emit: (event: "onSave" | "onClose" | "reset", ...args: any[]) => void;
27
45
  settingView: any;
28
46
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
29
47
  fields: {
30
- type: import("vue").PropType<any[]>;
48
+ type: import("vue").PropType<Partial<{
49
+ [key: string]: any;
50
+ id: string;
51
+ name: string;
52
+ show: boolean;
53
+ sort: boolean;
54
+ sortDirection: "NONE" | "ASC" | "DESC";
55
+ title: string;
56
+ alias: string;
57
+ fixedShow: boolean;
58
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
59
+ columnWidth: number | null;
60
+ editable: boolean;
61
+ editableDisable: boolean;
62
+ required: boolean;
63
+ requiredDisable: boolean;
64
+ hide: boolean;
65
+ }>[]>;
31
66
  default: () => never[];
32
67
  };
33
68
  footerFlag: {
@@ -54,7 +89,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
54
89
  clickItem: {
55
90
  [key: string]: any;
56
91
  };
57
- fields: {
92
+ fields: Partial<{
58
93
  [key: string]: any;
59
94
  id: string;
60
95
  name: string;
@@ -71,11 +106,11 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
71
106
  required: boolean;
72
107
  requiredDisable: boolean;
73
108
  hide: boolean;
74
- }[];
109
+ }>[];
75
110
  widthShow: string;
76
111
  widthLarge: string;
77
112
  };
78
- leftStyle: (ele: {
113
+ leftStyle: (ele: Partial<{
79
114
  [key: string]: any;
80
115
  id: string;
81
116
  name: string;
@@ -92,7 +127,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
92
127
  required: boolean;
93
128
  requiredDisable: boolean;
94
129
  hide: boolean;
95
- }) => {
130
+ }>) => {
96
131
  background: string | undefined;
97
132
  };
98
133
  showCheckBox: (key: string) => boolean;
@@ -103,7 +138,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
103
138
  reset: () => void;
104
139
  calculateCheck: (key: string) => boolean;
105
140
  handleAllCheck: (e: boolean, key: string) => void;
106
- handleFieldClick: (item: {
141
+ handleFieldClick: (item: Partial<{
107
142
  [key: string]: any;
108
143
  id: string;
109
144
  name: string;
@@ -120,8 +155,8 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
120
155
  required: boolean;
121
156
  requiredDisable: boolean;
122
157
  hide: boolean;
123
- }) => void;
124
- isDisable: (item: {
158
+ }>) => void;
159
+ isDisable: (item: Partial<{
125
160
  [key: string]: any;
126
161
  id: string;
127
162
  name: string;
@@ -138,7 +173,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
138
173
  required: boolean;
139
174
  requiredDisable: boolean;
140
175
  hide: boolean;
141
- }, key: string) => any;
176
+ }>, key: string) => any;
142
177
  setWidth: () => void;
143
178
  NButton: any;
144
179
  NCheckbox: any;
@@ -148,7 +183,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
148
183
  NSpin: any;
149
184
  NTooltip: any;
150
185
  NPopconfirm: any;
151
- draggable: import("vue").DefineComponent<{
186
+ Draggable: import("vue").DefineComponent<{
152
187
  list: {
153
188
  type: ArrayConstructor;
154
189
  required: boolean;
@@ -221,9 +256,26 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
221
256
  modelValue: unknown[];
222
257
  componentData: Record<string, any>;
223
258
  }>;
224
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("reset" | "onSave" | "onClose")[], "reset" | "onSave" | "onClose", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
259
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("onSave" | "onClose" | "reset")[], "onSave" | "onClose" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
225
260
  fields: {
226
- type: import("vue").PropType<any[]>;
261
+ type: import("vue").PropType<Partial<{
262
+ [key: string]: any;
263
+ id: string;
264
+ name: string;
265
+ show: boolean;
266
+ sort: boolean;
267
+ sortDirection: "NONE" | "ASC" | "DESC";
268
+ title: string;
269
+ alias: string;
270
+ fixedShow: boolean;
271
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
272
+ columnWidth: number | null;
273
+ editable: boolean;
274
+ editableDisable: boolean;
275
+ required: boolean;
276
+ requiredDisable: boolean;
277
+ hide: boolean;
278
+ }>[]>;
227
279
  default: () => never[];
228
280
  };
229
281
  footerFlag: {
@@ -244,7 +296,24 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
244
296
  onOnClose?: ((...args: any[]) => any) | undefined;
245
297
  }, {
246
298
  type: string;
247
- fields: any[];
299
+ fields: Partial<{
300
+ [key: string]: any;
301
+ id: string;
302
+ name: string;
303
+ show: boolean;
304
+ sort: boolean;
305
+ sortDirection: "NONE" | "ASC" | "DESC";
306
+ title: string;
307
+ alias: string;
308
+ fixedShow: boolean;
309
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
310
+ columnWidth: number | null;
311
+ editable: boolean;
312
+ editableDisable: boolean;
313
+ required: boolean;
314
+ requiredDisable: boolean;
315
+ hide: boolean;
316
+ }>[];
248
317
  footerFlag: boolean;
249
318
  isEdit: boolean;
250
319
  }>>;