@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/HelperText/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
2
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
3
3
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
4
4
|
|
|
5
5
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2021/11/1 20:28\n* @description 表单错误提示\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-helper-text {\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: 12px;\n font-weight: 400;\n line-height: 20px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-helper-text.paraui-v4-helper-text-error {\n color: rgb(244, 66, 66);\n}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
error =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const HelperText = props => {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
style,
|
|
12
|
+
error = false,
|
|
13
|
+
hideErrorDom = false,
|
|
14
|
+
helperText
|
|
15
|
+
} = props;
|
|
16
16
|
if (hideErrorDom === null) return null;
|
|
17
17
|
// 不存在错误,且没有错误隐藏错误dom
|
|
18
18
|
if (!error && hideErrorDom) return null;
|
|
19
19
|
// 处理class
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const handClass = () => {
|
|
21
|
+
let str = "".concat($prefixCls, "-helper-text");
|
|
22
22
|
if (className) str += " ".concat(className);
|
|
23
23
|
if (error) str += " ".concat($prefixCls, "-helper-text-error");
|
|
24
24
|
return str;
|
package/InputLang/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
|
|
2
|
-
import { _ as _typeof } from '../_verture/typeof-adeedc13.js';
|
|
3
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
4
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
5
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
2
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
7
3
|
import { TextField } from '../TextField/index.js';
|
|
@@ -11,9 +7,8 @@ import AutoTips from '../AutoTips/index.js';
|
|
|
11
7
|
import { Popover } from '../Popover/index.js';
|
|
12
8
|
import Internet from '@para-ui/icons/Internet';
|
|
13
9
|
import { GetLanguage, ArrayToObject } from '@paraview/lib';
|
|
14
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
10
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
15
11
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
16
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
17
12
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
18
13
|
import '../Label/index.js';
|
|
19
14
|
import '../Help/index.js';
|
|
@@ -28,101 +23,82 @@ import '@para-ui/icons/PreviewOpen';
|
|
|
28
23
|
import '@para-ui/icons/CloseCircleF';
|
|
29
24
|
import '../Loading/index.js';
|
|
30
25
|
import '@para-ui/icons/LoadingF';
|
|
31
|
-
import '../_verture/useGlobalProps-
|
|
26
|
+
import '../_verture/useGlobalProps-1e416658.js';
|
|
32
27
|
import '@para-ui/core/GlobalContext';
|
|
33
|
-
import '../_verture/index-
|
|
28
|
+
import '../_verture/index-da9097d3.js';
|
|
34
29
|
import 'rc-dropdown';
|
|
35
|
-
import '../_verture/usePopupContainer-
|
|
30
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
36
31
|
import 'dayjs';
|
|
37
32
|
import '@para-ui/icons/Delete';
|
|
38
33
|
import '@para-ui/icons/PlusCircleF';
|
|
39
|
-
import '../_verture/useFormatMessage-
|
|
34
|
+
import '../_verture/useFormatMessage-eb13cf56.js';
|
|
40
35
|
|
|
41
36
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-input-lang {\n display: inline-block;\n width: 100%;\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}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-before .lang-key {\n max-width: 100px;\n}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-within > .right-icon .lang-list-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-within > .right-icon .lang-list-icon:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-input-lang .input-lang-text-field > .paraui-v4-helper-text {\n display: none;\n}\n\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner {\n padding: 20px;\n line-height: 0;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box {\n padding-bottom: 0;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content .multi-box-content-item .multi-box-content-item-input .multi-box-text-field:first-child {\n flex: 1;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content .multi-box-content-item .multi-box-content-item-input .multi-box-text-field:last-child {\n flex: 3;\n}\n.paraui-v4-input-lang-popover.paraui-v4-input-lang-popover-disabled-add > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-add {\n display: none;\n}\n.paraui-v4-input-lang-popover.paraui-v4-input-lang-popover-disabled-delete > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content > .multi-box-content-item .opera-box {\n display: none;\n}";
|
|
42
37
|
styleInject(css_248z);
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
const InputLang = props => {
|
|
45
40
|
var _a;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
size =
|
|
52
|
-
placeholder
|
|
53
|
-
placeholderKey
|
|
54
|
-
placeholderValue
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var _useState3 = useState(GetLanguage() || 'zh'),
|
|
79
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
80
|
-
lang = _useState4[0],
|
|
81
|
-
setLang = _useState4[1]; // 当前语言
|
|
82
|
-
var _useState5 = useState({}),
|
|
83
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
84
|
-
langMapping = _useState6[0],
|
|
85
|
-
setLangMapping = _useState6[1];
|
|
86
|
-
var _useState7 = useState({}),
|
|
87
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
88
|
-
valueCom = _useState8[0],
|
|
89
|
-
setValueCom = _useState8[1];
|
|
90
|
-
var _useState9 = useState([]),
|
|
91
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
92
|
-
valueListLang = _useState10[0],
|
|
93
|
-
setValueListLang = _useState10[1]; // 多值框值
|
|
94
|
-
var constData = useRef({
|
|
95
|
-
lang: lang,
|
|
96
|
-
valueCom: valueCom,
|
|
41
|
+
const {
|
|
42
|
+
className,
|
|
43
|
+
style,
|
|
44
|
+
label,
|
|
45
|
+
labelTooltip,
|
|
46
|
+
size = 'large',
|
|
47
|
+
placeholder,
|
|
48
|
+
placeholderKey,
|
|
49
|
+
placeholderValue,
|
|
50
|
+
error = false,
|
|
51
|
+
hideErrorDom,
|
|
52
|
+
helperText = '',
|
|
53
|
+
required = false,
|
|
54
|
+
popoverClassName,
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
langList = ['zh', 'en'],
|
|
58
|
+
disabled = false,
|
|
59
|
+
disabledTooltip,
|
|
60
|
+
defaultLang,
|
|
61
|
+
disabledDelete,
|
|
62
|
+
disabledAdd,
|
|
63
|
+
disabledKey
|
|
64
|
+
} = props;
|
|
65
|
+
const [open, setOpen] = useState(false); // 打开弹窗
|
|
66
|
+
const [lang, setLang] = useState(GetLanguage() || 'zh'); // 当前语言
|
|
67
|
+
const [langMapping, setLangMapping] = useState({});
|
|
68
|
+
const [valueCom, setValueCom] = useState({});
|
|
69
|
+
const [valueListLang, setValueListLang] = useState([]); // 多值框值
|
|
70
|
+
const constData = useRef({
|
|
71
|
+
lang,
|
|
72
|
+
valueCom,
|
|
97
73
|
langMapping: {},
|
|
98
74
|
langLabelMapping: {}
|
|
99
75
|
});
|
|
100
|
-
|
|
76
|
+
const refDom = useRef(null);
|
|
101
77
|
constData.current.lang = lang;
|
|
102
78
|
constData.current.disabledDelete = disabledDelete;
|
|
103
|
-
useEffect(
|
|
79
|
+
useEffect(() => {
|
|
104
80
|
if (props.defaultValue !== undefined) {
|
|
105
81
|
handValue(props.defaultValue);
|
|
106
82
|
}
|
|
107
83
|
}, []);
|
|
108
|
-
useEffect(
|
|
84
|
+
useEffect(() => {
|
|
109
85
|
if (value !== undefined) {
|
|
110
86
|
handValue(value);
|
|
111
87
|
}
|
|
112
88
|
}, [value]);
|
|
113
|
-
useEffect(
|
|
89
|
+
useEffect(() => {
|
|
114
90
|
if (defaultLang !== undefined) {
|
|
115
91
|
setLang(defaultLang);
|
|
116
92
|
constData.current.lang = defaultLang;
|
|
117
93
|
handValue();
|
|
118
94
|
}
|
|
119
95
|
}, [defaultLang]);
|
|
120
|
-
useEffect(
|
|
96
|
+
useEffect(() => {
|
|
121
97
|
if (langList) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
for (
|
|
125
|
-
|
|
98
|
+
const obj = {};
|
|
99
|
+
const objLabel = {};
|
|
100
|
+
for (let i = 0, l = langList.length; i < l; i++) {
|
|
101
|
+
const item = langList[i];
|
|
126
102
|
if (typeof item === 'string') {
|
|
127
103
|
obj[item] = {
|
|
128
104
|
label: item,
|
|
@@ -146,35 +122,35 @@ var InputLang = function InputLang(props) {
|
|
|
146
122
|
/**
|
|
147
123
|
* 处理值
|
|
148
124
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
125
|
+
const handValue = val => {
|
|
126
|
+
const valueCopy = Object.assign({}, val || constData.current.valueCom);
|
|
127
|
+
const arr = [];
|
|
128
|
+
const json = {};
|
|
153
129
|
if (constData.current.disabledDelete) {
|
|
154
|
-
|
|
155
|
-
for (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
130
|
+
const keyArr = Object.keys(constData.current.langMapping) || [];
|
|
131
|
+
for (let i = 0, l = keyArr.length; i < l; i++) {
|
|
132
|
+
const keyItem = constData.current.langMapping[keyArr[i]] || {};
|
|
133
|
+
const key = keyItem.value;
|
|
134
|
+
const label = keyItem.label;
|
|
135
|
+
const val = valueCopy[key];
|
|
160
136
|
if (key !== constData.current.lang) {
|
|
161
137
|
json[key] = true;
|
|
162
138
|
arr.push({
|
|
163
|
-
label:
|
|
164
|
-
value:
|
|
139
|
+
label: label,
|
|
140
|
+
value: val || ''
|
|
165
141
|
});
|
|
166
142
|
}
|
|
167
143
|
}
|
|
168
144
|
}
|
|
169
|
-
|
|
170
|
-
for (
|
|
171
|
-
|
|
172
|
-
|
|
145
|
+
const valueCopyArr = Object.keys(valueCopy);
|
|
146
|
+
for (let i = 0, l = valueCopyArr.length; i < l; i++) {
|
|
147
|
+
const key = valueCopyArr[i];
|
|
148
|
+
const item = valueCopy[key];
|
|
173
149
|
// 不存在设置过,且不是当前语言
|
|
174
|
-
if (!json[
|
|
175
|
-
|
|
150
|
+
if (!json[key] && key !== constData.current.lang) {
|
|
151
|
+
const itemDetail = constData.current.langMapping[key] || {};
|
|
176
152
|
arr.push({
|
|
177
|
-
label: itemDetail.label ||
|
|
153
|
+
label: itemDetail.label || key,
|
|
178
154
|
value: item || ''
|
|
179
155
|
});
|
|
180
156
|
}
|
|
@@ -186,7 +162,7 @@ var InputLang = function InputLang(props) {
|
|
|
186
162
|
/**
|
|
187
163
|
* 向外抛值
|
|
188
164
|
* */
|
|
189
|
-
|
|
165
|
+
const outValue = val => {
|
|
190
166
|
if (props.value === undefined) {
|
|
191
167
|
constData.current.valueCom = Object.assign({}, val);
|
|
192
168
|
setValueCom(val);
|
|
@@ -197,26 +173,26 @@ var InputLang = function InputLang(props) {
|
|
|
197
173
|
* 改变当前语言
|
|
198
174
|
* @param event
|
|
199
175
|
*/
|
|
200
|
-
|
|
176
|
+
const changeValue = event => {
|
|
201
177
|
valueCom[lang] = event.target.value;
|
|
202
|
-
|
|
178
|
+
const val = Object.assign({}, valueCom);
|
|
203
179
|
outValue(val);
|
|
204
180
|
};
|
|
205
181
|
/**
|
|
206
182
|
* 改变弹窗语言值
|
|
207
183
|
* @param val
|
|
208
184
|
*/
|
|
209
|
-
|
|
210
|
-
setValueListLang(
|
|
185
|
+
const changeListLang = val => {
|
|
186
|
+
setValueListLang([...val]);
|
|
211
187
|
};
|
|
212
188
|
/** 模糊搜索 */
|
|
213
|
-
|
|
189
|
+
const fetchSuggestionsKey = (val, cb) => {
|
|
214
190
|
var _a;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
for (
|
|
218
|
-
|
|
219
|
-
if (
|
|
191
|
+
const arr = [];
|
|
192
|
+
const jsonMapping = ArrayToObject('label', valueListLang);
|
|
193
|
+
for (let i = 0, l = langList.length; i < l; i++) {
|
|
194
|
+
let item = langList[i];
|
|
195
|
+
if (typeof item === 'object') {
|
|
220
196
|
item = item.label;
|
|
221
197
|
}
|
|
222
198
|
if (!jsonMapping[item] && item !== (((_a = langMapping[lang]) === null || _a === void 0 ? void 0 : _a.label) || lang)) arr.push({
|
|
@@ -227,26 +203,26 @@ var InputLang = function InputLang(props) {
|
|
|
227
203
|
cb(arr);
|
|
228
204
|
};
|
|
229
205
|
/** 点击国际化图标 */
|
|
230
|
-
|
|
206
|
+
const clickRight = () => {
|
|
231
207
|
setOpen(true);
|
|
232
208
|
};
|
|
233
209
|
/** 关闭弹窗 */
|
|
234
|
-
|
|
210
|
+
const handleClose = bol => {
|
|
235
211
|
var _a;
|
|
236
212
|
if (bol) return;
|
|
237
213
|
setOpen(false);
|
|
238
214
|
// 向外抛值
|
|
239
|
-
|
|
215
|
+
const json = {};
|
|
240
216
|
json[lang] = valueCom[lang] || '';
|
|
241
|
-
for (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
217
|
+
for (let i = 0, l = valueListLang.length; i < l; i++) {
|
|
218
|
+
const item = valueListLang[i];
|
|
219
|
+
const label = ((_a = constData.current.langLabelMapping[item.label]) === null || _a === void 0 ? void 0 : _a.value) || item.label || '';
|
|
220
|
+
if (label.trim() !== '') json[label] = item.value || '';
|
|
245
221
|
}
|
|
246
222
|
outValue(json);
|
|
247
223
|
};
|
|
248
224
|
/** 当前语言 */
|
|
249
|
-
|
|
225
|
+
const AddonBeforeMemo = () => {
|
|
250
226
|
var _a;
|
|
251
227
|
return jsx("div", Object.assign({
|
|
252
228
|
className: 'lang-key'
|
|
@@ -259,7 +235,7 @@ var InputLang = function InputLang(props) {
|
|
|
259
235
|
}));
|
|
260
236
|
};
|
|
261
237
|
/** 加载更多语言 */
|
|
262
|
-
|
|
238
|
+
const RightIcon = useMemo(() => {
|
|
263
239
|
return jsx("div", Object.assign({
|
|
264
240
|
className: "lang-list-icon"
|
|
265
241
|
}, {
|
|
@@ -267,26 +243,30 @@ var InputLang = function InputLang(props) {
|
|
|
267
243
|
}));
|
|
268
244
|
}, []);
|
|
269
245
|
/** 处理弹出框className */
|
|
270
|
-
|
|
271
|
-
|
|
246
|
+
const popoverHandClass = () => {
|
|
247
|
+
let str = "".concat($prefixCls, "-input-lang-popover");
|
|
272
248
|
if (popoverClassName) str += " ".concat(popoverClassName);
|
|
273
249
|
if (disabledAdd) str += " ".concat($prefixCls, "-input-lang-popover-disabled-add");
|
|
274
250
|
if (disabledDelete) str += " ".concat($prefixCls, "-input-lang-popover-disabled-delete");
|
|
275
251
|
return str;
|
|
276
252
|
};
|
|
277
|
-
|
|
253
|
+
const handleDisabled = () => {
|
|
278
254
|
if (disabled === true) return true;
|
|
279
|
-
|
|
255
|
+
const arr = [];
|
|
280
256
|
if (disabledKey) {
|
|
281
|
-
|
|
282
|
-
for (
|
|
283
|
-
|
|
284
|
-
|
|
257
|
+
const bol = typeof disabledKey === 'object';
|
|
258
|
+
for (let i = 0, l = valueListLang.length; i < l; i++) {
|
|
259
|
+
const label = valueListLang[i].label || '';
|
|
260
|
+
const labelDetail = constData.current.langLabelMapping[label] || {};
|
|
285
261
|
if (bol) {
|
|
286
|
-
arr.push(
|
|
262
|
+
arr.push({
|
|
263
|
+
[label]: disabledKey.indexOf(labelDetail.value || label) !== -1
|
|
264
|
+
});
|
|
287
265
|
} else {
|
|
288
|
-
if (
|
|
289
|
-
arr.push(
|
|
266
|
+
if (label.trim() !== '') {
|
|
267
|
+
arr.push({
|
|
268
|
+
[label]: true
|
|
269
|
+
});
|
|
290
270
|
}
|
|
291
271
|
}
|
|
292
272
|
}
|
|
@@ -294,7 +274,7 @@ var InputLang = function InputLang(props) {
|
|
|
294
274
|
return arr;
|
|
295
275
|
};
|
|
296
276
|
/** 弹窗列表内容 */
|
|
297
|
-
|
|
277
|
+
const langListPopoverContent = () => {
|
|
298
278
|
return jsx("div", Object.assign({
|
|
299
279
|
className: "input-lang-list"
|
|
300
280
|
}, {
|
|
@@ -314,8 +294,8 @@ var InputLang = function InputLang(props) {
|
|
|
314
294
|
* 处理class
|
|
315
295
|
* @return {string}
|
|
316
296
|
*/
|
|
317
|
-
|
|
318
|
-
|
|
297
|
+
const handClass = () => {
|
|
298
|
+
let str = "".concat($prefixCls, "-input-lang");
|
|
319
299
|
if (size) str += " ".concat($prefixCls, "-input-lang-").concat(size);
|
|
320
300
|
if (error) str += " ".concat($prefixCls, "-input-lang-error");
|
|
321
301
|
if (className) str += " ".concat(className);
|