@para-ui/core 3.0.28 → 3.0.30
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 +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
package/TextField/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as _typeof } from '../_verture/typeof-498dd2b1.js';
|
|
2
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-
|
|
2
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-77980792.js';
|
|
3
3
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
4
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
@@ -11,9 +11,9 @@ import CloseCircle from '@para-ui/icons/CloseCircle';
|
|
|
11
11
|
import AutoTips from '../AutoTips/index.js';
|
|
12
12
|
import { Loading } from '../Loading/index.js';
|
|
13
13
|
import HelperText from '../HelperText/index.js';
|
|
14
|
-
import { u as useGlobalProps } from '../_verture/useGlobalProps-
|
|
15
|
-
import { D as Dropdown } from '../_verture/index-
|
|
16
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
14
|
+
import { u as useGlobalProps } from '../_verture/useGlobalProps-1b846a65.js';
|
|
15
|
+
import { D as Dropdown } from '../_verture/index-be4faaee.js';
|
|
16
|
+
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
|
|
17
17
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
18
18
|
import '../Help/index.js';
|
|
19
19
|
import '../Tooltip/index.js';
|
|
@@ -24,149 +24,133 @@ import '@para-ui/icons/Help';
|
|
|
24
24
|
import '@para-ui/icons/LoadingF';
|
|
25
25
|
import '@para-ui/core/GlobalContext';
|
|
26
26
|
import 'rc-dropdown';
|
|
27
|
-
import '../_verture/usePopupContainer-
|
|
27
|
+
import '../_verture/usePopupContainer-87febeb9.js';
|
|
28
28
|
import 'dayjs';
|
|
29
29
|
|
|
30
30
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-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-v3-text-field > .text-field-content {\n border: 1px solid;\n border-radius: 4px;\n border-color: rgba(171, 176, 185, 0.4);\n display: flex;\n width: 100%;\n position: relative;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v3-text-field > .text-field-content:hover {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-before {\n color: rgb(46, 55, 67);\n padding: 0 12px;\n border-right: 1px solid rgba(171, 176, 185, 0.4);\n background-color: rgba(171, 176, 185, 0.12);\n border-bottom-left-radius: 4px;\n border-top-left-radius: 4px;\n white-space: nowrap;\n display: flex;\n align-items: center;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-before svg {\n font-size: 20px;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within {\n position: relative;\n display: flex;\n flex-grow: 1;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .clean-up-icon {\n display: flex;\n height: 100%;\n align-items: center;\n margin-right: 12px;\n cursor: pointer;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .clean-up-icon svg {\n color: rgba(46, 55, 67, 0.7);\n font-size: 16px;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .clean-up-icon:hover svg {\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .right-icon {\n display: flex;\n height: 100%;\n align-items: center;\n margin-right: 12px;\n cursor: pointer;\n color: rgba(46, 55, 67, 0.7);\n position: relative;\n z-index: 1;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .right-icon.right-icon-password:hover svg {\n color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .right-icon svg {\n color: rgba(46, 55, 67, 0.7);\n font-size: 20px;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .length-limit {\n display: flex;\n height: 100%;\n align-items: center;\n margin-right: 12px;\n color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-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-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input input::-webkit-outer-spin-button,\n.paraui-v3-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-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input input[type=number] {\n -moz-appearance: textfield;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n width: 100%;\n height: 100%;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n width: 100% !important;\n padding: 12px;\n resize: none;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input, .paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n font-size: 14px;\n color: rgb(46, 55, 67);\n border: 0;\n border-radius: 4px;\n background: transparent;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input::-ms-clear, .paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea::-ms-clear {\n display: none;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input::-ms-reveal, .paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea::-ms-reveal {\n display: none;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > input:disabled, .paraui-v3-text-field > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea:disabled {\n background-color: transparent;\n}\n.paraui-v3-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 12px;\n color: rgba(46, 55, 67, 0.4);\n cursor: text;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n}\n.paraui-v3-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(235, 96, 84);\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-after {\n color: rgb(46, 55, 67);\n padding: 0 12px;\n border-left: 1px solid rgba(171, 176, 185, 0.4);\n background-color: rgba(171, 176, 185, 0.12);\n border-bottom-right-radius: 4px;\n border-top-right-radius: 4px;\n white-space: nowrap;\n display: flex;\n align-items: center;\n}\n.paraui-v3-text-field > .text-field-content > .text-field-content-after svg {\n font-size: 20px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-multiline > .text-field-content .text-field-content-within > .clean-up-icon {\n display: none;\n}\n.paraui-v3-text-field.paraui-v3-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% - 12px);\n background: white;\n justify-content: flex-end;\n padding-bottom: 8px;\n margin-right: 0;\n}\n.paraui-v3-text-field.paraui-v3-text-field-multiline > .text-field-content .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n padding-top: 12px;\n line-height: 1;\n height: calc(100% - 24px);\n}\n.paraui-v3-text-field.paraui-v3-text-field-disabled > .text-field-content {\n background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-text-field.paraui-v3-text-field-disabled > .text-field-content:hover {\n border-color: rgba(171, 176, 185, 0.4);\n}\n.paraui-v3-text-field.paraui-v3-text-field-disabled > .text-field-content > .text-field-content-before {\n background-color: transparent;\n}\n.paraui-v3-text-field.paraui-v3-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-v3-text-field.paraui-v3-text-field-disabled > .text-field-content > .text-field-content-within > .text-field-content-within-input > input, .paraui-v3-text-field.paraui-v3-text-field-disabled > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n cursor: not-allowed;\n}\n.paraui-v3-text-field.paraui-v3-text-field-disabled > .text-field-content > .text-field-content-after {\n background-color: transparent;\n}\n.paraui-v3-text-field.paraui-v3-text-field-disabled.paraui-v3-text-field-multiline > .text-field-content .text-field-content-within > .length-limit {\n background-color: transparent;\n}\n.paraui-v3-text-field.paraui-v3-text-field-error > .text-field-content {\n border-color: rgb(235, 96, 84) !important;\n}\n.paraui-v3-text-field.paraui-v3-text-field-error > .text-field-content:hover {\n border-color: rgb(235, 96, 84);\n}\n.paraui-v3-text-field.paraui-v3-text-field-limit > .text-field-content {\n border-color: rgb(235, 96, 84) !important;\n}\n.paraui-v3-text-field.paraui-v3-text-field-limit > .text-field-content:hover {\n border-color: rgb(235, 96, 84) !important;\n}\n.paraui-v3-text-field.paraui-v3-text-field-limit-length > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n padding-bottom: 25px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-focus > .text-field-content {\n border-color: rgb(54, 102, 214);\n}\n.paraui-v3-text-field.paraui-v3-text-field-small > .text-field-content {\n height: 28px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-small > .text-field-content > .text-field-content-before {\n line-height: 26px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-small > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 26px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-small > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 6px 12px;\n}\n.paraui-v3-text-field.paraui-v3-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-v3-text-field.paraui-v3-text-field-small > .text-field-content .text-field-content-after {\n line-height: 26px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content {\n height: 32px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content > .text-field-content-before {\n line-height: 30px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 30px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 8px 12px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n line-height: 30px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-medium > .text-field-content .text-field-content-after {\n line-height: 30px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content {\n height: 36px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content > .text-field-content-before {\n line-height: 34px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input {\n height: 34px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input > input {\n padding: 10px 12px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content > .text-field-content-within > .text-field-content-within-input > .text-field-label-placeholder {\n line-height: 34px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-large > .text-field-content .text-field-content-after {\n line-height: 34px;\n}\n.paraui-v3-text-field.paraui-v3-text-field-resize > .text-field-content > .text-field-content-within > .text-field-content-within-input > textarea {\n resize: both;\n}\n\n.paraui-v3-text-field-select.component-dropdown > .text-field-select-content {\n max-height: 300px;\n overflow: auto;\n}\n.paraui-v3-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item {\n display: flex;\n cursor: pointer;\n color: rgb(46, 55, 67);\n padding: 0 12px;\n}\n.paraui-v3-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item:hover {\n background-color: rgba(171, 176, 185, 0.12);\n color: rgb(54, 102, 214);\n}\n.paraui-v3-text-field-select.component-dropdown > .text-field-select-content > .text-field-select-content-item.text-field-select-content-item-keydown {\n background-color: rgba(171, 176, 185, 0.12);\n color: rgb(54, 102, 214);\n}\n.paraui-v3-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-v3-text-field-select.component-dropdown.paraui-v3-text-field-select-small > .text-field-select-content > .text-field-select-content-item {\n line-height: 28px;\n}\n.paraui-v3-text-field-select.component-dropdown.paraui-v3-text-field-select-medium > .text-field-select-content > .text-field-select-content-item {\n line-height: 32px;\n}\n.paraui-v3-text-field-select.component-dropdown.paraui-v3-text-field-select-large > .text-field-select-content > .text-field-select-content-item {\n line-height: 36px;\n}\n.paraui-v3-text-field-select.paraui-v3-text-field-select-data.component-tooltip {\n padding: 8px 0;\n}";
|
|
31
31
|
styleInject(css_248z);
|
|
32
32
|
|
|
33
|
+
// true:数值型的,false:非数值型
|
|
33
34
|
var IsNaN = function IsNaN(value) {
|
|
34
35
|
return typeof value === 'number' && !isNaN(value);
|
|
35
36
|
};
|
|
36
|
-
|
|
37
37
|
var TextField = function TextField(props) {
|
|
38
38
|
var _a = useGlobalProps(props, 'TextField'),
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
39
|
+
className = _a.className,
|
|
40
|
+
style = _a.style,
|
|
41
|
+
_a$size = _a.size,
|
|
42
|
+
size = _a$size === void 0 ? 'large' : _a$size,
|
|
43
|
+
_a$labelMode = _a.labelMode,
|
|
44
|
+
labelMode = _a$labelMode === void 0 ? 'outside' : _a$labelMode,
|
|
45
|
+
_a$placeholder = _a.placeholder,
|
|
46
|
+
placeholder = _a$placeholder === void 0 ? '' : _a$placeholder,
|
|
47
|
+
_a$label = _a.label,
|
|
48
|
+
label = _a$label === void 0 ? '' : _a$label,
|
|
49
|
+
labelTooltip = _a.labelTooltip,
|
|
50
|
+
_a$disabled = _a.disabled,
|
|
51
|
+
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
|
52
|
+
_a$multiline = _a.multiline,
|
|
53
|
+
multiline = _a$multiline === void 0 ? false : _a$multiline,
|
|
54
|
+
_a$required = _a.required,
|
|
55
|
+
required = _a$required === void 0 ? false : _a$required,
|
|
56
|
+
labelSign = _a.labelSign,
|
|
57
|
+
_a$rows = _a.rows,
|
|
58
|
+
rows = _a$rows === void 0 ? 2 : _a$rows,
|
|
59
|
+
_a$error = _a.error,
|
|
60
|
+
error = _a$error === void 0 ? false : _a$error,
|
|
61
|
+
hideErrorDom = _a.hideErrorDom,
|
|
62
|
+
_a$helperText = _a.helperText,
|
|
63
|
+
helperText = _a$helperText === void 0 ? '' : _a$helperText,
|
|
64
|
+
_a$addonBefore = _a.addonBefore,
|
|
65
|
+
addonBefore = _a$addonBefore === void 0 ? '' : _a$addonBefore,
|
|
66
|
+
_a$addonAfter = _a.addonAfter,
|
|
67
|
+
addonAfter = _a$addonAfter === void 0 ? '' : _a$addonAfter;
|
|
68
|
+
_a.defaultValue;
|
|
69
|
+
var value = _a.value,
|
|
70
|
+
_a$autoFocus = _a.autoFocus,
|
|
71
|
+
autoFocus = _a$autoFocus === void 0 ? false : _a$autoFocus,
|
|
72
|
+
_a$type = _a.type,
|
|
73
|
+
type = _a$type === void 0 ? 'text' : _a$type,
|
|
74
|
+
onClickIcon = _a.onClickIcon,
|
|
75
|
+
rightIcon = _a.rightIcon,
|
|
76
|
+
_a$showRightIcon = _a.showRightIcon,
|
|
77
|
+
showRightIcon = _a$showRightIcon === void 0 ? true : _a$showRightIcon,
|
|
78
|
+
_a$allowClear = _a.allowClear,
|
|
79
|
+
allowClear = _a$allowClear === void 0 ? false : _a$allowClear,
|
|
80
|
+
limitLength = _a.limitLength,
|
|
81
|
+
fetchSuggestions = _a.fetchSuggestions,
|
|
82
|
+
selectPopoverClass = _a.selectPopoverClass,
|
|
83
|
+
renderSelectItem = _a.renderSelectItem,
|
|
84
|
+
_a$showSelectName = _a.showSelectName,
|
|
85
|
+
showSelectName = _a$showSelectName === void 0 ? 'value' : _a$showSelectName,
|
|
86
|
+
_a$resize = _a.resize,
|
|
87
|
+
resize = _a$resize === void 0 ? true : _a$resize,
|
|
88
|
+
searchEmpty = _a.searchEmpty,
|
|
89
|
+
onBlur = _a.onBlur,
|
|
90
|
+
onFocus = _a.onFocus,
|
|
91
|
+
onChange = _a.onChange,
|
|
92
|
+
onKeydown = _a.onKeydown,
|
|
93
|
+
onKeyUp = _a.onKeyUp,
|
|
94
|
+
onEnter = _a.onEnter,
|
|
95
|
+
onClickAddonBefore = _a.onClickAddonBefore,
|
|
96
|
+
onClickAddonAfter = _a.onClickAddonAfter,
|
|
97
|
+
onSelect = _a.onSelect,
|
|
98
|
+
onClear = _a.onClear,
|
|
99
|
+
otherProps = __rest(_a, ["className", "style", "size", "labelMode", "placeholder", "label", "labelTooltip", "disabled", "multiline", "required", "labelSign", "rows", "error", "hideErrorDom", "helperText", "addonBefore", "addonAfter", "defaultValue", "value", "autoFocus", "type", "onClickIcon", "rightIcon", "showRightIcon", "allowClear", "limitLength", "fetchSuggestions", "selectPopoverClass", "renderSelectItem", "showSelectName", "resize", "searchEmpty", "onBlur", "onFocus", "onChange", "onKeydown", "onKeyUp", "onEnter", "onClickAddonBefore", "onClickAddonAfter", "onSelect", "onClear"]);
|
|
101
100
|
var _useState = useState('text-field-select-content-' + UUID()),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
102
|
+
classSearchOne = _useState2[0]; // 唯一class
|
|
106
103
|
var _useState3 = useState(true),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
105
|
+
showText = _useState4[0],
|
|
106
|
+
setShowText = _useState4[1]; // 是否显示输入框lable,placeholder true显示
|
|
112
107
|
var _useState5 = useState(''),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
109
|
+
valueCom = _useState6[0],
|
|
110
|
+
setValueCom = _useState6[1]; // 组件值
|
|
118
111
|
var _useState7 = useState(false),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
+
isFocus = _useState8[0],
|
|
114
|
+
setIsFocus = _useState8[1]; // 是否得到焦点
|
|
124
115
|
var _useState9 = useState('text'),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
117
|
+
typeCom = _useState10[0],
|
|
118
|
+
setTypeCom = _useState10[1];
|
|
129
119
|
var _useState11 = useState(false),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
121
|
+
open = _useState12[0],
|
|
122
|
+
setOpen = _useState12[1]; // 是否打开下拉框
|
|
135
123
|
var _useState13 = useState(false),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
124
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
125
|
+
selectLoading = _useState14[0],
|
|
126
|
+
setSelectLoading = _useState14[1]; // 下拉loading
|
|
141
127
|
var _useState15 = useState([]),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
128
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
129
|
+
selectData = _useState16[0],
|
|
130
|
+
setSelectData = _useState16[1];
|
|
131
|
+
//const [constData] = useState<ConstDataProps>({});
|
|
147
132
|
var inputDom = useRef(null);
|
|
148
133
|
var selectPosDom = useRef(null); // 下拉框定位元素
|
|
149
|
-
|
|
150
134
|
useEffect(function () {
|
|
151
135
|
if (props.defaultValue !== undefined) {
|
|
152
136
|
setValueCom(props.defaultValue);
|
|
153
137
|
}
|
|
154
|
-
}, []);
|
|
155
|
-
|
|
138
|
+
}, []);
|
|
139
|
+
// 组件类型
|
|
156
140
|
useEffect(function () {
|
|
157
141
|
if (type !== typeCom) setTypeCom(type);
|
|
158
|
-
}, [type]);
|
|
159
|
-
|
|
142
|
+
}, [type]);
|
|
143
|
+
// 监听value
|
|
160
144
|
useEffect(function () {
|
|
161
145
|
if (value !== undefined) {
|
|
162
146
|
setValueCom(value);
|
|
163
147
|
}
|
|
164
|
-
}, [value]);
|
|
165
|
-
|
|
148
|
+
}, [value]);
|
|
149
|
+
// 监听组件值,判断是否显示placehold,label
|
|
166
150
|
useEffect(function () {
|
|
167
151
|
if (valueCom !== '' && valueCom !== undefined) setShowText(false);else setShowText(true);
|
|
168
|
-
}, [valueCom]);
|
|
169
|
-
|
|
152
|
+
}, [valueCom]);
|
|
153
|
+
// 判断是否显示下拉
|
|
170
154
|
useEffect(function () {
|
|
171
155
|
if (!fetchSuggestions) return;
|
|
172
156
|
setOpen(isFocus);
|
|
@@ -177,7 +161,6 @@ var TextField = function TextField(props) {
|
|
|
177
161
|
} else {
|
|
178
162
|
window.removeEventListener("keydown", keydownCom);
|
|
179
163
|
}
|
|
180
|
-
|
|
181
164
|
return function () {
|
|
182
165
|
window.removeEventListener("keydown", keydownCom);
|
|
183
166
|
};
|
|
@@ -186,16 +169,13 @@ var TextField = function TextField(props) {
|
|
|
186
169
|
// 失去焦点
|
|
187
170
|
if (!isFocus && valueCom) {
|
|
188
171
|
var val = handValueLimit(valueCom);
|
|
189
|
-
|
|
190
172
|
if (val !== valueCom) {
|
|
191
173
|
var e = {};
|
|
192
174
|
e.target = inputDom.current;
|
|
193
175
|
e.target.value = val;
|
|
194
|
-
|
|
195
176
|
if (props.value === undefined) {
|
|
196
177
|
setValueCom(val);
|
|
197
178
|
}
|
|
198
|
-
|
|
199
179
|
props.onChange && props.onChange(e);
|
|
200
180
|
}
|
|
201
181
|
}
|
|
@@ -204,18 +184,14 @@ var TextField = function TextField(props) {
|
|
|
204
184
|
* 处理value值
|
|
205
185
|
* 超出字符长度限制,截取符合长度内容,并且触发onchange事件
|
|
206
186
|
* */
|
|
207
|
-
|
|
208
187
|
var handValueLimit = function handValueLimit(val) {
|
|
209
188
|
var valHand = val;
|
|
210
|
-
|
|
211
189
|
if (IsNaN(props.limitLength) && val.toString().length > Number(props.limitLength)) {
|
|
212
190
|
valHand = valHand.toString().substr(0, props.limitLength);
|
|
213
191
|
}
|
|
214
|
-
|
|
215
192
|
return valHand;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
};
|
|
194
|
+
// 点击内标题 / placeholder
|
|
219
195
|
var clickPlaceholder = function clickPlaceholder() {
|
|
220
196
|
if (disabled) return;
|
|
221
197
|
setShowText(false);
|
|
@@ -232,32 +208,27 @@ var TextField = function TextField(props) {
|
|
|
232
208
|
* currentDom: 当前元素
|
|
233
209
|
* }
|
|
234
210
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
211
|
var handKeydown = function handKeydown(config) {
|
|
238
212
|
var selectDom = config.selectDom,
|
|
239
|
-
|
|
240
|
-
|
|
213
|
+
keyCode = config.keyCode,
|
|
214
|
+
currentDom = config.currentDom;
|
|
241
215
|
var brotherDom = currentDom;
|
|
242
216
|
var type = 'nextSibling';
|
|
243
217
|
var classSelectStr = '.text-field-select-content-item';
|
|
244
|
-
|
|
245
218
|
if (keyCode === 38) {
|
|
246
219
|
// 上
|
|
247
220
|
type = 'previousSibling';
|
|
248
221
|
classSelectStr = '.text-field-select-content-item:last-child';
|
|
249
222
|
}
|
|
250
|
-
|
|
251
223
|
if (brotherDom) {
|
|
252
224
|
// 存在键盘上下的元素
|
|
253
|
-
brotherDom = brotherDom[type];
|
|
254
|
-
|
|
225
|
+
brotherDom = brotherDom[type];
|
|
226
|
+
// 没有兄弟节点,去最后跟第一的节点
|
|
255
227
|
if (!brotherDom) brotherDom = selectDom.querySelector(classSelectStr);
|
|
256
228
|
} else {
|
|
257
229
|
// 不存在,默认情况
|
|
258
230
|
brotherDom = selectDom.querySelector('.text-field-select-content-item');
|
|
259
231
|
}
|
|
260
|
-
|
|
261
232
|
if (brotherDom) {
|
|
262
233
|
brotherDom.classList.add("text-field-select-content-item-keydown");
|
|
263
234
|
domClientTop(brotherDom, selectDom);
|
|
@@ -268,14 +239,10 @@ var TextField = function TextField(props) {
|
|
|
268
239
|
* @param currentDom 当前元素
|
|
269
240
|
* @param selectDom 外容器
|
|
270
241
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
242
|
var domClientTop = function domClientTop(currentDom, selectDom) {
|
|
274
243
|
var clientHeight = selectDom.clientHeight; // 可见区域的高度
|
|
275
|
-
|
|
276
244
|
var top = currentDom.offsetTop + currentDom.clientHeight;
|
|
277
245
|
var difference = top - clientHeight;
|
|
278
|
-
|
|
279
246
|
if (difference > 0) {
|
|
280
247
|
selectDom.scrollTop = difference;
|
|
281
248
|
} else {
|
|
@@ -286,13 +253,11 @@ var TextField = function TextField(props) {
|
|
|
286
253
|
* 键盘事件
|
|
287
254
|
* @param e 键盘信息
|
|
288
255
|
*/
|
|
289
|
-
|
|
290
|
-
|
|
291
256
|
var keydownCom = function keydownCom(e) {
|
|
292
257
|
var selectDom = document.querySelector('.' + classSearchOne);
|
|
293
258
|
var currentDom = null;
|
|
294
|
-
var keydownDom = selectDom.querySelector('.text-field-select-content-item-keydown');
|
|
295
|
-
|
|
259
|
+
var keydownDom = selectDom.querySelector('.text-field-select-content-item-keydown');
|
|
260
|
+
// 回车
|
|
296
261
|
if (e.keyCode === 13) {
|
|
297
262
|
if (keydownDom) {
|
|
298
263
|
var val = keydownDom.dataset.val;
|
|
@@ -301,22 +266,19 @@ var TextField = function TextField(props) {
|
|
|
301
266
|
dom.blur();
|
|
302
267
|
}
|
|
303
268
|
}
|
|
304
|
-
|
|
305
269
|
if (keydownDom) {
|
|
306
270
|
currentDom = keydownDom;
|
|
307
271
|
keydownDom.classList.remove("text-field-select-content-item-keydown");
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
272
|
+
}
|
|
273
|
+
// 下
|
|
311
274
|
if (e.keyCode === 40) {
|
|
312
275
|
handKeydown({
|
|
313
276
|
selectDom: selectDom,
|
|
314
277
|
keyCode: e.keyCode,
|
|
315
278
|
currentDom: currentDom
|
|
316
279
|
});
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
280
|
+
}
|
|
281
|
+
// 上
|
|
320
282
|
if (e.keyCode === 38) {
|
|
321
283
|
handKeydown({
|
|
322
284
|
selectDom: selectDom,
|
|
@@ -329,8 +291,6 @@ var TextField = function TextField(props) {
|
|
|
329
291
|
* 失去焦点
|
|
330
292
|
* @param event 失去焦点元素对象
|
|
331
293
|
*/
|
|
332
|
-
|
|
333
|
-
|
|
334
294
|
var onBlurCom = function onBlurCom(event) {
|
|
335
295
|
setIsFocus(false);
|
|
336
296
|
if (event.target.value === '') setShowText(true);
|
|
@@ -340,8 +300,6 @@ var TextField = function TextField(props) {
|
|
|
340
300
|
* 下拉搜索
|
|
341
301
|
* @param val 搜索值
|
|
342
302
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
303
|
var fetchSuggestionsCom = function fetchSuggestionsCom(val) {
|
|
346
304
|
if (fetchSuggestions) {
|
|
347
305
|
setSelectLoading(true);
|
|
@@ -355,8 +313,6 @@ var TextField = function TextField(props) {
|
|
|
355
313
|
* 得到焦点
|
|
356
314
|
* @param event 得到焦点元素
|
|
357
315
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
316
|
var onFocusCom = function onFocusCom(event) {
|
|
361
317
|
setIsFocus(true);
|
|
362
318
|
onFocus && onFocus(event);
|
|
@@ -366,20 +322,15 @@ var TextField = function TextField(props) {
|
|
|
366
322
|
* 改变输入框
|
|
367
323
|
* @param event 输入框元素
|
|
368
324
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
325
|
var onChangeCom = function onChangeCom(event) {
|
|
372
326
|
var val = event.target.value;
|
|
373
327
|
if (val) setShowText(false); // 有值不显示placehold,防止浏览器默认填充
|
|
374
|
-
|
|
375
328
|
/*if (limitLength && val !== undefined && val !== '' && val.toString().length > limitLength) {
|
|
376
329
|
return;
|
|
377
330
|
}*/
|
|
378
|
-
|
|
379
331
|
if (props.value === undefined) {
|
|
380
332
|
setValueCom(val);
|
|
381
333
|
}
|
|
382
|
-
|
|
383
334
|
onChange && onChange(event);
|
|
384
335
|
fetchSuggestionsCom(event.target.value);
|
|
385
336
|
};
|
|
@@ -387,8 +338,6 @@ var TextField = function TextField(props) {
|
|
|
387
338
|
* 键盘按下事件
|
|
388
339
|
* @param event 输入框元素
|
|
389
340
|
*/
|
|
390
|
-
|
|
391
|
-
|
|
392
341
|
var onKeyDownCom = function onKeyDownCom(event) {
|
|
393
342
|
if (event.keyCode === 13) onEnter && onEnter(event);
|
|
394
343
|
onKeydown && onKeydown(event);
|
|
@@ -397,8 +346,6 @@ var TextField = function TextField(props) {
|
|
|
397
346
|
* 键盘抬起事件
|
|
398
347
|
* @param event 输入框元素
|
|
399
348
|
*/
|
|
400
|
-
|
|
401
|
-
|
|
402
349
|
var onKeyUpCom = function onKeyUpCom(event) {
|
|
403
350
|
onKeyUp && onKeyUp(event);
|
|
404
351
|
};
|
|
@@ -406,44 +353,36 @@ var TextField = function TextField(props) {
|
|
|
406
353
|
* 点击图标
|
|
407
354
|
* @param event 图标元素
|
|
408
355
|
*/
|
|
409
|
-
|
|
410
|
-
|
|
411
356
|
var onClickRightIcon = function onClickRightIcon(event) {
|
|
412
357
|
if (type === 'password') {
|
|
413
358
|
if (typeCom === 'text') {
|
|
414
359
|
setTypeCom('password');
|
|
415
360
|
}
|
|
416
|
-
|
|
417
361
|
if (typeCom === 'password') {
|
|
418
362
|
setTypeCom('text');
|
|
419
363
|
}
|
|
420
364
|
}
|
|
421
|
-
|
|
422
365
|
onClickIcon && onClickIcon(event);
|
|
423
366
|
};
|
|
424
|
-
|
|
425
367
|
var handValue = function handValue() {
|
|
426
368
|
if (props.value === undefined) return valueCom;
|
|
427
369
|
return value;
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
|
|
370
|
+
};
|
|
371
|
+
// 处理下拉框样式
|
|
431
372
|
var handleClassPopover = function handleClassPopover() {
|
|
432
373
|
var str = "".concat($prefixCls, "-text-field-select ").concat($prefixCls, "-scrollbar-small");
|
|
433
374
|
if (size) str += " ".concat($prefixCls, "-text-field-select-").concat(size);
|
|
434
375
|
if (selectPopoverClass) str += ' ' + selectPopoverClass;
|
|
435
376
|
if (selectData.length > 0) str += " ".concat($prefixCls, "-text-field-select-data");
|
|
436
377
|
return str;
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
|
|
378
|
+
};
|
|
379
|
+
// 点击下拉
|
|
440
380
|
var clickSelectItem = function clickSelectItem(item) {
|
|
441
381
|
return function (e) {
|
|
442
382
|
onSelect && onSelect(item);
|
|
443
383
|
};
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
|
|
384
|
+
};
|
|
385
|
+
// 限制长度
|
|
447
386
|
var limitMemo = useMemo(function () {
|
|
448
387
|
return jsx(Fragment, {
|
|
449
388
|
children: IsNaN(limitLength) && jsx("span", Object.assign({
|
|
@@ -452,14 +391,14 @@ var TextField = function TextField(props) {
|
|
|
452
391
|
children: (valueCom ? valueCom.toString().length : 0) + '/' + limitLength
|
|
453
392
|
}))
|
|
454
393
|
});
|
|
455
|
-
}, [limitLength, valueCom]);
|
|
456
|
-
|
|
394
|
+
}, [limitLength, valueCom]);
|
|
395
|
+
// 图标
|
|
457
396
|
var rightIconMemo = useMemo(function () {
|
|
458
397
|
var rightIconFunc = function rightIconFunc() {
|
|
459
|
-
return rightIcon ? rightIcon :
|
|
398
|
+
return rightIcon ? rightIcon :
|
|
399
|
+
// 只有密码模式有默认图标
|
|
460
400
|
type === 'password' ? typeCom === 'password' ? jsx(VisibilityOff, {}) : jsx(Visibility, {}) : null;
|
|
461
401
|
};
|
|
462
|
-
|
|
463
402
|
var rightIconContent = rightIconFunc();
|
|
464
403
|
return jsx(Fragment, {
|
|
465
404
|
children: showRightIcon && rightIconContent && jsx("span", Object.assign({
|
|
@@ -469,8 +408,8 @@ var TextField = function TextField(props) {
|
|
|
469
408
|
children: rightIconContent
|
|
470
409
|
}))
|
|
471
410
|
});
|
|
472
|
-
}, [showRightIcon, rightIcon, type, typeCom, onClickIcon]);
|
|
473
|
-
|
|
411
|
+
}, [showRightIcon, rightIcon, type, typeCom, onClickIcon]);
|
|
412
|
+
// 输入框
|
|
474
413
|
var renderInputDom = function renderInputDom() {
|
|
475
414
|
if (multiline) {
|
|
476
415
|
return jsx("textarea", Object.assign({
|
|
@@ -485,7 +424,6 @@ var TextField = function TextField(props) {
|
|
|
485
424
|
disabled: disabled
|
|
486
425
|
}, otherProps));
|
|
487
426
|
}
|
|
488
|
-
|
|
489
427
|
return jsx("input", Object.assign({
|
|
490
428
|
ref: inputDom,
|
|
491
429
|
type: typeCom,
|
|
@@ -497,25 +435,21 @@ var TextField = function TextField(props) {
|
|
|
497
435
|
onKeyUp: onKeyUpCom,
|
|
498
436
|
disabled: disabled
|
|
499
437
|
}, otherProps));
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
|
|
438
|
+
};
|
|
439
|
+
// 点击清楚按钮
|
|
503
440
|
var clickClean = function clickClean() {
|
|
504
441
|
var target = inputDom.current;
|
|
505
442
|
target.value = '';
|
|
506
|
-
|
|
507
443
|
if (props.value === undefined) {
|
|
508
444
|
setValueCom('');
|
|
509
445
|
}
|
|
510
|
-
|
|
511
446
|
onChange && onChange({
|
|
512
447
|
target: target
|
|
513
448
|
});
|
|
514
449
|
fetchSuggestionsCom('');
|
|
515
450
|
onClear && onClear();
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
|
|
451
|
+
};
|
|
452
|
+
// 清空内容
|
|
519
453
|
var clearRender = function clearRender() {
|
|
520
454
|
if (handValue() && !disabled && allowClear) {
|
|
521
455
|
return jsx("span", Object.assign({
|
|
@@ -525,9 +459,8 @@ var TextField = function TextField(props) {
|
|
|
525
459
|
children: jsx(CloseCircle, {})
|
|
526
460
|
}));
|
|
527
461
|
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
|
|
462
|
+
};
|
|
463
|
+
// 中间主体
|
|
531
464
|
var contentMemo = useMemo(function () {
|
|
532
465
|
var handPlaceholderCon = function handPlaceholderCon() {
|
|
533
466
|
if (labelMode === 'outside') return placeholder;
|
|
@@ -541,7 +474,6 @@ var TextField = function TextField(props) {
|
|
|
541
474
|
})]
|
|
542
475
|
});
|
|
543
476
|
};
|
|
544
|
-
|
|
545
477
|
return jsxs("div", Object.assign({
|
|
546
478
|
className: "text-field-content-within",
|
|
547
479
|
ref: selectPosDom
|
|
@@ -557,8 +489,8 @@ var TextField = function TextField(props) {
|
|
|
557
489
|
}))]
|
|
558
490
|
})), clearRender(), limitMemo, rightIconMemo]
|
|
559
491
|
}));
|
|
560
|
-
}, [showText, isFocus, autoFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onClickIcon, allowClear, onClear]);
|
|
561
|
-
|
|
492
|
+
}, [showText, isFocus, autoFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onClickIcon, allowClear, onClear]);
|
|
493
|
+
// 搜索下拉内容
|
|
562
494
|
var selectContentMemo = useMemo(function () {
|
|
563
495
|
var handSelectContentClass = function handSelectContentClass() {
|
|
564
496
|
var str = 'text-field-select-content';
|
|
@@ -566,15 +498,12 @@ var TextField = function TextField(props) {
|
|
|
566
498
|
if (classSearchOne) str += ' ' + classSearchOne;
|
|
567
499
|
return str;
|
|
568
500
|
};
|
|
569
|
-
|
|
570
501
|
var handText = function handText(item) {
|
|
571
502
|
if (_typeof(item) === 'object' && item !== null) {
|
|
572
503
|
return item[showSelectName];
|
|
573
504
|
}
|
|
574
|
-
|
|
575
505
|
return item;
|
|
576
506
|
};
|
|
577
|
-
|
|
578
507
|
return jsxs("div", Object.assign({
|
|
579
508
|
className: handSelectContentClass(),
|
|
580
509
|
style: {
|
|
@@ -593,8 +522,8 @@ var TextField = function TextField(props) {
|
|
|
593
522
|
}), index);
|
|
594
523
|
}), selectData.length === 0 && searchEmpty, selectLoading && jsx(Loading, {})]
|
|
595
524
|
}));
|
|
596
|
-
}, [selectPosDom, open, selectData, renderSelectItem, showSelectName, onSelect, selectLoading, classSearchOne, searchEmpty]);
|
|
597
|
-
|
|
525
|
+
}, [selectPosDom, open, selectData, renderSelectItem, showSelectName, onSelect, selectLoading, classSearchOne, searchEmpty]);
|
|
526
|
+
// 带有搜索的中间主体
|
|
598
527
|
var searchContentMemo = useMemo(function () {
|
|
599
528
|
return jsx(Dropdown, Object.assign({
|
|
600
529
|
visible: open,
|
|
@@ -607,22 +536,18 @@ var TextField = function TextField(props) {
|
|
|
607
536
|
}, {
|
|
608
537
|
children: contentMemo
|
|
609
538
|
}));
|
|
610
|
-
}, [showText, isFocus, autoFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onSelect, selectPosDom, open, selectPopoverClass, size, onClickIcon, selectData, allowClear, onClear]);
|
|
611
|
-
|
|
539
|
+
}, [showText, isFocus, autoFocus, typeCom, valueCom, limitMemo, rightIconMemo, labelMode, placeholder, label, disabled, multiline, rows, otherProps, onChange, fetchSuggestions, onSelect, selectPosDom, open, selectPopoverClass, size, onClickIcon, selectData, allowClear, onClear]);
|
|
540
|
+
// 外标题
|
|
612
541
|
var outSideMemo = useMemo(function () {
|
|
613
542
|
var showTag = Boolean(required || labelSign || label);
|
|
614
|
-
|
|
615
543
|
if (labelMode === 'outside' && showTag) {
|
|
616
544
|
var handLabelClass = function handLabelClass() {
|
|
617
545
|
var str = 'text-field-label';
|
|
618
|
-
|
|
619
546
|
if (labelTooltip && labelTooltip.className) {
|
|
620
547
|
str += ' ' + labelTooltip.className;
|
|
621
548
|
}
|
|
622
|
-
|
|
623
549
|
return str;
|
|
624
550
|
};
|
|
625
|
-
|
|
626
551
|
return jsx(Label, Object.assign({
|
|
627
552
|
label: label,
|
|
628
553
|
required: required,
|
|
@@ -631,10 +556,9 @@ var TextField = function TextField(props) {
|
|
|
631
556
|
className: handLabelClass()
|
|
632
557
|
}));
|
|
633
558
|
}
|
|
634
|
-
|
|
635
559
|
return null;
|
|
636
|
-
}, [labelMode, label, labelSign, required, labelTooltip]);
|
|
637
|
-
|
|
560
|
+
}, [labelMode, label, labelSign, required, labelTooltip]);
|
|
561
|
+
// 处理class
|
|
638
562
|
var handClass = function handClass() {
|
|
639
563
|
var str = "".concat($prefixCls, "-text-field");
|
|
640
564
|
if (className) str += ' ' + className;
|
|
@@ -649,18 +573,15 @@ var TextField = function TextField(props) {
|
|
|
649
573
|
if (handValue()) str += " ".concat($prefixCls, "-text-field-value");
|
|
650
574
|
if (allowClear) str += " ".concat($prefixCls, "-text-field-allow-clear");
|
|
651
575
|
return str;
|
|
652
|
-
};
|
|
653
|
-
|
|
654
|
-
|
|
576
|
+
};
|
|
577
|
+
// 点击前缀
|
|
655
578
|
var clickBefore = function clickBefore(event) {
|
|
656
579
|
onClickAddonBefore && onClickAddonBefore(event);
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
|
|
580
|
+
};
|
|
581
|
+
// 点击后缀
|
|
660
582
|
var clickAfter = function clickAfter(event) {
|
|
661
583
|
onClickAddonAfter && onClickAddonAfter(event);
|
|
662
584
|
};
|
|
663
|
-
|
|
664
585
|
return jsxs("div", Object.assign({
|
|
665
586
|
className: handClass(),
|
|
666
587
|
style: style
|