@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6
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/AutoBox/index.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +17 -16
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +90 -118
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +9 -10
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +260 -337
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/ComboSelect/utils.d.ts +6 -0
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +24 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +80 -95
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +222 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +70 -74
- package/FormItem/index.js +18 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +104 -113
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +60 -77
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +22 -23
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +34 -43
- package/Select/index.js +281 -345
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +582 -796
- package/SelectorPicker/index.js +113 -134
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +24 -25
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +360 -494
- package/Tabs/index.js +100 -100
- package/Tag/index.js +64 -82
- package/TextEditor/index.js +78 -100
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +29 -28
- package/Timeline/index.js +50 -47
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +29 -29
- package/Tooltip/index.js +52 -56
- package/Transfer/index.js +117 -154
- package/Tree/index.js +9 -10
- package/Upload/index.js +125 -143
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
- package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/utils-c17b5265.js +97 -0
- package/index.js +24 -23
- package/locale/en-US.d.ts +1 -0
- package/locale/index.d.ts +2 -0
- package/locale/index.js +10 -8
- package/locale/zh-CN.d.ts +1 -0
- package/package.json +11 -10
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/utils-418da0a4.js +0 -73
- /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
package/TextField/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
|
|
2
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
3
1
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
4
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
3
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
@@ -12,11 +10,10 @@ import AutoTips from '../AutoTips/index.js';
|
|
|
12
10
|
import { Loading } from '../Loading/index.js';
|
|
13
11
|
import { Tooltip } from '../Tooltip/index.js';
|
|
14
12
|
import HelperText from '../HelperText/index.js';
|
|
15
|
-
import { u as useGlobalProps } from '../_verture/useGlobalProps-
|
|
16
|
-
import { D as Dropdown } from '../_verture/index-
|
|
17
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
13
|
+
import { u as useGlobalProps } from '../_verture/useGlobalProps-1e416658.js';
|
|
14
|
+
import { D as Dropdown } from '../_verture/index-da9097d3.js';
|
|
15
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
18
16
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
19
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
20
17
|
import '../Help/index.js';
|
|
21
18
|
import '@para-ui/icons/Help';
|
|
22
19
|
import 'clsx';
|
|
@@ -26,152 +23,114 @@ import '@para-ui/icons/Forbid';
|
|
|
26
23
|
import '@para-ui/icons/LoadingF';
|
|
27
24
|
import '@para-ui/core/GlobalContext';
|
|
28
25
|
import 'rc-dropdown';
|
|
29
|
-
import '../_verture/usePopupContainer-
|
|
26
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
30
27
|
import 'dayjs';
|
|
31
28
|
|
|
32
29
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-text-field {\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n display: inline-block;\n width: 100%;\n}\n.paraui-v4-text-field > .text-field-content {\n border: 1px solid;\n border-radius: 4px;\n border-color: rgb(212, 218, 227);\n display: flex;\n width: 100%;\n position: relative;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-text-field > .text-field-content:hover {\n border-color: rgb(87, 131, 235);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-before {\n color: rgb(92, 101, 115);\n padding: 0 10px;\n border-bottom-left-radius: 4px;\n border-top-left-radius: 4px;\n white-space: nowrap;\n display: flex;\n align-items: center;\n position: relative;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-before:after {\n position: absolute;\n content: \"\";\n right: 0;\n width: 1px;\n background-color: rgb(212, 218, 227);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-before svg {\n font-size: 18px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within {\n position: relative;\n display: flex;\n flex-grow: 1;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within:hover > .clean-up-icon {\n display: flex;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .clean-up-icon {\n height: 100%;\n align-items: center;\n margin-right: 10px;\n cursor: pointer;\n display: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .clean-up-icon svg {\n color: rgb(161, 168, 179);\n font-size: 16px;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .clean-up-icon:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .right-icon {\n display: flex;\n height: 100%;\n align-items: center;\n margin-right: 10px;\n cursor: pointer;\n color: rgb(29, 33, 38);\n position: relative;\n z-index: 1;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .right-icon.right-icon-password:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .right-icon svg {\n color: rgb(92, 101, 115);\n font-size: 18px;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .length-limit {\n display: flex;\n height: 100%;\n align-items: center;\n margin-right: 10px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n width: 100%;\n line-height: 0;\n position: relative;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input input::-webkit-outer-spin-button,\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input input[type=number] {\n -moz-appearance: textfield;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n width: 100%;\n height: 100%;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n width: 100% !important;\n padding: 10px;\n resize: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input, .paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n font-size: 14px;\n color: rgb(29, 33, 38);\n border: 0;\n border-radius: 4px;\n background: transparent;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input::-ms-clear, .paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea::-ms-clear {\n display: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input::-ms-reveal, .paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea::-ms-reveal {\n display: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input:disabled, .paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea:disabled {\n background-color: transparent;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n width: 100%;\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n padding: 0 10px;\n color: rgb(161, 168, 179);\n cursor: text;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n pointer-events: none;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder > .text-field-required {\n margin-left: 2px;\n color: rgb(244, 66, 66);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-after {\n color: rgb(92, 101, 115);\n padding: 0 10px;\n border-bottom-right-radius: 4px;\n border-top-right-radius: 4px;\n white-space: nowrap;\n display: flex;\n align-items: center;\n position: relative;\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-after:after {\n position: absolute;\n content: \"\";\n left: 0;\n width: 1px;\n background-color: rgb(212, 218, 227);\n}\n.paraui-v4-text-field > .text-field-content > .text-field-content-after svg {\n font-size: 18px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-text-field.paraui-v4-text-field-multiline > .text-field-content .text-field-content-within > .clean-up-icon {\n display: none;\n}\n.paraui-v4-text-field.paraui-v4-text-field-multiline > .text-field-content .text-field-content-within > .length-limit {\n position: absolute;\n height: 22px;\n bottom: 0;\n border-radius: 4px;\n width: calc(100% - 10px);\n background: white;\n justify-content: flex-end;\n padding-bottom: 2px;\n margin-right: 0;\n left: 0;\n}\n.paraui-v4-text-field.paraui-v4-text-field-multiline > .text-field-content .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n padding-top: 10px;\n line-height: 1;\n height: calc(100% - 24px);\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content:hover {\n border-color: rgb(212, 218, 227);\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content > .text-field-content-before {\n background-color: transparent;\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n cursor: not-allowed;\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content > .text-field-content-within > .text-field-content-within-input > input, .paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n cursor: not-allowed;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled > .text-field-content > .text-field-content-after {\n background-color: transparent;\n}\n.paraui-v4-text-field.paraui-v4-text-field-disabled.paraui-v4-text-field-multiline > .text-field-content .text-field-content-within > .length-limit {\n background-color: transparent;\n}\n.paraui-v4-text-field.paraui-v4-text-field-error > .text-field-content {\n border-color: rgb(244, 66, 66) !important;\n}\n.paraui-v4-text-field.paraui-v4-text-field-error > .text-field-content:hover {\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-text-field.paraui-v4-text-field-limit > .text-field-content {\n border-color: rgb(244, 66, 66) !important;\n}\n.paraui-v4-text-field.paraui-v4-text-field-limit > .text-field-content:hover {\n border-color: rgb(244, 66, 66) !important;\n}\n.paraui-v4-text-field.paraui-v4-text-field-limit-length > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n padding-bottom: 25px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-focus > .text-field-content {\n border-color: rgb(46, 101, 230);\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content {\n height: 28px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content > .text-field-content-before {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content > .text-field-content-before:after {\n top: 5px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 6px 10px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content .text-field-content-after {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-small > .text-field-content .text-field-content-after:after {\n top: 5px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content {\n height: 28px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content > .text-field-content-before {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content > .text-field-content-before:after {\n top: 5px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 6px 10px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content .text-field-content-after {\n line-height: 26px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-medium > .text-field-content .text-field-content-after:after {\n top: 5px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content {\n height: 32px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content > .text-field-content-before {\n line-height: 30px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content > .text-field-content-before:after {\n top: 7px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 30px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 6px 10px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n line-height: 30px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content .text-field-content-after {\n line-height: 30px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-large > .text-field-content .text-field-content-after:after {\n top: 7px;\n height: 16px;\n}\n.paraui-v4-text-field.paraui-v4-text-field-resize > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n resize: both;\n}\n\n.paraui-v4-text-field-select.component-dropdown {\n /*// 小\n &.paraui-v4-text-field-select-small {\n & > .text-field-select-content {\n & > .text-field-select-content-item {\n line-height: 28px;\n }\n }\n }\n\n // 中\n &.paraui-v4-text-field-select-medium {\n & > .text-field-select-content {\n & > .text-field-select-content-item {\n line-height: 32px;\n }\n }\n }\n\n // 大\n &.paraui-v4-text-field-select-large {\n & > .text-field-select-content {\n & > .text-field-select-content-item {\n line-height: 36px;\n }\n }\n }*/\n}\n.paraui-v4-text-field-select.component-dropdown > .text-field-select-content {\n max-height: 320px;\n overflow: auto;\n}\n.paraui-v4-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item {\n display: flex;\n cursor: pointer;\n color: rgb(29, 33, 38);\n padding: 0 10px;\n line-height: 30px;\n}\n.paraui-v4-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item.text-field-select-content-item-keydown {\n background-color: rgb(247, 248, 250);\n color: rgb(46, 101, 230);\n}\n.paraui-v4-text-field-select.component-dropdown > .text-field-select-content.text-field-select-content-loading {\n height: 100px;\n position: relative;\n overflow: hidden;\n}\n.paraui-v4-text-field-select.paraui-v4-text-field-select-data.component-tooltip {\n padding: 8px 0;\n}";
|
|
33
30
|
styleInject(css_248z);
|
|
34
31
|
|
|
35
32
|
// true:数值型的,false:非数值型
|
|
36
|
-
|
|
33
|
+
const IsNaN = value => {
|
|
37
34
|
return typeof value === 'number' && !isNaN(value);
|
|
38
35
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
_a$showSelectName = _a.showSelectName,
|
|
86
|
-
showSelectName = _a$showSelectName === void 0 ? 'value' : _a$showSelectName,
|
|
87
|
-
_a$resize = _a.resize,
|
|
88
|
-
resize = _a$resize === void 0 ? true : _a$resize,
|
|
89
|
-
searchEmpty = _a.searchEmpty,
|
|
90
|
-
onBlur = _a.onBlur,
|
|
91
|
-
onFocus = _a.onFocus,
|
|
92
|
-
onChange = _a.onChange,
|
|
93
|
-
onKeydown = _a.onKeydown,
|
|
94
|
-
onKeyUp = _a.onKeyUp,
|
|
95
|
-
onEnter = _a.onEnter,
|
|
96
|
-
onClickAddonBefore = _a.onClickAddonBefore,
|
|
97
|
-
onClickAddonAfter = _a.onClickAddonAfter,
|
|
98
|
-
onSelect = _a.onSelect,
|
|
99
|
-
onClear = _a.onClear,
|
|
36
|
+
const TextField = props => {
|
|
37
|
+
const _a = useGlobalProps(props, 'TextField'),
|
|
38
|
+
{
|
|
39
|
+
className,
|
|
40
|
+
style,
|
|
41
|
+
size = 'large',
|
|
42
|
+
labelMode = 'outside',
|
|
43
|
+
placeholder = '',
|
|
44
|
+
label = '',
|
|
45
|
+
labelTooltip,
|
|
46
|
+
disabled = false,
|
|
47
|
+
disabledTooltip,
|
|
48
|
+
multiline = false,
|
|
49
|
+
required = false,
|
|
50
|
+
labelSign,
|
|
51
|
+
rows = 4,
|
|
52
|
+
error = false,
|
|
53
|
+
hideErrorDom,
|
|
54
|
+
helperText = '',
|
|
55
|
+
addonBefore = '',
|
|
56
|
+
addonAfter = '',
|
|
57
|
+
defaultValue,
|
|
58
|
+
value,
|
|
59
|
+
type = 'text',
|
|
60
|
+
onClickIcon,
|
|
61
|
+
rightIcon,
|
|
62
|
+
showRightIcon = true,
|
|
63
|
+
allowClear = false,
|
|
64
|
+
limitLength,
|
|
65
|
+
fetchSuggestions,
|
|
66
|
+
selectPopoverClass,
|
|
67
|
+
renderSelectItem,
|
|
68
|
+
showSelectName = 'value',
|
|
69
|
+
resize = true,
|
|
70
|
+
searchEmpty,
|
|
71
|
+
onBlur,
|
|
72
|
+
onFocus,
|
|
73
|
+
onChange,
|
|
74
|
+
onKeydown,
|
|
75
|
+
onKeyUp,
|
|
76
|
+
onEnter,
|
|
77
|
+
onClickAddonBefore,
|
|
78
|
+
onClickAddonAfter,
|
|
79
|
+
onSelect,
|
|
80
|
+
onClear
|
|
81
|
+
} = _a,
|
|
100
82
|
otherProps = __rest(_a, ["className", "style", "size", "labelMode", "placeholder", "label", "labelTooltip", "disabled", "disabledTooltip", "multiline", "required", "labelSign", "rows", "error", "hideErrorDom", "helperText", "addonBefore", "addonAfter", "defaultValue", "value", "type", "onClickIcon", "rightIcon", "showRightIcon", "allowClear", "limitLength", "fetchSuggestions", "selectPopoverClass", "renderSelectItem", "showSelectName", "resize", "searchEmpty", "onBlur", "onFocus", "onChange", "onKeydown", "onKeyUp", "onEnter", "onClickAddonBefore", "onClickAddonAfter", "onSelect", "onClear"]);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
110
|
-
valueCom = _useState6[0],
|
|
111
|
-
setValueCom = _useState6[1]; // 组件值
|
|
112
|
-
var _useState7 = useState(false),
|
|
113
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
114
|
-
isFocus = _useState8[0],
|
|
115
|
-
setIsFocus = _useState8[1]; // 是否得到焦点
|
|
116
|
-
var _useState9 = useState('text'),
|
|
117
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
118
|
-
typeCom = _useState10[0],
|
|
119
|
-
setTypeCom = _useState10[1];
|
|
120
|
-
var _useState11 = useState(false),
|
|
121
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
122
|
-
open = _useState12[0],
|
|
123
|
-
setOpen = _useState12[1]; // 是否打开下拉框
|
|
124
|
-
var _useState13 = useState(false),
|
|
125
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
126
|
-
selectLoading = _useState14[0],
|
|
127
|
-
setSelectLoading = _useState14[1]; // 下拉loading
|
|
128
|
-
var _useState15 = useState([]),
|
|
129
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
130
|
-
selectData = _useState16[0],
|
|
131
|
-
setSelectData = _useState16[1];
|
|
83
|
+
const [classSearchOne] = useState("text-field-select-content-".concat(UUID())); // 唯一class
|
|
84
|
+
const [showText, setShowText] = useState(true); // 是否显示输入框lable,placeholder true显示
|
|
85
|
+
const [valueCom, setValueCom] = useState(''); // 组件值
|
|
86
|
+
const [isFocus, setIsFocus] = useState(false); // 是否得到焦点
|
|
87
|
+
const [typeCom, setTypeCom] = useState('text');
|
|
88
|
+
const [open, setOpen] = useState(false); // 是否打开下拉框
|
|
89
|
+
const [selectLoading, setSelectLoading] = useState(false); // 下拉loading
|
|
90
|
+
const [selectData, setSelectData] = useState([]);
|
|
132
91
|
//const [constData] = useState<ConstDataProps>({});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
useEffect(
|
|
92
|
+
const inputDom = useRef(null);
|
|
93
|
+
const selectPosDom = useRef(null); // 下拉框定位元素
|
|
94
|
+
useEffect(() => {
|
|
136
95
|
if (props.defaultValue !== undefined) {
|
|
137
96
|
setValueCom(props.defaultValue === null ? '' : props.defaultValue);
|
|
138
97
|
}
|
|
139
98
|
}, []);
|
|
140
99
|
// 组件类型
|
|
141
|
-
useEffect(
|
|
100
|
+
useEffect(() => {
|
|
142
101
|
if (type !== typeCom) setTypeCom(type);
|
|
143
102
|
}, [type]);
|
|
144
103
|
// 监听value
|
|
145
|
-
useEffect(
|
|
104
|
+
useEffect(() => {
|
|
146
105
|
if (value !== undefined) {
|
|
147
106
|
setValueCom(value === null ? '' : value);
|
|
148
107
|
}
|
|
149
108
|
}, [value]);
|
|
150
109
|
// 监听组件值,判断是否显示placehold,label
|
|
151
|
-
useEffect(
|
|
110
|
+
useEffect(() => {
|
|
152
111
|
if (valueCom !== '' && valueCom !== undefined) setShowText(false);else setShowText(true);
|
|
153
112
|
}, [valueCom]);
|
|
154
113
|
// 判断是否显示下拉
|
|
155
|
-
useEffect(
|
|
114
|
+
useEffect(() => {
|
|
156
115
|
if (!fetchSuggestions) return;
|
|
157
116
|
setOpen(isFocus);
|
|
158
117
|
}, [isFocus, fetchSuggestions]);
|
|
159
|
-
useEffect(
|
|
118
|
+
useEffect(() => {
|
|
160
119
|
if (open) {
|
|
161
120
|
window.addEventListener('keydown', keydownCom);
|
|
162
121
|
} else {
|
|
163
122
|
window.removeEventListener('keydown', keydownCom);
|
|
164
123
|
}
|
|
165
|
-
return
|
|
124
|
+
return () => {
|
|
166
125
|
window.removeEventListener('keydown', keydownCom);
|
|
167
126
|
};
|
|
168
127
|
}, [open]);
|
|
169
|
-
useEffect(
|
|
128
|
+
useEffect(() => {
|
|
170
129
|
// 失去焦点
|
|
171
130
|
if (!isFocus && valueCom) {
|
|
172
|
-
|
|
131
|
+
const val = handValueLimit(valueCom);
|
|
173
132
|
if (val !== valueCom) {
|
|
174
|
-
|
|
133
|
+
const e = {};
|
|
175
134
|
e.target = inputDom.current;
|
|
176
135
|
e.target.value = val;
|
|
177
136
|
if (props.value === undefined) {
|
|
@@ -185,8 +144,8 @@ var TextField = function TextField(props) {
|
|
|
185
144
|
* 处理value值
|
|
186
145
|
* 超出字符长度限制,截取符合长度内容,并且触发onchange事件
|
|
187
146
|
* */
|
|
188
|
-
|
|
189
|
-
|
|
147
|
+
const handValueLimit = val => {
|
|
148
|
+
let valHand = val;
|
|
190
149
|
if (IsNaN(props.limitLength) && val.toString().length > Number(props.limitLength)) {
|
|
191
150
|
valHand = valHand.toString().substr(0, props.limitLength);
|
|
192
151
|
}
|
|
@@ -209,13 +168,15 @@ var TextField = function TextField(props) {
|
|
|
209
168
|
* currentDom: 当前元素
|
|
210
169
|
* }
|
|
211
170
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
171
|
+
const handKeydown = config => {
|
|
172
|
+
const {
|
|
173
|
+
selectDom,
|
|
174
|
+
keyCode,
|
|
175
|
+
currentDom
|
|
176
|
+
} = config;
|
|
177
|
+
let brotherDom = currentDom;
|
|
178
|
+
let type = 'nextSibling';
|
|
179
|
+
let classSelectStr = '.text-field-select-content-item';
|
|
219
180
|
if (keyCode === 38) {
|
|
220
181
|
// 上
|
|
221
182
|
type = 'previousSibling';
|
|
@@ -240,10 +201,10 @@ var TextField = function TextField(props) {
|
|
|
240
201
|
* @param currentDom 当前元素
|
|
241
202
|
* @param selectDom 外容器
|
|
242
203
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
204
|
+
const domClientTop = (currentDom, selectDom) => {
|
|
205
|
+
const clientHeight = selectDom.clientHeight; // 可见区域的高度
|
|
206
|
+
const top = currentDom.offsetTop + currentDom.clientHeight;
|
|
207
|
+
const difference = top - clientHeight;
|
|
247
208
|
if (difference > 0) {
|
|
248
209
|
selectDom.scrollTop = difference;
|
|
249
210
|
} else {
|
|
@@ -254,16 +215,16 @@ var TextField = function TextField(props) {
|
|
|
254
215
|
* 键盘事件
|
|
255
216
|
* @param e 键盘信息
|
|
256
217
|
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
218
|
+
const keydownCom = e => {
|
|
219
|
+
const selectDom = document.querySelector(".".concat(classSearchOne));
|
|
220
|
+
let currentDom = null;
|
|
221
|
+
const keydownDom = selectDom.querySelector('.text-field-select-content-item-keydown');
|
|
261
222
|
// 回车
|
|
262
223
|
if (e.keyCode === 13) {
|
|
263
224
|
if (keydownDom) {
|
|
264
|
-
|
|
225
|
+
const val = keydownDom.dataset.val;
|
|
265
226
|
clickSelectItem(JSON.parse(val))(e);
|
|
266
|
-
|
|
227
|
+
const dom = inputDom && inputDom.current;
|
|
267
228
|
dom.blur();
|
|
268
229
|
}
|
|
269
230
|
}
|
|
@@ -274,17 +235,17 @@ var TextField = function TextField(props) {
|
|
|
274
235
|
// 下
|
|
275
236
|
if (e.keyCode === 40) {
|
|
276
237
|
handKeydown({
|
|
277
|
-
selectDom
|
|
238
|
+
selectDom,
|
|
278
239
|
keyCode: e.keyCode,
|
|
279
|
-
currentDom
|
|
240
|
+
currentDom
|
|
280
241
|
});
|
|
281
242
|
}
|
|
282
243
|
// 上
|
|
283
244
|
if (e.keyCode === 38) {
|
|
284
245
|
handKeydown({
|
|
285
|
-
selectDom
|
|
246
|
+
selectDom,
|
|
286
247
|
keyCode: e.keyCode,
|
|
287
|
-
currentDom
|
|
248
|
+
currentDom
|
|
288
249
|
});
|
|
289
250
|
}
|
|
290
251
|
};
|
|
@@ -292,7 +253,7 @@ var TextField = function TextField(props) {
|
|
|
292
253
|
* 失去焦点
|
|
293
254
|
* @param event 失去焦点元素对象
|
|
294
255
|
*/
|
|
295
|
-
|
|
256
|
+
const onBlurCom = event => {
|
|
296
257
|
setIsFocus(false);
|
|
297
258
|
if (event.target.value === '') setShowText(true);
|
|
298
259
|
onBlur && onBlur(event);
|
|
@@ -301,10 +262,10 @@ var TextField = function TextField(props) {
|
|
|
301
262
|
* 下拉搜索
|
|
302
263
|
* @param val 搜索值
|
|
303
264
|
*/
|
|
304
|
-
|
|
265
|
+
const fetchSuggestionsCom = val => {
|
|
305
266
|
if (fetchSuggestions) {
|
|
306
267
|
setSelectLoading(true);
|
|
307
|
-
fetchSuggestions(val,
|
|
268
|
+
fetchSuggestions(val, data => {
|
|
308
269
|
setSelectData(data || []);
|
|
309
270
|
setSelectLoading(false);
|
|
310
271
|
});
|
|
@@ -314,7 +275,7 @@ var TextField = function TextField(props) {
|
|
|
314
275
|
* 得到焦点
|
|
315
276
|
* @param event 得到焦点元素
|
|
316
277
|
*/
|
|
317
|
-
|
|
278
|
+
const onFocusCom = event => {
|
|
318
279
|
setIsFocus(true);
|
|
319
280
|
onFocus && onFocus(event);
|
|
320
281
|
fetchSuggestionsCom(event.target.value);
|
|
@@ -323,8 +284,8 @@ var TextField = function TextField(props) {
|
|
|
323
284
|
* 改变输入框
|
|
324
285
|
* @param event 输入框元素
|
|
325
286
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
287
|
+
const onChangeCom = event => {
|
|
288
|
+
const val = event.target.value;
|
|
328
289
|
if (val) setShowText(false); // 有值不显示placehold,防止浏览器默认填充
|
|
329
290
|
/*if (limitLength && val !== undefined && val !== '' && val.toString().length > limitLength) {
|
|
330
291
|
return;
|
|
@@ -339,7 +300,7 @@ var TextField = function TextField(props) {
|
|
|
339
300
|
* 键盘按下事件
|
|
340
301
|
* @param event 输入框元素
|
|
341
302
|
*/
|
|
342
|
-
|
|
303
|
+
const onKeyDownCom = event => {
|
|
343
304
|
if (event.keyCode === 13) onEnter && onEnter(event);
|
|
344
305
|
onKeydown && onKeydown(event);
|
|
345
306
|
};
|
|
@@ -347,14 +308,14 @@ var TextField = function TextField(props) {
|
|
|
347
308
|
* 键盘抬起事件
|
|
348
309
|
* @param event 输入框元素
|
|
349
310
|
*/
|
|
350
|
-
|
|
311
|
+
const onKeyUpCom = event => {
|
|
351
312
|
onKeyUp && onKeyUp(event);
|
|
352
313
|
};
|
|
353
314
|
/**
|
|
354
315
|
* 点击图标
|
|
355
316
|
* @param event 图标元素
|
|
356
317
|
*/
|
|
357
|
-
|
|
318
|
+
const onClickRightIcon = event => {
|
|
358
319
|
if (type === 'password') {
|
|
359
320
|
if (typeCom === 'text') {
|
|
360
321
|
setTypeCom('password');
|
|
@@ -365,26 +326,24 @@ var TextField = function TextField(props) {
|
|
|
365
326
|
}
|
|
366
327
|
onClickIcon && onClickIcon(event);
|
|
367
328
|
};
|
|
368
|
-
|
|
329
|
+
const handValue = () => {
|
|
369
330
|
if (props.value === undefined) return valueCom;
|
|
370
331
|
return value;
|
|
371
332
|
};
|
|
372
333
|
// 处理下拉框样式
|
|
373
|
-
|
|
374
|
-
|
|
334
|
+
const handleClassPopover = () => {
|
|
335
|
+
let str = "".concat($prefixCls, "-text-field-select ").concat($prefixCls, "-scrollbar-small");
|
|
375
336
|
if (size) str += " ".concat($prefixCls, "-text-field-select-").concat(size);
|
|
376
337
|
if (selectPopoverClass) str += " ".concat(selectPopoverClass);
|
|
377
338
|
if (selectData.length > 0) str += " ".concat($prefixCls, "-text-field-select-data");
|
|
378
339
|
return str;
|
|
379
340
|
};
|
|
380
341
|
// 点击下拉
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
onSelect && onSelect(item);
|
|
384
|
-
};
|
|
342
|
+
const clickSelectItem = item => e => {
|
|
343
|
+
onSelect && onSelect(item);
|
|
385
344
|
};
|
|
386
345
|
// 限制长度
|
|
387
|
-
|
|
346
|
+
const limitMemo = useMemo(() => {
|
|
388
347
|
return jsx(Fragment, {
|
|
389
348
|
children: IsNaN(limitLength) && jsx("span", Object.assign({
|
|
390
349
|
className: "length-limit"
|
|
@@ -394,13 +353,13 @@ var TextField = function TextField(props) {
|
|
|
394
353
|
});
|
|
395
354
|
}, [limitLength, valueCom]);
|
|
396
355
|
// 图标
|
|
397
|
-
|
|
398
|
-
|
|
356
|
+
const rightIconMemo = useMemo(() => {
|
|
357
|
+
const rightIconFunc = () => {
|
|
399
358
|
return rightIcon ? rightIcon :
|
|
400
359
|
// 只有密码模式有默认图标
|
|
401
360
|
type === 'password' ? typeCom === 'password' ? jsx(VisibilityOff, {}) : jsx(Visibility, {}) : null;
|
|
402
361
|
};
|
|
403
|
-
|
|
362
|
+
const rightIconContent = rightIconFunc();
|
|
404
363
|
return jsx(Fragment, {
|
|
405
364
|
children: showRightIcon && rightIconContent && jsx("span", Object.assign({
|
|
406
365
|
className: type === 'password' ? 'right-icon right-icon-password' : 'right-icon',
|
|
@@ -411,7 +370,7 @@ var TextField = function TextField(props) {
|
|
|
411
370
|
});
|
|
412
371
|
}, [showRightIcon, rightIcon, type, typeCom, onClickIcon]);
|
|
413
372
|
// 输入框
|
|
414
|
-
|
|
373
|
+
const renderInputDom = () => {
|
|
415
374
|
if (multiline) {
|
|
416
375
|
return jsx("textarea", Object.assign({
|
|
417
376
|
ref: inputDom,
|
|
@@ -438,21 +397,21 @@ var TextField = function TextField(props) {
|
|
|
438
397
|
}, otherProps));
|
|
439
398
|
};
|
|
440
399
|
// 点击清楚按钮
|
|
441
|
-
|
|
442
|
-
|
|
400
|
+
const clickClean = () => {
|
|
401
|
+
const target = inputDom.current;
|
|
443
402
|
target.value = '';
|
|
444
403
|
if (props.value === undefined) {
|
|
445
404
|
setValueCom('');
|
|
446
405
|
}
|
|
447
406
|
onChange && onChange({
|
|
448
|
-
target
|
|
407
|
+
target
|
|
449
408
|
});
|
|
450
409
|
fetchSuggestionsCom('');
|
|
451
410
|
onClear && onClear();
|
|
452
411
|
};
|
|
453
412
|
// 清空内容
|
|
454
|
-
|
|
455
|
-
|
|
413
|
+
const clearRender = () => {
|
|
414
|
+
const valCom = handValue();
|
|
456
415
|
if ((valCom || valCom === 0) && !disabled && allowClear) {
|
|
457
416
|
return jsx("span", Object.assign({
|
|
458
417
|
className: "clean-up-icon",
|
|
@@ -463,8 +422,8 @@ var TextField = function TextField(props) {
|
|
|
463
422
|
}
|
|
464
423
|
};
|
|
465
424
|
// 中间主体
|
|
466
|
-
|
|
467
|
-
|
|
425
|
+
const contentMemo = useMemo(() => {
|
|
426
|
+
const handPlaceholderCon = () => {
|
|
468
427
|
if (labelMode === 'outside') return placeholder;
|
|
469
428
|
return jsxs(Fragment, {
|
|
470
429
|
children: [label || placeholder, required && jsx("span", Object.assign({
|
|
@@ -476,8 +435,8 @@ var TextField = function TextField(props) {
|
|
|
476
435
|
})]
|
|
477
436
|
});
|
|
478
437
|
};
|
|
479
|
-
|
|
480
|
-
|
|
438
|
+
const valCom = handValue();
|
|
439
|
+
const contentRender = () => {
|
|
481
440
|
return jsxs("div", Object.assign({
|
|
482
441
|
className: "text-field-content-within",
|
|
483
442
|
ref: selectPosDom
|
|
@@ -496,15 +455,15 @@ var TextField = function TextField(props) {
|
|
|
496
455
|
return contentRender();
|
|
497
456
|
}, [showText, isFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onClickIcon, allowClear, onClear]);
|
|
498
457
|
// 搜索下拉内容
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
458
|
+
const selectContentMemo = useMemo(() => {
|
|
459
|
+
const handSelectContentClass = () => {
|
|
460
|
+
let str = 'text-field-select-content';
|
|
502
461
|
if (selectLoading) str += ' text-field-select-content-loading';
|
|
503
462
|
if (classSearchOne) str += " ".concat(classSearchOne);
|
|
504
463
|
return str;
|
|
505
464
|
};
|
|
506
|
-
|
|
507
|
-
if (
|
|
465
|
+
const handText = item => {
|
|
466
|
+
if (typeof item === 'object' && item !== null) {
|
|
508
467
|
return item[showSelectName];
|
|
509
468
|
}
|
|
510
469
|
return item;
|
|
@@ -515,7 +474,7 @@ var TextField = function TextField(props) {
|
|
|
515
474
|
width: "".concat(selectPosDom && selectPosDom.current ? selectPosDom.current.offsetWidth : 0, "px")
|
|
516
475
|
}
|
|
517
476
|
}, {
|
|
518
|
-
children: [selectData && selectData.map(
|
|
477
|
+
children: [selectData && selectData.map((item, index) => {
|
|
519
478
|
return jsx("div", Object.assign({
|
|
520
479
|
className: "text-field-select-content-item",
|
|
521
480
|
onMouseDown: clickSelectItem(item),
|
|
@@ -529,7 +488,7 @@ var TextField = function TextField(props) {
|
|
|
529
488
|
}));
|
|
530
489
|
}, [selectPosDom, open, selectData, renderSelectItem, showSelectName, onSelect, selectLoading, classSearchOne, searchEmpty]);
|
|
531
490
|
// 带有搜索的中间主体
|
|
532
|
-
|
|
491
|
+
const searchContentMemo = useMemo(() => {
|
|
533
492
|
return jsx(Dropdown, Object.assign({
|
|
534
493
|
visible: open,
|
|
535
494
|
placement: 'bottomLeft',
|
|
@@ -543,11 +502,11 @@ var TextField = function TextField(props) {
|
|
|
543
502
|
}));
|
|
544
503
|
}, [showText, isFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onSelect, selectPosDom, open, selectPopoverClass, size, onClickIcon, selectData, allowClear, onClear]);
|
|
545
504
|
// 外标题
|
|
546
|
-
|
|
547
|
-
|
|
505
|
+
const outSideMemo = useMemo(() => {
|
|
506
|
+
const showTag = Boolean(required || labelSign || label);
|
|
548
507
|
if (labelMode === 'outside' && showTag) {
|
|
549
|
-
|
|
550
|
-
|
|
508
|
+
const handLabelClass = () => {
|
|
509
|
+
let str = 'text-field-label';
|
|
551
510
|
if (labelTooltip && labelTooltip.className) {
|
|
552
511
|
str += " ".concat(labelTooltip.className);
|
|
553
512
|
}
|
|
@@ -564,8 +523,8 @@ var TextField = function TextField(props) {
|
|
|
564
523
|
return null;
|
|
565
524
|
}, [labelMode, label, labelSign, required, labelTooltip]);
|
|
566
525
|
// 处理class
|
|
567
|
-
|
|
568
|
-
|
|
526
|
+
const handClass = () => {
|
|
527
|
+
let str = "".concat($prefixCls, "-text-field");
|
|
569
528
|
if (className) str += " ".concat(className);
|
|
570
529
|
if (size && !multiline) str += " ".concat($prefixCls, "-text-field-").concat(size);
|
|
571
530
|
if (error) str += " ".concat($prefixCls, "-text-field-error");
|
|
@@ -575,20 +534,20 @@ var TextField = function TextField(props) {
|
|
|
575
534
|
if (IsNaN(props.limitLength)) str += " ".concat($prefixCls, "-text-field-limit-length");
|
|
576
535
|
if (IsNaN(props.limitLength) && valueCom && valueCom.toString().length > Number(props.limitLength)) str += " ".concat($prefixCls, "-text-field-limit");
|
|
577
536
|
if (resize) str += " ".concat($prefixCls, "-text-field-resize");
|
|
578
|
-
|
|
537
|
+
const valCom = handValue();
|
|
579
538
|
if (valCom || valCom === 0) str += " ".concat($prefixCls, "-text-field-value");
|
|
580
539
|
if (allowClear) str += " ".concat($prefixCls, "-text-field-allow-clear");
|
|
581
540
|
return str;
|
|
582
541
|
};
|
|
583
542
|
// 点击前缀
|
|
584
|
-
|
|
543
|
+
const clickBefore = event => {
|
|
585
544
|
onClickAddonBefore && onClickAddonBefore(event);
|
|
586
545
|
};
|
|
587
546
|
// 点击后缀
|
|
588
|
-
|
|
547
|
+
const clickAfter = event => {
|
|
589
548
|
onClickAddonAfter && onClickAddonAfter(event);
|
|
590
549
|
};
|
|
591
|
-
|
|
550
|
+
const contentRender = () => {
|
|
592
551
|
return jsxs("div", Object.assign({
|
|
593
552
|
className: "text-field-content"
|
|
594
553
|
}, {
|
|
@@ -605,7 +564,7 @@ var TextField = function TextField(props) {
|
|
|
605
564
|
}))]
|
|
606
565
|
}));
|
|
607
566
|
};
|
|
608
|
-
|
|
567
|
+
const handleContentRender = () => {
|
|
609
568
|
if (disabledTooltip) {
|
|
610
569
|
return jsx(Tooltip, Object.assign({
|
|
611
570
|
disabled: true
|