@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.5
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 +89 -117
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +7 -9
- 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 +242 -330
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +22 -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 +219 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +66 -74
- package/FormItem/index.js +14 -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 +905 -796
- package/SelectorPicker/index.js +111 -133
- 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 +25 -26
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +767 -963
- package/Tabs/index.js +102 -102
- package/Tag/index.js +115 -162
- package/TextEditor/index.js +81 -103
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +27 -28
- package/Timeline/index.js +67 -58
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +53 -52
- package/Tooltip/index.js +79 -82
- package/Transfer/index.js +159 -201
- package/Tree/index.js +7 -12
- package/Upload/index.js +523 -758
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-0ced30f7.js} +1127 -1079
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-ef1235fb.js} +125 -134
- package/_verture/{index-b1f80962.js → index-f186b5e8.js} +314 -398
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
- 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-418da0a4.js → utils-46e99c9a.js} +34 -25
- package/index.js +21 -22
- package/locale/index.js +6 -6
- package/package.json +1 -1
- 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-232d890b.js +0 -327
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/toConsumableArray-8f4c9589.js +0 -19
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _toPropertyKey } from './defineProperty-1d116156.js';
|
|
2
|
-
import { _ as _toConsumableArray, a as _iterableToArray } from './toConsumableArray-8f4c9589.js';
|
|
3
|
-
import { _ as _slicedToArray, a as _arrayWithHoles, b as _nonIterableRest } from './slicedToArray-a8206399.js';
|
|
4
1
|
import { _ as __rest } from './tslib.es6-55ed4bd2.js';
|
|
5
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { _ as _arrayLikeToArray, a as _unsupportedIterableToArray, b as _slicedToArray, c as _arrayWithHoles, d as _nonIterableRest } from './slicedToArray-8223a2ef.js';
|
|
4
|
+
import { _ as _defineProperty, a as _toPropertyKey } from './defineProperty-1d116156.js';
|
|
6
5
|
import { _ as _typeof$1 } from './typeof-adeedc13.js';
|
|
7
6
|
import * as React$4 from 'react';
|
|
8
7
|
import React__default, { useState as useState$1, useMemo as useMemo$1, useCallback, useRef, useEffect } from 'react';
|
|
9
8
|
import ReactDOM, { unstable_batchedUpdates, createPortal, flushSync } from 'react-dom';
|
|
10
9
|
import CSSMotion from 'rc-motion';
|
|
11
|
-
import { _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-cb478f24.js';
|
|
12
10
|
import clsx from 'clsx';
|
|
13
11
|
import { _ as _typeof$2 } from './typeof-c310ee4a.js';
|
|
14
12
|
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
@@ -18,10 +16,10 @@ import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
|
18
16
|
import { getKey as getKey$1 } from 'rc-tree/lib/utils/treeUtil';
|
|
19
17
|
import { Tooltip } from '../Tooltip/index.js';
|
|
20
18
|
import { Forbid } from '@para-ui/icons';
|
|
21
|
-
import { $ as $prefixCls } from './constant-
|
|
19
|
+
import { $ as $prefixCls } from './constant-5317fc89.js';
|
|
22
20
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
23
21
|
import AutoTips from '../AutoTips/index.js';
|
|
24
|
-
import { u as useFormatMessage } from './useFormatMessage-
|
|
22
|
+
import { u as useFormatMessage } from './useFormatMessage-eb13cf56.js';
|
|
25
23
|
import { UUID } from '@paraview/lib';
|
|
26
24
|
import { s as styleInject } from './style-inject.es-300983ab.js';
|
|
27
25
|
|
|
@@ -40,6 +38,22 @@ function _extends() {
|
|
|
40
38
|
return _extends.apply(this, arguments);
|
|
41
39
|
}
|
|
42
40
|
|
|
41
|
+
function _arrayWithoutHoles(arr) {
|
|
42
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _iterableToArray(iter) {
|
|
46
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _nonIterableSpread() {
|
|
50
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function _toConsumableArray(arr) {
|
|
54
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
55
|
+
}
|
|
56
|
+
|
|
43
57
|
function ownKeys(e, r) {
|
|
44
58
|
var t = Object.keys(e);
|
|
45
59
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -126,7 +140,7 @@ var useLayoutEffect$3 = function useLayoutEffect(callback, deps) {
|
|
|
126
140
|
};
|
|
127
141
|
}, []);
|
|
128
142
|
};
|
|
129
|
-
var useLayoutUpdateEffect
|
|
143
|
+
var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
130
144
|
useLayoutEffect$3(function (firstMount) {
|
|
131
145
|
if (!firstMount) {
|
|
132
146
|
return callback();
|
|
@@ -198,7 +212,7 @@ function useMergedState$2(defaultStateValue, option) {
|
|
|
198
212
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
199
213
|
prevValue = _useState4[0],
|
|
200
214
|
setPrevValue = _useState4[1];
|
|
201
|
-
useLayoutUpdateEffect
|
|
215
|
+
useLayoutUpdateEffect(function () {
|
|
202
216
|
var prev = prevValue[0];
|
|
203
217
|
if (innerValue !== prev) {
|
|
204
218
|
onChangeFn(innerValue, prev);
|
|
@@ -206,7 +220,7 @@ function useMergedState$2(defaultStateValue, option) {
|
|
|
206
220
|
}, [prevValue]);
|
|
207
221
|
|
|
208
222
|
// Sync value back to `undefined` when it from control to un-control
|
|
209
|
-
useLayoutUpdateEffect
|
|
223
|
+
useLayoutUpdateEffect(function () {
|
|
210
224
|
if (!hasValue$2(value)) {
|
|
211
225
|
setInnerValue(value);
|
|
212
226
|
}
|
|
@@ -884,7 +898,8 @@ var reactIs = {exports: {}};
|
|
|
884
898
|
|
|
885
899
|
var reactIs_production_min = {};
|
|
886
900
|
|
|
887
|
-
/**
|
|
901
|
+
/**
|
|
902
|
+
* @license React
|
|
888
903
|
* react-is.production.min.js
|
|
889
904
|
*
|
|
890
905
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -898,18 +913,18 @@ var hasRequiredReactIs_production_min;
|
|
|
898
913
|
function requireReactIs_production_min () {
|
|
899
914
|
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
900
915
|
hasRequiredReactIs_production_min = 1;
|
|
901
|
-
var b=
|
|
902
|
-
|
|
903
|
-
function
|
|
904
|
-
reactIs_production_min.
|
|
905
|
-
reactIs_production_min.
|
|
906
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
916
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
917
|
+
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
918
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
919
|
+
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
920
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
|
|
907
921
|
return reactIs_production_min;
|
|
908
922
|
}
|
|
909
923
|
|
|
910
924
|
var reactIs_development = {};
|
|
911
925
|
|
|
912
|
-
/**
|
|
926
|
+
/**
|
|
927
|
+
* @license React
|
|
913
928
|
* react-is.development.js
|
|
914
929
|
*
|
|
915
930
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -924,38 +939,67 @@ function requireReactIs_development () {
|
|
|
924
939
|
if (hasRequiredReactIs_development) return reactIs_development;
|
|
925
940
|
hasRequiredReactIs_development = 1;
|
|
926
941
|
|
|
927
|
-
|
|
928
|
-
|
|
929
942
|
if (process.env.NODE_ENV !== "production") {
|
|
930
943
|
(function() {
|
|
931
944
|
|
|
932
|
-
//
|
|
933
|
-
//
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
var
|
|
937
|
-
var
|
|
938
|
-
var
|
|
939
|
-
var
|
|
940
|
-
var
|
|
941
|
-
var
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
var
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
var
|
|
948
|
-
var
|
|
949
|
-
var
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
var
|
|
954
|
-
var
|
|
945
|
+
// ATTENTION
|
|
946
|
+
// When adding new symbols to this file,
|
|
947
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
948
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
949
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
950
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
951
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
952
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
953
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
954
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
955
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
956
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
957
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
958
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
959
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
960
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
961
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
962
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
963
|
+
|
|
964
|
+
// -----------------------------------------------------------------------------
|
|
965
|
+
|
|
966
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
967
|
+
var enableCacheElement = false;
|
|
968
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
969
|
+
|
|
970
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
971
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
972
|
+
// issues in DEV builds.
|
|
973
|
+
|
|
974
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
975
|
+
|
|
976
|
+
var REACT_MODULE_REFERENCE;
|
|
977
|
+
|
|
978
|
+
{
|
|
979
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
980
|
+
}
|
|
955
981
|
|
|
956
982
|
function isValidElementType(type) {
|
|
957
|
-
|
|
958
|
-
|
|
983
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
984
|
+
return true;
|
|
985
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
if (typeof type === 'object' && type !== null) {
|
|
993
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
994
|
+
// types supported by any Flight configuration anywhere since
|
|
995
|
+
// we don't know which Flight build this will end up being used
|
|
996
|
+
// with.
|
|
997
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
998
|
+
return true;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return false;
|
|
959
1003
|
}
|
|
960
1004
|
|
|
961
1005
|
function typeOf(object) {
|
|
@@ -967,18 +1011,18 @@ function requireReactIs_development () {
|
|
|
967
1011
|
var type = object.type;
|
|
968
1012
|
|
|
969
1013
|
switch (type) {
|
|
970
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
971
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
972
1014
|
case REACT_FRAGMENT_TYPE:
|
|
973
1015
|
case REACT_PROFILER_TYPE:
|
|
974
1016
|
case REACT_STRICT_MODE_TYPE:
|
|
975
1017
|
case REACT_SUSPENSE_TYPE:
|
|
1018
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
976
1019
|
return type;
|
|
977
1020
|
|
|
978
1021
|
default:
|
|
979
1022
|
var $$typeofType = type && type.$$typeof;
|
|
980
1023
|
|
|
981
1024
|
switch ($$typeofType) {
|
|
1025
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
982
1026
|
case REACT_CONTEXT_TYPE:
|
|
983
1027
|
case REACT_FORWARD_REF_TYPE:
|
|
984
1028
|
case REACT_LAZY_TYPE:
|
|
@@ -998,10 +1042,7 @@ function requireReactIs_development () {
|
|
|
998
1042
|
}
|
|
999
1043
|
|
|
1000
1044
|
return undefined;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
1004
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
1045
|
+
}
|
|
1005
1046
|
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
1006
1047
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1007
1048
|
var Element = REACT_ELEMENT_TYPE;
|
|
@@ -1013,21 +1054,31 @@ function requireReactIs_development () {
|
|
|
1013
1054
|
var Profiler = REACT_PROFILER_TYPE;
|
|
1014
1055
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1015
1056
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
1016
|
-
var
|
|
1057
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
1058
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
1059
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
1017
1060
|
|
|
1018
1061
|
function isAsyncMode(object) {
|
|
1019
1062
|
{
|
|
1020
1063
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
1021
1064
|
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1022
1065
|
|
|
1023
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React
|
|
1066
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1024
1067
|
}
|
|
1025
1068
|
}
|
|
1026
1069
|
|
|
1027
|
-
return
|
|
1070
|
+
return false;
|
|
1028
1071
|
}
|
|
1029
1072
|
function isConcurrentMode(object) {
|
|
1030
|
-
|
|
1073
|
+
{
|
|
1074
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
1075
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1076
|
+
|
|
1077
|
+
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
return false;
|
|
1031
1082
|
}
|
|
1032
1083
|
function isContextConsumer(object) {
|
|
1033
1084
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
@@ -1062,9 +1113,10 @@ function requireReactIs_development () {
|
|
|
1062
1113
|
function isSuspense(object) {
|
|
1063
1114
|
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
1064
1115
|
}
|
|
1116
|
+
function isSuspenseList(object) {
|
|
1117
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
1118
|
+
}
|
|
1065
1119
|
|
|
1066
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
1067
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
1068
1120
|
reactIs_development.ContextConsumer = ContextConsumer;
|
|
1069
1121
|
reactIs_development.ContextProvider = ContextProvider;
|
|
1070
1122
|
reactIs_development.Element = Element;
|
|
@@ -1076,6 +1128,7 @@ function requireReactIs_development () {
|
|
|
1076
1128
|
reactIs_development.Profiler = Profiler;
|
|
1077
1129
|
reactIs_development.StrictMode = StrictMode;
|
|
1078
1130
|
reactIs_development.Suspense = Suspense;
|
|
1131
|
+
reactIs_development.SuspenseList = SuspenseList;
|
|
1079
1132
|
reactIs_development.isAsyncMode = isAsyncMode;
|
|
1080
1133
|
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
1081
1134
|
reactIs_development.isContextConsumer = isContextConsumer;
|
|
@@ -1089,6 +1142,7 @@ function requireReactIs_development () {
|
|
|
1089
1142
|
reactIs_development.isProfiler = isProfiler;
|
|
1090
1143
|
reactIs_development.isStrictMode = isStrictMode;
|
|
1091
1144
|
reactIs_development.isSuspense = isSuspense;
|
|
1145
|
+
reactIs_development.isSuspenseList = isSuspenseList;
|
|
1092
1146
|
reactIs_development.isValidElementType = isValidElementType;
|
|
1093
1147
|
reactIs_development.typeOf = typeOf;
|
|
1094
1148
|
})();
|
|
@@ -1417,6 +1471,39 @@ function findDOMNode(node) {
|
|
|
1417
1471
|
return null;
|
|
1418
1472
|
}
|
|
1419
1473
|
|
|
1474
|
+
var CollectionContext = /*#__PURE__*/React$4.createContext(null);
|
|
1475
|
+
/**
|
|
1476
|
+
* Collect all the resize event from children ResizeObserver
|
|
1477
|
+
*/
|
|
1478
|
+
function Collection(_ref) {
|
|
1479
|
+
var children = _ref.children,
|
|
1480
|
+
onBatchResize = _ref.onBatchResize;
|
|
1481
|
+
var resizeIdRef = React$4.useRef(0);
|
|
1482
|
+
var resizeInfosRef = React$4.useRef([]);
|
|
1483
|
+
var onCollectionResize = React$4.useContext(CollectionContext);
|
|
1484
|
+
var onResize = React$4.useCallback(function (size, element, data) {
|
|
1485
|
+
resizeIdRef.current += 1;
|
|
1486
|
+
var currentId = resizeIdRef.current;
|
|
1487
|
+
resizeInfosRef.current.push({
|
|
1488
|
+
size: size,
|
|
1489
|
+
element: element,
|
|
1490
|
+
data: data
|
|
1491
|
+
});
|
|
1492
|
+
Promise.resolve().then(function () {
|
|
1493
|
+
if (currentId === resizeIdRef.current) {
|
|
1494
|
+
onBatchResize === null || onBatchResize === void 0 || onBatchResize(resizeInfosRef.current);
|
|
1495
|
+
resizeInfosRef.current = [];
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
// Continue bubbling if parent exist
|
|
1500
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(size, element, data);
|
|
1501
|
+
}, [onBatchResize, onCollectionResize]);
|
|
1502
|
+
return /*#__PURE__*/React$4.createElement(CollectionContext.Provider, {
|
|
1503
|
+
value: onResize
|
|
1504
|
+
}, children);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1420
1507
|
/**
|
|
1421
1508
|
* A collection of shims that provide minimal functionality of the ES6 collections.
|
|
1422
1509
|
*
|
|
@@ -2350,16 +2437,19 @@ function onResize(entities) {
|
|
|
2350
2437
|
entities.forEach(function (entity) {
|
|
2351
2438
|
var _elementListeners$get;
|
|
2352
2439
|
var target = entity.target;
|
|
2353
|
-
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0
|
|
2440
|
+
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 || _elementListeners$get.forEach(function (listener) {
|
|
2354
2441
|
return listener(target);
|
|
2355
2442
|
});
|
|
2356
2443
|
});
|
|
2357
2444
|
}
|
|
2445
|
+
|
|
2358
2446
|
// Note: ResizeObserver polyfill not support option to measure border-box resize
|
|
2359
2447
|
var resizeObserver = new index(onResize);
|
|
2448
|
+
|
|
2360
2449
|
// Dev env only
|
|
2361
2450
|
process.env.NODE_ENV !== 'production' ? elementListeners : null; // eslint-disable-line
|
|
2362
2451
|
process.env.NODE_ENV !== 'production' ? onResize : null; // eslint-disable-line
|
|
2452
|
+
|
|
2363
2453
|
// ============================== Observe ==============================
|
|
2364
2454
|
function observe(element, callback) {
|
|
2365
2455
|
if (!elementListeners.has(element)) {
|
|
@@ -2496,47 +2586,17 @@ var DomWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
2496
2586
|
return DomWrapper;
|
|
2497
2587
|
}(React$4.Component);
|
|
2498
2588
|
|
|
2499
|
-
var CollectionContext = /*#__PURE__*/React$4.createContext(null);
|
|
2500
|
-
/**
|
|
2501
|
-
* Collect all the resize event from children ResizeObserver
|
|
2502
|
-
*/
|
|
2503
|
-
function Collection(_ref) {
|
|
2504
|
-
var children = _ref.children,
|
|
2505
|
-
onBatchResize = _ref.onBatchResize;
|
|
2506
|
-
var resizeIdRef = React$4.useRef(0);
|
|
2507
|
-
var resizeInfosRef = React$4.useRef([]);
|
|
2508
|
-
var onCollectionResize = React$4.useContext(CollectionContext);
|
|
2509
|
-
var onResize = React$4.useCallback(function (size, element, data) {
|
|
2510
|
-
resizeIdRef.current += 1;
|
|
2511
|
-
var currentId = resizeIdRef.current;
|
|
2512
|
-
resizeInfosRef.current.push({
|
|
2513
|
-
size: size,
|
|
2514
|
-
element: element,
|
|
2515
|
-
data: data
|
|
2516
|
-
});
|
|
2517
|
-
Promise.resolve().then(function () {
|
|
2518
|
-
if (currentId === resizeIdRef.current) {
|
|
2519
|
-
onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current);
|
|
2520
|
-
resizeInfosRef.current = [];
|
|
2521
|
-
}
|
|
2522
|
-
});
|
|
2523
|
-
// Continue bubbling if parent exist
|
|
2524
|
-
onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data);
|
|
2525
|
-
}, [onBatchResize, onCollectionResize]);
|
|
2526
|
-
return /*#__PURE__*/React$4.createElement(CollectionContext.Provider, {
|
|
2527
|
-
value: onResize
|
|
2528
|
-
}, children);
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
2589
|
function SingleObserver(props, ref) {
|
|
2532
2590
|
var children = props.children,
|
|
2533
2591
|
disabled = props.disabled;
|
|
2534
2592
|
var elementRef = React$4.useRef(null);
|
|
2535
2593
|
var wrapperRef = React$4.useRef(null);
|
|
2536
2594
|
var onCollectionResize = React$4.useContext(CollectionContext);
|
|
2595
|
+
|
|
2537
2596
|
// =========================== Children ===========================
|
|
2538
2597
|
var isRenderProps = typeof children === 'function';
|
|
2539
2598
|
var mergedChildren = isRenderProps ? children(elementRef) : children;
|
|
2599
|
+
|
|
2540
2600
|
// ============================= Size =============================
|
|
2541
2601
|
var sizeRef = React$4.useRef({
|
|
2542
2602
|
width: -1,
|
|
@@ -2544,21 +2604,25 @@ function SingleObserver(props, ref) {
|
|
|
2544
2604
|
offsetWidth: -1,
|
|
2545
2605
|
offsetHeight: -1
|
|
2546
2606
|
});
|
|
2607
|
+
|
|
2547
2608
|
// ============================= Ref ==============================
|
|
2548
2609
|
var canRef = !isRenderProps && /*#__PURE__*/React$4.isValidElement(mergedChildren) && supportRef(mergedChildren);
|
|
2549
2610
|
var originRef = canRef ? mergedChildren.ref : null;
|
|
2550
|
-
var mergedRef =
|
|
2551
|
-
return composeRef(originRef, elementRef);
|
|
2552
|
-
}, [originRef, elementRef]);
|
|
2611
|
+
var mergedRef = useComposeRef(originRef, elementRef);
|
|
2553
2612
|
var getDom = function getDom() {
|
|
2554
|
-
|
|
2613
|
+
var _elementRef$current;
|
|
2614
|
+
return findDOMNode(elementRef.current) || (
|
|
2615
|
+
// Support `nativeElement` format
|
|
2616
|
+
elementRef.current && _typeof$1(elementRef.current) === 'object' ? findDOMNode((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.nativeElement) : null) || findDOMNode(wrapperRef.current);
|
|
2555
2617
|
};
|
|
2556
2618
|
React$4.useImperativeHandle(ref, function () {
|
|
2557
2619
|
return getDom();
|
|
2558
2620
|
});
|
|
2621
|
+
|
|
2559
2622
|
// =========================== Observe ============================
|
|
2560
2623
|
var propsRef = React$4.useRef(props);
|
|
2561
2624
|
propsRef.current = props;
|
|
2625
|
+
|
|
2562
2626
|
// Handler
|
|
2563
2627
|
var onInternalResize = React$4.useCallback(function (target) {
|
|
2564
2628
|
var _propsRef$current = propsRef.current,
|
|
@@ -2569,6 +2633,7 @@ function SingleObserver(props, ref) {
|
|
|
2569
2633
|
height = _target$getBoundingCl.height;
|
|
2570
2634
|
var offsetWidth = target.offsetWidth,
|
|
2571
2635
|
offsetHeight = target.offsetHeight;
|
|
2636
|
+
|
|
2572
2637
|
/**
|
|
2573
2638
|
* Resize observer trigger when content size changed.
|
|
2574
2639
|
* In most case we just care about element size,
|
|
@@ -2584,6 +2649,7 @@ function SingleObserver(props, ref) {
|
|
|
2584
2649
|
offsetHeight: offsetHeight
|
|
2585
2650
|
};
|
|
2586
2651
|
sizeRef.current = size;
|
|
2652
|
+
|
|
2587
2653
|
// IE is strange, right?
|
|
2588
2654
|
var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
|
|
2589
2655
|
var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
|
|
@@ -2591,8 +2657,9 @@ function SingleObserver(props, ref) {
|
|
|
2591
2657
|
offsetWidth: mergedOffsetWidth,
|
|
2592
2658
|
offsetHeight: mergedOffsetHeight
|
|
2593
2659
|
});
|
|
2660
|
+
|
|
2594
2661
|
// Let collection know what happened
|
|
2595
|
-
onCollectionResize === null || onCollectionResize === void 0
|
|
2662
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(sizeInfo, target, data);
|
|
2596
2663
|
if (onResize) {
|
|
2597
2664
|
// defer the callback but not defer to next frame
|
|
2598
2665
|
Promise.resolve().then(function () {
|
|
@@ -2601,6 +2668,7 @@ function SingleObserver(props, ref) {
|
|
|
2601
2668
|
}
|
|
2602
2669
|
}
|
|
2603
2670
|
}, []);
|
|
2671
|
+
|
|
2604
2672
|
// Dynamic observe
|
|
2605
2673
|
React$4.useEffect(function () {
|
|
2606
2674
|
var currentElement = getDom();
|
|
@@ -2611,6 +2679,7 @@ function SingleObserver(props, ref) {
|
|
|
2611
2679
|
return unobserve(currentElement, onInternalResize);
|
|
2612
2680
|
};
|
|
2613
2681
|
}, [elementRef.current, disabled]);
|
|
2682
|
+
|
|
2614
2683
|
// ============================ Render ============================
|
|
2615
2684
|
return /*#__PURE__*/React$4.createElement(DomWrapper, {
|
|
2616
2685
|
ref: wrapperRef
|
|
@@ -2760,9 +2829,14 @@ var wrapperRaf = function wrapperRaf(callback) {
|
|
|
2760
2829
|
};
|
|
2761
2830
|
wrapperRaf.cancel = function (id) {
|
|
2762
2831
|
var realId = rafIds.get(id);
|
|
2763
|
-
cleanup(
|
|
2832
|
+
cleanup(id);
|
|
2764
2833
|
return caf(realId);
|
|
2765
2834
|
};
|
|
2835
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2836
|
+
wrapperRaf.ids = function () {
|
|
2837
|
+
return rafIds;
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2766
2840
|
|
|
2767
2841
|
function channelUpdate(callback) {
|
|
2768
2842
|
if (typeof MessageChannel === 'undefined') {
|
|
@@ -4109,7 +4183,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
4109
4183
|
|
|
4110
4184
|
function getRoot(ele) {
|
|
4111
4185
|
var _ele$getRootNode;
|
|
4112
|
-
return ele === null || ele === void 0
|
|
4186
|
+
return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
|
4113
4187
|
}
|
|
4114
4188
|
|
|
4115
4189
|
/**
|
|
@@ -4132,20 +4206,34 @@ function getUseId() {
|
|
|
4132
4206
|
return fullClone.useId;
|
|
4133
4207
|
}
|
|
4134
4208
|
var uuid$2 = 0;
|
|
4135
|
-
|
|
4209
|
+
var useOriginId = getUseId();
|
|
4210
|
+
var useId$3 = useOriginId ?
|
|
4211
|
+
// Use React `useId`
|
|
4212
|
+
function useId(id) {
|
|
4213
|
+
var reactId = useOriginId();
|
|
4214
|
+
|
|
4215
|
+
// Developer passed id is single source of truth
|
|
4216
|
+
if (id) {
|
|
4217
|
+
return id;
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
// Test env always return mock id
|
|
4221
|
+
if (process.env.NODE_ENV === 'test') {
|
|
4222
|
+
return 'test-id';
|
|
4223
|
+
}
|
|
4224
|
+
return reactId;
|
|
4225
|
+
} :
|
|
4226
|
+
// Use compatible of `useId`
|
|
4227
|
+
function useCompatId(id) {
|
|
4136
4228
|
// Inner id for accessibility usage. Only work in client side
|
|
4137
4229
|
var _React$useState = React$4.useState('ssr-id'),
|
|
4138
4230
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4139
4231
|
innerId = _React$useState2[0],
|
|
4140
4232
|
setInnerId = _React$useState2[1];
|
|
4141
|
-
var useOriginId = getUseId();
|
|
4142
|
-
var reactNativeId = useOriginId === null || useOriginId === void 0 ? void 0 : useOriginId();
|
|
4143
4233
|
React$4.useEffect(function () {
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
setInnerId("rc_unique_".concat(nextId));
|
|
4148
|
-
}
|
|
4234
|
+
var nextId = uuid$2;
|
|
4235
|
+
uuid$2 += 1;
|
|
4236
|
+
setInnerId("rc_unique_".concat(nextId));
|
|
4149
4237
|
}, []);
|
|
4150
4238
|
|
|
4151
4239
|
// Developer passed id is single source of truth
|
|
@@ -4159,263 +4247,544 @@ function useId$3(id) {
|
|
|
4159
4247
|
}
|
|
4160
4248
|
|
|
4161
4249
|
// Return react native id or inner id
|
|
4162
|
-
return
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
var TriggerContext = /*#__PURE__*/React$4.createContext(null);
|
|
4250
|
+
return innerId;
|
|
4251
|
+
};
|
|
4166
4252
|
|
|
4167
|
-
function
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
}
|
|
4181
|
-
if (hideActionSet.has('hover')) {
|
|
4182
|
-
hideActionSet.delete('hover');
|
|
4183
|
-
hideActionSet.add('click');
|
|
4184
|
-
}
|
|
4185
|
-
}
|
|
4186
|
-
return [showActionSet, hideActionSet];
|
|
4187
|
-
}, [mobile, action, showAction, hideAction]);
|
|
4188
|
-
}
|
|
4253
|
+
function Arrow(props) {
|
|
4254
|
+
var prefixCls = props.prefixCls,
|
|
4255
|
+
align = props.align,
|
|
4256
|
+
arrow = props.arrow,
|
|
4257
|
+
arrowPos = props.arrowPos;
|
|
4258
|
+
var _ref = arrow || {},
|
|
4259
|
+
className = _ref.className,
|
|
4260
|
+
content = _ref.content;
|
|
4261
|
+
var _arrowPos$x = arrowPos.x,
|
|
4262
|
+
x = _arrowPos$x === void 0 ? 0 : _arrowPos$x,
|
|
4263
|
+
_arrowPos$y = arrowPos.y,
|
|
4264
|
+
y = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
|
|
4265
|
+
var arrowRef = React$4.useRef();
|
|
4189
4266
|
|
|
4190
|
-
|
|
4191
|
-
if (!
|
|
4192
|
-
return
|
|
4267
|
+
// Skip if no align
|
|
4268
|
+
if (!align || !align.points) {
|
|
4269
|
+
return null;
|
|
4193
4270
|
}
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4271
|
+
var alignStyle = {
|
|
4272
|
+
position: 'absolute'
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
// Skip if no need to align
|
|
4276
|
+
if (align.autoArrow !== false) {
|
|
4277
|
+
var popupPoints = align.points[0];
|
|
4278
|
+
var targetPoints = align.points[1];
|
|
4279
|
+
var popupTB = popupPoints[0];
|
|
4280
|
+
var popupLR = popupPoints[1];
|
|
4281
|
+
var targetTB = targetPoints[0];
|
|
4282
|
+
var targetLR = targetPoints[1];
|
|
4283
|
+
|
|
4284
|
+
// Top & Bottom
|
|
4285
|
+
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
|
|
4286
|
+
alignStyle.top = y;
|
|
4287
|
+
} else if (popupTB === 't') {
|
|
4288
|
+
alignStyle.top = 0;
|
|
4289
|
+
} else {
|
|
4290
|
+
alignStyle.bottom = 0;
|
|
4213
4291
|
}
|
|
4214
|
-
}
|
|
4215
|
-
return false;
|
|
4216
|
-
});
|
|
4217
4292
|
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
4226
|
-
}
|
|
4227
|
-
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
4228
|
-
var points = align.points;
|
|
4229
|
-
var placements = Object.keys(builtinPlacements);
|
|
4230
|
-
for (var i = 0; i < placements.length; i += 1) {
|
|
4231
|
-
var _builtinPlacements$pl;
|
|
4232
|
-
var placement = placements[i];
|
|
4233
|
-
if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
|
|
4234
|
-
return "".concat(prefixCls, "-placement-").concat(placement);
|
|
4293
|
+
// Left & Right
|
|
4294
|
+
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
|
|
4295
|
+
alignStyle.left = x;
|
|
4296
|
+
} else if (popupLR === 'l') {
|
|
4297
|
+
alignStyle.left = 0;
|
|
4298
|
+
} else {
|
|
4299
|
+
alignStyle.right = 0;
|
|
4235
4300
|
}
|
|
4236
4301
|
}
|
|
4237
|
-
return
|
|
4302
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4303
|
+
ref: arrowRef,
|
|
4304
|
+
className: classNames("".concat(prefixCls, "-arrow"), className),
|
|
4305
|
+
style: alignStyle
|
|
4306
|
+
}, content);
|
|
4238
4307
|
}
|
|
4239
4308
|
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
};
|
|
4309
|
+
function Mask(props) {
|
|
4310
|
+
var prefixCls = props.prefixCls,
|
|
4311
|
+
open = props.open,
|
|
4312
|
+
zIndex = props.zIndex,
|
|
4313
|
+
mask = props.mask,
|
|
4314
|
+
motion = props.motion;
|
|
4315
|
+
if (!mask) {
|
|
4316
|
+
return null;
|
|
4249
4317
|
}
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4318
|
+
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({}, motion, {
|
|
4319
|
+
motionAppear: true,
|
|
4320
|
+
visible: open,
|
|
4321
|
+
removeOnLeave: true
|
|
4322
|
+
}), function (_ref) {
|
|
4323
|
+
var className = _ref.className;
|
|
4324
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4325
|
+
style: {
|
|
4326
|
+
zIndex: zIndex
|
|
4327
|
+
},
|
|
4328
|
+
className: classNames("".concat(prefixCls, "-mask"), className)
|
|
4329
|
+
});
|
|
4330
|
+
});
|
|
4259
4331
|
}
|
|
4260
4332
|
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
var scrollStyle = ['hidden', 'scroll', 'clip', 'auto'];
|
|
4270
|
-
while (current) {
|
|
4271
|
-
var _getWin$getComputedSt = getWin(current).getComputedStyle(current),
|
|
4272
|
-
overflowX = _getWin$getComputedSt.overflowX,
|
|
4273
|
-
overflowY = _getWin$getComputedSt.overflowY,
|
|
4274
|
-
overflow = _getWin$getComputedSt.overflow;
|
|
4275
|
-
if ([overflowX, overflowY, overflow].some(function (o) {
|
|
4276
|
-
return scrollStyle.includes(o);
|
|
4277
|
-
})) {
|
|
4278
|
-
scrollerList.push(current);
|
|
4279
|
-
}
|
|
4280
|
-
current = current.parentElement;
|
|
4281
|
-
}
|
|
4282
|
-
return scrollerList;
|
|
4283
|
-
}
|
|
4284
|
-
function toNum(num) {
|
|
4285
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4286
|
-
return Number.isNaN(num) ? defaultValue : num;
|
|
4287
|
-
}
|
|
4288
|
-
function getPxValue(val) {
|
|
4289
|
-
return toNum(parseFloat(val), 0);
|
|
4333
|
+
var PopupContent = /*#__PURE__*/React$4.memo(function (_ref) {
|
|
4334
|
+
var children = _ref.children;
|
|
4335
|
+
return children;
|
|
4336
|
+
}, function (_, next) {
|
|
4337
|
+
return next.cache;
|
|
4338
|
+
});
|
|
4339
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4340
|
+
PopupContent.displayName = 'PopupContent';
|
|
4290
4341
|
}
|
|
4291
|
-
/**
|
|
4292
|
-
*
|
|
4293
|
-
*
|
|
4294
|
-
* **************************************
|
|
4295
|
-
* * Border *
|
|
4296
|
-
* * ************************** *
|
|
4297
|
-
* * * * * *
|
|
4298
|
-
* * B * * S * B *
|
|
4299
|
-
* * o * * c * o *
|
|
4300
|
-
* * r * Content * r * r *
|
|
4301
|
-
* * d * * o * d *
|
|
4302
|
-
* * e * * l * e *
|
|
4303
|
-
* * r ******************** l * r *
|
|
4304
|
-
* * * Scroll * *
|
|
4305
|
-
* * ************************** *
|
|
4306
|
-
* * Border *
|
|
4307
|
-
* **************************************
|
|
4308
|
-
*
|
|
4309
|
-
*/
|
|
4310
|
-
/**
|
|
4311
|
-
* Get visible area of element
|
|
4312
|
-
*/
|
|
4313
|
-
function getVisibleArea(initArea, scrollerList) {
|
|
4314
|
-
var visibleArea = _objectSpread2({}, initArea);
|
|
4315
|
-
(scrollerList || []).forEach(function (ele) {
|
|
4316
|
-
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
|
|
4317
|
-
return;
|
|
4318
|
-
}
|
|
4319
4342
|
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4343
|
+
var Popup = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
4344
|
+
var popup = props.popup,
|
|
4345
|
+
className = props.className,
|
|
4346
|
+
prefixCls = props.prefixCls,
|
|
4347
|
+
style = props.style,
|
|
4348
|
+
target = props.target,
|
|
4349
|
+
_onVisibleChanged = props.onVisibleChanged,
|
|
4350
|
+
open = props.open,
|
|
4351
|
+
keepDom = props.keepDom,
|
|
4352
|
+
fresh = props.fresh,
|
|
4353
|
+
onClick = props.onClick,
|
|
4354
|
+
mask = props.mask,
|
|
4355
|
+
arrow = props.arrow,
|
|
4356
|
+
arrowPos = props.arrowPos,
|
|
4357
|
+
align = props.align,
|
|
4358
|
+
motion = props.motion,
|
|
4359
|
+
maskMotion = props.maskMotion,
|
|
4360
|
+
forceRender = props.forceRender,
|
|
4361
|
+
getPopupContainer = props.getPopupContainer,
|
|
4362
|
+
autoDestroy = props.autoDestroy,
|
|
4363
|
+
Portal = props.portal,
|
|
4364
|
+
zIndex = props.zIndex,
|
|
4365
|
+
onMouseEnter = props.onMouseEnter,
|
|
4366
|
+
onMouseLeave = props.onMouseLeave,
|
|
4367
|
+
onPointerEnter = props.onPointerEnter,
|
|
4368
|
+
ready = props.ready,
|
|
4369
|
+
offsetX = props.offsetX,
|
|
4370
|
+
offsetY = props.offsetY,
|
|
4371
|
+
offsetR = props.offsetR,
|
|
4372
|
+
offsetB = props.offsetB,
|
|
4373
|
+
onAlign = props.onAlign,
|
|
4374
|
+
onPrepare = props.onPrepare,
|
|
4375
|
+
stretch = props.stretch,
|
|
4376
|
+
targetWidth = props.targetWidth,
|
|
4377
|
+
targetHeight = props.targetHeight;
|
|
4378
|
+
var childNode = typeof popup === 'function' ? popup() : popup;
|
|
4339
4379
|
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
|
|
4380
|
+
// We can not remove holder only when motion finished.
|
|
4381
|
+
var isNodeVisible = open || keepDom;
|
|
4343
4382
|
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4383
|
+
// ======================= Container ========================
|
|
4384
|
+
var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;
|
|
4385
|
+
var _React$useState = React$4.useState(!getPopupContainer || !getPopupContainerNeedParams),
|
|
4386
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4387
|
+
show = _React$useState2[0],
|
|
4388
|
+
setShow = _React$useState2[1];
|
|
4349
4389
|
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
var clipNum = getPxValue(overflowClipMargin);
|
|
4355
|
-
clipMarginWidth = clipNum * scaleX;
|
|
4356
|
-
clipMarginHeight = clipNum * scaleY;
|
|
4390
|
+
// Delay to show since `getPopupContainer` need target element
|
|
4391
|
+
useLayoutEffect$3(function () {
|
|
4392
|
+
if (!show && getPopupContainerNeedParams && target) {
|
|
4393
|
+
setShow(true);
|
|
4357
4394
|
}
|
|
4395
|
+
}, [show, getPopupContainerNeedParams, target]);
|
|
4358
4396
|
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
|
|
4363
|
-
var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
|
|
4364
|
-
visibleArea.left = Math.max(visibleArea.left, eleLeft);
|
|
4365
|
-
visibleArea.top = Math.max(visibleArea.top, eleTop);
|
|
4366
|
-
visibleArea.right = Math.min(visibleArea.right, eleRight);
|
|
4367
|
-
visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
|
|
4368
|
-
});
|
|
4369
|
-
return visibleArea;
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
|
-
function getUnitOffset(size) {
|
|
4373
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4374
|
-
var offsetStr = "".concat(offset);
|
|
4375
|
-
var cells = offsetStr.match(/^(.*)\%$/);
|
|
4376
|
-
if (cells) {
|
|
4377
|
-
return size * (parseFloat(cells[1]) / 100);
|
|
4397
|
+
// ========================= Render =========================
|
|
4398
|
+
if (!show) {
|
|
4399
|
+
return null;
|
|
4378
4400
|
}
|
|
4379
|
-
return parseFloat(offsetStr);
|
|
4380
|
-
}
|
|
4381
|
-
function getNumberOffset(rect, offset) {
|
|
4382
|
-
var _ref = offset || [],
|
|
4383
|
-
_ref2 = _slicedToArray(_ref, 2),
|
|
4384
|
-
offsetX = _ref2[0],
|
|
4385
|
-
offsetY = _ref2[1];
|
|
4386
|
-
return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
|
|
4387
|
-
}
|
|
4388
|
-
function splitPoints() {
|
|
4389
|
-
var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
4390
|
-
return [points[0], points[1]];
|
|
4391
|
-
}
|
|
4392
|
-
function getAlignPoint(rect, points) {
|
|
4393
|
-
var topBottom = points[0];
|
|
4394
|
-
var leftRight = points[1];
|
|
4395
|
-
var x;
|
|
4396
|
-
var y;
|
|
4397
4401
|
|
|
4398
|
-
//
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
}
|
|
4402
|
+
// >>>>> Offset
|
|
4403
|
+
var AUTO = 'auto';
|
|
4404
|
+
var offsetStyle = {
|
|
4405
|
+
left: '-1000vw',
|
|
4406
|
+
top: '-1000vh',
|
|
4407
|
+
right: AUTO,
|
|
4408
|
+
bottom: AUTO
|
|
4409
|
+
};
|
|
4406
4410
|
|
|
4407
|
-
//
|
|
4408
|
-
if (
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4411
|
+
// Set align style
|
|
4412
|
+
if (ready || !open) {
|
|
4413
|
+
var _experimental;
|
|
4414
|
+
var points = align.points;
|
|
4415
|
+
var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);
|
|
4416
|
+
var alignRight = dynamicInset && points[0][1] === 'r';
|
|
4417
|
+
var alignBottom = dynamicInset && points[0][0] === 'b';
|
|
4418
|
+
if (alignRight) {
|
|
4419
|
+
offsetStyle.right = offsetR;
|
|
4420
|
+
offsetStyle.left = AUTO;
|
|
4421
|
+
} else {
|
|
4422
|
+
offsetStyle.left = offsetX;
|
|
4423
|
+
offsetStyle.right = AUTO;
|
|
4424
|
+
}
|
|
4425
|
+
if (alignBottom) {
|
|
4426
|
+
offsetStyle.bottom = offsetB;
|
|
4427
|
+
offsetStyle.top = AUTO;
|
|
4428
|
+
} else {
|
|
4429
|
+
offsetStyle.top = offsetY;
|
|
4430
|
+
offsetStyle.bottom = AUTO;
|
|
4431
|
+
}
|
|
4414
4432
|
}
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4433
|
+
|
|
4434
|
+
// >>>>> Misc
|
|
4435
|
+
var miscStyle = {};
|
|
4436
|
+
if (stretch) {
|
|
4437
|
+
if (stretch.includes('height') && targetHeight) {
|
|
4438
|
+
miscStyle.height = targetHeight;
|
|
4439
|
+
} else if (stretch.includes('minHeight') && targetHeight) {
|
|
4440
|
+
miscStyle.minHeight = targetHeight;
|
|
4441
|
+
}
|
|
4442
|
+
if (stretch.includes('width') && targetWidth) {
|
|
4443
|
+
miscStyle.width = targetWidth;
|
|
4444
|
+
} else if (stretch.includes('minWidth') && targetWidth) {
|
|
4445
|
+
miscStyle.minWidth = targetWidth;
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
if (!open) {
|
|
4449
|
+
miscStyle.pointerEvents = 'none';
|
|
4450
|
+
}
|
|
4451
|
+
return /*#__PURE__*/React$4.createElement(Portal, {
|
|
4452
|
+
open: forceRender || isNodeVisible,
|
|
4453
|
+
getContainer: getPopupContainer && function () {
|
|
4454
|
+
return getPopupContainer(target);
|
|
4455
|
+
},
|
|
4456
|
+
autoDestroy: autoDestroy
|
|
4457
|
+
}, /*#__PURE__*/React$4.createElement(Mask, {
|
|
4458
|
+
prefixCls: prefixCls,
|
|
4459
|
+
open: open,
|
|
4460
|
+
zIndex: zIndex,
|
|
4461
|
+
mask: mask,
|
|
4462
|
+
motion: maskMotion
|
|
4463
|
+
}), /*#__PURE__*/React$4.createElement(RefResizeObserver, {
|
|
4464
|
+
onResize: onAlign,
|
|
4465
|
+
disabled: !open
|
|
4466
|
+
}, function (resizeObserverRef) {
|
|
4467
|
+
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({
|
|
4468
|
+
motionAppear: true,
|
|
4469
|
+
motionEnter: true,
|
|
4470
|
+
motionLeave: true,
|
|
4471
|
+
removeOnLeave: false,
|
|
4472
|
+
forceRender: forceRender,
|
|
4473
|
+
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
4474
|
+
}, motion, {
|
|
4475
|
+
onAppearPrepare: onPrepare,
|
|
4476
|
+
onEnterPrepare: onPrepare,
|
|
4477
|
+
visible: open,
|
|
4478
|
+
onVisibleChanged: function onVisibleChanged(nextVisible) {
|
|
4479
|
+
var _motion$onVisibleChan;
|
|
4480
|
+
motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
|
|
4481
|
+
_onVisibleChanged(nextVisible);
|
|
4482
|
+
}
|
|
4483
|
+
}), function (_ref, motionRef) {
|
|
4484
|
+
var motionClassName = _ref.className,
|
|
4485
|
+
motionStyle = _ref.style;
|
|
4486
|
+
var cls = classNames(prefixCls, motionClassName, className);
|
|
4487
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4488
|
+
ref: composeRef(resizeObserverRef, ref, motionRef),
|
|
4489
|
+
className: cls,
|
|
4490
|
+
style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
4491
|
+
'--arrow-x': "".concat(arrowPos.x || 0, "px"),
|
|
4492
|
+
'--arrow-y': "".concat(arrowPos.y || 0, "px")
|
|
4493
|
+
}, offsetStyle), miscStyle), motionStyle), {}, {
|
|
4494
|
+
boxSizing: 'border-box',
|
|
4495
|
+
zIndex: zIndex
|
|
4496
|
+
}, style),
|
|
4497
|
+
onMouseEnter: onMouseEnter,
|
|
4498
|
+
onMouseLeave: onMouseLeave,
|
|
4499
|
+
onPointerEnter: onPointerEnter,
|
|
4500
|
+
onClick: onClick
|
|
4501
|
+
}, arrow && /*#__PURE__*/React$4.createElement(Arrow, {
|
|
4502
|
+
prefixCls: prefixCls,
|
|
4503
|
+
arrow: arrow,
|
|
4504
|
+
arrowPos: arrowPos,
|
|
4505
|
+
align: align
|
|
4506
|
+
}), /*#__PURE__*/React$4.createElement(PopupContent, {
|
|
4507
|
+
cache: !open && !fresh
|
|
4508
|
+
}, childNode));
|
|
4509
|
+
});
|
|
4510
|
+
}));
|
|
4511
|
+
});
|
|
4512
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4513
|
+
Popup.displayName = 'Popup';
|
|
4514
|
+
}
|
|
4515
|
+
|
|
4516
|
+
var TriggerWrapper = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
4517
|
+
var children = props.children,
|
|
4518
|
+
getTriggerDOMNode = props.getTriggerDOMNode;
|
|
4519
|
+
var canUseRef = supportRef(children);
|
|
4520
|
+
|
|
4521
|
+
// When use `getTriggerDOMNode`, we should do additional work to get the real dom
|
|
4522
|
+
var setRef = React$4.useCallback(function (node) {
|
|
4523
|
+
fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node) : node);
|
|
4524
|
+
}, [getTriggerDOMNode]);
|
|
4525
|
+
var mergedRef = useComposeRef(setRef, children.ref);
|
|
4526
|
+
return canUseRef ? /*#__PURE__*/React$4.cloneElement(children, {
|
|
4527
|
+
ref: mergedRef
|
|
4528
|
+
}) : children;
|
|
4529
|
+
});
|
|
4530
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4531
|
+
TriggerWrapper.displayName = 'TriggerWrapper';
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
var TriggerContext = /*#__PURE__*/React$4.createContext(null);
|
|
4535
|
+
|
|
4536
|
+
function toArray(val) {
|
|
4537
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
4538
|
+
}
|
|
4539
|
+
function useAction(mobile, action, showAction, hideAction) {
|
|
4540
|
+
return React$4.useMemo(function () {
|
|
4541
|
+
var mergedShowAction = toArray(showAction !== null && showAction !== void 0 ? showAction : action);
|
|
4542
|
+
var mergedHideAction = toArray(hideAction !== null && hideAction !== void 0 ? hideAction : action);
|
|
4543
|
+
var showActionSet = new Set(mergedShowAction);
|
|
4544
|
+
var hideActionSet = new Set(mergedHideAction);
|
|
4545
|
+
if (mobile) {
|
|
4546
|
+
if (showActionSet.has('hover')) {
|
|
4547
|
+
showActionSet.delete('hover');
|
|
4548
|
+
showActionSet.add('click');
|
|
4549
|
+
}
|
|
4550
|
+
if (hideActionSet.has('hover')) {
|
|
4551
|
+
hideActionSet.delete('hover');
|
|
4552
|
+
hideActionSet.add('click');
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4555
|
+
return [showActionSet, hideActionSet];
|
|
4556
|
+
}, [mobile, action, showAction, hideAction]);
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
var isVisible = (function (element) {
|
|
4560
|
+
if (!element) {
|
|
4561
|
+
return false;
|
|
4562
|
+
}
|
|
4563
|
+
if (element instanceof Element) {
|
|
4564
|
+
if (element.offsetParent) {
|
|
4565
|
+
return true;
|
|
4566
|
+
}
|
|
4567
|
+
if (element.getBBox) {
|
|
4568
|
+
var _getBBox = element.getBBox(),
|
|
4569
|
+
width = _getBBox.width,
|
|
4570
|
+
height = _getBBox.height;
|
|
4571
|
+
if (width || height) {
|
|
4572
|
+
return true;
|
|
4573
|
+
}
|
|
4574
|
+
}
|
|
4575
|
+
if (element.getBoundingClientRect) {
|
|
4576
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
4577
|
+
_width = _element$getBoundingC.width,
|
|
4578
|
+
_height = _element$getBoundingC.height;
|
|
4579
|
+
if (_width || _height) {
|
|
4580
|
+
return true;
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4584
|
+
return false;
|
|
4585
|
+
});
|
|
4586
|
+
|
|
4587
|
+
function isPointsEq() {
|
|
4588
|
+
var a1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4589
|
+
var a2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4590
|
+
var isAlignPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
4591
|
+
if (isAlignPoint) {
|
|
4592
|
+
return a1[0] === a2[0];
|
|
4593
|
+
}
|
|
4594
|
+
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
4595
|
+
}
|
|
4596
|
+
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
4597
|
+
var points = align.points;
|
|
4598
|
+
var placements = Object.keys(builtinPlacements);
|
|
4599
|
+
for (var i = 0; i < placements.length; i += 1) {
|
|
4600
|
+
var _builtinPlacements$pl;
|
|
4601
|
+
var placement = placements[i];
|
|
4602
|
+
if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
|
|
4603
|
+
return "".concat(prefixCls, "-placement-").concat(placement);
|
|
4604
|
+
}
|
|
4605
|
+
}
|
|
4606
|
+
return '';
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4609
|
+
/** @deprecated We should not use this if we can refactor all deps */
|
|
4610
|
+
function getMotion(prefixCls, motion, animation, transitionName) {
|
|
4611
|
+
if (motion) {
|
|
4612
|
+
return motion;
|
|
4613
|
+
}
|
|
4614
|
+
if (animation) {
|
|
4615
|
+
return {
|
|
4616
|
+
motionName: "".concat(prefixCls, "-").concat(animation)
|
|
4617
|
+
};
|
|
4618
|
+
}
|
|
4619
|
+
if (transitionName) {
|
|
4620
|
+
return {
|
|
4621
|
+
motionName: transitionName
|
|
4622
|
+
};
|
|
4623
|
+
}
|
|
4624
|
+
return null;
|
|
4625
|
+
}
|
|
4626
|
+
function getWin(ele) {
|
|
4627
|
+
return ele.ownerDocument.defaultView;
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4630
|
+
/**
|
|
4631
|
+
* Get all the scrollable parent elements of the element
|
|
4632
|
+
* @param ele The element to be detected
|
|
4633
|
+
* @param areaOnly Only return the parent which will cut visible area
|
|
4634
|
+
*/
|
|
4635
|
+
function collectScroller(ele) {
|
|
4636
|
+
var scrollerList = [];
|
|
4637
|
+
var current = ele === null || ele === void 0 ? void 0 : ele.parentElement;
|
|
4638
|
+
var scrollStyle = ['hidden', 'scroll', 'clip', 'auto'];
|
|
4639
|
+
while (current) {
|
|
4640
|
+
var _getWin$getComputedSt = getWin(current).getComputedStyle(current),
|
|
4641
|
+
overflowX = _getWin$getComputedSt.overflowX,
|
|
4642
|
+
overflowY = _getWin$getComputedSt.overflowY,
|
|
4643
|
+
overflow = _getWin$getComputedSt.overflow;
|
|
4644
|
+
if ([overflowX, overflowY, overflow].some(function (o) {
|
|
4645
|
+
return scrollStyle.includes(o);
|
|
4646
|
+
})) {
|
|
4647
|
+
scrollerList.push(current);
|
|
4648
|
+
}
|
|
4649
|
+
current = current.parentElement;
|
|
4650
|
+
}
|
|
4651
|
+
return scrollerList;
|
|
4652
|
+
}
|
|
4653
|
+
function toNum(num) {
|
|
4654
|
+
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4655
|
+
return Number.isNaN(num) ? defaultValue : num;
|
|
4656
|
+
}
|
|
4657
|
+
function getPxValue(val) {
|
|
4658
|
+
return toNum(parseFloat(val), 0);
|
|
4659
|
+
}
|
|
4660
|
+
/**
|
|
4661
|
+
*
|
|
4662
|
+
*
|
|
4663
|
+
* **************************************
|
|
4664
|
+
* * Border *
|
|
4665
|
+
* * ************************** *
|
|
4666
|
+
* * * * * *
|
|
4667
|
+
* * B * * S * B *
|
|
4668
|
+
* * o * * c * o *
|
|
4669
|
+
* * r * Content * r * r *
|
|
4670
|
+
* * d * * o * d *
|
|
4671
|
+
* * e * * l * e *
|
|
4672
|
+
* * r ******************** l * r *
|
|
4673
|
+
* * * Scroll * *
|
|
4674
|
+
* * ************************** *
|
|
4675
|
+
* * Border *
|
|
4676
|
+
* **************************************
|
|
4677
|
+
*
|
|
4678
|
+
*/
|
|
4679
|
+
/**
|
|
4680
|
+
* Get visible area of element
|
|
4681
|
+
*/
|
|
4682
|
+
function getVisibleArea(initArea, scrollerList) {
|
|
4683
|
+
var visibleArea = _objectSpread2({}, initArea);
|
|
4684
|
+
(scrollerList || []).forEach(function (ele) {
|
|
4685
|
+
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
|
|
4686
|
+
return;
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
// Skip if static position which will not affect visible area
|
|
4690
|
+
var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele),
|
|
4691
|
+
overflow = _getWin$getComputedSt2.overflow,
|
|
4692
|
+
overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin,
|
|
4693
|
+
borderTopWidth = _getWin$getComputedSt2.borderTopWidth,
|
|
4694
|
+
borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth,
|
|
4695
|
+
borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth,
|
|
4696
|
+
borderRightWidth = _getWin$getComputedSt2.borderRightWidth;
|
|
4697
|
+
var eleRect = ele.getBoundingClientRect();
|
|
4698
|
+
var eleOutHeight = ele.offsetHeight,
|
|
4699
|
+
eleInnerHeight = ele.clientHeight,
|
|
4700
|
+
eleOutWidth = ele.offsetWidth,
|
|
4701
|
+
eleInnerWidth = ele.clientWidth;
|
|
4702
|
+
var borderTopNum = getPxValue(borderTopWidth);
|
|
4703
|
+
var borderBottomNum = getPxValue(borderBottomWidth);
|
|
4704
|
+
var borderLeftNum = getPxValue(borderLeftWidth);
|
|
4705
|
+
var borderRightNum = getPxValue(borderRightWidth);
|
|
4706
|
+
var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000);
|
|
4707
|
+
var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000);
|
|
4708
|
+
|
|
4709
|
+
// Original visible area
|
|
4710
|
+
var eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX;
|
|
4711
|
+
var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
|
|
4712
|
+
|
|
4713
|
+
// Cut border size
|
|
4714
|
+
var scaledBorderTopWidth = borderTopNum * scaleY;
|
|
4715
|
+
var scaledBorderBottomWidth = borderBottomNum * scaleY;
|
|
4716
|
+
var scaledBorderLeftWidth = borderLeftNum * scaleX;
|
|
4717
|
+
var scaledBorderRightWidth = borderRightNum * scaleX;
|
|
4718
|
+
|
|
4719
|
+
// Clip margin
|
|
4720
|
+
var clipMarginWidth = 0;
|
|
4721
|
+
var clipMarginHeight = 0;
|
|
4722
|
+
if (overflow === 'clip') {
|
|
4723
|
+
var clipNum = getPxValue(overflowClipMargin);
|
|
4724
|
+
clipMarginWidth = clipNum * scaleX;
|
|
4725
|
+
clipMarginHeight = clipNum * scaleY;
|
|
4726
|
+
}
|
|
4727
|
+
|
|
4728
|
+
// Region
|
|
4729
|
+
var eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth;
|
|
4730
|
+
var eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight;
|
|
4731
|
+
var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
|
|
4732
|
+
var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
|
|
4733
|
+
visibleArea.left = Math.max(visibleArea.left, eleLeft);
|
|
4734
|
+
visibleArea.top = Math.max(visibleArea.top, eleTop);
|
|
4735
|
+
visibleArea.right = Math.min(visibleArea.right, eleRight);
|
|
4736
|
+
visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
|
|
4737
|
+
});
|
|
4738
|
+
return visibleArea;
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
function getUnitOffset(size) {
|
|
4742
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4743
|
+
var offsetStr = "".concat(offset);
|
|
4744
|
+
var cells = offsetStr.match(/^(.*)\%$/);
|
|
4745
|
+
if (cells) {
|
|
4746
|
+
return size * (parseFloat(cells[1]) / 100);
|
|
4747
|
+
}
|
|
4748
|
+
return parseFloat(offsetStr);
|
|
4749
|
+
}
|
|
4750
|
+
function getNumberOffset(rect, offset) {
|
|
4751
|
+
var _ref = offset || [],
|
|
4752
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
4753
|
+
offsetX = _ref2[0],
|
|
4754
|
+
offsetY = _ref2[1];
|
|
4755
|
+
return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
|
|
4756
|
+
}
|
|
4757
|
+
function splitPoints() {
|
|
4758
|
+
var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
4759
|
+
return [points[0], points[1]];
|
|
4760
|
+
}
|
|
4761
|
+
function getAlignPoint(rect, points) {
|
|
4762
|
+
var topBottom = points[0];
|
|
4763
|
+
var leftRight = points[1];
|
|
4764
|
+
var x;
|
|
4765
|
+
var y;
|
|
4766
|
+
|
|
4767
|
+
// Top & Bottom
|
|
4768
|
+
if (topBottom === 't') {
|
|
4769
|
+
y = rect.y;
|
|
4770
|
+
} else if (topBottom === 'b') {
|
|
4771
|
+
y = rect.y + rect.height;
|
|
4772
|
+
} else {
|
|
4773
|
+
y = rect.y + rect.height / 2;
|
|
4774
|
+
}
|
|
4775
|
+
|
|
4776
|
+
// Left & Right
|
|
4777
|
+
if (leftRight === 'l') {
|
|
4778
|
+
x = rect.x;
|
|
4779
|
+
} else if (leftRight === 'r') {
|
|
4780
|
+
x = rect.x + rect.width;
|
|
4781
|
+
} else {
|
|
4782
|
+
x = rect.x + rect.width / 2;
|
|
4783
|
+
}
|
|
4784
|
+
return {
|
|
4785
|
+
x: x,
|
|
4786
|
+
y: y
|
|
4787
|
+
};
|
|
4419
4788
|
}
|
|
4420
4789
|
function reversePoints(points, index) {
|
|
4421
4790
|
var reverseMap = {
|
|
@@ -4481,13 +4850,14 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4481
4850
|
var originTop = popupElement.style.top;
|
|
4482
4851
|
var originRight = popupElement.style.right;
|
|
4483
4852
|
var originBottom = popupElement.style.bottom;
|
|
4853
|
+
var originOverflow = popupElement.style.overflow;
|
|
4484
4854
|
|
|
4485
4855
|
// Placement
|
|
4486
4856
|
var placementInfo = _objectSpread2(_objectSpread2({}, builtinPlacements[placement]), popupAlign);
|
|
4487
4857
|
|
|
4488
4858
|
// placeholder element
|
|
4489
4859
|
var placeholderElement = doc.createElement('div');
|
|
4490
|
-
(_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0
|
|
4860
|
+
(_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
|
|
4491
4861
|
placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
|
|
4492
4862
|
placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
|
|
4493
4863
|
placeholderElement.style.position = popupPosition;
|
|
@@ -4499,6 +4869,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4499
4869
|
popupElement.style.top = '0';
|
|
4500
4870
|
popupElement.style.right = 'auto';
|
|
4501
4871
|
popupElement.style.bottom = 'auto';
|
|
4872
|
+
popupElement.style.overflow = 'hidden';
|
|
4502
4873
|
|
|
4503
4874
|
// Calculate align style, we should consider `transform` case
|
|
4504
4875
|
var targetRect;
|
|
@@ -4571,7 +4942,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4571
4942
|
popupElement.style.top = originTop;
|
|
4572
4943
|
popupElement.style.right = originRight;
|
|
4573
4944
|
popupElement.style.bottom = originBottom;
|
|
4574
|
-
|
|
4945
|
+
popupElement.style.overflow = originOverflow;
|
|
4946
|
+
(_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
|
|
4575
4947
|
|
|
4576
4948
|
// Calculate scale
|
|
4577
4949
|
var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
|
|
@@ -4790,491 +5162,206 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4790
5162
|
}
|
|
4791
5163
|
var numShiftY = shiftY === true ? 0 : shiftY;
|
|
4792
5164
|
if (typeof numShiftY === 'number') {
|
|
4793
|
-
// Top
|
|
4794
|
-
if (nextPopupY < visibleRegionArea.top) {
|
|
4795
|
-
nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
|
|
4796
|
-
|
|
4797
|
-
// When target if far away from visible area
|
|
4798
|
-
// Stop shift
|
|
4799
|
-
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
4800
|
-
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
4801
|
-
}
|
|
4802
|
-
}
|
|
4803
|
-
|
|
4804
|
-
// Bottom
|
|
4805
|
-
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
4806
|
-
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
4807
|
-
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
4808
|
-
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
}
|
|
4812
|
-
|
|
4813
|
-
// ============================ Arrow ============================
|
|
4814
|
-
// Arrow center align
|
|
4815
|
-
var popupLeft = popupRect.x + nextOffsetX;
|
|
4816
|
-
var popupRight = popupLeft + popupWidth;
|
|
4817
|
-
var popupTop = popupRect.y + nextOffsetY;
|
|
4818
|
-
var popupBottom = popupTop + popupHeight;
|
|
4819
|
-
var targetLeft = targetRect.x;
|
|
4820
|
-
var targetRight = targetLeft + targetWidth;
|
|
4821
|
-
var targetTop = targetRect.y;
|
|
4822
|
-
var targetBottom = targetTop + targetHeight;
|
|
4823
|
-
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
4824
|
-
var minRight = Math.min(popupRight, targetRight);
|
|
4825
|
-
var xCenter = (maxLeft + minRight) / 2;
|
|
4826
|
-
var nextArrowX = xCenter - popupLeft;
|
|
4827
|
-
var maxTop = Math.max(popupTop, targetTop);
|
|
4828
|
-
var minBottom = Math.min(popupBottom, targetBottom);
|
|
4829
|
-
var yCenter = (maxTop + minBottom) / 2;
|
|
4830
|
-
var nextArrowY = yCenter - popupTop;
|
|
4831
|
-
onPopupAlign === null || onPopupAlign === void 0 ? void 0 : onPopupAlign(popupEle, nextAlignInfo);
|
|
4832
|
-
|
|
4833
|
-
// Additional calculate right & bottom position
|
|
4834
|
-
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
4835
|
-
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
4836
|
-
setOffsetInfo({
|
|
4837
|
-
ready: true,
|
|
4838
|
-
offsetX: nextOffsetX / _scaleX,
|
|
4839
|
-
offsetY: nextOffsetY / _scaleY,
|
|
4840
|
-
offsetR: offsetX4Right / _scaleX,
|
|
4841
|
-
offsetB: offsetY4Bottom / _scaleY,
|
|
4842
|
-
arrowX: nextArrowX / _scaleX,
|
|
4843
|
-
arrowY: nextArrowY / _scaleY,
|
|
4844
|
-
scaleX: _scaleX,
|
|
4845
|
-
scaleY: _scaleY,
|
|
4846
|
-
align: nextAlignInfo
|
|
4847
|
-
});
|
|
4848
|
-
}
|
|
4849
|
-
});
|
|
4850
|
-
var triggerAlign = function triggerAlign() {
|
|
4851
|
-
alignCountRef.current += 1;
|
|
4852
|
-
var id = alignCountRef.current;
|
|
4853
|
-
|
|
4854
|
-
// Merge all align requirement into one frame
|
|
4855
|
-
Promise.resolve().then(function () {
|
|
4856
|
-
if (alignCountRef.current === id) {
|
|
4857
|
-
onAlign();
|
|
4858
|
-
}
|
|
4859
|
-
});
|
|
4860
|
-
};
|
|
4861
|
-
|
|
4862
|
-
// Reset ready status when placement & open changed
|
|
4863
|
-
var resetReady = function resetReady() {
|
|
4864
|
-
setOffsetInfo(function (ori) {
|
|
4865
|
-
return _objectSpread2(_objectSpread2({}, ori), {}, {
|
|
4866
|
-
ready: false
|
|
4867
|
-
});
|
|
4868
|
-
});
|
|
4869
|
-
};
|
|
4870
|
-
useLayoutEffect$3(resetReady, [placement]);
|
|
4871
|
-
useLayoutEffect$3(function () {
|
|
4872
|
-
if (!open) {
|
|
4873
|
-
resetReady();
|
|
4874
|
-
}
|
|
4875
|
-
}, [open]);
|
|
4876
|
-
return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
|
|
4877
|
-
}
|
|
4878
|
-
|
|
4879
|
-
function useWatch(open, target, popup, onAlign, onScroll) {
|
|
4880
|
-
useLayoutEffect$3(function () {
|
|
4881
|
-
if (open && target && popup) {
|
|
4882
|
-
var targetElement = target;
|
|
4883
|
-
var popupElement = popup;
|
|
4884
|
-
var targetScrollList = collectScroller(targetElement);
|
|
4885
|
-
var popupScrollList = collectScroller(popupElement);
|
|
4886
|
-
var win = getWin(popupElement);
|
|
4887
|
-
var mergedList = new Set([win].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
|
|
4888
|
-
function notifyScroll() {
|
|
4889
|
-
onAlign();
|
|
4890
|
-
onScroll();
|
|
4891
|
-
}
|
|
4892
|
-
mergedList.forEach(function (scroller) {
|
|
4893
|
-
scroller.addEventListener('scroll', notifyScroll, {
|
|
4894
|
-
passive: true
|
|
4895
|
-
});
|
|
4896
|
-
});
|
|
4897
|
-
win.addEventListener('resize', notifyScroll, {
|
|
4898
|
-
passive: true
|
|
4899
|
-
});
|
|
4900
|
-
|
|
4901
|
-
// First time always do align
|
|
4902
|
-
onAlign();
|
|
4903
|
-
return function () {
|
|
4904
|
-
mergedList.forEach(function (scroller) {
|
|
4905
|
-
scroller.removeEventListener('scroll', notifyScroll);
|
|
4906
|
-
win.removeEventListener('resize', notifyScroll);
|
|
4907
|
-
});
|
|
4908
|
-
};
|
|
4909
|
-
}
|
|
4910
|
-
}, [open, target, popup]);
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
function _toArray(arr) {
|
|
4914
|
-
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
4915
|
-
}
|
|
4916
|
-
|
|
4917
|
-
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
|
|
4918
|
-
var openRef = React$4.useRef(open);
|
|
4919
|
-
|
|
4920
|
-
// Window click to hide should be lock to avoid trigger lock immediately
|
|
4921
|
-
var lockRef = React$4.useRef(false);
|
|
4922
|
-
if (openRef.current !== open) {
|
|
4923
|
-
lockRef.current = true;
|
|
4924
|
-
openRef.current = open;
|
|
4925
|
-
}
|
|
4926
|
-
React$4.useEffect(function () {
|
|
4927
|
-
var id = wrapperRaf(function () {
|
|
4928
|
-
lockRef.current = false;
|
|
4929
|
-
});
|
|
4930
|
-
return function () {
|
|
4931
|
-
wrapperRaf.cancel(id);
|
|
4932
|
-
};
|
|
4933
|
-
}, [open]);
|
|
4934
|
-
|
|
4935
|
-
// Click to hide is special action since click popup element should not hide
|
|
4936
|
-
React$4.useEffect(function () {
|
|
4937
|
-
if (clickToHide && popupEle && (!mask || maskClosable)) {
|
|
4938
|
-
var genClickEvents = function genClickEvents() {
|
|
4939
|
-
var clickInside = false;
|
|
4940
|
-
|
|
4941
|
-
// User may mouseDown inside and drag out of popup and mouse up
|
|
4942
|
-
// Record here to prevent close
|
|
4943
|
-
var onWindowMouseDown = function onWindowMouseDown(_ref) {
|
|
4944
|
-
var target = _ref.target;
|
|
4945
|
-
clickInside = inPopupOrChild(target);
|
|
4946
|
-
};
|
|
4947
|
-
var onWindowClick = function onWindowClick(_ref2) {
|
|
4948
|
-
var target = _ref2.target;
|
|
4949
|
-
if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
|
|
4950
|
-
triggerOpen(false);
|
|
4951
|
-
}
|
|
4952
|
-
};
|
|
4953
|
-
return [onWindowMouseDown, onWindowClick];
|
|
4954
|
-
};
|
|
4955
|
-
|
|
4956
|
-
// Events
|
|
4957
|
-
var _genClickEvents = genClickEvents(),
|
|
4958
|
-
_genClickEvents2 = _slicedToArray(_genClickEvents, 2),
|
|
4959
|
-
onWinMouseDown = _genClickEvents2[0],
|
|
4960
|
-
onWinClick = _genClickEvents2[1];
|
|
4961
|
-
var _genClickEvents3 = genClickEvents(),
|
|
4962
|
-
_genClickEvents4 = _slicedToArray(_genClickEvents3, 2),
|
|
4963
|
-
onShadowMouseDown = _genClickEvents4[0],
|
|
4964
|
-
onShadowClick = _genClickEvents4[1];
|
|
4965
|
-
var win = getWin(popupEle);
|
|
4966
|
-
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
4967
|
-
win.addEventListener('click', onWinClick, true);
|
|
4968
|
-
win.addEventListener('contextmenu', onWinClick, true);
|
|
4969
|
-
|
|
4970
|
-
// shadow root
|
|
4971
|
-
var targetShadowRoot = getShadowRoot(targetEle);
|
|
4972
|
-
if (targetShadowRoot) {
|
|
4973
|
-
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
4974
|
-
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
4975
|
-
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
4976
|
-
}
|
|
4977
|
-
|
|
4978
|
-
// Warning if target and popup not in same root
|
|
4979
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4980
|
-
var _targetEle$getRootNod, _popupEle$getRootNode;
|
|
4981
|
-
var targetRoot = targetEle === null || targetEle === void 0 ? void 0 : (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
|
|
4982
|
-
var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
|
|
4983
|
-
warningOnce(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
|
|
4984
|
-
}
|
|
4985
|
-
return function () {
|
|
4986
|
-
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
4987
|
-
win.removeEventListener('click', onWinClick, true);
|
|
4988
|
-
win.removeEventListener('contextmenu', onWinClick, true);
|
|
4989
|
-
if (targetShadowRoot) {
|
|
4990
|
-
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
4991
|
-
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
4992
|
-
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
4993
|
-
}
|
|
4994
|
-
};
|
|
4995
|
-
}
|
|
4996
|
-
}, [clickToHide, targetEle, popupEle, mask, maskClosable]);
|
|
4997
|
-
}
|
|
4998
|
-
|
|
4999
|
-
function Arrow(props) {
|
|
5000
|
-
var prefixCls = props.prefixCls,
|
|
5001
|
-
align = props.align,
|
|
5002
|
-
arrow = props.arrow,
|
|
5003
|
-
arrowPos = props.arrowPos;
|
|
5004
|
-
var _ref = arrow || {},
|
|
5005
|
-
className = _ref.className,
|
|
5006
|
-
content = _ref.content;
|
|
5007
|
-
var _arrowPos$x = arrowPos.x,
|
|
5008
|
-
x = _arrowPos$x === void 0 ? 0 : _arrowPos$x,
|
|
5009
|
-
_arrowPos$y = arrowPos.y,
|
|
5010
|
-
y = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
|
|
5011
|
-
var arrowRef = React$4.useRef();
|
|
5165
|
+
// Top
|
|
5166
|
+
if (nextPopupY < visibleRegionArea.top) {
|
|
5167
|
+
nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
|
|
5012
5168
|
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
};
|
|
5169
|
+
// When target if far away from visible area
|
|
5170
|
+
// Stop shift
|
|
5171
|
+
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
5172
|
+
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5020
5175
|
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5176
|
+
// Bottom
|
|
5177
|
+
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
5178
|
+
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
5179
|
+
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
5180
|
+
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
5181
|
+
}
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5029
5184
|
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5185
|
+
// ============================ Arrow ============================
|
|
5186
|
+
// Arrow center align
|
|
5187
|
+
var popupLeft = popupRect.x + nextOffsetX;
|
|
5188
|
+
var popupRight = popupLeft + popupWidth;
|
|
5189
|
+
var popupTop = popupRect.y + nextOffsetY;
|
|
5190
|
+
var popupBottom = popupTop + popupHeight;
|
|
5191
|
+
var targetLeft = targetRect.x;
|
|
5192
|
+
var targetRight = targetLeft + targetWidth;
|
|
5193
|
+
var targetTop = targetRect.y;
|
|
5194
|
+
var targetBottom = targetTop + targetHeight;
|
|
5195
|
+
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
5196
|
+
var minRight = Math.min(popupRight, targetRight);
|
|
5197
|
+
var xCenter = (maxLeft + minRight) / 2;
|
|
5198
|
+
var nextArrowX = xCenter - popupLeft;
|
|
5199
|
+
var maxTop = Math.max(popupTop, targetTop);
|
|
5200
|
+
var minBottom = Math.min(popupBottom, targetBottom);
|
|
5201
|
+
var yCenter = (maxTop + minBottom) / 2;
|
|
5202
|
+
var nextArrowY = yCenter - popupTop;
|
|
5203
|
+
onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
|
|
5038
5204
|
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5205
|
+
// Additional calculate right & bottom position
|
|
5206
|
+
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
5207
|
+
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
5208
|
+
setOffsetInfo({
|
|
5209
|
+
ready: true,
|
|
5210
|
+
offsetX: nextOffsetX / _scaleX,
|
|
5211
|
+
offsetY: nextOffsetY / _scaleY,
|
|
5212
|
+
offsetR: offsetX4Right / _scaleX,
|
|
5213
|
+
offsetB: offsetY4Bottom / _scaleY,
|
|
5214
|
+
arrowX: nextArrowX / _scaleX,
|
|
5215
|
+
arrowY: nextArrowY / _scaleY,
|
|
5216
|
+
scaleX: _scaleX,
|
|
5217
|
+
scaleY: _scaleY,
|
|
5218
|
+
align: nextAlignInfo
|
|
5219
|
+
});
|
|
5046
5220
|
}
|
|
5047
|
-
}
|
|
5048
|
-
return /*#__PURE__*/React$4.createElement("div", {
|
|
5049
|
-
ref: arrowRef,
|
|
5050
|
-
className: classNames("".concat(prefixCls, "-arrow"), className),
|
|
5051
|
-
style: alignStyle
|
|
5052
|
-
}, content);
|
|
5053
|
-
}
|
|
5054
|
-
|
|
5055
|
-
function Mask(props) {
|
|
5056
|
-
var prefixCls = props.prefixCls,
|
|
5057
|
-
open = props.open,
|
|
5058
|
-
zIndex = props.zIndex,
|
|
5059
|
-
mask = props.mask,
|
|
5060
|
-
motion = props.motion;
|
|
5061
|
-
if (!mask) {
|
|
5062
|
-
return null;
|
|
5063
|
-
}
|
|
5064
|
-
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({}, motion, {
|
|
5065
|
-
motionAppear: true,
|
|
5066
|
-
visible: open,
|
|
5067
|
-
removeOnLeave: true
|
|
5068
|
-
}), function (_ref) {
|
|
5069
|
-
var className = _ref.className;
|
|
5070
|
-
return /*#__PURE__*/React$4.createElement("div", {
|
|
5071
|
-
style: {
|
|
5072
|
-
zIndex: zIndex
|
|
5073
|
-
},
|
|
5074
|
-
className: classNames("".concat(prefixCls, "-mask"), className)
|
|
5075
|
-
});
|
|
5076
5221
|
});
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
var
|
|
5080
|
-
var children = _ref.children;
|
|
5081
|
-
return children;
|
|
5082
|
-
}, function (_, next) {
|
|
5083
|
-
return next.cache;
|
|
5084
|
-
});
|
|
5085
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5086
|
-
PopupContent.displayName = 'PopupContent';
|
|
5087
|
-
}
|
|
5088
|
-
|
|
5089
|
-
var Popup = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
5090
|
-
var popup = props.popup,
|
|
5091
|
-
className = props.className,
|
|
5092
|
-
prefixCls = props.prefixCls,
|
|
5093
|
-
style = props.style,
|
|
5094
|
-
target = props.target,
|
|
5095
|
-
_onVisibleChanged = props.onVisibleChanged,
|
|
5096
|
-
open = props.open,
|
|
5097
|
-
keepDom = props.keepDom,
|
|
5098
|
-
fresh = props.fresh,
|
|
5099
|
-
onClick = props.onClick,
|
|
5100
|
-
mask = props.mask,
|
|
5101
|
-
arrow = props.arrow,
|
|
5102
|
-
arrowPos = props.arrowPos,
|
|
5103
|
-
align = props.align,
|
|
5104
|
-
motion = props.motion,
|
|
5105
|
-
maskMotion = props.maskMotion,
|
|
5106
|
-
forceRender = props.forceRender,
|
|
5107
|
-
getPopupContainer = props.getPopupContainer,
|
|
5108
|
-
autoDestroy = props.autoDestroy,
|
|
5109
|
-
Portal = props.portal,
|
|
5110
|
-
zIndex = props.zIndex,
|
|
5111
|
-
onMouseEnter = props.onMouseEnter,
|
|
5112
|
-
onMouseLeave = props.onMouseLeave,
|
|
5113
|
-
onPointerEnter = props.onPointerEnter,
|
|
5114
|
-
ready = props.ready,
|
|
5115
|
-
offsetX = props.offsetX,
|
|
5116
|
-
offsetY = props.offsetY,
|
|
5117
|
-
offsetR = props.offsetR,
|
|
5118
|
-
offsetB = props.offsetB,
|
|
5119
|
-
onAlign = props.onAlign,
|
|
5120
|
-
onPrepare = props.onPrepare,
|
|
5121
|
-
stretch = props.stretch,
|
|
5122
|
-
targetWidth = props.targetWidth,
|
|
5123
|
-
targetHeight = props.targetHeight;
|
|
5124
|
-
var childNode = typeof popup === 'function' ? popup() : popup;
|
|
5125
|
-
|
|
5126
|
-
// We can not remove holder only when motion finished.
|
|
5127
|
-
var isNodeVisible = open || keepDom;
|
|
5222
|
+
var triggerAlign = function triggerAlign() {
|
|
5223
|
+
alignCountRef.current += 1;
|
|
5224
|
+
var id = alignCountRef.current;
|
|
5128
5225
|
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5226
|
+
// Merge all align requirement into one frame
|
|
5227
|
+
Promise.resolve().then(function () {
|
|
5228
|
+
if (alignCountRef.current === id) {
|
|
5229
|
+
onAlign();
|
|
5230
|
+
}
|
|
5231
|
+
});
|
|
5232
|
+
};
|
|
5135
5233
|
|
|
5136
|
-
//
|
|
5234
|
+
// Reset ready status when placement & open changed
|
|
5235
|
+
var resetReady = function resetReady() {
|
|
5236
|
+
setOffsetInfo(function (ori) {
|
|
5237
|
+
return _objectSpread2(_objectSpread2({}, ori), {}, {
|
|
5238
|
+
ready: false
|
|
5239
|
+
});
|
|
5240
|
+
});
|
|
5241
|
+
};
|
|
5242
|
+
useLayoutEffect$3(resetReady, [placement]);
|
|
5137
5243
|
useLayoutEffect$3(function () {
|
|
5138
|
-
if (!
|
|
5139
|
-
|
|
5244
|
+
if (!open) {
|
|
5245
|
+
resetReady();
|
|
5140
5246
|
}
|
|
5141
|
-
}, [
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
if (!show) {
|
|
5145
|
-
return null;
|
|
5146
|
-
}
|
|
5247
|
+
}, [open]);
|
|
5248
|
+
return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
|
|
5249
|
+
}
|
|
5147
5250
|
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5251
|
+
function useWatch(open, target, popup, onAlign, onScroll) {
|
|
5252
|
+
useLayoutEffect$3(function () {
|
|
5253
|
+
if (open && target && popup) {
|
|
5254
|
+
var targetElement = target;
|
|
5255
|
+
var popupElement = popup;
|
|
5256
|
+
var targetScrollList = collectScroller(targetElement);
|
|
5257
|
+
var popupScrollList = collectScroller(popupElement);
|
|
5258
|
+
var win = getWin(popupElement);
|
|
5259
|
+
var mergedList = new Set([win].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
|
|
5260
|
+
function notifyScroll() {
|
|
5261
|
+
onAlign();
|
|
5262
|
+
onScroll();
|
|
5263
|
+
}
|
|
5264
|
+
mergedList.forEach(function (scroller) {
|
|
5265
|
+
scroller.addEventListener('scroll', notifyScroll, {
|
|
5266
|
+
passive: true
|
|
5267
|
+
});
|
|
5268
|
+
});
|
|
5269
|
+
win.addEventListener('resize', notifyScroll, {
|
|
5270
|
+
passive: true
|
|
5271
|
+
});
|
|
5156
5272
|
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
offsetStyle.right = offsetR;
|
|
5166
|
-
offsetStyle.left = AUTO;
|
|
5167
|
-
} else {
|
|
5168
|
-
offsetStyle.left = offsetX;
|
|
5169
|
-
offsetStyle.right = AUTO;
|
|
5170
|
-
}
|
|
5171
|
-
if (alignBottom) {
|
|
5172
|
-
offsetStyle.bottom = offsetB;
|
|
5173
|
-
offsetStyle.top = AUTO;
|
|
5174
|
-
} else {
|
|
5175
|
-
offsetStyle.top = offsetY;
|
|
5176
|
-
offsetStyle.bottom = AUTO;
|
|
5273
|
+
// First time always do align
|
|
5274
|
+
onAlign();
|
|
5275
|
+
return function () {
|
|
5276
|
+
mergedList.forEach(function (scroller) {
|
|
5277
|
+
scroller.removeEventListener('scroll', notifyScroll);
|
|
5278
|
+
win.removeEventListener('resize', notifyScroll);
|
|
5279
|
+
});
|
|
5280
|
+
};
|
|
5177
5281
|
}
|
|
5178
|
-
}
|
|
5282
|
+
}, [open, target, popup]);
|
|
5283
|
+
}
|
|
5179
5284
|
|
|
5180
|
-
|
|
5181
|
-
var
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
if (stretch.includes('width') && targetWidth) {
|
|
5189
|
-
miscStyle.width = targetWidth;
|
|
5190
|
-
} else if (stretch.includes('minWidth') && targetWidth) {
|
|
5191
|
-
miscStyle.minWidth = targetWidth;
|
|
5192
|
-
}
|
|
5193
|
-
}
|
|
5194
|
-
if (!open) {
|
|
5195
|
-
miscStyle.pointerEvents = 'none';
|
|
5285
|
+
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
|
|
5286
|
+
var openRef = React$4.useRef(open);
|
|
5287
|
+
|
|
5288
|
+
// Window click to hide should be lock to avoid trigger lock immediately
|
|
5289
|
+
var lockRef = React$4.useRef(false);
|
|
5290
|
+
if (openRef.current !== open) {
|
|
5291
|
+
lockRef.current = true;
|
|
5292
|
+
openRef.current = open;
|
|
5196
5293
|
}
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
return getPopupContainer(target);
|
|
5201
|
-
},
|
|
5202
|
-
autoDestroy: autoDestroy
|
|
5203
|
-
}, /*#__PURE__*/React$4.createElement(Mask, {
|
|
5204
|
-
prefixCls: prefixCls,
|
|
5205
|
-
open: open,
|
|
5206
|
-
zIndex: zIndex,
|
|
5207
|
-
mask: mask,
|
|
5208
|
-
motion: maskMotion
|
|
5209
|
-
}), /*#__PURE__*/React$4.createElement(RefResizeObserver, {
|
|
5210
|
-
onResize: onAlign,
|
|
5211
|
-
disabled: !open
|
|
5212
|
-
}, function (resizeObserverRef) {
|
|
5213
|
-
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({
|
|
5214
|
-
motionAppear: true,
|
|
5215
|
-
motionEnter: true,
|
|
5216
|
-
motionLeave: true,
|
|
5217
|
-
removeOnLeave: false,
|
|
5218
|
-
forceRender: forceRender,
|
|
5219
|
-
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
5220
|
-
}, motion, {
|
|
5221
|
-
onAppearPrepare: onPrepare,
|
|
5222
|
-
onEnterPrepare: onPrepare,
|
|
5223
|
-
visible: open,
|
|
5224
|
-
onVisibleChanged: function onVisibleChanged(nextVisible) {
|
|
5225
|
-
var _motion$onVisibleChan;
|
|
5226
|
-
motion === null || motion === void 0 ? void 0 : (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 ? void 0 : _motion$onVisibleChan.call(motion, nextVisible);
|
|
5227
|
-
_onVisibleChanged(nextVisible);
|
|
5228
|
-
}
|
|
5229
|
-
}), function (_ref, motionRef) {
|
|
5230
|
-
var motionClassName = _ref.className,
|
|
5231
|
-
motionStyle = _ref.style;
|
|
5232
|
-
var cls = classNames(prefixCls, motionClassName, className);
|
|
5233
|
-
return /*#__PURE__*/React$4.createElement("div", {
|
|
5234
|
-
ref: composeRef(resizeObserverRef, ref, motionRef),
|
|
5235
|
-
className: cls,
|
|
5236
|
-
style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
5237
|
-
'--arrow-x': "".concat(arrowPos.x || 0, "px"),
|
|
5238
|
-
'--arrow-y': "".concat(arrowPos.y || 0, "px")
|
|
5239
|
-
}, offsetStyle), miscStyle), motionStyle), {}, {
|
|
5240
|
-
boxSizing: 'border-box',
|
|
5241
|
-
zIndex: zIndex
|
|
5242
|
-
}, style),
|
|
5243
|
-
onMouseEnter: onMouseEnter,
|
|
5244
|
-
onMouseLeave: onMouseLeave,
|
|
5245
|
-
onPointerEnter: onPointerEnter,
|
|
5246
|
-
onClick: onClick
|
|
5247
|
-
}, arrow && /*#__PURE__*/React$4.createElement(Arrow, {
|
|
5248
|
-
prefixCls: prefixCls,
|
|
5249
|
-
arrow: arrow,
|
|
5250
|
-
arrowPos: arrowPos,
|
|
5251
|
-
align: align
|
|
5252
|
-
}), /*#__PURE__*/React$4.createElement(PopupContent, {
|
|
5253
|
-
cache: !open && !fresh
|
|
5254
|
-
}, childNode));
|
|
5294
|
+
React$4.useEffect(function () {
|
|
5295
|
+
var id = wrapperRaf(function () {
|
|
5296
|
+
lockRef.current = false;
|
|
5255
5297
|
});
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
}
|
|
5298
|
+
return function () {
|
|
5299
|
+
wrapperRaf.cancel(id);
|
|
5300
|
+
};
|
|
5301
|
+
}, [open]);
|
|
5261
5302
|
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5303
|
+
// Click to hide is special action since click popup element should not hide
|
|
5304
|
+
React$4.useEffect(function () {
|
|
5305
|
+
if (clickToHide && popupEle && (!mask || maskClosable)) {
|
|
5306
|
+
var genClickEvents = function genClickEvents() {
|
|
5307
|
+
var clickInside = false;
|
|
5266
5308
|
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5309
|
+
// User may mouseDown inside and drag out of popup and mouse up
|
|
5310
|
+
// Record here to prevent close
|
|
5311
|
+
var onWindowMouseDown = function onWindowMouseDown(_ref) {
|
|
5312
|
+
var target = _ref.target;
|
|
5313
|
+
clickInside = inPopupOrChild(target);
|
|
5314
|
+
};
|
|
5315
|
+
var onWindowClick = function onWindowClick(_ref2) {
|
|
5316
|
+
var target = _ref2.target;
|
|
5317
|
+
if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
|
|
5318
|
+
triggerOpen(false);
|
|
5319
|
+
}
|
|
5320
|
+
};
|
|
5321
|
+
return [onWindowMouseDown, onWindowClick];
|
|
5322
|
+
};
|
|
5323
|
+
|
|
5324
|
+
// Events
|
|
5325
|
+
var _genClickEvents = genClickEvents(),
|
|
5326
|
+
_genClickEvents2 = _slicedToArray(_genClickEvents, 2),
|
|
5327
|
+
onWinMouseDown = _genClickEvents2[0],
|
|
5328
|
+
onWinClick = _genClickEvents2[1];
|
|
5329
|
+
var _genClickEvents3 = genClickEvents(),
|
|
5330
|
+
_genClickEvents4 = _slicedToArray(_genClickEvents3, 2),
|
|
5331
|
+
onShadowMouseDown = _genClickEvents4[0],
|
|
5332
|
+
onShadowClick = _genClickEvents4[1];
|
|
5333
|
+
var win = getWin(popupEle);
|
|
5334
|
+
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
5335
|
+
win.addEventListener('click', onWinClick, true);
|
|
5336
|
+
win.addEventListener('contextmenu', onWinClick, true);
|
|
5337
|
+
|
|
5338
|
+
// shadow root
|
|
5339
|
+
var targetShadowRoot = getShadowRoot(targetEle);
|
|
5340
|
+
if (targetShadowRoot) {
|
|
5341
|
+
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
5342
|
+
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
5343
|
+
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
// Warning if target and popup not in same root
|
|
5347
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5348
|
+
var _targetEle$getRootNod, _popupEle$getRootNode;
|
|
5349
|
+
var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
|
|
5350
|
+
var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
|
|
5351
|
+
warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
|
|
5352
|
+
}
|
|
5353
|
+
return function () {
|
|
5354
|
+
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
5355
|
+
win.removeEventListener('click', onWinClick, true);
|
|
5356
|
+
win.removeEventListener('contextmenu', onWinClick, true);
|
|
5357
|
+
if (targetShadowRoot) {
|
|
5358
|
+
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
5359
|
+
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
5360
|
+
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
5361
|
+
}
|
|
5362
|
+
};
|
|
5363
|
+
}
|
|
5364
|
+
}, [clickToHide, targetEle, popupEle, mask, maskClosable]);
|
|
5278
5365
|
}
|
|
5279
5366
|
|
|
5280
5367
|
var _excluded$6 = ["prefixCls", "children", "action", "showAction", "hideAction", "popupVisible", "defaultPopupVisible", "onPopupVisibleChange", "afterPopupVisibleChange", "mouseEnterDelay", "mouseLeaveDelay", "focusDelay", "blurDelay", "mask", "maskClosable", "getPopupContainer", "forceRender", "autoDestroy", "destroyPopupOnHide", "popup", "popupClassName", "popupStyle", "popupPlacement", "builtinPlacements", "popupAlign", "zIndex", "stretch", "getPopupClassNameFromAlign", "fresh", "alignPoint", "onPopupClick", "onPopupAlign", "arrow", "popupMotion", "maskMotion", "popupTransitionName", "popupAnimation", "maskTransitionName", "maskAnimation", "className", "getTriggerDOMNode"];
|
|
@@ -5351,7 +5438,7 @@ function generateTrigger() {
|
|
|
5351
5438
|
return {
|
|
5352
5439
|
registerSubPopup: function registerSubPopup(id, subPopupEle) {
|
|
5353
5440
|
subPopupElements.current[id] = subPopupEle;
|
|
5354
|
-
parentContext === null || parentContext === void 0
|
|
5441
|
+
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, subPopupEle);
|
|
5355
5442
|
}
|
|
5356
5443
|
};
|
|
5357
5444
|
}, [parentContext]);
|
|
@@ -5366,7 +5453,7 @@ function generateTrigger() {
|
|
|
5366
5453
|
if (isDOM(node) && popupEle !== node) {
|
|
5367
5454
|
setPopupEle(node);
|
|
5368
5455
|
}
|
|
5369
|
-
parentContext === null || parentContext === void 0
|
|
5456
|
+
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, node);
|
|
5370
5457
|
});
|
|
5371
5458
|
|
|
5372
5459
|
// =========================== Target ===========================
|
|
@@ -5375,9 +5462,13 @@ function generateTrigger() {
|
|
|
5375
5462
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
5376
5463
|
targetEle = _React$useState6[0],
|
|
5377
5464
|
setTargetEle = _React$useState6[1];
|
|
5465
|
+
|
|
5466
|
+
// Used for forwardRef target. Not use internal
|
|
5467
|
+
var externalForwardRef = React$4.useRef(null);
|
|
5378
5468
|
var setTargetRef = useEvent$2(function (node) {
|
|
5379
5469
|
if (isDOM(node) && targetEle !== node) {
|
|
5380
5470
|
setTargetEle(node);
|
|
5471
|
+
externalForwardRef.current = node;
|
|
5381
5472
|
}
|
|
5382
5473
|
});
|
|
5383
5474
|
|
|
@@ -5417,15 +5508,19 @@ function generateTrigger() {
|
|
|
5417
5508
|
}, [popupVisible]);
|
|
5418
5509
|
var openRef = React$4.useRef(mergedOpen);
|
|
5419
5510
|
openRef.current = mergedOpen;
|
|
5511
|
+
var lastTriggerRef = React$4.useRef([]);
|
|
5512
|
+
lastTriggerRef.current = [];
|
|
5420
5513
|
var internalTriggerOpen = useEvent$2(function (nextOpen) {
|
|
5514
|
+
var _lastTriggerRef$curre;
|
|
5515
|
+
setMergedOpen(nextOpen);
|
|
5516
|
+
|
|
5421
5517
|
// Enter or Pointer will both trigger open state change
|
|
5422
5518
|
// We only need take one to avoid duplicated change event trigger
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
});
|
|
5519
|
+
// Use `lastTriggerRef` to record last open type
|
|
5520
|
+
if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
|
|
5521
|
+
lastTriggerRef.current.push(nextOpen);
|
|
5522
|
+
onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
|
|
5523
|
+
}
|
|
5429
5524
|
});
|
|
5430
5525
|
|
|
5431
5526
|
// Trigger for delay
|
|
@@ -5515,8 +5610,11 @@ function generateTrigger() {
|
|
|
5515
5610
|
var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
|
5516
5611
|
return classNames(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
|
|
5517
5612
|
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
|
|
5613
|
+
|
|
5614
|
+
// ============================ Refs ============================
|
|
5518
5615
|
React$4.useImperativeHandle(ref, function () {
|
|
5519
5616
|
return {
|
|
5617
|
+
nativeElement: externalForwardRef.current,
|
|
5520
5618
|
forceAlign: triggerAlign
|
|
5521
5619
|
};
|
|
5522
5620
|
});
|
|
@@ -5546,7 +5644,7 @@ function generateTrigger() {
|
|
|
5546
5644
|
var onVisibleChanged = function onVisibleChanged(visible) {
|
|
5547
5645
|
setInMotion(false);
|
|
5548
5646
|
onAlign();
|
|
5549
|
-
afterPopupVisibleChange === null || afterPopupVisibleChange === void 0
|
|
5647
|
+
afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
|
|
5550
5648
|
};
|
|
5551
5649
|
|
|
5552
5650
|
// We will trigger align when motion is in prepare
|
|
@@ -5573,14 +5671,14 @@ function generateTrigger() {
|
|
|
5573
5671
|
function wrapperAction(eventName, nextOpen, delay, preEvent) {
|
|
5574
5672
|
cloneProps[eventName] = function (event) {
|
|
5575
5673
|
var _originChildProps$eve;
|
|
5576
|
-
preEvent === null || preEvent === void 0
|
|
5674
|
+
preEvent === null || preEvent === void 0 || preEvent(event);
|
|
5577
5675
|
triggerOpen(nextOpen, delay);
|
|
5578
5676
|
|
|
5579
5677
|
// Pass to origin
|
|
5580
5678
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5581
5679
|
args[_key - 1] = arguments[_key];
|
|
5582
5680
|
}
|
|
5583
|
-
(_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0
|
|
5681
|
+
(_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
|
|
5584
5682
|
};
|
|
5585
5683
|
}
|
|
5586
5684
|
|
|
@@ -5599,7 +5697,7 @@ function generateTrigger() {
|
|
|
5599
5697
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
5600
5698
|
args[_key2 - 1] = arguments[_key2];
|
|
5601
5699
|
}
|
|
5602
|
-
(_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0
|
|
5700
|
+
(_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
|
|
5603
5701
|
};
|
|
5604
5702
|
}
|
|
5605
5703
|
|
|
@@ -5631,7 +5729,7 @@ function generateTrigger() {
|
|
|
5631
5729
|
cloneProps.onMouseMove = function (event) {
|
|
5632
5730
|
var _originChildProps$onM;
|
|
5633
5731
|
// setMousePosByEvent(event);
|
|
5634
|
-
(_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0
|
|
5732
|
+
(_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
|
|
5635
5733
|
};
|
|
5636
5734
|
}
|
|
5637
5735
|
}
|
|
@@ -5667,7 +5765,7 @@ function generateTrigger() {
|
|
|
5667
5765
|
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
5668
5766
|
args[_key3 - 1] = arguments[_key3];
|
|
5669
5767
|
}
|
|
5670
|
-
(_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0
|
|
5768
|
+
(_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
|
|
5671
5769
|
};
|
|
5672
5770
|
}
|
|
5673
5771
|
|
|
@@ -5689,7 +5787,7 @@ function generateTrigger() {
|
|
|
5689
5787
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5690
5788
|
args[_key4] = arguments[_key4];
|
|
5691
5789
|
}
|
|
5692
|
-
(_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0
|
|
5790
|
+
(_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
|
|
5693
5791
|
restProps[eventName].apply(restProps, args);
|
|
5694
5792
|
};
|
|
5695
5793
|
}
|
|
@@ -5901,6 +5999,10 @@ var SelectTrigger = function SelectTrigger(props, ref) {
|
|
|
5901
5999
|
var RefSelectTrigger = /*#__PURE__*/React$4.forwardRef(SelectTrigger);
|
|
5902
6000
|
RefSelectTrigger.displayName = 'SelectTrigger';
|
|
5903
6001
|
|
|
6002
|
+
function _toArray(arr) {
|
|
6003
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
6004
|
+
}
|
|
6005
|
+
|
|
5904
6006
|
function getKey(data, index) {
|
|
5905
6007
|
var key = data.key;
|
|
5906
6008
|
var value;
|
|
@@ -7289,13 +7391,11 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7289
7391
|
}
|
|
7290
7392
|
// Trigger next effect
|
|
7291
7393
|
if (needCollectHeight) {
|
|
7292
|
-
setSyncState(
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
});
|
|
7298
|
-
});
|
|
7394
|
+
setSyncState(_objectSpread2(_objectSpread2({}, syncState), {}, {
|
|
7395
|
+
times: syncState.times + 1,
|
|
7396
|
+
targetAlign: newTargetAlign,
|
|
7397
|
+
lastTop: targetTop
|
|
7398
|
+
}));
|
|
7299
7399
|
}
|
|
7300
7400
|
} else if (process.env.NODE_ENV !== 'production' && (syncState === null || syncState === void 0 ? void 0 : syncState.times) === MAX_TIMES) {
|
|
7301
7401
|
warningOnce(false, 'Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.');
|
|
@@ -9135,7 +9235,7 @@ var _typeof = _typeof$2.exports;
|
|
|
9135
9235
|
Object.defineProperty(useId$1, "__esModule", {
|
|
9136
9236
|
value: true
|
|
9137
9237
|
});
|
|
9138
|
-
var _default$
|
|
9238
|
+
var _default$2 = useId$1.default = useId;
|
|
9139
9239
|
useId$1.getUUID = getUUID;
|
|
9140
9240
|
useId$1.isBrowserClient = void 0;
|
|
9141
9241
|
var _slicedToArray2$2 = _interopRequireDefault$3(slicedToArray.exports);
|
|
@@ -9181,44 +9281,30 @@ var interopRequireWildcard = {exports: {}};
|
|
|
9181
9281
|
|
|
9182
9282
|
(function (module) {
|
|
9183
9283
|
var _typeof = _typeof$2.exports["default"];
|
|
9184
|
-
function _getRequireWildcardCache(
|
|
9185
|
-
if (typeof WeakMap
|
|
9186
|
-
var
|
|
9187
|
-
|
|
9188
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(
|
|
9189
|
-
return
|
|
9190
|
-
})(
|
|
9284
|
+
function _getRequireWildcardCache(e) {
|
|
9285
|
+
if ("function" != typeof WeakMap) return null;
|
|
9286
|
+
var r = new WeakMap(),
|
|
9287
|
+
t = new WeakMap();
|
|
9288
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
9289
|
+
return e ? t : r;
|
|
9290
|
+
})(e);
|
|
9191
9291
|
}
|
|
9192
|
-
function _interopRequireWildcard(
|
|
9193
|
-
if (!
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
9207
|
-
for (var key in obj) {
|
|
9208
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
9209
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
9210
|
-
if (desc && (desc.get || desc.set)) {
|
|
9211
|
-
Object.defineProperty(newObj, key, desc);
|
|
9212
|
-
} else {
|
|
9213
|
-
newObj[key] = obj[key];
|
|
9214
|
-
}
|
|
9215
|
-
}
|
|
9216
|
-
}
|
|
9217
|
-
newObj["default"] = obj;
|
|
9218
|
-
if (cache) {
|
|
9219
|
-
cache.set(obj, newObj);
|
|
9292
|
+
function _interopRequireWildcard(e, r) {
|
|
9293
|
+
if (!r && e && e.__esModule) return e;
|
|
9294
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
9295
|
+
"default": e
|
|
9296
|
+
};
|
|
9297
|
+
var t = _getRequireWildcardCache(r);
|
|
9298
|
+
if (t && t.has(e)) return t.get(e);
|
|
9299
|
+
var n = {
|
|
9300
|
+
__proto__: null
|
|
9301
|
+
},
|
|
9302
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
9303
|
+
for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) {
|
|
9304
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
9305
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
9220
9306
|
}
|
|
9221
|
-
return
|
|
9307
|
+
return n["default"] = e, t && t.set(e, n), n;
|
|
9222
9308
|
}
|
|
9223
9309
|
module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
9224
9310
|
} (interopRequireWildcard));
|
|
@@ -9227,7 +9313,7 @@ var _interopRequireWildcard$2 = interopRequireWildcard.exports.default;
|
|
|
9227
9313
|
Object.defineProperty(useEvent$1, "__esModule", {
|
|
9228
9314
|
value: true
|
|
9229
9315
|
});
|
|
9230
|
-
var _default$
|
|
9316
|
+
var _default$1 = useEvent$1.default = useEvent;
|
|
9231
9317
|
var React$2 = _interopRequireWildcard$2(React__default);
|
|
9232
9318
|
function useEvent(callback) {
|
|
9233
9319
|
var fnRef = React$2.useRef();
|
|
@@ -9272,16 +9358,14 @@ var useLayoutEffect = function useLayoutEffect(callback, deps) {
|
|
|
9272
9358
|
};
|
|
9273
9359
|
}, []);
|
|
9274
9360
|
};
|
|
9275
|
-
|
|
9361
|
+
useLayoutEffect$1.useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
9276
9362
|
useLayoutEffect(function (firstMount) {
|
|
9277
9363
|
if (!firstMount) {
|
|
9278
9364
|
return callback();
|
|
9279
9365
|
}
|
|
9280
9366
|
}, deps);
|
|
9281
9367
|
};
|
|
9282
|
-
useLayoutEffect$1.
|
|
9283
|
-
var _default$1 = useLayoutEffect;
|
|
9284
|
-
useLayoutEffect$1.default = _default$1;
|
|
9368
|
+
useLayoutEffect$1.default = useLayoutEffect;
|
|
9285
9369
|
|
|
9286
9370
|
var useState = {};
|
|
9287
9371
|
|
|
@@ -9848,7 +9932,6 @@ function Column(_ref) {
|
|
|
9848
9932
|
})]
|
|
9849
9933
|
})) : jsxs(Fragment, {
|
|
9850
9934
|
children: [renderMenuTilte(), optionInfoList.map(function (_ref2) {
|
|
9851
|
-
var _classNames;
|
|
9852
9935
|
var disabled = _ref2.disabled,
|
|
9853
9936
|
label = _ref2.label,
|
|
9854
9937
|
value = _ref2.value,
|
|
@@ -9896,7 +9979,7 @@ function Column(_ref) {
|
|
|
9896
9979
|
};
|
|
9897
9980
|
// >>>>> Render
|
|
9898
9981
|
return jsxs("li", Object.assign({
|
|
9899
|
-
className: classNames(menuItemPrefixCls, (
|
|
9982
|
+
className: classNames(menuItemPrefixCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(menuItemPrefixCls, "-expand"), !isMergedLeaf), "".concat(menuItemPrefixCls, "-active"), activeValue === value || activeValue === fullPathKey), "".concat(menuItemPrefixCls, "-disabled"), disabled), "".concat(menuItemPrefixCls, "-loading"), isLoading)),
|
|
9900
9983
|
style: dropdownMenuColumnStyle,
|
|
9901
9984
|
role: "menuitemcheckbox",
|
|
9902
9985
|
"aria-checked": checked,
|
|
@@ -9982,12 +10065,10 @@ var useActive = (function () {
|
|
|
9982
10065
|
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
9983
10066
|
[open]
|
|
9984
10067
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
9985
|
-
|
|
9986
10068
|
return [activeValueCells, setActiveValueCells];
|
|
9987
10069
|
});
|
|
9988
10070
|
|
|
9989
10071
|
var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
9990
|
-
var _ref3, _classNames;
|
|
9991
10072
|
var _a, _b;
|
|
9992
10073
|
var _useBaseProps = useBaseProps(),
|
|
9993
10074
|
prefixCls = _useBaseProps.prefixCls,
|
|
@@ -10131,7 +10212,7 @@ var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10131
10212
|
// ========================== Render ==========================
|
|
10132
10213
|
// >>>>> Empty
|
|
10133
10214
|
var isEmpty = !((_b = (_a = optionColumns[0]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.length);
|
|
10134
|
-
var emptyList = [(
|
|
10215
|
+
var emptyList = [_defineProperty(_defineProperty(_defineProperty({}, fieldNames.value, '__EMPTY__'), FIX_LABEL, notFoundContent), "disabled", true)];
|
|
10135
10216
|
var columnProps = Object.assign(Object.assign({}, props), {
|
|
10136
10217
|
multiple: !isEmpty && multiple,
|
|
10137
10218
|
onSelect: onPathSelect,
|
|
@@ -10164,7 +10245,7 @@ var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10164
10245
|
open: open
|
|
10165
10246
|
}, {
|
|
10166
10247
|
children: jsx("div", Object.assign({
|
|
10167
|
-
className: classNames("".concat(mergedPrefixCls, "-menus"), (
|
|
10248
|
+
className: classNames("".concat(mergedPrefixCls, "-menus"), _defineProperty(_defineProperty({}, "".concat(mergedPrefixCls, "-menu-empty"), isEmpty), "".concat(mergedPrefixCls, "-rtl"), rtl)),
|
|
10168
10249
|
ref: containerRef
|
|
10169
10250
|
}, {
|
|
10170
10251
|
children: columnNodes
|
|
@@ -10182,258 +10263,221 @@ function toRawValues(value) {
|
|
|
10182
10263
|
if (isMultipleValue(value)) {
|
|
10183
10264
|
return value;
|
|
10184
10265
|
}
|
|
10185
|
-
return (value.length === 0 ? [] : [value]).map(
|
|
10186
|
-
return Array.isArray(val) ? val : [val];
|
|
10187
|
-
});
|
|
10266
|
+
return (value.length === 0 ? [] : [value]).map(val => Array.isArray(val) ? val : [val]);
|
|
10188
10267
|
}
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10268
|
+
const Cascader = /*#__PURE__*/React$4.forwardRef((props, ref) => {
|
|
10269
|
+
const intl = useFormatMessage('Cascader', localeJson);
|
|
10270
|
+
const {
|
|
10271
|
+
// MISC
|
|
10272
|
+
id,
|
|
10273
|
+
prefixCls = "".concat($prefixCls, "-cascader"),
|
|
10274
|
+
fieldNames,
|
|
10275
|
+
// Value
|
|
10276
|
+
defaultValue,
|
|
10277
|
+
value,
|
|
10278
|
+
changeOnSelect,
|
|
10279
|
+
onChange,
|
|
10280
|
+
displayRender,
|
|
10281
|
+
// Trigger
|
|
10282
|
+
expandTrigger,
|
|
10283
|
+
// Options
|
|
10284
|
+
options,
|
|
10285
|
+
optionsTitle = [],
|
|
10286
|
+
dropdownPrefixCls,
|
|
10287
|
+
loadData,
|
|
10288
|
+
// Open
|
|
10289
|
+
popupVisible,
|
|
10290
|
+
open,
|
|
10291
|
+
popupClassName,
|
|
10292
|
+
dropdownClassName,
|
|
10293
|
+
dropdownMenuColumnStyle,
|
|
10294
|
+
popupPlacement,
|
|
10295
|
+
placement,
|
|
10296
|
+
onDropdownVisibleChange,
|
|
10297
|
+
onPopupVisibleChange,
|
|
10298
|
+
// Icon
|
|
10299
|
+
expandIcon = jsx(Right, {}),
|
|
10300
|
+
loadingIcon,
|
|
10301
|
+
// Placeholder
|
|
10302
|
+
placeholder = intl({
|
|
10303
|
+
id: 'placeholder'
|
|
10304
|
+
}),
|
|
10305
|
+
// Clear
|
|
10306
|
+
allClear = true,
|
|
10307
|
+
//MenuStlye
|
|
10308
|
+
menuMaxHight = 158,
|
|
10309
|
+
//Other
|
|
10310
|
+
expandJoin = '/',
|
|
10311
|
+
disabled = false,
|
|
10312
|
+
loading,
|
|
10313
|
+
disabledTooltip,
|
|
10314
|
+
// Children
|
|
10315
|
+
children,
|
|
10316
|
+
dropdownMatchSelectWidth = false,
|
|
10317
|
+
showCheckedStrategy = SHOW_PARENT
|
|
10318
|
+
} = props,
|
|
10237
10319
|
restProps = __rest(props, ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "expandTrigger", "options", "optionsTitle", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "expandIcon", "loadingIcon", "placeholder", "allClear", "menuMaxHight", "expandJoin", "disabled", "loading", "disabledTooltip", "children", "dropdownMatchSelectWidth", "showCheckedStrategy"]);
|
|
10238
|
-
|
|
10320
|
+
const mergedId = _default$2(id);
|
|
10239
10321
|
// =========================== Values ===========================
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
10245
|
-
rawValues = _useMergedState2[0],
|
|
10246
|
-
setRawValues = _useMergedState2[1];
|
|
10322
|
+
const [rawValues, setRawValues] = _default(defaultValue, {
|
|
10323
|
+
value,
|
|
10324
|
+
postState: toRawValues
|
|
10325
|
+
});
|
|
10247
10326
|
// ========================= FieldNames =========================
|
|
10248
|
-
|
|
10249
|
-
return fillFieldNames$1(fieldNames);
|
|
10250
|
-
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
10327
|
+
const mergedFieldNames = React$4.useMemo(() => fillFieldNames$1(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
|
10251
10328
|
[JSON.stringify(fieldNames)]
|
|
10252
10329
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
10253
10330
|
// =========================== Option ===========================
|
|
10254
|
-
|
|
10255
|
-
return options || [];
|
|
10256
|
-
}, [options]);
|
|
10331
|
+
const mergedOptions = React$4.useMemo(() => options || [], [options]);
|
|
10257
10332
|
// Only used in multiple mode, this fn will not call in single mode
|
|
10258
|
-
|
|
10333
|
+
const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
10259
10334
|
/** Convert path key back to value format */
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
return pathKeys.map(
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10335
|
+
const getValueByKeyPath = React$4.useCallback(pathKeys => {
|
|
10336
|
+
const keyPathEntities = getPathKeyEntities();
|
|
10337
|
+
return pathKeys.map(pathKey => {
|
|
10338
|
+
const {
|
|
10339
|
+
nodes
|
|
10340
|
+
} = keyPathEntities[pathKey];
|
|
10341
|
+
return nodes.map(node => node[mergedFieldNames.value]);
|
|
10267
10342
|
});
|
|
10268
10343
|
}, [getPathKeyEntities, mergedFieldNames]);
|
|
10269
10344
|
// =========================== Other ===========================
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
var _React$useState3 = React$4.useState(false),
|
|
10275
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
10276
|
-
dropdownVisible = _React$useState4[0],
|
|
10277
|
-
setDropdownVisible = _React$useState4[1]; // dropDown显示状态
|
|
10278
|
-
var _React$useState5 = React$4.useState('auto'),
|
|
10279
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
10280
|
-
menuWidth = _React$useState6[0],
|
|
10281
|
-
setMenuWidth = _React$useState6[1]; //下拉框的宽度
|
|
10282
|
-
var inputRef = React$4.useRef({
|
|
10345
|
+
const [inputLabel, setInputLable] = React$4.useState(); // 输入框选择文案
|
|
10346
|
+
const [dropdownVisible, setDropdownVisible] = React$4.useState(false); // dropDown显示状态
|
|
10347
|
+
const [menuWidth, setMenuWidth] = React$4.useState('auto'); //下拉框的宽度
|
|
10348
|
+
const inputRef = React$4.useRef({
|
|
10283
10349
|
id: UUID(),
|
|
10284
10350
|
level: 1
|
|
10285
10351
|
});
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
return toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(function (valueOpt) {
|
|
10290
|
-
return valueOpt.option;
|
|
10291
|
-
});
|
|
10292
|
-
});
|
|
10352
|
+
const handleValueToOptions = value => {
|
|
10353
|
+
const nextRawValues = toRawValues(value);
|
|
10354
|
+
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
|
|
10293
10355
|
return valueOptions;
|
|
10294
10356
|
};
|
|
10295
|
-
React$4.useEffect(
|
|
10357
|
+
React$4.useEffect(() => {
|
|
10296
10358
|
if (!value) return;
|
|
10297
|
-
|
|
10298
|
-
|
|
10359
|
+
const valueOptions = handleValueToOptions(value);
|
|
10360
|
+
const triggerOptions = valueOptions[0];
|
|
10299
10361
|
if (!triggerOptions) return;
|
|
10300
|
-
setInputLable(triggerOptions.map(
|
|
10301
|
-
return o.label;
|
|
10302
|
-
}).join(expandJoin));
|
|
10362
|
+
setInputLable(triggerOptions.map(o => o.label).join(expandJoin));
|
|
10303
10363
|
}, [value]);
|
|
10304
10364
|
// =========================== Values ===========================
|
|
10305
|
-
|
|
10365
|
+
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
10306
10366
|
// Fill `rawValues` with checked conduction values
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
halfCheckedValues = _React$useMemo2[1],
|
|
10326
|
-
missingCheckedValues = _React$useMemo2[2];
|
|
10327
|
-
var deDuplicatedValues = React$4.useMemo(function () {
|
|
10328
|
-
var checkedKeys = toPathKeys(checkedValues);
|
|
10329
|
-
var deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
10330
|
-
return [].concat(_toConsumableArray(missingCheckedValues), _toConsumableArray(getValueByKeyPath(deduplicateKeys)));
|
|
10367
|
+
const [checkedValues, halfCheckedValues, missingCheckedValues] = React$4.useMemo(() => {
|
|
10368
|
+
const [existValues, missingValues] = getMissingValues(rawValues);
|
|
10369
|
+
if (!rawValues.length) {
|
|
10370
|
+
return [existValues, [], missingValues];
|
|
10371
|
+
}
|
|
10372
|
+
const keyPathValues = toPathKeys(existValues);
|
|
10373
|
+
const keyPathEntities = getPathKeyEntities();
|
|
10374
|
+
const {
|
|
10375
|
+
checkedKeys,
|
|
10376
|
+
halfCheckedKeys
|
|
10377
|
+
} = conductCheck(keyPathValues, true, keyPathEntities);
|
|
10378
|
+
// Convert key back to value cells
|
|
10379
|
+
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
10380
|
+
}, [rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
|
|
10381
|
+
const deDuplicatedValues = React$4.useMemo(() => {
|
|
10382
|
+
const checkedKeys = toPathKeys(checkedValues);
|
|
10383
|
+
const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
10384
|
+
return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
|
|
10331
10385
|
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
|
|
10332
|
-
|
|
10386
|
+
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, false, displayRender);
|
|
10333
10387
|
// =========================== Change ===========================
|
|
10334
|
-
|
|
10388
|
+
const triggerChange = _default$1(nextValues => {
|
|
10335
10389
|
setRawValues(nextValues);
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
});
|
|
10341
|
-
});
|
|
10342
|
-
var triggerValues = nextRawValues[0];
|
|
10343
|
-
var triggerOptions = valueOptions[0];
|
|
10390
|
+
const nextRawValues = toRawValues(nextValues);
|
|
10391
|
+
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
|
|
10392
|
+
const triggerValues = nextRawValues[0];
|
|
10393
|
+
const triggerOptions = valueOptions[0];
|
|
10344
10394
|
onChange && onChange(triggerValues, triggerOptions);
|
|
10345
10395
|
});
|
|
10346
10396
|
// =========================== Select ===========================
|
|
10347
|
-
|
|
10397
|
+
const onInternalSelect = _default$1(valuePath => {
|
|
10348
10398
|
triggerChange(valuePath);
|
|
10349
10399
|
});
|
|
10350
10400
|
// Display Value change logic
|
|
10351
|
-
|
|
10401
|
+
const onDisplayValuesChange = (_, info) => {
|
|
10352
10402
|
if (info.type === 'clear') {
|
|
10353
10403
|
triggerChange([]);
|
|
10354
10404
|
return;
|
|
10355
10405
|
}
|
|
10356
10406
|
// Cascader do not support `add` type. Only support `remove`
|
|
10357
|
-
|
|
10407
|
+
const {
|
|
10408
|
+
valueCells
|
|
10409
|
+
} = info.values[0];
|
|
10358
10410
|
onInternalSelect(valueCells);
|
|
10359
10411
|
};
|
|
10360
10412
|
// ============================ Open ============================
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10413
|
+
const mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
10414
|
+
const mergedPlacement = placement || popupPlacement;
|
|
10415
|
+
const onInternalDropdownVisibleChange = nextVisible => {
|
|
10364
10416
|
setDropdownVisible(nextVisible);
|
|
10365
10417
|
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
10366
10418
|
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
10367
10419
|
};
|
|
10368
10420
|
// ========================== Context ===========================
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
};
|
|
10388
|
-
}, [menuWidth, mergedOptions, inputRef, optionsTitle, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, loading]);
|
|
10421
|
+
const cascaderContext = React$4.useMemo(() => ({
|
|
10422
|
+
options: mergedOptions,
|
|
10423
|
+
optionsTitle,
|
|
10424
|
+
fieldNames: mergedFieldNames,
|
|
10425
|
+
values: checkedValues,
|
|
10426
|
+
menuMaxHight,
|
|
10427
|
+
halfValues: halfCheckedValues,
|
|
10428
|
+
changeOnSelect,
|
|
10429
|
+
onSelect: onInternalSelect,
|
|
10430
|
+
menuWidth,
|
|
10431
|
+
dropdownPrefixCls,
|
|
10432
|
+
loadData,
|
|
10433
|
+
expandTrigger,
|
|
10434
|
+
expandIcon,
|
|
10435
|
+
loadingIcon,
|
|
10436
|
+
dropdownMenuColumnStyle,
|
|
10437
|
+
loading
|
|
10438
|
+
}), [menuWidth, mergedOptions, inputRef, optionsTitle, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, loading]);
|
|
10389
10439
|
// ==============================================================
|
|
10390
10440
|
// == Render ==
|
|
10391
10441
|
// ==============================================================
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
depth = _stack$pop.depth;
|
|
10442
|
+
const emptyOptions = !mergedOptions.length;
|
|
10443
|
+
const getMaxDepth = function (options) {
|
|
10444
|
+
let depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
10445
|
+
let maxDepth = depth;
|
|
10446
|
+
const stack = [...options.map(option => ({
|
|
10447
|
+
option,
|
|
10448
|
+
depth: 1
|
|
10449
|
+
}))];
|
|
10450
|
+
while (stack.length > 0 && maxDepth < 3) {
|
|
10451
|
+
const {
|
|
10452
|
+
option,
|
|
10453
|
+
depth
|
|
10454
|
+
} = stack.pop();
|
|
10406
10455
|
maxDepth = Math.max(maxDepth, depth);
|
|
10407
10456
|
if (option.children && option.children.length > 0) {
|
|
10408
|
-
stack.push
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
depth: depth + 1
|
|
10412
|
-
};
|
|
10457
|
+
stack.push(...option.children.map(child => ({
|
|
10458
|
+
option: child,
|
|
10459
|
+
depth: depth + 1
|
|
10413
10460
|
})));
|
|
10414
10461
|
}
|
|
10415
|
-
};
|
|
10416
|
-
while (stack.length > 0 && maxDepth < 3) {
|
|
10417
|
-
_loop();
|
|
10418
10462
|
}
|
|
10419
10463
|
return maxDepth;
|
|
10420
10464
|
};
|
|
10421
|
-
React$4.useEffect(
|
|
10465
|
+
React$4.useEffect(() => {
|
|
10422
10466
|
setDropdownVisible(!!(open !== undefined ? open : popupVisible));
|
|
10423
10467
|
}, [open, popupVisible]); // dropDownVisible
|
|
10424
10468
|
// 监听屏幕宽度
|
|
10425
|
-
React$4.useEffect(
|
|
10469
|
+
React$4.useEffect(() => {
|
|
10426
10470
|
window.addEventListener('resize', handleCalcMenuWidth);
|
|
10427
|
-
return
|
|
10471
|
+
return () => {
|
|
10428
10472
|
window.removeEventListener('resize', handleCalcMenuWidth);
|
|
10429
10473
|
};
|
|
10430
10474
|
}, []);
|
|
10431
|
-
React$4.useEffect(
|
|
10432
|
-
|
|
10475
|
+
React$4.useEffect(() => {
|
|
10476
|
+
const option = (options === null || options === void 0 ? void 0 : options[0]) || [];
|
|
10433
10477
|
inputRef.current.level = (option === null || option === void 0 ? void 0 : option.length) < 1 || loading ? 1 : getMaxDepth(options);
|
|
10434
10478
|
handleCalcMenuWidth();
|
|
10435
10479
|
}, [options, loading]);
|
|
10436
|
-
|
|
10480
|
+
const handleClear = e => {
|
|
10437
10481
|
e.stopPropagation();
|
|
10438
10482
|
setInputLable('');
|
|
10439
10483
|
onChange && onChange([], []);
|
|
@@ -10441,14 +10485,16 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10441
10485
|
cascaderContext.values = [];
|
|
10442
10486
|
};
|
|
10443
10487
|
// 设置下拉框的宽度
|
|
10444
|
-
|
|
10445
|
-
|
|
10488
|
+
const handleCalcMenuWidth = () => {
|
|
10489
|
+
const inputEle = document.getElementById("".concat(inputRef.current.id));
|
|
10446
10490
|
if (!inputEle) return;
|
|
10447
|
-
|
|
10491
|
+
const {
|
|
10492
|
+
clientWidth
|
|
10493
|
+
} = inputEle;
|
|
10448
10494
|
setMenuWidth((clientWidth / inputRef.current.level).toFixed(2));
|
|
10449
10495
|
};
|
|
10450
10496
|
// 内标题memo
|
|
10451
|
-
|
|
10497
|
+
const InsideMemo = React$4.useMemo(() => {
|
|
10452
10498
|
return jsx(Fragment, {
|
|
10453
10499
|
children: !inputLabel ? disabled && disabledTooltip ? jsx(Tooltip, Object.assign({
|
|
10454
10500
|
disabled: true
|
|
@@ -10477,7 +10523,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10477
10523
|
}))
|
|
10478
10524
|
});
|
|
10479
10525
|
}, [inputLabel, placeholder]);
|
|
10480
|
-
|
|
10526
|
+
const clearRender = () => {
|
|
10481
10527
|
if (allClear) {
|
|
10482
10528
|
return jsx("span", Object.assign({
|
|
10483
10529
|
className: "clean-up-icon",
|
|
@@ -10487,10 +10533,14 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10487
10533
|
}));
|
|
10488
10534
|
}
|
|
10489
10535
|
};
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10536
|
+
const childrenMemo = React$4.useMemo(() => {
|
|
10537
|
+
const contentClass = clsx("".concat($prefixCls, "-cascader-select-content"), {
|
|
10538
|
+
["".concat($prefixCls, "-cascader-select-value")]: inputLabel,
|
|
10539
|
+
["".concat($prefixCls, "-cascader-select-disabled")]: disabled
|
|
10540
|
+
});
|
|
10541
|
+
const svgClass = clsx("select-svg", {
|
|
10542
|
+
["select-svg-open"]: dropdownVisible
|
|
10543
|
+
});
|
|
10494
10544
|
return children ? children : jsxs("div", Object.assign({
|
|
10495
10545
|
className: contentClass,
|
|
10496
10546
|
id: inputRef.current.id
|
|
@@ -10502,7 +10552,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10502
10552
|
}))]
|
|
10503
10553
|
}));
|
|
10504
10554
|
}, [inputLabel, dropdownVisible, inputRef]);
|
|
10505
|
-
|
|
10555
|
+
const dropdownStyle =
|
|
10506
10556
|
// Empty keep the width
|
|
10507
10557
|
emptyOptions ? {} : {
|
|
10508
10558
|
minWidth: 'auto'
|
|
@@ -10521,7 +10571,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10521
10571
|
// Search
|
|
10522
10572
|
showSearch: false,
|
|
10523
10573
|
searchValue: '',
|
|
10524
|
-
onSearch:
|
|
10574
|
+
onSearch: () => {
|
|
10525
10575
|
console.log('not search');
|
|
10526
10576
|
},
|
|
10527
10577
|
// Value
|
|
@@ -10536,9 +10586,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10536
10586
|
placement: mergedPlacement,
|
|
10537
10587
|
onDropdownVisibleChange: onInternalDropdownVisibleChange,
|
|
10538
10588
|
// Children
|
|
10539
|
-
getRawInputElement:
|
|
10540
|
-
return childrenMemo;
|
|
10541
|
-
}
|
|
10589
|
+
getRawInputElement: () => childrenMemo
|
|
10542
10590
|
}))
|
|
10543
10591
|
}));
|
|
10544
10592
|
});
|