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.
- package/dist/DemoCom/TableDemo1.js +10 -4
- package/dist/components/OCR/Camera/hooks.d.ts +1 -1
- package/dist/components/OCR_COM/Camera/hooks.d.ts +1 -1
- package/dist/components/Table/hooks/useColumns.js +10 -1
- package/dist/components/Table/table.d.ts +2 -0
- package/dist/components/Table/table.js +19 -1
- package/dist/index.js +125 -92
- package/package.json +1 -1
|
@@ -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 =
|
|
64
|
+
]), records = _b[0], setRecords = _b[1];
|
|
64
65
|
var recordsRef = useRef();
|
|
65
66
|
// 初始化渲染,针对配置了editable、editableConfig的列配置
|
|
66
|
-
var
|
|
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(
|
|
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" | "
|
|
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" | "
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
|
|
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';
|