@chaoswise/ui 2.3.14 → 2.3.15
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 +6 -6
- package/lib/Ace/ace.js +1 -1
- package/lib/Ace/diff.js +1 -1
- package/lib/Ace/split.js +1 -1
- package/lib/AdaptiveLayout/index.js +4 -4
- package/lib/Antd/Drawer.js +4 -4
- package/lib/Antd4Form/FieldList.js +3 -3
- package/lib/Antd4Form/Form.js +1 -1
- package/lib/Antd4Form/FormItem.js +3 -3
- package/lib/Antd4Form/FormItemChildren.js +1 -1
- package/lib/Antd4Form/useForm.js +4 -4
- package/lib/BasicLayout/Breadcrumb.js +3 -3
- package/lib/BasicLayout/Sider.js +3 -3
- package/lib/BasicLayout/index.js +1 -1
- package/lib/CWCascader/Cascader/index.js +3 -3
- package/lib/CWCascader/rc-cascader/Cascader.js +3 -3
- package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +1 -1
- package/lib/CWCascader/rc-cascader/OptionList/Column.js +5 -5
- package/lib/CWCascader/rc-cascader/OptionList/index.js +6 -7
- package/lib/CWCascader/rc-cascader/OptionList/useActive.js +1 -1
- package/lib/CWCascader/rc-cascader/OptionList/useKeyboard.js +5 -6
- package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +1 -1
- package/lib/CWCascader/rc-cascader/hooks/useEntities.js +3 -3
- package/lib/CWCascader/rc-cascader/hooks/useSearchConfig.js +3 -3
- package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +3 -3
- package/lib/CWMessage/MessageContent/TabList/index.js +4 -4
- package/lib/CWMessage/MessageContent/index.js +6 -6
- package/lib/CWMessage/index.js +8 -8
- package/lib/CWRadioTabs/index.js +1 -1
- package/lib/CWRangePicker/DropdownMenu/index.js +4 -4
- package/lib/CWRangePicker/Refresh/index.js +4 -4
- package/lib/CWRangePicker/index.js +4 -4
- package/lib/CWRangePicker/utils/index.js +4 -4
- package/lib/CWSelect/DragTag/index.js +1 -1
- package/lib/CWSelect/antd-select.js +1 -1
- package/lib/CWSelect/index.js +4 -4
- package/lib/CWTable/CWTable.js +12 -12
- package/lib/CWTable/EditLine.js +4 -4
- package/lib/CWTable/Filter.js +1 -1
- package/lib/CWTable/FormTable.js +3 -3
- package/lib/CWTable/header.js +1 -1
- package/lib/CWTree/index.js +4 -4
- package/lib/CWTree/index.less +6 -0
- package/lib/CWTree/utils/index.js +3 -3
- package/lib/CWUpload/upload/DragList.js +2 -2
- package/lib/CWUpload/upload/Upload.js +2 -2
- package/lib/CWUpload/upload/UploadList.js +1 -1
- package/lib/CardSelect/index.js +1 -1
- package/lib/ChangeIcon/index.js +1 -1
- package/lib/Checkbox/Checkbox.js +3 -3
- package/lib/Checkbox/Group.js +1 -1
- package/lib/ColorPicker/index.js +4 -4
- package/lib/ConfigProvider/ConfigProvider.js +4 -4
- package/lib/CustomScrollBar/index.js +3 -3
- package/lib/DateRangePicker/RangeDatePicker.js +1 -1
- package/lib/DateRangePicker/RangeDateTimePicker.js +1 -1
- package/lib/DateRangePicker/components/ExtraTimeFooter.js +3 -3
- package/lib/DateRangePicker/utils/index.js +1 -1
- package/lib/Documentation/Tocify.js +1 -1
- package/lib/Documentation/index.js +4 -4
- package/lib/DropdownDatePicker/DropdownMenu/index.js +3 -3
- package/lib/DropdownDatePicker/index.js +4 -4
- package/lib/DropdownDatePicker/utils/index.js +4 -4
- package/lib/EchartsArea/index.js +3 -3
- package/lib/EchartsBar/index.js +3 -3
- package/lib/EchartsBase/index.js +3 -3
- package/lib/EchartsLine/index.js +3 -3
- package/lib/EditableText/index.js +1 -1
- package/lib/ErrorBoundary/history.js +1 -1
- package/lib/ErrorBoundary/index.js +1 -1
- package/lib/FilterDropDown/DragList.js +1 -1
- package/lib/FilterDropDown/index.js +1 -1
- package/lib/Flow/Flow.js +1 -1
- package/lib/Flow/components/PluginWrapper.js +1 -1
- package/lib/Flow/layouts/callChain.js +1 -1
- package/lib/Flow/plugins/CommandLifeCycle.js +1 -1
- package/lib/Flow/plugins/InitSideBarPlugin.js +1 -1
- package/lib/Flow/plugins/InitToolBarPlugin.js +1 -1
- package/lib/Form/FormItem.js +3 -3
- package/lib/FormItemWrapper/index.js +3 -3
- package/lib/Formily/FieldList/index.js +3 -3
- package/lib/Formily/FormItem/index.js +3 -3
- package/lib/Formily/FormItem/items/Upload.js +1 -1
- package/lib/Formily/FormItem/items/shared.js +1 -1
- package/lib/Formily/MegaLayout/index.js +3 -3
- package/lib/Formily/formily/index.js +1 -1
- package/lib/Formily/subscribeFields/index.js +4 -4
- package/lib/GlobalTabs/index.js +3 -3
- package/lib/Header/CommonDropMenu.js +1 -1
- package/lib/Header/CommonIcon.js +3 -3
- package/lib/Header/UserSetting/index.js +1 -1
- package/lib/Header/UserSetting/utils.js +3 -3
- package/lib/Header/index.js +3 -2
- package/lib/IconSelect/components/SearchIcon/index.js +1 -1
- package/lib/IconSelect/index.js +1 -1
- package/lib/Input/InputComponent.js +4 -7
- package/lib/IntersectionInput/index.js +4 -4
- package/lib/Joyride/index.js +4 -4
- package/lib/LayoutBreadcrumb/index.js +3 -3
- package/lib/LayoutWrapper/index.js +1 -1
- package/lib/LazyLoadingTreeSelect/index.js +4 -4
- package/lib/Menu/menu/MenuItem.js +1 -1
- package/lib/Menu/menu/SubMenu.js +1 -1
- package/lib/Menu/menu/index.js +1 -1
- package/lib/Modal/Modal.js +1 -1
- package/lib/Modal/custom-backup/entiretyDrag.js +3 -3
- package/lib/Modal/index.js +3 -3
- package/lib/ModuleFederation/ErrorBoundary/index.js +1 -1
- package/lib/ModuleFederation/react-dynamic-remote-component/RemoteComponent.js +6 -6
- package/lib/ModuleFederation/react-dynamic-remote-component/load-module.js +2 -2
- package/lib/Pagination/index.js +4 -4
- package/lib/PolymerizationSearch/index.js +1 -1
- package/lib/QuickRangePicker/index.js +2 -2
- package/lib/QuickTransfer/DragList.js +1 -1
- package/lib/QuickTransfer/index.js +4 -4
- package/lib/QuickTransfer/utils.js +23 -23
- package/lib/Radio/Group.js +1 -1
- package/lib/Radio/Radio.js +3 -3
- package/lib/RangePicker/components/ExtraTimeFooter.js +3 -3
- package/lib/RangePicker/index.js +2 -2
- package/lib/RangePicker/utils/index.js +1 -1
- package/lib/ReactSelect/customStyles.js +3 -3
- package/lib/ReactSelect/index.js +4 -4
- package/lib/ScrollLoad/index.js +1 -1
- package/lib/SearchBar/index.js +4 -4
- package/lib/SelectBackup/index.js +4 -4
- package/lib/SiderMenu/Item.js +1 -1
- package/lib/SiderMenu/index.js +3 -3
- package/lib/SimplePagination/index.js +4 -4
- package/lib/SingleSpa/import-html/process-tpl.js +1 -1
- package/lib/SingleSpa/import-html/utils.js +2 -2
- package/lib/SingleSpa/index.js +5 -5
- package/lib/SingleSpa/singleSpa/single-spa.dev.js +1 -1
- package/lib/SingleSpa/system/amd.js +1 -1
- package/lib/SingleSpa/system/system.js +1 -1
- package/lib/Tabs/index.js +3 -3
- package/lib/ThemeProvider/main.js +4 -4
- package/lib/ThemeProvider/utils.js +2 -2
- package/lib/TooltipText/index.js +4 -4
- package/lib/TreeList/index.js +2 -2
- package/lib/TreeSelect111/index.js +4 -4
- package/lib/TreeSelect111/utils/index.js +3 -3
- package/lib/Upload-back/index.js +1 -1
- package/lib/WangEditor/release/wangEditor.js +1 -1
- package/lib/WangEditor/usePreview.js +1 -1
- package/lib/WangEditor/wangEditor.js +1 -1
- package/lib/message/index.js +3 -3
- package/lib/noticeManager/globalState.js +1 -1
- package/lib/portalNoticeManager/usePortalDispatchNotice.js +4 -4
- package/lib/useLocale/index.js +3 -3
- package/lib/usePreview/index.js +1 -1
- package/package.json +2 -2
- package/lib/Antd4/notification/index.copy.js +0 -302
- package/lib/Cascaders/Cascader/index.js +0 -208
- package/lib/Cascaders/index.js +0 -17
- package/lib/Cascaders/index.less +0 -1
- package/lib/Cascaders/rc-cascader/Cascader.js +0 -326
- package/lib/Cascaders/rc-cascader/OptionList/Checkbox.js +0 -22
- package/lib/Cascaders/rc-cascader/OptionList/Column.js +0 -203
- package/lib/Cascaders/rc-cascader/OptionList/index.js +0 -213
- package/lib/Cascaders/rc-cascader/OptionList/useActive.js +0 -33
- package/lib/Cascaders/rc-cascader/OptionList/useKeyboard.js +0 -171
- package/lib/Cascaders/rc-cascader/context.js +0 -3
- package/lib/Cascaders/rc-cascader/hooks/useDisplayValues.js +0 -56
- package/lib/Cascaders/rc-cascader/hooks/useEntities.js +0 -34
- package/lib/Cascaders/rc-cascader/hooks/useMissingValues.js +0 -19
- package/lib/Cascaders/rc-cascader/hooks/useRefFunc.js +0 -13
- package/lib/Cascaders/rc-cascader/hooks/useSearchConfig.js +0 -25
- package/lib/Cascaders/rc-cascader/hooks/useSearchOptions.js +0 -72
- package/lib/Cascaders/rc-cascader/index.js +0 -2
- package/lib/Cascaders/rc-cascader/utils/commonUtil.js +0 -54
- package/lib/Cascaders/rc-cascader/utils/treeUtil.js +0 -37
- package/lib/Cascaders/rc-cascader/utils/warningPropsUtil.js +0 -30
- package/lib/Empty/assets/emptyState.png +0 -0
- package/lib/Header/assets/icon2.png +0 -0
- package/lib/Menu/assets/arrow.png +0 -0
- package/lib/Menu/index.less +0 -81
- package/lib/QuickTransfer/CheckList.js +0 -54
- package/lib/QuickTransfer/TopicList.js +0 -153
- package/lib/SiderMenu/assets/arrow.png +0 -0
- package/lib/SiderMenu/assets/logo.svg +0 -58
- package/lib/SiderMenu/assets/rect-logo.png +0 -0
- package/lib/SiderMenu/utils.js +0 -29
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
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."); }
|
|
3
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure 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 _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; }
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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
|
-
import { BaseSelect } from 'rc-cascader/node_modules/rc-select';
|
|
20
|
-
import useId from 'rc-cascader/node_modules/rc-select/lib/hooks/useId';
|
|
21
|
-
import { conductCheck } from 'rc-cascader/node_modules/rc-tree/lib/utils/conductUtil';
|
|
22
|
-
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
23
|
-
import * as React from 'react';
|
|
24
|
-
import CascaderContext from './context';
|
|
25
|
-
import useDisplayValues from './hooks/useDisplayValues';
|
|
26
|
-
import useEntities from './hooks/useEntities';
|
|
27
|
-
import useMissingValues from './hooks/useMissingValues';
|
|
28
|
-
import useRefFunc from './hooks/useRefFunc';
|
|
29
|
-
import useSearchConfig from './hooks/useSearchConfig';
|
|
30
|
-
import useSearchOptions from './hooks/useSearchOptions';
|
|
31
|
-
import OptionList from './OptionList';
|
|
32
|
-
import { fillFieldNames, SHOW_CHILD, SHOW_PARENT, toPathKey, toPathKeys } from './utils/commonUtil';
|
|
33
|
-
import { formatStrategyValues, toPathOptions } from './utils/treeUtil';
|
|
34
|
-
import warningProps, { warningNullOptions } from './utils/warningPropsUtil';
|
|
35
|
-
function isMultipleValue(value) {
|
|
36
|
-
return Array.isArray(value) && Array.isArray(value[0]);
|
|
37
|
-
}
|
|
38
|
-
function toRawValues(value) {
|
|
39
|
-
if (!value) {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
if (isMultipleValue(value)) {
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
return (value.length === 0 ? [] : [value]).map(function (val) {
|
|
46
|
-
return Array.isArray(val) ? val : [val];
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
var Cascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
50
|
-
var id = props.id,
|
|
51
|
-
_props$prefixCls = props.prefixCls,
|
|
52
|
-
prefixCls = _props$prefixCls === void 0 ? 'rc-cascader' : _props$prefixCls,
|
|
53
|
-
fieldNames = props.fieldNames,
|
|
54
|
-
defaultValue = props.defaultValue,
|
|
55
|
-
value = props.value,
|
|
56
|
-
changeOnSelect = props.changeOnSelect,
|
|
57
|
-
onChange = props.onChange,
|
|
58
|
-
displayRender = props.displayRender,
|
|
59
|
-
checkable = props.checkable,
|
|
60
|
-
searchValue = props.searchValue,
|
|
61
|
-
onSearch = props.onSearch,
|
|
62
|
-
showSearch = props.showSearch,
|
|
63
|
-
expandTrigger = props.expandTrigger,
|
|
64
|
-
options = props.options,
|
|
65
|
-
dropdownPrefixCls = props.dropdownPrefixCls,
|
|
66
|
-
loadData = props.loadData,
|
|
67
|
-
popupVisible = props.popupVisible,
|
|
68
|
-
open = props.open,
|
|
69
|
-
popupClassName = props.popupClassName,
|
|
70
|
-
dropdownClassName = props.dropdownClassName,
|
|
71
|
-
dropdownMenuColumnStyle = props.dropdownMenuColumnStyle,
|
|
72
|
-
popupPlacement = props.popupPlacement,
|
|
73
|
-
placement = props.placement,
|
|
74
|
-
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
|
75
|
-
onPopupVisibleChange = props.onPopupVisibleChange,
|
|
76
|
-
_props$expandIcon = props.expandIcon,
|
|
77
|
-
expandIcon = _props$expandIcon === void 0 ? '>' : _props$expandIcon,
|
|
78
|
-
loadingIcon = props.loadingIcon,
|
|
79
|
-
children = props.children,
|
|
80
|
-
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
81
|
-
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? false : _props$dropdownMatchS,
|
|
82
|
-
_props$showCheckedStr = props.showCheckedStrategy,
|
|
83
|
-
showCheckedStrategy = _props$showCheckedStr === void 0 ? SHOW_PARENT : _props$showCheckedStr,
|
|
84
|
-
onScroll = props.onScroll,
|
|
85
|
-
onSrollBottom = props.onSrollBottom,
|
|
86
|
-
showColumnSearch = props.showColumnSearch,
|
|
87
|
-
onInputChange = props.onInputChange,
|
|
88
|
-
restProps = __rest(props, ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", "searchValue", "onSearch", "showSearch", "expandTrigger", "options", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "expandIcon", "loadingIcon", "children", "dropdownMatchSelectWidth", "showCheckedStrategy", "onScroll", "onSrollBottom", "showColumnSearch", "onInputChange"]);
|
|
89
|
-
var mergedId = useId(id);
|
|
90
|
-
var multiple = !!checkable;
|
|
91
|
-
// =========================== Values ===========================
|
|
92
|
-
var _useMergedState = useMergedState(defaultValue, {
|
|
93
|
-
value: value,
|
|
94
|
-
postState: toRawValues
|
|
95
|
-
}),
|
|
96
|
-
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
97
|
-
rawValues = _useMergedState2[0],
|
|
98
|
-
setRawValues = _useMergedState2[1];
|
|
99
|
-
// ========================= FieldNames =========================
|
|
100
|
-
var mergedFieldNames = React.useMemo(function () {
|
|
101
|
-
return fillFieldNames(fieldNames);
|
|
102
|
-
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
103
|
-
[JSON.stringify(fieldNames)]);
|
|
104
|
-
// =========================== Option ===========================
|
|
105
|
-
var mergedOptions = React.useMemo(function () {
|
|
106
|
-
return options || [];
|
|
107
|
-
}, [options]);
|
|
108
|
-
// Only used in multiple mode, this fn will not call in single mode
|
|
109
|
-
var getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
110
|
-
/** Convert path key back to value format */
|
|
111
|
-
var getValueByKeyPath = React.useCallback(function (pathKeys) {
|
|
112
|
-
var keyPathEntities = getPathKeyEntities();
|
|
113
|
-
return pathKeys.map(function (pathKey) {
|
|
114
|
-
var nodes = keyPathEntities[pathKey].nodes;
|
|
115
|
-
return nodes.map(function (node) {
|
|
116
|
-
return node[mergedFieldNames.value];
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
}, [getPathKeyEntities, mergedFieldNames]);
|
|
120
|
-
// =========================== Search ===========================
|
|
121
|
-
var _useMergedState3 = useMergedState('', {
|
|
122
|
-
value: searchValue,
|
|
123
|
-
postState: function postState(search) {
|
|
124
|
-
return search || '';
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
_useMergedState4 = _slicedToArray(_useMergedState3, 2),
|
|
128
|
-
mergedSearchValue = _useMergedState4[0],
|
|
129
|
-
setSearchValue = _useMergedState4[1];
|
|
130
|
-
var onInternalSearch = function onInternalSearch(searchText, info) {
|
|
131
|
-
setSearchValue(searchText);
|
|
132
|
-
if (info.source !== 'blur' && onSearch) {
|
|
133
|
-
onSearch(searchText);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var _useSearchConfig = useSearchConfig(showSearch),
|
|
137
|
-
_useSearchConfig2 = _slicedToArray(_useSearchConfig, 2),
|
|
138
|
-
mergedShowSearch = _useSearchConfig2[0],
|
|
139
|
-
searchConfig = _useSearchConfig2[1];
|
|
140
|
-
var searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
|
|
141
|
-
// =========================== Values ===========================
|
|
142
|
-
var getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
143
|
-
// Fill `rawValues` with checked conduction values
|
|
144
|
-
var _React$useMemo = React.useMemo(function () {
|
|
145
|
-
var _getMissingValues = getMissingValues(rawValues),
|
|
146
|
-
_getMissingValues2 = _slicedToArray(_getMissingValues, 2),
|
|
147
|
-
existValues = _getMissingValues2[0],
|
|
148
|
-
missingValues = _getMissingValues2[1];
|
|
149
|
-
if (!multiple || !rawValues.length) {
|
|
150
|
-
return [existValues, [], missingValues];
|
|
151
|
-
}
|
|
152
|
-
var keyPathValues = toPathKeys(existValues);
|
|
153
|
-
var keyPathEntities = getPathKeyEntities();
|
|
154
|
-
var _conductCheck = conductCheck(keyPathValues, true, keyPathEntities),
|
|
155
|
-
checkedKeys = _conductCheck.checkedKeys,
|
|
156
|
-
halfCheckedKeys = _conductCheck.halfCheckedKeys;
|
|
157
|
-
// Convert key back to value cells
|
|
158
|
-
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
159
|
-
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]),
|
|
160
|
-
_React$useMemo2 = _slicedToArray(_React$useMemo, 3),
|
|
161
|
-
checkedValues = _React$useMemo2[0],
|
|
162
|
-
halfCheckedValues = _React$useMemo2[1],
|
|
163
|
-
missingCheckedValues = _React$useMemo2[2];
|
|
164
|
-
var deDuplicatedValues = React.useMemo(function () {
|
|
165
|
-
var checkedKeys = toPathKeys(checkedValues);
|
|
166
|
-
var deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
167
|
-
return [].concat(_toConsumableArray(missingCheckedValues), _toConsumableArray(getValueByKeyPath(deduplicateKeys)));
|
|
168
|
-
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
|
|
169
|
-
var displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
|
|
170
|
-
// =========================== Change ===========================
|
|
171
|
-
var triggerChange = useRefFunc(function (nextValues) {
|
|
172
|
-
setRawValues(nextValues);
|
|
173
|
-
// Save perf if no need trigger event
|
|
174
|
-
if (onChange) {
|
|
175
|
-
var nextRawValues = toRawValues(nextValues);
|
|
176
|
-
var valueOptions = nextRawValues.map(function (valueCells) {
|
|
177
|
-
return toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(function (valueOpt) {
|
|
178
|
-
return valueOpt.option;
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
var triggerValues = multiple ? nextRawValues : nextRawValues[0];
|
|
182
|
-
var triggerOptions = multiple ? valueOptions : valueOptions[0];
|
|
183
|
-
onChange(triggerValues, triggerOptions);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
// =========================== Select ===========================
|
|
187
|
-
var onInternalSelect = useRefFunc(function (valuePath) {
|
|
188
|
-
setSearchValue('');
|
|
189
|
-
if (!multiple) {
|
|
190
|
-
triggerChange(valuePath);
|
|
191
|
-
} else {
|
|
192
|
-
// Prepare conduct required info
|
|
193
|
-
var pathKey = toPathKey(valuePath);
|
|
194
|
-
var checkedPathKeys = toPathKeys(checkedValues);
|
|
195
|
-
var halfCheckedPathKeys = toPathKeys(halfCheckedValues);
|
|
196
|
-
var existInChecked = checkedPathKeys.includes(pathKey);
|
|
197
|
-
var existInMissing = missingCheckedValues.some(function (valueCells) {
|
|
198
|
-
return toPathKey(valueCells) === pathKey;
|
|
199
|
-
});
|
|
200
|
-
// Do update
|
|
201
|
-
var nextCheckedValues = checkedValues;
|
|
202
|
-
var nextMissingValues = missingCheckedValues;
|
|
203
|
-
if (existInMissing && !existInChecked) {
|
|
204
|
-
// Missing value only do filter
|
|
205
|
-
nextMissingValues = missingCheckedValues.filter(function (valueCells) {
|
|
206
|
-
return toPathKey(valueCells) !== pathKey;
|
|
207
|
-
});
|
|
208
|
-
} else {
|
|
209
|
-
// Update checked key first
|
|
210
|
-
var nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(function (key) {
|
|
211
|
-
return key !== pathKey;
|
|
212
|
-
}) : [].concat(_toConsumableArray(checkedPathKeys), [pathKey]);
|
|
213
|
-
var pathKeyEntities = getPathKeyEntities();
|
|
214
|
-
// Conduction by selected or not
|
|
215
|
-
var checkedKeys;
|
|
216
|
-
if (existInChecked) {
|
|
217
|
-
var _conductCheck2 = conductCheck(nextRawCheckedKeys, {
|
|
218
|
-
checked: false,
|
|
219
|
-
halfCheckedKeys: halfCheckedPathKeys
|
|
220
|
-
}, pathKeyEntities);
|
|
221
|
-
checkedKeys = _conductCheck2.checkedKeys;
|
|
222
|
-
} else {
|
|
223
|
-
var _conductCheck3 = conductCheck(nextRawCheckedKeys, true, pathKeyEntities);
|
|
224
|
-
checkedKeys = _conductCheck3.checkedKeys;
|
|
225
|
-
}
|
|
226
|
-
// Roll up to parent level keys
|
|
227
|
-
var deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
228
|
-
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
|
|
229
|
-
}
|
|
230
|
-
triggerChange([].concat(_toConsumableArray(nextMissingValues), _toConsumableArray(nextCheckedValues)));
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
// Display Value change logic
|
|
234
|
-
var onDisplayValuesChange = function onDisplayValuesChange(_, info) {
|
|
235
|
-
if (info.type === 'clear') {
|
|
236
|
-
triggerChange([]);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
// Cascader do not support `add` type. Only support `remove`
|
|
240
|
-
var valueCells = info.values[0].valueCells;
|
|
241
|
-
onInternalSelect(valueCells);
|
|
242
|
-
};
|
|
243
|
-
// ============================ Open ============================
|
|
244
|
-
var mergedOpen = open !== undefined ? open : popupVisible;
|
|
245
|
-
var mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
246
|
-
var mergedPlacement = placement || popupPlacement;
|
|
247
|
-
var onInternalDropdownVisibleChange = function onInternalDropdownVisibleChange(nextVisible) {
|
|
248
|
-
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
249
|
-
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
250
|
-
};
|
|
251
|
-
// ========================== Warning ===========================
|
|
252
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
253
|
-
warningProps(props);
|
|
254
|
-
warningNullOptions(mergedOptions, mergedFieldNames);
|
|
255
|
-
}
|
|
256
|
-
// ========================== Context ===========================
|
|
257
|
-
var cascaderContext = React.useMemo(function () {
|
|
258
|
-
return {
|
|
259
|
-
options: mergedOptions,
|
|
260
|
-
fieldNames: mergedFieldNames,
|
|
261
|
-
values: checkedValues,
|
|
262
|
-
halfValues: halfCheckedValues,
|
|
263
|
-
changeOnSelect: changeOnSelect,
|
|
264
|
-
onSelect: onInternalSelect,
|
|
265
|
-
checkable: checkable,
|
|
266
|
-
searchOptions: searchOptions,
|
|
267
|
-
dropdownPrefixCls: dropdownPrefixCls,
|
|
268
|
-
loadData: loadData,
|
|
269
|
-
expandTrigger: expandTrigger,
|
|
270
|
-
expandIcon: expandIcon,
|
|
271
|
-
loadingIcon: loadingIcon,
|
|
272
|
-
dropdownMenuColumnStyle: dropdownMenuColumnStyle,
|
|
273
|
-
onScroll: onScroll,
|
|
274
|
-
onSrollBottom: onSrollBottom,
|
|
275
|
-
showColumnSearch: showColumnSearch,
|
|
276
|
-
onInputChange: onInputChange
|
|
277
|
-
};
|
|
278
|
-
}, [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, onScroll, onSrollBottom, showColumnSearch, onInputChange]);
|
|
279
|
-
// ==============================================================
|
|
280
|
-
// == Render ==
|
|
281
|
-
// ==============================================================
|
|
282
|
-
var emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
|
|
283
|
-
var dropdownStyle =
|
|
284
|
-
// Search to match width
|
|
285
|
-
mergedSearchValue && searchConfig.matchInputWidth ||
|
|
286
|
-
// Empty keep the width
|
|
287
|
-
emptyOptions ? {} : {
|
|
288
|
-
minWidth: 'auto'
|
|
289
|
-
};
|
|
290
|
-
return /*#__PURE__*/React.createElement(CascaderContext.Provider, {
|
|
291
|
-
value: cascaderContext
|
|
292
|
-
}, /*#__PURE__*/React.createElement(BaseSelect, Object.assign({}, restProps, {
|
|
293
|
-
// MISC
|
|
294
|
-
ref: ref,
|
|
295
|
-
id: mergedId,
|
|
296
|
-
prefixCls: prefixCls,
|
|
297
|
-
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
|
298
|
-
dropdownStyle: dropdownStyle,
|
|
299
|
-
// Value
|
|
300
|
-
displayValues: displayValues,
|
|
301
|
-
onDisplayValuesChange: onDisplayValuesChange,
|
|
302
|
-
mode: multiple ? 'multiple' : undefined,
|
|
303
|
-
// Search
|
|
304
|
-
searchValue: mergedSearchValue,
|
|
305
|
-
onSearch: onInternalSearch,
|
|
306
|
-
showSearch: showColumnSearch ? false : mergedShowSearch,
|
|
307
|
-
// Options
|
|
308
|
-
OptionList: OptionList,
|
|
309
|
-
emptyOptions: emptyOptions,
|
|
310
|
-
// Open
|
|
311
|
-
open: mergedOpen,
|
|
312
|
-
dropdownClassName: mergedDropdownClassName,
|
|
313
|
-
placement: mergedPlacement,
|
|
314
|
-
onDropdownVisibleChange: onInternalDropdownVisibleChange,
|
|
315
|
-
// Children
|
|
316
|
-
getRawInputElement: function getRawInputElement() {
|
|
317
|
-
return children;
|
|
318
|
-
}
|
|
319
|
-
})));
|
|
320
|
-
});
|
|
321
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
322
|
-
Cascader.displayName = 'Cascader';
|
|
323
|
-
}
|
|
324
|
-
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
325
|
-
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
326
|
-
export default Cascader;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
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; }
|
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
-
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); }
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import classNames from 'classnames';
|
|
7
|
-
import CascaderContext from '../context';
|
|
8
|
-
export default function Checkbox(_ref) {
|
|
9
|
-
var _classNames;
|
|
10
|
-
var prefixCls = _ref.prefixCls,
|
|
11
|
-
checked = _ref.checked,
|
|
12
|
-
halfChecked = _ref.halfChecked,
|
|
13
|
-
disabled = _ref.disabled,
|
|
14
|
-
onClick = _ref.onClick;
|
|
15
|
-
var _React$useContext = React.useContext(CascaderContext),
|
|
16
|
-
checkable = _React$useContext.checkable;
|
|
17
|
-
var customCheckbox = typeof checkable !== 'boolean' ? checkable : null;
|
|
18
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
19
|
-
className: classNames("".concat(prefixCls), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-checked"), checked), _defineProperty(_classNames, "".concat(prefixCls, "-indeterminate"), !checked && halfChecked), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _classNames)),
|
|
20
|
-
onClick: onClick
|
|
21
|
-
}, customCheckbox);
|
|
22
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
import "@chaoswise/ui/lib/Input/index.less";
|
|
3
|
-
import _Input from "@chaoswise/ui/lib/Input";
|
|
4
|
-
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; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
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); }
|
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
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."); }
|
|
9
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
-
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); }
|
|
14
|
-
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; }
|
|
15
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
// @ts-nocheck
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import classNames from "classnames";
|
|
20
|
-
import { isLeaf, toPathKey } from "../utils/commonUtil";
|
|
21
|
-
import CascaderContext from "../context";
|
|
22
|
-
import Checkbox from "./Checkbox";
|
|
23
|
-
import { SEARCH_MARK } from "../hooks/useSearchOptions";
|
|
24
|
-
export var FIX_LABEL = "__cascader_fix_label__";
|
|
25
|
-
export default function Column(_ref) {
|
|
26
|
-
var prefixCls = _ref.prefixCls,
|
|
27
|
-
multiple = _ref.multiple,
|
|
28
|
-
options = _ref.options,
|
|
29
|
-
activeValue = _ref.activeValue,
|
|
30
|
-
prevValuePath = _ref.prevValuePath,
|
|
31
|
-
onToggleOpen = _ref.onToggleOpen,
|
|
32
|
-
onSelect = _ref.onSelect,
|
|
33
|
-
onActive = _ref.onActive,
|
|
34
|
-
checkedSet = _ref.checkedSet,
|
|
35
|
-
halfCheckedSet = _ref.halfCheckedSet,
|
|
36
|
-
loadingKeys = _ref.loadingKeys,
|
|
37
|
-
isSelectable = _ref.isSelectable;
|
|
38
|
-
var menuPrefixCls = "".concat(prefixCls, "-menu");
|
|
39
|
-
var menuItemPrefixCls = "".concat(prefixCls, "-menu-item");
|
|
40
|
-
var _React$useContext = React.useContext(CascaderContext),
|
|
41
|
-
fieldNames = _React$useContext.fieldNames,
|
|
42
|
-
changeOnSelect = _React$useContext.changeOnSelect,
|
|
43
|
-
expandTrigger = _React$useContext.expandTrigger,
|
|
44
|
-
expandIcon = _React$useContext.expandIcon,
|
|
45
|
-
loadingIcon = _React$useContext.loadingIcon,
|
|
46
|
-
dropdownMenuColumnStyle = _React$useContext.dropdownMenuColumnStyle,
|
|
47
|
-
_React$useContext$onS = _React$useContext.onScroll,
|
|
48
|
-
_onScroll = _React$useContext$onS === void 0 ? function () {} : _React$useContext$onS,
|
|
49
|
-
_React$useContext$onS2 = _React$useContext.onSrollBottom,
|
|
50
|
-
onSrollBottom = _React$useContext$onS2 === void 0 ? function () {} : _React$useContext$onS2,
|
|
51
|
-
_React$useContext$onI = _React$useContext.onInputChange,
|
|
52
|
-
onInputChange = _React$useContext$onI === void 0 ? function () {} : _React$useContext$onI;
|
|
53
|
-
var hoverOpen = expandTrigger === "hover";
|
|
54
|
-
var _React$useState = React.useState(""),
|
|
55
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
56
|
-
inputValue = _React$useState2[0],
|
|
57
|
-
setInputValue = _React$useState2[1];
|
|
58
|
-
// ============================ Option ============================
|
|
59
|
-
var optionInfoList = React.useMemo(function () {
|
|
60
|
-
return options.map(function (option) {
|
|
61
|
-
var _a;
|
|
62
|
-
var disabled = option.disabled;
|
|
63
|
-
var searchOptions = option[SEARCH_MARK];
|
|
64
|
-
var label = (_a = option[FIX_LABEL]) !== null && _a !== void 0 ? _a : option[fieldNames.label];
|
|
65
|
-
var value = option[fieldNames.value];
|
|
66
|
-
var isMergedLeaf = isLeaf(option, fieldNames);
|
|
67
|
-
// Get real value of option. Search option is different way.
|
|
68
|
-
var fullPath = searchOptions ? searchOptions.map(function (opt) {
|
|
69
|
-
return opt[fieldNames.value];
|
|
70
|
-
}) : [].concat(_toConsumableArray(prevValuePath), [value]);
|
|
71
|
-
var fullPathKey = toPathKey(fullPath);
|
|
72
|
-
var isLoading = loadingKeys.includes(fullPathKey);
|
|
73
|
-
// >>>>> checked
|
|
74
|
-
var checked = checkedSet.has(fullPathKey);
|
|
75
|
-
// >>>>> halfChecked
|
|
76
|
-
var halfChecked = halfCheckedSet.has(fullPathKey);
|
|
77
|
-
return {
|
|
78
|
-
disabled: disabled,
|
|
79
|
-
label: label,
|
|
80
|
-
value: value,
|
|
81
|
-
isLeaf: isMergedLeaf,
|
|
82
|
-
isLoading: isLoading,
|
|
83
|
-
checked: checked,
|
|
84
|
-
halfChecked: halfChecked,
|
|
85
|
-
option: option,
|
|
86
|
-
fullPath: fullPath,
|
|
87
|
-
fullPathKey: fullPathKey
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}, [options, checkedSet, fieldNames, halfCheckedSet, loadingKeys, prevValuePath]);
|
|
91
|
-
var scrollColumnId = prevValuePath.length ? prevValuePath[prevValuePath.length - 1] : undefined;
|
|
92
|
-
var onChange = function onChange(e) {
|
|
93
|
-
setInputValue(e.target.value);
|
|
94
|
-
onInputChange(e, scrollColumnId);
|
|
95
|
-
};
|
|
96
|
-
// ============================ Render ============================
|
|
97
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
style: {
|
|
99
|
-
display: "flex",
|
|
100
|
-
flexDirection: "column",
|
|
101
|
-
flex: 1
|
|
102
|
-
}
|
|
103
|
-
}, /*#__PURE__*/React.createElement(_Input, {
|
|
104
|
-
style: {
|
|
105
|
-
width: "100%"
|
|
106
|
-
},
|
|
107
|
-
value: inputValue,
|
|
108
|
-
onChange: onChange
|
|
109
|
-
}), /*#__PURE__*/React.createElement("ul", {
|
|
110
|
-
className: menuPrefixCls,
|
|
111
|
-
role: "menu",
|
|
112
|
-
style: {
|
|
113
|
-
flex: 1
|
|
114
|
-
},
|
|
115
|
-
onScroll: function onScroll(e) {
|
|
116
|
-
// scrollColumnId,一级为undefind,非一级为上一次的value
|
|
117
|
-
_onScroll(e, scrollColumnId);
|
|
118
|
-
function isScrollBottom() {
|
|
119
|
-
var element = e.target;
|
|
120
|
-
return element.scrollHeight - element.scrollTop <= element.clientHeight;
|
|
121
|
-
}
|
|
122
|
-
if (isScrollBottom()) {
|
|
123
|
-
onSrollBottom(e, scrollColumnId);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, optionInfoList.map(function (_ref2) {
|
|
127
|
-
var _classNames;
|
|
128
|
-
var disabled = _ref2.disabled,
|
|
129
|
-
label = _ref2.label,
|
|
130
|
-
value = _ref2.value,
|
|
131
|
-
isMergedLeaf = _ref2.isLeaf,
|
|
132
|
-
isLoading = _ref2.isLoading,
|
|
133
|
-
checked = _ref2.checked,
|
|
134
|
-
halfChecked = _ref2.halfChecked,
|
|
135
|
-
option = _ref2.option,
|
|
136
|
-
fullPath = _ref2.fullPath,
|
|
137
|
-
fullPathKey = _ref2.fullPathKey;
|
|
138
|
-
// >>>>> Open
|
|
139
|
-
var triggerOpenPath = function triggerOpenPath() {
|
|
140
|
-
if (!disabled && (!hoverOpen || !isMergedLeaf)) {
|
|
141
|
-
onActive(fullPath);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
// >>>>> Selection
|
|
145
|
-
var triggerSelect = function triggerSelect() {
|
|
146
|
-
if (isSelectable(option)) {
|
|
147
|
-
onSelect(fullPath, isMergedLeaf);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
// >>>>> Title
|
|
151
|
-
var title;
|
|
152
|
-
if (typeof option.title === "string") {
|
|
153
|
-
title = option.title;
|
|
154
|
-
} else if (typeof label === "string") {
|
|
155
|
-
title = label;
|
|
156
|
-
}
|
|
157
|
-
// >>>>> Render
|
|
158
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
159
|
-
key: fullPathKey,
|
|
160
|
-
className: classNames(menuItemPrefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(menuItemPrefixCls, "-expand"), !isMergedLeaf), _defineProperty(_classNames, "".concat(menuItemPrefixCls, "-active"), activeValue === value), _defineProperty(_classNames, "".concat(menuItemPrefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(menuItemPrefixCls, "-loading"), isLoading), _classNames)),
|
|
161
|
-
style: dropdownMenuColumnStyle,
|
|
162
|
-
role: "menuitemcheckbox",
|
|
163
|
-
title: title,
|
|
164
|
-
"aria-checked": checked,
|
|
165
|
-
"data-path-key": fullPathKey,
|
|
166
|
-
onClick: function onClick() {
|
|
167
|
-
triggerOpenPath();
|
|
168
|
-
if (!multiple || isMergedLeaf) {
|
|
169
|
-
triggerSelect();
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
onDoubleClick: function onDoubleClick() {
|
|
173
|
-
if (changeOnSelect) {
|
|
174
|
-
onToggleOpen(false);
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
onMouseEnter: function onMouseEnter() {
|
|
178
|
-
if (hoverOpen) {
|
|
179
|
-
triggerOpenPath();
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
onMouseDown: function onMouseDown(e) {
|
|
183
|
-
// Prevent selector from blurring
|
|
184
|
-
// e.preventDefault();
|
|
185
|
-
}
|
|
186
|
-
}, multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
187
|
-
prefixCls: "".concat(prefixCls, "-checkbox"),
|
|
188
|
-
checked: checked,
|
|
189
|
-
halfChecked: halfChecked,
|
|
190
|
-
disabled: disabled,
|
|
191
|
-
onClick: function onClick(e) {
|
|
192
|
-
e.stopPropagation();
|
|
193
|
-
triggerSelect();
|
|
194
|
-
}
|
|
195
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
196
|
-
className: "".concat(menuItemPrefixCls, "-content")
|
|
197
|
-
}, label), !isLoading && expandIcon && !isMergedLeaf && /*#__PURE__*/React.createElement("div", {
|
|
198
|
-
className: "".concat(menuItemPrefixCls, "-expand-icon")
|
|
199
|
-
}, expandIcon), isLoading && loadingIcon && /*#__PURE__*/React.createElement("div", {
|
|
200
|
-
className: "".concat(menuItemPrefixCls, "-loading-icon")
|
|
201
|
-
}, loadingIcon));
|
|
202
|
-
})));
|
|
203
|
-
}
|