ztxkui 4.2.18-71 → 4.2.18-72

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", isSort: true, summaryConfig: [
230
+ showColumnDynamic: true, showColumnDynamicKey: dynamicKey || 'symbol-id-1', configInfo: tableConfigInfo, isNumberInputAlignRight: true, isNumberInputThousandth: true, virtualTableKey: "virtualTableKey", 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, 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,10 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
445
445
  }
446
446
  // 添加过滤规则
447
447
  var filterKey = _column.key || _column.dataIndex;
448
- if (_column.isFilter === true &&
449
- typeof filterKey === 'string' &&
450
- !onEditableSave) {
448
+ var isFilter = _column.isFilter === false
449
+ ? false
450
+ : isTableFilterEnabled || _column.isFilter === true;
451
+ if (isFilter && typeof filterKey === 'string' && !onEditableSave) {
451
452
  _column.filterDropdown = function (_a) {
452
453
  var setSelectedKeys = _a.setSelectedKeys, selectedKeys = _a.selectedKeys, confirm = _a.confirm, clearFilters = _a.clearFilters;
453
454
  return (React.createElement(FilterDropdown, { searchInputRef: searchInput, setSelectedKeys: setSelectedKeys, selectedKeys: selectedKeys, confirm: confirm, clearFilters: clearFilters, dataIndex: filterKey, handleSearch: handleSearch, handleReset: handleReset, dataSourceRef: dataSourceRef }));
@@ -489,7 +490,7 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
489
490
  _column.sorter = false;
490
491
  }
491
492
  // 纯粹的前端排序
492
- if (_column.sorter == null && isSort) {
493
+ if (_column.sorter == null && (isSort || isTableSortEnabled)) {
493
494
  var title_5 = _column.title;
494
495
  _column.title = function () {
495
496
  return (React.createElement(TableSortTitle, { title: title_5, field: key, customOrder: customOrder, setCustomOrder: setCustomOrder, onChange: customSortHandle, align: align }));
@@ -706,7 +707,7 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
706
707
  }
707
708
  function useColumns(props) {
708
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;
709
- var _a = useBaseContext(), tableNumberFormatter = _a.tableNumberFormatter, isCustomDecimalField = _a.isCustomDecimalField, customDecimalFieldRender = _a.customDecimalFieldRender;
710
+ var _a = useBaseContext(), tableNumberFormatter = _a.tableNumberFormatter, isCustomDecimalField = _a.isCustomDecimalField, customDecimalFieldRender = _a.customDecimalFieldRender, isTableSortEnabled = _a.isTableSortEnabled, isTableFilterEnabled = _a.isTableFilterEnabled;
710
711
  var newColumnsRef = useRef();
711
712
  var _b = useAsyncSetValue(columns), upDateColumnsRef = _b[0], setUpDateColumnsRef = _b[1];
712
713
  var _c = useAsyncSetValue(false), isUpDateColumnsRef = _c[0], setIsUpDateColumnsRef = _c[1];
@@ -784,6 +785,8 @@ function useColumns(props) {
784
785
  autoDecimalFieldsRef: autoDecimalFieldsRef,
785
786
  isCustomDecimalField: isCustomDecimalField,
786
787
  customDecimalFieldRender: customDecimalFieldRender,
788
+ isTableSortEnabled: isTableSortEnabled,
789
+ isTableFilterEnabled: isTableFilterEnabled,
787
790
  });
788
791
  }, [
789
792
  showColumnDynamic,
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "4.2.18-71",
3
+ "version": "4.2.18-72",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",