zmdms-webui 1.6.1 → 1.6.3
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.
|
@@ -3,7 +3,7 @@ import { TextAreaProps } from 'antd/es/input';
|
|
|
3
3
|
|
|
4
4
|
interface ITextAreaProps extends TextAreaProps {
|
|
5
5
|
/** 在表单中是否可以自行调整尺寸 */
|
|
6
|
-
|
|
6
|
+
formResize?: boolean;
|
|
7
7
|
}
|
|
8
8
|
interface ITextAreaComponent extends React__default.ForwardRefExoticComponent<ITextAreaProps & React__default.RefAttributes<unknown>> {
|
|
9
9
|
displayName: string;
|
|
@@ -5,9 +5,9 @@ import { Input } from 'antd';
|
|
|
5
5
|
import classNames from '../node_modules/classnames/index.js';
|
|
6
6
|
|
|
7
7
|
var TextArea = function (props, ref) {
|
|
8
|
-
var
|
|
8
|
+
var formResize = props.formResize, className = props.className, resetProps = __rest(props, ["formResize", "className"]);
|
|
9
9
|
var classes = classNames(className, {
|
|
10
|
-
"ztxk-input-textArea--form-resize":
|
|
10
|
+
"ztxk-input-textArea--form-resize": formResize,
|
|
11
11
|
});
|
|
12
12
|
return jsx(Input.TextArea, __assign({ className: classes }, resetProps, { ref: ref }));
|
|
13
13
|
};
|
package/dist/es/table/hooks.js
CHANGED
|
@@ -284,6 +284,31 @@ function useCustomSort(dataSource, onTableChange, options) {
|
|
|
284
284
|
sortDataSource: sortDataSource,
|
|
285
285
|
customSortHandle: customSortHandle,
|
|
286
286
|
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* 计算表格高度
|
|
290
|
+
* @param isAutoScrollY 是否自动计算高度
|
|
291
|
+
* @param marginBottom table下面留出的距离
|
|
292
|
+
* @param id 表格id
|
|
293
|
+
* @returns 表格高度
|
|
294
|
+
*/
|
|
295
|
+
function useCalcScrollY(isAutoScrollY, subHeight, id) {
|
|
296
|
+
if (subHeight === void 0) { subHeight = 20; }
|
|
297
|
+
var _a = useState(undefined), tableHeight = _a[0], setTableHeight = _a[1];
|
|
298
|
+
useEffect(function () {
|
|
299
|
+
var _a, _b;
|
|
300
|
+
if (!isAutoScrollY)
|
|
301
|
+
return;
|
|
302
|
+
var containerRect = (_a = document
|
|
303
|
+
.querySelector(".ztxk-container")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
304
|
+
var tableRect = (_b = document
|
|
305
|
+
.querySelector(id ? "#".concat(CSS.escape(id), " .ant-table-tbody") : ".ant-table-tbody")) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
306
|
+
if (containerRect && tableRect) {
|
|
307
|
+
var tableHeight_1 = containerRect.height + containerRect.top - tableRect.top - subHeight;
|
|
308
|
+
setTableHeight(tableHeight_1);
|
|
309
|
+
}
|
|
310
|
+
}, [isAutoScrollY, subHeight, id]);
|
|
311
|
+
return tableHeight;
|
|
287
312
|
}
|
|
288
313
|
|
|
289
|
-
export { useAddAndDelChange, useCustomSort, useEditChange, useMoveRowChange, useScuRfresh };
|
|
314
|
+
export { useAddAndDelChange, useCalcScrollY, useCustomSort, useEditChange, useMoveRowChange, useScuRfresh };
|
|
@@ -404,6 +404,18 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
|
|
|
404
404
|
* 新增或删除行配置
|
|
405
405
|
*/
|
|
406
406
|
addAndDelProps?: IColumnsTypeProp<RecordType>;
|
|
407
|
+
/**
|
|
408
|
+
* 是否开启自动计算Y轴高度
|
|
409
|
+
*/
|
|
410
|
+
isAutoScrollY?: boolean;
|
|
411
|
+
/**
|
|
412
|
+
* 自动计算Y轴高度时,table下面留出的距离
|
|
413
|
+
*/
|
|
414
|
+
autoScrollYMarginBottom?: number;
|
|
415
|
+
/**
|
|
416
|
+
* 表格id
|
|
417
|
+
*/
|
|
418
|
+
tableId?: string;
|
|
407
419
|
}
|
|
408
420
|
interface IFields {
|
|
409
421
|
/**
|
package/dist/es/table/table.js
CHANGED
|
@@ -17,7 +17,7 @@ import { useColumns } from './useColumns.js';
|
|
|
17
17
|
import { useDynamicListByColumns } from './useDynamicListByColumns.js';
|
|
18
18
|
import useSummary from './useSummary.js';
|
|
19
19
|
import useInnerPagination, { getInnerIndex } from './useInnerPagination.js';
|
|
20
|
-
import { useScuRfresh, useCustomSort, useEditChange, useMoveRowChange, useAddAndDelChange } from './hooks.js';
|
|
20
|
+
import { useScuRfresh, useCustomSort, useCalcScrollY, useEditChange, useMoveRowChange, useAddAndDelChange } from './hooks.js';
|
|
21
21
|
import { HTML5Backend } from '../node_modules/react-dnd-html5-backend/dist/index.js';
|
|
22
22
|
import { VList, scrollTo } from '../node_modules/virtuallist-antd/dist/index.es.js';
|
|
23
23
|
import useTableValidate, { tableValidate } from './useTableValidate.js';
|
|
@@ -38,25 +38,25 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
|
|
|
38
38
|
// completed: 实现从execl复制到表格中的功能
|
|
39
39
|
var Table = function (props) {
|
|
40
40
|
// console.log("表格渲染");
|
|
41
|
-
var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps"]);
|
|
41
|
+
var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 60 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, tableId = props.tableId, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId"]);
|
|
42
42
|
var classes = classNames("ztxk-table", className, {
|
|
43
43
|
"ztxk-table--flex": isFlex,
|
|
44
44
|
});
|
|
45
45
|
// 针对SCU和增减行 做特殊处理
|
|
46
|
-
var
|
|
46
|
+
var _q = useScuRfresh(), refreshScuCell = _q.refreshScuCell, getRefreshScuCell = _q.getRefreshScuCell;
|
|
47
47
|
// 做一些前置处理
|
|
48
48
|
// 比如过滤某些列 不做展示
|
|
49
49
|
var columns = useParseColumns(_columns);
|
|
50
50
|
// 得到动态列配置信息
|
|
51
|
-
var
|
|
51
|
+
var _r = useDynamicListByColumns(columns, { dynamicKey: dynamicKey, dynamicVersion: dynamicVersion }), defaultDynamicList = _r.defaultDynamicList, onCurrentListChange = _r.onCurrentListChange, currentDynamicList = _r.currentDynamicList, dynamicSettingRef = _r.dynamicSettingRef;
|
|
52
52
|
// 因为内部分页需要知晓当前页面的数据展示,要不然数据排序就跟内部分页没关系了
|
|
53
53
|
// 自定义排序方法
|
|
54
|
-
var
|
|
54
|
+
var _s = useCustomSort(dataSource, onTableChange, {
|
|
55
55
|
refreshScuCell: refreshScuCell,
|
|
56
56
|
rowKey: props === null || props === void 0 ? void 0 : props.rowKey,
|
|
57
57
|
serviceOrder: serviceOrder,
|
|
58
58
|
isOrderUpdateData: isOrderUpdateData,
|
|
59
|
-
}), order =
|
|
59
|
+
}), order = _s.order, setOrder = _s.setOrder, customSortHandle = _s.customSortHandle, sortDataSource = _s.sortDataSource;
|
|
60
60
|
// 当前表格展示的数据
|
|
61
61
|
// 如果开启了前端排序的话,排序后的数据,可能会影响到很多地方。
|
|
62
62
|
// 所以后续操作的数据 应该用
|
|
@@ -65,28 +65,30 @@ var Table = function (props) {
|
|
|
65
65
|
var dataSourceRef = useLatest(currentTableDataSource);
|
|
66
66
|
var hiddenDelBtnHandleRef = useLatest(hiddenDelBtnHandle);
|
|
67
67
|
var hiddenAddBtnHandleRef = useLatest(hiddenAddBtnHandle);
|
|
68
|
+
var scrolly = useCalcScrollY(isAutoScrollY, autoScrollYMarginBottom, tableId);
|
|
68
69
|
var proxyScroll = useMemo(function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
// 如果没数据时,肯定不需要y轴滚动条
|
|
71
|
+
if ((!currentTableDataSource ||
|
|
72
|
+
(currentTableDataSource && (currentTableDataSource === null || currentTableDataSource === void 0 ? void 0 : currentTableDataSource.length) === 0)) &&
|
|
73
|
+
!virtualKey) {
|
|
74
|
+
return __assign(__assign({}, scroll), { y: undefined });
|
|
75
|
+
}
|
|
76
|
+
// 假设每行高度固定,如果没超过一页,则不出现滚动条
|
|
77
|
+
// if (currentTableDataSource && currentTableDataSource?.length <= 10) {
|
|
78
|
+
// return { ...scroll, y: undefined };
|
|
79
|
+
// }
|
|
80
|
+
if (isAutoScrollY) {
|
|
81
|
+
return __assign(__assign({}, scroll), { y: scrolly });
|
|
80
82
|
}
|
|
81
|
-
return
|
|
82
|
-
}, [scroll, currentTableDataSource]);
|
|
83
|
+
return scroll;
|
|
84
|
+
}, [scroll, currentTableDataSource, virtualKey, scrolly, isAutoScrollY]);
|
|
83
85
|
// 内部分页相关配置
|
|
84
|
-
var
|
|
86
|
+
var _t = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
|
|
85
87
|
innerPaginationPosition: innerPaginationPosition,
|
|
86
88
|
innerPaginationPageSizeOptions: innerPaginationPageSizeOptions,
|
|
87
89
|
innerPaginationConfig: innerPaginationConfig,
|
|
88
90
|
dataSource: currentTableDataSource,
|
|
89
|
-
}), paginationConfig =
|
|
91
|
+
}), paginationConfig = _t.paginationConfig, currentPage = _t.currentPage, setCurrent = _t.setCurrent, pageSize = _t.pageSize;
|
|
90
92
|
// 内部表格编辑事件
|
|
91
93
|
var onEditableSave = useEditChange(dataSourceRef, onTableChange);
|
|
92
94
|
// 记录表头过滤的一些配置(通过ref记录,key => filter) 复制整列、过滤后修改数据,需要先走过滤
|
|
@@ -156,7 +158,7 @@ var Table = function (props) {
|
|
|
156
158
|
isDel: isDel,
|
|
157
159
|
});
|
|
158
160
|
// 表格验证
|
|
159
|
-
var
|
|
161
|
+
var _u = useTableValidate(), tableRef = _u.tableRef, getCurrentTable = _u.getCurrentTable, clearErrorClass = _u.clearErrorClass;
|
|
160
162
|
// 虚拟滚动选项
|
|
161
163
|
var vComponents = useMemo(function () {
|
|
162
164
|
if (virtualKey) {
|
|
@@ -302,7 +304,7 @@ var Table = function (props) {
|
|
|
302
304
|
overflow: "hidden",
|
|
303
305
|
marginTop: isMarginTop ? 10 : 0,
|
|
304
306
|
marginBottom: isMarginBottom ? 10 : 0,
|
|
305
|
-
}, ref: tableRef }, { children: [isMove ? (jsx(DndProvider, __assign({ backend: HTML5Backend, context: window }, { children: SingleTable }))) : (SingleTable), dynamicKey ? (jsx(DynamicSetting, { parentDynamicKey: TABLE_DYNAMIC_KEY, dynamicKey: dynamicKey, defaultList: defaultDynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef, hiddenOperationIcon: true, isMore: true, isFixed: true })) : null] })));
|
|
307
|
+
}, ref: tableRef, id: tableId }, { children: [isMove ? (jsx(DndProvider, __assign({ backend: HTML5Backend, context: window }, { children: SingleTable }))) : (SingleTable), dynamicKey ? (jsx(DynamicSetting, { parentDynamicKey: TABLE_DYNAMIC_KEY, dynamicKey: dynamicKey, defaultList: defaultDynamicList, onCurrentListChange: onCurrentListChange, ref: dynamicSettingRef, hiddenOperationIcon: true, isMore: true, isFixed: true })) : null] })));
|
|
306
308
|
};
|
|
307
309
|
var MemoTable = memo(Table);
|
|
308
310
|
MemoTable.displayName = "ZTXK_WEBUI_Table";
|