cnhis-design-vue 3.1.37-beta.1 → 3.1.37

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 (57) hide show
  1. package/es/components/big-table/index.d.ts +66 -166
  2. package/es/components/big-table/src/BigTable.vue.d.ts +79 -194
  3. package/es/components/button-print/index.d.ts +24 -27
  4. package/es/components/button-print/src/ButtonPrint.vue.d.ts +101 -100
  5. package/es/components/button-print/src/components/EditFormat.vue.d.ts +4 -4
  6. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +4 -4
  7. package/es/components/button-print/src/utils/print.js +1 -6
  8. package/es/components/fabric-chart/index.d.ts +34 -11
  9. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +35 -12
  10. package/es/components/fabric-chart/src/FabricChart.vue.js +9 -9
  11. package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +1 -18
  12. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +129 -42
  13. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.d.ts +25 -0
  14. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +151 -0
  15. package/es/components/fabric-chart/src/hooks/useCenter.d.ts +1 -1
  16. package/es/components/fabric-chart/src/hooks/useCenter.js +6 -7
  17. package/es/components/fabric-chart/src/hooks/useOther.js +3 -2
  18. package/es/components/fabric-chart/src/hooks/useTemperatureChart.js +1 -1
  19. package/es/components/fabric-chart/src/interface.d.ts +3 -1
  20. package/es/components/fabric-chart/src/utils/utils.d.ts +1 -1
  21. package/es/components/fabric-chart/src/utils/utils.js +7 -4
  22. package/es/components/form-config/index.d.ts +2 -2
  23. package/es/components/form-config/src/FormConfig.vue.d.ts +2 -2
  24. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.d.ts +1 -1
  25. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.js +1 -1
  26. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +1 -1
  27. package/es/components/form-config/src/hooks/useSortalbeConfig.d.ts +2 -1
  28. package/es/components/form-config/src/hooks/useSortalbeConfig.js +2 -2
  29. package/es/components/form-render/src/hooks/useLowCodeReactions.js +19 -18
  30. package/es/components/form-render/src/types/index.d.ts +2 -2
  31. package/es/components/iho-table/src/constants/index.d.ts +2 -2
  32. package/es/components/iho-table/style/index.css +1 -1
  33. package/es/components/index.css +1 -1
  34. package/es/components/index.d.ts +1 -2
  35. package/es/components/index.js +0 -3
  36. package/es/components/scale-view/src/hooks/use-component.d.ts +30 -81
  37. package/es/components/select-label/index.d.ts +30 -81
  38. package/es/components/select-label/src/SelectLabel.vue.d.ts +30 -81
  39. package/es/components/select-person/index.d.ts +113 -41
  40. package/es/components/select-person/src/SelectPerson.vue.d.ts +76 -45
  41. package/es/shared/utils/tapable/AsyncParallelBailHook.js +1 -1
  42. package/es/shared/utils/tapable/AsyncSeriesWaterfallHook.js +2 -3
  43. package/es/shared/utils/tapable/Hook.d.ts +1 -1
  44. package/es/shared/utils/tapable/Hook.js +1 -1
  45. package/es/shared/utils/tapable/HookCodeFactory.js +3 -6
  46. package/es/shared/utils/tapable/SyncWaterfallHook.js +1 -2
  47. package/package.json +2 -2
  48. package/es/components/drag-layout/index.d.ts +0 -606
  49. package/es/components/drag-layout/index.js +0 -11
  50. package/es/components/drag-layout/src/DragFormLeftItem.vue.d.ts +0 -21
  51. package/es/components/drag-layout/src/DragFormLeftItem.vue.js +0 -122
  52. package/es/components/drag-layout/src/DragFormRightItem.vue.d.ts +0 -125
  53. package/es/components/drag-layout/src/DragFormRightItem.vue.js +0 -267
  54. package/es/components/drag-layout/src/DragLayout.vue.d.ts +0 -606
  55. package/es/components/drag-layout/src/DragLayout.vue.js +0 -662
  56. package/es/components/drag-layout/style/index.css +0 -1
  57. package/es/components/fabric-chart/src/BirthProcessChart.vue.d.ts +0 -181
@@ -1,7 +1,7 @@
1
1
  import { SFCWithInstall } from '../../../es/shared/types';
2
2
  declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
3
- mode: {
4
- type: import("vue").PropType<import("./src/interface").IMode>;
3
+ type: {
4
+ type: import("vue").PropType<import("./src/interface").IType>;
5
5
  default: string;
6
6
  };
7
7
  data: {
@@ -13,8 +13,8 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
13
13
  };
14
14
  }, {
15
15
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
16
- mode: {
17
- type: import("vue").PropType<import("./src/interface").IMode>;
16
+ type: {
17
+ type: import("vue").PropType<import("./src/interface").IType>;
18
18
  default: string;
19
19
  };
20
20
  data: {
@@ -27,10 +27,10 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
27
27
  }>> & {
28
28
  onChange?: ((...args: any[]) => any) | undefined;
29
29
  onSelect?: ((...args: any[]) => any) | undefined;
30
- onDelete?: ((...args: any[]) => any) | undefined;
31
30
  onAdd?: ((...args: any[]) => any) | undefined;
31
+ onRemove?: ((...args: any[]) => any) | undefined;
32
32
  }>>;
33
- emits: (event: "delete" | "change" | "add" | "select", ...args: any[]) => void;
33
+ emits: (event: "change" | "add" | "remove" | "select", ...args: any[]) => void;
34
34
  isTemperature: import("vue").ComputedRef<boolean>;
35
35
  canvasRef: any;
36
36
  canvas: import("vue").Ref<any>;
@@ -55,6 +55,29 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
55
55
  target: any;
56
56
  };
57
57
  clickMenu: import("vue").Ref<any>;
58
+ init: () => {
59
+ propItems: any;
60
+ redrawPoints: import("vue").Ref<any>;
61
+ select: import("vue").Ref<any>;
62
+ pointTipProps: {
63
+ show: boolean;
64
+ point: {
65
+ x: number;
66
+ y: number;
67
+ };
68
+ list: string[];
69
+ };
70
+ pointMenuProps: {
71
+ show: boolean;
72
+ point: {
73
+ x: number;
74
+ y: number;
75
+ };
76
+ list: any[];
77
+ target: any;
78
+ };
79
+ clickMenu: import("vue").Ref<any>;
80
+ };
58
81
  PopupTip: import("vue").DefineComponent<{
59
82
  show: {
60
83
  type: BooleanConstructor;
@@ -159,9 +182,9 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
159
182
  show: boolean;
160
183
  list: unknown[];
161
184
  }>;
162
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "change" | "add" | "select")[], "delete" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
163
- mode: {
164
- type: import("vue").PropType<import("./src/interface").IMode>;
185
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add" | "remove" | "select")[], "remove" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
186
+ type: {
187
+ type: import("vue").PropType<import("./src/interface").IType>;
165
188
  default: string;
166
189
  };
167
190
  data: {
@@ -174,9 +197,9 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
174
197
  }>> & {
175
198
  onChange?: ((...args: any[]) => any) | undefined;
176
199
  onSelect?: ((...args: any[]) => any) | undefined;
177
- onDelete?: ((...args: any[]) => any) | undefined;
178
200
  onAdd?: ((...args: any[]) => any) | undefined;
201
+ onRemove?: ((...args: any[]) => any) | undefined;
179
202
  }, {
180
- mode: import("./src/interface").IMode;
203
+ type: import("./src/interface").IType;
181
204
  }>>;
182
205
  export default FabricChart;
@@ -1,9 +1,9 @@
1
1
  import { PropType } from 'vue';
2
- import { IMode } from './interface';
2
+ import { IType } from './interface';
3
3
  import { AnyObject } from '../../../../es/shared/types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
- mode: {
6
- type: PropType<IMode>;
5
+ type: {
6
+ type: PropType<IType>;
7
7
  default: string;
8
8
  };
9
9
  data: {
@@ -15,8 +15,8 @@ declare const _default: import("vue").DefineComponent<{
15
15
  };
16
16
  }, {
17
17
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
18
- mode: {
19
- type: PropType<IMode>;
18
+ type: {
19
+ type: PropType<IType>;
20
20
  default: string;
21
21
  };
22
22
  data: {
@@ -29,10 +29,10 @@ declare const _default: import("vue").DefineComponent<{
29
29
  }>> & {
30
30
  onChange?: ((...args: any[]) => any) | undefined;
31
31
  onSelect?: ((...args: any[]) => any) | undefined;
32
- onDelete?: ((...args: any[]) => any) | undefined;
33
32
  onAdd?: ((...args: any[]) => any) | undefined;
33
+ onRemove?: ((...args: any[]) => any) | undefined;
34
34
  }>>;
35
- emits: (event: "delete" | "change" | "add" | "select", ...args: any[]) => void;
35
+ emits: (event: "change" | "add" | "remove" | "select", ...args: any[]) => void;
36
36
  isTemperature: import("vue").ComputedRef<boolean>;
37
37
  canvasRef: any;
38
38
  canvas: import("vue").Ref<any>;
@@ -57,6 +57,29 @@ declare const _default: import("vue").DefineComponent<{
57
57
  target: any;
58
58
  };
59
59
  clickMenu: import("vue").Ref<any>;
60
+ init: () => {
61
+ propItems: any;
62
+ redrawPoints: import("vue").Ref<any>;
63
+ select: import("vue").Ref<any>;
64
+ pointTipProps: {
65
+ show: boolean;
66
+ point: {
67
+ x: number;
68
+ y: number;
69
+ };
70
+ list: string[];
71
+ };
72
+ pointMenuProps: {
73
+ show: boolean;
74
+ point: {
75
+ x: number;
76
+ y: number;
77
+ };
78
+ list: any[];
79
+ target: any;
80
+ };
81
+ clickMenu: import("vue").Ref<any>;
82
+ };
60
83
  PopupTip: import("vue").DefineComponent<{
61
84
  show: {
62
85
  type: BooleanConstructor;
@@ -161,9 +184,9 @@ declare const _default: import("vue").DefineComponent<{
161
184
  show: boolean;
162
185
  list: unknown[];
163
186
  }>;
164
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "change" | "add" | "select")[], "delete" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
165
- mode: {
166
- type: PropType<IMode>;
187
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add" | "remove" | "select")[], "remove" | "change" | "add" | "select", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
188
+ type: {
189
+ type: PropType<IType>;
167
190
  default: string;
168
191
  };
169
192
  data: {
@@ -176,9 +199,9 @@ declare const _default: import("vue").DefineComponent<{
176
199
  }>> & {
177
200
  onChange?: ((...args: any[]) => any) | undefined;
178
201
  onSelect?: ((...args: any[]) => any) | undefined;
179
- onDelete?: ((...args: any[]) => any) | undefined;
180
202
  onAdd?: ((...args: any[]) => any) | undefined;
203
+ onRemove?: ((...args: any[]) => any) | undefined;
181
204
  }, {
182
- mode: IMode;
205
+ type: IType;
183
206
  }>;
184
207
  export default _default;
@@ -3,32 +3,32 @@ import { fabric } from './utils/index.js';
3
3
  import PopupTip from './components/PopupTip.vue.js';
4
4
  import PopupMenu from './components/PopupMenu.js';
5
5
  import useTemperatureChart from './hooks/useTemperatureChart.js';
6
+ import useBirthProcessChart from './hooks/useBirthProcessChart.js';
6
7
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
7
8
 
8
9
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
10
  __name: "FabricChart",
10
11
  props: {
11
- mode: { type: String, default: "temperature" },
12
+ type: { type: String, default: "temperature" },
12
13
  data: { type: Object, required: true },
13
14
  addRenderItem: { type: Function }
14
15
  },
15
16
  emits: [
16
17
  "change",
17
18
  "add",
18
- "delete",
19
+ "remove",
19
20
  "select"
20
21
  ],
21
22
  setup(__props, { expose, emit: emits }) {
22
23
  const props = __props;
23
- computed(() => props.mode === "temperature");
24
+ const isTemperature = computed(() => props.type === "temperature");
24
25
  const canvasRef = ref(null);
25
26
  const canvas = ref();
26
- const { propItems, redrawPoints, select, pointTipProps, pointMenuProps, clickMenu } = useTemperatureChart(
27
- canvas,
28
- props,
29
- emits,
30
- canvasRef
31
- );
27
+ const { propItems, redrawPoints, select, pointTipProps, pointMenuProps, clickMenu } = init();
28
+ function init() {
29
+ const params = [canvas, props, emits, canvasRef];
30
+ return isTemperature.value ? useTemperatureChart(...params) : useBirthProcessChart(...params);
31
+ }
32
32
  onMounted(() => {
33
33
  canvas.value = new fabric.Canvas(canvasRef.value, {
34
34
  width: propItems.canvasWidth,
@@ -1,24 +1,7 @@
1
1
  import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { AnyObject } from '../../../../../es/shared/types';
4
- export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: any): {
5
- pointTipProps: {
6
- show: boolean;
7
- point: {
8
- x: number;
9
- y: number;
10
- };
11
- list: string[];
12
- };
13
- pointMenuProps: {
14
- show: boolean;
15
- point: {
16
- x: number;
17
- y: number;
18
- };
19
- list: any[];
20
- target: any;
21
- };
4
+ export declare function useBirthProcess(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: any, pointTipProps: any, pointMenuProps: any, commonFunc: AnyObject): {
22
5
  clickMenu: ({ item, target }: {
23
6
  item: any;
24
7
  target: any;
@@ -1,15 +1,13 @@
1
- import { reactive, onMounted, nextTick } from 'vue';
2
1
  import { useBirthProcessCumputedPoint } from './useCumputedPoint.js';
3
2
  import useGrid from './useGrid.js';
4
- import { drawLine, drawPoint, drawText, defaultTextStyle, defaultRectStyle } from './useDraw.js';
3
+ import { drawLine, drawPoint, defaultTextStyle, drawText, defaultRectStyle } from './useDraw.js';
5
4
  import { fabric } from '../utils/index.js';
6
5
  import { getIndex, isEffectiveNode } from '../utils/utils.js';
7
- import { useCommon } from './useCommon.js';
8
6
  import { cloneDeep } from 'lodash-es';
9
7
 
10
- function useBirthProcess(canvas, propItems, emits) {
8
+ function useBirthProcess(canvas, propItems, emits, pointTipProps, pointMenuProps, commonFunc) {
11
9
  const { cumputedX, cumputedY, getXValue, getYValue } = useBirthProcessCumputedPoint(propItems);
12
- const { getEqualXTypes } = useCommon(canvas);
10
+ const { getEqualXTypes, repeatTip } = commonFunc;
13
11
  const {
14
12
  xAxis,
15
13
  grid,
@@ -30,20 +28,18 @@ function useBirthProcess(canvas, propItems, emits) {
30
28
  event,
31
29
  originYCervix
32
30
  } = propItems;
33
- const pointTipProps = reactive({
34
- show: false,
35
- point: { x: 0, y: 0 },
36
- list: []
37
- });
38
- const pointMenuProps = reactive({
39
- show: false,
40
- point: { x: 0, y: 0 },
41
- list: [],
42
- target: null
43
- });
44
31
  const yScaleValue = cloneDeep(scaleValues);
45
32
  const gridPoints = /* @__PURE__ */ new Set();
46
33
  useGrid(canvas, propItems, true);
34
+ init();
35
+ function init() {
36
+ drawYScale();
37
+ drawXScale();
38
+ drawBorder();
39
+ drawPolyLine();
40
+ setCanvasEvent();
41
+ drawIcons();
42
+ }
47
43
  function drawPolyLine() {
48
44
  yScaleValue.forEach((item, dataIndex) => {
49
45
  var _a;
@@ -161,8 +157,8 @@ function useBirthProcess(canvas, propItems, emits) {
161
157
  const { dataIndex, data, index, key } = params;
162
158
  const item = yScaleValue.find((v) => v.key === key);
163
159
  switch (mode) {
164
- case "delete":
165
- item.data.splice(index, 0);
160
+ case "remove":
161
+ item.data.splice(index, 1);
166
162
  break;
167
163
  case "change":
168
164
  item.data[index] = data;
@@ -240,7 +236,7 @@ function useBirthProcess(canvas, propItems, emits) {
240
236
  pointMenuProps.target = null;
241
237
  pointMenuProps.list = ["\u65B0\u589E\u8282\u70B9"];
242
238
  yScaleValue.forEach((item) => {
243
- if (!getEqualXTypes(x, "key").includes(item.key)) {
239
+ if (!getEqualXTypes(x, "key", xCellWidth).includes(item.key)) {
244
240
  if (["cervix", "fetalPresentation"].includes(item.key) && y < originYCervix)
245
241
  return;
246
242
  pointMenuProps.list.push(getPointMenuList(item, event2.pointer));
@@ -248,17 +244,19 @@ function useBirthProcess(canvas, propItems, emits) {
248
244
  });
249
245
  if (pointMenuProps.list.length === 1) {
250
246
  pointMenuProps.show = false;
247
+ repeatTip();
251
248
  console.log("\u5F53\u524D\u65F6\u95F4\u6BB5\u5185\u65E0\u53EF\u65B0\u589E\u8282\u70B9");
252
249
  }
253
250
  } else {
254
251
  pointMenuProps.target = event2.target;
255
252
  pointMenuProps.list = ["\u5220\u9664\u8282\u70B9"];
256
- yScaleValue.forEach((item) => {
257
- if (getEqualXTypes(x, "key").includes(item.key)) {
253
+ canvas.value.forEachObject((obj) => {
254
+ if (obj.origin && obj.left === event2.target.left && obj.top === event2.target.top) {
258
255
  pointMenuProps.list.push({
259
- ...getPointMenuList(item, event2.pointer),
260
- mode: "delete",
261
- index: event2.target.origin.index
256
+ renderItem: () => obj.origin.title,
257
+ origin: { ...obj.origin },
258
+ mode: "remove",
259
+ pointer: event2.pointer
262
260
  });
263
261
  }
264
262
  });
@@ -283,20 +281,120 @@ function useBirthProcess(canvas, propItems, emits) {
283
281
  function clickMenu({ item, target }) {
284
282
  console.log("item :>> ", item);
285
283
  const params = {
286
- data: {
287
- time: getXValue(item.pointer.x),
288
- value: getYValue(item.origin.key, item.pointer.y)
289
- },
290
284
  ...item.origin
291
285
  };
292
- if (item.mode === "delete") {
293
- emits("delete", params);
294
- updateData(params, "delete");
286
+ if (item.mode === "remove") {
287
+ emits("remove", params);
288
+ updateData(params, "remove");
295
289
  } else {
290
+ Object.assign(params, {
291
+ data: {
292
+ time: getXValue(item.pointer.x),
293
+ value: getYValue(item.origin.key, item.pointer.y)
294
+ }
295
+ });
296
296
  emits("add", params);
297
297
  updateData(params);
298
298
  }
299
299
  }
300
+ function drawIcons() {
301
+ const leftX = leftAddAreaWidth / 2;
302
+ const rightX = canvasWidth - rightAddAreaWidth / 2;
303
+ _drawIcons(leftScales, leftX);
304
+ _drawIcons(rightScales, rightX);
305
+ function _drawIcons(scales, left) {
306
+ if (!scales.length)
307
+ return;
308
+ let topY = originY;
309
+ const objs = [];
310
+ scales.forEach((item) => {
311
+ const title = item.title.split("").join("\n");
312
+ const dataIndex = scaleValues.findIndex((_item) => _item.key === item.key);
313
+ const text = new fabric.Text(String(title), {
314
+ ...defaultTextStyle,
315
+ ...item.titleStyle || {},
316
+ originY: "top",
317
+ left,
318
+ top: topY,
319
+ lineHeight: 1
320
+ });
321
+ const icon = drawPoint(item.type, {
322
+ left,
323
+ top: topY + text.height + 3,
324
+ ...item.pointAttr,
325
+ originY: "top",
326
+ origin: {
327
+ title: item.title,
328
+ unit: item.unit,
329
+ type: item.type,
330
+ dataIndex,
331
+ key: item.key,
332
+ isMenu: true
333
+ },
334
+ originLeft: left,
335
+ originTop: topY + text.height + 3,
336
+ ...propItems.event
337
+ });
338
+ topY += text.height + icon.height + 15;
339
+ setIconEvent(icon);
340
+ objs.push(text, icon);
341
+ });
342
+ setVerticalCenter(objs);
343
+ canvas.value.add(...objs);
344
+ }
345
+ function setVerticalCenter(objs) {
346
+ const lastobj = objs.at(-1);
347
+ const wrapHalf = (endY - originY) / 2;
348
+ const contentHalf = (lastobj.height + lastobj.top - originY) / 2;
349
+ objs.forEach((obj) => {
350
+ const top = obj.top + wrapHalf - contentHalf;
351
+ obj.set({
352
+ top,
353
+ originTop: top
354
+ });
355
+ });
356
+ }
357
+ }
358
+ function setIconEvent(point) {
359
+ point.on("moving", () => {
360
+ point.set("originY", "center");
361
+ if (isLimit2(point)) {
362
+ moveLimit(point);
363
+ setPopup(point);
364
+ } else {
365
+ pointTipProps.show = false;
366
+ }
367
+ });
368
+ point.on("mouseup:before", (event2) => {
369
+ pointTipProps.show = false;
370
+ if (event2.e.button === 0) {
371
+ if (isLimit2(point)) {
372
+ const isRepeat = getEqualXTypes(point.left, "key", xCellWidth).includes(point.origin.key);
373
+ if (isRepeat) {
374
+ repeatTip();
375
+ } else {
376
+ const params = {
377
+ data: {
378
+ time: getXValue(point.left),
379
+ value: getYValue(point.origin.key, point.top)
380
+ },
381
+ ...point.origin
382
+ };
383
+ emits("add", params);
384
+ updateData(params);
385
+ }
386
+ }
387
+ }
388
+ setRestore(point);
389
+ });
390
+ function isLimit2(point2) {
391
+ const { left, top } = point2;
392
+ return left >= originX && left <= endX && top >= originY && top <= endY;
393
+ }
394
+ }
395
+ function setRestore(point) {
396
+ point.setCoords().set({ originY: "top", left: point.originLeft, top: point.originTop });
397
+ }
300
398
  function drawXScale() {
301
399
  const { show, startTime: startTime2, range = [0, 23], position = "top", style } = xAxis.time;
302
400
  const { show: processTimeShow, range: processTimeRange = [0, 23], style: processTimeStyle } = xAxis.processTime;
@@ -400,18 +498,7 @@ function useBirthProcess(canvas, propItems, emits) {
400
498
  });
401
499
  canvas.value.add(border);
402
500
  }
403
- onMounted(() => {
404
- nextTick(() => {
405
- drawYScale();
406
- drawXScale();
407
- drawBorder();
408
- drawPolyLine();
409
- setCanvasEvent();
410
- });
411
- });
412
501
  return {
413
- pointTipProps,
414
- pointMenuProps,
415
502
  clickMenu
416
503
  };
417
504
  }
@@ -0,0 +1,25 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ export default function useBirthProcessChart(canvas: Ref<fabric.Canvas>, props: any, emits: any, canvasRef: Ref<any>): {
4
+ propItems: any;
5
+ redrawPoints: Ref<any>;
6
+ select: Ref<any>;
7
+ pointTipProps: {
8
+ show: boolean;
9
+ point: {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ list: string[];
14
+ };
15
+ pointMenuProps: {
16
+ show: boolean;
17
+ point: {
18
+ x: number;
19
+ y: number;
20
+ };
21
+ list: any[];
22
+ target: any;
23
+ };
24
+ clickMenu: Ref<any>;
25
+ };
@@ -0,0 +1,151 @@
1
+ import { ref, reactive, computed, onMounted, nextTick } from 'vue';
2
+ import { defaultBorderStyle } from './useDraw.js';
3
+ import '../utils/index.js';
4
+ import './useShadow.js';
5
+ import 'lodash-es';
6
+ import { useEvent, useCanvasEvent } from './useEvent.js';
7
+ import { useBirthProcess } from './useBirthProcess.js';
8
+ import { useCommon } from './useCommon.js';
9
+
10
+ function useBirthProcessChart(canvas, props, emits, canvasRef) {
11
+ const select = ref();
12
+ const redrawPoints = ref();
13
+ const clickMenu = ref();
14
+ const pointTipProps = reactive({
15
+ show: false,
16
+ point: { x: 0, y: 0 },
17
+ list: []
18
+ });
19
+ const pointMenuProps = reactive({
20
+ show: false,
21
+ point: { x: 0, y: 0 },
22
+ list: [],
23
+ target: null
24
+ });
25
+ const leftScales = computed(() => props.data.scaleValues.filter((item) => item.layout === "left"));
26
+ const rightScales = computed(() => props.data.scaleValues.filter((item) => item.layout === "right"));
27
+ const leftAddAreaWidth = 30;
28
+ const rightAddAreaWidth = computed(() => {
29
+ var _a;
30
+ return !((_a = rightScales.value) == null ? void 0 : _a.length) ? 0 : 30;
31
+ });
32
+ const originX = computed(() => {
33
+ var _a;
34
+ const leftScalesWidth = (_a = leftScales.value) == null ? void 0 : _a.reduce((width, item) => {
35
+ width += item.width;
36
+ return width;
37
+ }, 0);
38
+ return leftAddAreaWidth + leftScalesWidth;
39
+ });
40
+ const endX = computed(() => {
41
+ var _a;
42
+ const { width } = props.data;
43
+ const rightScalesWidth = (_a = rightScales.value) == null ? void 0 : _a.reduce((width2, item) => {
44
+ width2 += item.width;
45
+ return width2;
46
+ }, 0);
47
+ return width - rightAddAreaWidth.value - rightScalesWidth;
48
+ });
49
+ const gridXNumber = computed(() => props.data.grid.mainXCell);
50
+ const gridYNumber = computed(() => props.data.grid.mainYCell);
51
+ const xCellWidth = computed(() => {
52
+ return (endX.value - originX.value) / gridXNumber.value;
53
+ });
54
+ const yCellHeight = computed(() => {
55
+ const { xAxis, height } = props.data;
56
+ const xAxisNumber = Object.values(xAxis).reduce((num, item) => {
57
+ if (item.show)
58
+ num++;
59
+ return num;
60
+ }, 0);
61
+ return height / (gridYNumber.value + xAxisNumber);
62
+ });
63
+ const originY = computed(() => yCellHeight.value);
64
+ const originYCervix = computed(() => {
65
+ const { scaleValues } = props.data;
66
+ const cervixItem = scaleValues.find((item) => item.key === "cervix");
67
+ const [, max] = (cervixItem == null ? void 0 : cervixItem.range) || [0, 10];
68
+ const spaceValue = (cervixItem == null ? void 0 : cervixItem.spaceValue) || 1;
69
+ return endY.value - max * spaceValue * yCellHeight.value;
70
+ });
71
+ const endY = computed(() => {
72
+ const { height } = props.data;
73
+ return height - yCellHeight.value;
74
+ });
75
+ const startTime = computed(() => new Date(props.data.xAxis.time.startTime).getTime());
76
+ const timeXCell = computed(() => 1 * 60 * 60 * 1e3 / xCellWidth.value);
77
+ const cervixYCell = computed(() => {
78
+ const { scaleValues } = props.data;
79
+ const cervixItem = scaleValues.find((item) => item.key === "cervix");
80
+ return ((cervixItem == null ? void 0 : cervixItem.spaceValue) || 1) / yCellHeight.value;
81
+ });
82
+ const FHRYCell = computed(() => {
83
+ const { scaleValues } = props.data;
84
+ const cervixItem = scaleValues.find((item) => item.key === "FHR");
85
+ return ((cervixItem == null ? void 0 : cervixItem.spaceValue) || 10) / yCellHeight.value;
86
+ });
87
+ const fetalPresentationYCell = computed(() => {
88
+ const { scaleValues } = props.data;
89
+ const cervixItem = scaleValues.find((item) => item.key === "fetalPresentation");
90
+ return ((cervixItem == null ? void 0 : cervixItem.spaceValue) || 1) / yCellHeight.value;
91
+ });
92
+ const event = computed(() => {
93
+ var _a;
94
+ return ((_a = props.data.grid) == null ? void 0 : _a.event) || { selectable: true, evented: true, hovered: true };
95
+ });
96
+ const propItems = reactive({
97
+ canvasWidth: props.data.width,
98
+ canvasHeight: props.data.height,
99
+ borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle },
100
+ selectionStyle: props.data.selectionStyle || {},
101
+ grid: props.data.grid,
102
+ originX: originX.value,
103
+ endX: endX.value,
104
+ originY: originY.value,
105
+ endY: endY.value,
106
+ xCellWidth: xCellWidth.value,
107
+ yCellHeight: yCellHeight.value,
108
+ gridXNumber: gridXNumber.value,
109
+ gridYNumber: gridYNumber.value,
110
+ xAxis: props.data.xAxis,
111
+ leftScales: leftScales.value,
112
+ rightScales: rightScales.value,
113
+ leftAddAreaWidth,
114
+ rightAddAreaWidth: rightAddAreaWidth.value,
115
+ startTime: startTime.value,
116
+ timeXCell: timeXCell.value,
117
+ cervixYCell: cervixYCell.value,
118
+ FHRYCell: FHRYCell.value,
119
+ fetalPresentationYCell: fetalPresentationYCell.value,
120
+ scaleValues: props.data.scaleValues,
121
+ event: event.value,
122
+ originYCervix: originYCervix.value
123
+ });
124
+ const commonFunc = useCommon(canvas);
125
+ onMounted(() => {
126
+ nextTick(() => {
127
+ const { clickMenu: _clickMenu } = useBirthProcess(
128
+ canvas,
129
+ propItems,
130
+ emits,
131
+ pointTipProps,
132
+ pointMenuProps,
133
+ commonFunc
134
+ );
135
+ clickMenu.value = _clickMenu;
136
+ useEvent(canvasRef.value);
137
+ const { select: _select } = useCanvasEvent(canvas, propItems, emits);
138
+ select.value = _select;
139
+ });
140
+ });
141
+ return {
142
+ propItems,
143
+ redrawPoints,
144
+ select,
145
+ pointTipProps,
146
+ pointMenuProps,
147
+ clickMenu
148
+ };
149
+ }
150
+
151
+ export { useBirthProcessChart as default };
@@ -2,7 +2,7 @@ import { Ref } from 'vue';
2
2
  import { fabric } from '../utils';
3
3
  import { IPropItems } from '../interface';
4
4
  import { AnyObject } from '../../../../../es/shared/types';
5
- export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: any, pointMenuProps: any, useCommon: AnyObject): {
5
+ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined, pointTipProps: any, pointMenuProps: any, commonFunc: AnyObject): {
6
6
  pointTipProps: any;
7
7
  pointMenuProps: any;
8
8
  clickMenu: ({ item, target }: {