@lemon-fe/components 0.1.46 → 0.1.52
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/BaseTable/index.js +8 -7
- package/es/BaseTable/index.less +1 -1
- package/es/Filter/index.js +58 -49
- package/es/Filter/index.less +17 -3
- package/es/FormLayout/index.less +6 -3
- package/es/Layout/index.less +2 -2
- package/es/Section/index.less +2 -3
- package/es/SiderTree/index.less +1 -1
- package/es/Table/index.js +15 -3
- package/es/utils.less +3 -1
- package/package.json +2 -2
package/es/BaseTable/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["onWidthChange", "width", "fullTableRef", "children", "className"],
|
|
2
|
-
_excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "rowHeight", "tableLayout", "rowActions", "style"];
|
|
2
|
+
_excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "rowHeight", "tableLayout", "rowActions", "style", "locale"];
|
|
3
3
|
|
|
4
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
34
34
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
35
|
|
|
36
36
|
/// <reference path="../../typings.d.ts" />
|
|
37
|
-
import React, { useMemo, useState, useEffect, useRef
|
|
37
|
+
import React, { useMemo, useState, useEffect, useRef } from 'react';
|
|
38
38
|
import { Table as AntdTable } from 'antd';
|
|
39
39
|
import { get } from 'lodash';
|
|
40
40
|
import ResizeObserver from 'rc-resize-observer';
|
|
@@ -121,6 +121,7 @@ function BaseTable(props) {
|
|
|
121
121
|
tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
|
|
122
122
|
rowActions = props.rowActions,
|
|
123
123
|
style = props.style,
|
|
124
|
+
localeProp = props.locale,
|
|
124
125
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
125
126
|
|
|
126
127
|
var fullTableRef = useRef(null);
|
|
@@ -204,8 +205,8 @@ function BaseTable(props) {
|
|
|
204
205
|
hasPagination = paginationProp !== undefined && !!paginationProp.total || dataSource.length > 0;
|
|
205
206
|
}
|
|
206
207
|
|
|
207
|
-
|
|
208
|
-
setScrollY(calcScrollY() ||
|
|
208
|
+
useEffect(function () {
|
|
209
|
+
setScrollY(calcScrollY() || 0);
|
|
209
210
|
}, [hasPagination]);
|
|
210
211
|
useEffect(function () {
|
|
211
212
|
if (scrollYProp !== true) {
|
|
@@ -416,13 +417,13 @@ function BaseTable(props) {
|
|
|
416
417
|
style: scrollYProp === true ? _objectSpread(_objectSpread({}, style), {}, {
|
|
417
418
|
height: '100%'
|
|
418
419
|
}) : style,
|
|
419
|
-
locale: {
|
|
420
|
+
locale: _objectSpread({
|
|
420
421
|
emptyText: /*#__PURE__*/React.createElement("div", {
|
|
421
422
|
className: "".concat(PREFIX_CLS, "-table-empty")
|
|
422
423
|
}, /*#__PURE__*/React.createElement("img", {
|
|
423
424
|
src: empty
|
|
424
425
|
}), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"))
|
|
425
|
-
}
|
|
426
|
+
}, localeProp)
|
|
426
427
|
}, restProps), {}, {
|
|
427
428
|
pagination: paginationProp !== false ? _objectSpread({
|
|
428
429
|
size: 'small',
|
|
@@ -439,7 +440,7 @@ function BaseTable(props) {
|
|
|
439
440
|
if (scrollYProp === true) {
|
|
440
441
|
tableNode = /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
441
442
|
onResize: function onResize(size) {
|
|
442
|
-
|
|
443
|
+
changeScrollY(size.height);
|
|
443
444
|
}
|
|
444
445
|
}, tableNode);
|
|
445
446
|
}
|
package/es/BaseTable/index.less
CHANGED
package/es/Filter/index.js
CHANGED
|
@@ -172,39 +172,18 @@ function Filter(props) {
|
|
|
172
172
|
width = _useState12[0],
|
|
173
173
|
setWidth = _useState12[1];
|
|
174
174
|
|
|
175
|
-
var _useState13 = useState(
|
|
175
|
+
var _useState13 = useState(true),
|
|
176
176
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
177
177
|
collapsed = _useState14[0],
|
|
178
178
|
setCollapsed = _useState14[1];
|
|
179
179
|
|
|
180
|
-
var _useRequest = useRequest(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
switch (_context.prev = _context.next) {
|
|
185
|
-
case 0:
|
|
186
|
-
if (storageKey) {
|
|
187
|
-
_context.next = 2;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return _context.abrupt("return", null);
|
|
192
|
-
|
|
193
|
-
case 2:
|
|
194
|
-
_context.next = 4;
|
|
195
|
-
return getStorageData(storageKey);
|
|
196
|
-
|
|
197
|
-
case 4:
|
|
198
|
-
tabsData = _context.sent;
|
|
199
|
-
return _context.abrupt("return", tabsData);
|
|
180
|
+
var _useRequest = useRequest(function () {
|
|
181
|
+
if (!storageKey) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
200
184
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
return _context.stop();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}, _callee);
|
|
207
|
-
})), {
|
|
185
|
+
return getStorageData(storageKey);
|
|
186
|
+
}, {
|
|
208
187
|
loadingState: false,
|
|
209
188
|
onSuccess: function onSuccess(res) {
|
|
210
189
|
if (res !== null) {
|
|
@@ -236,8 +215,8 @@ function Filter(props) {
|
|
|
236
215
|
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, allValues, form);
|
|
237
216
|
};
|
|
238
217
|
|
|
239
|
-
var handleSave = function handleSave(
|
|
240
|
-
var title =
|
|
218
|
+
var handleSave = function handleSave(_ref) {
|
|
219
|
+
var title = _ref.name;
|
|
241
220
|
var index = tabs.findIndex(function (item) {
|
|
242
221
|
return item.title === title;
|
|
243
222
|
});
|
|
@@ -266,36 +245,36 @@ function Filter(props) {
|
|
|
266
245
|
};
|
|
267
246
|
|
|
268
247
|
var handleOk = /*#__PURE__*/function () {
|
|
269
|
-
var
|
|
248
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
270
249
|
var values;
|
|
271
|
-
return regeneratorRuntime.wrap(function
|
|
250
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
272
251
|
while (1) {
|
|
273
|
-
switch (
|
|
252
|
+
switch (_context.prev = _context.next) {
|
|
274
253
|
case 0:
|
|
275
|
-
|
|
276
|
-
|
|
254
|
+
_context.prev = 0;
|
|
255
|
+
_context.next = 3;
|
|
277
256
|
return modalForm.validateFields();
|
|
278
257
|
|
|
279
258
|
case 3:
|
|
280
|
-
values =
|
|
259
|
+
values = _context.sent;
|
|
281
260
|
handleSave(values);
|
|
282
|
-
|
|
261
|
+
_context.next = 9;
|
|
283
262
|
break;
|
|
284
263
|
|
|
285
264
|
case 7:
|
|
286
|
-
|
|
287
|
-
|
|
265
|
+
_context.prev = 7;
|
|
266
|
+
_context.t0 = _context["catch"](0);
|
|
288
267
|
|
|
289
268
|
case 9:
|
|
290
269
|
case "end":
|
|
291
|
-
return
|
|
270
|
+
return _context.stop();
|
|
292
271
|
}
|
|
293
272
|
}
|
|
294
|
-
},
|
|
273
|
+
}, _callee, null, [[0, 7]]);
|
|
295
274
|
}));
|
|
296
275
|
|
|
297
276
|
return function handleOk() {
|
|
298
|
-
return
|
|
277
|
+
return _ref2.apply(this, arguments);
|
|
299
278
|
};
|
|
300
279
|
}();
|
|
301
280
|
|
|
@@ -574,18 +553,48 @@ function Filter(props) {
|
|
|
574
553
|
style: {
|
|
575
554
|
visibility: showCollapse ? 'visible' : 'hidden'
|
|
576
555
|
},
|
|
577
|
-
className: "".concat(prefixCls, "-btn"),
|
|
578
556
|
onClick: function onClick() {
|
|
579
557
|
return setCollapsed(function (prev) {
|
|
580
558
|
return !prev;
|
|
581
559
|
});
|
|
582
560
|
},
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
561
|
+
type: "link",
|
|
562
|
+
className: "".concat(prefixCls, "-collapse")
|
|
563
|
+
}, collapsed ? '高级搜索' : '收起搜索', /*#__PURE__*/React.createElement("svg", {
|
|
564
|
+
width: "10",
|
|
565
|
+
height: "10",
|
|
566
|
+
viewBox: "0 0 10 10",
|
|
567
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
568
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
569
|
+
style: collapsed ? {
|
|
570
|
+
transform: 'rotate(180deg)'
|
|
571
|
+
} : undefined
|
|
572
|
+
}, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
|
|
573
|
+
id: "a",
|
|
574
|
+
d: "M0 0h10v10H0z"
|
|
575
|
+
})), /*#__PURE__*/React.createElement("g", {
|
|
576
|
+
transform: "matrix(1 0 0 -1 0 10)",
|
|
577
|
+
fill: "none",
|
|
578
|
+
fillRule: "evenodd"
|
|
579
|
+
}, /*#__PURE__*/React.createElement("mask", {
|
|
580
|
+
id: "b",
|
|
581
|
+
fill: "#fff"
|
|
582
|
+
}, /*#__PURE__*/React.createElement("use", {
|
|
583
|
+
xlinkHref: "#a",
|
|
584
|
+
transform: "rotate(-90 5 5)"
|
|
585
|
+
})), /*#__PURE__*/React.createElement("use", {
|
|
586
|
+
fillOpacity: "0",
|
|
587
|
+
fill: "#C4C4C4",
|
|
588
|
+
transform: "rotate(-90 5 5)",
|
|
589
|
+
xlinkHref: "#a"
|
|
590
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
591
|
+
d: "M2.172 1.757 5 4.586l2.828-2.829M2.172 5.757 5 8.586l2.828-2.829",
|
|
592
|
+
stroke: "currentColor",
|
|
593
|
+
strokeLinecap: "round",
|
|
594
|
+
strokeLinejoin: "round",
|
|
595
|
+
strokeDasharray: "0,0",
|
|
596
|
+
mask: "url(#b)"
|
|
597
|
+
}))))))))));
|
|
589
598
|
}
|
|
590
599
|
|
|
591
600
|
Filter.setComponents = setComponents;
|
package/es/Filter/index.less
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
.@{prefixCls}-filter {
|
|
2
2
|
&-tab-bar {
|
|
3
|
-
margin-bottom:
|
|
3
|
+
margin-bottom: 12px;
|
|
4
|
+
|
|
5
|
+
.@{prefixCls}-tab-bar-item {
|
|
6
|
+
padding: 8px 12px;
|
|
7
|
+
}
|
|
4
8
|
}
|
|
5
9
|
|
|
6
10
|
&-btn {
|
|
@@ -13,9 +17,19 @@
|
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
&-collapse {
|
|
21
|
+
padding: 4px 0;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
line-height: 1;
|
|
24
|
+
|
|
25
|
+
& > svg {
|
|
26
|
+
vertical-align: -1px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
&-btns {
|
|
17
31
|
display: flex;
|
|
18
|
-
margin-bottom:
|
|
32
|
+
margin-bottom: 8px;
|
|
19
33
|
padding: 0 8px;
|
|
20
34
|
}
|
|
21
35
|
|
|
@@ -52,5 +66,5 @@
|
|
|
52
66
|
}
|
|
53
67
|
|
|
54
68
|
.@{prefixCls}-section-body > .@{prefixCls}-filter:not(.@{prefixCls}-filter-simple):first-child {
|
|
55
|
-
margin-top: -
|
|
69
|
+
margin-top: -12px;
|
|
56
70
|
}
|
package/es/FormLayout/index.less
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
@import '../theme.less';
|
|
2
2
|
|
|
3
3
|
@spaceX: 16px;
|
|
4
|
-
@spaceY:
|
|
5
|
-
@minWidth:
|
|
4
|
+
@spaceY: 8px;
|
|
5
|
+
@minWidth: 350px;
|
|
6
|
+
@maxWidth: 94px + 422px;
|
|
6
7
|
|
|
7
8
|
.wrapper() {
|
|
8
9
|
margin-right: (-@spaceX / 2);
|
|
@@ -20,14 +21,15 @@
|
|
|
20
21
|
flex-wrap: nowrap;
|
|
21
22
|
width: percentage((@colSpan / 24));
|
|
22
23
|
min-width: if((@colSpan >= 12), 2 * @minWidth, @minWidth);
|
|
24
|
+
max-width: if((@colSpan >= 12), 2 * @maxWidth, @maxWidth);
|
|
23
25
|
padding: 0 (@spaceX / 2);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
.@{prefixCls}-form {
|
|
27
29
|
&-layout {
|
|
28
30
|
.ant-form-item {
|
|
29
|
-
margin-bottom: @spaceY;
|
|
30
31
|
flex-wrap: nowrap;
|
|
32
|
+
margin-bottom: @spaceY;
|
|
31
33
|
|
|
32
34
|
&-label {
|
|
33
35
|
flex: 0 0 94px;
|
|
@@ -88,5 +90,6 @@
|
|
|
88
90
|
&-layout-flex > div > .ant-form-item,
|
|
89
91
|
&-layout-flex &-col {
|
|
90
92
|
width: 100%;
|
|
93
|
+
max-width: 100%;
|
|
91
94
|
}
|
|
92
95
|
}
|
package/es/Layout/index.less
CHANGED
package/es/Section/index.less
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
.@{prefixCls}-section {
|
|
4
4
|
position: relative;
|
|
5
5
|
width: 100%;
|
|
6
|
-
padding:
|
|
6
|
+
padding: 12px 16px;
|
|
7
7
|
color: #333;
|
|
8
8
|
|
|
9
9
|
& + & {
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
&-header {
|
|
25
25
|
display: flex;
|
|
26
26
|
align-items: flex-end;
|
|
27
|
-
margin-bottom:
|
|
28
|
-
padding: 8px 0;
|
|
27
|
+
margin-bottom: 12px;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
&-title {
|
package/es/SiderTree/index.less
CHANGED
package/es/Table/index.js
CHANGED
|
@@ -30,6 +30,8 @@ import React, { useMemo, useState, useImperativeHandle, useEffect } from 'react'
|
|
|
30
30
|
import { useRequest } from '@lemon-fe/hooks';
|
|
31
31
|
import BaseTable from '../BaseTable';
|
|
32
32
|
import { isSortValue } from './utils';
|
|
33
|
+
import empty from '../BaseTable/empty.png';
|
|
34
|
+
import { PREFIX_CLS } from '../constants';
|
|
33
35
|
export default function Table(props) {
|
|
34
36
|
var _props$dataSource = props.dataSource,
|
|
35
37
|
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
|
|
@@ -115,16 +117,19 @@ export default function Table(props) {
|
|
|
115
117
|
onLoading(false);
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
setRemote(res.result)
|
|
120
|
+
setRemote(_objectSpread(_objectSpread({}, res.result), {}, {
|
|
121
|
+
error: undefined
|
|
122
|
+
}));
|
|
119
123
|
},
|
|
120
|
-
onError: function onError() {
|
|
124
|
+
onError: function onError(error) {
|
|
121
125
|
if (onLoading) {
|
|
122
126
|
onLoading(false);
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
setRemote({
|
|
126
130
|
data: [],
|
|
127
|
-
total: 0
|
|
131
|
+
total: 0,
|
|
132
|
+
error: error
|
|
128
133
|
});
|
|
129
134
|
}
|
|
130
135
|
}),
|
|
@@ -215,6 +220,13 @@ export default function Table(props) {
|
|
|
215
220
|
});
|
|
216
221
|
}
|
|
217
222
|
},
|
|
223
|
+
locale: remote.error ? {
|
|
224
|
+
emptyText: /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
className: "".concat(PREFIX_CLS, "-table-empty")
|
|
226
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
227
|
+
src: empty
|
|
228
|
+
}), /*#__PURE__*/React.createElement("div", null, remote.error.message))
|
|
229
|
+
} : undefined,
|
|
218
230
|
pagination: {
|
|
219
231
|
current: current,
|
|
220
232
|
pageSize: pageSize,
|
package/es/utils.less
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react": "^17.0.2",
|
|
42
42
|
"react-dom": "^17.0.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "68713e81d8cf4c82bae68564ae4c2e70c4a8cc27"
|
|
45
45
|
}
|