bri-components 1.4.80 → 1.4.82

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.4.80",
3
+ "version": "1.4.82",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -21,7 +21,7 @@
21
21
  :cellStyleOption="cellStyleOption"
22
22
  :rowStyleOption="rowStyleOption"
23
23
  :expandOption="selfPropsObj.expandOption"
24
- :checkbox-option="checkboxOption"
24
+ :checkbox-option="selfCheckboxOption"
25
25
  :radioOption="selfPropsObj.radioOption"
26
26
  :sortOption="sortOption"
27
27
  :cellSelectionOption="selfPropsObj.cellSelectionOption"
@@ -50,25 +50,31 @@
50
50
  export default {
51
51
  name: "BriTable",
52
52
  props: {
53
+ isLoading: Boolean,
54
+ data: Array,
55
+ footerData: Array,
56
+ columns: Array,
57
+
58
+ noDataText: {
59
+ type: String,
60
+ default: "暂无数据…"
61
+ },
53
62
  propsObj: {
54
63
  type: Object,
55
64
  default () {
56
65
  return {};
57
66
  }
58
67
  },
59
- isLoading: Boolean,
60
- noDataText: {
61
- type: String,
62
- default: "暂无数据…"
63
- },
64
- columns: Array,
65
- data: Array,
66
- footerData: Array
68
+ checkboxOption: {
69
+ type: Object,
70
+ default () {
71
+ return {};
72
+ }
73
+ }
67
74
  },
68
75
  data () {
69
76
  // 中文文档https://happy-coding-clans.github.io/vue-easytable/#/zh/doc/table/api
70
- return {
71
- };
77
+ return { };
72
78
  },
73
79
  computed: {
74
80
  selfPropsObj () {
@@ -138,7 +144,7 @@
138
144
  };
139
145
  },
140
146
  // 全选配置项
141
- checkboxOption () {
147
+ selfCheckboxOption () {
142
148
  return {
143
149
  // 行选择改变事件
144
150
  selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
@@ -156,7 +162,8 @@
156
162
  { isSelected, selectedRowKeys }
157
163
  );
158
164
  },
159
- ...(this.propsObj.checkboxOption || {})
165
+ ...(this.propsObj.checkboxOption || {}),
166
+ ...this.checkboxOption
160
167
  };
161
168
  },
162
169
  // 列宽改变设置项
@@ -262,7 +262,6 @@
262
262
  loadingText: "加载中,请稍等……",
263
263
  finishedText: "暂无更多数据!",
264
264
  noDataText: "暂无数据",
265
- noDataImg: "https://apaas-static.oss-cn-beijing.aliyuncs.com/kongdata.png",
266
265
 
267
266
  ...this.propsObj
268
267
  };
@@ -83,9 +83,33 @@
83
83
  return {
84
84
  ...operationItem,
85
85
  width: operationItem.width || getOperationItemMaxWidth(operationItem),
86
- style: (operationItem._name_ || operationItem.name).split("/").length > 1
87
- ? `width: ${getOperationItemMaxWidth(operationItem)}px; `
88
- : undefined
86
+ style: {
87
+ ...(
88
+ (operationItem._name_ || operationItem.name).split("/").length > 1
89
+ ? { width: `${getOperationItemMaxWidth(operationItem)}px` }
90
+ : {}
91
+ ),
92
+ ...(
93
+ typeof operationItem.style === "object"
94
+ ? operationItem.style
95
+ : typeof operationItem.style === "string"
96
+ ? operationItem.style.split(";").reduce((styleObj, styleItem) => {
97
+ if (styleItem) {
98
+ const property = styleItem.split(":")[0];
99
+ const val = styleItem.split(":")[1];
100
+
101
+ return {
102
+ ...styleObj,
103
+ [property]: val
104
+ };
105
+ }
106
+ else {
107
+ return styleObj;
108
+ }
109
+ }, {})
110
+ : {}
111
+ )
112
+ }
89
113
  };
90
114
  });
91
115
  },
@@ -58,6 +58,7 @@
58
58
  :data="isLoading ? [] : selfShowListData"
59
59
  :footer-data="footerData"
60
60
  :propsObj="tablePropsObj"
61
+ :checkboxOption="checkboxOption"
61
62
  @changeSelect="changeSelect"
62
63
  @selectAll="changeSelect"
63
64
  ></bri-table>
@@ -167,6 +168,7 @@
167
168
  :data="isLoading ? [] : selfShowListData"
168
169
  :footer-data="footerData"
169
170
  :propsObj="tableInModalPropsObj"
171
+ :checkboxOption="checkboxOption"
170
172
  @changeSelect="changeSelect"
171
173
  @selectAll="changeSelect"
172
174
  ></bri-table>
@@ -233,7 +233,6 @@ export default {
233
233
  return loop(nodes);
234
234
  },
235
235
 
236
-
237
236
  bodyCellSpan ({ row, rowIndex, column }) {
238
237
  row = row[column.nodeKey || column._key];
239
238
  return {
@@ -1,7 +1,13 @@
1
1
  export default {
2
2
  mixins: [],
3
3
  components: {},
4
- props: {},
4
+ props: {
5
+ // 使用多选列
6
+ useSelection: {
7
+ type: Boolean,
8
+ default: false
9
+ }
10
+ },
5
11
  data () {
6
12
  return {
7
13
  isUseDescSort: false,
@@ -283,6 +289,7 @@ export default {
283
289
  }
284
290
  }
285
291
 
292
+ this.changeSelect();
286
293
  this.change("createRow", newRow, newRowIndex, null);
287
294
  },
288
295
  // 点击 -删除行
@@ -443,7 +450,6 @@ export default {
443
450
  const indexInAll = list.findIndex(dataItem => dataItem._id === row._id);
444
451
  list.slice(indexInAll + 1, indexInAll + this.rowspanMap[this.getMixKey(row, column)])
445
452
  .forEach(rowItem => {
446
- console.log(rowItem[column._key]);
447
453
  rowItem[column._key] = this.$deepCopy(row[column._key]);
448
454
  });
449
455
  }
@@ -48,7 +48,6 @@ export default {
48
48
 
49
49
  showColumns () {
50
50
  return [
51
- ...(this.useSelection === true ? [this.selectionColumn] : []),
52
51
  this.expandColumn,
53
52
  ...(this.useIndex === true ? [this.indexColumn] : []),
54
53
  ...this.$transformToColumns(this.showContentColumns),
@@ -77,7 +77,7 @@ export default {
77
77
  showRuleMessage: false, // 进行全体校验
78
78
 
79
79
  idRecordMap: {}, // 默认id转换映射
80
- hoverRecordMap: {},
80
+ // hoverRecordMap: {},
81
81
  ruleRecordMap: {}, // 单元格是否发生校验的记录映射
82
82
 
83
83
  showTopSearch: true,
@@ -97,6 +97,7 @@ export default {
97
97
  },
98
98
 
99
99
  isLoading: false,
100
+ selectIds: [],
100
101
 
101
102
  dshRenderName: undefined,
102
103
  hideStatus: true,
@@ -135,7 +136,6 @@ export default {
135
136
  btnType: "errorText",
136
137
  icon: "md-trash",
137
138
  size: "small",
138
- color: "#E83636",
139
139
  disabled: false,
140
140
  event: "clickDelete"
141
141
  }
@@ -244,7 +244,6 @@ export default {
244
244
  _contentHeight: 500, // 表格最大高度
245
245
  _headHeightAuto: false, // 表头高度自适应
246
246
  _heightAuto: false, // 单元格高度自适应
247
- _useSelection: false, // 使用选择列 -配置端暂时用不到
248
247
  _useIndex: true, // 使用序号列
249
248
  _useSummary: false, // 使用汇总行
250
249
  _noborderColKeys: [], // 无边线的列
@@ -330,9 +329,6 @@ export default {
330
329
  heightAuto () {
331
330
  return this.selfPropsObj._heightAuto;
332
331
  },
333
- useSelection () {
334
- return this.selfPropsObj._useSelection;
335
- },
336
332
  useIndex () {
337
333
  return this.selfPropsObj._useIndex;
338
334
  },
@@ -469,7 +465,7 @@ export default {
469
465
  .map((rowItem, rowIndex) => {
470
466
  rowItem.__index__ = rowIndex + 1;
471
467
  return rowItem;
472
- });
468
+ });
473
469
  },
474
470
  // 全部数据 或 筛选时符合条件的数据 -总数
475
471
  selfTotal () {
@@ -491,11 +487,11 @@ export default {
491
487
  ? initDftVal
492
488
  : dftVal
493
489
  : dftInRowVal
494
- // [column._key]: this.$isEmptyData(dftInRowVal)
495
- // ? this.$isEmptyData(dftVal)
496
- // ? initDftVal
497
- // : dftVal
498
- // : dftInRowVal
490
+ // [column._key]: this.$isEmptyData(dftInRowVal)
491
+ // ? this.$isEmptyData(dftVal)
492
+ // ? initDftVal
493
+ // : dftVal
494
+ // : dftInRowVal
499
495
  });
500
496
  }, {});
501
497
  },
@@ -543,7 +539,6 @@ export default {
543
539
  : true
544
540
  );
545
541
  },
546
-
547
542
  selectionColumn () {
548
543
  return {
549
544
  _key: "__selection__",
@@ -573,6 +568,11 @@ export default {
573
568
  };
574
569
  },
575
570
 
571
+ checkboxOption () {
572
+ return {
573
+ selectedRowKeys: this.selectIds
574
+ };
575
+ },
576
576
  tablePropsObj () {
577
577
  return {
578
578
  // isLoading: false,
@@ -581,13 +581,6 @@ export default {
581
581
  // clickHighlight: true,
582
582
  // stripe: true // 斑马纹
583
583
  // },
584
- ...(
585
- this.selfPropsObj.checkboxOption
586
- ? {
587
- checkboxOption: this.selfPropsObj.checkboxOption
588
- }
589
- : {}
590
- ),
591
584
  maxHeight: this.contentHeight,
592
585
  // 通过实例方法 hideColumnsByKeys(keys)将列隐藏,通过实例方法 showColumnsByKeys(keys)将隐藏的列显示
593
586
  columnHiddenOption: {
@@ -818,7 +811,7 @@ export default {
818
811
  this.showRuleMessage = false;
819
812
 
820
813
  this.idRecordMap = {};
821
- this.hoverRecordMap = {};
814
+ // this.hoverRecordMap = {};
822
815
  this.ruleRecordMap = {};
823
816
 
824
817
  this.dftAdvSearch = {
@@ -832,8 +825,9 @@ export default {
832
825
  },
833
826
  loadingFunc () {
834
827
  this.isLoading = true;
828
+ this.changeSelect();
829
+
835
830
  setTimeout(() => {
836
- this.changeSelect();
837
831
  this.isLoading = false;
838
832
  });
839
833
  },
@@ -847,9 +841,10 @@ export default {
847
841
  this.changePage && this.changePage(1);
848
842
  }
849
843
  },
850
- // 列表选择项改变
844
+ // 列表选择项改变 (!!!外部在使用)
851
845
  changeSelect (selections = [], ...params) {
852
- this.$emit("changeSelect", selections.map(item => item._id), selections, ...params);
846
+ this.selectIds = selections.map(item => item._id);
847
+ this.$emit("changeSelect", this.selectIds, selections, ...params);
853
848
  },
854
849
 
855
850
  // 输入框失去焦点
@@ -1184,7 +1179,7 @@ export default {
1184
1179
  e.stopPropagation();
1185
1180
  }
1186
1181
  }
1187
- });
1182
+ });
1188
1183
  },
1189
1184
  topSearchRender (h) {
1190
1185
  return this.searchFormList.length
@@ -1438,10 +1433,10 @@ export default {
1438
1433
  // console.log("contextmenu::", row, rowIndex, column, event);
1439
1434
  },
1440
1435
  mouseenter: (event) => {
1441
- this.$set(this.hoverRecordMap, `${row._id}`, true);
1436
+ // this.$set(this.hoverRecordMap, `${row._id}`, true);
1442
1437
  },
1443
1438
  mouseleave: (event) => {
1444
- this.$set(this.hoverRecordMap, `${row._id}`, false);
1439
+ // this.$set(this.hoverRecordMap, `${row._id}`, false);
1445
1440
  }
1446
1441
  };
1447
1442
  },
@@ -1470,7 +1465,7 @@ export default {
1470
1465
  getRowDelBtnCanEdit (row, rowIndex) {
1471
1466
  return row.__readonly__ !== true && // 不能为只读数据
1472
1467
  (this.disabledDeleteDftRow ? row.__isDefault__ !== true : true) && // 默认数据可删除
1473
- (this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据可删除
1468
+ (this.disabledDeleteOldRow ? row.__old__ !== true : true); // 老数据可删除
1474
1469
  },
1475
1470
  // 行内容是否可编辑
1476
1471
  getRowCanEdit (row, rowIndex) {
@@ -25,7 +25,6 @@ export default {
25
25
  // btnType: "errorText",
26
26
  // icon: "ios-trash-outline",
27
27
  // size: "small",
28
- // color: "#E83636",
29
28
  // disabled: false,
30
29
  // event: "clickDeleteChilds"
31
30
  // }
@@ -54,7 +54,7 @@
54
54
  }
55
55
 
56
56
  return {
57
- class: ["cancel", "linkText", "primaryText", "errorLine", "errorText", "primaryLine"].includes(defaultType) ? `ivu-btn-${defaultType}` : "",
57
+ class: ["cancel", "errorLine", "primaryLine", "linkText", "primaryText", "errorText"].includes(defaultType) ? `ivu-btn-${defaultType}` : "",
58
58
  ...this.propsObj,
59
59
  btnType: setType,
60
60
  customIcon: this.propsObj.customIcon ? `bico-font ${this.propsObj.customIcon}` : undefined