vxe-table 3.6.14-beta.1 → 3.6.14-beta.2

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.
@@ -657,7 +657,7 @@ const Methods = {
657
657
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
658
658
  */
659
659
  cacheColumnMap () {
660
- const { tableFullColumn, collectColumn, fullColumnMap, showOverflow } = this
660
+ const { tableFullColumn, collectColumn, fullColumnMap, showOverflow, columnOpts, rowOpts } = this
661
661
  const fullColumnIdData = this.fullColumnIdData = {}
662
662
  const fullColumnFieldData = this.fullColumnFieldData = {}
663
663
  const isGroup = collectColumn.some(hasChildrenList)
@@ -666,6 +666,7 @@ const Methods = {
666
666
  let treeNodeColumn
667
667
  let checkboxColumn
668
668
  let radioColumn
669
+ let htmlColumn
669
670
  let hasFixed
670
671
  const handleFunc = (column, index, items, path, parent) => {
671
672
  const { id: colid, field, fixed, type, treeNode } = column
@@ -678,9 +679,14 @@ const Methods = {
678
679
  }
679
680
  fullColumnFieldData[field] = rest
680
681
  }
682
+
681
683
  if (!hasFixed && fixed) {
682
684
  hasFixed = fixed
683
685
  }
686
+ if (!htmlColumn && type === 'html') {
687
+ htmlColumn = column
688
+ }
689
+
684
690
  if (treeNode) {
685
691
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
686
692
  if (treeNodeColumn) {
@@ -728,6 +734,18 @@ const Methods = {
728
734
  warnLog('vxe.error.errConflicts', [`table.show-footer-overflow=${this.showFooterOverflow}`, `column.show-footer-overflow=${column.showFooterOverflow}`])
729
735
  }
730
736
  }
737
+
738
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
739
+ if (htmlColumn) {
740
+ if (!columnOpts.useKey) {
741
+ errLog('vxe.error.reqProp', ['column-config.useKey', 'column.type=html'])
742
+ }
743
+ if (!rowOpts.useKey) {
744
+ errLog('vxe.error.reqProp', ['row-config.useKey', 'column.type=html'])
745
+ }
746
+ }
747
+ }
748
+
731
749
  if (isAllOverflow && column.showOverflow === false) {
732
750
  isAllOverflow = false
733
751
  }
@@ -888,7 +906,7 @@ const Methods = {
888
906
  const { radioOpts, checkboxOpts, treeConfig, treeOpts, expandOpts } = this
889
907
  const rowkey = getRowkey(this)
890
908
  if (!XEUtils.isArray(records)) {
891
- records = [records]
909
+ records = [records || {}]
892
910
  }
893
911
  return records.map(record => {
894
912
  this.tableFullColumn.forEach(column => {
@@ -928,10 +946,9 @@ const Methods = {
928
946
  * @param {Array} records 新数据
929
947
  */
930
948
  createData (records) {
931
- const { treeConfig, treeOpts } = this
932
- const handleRrecord = record => this.defineField(Object.assign({}, record))
933
- const rows = treeConfig ? XEUtils.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord)
934
- return this.$nextTick().then(() => rows)
949
+ return this.$nextTick().then(() => {
950
+ return this.defineField(records)
951
+ })
935
952
  },
936
953
  /**
937
954
  * 创建 Row|Rows 对象
@@ -943,7 +960,7 @@ const Methods = {
943
960
  if (!isArr) {
944
961
  records = [records]
945
962
  }
946
- return this.$nextTick().then(() => this.createData(records).then(rows => isArr ? rows : rows[0]))
963
+ return this.createData(records).then(rows => isArr ? rows : rows[0])
947
964
  },
948
965
  /**
949
966
  * 还原数据
@@ -3733,13 +3750,17 @@ const Methods = {
3733
3750
  * 判断指定列是否为筛选状态,如果为空则判断所有列
3734
3751
  * @param {String} fieldOrColumn 字段名
3735
3752
  */
3736
- isFilter (fieldOrColumn) {
3753
+ isActiveFilterByColumn (fieldOrColumn) {
3737
3754
  const column = handleFieldOrColumn(this, fieldOrColumn)
3738
3755
  if (column) {
3739
3756
  return column.filters && column.filters.some(option => option.checked)
3740
3757
  }
3741
3758
  return this.getCheckedFilters().length > 0
3742
3759
  },
3760
+ // 已废弃
3761
+ isFilter (fieldOrColumn) {
3762
+ return this.isActiveFilterByColumn(fieldOrColumn)
3763
+ },
3743
3764
  /**
3744
3765
  * 判断展开行是否懒加载完成
3745
3766
  * @param {Row} row 行对象
package/types/table.d.ts CHANGED
@@ -630,6 +630,11 @@ export declare class Table extends VXETableComponent {
630
630
  * 判断指定列是否为筛选状态,如果为空则判断所有列
631
631
  * @param column 列对象
632
632
  */
633
+ isActiveFilterByColumn(column: ColumnInfo): boolean;
634
+ /**
635
+ * 已废弃,请使用 isFilterByColumn
636
+ * @deprecated
637
+ */
633
638
  isFilter(column: ColumnInfo): boolean;
634
639
  /**
635
640
  * 用于 expand-config.lazy,用于懒加载展开行,判断展开行是否懒加载完成
@@ -65,6 +65,8 @@ export interface RendererMapOptions {
65
65
  // 表单-项渲染
66
66
  itemClassName?: string | ((params: FormItemRenderParams) => string | { [key: string]: boolean })
67
67
  itemStyle?: string | VNodeStyle | ((params: FormItemRenderParams) => string | VNodeStyle)
68
+ itemContentClassName?: string | ((params: FormItemRenderParams) => string | { [key: string]: boolean })
69
+ itemContentStyle?: string | VNodeStyle | ((params: FormItemRenderParams) => string | VNodeStyle)
68
70
  renderItemTitle?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): SlotVNodeType | SlotVNodeType[];
69
71
  renderItemContent?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): SlotVNodeType | SlotVNodeType[];
70
72
  itemVisibleMethod?(params: FormItemVisibleParams): boolean;