cnhis-design-vue 3.1.15-beta.0 → 3.1.15-beta.1

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,4 +1,4 @@
1
- import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createVNode, withModifiers } from 'vue';
1
+ import { defineComponent, ref, watch, openBlock, createBlock, unref, withCtx, createVNode, withModifiers } from 'vue';
2
2
  import SlotRender from '../../../../../src/components/SlotRender';
3
3
  import { cloneDeep, isObject, isArray } from 'lodash-es';
4
4
  import { NPopover, NInput } from 'naive-ui';
@@ -17,13 +17,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  setup(__props, { emit }) {
18
18
  const props = __props;
19
19
  const popoverRef = ref();
20
+ const show = ref(false);
21
+ watch(show, updateShow);
20
22
  const editContent = ref();
21
23
  const { getRowData } = useSeparateMap();
22
- function updateShow(show) {
24
+ function updateShow(show2) {
23
25
  const target = getRowData(props.row);
24
26
  if (!target)
25
27
  return;
26
- if (show) {
28
+ if (show2) {
27
29
  editContent.value = cloneDeep(target.row[props.col.field]);
28
30
  return;
29
31
  }
@@ -52,14 +54,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
52
54
  return openBlock(), createBlock(unref(NPopover), {
53
55
  ref_key: "popoverRef",
54
56
  ref: popoverRef,
55
- trigger: "click",
56
- "show-arrow": false,
57
- "onUpdate:show": updateShow
57
+ trigger: "manual",
58
+ show: show.value,
59
+ "onUpdate:show": _cache[3] || (_cache[3] = ($event) => show.value = $event),
60
+ "show-arrow": false
58
61
  }, {
59
62
  trigger: withCtx(() => [
60
63
  createVNode(Separate, {
61
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
62
- }, ["stop"])),
64
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => show.value = !show.value, ["stop"])),
63
65
  style,
64
66
  col: __props.col,
65
67
  row: __props.row
@@ -81,7 +83,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
83
  }, null, 8, ["value"]))
82
84
  ]),
83
85
  _: 1
84
- }, 512);
86
+ }, 8, ["show"]);
85
87
  };
86
88
  }
87
89
  });
@@ -31,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
31
31
  onFormChange?: ((...args: any[]) => any) | undefined;
32
32
  }>>;
33
33
  popoverRef: import("vue").Ref<any>;
34
+ show: import("vue").Ref<boolean>;
34
35
  emit: (event: "formChange", ...args: any[]) => void;
35
36
  editContent: import("vue").Ref<any>;
36
37
  getRowData: (row: AnyObject) => {
@@ -223,6 +223,7 @@ export declare const comps: {
223
223
  onFormChange?: ((...args: any[]) => any) | undefined;
224
224
  }>>;
225
225
  popoverRef: import("vue").Ref<any>;
226
+ show: import("vue").Ref<boolean>;
226
227
  emit: (event: "formChange", ...args: any[]) => void;
227
228
  editContent: import("vue").Ref<any>;
228
229
  getRowData: (row: import("../../../../src/types").AnyObject) => {
@@ -8,6 +8,18 @@ import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
8
8
  function isEffectiveNode(node) {
9
9
  return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
10
10
  }
11
+ function getPointArr(arr) {
12
+ let _arr = [];
13
+ return arr.reduce((pre, cur, index) => {
14
+ var _a, _b;
15
+ _arr.push([cur.left, cur.top]);
16
+ if (((_b = (_a = cur.origin) == null ? void 0 : _a.data) == null ? void 0 : _b.breakpoint) || arr.length - 1 === index) {
17
+ pre.push(_arr);
18
+ _arr = [];
19
+ }
20
+ return pre;
21
+ }, []);
22
+ }
11
23
  function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
12
24
  useGrid(canvas, propItems);
13
25
  const {
@@ -36,6 +48,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
36
48
  target: null
37
49
  });
38
50
  const shadowLinesCache = /* @__PURE__ */ new Set();
51
+ let shadowPointCache = [];
39
52
  const maiboPoints = /* @__PURE__ */ new Set();
40
53
  const otherPoints = /* @__PURE__ */ new Set();
41
54
  const prevLines = /* @__PURE__ */ new Set();
@@ -45,7 +58,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
45
58
  });
46
59
  });
47
60
  function init() {
48
- drawShaDow();
61
+ shadowPointCache = [];
49
62
  maiboPoints.clear();
50
63
  otherPoints.clear();
51
64
  prevLines.clear();
@@ -55,6 +68,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
55
68
  drawPolyLine(item, dataIndex, scaleValue);
56
69
  });
57
70
  });
71
+ drawShaDow();
58
72
  drawOverlapPoint();
59
73
  setCanvasEvent();
60
74
  }
@@ -67,89 +81,34 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
67
81
  canvas.value.renderAll();
68
82
  }
69
83
  function drawShaDow(target) {
70
- var _a, _b;
84
+ var _a;
71
85
  const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
72
86
  if (!pulseObj || !((_a = pulseObj.dataList) == null ? void 0 : _a.length))
73
87
  return;
74
88
  if (shadowLinesCache.size)
75
89
  canvas.value.remove(...shadowLinesCache);
76
90
  shadowLinesCache.clear();
77
- const data = [];
78
- if (((_b = pulseObj.dataList) == null ? void 0 : _b.length) > 1) {
79
- let points1 = [];
80
- let points2 = [];
81
- const copyDataList = JSON.parse(JSON.stringify(pulseObj.dataList));
91
+ if (shadowPointCache.length > 1) {
82
92
  if (target) {
83
93
  const { type, dataIndex, index } = target.origin || {};
84
94
  if (type === "pulse") {
85
- Object.assign(copyDataList[dataIndex].list[index], {
86
- x: target.left,
87
- y: target.top
88
- });
95
+ shadowPointCache[dataIndex].splice(index, 1, target);
89
96
  }
90
97
  }
91
- const [data1, data2] = copyDataList;
92
- const getPoint = (item) => {
93
- if (item.x && item.y) {
94
- return {
95
- x: item.x,
96
- y: item.y
97
- };
98
- }
99
- const point = getPointer(item, pulseObj);
100
- if (point == null ? void 0 : point.length) {
101
- return {
102
- x: point[0],
103
- y: point[1]
104
- };
105
- }
106
- };
107
- data1.list.forEach((item, index) => {
108
- const point1 = getPoint(item);
109
- const item2 = data2.list[index];
110
- const point2 = item2 ? getPoint(item2) : null;
111
- if (point1 && point2 && point1.x === point2.x && point1.y !== point2.y) {
112
- points1.push(point1);
113
- points2.push(point2);
114
- const itemPrev = data1.list[index - 1];
115
- const itemNext = data1.list[index + 1];
116
- const itemNext2 = data2.list[index + 1];
117
- if (itemPrev && points1.length === 1) {
118
- const point = getPoint(itemPrev);
119
- point && points1.unshift(point);
120
- }
121
- if (itemNext && itemNext2) {
122
- const pointNext = getPoint(itemNext);
123
- const pointNext2 = getPoint(itemNext2);
124
- if (pointNext && pointNext2 && pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
125
- points1.push(pointNext);
126
- }
127
- } else {
128
- data.push({ points1, points2 });
129
- }
130
- } else {
131
- if (points1.length && points2.length) {
132
- data.push({ points1, points2 });
133
- points1 = [];
134
- points2 = [];
135
- }
136
- }
137
- });
138
- }
139
- if (data.length) {
140
- const newData = data.reduce((pre, cur) => {
141
- const arr1 = cur.points1.map((v) => [v.x, v.y]);
142
- const arr2 = cur.points2.map((v) => [v.x, v.y]);
143
- return pre.concat([[...arr1, ...arr2.reverse()]]);
144
- }, []);
98
+ const [data1, data2] = shadowPointCache;
99
+ if (!data1.length || !data2.length)
100
+ return;
101
+ const points1 = getPointArr(data1);
102
+ const points2 = getPointArr(data2);
103
+ const data = points1.reduce((pre, cur, index) => pre.concat([[...cur, ...points2[index].reverse()]]), []);
145
104
  const { createShadowLines } = useShadow();
146
- newData.forEach((item) => {
147
- var _a2, _b2, _c, _d;
105
+ data.forEach((item) => {
106
+ var _a2, _b, _c, _d;
148
107
  if (((_a2 = pulseObj.shadow) == null ? void 0 : _a2.mode) == "color") {
149
108
  const points = item.map((v) => ({ x: v[0], y: v[1] }));
150
109
  const polygon = new fabric.Polygon(points, {
151
110
  ...defaultStyle,
152
- ...((_b2 = pulseObj.shadow) == null ? void 0 : _b2.style) || {}
111
+ ...((_b = pulseObj.shadow) == null ? void 0 : _b.style) || {}
153
112
  });
154
113
  shadowLinesCache.add(polygon);
155
114
  canvas.value.add(polygon);
@@ -414,6 +373,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
414
373
  pointList.push(point);
415
374
  }
416
375
  });
376
+ scaleValue.type === "pulse" && shadowPointCache.push(pointList);
417
377
  Promise.all(pointList).then((res) => {
418
378
  const lineListFilter = lineList.filter((v) => v);
419
379
  let prevPoint = null;
@@ -1,5 +1,4 @@
1
1
  import { AnyObject, ArrayAble } from '../../../../../es/src/types';
2
- import { SchemaReaction } from '@formily/json-schema/esm/types';
3
2
  import { SchemaTypes } from '@formily/vue';
4
3
  import { CSSProperties, VNode } from 'vue';
5
4
  import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
@@ -41,6 +40,20 @@ interface SwitchProperty {
41
40
  value?: any;
42
41
  describe?: string;
43
42
  }
43
+ interface ReactionType {
44
+ dependencies?: string[];
45
+ target?: string;
46
+ when?: string | boolean;
47
+ fulfill?: {
48
+ state?: AnyObject;
49
+ run?: string;
50
+ };
51
+ otherwise?: {
52
+ state?: AnyObject;
53
+ run?: string;
54
+ };
55
+ [key: string]: any;
56
+ }
44
57
  export declare type FieldItem = {
45
58
  /**
46
59
  * 字段的key
@@ -181,7 +194,7 @@ export declare type FieldItem = {
181
194
  /**
182
195
  * 表单联动配置
183
196
  */
184
- reactions: ArrayAble<SchemaReaction>;
197
+ reactions: ArrayAble<ReactionType>;
185
198
  [key: string]: any;
186
199
  }>;
187
200
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.15-beta.0",
4
+ "version": "3.1.15-beta.1",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",