@lemon-fe/kits 1.0.0-21 → 1.0.0-22
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/Popup/index.js +11 -9
- package/package.json +1 -1
|
@@ -26,11 +26,12 @@ 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, isValidElement, useEffect } from 'react';
|
|
30
|
-
import { Modal, Input, message } from 'antd';
|
|
29
|
+
import React, { useState, cloneElement, useRef, isValidElement, useEffect, useContext } from 'react';
|
|
30
|
+
import { Modal, Input, message, ConfigProvider } from 'antd';
|
|
31
31
|
import { CloseCircleFilled } from '@ant-design/icons';
|
|
32
|
-
import { PREFIX_CLS } from "../../constants";
|
|
33
32
|
import SearchIcon from "../Icons/Search";
|
|
33
|
+
import { prefixClassName } from "../utils";
|
|
34
|
+
var prefix = prefixClassName('popup');
|
|
34
35
|
|
|
35
36
|
function Popup(props) {
|
|
36
37
|
var valueProp = props.value,
|
|
@@ -55,8 +56,6 @@ function Popup(props) {
|
|
|
55
56
|
emptyValue = props.emptyValue,
|
|
56
57
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
57
58
|
|
|
58
|
-
var prefixCls = "".concat(PREFIX_CLS, "-popup");
|
|
59
|
-
|
|
60
59
|
var _useState = useState(valueProp || emptyValue),
|
|
61
60
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
61
|
value = _useState2[0],
|
|
@@ -69,6 +68,9 @@ function Popup(props) {
|
|
|
69
68
|
|
|
70
69
|
var inputRef = useRef(null);
|
|
71
70
|
|
|
71
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
72
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
73
|
+
|
|
72
74
|
var handleCancel = function handleCancel() {
|
|
73
75
|
setVisible(false);
|
|
74
76
|
};
|
|
@@ -180,7 +182,7 @@ function Popup(props) {
|
|
|
180
182
|
trigger = showLabel ? /*#__PURE__*/cloneElement(children, undefined, label) : children;
|
|
181
183
|
} else {
|
|
182
184
|
trigger = /*#__PURE__*/React.createElement(Input, {
|
|
183
|
-
className:
|
|
185
|
+
className: prefix('input'),
|
|
184
186
|
value: label,
|
|
185
187
|
readOnly: true,
|
|
186
188
|
ref: inputRef,
|
|
@@ -189,7 +191,7 @@ function Popup(props) {
|
|
|
189
191
|
placeholder: placeholder,
|
|
190
192
|
bordered: bordered,
|
|
191
193
|
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && allowClear && label && /*#__PURE__*/React.createElement(CloseCircleFilled, {
|
|
192
|
-
className: "
|
|
194
|
+
className: "".concat(getPrefixCls('input'), "-clear-icon"),
|
|
193
195
|
onClick: handleClear
|
|
194
196
|
}), /*#__PURE__*/React.createElement(SearchIcon, null))
|
|
195
197
|
});
|
|
@@ -201,11 +203,11 @@ function Popup(props) {
|
|
|
201
203
|
}
|
|
202
204
|
}, [valueProp]);
|
|
203
205
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
204
|
-
className:
|
|
206
|
+
className: prefix('wrapper'),
|
|
205
207
|
onClick: handleOpen
|
|
206
208
|
}, trigger), /*#__PURE__*/React.createElement(Modal, _extends({
|
|
207
209
|
destroyOnClose: true,
|
|
208
|
-
|
|
210
|
+
open: visible,
|
|
209
211
|
width: 994,
|
|
210
212
|
centered: true,
|
|
211
213
|
onCancel: handleCancel,
|