@lemon-fe/kits 1.0.2-0 → 1.0.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/es/components/DataGrid/cell-editors/Date.d.ts +10 -3
- package/es/components/DataGrid/cell-editors/Date.js +15 -3
- package/es/components/DataGrid/cell-editors/Select.d.ts +2 -2
- package/es/components/DataGrid/components/CustomColumnPanel/DragContext.d.ts +4 -0
- package/es/components/DataGrid/components/CustomColumnPanel/DragContext.js +3 -0
- package/es/components/DataGrid/components/CustomColumnPanel/FieldModal.d.ts +10 -0
- package/es/components/DataGrid/components/CustomColumnPanel/FieldModal.js +256 -0
- package/es/components/DataGrid/components/CustomColumnPanel/Item.d.ts +14 -0
- package/es/components/DataGrid/components/CustomColumnPanel/Item.js +200 -0
- package/es/components/DataGrid/components/CustomColumnPanel/index.d.ts +5 -0
- package/es/components/DataGrid/components/CustomColumnPanel/index.js +366 -0
- package/es/components/DataGrid/components/CustomColumnPanel/typings.d.ts +25 -0
- package/es/components/DataGrid/components/Search.js +2 -2
- package/es/components/DataGrid/components/Selected.js +3 -3
- package/es/components/DataGrid/index.d.ts +16 -7
- package/es/components/DataGrid/index.js +838 -364
- package/es/components/DataGrid/index.less +261 -8
- package/es/components/DataGrid/renderer/CellDeleteRenderer.d.ts +1 -1
- package/es/components/DataGrid/renderer/CellDeleteRenderer.js +49 -12
- package/es/components/DataGrid/renderer/CellIndexRenderer.js +6 -1
- package/es/components/DataGrid/renderer/DetailCellRenderer.d.ts +1 -0
- package/es/components/DataGrid/renderer/DetailCellRenderer.js +6 -3
- package/es/components/DataGrid/typings.d.ts +24 -5
- package/es/components/DataGrid/utils.d.ts +3 -1
- package/es/components/DataGrid/utils.js +13 -3
- package/es/components/Dropdown/index.d.ts +7 -8
- package/es/components/Dropdown/index.js +40 -47
- package/es/components/Dropdown/index.less +2 -10
- package/es/components/DurationPicker/index.d.ts +3 -1
- package/es/components/DurationPicker/index.js +13 -4
- package/es/components/Filter/index.d.ts +1 -1
- package/es/components/Filter/index.js +22 -8
- package/es/components/Filter/typings.d.ts +6 -1
- package/es/components/FormLayout/index.less +6 -2
- package/es/components/GreyPanel/index.less +5 -0
- package/es/components/Icons/Clear.d.ts +1 -1
- package/es/components/Icons/Clear.js +1 -2
- package/es/components/Icons/Drag/drag.svg +7 -0
- package/es/components/Icons/Drag/index.d.ts +3 -0
- package/es/components/Icons/Drag/index.js +34 -0
- package/es/components/Icons/NewTag.d.ts +3 -0
- package/es/components/Icons/NewTag.js +22 -0
- package/es/components/Icons/Plus/index.d.ts +3 -0
- package/es/components/Icons/Plus/index.js +30 -0
- package/es/components/Icons/Plus/plus.svg +6 -0
- package/es/components/Icons/Reload.d.ts +3 -0
- package/es/components/Icons/Reload.js +21 -0
- package/es/components/Icons/Tip.d.ts +1 -1
- package/es/components/Icons/Tip.js +1 -0
- package/es/components/Icons/index.d.ts +8 -0
- package/es/components/Icons/index.js +9 -1
- package/es/components/InputCompact/index.d.ts +1 -0
- package/es/components/InputCompact/index.js +19 -8
- package/es/components/InputCompact/index.less +15 -0
- package/es/components/InputNumber/index.d.ts +1 -1
- package/es/components/InputNumber/index.js +3 -1
- package/es/components/Layout/index.less +2 -1
- package/es/components/Popup/index.d.ts +1 -1
- package/es/components/Popup/index.js +68 -41
- package/es/components/Popup/index.less +3 -0
- package/es/components/SelectPanel/index.d.ts +17 -0
- package/es/components/SelectPanel/index.js +70 -0
- package/es/components/SelectPanel/index.less +112 -0
- package/es/components/SelectView/index.d.ts +6 -2
- package/es/components/SelectView/index.js +75 -40
- package/es/components/SelectView/index.less +19 -6
- package/es/components/SiderTree/index.js +2 -9
- package/es/components/SiderTree/index.less +6 -26
- package/es/components/State/index.d.ts +1 -1
- package/es/components/State/index.js +13 -3
- package/es/components/State/index.less +6 -1
- package/es/hooks/useBatchOperator/index.d.ts +40 -4
- package/es/hooks/useBatchOperator/index.js +591 -356
- package/es/hooks/useHistoryBlock/index.d.ts +8 -0
- package/es/hooks/useHistoryBlock/index.js +30 -0
- package/es/index.d.ts +4 -1
- package/es/index.js +4 -1
- package/es/index.less +1 -0
- package/es/init.js +26 -1
- package/es/layouts/MicroLayout/index.js +69 -5
- package/es/layouts/MicroLayout/typings.d.ts +4 -2
- package/es/layouts/TabInstance.d.ts +31 -0
- package/es/layouts/TabInstance.js +115 -0
- package/es/layouts/components/RouteTab.d.ts +7 -3
- package/es/layouts/components/RouteTab.js +6 -2
- package/es/layouts/utils.d.ts +1 -1
- package/es/layouts/utils.js +2 -2
- package/es/styles/overrides.less +34 -4
- package/es/styles/theme.less +20 -0
- package/es/styles/utils.less +17 -17
- package/package.json +5 -1
|
@@ -26,12 +26,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
26
26
|
|
|
27
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
28
|
|
|
29
|
-
import {
|
|
29
|
+
import { Spin, Tabs } from 'antd';
|
|
30
30
|
import { get } from 'lodash';
|
|
31
31
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
32
32
|
import DataGrid from "../DataGrid";
|
|
33
33
|
import Filter from "../Filter";
|
|
34
|
-
import {
|
|
34
|
+
import { prefixClassName } from "../utils";
|
|
35
35
|
export default function SelectView(props) {
|
|
36
36
|
var emptyValue = useMemo(function () {
|
|
37
37
|
return [];
|
|
@@ -50,9 +50,14 @@ export default function SelectView(props) {
|
|
|
50
50
|
filter = props.filter,
|
|
51
51
|
dataSource = props.dataSource,
|
|
52
52
|
rowFilter = props.rowFilter,
|
|
53
|
-
|
|
54
|
-
readOnly = props.readOnly
|
|
55
|
-
|
|
53
|
+
loadingProp = props.loading,
|
|
54
|
+
readOnly = props.readOnly,
|
|
55
|
+
defaultColDef = props.defaultColDef,
|
|
56
|
+
rowHeight = props.rowHeight,
|
|
57
|
+
cellDisplayFlex = props.cellDisplayFlex,
|
|
58
|
+
isRowSelectable = props.isRowSelectable,
|
|
59
|
+
checkSearchParams = props.checkSearchParams;
|
|
60
|
+
var prefix = prefixClassName("select-view");
|
|
56
61
|
|
|
57
62
|
var _useState = useState(value || emptyValue),
|
|
58
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -76,6 +81,13 @@ export default function SelectView(props) {
|
|
|
76
81
|
rows = _useState8[0],
|
|
77
82
|
setRows = _useState8[1];
|
|
78
83
|
|
|
84
|
+
var _useState9 = useState(false),
|
|
85
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
86
|
+
loading = _useState10[0],
|
|
87
|
+
setLoading = _useState10[1];
|
|
88
|
+
|
|
89
|
+
var cParams = (filter === null || filter === void 0 ? void 0 : filter.value) || params;
|
|
90
|
+
|
|
79
91
|
var getRowKey = function getRowKey(item) {
|
|
80
92
|
var _get;
|
|
81
93
|
|
|
@@ -93,28 +105,32 @@ export default function SelectView(props) {
|
|
|
93
105
|
return fetch({
|
|
94
106
|
current: current,
|
|
95
107
|
pageSize: pageSize,
|
|
96
|
-
params:
|
|
108
|
+
params: cParams,
|
|
97
109
|
sort: sort
|
|
98
110
|
});
|
|
99
111
|
} : undefined;
|
|
100
112
|
useEffect(function () {
|
|
101
|
-
|
|
102
|
-
}, [dataSource]);
|
|
103
|
-
useEffect(function () {
|
|
104
|
-
if (list.current !== null) {
|
|
105
|
-
if (dataSource !== undefined && rowFilter !== undefined) {
|
|
106
|
-
setRows(dataSource.filter(function (row) {
|
|
107
|
-
return rowFilter(row, params);
|
|
108
|
-
}));
|
|
113
|
+
var mDataSource = dataSource;
|
|
109
114
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
115
|
+
if (rowFilter !== undefined && dataSource !== undefined) {
|
|
116
|
+
mDataSource = dataSource.filter(function (row) {
|
|
117
|
+
return rowFilter(row, cParams);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setRows(mDataSource);
|
|
122
|
+
|
|
123
|
+
if (list.current !== null) {
|
|
124
|
+
if (mDataSource !== undefined) {
|
|
125
|
+
var grid = list.current;
|
|
126
|
+
grid.afterReady(function () {
|
|
127
|
+
grid.api.paginationGoToFirstPage();
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
114
130
|
list.current.fetch();
|
|
115
131
|
}
|
|
116
132
|
}
|
|
117
|
-
}, [
|
|
133
|
+
}, [cParams, dataSource]);
|
|
118
134
|
useEffect(function () {
|
|
119
135
|
setData(value || emptyValue);
|
|
120
136
|
}, [value]);
|
|
@@ -147,6 +163,10 @@ export default function SelectView(props) {
|
|
|
147
163
|
filter.onChange(mParams, 'submit');
|
|
148
164
|
}
|
|
149
165
|
|
|
166
|
+
if (checkSearchParams && !checkSearchParams(mParams)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
150
170
|
setParams(mParams);
|
|
151
171
|
};
|
|
152
172
|
|
|
@@ -156,20 +176,21 @@ export default function SelectView(props) {
|
|
|
156
176
|
if (filter) {
|
|
157
177
|
if (filter.data) {
|
|
158
178
|
headerNode = /*#__PURE__*/React.createElement(Filter, _extends({
|
|
159
|
-
simple: true
|
|
179
|
+
simple: true,
|
|
180
|
+
autoPlaceholder: true
|
|
160
181
|
}, filter, {
|
|
161
|
-
value:
|
|
182
|
+
value: cParams,
|
|
162
183
|
onChange: function onChange(val) {
|
|
163
|
-
return handleChangeParams(_objectSpread(_objectSpread({},
|
|
184
|
+
return handleChangeParams(_objectSpread(_objectSpread({}, cParams), val));
|
|
164
185
|
}
|
|
165
186
|
}));
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
if (filter.sider) {
|
|
169
190
|
siderNode = filter.sider({
|
|
170
|
-
value:
|
|
191
|
+
value: cParams,
|
|
171
192
|
onChange: function onChange(val) {
|
|
172
|
-
return handleChangeParams(_objectSpread(_objectSpread({},
|
|
193
|
+
return handleChangeParams(_objectSpread(_objectSpread({}, cParams), val));
|
|
173
194
|
}
|
|
174
195
|
});
|
|
175
196
|
}
|
|
@@ -184,7 +205,8 @@ export default function SelectView(props) {
|
|
|
184
205
|
}
|
|
185
206
|
|
|
186
207
|
var result = [{
|
|
187
|
-
type: 'delete'
|
|
208
|
+
type: 'delete',
|
|
209
|
+
sortable: false
|
|
188
210
|
}].concat(_toConsumableArray(selectedColumns));
|
|
189
211
|
return result;
|
|
190
212
|
}, [selectedColumns, readOnly]);
|
|
@@ -192,22 +214,23 @@ export default function SelectView(props) {
|
|
|
192
214
|
|
|
193
215
|
var renderList = function renderList() {
|
|
194
216
|
return /*#__PURE__*/React.createElement("div", {
|
|
195
|
-
className:
|
|
217
|
+
className: prefix('layout')
|
|
196
218
|
}, siderNode !== null && /*#__PURE__*/React.createElement("div", {
|
|
197
|
-
className:
|
|
219
|
+
className: prefix('sider')
|
|
198
220
|
}, siderNode), /*#__PURE__*/React.createElement("div", {
|
|
199
|
-
className:
|
|
221
|
+
className: prefix('main')
|
|
200
222
|
}, headerNode !== null && /*#__PURE__*/React.createElement("div", {
|
|
201
|
-
className:
|
|
223
|
+
className: prefix('head')
|
|
202
224
|
}, headerNode), /*#__PURE__*/React.createElement("div", {
|
|
203
|
-
className:
|
|
225
|
+
className: prefix('body')
|
|
204
226
|
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
205
227
|
ref: list,
|
|
206
228
|
rowKey: rowKey,
|
|
207
229
|
rowSelection: {
|
|
208
230
|
type: multiple ? 'checkbox' : 'radio',
|
|
209
231
|
selectedRowKeys: dataKeys,
|
|
210
|
-
onChange: handleChangeData
|
|
232
|
+
onChange: handleChangeData,
|
|
233
|
+
preserveSelectedRowKeys: true
|
|
211
234
|
},
|
|
212
235
|
onRowDoubleClicked: function onRowDoubleClicked(_ref2) {
|
|
213
236
|
var node = _ref2.node;
|
|
@@ -216,9 +239,13 @@ export default function SelectView(props) {
|
|
|
216
239
|
handleChangeData([node.id], [node.data], true);
|
|
217
240
|
}
|
|
218
241
|
},
|
|
242
|
+
rowHeight: rowHeight,
|
|
243
|
+
defaultColDef: defaultColDef,
|
|
244
|
+
cellDisplayFlex: cellDisplayFlex,
|
|
245
|
+
isRowSelectable: isRowSelectable,
|
|
219
246
|
dataSource: rows,
|
|
220
247
|
columns: columns,
|
|
221
|
-
|
|
248
|
+
onLoading: setLoading,
|
|
222
249
|
fetch: request,
|
|
223
250
|
pagination: pagination
|
|
224
251
|
}))));
|
|
@@ -226,14 +253,20 @@ export default function SelectView(props) {
|
|
|
226
253
|
|
|
227
254
|
var renderSelected = function renderSelected() {
|
|
228
255
|
return /*#__PURE__*/React.createElement("div", {
|
|
229
|
-
className:
|
|
256
|
+
className: prefix('layout')
|
|
230
257
|
}, /*#__PURE__*/React.createElement("div", {
|
|
231
|
-
className:
|
|
258
|
+
className: prefix('main')
|
|
232
259
|
}, /*#__PURE__*/React.createElement("div", {
|
|
233
|
-
className:
|
|
260
|
+
className: prefix('body')
|
|
234
261
|
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
235
262
|
dataSource: data,
|
|
236
|
-
|
|
263
|
+
defaultColDef: defaultColDef,
|
|
264
|
+
rowHeight: rowHeight,
|
|
265
|
+
cellDisplayFlex: cellDisplayFlex,
|
|
266
|
+
onDataSourceChange: function onDataSourceChange(v) {
|
|
267
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(v);
|
|
268
|
+
setData(v);
|
|
269
|
+
},
|
|
237
270
|
columns: mSelectedCols,
|
|
238
271
|
rowKey: rowKey,
|
|
239
272
|
pagination: pagination,
|
|
@@ -262,8 +295,7 @@ export default function SelectView(props) {
|
|
|
262
295
|
tabBarGutter: 20,
|
|
263
296
|
onChange: setTabFlag,
|
|
264
297
|
tabBarExtraContent: {
|
|
265
|
-
right: tabFlag === 'selected' && !readOnly ? /*#__PURE__*/React.createElement(
|
|
266
|
-
type: "link",
|
|
298
|
+
right: tabFlag === 'selected' && !readOnly ? /*#__PURE__*/React.createElement("a", {
|
|
267
299
|
onClick: handleClear
|
|
268
300
|
}, "\u6E05\u7A7A") : null
|
|
269
301
|
}
|
|
@@ -271,6 +303,9 @@ export default function SelectView(props) {
|
|
|
271
303
|
}
|
|
272
304
|
|
|
273
305
|
return /*#__PURE__*/React.createElement("div", {
|
|
274
|
-
className:
|
|
275
|
-
}, content
|
|
306
|
+
className: prefix()
|
|
307
|
+
}, content, loadingProp || loading ? /*#__PURE__*/React.createElement(Spin, {
|
|
308
|
+
spinning: true,
|
|
309
|
+
className: prefix('spin')
|
|
310
|
+
}) : null);
|
|
276
311
|
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
.@{prefixCls}-select-view {
|
|
2
|
+
position: relative;
|
|
2
3
|
height: 100%;
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
&-spin {
|
|
6
|
+
position: absolute;
|
|
7
|
+
top: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
background-color: rgba(255, 255, 255, 0.6);
|
|
6
15
|
}
|
|
7
16
|
|
|
8
17
|
& > .@{ant-prefix}-tabs {
|
|
9
18
|
.fullTabs();
|
|
10
19
|
|
|
11
20
|
& > .@{ant-prefix}-tabs-nav {
|
|
12
|
-
margin:
|
|
21
|
+
margin-bottom: 0;
|
|
13
22
|
}
|
|
14
23
|
}
|
|
15
24
|
|
|
@@ -19,8 +28,8 @@
|
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
&-sider {
|
|
22
|
-
width:
|
|
23
|
-
padding: @padding-md;
|
|
31
|
+
width: 200px;
|
|
32
|
+
padding: @padding-md @padding-md @padding-md 0;
|
|
24
33
|
overflow: auto;
|
|
25
34
|
border-right: 1px solid @border-color-split;
|
|
26
35
|
}
|
|
@@ -30,7 +39,11 @@
|
|
|
30
39
|
flex: 1;
|
|
31
40
|
flex-direction: column;
|
|
32
41
|
min-width: 0;
|
|
33
|
-
padding: @padding-md;
|
|
42
|
+
padding: @padding-md 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&-sider + &-main {
|
|
46
|
+
padding-left: @padding-md;
|
|
34
47
|
}
|
|
35
48
|
|
|
36
49
|
&-head + &-body {
|
|
@@ -90,7 +90,7 @@ export default function SiderTree(props) {
|
|
|
90
90
|
if (filterNode) {
|
|
91
91
|
return filterNode(keywords, item);
|
|
92
92
|
} else {
|
|
93
|
-
return
|
|
93
|
+
return item.title.toString().toLowerCase().includes(keywords.toLowerCase());
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -162,14 +162,7 @@ export default function SiderTree(props) {
|
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
164
|
blockNode: true,
|
|
165
|
-
switcherIcon: function switcherIcon(
|
|
166
|
-
var expanded = _ref.expanded,
|
|
167
|
-
isLeaf = _ref.isLeaf;
|
|
168
|
-
|
|
169
|
-
if (isLeaf) {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
|
|
165
|
+
switcherIcon: function switcherIcon() {
|
|
173
166
|
return /*#__PURE__*/React.createElement(Icons.Down, {
|
|
174
167
|
style: {
|
|
175
168
|
fontSize: 14,
|
|
@@ -7,15 +7,6 @@
|
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
height: 100%;
|
|
10
|
-
|
|
11
|
-
.@{ant-prefix}-tree-list-scrollbar {
|
|
12
|
-
right: -@padding-md !important;
|
|
13
|
-
display: block !important;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.@{ant-prefix}-tree-list-scrollbar-thumb {
|
|
17
|
-
background: #ddd !important;
|
|
18
|
-
}
|
|
19
10
|
}
|
|
20
11
|
|
|
21
12
|
&-menu-popover {
|
|
@@ -58,20 +49,11 @@
|
|
|
58
49
|
&-body {
|
|
59
50
|
min-height: 0;
|
|
60
51
|
overflow: auto;
|
|
61
|
-
.scrollBar(
|
|
52
|
+
.scrollBar();
|
|
62
53
|
|
|
63
54
|
.@{ant-prefix}-tree {
|
|
64
|
-
&-list-holder-inner {
|
|
65
|
-
align-items: stretch;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&-list-scrollbar-thumb {
|
|
69
|
-
background: #ddd !important;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
55
|
&-node-content-wrapper {
|
|
73
56
|
min-width: 0;
|
|
74
|
-
overflow-x: hidden;
|
|
75
57
|
}
|
|
76
58
|
|
|
77
59
|
&-title {
|
|
@@ -79,7 +61,6 @@
|
|
|
79
61
|
flex: 1;
|
|
80
62
|
align-items: center;
|
|
81
63
|
justify-content: space-between;
|
|
82
|
-
min-width: 56px;
|
|
83
64
|
border-radius: 4px;
|
|
84
65
|
cursor: pointer;
|
|
85
66
|
transition: background-color 0.2s;
|
|
@@ -151,21 +132,20 @@
|
|
|
151
132
|
.@{prefixCls}-tree-wrapper {
|
|
152
133
|
padding: @padding-md;
|
|
153
134
|
|
|
154
|
-
|
|
135
|
+
.@{prefixCls}-tree-header {
|
|
155
136
|
margin-right: @padding-md;
|
|
156
137
|
}
|
|
157
138
|
}
|
|
158
139
|
|
|
159
140
|
.@{prefixCls}-tree-tabs {
|
|
160
141
|
padding: @padding-md;
|
|
142
|
+
|
|
143
|
+
.@{prefixCls}-tree-wrapper .@{prefixCls}-tree-header {
|
|
144
|
+
margin-right: 0;
|
|
145
|
+
}
|
|
161
146
|
}
|
|
162
147
|
|
|
163
148
|
.@{ant-prefix}-tabs-tabpane > .@{prefixCls}-tree-wrapper {
|
|
164
149
|
padding: 0;
|
|
165
150
|
}
|
|
166
|
-
|
|
167
|
-
.@{prefixCls}-tree-body {
|
|
168
|
-
margin-right: -@padding-md;
|
|
169
|
-
padding-right: @padding-md;
|
|
170
|
-
}
|
|
171
151
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface Props {
|
|
3
3
|
shape?: 'default' | 'order' | 'text';
|
|
4
|
-
type?: 'default' | 'success' | 'warning' | 'error' | 'disabled';
|
|
4
|
+
type?: 'default' | 'success' | 'warning' | 'error' | 'disabled' | 'processing';
|
|
5
5
|
children?: string;
|
|
6
6
|
}
|
|
7
7
|
export default function State(props: Props): JSX.Element;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var _excluded = ["shape", "type", "children"];
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
+
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
|
|
1
9
|
import classNames from 'classnames';
|
|
2
10
|
import React from 'react';
|
|
3
11
|
import { prefixClassName } from "../utils";
|
|
@@ -8,8 +16,10 @@ export default function State(props) {
|
|
|
8
16
|
_props$type = props.type,
|
|
9
17
|
type = _props$type === void 0 ? 'default' : _props$type,
|
|
10
18
|
_props$children = props.children,
|
|
11
|
-
children = _props$children === void 0 ? '' : _props$children
|
|
12
|
-
|
|
19
|
+
children = _props$children === void 0 ? '' : _props$children,
|
|
20
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
21
|
+
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
13
23
|
className: classNames(prefix(), prefix("shape-".concat(shape)), prefix("type-".concat(type)))
|
|
14
|
-
}, /*#__PURE__*/React.createElement("span", null, children));
|
|
24
|
+
}, restProps), /*#__PURE__*/React.createElement("span", null, children));
|
|
15
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@color-success: #2ca471;
|
|
2
2
|
@color-warning: #e37319;
|
|
3
3
|
@color-error: #d54a42;
|
|
4
|
+
@color-processing: #16c0ff;
|
|
4
5
|
@color-disabled: rgba(51, 51, 51, 0.5);
|
|
5
6
|
|
|
6
7
|
.@{prefixCls}-state {
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
|
|
67
68
|
&-type-default&-shape-default {
|
|
68
69
|
&::before {
|
|
69
|
-
background-color:
|
|
70
|
+
background-color: #c0c0c0;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -74,6 +75,10 @@
|
|
|
74
75
|
.defaultShapeColor(@color-success);
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
&-type-processing&-shape-default {
|
|
79
|
+
.defaultShapeColor(@color-processing);
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
&-type-warning&-shape-default {
|
|
78
83
|
.defaultShapeColor(@color-warning);
|
|
79
84
|
}
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
import type { Key } from 'react';
|
|
2
|
+
import type { Key, ReactNode } from 'react';
|
|
3
3
|
import type { ColType, DataGridProps } from "../../components/DataGrid/typings";
|
|
4
|
-
declare type Result<ResultType> = Error |
|
|
4
|
+
declare type Result<ResultType> = Error | ResultType;
|
|
5
|
+
declare type ProcessStepParams<T> = {
|
|
6
|
+
data: T;
|
|
7
|
+
/**
|
|
8
|
+
* 上一步的额外信息,如果上一步执行成功,则没有该数据
|
|
9
|
+
*/
|
|
10
|
+
payload?: any;
|
|
11
|
+
};
|
|
12
|
+
declare type ProcessStep<T, R> = {
|
|
13
|
+
/** 在不传入render warning会自动进行二次确认 */
|
|
14
|
+
mode?: 'warning';
|
|
15
|
+
handler: (params: ProcessStepParams<T>) => Promise<any> | any;
|
|
16
|
+
/**
|
|
17
|
+
* 出现错误或者最后一步的 渲染函数
|
|
18
|
+
* @param params
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
render?: (params: {
|
|
22
|
+
data: T;
|
|
23
|
+
error?: Error;
|
|
24
|
+
result?: R;
|
|
25
|
+
next: (params: {
|
|
26
|
+
type: 'goOn' | 'stop' | 'restart';
|
|
27
|
+
payload?: any;
|
|
28
|
+
}) => void;
|
|
29
|
+
}) => ReactNode;
|
|
30
|
+
};
|
|
5
31
|
interface Props<RecordType extends Record<string, any> = Record<string, any>, ResultType = any, ParamsType = any> {
|
|
6
32
|
modalTitle: string;
|
|
7
|
-
handler
|
|
33
|
+
handler?: (record: RecordType, params?: ParamsType, reloadParams?: any) => Promise<ResultType>;
|
|
34
|
+
process?: ProcessStep<RecordType, any>[] | ((parmas?: ParamsType) => ProcessStep<RecordType, any>[]);
|
|
8
35
|
columns?: ColType<RecordType>[];
|
|
9
36
|
rowKey: DataGridProps<RecordType>['rowKey'];
|
|
10
37
|
/**
|
|
@@ -35,8 +62,17 @@ interface Props<RecordType extends Record<string, any> = Record<string, any>, Re
|
|
|
35
62
|
failIcon: ReactElement;
|
|
36
63
|
successIcon: ReactElement;
|
|
37
64
|
};
|
|
38
|
-
|
|
65
|
+
/**
|
|
66
|
+
* @description 重新执行handler的方法
|
|
67
|
+
* @param params handler的第三个参数可获取到这里传入的params
|
|
68
|
+
*/
|
|
69
|
+
reload: (params?: any) => any;
|
|
39
70
|
}) => ReactElement | string | number | null;
|
|
71
|
+
/**
|
|
72
|
+
* isError 应该与自定义渲染有关
|
|
73
|
+
* @param result
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
40
76
|
isError?: (result: ResultType) => boolean;
|
|
41
77
|
params?: ParamsType;
|
|
42
78
|
/**
|