ztxkui 4.2.18-71 → 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.
- package/dist/DemoCom/TableDetail.js +1 -1
- package/dist/components/Table/hooks/useColumns.d.ts +1 -0
- package/dist/components/Table/hooks/useColumns.js +15 -7
- package/dist/components/Table/table.d.ts +2 -0
- package/dist/components/Table/table.js +9 -8
- package/dist/components/utils/ZtxkContext.d.ts +8 -0
- package/dist/components/utils/ZtxkContext.js +2 -0
- package/dist/index.js +8 -0
- package/package.json +1 -1
|
@@ -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", isSort:
|
|
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;
|
|
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,9 +445,12 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
445
445
|
}
|
|
446
446
|
// 添加过滤规则
|
|
447
447
|
var filterKey = _column.key || _column.dataIndex;
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
var needFilter = _column.isFilter === false
|
|
449
|
+
? false
|
|
450
|
+
: isFilter === false
|
|
451
|
+
? false
|
|
452
|
+
: isTableFilterEnabled || _column.isFilter === true || isFilter;
|
|
453
|
+
if (needFilter && typeof filterKey === 'string' && !onEditableSave) {
|
|
451
454
|
_column.filterDropdown = function (_a) {
|
|
452
455
|
var setSelectedKeys = _a.setSelectedKeys, selectedKeys = _a.selectedKeys, confirm = _a.confirm, clearFilters = _a.clearFilters;
|
|
453
456
|
return (React.createElement(FilterDropdown, { searchInputRef: searchInput, setSelectedKeys: setSelectedKeys, selectedKeys: selectedKeys, confirm: confirm, clearFilters: clearFilters, dataIndex: filterKey, handleSearch: handleSearch, handleReset: handleReset, dataSourceRef: dataSourceRef }));
|
|
@@ -489,7 +492,8 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
489
492
|
_column.sorter = false;
|
|
490
493
|
}
|
|
491
494
|
// 纯粹的前端排序
|
|
492
|
-
|
|
495
|
+
var needSort = isSort === false ? false : isSort || isTableSortEnabled;
|
|
496
|
+
if (_column.sorter == null && needSort) {
|
|
493
497
|
var title_5 = _column.title;
|
|
494
498
|
_column.title = function () {
|
|
495
499
|
return (React.createElement(TableSortTitle, { title: title_5, field: key, customOrder: customOrder, setCustomOrder: setCustomOrder, onChange: customSortHandle, align: align }));
|
|
@@ -705,8 +709,8 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
705
709
|
}
|
|
706
710
|
}
|
|
707
711
|
function useColumns(props) {
|
|
708
|
-
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;
|
|
709
|
-
var _a = useBaseContext(), tableNumberFormatter = _a.tableNumberFormatter, isCustomDecimalField = _a.isCustomDecimalField, customDecimalFieldRender = _a.customDecimalFieldRender;
|
|
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;
|
|
713
|
+
var _a = useBaseContext(), tableNumberFormatter = _a.tableNumberFormatter, isCustomDecimalField = _a.isCustomDecimalField, customDecimalFieldRender = _a.customDecimalFieldRender, isTableSortEnabled = _a.isTableSortEnabled, isTableFilterEnabled = _a.isTableFilterEnabled;
|
|
710
714
|
var newColumnsRef = useRef();
|
|
711
715
|
var _b = useAsyncSetValue(columns), upDateColumnsRef = _b[0], setUpDateColumnsRef = _b[1];
|
|
712
716
|
var _c = useAsyncSetValue(false), isUpDateColumnsRef = _c[0], setIsUpDateColumnsRef = _c[1];
|
|
@@ -774,6 +778,7 @@ function useColumns(props) {
|
|
|
774
778
|
customOrder: customOrder,
|
|
775
779
|
setCustomOrder: setCustomOrder,
|
|
776
780
|
isSort: isSort,
|
|
781
|
+
isFilter: isFilter,
|
|
777
782
|
handleSearch: handleSearch,
|
|
778
783
|
handleReset: handleReset,
|
|
779
784
|
searchInput: searchInput,
|
|
@@ -784,6 +789,8 @@ function useColumns(props) {
|
|
|
784
789
|
autoDecimalFieldsRef: autoDecimalFieldsRef,
|
|
785
790
|
isCustomDecimalField: isCustomDecimalField,
|
|
786
791
|
customDecimalFieldRender: customDecimalFieldRender,
|
|
792
|
+
isTableSortEnabled: isTableSortEnabled,
|
|
793
|
+
isTableFilterEnabled: isTableFilterEnabled,
|
|
787
794
|
});
|
|
788
795
|
}, [
|
|
789
796
|
showColumnDynamic,
|
|
@@ -814,6 +821,7 @@ function useColumns(props) {
|
|
|
814
821
|
isUpDateColumnsRef,
|
|
815
822
|
setIsUpDateColumnsRef,
|
|
816
823
|
isSort,
|
|
824
|
+
isFilter,
|
|
817
825
|
onFillDownChangeRef,
|
|
818
826
|
isModalInput,
|
|
819
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
|
*/
|
|
@@ -21,6 +21,14 @@ export interface IZtxkConfig {
|
|
|
21
21
|
* 显示自定义小数位字段渲染逻辑
|
|
22
22
|
*/
|
|
23
23
|
customDecimalFieldRender?: (text: any, record: any, index: any) => any;
|
|
24
|
+
/**
|
|
25
|
+
* 表格是否默认开启前端排序
|
|
26
|
+
*/
|
|
27
|
+
isTableSortEnabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 表格是否默认开启前端过滤
|
|
30
|
+
*/
|
|
31
|
+
isTableFilterEnabled?: boolean;
|
|
24
32
|
}
|
|
25
33
|
declare const ZtxkContext: React.Context<IZtxkConfig>;
|
|
26
34
|
export default ZtxkContext;
|
|
@@ -6,6 +6,8 @@ var ztxkConfig = {
|
|
|
6
6
|
tableNumberFormatter: undefined,
|
|
7
7
|
isCustomDecimalField: undefined,
|
|
8
8
|
customDecimalFieldRender: undefined,
|
|
9
|
+
isTableSortEnabled: false,
|
|
10
|
+
isTableFilterEnabled: false,
|
|
9
11
|
};
|
|
10
12
|
var ZtxkContext = React.createContext(ztxkConfig);
|
|
11
13
|
export default ZtxkContext;
|
package/dist/index.js
CHANGED
|
@@ -113,6 +113,14 @@
|
|
|
113
113
|
// return text;
|
|
114
114
|
// }
|
|
115
115
|
// },
|
|
116
|
+
// /**
|
|
117
|
+
// * 表格是否默认开启前端排序
|
|
118
|
+
// */
|
|
119
|
+
// isTableSortEnabled: true,
|
|
120
|
+
// /**
|
|
121
|
+
// * 表格是否默认开启前端过滤
|
|
122
|
+
// */
|
|
123
|
+
// isTableFilterEnabled: true,
|
|
116
124
|
// };
|
|
117
125
|
// ReactDOM.render(
|
|
118
126
|
// // <React.StrictMode>
|