zmdms-webui 0.0.165 → 0.0.166
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,6 +227,10 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
|
|
|
227
227
|
* 是否显示增加行功能
|
|
228
228
|
*/
|
|
229
229
|
isAdd?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* 是否显示表头的新增行按钮(当没有一条数据时,可以点击表头行实现数据的插入)
|
|
232
|
+
*/
|
|
233
|
+
isTheadTitleAdd?: boolean;
|
|
230
234
|
/**
|
|
231
235
|
* 新增的逻辑 默认生成一条空白数据 或者复制
|
|
232
236
|
*/
|
package/dist/es/table/table.js
CHANGED
|
@@ -37,7 +37,7 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
|
|
|
37
37
|
// TODO: 过滤功能
|
|
38
38
|
var Table = function (props) {
|
|
39
39
|
// console.log("表格渲染");
|
|
40
|
-
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, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, hiddenDelBtnHandle = props.hiddenDelBtnHandle,
|
|
40
|
+
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, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, _c = props.isTheadTitleAdd, isTheadTitleAdd = _c === void 0 ? true : _c, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _d = props.isDelAll, isDelAll = _d === void 0 ? true : _d, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _e = props.summaryFixed, summaryFixed = _e === void 0 ? true : _e, isInnerPagination = props.isInnerPagination, _f = props.innerPaginationPageSize, innerPaginationPageSize = _f === void 0 ? 30 : _f, _g = props.innerPaginationPosition, innerPaginationPosition = _g === void 0 ? INNER_TABLE_PAGINATION_POSITION : _g, _h = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _h === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _h, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _j = props.isResizableColumn, isResizableColumn = _j === void 0 ? true : _j, _k = props.isRealTimeValidate, isRealTimeValidate = _k === void 0 ? true : _k, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isRealTimeValidate", "isMarginTop", "isMarginBottom"]);
|
|
41
41
|
// 做一些前置处理
|
|
42
42
|
// 比如过滤某些列 不做展示
|
|
43
43
|
var columns = useParseColumns(_columns);
|
|
@@ -48,14 +48,14 @@ var Table = function (props) {
|
|
|
48
48
|
var dataSourceRef = useLatest(dataSource);
|
|
49
49
|
var hiddenDelBtnHandleRef = useLatest(hiddenDelBtnHandle);
|
|
50
50
|
// 得到动态列配置信息
|
|
51
|
-
var
|
|
51
|
+
var _l = useDynamicListByColumns(columns, dynamicKey), defaultDynamicList = _l.defaultDynamicList, onCurrentListChange = _l.onCurrentListChange, currentDynamicList = _l.currentDynamicList, dynamicSettingRef = _l.dynamicSettingRef;
|
|
52
52
|
// 针对SCU和增减行 做特殊处理
|
|
53
|
-
var
|
|
53
|
+
var _m = useScuRfresh(), refreshScuCell = _m.refreshScuCell, getRefreshScuCell = _m.getRefreshScuCell;
|
|
54
54
|
// 内部分页相关配置
|
|
55
|
-
var
|
|
55
|
+
var _o = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
|
|
56
56
|
innerPaginationPosition: innerPaginationPosition,
|
|
57
57
|
innerPaginationPageSizeOptions: innerPaginationPageSizeOptions,
|
|
58
|
-
}), paginationConfig =
|
|
58
|
+
}), paginationConfig = _o.paginationConfig, currentPage = _o.currentPage, setCurrent = _o.setCurrent, pageSize = _o.pageSize;
|
|
59
59
|
// 内部表格编辑事件
|
|
60
60
|
var onEditableSave = useEditChange(dataSourceRef, onTableChange);
|
|
61
61
|
// 内部表格拖拽事件
|
|
@@ -74,12 +74,12 @@ var Table = function (props) {
|
|
|
74
74
|
currentPage: currentPage,
|
|
75
75
|
});
|
|
76
76
|
// 自定义排序方法
|
|
77
|
-
var
|
|
77
|
+
var _p = useCustomSort(dataSource, onTableChange, {
|
|
78
78
|
refreshScuCell: refreshScuCell,
|
|
79
79
|
currentPage: currentPage,
|
|
80
80
|
rowKey: props === null || props === void 0 ? void 0 : props.rowKey,
|
|
81
81
|
serviceOrder: serviceOrder,
|
|
82
|
-
}), order =
|
|
82
|
+
}), order = _p.order, setOrder = _p.setOrder, customSortHandle = _p.customSortHandle, sortDataSource = _p.sortDataSource;
|
|
83
83
|
// 处理列配置信息 得到新的列配置信息
|
|
84
84
|
var newColumns = useColumns(columns, {
|
|
85
85
|
// 动态列配置相关信息
|
|
@@ -93,6 +93,7 @@ var Table = function (props) {
|
|
|
93
93
|
onEditableSave: onEditableSave,
|
|
94
94
|
isEdit: isEdit,
|
|
95
95
|
isAdd: isAdd,
|
|
96
|
+
isTheadTitleAdd: isTheadTitleAdd,
|
|
96
97
|
isDel: isDel,
|
|
97
98
|
onAddAndDel: onAddAndDel,
|
|
98
99
|
getRefreshScuCell: getRefreshScuCell,
|
|
@@ -119,7 +120,7 @@ var Table = function (props) {
|
|
|
119
120
|
isDel: isDel,
|
|
120
121
|
});
|
|
121
122
|
// 表格验证
|
|
122
|
-
var
|
|
123
|
+
var _q = useTableValidate(), tableRef = _q.tableRef, getCurrentTable = _q.getCurrentTable, clearErrorClass = _q.clearErrorClass;
|
|
123
124
|
// 虚拟滚动选项
|
|
124
125
|
var vComponents = useMemo(function () {
|
|
125
126
|
var _a;
|
|
@@ -17,7 +17,7 @@ import { PLACEHOLDER_NULL } from '../config/constant.js';
|
|
|
17
17
|
// 不适用column里面的dataIndex字段,使用key字段
|
|
18
18
|
function useColumns(columns, options) {
|
|
19
19
|
var _a, _b;
|
|
20
|
-
var dynamicKey = options.dynamicKey, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isDel = options.isDel, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef;
|
|
20
|
+
var dynamicKey = options.dynamicKey, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isTheadTitleAdd = options.isTheadTitleAdd, isDel = options.isDel, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef;
|
|
21
21
|
var newColumns = getTableColumns(columns, currentDynamicList);
|
|
22
22
|
// 循环遍历 neColumns 根据一些内容进行处理
|
|
23
23
|
var myNewColumns = [];
|
|
@@ -185,7 +185,8 @@ function useColumns(columns, options) {
|
|
|
185
185
|
isDel &&
|
|
186
186
|
Array.isArray(dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) &&
|
|
187
187
|
((_a = dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
188
|
-
var showTitleAddIcon_1 =
|
|
188
|
+
var showTitleAddIcon_1 = isTheadTitleAdd &&
|
|
189
|
+
isAdd &&
|
|
189
190
|
(!(dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) || ((_b = dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) === null || _b === void 0 ? void 0 : _b.length) === 0);
|
|
190
191
|
// 如果配置了增减行
|
|
191
192
|
if (isAdd || isDel) {
|