@chaoswise/ui 2.2.9 → 2.3.1
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/lib/AbreastLayout/index.js +5 -1
- package/lib/BasicLayout/Sider.js +8 -3
- package/lib/BasicLayout/index.js +10 -2
- package/lib/Button/index.js +0 -8
- package/lib/CWCascader/Cascader/index.js +207 -0
- package/lib/CWCascader/index.js +60 -0
- package/lib/CWCascader/index.less +31 -0
- package/lib/CWCascader/rc-cascader/Cascader.js +353 -0
- package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +22 -0
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +276 -0
- package/lib/CWCascader/rc-cascader/OptionList/index.js +221 -0
- package/lib/CWCascader/rc-cascader/OptionList/useActive.js +33 -0
- package/lib/CWCascader/rc-cascader/OptionList/useKeyboard.js +173 -0
- package/lib/CWCascader/rc-cascader/context.js +3 -0
- package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +85 -0
- package/lib/CWCascader/rc-cascader/hooks/useEntities.js +40 -0
- package/lib/CWCascader/rc-cascader/hooks/useMissingValues.js +19 -0
- package/lib/CWCascader/rc-cascader/hooks/useRefFunc.js +13 -0
- package/lib/CWCascader/rc-cascader/hooks/useSearchConfig.js +30 -0
- package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +74 -0
- package/lib/CWCascader/rc-cascader/index.js +2 -0
- package/lib/CWCascader/rc-cascader/utils/commonUtil.js +54 -0
- package/lib/CWCascader/rc-cascader/utils/treeUtil.js +81 -0
- package/lib/CWCascader/rc-cascader/utils/warningPropsUtil.js +30 -0
- package/lib/CWRangePicker/DropdownMenu/index.js +1 -1
- package/lib/CWRangePicker/DropdownMenu/index.less +11 -7
- package/lib/CWRangePicker/index.js +30 -29
- package/lib/CWSelect/index.js +9 -1
- package/lib/CWSelect/index.less +11 -1
- package/lib/Cascader/index.js +0 -8
- package/lib/Cascader/index.less +23 -0
- package/lib/Cascaders/Cascader/index.js +208 -0
- package/lib/Cascaders/index.js +17 -0
- package/lib/Cascaders/index.less +1 -0
- package/lib/Cascaders/rc-cascader/Cascader.js +326 -0
- package/lib/Cascaders/rc-cascader/OptionList/Checkbox.js +22 -0
- package/lib/Cascaders/rc-cascader/OptionList/Column.js +203 -0
- package/lib/Cascaders/rc-cascader/OptionList/index.js +213 -0
- package/lib/Cascaders/rc-cascader/OptionList/useActive.js +33 -0
- package/lib/Cascaders/rc-cascader/OptionList/useKeyboard.js +171 -0
- package/lib/Cascaders/rc-cascader/context.js +3 -0
- package/lib/Cascaders/rc-cascader/hooks/useDisplayValues.js +56 -0
- package/lib/Cascaders/rc-cascader/hooks/useEntities.js +34 -0
- package/lib/Cascaders/rc-cascader/hooks/useMissingValues.js +19 -0
- package/lib/Cascaders/rc-cascader/hooks/useRefFunc.js +13 -0
- package/lib/Cascaders/rc-cascader/hooks/useSearchConfig.js +25 -0
- package/lib/Cascaders/rc-cascader/hooks/useSearchOptions.js +72 -0
- package/lib/Cascaders/rc-cascader/index.js +2 -0
- package/lib/Cascaders/rc-cascader/utils/commonUtil.js +54 -0
- package/lib/Cascaders/rc-cascader/utils/treeUtil.js +37 -0
- package/lib/Cascaders/rc-cascader/utils/warningPropsUtil.js +30 -0
- package/lib/CitySelect/index.js +2 -2
- package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.js +46 -0
- package/lib/DropdownDatePicker/DropdownMenu/MoreTimeList/index.less +14 -0
- package/lib/DropdownDatePicker/DropdownMenu/index.js +126 -0
- package/lib/DropdownDatePicker/DropdownMenu/index.less +68 -0
- package/lib/DropdownDatePicker/assets/Calendar2.js +15 -0
- package/lib/DropdownDatePicker/assets/live.js +19 -0
- package/lib/DropdownDatePicker/assets/more.js +23 -0
- package/lib/DropdownDatePicker/index.js +281 -0
- package/lib/DropdownDatePicker/index.less +34 -0
- package/lib/DropdownDatePicker/locale/en_US.js +20 -0
- package/lib/DropdownDatePicker/locale/index.js +12 -0
- package/lib/DropdownDatePicker/locale/zh_CN.js +20 -0
- package/lib/DropdownDatePicker/utils/index.js +247 -0
- package/lib/InputNumber/index.js +15 -11
- package/lib/ModuleFederation/ErrorBoundary/index.js +54 -0
- package/lib/ModuleFederation/index.js +10 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +185 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/attach-script.js +42 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/index.js +1 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +44 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/loading-script.js +35 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/suspend.js +28 -0
- package/lib/ModuleFederation/react-dynamic-remote-component/utils.js +7 -0
- package/lib/QuickTransfer/locale/index.js +1 -4
- package/lib/QuickTransfer/locale/zh_CN.js +0 -8
- package/package.json +4 -3
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
color: @text-color;
|
|
27
27
|
font-weight: normal;
|
|
28
28
|
font-size: @dropdown-font-size;
|
|
29
|
-
line-height:
|
|
29
|
+
line-height: 22px; // 整体32px的高度
|
|
30
30
|
|
|
31
31
|
.cw-range-picker-menu-item-calendar {
|
|
32
32
|
width: 14px;
|
|
@@ -46,19 +46,22 @@
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.cw-dropdown-menu-item-more {
|
|
49
|
+
position: relative;
|
|
49
50
|
justify-content: space-between;
|
|
50
|
-
|
|
51
|
+
overflow: visible;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
.cw-dropdown-menu-more-wrapper {
|
|
55
56
|
width: 384px;
|
|
56
|
-
top:
|
|
57
|
-
|
|
57
|
+
top: auto !important;
|
|
58
|
+
bottom: -32px !important;
|
|
59
|
+
left: calc(100% + 2px) !important;
|
|
58
60
|
box-shadow: @box-shadow-base;
|
|
59
61
|
|
|
60
62
|
&.cw-dropdown-menu-more-wrapper-left {
|
|
61
|
-
|
|
63
|
+
right: calc(100% + 2px) !important;
|
|
64
|
+
left: auto !important;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
.cw-dropdown-menu-history-outer-wrapper{
|
|
@@ -102,10 +105,11 @@
|
|
|
102
105
|
.cw-dropdown-menu-history-more-wrapper {
|
|
103
106
|
width: 384px;
|
|
104
107
|
top: 0 !important;
|
|
105
|
-
left:
|
|
108
|
+
left: calc(100% + 2px) !important;
|
|
106
109
|
box-shadow: @box-shadow-base;
|
|
107
110
|
&.cw-dropdown-menu-history-more-wrapper-left {
|
|
108
|
-
|
|
111
|
+
right: calc(100% + 2px) !important;
|
|
112
|
+
left: auto !important;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
}
|
|
@@ -160,7 +160,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
160
160
|
var _refreshRef$current;
|
|
161
161
|
return {
|
|
162
162
|
onStop: onStop,
|
|
163
|
-
onRefresh: (_refreshRef$current = refreshRef.current) === null || _refreshRef$current === void 0 ? void 0 : _refreshRef$current.onRefresh
|
|
163
|
+
onRefresh: (_refreshRef$current = refreshRef.current) === null || _refreshRef$current === void 0 ? void 0 : _refreshRef$current.onRefresh,
|
|
164
|
+
onClickAutoRefresh: onClickAutoRefresh
|
|
164
165
|
};
|
|
165
166
|
});
|
|
166
167
|
// 初始时记录当前时间项
|
|
@@ -251,16 +252,23 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
251
252
|
};
|
|
252
253
|
}, []);
|
|
253
254
|
// 日期是否存在
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
var _useMemo = useMemo(function () {
|
|
256
|
+
// 不符合最近时间格式和没有日期数据返回false
|
|
257
|
+
var values = recordDateValue.value;
|
|
258
|
+
var _judgeType7 = judgeType(recordDateValue),
|
|
259
|
+
_judgeType8 = _slicedToArray(_judgeType7, 2),
|
|
260
|
+
isRule = _judgeType8[0],
|
|
261
|
+
captureUnit = _judgeType8[1];
|
|
262
|
+
values = funcValueChangeArrayValue(values);
|
|
263
|
+
if (isRule) {
|
|
264
|
+
values = getChangeUnitDate(captureUnit[0], captureUnit[1]);
|
|
265
|
+
}
|
|
266
|
+
if (!isRule && !values) return [false, undefined];
|
|
267
|
+
return [true, values];
|
|
268
|
+
}, [recordDateValue]),
|
|
269
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
270
|
+
isHasDate = _useMemo2[0],
|
|
271
|
+
_defaultValue = _useMemo2[1];
|
|
264
272
|
// 重组数据源
|
|
265
273
|
var regroupDataSource = useMemo(function () {
|
|
266
274
|
if (exceedShowInMore) {
|
|
@@ -352,9 +360,9 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
352
360
|
e.target.select();
|
|
353
361
|
}, 100);
|
|
354
362
|
};
|
|
355
|
-
//
|
|
356
|
-
var
|
|
357
|
-
|
|
363
|
+
// 输入框按下Enter
|
|
364
|
+
var onPressEnter = function onPressEnter(e) {
|
|
365
|
+
onInputBlur();
|
|
358
366
|
};
|
|
359
367
|
// 外部获取ref停止自动刷新
|
|
360
368
|
var onStop = function onStop() {
|
|
@@ -363,8 +371,12 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
363
371
|
((_refreshRef$current2 = refreshRef.current) === null || _refreshRef$current2 === void 0 ? void 0 : _refreshRef$current2.onAutoRefresh) && ((_refreshRef$current3 = refreshRef.current) === null || _refreshRef$current3 === void 0 ? void 0 : _refreshRef$current3.onAutoRefresh());
|
|
364
372
|
}
|
|
365
373
|
};
|
|
366
|
-
|
|
367
|
-
|
|
374
|
+
var onClickAutoRefresh = function onClickAutoRefresh() {
|
|
375
|
+
var _refreshRef$current4, _refreshRef$current5;
|
|
376
|
+
((_refreshRef$current4 = refreshRef.current) === null || _refreshRef$current4 === void 0 ? void 0 : _refreshRef$current4.onAutoRefresh) && ((_refreshRef$current5 = refreshRef.current) === null || _refreshRef$current5 === void 0 ? void 0 : _refreshRef$current5.onAutoRefresh());
|
|
377
|
+
};
|
|
378
|
+
// 输入框失去焦点
|
|
379
|
+
var onInputBlur = function onInputBlur(e) {
|
|
368
380
|
if (!isInputRef.current) return;
|
|
369
381
|
var _getUnit = getUnit(inputValue),
|
|
370
382
|
isRule = _getUnit.isRule,
|
|
@@ -376,9 +388,7 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
376
388
|
}, inputValue);
|
|
377
389
|
var isInvalidDate_ = isInvalidDate(returnValue.value);
|
|
378
390
|
if (!isInvalidDate_) {
|
|
379
|
-
var _inputRef$current;
|
|
380
391
|
// message.success(localeObj["fit-the-input-format"]);
|
|
381
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
|
|
382
392
|
_onChange(returnValue);
|
|
383
393
|
setIsFocus(false);
|
|
384
394
|
var _getHistoryInfo = getHistoryInfo(returnValue, historyList, locale, format),
|
|
@@ -401,11 +411,9 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
401
411
|
var _dateValue2 = finalDateOption.dateValue;
|
|
402
412
|
var dateCount = getTruthDateCount(_dateValue2);
|
|
403
413
|
if (dateCount === 2) {
|
|
404
|
-
var _inputRef$current2;
|
|
405
414
|
var _returnValue = getCorrectValue({
|
|
406
415
|
value: _dateValue2
|
|
407
416
|
});
|
|
408
|
-
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
|
|
409
417
|
_onChange(_returnValue);
|
|
410
418
|
setIsFocus(false);
|
|
411
419
|
var _getHistoryInfo3 = getHistoryInfo(_returnValue, historyList, locale, format),
|
|
@@ -545,15 +553,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
545
553
|
}
|
|
546
554
|
}
|
|
547
555
|
},
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
endTimeOption: moment("23:59:59", "HH:mm:ss")
|
|
551
|
-
},
|
|
552
|
-
defaultValue: [moment().subtract(1, "months").startOf("month"), moment().subtract(1, "months").startOf("month").add(1, "d").set({
|
|
553
|
-
"hour": 23,
|
|
554
|
-
"minute": 59,
|
|
555
|
-
"second": 59
|
|
556
|
-
})],
|
|
556
|
+
defaultValue: _defaultValue // 默认为当前已经选择的时间
|
|
557
|
+
,
|
|
557
558
|
showTime: {
|
|
558
559
|
hideDisabledOptions: true
|
|
559
560
|
}
|
package/lib/CWSelect/index.js
CHANGED
|
@@ -400,7 +400,15 @@ var CWSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
400
400
|
return !dataSource.length ? /*#__PURE__*/React.createElement("div", {
|
|
401
401
|
className: "cw-select-show-checkbox-empty"
|
|
402
402
|
}, localeObj["no-results-were-found"]) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
403
|
-
className: "cw-checkbox-all"
|
|
403
|
+
className: "cw-checkbox-all",
|
|
404
|
+
onMouseDown: function onMouseDown(e) {
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
e.stopPropagation();
|
|
407
|
+
},
|
|
408
|
+
onClick: function onClick(e) {
|
|
409
|
+
e.preventDefault();
|
|
410
|
+
e.stopPropagation();
|
|
411
|
+
}
|
|
404
412
|
}, /*#__PURE__*/React.createElement(_Checkbox, {
|
|
405
413
|
indeterminate: filterActiveValues.length && filterActiveValues.length !== dataSource.length,
|
|
406
414
|
checked: filterActiveValues.length === dataSource.length,
|
package/lib/CWSelect/index.less
CHANGED
|
@@ -661,7 +661,7 @@
|
|
|
661
661
|
font-weight: @select-item-selected-font-weight; // UI规范
|
|
662
662
|
background-color: @select-selected-enable-bg; // UI规范
|
|
663
663
|
}
|
|
664
|
-
&.cw-select-dropdown-multiple{
|
|
664
|
+
&.cw-select-dropdown-multiple.cw-select-dropdown-has-checkbox{
|
|
665
665
|
.@{select-prefix-cls}-item-option.@{select-prefix-cls}-item-option-selected:not(.@{select-prefix-cls}-item-option-disabled){
|
|
666
666
|
color: @text-color; // UI规范
|
|
667
667
|
font-weight: 400; // UI规范
|
|
@@ -695,6 +695,9 @@
|
|
|
695
695
|
&.cw-select-dropdown-has-checkbox{
|
|
696
696
|
.cw-checkbox-all{
|
|
697
697
|
padding: 6px 10px;
|
|
698
|
+
&:hover{
|
|
699
|
+
background-color: @select-item-active-bg;
|
|
700
|
+
}
|
|
698
701
|
}
|
|
699
702
|
.@{select-prefix-cls}-item{
|
|
700
703
|
padding: 6px 10px;
|
|
@@ -710,6 +713,13 @@
|
|
|
710
713
|
flex: 1;
|
|
711
714
|
overflow: hidden;
|
|
712
715
|
}
|
|
716
|
+
&:hover{
|
|
717
|
+
.@{ant-prefix}-checkbox{
|
|
718
|
+
.@{ant-prefix}-checkbox-inner{
|
|
719
|
+
border-color:@checkbox-color;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
713
723
|
}
|
|
714
724
|
}
|
|
715
725
|
}
|
package/lib/Cascader/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
/*
|
|
3
|
-
* @Author: andrew.qiao andrew.qiao@cloudwise.com
|
|
4
|
-
* @Date: 2023-05-11 15:08:15
|
|
5
|
-
* @LastEditors: andrew.qiao andrew.qiao@cloudwise.com
|
|
6
|
-
* @LastEditTime: 2023-05-11 19:15:27
|
|
7
|
-
* @FilePath: /change_01/aops_web_commons/packages/ui/components/Cascader/index.js
|
|
8
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
9
|
-
*/
|
|
10
2
|
import React, { forwardRef } from "react";
|
|
11
3
|
import Cascader from "../Antd4/cascader";
|
|
12
4
|
import "antd/es/cascader/style/index.less";
|
package/lib/Cascader/index.less
CHANGED
|
@@ -2,4 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
.@{cascader-prefix-cls}-menus {
|
|
4
4
|
position: static !important;
|
|
5
|
+
|
|
6
|
+
.@{cascader-prefix-cls}-menu {
|
|
7
|
+
.@{cascader-prefix-cls}-menu-item {
|
|
8
|
+
|
|
9
|
+
.@{cascader-prefix-cls}-menu-item-expand-icon,
|
|
10
|
+
.@{cascader-prefix-cls}-menu-item-loading-icon {
|
|
11
|
+
position: static;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.@{cascader-prefix-cls}.@{ant-prefix}-select {
|
|
18
|
+
.@{ant-prefix}-select-selection-overflow {
|
|
19
|
+
flex: 0 1 auto;
|
|
20
|
+
|
|
21
|
+
.@{ant-prefix}-select-selection-overflow-item {
|
|
22
|
+
|
|
23
|
+
.@{ant-prefix}-select-selection-search {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
5
28
|
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
// @ts-nocheck
|
|
20
|
+
import * as React from 'react';
|
|
21
|
+
import classNames from 'classnames';
|
|
22
|
+
import RcCascader from '../rc-cascader';
|
|
23
|
+
import omit from 'rc-util/lib/omit';
|
|
24
|
+
import RightOutlined from '@ant-design/icons/RightOutlined';
|
|
25
|
+
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
|
26
|
+
import LeftOutlined from '@ant-design/icons/LeftOutlined';
|
|
27
|
+
import { useContext } from 'react';
|
|
28
|
+
import devWarning from '../../Antd4/_util/devWarning';
|
|
29
|
+
import { ConfigContext } from '../../Antd4/config-provider';
|
|
30
|
+
import SizeContext from '../../Antd4/config-provider/SizeContext';
|
|
31
|
+
import getIcons from '../../Antd4/select/utils/iconUtil';
|
|
32
|
+
import { getTransitionName, getTransitionDirection } from '../../Antd4/_util/motion';
|
|
33
|
+
import { FormItemInputContext } from '../../Antd4/form4-24-7/context';
|
|
34
|
+
import { getMergedStatus, getStatusClassNames } from '../../Antd4/_util/statusUtils';
|
|
35
|
+
var SHOW_CHILD = RcCascader.SHOW_CHILD,
|
|
36
|
+
SHOW_PARENT = RcCascader.SHOW_PARENT;
|
|
37
|
+
function highlightKeyword(str, lowerKeyword, prefixCls) {
|
|
38
|
+
var cells = str.toLowerCase().split(lowerKeyword).reduce(function (list, cur, index) {
|
|
39
|
+
return index === 0 ? [cur] : [].concat(_toConsumableArray(list), [lowerKeyword, cur]);
|
|
40
|
+
}, []);
|
|
41
|
+
var fillCells = [];
|
|
42
|
+
var start = 0;
|
|
43
|
+
cells.forEach(function (cell, index) {
|
|
44
|
+
var end = start + cell.length;
|
|
45
|
+
var originWorld = str.slice(start, end);
|
|
46
|
+
start = end;
|
|
47
|
+
if (index % 2 === 1) {
|
|
48
|
+
originWorld =
|
|
49
|
+
/*#__PURE__*/
|
|
50
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
51
|
+
React.createElement("span", {
|
|
52
|
+
className: "".concat(prefixCls, "-menu-item-keyword"),
|
|
53
|
+
key: "seperator-".concat(index)
|
|
54
|
+
}, originWorld);
|
|
55
|
+
}
|
|
56
|
+
fillCells.push(originWorld);
|
|
57
|
+
});
|
|
58
|
+
return fillCells;
|
|
59
|
+
}
|
|
60
|
+
var defaultSearchRender = function defaultSearchRender(inputValue, path, prefixCls, fieldNames) {
|
|
61
|
+
var optionList = [];
|
|
62
|
+
// We do lower here to save perf
|
|
63
|
+
var lower = inputValue.toLowerCase();
|
|
64
|
+
path.forEach(function (node, index) {
|
|
65
|
+
if (index !== 0) {
|
|
66
|
+
optionList.push(' / ');
|
|
67
|
+
}
|
|
68
|
+
var label = node[fieldNames.label];
|
|
69
|
+
var type = _typeof(label);
|
|
70
|
+
if (type === 'string' || type === 'number') {
|
|
71
|
+
label = highlightKeyword(String(label), lower, prefixCls);
|
|
72
|
+
}
|
|
73
|
+
optionList.push(label);
|
|
74
|
+
});
|
|
75
|
+
return optionList;
|
|
76
|
+
};
|
|
77
|
+
var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
78
|
+
var _classNames2;
|
|
79
|
+
var customizePrefixCls = props.prefixCls,
|
|
80
|
+
customizeSize = props.size,
|
|
81
|
+
className = props.className,
|
|
82
|
+
multiple = props.multiple,
|
|
83
|
+
_props$bordered = props.bordered,
|
|
84
|
+
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
85
|
+
transitionName = props.transitionName,
|
|
86
|
+
_props$choiceTransiti = props.choiceTransitionName,
|
|
87
|
+
choiceTransitionName = _props$choiceTransiti === void 0 ? '' : _props$choiceTransiti,
|
|
88
|
+
popupClassName = props.popupClassName,
|
|
89
|
+
dropdownClassName = props.dropdownClassName,
|
|
90
|
+
expandIcon = props.expandIcon,
|
|
91
|
+
placement = props.placement,
|
|
92
|
+
showSearch = props.showSearch,
|
|
93
|
+
_props$allowClear = props.allowClear,
|
|
94
|
+
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
95
|
+
notFoundContent = props.notFoundContent,
|
|
96
|
+
direction = props.direction,
|
|
97
|
+
getPopupContainer = props.getPopupContainer,
|
|
98
|
+
customStatus = props.status,
|
|
99
|
+
showArrow = props.showArrow,
|
|
100
|
+
rest = __rest(props, ["prefixCls", "size", "className", "multiple", "bordered", "transitionName", "choiceTransitionName", "popupClassName", "dropdownClassName", "expandIcon", "placement", "showSearch", "allowClear", "notFoundContent", "direction", "getPopupContainer", "status", "showArrow"]);
|
|
101
|
+
var restProps = omit(rest, ['suffixIcon']);
|
|
102
|
+
var _useContext = useContext(ConfigContext),
|
|
103
|
+
getContextPopupContainer = _useContext.getPopupContainer,
|
|
104
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
105
|
+
renderEmpty = _useContext.renderEmpty,
|
|
106
|
+
rootDirection = _useContext.direction;
|
|
107
|
+
var mergedDirection = direction || rootDirection;
|
|
108
|
+
var isRtl = mergedDirection === 'rtl';
|
|
109
|
+
// =================== Form =====================
|
|
110
|
+
var _useContext2 = useContext(FormItemInputContext),
|
|
111
|
+
contextStatus = _useContext2.status,
|
|
112
|
+
hasFeedback = _useContext2.hasFeedback,
|
|
113
|
+
isFormItemInput = _useContext2.isFormItemInput,
|
|
114
|
+
feedbackIcon = _useContext2.feedbackIcon;
|
|
115
|
+
var mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
116
|
+
// =================== Warning =====================
|
|
117
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
118
|
+
devWarning(popupClassName === undefined, 'Cascader', '`popupClassName` is deprecated. Please use `dropdownClassName` instead.');
|
|
119
|
+
devWarning(!multiple || !props.displayRender, 'Cascader', '`displayRender` not work on `multiple`. Please use `tagRender` instead.');
|
|
120
|
+
}
|
|
121
|
+
// =================== No Found ====================
|
|
122
|
+
var mergedNotFoundContent = notFoundContent || renderEmpty('Cascader');
|
|
123
|
+
// ==================== Prefix =====================
|
|
124
|
+
var rootPrefixCls = getPrefixCls();
|
|
125
|
+
var prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
126
|
+
var cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
127
|
+
// =================== Dropdown ====================
|
|
128
|
+
var mergedDropdownClassName = classNames(dropdownClassName || popupClassName, "".concat(cascaderPrefixCls, "-dropdown"), _defineProperty({}, "".concat(cascaderPrefixCls, "-dropdown-rtl"), mergedDirection === 'rtl'));
|
|
129
|
+
// ==================== Search =====================
|
|
130
|
+
var mergedShowSearch = React.useMemo(function () {
|
|
131
|
+
if (!showSearch) {
|
|
132
|
+
return showSearch;
|
|
133
|
+
}
|
|
134
|
+
var searchConfig = {
|
|
135
|
+
render: defaultSearchRender
|
|
136
|
+
};
|
|
137
|
+
if (_typeof(showSearch) === 'object') {
|
|
138
|
+
searchConfig = Object.assign(Object.assign({}, searchConfig), showSearch);
|
|
139
|
+
}
|
|
140
|
+
return searchConfig;
|
|
141
|
+
}, [showSearch]);
|
|
142
|
+
// ===================== Size ======================
|
|
143
|
+
var size = React.useContext(SizeContext);
|
|
144
|
+
var mergedSize = customizeSize || size;
|
|
145
|
+
// ===================== Icon ======================
|
|
146
|
+
var mergedExpandIcon = expandIcon;
|
|
147
|
+
if (!expandIcon) {
|
|
148
|
+
mergedExpandIcon = isRtl ? /*#__PURE__*/React.createElement(LeftOutlined, null) : /*#__PURE__*/React.createElement(RightOutlined, null);
|
|
149
|
+
}
|
|
150
|
+
var loadingIcon = /*#__PURE__*/React.createElement("span", {
|
|
151
|
+
className: "".concat(prefixCls, "-menu-item-loading-icon")
|
|
152
|
+
}, /*#__PURE__*/React.createElement(LoadingOutlined, {
|
|
153
|
+
spin: true
|
|
154
|
+
}));
|
|
155
|
+
// =================== Multiple ====================
|
|
156
|
+
var checkable = React.useMemo(function () {
|
|
157
|
+
return multiple ? /*#__PURE__*/React.createElement("span", {
|
|
158
|
+
className: "".concat(cascaderPrefixCls, "-checkbox-inner")
|
|
159
|
+
}) : false;
|
|
160
|
+
}, [multiple]);
|
|
161
|
+
// ===================== Icons =====================
|
|
162
|
+
var mergedShowArrow = showArrow !== undefined ? showArrow : props.loading || !multiple;
|
|
163
|
+
var _getIcons = getIcons(Object.assign(Object.assign({}, props), {
|
|
164
|
+
hasFeedback: hasFeedback,
|
|
165
|
+
feedbackIcon: feedbackIcon,
|
|
166
|
+
showArrow: mergedShowArrow,
|
|
167
|
+
multiple: multiple,
|
|
168
|
+
prefixCls: prefixCls
|
|
169
|
+
})),
|
|
170
|
+
suffixIcon = _getIcons.suffixIcon,
|
|
171
|
+
removeIcon = _getIcons.removeIcon,
|
|
172
|
+
clearIcon = _getIcons.clearIcon;
|
|
173
|
+
// ===================== Placement =====================
|
|
174
|
+
var getPlacement = function getPlacement() {
|
|
175
|
+
if (placement !== undefined) {
|
|
176
|
+
return placement;
|
|
177
|
+
}
|
|
178
|
+
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
|
|
179
|
+
};
|
|
180
|
+
// ==================== Render =====================
|
|
181
|
+
return /*#__PURE__*/React.createElement(RcCascader, Object.assign({
|
|
182
|
+
prefixCls: prefixCls,
|
|
183
|
+
className: classNames(!customizePrefixCls && cascaderPrefixCls, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-lg"), mergedSize === 'large'), _defineProperty(_classNames2, "".concat(prefixCls, "-sm"), mergedSize === 'small'), _defineProperty(_classNames2, "".concat(prefixCls, "-rtl"), isRtl), _defineProperty(_classNames2, "".concat(prefixCls, "-borderless"), !bordered), _defineProperty(_classNames2, "".concat(prefixCls, "-in-form-item"), isFormItemInput), _classNames2), getStatusClassNames(prefixCls, mergedStatus, hasFeedback), className)
|
|
184
|
+
}, restProps, {
|
|
185
|
+
direction: mergedDirection,
|
|
186
|
+
placement: getPlacement(),
|
|
187
|
+
notFoundContent: mergedNotFoundContent,
|
|
188
|
+
allowClear: allowClear,
|
|
189
|
+
showSearch: mergedShowSearch,
|
|
190
|
+
expandIcon: mergedExpandIcon,
|
|
191
|
+
inputIcon: suffixIcon,
|
|
192
|
+
removeIcon: removeIcon,
|
|
193
|
+
clearIcon: clearIcon,
|
|
194
|
+
loadingIcon: loadingIcon,
|
|
195
|
+
checkable: checkable,
|
|
196
|
+
dropdownClassName: mergedDropdownClassName,
|
|
197
|
+
dropdownPrefixCls: customizePrefixCls || cascaderPrefixCls,
|
|
198
|
+
choiceTransitionName: getTransitionName(rootPrefixCls, '', choiceTransitionName),
|
|
199
|
+
transitionName: getTransitionName(rootPrefixCls, getTransitionDirection(placement), transitionName),
|
|
200
|
+
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
201
|
+
ref: ref,
|
|
202
|
+
showArrow: hasFeedback || showArrow
|
|
203
|
+
}));
|
|
204
|
+
});
|
|
205
|
+
Cascader.displayName = 'Cascader';
|
|
206
|
+
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
207
|
+
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
208
|
+
export default Cascader;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
import React, { forwardRef } from "react";
|
|
4
|
+
import Cascader from "./Cascader";
|
|
5
|
+
import "antd/es/cascader/style/index.less";
|
|
6
|
+
import "../Antd4/cascader/style/index.less";
|
|
7
|
+
import classnames from "classnames";
|
|
8
|
+
import { cloneComProps } from "../utils";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
var Cascaders = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
|
+
var rest = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
12
|
+
return /*#__PURE__*/React.createElement(Cascader, _extends({
|
|
13
|
+
ref: ref
|
|
14
|
+
}, rest));
|
|
15
|
+
});
|
|
16
|
+
cloneComProps(Cascader, Cascaders);
|
|
17
|
+
export default Cascaders;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../Cascader/index.less';
|