cnhis-design-vue 3.4.0-beta.50 → 3.4.0-beta.52

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.
@@ -1,5 +1,5 @@
1
1
  import { fabric } from '../../../../../shared/utils/fabricjs/index.js';
2
- import { useThrottleFn } from '@vueuse/core';
2
+ import { useDebounceFn, useThrottleFn } from '@vueuse/core';
3
3
  import { range } from 'lodash-es';
4
4
  import { useDetailEvent } from './hooks/useDetailEvent.js';
5
5
  import { defaultStyle, drawLine } from '../useDraw.js';
@@ -71,15 +71,17 @@ function useElectrocardiogram(canvas, propItems, flag) {
71
71
  const { x, y, rowIdx, limitX } = lineItem.origin;
72
72
  const lineLength = lineItem.data.length;
73
73
  const showLength = idx < ECG.MAXLINENUMBER - 1 ? getShowLength(lineItem.data) : lineLength;
74
- const points = lineItem.data.reduce((res, value, _idx) => {
75
- let _res = _idx >= startIdx && _idx <= startIdx + showLength ? [{ x: computedX(res.length + 1), y: computedY(-+value) + y }] : [];
76
- if (_res.length) {
77
- if (idx < ECG.MAXLINENUMBER - 1 && _res[0].x > limitX) {
78
- _res = [];
79
- }
74
+ const points = [];
75
+ let pointIndex = 0;
76
+ for (let _idx = startIdx; _idx <= startIdx + showLength && _idx < lineLength; _idx++) {
77
+ const value = lineItem.data[_idx];
78
+ const point = { x: computedX(pointIndex + 1), y: computedY(-+value) + y };
79
+ if (idx < ECG.MAXLINENUMBER - 1 && point.x > limitX) {
80
+ break;
80
81
  }
81
- return res.concat(_res);
82
- }, []);
82
+ points.push(point);
83
+ pointIndex++;
84
+ }
83
85
  const polyline = new fabric.Polyline(points, {
84
86
  ...lineStyle,
85
87
  fill: "transparent",
@@ -105,8 +107,7 @@ function useElectrocardiogram(canvas, propItems, flag) {
105
107
  detailRadius: 370,
106
108
  beforeEvent: () => flag.value && Promise.reject()
107
109
  });
108
- polyline.startIdx = startIdx;
109
- if (idx < dataList.length - 1 || overflowIsScroll) {
110
+ if (idx < ECG.MAXLINENUMBER - 1 || overflowIsScroll) {
110
111
  gridPoints.add(polyline);
111
112
  } else {
112
113
  fixedPointsCache.add(polyline);
@@ -187,22 +188,30 @@ function useElectrocardiogram(canvas, propItems, flag) {
187
188
  });
188
189
  canvas.value.add(...lines);
189
190
  }
190
- const updatePolyline = useThrottleFn((percent) => {
191
- const showLength = getShowLength(dataList[dataList.length - 1].data);
192
- if (showLength === dataList[0].data.length)
191
+ let currentStartIdx = -1;
192
+ let isUpdating = false;
193
+ const debouncedUpdate = useDebounceFn((startIdx) => {
194
+ if (isUpdating || currentStartIdx === startIdx)
193
195
  return;
194
- const totalLength = dataList[dataList.length - 1].data.length;
195
- const startIdx = ~~(percent * totalLength);
196
+ isUpdating = true;
197
+ currentStartIdx = startIdx;
196
198
  fabric.util.requestAnimFrame(() => {
197
199
  if (gridPoints.size) {
198
- const [firstPoint] = [...gridPoints];
199
- if (firstPoint.startIdx === startIdx)
200
- return;
201
- [...gridPoints].forEach((point) => canvas.value.remove(point));
200
+ const pointsArray = [...gridPoints];
201
+ canvas.value.remove(...pointsArray);
202
202
  gridPoints.clear();
203
203
  }
204
204
  drawPolyLine(startIdx);
205
+ isUpdating = false;
205
206
  });
207
+ }, 100);
208
+ const updatePolyline = useThrottleFn((percent) => {
209
+ const showLength = getShowLength(dataList[dataList.length - 1].data);
210
+ if (showLength === dataList[0].data.length)
211
+ return;
212
+ const totalLength = dataList[dataList.length - 1].data.length;
213
+ const startIdx = ~~(percent * totalLength);
214
+ debouncedUpdate(startIdx);
206
215
  }, 150);
207
216
  function drawBorder() {
208
217
  const { strokeWidth } = borderStyle;
@@ -133,7 +133,7 @@ function useFormExposeEvent({
133
133
  wordbookSettingHandler2.triggerDisabled = options.avoidWordbookSettingConnection;
134
134
  operationalFormHandler.triggerDisabled = options.avoidOperationalFormConnection;
135
135
  if (options.needSplitExtendKey) {
136
- values = splitExtendKey(getFieldList(), values);
136
+ values = splitExtendKey(getFieldList(), values, !!options.overwrite);
137
137
  }
138
138
  if (options.avoidFormChangeEvent) {
139
139
  emitFormChange.value = false;
@@ -18,7 +18,7 @@ export declare function createSlot(renderer: unknown, props: AnyObject, defaultR
18
18
  export declare function createInputSlot(props: AnyObject, defaultRenderer?: (v: unknown) => unknown[]): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}, any, {}>>>;
19
19
  export declare function validateMessageParser(message: string, fieldItem: Omit<FieldItem, 'reactions'>): string;
20
20
  export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
21
- export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
21
+ export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject, overwrite: boolean): AnyObject;
22
22
  export declare function isNestedType(type?: string): boolean | "" | undefined;
23
23
  export declare function isNestedFieldType(field: FieldItem | GeneralField): boolean | "" | undefined;
24
24
  export declare function renderOptionLabel(option: AnyObject, labelKey: string): any;
@@ -136,7 +136,7 @@ function combineExtendKey(fieldList, values) {
136
136
  });
137
137
  return result;
138
138
  }
139
- function splitExtendKey(fieldList, values) {
139
+ function splitExtendKey(fieldList, values, overwrite) {
140
140
  const fieldListWithExtendKey = findExtendKeyField(fieldList);
141
141
  if (!fieldListWithExtendKey.length)
142
142
  return values;
@@ -156,7 +156,10 @@ function splitExtendKey(fieldList, values) {
156
156
  }) => {
157
157
  if (Reflect.has(result, val_key))
158
158
  return;
159
- result[val_key] = queryFieldValue(extendKey)[val_key];
159
+ const value = queryFieldValue(extendKey)[val_key];
160
+ if (value == null && !overwrite)
161
+ return;
162
+ result[val_key] = value;
160
163
  });
161
164
  return result;
162
165
  }
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.4.0-beta.50";
2
+ var version = "3.4.0-beta.52";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.4.0-beta.50",
3
+ "version": "3.4.0-beta.52",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -73,5 +73,5 @@
73
73
  "iOS 7",
74
74
  "last 3 iOS versions"
75
75
  ],
76
- "gitHead": "2c49a610d85f6705857cf1168ffd41653a4604fc"
76
+ "gitHead": "577e344e6eb94688fb0152288073d483d17e9a0f"
77
77
  }