@zat-design/sisyphus-react 3.4.13 → 3.5.0
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/LICENSE +201 -21
- package/dist/index.esm.css +60 -0
- package/dist/less.esm.css +60 -0
- package/es/ProEditTable/components/DndWrapper/index.js +1 -0
- package/es/ProEditTable/index.d.ts +1 -1
- package/es/ProEditTable/index.js +8 -3
- package/es/ProEditTable/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/ProNumberRange/index.js +28 -7
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
- package/es/ProForm/utils/valueType.d.ts +0 -6
- package/es/ProForm/utils/valueType.js +30 -2
- package/es/ProLayout/index.js +6 -2
- package/es/ProLayout/propTypes.d.ts +4 -0
- package/es/ProSelect/index.js +52 -45
- package/es/ProSelect/index.less +6 -0
- package/es/ProTable/components/DndWrapper/index.d.ts +15 -0
- package/es/ProTable/components/DndWrapper/index.js +94 -0
- package/es/ProTable/components/index.d.ts +1 -0
- package/es/ProTable/components/index.js +2 -1
- package/es/ProTable/index.d.ts +3 -0
- package/es/ProTable/index.js +177 -74
- package/es/ProTable/propsType.d.ts +5 -1
- package/es/ProTable/style/index.less +90 -0
- package/es/ProTree/utils.d.ts +1 -1
- package/es/ProTree/utils.js +1 -1
- package/es/ProTreeModal/index.js +10 -4
- package/es/ProTreeModal/style/index.less +1 -0
- package/lib/ProEditTable/components/DndWrapper/index.js +1 -0
- package/lib/ProEditTable/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +8 -3
- package/lib/ProEditTable/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/ProNumberRange/index.js +28 -7
- package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
- package/lib/ProForm/utils/valueType.d.ts +0 -6
- package/lib/ProForm/utils/valueType.js +30 -2
- package/lib/ProLayout/index.js +6 -2
- package/lib/ProLayout/propTypes.d.ts +4 -0
- package/lib/ProSelect/index.js +54 -45
- package/lib/ProSelect/index.less +6 -0
- package/lib/ProTable/components/DndWrapper/index.d.ts +15 -0
- package/lib/ProTable/components/DndWrapper/index.js +101 -0
- package/lib/ProTable/components/index.d.ts +1 -0
- package/lib/ProTable/components/index.js +15 -1
- package/lib/ProTable/index.d.ts +3 -0
- package/lib/ProTable/index.js +173 -70
- package/lib/ProTable/propsType.d.ts +5 -1
- package/lib/ProTable/style/index.less +90 -0
- package/lib/ProTree/utils.d.ts +1 -1
- package/lib/ProTree/utils.js +1 -1
- package/lib/ProTreeModal/index.js +10 -4
- package/lib/ProTreeModal/style/index.less +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Row = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _core = require("@dnd-kit/core");
|
|
13
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
14
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
15
|
+
var _ProIcon = _interopRequireDefault(require("../../../ProIcon"));
|
|
16
|
+
var _excluded = ["disabled", "children"];
|
|
17
|
+
var Row = exports.Row = function Row(props) {
|
|
18
|
+
var disabled = props.disabled,
|
|
19
|
+
children = props.children,
|
|
20
|
+
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
21
|
+
var data = (0, _sortable.useSortable)({
|
|
22
|
+
id: props['data-row-key'],
|
|
23
|
+
disabled: disabled
|
|
24
|
+
});
|
|
25
|
+
var attributes = data.attributes,
|
|
26
|
+
listeners = data.listeners,
|
|
27
|
+
setNodeRef = data.setNodeRef,
|
|
28
|
+
transform = data.transform,
|
|
29
|
+
transition = data.transition,
|
|
30
|
+
isDragging = data.isDragging;
|
|
31
|
+
var style = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.style), {}, {
|
|
32
|
+
transform: _utilities.CSS.Transform.toString(transform && (0, _objectSpread2.default)((0, _objectSpread2.default)({}, transform), {}, {
|
|
33
|
+
scaleY: 1
|
|
34
|
+
})),
|
|
35
|
+
transition: transition
|
|
36
|
+
}, isDragging ? {
|
|
37
|
+
position: 'relative',
|
|
38
|
+
zIndex: 2
|
|
39
|
+
} : {});
|
|
40
|
+
return (0, _jsxRuntime.jsx)("tr", (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, restProps), {}, {
|
|
41
|
+
ref: setNodeRef,
|
|
42
|
+
style: style
|
|
43
|
+
}, attributes), {}, {
|
|
44
|
+
children: _react.default.Children.map(children, function (child) {
|
|
45
|
+
if (child.key === 'RC_TABLE_KEY') {
|
|
46
|
+
var _ref = (child === null || child === void 0 ? void 0 : child.props) || {},
|
|
47
|
+
render = _ref.render,
|
|
48
|
+
record = _ref.record,
|
|
49
|
+
renderIndex = _ref.renderIndex;
|
|
50
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
51
|
+
children: (0, _jsxRuntime.jsxs)("span", {
|
|
52
|
+
className: "drag-wrapper".concat(props['data-hide'] ? ' no-check' : ''),
|
|
53
|
+
children: [(0, _jsxRuntime.jsx)(_ProIcon.default, (0, _objectSpread2.default)({
|
|
54
|
+
className: "drag-icon",
|
|
55
|
+
style: {
|
|
56
|
+
touchAction: 'none',
|
|
57
|
+
cursor: disabled ? 'no-drop' : 'move'
|
|
58
|
+
},
|
|
59
|
+
type: "drag",
|
|
60
|
+
size: 20
|
|
61
|
+
}, listeners)), props['data-hide'] ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return child;
|
|
66
|
+
})
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
var DndWrapper = function DndWrapper(_ref2) {
|
|
70
|
+
var _value$;
|
|
71
|
+
var draggable = _ref2.draggable,
|
|
72
|
+
value = _ref2.value,
|
|
73
|
+
onChange = _ref2.onChange,
|
|
74
|
+
disabled = _ref2.disabled,
|
|
75
|
+
children = _ref2.children;
|
|
76
|
+
var onDragEnd = function onDragEnd(_ref3) {
|
|
77
|
+
var active = _ref3.active,
|
|
78
|
+
over = _ref3.over;
|
|
79
|
+
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
80
|
+
var activeIndex = value.findIndex(function (i) {
|
|
81
|
+
return i.rowKey === active.id;
|
|
82
|
+
});
|
|
83
|
+
var overIndex = value.findIndex(function (i) {
|
|
84
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
85
|
+
});
|
|
86
|
+
var nextValue = (0, _sortable.arrayMove)(value, activeIndex, overIndex);
|
|
87
|
+
onChange(nextValue);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return draggable && !disabled ? (0, _jsxRuntime.jsx)(_core.DndContext, {
|
|
91
|
+
onDragEnd: onDragEnd,
|
|
92
|
+
children: (0, _jsxRuntime.jsx)(_sortable.SortableContext, {
|
|
93
|
+
items: (value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey) ? value.map(function (i) {
|
|
94
|
+
return i.rowKey;
|
|
95
|
+
}) : [],
|
|
96
|
+
strategy: _sortable.verticalListSortingStrategy,
|
|
97
|
+
children: children
|
|
98
|
+
})
|
|
99
|
+
}) : children;
|
|
100
|
+
};
|
|
101
|
+
var _default = exports.default = DndWrapper;
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "DndWrapper", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _DndWrapper.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
7
14
|
Object.defineProperty(exports, "ResizableLine", {
|
|
8
15
|
enumerable: true,
|
|
9
16
|
get: function get() {
|
|
10
17
|
return _ResizableLine.default;
|
|
11
18
|
}
|
|
12
19
|
});
|
|
20
|
+
Object.defineProperty(exports, "Row", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _DndWrapper.Row;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
13
26
|
Object.defineProperty(exports, "TableResizable", {
|
|
14
27
|
enumerable: true,
|
|
15
28
|
get: function get() {
|
|
@@ -17,4 +30,5 @@ Object.defineProperty(exports, "TableResizable", {
|
|
|
17
30
|
}
|
|
18
31
|
});
|
|
19
32
|
var _ResizableLine = _interopRequireDefault(require("./ResizableLine"));
|
|
20
|
-
var _TableResizable = _interopRequireDefault(require("./TableResizable"));
|
|
33
|
+
var _TableResizable = _interopRequireDefault(require("./TableResizable"));
|
|
34
|
+
var _DndWrapper = _interopRequireWildcard(require("./DndWrapper"));
|
package/lib/ProTable/index.d.ts
CHANGED
package/lib/ProTable/index.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.defaultPage = exports.default = exports.TableContext = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -28,7 +30,7 @@ var _reset = _interopRequireDefault(require("../assets/reset.svg"));
|
|
|
28
30
|
var _customColumn = _interopRequireDefault(require("../assets/customColumn.svg"));
|
|
29
31
|
var _utils3 = require("./utils");
|
|
30
32
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
31
|
-
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "summary", "emptyText", "originalDataSource"],
|
|
33
|
+
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource"],
|
|
32
34
|
_excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
|
|
33
35
|
var defaultCacheTime = 1; // columns 配置保存时间为一天
|
|
34
36
|
// 全局上下文
|
|
@@ -53,6 +55,10 @@ function ProTable(props) {
|
|
|
53
55
|
_props$columns = props.columns,
|
|
54
56
|
propsColumns = _props$columns === void 0 ? [] : _props$columns,
|
|
55
57
|
className = props.className,
|
|
58
|
+
draggable = props.draggable,
|
|
59
|
+
disabled = props.disabled,
|
|
60
|
+
isView = props.isView,
|
|
61
|
+
rowDisabled = props.rowDisabled,
|
|
56
62
|
summary = props.summary,
|
|
57
63
|
_props$emptyText = props.emptyText,
|
|
58
64
|
emptyText = _props$emptyText === void 0 ? _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable = _locale.default.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.noData : _props$emptyText,
|
|
@@ -78,8 +84,24 @@ function ProTable(props) {
|
|
|
78
84
|
pagination = _ref3.pagination,
|
|
79
85
|
dataSource = _ref3.dataSource,
|
|
80
86
|
rowKey = _ref3.rowKey;
|
|
87
|
+
var initDataSource = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
88
|
+
return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, item), {}, {
|
|
89
|
+
rowKey: item === null || item === void 0 ? void 0 : item[rowKey]
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
var _useSetState = (0, _ahooks.useSetState)({
|
|
93
|
+
dataSource: initDataSource
|
|
94
|
+
}),
|
|
95
|
+
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
96
|
+
_dataSource = _useSetState2[0].dataSource,
|
|
97
|
+
setState = _useSetState2[1];
|
|
98
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
99
|
+
setState({
|
|
100
|
+
dataSource: initDataSource
|
|
101
|
+
});
|
|
102
|
+
}, [initDataSource]);
|
|
81
103
|
var originalObj = originalDataSource ? (0, _lodash.keyBy)(originalDataSource, rowKey) : undefined;
|
|
82
|
-
var dataSourceObj =
|
|
104
|
+
var dataSourceObj = _dataSource ? (0, _lodash.keyBy)(_dataSource, rowKey) : {};
|
|
83
105
|
var propsColumnObj = (0, _react.useMemo)(function () {
|
|
84
106
|
return propsColumns.reduce(function (acc, cur) {
|
|
85
107
|
// @ts-ignore
|
|
@@ -226,7 +248,7 @@ function ProTable(props) {
|
|
|
226
248
|
var _ref6 = tableProps || {},
|
|
227
249
|
dataSource = _ref6.dataSource;
|
|
228
250
|
// 没有数据时,不展示合计栏
|
|
229
|
-
if (!(
|
|
251
|
+
if (!(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.length)) {
|
|
230
252
|
return null;
|
|
231
253
|
}
|
|
232
254
|
return (0, _jsxRuntime.jsx)(_antd.Table.Summary, {
|
|
@@ -247,7 +269,7 @@ function ProTable(props) {
|
|
|
247
269
|
} else if (total && key) {
|
|
248
270
|
var _dataSource$reduce;
|
|
249
271
|
var format = _utils2.valueTypeRender === null || _utils2.valueTypeRender === void 0 ? void 0 : _utils2.valueTypeRender[valueType];
|
|
250
|
-
var sum =
|
|
272
|
+
var sum = _dataSource === null || _dataSource === void 0 ? void 0 : (_dataSource$reduce = _dataSource.reduce) === null || _dataSource$reduce === void 0 ? void 0 : _dataSource$reduce.call(_dataSource, function (pre, cur) {
|
|
251
273
|
var _get;
|
|
252
274
|
return _utils.tools.calc(pre, '+', (_get = (0, _lodash.get)(cur, key)) !== null && _get !== void 0 ? _get : 0);
|
|
253
275
|
}, 0);
|
|
@@ -265,91 +287,172 @@ function ProTable(props) {
|
|
|
265
287
|
};
|
|
266
288
|
var cls = (0, _classnames2.default)((0, _defineProperty2.default)({
|
|
267
289
|
'pro-table': true,
|
|
268
|
-
'pro-table-no-stripe': !stripe
|
|
290
|
+
'pro-table-no-stripe': !stripe,
|
|
291
|
+
'pro-table-draggable-only': draggable && !(tableProps === null || tableProps === void 0 ? void 0 : tableProps.rowSelection)
|
|
269
292
|
}, className, className));
|
|
293
|
+
// 复选框
|
|
294
|
+
var _rowSelection = tableProps.rowSelection ? (0, _objectSpread4.default)({
|
|
295
|
+
fixed: draggable,
|
|
296
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
297
|
+
if (rowDisabled) {
|
|
298
|
+
var _disabled = rowDisabled(record);
|
|
299
|
+
return {
|
|
300
|
+
disabled: _disabled
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return {};
|
|
304
|
+
},
|
|
305
|
+
hideSelectAll: disabled || isView
|
|
306
|
+
}, tableProps.rowSelection) : undefined;
|
|
307
|
+
/**
|
|
308
|
+
* 渲染表格选择器
|
|
309
|
+
* @returns rowSelection
|
|
310
|
+
*/
|
|
311
|
+
var renderRowSelection = function renderRowSelection() {
|
|
312
|
+
if (disabled || isView) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
if (draggable && !tableProps.rowSelection) {
|
|
316
|
+
return {
|
|
317
|
+
fixed: true,
|
|
318
|
+
hideSelectAll: true,
|
|
319
|
+
renderCell: function renderCell() {
|
|
320
|
+
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return _rowSelection;
|
|
325
|
+
};
|
|
326
|
+
var onDataSourceChange = /*#__PURE__*/function () {
|
|
327
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nextDataSource) {
|
|
328
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
329
|
+
while (1) switch (_context.prev = _context.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
setState({
|
|
332
|
+
dataSource: nextDataSource
|
|
333
|
+
});
|
|
334
|
+
// 覆盖引用值
|
|
335
|
+
(0, _lodash.assign)(dataSource, nextDataSource);
|
|
336
|
+
case 2:
|
|
337
|
+
case "end":
|
|
338
|
+
return _context.stop();
|
|
339
|
+
}
|
|
340
|
+
}, _callee);
|
|
341
|
+
}));
|
|
342
|
+
return function onDataSourceChange(_x) {
|
|
343
|
+
return _ref8.apply(this, arguments);
|
|
344
|
+
};
|
|
345
|
+
}();
|
|
346
|
+
var renderComponents = function renderComponents() {
|
|
347
|
+
if (draggable) {
|
|
348
|
+
return {
|
|
349
|
+
body: {
|
|
350
|
+
row: _components.Row
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (resizeColumn) {
|
|
355
|
+
return _components.TableResizable.components;
|
|
356
|
+
}
|
|
357
|
+
return null;
|
|
358
|
+
};
|
|
270
359
|
return (0, _jsxRuntime.jsx)(TableContext.Provider, {
|
|
271
360
|
value: {
|
|
272
361
|
pathKey: pathKey,
|
|
273
362
|
tableConfig: tableConfig,
|
|
274
363
|
Storage: Storage
|
|
275
364
|
},
|
|
276
|
-
children: (0, _jsxRuntime.
|
|
365
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
277
366
|
className: cls,
|
|
278
|
-
children:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
className: "
|
|
285
|
-
children: [
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
onClick: resetColumnWidth,
|
|
292
|
-
children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable2 = _locale.default.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.resetColumnWidth
|
|
293
|
-
}), columnConfig && (0, _jsxRuntime.jsx)(_index.ProTreeModal, {
|
|
294
|
-
title: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable3 = _locale.default.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.customColumns,
|
|
295
|
-
span: 8,
|
|
296
|
-
mode: "list",
|
|
297
|
-
draggable: true,
|
|
298
|
-
dataSource: customColumns,
|
|
299
|
-
value: checkColumns,
|
|
300
|
-
allValue: "all",
|
|
301
|
-
onChange: handleColumnConfig,
|
|
302
|
-
trigger: (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
303
|
-
className: "custom-column-btn",
|
|
367
|
+
children: (0, _jsxRuntime.jsxs)(_components.DndWrapper, {
|
|
368
|
+
value: _dataSource,
|
|
369
|
+
onChange: onDataSourceChange,
|
|
370
|
+
disabled: false,
|
|
371
|
+
draggable: draggable,
|
|
372
|
+
children: [(headerRender || columnConfig || resizeColumn) && (0, _jsxRuntime.jsxs)("div", {
|
|
373
|
+
className: "column-config",
|
|
374
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
375
|
+
className: "left-contain",
|
|
376
|
+
children: headerRender ? typeof headerRender === 'function' ? headerRender() : headerRender : null
|
|
377
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
378
|
+
className: "right-actions",
|
|
379
|
+
children: [resizeColumn && (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
304
380
|
icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
|
305
381
|
className: "anticon",
|
|
306
382
|
wrapper: "span",
|
|
307
|
-
src:
|
|
383
|
+
src: _reset.default
|
|
308
384
|
}),
|
|
309
|
-
|
|
310
|
-
|
|
385
|
+
onClick: resetColumnWidth,
|
|
386
|
+
children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable2 = _locale.default.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.resetColumnWidth
|
|
387
|
+
}), columnConfig && (0, _jsxRuntime.jsx)(_index.ProTreeModal, {
|
|
388
|
+
title: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable3 = _locale.default.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.customColumns,
|
|
389
|
+
span: 8,
|
|
390
|
+
mode: "list",
|
|
391
|
+
draggable: true,
|
|
392
|
+
dataSource: customColumns,
|
|
393
|
+
value: checkColumns,
|
|
394
|
+
allValue: "all",
|
|
395
|
+
onChange: handleColumnConfig,
|
|
396
|
+
trigger: (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
397
|
+
className: "custom-column-btn",
|
|
398
|
+
icon: (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
|
399
|
+
className: "anticon",
|
|
400
|
+
wrapper: "span",
|
|
401
|
+
src: _customColumn.default
|
|
402
|
+
}),
|
|
403
|
+
children: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable4 = _locale.default.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.customColumns
|
|
404
|
+
})
|
|
405
|
+
})]
|
|
311
406
|
})]
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
407
|
+
}), (0, _jsxRuntime.jsxs)("div", {
|
|
408
|
+
className: "pro-table-container",
|
|
409
|
+
children: [(0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread4.default)((0, _objectSpread4.default)({
|
|
410
|
+
className: draggable ? 'pro-edit-table-drag' : '',
|
|
411
|
+
// components={resizeColumn ? TableResizable.components : undefined}
|
|
412
|
+
components: renderComponents(),
|
|
413
|
+
// @ts-ignore
|
|
414
|
+
columns: columns,
|
|
415
|
+
locale: {
|
|
416
|
+
emptyText: (0, _jsxRuntime.jsxs)("div", {
|
|
417
|
+
className: "pro-table-empty",
|
|
418
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
419
|
+
className: "empty-image",
|
|
420
|
+
children: (0, _jsxRuntime.jsx)("img", {
|
|
421
|
+
src: _empty.default,
|
|
422
|
+
alt: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable5 = _locale.default.ProTable) === null || _locale$ProTable5 === void 0 ? void 0 : _locale$ProTable5.noData
|
|
423
|
+
})
|
|
424
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
425
|
+
className: "empty-description",
|
|
426
|
+
children: typeof emptyText === 'function' ? emptyText() : emptyText
|
|
427
|
+
})]
|
|
428
|
+
})
|
|
429
|
+
},
|
|
430
|
+
summary: (0, _typeof2.default)(summary) === 'object' ? function () {
|
|
431
|
+
return renderSummary();
|
|
432
|
+
} : summary,
|
|
433
|
+
rowClassName: function rowClassName(record, index) {
|
|
434
|
+
if (originalDataSource && !originalObj.hasOwnProperty((0, _lodash.get)(record, rowKey))) {
|
|
435
|
+
return 'new-cell';
|
|
436
|
+
}
|
|
340
437
|
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
438
|
+
}, tableProps), {}, {
|
|
439
|
+
dataSource: _dataSource,
|
|
440
|
+
rowSelection: renderRowSelection()
|
|
441
|
+
})), (0, _jsxRuntime.jsx)(_components.ResizableLine, {})]
|
|
442
|
+
}), footerRender ? (0, _jsxRuntime.jsx)("div", {
|
|
443
|
+
className: "pro-table-footer ".concat(pagination && !!(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.length) ? 'has-page' : 'no-page'),
|
|
444
|
+
children: typeof footerRender === 'function' ? footerRender() : footerRender
|
|
445
|
+
}) : null]
|
|
446
|
+
})
|
|
347
447
|
})
|
|
348
448
|
});
|
|
349
449
|
}
|
|
350
450
|
ProTable.defaultProps = {
|
|
351
451
|
quickConfig: false,
|
|
352
|
-
stripe: true
|
|
452
|
+
stripe: true,
|
|
453
|
+
draggable: false,
|
|
454
|
+
disabled: false,
|
|
455
|
+
isView: false
|
|
353
456
|
};
|
|
354
457
|
ProTable.useAntdTable = _useAntdTable.default;
|
|
355
458
|
var _default = exports.default = ProTable;
|
|
@@ -35,7 +35,7 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
|
35
35
|
};
|
|
36
36
|
transform?: (value: any, record?: any) => string[];
|
|
37
37
|
}
|
|
38
|
-
export interface ProTableProps extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
38
|
+
export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
39
39
|
tableId?: string;
|
|
40
40
|
rowKey?: string | GetRowKey<any>;
|
|
41
41
|
headerRender?: ReactNode | (() => ReactNode);
|
|
@@ -49,6 +49,10 @@ export interface ProTableProps extends Omit<TableProps<any>, 'summary' | 'column
|
|
|
49
49
|
footerRender?: ReactNode | (() => ReactNode);
|
|
50
50
|
emptyText?: string | ReactNode | (() => ReactNode);
|
|
51
51
|
summary?: ProTableSummaryProps | TableProps<any>['summary'];
|
|
52
|
+
draggable?: boolean;
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
isView?: boolean;
|
|
55
|
+
rowDisabled?: (record?: T) => string | boolean;
|
|
52
56
|
/**
|
|
53
57
|
* 斑马纹设置
|
|
54
58
|
*/
|
|
@@ -2,6 +2,90 @@
|
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
4
|
.pro-table {
|
|
5
|
+
&.pro-table-draggable-only{
|
|
6
|
+
.ant-table-tbody{
|
|
7
|
+
.anticon {
|
|
8
|
+
margin-right: 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.@{ant-prefix}-table-content {
|
|
14
|
+
>table {
|
|
15
|
+
.@{ant-prefix}-table-summary {
|
|
16
|
+
background-color: var(--zaui-table-header-bg, #f2f3f5);
|
|
17
|
+
color : var(--zaui-text, #343434);
|
|
18
|
+
font-weight : 600;
|
|
19
|
+
|
|
20
|
+
.@{ant-prefix}-table-cell-fix-left,
|
|
21
|
+
.@{ant-prefix}-table-cell-fix-right {
|
|
22
|
+
background-color: var(--zaui-table-header-bg, #f2f3f5);
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
th.@{ant-prefix}-table-selection-column {
|
|
28
|
+
width: 48px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
td {
|
|
32
|
+
.pro-form-view-container_nowrap {
|
|
33
|
+
white-space: normal;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.@{ant-prefix}-table-thead>tr>th:not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan]).is-required {
|
|
38
|
+
&.is-required-right {
|
|
39
|
+
.pro-edit-table-title {
|
|
40
|
+
&::before {
|
|
41
|
+
position : static;
|
|
42
|
+
top : 0;
|
|
43
|
+
display : inline-block;
|
|
44
|
+
text-indent: -8px;
|
|
45
|
+
color : #ff5050;
|
|
46
|
+
font-size : var(--zaui-font-size-md, 14px);
|
|
47
|
+
line-height: 1;
|
|
48
|
+
content : "*";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&.is-required-left {
|
|
53
|
+
.pro-edit-table-title {
|
|
54
|
+
&::after {
|
|
55
|
+
width: auto;
|
|
56
|
+
position : static;
|
|
57
|
+
top : 0;
|
|
58
|
+
display : inline-block;
|
|
59
|
+
margin-left: var(--zaui-space-size-xs, 4px);
|
|
60
|
+
color : #ff5050;
|
|
61
|
+
font-size : 14px;
|
|
62
|
+
line-height: 1;
|
|
63
|
+
content : "*";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
.drag-wrapper {
|
|
71
|
+
display: flex;
|
|
72
|
+
width: 20px;
|
|
73
|
+
.anticon {
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
margin-right: 12px;
|
|
76
|
+
.drag-icon{
|
|
77
|
+
margin-right: 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
.drag-wrapper.no-check {
|
|
82
|
+
.anticon {
|
|
83
|
+
margin-right: 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
5
89
|
&.pro-table-bordered {
|
|
6
90
|
.@{ant-prefix}-table .@{ant-prefix}-table-thead > tr > th {
|
|
7
91
|
border-bottom: 1px solid #f0f0f0;
|
|
@@ -465,3 +549,9 @@
|
|
|
465
549
|
}
|
|
466
550
|
}
|
|
467
551
|
}
|
|
552
|
+
|
|
553
|
+
.pro-edit-table-drag {
|
|
554
|
+
table tr th.@{ant-prefix}-table-selection-column.@{ant-prefix}-table-cell-fix-left{
|
|
555
|
+
text-align: right;
|
|
556
|
+
}
|
|
557
|
+
}
|
package/lib/ProTree/utils.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function getAllKeys(data: TreeDataProps[], fieldNames: FieldNames
|
|
|
22
22
|
export declare const getParentKey: (key: string, tree: TreeDataProps[], fieldNames: FieldNamesType) => string;
|
|
23
23
|
export declare function findTreeNodeByKey(treeData: TreeDataProps[], key: string, fieldNames: FieldNamesType): TreeDataProps[];
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 过滤掉每一层假值(例如 false、null、0、""、undefined 等)
|
|
26
26
|
* @param data
|
|
27
27
|
* @param checkedKeys
|
|
28
28
|
* @returns
|
package/lib/ProTree/utils.js
CHANGED
|
@@ -260,10 +260,16 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
260
260
|
}
|
|
261
261
|
onChange === null || onChange === void 0 ? void 0 : onChange(values);
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
// fix: 当有 openChange 时候、点击确定应该由关闭 openChange 控制
|
|
264
|
+
if (!openChange || open === undefined) {
|
|
265
|
+
setState({
|
|
266
|
+
open: false
|
|
267
|
+
});
|
|
268
|
+
openChange === null || openChange === void 0 ? void 0 : openChange(false);
|
|
269
|
+
}
|
|
270
|
+
if (openChange && open !== undefined) {
|
|
271
|
+
openChange === null || openChange === void 0 ? void 0 : openChange(true);
|
|
272
|
+
}
|
|
267
273
|
};
|
|
268
274
|
/**
|
|
269
275
|
* clear all checked
|