@lemon-fe/components 0.1.71 → 0.1.72
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/Popup/index.d.ts +6 -6
- package/es/Popup/index.js +6 -2
- package/es/SiderTree/index.d.ts +1 -1
- package/package.json +3 -3
package/es/Popup/index.d.ts
CHANGED
|
@@ -3,13 +3,18 @@ import type { ModalProps } from 'antd/lib/modal';
|
|
|
3
3
|
export interface PopupProps<ValueType> extends ModalProps {
|
|
4
4
|
value?: ValueType;
|
|
5
5
|
onChange?: (value?: ValueType) => void;
|
|
6
|
+
/**
|
|
7
|
+
* @description 渲染函数,这个函数不是作为组件渲染的,偷懒可以直接传入组件,如果需要考虑优化参考demo的传入方式
|
|
8
|
+
*/
|
|
6
9
|
component: (params: {
|
|
7
10
|
value?: ValueType;
|
|
8
11
|
onChange: (value: ValueType) => void;
|
|
9
12
|
}) => ReactElement | null;
|
|
10
13
|
formatLabel?: (value: ValueType) => string;
|
|
11
14
|
beforeOk?: (value: ValueType) => ValueType | PromiseLike<ValueType>;
|
|
12
|
-
children?:
|
|
15
|
+
children?: JSX.Element | ((props: {
|
|
16
|
+
value?: ValueType;
|
|
17
|
+
}) => JSX.Element);
|
|
13
18
|
allowClear?: boolean;
|
|
14
19
|
disabled?: boolean;
|
|
15
20
|
autoFocus?: boolean;
|
|
@@ -19,10 +24,5 @@ export interface PopupProps<ValueType> extends ModalProps {
|
|
|
19
24
|
bordered?: boolean;
|
|
20
25
|
onClick?: () => void;
|
|
21
26
|
}
|
|
22
|
-
interface ValuedPopupProps<ValueType> extends Omit<PopupProps<ValueType>, 'value' | 'onChange'> {
|
|
23
|
-
value: ValueType;
|
|
24
|
-
onChange?: (value: ValueType) => void;
|
|
25
|
-
}
|
|
26
|
-
declare function Popup<ValueType>(props: ValuedPopupProps<ValueType>): JSX.Element;
|
|
27
27
|
declare function Popup<ValueType>(props: PopupProps<ValueType>): JSX.Element;
|
|
28
28
|
export default Popup;
|
package/es/Popup/index.js
CHANGED
|
@@ -26,7 +26,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
26
26
|
|
|
27
27
|
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; }
|
|
28
28
|
|
|
29
|
-
import React, { useState, cloneElement, useRef } from 'react';
|
|
29
|
+
import React, { useState, cloneElement, useRef, isValidElement } from 'react';
|
|
30
30
|
import { Modal, Input, message } from 'antd';
|
|
31
31
|
import { CloseCircleFilled } from '@ant-design/icons';
|
|
32
32
|
import { PREFIX_CLS } from '../constants';
|
|
@@ -151,7 +151,11 @@ function Popup(props) {
|
|
|
151
151
|
var label = valueProp ? formatLabel ? formatLabel(valueProp) : valueProp : undefined;
|
|
152
152
|
var trigger;
|
|
153
153
|
|
|
154
|
-
if (children) {
|
|
154
|
+
if (typeof children === 'function') {
|
|
155
|
+
trigger = children({
|
|
156
|
+
value: valueProp
|
|
157
|
+
});
|
|
158
|
+
} else if ( /*#__PURE__*/isValidElement(children)) {
|
|
155
159
|
trigger = showLabel ? /*#__PURE__*/cloneElement(children, undefined, label) : children;
|
|
156
160
|
} else {
|
|
157
161
|
trigger = /*#__PURE__*/React.createElement(Input, {
|
package/es/SiderTree/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface Props<KeyType> extends Omit<TreeProps, 'onSelect' | 'selectedKeys' | '
|
|
|
13
13
|
onSelect?: (node: TreeData<KeyType>, info: {
|
|
14
14
|
event: 'select';
|
|
15
15
|
selected: boolean;
|
|
16
|
-
node: EventDataNode
|
|
16
|
+
node: EventDataNode<DataNode>;
|
|
17
17
|
selectedNodes: DataNode[];
|
|
18
18
|
nativeEvent: MouseEvent;
|
|
19
19
|
}) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.72",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "鲁盛杰 <lusj@cnlemon.net>",
|
|
6
6
|
"homepage": "",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@types/color-string": "^1.5.2",
|
|
37
37
|
"@types/lodash": "^4.14.179",
|
|
38
38
|
"@types/react-resizable": "^1.7.4",
|
|
39
|
-
"antd": "^4.
|
|
39
|
+
"antd": "^4.21.6",
|
|
40
40
|
"rc-resize-observer": "^1.2.0",
|
|
41
41
|
"react": "^17.0.2",
|
|
42
42
|
"react-dom": "^17.0.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "21ba97408ddedae75c198d8fd0f3c1d5da248f9f"
|
|
45
45
|
}
|