cnhis-design-vue 2.1.100 → 2.1.101

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 (47) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/age/index.js +2 -2
  3. package/es/big-table/index.js +141 -101
  4. package/es/big-table/style.css +1 -1
  5. package/es/button/index.js +2 -2
  6. package/es/captcha/index.js +3 -3
  7. package/es/card-reader-sdk/index.js +1 -1
  8. package/es/checkbox/index.js +1 -1
  9. package/es/color-picker/index.js +1 -1
  10. package/es/drag-layout/index.js +3 -3
  11. package/es/editor/index.js +1 -1
  12. package/es/ellipsis/index.js +1 -1
  13. package/es/fabric-chart/index.js +414 -270
  14. package/es/fabric-chart/style.css +1 -1
  15. package/es/form-table/index.js +20 -20
  16. package/es/index/index.js +699 -515
  17. package/es/index/style.css +1 -1
  18. package/es/input/index.js +1 -1
  19. package/es/map/index.js +1 -1
  20. package/es/multi-chat/index.js +25 -25
  21. package/es/multi-chat-client/index.js +19 -19
  22. package/es/multi-chat-history/index.js +4 -4
  23. package/es/multi-chat-record/index.js +4 -4
  24. package/es/multi-chat-setting/index.js +20 -20
  25. package/es/multi-chat-sip/index.js +1 -1
  26. package/es/radio/index.js +1 -1
  27. package/es/scale-container/index.js +1 -1
  28. package/es/scale-view/index.js +27 -27
  29. package/es/select/index.js +4 -4
  30. package/es/select-label/index.js +3 -3
  31. package/es/select-person/index.js +2 -2
  32. package/es/select-tag/index.js +4 -4
  33. package/es/shortcut-setter/index.js +2 -2
  34. package/es/table-filter/index.js +29 -29
  35. package/es/tag/index.js +1 -1
  36. package/es/verification-code/index.js +2 -2
  37. package/lib/cui.common.js +752 -568
  38. package/lib/cui.umd.js +752 -568
  39. package/lib/cui.umd.min.js +12 -12
  40. package/package.json +1 -1
  41. package/packages/big-table/src/BigTable.vue +33 -5
  42. package/packages/big-table/src/assets/style/table-global.less +3 -5
  43. package/packages/fabric-chart/src/FabricChart.vue +1 -1
  44. package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +10 -8
  45. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +83 -47
  46. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +85 -43
  47. package/packages/fabric-chart/src/mixins/draw.js +1 -1
@@ -152,12 +152,7 @@ export default {
152
152
  this.isRightVisible = false;
153
153
  const text = this._currentPoint;
154
154
  this._currentPoint = '';
155
- const obj = {
156
- type: text.type,
157
- index: text.index,
158
- dataIndex: text.dataIndex
159
- };
160
- this.$emit(`${type}Other`, obj);
155
+ this.$emit(`${type}Other`, this.getOtherParams(text, false));
161
156
  },
162
157
  removeOther() {
163
158
  this.canvas.forEachObject(obj => {
@@ -232,11 +227,13 @@ export default {
232
227
  }
233
228
  },
234
229
  drawTextDataGroupColList(colList) {
235
- const { originY } = this.propItems;
230
+ const { originY, endX } = this.propItems;
236
231
  let textList = [];
237
232
  colList.forEach((item, index) => {
238
233
  const baseTop = originY + (item.marginTop || 10);
239
234
  if (this.isLimit(item.scalevalue)) {
235
+ const textItemPoints = [];
236
+ const left = this.cumputedX(item.scalevalue);
240
237
  item.dataList.forEach((v, i) => {
241
238
  const top = baseTop + i * (item.lineHeight || 15);
242
239
  const text = new this.fabric.Text(String(v.value), {
@@ -245,9 +242,8 @@ export default {
245
242
  ...item.style,
246
243
  originX: 'left',
247
244
  originY: 'center',
248
- left: this.cumputedX(item.scalevalue),
245
+ left,
249
246
  top,
250
- lockMovementX: true,
251
247
  lockMovementY: true,
252
248
  dataIndex: index,
253
249
  index: i,
@@ -255,12 +251,23 @@ export default {
255
251
  id: `${index}_${i}_other_${Date.now()}`,
256
252
  name: v.value,
257
253
  objectCaching: false,
254
+ origin: {
255
+ time: item.scalevalue,
256
+ ...v
257
+ },
258
258
  ...this.eventStyle
259
259
  });
260
- text.hasControls = text.hasBorders = false;
261
- this.setPopup(text);
260
+ textItemPoints.push(text);
261
+ this.pointOtherEvent(text);
262
262
  textList.push(text);
263
263
  });
264
+ const maxTextWidth = Math.max(...textItemPoints.map(obj => obj.width));
265
+ const isOverstep = left > endX - maxTextWidth;
266
+ textItemPoints.forEach((point, _, arr) => {
267
+ point.maxTextWidth = maxTextWidth;
268
+ point.siblingPoints = arr.filter(_point => _point.index !== point.index);
269
+ if (isOverstep) point.setCoords().set('originX', 'right');
270
+ });
264
271
  }
265
272
  });
266
273
  this.canvas.add(...textList);
@@ -296,6 +303,7 @@ export default {
296
303
  this.setMovingEvent(title, originOptions);
297
304
  textList.push(title);
298
305
  const { icon: _icon = { type: 'circle' }, dataList } = item || {};
306
+ let prevPoint;
299
307
  for (let i = 0, len = dataList.length; i < len; i++) {
300
308
  const v = dataList[i];
301
309
  if (this.isLimit(v.time)) {
@@ -305,7 +313,8 @@ export default {
305
313
  dataIndex: index,
306
314
  index: i,
307
315
  type: 'list',
308
- objectCaching: false
316
+ objectCaching: false,
317
+ origin: v
309
318
  };
310
319
  const left = this.cumputedX(v.time);
311
320
  title.dataList.push(left);
@@ -327,20 +336,33 @@ export default {
327
336
  });
328
337
  const groupObj = new this.fabric.Group([icon, text], {
329
338
  id: `${index}_${i}_other_${Date.now()}`,
330
- lockMovementX: true,
331
339
  lockMovementY: true,
332
340
  ...commonOptions,
333
341
  ...this.eventStyle,
334
- realLeft: left
342
+ realLeft: left,
343
+ iconHalfWidth: icon.width / 2
335
344
  });
336
- groupObj.hasControls = groupObj.hasBorders = false;
337
- this.setPopup(groupObj);
345
+ if (prevPoint) {
346
+ prevPoint.nextPoint = groupObj;
347
+ groupObj.prevPoint = prevPoint;
348
+ }
349
+ prevPoint = groupObj;
350
+ this.pointOtherEvent(groupObj);
338
351
  textList.push(groupObj);
339
352
  }
340
353
  }
341
354
  }
342
355
  this.canvas.add(...textList);
343
356
  },
357
+ emitMouseoverTarget(point) {
358
+ if (point) {
359
+ Bus.$emit('mouseoverTarget', true);
360
+ this.showDrapPopup(point, true);
361
+ } else {
362
+ !this.isRightVisible && Bus.$emit('mouseoverTarget', false);
363
+ this.isDropVisible = false;
364
+ }
365
+ },
344
366
  setMovingEvent(point) {
345
367
  const { originX, originY, endX, endY } = this.propItems;
346
368
  const isLimit = () => point.left >= originX && point.left <= endX && point.top >= originY && point.top <= endY;
@@ -355,11 +377,9 @@ export default {
355
377
  point.isClone = true;
356
378
  });
357
379
  if (isLimit()) {
358
- Bus.$emit('mouseoverTarget', true);
359
- this.showDrapPopup(point, true);
380
+ this.emitMouseoverTarget(point);
360
381
  } else {
361
- !this.isRightVisible && Bus.$emit('mouseoverTarget', false);
362
- this.isDropVisible = false;
382
+ this.emitMouseoverTarget();
363
383
  }
364
384
  });
365
385
  point.on('moved', () => {
@@ -367,35 +387,60 @@ export default {
367
387
  point.isClone = false;
368
388
  this.removeOther();
369
389
  this.drawTextDataGroup(this.templateData.other);
370
- !this.isRightVisible && Bus.$emit('mouseoverTarget', false);
371
- this.isDropVisible = false;
390
+ this.emitMouseoverTarget();
372
391
  if (isLimit()) {
373
- const { type, dataIndex, left, dataList } = point;
374
- const time = this.getXValue(left);
392
+ const { left, dataList } = point;
375
393
  const index = dataList.findIndex(_left => _left > left);
376
394
  // 使用定时器,是因为:防止上方移除重绘过慢新增完后再次触发移除重绘导致页面多次重绘节点
377
395
  setTimeout(() => {
378
- this.$emit('addOhter', {
379
- type,
380
- dataIndex,
381
- index: !~index ? (dataList.length ? dataList.length - 1 : 0) : index,
382
- data: {
383
- time
384
- }
385
- });
396
+ this.$emit('addOhter', { ...this.getOtherParams(point), index: !~index ? (dataList.length ? dataList.length - 1 : 0) : index });
386
397
  });
387
398
  }
388
399
  });
389
400
  },
401
+ pointOtherEvent(point) {
402
+ point.hasControls = point.hasBorders = false;
403
+ this.setPopup(point);
404
+ // 移动中 实时更新相关联的线的坐标
405
+ if (this.eventStyle.evented) {
406
+ const { endX, originX } = this.propItems;
407
+ point.on('moving', () => {
408
+ point.setCoords();
409
+ const { prevPoint, nextPoint } = point;
410
+ const limitLeft = prevPoint?.left || originX;
411
+ const limitRight = nextPoint?.left || endX;
412
+ if (point.left > limitRight) point.set('left', limitRight);
413
+ if (point.left < limitLeft) point.set('left', limitLeft);
414
+ if (point.realLeft && point.iconHalfWidth) point.realLeft = point.left + point.iconHalfWidth;
415
+ if (point.maxTextWidth) {
416
+ const isOverstep = point.left + point.maxTextWidth > limitRight;
417
+ const originX = isOverstep ? 'right' : 'left';
418
+ point.setCoords().set({ originX });
419
+ point.siblingPoints.forEach(_point => _point.setCoords().set({ originX, left: point.left }));
420
+ }
421
+ this.showDrapPopup(point);
422
+ });
423
+ point.on('moved', () => {
424
+ this.isDropVisible = false;
425
+ this.$emit('otherChange', this.getOtherParams(point));
426
+ });
427
+ }
428
+ },
429
+ getOtherParams(point, isChange = true) {
430
+ const { type, dataIndex, left, realLeft, origin, index } = point;
431
+ return {
432
+ type,
433
+ dataIndex,
434
+ index,
435
+ data: {
436
+ ...origin,
437
+ ...(isChange ? { time: this.getXValue(realLeft ?? left) } : {})
438
+ }
439
+ };
440
+ },
390
441
  setPopup(point) {
391
- point.on('mouseover', () => {
392
- Bus.$emit('mouseoverTarget', true);
393
- this.showDrapPopup(point, true);
394
- });
395
- point.on('mouseout', () => {
396
- !this.isRightVisible && Bus.$emit('mouseoverTarget', false);
397
- this.isDropVisible = false;
398
- });
442
+ point.on('mouseover', () => this.emitMouseoverTarget(point));
443
+ point.on('mouseout', () => this.emitMouseoverTarget());
399
444
  },
400
445
  // 判断当前时间是否超出网格区域
401
446
  isLimit(value) {
@@ -653,8 +698,5 @@ export default {
653
698
  }
654
699
  }
655
700
  }
656
- // render(h) {
657
- // return this.$slots.default ? h('div', this.$slots.default) : undefined;
658
- // }
659
701
  };
660
702
  </script>
@@ -150,7 +150,7 @@ export default {
150
150
  return new this.fabric.Circle({
151
151
  objectCaching: false,
152
152
  strokeWidth: 1,
153
- radius: data.width / 2,
153
+ radius: data.width ? data.width / 2 : data.radius,
154
154
  scale: 1,
155
155
  fill: '#fff',
156
156
  ...data