cnhis-design-vue 3.1.51-beta.1 → 3.1.51-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/es/components/callback/index.d.ts +69 -0
  2. package/es/components/callback/index.js +1 -0
  3. package/es/components/callback/src/components/dialog/drawer.vue.d.ts +353 -0
  4. package/es/components/callback/src/components/dialog/drawer.vue.js +1 -0
  5. package/es/components/callback/src/components/dialog/drawer.vue2.js +1 -0
  6. package/es/components/callback/src/components/dialog/modal.vue.d.ts +166 -0
  7. package/es/components/callback/src/components/dialog/modal.vue.js +1 -0
  8. package/es/components/callback/src/components/dialog/modal.vue2.js +1 -0
  9. package/es/components/callback/src/components/popup/index.vue.d.ts +48 -0
  10. package/es/components/callback/src/components/popup/index.vue.js +1 -0
  11. package/es/components/callback/src/components/render/drawerIframe/index.vue.d.ts +62 -0
  12. package/es/components/callback/src/components/render/drawerIframe/index.vue.js +1 -0
  13. package/es/components/callback/src/components/render/drawerIframe/index.vue2.js +1 -0
  14. package/es/components/callback/src/components/render/enums.d.ts +5 -0
  15. package/es/components/callback/src/components/render/enums.js +1 -0
  16. package/es/components/callback/src/components/render/index.vue.d.ts +57 -0
  17. package/es/components/callback/src/components/render/index.vue.js +1 -0
  18. package/es/components/callback/src/components/render/popupMaps.d.ts +5700 -0
  19. package/es/components/callback/src/components/render/popupMaps.js +1 -0
  20. package/es/components/callback/src/index.vue.d.ts +68 -0
  21. package/es/components/callback/src/index.vue.js +1 -0
  22. package/es/components/callback/src/index.vue2.js +1 -0
  23. package/es/components/callback/src/types/index.d.ts +11 -0
  24. package/es/components/callback/style/callback-iconfont.ttf +0 -0
  25. package/es/components/callback/style/index.css +1 -0
  26. package/es/components/expand-field/index.d.ts +0 -13
  27. package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +0 -13
  28. package/es/components/expand-field/src/components/PersonModal.vue.d.ts +0 -13
  29. package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -1
  30. package/es/components/expand-field/src/components/form.vue.d.ts +0 -13
  31. package/es/components/expand-field/src/index.vue.d.ts +0 -13
  32. package/es/components/expand-field/src/index.vue2.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  35. package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +79 -2
  36. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  37. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +16 -10
  38. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  39. package/es/components/index.css +1 -1
  40. package/es/components/index.d.ts +3 -3
  41. package/es/components/index.js +1 -1
  42. package/es/components/scale-view/src/hooks/use-component.d.ts +615 -255
  43. package/es/components/select-label/index.d.ts +617 -256
  44. package/es/components/select-label/index.js +1 -1
  45. package/es/components/{iho-select-label/src/LabelFormContent.vue.d.ts → select-label/src/ihoLabel/IhoLabelFormContent.vue.d.ts} +5 -5
  46. package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue.js +1 -0
  47. package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue2.js +1 -0
  48. package/es/components/{iho-select-label/src/SelectLabel.vue.d.ts → select-label/src/ihoLabel/IhoSelectLabel.vue.d.ts} +7 -7
  49. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue.js +1 -0
  50. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -0
  51. package/es/components/{iho-select-label/src/components/label-classify.vue.d.ts → select-label/src/ihoLabel/iho-label-classify.vue.d.ts} +1 -1
  52. package/es/components/select-label/src/ihoLabel/iho-label-classify.vue.js +1 -0
  53. package/es/components/select-label/src/ihoLabel/iho-label-classify.vue2.js +1 -0
  54. package/es/components/select-label/src/index.vue.d.ts +899 -0
  55. package/es/components/select-label/src/index.vue.js +1 -0
  56. package/es/components/select-label/src/index.vue2.js +1 -0
  57. package/es/components/select-label/src/types/index.js +1 -0
  58. package/es/shared/package.json.js +1 -1
  59. package/es/shared/utils/index.d.ts +3 -3
  60. package/package.json +2 -2
  61. package/es/components/iho-select-label/index.d.ts +0 -363
  62. package/es/components/iho-select-label/index.js +0 -1
  63. package/es/components/iho-select-label/src/LabelFormContent.vue.js +0 -1
  64. package/es/components/iho-select-label/src/LabelFormContent.vue2.js +0 -1
  65. package/es/components/iho-select-label/src/SelectLabel.vue.js +0 -1
  66. package/es/components/iho-select-label/src/SelectLabel.vue2.js +0 -1
  67. package/es/components/iho-select-label/src/components/label-classify.vue.js +0 -1
  68. package/es/components/iho-select-label/src/components/label-classify.vue2.js +0 -1
  69. package/es/components/iho-select-label/style/iho-select-label-iconfont.ttf +0 -0
  70. package/es/components/iho-select-label/style/index.css +0 -1
  71. /package/es/components/{iho-select-label → callback}/src/types/index.js +0 -0
  72. /package/es/components/{iho-select-label → select-label}/src/types/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ import{CallbackTypeEnums as o}from"./enums.js";import e from"../../../../form-render/index.js";import r from"../../../../iho-table/index.js";import p from"./drawerIframe/index.vue.js";const m=new Map([[o.FORM,{component:e,props:{consumer:!0},style:{}}],[o.TABLE_LIST,{component:r,props:{},style:{}}],[o.PAGE,{component:p,props:{clearable:!0,options:[],filterable:!0,multiple:!1}}]]);export{m as CallbackMaps};
@@ -0,0 +1,68 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ config: {
3
+ type: ObjectConstructor;
4
+ };
5
+ callbackApiConfig: {
6
+ type: ObjectConstructor;
7
+ };
8
+ }, {
9
+ emit: (event: "closeModal", ...args: any[]) => void;
10
+ closeModal: (bool: boolean) => void;
11
+ CallbackPopup: import("vue").DefineComponent<{
12
+ options: {
13
+ type: ObjectConstructor;
14
+ default: () => {
15
+ visible: boolean;
16
+ type: string;
17
+ code: string;
18
+ targetId: string;
19
+ targetName: string;
20
+ openWindowType: string;
21
+ params: string;
22
+ page: string;
23
+ };
24
+ };
25
+ callbackApiConfig: {
26
+ type: ObjectConstructor;
27
+ };
28
+ }, any, {
29
+ initialProps: {};
30
+ dialogVisible: any;
31
+ }, {}, {
32
+ generateModal(cfg: any): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
33
+ [key: string]: any;
34
+ }>;
35
+ onClose(): Promise<void>;
36
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "closeModal"[], "closeModal", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
37
+ options: {
38
+ type: ObjectConstructor;
39
+ default: () => {
40
+ visible: boolean;
41
+ type: string;
42
+ code: string;
43
+ targetId: string;
44
+ targetName: string;
45
+ openWindowType: string;
46
+ params: string;
47
+ page: string;
48
+ };
49
+ };
50
+ callbackApiConfig: {
51
+ type: ObjectConstructor;
52
+ };
53
+ }>> & {
54
+ onCloseModal?: ((...args: any[]) => any) | undefined;
55
+ }, {
56
+ options: Record<string, any>;
57
+ }>;
58
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "closeModal"[], "closeModal", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
59
+ config: {
60
+ type: ObjectConstructor;
61
+ };
62
+ callbackApiConfig: {
63
+ type: ObjectConstructor;
64
+ };
65
+ }>> & {
66
+ onCloseModal?: ((...args: any[]) => any) | undefined;
67
+ }, {}>;
68
+ export default _default;
@@ -0,0 +1 @@
1
+ import e from"./index.vue2.js";import r from"../../../_virtual/_plugin-vue_export-helper.js";var i=r(e,[["__file","index.vue"]]);export{i as default};
@@ -0,0 +1 @@
1
+ import{defineComponent as o,openBlock as e,createBlock as i}from"vue";import n from"./components/popup/index.vue.js";var p=o({__name:"index",props:{config:{type:Object},callbackApiConfig:{type:Object}},emits:["closeModal"],setup(o,{emit:p}){function l(o){p("closeModal",o)}return(p,c)=>(e(),i(n,{options:o.config,callbackApiConfig:o.callbackApiConfig,onCloseModal:l},null,8,["options","callbackApiConfig"]))}});export{p as default};
@@ -0,0 +1,11 @@
1
+ export declare type ICallbackConfigType = {
2
+ visible: boolean;
3
+ type: string;
4
+ code: string;
5
+ targetId: string;
6
+ targetName: string;
7
+ openWindowType: string;
8
+ params: string;
9
+ page: string;
10
+ name: string;
11
+ };
@@ -0,0 +1 @@
1
+ @font-face{font-family:callback-iconfont;src:url(callback-iconfont.ttf) format("truetype")}.iconfont-callback{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;cursor:pointer;font-family:callback-iconfont!important;font-size:16px;font-style:normal}.icon-callback-menzhenyishengzhanxitongtubiaoguanbi:before{content:"\e76e"}.icon-callback-menzhenyishengzhanxitongtubiaozuixiaohua:before{content:"\e778"}.icon-callback-menzhenyishengzhanxitongtubiaozuidahua:before{content:"\e779"}.callback-drawer-block .n-drawer-header .n-drawer-header__main{width:100%}.callback-drawer-block .n-drawer-header .n-drawer-header__main .d-header{align-items:center;display:flex;justify-content:space-between;width:100%}.callback-drawer-block .n-drawer-header .n-drawer-header__main .d-header .title{font-size:18px;margin:0;padding:0}
@@ -774,10 +774,6 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
774
774
  type: BooleanConstructor;
775
775
  default: boolean;
776
776
  };
777
- orgId: {
778
- type: StringConstructor;
779
- default: string;
780
- };
781
777
  defaultList: {
782
778
  type: import("vue").PropType<string[]>;
783
779
  default: () => never[];
@@ -792,10 +788,6 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
792
788
  type: BooleanConstructor;
793
789
  default: boolean;
794
790
  };
795
- orgId: {
796
- type: StringConstructor;
797
- default: string;
798
- };
799
791
  defaultList: {
800
792
  type: import("vue").PropType<string[]>;
801
793
  default: () => never[];
@@ -1522,10 +1514,6 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1522
1514
  type: BooleanConstructor;
1523
1515
  default: boolean;
1524
1516
  };
1525
- orgId: {
1526
- type: StringConstructor;
1527
- default: string;
1528
- };
1529
1517
  defaultList: {
1530
1518
  type: import("vue").PropType<string[]>;
1531
1519
  default: () => never[];
@@ -1541,7 +1529,6 @@ declare const ExpandField: SFCWithInstall<import("vue").DefineComponent<{
1541
1529
  visible: boolean;
1542
1530
  defaultList: string[];
1543
1531
  treeData: import("../../../es/shared/types").AnyObject[];
1544
- orgId: string;
1545
1532
  }>;
1546
1533
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "checkPerson"[], "checkPerson", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1547
1534
  defaultValue: {
@@ -56,10 +56,6 @@ declare const _default: import("vue").DefineComponent<{
56
56
  type: BooleanConstructor;
57
57
  default: boolean;
58
58
  };
59
- orgId: {
60
- type: StringConstructor;
61
- default: string;
62
- };
63
59
  defaultList: {
64
60
  type: PropType<string[]>;
65
61
  default: () => never[];
@@ -74,10 +70,6 @@ declare const _default: import("vue").DefineComponent<{
74
70
  type: BooleanConstructor;
75
71
  default: boolean;
76
72
  };
77
- orgId: {
78
- type: StringConstructor;
79
- default: string;
80
- };
81
73
  defaultList: {
82
74
  type: PropType<string[]>;
83
75
  default: () => never[];
@@ -804,10 +796,6 @@ declare const _default: import("vue").DefineComponent<{
804
796
  type: BooleanConstructor;
805
797
  default: boolean;
806
798
  };
807
- orgId: {
808
- type: StringConstructor;
809
- default: string;
810
- };
811
799
  defaultList: {
812
800
  type: PropType<string[]>;
813
801
  default: () => never[];
@@ -823,7 +811,6 @@ declare const _default: import("vue").DefineComponent<{
823
811
  visible: boolean;
824
812
  defaultList: string[];
825
813
  treeData: import("../../..").AnyObject[];
826
- orgId: string;
827
814
  }>;
828
815
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "checkPerson"[], "checkPerson", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
829
816
  defaultValue: {
@@ -5,10 +5,6 @@ declare const _default: import("vue").DefineComponent<{
5
5
  type: BooleanConstructor;
6
6
  default: boolean;
7
7
  };
8
- orgId: {
9
- type: StringConstructor;
10
- default: string;
11
- };
12
8
  defaultList: {
13
9
  type: PropType<string[]>;
14
10
  default: () => never[];
@@ -23,10 +19,6 @@ declare const _default: import("vue").DefineComponent<{
23
19
  type: BooleanConstructor;
24
20
  default: boolean;
25
21
  };
26
- orgId: {
27
- type: StringConstructor;
28
- default: string;
29
- };
30
22
  defaultList: {
31
23
  type: PropType<string[]>;
32
24
  default: () => never[];
@@ -753,10 +745,6 @@ declare const _default: import("vue").DefineComponent<{
753
745
  type: BooleanConstructor;
754
746
  default: boolean;
755
747
  };
756
- orgId: {
757
- type: StringConstructor;
758
- default: string;
759
- };
760
748
  defaultList: {
761
749
  type: PropType<string[]>;
762
750
  default: () => never[];
@@ -772,6 +760,5 @@ declare const _default: import("vue").DefineComponent<{
772
760
  visible: boolean;
773
761
  defaultList: string[];
774
762
  treeData: AnyObject[];
775
- orgId: string;
776
763
  }>;
777
764
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as a,openBlock as o,createBlock as t,unref as i,isRef as l,withCtx as n,createVNode as d,createElementVNode as r,createTextVNode as s}from"vue";import{NModal as u,NCard as p,NButton as c}from"naive-ui";import f from"../../../select-person/index.js";const _={class:"flex_right"};var m=e({__name:"PersonModal",props:{visible:{type:Boolean,default:!1},orgId:{type:String,default:""},defaultList:{type:Array,default:()=>[]},treeData:{type:Array,default:()=>[]}},emits:["check","changeModalVisible"],setup(e,{emit:m}){const b=a({parent_id_obj:"id",parent_id_obj_key:"id",parent_name_obj:"name",parent_name_obj_key:"name",user_count_obj:"count"}),h={user_id_obj:"id",user_id_obj_key:"id",user_name_obj:"name",user_name_obj_key:"name"},g=a([]),v=a([]);function k(){m("check",v.value),g.value=[],x()}function x(){m("changeModalVisible")}function y(e){const a=e.map((e=>e.originItem));a.forEach((e=>{e.parentNode&&delete e.parentNode})),v.value=a}return(a,m)=>(o(),t(i(u),{class:"expand-field-modal-block expand-person-modal",show:e.visible,"onUpdate:show":m[0]||(m[0]=e=>l(visible)?visible.value=e:null),maskClosable:!1,width:"700px",bodyStyle:"height: 556px;maxHeight: 556px;",closable:!1,centered:"",onPositiveClick:k,onNegativeClick:x},{default:n((()=>[d(i(p),{style:{width:"700px",height:"556px",maxHeight:"556px"},title:"批量编辑",bordered:!1,size:"huge",role:"dialog","aria-modal":"true"},{"header-extra":n((()=>[r("div",{class:"svg-wrap"},[r("i",{onClick:x,class:"iconfont-expand-field icon-expand-field-menzhenyishengzhanxitongtubiaoguanbi"})])])),footer:n((()=>[r("div",_,[d(i(c),{onClick:x},{default:n((()=>[s("取消")])),_:1}),d(i(c),{type:"info",onClick:k},{default:n((()=>[s("保存")])),_:1})])])),default:n((()=>[d(i(f),{style:{padding:"0"},ref:"personRef",wordbook:b.value,wordbookChild:h,data:e.treeData,defaultList:e.defaultList,onCheckWithLevel:y},null,8,["wordbook","data","defaultList"])])),_:1})])),_:1},8,["show"]))}});export{m as default};
1
+ import{defineComponent as e,ref as a,openBlock as o,createBlock as t,unref as i,isRef as l,withCtx as n,createVNode as d,createElementVNode as r,createTextVNode as s}from"vue";import{NModal as u,NCard as p,NButton as c}from"naive-ui";import _ from"../../../select-person/index.js";const f={class:"flex_right"};var m=e({__name:"PersonModal",props:{visible:{type:Boolean,default:!1},defaultList:{type:Array,default:()=>[]},treeData:{type:Array,default:()=>[]}},emits:["check","changeModalVisible"],setup(e,{emit:m}){const b=a({parent_id_obj:"id",parent_id_obj_key:"id",parent_name_obj:"name",parent_name_obj_key:"name",user_count_obj:"count"}),h={user_id_obj:"id",user_id_obj_key:"id",user_name_obj:"name",user_name_obj_key:"name"},v=a([]),k=a([]);function x(){m("check",k.value),v.value=[],g()}function g(){m("changeModalVisible")}function y(e){const a=e.map((e=>e.originItem));a.forEach((e=>{e.parentNode&&delete e.parentNode})),k.value=a}return(a,m)=>(o(),t(i(u),{class:"expand-field-modal-block expand-person-modal",show:e.visible,"onUpdate:show":m[0]||(m[0]=e=>l(visible)?visible.value=e:null),maskClosable:!1,width:"700px",bodyStyle:"height: 556px;maxHeight: 556px;",closable:!1,centered:"",onPositiveClick:x,onNegativeClick:g},{default:n((()=>[d(i(p),{style:{width:"700px",height:"556px",maxHeight:"556px"},title:"批量编辑",bordered:!1,size:"huge",role:"dialog","aria-modal":"true"},{"header-extra":n((()=>[r("div",{class:"svg-wrap"},[r("i",{onClick:g,class:"iconfont-expand-field icon-expand-field-menzhenyishengzhanxitongtubiaoguanbi"})])])),footer:n((()=>[r("div",f,[d(i(c),{onClick:g},{default:n((()=>[s("取消")])),_:1}),d(i(c),{type:"info",onClick:x},{default:n((()=>[s("保存")])),_:1})])])),default:n((()=>[d(i(_),{style:{padding:"0"},ref:"personRef",wordbook:b.value,wordbookChild:h,data:e.treeData,defaultList:e.defaultList,onCheckWithLevel:y},null,8,["wordbook","data","defaultList"])])),_:1})])),_:1},8,["show"]))}});export{m as default};
@@ -669,10 +669,6 @@ declare const _default: import("vue").DefineComponent<{
669
669
  type: BooleanConstructor;
670
670
  default: boolean;
671
671
  };
672
- orgId: {
673
- type: StringConstructor;
674
- default: string;
675
- };
676
672
  defaultList: {
677
673
  type: import("vue").PropType<string[]>;
678
674
  default: () => never[];
@@ -687,10 +683,6 @@ declare const _default: import("vue").DefineComponent<{
687
683
  type: BooleanConstructor;
688
684
  default: boolean;
689
685
  };
690
- orgId: {
691
- type: StringConstructor;
692
- default: string;
693
- };
694
686
  defaultList: {
695
687
  type: import("vue").PropType<string[]>;
696
688
  default: () => never[];
@@ -1417,10 +1409,6 @@ declare const _default: import("vue").DefineComponent<{
1417
1409
  type: BooleanConstructor;
1418
1410
  default: boolean;
1419
1411
  };
1420
- orgId: {
1421
- type: StringConstructor;
1422
- default: string;
1423
- };
1424
1412
  defaultList: {
1425
1413
  type: import("vue").PropType<string[]>;
1426
1414
  default: () => never[];
@@ -1436,7 +1424,6 @@ declare const _default: import("vue").DefineComponent<{
1436
1424
  visible: boolean;
1437
1425
  defaultList: string[];
1438
1426
  treeData: AnyObject[];
1439
- orgId: string;
1440
1427
  }>;
1441
1428
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "checkPerson"[], "checkPerson", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1442
1429
  defaultValue: {
@@ -776,10 +776,6 @@ declare const _default: import("vue").DefineComponent<{
776
776
  type: BooleanConstructor;
777
777
  default: boolean;
778
778
  };
779
- orgId: {
780
- type: StringConstructor;
781
- default: string;
782
- };
783
779
  defaultList: {
784
780
  type: PropType<string[]>;
785
781
  default: () => never[];
@@ -794,10 +790,6 @@ declare const _default: import("vue").DefineComponent<{
794
790
  type: BooleanConstructor;
795
791
  default: boolean;
796
792
  };
797
- orgId: {
798
- type: StringConstructor;
799
- default: string;
800
- };
801
793
  defaultList: {
802
794
  type: PropType<string[]>;
803
795
  default: () => never[];
@@ -1524,10 +1516,6 @@ declare const _default: import("vue").DefineComponent<{
1524
1516
  type: BooleanConstructor;
1525
1517
  default: boolean;
1526
1518
  };
1527
- orgId: {
1528
- type: StringConstructor;
1529
- default: string;
1530
- };
1531
1519
  defaultList: {
1532
1520
  type: PropType<string[]>;
1533
1521
  default: () => never[];
@@ -1543,7 +1531,6 @@ declare const _default: import("vue").DefineComponent<{
1543
1531
  visible: boolean;
1544
1532
  defaultList: string[];
1545
1533
  treeData: AnyObject[];
1546
- orgId: string;
1547
1534
  }>;
1548
1535
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "checkPerson"[], "checkPerson", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1549
1536
  defaultValue: {
@@ -1 +1 @@
1
- import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createCommentVNode as o,createVNode as s,unref as r,withCtx as d,Fragment as c,renderList as u,createTextVNode as m,toDisplayString as p,createBlock as f,withModifiers as v}from"vue";import{useMessage as h,NGrid as _,NGridItem as g,NTooltip as y,NIcon as k,NPopconfirm as C,NButton as x}from"naive-ui";import{Brush as D}from"@vicons/ionicons5";import w from"./components/form.vue.js";import I from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as N}from"./constants/index.js";const b={class:"tableset-expand-field"},M={class:"list"},z={class:"table-modal-list"},A={class:"list-content"},S=n("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[n("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),n("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),j={class:"footer"};var F=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:F}){const O=t,V=h(),{deleteExtendFieldById:B}=I();e(N,O.expandFieldApiConfig);const E=[{title:"字段标题",columnName:"name",span:3},{title:"字段键名",columnName:"code",span:3},{title:"字段类型",columnName:"html_type",span:3},{title:"问号提示",columnName:"remark",span:4},{title:"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:"操作",columnName:"operator",span:3}],P=l(!1),L=l("add"),U=l({});function q(){F("closeModal")}function G(){P.value=!0,L.value="add",U.value={}}function H(){P.value=!1}return(e,l)=>(a(),i("div",b,[n("div",M,[n("div",z,[o(' <div class="list-title">\r\n\t\t\t\t\t<span class="list-title-item" v-for="titleItem in filedList" :key="titleItem.columnName">\r\n\t\t\t\t\t\t{{ titleItem.title }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</div> '),s(r(_),{cols:24,class:"list-title"},{default:d((()=>[(a(),i(c,null,u(E,(t=>s(r(g),{span:t.span,class:"list-title-item",key:t.columnName},{default:d((()=>[m(p(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),n("div",A,[(a(!0),i(c,null,u(t.tableData,((t,e)=>(a(),f(r(_),{key:e,class:"list-content-block"},{default:d((()=>[s(r(g),{span:3,title:t.name,class:"list-content-item"},{default:d((()=>[m(p(t.name),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.code,class:"list-content-item"},{default:d((()=>[m(p(t.code),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.html_type,class:"list-content-item"},{default:d((()=>[m(p(t.html_type),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.remark,class:"list-content-item"},{default:d((()=>[m(p(t.remark),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.createdDate,class:"list-content-item"},{default:d((()=>[m(p(t.createdDate),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.updatedDate,class:"list-content-item"},{default:d((()=>[m(p(t.updatedDate),1)])),_:2},1032,["title"]),s(r(g),{span:3,class:"list-content-item"},{default:d((()=>[s(r(y),{duration:0},{trigger:d((()=>[s(r(k),{component:r(D),onClick:v((e=>{return l=t,P.value=!0,L.value="edit",void(U.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:d((()=>[m(" 编辑 ")])),_:2},1024),s(r(y),{duration:0},{trigger:d((()=>[s(r(C),{onPositiveClick:e=>async function(t){try{const e=await B(t,O.expandFieldApiConfig);if("SUCCESS"!==(null==e?void 0:e.result))return void V.error((null==e?void 0:e.resultMsg)||"删除失败");V.success("删除成功")}catch(t){V.error(t)}}(t)},{trigger:d((()=>[s(r(k),null,{default:d((()=>[S])),_:1})])),default:d((()=>[m(" 是否确认删除? ")])),_:2},1032,["onPositiveClick"])])),default:d((()=>[m(" 删除 ")])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),n("div",j,[s(r(x),{onClick:q},{default:d((()=>[m("取消")])),_:1}),s(r(x),{type:"info",onClick:G},{default:d((()=>[m("增加字段")])),_:1})])]),s(w,{visible:P.value,formItemData:U.value,formOntype:L.value,id:t.id,orgId:t.orgId,onCancelModal:H},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{F as default};
1
+ import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createVNode as o,unref as s,withCtx as r,Fragment as d,renderList as c,createTextVNode as u,toDisplayString as m,createBlock as p,withModifiers as f}from"vue";import{useMessage as v,NGrid as h,NGridItem as _,NTooltip as g,NIcon as y,NPopconfirm as C,NButton as k}from"naive-ui";import{Brush as x}from"@vicons/ionicons5";import D from"./components/form.vue.js";import w from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as b}from"./constants/index.js";const M={class:"tableset-expand-field"},N={class:"list"},I={class:"table-modal-list"},z={class:"list-content"},A=n("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[n("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),n("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),S={class:"footer"};var j=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:j}){const F=t,O=v(),{deleteExtendFieldById:V}=w();e(b,F.expandFieldApiConfig);const B=[{title:"字段标题",columnName:"name",span:3},{title:"字段键名",columnName:"code",span:3},{title:"字段类型",columnName:"html_type",span:3},{title:"问号提示",columnName:"remark",span:4},{title:"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:"操作",columnName:"operator",span:3}],E=l(!1),P=l("add"),U=l({});function q(){j("closeModal")}function G(){E.value=!0,P.value="add",U.value={}}function H(){E.value=!1}return(e,l)=>(a(),i("div",M,[n("div",N,[n("div",I,[o(s(h),{cols:24,class:"list-title"},{default:r((()=>[(a(),i(d,null,c(B,(t=>o(s(_),{span:t.span,class:"list-title-item",key:t.columnName},{default:r((()=>[u(m(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),n("div",z,[(a(!0),i(d,null,c(t.tableData,((t,e)=>(a(),p(s(h),{key:e,class:"list-content-block"},{default:r((()=>[o(s(_),{span:3,title:t.name,class:"list-content-item"},{default:r((()=>[u(m(t.name),1)])),_:2},1032,["title"]),o(s(_),{span:3,title:t.code,class:"list-content-item"},{default:r((()=>[u(m(t.code),1)])),_:2},1032,["title"]),o(s(_),{span:3,title:t.html_type,class:"list-content-item"},{default:r((()=>[u(m(t.html_type),1)])),_:2},1032,["title"]),o(s(_),{span:4,title:t.remark,class:"list-content-item"},{default:r((()=>[u(m(t.remark),1)])),_:2},1032,["title"]),o(s(_),{span:4,title:t.createdDate,class:"list-content-item"},{default:r((()=>[u(m(t.createdDate),1)])),_:2},1032,["title"]),o(s(_),{span:4,title:t.updatedDate,class:"list-content-item"},{default:r((()=>[u(m(t.updatedDate),1)])),_:2},1032,["title"]),o(s(_),{span:3,class:"list-content-item"},{default:r((()=>[o(s(g),{duration:0},{trigger:r((()=>[o(s(y),{component:s(x),onClick:f((e=>{return l=t,E.value=!0,P.value="edit",void(U.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:r((()=>[u(" 编辑 ")])),_:2},1024),o(s(g),{duration:0},{trigger:r((()=>[o(s(C),{onPositiveClick:e=>async function(t){try{const e=await V(t,F.expandFieldApiConfig);if("SUCCESS"!==(null==e?void 0:e.result))return void O.error((null==e?void 0:e.resultMsg)||"删除失败");O.success("删除成功")}catch(t){O.error(t)}}(t)},{trigger:r((()=>[o(s(y),null,{default:r((()=>[A])),_:1})])),default:r((()=>[u(" 确认要删除-"+m(t.name)+"吗? ",1)])),_:2},1032,["onPositiveClick"])])),default:r((()=>[u(" 删除 ")])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),n("div",S,[o(s(k),{onClick:q},{default:r((()=>[u("取消")])),_:1}),o(s(k),{type:"info",onClick:G},{default:r((()=>[u("增加字段")])),_:1})])]),o(D,{visible:E.value,formItemData:U.value,formOntype:P.value,id:t.id,orgId:t.orgId,onCancelModal:H},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{j as default};
@@ -1 +1 @@
1
- import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as o,drawPoint as i}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function y(y,g,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:w,getYValue:b}=r(g),{xCellWidth:A,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:I,event:T,scaleValues:M,xAxis:S,startTime:V,timeXCell:X,itemList:$,dialog:O}=g,Y=new Map,D=new Set,_=d(M);let N=[],z=null;const G=new Set;l(y,g);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:F}=s(y,h,g),{pause:R,resume:W}=v((()=>{!function(){for(const e of G)e.set("opacity",1===e.opacity?.5:1),y.value.renderAll()}()}),800);function B(){_.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:i,lineStyle:l}){if(!e||!n)return;const r=P(t.type,t.range,n),a=o([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${i} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),y.value.add(a)}a(n),a(i),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==z?void 0:z.areaPos))return[];const{startPos:t,endPos:n}=z.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:ae()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function Q(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){z&&y.value.remove(z),z=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];Y.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:o,type:i}=n.origin;o===t&&i===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,v,x=c;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:C="",key:K,type:j="circle"}=x,E=re(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(v=o([...e,...E],P));const I=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:I,rightLine:v,...L,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};I?d=i(j,{left:I.get("x2"),top:I.get("y2"),...M}):e&&(M.leftLine=null,d=i(j,{left:e[0],top:e[1],...M}));f.push(v),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){T.hovered&&(e.on("mouseover",(()=>{ie(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{le(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),T.hovered&&ie(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/A);if(o>t+A&&!e.nextPoint){if(0===N.length){ee(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+A*r;if(N.every((e=>e.left!==o))){const t=w(o),n=b(l.type,i);N.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),ee(e,[...e.prevPointer,o,i])}N.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+A*l,r=N.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=N.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=N[l-1]||{left:n,top:o},f=~~((r.left-(t-A))/A),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:w(t),value:b(i.type,a.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},N.splice(l,0,a),ee(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(N.length>0&&o<N[N.length-1].left){for(const e of D)e.left>o&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(N=N.filter((e=>e.left<=o)),0===N.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(N.length>0){const t=N.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:b(t,e.top)}};if(y.value.discardActiveObject(),N.length>0){const e=N.map((e=>e.data)),i=_.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),te({...o,data:e})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),te(o,"change")}}))}(d),null==(p=Y.get(c.key))||p.push(d))}(re(l,n),l,u,e)})),Promise.all(Y.get(e.key)).then((t=>{const n=f.filter((e=>e));F(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:o={}}=t.panicValue||{},{max:i={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:o},i){!t&&n&&o&&e.forEach((e=>{const t=e.origin.data.value;"max"===i&&t<n||"min"===i&&t>n||G.add(e)}))}r(n,"max"),r(o,"min"),r(i,"max"),r(l,"min")}(t,e)}))}function ee(e,t){const[,,n,i]=t;e.clone((l=>{l.set({left:n,top:i}),e.prevPointer=[n,i];const r=o(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function te(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:a}=e;const s=_.find((e=>e.type===r)),f=s.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":f.list.splice(i,n);break;case"change":f.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=u(e,f.list),n=Array.isArray(o)?o:[o];f.list.splice(t,0,...n);break}}ne({dataIndex:a,scaleValue:s})}function ne(e){var t,n,o;if(D.size&&(null==(t=y.value)||t.remove(...oe([...D]))),D.clear(),N=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=y.value)||n.remove(...oe(Y.get(i.key))),Y.delete(i.key),Z(i,t,o)}else Y.size&&(null==(o=y.value)||o.remove(...oe(ae()))),Y.clear(),B()}function oe(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 ie(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:b(o,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],k.show=!0}function le(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:K,o=e.nextPoint?e.nextPoint.left-t:j;e.top<E&&e.set("top",E),e.top>I&&e.set("top",I),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function re(e,t){if(c(e)&&function(e){const t=Date.parse(S.list.at(-1)),n=p(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),o=P(t.type,t.range,e.value);return[n,o<E?E:o>I?I:o]}}function ae(){return Array.from(Y.values()).flat()}return e((()=>{R()})),B(),function(){if(!T.evented)return;let e=!1,o={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=I)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=f(e.target);ae().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&x.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),$.forEach((n=>{J(ae(),t,"key",2*A).includes(n.linkKey||n.key)||x.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===x.list.length&&(x.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return te(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(z)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,o=t.pointer)})),y.value.on("mouse:move",(i=>{if(!e)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;z&&y.value.remove(z),z=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),z.areaPos={startPos:o,endPos:i.pointer},y.value.add(z)}))}(),{redrawPoints:ne,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),te(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:b(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),te({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:le,setPopup:ie,updateData:te,getGridPoints:ae,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{y as useCenter};
1
+ import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as o,drawPoint as i}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function y(y,g,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:w,getYValue:b}=r(g),{xCellWidth:A,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:I,event:T,scaleValues:M,xAxis:S,startTime:V,timeXCell:X,itemList:$,dialog:O}=g,Y=new Map,D=new Set,_=d(M);let z=[],N=null;const G=new Set;l(y,g);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:F}=s(y,h,g),{pause:R,resume:W}=v((()=>{!function(){if(!G.size)return;for(const e of G)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function B(){_.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:i,lineStyle:l}){if(!e||!n)return;const r=P(t.type,t.range,n),a=o([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${i} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),y.value.add(a)}a(n),a(i),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==N?void 0:N.areaPos))return[];const{startPos:t,endPos:n}=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:ae()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function Q(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){N&&y.value.remove(N),N=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];Y.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:o,type:i}=n.origin;o===t&&i===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,v,x=c;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:C="",key:K,type:j="circle"}=x,E=re(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(v=o([...e,...E],P));const I=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:I,rightLine:v,...L,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};I?d=i(j,{left:I.get("x2"),top:I.get("y2"),...M}):e&&(M.leftLine=null,d=i(j,{left:e[0],top:e[1],...M}));f.push(v),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){T.hovered&&(e.on("mouseover",(()=>{ie(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{le(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),T.hovered&&ie(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/A);if(o>t+A&&!e.nextPoint){if(0===z.length){ee(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+A*r;if(z.every((e=>e.left!==o))){const t=w(o),n=b(l.type,i);z.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),ee(e,[...e.prevPointer,o,i])}z.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+A*l,r=z.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=z.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=z[l-1]||{left:n,top:o},f=~~((r.left-(t-A))/A),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:w(t),value:b(i.type,a.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},z.splice(l,0,a),ee(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(z.length>0&&o<z[z.length-1].left){for(const e of D)e.left>o&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(z=z.filter((e=>e.left<=o)),0===z.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(z.length>0){const t=z.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:b(t,e.top)}};if(y.value.discardActiveObject(),z.length>0){const e=z.map((e=>e.data)),i=_.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),te({...o,data:e})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),te(o,"change")}}))}(d),null==(p=Y.get(c.key))||p.push(d))}(re(l,n),l,u,e)})),Promise.all(Y.get(e.key)).then((t=>{const n=f.filter((e=>e));F(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:o={}}=t.panicValue||{},{max:i={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:o},i){!t&&n&&o&&e.forEach((e=>{const t=e.origin.data.value;"max"===i&&t<n||"min"===i&&t>n||G.add(e)}))}r(n,"max"),r(o,"min"),r(i,"max"),r(l,"min")}(t,e)}))}function ee(e,t){const[,,n,i]=t;e.clone((l=>{l.set({left:n,top:i}),e.prevPointer=[n,i];const r=o(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function te(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:a}=e;const s=_.find((e=>e.type===r)),f=s.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":f.list.splice(i,n),f.list[i-1]&&(f.list[i-1].breakpoint=!0);break;case"change":f.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=u(e,f.list),n=Array.isArray(o)?o:[o];f.list.splice(t,0,...n);break}}ne({dataIndex:a,scaleValue:s})}function ne(e){var t,n,o;if(D.size&&(null==(t=y.value)||t.remove(...oe([...D]))),D.clear(),z=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=y.value)||n.remove(...oe(Y.get(i.key))),Y.delete(i.key),Z(i,t,o)}else Y.size&&(null==(o=y.value)||o.remove(...oe(ae()))),Y.clear(),B()}function oe(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 ie(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:b(o,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],k.show=!0}function le(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:K,o=e.nextPoint?e.nextPoint.left-t:j;e.top<E&&e.set("top",E),e.top>I&&e.set("top",I),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function re(e,t){if(c(e)&&function(e){const t=Date.parse(S.list.at(-1)),n=p(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),o=P(t.type,t.range,e.value);return[n,o<E?E:o>I?I:o]}}function ae(){return Array.from(Y.values()).flat()}return e((()=>{R()})),B(),function(){if(!T.evented)return;let e=!1,o={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=I)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=f(e.target);ae().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&x.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),$.forEach((n=>{J(ae(),t,"key",2*A).includes(n.linkKey||n.key)||x.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===x.list.length&&(x.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return te(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(N)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,o=t.pointer)})),y.value.on("mouse:move",(i=>{if(!e)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;N&&y.value.remove(N),N=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),N.areaPos={startPos:o,endPos:i.pointer},y.value.add(N)}))}(),{redrawPoints:ne,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),te(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:b(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),te({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:le,setPopup:ie,updateData:te,getGridPoints:ae,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{y as useCenter};
@@ -1 +1 @@
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";import"@vueuse/core";function d(d,c,u,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,u,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:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{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,...u,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:f,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)),u=Math.max(...c.map((t=>t.width))),f=l>C-u;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=u,f&&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",(()=>{f.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(f.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(),u("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;f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+I/2},f.list=[`时间 ${k(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.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):f.show=!1})),c.on("mouseup:before",(t=>{if(f.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};u("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}),u("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
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";import"@vueuse/core";function d(d,c,u,f,h,m,g,p,v){const{cumputedX:x,getXValue:k}=o(c),{getEqualXTypes:y,handleAddPrevent:X,isGridLimit:b}=r(d,u,c),{other:P,yCellHeight:w,xCellWidth:j,endX:z,originX:C,originY:E,endY:A,markHeight:L,event:M,topGridYCellHeight:S}=c,I=new Map,T=l(P);function H(){var o;if(!(null==(o=null==T?void 0:T.horizontal)?void 0:o.length))return;const n="horizontal";I.set(n,[]);const{horizontal:r}=T;let a=E+w/2;r.forEach(((o,r)=>{const{title:l,type:s,pointAttr:c={},textStyle:u={},data:f}=o;let h=null;f.forEach(((o,f)=>{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,...u,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:f,data:o,title:l},limitX:{x1:C,x2:z-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,O(X),I.get(n).push(X),d.value.add(X)})),a+=w}))}function W(){var t;if(!(null==(t=null==T?void 0:T.vertical)?void 0:t.length))return;const i="vertical";I.set(i,[]);const{vertical:o}=T;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=x(a);if(!B(l))return;let s=E+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),I.get(i).push(a),d.value.add(a)}));const c=I.get(i).filter((t=>t.origin.dataIndex===o)),u=Math.max(...c.map((t=>t.width))),f=l>z-u;c.forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index)),t.maxTextWidth=u,f&&t.setCoords().set("originX","right")}))}))}function Y(t,e="add"){const{dataIndex:i,data:o,index:n,key:r}=t,l=T[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(...I.get(i)),I.delete(i),i){case"horizontal":H();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([C-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:C,x2:z};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(s)}function O(t){if(M.hovered&&(t.on("mouseover",(()=>{q(t)})),t.on("mouseout",(()=>{f.show=!1}))),!M.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?function(t){const e=t.origin.key,i="horizontal"===e;t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1+(i?1:0));t.left>t.limitX.x2&&t.set("left",t.limitX.x2+(i?-1:0));if("mark"===e){t.top<E&&t.set("top",E);const e=A+L-t.height/2;t.top>e&&t.set("top",e)}i&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(m(t),function(t){const e=t.left+t.maxTextWidth>z?"right":"left";t.setCoords().set({originX:e}),t.siblingPoints.forEach((i=>i.setCoords().set({originX:e,left:t.left})))}(t)),M.hovered&&q(t)})),t.on("mouseup",(n=>{var r;if(f.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(),u("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){f.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+S/2};const e=!t.origin.isMenu&&t.originLeft?t.originLeft:t.left;f.list=[`时间 ${k(e).slice(-5)}`],"mark"===t.origin.key&&f.list.unshift(t.origin.data.name+" "),f.show=!0}function B(t){return t>=C&&t<=z}return function(){var t;if(!(null==(t=null==T?void 0:T.horizontal)?void 0:t.length))return;const{horizontal:i}=T,o=C-5;let n=E+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,isMenu:!0},originLeft:o,originTop:n});var c;(c=s).on("moving",(()=>{c.set("originX","center"),b(c)?q(c):f.show=!1})),c.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&b(c))if(y(I.get("horizontal"),c.left,"key",j).includes(c.origin.key))X("repeat"),console.log("重复节点");else{const t={data:{time:k(c.left),value:c.origin.defaultAddValue},...c.origin};u("add",t),Y(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),d.value.add(s),n+=w}))}(),H(),W(),G(),n.on((()=>{const t="horizontal",e=g(I.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 T.horizontal[t].data.splice(i[0].index,i.length),i})).flat()}(e);V({key:t}),u("remove",i)})):v()})),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&Y(o,i)}}}export{d as useOther};
@@ -3,7 +3,7 @@ import { PropType } from 'vue';
3
3
  import { UrlConfig } from '../../../../../../es/components/form-render';
4
4
  export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
5
5
  value: {
6
- type: PropType<String | null>;
6
+ type: PropType<string | null>;
7
7
  };
8
8
  requestCache: {
9
9
  type: BooleanConstructor;
@@ -22,17 +22,54 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
22
22
  type: StringConstructor;
23
23
  default: string;
24
24
  };
25
+ showField: {
26
+ type: StringConstructor;
27
+ };
25
28
  urlConfig: {
26
29
  type: PropType<UrlConfig>;
27
30
  };
31
+ autograph: {
32
+ type: StringConstructor;
33
+ };
34
+ wordbook: {
35
+ type: PropType<Partial<{
36
+ level_num: number;
37
+ id: string;
38
+ name: string;
39
+ render_key: string[];
40
+ search_key: string[];
41
+ value_key: string;
42
+ queryParams: string[];
43
+ primary_key: string;
44
+ type: string;
45
+ level_key: string;
46
+ link_key: string;
47
+ link_key_split: string;
48
+ show_key: string | string[];
49
+ conObj: AnyObject[];
50
+ conObjFirstLevel: AnyObject[];
51
+ setting: Partial<{
52
+ cascading: {
53
+ 'form.name': string;
54
+ value: string;
55
+ }[];
56
+ }>;
57
+ }>>;
58
+ };
28
59
  onChange: {};
29
60
  useLoading: {
30
61
  type: BooleanConstructor;
31
62
  default: boolean;
32
63
  };
64
+ lazyRequest: {
65
+ type: BooleanConstructor;
66
+ default: boolean;
67
+ };
68
+ multiple: BooleanConstructor;
69
+ deletable: BooleanConstructor;
33
70
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
34
71
  value: {
35
- type: PropType<String | null>;
72
+ type: PropType<string | null>;
36
73
  };
37
74
  requestCache: {
38
75
  type: BooleanConstructor;
@@ -51,21 +88,61 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
51
88
  type: StringConstructor;
52
89
  default: string;
53
90
  };
91
+ showField: {
92
+ type: StringConstructor;
93
+ };
54
94
  urlConfig: {
55
95
  type: PropType<UrlConfig>;
56
96
  };
97
+ autograph: {
98
+ type: StringConstructor;
99
+ };
100
+ wordbook: {
101
+ type: PropType<Partial<{
102
+ level_num: number;
103
+ id: string;
104
+ name: string;
105
+ render_key: string[];
106
+ search_key: string[];
107
+ value_key: string;
108
+ queryParams: string[];
109
+ primary_key: string;
110
+ type: string;
111
+ level_key: string;
112
+ link_key: string;
113
+ link_key_split: string;
114
+ show_key: string | string[];
115
+ conObj: AnyObject[];
116
+ conObjFirstLevel: AnyObject[];
117
+ setting: Partial<{
118
+ cascading: {
119
+ 'form.name': string;
120
+ value: string;
121
+ }[];
122
+ }>;
123
+ }>>;
124
+ };
57
125
  onChange: {};
58
126
  useLoading: {
59
127
  type: BooleanConstructor;
60
128
  default: boolean;
61
129
  };
130
+ lazyRequest: {
131
+ type: BooleanConstructor;
132
+ default: boolean;
133
+ };
134
+ multiple: BooleanConstructor;
135
+ deletable: BooleanConstructor;
62
136
  }>> & {
63
137
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
64
138
  }, {
65
139
  options: AnyObject[];
140
+ multiple: boolean;
66
141
  labelField: string;
67
142
  valueField: string;
143
+ lazyRequest: boolean;
68
144
  requestCache: boolean;
145
+ deletable: boolean;
69
146
  allowCreate: boolean;
70
147
  useLoading: boolean;
71
148
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as a,inject as u,watch as n,createVNode as o}from"vue";import{connect as t,mapProps as r}from"@formily/vue";import{HelpCircleSharp as i}from"@vicons/ionicons5";import{useVModel as s,useDebounceFn as v}from"@vueuse/core";import{isString as p,isArray as d,cloneDeep as m,isEqual as c}from"lodash-es";import{NSelect as f,NSpin as y,NEmpty as g,NTooltip as C,NIcon as h}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as j,InjectionChangeContextCollector as F,InjectionFormItemDepsCollector as x}from"../../constants/index.js";import{createUrlConfigParams as b,formRenderLog as w}from"../../utils/index.js";import{useCommonInjection as K,useSelectOptionProps as S}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as k,assignClearBindVisited as B,createVisitedSetter as L}from"../../utils/schema.js";import{useFormField as V}from"../../hooks/useFormField.js";const q=t(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},allowCreate:Boolean,labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},urlConfig:{type:Object},onChange:{},useLoading:{type:Boolean,default:!0}},emits:["update:value"],setup(e,{slots:t,emit:r}){const k=s(e,"value",r),{field:B,fieldKey:q}=V(),A=l(null),I=a((()=>{var l,a,u;return null!=(u=null!=(a=null==(l=e.urlConfig)?void 0:l.nameKey)?a:e.labelField)?u:"text"})),O=a((()=>{var l,a,u;return null!=(u=null!=(a=null==(l=e.urlConfig)?void 0:l.valueKey)?a:e.valueField)?u:"value"})),P=u(j),U=l(""),D=l(!1),R=v((async(l="",a="label")=>{if(U.value=l,!e.urlConfig)return A.value=null;try{D.value=!0,A.value=[],A.value=await P.addAsync(await b({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===a?O.value:"keyword"]:l}},cache:e.requestCache,field:B.value}))}catch(e){p(e)&&w(e)}finally{D.value=!1}})),z=a((()=>d(A.value)?A.value:d(e.options)?e.options:[])),{injectValueValidate:E,injectValueBindKey:G}=K();E(k);const H=G(k);n(k,(e=>{if(e&&!z.value.find((l=>l[O.value]===e)))return R(e,"value")}));u(F).setContext(q.value,(e=>{return{currentOption:m((l=e,z.value.find((e=>e[O.value]===l))))};var l}));const J=u(x);n((()=>e.urlConfig),((e,l)=>{c(e,l)||(A.value=null,e&&(J.setDeps(q.value,e.dependKey||[],(async()=>{A.value=null,k.value=null})),k.value&&R(k.value,"value")))}),{immediate:!0});const{menuProps:M,nodeProps:N}=S(),Q=a((()=>z.value.length||!e.allowCreate?z.value:U.value?[{[I.value]:U.value,[O.value]:U.value},...z.value]:z.value));async function T(e){D.value=e,e&&R()}function W(e){const l=e.alias||e[I.value];if(!l||!p(l))return"";const a=l;return e.desc?o("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[a,e.desc?o(C,null,{trigger:()=>o(h,{component:i},null),default:()=>e.desc}):null]):a}return()=>o(f,{remote:!0,filterable:!0,key:H.value,value:k.value,"onUpdate:value":e=>k.value=e,labelField:I.value,valueField:O.value,"menu-props":M,"node-props":N,onSearch:R,"onUpdate:show":T,options:Q.value,onFocus:L(B),renderLabel:W},{empty:()=>e.useLoading&&D.value?o(y,null,null):o(g,{description:"无数据"},null),...t})}}),r(k,B));export{q as REMOTE_SEARCH};
1
+ import{defineComponent as e,watch as l,inject as o,computed as a,createVNode as t}from"vue";import{connect as n,mapProps as u}from"@formily/vue";import{HelpCircleSharp as r}from"@vicons/ionicons5";import{useVModel as i,useDebounceFn as s}from"@vueuse/core";import{cloneDeep as p,isString as v}from"lodash-es";import{NSelect as d,NSpin as m,NEmpty as f,NTooltip as c,NIcon as y,NTag as g}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as h}from"../../constants/index.js";import{useCommonInjection as C,useSelectOptionProps as b}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as j,assignClearBindVisited as F,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as x}from"../../hooks/useFormField.js";import{useUrlConfigOptions as B,useAutographOptions as K}from"../../hooks/useFormRenderOptions.js";const S=n(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},allowCreate:Boolean,labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},onChange:{},useLoading:{type:Boolean,default:!0},lazyRequest:{type:Boolean,default:!0},multiple:Boolean,deletable:Boolean},emits:["update:value"],setup(e,{slots:n,emit:u}){const j=i(e,"value",u),{field:F,fieldKey:S}=x(),{injectValueValidate:k,injectValueBindKey:O}=C();k(j);const D=O(j),R={onRequestConfigChange:({fetchData:e,valueKey:l})=>e(j.value,{[l]:j.value}),onDepsChange:({fetchData:e,valueKey:l})=>e(j.value,{[l]:j.value})},{labelKey:q,valueKey:L,showKey:P,fetchData:V,searchContent:I,fullOptions:U,loading:z}=e.urlConfig?B(e,j,R):K(e,j,R),A=s(((e="",l="label")=>V(e,{["value"===l?L.value:"keyword"]:e})),300);l(j,(e=>{if(e&&!U.value.find((l=>l[L.value]===e)))return A(e,"value")}));o(h).setContext(S.value,(e=>{return{currentOption:p((l=e,U.value.find((e=>e[L.value]===l))))};var l}));const{menuProps:T,nodeProps:$}=b(),E=a((()=>U.value.length||!e.allowCreate?U.value:I.value?[{[q.value]:I.value,[L.value]:I.value},...U.value]:U.value));async function G(e){z.value=e,e&&A()}function H(e){const l=e.alias||e[q.value];if(!l||!v(l))return"";const o=l;return e.desc?t("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[o,e.desc?t(c,null,{trigger:()=>t(y,{component:r},null),default:()=>e.desc}):null]):o}function J({option:l,handleClose:o}){var a;const n=null!=(a=P.value&&l[P.value])?a:l[q.value];if(!e.multiple)return n;return e.deletable?t(g,{closable:!0,onClose:function(e){e.stopPropagation(),o()}},{default:()=>n}):`${n};`}return()=>t(d,{remote:!0,filterable:!0,key:D.value,value:j.value,"onUpdate:value":e=>j.value=e,labelField:q.value,valueField:L.value,"menu-props":T,"node-props":$,onSearch:A,"onUpdate:show":G,options:E.value,onFocus:w(F),renderLabel:H,renderTag:J},{empty:()=>e.useLoading&&z.value?t(m,null,null):t(f,{description:"无数据"},null),...n})}}),u(j,F));export{S as REMOTE_SEARCH};