fix: table loop render
parent
a43655b0b5
commit
aa8e176fc7
|
@ -1 +1 @@
|
||||||
Subproject commit 3978ece8febab44f9007ea66df2adc20d65982c4
|
Subproject commit 4a986352a599904cfe895d0df1a8bb794e684645
|
|
@ -66,7 +66,6 @@ export default {
|
||||||
sLoading,
|
sLoading,
|
||||||
ghost,
|
ghost,
|
||||||
block,
|
block,
|
||||||
icon,
|
|
||||||
$attrs,
|
$attrs,
|
||||||
} = this;
|
} = this;
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||||
|
@ -86,7 +85,7 @@ export default {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const iconType = sLoading ? 'loading' : icon;
|
const iconType = sLoading ? 'loading' : this.iconCom;
|
||||||
return {
|
return {
|
||||||
[$attrs.class]: $attrs.class,
|
[$attrs.class]: $attrs.class,
|
||||||
[`${prefixCls}`]: true,
|
[`${prefixCls}`]: true,
|
||||||
|
|
|
@ -84,9 +84,9 @@ const Dropdown = {
|
||||||
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
|
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||||
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
const prefixCls = getPrefixCls('dropdown', customizePrefixCls);
|
||||||
|
const child = getSlot(this)[0];
|
||||||
const dropdownTrigger = cloneElement(getSlot(this), {
|
const dropdownTrigger = cloneElement(child, {
|
||||||
class: classNames(this.$attrs?.class, `${prefixCls}-trigger`),
|
class: classNames(child?.props?.class, `${prefixCls}-trigger`),
|
||||||
disabled,
|
disabled,
|
||||||
});
|
});
|
||||||
const triggerActions = disabled ? [] : trigger;
|
const triggerActions = disabled ? [] : trigger;
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
// export default {
|
|
||||||
// name: 'FilterDropdownMenuWrapper',
|
|
||||||
// methods: {
|
|
||||||
// handelClick(e) {
|
|
||||||
// e.stopPropagation();
|
|
||||||
// //this.$emit('click', e);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// render() {
|
|
||||||
// const { $slots, handelClick } = this;
|
|
||||||
// return <div onClick={handelClick}>{$slots.default}</div>;
|
|
||||||
// },
|
|
||||||
// };
|
|
||||||
|
|
||||||
const FilterDropdownMenuWrapper = (_, { attrs, slots }) => {
|
const FilterDropdownMenuWrapper = (_, { attrs, slots }) => {
|
||||||
return (
|
return (
|
||||||
<div class={attrs.class} onClick={e => e.stopPropagation()}>
|
<div class={attrs.class} onClick={e => e.stopPropagation()}>
|
||||||
|
|
|
@ -134,13 +134,10 @@ export default {
|
||||||
|
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
this.confirmFilter2();
|
|
||||||
// Call `setSelectedKeys` & `confirm` in the same time will make filter data not up to date
|
// Call `setSelectedKeys` & `confirm` in the same time will make filter data not up to date
|
||||||
// https://github.com/ant-design/ant-design/issues/12284
|
// https://github.com/ant-design/ant-design/issues/12284
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
this.$nextTick(() => {
|
this.$nextTick(this.confirmFilter2);
|
||||||
this.confirmFilter;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onVisibleChange(visible) {
|
onVisibleChange(visible) {
|
||||||
|
|
|
@ -115,13 +115,9 @@ export const TableProps = {
|
||||||
expandIconAsCell: PropTypes.bool,
|
expandIconAsCell: PropTypes.bool,
|
||||||
expandIconColumnIndex: PropTypes.number,
|
expandIconColumnIndex: PropTypes.number,
|
||||||
expandRowByClick: PropTypes.bool,
|
expandRowByClick: PropTypes.bool,
|
||||||
// onExpandedRowsChange?: (expandedRowKeys: string[] | number[]) => void;
|
|
||||||
// onExpand?: (expanded: boolean, record: T) => void;
|
|
||||||
// onChange?: (pagination: PaginationProps | boolean, filters: string[], sorter: Object) => any;
|
|
||||||
loading: PropTypes.oneOfType([PropTypes.shape(SpinProps).loose, PropTypes.bool]),
|
loading: PropTypes.oneOfType([PropTypes.shape(SpinProps).loose, PropTypes.bool]),
|
||||||
locale: TableLocale,
|
locale: TableLocale,
|
||||||
indentSize: PropTypes.number,
|
indentSize: PropTypes.number,
|
||||||
// onRowClick?: (record: T, index: number, event: Event) => any;
|
|
||||||
customRow: PropTypes.func,
|
customRow: PropTypes.func,
|
||||||
customHeaderRow: PropTypes.func,
|
customHeaderRow: PropTypes.func,
|
||||||
useFixedHeader: PropTypes.bool,
|
useFixedHeader: PropTypes.bool,
|
||||||
|
@ -137,7 +133,10 @@ export const TableProps = {
|
||||||
getPopupContainer: PropTypes.func,
|
getPopupContainer: PropTypes.func,
|
||||||
expandIcon: PropTypes.func,
|
expandIcon: PropTypes.func,
|
||||||
transformCellText: PropTypes.func,
|
transformCellText: PropTypes.func,
|
||||||
// className?: PropTypes.string,
|
onExpandedRowsChange: PropTypes.func,
|
||||||
|
onExpand: PropTypes.func,
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
onRowClick: PropTypes.func,
|
||||||
// style?: React.CSSProperties;
|
// style?: React.CSSProperties;
|
||||||
// children?: React.ReactNode;
|
// children?: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
@ -169,10 +168,10 @@ export const SelectionCheckboxAllProps = {
|
||||||
getRecordKey: PropTypes.func,
|
getRecordKey: PropTypes.func,
|
||||||
data: PropTypes.array,
|
data: PropTypes.array,
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
// onSelect: (key: string, index: number, selectFunc: any) => void;
|
|
||||||
hideDefaultSelections: PropTypes.bool,
|
hideDefaultSelections: PropTypes.bool,
|
||||||
selections: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
|
selections: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
|
||||||
getPopupContainer: PropTypes.func,
|
getPopupContainer: PropTypes.func,
|
||||||
|
onSelect: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
// export interface SelectionCheckboxAllState {
|
// export interface SelectionCheckboxAllState {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
import { toRaw } from 'vue';
|
||||||
export default class ColumnManager {
|
export default class ColumnManager {
|
||||||
constructor(columns) {
|
constructor(columns) {
|
||||||
this.columns = columns;
|
this.columns = toRaw(columns);
|
||||||
this._cached = {};
|
this._cached = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ export default class ColumnManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
reset(columns) {
|
reset(columns) {
|
||||||
this.columns = columns;
|
this.columns = toRaw(columns);
|
||||||
this._cached = {};
|
this._cached = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,8 +233,10 @@ const ExpandableTable = {
|
||||||
const needIndentSpaced = data.some(record => record[childrenColumnName]);
|
const needIndentSpaced = data.some(record => record[childrenColumnName]);
|
||||||
|
|
||||||
return getSlot(this, 'default', {
|
return getSlot(this, 'default', {
|
||||||
props,
|
props: {
|
||||||
...this.$attrs,
|
...props,
|
||||||
|
...this.$attrs,
|
||||||
|
},
|
||||||
needIndentSpaced,
|
needIndentSpaced,
|
||||||
renderRows: this.renderRows,
|
renderRows: this.renderRows,
|
||||||
handleExpandChange: this.handleExpandChange,
|
handleExpandChange: this.handleExpandChange,
|
||||||
|
|
|
@ -88,7 +88,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
this.preData = [...this.data];
|
this.preData = [...this.data];
|
||||||
return {
|
return {
|
||||||
columnManager: new ColumnManager(this.columns),
|
columnManager: markRaw(new ColumnManager(this.columns)),
|
||||||
sComponents: markRaw(
|
sComponents: markRaw(
|
||||||
merge(
|
merge(
|
||||||
{
|
{
|
||||||
|
@ -178,6 +178,7 @@ export default {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
console.log(this.ref_headTable);
|
||||||
if (this.columnManager.isAnyColumnsFixed()) {
|
if (this.columnManager.isAnyColumnsFixed()) {
|
||||||
this.handleWindowResize();
|
this.handleWindowResize();
|
||||||
this.resizeEvent = addEventListener(window, 'resize', this.debouncedWindowResize);
|
this.resizeEvent = addEventListener(window, 'resize', this.debouncedWindowResize);
|
||||||
|
|
|
@ -70,9 +70,9 @@ export default {
|
||||||
let rowSpan;
|
let rowSpan;
|
||||||
|
|
||||||
if (customRender) {
|
if (customRender) {
|
||||||
text = customRender(text, record, index, column);
|
text = customRender({ text, record, index, column });
|
||||||
if (isInvalidRenderCellText(text)) {
|
if (isInvalidRenderCellText(text)) {
|
||||||
tdProps = text.props || tdProps;
|
tdProps = text.props || text.attrs || tdProps;
|
||||||
({ colSpan, rowSpan } = tdProps);
|
({ colSpan, rowSpan } = tdProps);
|
||||||
text = text.children;
|
text = text.children;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ const TableRow = {
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
// this.shouldRender = this.visible
|
// this.shouldRender = this.visible
|
||||||
|
this.rowRef = null;
|
||||||
return {
|
return {
|
||||||
shouldRender: this.visible,
|
shouldRender: this.visible,
|
||||||
};
|
};
|
||||||
|
@ -155,17 +156,13 @@ const TableRow = {
|
||||||
|
|
||||||
saveRowRef() {
|
saveRowRef() {
|
||||||
this.rowRef = findDOMNode(this);
|
this.rowRef = findDOMNode(this);
|
||||||
|
|
||||||
const { isAnyColumnsFixed, fixed, expandedRow, ancestorKeys } = this;
|
const { isAnyColumnsFixed, fixed, expandedRow, ancestorKeys } = this;
|
||||||
|
|
||||||
if (!isAnyColumnsFixed) {
|
if (!isAnyColumnsFixed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fixed && expandedRow) {
|
if (!fixed && expandedRow) {
|
||||||
this.setExpandedRowHeight();
|
this.setExpandedRowHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fixed && ancestorKeys.length >= 0) {
|
if (!fixed && ancestorKeys.length >= 0) {
|
||||||
this.setRowHeight();
|
this.setRowHeight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import demo from '../antdv-demo/docs/transfer/demo/basic';
|
import demo from '../antdv-demo/docs/table/demo/custom-filter-panel';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
Loading…
Reference in New Issue