cnhis-design-vue 2.1.81 → 2.1.83

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 (44) hide show
  1. package/CHANGELOG.md +41 -22
  2. package/es/age/index.js +2 -2
  3. package/es/big-table/index.js +23 -23
  4. package/es/button/index.js +2 -2
  5. package/es/captcha/index.js +3 -3
  6. package/es/checkbox/index.js +1 -1
  7. package/es/color-picker/index.js +1 -1
  8. package/es/drag-layout/index.js +3 -3
  9. package/es/editor/index.js +1 -1
  10. package/es/ellipsis/index.js +1 -1
  11. package/es/fabric-chart/index.js +205 -74
  12. package/es/fabric-chart/style.css +1 -1
  13. package/es/form-table/index.js +20 -20
  14. package/es/index/index.js +414 -259
  15. package/es/index/style.css +1 -1
  16. package/es/input/index.js +1 -1
  17. package/es/map/index.js +1 -1
  18. package/es/multi-chat/index.js +25 -25
  19. package/es/multi-chat-client/index.js +19 -19
  20. package/es/multi-chat-history/index.js +4 -4
  21. package/es/multi-chat-record/index.js +4 -4
  22. package/es/multi-chat-setting/index.js +20 -20
  23. package/es/multi-chat-sip/index.js +1 -1
  24. package/es/radio/index.js +1 -1
  25. package/es/scale-container/index.js +1 -1
  26. package/es/scale-view/index.js +27 -27
  27. package/es/select/index.js +4 -4
  28. package/es/select-label/index.js +3 -3
  29. package/es/select-person/index.js +2 -2
  30. package/es/select-tag/index.js +4 -4
  31. package/es/shortcut-setter/index.js +2 -2
  32. package/es/table-filter/index.js +70 -46
  33. package/es/tag/index.js +1 -1
  34. package/es/verification-code/index.js +2 -2
  35. package/lib/cui.common.js +434 -283
  36. package/lib/cui.umd.js +434 -283
  37. package/lib/cui.umd.min.js +8 -8
  38. package/package.json +1 -1
  39. package/packages/fabric-chart/src/FabricChart.vue +12 -1
  40. package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +1 -0
  41. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +89 -8
  42. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +2 -0
  43. package/packages/table-filter/src/components/render-widget/components/Select.vue +12 -1
  44. package/packages/table-filter/src/mixins/mixins.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "2.1.81",
3
+ "version": "2.1.83",
4
4
  "description": "前端业务UI库",
5
5
  "keyword": "cnhis-design-vue vue cnhis",
6
6
  "homepage": "http://dv.cnhis.com/",
@@ -5,7 +5,15 @@
5
5
  <fabric-grid></fabric-grid>
6
6
  <fabric-scale-value v-if="hasTable" :templateData="templateData"></fabric-scale-value>
7
7
  <fabric-lines v-if="hasTopTable" ref="lines" :linesObj="templateData.top" v-on="$listeners"></fabric-lines>
8
- <fabric-polylines ref="polylines" v-if="hasTable" :polyline="polylines" :other="templateData.left.other || {}" @pointOperation="pointOperation" v-on="$listeners"></fabric-polylines>
8
+ <fabric-polylines
9
+ ref="polylines"
10
+ v-if="hasTable"
11
+ :polyline="polylines"
12
+ :other="templateData.left.other || {}"
13
+ :timeRangeStyle="templateData.timeRangeStyle || {}"
14
+ @pointOperation="pointOperation"
15
+ v-on="$listeners"
16
+ ></fabric-polylines>
9
17
  </fabric-canvas>
10
18
  </div>
11
19
  </template>
@@ -76,6 +84,9 @@ export default create({
76
84
  this.canvasWidth = `${this.templateData.canvasWidth}px` || '1000px';
77
85
  },
78
86
  methods: {
87
+ setTimeRange(enabled) {
88
+ this.$refs.polylines.timeRangeData.enabled = enabled;
89
+ },
79
90
  pointOperation(type, value) {
80
91
  switch (type) {
81
92
  case 'add':
@@ -329,6 +329,7 @@ export default {
329
329
  },
330
330
  destroyed() {
331
331
  this.canvas.clear();
332
+ this.canvas.off();
332
333
  this.canvas = null;
333
334
  // this.canvas.dispose();
334
335
  }
@@ -65,7 +65,8 @@ export default {
65
65
  other: {
66
66
  type: Object,
67
67
  default: () => {}
68
- }
68
+ },
69
+ timeRangeStyle: { type: Object }
69
70
  },
70
71
  components: {
71
72
  MouseRightClick,
@@ -87,7 +88,13 @@ export default {
87
88
  polylinePointList: [], // 缓存折线项目节点
88
89
  isMovingToOtherTarget: false,
89
90
  interval: null,
90
- flickerablePoints: [] // 记录需要闪烁的节点
91
+ flickerablePoints: [], // 记录需要闪烁的节点
92
+ timeRangeData: {
93
+ enabled: false, // 是否开启
94
+ line1: null,
95
+ line2: null,
96
+ rect: null
97
+ }
91
98
  };
92
99
  },
93
100
  computed: {
@@ -126,6 +133,17 @@ export default {
126
133
  createEvent() {
127
134
  this.canvas.on('mouse:up', event => {
128
135
  if (event.button === 3) {
136
+ // 取消时间范围选区状态
137
+ if (this.timeRangeData.enabled) {
138
+ Object.keys(this.timeRangeData).forEach(key => {
139
+ if (['enabled'].includes(key)) this.timeRangeData[key] = false;
140
+ if (['line1', 'line2', 'rect'].includes(key)) {
141
+ this.timeRangeData[key] && this.canvas.remove(this.timeRangeData[key]);
142
+ this.timeRangeData[key] = null;
143
+ }
144
+ });
145
+ return;
146
+ }
129
147
  const { x, y } = event.pointer;
130
148
  if (this.isGridLimit(x, y)) {
131
149
  this.activeEvent = event;
@@ -133,6 +151,7 @@ export default {
133
151
  this.isAddEventListenerContextmenu = true;
134
152
  }
135
153
  }
154
+
136
155
  // 左键松开鼠标-批量删除
137
156
  this.isSelectArea = false;
138
157
  if (event.button === 1 && !event.target && this.selectArea) {
@@ -147,7 +166,46 @@ export default {
147
166
  });
148
167
  let selectAreaOrigin = { left: 0, top: 0 };
149
168
  this.canvas.on('mouse:down', event => {
150
- if (event.button === 1 && !event.target) {
169
+ if (event.button !== 1) return;
170
+
171
+ // 处理时间范围选区
172
+ const { enabled, line1, line2, rect } = this.timeRangeData;
173
+ const { originY, endY, xScaleCellList } = this.propItems;
174
+ if (enabled) {
175
+ const left = xScaleCellList
176
+ .map(item => item.x)
177
+ .reduce((pre, curr) => {
178
+ return Math.abs(pre - event.pointer.x) > Math.abs(curr - event.pointer.x) ? curr : pre;
179
+ });
180
+ if (line1 && !line1.__fixed) {
181
+ line1.__fixed = true;
182
+ line1.setCoords().set({ x1: left, x2: left });
183
+ } else if (line2 && !line2.__fixed) {
184
+ line2.__fixed = true;
185
+ line2.setCoords().set({ x1: left, x2: left });
186
+ const [startLeft, endLeft] = [line1.x1, line2.x1].sort((a, b) => a - b);
187
+ this.timeRangeData.rect && this.canvas.remove(this.timeRangeData.rect);
188
+ this.timeRangeData.rect = new this.fabric.Rect({
189
+ ...defaultVaule.style,
190
+ fill: '#CAF982',
191
+ opacity: 0.4,
192
+ left: startLeft,
193
+ top: line1.y1,
194
+ width: endLeft - startLeft,
195
+ height: endY - originY,
196
+ ...(this.timeRangeStyle.rect || {})
197
+ });
198
+ this.canvas.add(this.timeRangeData.rect);
199
+
200
+ this.$emit('timeRangeChange', {
201
+ start: this.getXValue(startLeft),
202
+ end: this.getXValue(endLeft)
203
+ });
204
+ }
205
+ return;
206
+ }
207
+
208
+ if (!event.target) {
151
209
  this.isSelectArea = true;
152
210
  selectAreaOrigin.left = event.pointer.x;
153
211
  selectAreaOrigin.top = event.pointer.y;
@@ -155,6 +213,7 @@ export default {
155
213
  });
156
214
  this.canvas.on('mouse:move', event => {
157
215
  this.isSelectArea && this.createSelectArea(event, selectAreaOrigin);
216
+ this.setTimeRange(event.pointer);
158
217
  });
159
218
  },
160
219
  handleMoving(event) {
@@ -209,7 +268,30 @@ export default {
209
268
  ponits: [selectAreaOrigin.left, selectAreaOrigin.top, event.pointer.x, event.pointer.y]
210
269
  });
211
270
  this.canvas.add(this.selectArea);
212
- // this.canvas.renderAll();
271
+ },
272
+ createTimeRangeLine(line, pointer) {
273
+ const { originY, endY } = this.propItems;
274
+ const { x, y } = pointer;
275
+ this.timeRangeData[line] && this.canvas.remove(this.timeRangeData[line]);
276
+ this.timeRangeData[line] = this.drawLine([x, originY, x, endY], {
277
+ stroke: '#4b790287',
278
+ strokeWidth: 3,
279
+ ...(this.timeRangeStyle.line || {})
280
+ });
281
+ this.canvas.add(this.timeRangeData[line]);
282
+ },
283
+ setTimeRange(pointer) {
284
+ const { enabled, line1, line2 } = this.timeRangeData;
285
+ const { x, y } = pointer;
286
+ if (!enabled || !this.isGridLimit(x, y)) return;
287
+
288
+ // 使用setCoords().set({ x1: x, x2: x })方法更改其坐标会产生很明显的卡顿现象,可能是canvas.on('mouse:move')抛出的事件节流了
289
+
290
+ if (!line1?.__fixed) {
291
+ this.createTimeRangeLine('line1', pointer);
292
+ } else if (!line2?.__fixed) {
293
+ this.createTimeRangeLine('line2', pointer);
294
+ }
213
295
  },
214
296
  // 每一个折线类别
215
297
  createPolyline(polylineType, polylineTypeId) {
@@ -1012,16 +1094,15 @@ export default {
1012
1094
  // 折线点移动时 setCoords()方法手动更新相关联的线坐标
1013
1095
  pointMoveUpdateLine(point) {
1014
1096
  if (point.line1) {
1015
- point.line1.setCoords();
1016
- point.line1.set({ x2: point.left, y2: point.top });
1097
+ point.line1.setCoords().set({ x2: point.left, y2: point.top });
1017
1098
  }
1018
1099
  if (point.line2) {
1019
- point.line2.setCoords();
1020
- point.line2.set({ x1: point.left, y1: point.top });
1100
+ point.line2.setCoords().set({ x1: point.left, y1: point.top });
1021
1101
  }
1022
1102
  },
1023
1103
  // 打开右键菜单
1024
1104
  openRightModal() {
1105
+ if (this.timeRangeData.enabled) return;
1025
1106
  const { clientX, pageX, clientY, pageY } = this.activeEvent.e;
1026
1107
  this.rightPos = {
1027
1108
  clientX: clientX ?? pageX,
@@ -127,6 +127,8 @@ export default {
127
127
  },
128
128
  // 打开右键菜单
129
129
  openRightModal() {
130
+ // 一下方法不会生效,因为,polylines组件中timeRangeData.enabled设置为false操作晚于当前操作,需换一种方式
131
+ // if (this.$parent.$children.find(children => /polylines/.test(children.$vnode.tag))?.componentInstance?.timeRangeData?.enabled) return;
130
132
  const { clientX, pageX, clientY, pageY } = this.activeEvent.e;
131
133
  this.rightPos = {
132
134
  clientX: clientX ?? pageX,
@@ -1,8 +1,16 @@
1
1
  <template>
2
- <Select v-bind="$attrs" v-on="$listeners" v-model="valueCp" :maxTagCount="maxTagCount" :maxTagPlaceholder="maxTagPlaceholder"></Select>
2
+ <Select
3
+ v-bind="$attrs"
4
+ v-on="$listeners"
5
+ v-model="valueCp"
6
+ :maxTagCount="maxTagCount"
7
+ :maxTagPlaceholder="maxTagPlaceholder"
8
+ :filterOption="filterOption"
9
+ ></Select>
3
10
  </template>
4
11
 
5
12
  <script>
13
+ import utils from '@/utils/utils-map';
6
14
  import { Select } from 'ant-design-vue';
7
15
 
8
16
  export default {
@@ -43,6 +51,9 @@ export default {
43
51
  const { alias, title } = this.componentCfg;
44
52
  const len = this.value.length || 0;
45
53
  return this.value.length > 1 ? `已选${len}个${alias || title}` : "";
54
+ },
55
+ filterOption(...arg) {
56
+ return utils.filterOption(...arg);
46
57
  }
47
58
  },
48
59
  }
@@ -73,7 +73,11 @@ export const filterApiFn = {
73
73
  try {
74
74
  // TODO: 判断 fn 是异步函数还是同步
75
75
  const filterApiConfig = this.isOut ? this.filterApiConfigOutSearch : this?.filterApiConfig || {};
76
- const fn = filterApiConfig[key] || null;
76
+ let fn = filterApiConfig[key] || null;
77
+ // BaseSearch中
78
+ if (this.isOut && !fn) {
79
+ fn = this.filterApiConfig?.[key];
80
+ }
77
81
  if (typeof fn === 'function') {
78
82
  let res = await fn(params, config);
79
83
  return Promise.resolve(res);