bri-components 1.4.24 → 1.4.25

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.24",
3
+ "version": "1.4.25",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -46,6 +46,13 @@ export default {
46
46
  return this.transformRows(this.allTreeData, this.treeColumns);
47
47
  },
48
48
 
49
+ showContentColumns () {
50
+ return this.contentColumns.filter(colItem =>
51
+ this.hideStatus === true
52
+ ? !this.hideColKeys.includes(colItem._key)
53
+ : true
54
+ );
55
+ },
49
56
  showColumns () {
50
57
  return this.mergeColumns(this.treeColumns);
51
58
  },
@@ -61,7 +61,7 @@ export default {
61
61
  ? []
62
62
  : this.useSummary && this.allListData.length
63
63
  ? [
64
- this.filterColumns.reduce((obj, column) => {
64
+ this.useFormColumns.reduce((obj, column) => {
65
65
  return {
66
66
  ...obj,
67
67
  [column._key]: column._type === "number" && column._summaryType
@@ -23,7 +23,7 @@ export default {
23
23
  ? []
24
24
  : this.useSummary && this.allListData.length
25
25
  ? [
26
- this.filterColumns.reduce((obj, column) => {
26
+ this.useFormColumns.reduce((obj, column) => {
27
27
  return {
28
28
  ...obj,
29
29
  [column._key]: column._type === "number" && column._summaryType
@@ -210,7 +210,7 @@ export default {
210
210
  controlKey () {
211
211
  return this.propsObj._key;
212
212
  },
213
- // 是否在设置默认值下
213
+ // 是否在字段默认值设置里使用
214
214
  isDftSet () {
215
215
  return this.controlKey === "_default";
216
216
  },
@@ -265,6 +265,8 @@ export default {
265
265
  conditions: []
266
266
  }, // 筛选默认值(cascaderTable和flatTable组件里默认值情使用时,以及modSetForm里,会重置_tableAdvSearch)
267
267
 
268
+ _showOrHideColKeys: [], // 联动隐藏字段的keys
269
+ _showByNumFieldKey: "", // 控制联动隐藏字段的外层字段
268
270
  _hideColKeys: [], // 隐藏/查看列字段的keys
269
271
  _isQuote: false, // 引用
270
272
  _quoteDisabledColKeys: [], // 引用数据行不可编辑咧
@@ -356,7 +358,6 @@ export default {
356
358
  disabledDeleteOldRow () {
357
359
  return this.isDftSet ? false : this.selfPropsObj._disabledDeleteOldRow;
358
360
  },
359
-
360
361
  dftReadonly () {
361
362
  return this.isDftSet ? false : this.selfPropsObj._dftReadonly;
362
363
  },
@@ -370,6 +371,7 @@ export default {
370
371
  return this.isDftSet ? [] : this.selfPropsObj._oldReadonlyColKeys || []; // 配置端有问题,高级依赖时值成undefined了
371
372
  },
372
373
 
374
+ /* --- 筛选 --- */
373
375
  searchLabelWidth () {
374
376
  return this.selfPropsObj._searchLabelWidth;
375
377
  },
@@ -392,7 +394,7 @@ export default {
392
394
  tableAdvSearch () {
393
395
  return this.$transformAdvSearch(this.selfPropsObj._tableAdvSearch, this.allFormList, this.parentObj);
394
396
  },
395
- // 配置的默认筛选值里 隐藏的看不到的筛选条件
397
+ // 默认筛选配置里-隐藏的筛选条件
396
398
  hideAdvSearch () {
397
399
  return {
398
400
  logic: ["and", "or"].includes(this.tableAdvSearch.logic) ? this.tableAdvSearch.logic : "and",
@@ -411,9 +413,11 @@ export default {
411
413
  ]
412
414
  };
413
415
  },
416
+ // 是否搜索状态
414
417
  isSearching () {
415
418
  return this.$isAdvSearching(this.finalTableAdvSearch);
416
419
  },
420
+ // 当前行数
417
421
  rowsNum () {
418
422
  return this.isSearching
419
423
  ? this.showListData.length
@@ -423,7 +427,7 @@ export default {
423
427
  return `当前${this.isSearching ? "筛选" : "全部"}数据, 共 ${this.rowsNum} ${this.showMode === "form" ? "条" : "行"};`;
424
428
  },
425
429
 
426
- /* 数据 */
430
+ /* --- 数据 --- */
427
431
  defaultListData () {
428
432
  const loop = (tree = [], list = []) => {
429
433
  return tree.reduce((newList, rowItem) => {
@@ -486,15 +490,22 @@ export default {
486
490
  return !!this.compareListData.length;
487
491
  },
488
492
 
489
- /* */
493
+ /* --- 列字段 --- */
494
+ // columns => selfColumns => useFormColumns => contentColumns => showContentColumns => showColumns
490
495
  selfColumns () {
491
496
  return this.columns;
492
497
  },
493
- filterColumns () {
494
- return this.selfColumns.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
498
+ useFormColumns () {
499
+ const list = this.selfColumns.filter(colItem =>
500
+ this.showOrHideColKeys.includes(colItem._key)
501
+ ? this.showColKeys.includes(colItem._key)
502
+ : true
503
+ );
504
+
505
+ return list.filter(colItem => this.$isAdvRelyShow(colItem, this.allListData, this.parentObj, true));
495
506
  },
496
507
  contentColumns () {
497
- return this.filterColumns.map(colItem => ({
508
+ return this.useFormColumns.map(colItem => ({
498
509
  filter: undefined,
499
510
  sortBy: undefined,
500
511
  renderHeaderCell: ({ column }, h) => {
@@ -506,13 +517,7 @@ export default {
506
517
  ...colItem
507
518
  }));
508
519
  },
509
- showContentColumns () {
510
- return this.contentColumns.filter(colItem =>
511
- this.hideStatus === true
512
- ? !this.hideColKeys.includes(colItem._key)
513
- : true
514
- );
515
- },
520
+
516
521
  selectionColumn () {
517
522
  return {
518
523
  _key: "__selection__",
@@ -572,9 +577,30 @@ export default {
572
577
  };
573
578
  },
574
579
 
580
+ // 联动隐藏
581
+ showColKeys () {
582
+ return this.showByNumFieldVal >= 0
583
+ ? this.showOrHideColKeys.slice(0, this.showByNumFieldVal)
584
+ : this.showOrHideColKeys;
585
+ },
586
+ showOrHideColKeys () {
587
+ return this.selfPropsObj._showOrHideColKeys || [];
588
+ },
589
+ showByNumFieldKey () {
590
+ // 控制联动隐藏的数字类型字段
591
+ return this.selfPropsObj._showByNumFieldKey;
592
+ },
593
+ showByNumFieldVal () {
594
+ // 控制联动隐藏的数字类型字段的值
595
+ return this.showByNumFieldKey
596
+ ? this.parentObj[this.showByNumFieldKey]
597
+ : undefined;
598
+ },
599
+ // 显示/隐藏
575
600
  hideColKeys () {
576
601
  return this.selfPropsObj._hideColKeys;
577
602
  },
603
+ // 引用
578
604
  isQuote () {
579
605
  return this.selfPropsObj._isQuote;
580
606
  },
@@ -608,6 +634,7 @@ export default {
608
634
  }
609
635
  };
610
636
  },
637
+ // 导入
611
638
  isImport () {
612
639
  return this.selfPropsObj._isImport;
613
640
  },
@@ -618,6 +645,7 @@ export default {
618
645
  importType: this.inTableType
619
646
  };
620
647
  },
648
+ // 导出
621
649
  isExport () {
622
650
  return this.selfPropsObj._isExport;
623
651
  },
@@ -629,6 +657,7 @@ export default {
629
657
  advSearch: this.finalTableAdvSearch
630
658
  };
631
659
  },
660
+ // 全屏
632
661
  useEnlarge () {
633
662
  return this.selfPropsObj._useEnlarge;
634
663
  },
@@ -639,6 +668,7 @@ export default {
639
668
  };
640
669
  },
641
670
 
671
+ /* --- 功能按钮 --- */
642
672
  baseOperationBtns () {
643
673
  return Object.keys(this.baseOperationMap);
644
674
  },
@@ -1326,7 +1356,7 @@ export default {
1326
1356
  /* ----------- 方法 ---------- */
1327
1357
  // 整行校验结果
1328
1358
  getRowRuleResult (row, rowIndex) {
1329
- return this.filterColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
1359
+ return this.useFormColumns.every(column => this.getColRuleResult({ row, rowIndex, column }).bool);
1330
1360
  },
1331
1361
  getRowFormList (row, rowIndex) {
1332
1362
  return this.selfColumns.map(column => {