ztxkui 4.2.18-72 → 4.2.18-73
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.
|
@@ -227,7 +227,7 @@ var BasicTable = function (_a) {
|
|
|
227
227
|
"isResizableColumn\u5C5E\u6027\u9ED8\u8BA4\u4E3Atrue\uFF0C\u5982\u679C\u4E0D\u9700\u8981\u5217\u4F38\u7F29\u53EF\u4EE5\u4F20\u5165false"),
|
|
228
228
|
React.createElement(Table, { dataSource: dataSource, columns: columns, rowKey: "id", scroll: { y: 500 },
|
|
229
229
|
// isContextMenu
|
|
230
|
-
showColumnDynamic: true, showColumnDynamicKey: dynamicKey || 'symbol-id-1', configInfo: tableConfigInfo, isNumberInputAlignRight: true, isNumberInputThousandth: true, virtualTableKey: "virtualTableKey", summaryConfig: [
|
|
230
|
+
showColumnDynamic: true, showColumnDynamicKey: dynamicKey || 'symbol-id-1', configInfo: tableConfigInfo, isNumberInputAlignRight: true, isNumberInputThousandth: true, virtualTableKey: "virtualTableKey", isSort: false, isFilter: false, summaryConfig: [
|
|
231
231
|
{
|
|
232
232
|
type: 'subtotal',
|
|
233
233
|
fields: ['test10', 'test101'],
|
|
@@ -233,7 +233,7 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
233
233
|
var columns = basicConfig.columns, newColumnsRef = basicConfig.newColumnsRef, showColumnDynamic = basicConfig.showColumnDynamic, showColumnDynamicKey = basicConfig.showColumnDynamicKey, configInfo = basicConfig.configInfo, currentDataSource = basicConfig.currentDataSource, preDataSource = basicConfig.preDataSource, rowKey = basicConfig.rowKey, dataSourceRef = basicConfig.dataSourceRef, expandableChildrenColumnName = basicConfig.expandableChildrenColumnName, upDateColumnsRef = basicConfig.upDateColumnsRef, setUpDateColumnsRef = basicConfig.setUpDateColumnsRef, isUpDateColumnsRef = basicConfig.isUpDateColumnsRef, setIsUpDateColumnsRef = basicConfig.setIsUpDateColumnsRef;
|
|
234
234
|
var onEditableSave = editableConfig.onEditableSave, onTableChange = editableConfig.onTableChange, currentPage = editableConfig.currentPage, onFillDownChangeRef = editableConfig.onFillDownChangeRef;
|
|
235
235
|
var ColumnDynamicCom = dynamicConfig.ColumnDynamicCom, DelAllCom = dynamicConfig.DelAllCom, onAddAndDelHandleMemo = dynamicConfig.onAddAndDelHandleMemo, onAddAndDelHandle = dynamicConfig.onAddAndDelHandle, hideAddIcon = dynamicConfig.hideAddIcon, addIconText = dynamicConfig.addIconText, hideDelIcon = dynamicConfig.hideDelIcon, delIconText = dynamicConfig.delIconText;
|
|
236
|
-
var copyByKey = otherConfig.copyByKey, myCatchColumns = otherConfig.myCatchColumns, customSortHandle = otherConfig.customSortHandle, customOrder = otherConfig.customOrder, setCustomOrder = otherConfig.setCustomOrder, isSort = otherConfig.isSort, handleSearch = otherConfig.handleSearch, handleReset = otherConfig.handleReset, searchInput = otherConfig.searchInput, isModalInput = otherConfig.isModalInput, tableNumberFormatter = otherConfig.tableNumberFormatter, isNumberInputThousandth = otherConfig.isNumberInputThousandth, isNumberInputAlignRight = otherConfig.isNumberInputAlignRight, autoDecimalFieldsRef = otherConfig.autoDecimalFieldsRef, isCustomDecimalField = otherConfig.isCustomDecimalField, customDecimalFieldRender = otherConfig.customDecimalFieldRender, isTableSortEnabled = otherConfig.isTableSortEnabled, isTableFilterEnabled = otherConfig.isTableFilterEnabled;
|
|
236
|
+
var copyByKey = otherConfig.copyByKey, myCatchColumns = otherConfig.myCatchColumns, customSortHandle = otherConfig.customSortHandle, customOrder = otherConfig.customOrder, setCustomOrder = otherConfig.setCustomOrder, isSort = otherConfig.isSort, isFilter = otherConfig.isFilter, handleSearch = otherConfig.handleSearch, handleReset = otherConfig.handleReset, searchInput = otherConfig.searchInput, isModalInput = otherConfig.isModalInput, tableNumberFormatter = otherConfig.tableNumberFormatter, isNumberInputThousandth = otherConfig.isNumberInputThousandth, isNumberInputAlignRight = otherConfig.isNumberInputAlignRight, autoDecimalFieldsRef = otherConfig.autoDecimalFieldsRef, isCustomDecimalField = otherConfig.isCustomDecimalField, customDecimalFieldRender = otherConfig.customDecimalFieldRender, isTableSortEnabled = otherConfig.isTableSortEnabled, isTableFilterEnabled = otherConfig.isTableFilterEnabled;
|
|
237
237
|
var tableLayout = showColumnDynamicKey
|
|
238
238
|
? getStorage(showColumnDynamicKey)
|
|
239
239
|
: myCatchColumns;
|
|
@@ -445,10 +445,12 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
445
445
|
}
|
|
446
446
|
// 添加过滤规则
|
|
447
447
|
var filterKey = _column.key || _column.dataIndex;
|
|
448
|
-
var
|
|
448
|
+
var needFilter = _column.isFilter === false
|
|
449
449
|
? false
|
|
450
|
-
:
|
|
451
|
-
|
|
450
|
+
: isFilter === false
|
|
451
|
+
? false
|
|
452
|
+
: isTableFilterEnabled || _column.isFilter === true || isFilter;
|
|
453
|
+
if (needFilter && typeof filterKey === 'string' && !onEditableSave) {
|
|
452
454
|
_column.filterDropdown = function (_a) {
|
|
453
455
|
var setSelectedKeys = _a.setSelectedKeys, selectedKeys = _a.selectedKeys, confirm = _a.confirm, clearFilters = _a.clearFilters;
|
|
454
456
|
return (React.createElement(FilterDropdown, { searchInputRef: searchInput, setSelectedKeys: setSelectedKeys, selectedKeys: selectedKeys, confirm: confirm, clearFilters: clearFilters, dataIndex: filterKey, handleSearch: handleSearch, handleReset: handleReset, dataSourceRef: dataSourceRef }));
|
|
@@ -490,7 +492,8 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
490
492
|
_column.sorter = false;
|
|
491
493
|
}
|
|
492
494
|
// 纯粹的前端排序
|
|
493
|
-
|
|
495
|
+
var needSort = isSort === false ? false : isSort || isTableSortEnabled;
|
|
496
|
+
if (_column.sorter == null && needSort) {
|
|
494
497
|
var title_5 = _column.title;
|
|
495
498
|
_column.title = function () {
|
|
496
499
|
return (React.createElement(TableSortTitle, { title: title_5, field: key, customOrder: customOrder, setCustomOrder: setCustomOrder, onChange: customSortHandle, align: align }));
|
|
@@ -706,7 +709,7 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
706
709
|
}
|
|
707
710
|
}
|
|
708
711
|
function useColumns(props) {
|
|
709
|
-
var columns = props.columns, hiddenColumnDynamicIcon = props.hiddenColumnDynamicIcon, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, showDelAllBtn = props.showDelAllBtn, delAllChange = props.delAllChange, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showDynamicHandle = props.showDynamicHandle, onEditableSave = props.onEditableSave, configInfo = props.configInfo, copyByKey = props.copyByKey, onTableChange = props.onTableChange, currentPage = props.currentPage, currentDataSource = props.currentDataSource, preDataSource = props.preDataSource, rowKey = props.rowKey, dataSourceRef = props.dataSourceRef, expandableChildrenColumnName = props.expandableChildrenColumnName, customSortHandle = props.customSortHandle, customOrder = props.customOrder, setCustomOrder = props.setCustomOrder, isSort = props.isSort, onFillDownChangeRef = props.onFillDownChangeRef, isModalInput = props.isModalInput, isNumberInputThousandth = props.isNumberInputThousandth, isNumberInputAlignRight = props.isNumberInputAlignRight, autoDecimalFieldsRef = props.autoDecimalFieldsRef;
|
|
712
|
+
var columns = props.columns, hiddenColumnDynamicIcon = props.hiddenColumnDynamicIcon, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, showDelAllBtn = props.showDelAllBtn, delAllChange = props.delAllChange, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, delIconText = props.delIconText, showDynamicHandle = props.showDynamicHandle, onEditableSave = props.onEditableSave, configInfo = props.configInfo, copyByKey = props.copyByKey, onTableChange = props.onTableChange, currentPage = props.currentPage, currentDataSource = props.currentDataSource, preDataSource = props.preDataSource, rowKey = props.rowKey, dataSourceRef = props.dataSourceRef, expandableChildrenColumnName = props.expandableChildrenColumnName, customSortHandle = props.customSortHandle, customOrder = props.customOrder, setCustomOrder = props.setCustomOrder, isSort = props.isSort, isFilter = props.isFilter, onFillDownChangeRef = props.onFillDownChangeRef, isModalInput = props.isModalInput, isNumberInputThousandth = props.isNumberInputThousandth, isNumberInputAlignRight = props.isNumberInputAlignRight, autoDecimalFieldsRef = props.autoDecimalFieldsRef;
|
|
710
713
|
var _a = useBaseContext(), tableNumberFormatter = _a.tableNumberFormatter, isCustomDecimalField = _a.isCustomDecimalField, customDecimalFieldRender = _a.customDecimalFieldRender, isTableSortEnabled = _a.isTableSortEnabled, isTableFilterEnabled = _a.isTableFilterEnabled;
|
|
711
714
|
var newColumnsRef = useRef();
|
|
712
715
|
var _b = useAsyncSetValue(columns), upDateColumnsRef = _b[0], setUpDateColumnsRef = _b[1];
|
|
@@ -775,6 +778,7 @@ function useColumns(props) {
|
|
|
775
778
|
customOrder: customOrder,
|
|
776
779
|
setCustomOrder: setCustomOrder,
|
|
777
780
|
isSort: isSort,
|
|
781
|
+
isFilter: isFilter,
|
|
778
782
|
handleSearch: handleSearch,
|
|
779
783
|
handleReset: handleReset,
|
|
780
784
|
searchInput: searchInput,
|
|
@@ -817,6 +821,7 @@ function useColumns(props) {
|
|
|
817
821
|
isUpDateColumnsRef,
|
|
818
822
|
setIsUpDateColumnsRef,
|
|
819
823
|
isSort,
|
|
824
|
+
isFilter,
|
|
820
825
|
onFillDownChangeRef,
|
|
821
826
|
isModalInput,
|
|
822
827
|
tableNumberFormatter,
|
|
@@ -63,6 +63,8 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
|
|
|
63
63
|
virtualTableKey?: string;
|
|
64
64
|
/** 是否需要排序 内部会有一个排序功能。自定义的 这个在某些条件下不会开启。但是还需要别的条件也不开启 */
|
|
65
65
|
isSort?: boolean;
|
|
66
|
+
/** 是否需要过滤 */
|
|
67
|
+
isFilter?: boolean;
|
|
66
68
|
/** 排序方法 ascend 升序 descend 降序 */
|
|
67
69
|
onSortChange?: (info: {
|
|
68
70
|
order: 'ascend' | 'descend' | null;
|
|
@@ -132,21 +132,21 @@ export function usePrevious(value) {
|
|
|
132
132
|
function Table(props) {
|
|
133
133
|
var _this = this;
|
|
134
134
|
var _a, _b, _c, _d;
|
|
135
|
-
var className = props.className, scroll = props.scroll, _e = props.pagination, pagination = _e === void 0 ? false : _e, _f = props.bordered, bordered = _f === void 0 ? true : _f, _columns = props.columns, initColumns = props.initColumns, dataSource = props.dataSource, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, showDelAllBtn = props.showDelAllBtn, delAllChange = props.delAllChange, delIconText = props.delIconText, hiddenColumnDynamicIcon = props.hiddenColumnDynamicIcon, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, summaryConfig = props.summaryConfig, summaryFixed = props.summaryFixed, summary = props.summary, onMoveRow = props.onMoveRow, onEditableSave = props.onEditableSave, onDynamicChange = props.onDynamicChange, _g = props.isResizableColumn, isResizableColumn = _g === void 0 ? true : _g, configInfo = props.configInfo, tableHandleRef = props.tableHandleRef, tableName = props.tableName, isFlex = props.isFlex, onTableChange = props.onTableChange, rowSelection = props.rowSelection, showInnerPagination = props.showInnerPagination, defaultInnerPageSize = props.defaultInnerPageSize, virtualTableKey = props.virtualTableKey,
|
|
135
|
+
var className = props.className, scroll = props.scroll, _e = props.pagination, pagination = _e === void 0 ? false : _e, _f = props.bordered, bordered = _f === void 0 ? true : _f, _columns = props.columns, initColumns = props.initColumns, dataSource = props.dataSource, onAddAndDelHandle = props.onAddAndDelHandle, hideAddIcon = props.hideAddIcon, addIconText = props.addIconText, hideDelIcon = props.hideDelIcon, showDelAllBtn = props.showDelAllBtn, delAllChange = props.delAllChange, delIconText = props.delIconText, hiddenColumnDynamicIcon = props.hiddenColumnDynamicIcon, showColumnDynamic = props.showColumnDynamic, showColumnDynamicKey = props.showColumnDynamicKey, summaryConfig = props.summaryConfig, summaryFixed = props.summaryFixed, summary = props.summary, onMoveRow = props.onMoveRow, onEditableSave = props.onEditableSave, onDynamicChange = props.onDynamicChange, _g = props.isResizableColumn, isResizableColumn = _g === void 0 ? true : _g, configInfo = props.configInfo, tableHandleRef = props.tableHandleRef, tableName = props.tableName, isFlex = props.isFlex, onTableChange = props.onTableChange, rowSelection = props.rowSelection, showInnerPagination = props.showInnerPagination, defaultInnerPageSize = props.defaultInnerPageSize, virtualTableKey = props.virtualTableKey, isSort = props.isSort, isFilter = props.isFilter, onSortChange = props.onSortChange, onFillDownChange = props.onFillDownChange, _h = props.isModalInput, isModalInput = _h === void 0 ? false : _h, // 默认关闭这个功能
|
|
136
136
|
// onRow,
|
|
137
|
-
isOpenVirtualScrollBar = props.isOpenVirtualScrollBar,
|
|
137
|
+
isOpenVirtualScrollBar = props.isOpenVirtualScrollBar, _j = props.isNumberInputThousandth, isNumberInputThousandth = _j === void 0 ? true : _j, _k = props.isNumberInputAlignRight, isNumberInputAlignRight = _k === void 0 ? true : _k, restProps = __rest(props, ["className", "scroll", "pagination", "bordered", "columns", "initColumns", "dataSource", "onAddAndDelHandle", "hideAddIcon", "addIconText", "hideDelIcon", "showDelAllBtn", "delAllChange", "delIconText", "hiddenColumnDynamicIcon", "showColumnDynamic", "showColumnDynamicKey", "summaryConfig", "summaryFixed", "summary", "onMoveRow", "onEditableSave", "onDynamicChange", "isResizableColumn", "configInfo", "tableHandleRef", "tableName", "isFlex", "onTableChange", "rowSelection", "showInnerPagination", "defaultInnerPageSize", "virtualTableKey", "isSort", "isFilter", "onSortChange", "onFillDownChange", "isModalInput", "isOpenVirtualScrollBar", "isNumberInputThousandth", "isNumberInputAlignRight"]);
|
|
138
138
|
var onChange = restProps.onChange;
|
|
139
139
|
var classes = classNames('zt-table', className, {
|
|
140
140
|
'zt-table--flex': isFlex,
|
|
141
141
|
});
|
|
142
|
-
var
|
|
142
|
+
var _l = useState(false), dynamicVisible = _l[0], setDynamicVisible = _l[1];
|
|
143
143
|
var showDynamicHandle = useCallback(function () { return setDynamicVisible(true); }, []);
|
|
144
144
|
var hideDynamicHandle = useCallback(function () { return setDynamicVisible(false); }, []);
|
|
145
145
|
var dataSourceRef = useRef();
|
|
146
146
|
var preDataSource = usePrevious(dataSource);
|
|
147
|
-
var
|
|
147
|
+
var _m = useState(), sortDataSource = _m[0], setSortDataSource = _m[1];
|
|
148
148
|
// 内部分页相关配置
|
|
149
|
-
var
|
|
149
|
+
var _o = useInnerPagination(showInnerPagination, defaultInnerPageSize), paginationConfig = _o.paginationConfig, currentPage = _o.currentPage, setCurrent = _o.setCurrent, pageSize = _o.pageSize;
|
|
150
150
|
var rowSelectionDataSource = useRef({});
|
|
151
151
|
var myScroll = useMemo(function () {
|
|
152
152
|
if (scroll) {
|
|
@@ -268,7 +268,7 @@ function Table(props) {
|
|
|
268
268
|
onTableChange && onTableChange(resultTextList, startIndex);
|
|
269
269
|
}, [clearErrorClass, onTableChange]);
|
|
270
270
|
// 2023-05-04 自定义表格排序方法
|
|
271
|
-
var
|
|
271
|
+
var _p = useState(), customOrder = _p[0], setCustomOrder = _p[1];
|
|
272
272
|
var customSortHandle = useCallback(function (info, options) {
|
|
273
273
|
if (Array.isArray(expandableDataSource) &&
|
|
274
274
|
expandableDataSource.length > 1) {
|
|
@@ -336,7 +336,7 @@ function Table(props) {
|
|
|
336
336
|
* 以及一个需要动态列配置的columns
|
|
337
337
|
*/
|
|
338
338
|
var onFillDownChangeRef = useLastest(onFillDownChange);
|
|
339
|
-
var
|
|
339
|
+
var _q = useColumns({
|
|
340
340
|
columns: _columns,
|
|
341
341
|
hiddenColumnDynamicIcon: hiddenColumnDynamicIcon,
|
|
342
342
|
showColumnDynamic: showColumnDynamic,
|
|
@@ -363,12 +363,13 @@ function Table(props) {
|
|
|
363
363
|
customOrder: customOrder,
|
|
364
364
|
setCustomOrder: setCustomOrder,
|
|
365
365
|
isSort: isSort,
|
|
366
|
+
isFilter: isFilter,
|
|
366
367
|
onFillDownChangeRef: onFillDownChangeRef,
|
|
367
368
|
isModalInput: isModalInput,
|
|
368
369
|
isNumberInputThousandth: isNumberInputThousandth,
|
|
369
370
|
isNumberInputAlignRight: isNumberInputAlignRight,
|
|
370
371
|
autoDecimalFieldsRef: autoDecimalFieldsRef,
|
|
371
|
-
}), newColumns =
|
|
372
|
+
}), newColumns = _q.newColumns, dynamicColumns = _q.dynamicColumns, refreshColumnsHandle = _q.refreshColumnsHandle;
|
|
372
373
|
/**
|
|
373
374
|
* @description 保存列配置
|
|
374
375
|
*/
|