cnhis-design-vue 3.4.0-beta.56 → 3.4.0-beta.58

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 { reactive, computed, watch, toRefs } from 'vue';
1
+ import { reactive, watch, toRefs } from 'vue';
2
2
  import { defaultBorderStyle } from '../useDraw.js';
3
3
  import '../../../../../shared/utils/fabricjs/index.js';
4
4
  import { useCumputedPoint } from '../useCumputedPoint.js';
@@ -28,284 +28,206 @@ function useTemperatureChart(canvas, props, emits, canvasRef, pointTipProps, poi
28
28
  redrawPoints: null,
29
29
  clickMenu: null
30
30
  });
31
- const painSurplusCell = computed(() => {
32
- const { painSurplusCell: painSurplusCell2 = [0, 0] } = props.data.grid || {};
33
- if (!~painIndex.value)
34
- return [0, 0];
35
- return painSurplusCell2;
36
- });
37
- const surplusCell = computed(() => {
38
- var _a, _b;
39
- const surplusCell2 = ((_b = (_a = props.data.grid) == null ? void 0 : _a.surplusCell) == null ? void 0 : _b.slice()) || [0, 0, 0, 0];
40
- if (painIndex.value === 0) {
41
- surplusCell2[0] = surplusCell2[0] + painSurplusCell.value[1];
42
- } else if (painIndex.value > 0) {
43
- surplusCell2[2] = surplusCell2[2] + painSurplusCell.value[0];
44
- }
45
- return surplusCell2;
46
- });
47
- const mainSurplusCell = computed(() => {
48
- if (painIndex.value === 0) {
49
- return [painSurplusCell.value[0], surplusCell.value[1], surplusCell.value[2], surplusCell.value[3]];
50
- } else if (painIndex.value > 0) {
51
- return [surplusCell.value[0], surplusCell.value[1], painSurplusCell.value[1], surplusCell.value[3]];
52
- }
53
- return surplusCell.value;
54
- });
55
- const dateHeight = computed(() => {
56
- const { top } = props.data;
57
- return top.date.show && (top.date.height || defaultHeight) || 0;
58
- });
59
- const hospitalDaysHeight = computed(() => {
60
- var _a;
61
- const { top } = props.data;
62
- return ((_a = top.hospitalDays) == null ? void 0 : _a.show) && (top.hospitalDays.height || defaultHeight) || 0;
63
- });
64
- const operationDaysHeight = computed(() => {
65
- var _a;
66
- const { top } = props.data;
67
- return ((_a = top.operationDays) == null ? void 0 : _a.show) && (top.operationDays.height || defaultHeight) || 0;
68
- });
69
- const xScalevalueHeight = computed(() => {
70
- var _a, _b, _c;
71
- const { top } = props.data;
72
- const height = ((_a = top.xScalevalue) == null ? void 0 : _a.show) && (top.xScalevalue.height || defaultHeight) || 0;
73
- const dayHeight = ((_b = top.xScalevalue) == null ? void 0 : _b.show) ? (_c = top.dayHeight) != null ? _c : 0 : 0;
74
- return height + dayHeight;
75
- });
76
- const childbirthDaysHeight = computed(() => {
77
- var _a;
78
- const { top } = props.data;
79
- return ((_a = top.childbirthDays) == null ? void 0 : _a.show) && (top.childbirthDays.height || defaultHeight) || 0;
80
- });
81
- const breathingHeight = computed(() => {
82
- var _a;
83
- const { bottom } = props.data;
84
- return ((_a = bottom == null ? void 0 : bottom.breathing) == null ? void 0 : _a.show) && (bottom.breathing.height || defaultHeight * 2) || 0;
85
- });
86
- const gridXNumber = computed(() => {
87
- const { grid } = props.data;
88
- return grid.mainXCell * grid.subXCell + surplusCell.value[1] + surplusCell.value[3];
89
- });
90
- const gridYNumber = computed(() => {
91
- const { mainYCell, subYCell, painSubYCell = 5 } = props.data.grid;
92
- const painSurplusCellNumber = painIndex.value > 0 ? painSurplusCell.value[1] : painSurplusCell.value[0];
93
- return (mainYCell - 1) * subYCell + painSubYCell + surplusCell.value[0] + surplusCell.value[2] + painSurplusCellNumber;
94
- });
95
- const endX = computed(() => {
96
- var _a;
97
- const { width, right = null, top } = props.data;
98
- if (!right)
99
- return width;
100
- const endWidth = (_a = right.width) != null ? _a : 0;
101
- return width - endWidth;
102
- });
103
- const endXLimit = computed(() => {
104
- return endX.value - surplusCell.value[1] * xCellWidth.value;
105
- });
106
- const originX = computed(() => {
107
- const { top, left } = props.data;
108
- const originX2 = top.titleWidth + iconsWidth.value;
109
- return originX2;
110
- });
111
- const endY = computed(() => {
112
- const { bottom = null, height } = props.data;
113
- if (!bottom)
114
- return height;
115
- const endHeight = bottom.height || 30;
116
- return height - endHeight;
117
- });
118
- const originY = computed(() => {
119
- var _a;
120
- const { top } = props.data;
121
- const dayHeight = top.xScalevalue.show && ((_a = top.dayHeight) != null ? _a : 0) || 0;
122
- const xScaleHeight = top.xScalevalue.show && (top.xScalevalue.height || defaultHeight) || 0;
123
- const topHeight = dateHeight.value + dayHeight + xScaleHeight + hospitalDaysHeight.value + operationDaysHeight.value + childbirthDaysHeight.value;
124
- return topHeight;
125
- });
126
- const xCellWidth = computed(() => {
127
- return (endX.value - originX.value) / gridXNumber.value;
128
- });
129
- const yCellHeight = computed(() => {
130
- return (endY.value - originY.value) / gridYNumber.value;
131
- });
132
- const iconsWidth = computed(() => {
133
- var _a, _b;
134
- const { left } = props.data;
135
- return ((_a = left.icons) == null ? void 0 : _a.show) && (((_b = left.icons) == null ? void 0 : _b.width) || 100) || 0;
136
- });
137
- const xScaleList = computed(() => {
138
- var _a, _b;
139
- const { top, grid } = props.data;
140
- const dateList = ((_b = (_a = top.date.list) == null ? void 0 : _a.slice) == null ? void 0 : _b.call(_a, 0, grid.mainXCell)) || [];
141
- const times = top.xScalevalue.times;
142
- let left = originX.value - xCellWidth.value;
143
- const startDate = top.date.startDate || format(new Date(), "yyyy-MM-dd");
144
- const newDateList = dateList.reduce(
145
- (arr, item, index) => index === 0 ? arr.concat(startDate) : arr.concat(format(addDays(new Date(startDate.replace(/-/g, "/")), index), "yyyy-MM-dd")),
146
- []
147
- );
148
- const timeList = newDateList.map((item) => {
149
- return times.map((v) => {
150
- left += xCellWidth.value;
151
- const start = Date.parse(`${item} ${v.start}`);
152
- const end = Date.parse(`${item} ${v.end}`);
153
- return {
154
- start,
155
- end,
156
- left,
157
- center: left + xCellWidth.value / 2,
158
- scaleCell: (end - start) / xCellWidth.value
159
- };
160
- });
161
- });
162
- return flatten(timeList);
163
- });
164
- const event = computed(() => {
165
- var _a;
166
- return ((_a = props.data.grid) == null ? void 0 : _a.event) || { selectable: true, evented: true, hovered: true };
167
- });
168
- const itemList = computed(() => {
169
- const { left } = props.data;
170
- return flatten(
171
- left.yScaleValue.filter((v) => v.show).map((item) => {
172
- return item.dataList.filter((v) => v.show).map((v, dataIndex) => {
31
+ function buildDerived() {
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
33
+ const { grid, top, left, right, bottom } = props.data;
34
+ const iconsWidth = ((_a = left.icons) == null ? void 0 : _a.show) && (((_b = left.icons) == null ? void 0 : _b.width) || 100) || 0;
35
+ const dateHeight = top.date.show && (top.date.height || defaultHeight) || 0;
36
+ const hospitalDaysHeight = ((_c = top.hospitalDays) == null ? void 0 : _c.show) && (top.hospitalDays.height || defaultHeight) || 0;
37
+ const operationDaysHeight = ((_d = top.operationDays) == null ? void 0 : _d.show) && (top.operationDays.height || defaultHeight) || 0;
38
+ const xScaleHeight = ((_e = top.xScalevalue) == null ? void 0 : _e.show) && (top.xScalevalue.height || defaultHeight) || 0;
39
+ const dayHeight = ((_f = top.xScalevalue) == null ? void 0 : _f.show) ? (_g = top.dayHeight) != null ? _g : 0 : 0;
40
+ const xScalevalueHeight = xScaleHeight + dayHeight;
41
+ const childbirthDaysHeight = ((_h = top.childbirthDays) == null ? void 0 : _h.show) && (top.childbirthDays.height || defaultHeight) || 0;
42
+ const breathingHeight = ((_i = bottom == null ? void 0 : bottom.breathing) == null ? void 0 : _i.show) && (bottom.breathing.height || defaultHeight * 2) || 0;
43
+ const painIndex = (() => {
44
+ const index = left.yScaleValue.findIndex((v) => v.type === "pain");
45
+ return index > -1 && left.yScaleValue[index].show ? index : -1;
46
+ })();
47
+ const painSurplusCell = (() => {
48
+ const { painSurplusCell: painSurplusCell2 = [0, 0] } = grid || {};
49
+ if (!~painIndex)
50
+ return [0, 0];
51
+ return painSurplusCell2;
52
+ })();
53
+ const surplusCell = (() => {
54
+ var _a2;
55
+ const sc = ((_a2 = grid == null ? void 0 : grid.surplusCell) == null ? void 0 : _a2.slice()) || [0, 0, 0, 0];
56
+ if (painIndex === 0) {
57
+ sc[0] = sc[0] + painSurplusCell[1];
58
+ } else if (painIndex > 0) {
59
+ sc[2] = sc[2] + painSurplusCell[0];
60
+ }
61
+ return sc;
62
+ })();
63
+ const mainSurplusCell = (() => {
64
+ if (painIndex === 0) {
65
+ return [painSurplusCell[0], surplusCell[1], surplusCell[2], surplusCell[3]];
66
+ } else if (painIndex > 0) {
67
+ return [surplusCell[0], surplusCell[1], painSurplusCell[1], surplusCell[3]];
68
+ }
69
+ return surplusCell;
70
+ })();
71
+ const originX = top.titleWidth + iconsWidth;
72
+ const endX = !right ? props.data.width : props.data.width - ((_j = right.width) != null ? _j : 0);
73
+ const endXLimit = endX - surplusCell[1] * ((endX - originX) / (grid.mainXCell * grid.subXCell + surplusCell[1] + surplusCell[3]));
74
+ const endY = !bottom ? props.data.height : props.data.height - (bottom.height || 30);
75
+ const originY = dateHeight + dayHeight + xScaleHeight + hospitalDaysHeight + operationDaysHeight + childbirthDaysHeight;
76
+ const gridXNumber = grid.mainXCell * grid.subXCell + surplusCell[1] + surplusCell[3];
77
+ const { mainYCell, subYCell, painSubYCell = 5 } = grid;
78
+ const painSurplusCellNumber = painIndex > 0 ? painSurplusCell[1] : painSurplusCell[0];
79
+ const gridYNumber = (mainYCell - 1) * subYCell + painSubYCell + surplusCell[0] + surplusCell[2] + painSurplusCellNumber;
80
+ const xCellWidth = (endX - originX) / gridXNumber;
81
+ const yCellHeight = (endY - originY) / gridYNumber;
82
+ const xScaleList = (() => {
83
+ var _a2, _b2;
84
+ const dateList = ((_b2 = (_a2 = top.date.list) == null ? void 0 : _a2.slice) == null ? void 0 : _b2.call(_a2, 0, grid.mainXCell)) || [];
85
+ const times = top.xScalevalue.times;
86
+ let leftPos = originX - xCellWidth;
87
+ const startDate = top.date.startDate || format(new Date(), "yyyy-MM-dd");
88
+ const newDateList = dateList.reduce(
89
+ (arr, _item, index) => index === 0 ? arr.concat(startDate) : arr.concat(format(addDays(new Date(startDate.replace(/-/g, "/")), index), "yyyy-MM-dd")),
90
+ []
91
+ );
92
+ const timeList = newDateList.map((item) => {
93
+ return times.map((v) => {
94
+ leftPos += xCellWidth;
95
+ const start = Date.parse(`${item} ${v.start}`);
96
+ const end = Date.parse(`${item} ${v.end}`);
173
97
  return {
174
- ...v,
175
- bigType: setOtherType(v.key, item.type),
176
- unit: item.unit,
177
- dataIndex,
178
- isOneLine: isOneLine(item)
98
+ start,
99
+ end,
100
+ left: leftPos,
101
+ center: leftPos + xCellWidth / 2,
102
+ scaleCell: (end - start) / xCellWidth
179
103
  };
180
104
  });
181
- })
105
+ });
106
+ return flatten(timeList);
107
+ })();
108
+ const event = ((_k = props.data.grid) == null ? void 0 : _k.event) || { selectable: true, evented: true, hovered: true };
109
+ const itemList = flatten(
110
+ left.yScaleValue.filter((v) => v.show).map(
111
+ (item) => item.dataList.filter((v) => v.show).map((v, dataIndex) => ({
112
+ ...v,
113
+ bigType: setOtherType(v.key, item.type),
114
+ unit: item.unit,
115
+ dataIndex,
116
+ isOneLine: isOneLine(item)
117
+ }))
118
+ )
182
119
  );
183
- });
184
- const painScalePositionSurplusHeight = computed(() => {
185
- const { left } = props.data;
186
120
  const painItem = left.yScaleValue.find((v) => v.type === "pain");
187
- if (!painItem)
188
- return 0;
189
- const { numberVerticalPosition = "bottom", spaceGridNumber = 1 } = painItem;
190
- return numberVerticalPosition === "center" ? yCellHeight.value * spaceGridNumber / 2 : 0;
191
- });
192
- const painIndex = computed(() => {
193
- const { left } = props.data;
194
- const index = left.yScaleValue.findIndex((v) => v.type === "pain");
195
- return index > -1 && left.yScaleValue[index].show ? index : -1;
196
- });
197
- const painHeight = computed(() => {
198
- const { painSubYCell = 5 } = props.data.grid;
199
- return painIndex.value === -1 ? 0 : yCellHeight.value * painSubYCell;
200
- });
201
- const painBorderColor = computed(() => {
202
- const { left } = props.data;
203
- return (left.yScaleValue.find((v) => v.type === "pain") || {}).borderColor;
204
- });
205
- const painOriginY = computed(() => {
206
- const { left } = props.data;
207
- const obj = {
208
- originY: originY.value + painSurplusCell.value[0] * yCellHeight.value,
209
- endY: endY.value - painSurplusCell.value[1] * yCellHeight.value - painScalePositionSurplusHeight.value
210
- };
211
- if (painIndex.value === 0 && left.yScaleValue.length > 1) {
212
- obj.endY = obj.originY + painHeight.value - painScalePositionSurplusHeight.value;
213
- } else if (painIndex.value === left.yScaleValue.length - 1) {
214
- obj.originY = obj.endY - painHeight.value + painScalePositionSurplusHeight.value;
215
- }
216
- return obj;
217
- });
218
- const vitalSignsOriginY = computed(() => {
219
- const { left } = props.data;
220
- const obj = {
221
- originY: originY.value + surplusCell.value[0] * yCellHeight.value,
222
- endY: endY.value - surplusCell.value[2] * yCellHeight.value
223
- };
224
- if (painIndex.value === 0 && left.yScaleValue.length > 1) {
225
- obj.originY = painOriginY.value.endY + painScalePositionSurplusHeight.value + surplusCell.value[0] * yCellHeight.value;
226
- } else if (painIndex.value === left.yScaleValue.length - 1) {
227
- obj.endY = painOriginY.value.originY - surplusCell.value[2] * yCellHeight.value;
228
- }
229
- return obj;
230
- });
231
- const topList = computed(() => {
232
- var _a, _b;
233
- const { top, grid } = props.data;
234
- const topList2 = [];
235
- for (const i in top) {
236
- if (top[i].show) {
237
- topList2.push({
238
- ...top[i],
239
- list: ((_b = (_a = top[i].list) == null ? void 0 : _a.slice) == null ? void 0 : _b.call(_a, 0, grid.mainXCell)) || [],
240
- key: i
121
+ const painScalePositionSurplusHeight = (() => {
122
+ if (!painItem)
123
+ return 0;
124
+ const { numberVerticalPosition = "bottom", spaceGridNumber = 1 } = painItem;
125
+ return numberVerticalPosition === "center" ? yCellHeight * spaceGridNumber / 2 : 0;
126
+ })();
127
+ const painHeight = painIndex === -1 ? 0 : yCellHeight * ((_l = grid.painSubYCell) != null ? _l : 5);
128
+ const painBorderColor = (painItem || {}).borderColor;
129
+ const painOriginY = (() => {
130
+ const obj = {
131
+ originY: originY + painSurplusCell[0] * yCellHeight,
132
+ endY: endY - painSurplusCell[1] * yCellHeight - painScalePositionSurplusHeight
133
+ };
134
+ if (painIndex === 0 && left.yScaleValue.length > 1) {
135
+ obj.endY = obj.originY + painHeight - painScalePositionSurplusHeight;
136
+ } else if (painIndex === left.yScaleValue.length - 1) {
137
+ obj.originY = obj.endY - painHeight + painScalePositionSurplusHeight;
138
+ }
139
+ return obj;
140
+ })();
141
+ const vitalSignsOriginY = (() => {
142
+ const obj = {
143
+ originY: originY + surplusCell[0] * yCellHeight,
144
+ endY: endY - surplusCell[2] * yCellHeight
145
+ };
146
+ if (painIndex === 0 && left.yScaleValue.length > 1) {
147
+ obj.originY = painOriginY.endY + painScalePositionSurplusHeight + surplusCell[0] * yCellHeight;
148
+ } else if (painIndex === left.yScaleValue.length - 1) {
149
+ obj.endY = painOriginY.originY - surplusCell[2] * yCellHeight;
150
+ }
151
+ return obj;
152
+ })();
153
+ const topList = (() => {
154
+ var _a2, _b2;
155
+ const list = [];
156
+ for (const i in top) {
157
+ if (top[i].show) {
158
+ list.push({
159
+ ...top[i],
160
+ list: ((_b2 = (_a2 = top[i].list) == null ? void 0 : _a2.slice) == null ? void 0 : _b2.call(_a2, 0, grid.mainXCell)) || [],
161
+ key: i
162
+ });
163
+ }
164
+ }
165
+ return list.sort((a, b) => a.seq - b.seq);
166
+ })();
167
+ const getRightInfo = (() => {
168
+ var _a2;
169
+ const temperatureObj = left.yScaleValue.find((v) => v.type === "temperature");
170
+ const yScaleValue = (right == null ? void 0 : right.yScaleValue) ? { ...right.yScaleValue } : {};
171
+ if ((_a2 = temperatureObj == null ? void 0 : temperatureObj.list) == null ? void 0 : _a2.length) {
172
+ const detailedList = (yScaleValue == null ? void 0 : yScaleValue.showdetailedScale) ? temperatureObj.list.reduce((res) => {
173
+ const lastItem = res[res.length - 1];
174
+ return lastItem ? res.concat([lastItem + 1, lastItem + 2]) : res.concat([92]);
175
+ }, []) : [];
176
+ const list = temperatureObj.list.map((v) => getFloorNumber(1.8 * v + 32));
177
+ Object.assign(yScaleValue, {
178
+ list,
179
+ detailedList,
180
+ spaceGridNumber: temperatureObj.spaceGridNumber
241
181
  });
242
182
  }
243
- }
244
- return topList2.sort((a, b) => a.seq - b.seq);
245
- });
246
- const getRightInfo = computed(() => {
247
- var _a;
248
- const { left, right } = props.data;
249
- const temperatureObj = left.yScaleValue.find((v) => v.type === "temperature");
250
- const yScaleValue = (right == null ? void 0 : right.yScaleValue) || {};
251
- if ((_a = temperatureObj == null ? void 0 : temperatureObj.list) == null ? void 0 : _a.length) {
252
- const detailedList = (yScaleValue == null ? void 0 : yScaleValue.showdetailedScale) ? temperatureObj.list.reduce((res) => {
253
- const lastItem = res[res.length - 1];
254
- return lastItem ? res.concat([lastItem + 1, lastItem + 2]) : res.concat([92]);
255
- }, []) : [];
256
- const list = temperatureObj.list.map((v) => getFloorNumber(1.8 * v + 32));
257
- Object.assign(yScaleValue, {
258
- list,
259
- detailedList,
260
- spaceGridNumber: temperatureObj.spaceGridNumber
261
- });
262
- }
263
- return yScaleValue;
264
- });
265
- const propItems = reactive({
266
- canvasWidth: props.data.width,
267
- canvasHeight: props.data.height,
268
- borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle || {} },
269
- selectionStyle: props.data.selectionStyle || {},
270
- dateHeight: dateHeight.value,
271
- hospitalDaysHeight: hospitalDaysHeight.value,
272
- operationDaysHeight: operationDaysHeight.value,
273
- xScalevalueHeight: xScalevalueHeight.value,
274
- childbirthDaysHeight: childbirthDaysHeight.value,
275
- topList: topList.value,
276
- breathingHeight: breathingHeight.value,
277
- hospitalizationDate: props.data.hospitalizationDate,
278
- grid: props.data.grid,
279
- top: props.data.top,
280
- left: props.data.left,
281
- right: props.data.right,
282
- bottom: props.data.bottom,
283
- other: props.data.other,
284
- painIndex: painIndex.value,
285
- painHeight: painHeight.value,
286
- painOriginY: painOriginY.value,
287
- vitalSignsOriginY: vitalSignsOriginY.value,
288
- gridXNumber: gridXNumber.value,
289
- gridYNumber: gridYNumber.value,
290
- iconsWidth: iconsWidth.value,
291
- originX: originX.value,
292
- originY: originY.value,
293
- endX: endX.value,
294
- endXLimit: endXLimit.value,
295
- endY: endY.value,
296
- xCellWidth: xCellWidth.value,
297
- yCellHeight: yCellHeight.value,
298
- xScaleList: xScaleList.value,
299
- event: event.value,
300
- itemList: itemList.value,
301
- getRightInfo: getRightInfo.value,
302
- config: props.data.config || {},
303
- surplusCell: surplusCell.value,
304
- painSurplusCell: painSurplusCell.value,
305
- mainSurplusCell: mainSurplusCell.value,
306
- painScalePositionSurplusHeight: painScalePositionSurplusHeight.value,
307
- painBorderColor: painBorderColor.value
308
- });
183
+ return yScaleValue;
184
+ })();
185
+ return {
186
+ canvasWidth: props.data.width,
187
+ canvasHeight: props.data.height,
188
+ borderStyle: { ...defaultBorderStyle, ...props.data.borderStyle },
189
+ selectionStyle: props.data.selectionStyle || {},
190
+ dateHeight,
191
+ hospitalDaysHeight,
192
+ operationDaysHeight,
193
+ xScalevalueHeight,
194
+ childbirthDaysHeight,
195
+ topList,
196
+ breathingHeight,
197
+ hospitalizationDate: props.data.hospitalizationDate,
198
+ grid: props.data.grid,
199
+ top: props.data.top,
200
+ left: props.data.left,
201
+ right: props.data.right,
202
+ bottom: props.data.bottom,
203
+ other: props.data.other,
204
+ painIndex,
205
+ painHeight,
206
+ painOriginY,
207
+ vitalSignsOriginY,
208
+ gridXNumber,
209
+ gridYNumber,
210
+ iconsWidth,
211
+ originX,
212
+ originY,
213
+ endX,
214
+ endXLimit,
215
+ endY,
216
+ xCellWidth,
217
+ yCellHeight,
218
+ xScaleList,
219
+ event,
220
+ itemList,
221
+ getRightInfo,
222
+ config: props.data.config || {},
223
+ surplusCell,
224
+ painSurplusCell,
225
+ mainSurplusCell,
226
+ painScalePositionSurplusHeight,
227
+ painBorderColor
228
+ };
229
+ }
230
+ const propItems = reactive(buildDerived());
309
231
  const { computedX, computedY, getXValue, getYValue } = useCumputedPoint(propItems);
310
232
  watch(
311
233
  () => canvas.value,
@@ -39,6 +39,14 @@ function useNewLowCodeReactions(configListRef, formModel) {
39
39
  createFieldHandler((state, isPositive) => {
40
40
  state.disabled = isPositive;
41
41
  })
42
+ ],
43
+ [
44
+ ["setValue", "_"],
45
+ createFieldHandler((state, isPositive, { actionConfig: { value } = {} }) => {
46
+ if (!isPositive)
47
+ return;
48
+ state.value = value === null ? "null" : value === void 0 ? "undefined" : value;
49
+ })
42
50
  ]
43
51
  ]);
44
52
  const relativeFieldMap = computed(() => {
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.4.0-beta.56";
2
+ var version = "3.4.0-beta.58";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
@@ -88,19 +88,20 @@ export declare namespace LowCodeTypes {
88
88
  __oppositeBindField: reactionConfig;
89
89
  __oppositeTargetField: reactionConfig;
90
90
  }>;
91
- type reactionActionType = 'show' | 'hide' | 'required' | 'notRequired' | 'enabled' | 'disabled';
91
+ type reactionActionType = 'show' | 'hide' | 'required' | 'notRequired' | 'enabled' | 'disabled' | 'setValue';
92
92
  type reactionAction = {
93
93
  action: reactionActionType;
94
94
  fields: string[];
95
95
  actionConfig?: Partial<{
96
96
  restoreDefault: boolean;
97
97
  restoreEmpty: boolean;
98
+ value: unknown;
98
99
  }>;
99
100
  };
100
101
  type LowCodeConditions = {
101
102
  field: string;
102
103
  type: VALUE_RELATION;
103
- valueType?: 'const' | 'field';
104
+ valueType?: 'const' | 'field' | 'range';
104
105
  value?: any;
105
106
  };
106
107
  type newReactionConfig = {
@@ -66,10 +66,26 @@ function isMatchNewLowCodeConditionsWithSqlExpression(formData, config) {
66
66
  config.compareMap
67
67
  );
68
68
  }
69
+ if (condition.valueType === "range") {
70
+ return isInRange(value, condition.value);
71
+ }
69
72
  return isMatchLowCodeCondition(value, { con: condition.type, value: condition.value }, config.compareMap);
70
73
  });
71
74
  return isConditionsMatchSqlExpression(conditions, config.sqlExpression);
72
75
  }
76
+ function isInRange(value, range) {
77
+ if (!isArray(range) || range.length !== 2)
78
+ return false;
79
+ const [min, max] = range.map((v) => +v);
80
+ if (Number.isNaN(min) || Number.isNaN(max))
81
+ return false;
82
+ if (!isNumber(value) && !isString(value))
83
+ return false;
84
+ const numberValue = +value;
85
+ if (Number.isNaN(numberValue))
86
+ return false;
87
+ return numberValue >= min && numberValue <= max;
88
+ }
73
89
  function handleFieldTriggerSetValue(bindEventSetting, {
74
90
  getter,
75
91
  setter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.4.0-beta.56",
3
+ "version": "3.4.0-beta.58",
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": "8e39e86b98a7fdb66ec6beedf6222c779036e974"
76
+ "gitHead": "e1fd269cd0c3d98a766885c3abe074ec04c136d0"
77
77
  }