ztxkui 4.3.24 → 4.3.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.
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  // 带编辑属性的表格使用
38
38
  import { useState, useCallback, useRef } from 'react';
39
39
  import { data2 } from './data';
40
- import ProEditTable from './ProEditTable';
40
+ import ProEditTable from 'components/ProTable';
41
41
  import { Button, message, EnhanceSelect } from '../../index';
42
42
  // 表格列配置相关逻辑
43
43
  // 可以把columns定义成常量再最外面,或者state
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export declare function useDataSourceRef<D>(dataSource: D[]): import("react").MutableRefObject<D[]>;
3
- export declare function useAddAndDelRow(showAddIcon: any, showDelIcon: any, dataSourceRef: any, addDataMode: any, onChange: any, rowKey: any, refreshScuCell: any): {
3
+ export declare function useAddAndDelRow(showAddIcon: any, showDelIcon: any, dataSourceRef: any, addDataMode: any, addDataReturnRecord: any, onChange: any, rowKey: any, refreshScuCell: any): {
4
4
  needAddAndDel: any;
5
5
  onAddAndDelHandle: (type: 'add' | 'del', index: number) => void;
6
6
  };
@@ -25,7 +25,7 @@ export function useDataSourceRef(dataSource) {
25
25
  return dataSourceRef;
26
26
  }
27
27
  // 加减行相关
28
- export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, onChange, rowKey, refreshScuCell) {
28
+ export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, addDataReturnRecord, onChange, rowKey, refreshScuCell) {
29
29
  var needAddAndDel = useMemo(function () {
30
30
  return showAddIcon || showDelIcon;
31
31
  }, [showAddIcon, showDelIcon]);
@@ -33,7 +33,7 @@ export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addData
33
33
  var onAddAndDelHandle = useCallback(function (type, index) {
34
34
  var _a, _b;
35
35
  if (typeof addDataMode === 'function') {
36
- var newDataSource_1 = addDataMode(index, dataSourceRef.current);
36
+ var newDataSource_1 = addDataMode(index, dataSourceRef.current, type);
37
37
  refreshScuCell();
38
38
  onChange && onChange(newDataSource_1);
39
39
  return;
@@ -41,17 +41,17 @@ export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addData
41
41
  var newDataSource = __spreadArray([], dataSourceRef.current);
42
42
  var newRecord = {};
43
43
  if (type === 'add') {
44
+ var currentRecord = newDataSource[index];
45
+ var outsideRecord = addDataReturnRecord
46
+ ? addDataReturnRecord(currentRecord)
47
+ : {};
44
48
  if (addDataMode === 'blank') {
45
49
  // 生成一条空白数据
46
- newRecord = (_a = {},
47
- _a[rowKey] = Date.now() + "-" + index,
48
- _a.__INNER__ADD__DATA = true,
49
- _a);
50
+ newRecord = __assign((_a = {}, _a[rowKey] = Date.now() + "-" + index, _a.__INNER__ADD__DATA = true, _a), outsideRecord);
50
51
  }
51
52
  else {
52
53
  // 复制当前这条数据
53
- var currentRecord = newDataSource[index];
54
- newRecord = __assign(__assign({}, currentRecord), (_b = {}, _b[rowKey] = Date.now() + "-" + index, _b.__INNER__ADD__DATA = true, _b));
54
+ newRecord = __assign(__assign(__assign({}, currentRecord), (_b = {}, _b[rowKey] = Date.now() + "-" + index, _b.__INNER__ADD__DATA = true, _b)), outsideRecord);
55
55
  }
56
56
  newDataSource.splice(index + 1, 0, newRecord);
57
57
  }
@@ -60,7 +60,14 @@ export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addData
60
60
  }
61
61
  refreshScuCell();
62
62
  onChange && onChange(newDataSource);
63
- }, [addDataMode, onChange, dataSourceRef, rowKey, refreshScuCell]);
63
+ }, [
64
+ addDataMode,
65
+ onChange,
66
+ dataSourceRef,
67
+ rowKey,
68
+ refreshScuCell,
69
+ addDataReturnRecord,
70
+ ]);
64
71
  return {
65
72
  needAddAndDel: needAddAndDel,
66
73
  onAddAndDelHandle: onAddAndDelHandle,
@@ -100,17 +107,17 @@ export function useEditRow(onChange, dataSourceRef, innerTableHandleRef, _a) {
100
107
  var _b, _c, _d, _e;
101
108
  if (_dataIndex === void 0) { _dataIndex = ''; }
102
109
  if (typeof index === 'number') {
110
+ // TODO:帮助找到真实的index,如果开启内部分页 需要这么做
111
+ var realyIndex = (_c = (_b = innerTableHandleRef.current) === null || _b === void 0 ? void 0 : _b.getRealyIndex) === null || _c === void 0 ? void 0 : _c.call(_b, index);
103
112
  var newDataSource = __spreadArray([], dataSourceRef.current);
104
- var oldRecord = newDataSource[index];
113
+ var oldRecord = newDataSource[realyIndex];
105
114
  // 如果新的record里面的值 老的Record里面有 那么不需要触发onChange
106
115
  // 这里主要是为了优化物料组件带来的多次rerender导致的一些问题
107
116
  if (objIsEqual(record, oldRecord)) {
108
117
  return;
109
118
  }
110
119
  // TODO:清楚错误样式
111
- (_c = (_b = innerTableHandleRef === null || innerTableHandleRef === void 0 ? void 0 : innerTableHandleRef.current) === null || _b === void 0 ? void 0 : _b.clearErrorClass) === null || _c === void 0 ? void 0 : _c.call(_b, index);
112
- // TODO:帮助找到真实的index,如果开启内部分页 需要这么做
113
- var realyIndex = (_e = (_d = innerTableHandleRef.current) === null || _d === void 0 ? void 0 : _d.getRealyIndex) === null || _e === void 0 ? void 0 : _e.call(_d, index);
120
+ (_e = (_d = innerTableHandleRef === null || innerTableHandleRef === void 0 ? void 0 : innerTableHandleRef.current) === null || _d === void 0 ? void 0 : _d.clearErrorClass) === null || _e === void 0 ? void 0 : _e.call(_d, index);
114
121
  var newRecord = _dataIndex
115
122
  ? __assign(__assign(__assign({}, record), oldRecord), (_a = {}, _a[_dataIndex] = record[_dataIndex], _a)) : __assign(__assign({}, oldRecord), record);
116
123
  newDataSource.splice(realyIndex, 1, newRecord);
@@ -27,7 +27,7 @@ import React, { memo, useRef, useImperativeHandle } from 'react';
27
27
  import { Table } from '../../index';
28
28
  import { useDataSourceRef, useAddAndDelRow, useScuRfresh, useMoveRow, useEditRow, } from './hooks';
29
29
  function ProEditTable(props) {
30
- var rowKey = props.rowKey, dataSource = props.dataSource, columns = props.columns, onChange = props.onChange, showAddIcon = props.showAddIcon, showDelIcon = props.showDelIcon, _a = props.addDataMode, addDataMode = _a === void 0 ? 'blank' : _a, isMove = props.isMove, isEdit = props.isEdit, isPaste = props.isPaste, tableHandleRef = props.tableHandleRef, onBatchPastePre = props.onBatchPastePre, onBatchPastePost = props.onBatchPastePost, restProps = __rest(props, ["rowKey", "dataSource", "columns", "onChange", "showAddIcon", "showDelIcon", "addDataMode", "isMove", "isEdit", "isPaste", "tableHandleRef", "onBatchPastePre", "onBatchPastePost"]);
30
+ var rowKey = props.rowKey, dataSource = props.dataSource, columns = props.columns, onChange = props.onChange, showAddIcon = props.showAddIcon, showDelIcon = props.showDelIcon, _a = props.addDataMode, addDataMode = _a === void 0 ? 'blank' : _a, addDataReturnRecord = props.addDataReturnRecord, isMove = props.isMove, isEdit = props.isEdit, isPaste = props.isPaste, tableHandleRef = props.tableHandleRef, onBatchPastePre = props.onBatchPastePre, onBatchPastePost = props.onBatchPastePost, restProps = __rest(props, ["rowKey", "dataSource", "columns", "onChange", "showAddIcon", "showDelIcon", "addDataMode", "addDataReturnRecord", "isMove", "isEdit", "isPaste", "tableHandleRef", "onBatchPastePre", "onBatchPastePost"]);
31
31
  var innerTableHandleRef = useRef();
32
32
  var tableColumns = columns.map(function (item) {
33
33
  if (item.shouldCellUpdate) {
@@ -46,7 +46,7 @@ function ProEditTable(props) {
46
46
  // SCU逻辑
47
47
  var _b = useScuRfresh(), refreshScuCell = _b.refreshScuCell, getRefreshScuCell = _b.getRefreshScuCell;
48
48
  // 增减行相关hook
49
- var _c = useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, onChange, rowKey, refreshScuCell), needAddAndDel = _c.needAddAndDel, onAddAndDelHandle = _c.onAddAndDelHandle;
49
+ var _c = useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, addDataReturnRecord, onChange, rowKey, refreshScuCell), needAddAndDel = _c.needAddAndDel, onAddAndDelHandle = _c.onAddAndDelHandle;
50
50
  // 拖拽行相关hook
51
51
  var onMoveRowHandle = useMoveRow(onChange, dataSourceRef, refreshScuCell);
52
52
  // 修改行相关hook
@@ -11,7 +11,8 @@ export interface IProps<RecordType> extends Omit<TableIProps<RecordType>, 'colum
11
11
  /**
12
12
  * 增加数据的模式 blank add空白数据; copy add复制数据; 自定义增加
13
13
  */
14
- addDataMode?: 'blank' | 'copy' | ((index: number, dataSource: any[]) => any[]);
14
+ addDataMode?: 'blank' | 'copy' | ((index: number, dataSource: any[], type: string) => any[]);
15
+ addDataReturnRecord?: (record: any) => any;
15
16
  isMove?: boolean;
16
17
  isEdit?: boolean;
17
18
  isPaste?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "4.3.24",
3
+ "version": "4.3.25",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function useDataSourceRef<D>(dataSource: D[]): import("react").MutableRefObject<D[]>;
3
- export declare function useAddAndDelRow(showAddIcon: any, showDelIcon: any, dataSourceRef: any, addDataMode: any, onChange: any, rowKey: any, refreshScuCell: any): {
4
- needAddAndDel: any;
5
- onAddAndDelHandle: (type: 'add' | 'del', index: number) => void;
6
- };
7
- export declare function useMoveRow(onChange: any, dataSourceRef: any, refreshScuCell: any): (dragIndex: number, hoverIndex: number) => void;
8
- export declare function useEditRow(onChange: any, dataSourceRef: any, innerTableHandleRef: any, { onBatchPastePre, onBatchPastePost }: {
9
- onBatchPastePre: any;
10
- onBatchPastePost: any;
11
- }): {
12
- onEditableSaveHandle: (record: any, index: number | undefined, _dataIndex?: string) => void;
13
- onBatchPasteHandle: (records: any, startIndex: any) => void;
14
- };
15
- export declare function useScuRfresh(): {
16
- refreshScuCell: () => void;
17
- getRefreshScuCell: () => boolean;
18
- };
@@ -1,184 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
13
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
14
- to[j] = from[i];
15
- return to;
16
- };
17
- import { useRef, useEffect, useMemo, useCallback } from 'react';
18
- import update from 'immutability-helper';
19
- // 设置数据源临时Ref对象
20
- export function useDataSourceRef(dataSource) {
21
- var dataSourceRef = useRef(dataSource);
22
- useEffect(function () {
23
- dataSourceRef.current = dataSource;
24
- }, [dataSource]);
25
- return dataSourceRef;
26
- }
27
- // 加减行相关
28
- export function useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, onChange, rowKey, refreshScuCell) {
29
- var needAddAndDel = useMemo(function () {
30
- return showAddIcon || showDelIcon;
31
- }, [showAddIcon, showDelIcon]);
32
- // 增减行回调
33
- var onAddAndDelHandle = useCallback(function (type, index) {
34
- var _a, _b;
35
- if (typeof addDataMode === 'function') {
36
- var newDataSource_1 = addDataMode(index, dataSourceRef.current);
37
- refreshScuCell();
38
- onChange && onChange(newDataSource_1);
39
- return;
40
- }
41
- var newDataSource = __spreadArray([], dataSourceRef.current);
42
- var newRecord = {};
43
- if (type === 'add') {
44
- if (addDataMode === 'blank') {
45
- // 生成一条空白数据
46
- newRecord = (_a = {},
47
- _a[rowKey] = Date.now() + "-" + index,
48
- _a.__INNER__ADD__DATA = true,
49
- _a);
50
- }
51
- else {
52
- // 复制当前这条数据
53
- var currentRecord = newDataSource[index];
54
- newRecord = __assign(__assign({}, currentRecord), (_b = {}, _b[rowKey] = Date.now() + "-" + index, _b.__INNER__ADD__DATA = true, _b));
55
- }
56
- newDataSource.splice(index + 1, 0, newRecord);
57
- }
58
- else {
59
- newDataSource.splice(index, 1);
60
- }
61
- refreshScuCell();
62
- onChange && onChange(newDataSource);
63
- }, [addDataMode, onChange, dataSourceRef, rowKey, refreshScuCell]);
64
- return {
65
- needAddAndDel: needAddAndDel,
66
- onAddAndDelHandle: onAddAndDelHandle,
67
- };
68
- }
69
- // 拖拽行相关
70
- export function useMoveRow(onChange, dataSourceRef, refreshScuCell) {
71
- var onMoveRowHandle = useCallback(function (dragIndex, hoverIndex) {
72
- var copyDataSource = __spreadArray([], dataSourceRef.current);
73
- var dragRow = copyDataSource[dragIndex];
74
- var newDataSource = update(copyDataSource, {
75
- $splice: [
76
- [dragIndex, 1],
77
- [hoverIndex, 0, dragRow],
78
- ],
79
- });
80
- refreshScuCell();
81
- onChange && onChange(newDataSource);
82
- }, [onChange, dataSourceRef, refreshScuCell]);
83
- return onMoveRowHandle;
84
- }
85
- // 编辑行相关
86
- function objIsEqual(newObj, oldObj) {
87
- var keys = Object.keys(newObj);
88
- for (var i = 0; i < keys.length; i++) {
89
- var key = keys[i];
90
- if (oldObj[key] !== newObj[key]) {
91
- return false;
92
- }
93
- }
94
- return true;
95
- }
96
- export function useEditRow(onChange, dataSourceRef, innerTableHandleRef, _a) {
97
- var onBatchPastePre = _a.onBatchPastePre, onBatchPastePost = _a.onBatchPastePost;
98
- var onEditableSaveHandle = useCallback(function (record, index, _dataIndex) {
99
- var _a;
100
- var _b, _c, _d, _e;
101
- if (_dataIndex === void 0) { _dataIndex = ''; }
102
- if (typeof index === 'number') {
103
- var newDataSource = __spreadArray([], dataSourceRef.current);
104
- var oldRecord = newDataSource[index];
105
- // 如果新的record里面的值 老的Record里面有 那么不需要触发onChange
106
- // 这里主要是为了优化物料组件带来的多次rerender导致的一些问题
107
- if (objIsEqual(record, oldRecord)) {
108
- return;
109
- }
110
- // TODO:清楚错误样式
111
- (_c = (_b = innerTableHandleRef === null || innerTableHandleRef === void 0 ? void 0 : innerTableHandleRef.current) === null || _b === void 0 ? void 0 : _b.clearErrorClass) === null || _c === void 0 ? void 0 : _c.call(_b, index);
112
- // TODO:帮助找到真实的index,如果开启内部分页 需要这么做
113
- var realyIndex = (_e = (_d = innerTableHandleRef.current) === null || _d === void 0 ? void 0 : _d.getRealyIndex) === null || _e === void 0 ? void 0 : _e.call(_d, index);
114
- var newRecord = _dataIndex
115
- ? __assign(__assign(__assign({}, record), oldRecord), (_a = {}, _a[_dataIndex] = record[_dataIndex], _a)) : __assign(__assign({}, oldRecord), record);
116
- newDataSource.splice(realyIndex, 1, newRecord);
117
- onChange && onChange(newDataSource);
118
- }
119
- }, [dataSourceRef, onChange, innerTableHandleRef]);
120
- var onBatchPasteHandle = useCallback(function (records, startIndex) {
121
- if (!Array.isArray(records)) {
122
- return;
123
- }
124
- // 前置处理
125
- var pasteRecords = onBatchPastePre ? onBatchPastePre(records) : records;
126
- // 计算结束位置
127
- var endIndex = startIndex + pasteRecords.length - 1;
128
- var currentRecords = Array.isArray(dataSourceRef.current)
129
- ? dataSourceRef.current.slice()
130
- : [];
131
- if (endIndex > currentRecords.length - 1) {
132
- endIndex = currentRecords.length - 1;
133
- }
134
- // 从开始位置开始,替换对应的值
135
- var currentIndex = 0;
136
- var dataSource = currentRecords.map(function (record, index) {
137
- if (index >= startIndex && index <= endIndex) {
138
- var obj = __assign(__assign({}, record), pasteRecords[currentIndex]);
139
- currentIndex++;
140
- return obj;
141
- }
142
- return record;
143
- });
144
- // 后置处理
145
- var newDataSource = onBatchPastePost
146
- ? onBatchPastePost(dataSource)
147
- : dataSource;
148
- // 触发onChange事件
149
- onChange && onChange(newDataSource);
150
- }, [dataSourceRef, onChange, onBatchPastePre, onBatchPastePost]);
151
- return {
152
- onEditableSaveHandle: onEditableSaveHandle,
153
- onBatchPasteHandle: onBatchPasteHandle,
154
- };
155
- }
156
- // SCU刷新逻辑
157
- // 这么写的原因是 如果拖拽行 增减行后,并不能触发column的scu
158
- // 之前的写法是,通过useState刷新。但是 setState会触发整个组件的刷新
159
- // 设置数据后,本身会触发setState。导致执行两次rerender。每个单元格都会执行rerender
160
- // 通过Ref并不会触发 setState 通过setTimeout也不会导致每一个单元格的刷新出现问题
161
- export function useScuRfresh() {
162
- var timeOutRef = useRef(null);
163
- var tableSCURefreshRef = useRef();
164
- var refreshScuCell = useCallback(function () {
165
- tableSCURefreshRef.current = true;
166
- }, []);
167
- var getRefreshScuCell = useCallback(function () {
168
- if (tableSCURefreshRef.current) {
169
- if (timeOutRef.current) {
170
- clearTimeout(timeOutRef.current);
171
- timeOutRef.current = null;
172
- }
173
- timeOutRef.current = setTimeout(function () {
174
- tableSCURefreshRef.current = false;
175
- });
176
- return true;
177
- }
178
- return false;
179
- }, []);
180
- return {
181
- refreshScuCell: refreshScuCell,
182
- getRefreshScuCell: getRefreshScuCell,
183
- };
184
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * 业务封装可编辑表格组件
3
- */
4
- import React from 'react';
5
- import { IProps } from './interface';
6
- declare function ProEditTable(props: IProps<any>): JSX.Element;
7
- declare const _default: React.MemoExoticComponent<typeof ProEditTable>;
8
- export default _default;
@@ -1,66 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- /**
24
- * 业务封装可编辑表格组件
25
- */
26
- import React, { memo, useRef, useImperativeHandle } from 'react';
27
- import { Table } from '../../index';
28
- import { useDataSourceRef, useAddAndDelRow, useScuRfresh, useMoveRow, useEditRow, } from './hooks';
29
- function ProEditTable(props) {
30
- var rowKey = props.rowKey, dataSource = props.dataSource, columns = props.columns, onChange = props.onChange, showAddIcon = props.showAddIcon, showDelIcon = props.showDelIcon, _a = props.addDataMode, addDataMode = _a === void 0 ? 'blank' : _a, isMove = props.isMove, isEdit = props.isEdit, isPaste = props.isPaste, tableHandleRef = props.tableHandleRef, onBatchPastePre = props.onBatchPastePre, onBatchPastePost = props.onBatchPastePost, restProps = __rest(props, ["rowKey", "dataSource", "columns", "onChange", "showAddIcon", "showDelIcon", "addDataMode", "isMove", "isEdit", "isPaste", "tableHandleRef", "onBatchPastePre", "onBatchPastePost"]);
31
- var innerTableHandleRef = useRef();
32
- var tableColumns = columns.map(function (item) {
33
- if (item.shouldCellUpdate) {
34
- var fn_1 = item.shouldCellUpdate;
35
- item.shouldCellUpdate = function (record, preRecord) {
36
- if (getRefreshScuCell()) {
37
- return true;
38
- }
39
- return fn_1(record, preRecord);
40
- };
41
- }
42
- return item;
43
- });
44
- // 保存dataSource值存为Ref
45
- var dataSourceRef = useDataSourceRef(dataSource);
46
- // SCU逻辑
47
- var _b = useScuRfresh(), refreshScuCell = _b.refreshScuCell, getRefreshScuCell = _b.getRefreshScuCell;
48
- // 增减行相关hook
49
- var _c = useAddAndDelRow(showAddIcon, showDelIcon, dataSourceRef, addDataMode, onChange, rowKey, refreshScuCell), needAddAndDel = _c.needAddAndDel, onAddAndDelHandle = _c.onAddAndDelHandle;
50
- // 拖拽行相关hook
51
- var onMoveRowHandle = useMoveRow(onChange, dataSourceRef, refreshScuCell);
52
- // 修改行相关hook
53
- var _d = useEditRow(onChange, dataSourceRef, innerTableHandleRef, {
54
- onBatchPastePre: onBatchPastePre,
55
- onBatchPastePost: onBatchPastePost,
56
- }), onEditableSaveHandle = _d.onEditableSaveHandle, onBatchPasteHandle = _d.onBatchPasteHandle;
57
- useImperativeHandle(tableHandleRef, function () { return ({
58
- validate: innerTableHandleRef.current.validate,
59
- clearErrorClass: innerTableHandleRef.current.clearErrorClass,
60
- getCurrentPage: innerTableHandleRef.current.getCurrentPage,
61
- getRealyIndex: innerTableHandleRef.current.getRealyIndex,
62
- onEditableSaveHandle: onEditableSaveHandle,
63
- }); });
64
- return (React.createElement(Table, __assign({ rowKey: rowKey, dataSource: dataSource, columns: tableColumns, hideAddIcon: !showAddIcon, hideDelIcon: !showDelIcon, onAddAndDelHandle: needAddAndDel ? onAddAndDelHandle : undefined, onMoveRow: isMove ? onMoveRowHandle : undefined, onEditableSave: isEdit ? onEditableSaveHandle : undefined, tableHandleRef: innerTableHandleRef, onTableChange: isPaste ? onBatchPasteHandle : undefined }, restProps)));
65
- }
66
- export default memo(ProEditTable);
@@ -1,31 +0,0 @@
1
- /// <reference types="react" />
2
- import { ColumnsType } from '../../../components/Table';
3
- import { IProps as TableIProps } from '../../../components/Table/table';
4
- export interface IProps<RecordType> extends Omit<TableIProps<RecordType>, 'columns' | 'onChange' | 'onEditableSave'> {
5
- dataSource: any[];
6
- columns: ColumnsType<any>;
7
- rowKey: string;
8
- onChange?: (dataSource: any[]) => void;
9
- showAddIcon?: boolean;
10
- showDelIcon?: boolean;
11
- /**
12
- * 增加数据的模式 blank add空白数据; copy add复制数据; 自定义增加
13
- */
14
- addDataMode?: 'blank' | 'copy' | ((index: number, dataSource: any[]) => any[]);
15
- isMove?: boolean;
16
- isEdit?: boolean;
17
- isPaste?: boolean;
18
- onBatchPastePre?: (data: any[]) => any[];
19
- onBatchPastePost?: (data: any[]) => any[];
20
- tableHandleRef?: React.Ref<{
21
- validate: () => Promise<any>;
22
- clearErrorClass: (index: number) => void;
23
- getCurrentPage: () => {
24
- page: number;
25
- pageSize: number;
26
- } | null;
27
- getRealyIndex: (index: number) => number;
28
- onEditableSaveHandle: (record: any, index: number | undefined, _dataIndex: string) => void;
29
- [prop: string]: any;
30
- }>;
31
- }
@@ -1 +0,0 @@
1
- export {};