bri-components 1.3.90 → 1.3.91

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.3.90",
3
+ "version": "1.3.91",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -142,7 +142,7 @@
142
142
  selfPropsObj () {
143
143
  return {
144
144
  _fileType: "file",
145
- _showMode: this.isHeightAuto ? "old" : "inline", // 宽度为100%、且不在级联表格或内部表格里的 显示老版
145
+ _showMode: this.isHeightAuto ? "old" : "inline", // 宽度为100%、且不在表格字段里的 显示老版
146
146
 
147
147
  _multiple: true,
148
148
  _useType: "drag",
@@ -354,7 +354,6 @@
354
354
  }
355
355
  }
356
356
 
357
- // 内部表格inline模式
358
357
  &-inline {
359
358
  height: 32px;
360
359
  line-height: 32px;
@@ -29,7 +29,7 @@
29
29
  >
30
30
  <!-- 有值 -->
31
31
  <template v-if="!$isEmptyData(curValList)">
32
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
32
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
33
33
  <div
34
34
  v-if="isHeightAuto"
35
35
  :class="{
@@ -103,7 +103,7 @@
103
103
  >
104
104
  <!-- 有值 -->
105
105
  <template v-if="!$isEmptyData(curValList)">
106
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
106
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
107
107
  <dsh-tags
108
108
  v-if="isHeightAuto"
109
109
  :class="{
@@ -44,7 +44,7 @@
44
44
  >
45
45
  <!-- 有值 -->
46
46
  <template v-if="!$isEmptyData(curVal)">
47
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
47
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
48
48
  <template v-if="isHeightAuto">
49
49
  <a
50
50
  v-if="inputType === 'url'"
@@ -83,7 +83,7 @@
83
83
  >
84
84
  <!-- 有值 -->
85
85
  <template v-if="!$isEmptyData(curValList)">
86
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
86
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
87
87
  <dsh-tags
88
88
  v-if="isHeightAuto"
89
89
  :class="{
@@ -89,7 +89,7 @@
89
89
  >
90
90
  <!-- 有值 -->
91
91
  <template v-if="!$isEmptyData(curVal)">
92
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
92
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
93
93
  <dsh-tags
94
94
  v-if="isHeightAuto"
95
95
  :class="{
@@ -30,7 +30,7 @@
30
30
  >
31
31
  <!-- 有值 -->
32
32
  <template v-if="!$isEmptyData(curVal)">
33
- <!-- 高度自由时 单元格-级联表格内,详情页-独占一行宽度时 -->
33
+ <!-- 高度自由时 单元格-表格字段内,详情页-独占一行宽度时 -->
34
34
  <dsh-tags
35
35
  v-if="isHeightAuto"
36
36
  :class="{
@@ -24,7 +24,7 @@ export default {
24
24
  }
25
25
  },
26
26
 
27
- /* 内部表,层级表内的字段用到的 */
27
+ /* 表格字段内用到的 */
28
28
  inTableType: {
29
29
  type: String,
30
30
  validator (val) {
@@ -150,7 +150,7 @@
150
150
  },
151
151
 
152
152
  searchList () {
153
- return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
153
+ return this.selfPropsObj._searchList;
154
154
  },
155
155
  searchListMap () {
156
156
  return this.$arrToMap(this.searchList, "_key");
@@ -91,7 +91,7 @@
91
91
  },
92
92
 
93
93
  searchList () {
94
- return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
94
+ return this.selfPropsObj._searchList;
95
95
  },
96
96
  searchListMap () {
97
97
  return this.$arrToMap(this.searchList, "_key");
@@ -135,7 +135,7 @@
135
135
  }
136
136
  },
137
137
 
138
- /* 内部表,层级表内的字段用到的 */
138
+ /* 表格字段内用到的 */
139
139
  inTableType: {
140
140
  type: String,
141
141
  validator (val) {
@@ -122,7 +122,7 @@
122
122
  // 自定义表格事件,也可配置鼠标事件
123
123
  eventCustomOption () {
124
124
  return {
125
- bodyCellEvents: ({ row, column, rowIndex }) => {
125
+ bodyCellEvents: ({ row, rowIndex, column }) => {
126
126
  return {
127
127
  click: (event) => {
128
128
  if (!["checkbox"].includes(column.type)) {
@@ -120,7 +120,7 @@
120
120
  width: 78,
121
121
  align: "center",
122
122
  fixed: "left",
123
- renderBodyCell: ({ row, column, rowIndex }, h) => {
123
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
124
124
  return ++rowIndex;
125
125
  }
126
126
  };
@@ -594,7 +594,7 @@ export default {
594
594
  ]);
595
595
  };
596
596
  },
597
- // 表头单元格渲染函数 (无法共用contentColumns的renderHeaderCell,因为级联表头的无renderHeaderCell)
597
+ // 表头单元格渲染函数 (无法共用contentColumns的renderHeaderCell,因为级联老版表头的无renderHeaderCell)
598
598
  getThRender (column, colIndex) {
599
599
  column = this.$transformDynamicProperty(column, undefined, this.parentObj);
600
600
 
@@ -72,7 +72,7 @@ export default {
72
72
  width: 76,
73
73
  align: "center",
74
74
  fixed: "left",
75
- renderBodyCell: ({ row, column, rowIndex }, h) => {
75
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
76
76
  return [
77
77
  h("div", rowIndex + 1),
78
78
 
@@ -121,14 +121,23 @@ export default {
121
121
  created () { },
122
122
  methods: {
123
123
  // 点击 -添加行
124
- clickCreate (operationItem, row, rowIndex, column) {
125
- const mergeRowData = row
126
- ? this.mergeRowColumns.reduce((obj, column) => {
127
- return column._canEditOnMergeRow === true
128
- ? obj
129
- : Object.assign(obj, { [column._key]: row[column._key] });
130
- }, {})
131
- : {};
124
+ clickCreate (operationItem, row, rowIndex, col) {
125
+ // 处理单元格合并相关
126
+ let mergeRowData = {};
127
+ if (col && col._mergeRow) {
128
+ const newList = this.showListData.slice(rowIndex);
129
+ const newIndex = newList.findIndex(rowItem => row[col._key] !== rowItem[col._key]);
130
+ row = newList[newIndex - 1];
131
+
132
+ const curIndex = this.mergeRowColumns.findIndex(column => col._key === column._key);
133
+ mergeRowData = this.mergeRowColumns.reduce((obj, column, colIndex) => {
134
+ // 该列之前的合并列,要复制这一行对应列的值
135
+ return colIndex < curIndex
136
+ ? Object.assign(obj, { [column._key]: row[column._key] })
137
+ : obj;
138
+ }, {});
139
+ }
140
+
132
141
  const newRow = {
133
142
  ...this.$deepCopy(this.selfRowDefault),
134
143
  ...this.$deepCopy(mergeRowData),
@@ -85,7 +85,7 @@ export default {
85
85
  defaultHiddenColumnKeys: [...this.hideColKeys] // 必须这么写,不解构,切换一次隐藏/显示后,hideColKeys会变成空数组
86
86
  },
87
87
  cellStyleOption: {
88
- bodyCellClass: ({ row, column, rowIndex }) => {
88
+ bodyCellClass: ({ row, rowIndex, column }) => {
89
89
  return "bri-table-td" +
90
90
  `${this.getRowCanEdit(row)
91
91
  ? " bri-table-td-edit"
@@ -135,7 +135,7 @@ export default {
135
135
  width: 48,
136
136
  align: "center",
137
137
  fixed: "left",
138
- renderBodyCell: ({ row, column, rowIndex }, h) => {
138
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
139
139
  return this.isSearching && this.searchMode === "flat"
140
140
  ? h("span", "")
141
141
  : row.children && row.children.length
@@ -170,7 +170,7 @@ export default {
170
170
  width: 28 + 16 + (this.maxLevel - 1) * 38,
171
171
  align: "left",
172
172
  fixed: "left",
173
- renderBodyCell: ({ row, column, rowIndex }, h) => {
173
+ renderBodyCell: ({ row, rowIndex, column }, h) => {
174
174
  return [
175
175
  h("div", {
176
176
  style: {
@@ -317,7 +317,7 @@ export default {
317
317
  return this.selfPropsObj._searchLabelWidth;
318
318
  },
319
319
  searchList () {
320
- return this.selfPropsObj._searchList || []; // 级联表切层级表时 值会undefined覆盖selfPropsObj默认的[]
320
+ return this.selfPropsObj._searchList;
321
321
  },
322
322
  searchListMap () {
323
323
  return this.$arrToMap(this.searchList, "_key");
@@ -447,38 +447,45 @@ export default {
447
447
  }
448
448
  },
449
449
  cellSpanOption: {
450
- bodyCellSpan: ({ row, column, rowIndex }) => {
450
+ bodyCellSpan: ({ row, rowIndex, column }) => {
451
451
  if (column._mergeRow === true) {
452
- if (
453
- rowIndex !== 0 &&
454
- row[column._key] === this.showListData[rowIndex - 1][column._key]
455
- ) {
452
+ if (this.$isEmptyData(row[column._key])) {
456
453
  return {
457
- rowspan: 0,
458
- colspan: 0
459
- };
460
- } else {
461
- const newList = this.showListData.slice(rowIndex);
462
- const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
463
- return {
464
- rowspan: newIndex === -1 ? newList.length : newIndex,
454
+ rowspan: 1,
465
455
  colspan: 1
466
456
  };
457
+ } else {
458
+ if (
459
+ rowIndex !== 0 &&
460
+ row[column._key] === this.showListData[rowIndex - 1][column._key]
461
+ ) {
462
+ return {
463
+ rowspan: 0,
464
+ colspan: 0
465
+ };
466
+ } else {
467
+ const newList = this.showListData.slice(rowIndex);
468
+ const newIndex = newList.findIndex(rowItem => row[column._key] !== rowItem[column._key]);
469
+ return {
470
+ rowspan: newIndex === -1 ? newList.length : newIndex,
471
+ colspan: 1
472
+ };
473
+ }
467
474
  }
468
475
  }
469
476
  }
470
477
  },
471
478
  eventCustomOption: {
472
- bodyCellEvents: ({ row, column, rowIndex }) => {
479
+ bodyCellEvents: ({ row, rowIndex, column }) => {
473
480
  return {
474
481
  click: (event) => {
475
- // console.log("click::", row, column, rowIndex, event);
482
+ // console.log("click::", row, rowIndex, column, event);
476
483
  },
477
484
  dblclick: (event) => {
478
- // console.log("dblclick::", row, column, rowIndex, event);
485
+ // console.log("dblclick::", row, rowIndex, column, event);
479
486
  },
480
487
  contextmenu: (event) => {
481
- // console.log("contextmenu::", row, column, rowIndex, event);
488
+ // console.log("contextmenu::", row, rowIndex, column, event);
482
489
  },
483
490
  mouseenter: (event) => {
484
491
  this.$set(this.hoverRecordMap, `${row._id}dsh${column._key}`, true);
@@ -642,7 +649,7 @@ export default {
642
649
  list: operationList.map(btnItem => ({
643
650
  ...btnItem,
644
651
  disabled: !this.getRowBtnCanEdit(row) ||
645
- (this.disabledDeleteDftRow ? row.__isDefault__ === true : false)
652
+ (this.disabledDeleteDftRow ? this.isDftRowDisabled(row) : false)
646
653
  }))
647
654
  },
648
655
  on: {
@@ -1137,6 +1144,10 @@ export default {
1137
1144
  !(this.$isEmptyData(row[col._key]) && this.$isEmptyData(oldRow[col._key])) &&
1138
1145
  row[col._key] !== oldRow[col._key];
1139
1146
  },
1147
+ // 是否禁止操作 在关于默认行方面
1148
+ isDftRowDisabled (row) {
1149
+ return this.controlKey === "_default" ? false : row.__isDefault__;
1150
+ },
1140
1151
  // 整行校验结果
1141
1152
  getRowRuleResult (row, rowIndex) {
1142
1153
  return this.filterColumns.every(column => this.getColRuleResult(column, row, rowIndex).bool);
@@ -1187,16 +1198,12 @@ export default {
1187
1198
  : true
1188
1199
  : true
1189
1200
  ) &&
1190
- !(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 级联表格类型,固定字段不编辑
1201
+ !(["cascaderTable"].includes(this.controlType) && ["level", "children"].includes(col._key)) && // 层级表格的固定字段不可编辑
1191
1202
  (col._oldReadonly ? row.__old__ !== true : true) && // 老数据行里某些列不可编辑
1192
1203
  (row.__isQuote__ ? !this.quoteDisabledColKeys.includes(col._key) : true) && // 引用过来的数据是否可编辑
1193
1204
  !["calculate"].includes(col._enterType) && // 计算的不可编辑
1194
1205
  col._readonly !== true && // 不能为只读
1195
- (
1196
- col._mergeRow === true
1197
- ? this.controlKey === "_default" || (col._canEditOnMergeRow === true && row.__isDefault__ !== true)
1198
- : true
1199
- ) && // 合并单元格的且不配置"新增数据的可编辑"的不可编辑
1206
+ (!this.isDftRowDisabled(row) || col._readonlyOnDftRow !== true) && // 合并单元格的且不配置"新增数据的可编辑"的不可编辑
1200
1207
  col.canEdit !== false; // 字段本身编辑权限 考虑为undefined时候
1201
1208
  },
1202
1209
  // 单元格最终编辑状态
@@ -26,7 +26,7 @@ export default {
26
26
  }
27
27
  },
28
28
 
29
- /* 内部表,层级表内的字段用到的 */
29
+ /* 表格字段内用到的 */
30
30
  inTableType: {
31
31
  type: String,
32
32
  validator (val) {
@@ -132,7 +132,7 @@ const transformToColumns = function (form, {
132
132
  },
133
133
  renderBodyCell: col._type
134
134
  ? col._type === "operation"
135
- ? ({ row, column, rowIndex }, h) => {
135
+ ? ({ row, rowIndex, column }, h) => {
136
136
  return h("dsh-buttons", {
137
137
  class: "bri-table-td-operation",
138
138
  props: {
@@ -141,12 +141,12 @@ const transformToColumns = function (form, {
141
141
  },
142
142
  on: {
143
143
  click: (operationItem) => {
144
- this.$dispatchEvent(operationItem, { row, column, rowIndex });
144
+ this.$dispatchEvent(operationItem, { row, rowIndex, column });
145
145
  }
146
146
  }
147
147
  });
148
148
  }
149
- : ({ row, column, rowIndex }, h) => {
149
+ : ({ row, rowIndex, column }, h) => {
150
150
  return h("dsh-list-unit", {
151
151
  props: {
152
152
  canEdit: false,