bri-components 1.6.13 → 1.6.14

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.6.13",
3
+ "version": "1.6.14",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -142,10 +142,11 @@ export default {
142
142
  // 多选模式 点击选项
143
143
  clickCheckItem (item, index) {
144
144
  if (!this.getCheckItemDisabled(item)) {
145
- this.curValList = this.getItemCheckStatus(item)
146
- ? this.curValList.filter(key => key !== item[this.saveKey])
147
- : [...this.curValList, item[this.saveKey]];
148
- this.curValList = this.curValList.filter(key => this.listDataKeys.includes(key));
145
+ this.curValList = (
146
+ this.getItemCheckStatus(item)
147
+ ? this.curValList.filter(key => key !== item[this.saveKey])
148
+ : [...this.curValList, item[this.saveKey]]
149
+ ).filter(key => this.listDataKeys.includes(key));
149
150
  }
150
151
  },
151
152
 
@@ -200,7 +200,7 @@ export default {
200
200
  // 每条数据都补充全所有字段值(赋一个默认的空值)
201
201
  this.selfColumns.forEach((colItem) => {
202
202
  // 不用row[colItem._key] === undefined判断,是因为后端给的空值不可靠,多选的有时候都能给null
203
- if (!Object.prototype.hasOwnProperty.call(row, colItem._key) && this.$isEmptyData(row[colItem._key])) {
203
+ if (!row.hasOwnProperty(colItem._key) && this.$isEmptyData(row[colItem._key])) {
204
204
  this.$set(row, colItem._key, this.$deepCopy(this.dftInitValMap[colItem._type]));
205
205
  }
206
206
  });
@@ -456,7 +456,7 @@ export default {
456
456
  // 每条数据都补充全所有字段值(赋一个默认的空值)
457
457
  this.selfColumns.forEach((colItem) => {
458
458
  // 不用row[colItem._key] === undefined判断,是因为后端给的空值不可靠,多选的有时候都能给null
459
- if (!Object.prototype.hasOwnProperty.call(row, colItem._key) && this.$isEmptyData(row[colItem._key])) {
459
+ if (!row.hasOwnProperty(colItem._key) && this.$isEmptyData(row[colItem._key])) {
460
460
  this.$set(row, colItem._key, this.$deepCopy(this.dftInitValMap[colItem._type]));
461
461
  }
462
462
  });
@@ -28,11 +28,11 @@ export default {
28
28
  },
29
29
  expandColumn () {
30
30
  return {
31
- // title: "开/合",
31
+ title: "开/收",
32
32
  _key: "__isExpand__",
33
33
  key: "__isExpand__",
34
34
  field: "__isExpand__",
35
- width: 48,
35
+ width: 52,
36
36
  align: "center",
37
37
  fixed: "left",
38
38
  renderBodyCell: ({ row, rowIndex, column }, h) => {
@@ -67,14 +67,14 @@ export default {
67
67
  _key: "__treeIndex__",
68
68
  key: "__treeIndex__",
69
69
  field: "__treeIndex__",
70
- width: 28 + 16 + (this.maxLevel - 1) * 36,
70
+ width: 28 + (this.maxLevel - 1) * 24,
71
71
  align: "left",
72
- fixed: "left",
72
+ // fixed: "left",
73
73
  renderBodyCell: ({ row, rowIndex, column }, h) => {
74
74
  return [
75
75
  h("div", {
76
76
  style: {
77
- paddingLeft: `${(row.level - 1) * 18}px`,
77
+ paddingLeft: `${(row.level - 1) * 10}px`,
78
78
  fontWeight: "500"
79
79
  }
80
80
  }, row.__treeIndex__),
@@ -220,7 +220,7 @@ export default {
220
220
  // 每条数据都补充全所有字段值(赋一个默认的空值)
221
221
  this.selfColumns.forEach((colItem) => {
222
222
  // 不用row[colItem._key] === undefined判断,是因为后端给的空值不可靠,多选的有时候都能给null
223
- if (!Object.prototype.hasOwnProperty.call(row, colItem._key) && this.$isEmptyData(row[colItem._key])) {
223
+ if (!row.hasOwnProperty(colItem._key) && this.$isEmptyData(row[colItem._key])) {
224
224
  this.$set(row, colItem._key, this.$deepCopy(this.dftInitValMap[colItem._type]));
225
225
  }
226
226
  });
@@ -248,13 +248,13 @@ export default {
248
248
  else {
249
249
  // 第一级的需要显示出来
250
250
  if (row.level === 1) {
251
- !Object.prototype.hasOwnProperty.call(row, "__isExpand__") && this.$set(row, "__isExpand__", false);
252
- !Object.prototype.hasOwnProperty.call(row, "__isShow__") && this.$set(row, "__isShow__", true);
253
- !Object.prototype.hasOwnProperty.call(row, "__isTmpShow__") && this.$set(row, "__isTmpShow__", true);
251
+ !row.hasOwnProperty("__isExpand__") && this.$set(row, "__isExpand__", false);
252
+ !row.hasOwnProperty("__isShow__") && this.$set(row, "__isShow__", true);
253
+ !row.hasOwnProperty("__isTmpShow__") && this.$set(row, "__isTmpShow__", true);
254
254
  } else {
255
- !Object.prototype.hasOwnProperty.call(row, "__isExpand__") && this.$set(row, "__isExpand__", false);
256
- !Object.prototype.hasOwnProperty.call(row, "__isShow__") && this.$set(row, "__isShow__", false);
257
- !Object.prototype.hasOwnProperty.call(row, "__isTmpShow__") && this.$set(row, "__isTmpShow__", false);
255
+ !row.hasOwnProperty("__isExpand__") && this.$set(row, "__isExpand__", false);
256
+ !row.hasOwnProperty("__isShow__") && this.$set(row, "__isShow__", false);
257
+ !row.hasOwnProperty("__isTmpShow__") && this.$set(row, "__isTmpShow__", false);
258
258
  }
259
259
  }
260
260
  },
@@ -268,22 +268,25 @@ export default {
268
268
  },
269
269
  // 切换子孙后代的显示/隐藏
270
270
  toggleDescendantsShow (row, bool) {
271
- const loop = (row, isFirstSon) => {
271
+ const loop = (row, bool, isFirstSon) => {
272
272
  if (row.children && row.children.length) {
273
273
  row.children.forEach(subRow => {
274
+ // !父级的bool是true,即只有当父级节点是显示状态时,子孙后代才能根据__isTmpShow__设置__isShow__
275
+ let resultBool = bool;
274
276
  if (isFirstSon) {
275
- this.$set(subRow, "__isShow__", bool);
276
- this.$set(subRow, "__isTmpShow__", bool);
277
+ this.$set(subRow, "__isShow__", resultBool);
278
+ this.$set(subRow, "__isTmpShow__", resultBool);
277
279
  } else {
278
- this.$set(subRow, "__isShow__", bool ? !!subRow.__isTmpShow__ : false);
280
+ resultBool = bool ? !!subRow.__isTmpShow__ : false;
281
+ this.$set(subRow, "__isShow__", resultBool);
279
282
  }
280
283
 
281
- loop(subRow);
284
+ loop(subRow, resultBool);
282
285
  });
283
286
  }
284
287
  };
285
288
 
286
- loop(row, true);
289
+ loop(row, bool, true);
287
290
  },
288
291
  // getNewRowData时,额外补充的行相关的数据
289
292
  getSelfNewRowData (level) {
@@ -1362,76 +1362,76 @@ export default {
1362
1362
 
1363
1363
  return [
1364
1364
  // 插入一行图标
1365
- baseBool
1366
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canInsert", iconSize, ++sortNum)
1365
+ baseBool && this.operationMap.canInsert && this.operationMap.canInsert.disabled !== true
1366
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canInsert, iconSize, ++sortNum)
1367
1367
  : h("span", ""),
1368
1368
 
1369
- // 添加一行下级图标
1370
- baseBool && ["treeTable"].includes(this.inTableType) && row.level < this.maxLevel // 只有层级表格要“添加下级”图标
1371
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canCreateChild", iconSize, ++sortNum)
1369
+ // 添加一行下级图标 (只有层级表格要“添加下级”图标)
1370
+ baseBool && this.operationMap.canCreateChild && this.operationMap.canCreateChild.disabled !== true &&
1371
+ ["treeTable"].includes(this.inTableType) && row.level < this.maxLevel
1372
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canCreateChild, iconSize, ++sortNum)
1372
1373
  : h("span", ""),
1373
1374
 
1374
1375
  // 删除该行图标(得有删除能力)
1375
- baseBool && ["cascaderTable"].includes(this.inTableType) && this.getRowDelBtnCanEdit(row, rowIndex)
1376
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canDelete", iconSize, ++sortNum)
1376
+ baseBool && this.operationMap.canDelete && this.operationMap.canDelete.disabled !== true &&
1377
+ ["cascaderTable"].includes(this.inTableType) && this.getRowDelBtnCanEdit(row, rowIndex)
1378
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canDelete, iconSize, ++sortNum)
1377
1379
  : h("span", ""),
1378
1380
 
1379
1381
  // 下移图标
1380
- baseBool && !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__)
1381
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canMoveDown", iconSize, ++sortNum)
1382
+ baseBool && this.operationMap.canMoveDown && this.operationMap.canMoveDown.disabled !== true &&
1383
+ !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["first", "center"].includes(row.__position__)
1384
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canMoveDown, iconSize, ++sortNum)
1382
1385
  : h("span", ""),
1383
1386
 
1384
1387
  // 上移图标
1385
- baseBool && !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__)
1386
- ? this.getOperationIconRender(h, { row, rowIndex, column }, "canMoveUp", iconSize, ++sortNum)
1388
+ baseBool && this.operationMap.canMoveUp && this.operationMap.canMoveUp.disabled !== true &&
1389
+ !this.useMoveInOperationCol && this.getRowMoveBtnCanEdit(row, rowIndex) && ["last", "center"].includes(row.__position__)
1390
+ ? this.getOperationIconRender(h, { row, rowIndex, column }, this.operationMap.canMoveUp, iconSize, ++sortNum)
1387
1391
  : h("span", "")
1388
1392
  ];
1389
1393
  },
1390
- getOperationIconRender (h, { row, rowIndex, column }, operationType, iconSize = 14, sortNum = 0) {
1391
- const operationItem = this.operationMap[operationType];
1392
-
1393
- return operationItem && operationItem.disabled !== true
1394
- ? h("div", {
1395
- class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}${operationItem.triggerType === "hover" ? " dsh-tr-hover-show" : ""}`,
1396
- style: {
1397
- position: "absolute",
1398
- bottom: "0px",
1399
- right: `${(iconSize + 3) * sortNum}px`,
1400
- width: `${iconSize + 2}px`,
1401
- height: `${iconSize + 2}px`,
1402
- borderRadius: "2px",
1403
- backgroundColor: "#ffffff",
1404
- lineHeight: `${iconSize - 2}px`,
1405
- cursor: "pointer",
1406
- verticalAlign: "middle",
1407
- transition: "color .2s ease-in-out,border-color .2s ease-in-out"
1394
+ getOperationIconRender (h, { row, rowIndex, column }, operationItem, iconSize = 14, sortNum = 0) {
1395
+ return h("div", {
1396
+ class: `dsh-color-border-${operationItem.btnType.includes("error") ? "error" : "primary"}${operationItem.triggerType === "hover" ? " dsh-tr-hover-show" : ""}`,
1397
+ style: {
1398
+ position: "absolute",
1399
+ bottom: "0px",
1400
+ right: `${(iconSize + 3) * sortNum}px`,
1401
+ width: `${iconSize + 2}px`,
1402
+ height: `${iconSize + 2}px`,
1403
+ borderRadius: "2px",
1404
+ backgroundColor: "#ffffff",
1405
+ lineHeight: `${iconSize - 2}px`,
1406
+ cursor: "pointer",
1407
+ verticalAlign: "middle",
1408
+ transition: "color .2s ease-in-out,border-color .2s ease-in-out"
1409
+ }
1410
+ }, [
1411
+ h("Tooltip", {
1412
+ props: {
1413
+ content: operationItem.tip,
1414
+ maxWidth: "250",
1415
+ transfer: true
1408
1416
  }
1409
1417
  }, [
1410
- h("Tooltip", {
1418
+ h("Icon", {
1419
+ class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
1420
+ style: {
1421
+ fontWeight: "500"
1422
+ },
1411
1423
  props: {
1412
- content: operationItem.tip,
1413
- maxWidth: "250",
1414
- transfer: true
1415
- }
1416
- }, [
1417
- h("Icon", {
1418
- class: `dsh-color-${operationItem.btnType.includes("error") ? "error" : "primary"}`,
1419
- style: {
1420
- fontWeight: "500"
1421
- },
1422
- props: {
1423
- type: operationItem.icon,
1424
- size: iconSize
1425
- },
1426
- on: {
1427
- click: () => {
1428
- this.$dispatchEvent(operationItem, row, rowIndex, column);
1429
- }
1424
+ type: operationItem.icon,
1425
+ size: iconSize
1426
+ },
1427
+ on: {
1428
+ click: () => {
1429
+ this.$dispatchEvent(operationItem, row, rowIndex, column);
1430
1430
  }
1431
- })
1432
- ])
1431
+ }
1432
+ })
1433
1433
  ])
1434
- : h("span", "");
1434
+ ]);
1435
1435
  },
1436
1436
  bodyCellClass ({ row, rowIndex, column }) {
1437
1437
  return "bri-table-td" +
@@ -62,6 +62,13 @@
62
62
  &-default {
63
63
  .ivu-modal-wrap {
64
64
  .ivu-modal {
65
+ margin: 0px auto;
66
+ position: absolute;
67
+ top: 160px;
68
+ bottom: 0px;
69
+ left: 0px;
70
+ right: 0px;
71
+
65
72
  width: 750px !important;
66
73
  height: 550px !important;
67
74
  max-height: 100%;
@@ -190,26 +197,26 @@
190
197
  height: 100%;
191
198
  display: flex;
192
199
  flex-direction: column;
193
-
200
+
194
201
  .DshModal-close,
195
202
  .ivu-modal-close {
196
203
  top: 20px;
197
204
  right: 24px;
198
205
  color: @contentColor;
199
206
  font-size: @smallTitleSize;
200
-
207
+
201
208
  .ivu-icon-ios-close {
202
209
  font-size: 22px;
203
210
  color: @contentColor;
204
211
  }
205
212
  }
206
-
213
+
207
214
  .ivu-modal-header {
208
215
  width: 100%;
209
216
  height: 48px;
210
217
  padding: 16px 24px 8px 24px;
211
218
  // border-bottom: none;
212
-
219
+
213
220
  &-inner {
214
221
  color: rgba(0, 0, 0, 0.9);
215
222
  font-size: 16px;
@@ -218,7 +225,7 @@
218
225
  height: 24px;
219
226
  }
220
227
  }
221
-
228
+
222
229
  .ivu-modal-body {
223
230
  flex: 1;
224
231
  overflow: auto;
@@ -228,13 +235,13 @@
228
235
  }
229
236
  }
230
237
  }
231
-
238
+
232
239
  #bri-modal-common();
233
240
 
234
241
  // 小框 无固定高度,上下居中
235
242
  &-center {
236
243
  #bri-modal-common();
237
-
244
+
238
245
  .ivu-modal-wrap {
239
246
  width: 100%;
240
247
  height: 100%;
@@ -242,16 +249,16 @@
242
249
  flex-direction: column;
243
250
  align-items: center;
244
251
  justify-content: center;
245
-
252
+
246
253
  .ivu-modal {
247
254
  top: 0px;
248
255
  }
249
256
  }
250
257
  }
251
-
258
+
252
259
  // modal内部公用样式
253
260
  &-footer {
254
261
  text-align: right;
255
262
  margin-top: 16px;
256
263
  }
257
- }
264
+ }