ztxkui 10.0.23 → 10.0.25

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.
@@ -56,14 +56,15 @@ var depListObj = {
56
56
  ],
57
57
  };
58
58
  var TableDemo1 = function () {
59
- var _a = useState([
59
+ var _a = useState(false), isDepShow = _a[0], setIsDepShow = _a[1];
60
+ var _b = useState([
60
61
  { id: '1' },
61
62
  { id: '2' },
62
63
  { id: '3' },
63
- ]), records = _a[0], setRecords = _a[1];
64
+ ]), records = _b[0], setRecords = _b[1];
64
65
  var recordsRef = useRef();
65
66
  // 初始化渲染,针对配置了editable、editableConfig的列配置
66
- var _b = useState(false), firstRender = _b[0], setFirstRender = _b[1];
67
+ var _c = useState(false), firstRender = _c[0], setFirstRender = _c[1];
67
68
  useEffect(function () {
68
69
  setFirstRender(true);
69
70
  }, []);
@@ -85,6 +86,7 @@ var TableDemo1 = function () {
85
86
  width: 120,
86
87
  key: 'company',
87
88
  dataIndex: 'company',
89
+ hideColumn: isDepShow,
88
90
  headTooltip: function () {
89
91
  return (React.createElement(React.Fragment, null,
90
92
  React.createElement("p", null, "12"),
@@ -109,6 +111,7 @@ var TableDemo1 = function () {
109
111
  width: 120,
110
112
  key: 'department',
111
113
  dataIndex: 'department',
114
+ hideColumn: !isDepShow,
112
115
  shouldCellUpdate: function (record, preRecord) {
113
116
  return (record.company !== preRecord.company ||
114
117
  record.department !== preRecord.department);
@@ -217,7 +220,10 @@ var TableDemo1 = function () {
217
220
  }, []);
218
221
  console.log('render');
219
222
  return (React.createElement(React.Fragment, null,
220
- React.createElement(Table, { columns: columns, dataSource: records, rowKey: "id", onEditableSave: onEditableSaveHandle }),
223
+ React.createElement("button", { onClick: function () {
224
+ setIsDepShow(function (state) { return !state; });
225
+ } }, isDepShow ? '显示部门' : '显示公司'),
226
+ React.createElement(Table, { showColumnDynamic: true, showColumnDynamicKey: "tableDemo1", columns: columns, dataSource: records, rowKey: "id", onEditableSave: onEditableSaveHandle }),
221
227
  React.createElement("button", { onClick: function () {
222
228
  console.log(records);
223
229
  } }, "\u83B7\u53D6\u6570\u636E")));
@@ -6,7 +6,7 @@ export declare function useModalVisible(): {
6
6
  export declare function useGpy(imgRef: any, visible: any): {
7
7
  visible: any;
8
8
  domRef: import("react").MutableRefObject<any>;
9
- devStatus: "pause" | "pendding" | "fulfilled" | "rejected" | "noDev";
9
+ devStatus: "pause" | "fulfilled" | "rejected" | "pendding" | "noDev";
10
10
  cameraInfo: any;
11
11
  cameraValue: number;
12
12
  setCameraValue: import("react").Dispatch<import("react").SetStateAction<number>>;
@@ -6,7 +6,7 @@ export declare function useModalVisible(): {
6
6
  export declare function useGpy(imgRef: any, visible: any): {
7
7
  visible: any;
8
8
  domRef: import("react").MutableRefObject<any>;
9
- devStatus: "pause" | "pendding" | "fulfilled" | "rejected" | "noDev";
9
+ devStatus: "pause" | "fulfilled" | "rejected" | "pendding" | "noDev";
10
10
  cameraInfo: any;
11
11
  cameraValue: number;
12
12
  setCameraValue: import("react").Dispatch<import("react").SetStateAction<number>>;
@@ -121,7 +121,16 @@ export var getTableLayoutFullData = function (columns, tableLayout) {
121
121
  // );
122
122
  return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], preColumns_1), middleColumns_1), newAddColumns_1), afterColumns_1);
123
123
  }
124
- return columns;
124
+ else {
125
+ return columns.map(function (_column) {
126
+ // 如果业务代码中设置了hideColumn,那么不做自定义显隐控制
127
+ var column = __assign({}, _column);
128
+ if (column.hideColumn !== undefined) {
129
+ column.isNoDynamicHide = true;
130
+ }
131
+ return column;
132
+ });
133
+ }
125
134
  };
126
135
  // 搜索表单存储位置信息key
127
136
  export var LOCALSTORAGE_KEY = 'ztui_dynamic_table_key';
@@ -20,6 +20,8 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
20
20
  showColumnDynamic?: boolean;
21
21
  /**动态表头配置,是否缓存,动态列配置如果要缓存得话,必须得使用一个全局唯一得key来标识 */
22
22
  showColumnDynamicKey?: string;
23
+ /**是否根据columns变化刷新缓存 */
24
+ isColumnDynamicAutoRefresh?: boolean;
23
25
  /**是否显示小计或总计 */
24
26
  summaryConfig?: ISummaryConfig[];
25
27
  summaryFixed?: boolean;
@@ -116,7 +116,7 @@ export function usePrevious(value) {
116
116
  function Table(props) {
117
117
  var _this = this;
118
118
  var _a, _b;
119
- var className = props.className, scroll = props.scroll, _c = props.pagination, pagination = _c === void 0 ? false : _c, _d = props.bordered, bordered = _d === void 0 ? true : _d, _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, _e = props.isResizableColumn, isResizableColumn = _e === void 0 ? true : _e, 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, _f = props.isSort, isSort = _f === void 0 ? true : _f, 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"]);
119
+ var className = props.className, scroll = props.scroll, _c = props.pagination, pagination = _c === void 0 ? false : _c, _d = props.bordered, bordered = _d === void 0 ? true : _d, _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, _e = props.isResizableColumn, isResizableColumn = _e === void 0 ? true : _e, 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, _f = props.isSort, isSort = _f === void 0 ? true : _f, isColumnDynamicAutoRefresh = props.isColumnDynamicAutoRefresh, 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", "isColumnDynamicAutoRefresh"]);
120
120
  var classes = classNames('zt-table', className, {
121
121
  'zt-table--flex': isFlex,
122
122
  });
@@ -314,6 +314,24 @@ function Table(props) {
314
314
  setCustomOrder: setCustomOrder,
315
315
  isSort: isSort,
316
316
  }), newColumns = _l.newColumns, dynamicColumns = _l.dynamicColumns, refreshColumnsHandle = _l.refreshColumnsHandle;
317
+ useEffect(function () {
318
+ if (isColumnDynamicAutoRefresh && showColumnDynamicKey && dynamicColumns) {
319
+ var catchColumns = dynamicColumns.map(function (item) {
320
+ if (item.dataIndex || item.key) {
321
+ return {
322
+ dataIndex: item.dataIndex,
323
+ key: item.key,
324
+ hideColumn: item.hideColumn,
325
+ width: item.width,
326
+ fixed: item.fixed,
327
+ };
328
+ }
329
+ return __assign({}, item);
330
+ });
331
+ setDynamicKey(showColumnDynamicKey, catchColumns);
332
+ }
333
+ // eslint-disable-next-line react-hooks/exhaustive-deps
334
+ }, [dynamicColumns, isColumnDynamicAutoRefresh]);
317
335
  /**
318
336
  * @description 保存列配置
319
337
  */
package/dist/index.js CHANGED
@@ -1,95 +1,128 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import App from './App';
4
- import { ConfigProvider } from 'antd';
5
- import zhCN from 'antd/lib/locale/zh_CN';
6
- import * as dayjs from 'dayjs';
7
- import zhCn from 'dayjs/locale/zh-cn';
8
- import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
9
- import Demo from './Demo';
10
- import TreeSelectDemo from './TreeSelectDemo';
11
- import TreeDemo from './TreeDemo';
12
- import UploadDemo from './UploadDemo';
13
- import CollapseDemo from './DemoCom/CollapseDemo';
14
- import TimelineDemo from './DemoCom/TimelineDemo';
15
- import WeChatDemo from './DemoCom/WechatDemo';
16
- import TableDemo from './DemoCom/TableDemo';
17
- import TableDemo1 from './DemoCom/TableDemo1';
18
- import BasicDemo from './DemoCom/BasicDemo';
19
- import FormDemo from './DemoCom/FormDemo';
20
- import FormDemo1 from './DemoCom/FormDemo1';
21
- import TableAnalyse from './DemoCom/TableAnalyse';
22
- import DragSort from './DemoCom/DragSort';
23
- import PrintDemo from './DemoCom/PrintDemo';
24
- import PrintContainerDemo from './DemoCom/PrintContainerDemo';
25
- import SinaturesDemo from './DemoCom/SinaturesDemo';
26
- import TableDemoAll from './TableDemo';
27
- import CodeQueryDemo from './DemoCom/CodeQueryDemo';
28
- import ZtxkContext from './components/utils/ZtxkContext';
29
- import UI from './UI';
30
- dayjs.locale(zhCn);
31
- ReactDOM.render(
32
- // <React.StrictMode>
33
- React.createElement(ConfigProvider, { locale: zhCN },
34
- React.createElement(ZtxkContext.Provider, { value: { apiBaseUrl: 'http://192.168.0.83:8000' } },
35
- React.createElement(BrowserRouter, null,
36
- React.createElement(Switch, null,
37
- React.createElement(Route, { path: "/ui" },
38
- React.createElement(UI, null)),
39
- React.createElement(Route, { exact: true, path: "/app" },
40
- React.createElement(App, null)),
41
- React.createElement(Route, { exact: true, path: "/code-query" },
42
- React.createElement(CodeQueryDemo, null)),
43
- React.createElement(Route, { exact: true, path: "/select" },
44
- React.createElement(Demo, null)),
45
- React.createElement(Route, { exact: true, path: "/tree-select" },
46
- React.createElement(TreeSelectDemo, null)),
47
- React.createElement(Route, { exact: true, path: "/tree" },
48
- React.createElement(TreeDemo, null)),
49
- React.createElement(Route, { exact: true, path: "/upload" },
50
- React.createElement(UploadDemo, null)),
51
- React.createElement(Route, { exact: true, path: "/collapse" },
52
- React.createElement(CollapseDemo, null)),
53
- React.createElement(Route, { exact: true, path: "/timeline" },
54
- React.createElement(TimelineDemo, null)),
55
- React.createElement(Route, { exact: true, path: "/wechat" },
56
- React.createElement(WeChatDemo, null)),
57
- React.createElement(Route, { exact: true, path: "/table" },
58
- React.createElement(TableDemo, null)),
59
- React.createElement(Route, { exact: true, path: "/table1" },
60
- React.createElement(TableDemo1, null)),
61
- React.createElement(Route, { exact: true, path: "/basic" },
62
- React.createElement(BasicDemo, null)),
63
- React.createElement(Route, { exact: true, path: "/form" },
64
- React.createElement(FormDemo, null)),
65
- React.createElement(Route, { exact: true, path: "/form1" },
66
- React.createElement(FormDemo1, null)),
67
- React.createElement(Route, { exact: true, path: "/print" },
68
- React.createElement(PrintDemo, null)),
69
- React.createElement(Route, { exact: true, path: "/print-container" },
70
- React.createElement(PrintContainerDemo, null)),
71
- React.createElement(Route, { exact: true, path: "/tableall" },
72
- React.createElement(TableDemoAll, null)),
73
- React.createElement(Route, { exact: true, path: "/table-analyse" },
74
- React.createElement(TableAnalyse, null)),
75
- React.createElement(Route, { exact: true, path: "/drag-sort" },
76
- React.createElement(DragSort, null)),
77
- React.createElement(Route, { exact: true, path: "/sinatures" },
78
- React.createElement(SinaturesDemo, null)),
79
- React.createElement(Route, { exact: true, path: "/test" },
80
- React.createElement("div", null,
81
- React.createElement("h1", null,
82
- React.createElement(Link, { to: "/select" }, "select")),
83
- React.createElement("h1", null,
84
- React.createElement(Link, { to: "/tree-select" }, "tree select")),
85
- React.createElement("h1", null,
86
- React.createElement(Link, { to: "/tree" }, "tree")),
87
- React.createElement("h1", null,
88
- React.createElement(Link, { to: "/upload" }, "upload")),
89
- React.createElement("h1", null,
90
- React.createElement(Link, { to: "/drag-sort" }, "drag-sort")))))))),
91
- // </React.StrictMode>,
92
- document.getElementById('root'));
1
+ // import React from 'react';
2
+ // import ReactDOM from 'react-dom';
3
+ // import App from './App';
4
+ // import { ConfigProvider } from 'antd';
5
+ // import zhCN from 'antd/lib/locale/zh_CN';
6
+ // import * as dayjs from 'dayjs';
7
+ // import zhCn from 'dayjs/locale/zh-cn';
8
+ // import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
9
+ // import Demo from './Demo';
10
+ // import TreeSelectDemo from './TreeSelectDemo';
11
+ // import TreeDemo from './TreeDemo';
12
+ // import UploadDemo from './UploadDemo';
13
+ // import CollapseDemo from './DemoCom/CollapseDemo';
14
+ // import TimelineDemo from './DemoCom/TimelineDemo';
15
+ // import WeChatDemo from './DemoCom/WechatDemo';
16
+ // import TableDemo from './DemoCom/TableDemo';
17
+ // import TableDemo1 from './DemoCom/TableDemo1';
18
+ // import BasicDemo from './DemoCom/BasicDemo';
19
+ // import FormDemo from './DemoCom/FormDemo';
20
+ // import FormDemo1 from './DemoCom/FormDemo1';
21
+ // import TableAnalyse from './DemoCom/TableAnalyse';
22
+ // import DragSort from './DemoCom/DragSort';
23
+ // import PrintDemo from './DemoCom/PrintDemo';
24
+ // import PrintContainerDemo from './DemoCom/PrintContainerDemo';
25
+ // import SinaturesDemo from './DemoCom/SinaturesDemo';
26
+ // import TableDemoAll from './TableDemo';
27
+ // import CodeQueryDemo from './DemoCom/CodeQueryDemo';
28
+ // import ZtxkContext from './components/utils/ZtxkContext';
29
+ // import UI from './UI';
30
+ // dayjs.locale(zhCn);
31
+ // ReactDOM.render(
32
+ // // <React.StrictMode>
33
+ // <ConfigProvider locale={zhCN}>
34
+ // <ZtxkContext.Provider value={{ apiBaseUrl: 'http://192.168.0.83:8000' }}>
35
+ // <BrowserRouter>
36
+ // <Switch>
37
+ // <Route path="/ui">
38
+ // <UI />
39
+ // </Route>
40
+ // <Route exact path="/app">
41
+ // <App />
42
+ // </Route>
43
+ // <Route exact path="/code-query">
44
+ // <CodeQueryDemo />
45
+ // </Route>
46
+ // <Route exact path="/select">
47
+ // <Demo />
48
+ // </Route>
49
+ // <Route exact path="/tree-select">
50
+ // <TreeSelectDemo />
51
+ // </Route>
52
+ // <Route exact path="/tree">
53
+ // <TreeDemo />
54
+ // </Route>
55
+ // <Route exact path="/upload">
56
+ // <UploadDemo />
57
+ // </Route>
58
+ // <Route exact path="/collapse">
59
+ // <CollapseDemo />
60
+ // </Route>
61
+ // <Route exact path="/timeline">
62
+ // <TimelineDemo />
63
+ // </Route>
64
+ // <Route exact path="/wechat">
65
+ // <WeChatDemo />
66
+ // </Route>
67
+ // <Route exact path="/table">
68
+ // <TableDemo />
69
+ // </Route>
70
+ // <Route exact path="/table1">
71
+ // <TableDemo1 />
72
+ // </Route>
73
+ // <Route exact path="/basic">
74
+ // <BasicDemo />
75
+ // </Route>
76
+ // <Route exact path="/form">
77
+ // <FormDemo />
78
+ // </Route>
79
+ // <Route exact path="/form1">
80
+ // <FormDemo1 />
81
+ // </Route>
82
+ // <Route exact path="/print">
83
+ // <PrintDemo />
84
+ // </Route>
85
+ // <Route exact path="/print-container">
86
+ // <PrintContainerDemo />
87
+ // </Route>
88
+ // <Route exact path="/tableall">
89
+ // <TableDemoAll />
90
+ // </Route>
91
+ // <Route exact path="/table-analyse">
92
+ // <TableAnalyse />
93
+ // </Route>
94
+ // <Route exact path="/drag-sort">
95
+ // <DragSort />
96
+ // </Route>
97
+ // <Route exact path="/sinatures">
98
+ // <SinaturesDemo />
99
+ // </Route>
100
+ // <Route exact path="/test">
101
+ // <div>
102
+ // <h1>
103
+ // <Link to="/select">select</Link>
104
+ // </h1>
105
+ // <h1>
106
+ // <Link to="/tree-select">tree select</Link>
107
+ // </h1>
108
+ // <h1>
109
+ // <Link to="/tree">tree</Link>
110
+ // </h1>
111
+ // <h1>
112
+ // <Link to="/upload">upload</Link>
113
+ // </h1>
114
+ // <h1>
115
+ // <Link to="/drag-sort">drag-sort</Link>
116
+ // </h1>
117
+ // </div>
118
+ // </Route>
119
+ // </Switch>
120
+ // </BrowserRouter>
121
+ // </ZtxkContext.Provider>
122
+ // </ConfigProvider>,
123
+ // // </React.StrictMode>,
124
+ // document.getElementById('root')
125
+ // );
93
126
  export { default as Button } from './components/Button';
94
127
  export { default as Calendar } from './components/Calendar';
95
128
  export { default as Checkbox } from './components/Checkbox';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.23",
3
+ "version": "10.0.25",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",