@lemon-fe/components 0.1.105 → 0.1.118
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/Dropdown/index.d.ts +1 -0
- package/es/Dropdown/index.js +4 -2
- package/es/MainFramework/index.d.ts +3 -1
- package/es/MainFramework/index.js +7 -3
- package/es/Popup/index.d.ts +2 -0
- package/es/Popup/index.js +30 -10
- package/package.json +2 -2
package/es/Dropdown/index.d.ts
CHANGED
package/es/Dropdown/index.js
CHANGED
|
@@ -21,7 +21,9 @@ export default function Dropdown(props) {
|
|
|
21
21
|
overlayClassName = props.overlayClassName,
|
|
22
22
|
_props$placement = props.placement,
|
|
23
23
|
placement = _props$placement === void 0 ? 'bottomRight' : _props$placement,
|
|
24
|
-
children = props.children
|
|
24
|
+
children = props.children,
|
|
25
|
+
_props$trigger = props.trigger,
|
|
26
|
+
trigger = _props$trigger === void 0 ? 'click' : _props$trigger;
|
|
25
27
|
|
|
26
28
|
var _useState = useState(false),
|
|
27
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -30,7 +32,7 @@ export default function Dropdown(props) {
|
|
|
30
32
|
|
|
31
33
|
var prefixCls = "".concat(PREFIX_CLS, "-dropdown");
|
|
32
34
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
33
|
-
trigger:
|
|
35
|
+
trigger: trigger,
|
|
34
36
|
placement: placement,
|
|
35
37
|
visible: visible,
|
|
36
38
|
onVisibleChange: setVisible,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import type { MenuFavorites, MenuItem } from './typings';
|
|
3
3
|
interface Props<T> {
|
|
4
4
|
title: string | ReactNode;
|
|
@@ -17,6 +17,8 @@ interface Props<T> {
|
|
|
17
17
|
onFavoritesChange?: (value: MenuFavorites) => void;
|
|
18
18
|
right?: ReactNode;
|
|
19
19
|
children?: ReactNode;
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
20
22
|
}
|
|
21
23
|
export default function MainFramework<TabType extends {
|
|
22
24
|
title: string;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import TabBar from './components/TabBar';
|
|
3
4
|
import Menu from './components/Menu';
|
|
4
5
|
import { PREFIX_CLS as prefixCls } from '../constants';
|
|
5
6
|
import RefreshButton from './components/RefreshButton';
|
|
6
7
|
export default function MainFramework(props) {
|
|
7
|
-
var
|
|
8
|
+
var className = props.className,
|
|
9
|
+
tabs = props.tabs,
|
|
8
10
|
active = props.active,
|
|
9
11
|
children = props.children,
|
|
10
12
|
right = props.right,
|
|
@@ -20,9 +22,11 @@ export default function MainFramework(props) {
|
|
|
20
22
|
title = props.title,
|
|
21
23
|
favorites = props.favorites,
|
|
22
24
|
onFavoritesChange = props.onFavoritesChange,
|
|
23
|
-
renderMenu = props.renderMenu
|
|
25
|
+
renderMenu = props.renderMenu,
|
|
26
|
+
style = props.style;
|
|
24
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: "".concat(prefixCls, "-main")
|
|
28
|
+
className: classNames("".concat(prefixCls, "-main"), className),
|
|
29
|
+
style: style
|
|
26
30
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27
31
|
className: "".concat(prefixCls, "-nav")
|
|
28
32
|
}, /*#__PURE__*/React.createElement("div", {
|
package/es/Popup/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface PopupProps<ValueType> extends ModalProps {
|
|
|
12
12
|
}) => ReactElement | null;
|
|
13
13
|
formatLabel?: (value: ValueType) => string;
|
|
14
14
|
beforeOk?: (value: ValueType) => ValueType | PromiseLike<ValueType>;
|
|
15
|
+
/** 确认事件之前校验 */
|
|
16
|
+
beforeOkCheck?: (value?: ValueType) => boolean | PromiseLike<boolean>;
|
|
15
17
|
children?: JSX.Element | ((props: {
|
|
16
18
|
value?: ValueType;
|
|
17
19
|
}) => JSX.Element);
|
package/es/Popup/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["value", "onChange", "component", "children", "formatLabel", "disabled", "allowClear", "autoFocus", "showLabel", "beforeOk", "placeholder", "onClick", "disabledTip", "bordered", "emptyValue"];
|
|
1
|
+
var _excluded = ["value", "onChange", "component", "children", "formatLabel", "disabled", "allowClear", "autoFocus", "showLabel", "beforeOk", "beforeOkCheck", "placeholder", "onClick", "disabledTip", "bordered", "emptyValue"];
|
|
2
2
|
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
@@ -46,6 +46,7 @@ function Popup(props) {
|
|
|
46
46
|
_props$showLabel = props.showLabel,
|
|
47
47
|
showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
|
|
48
48
|
beforeOk = props.beforeOk,
|
|
49
|
+
beforeOkCheck = props.beforeOkCheck,
|
|
49
50
|
placeholder = props.placeholder,
|
|
50
51
|
onClick = props.onClick,
|
|
51
52
|
disabledTip = props.disabledTip,
|
|
@@ -94,41 +95,60 @@ function Popup(props) {
|
|
|
94
95
|
|
|
95
96
|
var handleOk = /*#__PURE__*/function () {
|
|
96
97
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
97
|
-
var res;
|
|
98
|
+
var checkResult, res;
|
|
98
99
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
99
100
|
while (1) {
|
|
100
101
|
switch (_context.prev = _context.next) {
|
|
101
102
|
case 0:
|
|
103
|
+
if (!beforeOkCheck) {
|
|
104
|
+
_context.next = 6;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_context.next = 3;
|
|
109
|
+
return beforeOkCheck(value);
|
|
110
|
+
|
|
111
|
+
case 3:
|
|
112
|
+
checkResult = _context.sent;
|
|
113
|
+
|
|
114
|
+
if (checkResult) {
|
|
115
|
+
_context.next = 6;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return _context.abrupt("return");
|
|
120
|
+
|
|
121
|
+
case 6:
|
|
102
122
|
setVisible(false);
|
|
103
123
|
|
|
104
124
|
if (!onChange) {
|
|
105
|
-
_context.next =
|
|
125
|
+
_context.next = 16;
|
|
106
126
|
break;
|
|
107
127
|
}
|
|
108
128
|
|
|
109
129
|
if (!(beforeOk && value)) {
|
|
110
|
-
_context.next =
|
|
130
|
+
_context.next = 15;
|
|
111
131
|
break;
|
|
112
132
|
}
|
|
113
133
|
|
|
114
|
-
_context.next =
|
|
134
|
+
_context.next = 11;
|
|
115
135
|
return beforeOk(value);
|
|
116
136
|
|
|
117
|
-
case
|
|
137
|
+
case 11:
|
|
118
138
|
res = _context.sent;
|
|
119
139
|
onChange(res);
|
|
120
|
-
_context.next =
|
|
140
|
+
_context.next = 16;
|
|
121
141
|
break;
|
|
122
142
|
|
|
123
|
-
case
|
|
143
|
+
case 15:
|
|
124
144
|
onChange(value);
|
|
125
145
|
|
|
126
|
-
case
|
|
146
|
+
case 16:
|
|
127
147
|
if (inputRef.current) {
|
|
128
148
|
inputRef.current.focus();
|
|
129
149
|
}
|
|
130
150
|
|
|
131
|
-
case
|
|
151
|
+
case 17:
|
|
132
152
|
case "end":
|
|
133
153
|
return _context.stop();
|
|
134
154
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.118",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^17.0.2",
|
|
40
40
|
"react-dom": "^17.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "0d7a7267f4030ed13f74d6cb651ab4e2bfc5bbf5"
|
|
43
43
|
}
|