cnhis-design-vue 3.1.50-beta.2 → 3.1.50-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.
- package/es/components/card-reader-sdk/src/cardReaderSDK.d.ts +1 -0
- package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
- package/es/components/card-reader-sdk/src/insuranceSDK.js +1 -1
- package/es/components/card-reader-sdk/src/types/index.d.ts +1 -1
- package/es/components/card-reader-sdk/src/utils/index.d.ts +0 -3
- package/es/components/card-reader-sdk/src/utils/index.js +1 -1
- package/es/components/classification/index.d.ts +3 -1
- package/es/components/classification/src/components/search-filter/index.vue.d.ts +3 -1
- package/es/components/classification/src/components/set-classification/index.vue.d.ts +3 -1
- package/es/components/classification/src/index.vue.d.ts +3 -1
- package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
- package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/index.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.d.ts +3 -0
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
- package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
- package/es/components/fabric-chart/src/hooks/useEvent.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/useEvent.js +1 -1
- package/es/components/field-set/index.d.ts +14 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +14 -1
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/form-config/index.d.ts +422 -73
- package/es/components/form-config/src/FormConfig.vue.d.ts +423 -74
- package/es/components/form-config/src/FormConfig.vue2.js +1 -1
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +120 -23
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +138 -35
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +121 -0
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.js +1 -0
- package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -0
- package/es/components/form-config/src/constants/index.d.ts +19 -1
- package/es/components/form-config/src/constants/index.js +1 -1
- package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
- package/es/components/form-config/src/types/index.d.ts +7 -3
- package/es/components/form-config/style/index.css +1 -1
- package/es/components/form-render/index.d.ts +120 -23
- package/es/components/form-render/src/FormRender.vue.d.ts +119 -22
- package/es/components/form-render/src/FormRender.vue2.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +120 -23
- package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
- package/es/components/form-render/src/components/renderer/select.d.ts +3 -0
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
- package/es/components/form-render/src/hooks/useFieldListAdaptor.d.ts +2 -5
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +173 -4
- package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
- package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +2 -2
- package/es/components/form-render/src/hooks/useFormAsyncQueue.js +1 -1
- package/es/components/form-render/src/hooks/useFormContext.d.ts +15 -2
- package/es/components/form-render/src/hooks/useFormContext.js +1 -1
- package/es/components/form-render/src/hooks/useFormRenderLifeCycle.d.ts +6 -6
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
- package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +2 -2
- package/es/components/form-render/src/hooks/useLowCodeReactions.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/form-render/src/types/index.d.ts +6 -21
- package/es/components/form-render/style/index.css +1 -1
- package/es/components/iho-table/index.d.ts +26 -0
- package/es/components/iho-table/index.js +1 -1
- package/es/components/iho-table/src/IhoTable.vue.d.ts +26 -0
- package/es/components/iho-table/src/constants/index.d.ts +1 -2
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +3 -1
- package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +18 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +14 -1
- package/es/components/iho-table/src/utils/index.d.ts +1 -1
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/iho-table/src/utils/separateMap.d.ts +5 -0
- package/es/components/iho-table/src/utils/separateMap.js +1 -0
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +346 -65
- package/es/components/info-header/src/InfoHeader.vue.d.ts +346 -65
- package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +86 -3
- package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +86 -3
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +206 -26
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +120 -23
- package/es/components/search-cascader/index.d.ts +4 -0
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +4 -0
- package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
- package/es/components/shortcut-setter/index.d.ts +121 -23
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +121 -23
- package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -0
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/classify-filter/components/Date.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +1 -0
- package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +1 -1
- package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +2 -0
- package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +3 -1
- package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +28 -0
- package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/types/business.d.ts +20 -0
- package/es/shared/utils/business.d.ts +2 -1
- package/es/shared/utils/business.js +1 -1
- package/es/shared/utils/index.js +1 -1
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ export default class CardReaderSDK {
|
|
|
12
12
|
constructor(options: InsuranceType.CardReadOptions);
|
|
13
13
|
private get basicParamsRes();
|
|
14
14
|
static create(options?: InsuranceType.CardReadOptions): CardReaderSDK;
|
|
15
|
+
static destroy(): void;
|
|
15
16
|
destroy(): void;
|
|
16
17
|
private createParams;
|
|
17
18
|
private checkLoading;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isFunction as a}from"lodash-es";import{TRANS_CMD as
|
|
1
|
+
import{isFunction as a}from"lodash-es";import{TRANS_CMD as t}from"./constants/index.js";import e from"./insuranceSDK.js";import{ReadHealthCard as r}from"./utils/readHealthCard.js";let s=null;const n=class{constructor(a){if(this.options=a,this.loading=!1,this.readHealthCardDialog=new r,s)return s;s=this,this.insurance=new e}get basicParamsRes(){return a(this.options.basicParams)?this.options.basicParams():this.options.basicParams}static create(a={}){return new n(a)}static destroy(){null==s||s.destroy(),s=null}destroy(){this.insurance.destroy()}createParams(a,t,e){var r,s;const{operatorname:n,operatorcode:i,...o}=this.basicParamsRes||{};return{transcmd:a,operatorname:null!=(r=t.operatorname)?r:n,operatorcode:null!=(s=t.operatorcode)?s:i,...o,...e}}checkLoading(){if(this.loading)return Promise.reject("请勿重复操作")}async checkResCodeAndLoading(a){try{this.loading=!0;const t=await a;return 3===t.returncode||"3"===t.returncode?Promise.reject(`${t.returnmsg||"操作失败"}`):t.returndata}finally{this.loading=!1}}async readHealthCard(a,t){return await this.checkLoading(),this.readHealthCardDialog.show({instance:a,...t})}async readIdCard(a={}){await this.checkLoading();const e=this.createParams(t.ID_CARD_READ,a,{transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"2",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async readMemberCard(a={}){await this.checkLoading();const e=this.createParams(t.MEMBER_CARD_READ,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async writeMemberCard(a={}){await this.checkLoading();const e=this.createParams(t.MEMBER_CARD_WRITE,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async readInsuranceCard(a={}){var e,r;await this.checkLoading();const s=this.createParams(t.NS_GETPERSONALINFO,a,{transchannel:"101",interfaceid:a.interfaceid,transtype:"YB0000",transdata:{...a.transdata,iar1:{...(null==(e=a.transdata)?void 0:e.iar1)||{acf01:"0",iak22:"0"}},personinfo:{...(null==(r=a.transdata)?void 0:r.personinfo)||{location:0,ownpay:"0"}}}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(s))}async generalRequest(a={}){await this.checkLoading();const e=this.createParams(t.NS_GETPERSONALINFO,a);return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}};let i=n;i.version=1,i.TRANS_CMD=t;export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,
|
|
1
|
+
import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,getErrorMessageByType as l,getTranstime as d,getSerialNumber as u}from"./utils/index.js";var c;class m{constructor(e){var s,t;this.webview=null==(c=window.chrome)?void 0:c.webview,this.requestParams=null,this.currentMessageHandler=null,this.messageHandlerQueue=[],(null==e?void 0:e.selfWindow)&&(this.webview=null==(t=null==(s=null==e?void 0:e.selfWindow)?void 0:s.chrome)?void 0:t.webview),this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler))}messageHandler(s){const r=this.messageHandlerQueue.shift();if(!r)return Promise.reject(o("当前回执",s,"没有可用的handler"));const{resolve:i,reject:n,transcmd:a}=r,l=t(s.data)?e(s.data)||{}:s.data;if(!l||!["hisyb","login"].includes(l.exec))return n(o("当前回执不是hisyb消息"));const{transcmd:d}=l.res||{};if(a&&d&&`${a}`!=`${d}`)return n(o("交易命令不相等,当前transcmd",a,"返回transcmd",d));i(l)}async postMessage(s){return this.webview&&s?new Promise(((t,r)=>{var i;this.messageHandlerQueue.push({resolve:t,reject:r,transcmd:null==(i=e(s.data))?void 0:i.transcmd}),this.webview.postMessage(s)})).then((e=>e&&e.result&&e.exec===s.exec?e:Promise.reject())):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=null)}login(){var e,s;return this.postMessage({exec:"login",data:null!=(s=null==(e=this.requestParams)?void 0:e.loginCode)?s:"7777"})}async HOInterfaceSvr(e){const{transcmd:t,needLogin:n}=this.requestParams||{};try{if(this.webview){n&&await this.login();return(await this.postMessage({exec:"hisyb",data:JSON.stringify(r(e,["needLogin"]))})).res}return(await s.post(i,JSON.stringify(r(e,["needLogin"])))).data}catch(e){return Promise.reject(l(t))}}initConfig(e){this.requestParams=Object.assign({},n,e)}initParams(){var e,s;return{...this.requestParams,transcmd:null!=(s=null==(e=this.requestParams)?void 0:e.transcmd)?s:a.NS_GETPERSONALINFO,transtime:d(),serialnumber:u()}}getInsuranceInfoPromise(e){return this.initConfig(e),this.HOInterfaceSvr(this.initParams())}}export{m as default};
|
|
@@ -28,7 +28,7 @@ export declare namespace InsuranceType {
|
|
|
28
28
|
export type CardReadParams = Partial<{
|
|
29
29
|
operatorname: string;
|
|
30
30
|
operatorcode: string;
|
|
31
|
-
location:
|
|
31
|
+
location: string | number;
|
|
32
32
|
needLogin: boolean;
|
|
33
33
|
interfaceid: number | string;
|
|
34
34
|
transtime: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
|
-
import { CONFIG_MAP } from '../constants';
|
|
3
1
|
export declare function getSerialNumber(): string;
|
|
4
2
|
export declare function getTranstime(): string;
|
|
5
3
|
export declare function pad2(n: number): string | number;
|
|
6
4
|
export declare function generateTimeRequestNumber(): string;
|
|
7
5
|
export declare function insuranceLog(...messages: any[]): any;
|
|
8
6
|
export declare function getErrorMessageByType(code?: number): string;
|
|
9
|
-
export declare function getDataMessageByData(_data: string | AnyObject, configMap?: typeof CONFIG_MAP): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{TRANS_CMD as t}from"../constants/index.js";function n(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function e(){return o()+parseInt(1e3*Math.random()+"")}function r(t){return t<10?"0"+t:t}function o(){const t=new Date;return t.getFullYear().toString()+r(t.getMonth()+1)+r(t.getDate())+r(t.getHours())+r(t.getMinutes())+r(t.getSeconds())}function u(...t){return console.log("[INSURANCE-SDK]: ",...t),t.reduce(((t,n)=>t+n))}const c={[t.ID_CARD_READ]:"身份证读卡接口服务异常",[t.MEMBER_CARD_READ]:"会员读卡接口服务异常",[t.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function i(t){return t&&c[t]||"请检查医保服务是否正常"}export{o as generateTimeRequestNumber,i as getErrorMessageByType,n as getSerialNumber,e as getTranstime,u as insuranceLog,r as pad2};
|
|
@@ -684,7 +684,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
684
684
|
value: any;
|
|
685
685
|
unit: any;
|
|
686
686
|
}[];
|
|
687
|
-
findConditionByDisplayCategory: (
|
|
687
|
+
findConditionByDisplayCategory: (sid: string) => unknown;
|
|
688
688
|
handleDisplayCategorySelectProxy: (item: import("..").ICategoryItemType) => void;
|
|
689
689
|
clearFormData: () => void;
|
|
690
690
|
handleInitConditions: () => Promise<void>;
|
|
@@ -784,6 +784,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
784
784
|
label: string;
|
|
785
785
|
value: string;
|
|
786
786
|
}[]>;
|
|
787
|
+
initMounted: () => void;
|
|
787
788
|
isDateDisabled: (ts: number) => boolean;
|
|
788
789
|
timeDisabled: (ts: number) => {
|
|
789
790
|
isHourDisabled(hour: number): boolean | undefined;
|
|
@@ -1335,6 +1336,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1335
1336
|
value: string;
|
|
1336
1337
|
}[]>;
|
|
1337
1338
|
presetValCp: import("vue").WritableComputedRef<string>;
|
|
1339
|
+
initMounted: () => void;
|
|
1338
1340
|
handleChange: (val: any, type: "end" | "start") => void;
|
|
1339
1341
|
isStartDateDisabled: (ts: number) => boolean;
|
|
1340
1342
|
timeStartDisabled: (ts: number) => {
|
|
@@ -161,7 +161,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
161
161
|
value: any;
|
|
162
162
|
unit: any;
|
|
163
163
|
}[];
|
|
164
|
-
findConditionByDisplayCategory: (
|
|
164
|
+
findConditionByDisplayCategory: (sid: string) => unknown;
|
|
165
165
|
handleDisplayCategorySelectProxy: (item: import("../../../..").ICategoryItemType) => void;
|
|
166
166
|
clearFormData: () => void;
|
|
167
167
|
handleInitConditions: () => Promise<void>;
|
|
@@ -261,6 +261,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
261
261
|
label: string;
|
|
262
262
|
value: string;
|
|
263
263
|
}[]>;
|
|
264
|
+
initMounted: () => void;
|
|
264
265
|
isDateDisabled: (ts: number) => boolean;
|
|
265
266
|
timeDisabled: (ts: number) => {
|
|
266
267
|
isHourDisabled(hour: number): boolean | undefined;
|
|
@@ -812,6 +813,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
812
813
|
value: string;
|
|
813
814
|
}[]>;
|
|
814
815
|
presetValCp: import("vue").WritableComputedRef<string>;
|
|
816
|
+
initMounted: () => void;
|
|
815
817
|
handleChange: (val: any, type: "end" | "start") => void;
|
|
816
818
|
isStartDateDisabled: (ts: number) => boolean;
|
|
817
819
|
timeStartDisabled: (ts: number) => {
|
|
@@ -471,7 +471,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
471
471
|
value: any;
|
|
472
472
|
unit: any;
|
|
473
473
|
}[];
|
|
474
|
-
findConditionByDisplayCategory: (
|
|
474
|
+
findConditionByDisplayCategory: (sid: string) => unknown;
|
|
475
475
|
handleDisplayCategorySelectProxy: (item: import("../../../../../../es/components/table-filter/src/types").ICategoryItemType) => void;
|
|
476
476
|
clearFormData: () => void;
|
|
477
477
|
handleInitConditions: () => Promise<void>;
|
|
@@ -571,6 +571,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
571
571
|
label: string;
|
|
572
572
|
value: string;
|
|
573
573
|
}[]>;
|
|
574
|
+
initMounted: () => void;
|
|
574
575
|
isDateDisabled: (ts: number) => boolean;
|
|
575
576
|
timeDisabled: (ts: number) => {
|
|
576
577
|
isHourDisabled(hour: number): boolean | undefined;
|
|
@@ -1122,6 +1123,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1122
1123
|
value: string;
|
|
1123
1124
|
}[]>;
|
|
1124
1125
|
presetValCp: import("vue").WritableComputedRef<string>;
|
|
1126
|
+
initMounted: () => void;
|
|
1125
1127
|
handleChange: (val: any, type: "end" | "start") => void;
|
|
1126
1128
|
isStartDateDisabled: (ts: number) => boolean;
|
|
1127
1129
|
timeStartDisabled: (ts: number) => {
|
|
@@ -685,7 +685,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
685
685
|
value: any;
|
|
686
686
|
unit: any;
|
|
687
687
|
}[];
|
|
688
|
-
findConditionByDisplayCategory: (
|
|
688
|
+
findConditionByDisplayCategory: (sid: string) => unknown;
|
|
689
689
|
handleDisplayCategorySelectProxy: (item: import("../../../../es/components/table-filter/src/types").ICategoryItemType) => void;
|
|
690
690
|
clearFormData: () => void;
|
|
691
691
|
handleInitConditions: () => Promise<void>;
|
|
@@ -785,6 +785,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
785
785
|
label: string;
|
|
786
786
|
value: string;
|
|
787
787
|
}[]>;
|
|
788
|
+
initMounted: () => void;
|
|
788
789
|
isDateDisabled: (ts: number) => boolean;
|
|
789
790
|
timeDisabled: (ts: number) => {
|
|
790
791
|
isHourDisabled(hour: number): boolean | undefined;
|
|
@@ -1336,6 +1337,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1336
1337
|
value: string;
|
|
1337
1338
|
}[]>;
|
|
1338
1339
|
presetValCp: import("vue").WritableComputedRef<string>;
|
|
1340
|
+
initMounted: () => void;
|
|
1339
1341
|
handleChange: (val: any, type: "end" | "start") => void;
|
|
1340
1342
|
isStartDateDisabled: (ts: number) => boolean;
|
|
1341
1343
|
timeStartDisabled: (ts: number) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as t,reactive as
|
|
1
|
+
import{defineComponent as e,ref as t,reactive as s,onMounted as r,onBeforeUnmount as o,openBlock as a,createElementBlock as n,Fragment as i,createElementVNode as p,createBlock as u,mergeProps as l,unref as c,createCommentVNode as h}from"vue";import{fabric as m}from"../../../shared/utils/fabricjs/index.js";import f from"./components/PopupTip.vue.js";import d from"./components/PopupMenu.js";import"./hooks/useDraw.js";import"date-fns";import"lodash-es";import"./hooks/useEvent.js";import{useBirthProcessChart as v}from"./hooks/birthProcess/useBirthProcessChart.js";import{useTemperatureChart as w}from"./hooks/temperature/useTemperatureChart.js";import{useSurgicalAnesthesiaChart as k}from"./hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js";var g=e({__name:"FabricChart",props:{type:{type:String,default:"temperature"},data:{type:Object,required:!0},addRenderItem:{type:Function}},emits:["change","add","remove","select","add:prevent"],setup(e,{expose:g,emit:C}){const j=e,y=t(null),b=t(),P=s({show:!1,point:{x:0,y:0},list:[]}),x=s({show:!1,point:{x:0,y:0},list:[],target:null}),{propItems:I,redrawPoints:M,select:A,clickMenu:R}=function(){const e=[b,j,C,y,P,x];switch(j.type){case"birthProcess":return v(...e);case"surgicalAnesthesia":return k(...e);default:return w(...e)}}();return r((()=>{b.value=new m.Canvas(y.value,{width:I.canvasWidth,height:I.canvasHeight,backgroundColor:"#fff",selection:!1,containerClass:"c-fabric-chart",stopContextMenu:!0,fireRightClick:!0,allowTouchScrolling:!0})})),o((()=>{b.value.off(),b.value.clear()})),g({redrawPoints:M,select:A,canvas:b}),(e,t)=>(a(),n(i,null,[p("canvas",{ref_key:"canvasRef",ref:y},null,512),b.value?(a(),u(f,l({key:0,propItems:c(I)},P),null,16,["propItems"])):h("v-if",!0),b.value?(a(),u(c(d),l({key:1,propItems:c(I)},x,{show:x.show,"onUpdate:show":t[0]||(t[0]=e=>x.show=e),onClickMenu:c(R)}),null,16,["propItems","show","onClickMenu"])):h("v-if",!0)],64))}});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as t,drawArrow as n,drawText as o,defaultTextStyle as i,drawPoint as r,drawTextAndIconGroup as l,defaultStyle as s,defaultRectStyle as a}from"../useDraw.js";import{useGrid as u}from"../useGrid.js";import{useBirthProcessCumputedPoint as c}from"../useCumputedPoint.js";import"../useEvent.js";import{getScaleInfo as d,drawScaleNumber as f,drawScaleLine as p}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import{getIndex as g,isEffectiveNode as v,getTime as m,getScaleNumberList as y}from"../../utils/index.js";import"../temperature/useShadow.js";import{cloneDeep as k}from"lodash-es";import{format as w}from"date-fns";import"naive-ui";function x(x,b,j,C,P){const{cumputedX:S,cumputedY:E,getXValue:G,getYValue:M}=c(b),{getEqualXTypes:T,handleAddPrevent:Y,isGridLimit:L}=h(x,j,b),{xAxis:X,grid:A,originX:I,originY:H,xCellWidth:W,endY:O,startTime:V,leftAddAreaWidth:D,leftScales:N,rightScales:R,yCellHeight:$,endX:B,scaleValues:F,canvasWidth:q,borderStyle:z,rightAddAreaWidth:J,event:K,originYCervix:Q,other:U,canvasHeight:Z}=b,_=k(F),ee=new Set;function te(){_.filter((e=>e.show)).forEach(((e,l)=>{var s;const a=[],u=[],c=[];null==(s=e.data)||s.forEach(((s,d)=>{!function(s,d,f){let p,h;const{pointAttr:g={},lineAttr:v={},title:m="",key:y,type:k="circle",childbirthStyle:w={}}=e,P=e.data[f+1],S=le(P,e);if(s&&S&&!d.breakpoint)h=t([...s,...S],{...v});else if(s&&!S&&!d.breakpoint){const n=le(P,e);h=n?t([...s,...n],{...v}):null}let E,T;if(d.childbirth){const e=s[1]+$;E=n([s[0],s[1],e],w),c.push(E),T=o([s[0]+W/2,e-$/2],{value:String(d.childbirth),...i,originX:"left",originY:"center",...w}),c.push(T)}const Y=u[f-1],L={origin:{data:d,title:m,key:y||"",dataIndex:l,index:f},leftLine:Y,rightLine:h,arrowGroup:E,arrowGroupText:T,...g,...b.event.hovered?b.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:b.event};Y?p=r(k,{left:Y.get("x2"),top:Y.get("y2"),...L}):s&&(L.leftLine=null,p=r(k,{left:s[0],top:s[1],...L}));u.push(h),p&&(!function(e){K.hovered&&(e.on("mouseover",(()=>{re(e,"hover")})),e.on("mouseout",(()=>{C.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{ie(e),function(e){var t,n,o,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top}),null==(o=e.arrowGroup)||o.setCoords().set({left:e.left,top:e.top}),null==(i=e.arrowGroupText)||i.setCoords().set({left:e.left+W/2,top:e.top+$/2})}(e),K.hovered&&re(e)})),e.on("mouseup",(t=>{if(C.show=!1,1===t.button){const{key:t}=e.origin,n={...e.origin,data:{...e.origin.data,time:G(e.left),value:M(t,e.top)}};x.value.discardActiveObject(),j("change",n),ne(n,"change")}}))}(p),a.push(p),ee.add(p))}(le(s,e),s,d)})),Promise.all(a).then((e=>{const t=u.filter((e=>e));let n=null;e=e.filter((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),Promise.all(c).then((n=>{x.value.add(...t,...e,...n),e.forEach((e=>{null==e||e.bringToFront()}))}))}))}))}function ne(e,t="add"){const{dataIndex:n,data:o,index:i,key:r}=e,l=_.find((e=>e.key===r));switch(t){case"remove":l.data.splice(i,1);break;case"change":l.data[i]=o;break;default:{const e=g(o.time,l.data);l.data.splice(e,0,o);break}}oe()}function oe(){var e;ee.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),(null==e?void 0:e.arrowGroup)&&t.push(null==e?void 0:e.arrowGroup),(null==e?void 0:e.arrowGroupText)&&t.push(null==e?void 0:e.arrowGroupText)})),t}([...ee]))),ee.clear(),te()}function ie(e){const t=e.prevPoint?e.prevPoint.left:I,n=e.nextPoint?e.nextPoint.left:B;e.setCoords(),["cervix","fetalPresentation"].includes(e.origin.key)&&e.top<Q&&e.set("top",Q),e.top<H&&e.set("top",H),e.top>O&&e.set("top",O),e.left<t&&e.set("left",t),e.left>n&&e.set("left",n)}function re(e,t="moving"){const{title:n,key:o,data:i}=e.origin;C.point={x:e.left,y:e.top},C.list=[`${n} ${"hover"===t?i.value:M(o,e.top)}`,`时间 ${G(e.left).slice(-5)}`],C.show=!0}function le(e,t){if(v(e)&&function(e){const t=V+864e5,n=m(e);return n>=V&&n<=t}(e.time)){const n=S(e.time),o=E(t.key,t.range,e.value);return[n,o<H?H:o>O?O:o]}}function se(e,t){return e+1>t[1]?t[0]:e+1}return u(x,b),function(){const t=new e.Rect({...z,width:q-D-J-1,height:O-1,left:D,top:0,fill:"transparent"});x.value.add(t)}(),function(){function t(t,n="left"){let r="left"===n?D:B;t.forEach(((t,n)=>{const{range:l,spaceValue:u,width:c,title:h,titleStyle:g,key:v,position:m="center",spaceGridNumber:k=1,showNumber:w,showMaxMinNumber:b}=t,j=[],C=[],P=r+c/2,S=y(l,u),E=S.length;S.forEach(((e,n)=>{const{lineXMain:o,lineXSub:i,textLeft:l}=d(m,r,c),s=O-n*$*k,a=0===n?O-8:n!==S.length-1||H||Q&&"FHR"!==v?s:H+8;!w||(0===n||n===E-1)&&!b||j.push(f(String(e),t,l,a)),C.push(...p(t,n,o,i,s,$,H,E))}));const G=new e.Rect({...a,strokeWidth:.5,width:c,height:O,left:P,top:O/2}),M=o([P,H>0?H-$/2:$/2],{value:String(h),...i,...g}),T=new e.Group([...C,...j,G,...M?[M]:[]],{objectCaching:!1,...s});x.value.add(T),T.sendToBack(),r+=c}))}t(N),t(R,"right")}(),function(){const{show:t,startTime:n,range:r=[0,23],position:l="top",style:a}=X.time,{show:u,range:c=[0,23],position:d,style:f}=X.processTime;if(t||u){const p=[],h=[],g=[],v=[],m=I+W/2,y=$/2;for(let e=0;e<A.mainXCell;e++){if(t){const t=0===e?+n.slice(11,13):se(p.at(-1),r);p.push(t);const s="top"===l?H-y:O+y;g.push(o([m+e*W,s],{value:String(t),...i,...a||{}}))}if(u){const t=0===e?c[0]:h.at(-1)+1;h.push(t);const n="top"===d?y:Z-y;v.push(o([m+e*W,n],{value:String(t),...i,...f||{}}))}}const k=new e.Group([...g,...v],{objectCaching:!1,...s});x.value.add(k),x.value.sendToBack(k)}}(),function(){var e;const n=Object.values(U),o=[],i={},r=_.find((e=>"cervix"===e.key&&e.show)),l=null==(e=null==r?void 0:r.data)?void 0:e.find((e=>3==+e.value));function s(e,t){const{key:n,range:o}=r||{},i=E(n,o,10),l=[0,t],s=[-t/e,0],a=[(O-i-t)/e,O-i],u=[B-I,e*(B-I)+t];let c=[],d=[];function f([n,o]){return Math.abs(o-e*n-t)<=1}function p([e,t]){const[n,o]=[...h([e,t])];return n>=I&&n<=B&&o>=i&&o<=O}function h([e,t]){return[I+e,O-t]}return f(l)&&p(l)&&(c=h(l)),f(s)&&p(s)&&(c=h(s)),f(a)&&p(a)&&(d=h(a)),f(u)&&p(u)&&(d=h(u)),[...c,...d]}n.forEach((e=>{if(!e.show)return;const{key:n}=e;switch(n){case"fetalPresentation":{const{range:i,show:r}=_.find((e=>e.key===n));if(r){const r=E(n,i,0);o.push(t([I,r,B,r],{...e}))}break}case"alert":if(l){const{key:n,range:a}=r||{},u=216e5,c={time:w(new Date(m(l.time)+u),"yyyy-MM-dd HH:mm"),value:10},[d,f]=[S(l.time)-I,O-E(n,a,l.value)],[p,h]=[S(c.time)-I,O-E(n,a,c.value)],g=(h-f)/(p-d),v=f-d*g,y=s(g,v);y.length>0&&(o.push(t(y,{...e})),Object.assign(i,{k:g,b:v}))}break;case"handling":if(l){const{k:n,b:r}=i,a=144e5,u=s(n,r-(S(w(new Date(m(l.time)+a),"yyyy-MM-dd HH:mm"))-S(l.time))*n);u.length>0&&o.push(t(u,{...e}))}}})),x.value.add(...o)}(),te(),function(){function e(e,t){const n=_.findIndex((t=>t.key===e.key));return{renderItem:()=>e.title,origin:{title:e.title,unit:e.unit,dataIndex:n,key:e.key},pointer:t}}b.event.evented&&x.value.on("mouse:up",(t=>{if(3===t.button){const{x:n=0,y:o=0}=t.pointer||{};n>=I&&n<=B&&o>=H&&o<=O&&(P.point={x:n,y:o},P.show=!0,t.target?(P.target=t.target,P.list=["删除节点"],[...ee].forEach((e=>{e.origin&&e.left===t.target.left&&e.top===t.target.top&&P.list.push({renderItem:()=>e.origin.title,origin:{...e.origin},mode:"remove",pointer:t.pointer})}))):(P.target=null,P.list=["新增节点"],_.filter((e=>e.show)).forEach((i=>{if(!T([...ee],n,"key").includes(i.key)){if(["cervix","fetalPresentation"].includes(i.key)&&o<Q)return;P.list.push(e(i,t.pointer))}})),1===P.list.length&&(P.show=!1,Y("repeat"),console.log("当前时间段内无可新增节点"))))}}))}(),function(){const e=q-J/2;function t(e,t){if(!e.length)return;let o=H;const i=[];e.forEach((e=>{const n=e.title.split("").join("\n"),r=F.findIndex((t=>t.key===e.key)),{text:s,icon:a}=l(n,e,{text:{originY:"top",left:t,top:o},icon:{left:t,topY:o,originY:"top",origin:{type:e.type,dataIndex:r},...b.event}},"vertical");var u;o+=s.height+a.height+15,(u=a).on("moving",(()=>{u.set("originY","center"),L(u)?(ie(u),re(u)):C.show=!1})),u.on("mouseup:before",(e=>{if(C.show=!1,0===e.e.button&&L(u))if(T([...ee],u.left,"key").includes(u.origin.key))Y("repeat");else{const e={data:{time:G(u.left),value:M(u.origin.key,u.top)},...u.origin};j("add",e),ne(e)}!function(e){e.setCoords().set({originY:"top",left:e.originLeft,top:e.originTop})}(u)})),i.push(s,a)})),n(i),x.value.add(...i)}function n(e){const t=e.at(-1),n=(O-H)/2,o=(t.height+t.top-H)/2;e.forEach((e=>{const t=e.top+n-o;e.set({top:t,originTop:t})}))}t(N,D/2),t(R,e)}(),{clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(j("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:G(e.pointer.x),value:M(e.origin.key,e.pointer.y)}}),j("add",n),ne(n))},redrawPoints:oe}}export{x as useBirthProcess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
|
|
1
|
+
export{defaultBorderStyle,defaultLineStyle,defaultRectStyle,defaultStyle,defaultTextStyle,drawArrow,drawLine,drawPoint,drawText,drawTextAndIconGroup,drawTextGroup}from"./useDraw.js";export{useGrid}from"./useGrid.js";export{useBirthProcessCumputedPoint,useCumputedPoint}from"./useCumputedPoint.js";export{bus,useCanvasEvent}from"./useEvent.js";export{drawScaleLine,drawScaleNumber,getScaleInfo}from"./useScaleColumn.js";export{useCommon}from"./useCommon.js";export{useBirthProcessChart}from"./birthProcess/useBirthProcessChart.js";export{useTemperatureChart}from"./temperature/useTemperatureChart.js";export{useSurgicalAnesthesiaChart}from"./surgicalAnesthesia/useSurgicalAnesthesiaChart.js";
|
|
@@ -12,4 +12,7 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: AnyObje
|
|
|
12
12
|
setPopup: (point: any, status?: string) => void;
|
|
13
13
|
updateData: (params: AnyObject, mode?: string, n?: number) => void;
|
|
14
14
|
getGridPoints: () => IObject[];
|
|
15
|
+
getContainPoints: (gridPoints?: never[]) => IObject[];
|
|
16
|
+
showDialog: (callback: Function) => void;
|
|
17
|
+
removeCurrentSelection: () => void;
|
|
15
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{bus as r}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as f,isEffectiveNode as u,getTime as c}from"../../utils/index.js";import{cloneDeep as p,omit as d}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function m(m,v,y,g,h){const{cumputedX:k,cumputedY:x,getXValue:L,getYValue:P}=l(v),{xCellWidth:w,pointSelectionStyle:b,originX:A,endX:C,originY:K,endY:j,event:I,scaleValues:T,xAxis:E,startTime:M,timeXCell:X,itemList:S,dialog:$}=v,O=new Map,V=new Set,Y=p(T);let D=[],_=null;i(m,v);const{getEqualXTypes:N,handleAddPrevent:z}=s(m,y,v);function G(){Y.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function s({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=x(t.type,t.range,o),s=n([A,r,C,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});I.hovered&&i&&(s.on("mousemove",(({pointer:e})=>{g.point={...e||{x:s.left,y:s.top}},g.list=[`${i} ${o}${t.unit||""}`],g.show=!0})),s.on("mouseout",(()=>{g.show=!1}))),m.value.add(s)}s(o),s(i),s(l),s(r)}(t,e),R(t,o,e))}))}))}function J(e=[]){if(!(null==_?void 0:_.areaPos))return[];const{startPos:t,endPos:n}=_.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:te()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),F()},onNegativeClick:()=>F(),onClose:()=>F()})}function F(){_&&m.value.remove(_),_=null}function R(e,t,i){var l;const{type:r,unit:s,dataList:a=[]}=i,f=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let h,k,x=c;l.key&&(x=a.find((e=>e.key===l.key)));const{pointAttr:b={},lineAttr:A={},title:C="",key:K,type:j="circle"}=x,T=ee(c.list[u+1],i);e&&T&&!l.breakpoint&&e[0]!==T[0]&&(k=n([...e,...T],A));const E=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:s,type:r,dataIndex:t,index:u,lineAttr:A},__type:"main",leftLine:E,rightLine:k,...b,...v.event.hovered?v.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:v.event};E?h=o(j,{left:E.get("x2"),top:E.get("y2"),...M}):e&&(M.leftLine=null,h=o(j,{left:e[0],top:e[1],...M}));f.push(k),h&&(h.originLeft=h.left,h.originTop=h.top,function(e){I.hovered&&(e.on("mouseover",(()=>{U(e,"hover")})),e.on("mouseout",(()=>{g.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{Z(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),I.hovered&&U(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/w);if(o>t+w&&!e.nextPoint){if(0===D.length){W(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+w*r;if(D.every((e=>e.left!==o))){const t=L(o),n=P(l.type,i);D.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),W(e,[...e.prevPointer,o,i])}D.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+w*l,r=D.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=D.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const s=JSON.parse(JSON.stringify(r)),a=D[l-1]||{left:n,top:o},f=~~((r.left-(t-w))/w),u=(r.top-a.top)/f;s.top=a.top+u,s.left=t,s.data={time:L(t),value:P(i.type,s.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},D.splice(l,0,s),W(e,[a.left,a.top,s.left,s.top])}}l++}}(e,r)}if(D.length>0&&o<D[D.length-1].left){for(const e of V)e.left>o&&(e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e));if(D=D.filter((e=>e.left<=o)),0===D.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of V)e.leftLine&&m.value.remove(e.leftLine),m.value.remove(e)}if(D.length>0){const t=D.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(g.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:L(e.left),value:P(t,e.top)}};if(m.value.discardActiveObject(),D.length>0){const e=D.map((e=>e.data)),i=Y.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));y("add",{...d(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),B({...o,data:e})}else y("change",{...d(o,["selfKey","lineAttr"]),key:n}),B(o,"change")}}))}(h),null==(p=O.get(c.key))||p.push(h))}(ee(l,i),l,u,e)})),Promise.all(O.get(e.key)).then((e=>{const t=f.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),m.value.add(...t,...e)}))}function W(e,t){const[,,o,i]=t;e.clone((l=>{l.set({left:o,top:i}),e.prevPointer=[o,i];const r=n(t,e.origin.lineAttr);l.leftLine=r,V.add(l),m.value.add(r,l)}))}function B(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:s}=e;const a=Y.find((e=>e.type===r)),u=a.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(i,n);break;case"change":u.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=f(e,u.list),n=Array.isArray(o)?o:[o];u.list.splice(t,0,...n);break}}H({dataIndex:s,scaleValue:a})}function H(e){var t,n,o;if(V.size&&(null==(t=m.value)||t.remove(...Q([...V]))),V.clear(),D=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=m.value)||n.remove(...Q(O.get(i.key))),O.delete(i.key),R(i,t,o)}else O.size&&(null==(o=m.value)||o.remove(...Q(te()))),O.clear(),G()}function Q(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function U(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;g.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:P(o,e.top)}`;g.list=[`${n} ${r}${l||""}`,`时间 ${L(e.left).slice(-5)}`],g.show=!0}function Z(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:A,o=e.nextPoint?e.nextPoint.left-t:C;e.top<K&&e.set("top",K),e.top>j&&e.set("top",j),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function ee(e,t){if(u(e)&&function(e){const t=Date.parse(E.list.at(-1)),n=c(e);return n>=M&&n<=t}(e.time)){const n=k(e.time),o=x(t.type,t.range,e.value);return[n,o<K?K:o>j?j:o]}}function te(){return Array.from(O.values()).flat()}return G(),function(){if(!I.evented)return;let n=!1,o={x:0,y:0};m.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=A&&t<=C&&n>=K&&n<=j)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=a(e.target);te().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&h.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===h.list.length&&(h.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),S.forEach((n=>{N(te(),t,"key",2*w).includes(n.linkKey||n.key)||h.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===h.list.length&&(h.show=!1,z("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(h,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=J();e.length>0?q((()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return B(n[0],"remove",n.length),n.map((e=>({...d(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(e);y("remove",t)})):r.emit(_)}})),m.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),m.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:s,y:a}=i.pointer;_&&m.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...b,left:l,top:r,width:s-l,height:a-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},m.value.add(_)}))}(),{redrawPoints:H,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(y("remove",n),B(n,"remove")):(Object.assign(n,{data:{time:L(e.pointer.x),value:P(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),y("add",n),B({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:Z,setPopup:U,updateData:B,getGridPoints:te,getContainPoints:J,showDialog:q,removeCurrentSelection:F}}export{m as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultRectStyle as i,drawTextAndIconGroup as o,drawText as n,defaultTextStyle as l,defaultStyle as r}from"../useDraw.js";import{useBirthProcessCumputedPoint as s}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as a}from"../useScaleColumn.js";import{useCommon as u}from"../useCommon.js";import"vue";import{getScaleNumberList as d}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function h(h,p,f,m,g,v,y,k){const{getYValue:w,getXValue:j}=s(p),{getEqualXTypes:x,handleAddPrevent:b,isGridLimit:W}=u(h,f,p),{originY:X,endY:C,borderStyle:E,left:S,itemList:Y,scaleValues:K,originX:L,endX:V,yCellHeight:G,markHeight:H,canvasWidth:N,canvasHeight:T,xCellWidth:M}=p;!function(){if(!S)return;const{title:t,titleWidth:i,titleStyle:o}=S,n=e({width:i,height:C-X+H,...E},{value:t.split("").join("\n"),...o||{}},{left:0,top:X},!0);h.value.add(n)}(),K.forEach(((e,i)=>{var o,s;const u="left"===e.layout?L-5:V+5,{range:c,spaceValue:p,title:f,unit:m,titleStyle:g,spaceGridNumber:v=1,showNumber:y,showMaxMinNumber:k}=e,w=[],j=d(c,p),x=j.length;j.forEach(((t,i)=>{const o=0===i?C-5:C-i*G*v;!y||(0===i||i===x-1)&&!k||w.push(a(String(t),{...e,position:e.layout},u,o))}));const b=f&&n(["left"===e.layout?S.width/2:V+(N-V)/2,(null!=(s=null==(o=w.at(-1))?void 0:o.top)?s:330)-G],{value:`${f}${m?"\n"+m:""}`,...l,...g}),W=new t.Group([...w,...b?[b]:[]],{objectCaching:!1,...r});h.value.add(W),W.sendToBack()})),function(){const e=new t.Rect({width:L-S.titleWidth,height:C-X+H,left:S.titleWidth,top:X,...i,originX:"left",originY:"top",...E});h.value.add(e);const n=c(Y),l=c(S.externalIconList||[]).map((t=>({...t,isExternal:!0})));let r=C;const s=S.titleWidth+15;l.concat(n.reverse()).forEach((t=>{r-=10;const e=t.title,{text:i,icon:n}=o(e,t,{text:{left:s,top:r},icon:{leftX:s,topY:r,...t.isExternal?{evented:!1,selectable:!1}:{},origin:{linkKey:t.linkKey}}});var l;r-=i.height||30,(l=n).on("moving",(()=>{l.set("originX","center"),W(l)?(g(l),v(l)):m.show=!1})),l.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&W(l)){const t=l.origin.linkKey||l.origin.key;if(x(k(),l.left,"key",2*M).includes(t))b("repeat");else{const e={data:{time:j(l.left),value:w(l.origin.type,l.top),...l.origin.linkKey?{key:l.origin.key}:{}},...l.origin};f("add",e),y({...e,key:t})}}!function(t){t.setCoords().set({originX:"left",left:t.originLeft,top:t.originTop})}(l)})),h.value.add(i,n)}))}(),h.value.add(new t.Rect({left:0,top:0,width:N-E.strokeWidth,height:T-E.strokeWidth,fill:"transparent",...E}))}export{h as useLeft};
|
|
@@ -2,7 +2,7 @@ import { Ref } from 'vue';
|
|
|
2
2
|
import { fabric } from '../../../../../../es/shared/utils/fabricjs';
|
|
3
3
|
import { IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
|
|
4
4
|
import { AnyObject } from '../../../../../../es/shared/types';
|
|
5
|
-
export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
|
|
5
|
+
export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps, moveLimit: Function, getContainPoints: Function, showDialog: Function, removeCurrentSelection: Function): {
|
|
6
6
|
clickMenu: ({ item, target }: {
|
|
7
7
|
item: AnyObject;
|
|
8
8
|
target: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{bus as n}from"../useEvent.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getIndex as a}from"../../utils/index.js";import{cloneDeep as l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as s}from"../../constants/index.js";import"naive-ui";function d(d,c,f,u,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,f,c),{other:P,yCellHeight:w,xCellWidth:j,endX:C,originX:E,originY:z,endY:A,markHeight:L,event:S,topGridYCellHeight:I}=c,H=new Map,M=l(P);function T(){var o;if(!(null==(o=null==M?void 0:M.horizontal)?void 0:o.length))return;const n="horizontal";H.set(n,[]);const{horizontal:r}=M;let a=z+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:f={},data:u}=o;let h=null;u.forEach(((o,u)=>{const{time:m,value:g}=o,p=x(m);if(!B(p))return;const v=e(s,{...c,left:p,top:a}),k=p+v.width/2+2,y=i([k,a],{value:g,...f,originX:"left"}),X=new t.Group([v,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:p,iconHalfWidth:v.width/2,origin:{type:"other",key:n,dataIndex:r,index:u,data:o,title:l},limitX:{x1:E,x2:C-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),H.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==M?void 0:M.vertical)?void 0:t.length))return;const i="vertical";H.set(i,[]);const{vertical:o}=M;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=z+w/2;r.forEach(((t,r)=>{const a=e(String(t),{...n,lockMovementY:!0,left:l,originX:"left",top:s,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});s+=w,O(a),H.get(i).push(a),d.value.add(a)}));const c=H.get(i).filter((t=>t.origin.dataIndex===o)),f=Math.max(...c.map((t=>t.width))),u=l>C-f;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=f,u&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=M[r],s=["mark"].includes(r)?l.dataList[i]:l[i];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=a(t,s.data),i=Array.isArray(o)?o:[o];s.data.splice(e,0,...i);break}}V(t)}function V(t){var e;const{key:i}=t;switch(null==(e=d.value)||e.remove(...H.get(i)),H.delete(i),i){case"horizontal":T();break;case"vertical":W();break;case"mark":G()}}function G(){if(!(null==P?void 0:P.mark)||!L)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=P.mark,a=i([E-5,A+L/2],{value:t,...o,originX:"right"});d.value.add(a);const l=A+L,s=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=x(i);if(!B(r))return;let a=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),c=o.height;a+c<=l&&a>=A?(o.set("top",a+c/2),a+=c):(i||(a=A,i=!0),o.set("top",a-c/2),a-=c),s.push(o),O(o),d.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:E,x2:C};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(S.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{u.show=!1}))),!S.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);if("mark"===t.origin.key){t.top<z&&t.set("top",z);const e=A+L-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){const e=t.left+t.maxTextWidth>C?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),S.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(u.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=k(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};d.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(h.point={x:t.left,y:t.top},h.show=!0,h.target=t,h.list=s.map((t=>({...t,renderItem:()=>t.label}))))}))}function q(t){var e;u.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},u.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&u.list.unshift(t.origin.data.name+" "),u.show=!0}function B(t){return t>=E&&t<=C}return function(){var t;if(!(null==(t=null==M?void 0:M.horizontal)?void 0:t.length))return;const{horizontal:i}=M,o=E-5;let n=z+w/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,s=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):u.show=!1})),c.on("mouseup:before",(t=>{if(u.show=!1,0===t.e.button&&b(c))if(y(H.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};f("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),T(),W(),G(),n.on((()=>{const t="horizontal",e=g(H.get(t));e.length>0?p((()=>{const i=function(t){const e=t.reduce(((t,e)=>{const{dataIndex:i}=e.origin;return t[i]=t[i]?t[i].concat(e.origin):[e.origin],t}),{});return Object.keys(e).map((t=>{const i=e[t];return M.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),f("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
|
package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as
|
|
1
|
+
import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as o}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as u}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import"../useEvent.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import{useTop as m}from"./useTop.js";import{useLeft as v}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as f}from"./useOther.js";function g(g,y,x,w,b,j){const C=n(),Y=e(),H=e(),S=e(),D=t((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=y.data.left.width)?e:0})),M=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),X=t((()=>s(y.data.top.treeData))),G=t((()=>y.data.top.tree.cellHeight)),V=t((()=>G.value*X.value)),k=t((()=>ee($("drug")||"top"))),P=t((()=>k.value+V.value)),L=t((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||u(new Date,"yyyy-MM-dd HH:mm:ss"))})),N=t((()=>{const e=d(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(M.value/t+1).map((r=>0===r?e.startTime:u(new Date(L.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),O=function(){const e=d(y.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=y.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const o={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);o.height=a*r,e(i.children,l+1)}else o.width=A.value-o.left;Object.assign(i,o)}))}(e),e}(),E=t((()=>ee($("xAxis")||"center"))),W=t((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),I=t((()=>ee($("intraoperatively")||"bottom"))),q=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),z=t((()=>I.value+(y.data.height-V.value-N.value.height-q.value))),B=t((()=>(W.value-A.value)/M.value)),F=t((()=>(z.value-I.value)/T.value)),J=t((()=>N.value.spaceTimeStamp/B.value)),K=t((()=>{const{scaleValues:e}=y.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>te("pulse"))),R=t((()=>te("temperature"))),U=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...o,...y.data.borderStyle},pointSelectionStyle:y.data.pointSelectionStyle||{},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(X),topGridYCellHeight:r(G),topGridOriginY:r(k),topGridEndY:r(P),treeData:O,xAxis:r(N),originYXAxis:r(E),startTime:r(L),timeXCell:r(J),gridXNumber:r(M),gridYNumber:r(T),xCellWidth:r(B),yCellHeight:r(F),originX:r(A),endX:r(W),originY:r(I),endY:r(z),markHeight:r(q),itemList:r(K),scaleValues:y.data.scaleValues,pulseYCell:r(Q),temperatureYCell:r(R),event:r(U),dialog:C});function $(e){let t="";return Object.entries(D.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function _(e){const t=D.value[e],a=N.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return y.data.height-V.value-a}}function ee(e){switch(e){case"top":return 0;case"center":return _("top");default:return _("top")+_("center")}}function te(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return F.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(g,Z,x,b);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:n,getContainPoints:o,showDialog:u,removeCurrentSelection:s}=h(g,Z,x,b,j);v(g,Z,x,b,a,r,i,n);const{clickMenu:d}=f(g,Z,x,b,j,a,o,u,s);H.value=e,S.value=e=>{const{item:a}=e;a.type&&p.map((e=>e.type)).includes(a.type)?d(e):t(e)}})),{propItems:Z,redrawPoints:H,select:Y,clickMenu:S}}export{g as useSurgicalAnesthesiaChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,d,u,m,h){const{cumputedX:p,getXValue:v}=a(d),{originX:g,endX:x,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=d,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=E(n,e,i);n&&(n.set(f),n.origin={data:t},$(n),s&&(s.text=n),a&&(a.text=n))}return n}function E(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function M(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<g||s>x)return;const{lineStyle:d}=C.data||{};let u;const m={left:s,top:c};u=i?r("circle",{fill:d.stroke,...m}):n?r(">",{fill:d.stroke,...m,fontSize:18}):l([s,a,s,c],d);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([u,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,$(p),p}function $(t){I.hovered&&(t.on("mouseover",(()=>{W(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=E(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&W(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};u("change",e)}})))}function W(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...d,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],d=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,d],{value:t.slice(11,16)}))}));const u=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;u&&c.value.add(u);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([x+(w-x)/2,d],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:d,left:u,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[d,u]=f,m=d&&p(d),h=u&&p(u),v=M({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=M({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<g)&&(L||h>x)){X=l([v?m:g,o,L?h:x,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:g,x2:l?l.left:x};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:g,x2:x};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=x+(w-x)/2,l=e([o,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle}),r=w-Y.strokeWidth;o+l.width>r&&l.set({originX:"right",left:r});l&&c.value.add(l)}(i)),s.push(o({width:a,height:d,...Y},v,{left:u,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"vue";import"./useShadow.js";import"naive-ui";function o(o,s){const{xScaleList:a,originX:
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawTextGroup as e,defaultTextStyle as i,defaultStyle as n}from"../useDraw.js";import"date-fns";import"lodash-es";import"../useEvent.js";import"vue";import"./useShadow.js";import"naive-ui";function o(o,s){const{xScaleList:a,originX:r,endX:l,endY:h,xCellWidth:c,canvasWidth:d,canvasHeight:u,bottom:p,breathingHeight:g,iconsWidth:m,borderStyle:f}=s;!function(){var s,d,u;if(!g||!p){const e=new t.Line([m,h-1,l,h-1],f);return o.value.add(e),e.sendToBack(),!1}const v=g,b=(null==(s=p.breathing)?void 0:s.list)||[],w=[];let j=!0;a.forEach(((t,n)=>{const o=r+n*c;let s="";b.forEach(((e,i)=>{const n=new Date(e.time).getTime();n>=t&&n<+t+t.scaleCell&&(s=e.value)}));const a=j?{top:-(v/2-10)}:{top:v/2-10};s&&(j=!j);const l=e({width:c,height:v,...f},Object.assign({},{text:String(s),...i},s?a:{}),{left:o,top:h});w.push(l)}));const x=e({width:l,height:v,...f},{text:String((null==(d=p.breathing)?void 0:d.title)+(null==(u=p.breathing)?void 0:u.unit)),...i,left:-(l-r)/2},{left:0,top:h});w.push(x);const S=w.length>0?new t.Group([...w],{...n}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useBottom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as g,deleteProperty as v}from"../../utils/index.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.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]);r.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),v()}}else p?(l.push(p),v()):f?(r.push(f),v()):v()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:g={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...v.line,...n}),j=o((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:l,...v.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:g={},title:v="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...g}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:v,key:m||"",unit:s.unit,type:c,_type:d(v,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(v.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B: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,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.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&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=g(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.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}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=v(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
|
|
1
|
+
import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import"date-fns";import{isOneLine as a,getType as u,isOverlapPoint as c,isValidValue as p,setOtherType as d,isEffectiveNode as f,getTime as h,getIndex as v,deleteProperty as g}from"../../utils/index.js";import"../useEvent.js";import{useCommon as y}from"../useCommon.js";import"vue";import{cloneDeep as m}from"lodash-es";import"naive-ui";import{TEMPERATURE_MENU as x,PAIN_MENU as b,OVERLAP as j}from"../../constants/index.js";function L(L,k,S,Y,E,M,$,O,P,A){s(L,k);const{getEqualXTypes:C,handleAddPrevent:I}=y(L,S,k),{createShadowLines:T}=t(),{left:R,xScaleList:X,xCellWidth:F,yCellHeight:z,originX:D,endX:V,originY:_,endY:G,itemList:H,event:W,vitalSignsOriginY:q,painOriginY:B,hospitalizationDate:J,config:K,canvasHeight:N}=k,Q=new Set,U=["xinmai","mai"],Z=new Map,ee=new Set,te=new Set,ie=new Set,ne=m(R.yScaleValue);function oe(t){var o;const l=ne.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(Q.size&&L.value.remove(...Q),Q.clear(),Z.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=Z.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of Z)t.push(e[1]),e[0]===U[0]&&e[1].forEach((e=>{(Z.get(U[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],r=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),s=o.findIndex((e=>e[0]===t)),a=n[i],u=o[s],c=n[i-1],p=n[i+1],d=o[s-1],f=o[s+1];if(c&&d){if(c[0]!==d[0]){const e=Math.max(c[0],d[0]);l.push([c,d].find((t=>t[0]===e)))}}else c?l.push(c):d&&r.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);r.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...r.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],r=[]};if(p&&f){if(p[0]!==f[0]){const e=Math.min(p[0],f[0]);l.push([p,f].find((t=>t[0]===e))),g()}}else p?(l.push(p),g()):f?(r.push(f),g()):g()})),e}(),{mode:r,style:s={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...s,strokeWidth:1});if(["slash","line"].includes(r)){l.set({fill:"transparent",stroke:s.stroke||"#f00"});const e=[];if(["slash"].includes(r))e.push(...T(t,s._angle,s.space)),e.forEach((e=>{Object.assign(e,{...n,...s}),Q.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...t.flat()],{...s,originX:"center"});e.push(n),Q.add(n)}))}L.value.add(...e)}Q.add(l),L.value.add(l)}))}}function le(){var e;const t=ne.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},j,R.overlap||{}),l=[];ee.size&&[...ee].forEach((e=>{[...te].forEach((t=>{if(t.origin&&c(e,t)){const e=t.origin.key;if(e){const r={left:t.left,top:t.top,...n,hoverCursor:"default"};let s="koumai";"yemai"===e&&(s=e),"humai"===e&&(s="circle"),l.push(o(s,{...i[e]||{},...r}))}}}))})),setTimeout((()=>{L.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ie.add(e)}))}))}function re(e,t,s){var u;const{type:c,riseStyle:f={},noRiseStyle:h={},verifiedStyle:v={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:x={},nonePainPointStyle:b={},dataList:j=[]}=s,{type:Y,textStyle:M,showConnectLine:O=!1}=b,A=[],C=[],I=[];null==(u=e.list)||u.forEach(((u,b)=>{const T=a(c)?j.find((e=>e.key===u.key)):e,R=ue(u,s),X={};X.value=function(e,t,i){if(!(null==e?void 0:e.length)||!K.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=q.originY+z?e[1]+z:e[1]-z,r=l([e[0],o],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return I.push(r),{obj:r,top:-z}}(R,u,T),function(e,t,s,a,u){var d,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(c))return;const{lineAttr:m={}}=s,{value:x}=a;let b,j,L,k,S,Y;if(t.noRise&&h.show){const t=w(h)?E(u.type,u.list,35):e[1];if(h.text)L=l([e[0],w(h)?t:t+5],{value:h.text.split("").join("\n"),originY:"top",...h.style||{}}),I.push(L);else{const i=t+2*z;k=r([e[0],t,i],h.style||{}),I.push(k)}}t.rise&&f.show&&f.text&&(S=l([e[0],e[1]-(x?z:0)-5],{value:f.text.split("").join("\n"),originY:"bottom",...f.style||{}}),I.push(S));t.verified&&(Y=l([e[0],e[1]-(x?z:0)-5],{value:"v",originX:"center",originY:"bottom",...v}),I.push(Y));if(p(t.physicsReduce)||p(t.drugReduce)){const l=E(c,u.list,null!=(d=t.physicsReduce)?d:t.drugReduce);b=i([...e,e[0],l],{...m,...g.line,...n}),j=o((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:l,...g.point,...n,originY:l===N?"bottom":"center"}),b&&I.push(b),j&&I.push(j)}Object.assign(a,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5,isFixed:w(h)},arrowGroup:{obj:k,top:2*z,isFixed:w(h)},riseText:{obj:S,top:(x?-z:0)-5},verifiedText:{obj:Y,top:(x?-z:0)-5},reducePoint:{obj:j,type:"reduce"}})}(R,u,T,X,s),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(c))return;let o,a;const{upArrowShow:u=!1,limitValueShow:p=!1}=i;if(u&&+t.value>180){let t=e[1]-2.5*z,i=[e[1]-z/2,t];t<q.originY&&(t=e[1]+2.5*z,i=[t,e[1]+z/2]),o=r([e[0],i[0],i[1]],m,"up"),I.push(o)}if(p){const i={value:t.value,originX:"center",originY:"center",...x};if(+t.value>Math.max(...s.list)){const t=o?e[1]+z/2+o.height:e[1]+z;a=l([e[0],t],i),I.push(a)}+t.value<Math.min(...s.list)&&(a=l([e[0],e[1]-z],i),I.push(a))}Object.assign(n,{upArrow:{obj:o},limitValue:{obj:a,top:-z}})}(R,u,T,X),function(n,l,r,a,u){let p,f;const{pointAttr:h={},lineAttr:v={},title:g="",key:m,type:x="circle"}=a,b=e.list[r+1],j=ue(b,s),w=se(c,e.list[r].value),E=j&&se(c,b.value);n&&j&&!l.breakpoint&&(!w&&!E||O)&&n[0]!==j[0]&&(f=i([...n,...j],{...v}));const I=l.pacemakerShow&&"pulse"==c?y.value:w&&"number"===Y?0:x,T=C[r-1],R={origin:{data:l,title:g,key:m||"",unit:s.unit,type:c,_type:d(g,c),dataIndex:t,index:r},leftLine:T,rightLine:f,otherObj:u,lockMovementX:!0,...l.pacemakerShow&&"pulse"==c?y.style:h,...k.event.hovered?k.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:k.event,...w?{selectable:!1,evented:!1,..."number"===Y?M:{}}:{}};if(T){const e=T.get("y2");p=o(I,{left:T.get("x2"),top:w?e-5:e,...R})}else n&&(R.leftLine=null,p=o(I,{left:n[0],top:w?n[1]-5:n[1],...R}));C.push(f),p&&(g.includes("脉搏")?ee.add(p):te.add(p),function(e){W.hovered&&(e.on("mouseover",(()=>{ae(e,"hover")})),e.on("mouseout",(()=>{P.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?B: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,isFixed:l}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):!l&&(null==i||i.setCoords().set({left:e.left,top:e.top+o})))})),oe(e)}(e),W.hovered&&ae(e)})),e.on("mouseup",(t=>{if(P.show=!1,1===t.button){const{type:t}=e.origin,i=$(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};L.value.discardActiveObject(),S("change",n),pe(n,"change")}}))}(p),A.push(p),ie.add(p))}(R,u,b,T,X)})),"pulse"===c&&U.forEach((e=>{Z.set(e,A.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all(A).then((e=>{const t=C.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(I).then((i=>{L.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&&L.value.remove(e.leftLine),e.rightLine&&L.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function ae(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;P.point={x:e.left,y:e.top},P.list=[function(){const{drugReduce:r,physicsReduce:s}=l||{},a="hover"===t?l.value:$(o,e.top);if(p(r))return`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(p(s))return`物理降${"pain"==o?"痛":"温"} ${a}—>${s}${n||""}`;return`${i} ${a}${n||""}`}(),`时间 ${((null==l?void 0:l.time)||M(e.left)).slice(-5)}`],P.show=!0}function ue(e,t){const i="pain"===t.type?B:q;if(f(e)&&function(e){const[t]=X,i=X.at(-1),n=t.start,o=i.end,l=h(e);return l>=n&&l<=o}(e.time)){const n=Y(e.time),o=E(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ce(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=h(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=h(`${M(e)}:00`);return J&&l<h(J)?(I("exceedMin"),!1):!(l>o)||(I("exceedMax"),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:r}=e,s=ne.find((e=>e.type===i));if("add"===t){const e=a(i)?s.dataList.find((e=>e.enable)):s.dataList[n],t=v(l.time,e.list);e.list.splice(t,0,l)}else s.dataList[n].list[o]=l;de()}function de(){var e;ie.size&&(null==(e=L.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}([...ie]))),Z.clear(),ie.clear(),ee.clear(),te.clear(),ne.forEach((e=>{e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le()}return Z.clear(),ee.clear(),te.clear(),ne.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const t=E(e.type,e.list,e.positionLine.value),n=i([D,t,V,t],e.positionLine);L.value.add(n)}(e),e.dataList.forEach(((t,i)=>{a(e.type)&&!t.enable||re(t,i,e)}))})),oe(),le(),k.event.evented&&L.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=D&&i<=V&&n>=_&&n<=G){A.point={x:i,y:n},A.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&(A.list=[...x]),"pain"===o&&(A.list=[...b]),A.target=e.target;else{A.target=null,A.list=["新增节点"],H.forEach((t=>{if(!C([...ie],i,"_type").includes(t.bigType)){const i=["pain"].includes(t.bigType)?B:q;n>=i.originY&&n<=i.endY&&A.list.push({renderItem:O?O(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:u(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ce(i);t&&1!==A.list.length||(A.show=!1,1===A.list.length&&t&&I("repeat"))}}}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,r=g(i,[...x,...b]);r[`${e.type}`]=e.value,a(n)&&(r.key=t.origin.key);const s={...t.origin,data:r};S("change",s),pe(s,"change")}else{const t={data:{time:M(e.pointer.x),value:$(e.origin.type,e.pointer.y),...a(e.origin.type)?{key:e.origin.key}:{}},...e.origin};S("add",t),pe(t)}},setPopup:ae,isAddPoint:ce,updateData:pe,redrawPoints:de,gridPoints:ie}}function w(e){return"fixed"===e.position}export{L as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"naive-ui";function
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawTextAndIconGroup as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as s,isOneLine as r}from"../../utils/index.js";import"../useEvent.js";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as c}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";import"naive-ui";function p(p,g,d,f,m,y,v,w,S,Y,b,x){var j,X;const{getEqualXTypes:C,handleAddPrevent:N,isGridLimit:T}=c(p,d,g),{originY:V,endY:k,originX:E,endX:L,xCellWidth:M,yCellHeight:W,left:G,vitalSignsOriginY:O,painOriginY:A,painHeight:H,iconsWidth:I,itemList:R,painIndex:_,right:B,canvasWidth:J,canvasHeight:$,getRightInfo:q,borderStyle:D}=g;function P(o){var s;if(!(null==o?void 0:o.length))return;const{layout:r}=o[0];let c=I,g=E;"right"===r&&(c=L,g=L+(null!=(s=null==B?void 0:B.width)?s:0));const d=[],f=H&&"right"!==r?o.length-1:o.length,m=(g-c)/f,y=m+(g-c)%f;o.forEach(((o,s)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:s=5,showScale:r,showNumber:h,position:c,showMaxMinNumber:g,style:d,title:f}=n,m=l({width:E-I,height:H,...D},{value:`${f}`,...i,...d||{}},{left:I,top:A.originY}),y=e([I,A.originY,E,A.originY],D),v=[];if(r||h){const{lineXMain:e,textLeft:i}=a(c,I,E-I),l=o.length;o.forEach(((o,a)=>{let c=A.endY-a*W*s;if(0===a&&(c=k-5),!h||(0===a||a===l-1)&&!g||v.push(u(o,n,i,c)),r&&0!==a){const[i,n]=e,o=new t.Line([i,c,n,c],{...D,...d});v.push(o)}}))}p.value.add(y,m,...v),m.sendToBack()}(o);const g=[],f=0===s?y:m,v=0===s?c:y+c+(s-1)*m,w="right"===r?0:O.originY,S="right"===r?$:O.endY,Y=s>0?e([v,w,v,S],{objectCaching:!1,...D}):null;Y&&g.push(Y);const b=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:X,showNumber:C,position:N,showMaxMinNumber:T}=o;if(X||C){const{lineXMain:t,lineXSub:e,textLeft:i}=a(N,v,f),n=x.length;x.forEach(((l,s)=>{const r=O.endY-s*W*j;if(C&&(!(0===s||s===n-1)||T)){const t=0==s?r-5:r,e=u(l,o,i,t),n=O.originY+e.height/2;t<n&&e.set({top:n}),g.push(e)}g.push(...h(o,s,t,e,r,W,O.originY))}))}let V=o.title||"";o.unit&&(V+="\n"+o.unit),V&&g.push(new t.Text(String(V),{...i,left:b,top:O.originY+W*j/2,textAlign:"center",...o.style}));const L=new t.Group(g,{...n,objectCaching:!1});d.push(L)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&p.value.add(v),v&&v.sendToBack()}I&&function(){const t=JSON.parse(JSON.stringify(R));let e=k;const i=I-G.icons.marginRight;t.reverse().forEach((t=>{e-=10;let n=t.title.replace(/(.{2})/g,"$1\n");n.endsWith("\n")&&(n=n.slice(0,n.length-1));const{text:l,icon:a}=o(n,t,{text:{left:i-(t.pointAttr.width||10)-5,top:e,originX:"right"},icon:{originX:"right",left:i,topY:e,origin:{type:s(t.bigType),_type:t.bigType},...g.event}});var u;e-=l.height||30,(u=a).on("moving",(()=>{u.set("originX","center"),function(t){if(t.left>=E&&t.left<=L){t.setCoords();const e="pain"===t.origin.type?A:O;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(u),T(u)?f(u):m.show=!1})),u.on("mouseup:before",(t=>{if(m.show=!1,0===t.e.button&&T(u)){const t=C([...x],u.left,"_type").includes(u.origin._type),e=Y(u.left);if(!e||t)t&&e&&N("repeat");else{const t={data:{time:w(u.left),value:S(u.origin.type,u.top),...r(u.origin.type)?{key:u.origin.key}:{}},...u.origin};d("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(u)})),p.value.add(l,a)}))}();const z=G.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==B?void 0:B.width)&&"left"===(null==(j=null==B?void 0:B.yScaleValue)?void 0:j.layout)&&(null==(X=null==B?void 0:B.yScaleValue)?void 0:X.show)&&z.push(q),_>0&&G.yScaleValue[_].show){const t=G.yScaleValue[_];0===_&&G.yScaleValue.length>1&&z.unshift(t),_==G.yScaleValue.length-1&&z.push(t)}const F=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),K=z[F];return F>-1&&z.splice(F,0,{...K,title:(null==K?void 0:K.doubleTitle)||(null==K?void 0:K.title)}),P(z),p.value.add(new t.Rect({left:I,top:0,width:J-I-D.strokeWidth,height:$-D.strokeWidth,fill:"transparent",...D})),{drawScaleValue:P}}export{p as useLeft};
|