@lemon-fe/components 0.1.8 → 0.1.9
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/Actions/index.js +3 -2
- package/es/Dropdown/index.d.ts +14 -0
- package/es/Dropdown/index.js +53 -0
- package/es/Dropdown/index.less +13 -0
- package/es/Filter/index.js +32 -18
- package/es/Filter/index.less +11 -29
- package/es/Filter/typings.d.ts +4 -0
- package/es/Section/index.less +0 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/index.less +1 -0
- package/package.json +2 -2
package/es/Actions/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function Actions(props) {
|
|
|
49
49
|
style: style
|
|
50
50
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
51
51
|
direction: "horizontal",
|
|
52
|
-
size:
|
|
52
|
+
size: 12
|
|
53
53
|
}, visibleBtns.map(function (item, index) {
|
|
54
54
|
if (item === null) {
|
|
55
55
|
return item;
|
|
@@ -118,7 +118,8 @@ function Actions(props) {
|
|
|
118
118
|
}, rest), text, /*#__PURE__*/React.createElement(Icons.Down, {
|
|
119
119
|
style: {
|
|
120
120
|
opacity: 0.7,
|
|
121
|
-
fontSize: 16
|
|
121
|
+
fontSize: 16,
|
|
122
|
+
verticalAlign: -3
|
|
122
123
|
}
|
|
123
124
|
})));
|
|
124
125
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PopoverProps } from 'antd';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
actions: ({
|
|
5
|
+
text: string | ReactElement;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
} | null)[];
|
|
9
|
+
overlayClassName?: string;
|
|
10
|
+
placement?: PopoverProps['placement'];
|
|
11
|
+
children?: ReactElement | null;
|
|
12
|
+
}
|
|
13
|
+
export default function Dropdown(props: Props): JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
import { Popover } from 'antd';
|
|
16
|
+
import React, { useState } from 'react';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import { PREFIX_CLS } from '../constants';
|
|
19
|
+
export default function Dropdown(props) {
|
|
20
|
+
var actions = props.actions,
|
|
21
|
+
overlayClassName = props.overlayClassName,
|
|
22
|
+
_props$placement = props.placement,
|
|
23
|
+
placement = _props$placement === void 0 ? 'bottomRight' : _props$placement,
|
|
24
|
+
children = props.children;
|
|
25
|
+
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
visible = _useState2[0],
|
|
29
|
+
setVisible = _useState2[1];
|
|
30
|
+
|
|
31
|
+
var prefixCls = "".concat(PREFIX_CLS, "-dropdown");
|
|
32
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
33
|
+
trigger: "click",
|
|
34
|
+
placement: placement,
|
|
35
|
+
visible: visible,
|
|
36
|
+
onVisibleChange: setVisible,
|
|
37
|
+
overlayClassName: classNames(prefixCls, overlayClassName),
|
|
38
|
+
content: actions.map(function (item, index) {
|
|
39
|
+
return item !== null && /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: classNames("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-disabled"), item.disabled)),
|
|
41
|
+
key: index,
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
if (item.disabled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setVisible(false);
|
|
48
|
+
item.onClick();
|
|
49
|
+
}
|
|
50
|
+
}, item.text);
|
|
51
|
+
})
|
|
52
|
+
}, children);
|
|
53
|
+
}
|
package/es/Filter/index.js
CHANGED
|
@@ -29,13 +29,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
29
29
|
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; }
|
|
30
30
|
|
|
31
31
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
32
|
-
import { Button, Checkbox, Form, Input, Popover, Space,
|
|
32
|
+
import { Button, Checkbox, Form, Input, Popover, Space, Modal, message, Select, Empty, InputNumber } from 'antd';
|
|
33
33
|
import { useDebounce, useRequest } from '@lemon-fe/hooks';
|
|
34
|
+
import classNames from 'classnames';
|
|
34
35
|
import Icons from '../Icons';
|
|
35
36
|
import DurationPicker from '../DurationPicker';
|
|
36
37
|
import FormLayout from '../FormLayout';
|
|
37
38
|
import { PREFIX_CLS } from '../constants';
|
|
38
39
|
import TabBar from '../TabBar';
|
|
40
|
+
import Dropdown from '../Dropdown';
|
|
39
41
|
var components = [{
|
|
40
42
|
type: 'input',
|
|
41
43
|
render: function render(item) {
|
|
@@ -107,7 +109,8 @@ function Filter(props) {
|
|
|
107
109
|
defaultActiveKeys = props.defaultActiveKeys,
|
|
108
110
|
storageKey = props.storageKey,
|
|
109
111
|
onValuesChange = props.onValuesChange,
|
|
110
|
-
style = props.style
|
|
112
|
+
style = props.style,
|
|
113
|
+
simple = props.simple;
|
|
111
114
|
var prefixCls = PREFIX_CLS;
|
|
112
115
|
var defaultValue = useMemo(function () {
|
|
113
116
|
return defaultValueProp || value;
|
|
@@ -407,10 +410,10 @@ function Filter(props) {
|
|
|
407
410
|
initialValues: defaultValue,
|
|
408
411
|
onFinish: handleFinish,
|
|
409
412
|
form: form,
|
|
410
|
-
className: "".concat(prefixCls, "-filter"),
|
|
413
|
+
className: classNames("".concat(prefixCls, "-filter"), _defineProperty({}, "".concat(prefixCls, "-simple-filter"), simple)),
|
|
411
414
|
onValuesChange: handleValuesChange,
|
|
412
415
|
style: style
|
|
413
|
-
}, /*#__PURE__*/React.createElement(TabBar, {
|
|
416
|
+
}, !simple && /*#__PURE__*/React.createElement(TabBar, {
|
|
414
417
|
tabs: tabs,
|
|
415
418
|
activeKey: tabs[active].title,
|
|
416
419
|
onTabClick: function onTabClick(_, index) {
|
|
@@ -442,18 +445,33 @@ function Filter(props) {
|
|
|
442
445
|
type: "primary",
|
|
443
446
|
htmlType: "submit"
|
|
444
447
|
}, "\u67E5\u8BE2")
|
|
445
|
-
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
}, simple ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
449
|
+
className: "".concat(prefixCls, "-filter-btn"),
|
|
450
|
+
onClick: handleReset
|
|
451
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
452
|
+
width: "20",
|
|
453
|
+
height: "20",
|
|
454
|
+
viewBox: "0 0 20 20",
|
|
455
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
456
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
457
|
+
d: "m15 12 .98 3.314a8 8 0 1 0-3.293 2.223",
|
|
458
|
+
stroke: "currentColor",
|
|
459
|
+
strokeWidth: "1.5",
|
|
460
|
+
strokeLinecap: "round",
|
|
461
|
+
strokeLinejoin: "round",
|
|
462
|
+
fill: "none",
|
|
463
|
+
fillRule: "evenodd"
|
|
464
|
+
})))) : /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
465
|
+
actions: [{
|
|
466
|
+
text: '重置',
|
|
449
467
|
onClick: handleReset
|
|
450
|
-
},
|
|
451
|
-
|
|
468
|
+
}, {
|
|
469
|
+
text: '保存方案',
|
|
452
470
|
onClick: handleAddTab
|
|
453
|
-
},
|
|
454
|
-
|
|
471
|
+
}, {
|
|
472
|
+
text: '删除方案',
|
|
455
473
|
onClick: handleDelete
|
|
456
|
-
}
|
|
474
|
+
}]
|
|
457
475
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
458
476
|
icon: /*#__PURE__*/React.createElement(Icons.More, null)
|
|
459
477
|
})), /*#__PURE__*/React.createElement(Popover, {
|
|
@@ -464,11 +482,7 @@ function Filter(props) {
|
|
|
464
482
|
placeholder: "\u641C\u7D22\u9009\u9879",
|
|
465
483
|
allowClear: true,
|
|
466
484
|
className: "".concat(prefixCls, "-filter-items-search"),
|
|
467
|
-
|
|
468
|
-
style: {
|
|
469
|
-
color: '#686868'
|
|
470
|
-
}
|
|
471
|
-
}),
|
|
485
|
+
prefix: /*#__PURE__*/React.createElement(Icons.Search, null),
|
|
472
486
|
onChange: function onChange(e) {
|
|
473
487
|
return handleChangeKeywords(e.currentTarget.value);
|
|
474
488
|
}
|
package/es/Filter/index.less
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@import '../theme.less';
|
|
2
|
-
|
|
3
1
|
.@{prefixCls}-filter {
|
|
4
2
|
&-tab {
|
|
5
3
|
height: 100%;
|
|
@@ -38,46 +36,30 @@
|
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
&-popover {
|
|
41
|
-
|
|
42
|
-
padding-top: 0;
|
|
43
|
-
|
|
44
|
-
.ant-popover-arrow {
|
|
45
|
-
display: none;
|
|
46
|
-
}
|
|
39
|
+
.popover(220px);
|
|
47
40
|
|
|
48
41
|
.ant-popover-inner {
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.ant-popover-inner-content {
|
|
53
|
-
padding: 4px 5px 16px;
|
|
42
|
+
padding: 16px 0;
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
45
|
|
|
57
|
-
&-items-search
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
border: none;
|
|
61
|
-
outline: none;
|
|
62
|
-
box-shadow: none;
|
|
63
|
-
|
|
64
|
-
input {
|
|
65
|
-
background-color: transparent;
|
|
66
|
-
}
|
|
46
|
+
&-items-search {
|
|
47
|
+
width: auto;
|
|
48
|
+
margin: 0 16px 8px;
|
|
67
49
|
}
|
|
68
50
|
|
|
69
51
|
&-items {
|
|
70
52
|
max-height: 400px;
|
|
71
|
-
padding: 0 20px;
|
|
72
53
|
overflow: auto;
|
|
73
54
|
}
|
|
74
55
|
|
|
75
56
|
&-item {
|
|
76
|
-
|
|
77
|
-
overflow: hidden;
|
|
57
|
+
.popoverItem();
|
|
78
58
|
|
|
79
|
-
|
|
80
|
-
color: #888;
|
|
81
|
-
}
|
|
59
|
+
overflow: hidden;
|
|
82
60
|
}
|
|
83
61
|
}
|
|
62
|
+
|
|
63
|
+
.@{prefixCls}-section-body > .@{prefixCls}-filter:not(.@{prefixCls}-simple-filter):first-child {
|
|
64
|
+
margin-top: -16px;
|
|
65
|
+
}
|
package/es/Filter/typings.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export interface FilterProps<T extends Record<string, any> = Record<string, any>
|
|
|
19
19
|
defaultActiveKeys?: string[];
|
|
20
20
|
storageKey?: string;
|
|
21
21
|
style?: CSSProperties;
|
|
22
|
+
/**
|
|
23
|
+
* @description 是否简化筛选器,简化版不包含标签以及选项保存
|
|
24
|
+
*/
|
|
25
|
+
simple?: boolean;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export interface ComponentOption {
|
package/es/Section/index.less
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -27,3 +27,4 @@ export { default as FormTable } from './FormTable';
|
|
|
27
27
|
export type { FormTableColumnType, FormTableProps, FormTableRef } from './FormTable/typings';
|
|
28
28
|
export { default as TabBar } from './TabBar';
|
|
29
29
|
export { default as SymbolIcon } from './SymbolIcon';
|
|
30
|
+
export { default as Dropdown } from './Dropdown';
|
package/es/index.js
CHANGED
|
@@ -21,4 +21,5 @@ export { default as FormHorizontal } from './FormHorizontal';
|
|
|
21
21
|
export { default as FormInline } from './FormInline';
|
|
22
22
|
export { default as FormTable } from './FormTable';
|
|
23
23
|
export { default as TabBar } from './TabBar';
|
|
24
|
-
export { default as SymbolIcon } from './SymbolIcon';
|
|
24
|
+
export { default as SymbolIcon } from './SymbolIcon';
|
|
25
|
+
export { default as Dropdown } from './Dropdown';
|
package/es/index.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.9",
|
|
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": "f43d8d68fe859bd2d30478c18b85fafc2310595d"
|
|
45
45
|
}
|