cnhis-design-vue 3.4.0-beta.43 → 3.4.0-beta.45

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.
@@ -134,6 +134,33 @@ function useCenter(canvas, propItems, emits, computedX, computedY, getXValue, ge
134
134
  const line = drawLine([originX, y, endX, y], scaleValue.positionLine);
135
135
  canvas.value.add(line);
136
136
  }
137
+ function creatShaDowBorder(points, mode, style) {
138
+ const borderGroup = new fabric.Group();
139
+ const lines = [];
140
+ const drawnLines = /* @__PURE__ */ new Set();
141
+ for (let i = 0; i < points.length; i++) {
142
+ const nextIndex = (i + 1) % points.length;
143
+ const startPoint = points[i];
144
+ const endPoint = points[nextIndex];
145
+ const lineKey1 = `${startPoint.x},${startPoint.y},${endPoint.x},${endPoint.y}`;
146
+ const lineKey2 = `${endPoint.x},${endPoint.y},${startPoint.x},${startPoint.y}`;
147
+ if (drawnLines.has(lineKey1) || drawnLines.has(lineKey2)) {
148
+ continue;
149
+ }
150
+ if (startPoint.x === endPoint.x && startPoint.y === endPoint.y || mode === "line" && startPoint.x === endPoint.x) {
151
+ continue;
152
+ }
153
+ drawnLines.add(lineKey1);
154
+ const line = new fabric.Line([startPoint.x, startPoint.y, endPoint.x, endPoint.y], {
155
+ ...defaultStyle,
156
+ ...style,
157
+ strokeWidth: 1
158
+ });
159
+ lines.push(line);
160
+ }
161
+ borderGroup.add(...lines).addWithUpdate();
162
+ return borderGroup;
163
+ }
137
164
  function drawShaDow(target) {
138
165
  var _a;
139
166
  const pulseObj = yScaleValue.find((item) => item.show && item.type === "pulse");
@@ -174,23 +201,19 @@ function useCenter(canvas, propItems, emits, computedX, computedY, getXValue, ge
174
201
  x: v[0],
175
202
  y: v[1]
176
203
  }));
177
- const polygon = new fabric.Polygon(points, {
204
+ const polygon = mode === "color" ? new fabric.Polygon(points, {
178
205
  ...defaultStyle,
179
206
  ...style,
180
207
  strokeWidth: 1
181
- });
208
+ }) : creatShaDowBorder(points, mode, style);
182
209
  if (["slash", "line"].includes(mode)) {
183
- polygon.set({
184
- fill: "transparent",
185
- stroke: style.stroke || "#f00"
186
- });
187
210
  const shadowLines = [];
188
211
  if (["slash"].includes(mode)) {
189
212
  shadowLines.push(...createShadowLines(item, style._angle, style.space, omit(style, ["_angle", "space"])));
190
213
  shadowLines.forEach((l) => {
191
214
  shadowLinesCache.add(l);
192
215
  });
193
- } else {
216
+ } else if (!style.onlyBorder) {
194
217
  const finalData = getLineData(item);
195
218
  if (finalData.length > 0) {
196
219
  const otherFilters = otherLineData.filter(([[x1, _]]) => {
@@ -405,7 +405,7 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<import("v
405
405
  beforeCloseFn: () => Promise<unknown>;
406
406
  cancel: () => Promise<void>;
407
407
  getScaleData: () => any;
408
- batchInjectFormNew: (data: import("../../shared/types").AnyObject, skipValid?: boolean) => Promise<void>;
408
+ batchInjectFormNew: (data: import("../../shared/types").AnyObject, skipValid?: boolean) => Promise<boolean>;
409
409
  readonly isCollection: (e: string) => boolean;
410
410
  NoData: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
411
411
  noDataTip: {
@@ -404,7 +404,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
404
404
  beforeCloseFn: () => Promise<unknown>;
405
405
  cancel: () => Promise<void>;
406
406
  getScaleData: () => any;
407
- batchInjectFormNew: (data: AnyObject, skipValid?: boolean) => Promise<void>;
407
+ batchInjectFormNew: (data: AnyObject, skipValid?: boolean) => Promise<boolean>;
408
408
  readonly isCollection: (e: string) => boolean;
409
409
  NoData: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
410
410
  noDataTip: {
@@ -1,5 +1,5 @@
1
1
  import { i18n } from '../../../_virtual/_virtual_i18n-methods.js';
2
- import { defineComponent, reactive, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, Fragment, createBlock, mergeProps, createCommentVNode, createElementVNode, createVNode, withCtx, renderList, toDisplayString, createTextVNode, resolveDynamicComponent, renderSlot } from 'vue';
2
+ import { defineComponent, reactive, ref, watch, nextTick, onUnmounted, openBlock, createElementBlock, normalizeClass, unref, Fragment, createBlock, mergeProps, createCommentVNode, createElementVNode, createVNode, withCtx, renderList, toDisplayString, createTextVNode, resolveDynamicComponent, renderSlot } from 'vue';
3
3
  import useNoData from './hooks/use-noData.js';
4
4
  import { ScaleViewProps } from './hooks/scaleview-props.js';
5
5
  import { getScaleViewState } from './hooks/scaleview-state.js';
@@ -219,12 +219,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
219
219
  };
220
220
  const batchInjectFormNew = async (data, skipValid = false) => {
221
221
  window._beforeCloseFn = null;
222
- await batchInjectForm(data, skipValid);
222
+ const batchStatus = await batchInjectForm(data, skipValid);
223
223
  if (!skipValid || !props.closeConfirm)
224
- return;
224
+ return batchStatus;
225
225
  formChecker.setInitialSnapshot(state.form);
226
226
  window._beforeCloseFn = beforeCloseFn;
227
+ return batchStatus;
227
228
  };
229
+ onUnmounted(() => {
230
+ if (window._beforeCloseFn) {
231
+ window._beforeCloseFn = null;
232
+ }
233
+ });
228
234
  __expose({
229
235
  getScaleData,
230
236
  onSubmitForm,
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.4.0-beta.43";
2
+ var version = "3.4.0-beta.45";
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.43",
3
+ "version": "3.4.0-beta.45",
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": "f0a7f225fcd87a9e4607b79812a027d03e927a8f"
76
+ "gitHead": "d3ced341f7fb5a1e994e5a2b243c90491941f4b4"
77
77
  }