cnhis-design-vue 0.1.40 → 0.1.42

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/es/big-table/index.js +74 -67
  2. package/es/big-table/style.css +1 -1
  3. package/es/button/index.js +2 -2
  4. package/es/color-picker/index.js +1 -1
  5. package/es/color-picker/style.css +1 -1
  6. package/es/fabric-chart/index.js +4 -4
  7. package/es/fabric-chart/style.css +1 -1
  8. package/es/index/index.js +42 -42
  9. package/es/index/style.css +2 -2
  10. package/es/modal/index.js +4 -4
  11. package/es/select/index.js +7 -7
  12. package/es/select/style.css +1 -1
  13. package/es/table-filter/index.js +22 -22
  14. package/es/table-filter/style.css +1 -1
  15. package/lib/cui.common.js +4223 -1783
  16. package/lib/cui.umd.js +4223 -1783
  17. package/lib/cui.umd.min.js +52 -52
  18. package/package.json +1 -1
  19. package/packages/big-table/index.js +6 -0
  20. package/packages/big-table/src/BigTable.vue +11 -94
  21. package/packages/big-table/src/Fieldset.vue +4 -4
  22. package/packages/big-table/src/utils/bigTableProps.js +82 -0
  23. package/packages/color-picker/src/color-picker.vue +14 -2
  24. package/packages/color-picker/src/style.less +1 -1
  25. package/packages/fabric-chart/src/FabricChart.vue +0 -1
  26. package/packages/fabric-chart/src/const/defaultVaule.js +20 -1
  27. package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +39 -43
  28. package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +46 -37
  29. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +169 -109
  30. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +111 -51
  31. package/packages/fabric-chart/src/fabric-chart2/FabricCenter.vue +8 -12
  32. package/packages/fabric-chart/src/mixins/{polylineCommon.js → eventCommon.js} +13 -3
  33. package/packages/index.js +6 -7
  34. package/packages/modal/index.js +6 -2
  35. package/packages/modal/src/Modal.js +7 -0
  36. package/packages/select/src/TableSelect/index.vue +138 -75
  37. package/packages/table-filter/src/base-search-com/BaseSearch.vue +30 -22
  38. package/packages/table-filter/src/classification/Classification-com.vue +6 -2
  39. package/packages/table-filter/src/components/multi-select/multi-select.vue +1 -1
  40. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +2 -0
  41. package/packages/table-filter/src/quick-search/QuickSearch.vue +25 -22
  42. package/src/style/style.less +2 -2
  43. package/src/utils/clickoutside.js +14 -13
  44. package/docs_20211021.zip +0 -0
@@ -11,31 +11,40 @@ import draw from '../mixins/draw';
11
11
  import defaultVaule from '../const/defaultVaule';
12
12
  import DropPopup from '../components/DropPopup';
13
13
  import MouseRightClick from '../components/MouseRightClick';
14
- import polylineCommon from '../mixins/polylineCommon';
14
+ import eventCommon from '../mixins/eventCommon';
15
15
 
16
16
  const rightClickNode = [
17
17
  { name: '修改', type: 'edit' },
18
18
  { name: '删除', type: 'delete' }
19
19
  ];
20
+
21
+ let topTotalList = [];
22
+ const getTopTotalList = (tree, topTotalList) => {
23
+ tree.forEach(item => {
24
+ if (item?.children?.length) {
25
+ getTopTotalList(item.children, topTotalList);
26
+ } else {
27
+ const obj = JSON.parse(JSON.stringify(item));
28
+ topTotalList.push(obj?.total || '');
29
+ }
30
+ });
31
+ };
32
+
20
33
  export default {
21
34
  name: 'fabric-text-group',
22
35
  components: {
23
36
  DropPopup,
24
37
  MouseRightClick
25
38
  },
26
- mixins: [fabricCommon, draw, polylineCommon],
39
+ mixins: [fabricCommon, draw, eventCommon],
27
40
  props: {
28
41
  templateData: {
29
42
  type: Object,
30
43
  required: true
31
44
  },
32
- other: {
33
- type: Object,
34
- default: () => {}
35
- }
36
45
  },
37
46
  watch: {
38
- other: {
47
+ 'templateData.other': {
39
48
  handler(value) {
40
49
  if (value) {
41
50
  this.removeOther();
@@ -55,7 +64,7 @@ export default {
55
64
  isRightVisible: false,
56
65
  rightPos: { clientX: 0, clientY: 0 },
57
66
  rightClickNode: [],
58
- activeEvent: null, // 当前可右键活动的对象
67
+ activeEvent: null // 当前可右键活动的对象
59
68
  };
60
69
  },
61
70
  mounted() {
@@ -66,26 +75,41 @@ export default {
66
75
  computed: {
67
76
  girdLineStyle() {
68
77
  return Object.assign({}, defaultVaule.borderStyle, this.templateData.borderStyle || {});
78
+ },
79
+ eventStyle() {
80
+ return this.propItems.eventStyle;
69
81
  }
70
82
  },
71
83
  methods: {
72
84
  init() {
85
+ if (this.propItems.treeList?.length) {
86
+ this.topTreeTextGroup(this.propItems.treeList);
87
+ if (this.propItems.topTotal?.width) {
88
+ topTotalList = [];
89
+ getTopTotalList(this.templateData.top.list, topTotalList);
90
+ this.drawTopTotal(topTotalList);
91
+ }
92
+ }
93
+ this.templateData.left && this.drawLeftScaleGroup(this.templateData.left);
94
+ this.templateData.other && this.drawTextDataGroup(this.templateData.other);
95
+ this.templateData.bottom && this.drawBottomTextDataGroup(this.templateData.bottom);
96
+ this.eventStyle.evented && this.createEvent();
97
+
98
+ this.drawBorder();
99
+ this.canvas.renderAll();
100
+ },
101
+ drawBorder() {
102
+ const { endX, canvasWidth, canvasHeight, topTotal } = this.propItems;
103
+ const curEndX = topTotal.width ? canvasWidth : endX;
73
104
  // 右 下两条线宽度和高度顶格不显示未发现具体原因 暂时减一处理
74
105
  // 上边线
75
- this.canvas.add(this.drawLine([0, 0, this.propItems.endX, 0], { ...this.girdLineStyle }));
106
+ this.canvas.add(this.drawLine([0, 0, curEndX, 0], { ...this.girdLineStyle }));
76
107
  // 右边线
77
- this.canvas.add(this.drawLine([this.propItems.endX, 0, this.propItems.endX, this.propItems.canvasHeight], { ...this.girdLineStyle }));
108
+ this.canvas.add(this.drawLine([topTotal.width ? curEndX - 1 : curEndX, 0, topTotal.width ? curEndX - 1 : curEndX, canvasHeight], { ...this.girdLineStyle }));
78
109
  // 下边线
79
- this.canvas.add(this.drawLine([0, this.propItems.canvasHeight - 1, this.propItems.endX, this.propItems.canvasHeight - 1], { ...this.girdLineStyle }));
110
+ this.canvas.add(this.drawLine([0, canvasHeight - 1, curEndX, canvasHeight - 1], { ...this.girdLineStyle }));
80
111
  // 左侧边框线
81
- this.canvas.add(this.drawLine([0, 0, 0, this.propItems.canvasHeight], { ...this.girdLineStyle }));
82
-
83
- this.propItems.treeList.length > 0 && this.topTreeTextGroup(this.propItems.treeList);
84
- this.templateData.left && this.drawLeftScaleGroup(this.templateData.left);
85
- this.templateData.other && this.drawTextDataGroup(this.templateData.other);
86
- this.templateData.bottom && this.drawBottomTextDataGroup(this.templateData.bottom);
87
- this.createEvent();
88
- this.canvas.renderAll();
112
+ this.canvas.add(this.drawLine([0, 0, 0, canvasHeight], { ...this.girdLineStyle }));
89
113
  },
90
114
  createEvent() {
91
115
  this.canvas.on('mouse:up', event => {
@@ -101,9 +125,6 @@ export default {
101
125
  },
102
126
  // 打开右键菜单
103
127
  openRightModal(event) {
104
- if (!this.propItems.eventStyle.evented) {
105
- return;
106
- }
107
128
  this.rightPos = {
108
129
  clientX: event.e.clientX || event.e.pageX,
109
130
  clientY: event.e.clientY || event.e.pageY
@@ -128,7 +149,7 @@ export default {
128
149
  type: text.type,
129
150
  index: text.index,
130
151
  dataIndex: text.dataIndex
131
- }
152
+ };
132
153
  this.$emit(`${type}Other`, obj);
133
154
  },
134
155
  removeOther() {
@@ -138,11 +159,40 @@ export default {
138
159
  }
139
160
  });
140
161
  },
162
+ drawTopTotal(topTotalList) {
163
+ const { endX, canvasWidth, yCellHeightTop, topTotal, endYTop, spaceHeight } = this.propItems;
164
+ const textList = [];
165
+ const left = endX + (canvasWidth - endX) / 2;
166
+ topTotalList.forEach((v, i) => {
167
+ const top = i * yCellHeightTop + yCellHeightTop / 2;
168
+ const text = v
169
+ ? new this.fabric.Text(String(v), {
170
+ ...defaultVaule.style,
171
+ ...(topTotal.style || defaultVaule.textStyle),
172
+ left,
173
+ top,
174
+ originX: 'center',
175
+ originY: 'center'
176
+ })
177
+ : null;
178
+ text && textList.push(text);
179
+ });
180
+ const title = this.drawTextGroup(
181
+ { width: canvasWidth - endX, height: spaceHeight, strokeWidth: 1 },
182
+ { text: String(topTotal.title), ...(topTotal.style || defaultVaule.textStyle) },
183
+ { left: endX, top: endYTop }
184
+ );
185
+ this.canvas.add(...textList, title);
186
+ },
141
187
  topTreeTextGroup(list) {
142
188
  list.forEach(item => {
143
- if (item.children && Array.isArray(item.children) && item.children.length > 0) {
189
+ if (item?.children?.length) {
144
190
  this.canvas.add(
145
- this.drawTextGroup({ width: item.width, height: item.height, strokeWidth: 1 }, { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {})}, { left: item.left, top: item.top })
191
+ this.drawTextGroup(
192
+ { width: item.width, height: item.height, strokeWidth: 1 },
193
+ { text: String(item.title), ...(this.templateData.top.treeTableTextStyle || {}) },
194
+ { left: item.left, top: item.top }
195
+ )
146
196
  );
147
197
  this.topTreeTextGroup(item.children);
148
198
  } else {
@@ -168,7 +218,7 @@ export default {
168
218
  }
169
219
  },
170
220
  drawTextDataGroupColList(colList) {
171
- const { originY, eventStyle } = this.propItems;
221
+ const { originY } = this.propItems;
172
222
  let textList = [];
173
223
  colList.forEach((item, index) => {
174
224
  const baseTop = originY + (item.marginTop || 10);
@@ -189,7 +239,7 @@ export default {
189
239
  index: i,
190
240
  type: 'colList',
191
241
  id: `${index}_${i}_other_${Date.now()}`,
192
- ...eventStyle
242
+ ...this.eventStyle
193
243
  });
194
244
  text.hasControls = text.hasBorders = false;
195
245
  textList.push(text);
@@ -200,12 +250,12 @@ export default {
200
250
  },
201
251
  drawTextDataGroupList(list) {
202
252
  let textList = [];
203
- const { originX, originY, eventStyle } = this.propItems;
253
+ const { originX, originY } = this.propItems;
204
254
  let top = originY + 10;
205
255
  list.forEach((item, index) => {
206
- const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || 3;
207
- const left = originX - marginLeft * 4; // 默认减去4倍的左边距,防止最左边的数据与名称显示重合了
208
-
256
+ const marginLeft = item.titleStyle?.marginLeft || 8;
257
+ const left = originX - marginLeft; // 防止最左边的数据与名称显示重合了
258
+
209
259
  if (list[index - 1]) {
210
260
  top += item.lineHeight || 15;
211
261
  }
@@ -214,11 +264,12 @@ export default {
214
264
  ...defaultVaule.style,
215
265
  ...defaultVaule.textStyle,
216
266
  ...item.style,
267
+ ...(item.titleStyle || {}),
217
268
  originX: 'right',
218
269
  originY: 'center',
219
270
  left,
220
271
  top,
221
- id: `${index}_other_${Date.now()}`,
272
+ id: `${index}_other_${Date.now()}`
222
273
  });
223
274
  textList.push(title);
224
275
  item.dataList.forEach((v, i) => {
@@ -237,7 +288,7 @@ export default {
237
288
  index: i,
238
289
  type: 'list',
239
290
  id: `${index}_${i}_other_${Date.now()}`,
240
- ...eventStyle
291
+ ...this.eventStyle
241
292
  });
242
293
  text.hasControls = text.hasBorders = false;
243
294
  textList.push(text);
@@ -266,9 +317,10 @@ export default {
266
317
  if (!obj.list) {
267
318
  return;
268
319
  }
269
- const { originX, endY, canvasHeight, eventStyle } = this.propItems;
320
+ const { endX, originX, endY, canvasHeight, topTotal } = this.propItems;
321
+ topTotal.width && this.canvas.add(this.drawLine([endX, endY - 1, endX, canvasHeight], { ...this.defaultRectStyle }));
270
322
  const textList = [];
271
- const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || 3;
323
+ const marginLeft = this.templateData.left.leftYScalevalue.spaceGridNumber || defaultVaule.spaceGridNumber;
272
324
  const left = originX - marginLeft * 4; // 默认减去4倍的左边距,防止最左边的数据与名称显示重合了
273
325
  const title = new this.fabric.Text(String(obj.title), {
274
326
  ...defaultVaule.style,
@@ -280,6 +332,7 @@ export default {
280
332
  top: endY + (canvasHeight - endY) / 2,
281
333
  type: 'mark'
282
334
  });
335
+
283
336
  textList.push(title);
284
337
  const baseY = endY + 2; // 目前固定10像素的下边距
285
338
  const baseYLimit = endY - 2; // 目前固定10像素的上边距
@@ -311,11 +364,16 @@ export default {
311
364
  other: v.other || {},
312
365
  time: item[0],
313
366
  name: v.name,
314
- type: 'mark',
367
+ type: 'mark'
315
368
  };
369
+ const eventStyle = !this.eventStyle.evented
370
+ ? {
371
+ lockMovementX: true,
372
+ lockMovementY: true
373
+ }
374
+ : {};
316
375
  if (this.isObject(v) && !v.value) {
317
376
  const option = Object.assign({}, obj.iconStyle || {}, v || {}, {
318
- ...defaultVaule.style,
319
377
  ...common,
320
378
  ...eventStyle
321
379
  });
@@ -355,20 +413,22 @@ export default {
355
413
  this.isDropVisible = false;
356
414
  });
357
415
  // 移动中 实时更新相关联的线的坐标
358
- point.on('moving', () => {
359
- this.moveLimit(point);
360
- this.canvas.renderAll();
361
- this.showDrapPopup(point);
362
- });
363
- point.on('moved', () => {
364
- this.isDropVisible = false;
365
- const value = {
366
- data: point.data,
367
- oldVal: point.time,
368
- newVal: this.getXValue(point.left),
369
- };
370
- this.$emit('markChange', value);
371
- });
416
+ if (this.eventStyle.evented) {
417
+ point.on('moving', () => {
418
+ this.moveLimit(point);
419
+ this.canvas.renderAll();
420
+ this.showDrapPopup(point);
421
+ });
422
+ point.on('moved', () => {
423
+ this.isDropVisible = false;
424
+ const value = {
425
+ data: point.data,
426
+ oldVal: point.time,
427
+ newVal: this.getXValue(point.left)
428
+ };
429
+ this.$emit('markChange', value);
430
+ });
431
+ }
372
432
  },
373
433
  moveLimit(point) {
374
434
  point.setCoords();
@@ -8,7 +8,7 @@
8
8
  <script>
9
9
  import fabricCommon from '../mixins/fabricCommon';
10
10
  import draw from '../mixins/draw';
11
- import polylineCommon from '../mixins/polylineCommon';
11
+ import eventCommon from '../mixins/eventCommon';
12
12
  import MouseRightClick from '../components/MouseRightClick';
13
13
  import DropPopup from '../components/DropPopup';
14
14
  import defaultVaule from '../const/defaultVaule';
@@ -19,7 +19,7 @@ const rightClickNode = [
19
19
  ];
20
20
  export default {
21
21
  name: 'fabric-center2',
22
- mixins: [fabricCommon, draw, polylineCommon],
22
+ mixins: [fabricCommon, draw, eventCommon],
23
23
  props: {
24
24
  other: {
25
25
  type: Object,
@@ -65,17 +65,19 @@ export default {
65
65
  },
66
66
  created() {},
67
67
  mounted() {
68
- document.addEventListener('click', this.addEventListenerClick, true);
69
- document.addEventListener('scroll', this.addEventListenerScroll, true);
70
68
  this.$nextTick(() => {
71
69
  this.init();
72
70
  });
73
71
  },
74
- computed: {},
72
+ computed: {
73
+ eventStyle() {
74
+ return this.propItems.eventStyle;
75
+ }
76
+ },
75
77
  methods: {
76
78
  init() {
77
79
  this.drawOther(this.other);
78
- this.createEvent();
80
+ this.eventStyle.evented && this.createEvent();
79
81
  this.polylineList = JSON.parse(JSON.stringify(this.polyline));
80
82
  },
81
83
  getContainer() {
@@ -606,11 +608,5 @@ export default {
606
608
  this.polylineList = JSON.parse(JSON.stringify(this.polyline));
607
609
  }
608
610
  },
609
- beforeDestroy() {
610
- const upperCanvas = document.querySelector('.upper-canvas');
611
- upperCanvas && upperCanvas.removeEventListener('contextmenu', this.addEventListenerContextmenu, true);
612
- document.removeEventListener('click', this.addEventListenerClick, true);
613
- document.removeEventListener('scroll', this.addEventListenerScroll, true);
614
- }
615
611
  };
616
612
  </script>
@@ -1,13 +1,15 @@
1
1
 
2
2
  export default {
3
- name: 'polylineCommon',
3
+ name: 'eventCommon',
4
4
  data() {
5
5
  return {
6
6
  };
7
7
  },
8
8
  mounted() {
9
- document.addEventListener('click', this.addEventListenerClick, true);
10
- document.addEventListener('scroll', this.addEventListenerScroll, true);
9
+ if (this.eventStyle.evented) {
10
+ document.addEventListener('click', this.addEventListenerClick, true);
11
+ document.addEventListener('scroll', this.addEventListenerScroll, true);
12
+ }
11
13
  },
12
14
  methods: {
13
15
  // 折线点移动限制 目前仅限制不能移动出画布
@@ -60,5 +62,13 @@ export default {
60
62
  addEventListenerScroll() {
61
63
  this.isRightVisible = false;
62
64
  }
65
+ },
66
+ beforeDestroy() {
67
+ if (this.eventStyle.evented) {
68
+ const upperCanvas = document.querySelector('.upper-canvas');
69
+ upperCanvas && upperCanvas.removeEventListener('contextmenu', this.addEventListenerContextmenu, true);
70
+ document.removeEventListener('click', this.addEventListenerClick, true);
71
+ document.removeEventListener('scroll', this.addEventListenerScroll, true);
72
+ }
63
73
  }
64
74
  };
package/packages/index.js CHANGED
@@ -176,15 +176,14 @@ const install = function(Vue) {
176
176
  components.map(component => {
177
177
  Vue.use(component);
178
178
  });
179
-
180
179
  Vue.prototype.$message = message;
181
180
  Vue.prototype.$notification = notification;
182
- Vue.prototype.$info = Modal.info;
183
- Vue.prototype.$success = Modal.success;
184
- Vue.prototype.$error = Modal.error;
185
- Vue.prototype.$warning = Modal.warning;
186
- Vue.prototype.$confirm = Modal.confirm;
187
- Vue.prototype.$destroyAll = Modal.destroyAll;
181
+ Vue.prototype.$info = Modal.extends.info;
182
+ Vue.prototype.$success = Modal.extends.success;
183
+ Vue.prototype.$error = Modal.extends.error;
184
+ Vue.prototype.$warning = Modal.extends.warning;
185
+ Vue.prototype.$confirm = Modal.extends.confirm;
186
+ Vue.prototype.$destroyAll = Modal.extends.destroyAll;
188
187
  };
189
188
 
190
189
  // 判断是否是直接引入文件
@@ -1,6 +1,10 @@
1
- import { Modal } from 'ant-design-vue';
1
+ // 导入组件
2
+ import Modal from './src/Modal.js';
2
3
 
3
- Modal.name = 'CModal';
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ Modal.install = function(Vue) {
6
+ Vue.component(Modal.name, Modal);
7
+ };
4
8
 
5
9
  // 默认导出组件
6
10
  export default Modal;
@@ -0,0 +1,7 @@
1
+ import { Modal } from 'ant-design-vue';
2
+
3
+ import create from '@/core/create';
4
+ export default create({
5
+ name: 'modal',
6
+ extends: Modal
7
+ });