cnhis-design-vue 3.1.9-beta.10 → 3.1.9-beta.13

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 (108) hide show
  1. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +35 -14
  2. package/es/packages/chunk-upload/index.d.ts +22 -1
  3. package/es/packages/chunk-upload/src/chunk-upload-new.vue.d.ts +32 -0
  4. package/es/packages/chunk-upload/src/chunk-upload-new.vue_vue_type_script_setup_true_lang.js +3 -2
  5. package/es/packages/chunk-upload/src/hooks/upload-data.d.ts +29 -27
  6. package/es/packages/chunk-upload/src/hooks/upload-data.js +32 -29
  7. package/es/packages/chunk-upload/src/hooks/vod-data.d.ts +21 -42
  8. package/es/packages/chunk-upload/src/hooks/vod-data.js +26 -31
  9. package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +31 -2
  10. package/es/packages/chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue_vue_type_script_setup_true_lang.js +16 -6
  11. package/es/packages/chunk-upload/style/index.css +2 -0
  12. package/es/packages/fabric-chart/index.d.ts +7 -81
  13. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +7 -82
  14. package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +16 -4
  15. package/es/packages/fabric-chart/src/hooks/useCenter.d.ts +4 -0
  16. package/es/packages/fabric-chart/src/hooks/useCenter.js +7 -0
  17. package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +42 -0
  18. package/es/packages/fabric-chart/src/hooks/useDraw.js +76 -0
  19. package/es/packages/fabric-chart/src/hooks/useGrid.d.ts +4 -0
  20. package/es/packages/fabric-chart/src/hooks/useGrid.js +45 -0
  21. package/es/packages/fabric-chart/src/hooks/useLeft.d.ts +4 -0
  22. package/es/packages/fabric-chart/src/hooks/useLeft.js +66 -0
  23. package/es/packages/fabric-chart/src/hooks/useTop.d.ts +4 -0
  24. package/es/packages/fabric-chart/src/hooks/useTop.js +124 -0
  25. package/es/packages/fabric-chart/src/interface.d.ts +88 -0
  26. package/es/packages/fabric-chart/src/interface.js +4 -0
  27. package/es/packages/fabric-chart/src/utils/index.d.ts +2 -0
  28. package/es/packages/fabric-chart/src/utils/index.js +15352 -0
  29. package/es/packages/form-render/index.d.ts +3 -3
  30. package/es/packages/form-render/index.js +1 -0
  31. package/es/packages/form-render/src/FormRender.vue.d.ts +4 -4
  32. package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +23 -9
  33. package/es/packages/form-render/src/components/cascader.js +0 -1
  34. package/es/packages/form-render/src/hooks/index.d.ts +1 -0
  35. package/es/packages/form-render/src/hooks/index.js +1 -0
  36. package/es/packages/form-render/src/hooks/useAsyncQueue.js +1 -1
  37. package/es/packages/form-render/src/hooks/useFieldList2Schema.js +1 -1
  38. package/es/packages/form-render/src/hooks/useFormField.js +1 -3
  39. package/es/packages/form-render/src/hooks/useInitialData.d.ts +5 -0
  40. package/es/packages/form-render/src/hooks/useInitialData.js +11 -0
  41. package/es/packages/form-render/src/types/index.d.ts +1 -1
  42. package/es/packages/form-render/style/index.css +1 -1
  43. package/es/packages/index.css +38 -9
  44. package/es/packages/index.js +1 -0
  45. package/es/packages/scale-view/index.d.ts +137 -0
  46. package/es/packages/scale-view/src/ScaleView.vue.d.ts +119 -0
  47. package/es/packages/scale-view/src/ScaleView.vue_vue_type_script_setup_true_lang.js +30 -24
  48. package/es/packages/scale-view/src/components/composables/choose-common.d.ts +1 -0
  49. package/es/packages/scale-view/src/components/composables/choose-common.js +6 -1
  50. package/es/packages/scale-view/src/components/formitem/r-checkbox.d.ts +9 -0
  51. package/es/packages/scale-view/src/components/formitem/r-checkbox.js +57 -12
  52. package/es/packages/scale-view/src/components/formitem/r-datetime.js +5 -2
  53. package/es/packages/scale-view/src/components/formitem/r-radio.d.ts +9 -0
  54. package/es/packages/scale-view/src/components/formitem/r-radio.js +26 -13
  55. package/es/packages/scale-view/src/hooks/scaleview-computed.js +5 -13
  56. package/es/packages/scale-view/src/hooks/scaleview-init.js +3 -1
  57. package/es/packages/scale-view/src/hooks/scaleview-props.d.ts +28 -0
  58. package/es/packages/scale-view/src/hooks/scaleview-props.js +21 -0
  59. package/es/packages/scale-view/src/hooks/scaleview-state.d.ts +32 -31
  60. package/es/packages/scale-view/src/hooks/scaleview-state.js +41 -38
  61. package/es/packages/scale-view/src/hooks/use-component.d.ts +103 -2
  62. package/es/packages/scale-view/style/index.css +16 -4
  63. package/es/packages/select-label/index.d.ts +46 -2
  64. package/es/packages/select-label/src/LabelFormContent.vue.d.ts +1 -1
  65. package/es/packages/select-label/src/LabelFormContent.vue_vue_type_script_setup_true_lang.js +1 -2
  66. package/es/packages/select-label/src/SelectLabel.vue.d.ts +58 -8
  67. package/es/packages/select-label/src/SelectLabel.vue_vue_type_script_setup_true_lang.js +20 -2
  68. package/es/packages/select-label/src/components/label-classify.vue_vue_type_script_setup_true_lang.js +4 -1
  69. package/es/packages/select-label/style/index.css +10 -0
  70. package/es/src/assets/img/failure.d.ts +2 -1
  71. package/es/src/assets/img/icon-asc.d.ts +2 -1
  72. package/es/src/assets/img/icon-desc.d.ts +2 -1
  73. package/es/src/assets/img/no-permission.d.ts +2 -1
  74. package/es/src/assets/img/nodata.d.ts +2 -1
  75. package/es/src/assets/img/notfound.d.ts +2 -1
  76. package/es/src/assets/img/qr.d.ts +2 -1
  77. package/es/src/assets/img/success.d.ts +2 -1
  78. package/es/src/assets/img/video.d.ts +2 -1
  79. package/es/src/assets/img/video_default_cover.d.ts +2 -1
  80. package/es/src/assets/img/video_hover.d.ts +2 -1
  81. package/es/src/assets/img/video_play_hover.d.ts +2 -1
  82. package/es/src/assets/img/xb_big.d.ts +2 -1
  83. package/es/src/assets/img/xb_small.d.ts +2 -1
  84. package/es/src/components/player-vod/video-modal.js +1 -1
  85. package/package.json +2 -4
  86. package/test.ts +326 -0
  87. package/es/packages/big-table/style/index.less +0 -551
  88. package/es/packages/bpmn-workflow/src/BpmnWorkflow.d.js +0 -1
  89. package/es/packages/bpmn-workflow/style/index.less +0 -29
  90. package/es/packages/bpmn-workflow/types/BpmnViewer.d.js +0 -1
  91. package/es/packages/bpmn-workflow/types/ModelingModule.d.js +0 -1
  92. package/es/packages/bpmn-workflow/types/MoveCanvasModule.d.js +0 -1
  93. package/es/packages/button-print/style/index.less +0 -30
  94. package/es/packages/chunk-upload/style/index.less +0 -395
  95. package/es/packages/drag-layout/style/index.less +0 -208
  96. package/es/packages/editor/style/index.less +0 -0
  97. package/es/packages/fabric-chart/style/index.less +0 -0
  98. package/es/packages/field-set/style/index.less +0 -157
  99. package/es/packages/form-render/style/index.less +0 -129
  100. package/es/packages/form-table/style/index.less +0 -301
  101. package/es/packages/grid/style/index.less +0 -13
  102. package/es/packages/index.less +0 -3069
  103. package/es/packages/info-header/style/index.less +0 -149
  104. package/es/packages/map/style/index.less +0 -60
  105. package/es/packages/scale-view/style/index.less +0 -753
  106. package/es/packages/select-label/style/index.less +0 -151
  107. package/es/packages/select-person/style/index.less +0 -229
  108. package/es/packages/time-line/style/index.less +0 -35
@@ -1,66 +1,15 @@
1
1
  import { SFCWithInstall } from '../../../es/src/types';
2
2
  declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
3
3
  data: {
4
- type: ObjectConstructor;
4
+ type: null;
5
5
  required: true;
6
6
  };
7
7
  }, {
8
8
  props: {
9
- data: {
10
- width: number;
11
- height: number;
12
- borderStyle?: import("fabric/fabric-impl").ILineOptions | undefined;
13
- grid: {
14
- mainXCell: number;
15
- subXCell: number;
16
- subSecondXCell: number;
17
- mainYCell: number;
18
- subYCell: number;
19
- mainLineStyle?: import("fabric/fabric-impl").ILineOptions | undefined;
20
- subLineStyle?: import("fabric/fabric-impl").ILineOptions | undefined;
21
- subSecondLineStyle?: import("fabric/fabric-impl").ILineOptions | undefined;
22
- event?: Partial<{
23
- selectable: boolean;
24
- evented: boolean;
25
- }> | undefined;
26
- };
27
- other?: {
28
- style?: import("fabric/fabric-impl").ITextOptions | undefined;
29
- list: {
30
- time: string;
31
- value: string | number;
32
- }[];
33
- } | undefined;
34
- top: {
35
- dateStyle?: import("fabric/fabric-impl").ITextOptions | undefined;
36
- titleWidth: number;
37
- date: {
38
- title: string;
39
- height?: number | undefined;
40
- list: string[];
41
- style?: import("fabric/fabric-impl").ITextOptions | undefined;
42
- };
43
- xScalevalue: {
44
- title: string;
45
- height?: number | undefined;
46
- list: string[];
47
- style?: import("fabric/fabric-impl").ITextOptions | undefined;
48
- };
49
- dayHeight?: number | undefined;
50
- };
51
- left: {
52
- spaceGridNumber?: number | undefined;
53
- yScaleValue: any[];
54
- };
55
- right?: {
56
- width?: number | undefined;
57
- yScaleValue: any;
58
- } | undefined;
59
- bottom?: any;
60
- };
9
+ data: import("./src/interface").IData;
61
10
  };
62
- canvasRef: import("vue").Ref<HTMLCanvasElement | null>;
63
- canvas: import("vue").Ref<import("fabric/fabric-impl").Canvas | undefined>;
11
+ canvasRef: any;
12
+ canvas: import("vue").Ref<any>;
64
13
  gridXNumber: import("vue").ComputedRef<number>;
65
14
  gridYNumber: import("vue").ComputedRef<number>;
66
15
  endX: import("vue").ComputedRef<number>;
@@ -74,34 +23,11 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
74
23
  breatheYCell: import("vue").ComputedRef<number>;
75
24
  pulseYCell: import("vue").ComputedRef<number>;
76
25
  centigradeYCell: import("vue").ComputedRef<number>;
77
- event: import("vue").ComputedRef<Partial<{
78
- selectable: boolean;
79
- evented: boolean;
80
- }>>;
81
- propItems: {
82
- canvasWidth: number;
83
- canvasHeight: number;
84
- gridXNumber: number;
85
- gridYNumber: number;
86
- originX: number;
87
- originY: number;
88
- endX: number;
89
- endY: number;
90
- xCellWidth: number;
91
- yCellHeight: number;
92
- xScaleList: number[];
93
- xScaleCell: number;
94
- breatheYCell: number;
95
- pulseYCell: number;
96
- centigradeYCell: number;
97
- event: {
98
- selectable?: boolean | undefined;
99
- evented?: boolean | undefined;
100
- };
101
- };
26
+ event: import("vue").ComputedRef<any>;
27
+ propItems: any;
102
28
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
103
29
  data: {
104
- type: ObjectConstructor;
30
+ type: null;
105
31
  required: true;
106
32
  };
107
33
  }>>, {}>>;
@@ -1,70 +1,15 @@
1
- import { fabric } from 'fabric';
2
- declare type IEvent = {
3
- selectable: boolean;
4
- evented: boolean;
5
- };
6
- declare type IPoint = {
7
- time: string;
8
- value: string | number;
9
- };
10
- declare type IGrid = {
11
- mainXCell: number;
12
- subXCell: number;
13
- subSecondXCell: number;
14
- mainYCell: number;
15
- subYCell: number;
16
- mainLineStyle?: fabric.ILineOptions;
17
- subLineStyle?: fabric.ILineOptions;
18
- subSecondLineStyle?: fabric.ILineOptions;
19
- event?: Partial<IEvent>;
20
- };
21
- declare type IOther = {
22
- style?: fabric.ITextOptions;
23
- list: Array<IPoint>;
24
- };
25
- declare type IDate = {
26
- title: string;
27
- height?: number;
28
- list: Array<string>;
29
- style?: fabric.ITextOptions;
30
- };
31
- declare type ITop = {
32
- dateStyle?: fabric.ITextOptions;
33
- titleWidth: number;
34
- date: IDate;
35
- xScalevalue: IDate;
36
- dayHeight?: number;
37
- };
38
- declare type ILeft = {
39
- spaceGridNumber?: number;
40
- yScaleValue: Array<any>;
41
- };
42
- declare type IRight = {
43
- width?: number;
44
- yScaleValue: any;
45
- };
46
- declare type IData = {
47
- width: number;
48
- height: number;
49
- borderStyle?: fabric.ILineOptions;
50
- grid: IGrid;
51
- other?: IOther;
52
- top: ITop;
53
- left: ILeft;
54
- right?: IRight;
55
- bottom?: any;
56
- };
1
+ import { IData } from './interface';
57
2
  declare const _default: import("vue").DefineComponent<{
58
3
  data: {
59
- type: ObjectConstructor;
4
+ type: null;
60
5
  required: true;
61
6
  };
62
7
  }, {
63
8
  props: {
64
9
  data: IData;
65
10
  };
66
- canvasRef: import("vue").Ref<HTMLCanvasElement | null>;
67
- canvas: import("vue").Ref<fabric.Canvas | undefined>;
11
+ canvasRef: any;
12
+ canvas: import("vue").Ref<any>;
68
13
  gridXNumber: import("vue").ComputedRef<number>;
69
14
  gridYNumber: import("vue").ComputedRef<number>;
70
15
  endX: import("vue").ComputedRef<number>;
@@ -78,31 +23,11 @@ declare const _default: import("vue").DefineComponent<{
78
23
  breatheYCell: import("vue").ComputedRef<number>;
79
24
  pulseYCell: import("vue").ComputedRef<number>;
80
25
  centigradeYCell: import("vue").ComputedRef<number>;
81
- event: import("vue").ComputedRef<Partial<IEvent>>;
82
- propItems: {
83
- canvasWidth: number;
84
- canvasHeight: number;
85
- gridXNumber: number;
86
- gridYNumber: number;
87
- originX: number;
88
- originY: number;
89
- endX: number;
90
- endY: number;
91
- xCellWidth: number;
92
- yCellHeight: number;
93
- xScaleList: number[];
94
- xScaleCell: number;
95
- breatheYCell: number;
96
- pulseYCell: number;
97
- centigradeYCell: number;
98
- event: {
99
- selectable?: boolean | undefined;
100
- evented?: boolean | undefined;
101
- };
102
- };
26
+ event: import("vue").ComputedRef<any>;
27
+ propItems: any;
103
28
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
104
29
  data: {
105
- type: ObjectConstructor;
30
+ type: null;
106
31
  required: true;
107
32
  };
108
33
  }>>, {}>;
@@ -1,11 +1,16 @@
1
1
  import { defineComponent, ref, computed, reactive, provide, onMounted, openBlock, createElementBlock, createElementVNode } from 'vue';
2
- import { fabric } from 'fabric';
2
+ import { fabric } from './utils/index.js';
3
+ import { InjectionCanvas, InjectionPropItems } from './interface.js';
4
+ import { defaultBorderStyle } from './hooks/useDraw.js';
5
+ import useTop from './hooks/useTop.js';
6
+ import useCenter from './hooks/useCenter.js';
7
+ import useLeft from './hooks/useLeft.js';
3
8
 
4
9
  const _hoisted_1 = { class: "c-fabric-chart" };
5
10
  var script = /* @__PURE__ */ defineComponent({
6
11
  __name: "FabricChart",
7
12
  props: {
8
- data: { type: Object, required: true }
13
+ data: { type: null, required: true }
9
14
  },
10
15
  setup(__props) {
11
16
  const props = __props;
@@ -91,6 +96,10 @@ var script = /* @__PURE__ */ defineComponent({
91
96
  const propItems = reactive({
92
97
  canvasWidth: props.data.width,
93
98
  canvasHeight: props.data.height,
99
+ borderStyle: props.data.borderStyle || defaultBorderStyle,
100
+ grid: props.data.grid,
101
+ top: props.data.top,
102
+ left: props.data.left,
94
103
  gridXNumber: gridXNumber.value,
95
104
  gridYNumber: gridYNumber.value,
96
105
  originX: originX.value,
@@ -106,8 +115,11 @@ var script = /* @__PURE__ */ defineComponent({
106
115
  centigradeYCell: centigradeYCell.value,
107
116
  event: event.value
108
117
  });
109
- provide("canvas", canvas);
110
- provide("propItems", propItems);
118
+ provide(InjectionCanvas, canvas);
119
+ provide(InjectionPropItems, propItems);
120
+ useTop(canvas, propItems);
121
+ useCenter(canvas, propItems);
122
+ useLeft(canvas, propItems);
111
123
  onMounted(() => {
112
124
  canvas.value = new fabric.Canvas(canvasRef.value, {
113
125
  width: propItems.canvasWidth,
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,7 @@
1
+ import useGrid from './useGrid.js';
2
+
3
+ function useCenter(canvas, propItems) {
4
+ useGrid(canvas, propItems);
5
+ }
6
+
7
+ export { useCenter as default };
@@ -0,0 +1,42 @@
1
+ import { fabric } from '../utils';
2
+ import { ILineOptions, ITextOptions } from '../interface';
3
+ export declare const defaultStyle: {
4
+ evented: boolean;
5
+ selectable: boolean;
6
+ };
7
+ export declare const defaultBorderStyle: {
8
+ evented: boolean;
9
+ selectable: boolean;
10
+ stroke: string;
11
+ strokeWidth: number;
12
+ };
13
+ export declare const defaultLineStyle: {
14
+ evented: boolean;
15
+ selectable: boolean;
16
+ stroke: string;
17
+ strokeWidth: number;
18
+ strokeDashArray: number[];
19
+ };
20
+ export declare const defaultRectStyle: {
21
+ evented: boolean;
22
+ selectable: boolean;
23
+ fill: string;
24
+ stroke: string;
25
+ strokeWidth: number;
26
+ originX: string;
27
+ originY: string;
28
+ };
29
+ export declare const defaultTextStyle: {
30
+ evented: boolean;
31
+ selectable: boolean;
32
+ fontFamily: string;
33
+ fontSize: number;
34
+ fill: string;
35
+ centeredRotation: boolean;
36
+ originX: string;
37
+ originY: string;
38
+ lineHeight: number;
39
+ };
40
+ export declare function drawLine(points: number[], style: Partial<ILineOptions>): fabric.Line;
41
+ export declare function drawTextGroup(rectStyle: Partial<fabric.IRectOptions>, fontStyle: Partial<ITextOptions>, groupStyle: Partial<fabric.IGroupOptions>): fabric.Group;
42
+ export declare function drawPoint(type: string, style: any): fabric.Triangle | fabric.Circle | undefined;
@@ -0,0 +1,76 @@
1
+ import { fabric } from '../utils/index.js';
2
+
3
+ const defaultStyle = {
4
+ evented: false,
5
+ selectable: false
6
+ };
7
+ const defaultBorderStyle = {
8
+ stroke: "#999",
9
+ strokeWidth: 1,
10
+ ...defaultStyle
11
+ };
12
+ const defaultLineStyle = {
13
+ stroke: "#000",
14
+ strokeWidth: 1,
15
+ strokeDashArray: [0, 0],
16
+ ...defaultStyle
17
+ };
18
+ const defaultRectStyle = {
19
+ fill: "transparent",
20
+ stroke: "#999",
21
+ strokeWidth: 1,
22
+ originX: "center",
23
+ originY: "center",
24
+ ...defaultStyle
25
+ };
26
+ const defaultTextStyle = {
27
+ fontFamily: "\u5FAE\u8F6F\u96C5\u9ED1",
28
+ fontSize: 12,
29
+ fill: "#000",
30
+ centeredRotation: true,
31
+ originX: "center",
32
+ originY: "center",
33
+ lineHeight: 1,
34
+ ...defaultStyle
35
+ };
36
+ function drawLine(points, style) {
37
+ return new fabric.Line(points, {
38
+ ...defaultLineStyle,
39
+ ...style
40
+ });
41
+ }
42
+ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
43
+ const rect = new fabric.Rect({
44
+ ...defaultRectStyle,
45
+ ...rectStyle
46
+ });
47
+ const texts = new fabric.Text(String(fontStyle.value), {
48
+ ...defaultTextStyle,
49
+ ...fontStyle
50
+ });
51
+ return new fabric.Group([rect, texts], {
52
+ ...groupStyle
53
+ });
54
+ }
55
+ function drawPoint(type, style) {
56
+ switch (type) {
57
+ case "triangle":
58
+ return new fabric.Triangle({
59
+ width: 20,
60
+ height: 20,
61
+ strokeWidth: 1,
62
+ scale: 1,
63
+ ...style
64
+ });
65
+ case "circle":
66
+ return new fabric.Circle({
67
+ objectCaching: false,
68
+ strokeWidth: 1,
69
+ radius: 5,
70
+ scale: 1,
71
+ ...style
72
+ });
73
+ }
74
+ }
75
+
76
+ export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawLine, drawPoint, drawTextGroup };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useGrid(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,45 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { drawLine } from './useDraw.js';
4
+
5
+ function useGrid(canvas, propItems) {
6
+ const { gridYNumber, originY, grid, originX, endX, xCellWidth, yCellHeight, gridXNumber, endY } = propItems;
7
+ const yList = [];
8
+ const xList = [];
9
+ for (let i = 0; i <= gridYNumber; i++) {
10
+ const y = originY + parseInt(String(yCellHeight * (gridYNumber - i)));
11
+ const style = i % grid.subYCell === 0 ? grid.mainLineStyle || {} : grid.subLineStyle || {};
12
+ yList.push(drawLine([originX, y, endX, y], {
13
+ id: i + "_" + new Date().getTime(),
14
+ ...style
15
+ }));
16
+ }
17
+ for (let i = 0; i <= gridXNumber; i++) {
18
+ const x = originX + parseInt(String(xCellWidth * i));
19
+ let style;
20
+ style = i % grid.subXCell === 0 ? grid.mainLineStyle || {} : grid.subLineStyle || {};
21
+ if (i % grid.subSecondXCell === 0) {
22
+ style = grid.subSecondLineStyle || {};
23
+ }
24
+ if (i % grid.subXCell === 0) {
25
+ style = grid.mainLineStyle || {};
26
+ }
27
+ xList.push(drawLine([x, originY, x, endY], {
28
+ id: i + "_" + new Date().getTime(),
29
+ ...style
30
+ }));
31
+ }
32
+ const group = new fabric.Group([...xList, ...yList], {
33
+ evented: false,
34
+ selectable: false
35
+ });
36
+ onMounted(() => {
37
+ nextTick(() => {
38
+ canvas.value.add(group);
39
+ canvas.value.sendToBack(group);
40
+ canvas.value.renderAll();
41
+ });
42
+ });
43
+ }
44
+
45
+ export { useGrid as default };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,66 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { defaultTextStyle, defaultStyle, defaultRectStyle } from './useDraw.js';
4
+
5
+ function useLeft(canvas, propItems) {
6
+ const { originY, endY, originX, yCellHeight, borderStyle, left } = propItems;
7
+ function drawScaleValue() {
8
+ let groupList = [];
9
+ const column = left.yScaleValue.length;
10
+ const colWidth = originX / column;
11
+ const residue = originX % column;
12
+ const firstColWidth = colWidth + residue;
13
+ left.yScaleValue.forEach((item, index) => {
14
+ let list = [];
15
+ const rectWidth = index === 0 ? firstColWidth : colWidth;
16
+ const rectLeft = index === 0 ? 0 : firstColWidth + (index - 1) * colWidth;
17
+ const line = index > 0 ? new fabric.Line([rectLeft, originY, rectLeft, endY], {
18
+ ...borderStyle
19
+ }) : null;
20
+ line && list.push(line);
21
+ const leftVal = rectLeft + rectWidth / 2;
22
+ const spaceGridNumber = left.spaceGridNumber || 5;
23
+ item.list.forEach((v, i) => {
24
+ const top = endY - i * yCellHeight * spaceGridNumber;
25
+ const text = new fabric.Text(String(v), {
26
+ ...defaultTextStyle,
27
+ left: leftVal,
28
+ top: i === 0 ? top - 5 : top,
29
+ ...item.style
30
+ });
31
+ list.push(text);
32
+ });
33
+ let title = item.name || "";
34
+ if (item.unit)
35
+ title += "\n" + item.unit;
36
+ title && list.push(new fabric.Text(String(title), {
37
+ ...defaultTextStyle,
38
+ left: leftVal,
39
+ top: originY + yCellHeight * spaceGridNumber / 2,
40
+ textAlign: "center",
41
+ ...item.style
42
+ }));
43
+ const group2 = new fabric.Group(list, defaultStyle);
44
+ groupList.push(group2);
45
+ });
46
+ groupList.push(new fabric.Rect({
47
+ ...defaultStyle,
48
+ ...defaultRectStyle,
49
+ width: originX,
50
+ height: endY - originY,
51
+ left: 0,
52
+ top: originY
53
+ }));
54
+ const group = groupList.length > 0 ? new fabric.Group([...groupList], { ...defaultStyle }) : null;
55
+ group && group.sendToBack();
56
+ group && canvas.value.add(group);
57
+ }
58
+ onMounted(() => {
59
+ nextTick(() => {
60
+ drawScaleValue();
61
+ canvas.value.renderAll();
62
+ });
63
+ });
64
+ }
65
+
66
+ export { useLeft as default };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
4
+ export default function useTop(canvas: Ref<fabric.Canvas>, propItems: IPropItems): void;
@@ -0,0 +1,124 @@
1
+ import { onMounted, nextTick } from 'vue';
2
+ import { fabric } from '../utils/index.js';
3
+ import { defaultStyle, drawTextGroup, defaultTextStyle, defaultRectStyle } from './useDraw.js';
4
+
5
+ function useTop(canvas, propItems) {
6
+ const { originY, grid, originX, xCellWidth, gridXNumber, top } = propItems;
7
+ function drawTop() {
8
+ let list = [];
9
+ drawTopDate(list);
10
+ drawTopDay(list);
11
+ drawTopTime(list);
12
+ const group = list.length > 0 ? new fabric.Group([...list], { ...defaultStyle }) : null;
13
+ group && group.sendToBack();
14
+ group && canvas.value.add(group);
15
+ }
16
+ function drawTopTime(list) {
17
+ var _a, _b;
18
+ const dateHeight = ((_a = top.date) == null ? void 0 : _a.height) || 0;
19
+ const dayHeight = top.dayHeight || 0;
20
+ const height = originY - dateHeight - dayHeight;
21
+ const titleHeight = dayHeight + height;
22
+ const title = drawTextGroup({
23
+ width: originX,
24
+ height: titleHeight,
25
+ ...defaultRectStyle
26
+ }, {
27
+ value: top.xScalevalue.title,
28
+ ...defaultTextStyle,
29
+ ...((_b = top.date) == null ? void 0 : _b.style) || {}
30
+ }, {
31
+ left: 0,
32
+ top: dateHeight
33
+ });
34
+ list.push(title);
35
+ let timeList = [];
36
+ for (let j = 0; j < grid.mainXCell; j++) {
37
+ timeList.push(top.xScalevalue.list);
38
+ }
39
+ timeList.flat().forEach((v, i) => {
40
+ var _a2;
41
+ const left = originX + i * xCellWidth;
42
+ const textGroup = drawTextGroup({
43
+ width: xCellWidth,
44
+ height
45
+ }, {
46
+ value: v,
47
+ ...defaultTextStyle,
48
+ ...((_a2 = top.date) == null ? void 0 : _a2.style) || {}
49
+ }, {
50
+ left,
51
+ top: dateHeight + dayHeight
52
+ });
53
+ list.push(textGroup);
54
+ });
55
+ }
56
+ function drawTopDay(list) {
57
+ var _a;
58
+ if (!top.dayHeight)
59
+ return false;
60
+ const height = top.dayHeight;
61
+ const width = xCellWidth * grid.subSecondXCell;
62
+ const dayList = gridXNumber / grid.subSecondXCell;
63
+ for (let i = 0; i < dayList; i++) {
64
+ const left = originX + i * width;
65
+ const value = i % 2 === 0 ? "\u4E0A\u5348" : "\u4E0B\u5348";
66
+ const textGroup = drawTextGroup({
67
+ width,
68
+ height
69
+ }, {
70
+ value,
71
+ ...defaultTextStyle,
72
+ ...((_a = top.date) == null ? void 0 : _a.style) || {}
73
+ }, {
74
+ left,
75
+ top: top.date.height || 0
76
+ });
77
+ list.push(textGroup);
78
+ }
79
+ }
80
+ function drawTopDate(list) {
81
+ var _a;
82
+ if (!top.date.height)
83
+ return false;
84
+ const height = top.date.height;
85
+ const title = drawTextGroup({
86
+ width: originX,
87
+ height,
88
+ ...defaultRectStyle
89
+ }, {
90
+ value: top.date.title,
91
+ ...defaultTextStyle,
92
+ ...((_a = top.date) == null ? void 0 : _a.style) || {}
93
+ }, {
94
+ left: 0,
95
+ top: 0
96
+ });
97
+ list.push(title);
98
+ const width = xCellWidth * grid.subXCell;
99
+ top.date.list.forEach((v, i) => {
100
+ var _a2;
101
+ const left = originX + i * width;
102
+ const textGroup = drawTextGroup({
103
+ width,
104
+ height
105
+ }, {
106
+ value: v,
107
+ ...defaultTextStyle,
108
+ ...((_a2 = top.date) == null ? void 0 : _a2.style) || {}
109
+ }, {
110
+ left,
111
+ top: 0
112
+ });
113
+ list.push(textGroup);
114
+ });
115
+ }
116
+ onMounted(() => {
117
+ nextTick(() => {
118
+ drawTop();
119
+ canvas.value.renderAll();
120
+ });
121
+ });
122
+ }
123
+
124
+ export { useTop as default };