@zat-design/sisyphus-react 3.6.9-beta.7 → 3.6.10-beta.2
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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/dist/index.esm.css +41 -41
- package/dist/less.esm.css +41 -41
- package/es/ProEditTable/components/RenderField/index.js +46 -27
- package/es/ProForm/components/combination/ProCascader/index.js +14 -8
- package/es/ProForm/components/render/Render.js +37 -17
- package/es/ProForm/style/index.less +52 -52
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +27 -4
- package/es/ProForm/utils/useChanged.js +2 -1
- package/es/ProForm/utils/useListChanged.js +3 -3
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +106 -40
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +14 -1
- package/es/ProTable/index.js +6 -2
- package/es/ProTable/propsType.d.ts +22 -0
- package/es/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
- package/es/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
- package/es/ProThemeTools/component/index.d.ts +2 -1
- package/es/ProThemeTools/component/index.js +2 -1
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProThemeTools/style/index.less +1 -1
- package/es/ProTreeModal/components/List.js +30 -4
- package/lib/ProEditTable/components/RenderField/index.js +41 -26
- package/lib/ProForm/components/combination/ProCascader/index.js +12 -6
- package/lib/ProForm/components/render/Render.js +35 -17
- package/lib/ProForm/style/index.less +52 -52
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +27 -3
- package/lib/ProForm/utils/useChanged.js +2 -1
- package/lib/ProForm/utils/useListChanged.js +2 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +3 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +106 -40
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +13 -1
- package/lib/ProTable/index.js +6 -2
- package/lib/ProTable/propsType.d.ts +22 -0
- package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
- package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
- package/lib/ProThemeTools/component/index.d.ts +2 -1
- package/lib/ProThemeTools/component/index.js +3 -3
- package/lib/ProThemeTools/index.js +1 -1
- package/lib/ProThemeTools/style/index.less +1 -1
- package/lib/ProTreeModal/components/List.js +30 -4
- package/package.json +1 -1
- package/es/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
- package/es/ProEditTable/components/RenderField/ListChanged.js +0 -124
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/es/ProForm/components/render/Changed.js +0 -64
- package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
- package/lib/ProEditTable/components/RenderField/ListChanged.js +0 -129
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.js +0 -69
- /package/es/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
- /package/lib/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Row = void 0;
|
|
8
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -12,6 +14,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
14
|
var _core = require("@dnd-kit/core");
|
|
13
15
|
var _sortable = require("@dnd-kit/sortable");
|
|
14
16
|
var _utilities = require("@dnd-kit/utilities");
|
|
17
|
+
var _lodash = require("lodash");
|
|
15
18
|
var _index = require("./utils/index");
|
|
16
19
|
var _ProIcon = _interopRequireDefault(require("../../../../../../../ProIcon"));
|
|
17
20
|
var _excluded = ["disabled", "children"];
|
|
@@ -74,48 +77,110 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
74
77
|
onChange = _ref2.onChange,
|
|
75
78
|
disabled = _ref2.disabled,
|
|
76
79
|
children = _ref2.children,
|
|
77
|
-
rowKey = _ref2.rowKey
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
overParentId = overObject.parentId;
|
|
96
|
-
if (activeLevel === overLevel && activeParentId === overParentId) {
|
|
97
|
-
// 将树平铺
|
|
98
|
-
var _flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
|
|
99
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
100
|
-
children: undefined
|
|
80
|
+
rowKey = _ref2.rowKey,
|
|
81
|
+
onDragStartGuard = _ref2.onDragStartGuard,
|
|
82
|
+
onDragEndGuard = _ref2.onDragEndGuard;
|
|
83
|
+
var onDragStart = /*#__PURE__*/function () {
|
|
84
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_ref3) {
|
|
85
|
+
var active, transformedValue, activeObject;
|
|
86
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
87
|
+
while (1) switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
active = _ref3.active;
|
|
90
|
+
if (!(onDragStartGuard && (0, _lodash.isFunction)(onDragStartGuard))) {
|
|
91
|
+
_context.next = 6;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
// 为数据源划分层级及parentId
|
|
95
|
+
transformedValue = (0, _index.addLevelAndParentId)(value, rowKey);
|
|
96
|
+
activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
|
97
|
+
return t.rowKey === active.id;
|
|
101
98
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onChange((0, _index.createTreeFromArray)(nextValue, {
|
|
111
|
-
itemKey: 'rowKey',
|
|
112
|
-
parentKey: 'parentId',
|
|
113
|
-
childrenKey: 'children'
|
|
114
|
-
}));
|
|
99
|
+
_context.next = 6;
|
|
100
|
+
return onDragStartGuard({
|
|
101
|
+
activeObject: activeObject,
|
|
102
|
+
currentDataSource: value
|
|
103
|
+
});
|
|
104
|
+
case 6:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context.stop();
|
|
115
107
|
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
108
|
+
}, _callee);
|
|
109
|
+
}));
|
|
110
|
+
return function onDragStart(_x) {
|
|
111
|
+
return _ref4.apply(this, arguments);
|
|
112
|
+
};
|
|
113
|
+
}();
|
|
114
|
+
var onDragEnd = /*#__PURE__*/function () {
|
|
115
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(_ref5) {
|
|
116
|
+
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
|
117
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
118
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
active = _ref5.active, over = _ref5.over;
|
|
121
|
+
// 为数据源划分层级及parentId
|
|
122
|
+
transformedValue = (0, _index.addLevelAndParentId)(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
|
|
123
|
+
if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
|
|
124
|
+
_context2.next = 15;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
activeObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
|
128
|
+
return t.rowKey === active.id;
|
|
129
|
+
});
|
|
130
|
+
overObject = (0, _index.treeNodeFind)(transformedValue, function (t) {
|
|
131
|
+
return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
132
|
+
});
|
|
133
|
+
if (!(activeObject && overObject)) {
|
|
134
|
+
_context2.next = 15;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
activeLevel = activeObject.level, activeParentId = activeObject.parentId;
|
|
138
|
+
overLevel = overObject.level, overParentId = overObject.parentId; // 如果传了onDragEndGuard 则视为外部业务逻辑自处理
|
|
139
|
+
if (!(onDragEndGuard && (0, _lodash.isFunction)(onDragEndGuard))) {
|
|
140
|
+
_context2.next = 14;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
_context2.next = 11;
|
|
144
|
+
return onDragEndGuard({
|
|
145
|
+
activeObject: activeObject,
|
|
146
|
+
overObject: overObject,
|
|
147
|
+
currentDataSource: value
|
|
148
|
+
});
|
|
149
|
+
case 11:
|
|
150
|
+
nextDataSource = _context2.sent;
|
|
151
|
+
onChange(nextDataSource !== null && nextDataSource !== void 0 ? nextDataSource : []);
|
|
152
|
+
return _context2.abrupt("return");
|
|
153
|
+
case 14:
|
|
154
|
+
if (activeLevel === overLevel && activeParentId === overParentId) {
|
|
155
|
+
// 将树平铺
|
|
156
|
+
_flatTree = (0, _index.transformTreeToArray)(transformedValue).map(function (item) {
|
|
157
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
158
|
+
children: undefined
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
activeIndex = _flatTree.findIndex(function (i) {
|
|
162
|
+
return i.rowKey === active.id;
|
|
163
|
+
});
|
|
164
|
+
overIndex = _flatTree.findIndex(function (i) {
|
|
165
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
|
166
|
+
});
|
|
167
|
+
nextValue = (0, _sortable.arrayMove)(_flatTree, activeIndex, overIndex);
|
|
168
|
+
onChange((0, _index.createTreeFromArray)(nextValue, {
|
|
169
|
+
itemKey: 'rowKey',
|
|
170
|
+
parentKey: 'parentId',
|
|
171
|
+
childrenKey: 'children'
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
case 15:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context2.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee2);
|
|
179
|
+
}));
|
|
180
|
+
return function onDragEnd(_x2) {
|
|
181
|
+
return _ref6.apply(this, arguments);
|
|
182
|
+
};
|
|
183
|
+
}();
|
|
119
184
|
// 将树平铺
|
|
120
185
|
var flatTree = (0, _index.transformTreeToArray)(value).map(function (item) {
|
|
121
186
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
@@ -123,6 +188,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
123
188
|
});
|
|
124
189
|
});
|
|
125
190
|
return draggable && !disabled ? (0, _jsxRuntime.jsx)(_core.DndContext, {
|
|
191
|
+
onDragStart: onDragStart,
|
|
126
192
|
onDragEnd: onDragEnd,
|
|
127
193
|
collisionDetection: _core.closestCorners,
|
|
128
194
|
children: (0, _jsxRuntime.jsx)(_sortable.SortableContext, {
|
|
@@ -15,6 +15,14 @@ var _DndWrapper = _interopRequireWildcard(require("./components/DndWrapper"));
|
|
|
15
15
|
var _index = require("../../../index");
|
|
16
16
|
require("../../../../style/index.less");
|
|
17
17
|
var _excluded = ["dataSource", "tableProps", "draggableProps", "summaryProps", "emptyTextProps"];
|
|
18
|
+
/*
|
|
19
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
20
|
+
* @Date: 2024-08-09 13:48:59
|
|
21
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
22
|
+
* @LastEditTime: 2024-08-20 19:31:24
|
|
23
|
+
* @FilePath: /za-material-warehouse/src/ProTable/components/RcTable/components/DraggableTable/index.tsx
|
|
24
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
25
|
+
*/
|
|
18
26
|
var DraggableTable = function DraggableTable(_ref) {
|
|
19
27
|
var dataSource = _ref.dataSource,
|
|
20
28
|
tableProps = _ref.tableProps,
|
|
@@ -28,13 +36,17 @@ var DraggableTable = function DraggableTable(_ref) {
|
|
|
28
36
|
disabled = tableProps.disabled;
|
|
29
37
|
var onChange = draggableProps.onChange,
|
|
30
38
|
draggable = draggableProps.draggable,
|
|
31
|
-
rowKey = draggableProps.rowKey
|
|
39
|
+
rowKey = draggableProps.rowKey,
|
|
40
|
+
onDragStartGuard = draggableProps.onDragStartGuard,
|
|
41
|
+
onDragEndGuard = draggableProps.onDragEndGuard;
|
|
32
42
|
return (0, _jsxRuntime.jsx)(_DndWrapper.default, {
|
|
33
43
|
value: dataSource !== null && dataSource !== void 0 ? dataSource : [],
|
|
34
44
|
onChange: onChange,
|
|
35
45
|
disabled: disabled,
|
|
36
46
|
draggable: draggable,
|
|
37
47
|
rowKey: rowKey,
|
|
48
|
+
onDragStartGuard: onDragStartGuard,
|
|
49
|
+
onDragEndGuard: onDragEndGuard,
|
|
38
50
|
children: (0, _jsxRuntime.jsx)(_antd.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
39
51
|
className: "pro-edit-table-drag",
|
|
40
52
|
components: {
|
package/lib/ProTable/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var _reset = _interopRequireDefault(require("../assets/reset.svg"));
|
|
|
27
27
|
var _customColumn = _interopRequireDefault(require("../assets/customColumn.svg"));
|
|
28
28
|
var _utils = require("./utils");
|
|
29
29
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
30
|
-
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource"],
|
|
30
|
+
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource", "onDragStart", "onDragEnd"],
|
|
31
31
|
_excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
|
|
32
32
|
var defaultCacheTime = 1; // columns 配置保存时间为一天
|
|
33
33
|
// 全局上下文
|
|
@@ -60,6 +60,8 @@ function ProTable(props) {
|
|
|
60
60
|
_props$emptyText = props.emptyText,
|
|
61
61
|
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,
|
|
62
62
|
originalDataSource = props.originalDataSource,
|
|
63
|
+
onDragStartGuard = props.onDragStart,
|
|
64
|
+
onDragEndGuard = props.onDragEnd,
|
|
63
65
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
64
66
|
var quickTableConfig = quickConfig ? (0, _objectSpread4.default)({
|
|
65
67
|
columnConfig: true,
|
|
@@ -359,7 +361,9 @@ function ProTable(props) {
|
|
|
359
361
|
draggableProps: {
|
|
360
362
|
onChange: onDataSourceChange,
|
|
361
363
|
draggable: draggable,
|
|
362
|
-
rowKey: rowKey
|
|
364
|
+
rowKey: rowKey,
|
|
365
|
+
onDragStartGuard: onDragStartGuard,
|
|
366
|
+
onDragEndGuard: onDragEndGuard
|
|
363
367
|
},
|
|
364
368
|
tableProps: {
|
|
365
369
|
value: _dataSource,
|
|
@@ -41,6 +41,23 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
|
41
41
|
toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
|
|
42
42
|
transform?: (value: any, record?: any) => string[];
|
|
43
43
|
}
|
|
44
|
+
export interface CreateTreeFromArrayOptions {
|
|
45
|
+
itemKey?: string;
|
|
46
|
+
parentKey?: string;
|
|
47
|
+
childrenKey?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface DragCommonGuardProps<T> {
|
|
50
|
+
event: T;
|
|
51
|
+
}
|
|
52
|
+
export interface DragEndGuardProps {
|
|
53
|
+
activeObject: any;
|
|
54
|
+
overObject?: any;
|
|
55
|
+
currentDataSource: any[];
|
|
56
|
+
}
|
|
57
|
+
export interface DragStartGuardProps {
|
|
58
|
+
activeObject: any;
|
|
59
|
+
currentDataSource: any[];
|
|
60
|
+
}
|
|
44
61
|
export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
45
62
|
tableId?: string;
|
|
46
63
|
rowKey?: string | GetRowKey<any>;
|
|
@@ -67,6 +84,11 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
|
|
|
67
84
|
stripe?: boolean;
|
|
68
85
|
columns: ProTableColumn[];
|
|
69
86
|
originalDataSource?: any[];
|
|
87
|
+
/**
|
|
88
|
+
* 拖拽额外配置
|
|
89
|
+
*/
|
|
90
|
+
onDragStart?: DragStartGuardProps;
|
|
91
|
+
onDragEnd?: DragEndGuardProps;
|
|
70
92
|
}
|
|
71
93
|
export type ProTableValueType = 'percentage' | 'permillage' | 'thousandth' | 'datePicker' | 'enumName' | 'enumCodeName' | 'address' | 'thousandthCNY' | 'date' | 'dateTime' | 'dateStartTime' | 'dateEndTime' | 'dateStartEndTime';
|
|
72
94
|
export interface Response<T = any> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { DevToolsPropsType } from '../../propsType';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const PrdTools: ({ onReset, onClose, setState, open, state, tableBorder, tableStripe, }: DevToolsPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default PrdTools;
|
|
@@ -21,7 +21,7 @@ var connect = function connect(Component) {
|
|
|
21
21
|
return ComponentWrapper;
|
|
22
22
|
};
|
|
23
23
|
var NewDrawer = connect(_antd.Drawer);
|
|
24
|
-
var
|
|
24
|
+
var PrdTools = function PrdTools(_ref) {
|
|
25
25
|
var onReset = _ref.onReset,
|
|
26
26
|
onClose = _ref.onClose,
|
|
27
27
|
setState = _ref.setState,
|
|
@@ -266,4 +266,4 @@ var ProTools = function ProTools(_ref) {
|
|
|
266
266
|
})]
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
|
-
var _default = exports.default =
|
|
269
|
+
var _default = exports.default = PrdTools;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="typings" />
|
|
2
|
+
export { default as PrdTools } from './PrdTools';
|
|
@@ -4,10 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "PrdTools", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
10
|
-
return
|
|
10
|
+
return _PrdTools.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var
|
|
13
|
+
var _PrdTools = _interopRequireDefault(require("./PrdTools"));
|
|
@@ -186,7 +186,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
|
|
|
186
186
|
className: "setting-icon",
|
|
187
187
|
src: _setting.default
|
|
188
188
|
})
|
|
189
|
-
}), (0, _jsxRuntime.jsx)(_component.
|
|
189
|
+
}), (0, _jsxRuntime.jsx)(_component.PrdTools, {
|
|
190
190
|
prefixCls: prefixCls,
|
|
191
191
|
onReset: onReset,
|
|
192
192
|
onClose: toggle,
|
|
@@ -125,11 +125,32 @@ function List(props, ref) {
|
|
|
125
125
|
document.body.removeChild(temp);
|
|
126
126
|
return len * 20;
|
|
127
127
|
}
|
|
128
|
+
var handleCommonTitle = function handleCommonTitle(item) {
|
|
129
|
+
if (isCASCADER) {
|
|
130
|
+
return item === null || item === void 0 ? void 0 : item.title;
|
|
131
|
+
}
|
|
132
|
+
return item[fieldNameLabel];
|
|
133
|
+
};
|
|
134
|
+
var handleGetTitle = function handleGetTitle(item) {
|
|
135
|
+
if (showCodeName) {
|
|
136
|
+
if (isCASCADER) {
|
|
137
|
+
if (item[fieldNameValue] && (item === null || item === void 0 ? void 0 : item.title)) {
|
|
138
|
+
return "".concat(item[fieldNameValue], "-").concat(item.title);
|
|
139
|
+
}
|
|
140
|
+
return handleCommonTitle(item);
|
|
141
|
+
}
|
|
142
|
+
if (item[fieldNameValue] && item[fieldNameValue]) {
|
|
143
|
+
return "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]);
|
|
144
|
+
}
|
|
145
|
+
return handleCommonTitle(item);
|
|
146
|
+
}
|
|
147
|
+
return handleCommonTitle(item);
|
|
148
|
+
};
|
|
128
149
|
var _useVirtualList = (0, _ahooks.useVirtualList)(originalList, {
|
|
129
150
|
containerTarget: containerRef,
|
|
130
151
|
wrapperTarget: wrapperRef,
|
|
131
152
|
itemHeight: function itemHeight(index, item) {
|
|
132
|
-
var title =
|
|
153
|
+
var title = handleGetTitle(item);
|
|
133
154
|
return Math.floor(getLineHeight(title, 406)) + 12;
|
|
134
155
|
}
|
|
135
156
|
}),
|
|
@@ -185,7 +206,7 @@ function List(props, ref) {
|
|
|
185
206
|
children: (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
186
207
|
children: list.map(function (_item) {
|
|
187
208
|
var item = _item.data;
|
|
188
|
-
var title =
|
|
209
|
+
var title = handleGetTitle(item);
|
|
189
210
|
var content = optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, {
|
|
190
211
|
label: title,
|
|
191
212
|
searchStr: searchStr
|
|
@@ -223,7 +244,7 @@ function List(props, ref) {
|
|
|
223
244
|
value: checkedValues,
|
|
224
245
|
children: (0, _jsxRuntime.jsx)(_antd.Row, {
|
|
225
246
|
children: treeData.map(function (item) {
|
|
226
|
-
var title =
|
|
247
|
+
var title = handleGetTitle(item);
|
|
227
248
|
var content = optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, {
|
|
228
249
|
label: title,
|
|
229
250
|
searchStr: searchStr
|
|
@@ -260,7 +281,12 @@ function List(props, ref) {
|
|
|
260
281
|
ref: wrapperRef,
|
|
261
282
|
children: list.map(function (_item) {
|
|
262
283
|
var item = _item.data;
|
|
263
|
-
var title =
|
|
284
|
+
var title = item[fieldNameLabel];
|
|
285
|
+
if (showCodeName) {
|
|
286
|
+
if (item[fieldNameValue] && item[fieldNameLabel]) {
|
|
287
|
+
title = "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
264
290
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
265
291
|
className: "pro-tree-modal-checkbox-content",
|
|
266
292
|
children: [(0, _jsxRuntime.jsx)("div", {
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd';
|
|
3
|
-
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
-
interface Props {
|
|
5
|
-
name?: NamePath;
|
|
6
|
-
names?: NamePath[];
|
|
7
|
-
originalName?: NamePath;
|
|
8
|
-
originalNames?: NamePath[];
|
|
9
|
-
namesStr?: NamePath;
|
|
10
|
-
originalValues?: any;
|
|
11
|
-
form: FormInstance;
|
|
12
|
-
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
13
|
-
[name: string]: any;
|
|
14
|
-
}
|
|
15
|
-
declare const ListChanged: React.FC<Props>;
|
|
16
|
-
export default ListChanged;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import "antd/es/space/style";
|
|
2
|
-
import _Space from "antd/es/space";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type"];
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
import React, { useMemo } from 'react';
|
|
10
|
-
import { get } from 'lodash';
|
|
11
|
-
import { diffOriginal } from '../../../ProForm/utils/diffOriginal';
|
|
12
|
-
var toNamePath = function toNamePath(name) {
|
|
13
|
-
if (Array.isArray(name)) {
|
|
14
|
-
return name;
|
|
15
|
-
}
|
|
16
|
-
return [name];
|
|
17
|
-
};
|
|
18
|
-
var toNamePaths = function toNamePaths(names) {
|
|
19
|
-
return names.map(function (name) {
|
|
20
|
-
return toNamePath(name);
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var getOriginalValue = function getOriginalValue(_ref) {
|
|
24
|
-
var namePath = _ref.namePath,
|
|
25
|
-
originalName = _ref.originalName,
|
|
26
|
-
originalNames = _ref.originalNames,
|
|
27
|
-
originalValues = _ref.originalValues,
|
|
28
|
-
rowKeyPath = _ref.rowKeyPath,
|
|
29
|
-
form = _ref.form;
|
|
30
|
-
if (!originalValues) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
if (rowKeyPath) {
|
|
34
|
-
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
35
|
-
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
36
|
-
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
37
|
-
if (!rowValue) return undefined;
|
|
38
|
-
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
39
|
-
if (!keyValue) return undefined;
|
|
40
|
-
var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
41
|
-
var originalValueRow = originalValueList.find(function (item) {
|
|
42
|
-
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
43
|
-
});
|
|
44
|
-
var originalValue;
|
|
45
|
-
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
|
46
|
-
var originalNamesValue = originalNames.map(function (originalName) {
|
|
47
|
-
return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
48
|
-
});
|
|
49
|
-
// 有可能出现数组中全是undefined的情况 视为没有值
|
|
50
|
-
var fillUndefined = originalNamesValue.every(function (valItem) {
|
|
51
|
-
return valItem === undefined;
|
|
52
|
-
});
|
|
53
|
-
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
54
|
-
} else {
|
|
55
|
-
originalValue = get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
56
|
-
}
|
|
57
|
-
return originalValue;
|
|
58
|
-
}
|
|
59
|
-
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
60
|
-
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
61
|
-
return get(originalValues, originalName);
|
|
62
|
-
}) : get(originalValues, originalName);
|
|
63
|
-
};
|
|
64
|
-
var ListChanged = function ListChanged(props) {
|
|
65
|
-
var name = props.name,
|
|
66
|
-
names = props.names,
|
|
67
|
-
namesStr = props.namesStr,
|
|
68
|
-
_props$originalName = props.originalName,
|
|
69
|
-
originalName = _props$originalName === void 0 ? name : _props$originalName,
|
|
70
|
-
_props$originalNames = props.originalNames,
|
|
71
|
-
originalNames = _props$originalNames === void 0 ? names : _props$originalNames,
|
|
72
|
-
originalValues = props.originalValues,
|
|
73
|
-
form = props.form,
|
|
74
|
-
equalWith = props.equalWith,
|
|
75
|
-
rowKeyPath = props.rowKeyPath,
|
|
76
|
-
children = props.children,
|
|
77
|
-
type = props.type,
|
|
78
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
79
|
-
var namePath = toNamePath(namesStr || name);
|
|
80
|
-
var originalNamePath = toNamePath(originalName);
|
|
81
|
-
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
82
|
-
var notWatch = !originalValues || ['FormList', 'ProEditTable'].includes(type);
|
|
83
|
-
var originalValue = !notWatch ? getOriginalValue({
|
|
84
|
-
namePath: namePath,
|
|
85
|
-
originalName: originalNamePath,
|
|
86
|
-
originalNames: originalNamePaths,
|
|
87
|
-
originalValues: originalValues,
|
|
88
|
-
rowKeyPath: rowKeyPath,
|
|
89
|
-
form: form
|
|
90
|
-
}) : undefined;
|
|
91
|
-
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
92
|
-
var changed = useMemo(function () {
|
|
93
|
-
if (notWatch || noChange) return false;
|
|
94
|
-
return diffOriginal({
|
|
95
|
-
value: props.value,
|
|
96
|
-
originalValue: originalValue,
|
|
97
|
-
form: form,
|
|
98
|
-
equalWith: equalWith
|
|
99
|
-
// name: isString(namesStr) ? namesStr : originalName || name,
|
|
100
|
-
});
|
|
101
|
-
}, [props.value, originalValue]);
|
|
102
|
-
if (notWatch || noChange) {
|
|
103
|
-
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
104
|
-
}
|
|
105
|
-
return _jsx(_Tooltip, {
|
|
106
|
-
open: changed ? undefined : false,
|
|
107
|
-
getPopupContainer: function getPopupContainer(target) {
|
|
108
|
-
return target.parentElement;
|
|
109
|
-
},
|
|
110
|
-
title: _jsxs(_Space, {
|
|
111
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, {
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
isView: true,
|
|
114
|
-
value: originalValue,
|
|
115
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
116
|
-
})) : undefined]
|
|
117
|
-
}),
|
|
118
|
-
children: _jsx("div", {
|
|
119
|
-
className: changed ? 'pro-form-item-changed' : '',
|
|
120
|
-
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
export default ListChanged;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FormInstance } from 'antd';
|
|
2
|
-
import { NamePath } from 'antd/lib/form/interface';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
interface Props {
|
|
5
|
-
name?: NamePath;
|
|
6
|
-
names?: NamePath[];
|
|
7
|
-
namesStr?: string;
|
|
8
|
-
originalValues?: any;
|
|
9
|
-
form: FormInstance;
|
|
10
|
-
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
11
|
-
[name: string]: any;
|
|
12
|
-
}
|
|
13
|
-
declare const Changed: React.FC<Props>;
|
|
14
|
-
export default Changed;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import "antd/es/space/style";
|
|
2
|
-
import _Space from "antd/es/space";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["name", "names", "namesStr", "originalValues", "form", "equalWith", "children", "type", "originalDiffTip"];
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { get } from 'lodash';
|
|
10
|
-
import React, { useMemo } from 'react';
|
|
11
|
-
import { diffOriginal } from '../../utils/diffOriginal';
|
|
12
|
-
var Changed = function Changed(props) {
|
|
13
|
-
var name = props.name,
|
|
14
|
-
names = props.names,
|
|
15
|
-
namesStr = props.namesStr,
|
|
16
|
-
originalValues = props.originalValues,
|
|
17
|
-
form = props.form,
|
|
18
|
-
equalWith = props.equalWith,
|
|
19
|
-
children = props.children,
|
|
20
|
-
type = props.type,
|
|
21
|
-
originalDiffTip = props.originalDiffTip,
|
|
22
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
23
|
-
// 不渲染tooltip
|
|
24
|
-
var notWatch = !originalDiffTip || ['FormList', 'ProEditTable'].includes(type);
|
|
25
|
-
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
26
|
-
return get(originalValues, name);
|
|
27
|
-
}) : get(originalValues, name);
|
|
28
|
-
var noChange = !equalWith && (!originalValues || originalValue === undefined);
|
|
29
|
-
var changed = useMemo(function () {
|
|
30
|
-
if (notWatch || noChange) return false;
|
|
31
|
-
return diffOriginal({
|
|
32
|
-
originalValue: originalValue,
|
|
33
|
-
value: props.value,
|
|
34
|
-
form: form,
|
|
35
|
-
equalWith: equalWith
|
|
36
|
-
// name: namesStr || name,
|
|
37
|
-
});
|
|
38
|
-
}, [notWatch, noChange, props.value, originalValue]);
|
|
39
|
-
var tipContent = useMemo(function () {
|
|
40
|
-
if (notWatch || noChange) return undefined;
|
|
41
|
-
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, {
|
|
42
|
-
isView: true,
|
|
43
|
-
value: originalValue,
|
|
44
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
45
|
-
})) : undefined;
|
|
46
|
-
}, [originalValue, children]);
|
|
47
|
-
if (notWatch || noChange) {
|
|
48
|
-
return /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest));
|
|
49
|
-
}
|
|
50
|
-
return _jsx(_Tooltip, {
|
|
51
|
-
open: changed ? undefined : false,
|
|
52
|
-
getPopupContainer: function getPopupContainer(target) {
|
|
53
|
-
return target.parentElement;
|
|
54
|
-
},
|
|
55
|
-
title: _jsxs(_Space, {
|
|
56
|
-
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
57
|
-
}),
|
|
58
|
-
children: _jsx("div", {
|
|
59
|
-
className: changed ? 'pro-form-item-changed' : '',
|
|
60
|
-
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), rest)) : undefined
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export default Changed;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd';
|
|
3
|
-
import { NamePath } from 'antd/lib/form/interface';
|
|
4
|
-
interface Props {
|
|
5
|
-
name?: NamePath;
|
|
6
|
-
names?: NamePath[];
|
|
7
|
-
originalName?: NamePath;
|
|
8
|
-
originalNames?: NamePath[];
|
|
9
|
-
namesStr?: NamePath;
|
|
10
|
-
originalValues?: any;
|
|
11
|
-
form: FormInstance;
|
|
12
|
-
equalWith?: (preValue: any, curValue: any) => boolean | undefined;
|
|
13
|
-
[name: string]: any;
|
|
14
|
-
}
|
|
15
|
-
declare const ListChanged: React.FC<Props>;
|
|
16
|
-
export default ListChanged;
|