bri-components 1.3.21 → 1.3.23

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.21",
3
+ "version": "1.3.23",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -167,10 +167,10 @@
167
167
  ></dsh-list-unit>
168
168
 
169
169
  <span
170
- v-if="!getRuleResult(col, row[col.nodeKey], rowIndex).bool"
170
+ v-if="!getColRuleResult(col, row[col.nodeKey], rowIndex).bool"
171
171
  class="bri-table-td-tip"
172
172
  >
173
- {{ getRuleResult(col, row[col.nodeKey], rowIndex).message }}
173
+ {{ getColRuleResult(col, row[col.nodeKey], rowIndex).message }}
174
174
  </span>
175
175
  </td>
176
176
  </template>
@@ -447,7 +447,7 @@
447
447
 
448
448
  const subColumns = this.columns.filter(col => col.colType === "data");
449
449
  return this.rows.every((row, rowIndex) =>
450
- subColumns.every(col => this.getRuleResult(col, row[col.nodeKey], rowIndex, true).bool)
450
+ subColumns.every(col => this.getColRuleResult(col, row[col.nodeKey], rowIndex, true).bool)
451
451
  );
452
452
  },
453
453
 
@@ -572,7 +572,7 @@
572
572
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
573
573
  },
574
574
  // 是否显示 单元格校验提示文字
575
- getRuleResult (col, row, rowIndex, showRuleMessage = this.showRuleMessage) {
575
+ getColRuleResult (col, row, rowIndex, showRuleMessage = this.showRuleMessage) {
576
576
  if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || showRuleMessage) {
577
577
  return this.$getFieldRuleResult({
578
578
  ...col,
@@ -60,7 +60,7 @@
60
60
  return {
61
61
  maxHeight: this.contentHeight,
62
62
  cellStyleOption: {
63
- bodyCellClass: ({rowIndex}) => {
63
+ bodyCellClass: ({row, column, rowIndex}) => {
64
64
  return `bri-table-td ${this.canEdit ? "bri-table-td-edit" : "bri-table-td-show"}`;
65
65
  }
66
66
  }
@@ -124,7 +124,7 @@
124
124
  filter: undefined,
125
125
  sortBy: undefined,
126
126
  renderBodyCell: ({ row, column, rowIndex }, h) => {
127
- column = this.transformCol(column, row);
127
+ column = this.$transformFieldProperty(column, row, this.parentObj);
128
128
  column = this.resetCol(column, row);
129
129
  const unitCanEdit = this.getUnitCanEdit(column, row);
130
130
 
@@ -174,15 +174,15 @@
174
174
  }
175
175
  }),
176
176
 
177
- !this.getRuleResult(column, row).bool
177
+ !this.getColRuleResult(column, row).bool
178
178
  ? h("span", {
179
179
  class: "bri-table-td-tip"
180
- }, this.getRuleResult(column, row).message)
180
+ }, this.getColRuleResult(column, row).message)
181
181
  : undefined
182
182
  ];
183
183
  },
184
184
  renderHeaderCell: ({ column }, h) => {
185
- column = this.transformCol(column);
185
+ column = this.$transformFieldProperty(column, undefined, this.parentObj);
186
186
 
187
187
  return this.$getHeadRender(h, column, {
188
188
  showRequired: this.showRequired,
@@ -302,6 +302,11 @@
302
302
  // isShare: this.isShare,
303
303
  _heightAuto: this.heightAuto
304
304
  };
305
+ },
306
+ getUnitCanEdit (col, row) {
307
+ return this.getRowCanEdit(row) &&
308
+ this.getColCanEdit(col, row) &&
309
+ this.$isAdvRelyShow(col, row, this.parentObj, true);
305
310
  }
306
311
  }
307
312
  };
@@ -115,11 +115,7 @@ export default {
115
115
  },
116
116
 
117
117
  filterColumns () {
118
- return this.columns.filter(col =>
119
- col._isRelyByParent
120
- ? this.$isAdvRelyShow(col, this.parentObj, true, true, this.listData)
121
- : !["hide"].includes(col._displayType)
122
- );
118
+ return this.columns.filter(col => this.$isAdvRelyShow(col, this.listData, this.parentObj, true));
123
119
  },
124
120
  selfRowDefault () {
125
121
  return this.$filterObj(this.filterColumns, this.rowDefault);
@@ -141,15 +137,15 @@ export default {
141
137
  validate () {
142
138
  this.showRuleMessage = true;
143
139
 
144
- return this.listData.every(row =>
145
- this.filterColumns.every(col => {
146
- col = this.transformCol(col, row);
147
- return this.getRuleResult(col, row).bool;
148
- })
149
- );
150
- },
151
- // 是否显示 单元格校验提示文字
152
- getRuleResult (col, row) {
140
+ return this.listData.every(row => this.getRowRuleResult(row));
141
+ },
142
+ // 整行校验结果
143
+ getRowRuleResult (row) {
144
+ return this.filterColumns.every(column => this.getColRuleResult(column, row).bool);
145
+ },
146
+ // 单元格校验结果
147
+ getColRuleResult (col, row) {
148
+ col = this.$transformFieldProperty(col, row, this.parentObj);
153
149
  if ((this.ruleRecordMap[`${row._id}dsh${col._key}`] || {}).showRuleMessage || this.showRuleMessage) {
154
150
  return this.$getFieldRuleResult(col, row);
155
151
  } else {
@@ -176,20 +172,12 @@ export default {
176
172
  },
177
173
 
178
174
  /* --------------- 工具方法 ------------- */
179
- transformCol (col, row) {
180
- return this.$transformFieldProperty(col, col._isRuleByParent ? this.parentObj : row);
181
- },
182
- getUnitCanEdit (col, row) {
183
- return this.getRowCanEdit(row) && this.getColCanEdit(col, row);
184
- },
185
175
  getRowCanEdit (row) {
186
176
  return this.canEdit && // 是否是编辑状态
187
- // (!this.disabledOldDataRow || !!this.createRowMap[row._id]) && // 是否让老数据行置灰
188
177
  (!this.disabledOldDataRow || !!row.__isCreate__); // 是否让老数据行置灰
189
178
  },
190
179
  getColCanEdit (col, row) {
191
- return (!col.dependRowCanEdit || row.canEdit !== false) &&
192
- (col._isRelyByParent ? true : this.$isAdvRelyShow(col, row, true)); // 在老数据行里某些列不可编辑; // 在老数据行里某些列不可编辑
180
+ return (!col.dependRowCanEdit || row.canEdit !== false);// 在老数据行里某些列不可编辑
193
181
  },
194
182
  isShowCompare (col, row, oldRow = {}) {
195
183
  return this.useCampare && ["number"].includes(col._type) &&
@@ -1,11 +1,3 @@
1
- .dsh-title {
2
- padding: 10px;
3
- text-align: center;
4
- font-size: 16px;
5
- font-weight: 600;
6
- color: @textColor;
7
- }
8
-
9
1
  #dsh-nodata {
10
2
  width: 100%;
11
3
  margin: auto;
@@ -34,6 +26,16 @@
34
26
  color: @placeholderColor;
35
27
  }
36
28
 
29
+ .dsh-title {
30
+ padding: 10px;
31
+ text-align: center;
32
+ font-size: 16px;
33
+ font-weight: 600;
34
+ color: @textColor;
35
+ }
36
+ .dsh-hide {
37
+ display: none;;
38
+ }
37
39
  .dsh-subtip {
38
40
  width: 100%;
39
41
  text-align: center;