@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoBox/index.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +17 -16
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +90 -118
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +9 -10
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +260 -337
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/ComboSelect/utils.d.ts +6 -0
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +24 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +80 -95
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +222 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +70 -74
- package/FormItem/index.js +18 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +104 -113
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +60 -77
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +22 -23
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +34 -43
- package/Select/index.js +281 -345
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +582 -796
- package/SelectorPicker/index.js +113 -134
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +24 -25
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +360 -494
- package/Tabs/index.js +100 -100
- package/Tag/index.js +64 -82
- package/TextEditor/index.js +78 -100
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +29 -28
- package/Timeline/index.js +50 -47
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +29 -29
- package/Tooltip/index.js +52 -56
- package/Transfer/index.js +117 -154
- package/Tree/index.js +9 -10
- package/Upload/index.js +125 -143
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
- package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/utils-c17b5265.js +97 -0
- package/index.js +24 -23
- package/locale/en-US.d.ts +1 -0
- package/locale/index.d.ts +2 -0
- package/locale/index.js +10 -8
- package/locale/zh-CN.d.ts +1 -0
- package/package.json +11 -10
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/utils-418da0a4.js +0 -73
- /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
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 _toConsumableArray, a as _iterableToArray } from './toConsumableArray-c7a8028f.js';
|
|
4
|
+
import { _ as _defineProperty, a as _toPropertyKey } from './defineProperty-1d116156.js';
|
|
5
|
+
import { _ as _slicedToArray, a as _arrayWithHoles, b as _unsupportedIterableToArray, c as _nonIterableRest } from './slicedToArray-75fa4188.js';
|
|
6
6
|
import { _ as _typeof$1 } from './typeof-adeedc13.js';
|
|
7
7
|
import * as React$4 from 'react';
|
|
8
8
|
import React__default, { useState as useState$1, useMemo as useMemo$1, useCallback, useRef, useEffect } from 'react';
|
|
9
9
|
import ReactDOM, { unstable_batchedUpdates, createPortal, flushSync } from 'react-dom';
|
|
10
10
|
import CSSMotion from 'rc-motion';
|
|
11
|
-
import { _ as _unsupportedIterableToArray } from './unsupportedIterableToArray-cb478f24.js';
|
|
12
11
|
import clsx from 'clsx';
|
|
13
|
-
import { _ as _typeof$2 } from './typeof-
|
|
12
|
+
import { _ as _typeof$2 } from './typeof-b240b062.js';
|
|
14
13
|
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
15
14
|
import Right from '@para-ui/icons/Right';
|
|
16
15
|
import Down from '@para-ui/icons/Down';
|
|
@@ -18,10 +17,10 @@ import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
|
18
17
|
import { getKey as getKey$1 } from 'rc-tree/lib/utils/treeUtil';
|
|
19
18
|
import { Tooltip } from '../Tooltip/index.js';
|
|
20
19
|
import { Forbid } from '@para-ui/icons';
|
|
21
|
-
import { $ as $prefixCls } from './constant-
|
|
20
|
+
import { $ as $prefixCls } from './constant-5317fc89.js';
|
|
22
21
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
23
22
|
import AutoTips from '../AutoTips/index.js';
|
|
24
|
-
import { u as useFormatMessage } from './useFormatMessage-
|
|
23
|
+
import { u as useFormatMessage } from './useFormatMessage-eb13cf56.js';
|
|
25
24
|
import { UUID } from '@paraview/lib';
|
|
26
25
|
import { s as styleInject } from './style-inject.es-300983ab.js';
|
|
27
26
|
|
|
@@ -126,7 +125,7 @@ var useLayoutEffect$3 = function useLayoutEffect(callback, deps) {
|
|
|
126
125
|
};
|
|
127
126
|
}, []);
|
|
128
127
|
};
|
|
129
|
-
var useLayoutUpdateEffect
|
|
128
|
+
var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
130
129
|
useLayoutEffect$3(function (firstMount) {
|
|
131
130
|
if (!firstMount) {
|
|
132
131
|
return callback();
|
|
@@ -198,7 +197,7 @@ function useMergedState$2(defaultStateValue, option) {
|
|
|
198
197
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
199
198
|
prevValue = _useState4[0],
|
|
200
199
|
setPrevValue = _useState4[1];
|
|
201
|
-
useLayoutUpdateEffect
|
|
200
|
+
useLayoutUpdateEffect(function () {
|
|
202
201
|
var prev = prevValue[0];
|
|
203
202
|
if (innerValue !== prev) {
|
|
204
203
|
onChangeFn(innerValue, prev);
|
|
@@ -206,7 +205,7 @@ function useMergedState$2(defaultStateValue, option) {
|
|
|
206
205
|
}, [prevValue]);
|
|
207
206
|
|
|
208
207
|
// Sync value back to `undefined` when it from control to un-control
|
|
209
|
-
useLayoutUpdateEffect
|
|
208
|
+
useLayoutUpdateEffect(function () {
|
|
210
209
|
if (!hasValue$2(value)) {
|
|
211
210
|
setInnerValue(value);
|
|
212
211
|
}
|
|
@@ -884,7 +883,8 @@ var reactIs = {exports: {}};
|
|
|
884
883
|
|
|
885
884
|
var reactIs_production_min = {};
|
|
886
885
|
|
|
887
|
-
/**
|
|
886
|
+
/**
|
|
887
|
+
* @license React
|
|
888
888
|
* react-is.production.min.js
|
|
889
889
|
*
|
|
890
890
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -898,18 +898,18 @@ var hasRequiredReactIs_production_min;
|
|
|
898
898
|
function requireReactIs_production_min () {
|
|
899
899
|
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
900
900
|
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;
|
|
901
|
+
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");
|
|
902
|
+
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;
|
|
903
|
+
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};
|
|
904
|
+
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};
|
|
905
|
+
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
906
|
return reactIs_production_min;
|
|
908
907
|
}
|
|
909
908
|
|
|
910
909
|
var reactIs_development = {};
|
|
911
910
|
|
|
912
|
-
/**
|
|
911
|
+
/**
|
|
912
|
+
* @license React
|
|
913
913
|
* react-is.development.js
|
|
914
914
|
*
|
|
915
915
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -924,38 +924,67 @@ function requireReactIs_development () {
|
|
|
924
924
|
if (hasRequiredReactIs_development) return reactIs_development;
|
|
925
925
|
hasRequiredReactIs_development = 1;
|
|
926
926
|
|
|
927
|
-
|
|
928
|
-
|
|
929
927
|
if (process.env.NODE_ENV !== "production") {
|
|
930
928
|
(function() {
|
|
931
929
|
|
|
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
|
|
930
|
+
// ATTENTION
|
|
931
|
+
// When adding new symbols to this file,
|
|
932
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
933
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
934
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
935
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
936
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
937
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
938
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
939
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
940
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
941
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
942
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
943
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
944
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
945
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
946
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
947
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
948
|
+
|
|
949
|
+
// -----------------------------------------------------------------------------
|
|
950
|
+
|
|
951
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
952
|
+
var enableCacheElement = false;
|
|
953
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
954
|
+
|
|
955
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
956
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
957
|
+
// issues in DEV builds.
|
|
958
|
+
|
|
959
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
960
|
+
|
|
961
|
+
var REACT_MODULE_REFERENCE;
|
|
962
|
+
|
|
963
|
+
{
|
|
964
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
965
|
+
}
|
|
955
966
|
|
|
956
967
|
function isValidElementType(type) {
|
|
957
|
-
|
|
958
|
-
|
|
968
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
969
|
+
return true;
|
|
970
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
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 ) {
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
if (typeof type === 'object' && type !== null) {
|
|
978
|
+
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
|
|
979
|
+
// types supported by any Flight configuration anywhere since
|
|
980
|
+
// we don't know which Flight build this will end up being used
|
|
981
|
+
// with.
|
|
982
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
983
|
+
return true;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
return false;
|
|
959
988
|
}
|
|
960
989
|
|
|
961
990
|
function typeOf(object) {
|
|
@@ -967,18 +996,18 @@ function requireReactIs_development () {
|
|
|
967
996
|
var type = object.type;
|
|
968
997
|
|
|
969
998
|
switch (type) {
|
|
970
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
971
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
972
999
|
case REACT_FRAGMENT_TYPE:
|
|
973
1000
|
case REACT_PROFILER_TYPE:
|
|
974
1001
|
case REACT_STRICT_MODE_TYPE:
|
|
975
1002
|
case REACT_SUSPENSE_TYPE:
|
|
1003
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
976
1004
|
return type;
|
|
977
1005
|
|
|
978
1006
|
default:
|
|
979
1007
|
var $$typeofType = type && type.$$typeof;
|
|
980
1008
|
|
|
981
1009
|
switch ($$typeofType) {
|
|
1010
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
982
1011
|
case REACT_CONTEXT_TYPE:
|
|
983
1012
|
case REACT_FORWARD_REF_TYPE:
|
|
984
1013
|
case REACT_LAZY_TYPE:
|
|
@@ -998,10 +1027,7 @@ function requireReactIs_development () {
|
|
|
998
1027
|
}
|
|
999
1028
|
|
|
1000
1029
|
return undefined;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
1004
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
1030
|
+
}
|
|
1005
1031
|
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
1006
1032
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1007
1033
|
var Element = REACT_ELEMENT_TYPE;
|
|
@@ -1013,21 +1039,31 @@ function requireReactIs_development () {
|
|
|
1013
1039
|
var Profiler = REACT_PROFILER_TYPE;
|
|
1014
1040
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1015
1041
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
1016
|
-
var
|
|
1042
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
1043
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
1044
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
1017
1045
|
|
|
1018
1046
|
function isAsyncMode(object) {
|
|
1019
1047
|
{
|
|
1020
1048
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
1021
1049
|
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1022
1050
|
|
|
1023
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React
|
|
1051
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1024
1052
|
}
|
|
1025
1053
|
}
|
|
1026
1054
|
|
|
1027
|
-
return
|
|
1055
|
+
return false;
|
|
1028
1056
|
}
|
|
1029
1057
|
function isConcurrentMode(object) {
|
|
1030
|
-
|
|
1058
|
+
{
|
|
1059
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
1060
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1061
|
+
|
|
1062
|
+
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
return false;
|
|
1031
1067
|
}
|
|
1032
1068
|
function isContextConsumer(object) {
|
|
1033
1069
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
@@ -1062,9 +1098,10 @@ function requireReactIs_development () {
|
|
|
1062
1098
|
function isSuspense(object) {
|
|
1063
1099
|
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
1064
1100
|
}
|
|
1101
|
+
function isSuspenseList(object) {
|
|
1102
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
1103
|
+
}
|
|
1065
1104
|
|
|
1066
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
1067
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
1068
1105
|
reactIs_development.ContextConsumer = ContextConsumer;
|
|
1069
1106
|
reactIs_development.ContextProvider = ContextProvider;
|
|
1070
1107
|
reactIs_development.Element = Element;
|
|
@@ -1076,6 +1113,7 @@ function requireReactIs_development () {
|
|
|
1076
1113
|
reactIs_development.Profiler = Profiler;
|
|
1077
1114
|
reactIs_development.StrictMode = StrictMode;
|
|
1078
1115
|
reactIs_development.Suspense = Suspense;
|
|
1116
|
+
reactIs_development.SuspenseList = SuspenseList;
|
|
1079
1117
|
reactIs_development.isAsyncMode = isAsyncMode;
|
|
1080
1118
|
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
1081
1119
|
reactIs_development.isContextConsumer = isContextConsumer;
|
|
@@ -1089,6 +1127,7 @@ function requireReactIs_development () {
|
|
|
1089
1127
|
reactIs_development.isProfiler = isProfiler;
|
|
1090
1128
|
reactIs_development.isStrictMode = isStrictMode;
|
|
1091
1129
|
reactIs_development.isSuspense = isSuspense;
|
|
1130
|
+
reactIs_development.isSuspenseList = isSuspenseList;
|
|
1092
1131
|
reactIs_development.isValidElementType = isValidElementType;
|
|
1093
1132
|
reactIs_development.typeOf = typeOf;
|
|
1094
1133
|
})();
|
|
@@ -1417,6 +1456,39 @@ function findDOMNode(node) {
|
|
|
1417
1456
|
return null;
|
|
1418
1457
|
}
|
|
1419
1458
|
|
|
1459
|
+
var CollectionContext = /*#__PURE__*/React$4.createContext(null);
|
|
1460
|
+
/**
|
|
1461
|
+
* Collect all the resize event from children ResizeObserver
|
|
1462
|
+
*/
|
|
1463
|
+
function Collection(_ref) {
|
|
1464
|
+
var children = _ref.children,
|
|
1465
|
+
onBatchResize = _ref.onBatchResize;
|
|
1466
|
+
var resizeIdRef = React$4.useRef(0);
|
|
1467
|
+
var resizeInfosRef = React$4.useRef([]);
|
|
1468
|
+
var onCollectionResize = React$4.useContext(CollectionContext);
|
|
1469
|
+
var onResize = React$4.useCallback(function (size, element, data) {
|
|
1470
|
+
resizeIdRef.current += 1;
|
|
1471
|
+
var currentId = resizeIdRef.current;
|
|
1472
|
+
resizeInfosRef.current.push({
|
|
1473
|
+
size: size,
|
|
1474
|
+
element: element,
|
|
1475
|
+
data: data
|
|
1476
|
+
});
|
|
1477
|
+
Promise.resolve().then(function () {
|
|
1478
|
+
if (currentId === resizeIdRef.current) {
|
|
1479
|
+
onBatchResize === null || onBatchResize === void 0 || onBatchResize(resizeInfosRef.current);
|
|
1480
|
+
resizeInfosRef.current = [];
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1484
|
+
// Continue bubbling if parent exist
|
|
1485
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(size, element, data);
|
|
1486
|
+
}, [onBatchResize, onCollectionResize]);
|
|
1487
|
+
return /*#__PURE__*/React$4.createElement(CollectionContext.Provider, {
|
|
1488
|
+
value: onResize
|
|
1489
|
+
}, children);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1420
1492
|
/**
|
|
1421
1493
|
* A collection of shims that provide minimal functionality of the ES6 collections.
|
|
1422
1494
|
*
|
|
@@ -2350,16 +2422,19 @@ function onResize(entities) {
|
|
|
2350
2422
|
entities.forEach(function (entity) {
|
|
2351
2423
|
var _elementListeners$get;
|
|
2352
2424
|
var target = entity.target;
|
|
2353
|
-
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0
|
|
2425
|
+
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 || _elementListeners$get.forEach(function (listener) {
|
|
2354
2426
|
return listener(target);
|
|
2355
2427
|
});
|
|
2356
2428
|
});
|
|
2357
2429
|
}
|
|
2430
|
+
|
|
2358
2431
|
// Note: ResizeObserver polyfill not support option to measure border-box resize
|
|
2359
2432
|
var resizeObserver = new index(onResize);
|
|
2433
|
+
|
|
2360
2434
|
// Dev env only
|
|
2361
2435
|
process.env.NODE_ENV !== 'production' ? elementListeners : null; // eslint-disable-line
|
|
2362
2436
|
process.env.NODE_ENV !== 'production' ? onResize : null; // eslint-disable-line
|
|
2437
|
+
|
|
2363
2438
|
// ============================== Observe ==============================
|
|
2364
2439
|
function observe(element, callback) {
|
|
2365
2440
|
if (!elementListeners.has(element)) {
|
|
@@ -2496,47 +2571,17 @@ var DomWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
2496
2571
|
return DomWrapper;
|
|
2497
2572
|
}(React$4.Component);
|
|
2498
2573
|
|
|
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
2574
|
function SingleObserver(props, ref) {
|
|
2532
2575
|
var children = props.children,
|
|
2533
2576
|
disabled = props.disabled;
|
|
2534
2577
|
var elementRef = React$4.useRef(null);
|
|
2535
2578
|
var wrapperRef = React$4.useRef(null);
|
|
2536
2579
|
var onCollectionResize = React$4.useContext(CollectionContext);
|
|
2580
|
+
|
|
2537
2581
|
// =========================== Children ===========================
|
|
2538
2582
|
var isRenderProps = typeof children === 'function';
|
|
2539
2583
|
var mergedChildren = isRenderProps ? children(elementRef) : children;
|
|
2584
|
+
|
|
2540
2585
|
// ============================= Size =============================
|
|
2541
2586
|
var sizeRef = React$4.useRef({
|
|
2542
2587
|
width: -1,
|
|
@@ -2544,21 +2589,25 @@ function SingleObserver(props, ref) {
|
|
|
2544
2589
|
offsetWidth: -1,
|
|
2545
2590
|
offsetHeight: -1
|
|
2546
2591
|
});
|
|
2592
|
+
|
|
2547
2593
|
// ============================= Ref ==============================
|
|
2548
2594
|
var canRef = !isRenderProps && /*#__PURE__*/React$4.isValidElement(mergedChildren) && supportRef(mergedChildren);
|
|
2549
2595
|
var originRef = canRef ? mergedChildren.ref : null;
|
|
2550
|
-
var mergedRef =
|
|
2551
|
-
return composeRef(originRef, elementRef);
|
|
2552
|
-
}, [originRef, elementRef]);
|
|
2596
|
+
var mergedRef = useComposeRef(originRef, elementRef);
|
|
2553
2597
|
var getDom = function getDom() {
|
|
2554
|
-
|
|
2598
|
+
var _elementRef$current;
|
|
2599
|
+
return findDOMNode(elementRef.current) || (
|
|
2600
|
+
// Support `nativeElement` format
|
|
2601
|
+
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
2602
|
};
|
|
2556
2603
|
React$4.useImperativeHandle(ref, function () {
|
|
2557
2604
|
return getDom();
|
|
2558
2605
|
});
|
|
2606
|
+
|
|
2559
2607
|
// =========================== Observe ============================
|
|
2560
2608
|
var propsRef = React$4.useRef(props);
|
|
2561
2609
|
propsRef.current = props;
|
|
2610
|
+
|
|
2562
2611
|
// Handler
|
|
2563
2612
|
var onInternalResize = React$4.useCallback(function (target) {
|
|
2564
2613
|
var _propsRef$current = propsRef.current,
|
|
@@ -2569,6 +2618,7 @@ function SingleObserver(props, ref) {
|
|
|
2569
2618
|
height = _target$getBoundingCl.height;
|
|
2570
2619
|
var offsetWidth = target.offsetWidth,
|
|
2571
2620
|
offsetHeight = target.offsetHeight;
|
|
2621
|
+
|
|
2572
2622
|
/**
|
|
2573
2623
|
* Resize observer trigger when content size changed.
|
|
2574
2624
|
* In most case we just care about element size,
|
|
@@ -2584,6 +2634,7 @@ function SingleObserver(props, ref) {
|
|
|
2584
2634
|
offsetHeight: offsetHeight
|
|
2585
2635
|
};
|
|
2586
2636
|
sizeRef.current = size;
|
|
2637
|
+
|
|
2587
2638
|
// IE is strange, right?
|
|
2588
2639
|
var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
|
|
2589
2640
|
var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
|
|
@@ -2591,8 +2642,9 @@ function SingleObserver(props, ref) {
|
|
|
2591
2642
|
offsetWidth: mergedOffsetWidth,
|
|
2592
2643
|
offsetHeight: mergedOffsetHeight
|
|
2593
2644
|
});
|
|
2645
|
+
|
|
2594
2646
|
// Let collection know what happened
|
|
2595
|
-
onCollectionResize === null || onCollectionResize === void 0
|
|
2647
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(sizeInfo, target, data);
|
|
2596
2648
|
if (onResize) {
|
|
2597
2649
|
// defer the callback but not defer to next frame
|
|
2598
2650
|
Promise.resolve().then(function () {
|
|
@@ -2601,6 +2653,7 @@ function SingleObserver(props, ref) {
|
|
|
2601
2653
|
}
|
|
2602
2654
|
}
|
|
2603
2655
|
}, []);
|
|
2656
|
+
|
|
2604
2657
|
// Dynamic observe
|
|
2605
2658
|
React$4.useEffect(function () {
|
|
2606
2659
|
var currentElement = getDom();
|
|
@@ -2611,6 +2664,7 @@ function SingleObserver(props, ref) {
|
|
|
2611
2664
|
return unobserve(currentElement, onInternalResize);
|
|
2612
2665
|
};
|
|
2613
2666
|
}, [elementRef.current, disabled]);
|
|
2667
|
+
|
|
2614
2668
|
// ============================ Render ============================
|
|
2615
2669
|
return /*#__PURE__*/React$4.createElement(DomWrapper, {
|
|
2616
2670
|
ref: wrapperRef
|
|
@@ -2760,9 +2814,14 @@ var wrapperRaf = function wrapperRaf(callback) {
|
|
|
2760
2814
|
};
|
|
2761
2815
|
wrapperRaf.cancel = function (id) {
|
|
2762
2816
|
var realId = rafIds.get(id);
|
|
2763
|
-
cleanup(
|
|
2817
|
+
cleanup(id);
|
|
2764
2818
|
return caf(realId);
|
|
2765
2819
|
};
|
|
2820
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2821
|
+
wrapperRaf.ids = function () {
|
|
2822
|
+
return rafIds;
|
|
2823
|
+
};
|
|
2824
|
+
}
|
|
2766
2825
|
|
|
2767
2826
|
function channelUpdate(callback) {
|
|
2768
2827
|
if (typeof MessageChannel === 'undefined') {
|
|
@@ -4109,7 +4168,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
4109
4168
|
|
|
4110
4169
|
function getRoot(ele) {
|
|
4111
4170
|
var _ele$getRootNode;
|
|
4112
|
-
return ele === null || ele === void 0
|
|
4171
|
+
return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
|
4113
4172
|
}
|
|
4114
4173
|
|
|
4115
4174
|
/**
|
|
@@ -4132,20 +4191,34 @@ function getUseId() {
|
|
|
4132
4191
|
return fullClone.useId;
|
|
4133
4192
|
}
|
|
4134
4193
|
var uuid$2 = 0;
|
|
4135
|
-
|
|
4194
|
+
var useOriginId = getUseId();
|
|
4195
|
+
var useId$3 = useOriginId ?
|
|
4196
|
+
// Use React `useId`
|
|
4197
|
+
function useId(id) {
|
|
4198
|
+
var reactId = useOriginId();
|
|
4199
|
+
|
|
4200
|
+
// Developer passed id is single source of truth
|
|
4201
|
+
if (id) {
|
|
4202
|
+
return id;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
// Test env always return mock id
|
|
4206
|
+
if (process.env.NODE_ENV === 'test') {
|
|
4207
|
+
return 'test-id';
|
|
4208
|
+
}
|
|
4209
|
+
return reactId;
|
|
4210
|
+
} :
|
|
4211
|
+
// Use compatible of `useId`
|
|
4212
|
+
function useCompatId(id) {
|
|
4136
4213
|
// Inner id for accessibility usage. Only work in client side
|
|
4137
4214
|
var _React$useState = React$4.useState('ssr-id'),
|
|
4138
4215
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4139
4216
|
innerId = _React$useState2[0],
|
|
4140
4217
|
setInnerId = _React$useState2[1];
|
|
4141
|
-
var useOriginId = getUseId();
|
|
4142
|
-
var reactNativeId = useOriginId === null || useOriginId === void 0 ? void 0 : useOriginId();
|
|
4143
4218
|
React$4.useEffect(function () {
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
setInnerId("rc_unique_".concat(nextId));
|
|
4148
|
-
}
|
|
4219
|
+
var nextId = uuid$2;
|
|
4220
|
+
uuid$2 += 1;
|
|
4221
|
+
setInnerId("rc_unique_".concat(nextId));
|
|
4149
4222
|
}, []);
|
|
4150
4223
|
|
|
4151
4224
|
// Developer passed id is single source of truth
|
|
@@ -4159,104 +4232,385 @@ function useId$3(id) {
|
|
|
4159
4232
|
}
|
|
4160
4233
|
|
|
4161
4234
|
// Return react native id or inner id
|
|
4162
|
-
return
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
var TriggerContext = /*#__PURE__*/React$4.createContext(null);
|
|
4235
|
+
return innerId;
|
|
4236
|
+
};
|
|
4166
4237
|
|
|
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
|
-
}
|
|
4238
|
+
function Arrow(props) {
|
|
4239
|
+
var prefixCls = props.prefixCls,
|
|
4240
|
+
align = props.align,
|
|
4241
|
+
arrow = props.arrow,
|
|
4242
|
+
arrowPos = props.arrowPos;
|
|
4243
|
+
var _ref = arrow || {},
|
|
4244
|
+
className = _ref.className,
|
|
4245
|
+
content = _ref.content;
|
|
4246
|
+
var _arrowPos$x = arrowPos.x,
|
|
4247
|
+
x = _arrowPos$x === void 0 ? 0 : _arrowPos$x,
|
|
4248
|
+
_arrowPos$y = arrowPos.y,
|
|
4249
|
+
y = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
|
|
4250
|
+
var arrowRef = React$4.useRef();
|
|
4189
4251
|
|
|
4190
|
-
|
|
4191
|
-
if (!
|
|
4192
|
-
return
|
|
4252
|
+
// Skip if no align
|
|
4253
|
+
if (!align || !align.points) {
|
|
4254
|
+
return null;
|
|
4193
4255
|
}
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4256
|
+
var alignStyle = {
|
|
4257
|
+
position: 'absolute'
|
|
4258
|
+
};
|
|
4259
|
+
|
|
4260
|
+
// Skip if no need to align
|
|
4261
|
+
if (align.autoArrow !== false) {
|
|
4262
|
+
var popupPoints = align.points[0];
|
|
4263
|
+
var targetPoints = align.points[1];
|
|
4264
|
+
var popupTB = popupPoints[0];
|
|
4265
|
+
var popupLR = popupPoints[1];
|
|
4266
|
+
var targetTB = targetPoints[0];
|
|
4267
|
+
var targetLR = targetPoints[1];
|
|
4268
|
+
|
|
4269
|
+
// Top & Bottom
|
|
4270
|
+
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
|
|
4271
|
+
alignStyle.top = y;
|
|
4272
|
+
} else if (popupTB === 't') {
|
|
4273
|
+
alignStyle.top = 0;
|
|
4274
|
+
} else {
|
|
4275
|
+
alignStyle.bottom = 0;
|
|
4213
4276
|
}
|
|
4214
|
-
}
|
|
4215
|
-
return false;
|
|
4216
|
-
});
|
|
4217
4277
|
|
|
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);
|
|
4278
|
+
// Left & Right
|
|
4279
|
+
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
|
|
4280
|
+
alignStyle.left = x;
|
|
4281
|
+
} else if (popupLR === 'l') {
|
|
4282
|
+
alignStyle.left = 0;
|
|
4283
|
+
} else {
|
|
4284
|
+
alignStyle.right = 0;
|
|
4235
4285
|
}
|
|
4236
4286
|
}
|
|
4237
|
-
return
|
|
4287
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4288
|
+
ref: arrowRef,
|
|
4289
|
+
className: classNames("".concat(prefixCls, "-arrow"), className),
|
|
4290
|
+
style: alignStyle
|
|
4291
|
+
}, content);
|
|
4238
4292
|
}
|
|
4239
4293
|
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
};
|
|
4249
|
-
}
|
|
4250
|
-
if (transitionName) {
|
|
4251
|
-
return {
|
|
4252
|
-
motionName: transitionName
|
|
4253
|
-
};
|
|
4294
|
+
function Mask(props) {
|
|
4295
|
+
var prefixCls = props.prefixCls,
|
|
4296
|
+
open = props.open,
|
|
4297
|
+
zIndex = props.zIndex,
|
|
4298
|
+
mask = props.mask,
|
|
4299
|
+
motion = props.motion;
|
|
4300
|
+
if (!mask) {
|
|
4301
|
+
return null;
|
|
4254
4302
|
}
|
|
4255
|
-
return
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
}
|
|
4303
|
+
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({}, motion, {
|
|
4304
|
+
motionAppear: true,
|
|
4305
|
+
visible: open,
|
|
4306
|
+
removeOnLeave: true
|
|
4307
|
+
}), function (_ref) {
|
|
4308
|
+
var className = _ref.className;
|
|
4309
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4310
|
+
style: {
|
|
4311
|
+
zIndex: zIndex
|
|
4312
|
+
},
|
|
4313
|
+
className: classNames("".concat(prefixCls, "-mask"), className)
|
|
4314
|
+
});
|
|
4315
|
+
});
|
|
4316
|
+
}
|
|
4317
|
+
|
|
4318
|
+
var PopupContent = /*#__PURE__*/React$4.memo(function (_ref) {
|
|
4319
|
+
var children = _ref.children;
|
|
4320
|
+
return children;
|
|
4321
|
+
}, function (_, next) {
|
|
4322
|
+
return next.cache;
|
|
4323
|
+
});
|
|
4324
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4325
|
+
PopupContent.displayName = 'PopupContent';
|
|
4326
|
+
}
|
|
4327
|
+
|
|
4328
|
+
var Popup = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
4329
|
+
var popup = props.popup,
|
|
4330
|
+
className = props.className,
|
|
4331
|
+
prefixCls = props.prefixCls,
|
|
4332
|
+
style = props.style,
|
|
4333
|
+
target = props.target,
|
|
4334
|
+
_onVisibleChanged = props.onVisibleChanged,
|
|
4335
|
+
open = props.open,
|
|
4336
|
+
keepDom = props.keepDom,
|
|
4337
|
+
fresh = props.fresh,
|
|
4338
|
+
onClick = props.onClick,
|
|
4339
|
+
mask = props.mask,
|
|
4340
|
+
arrow = props.arrow,
|
|
4341
|
+
arrowPos = props.arrowPos,
|
|
4342
|
+
align = props.align,
|
|
4343
|
+
motion = props.motion,
|
|
4344
|
+
maskMotion = props.maskMotion,
|
|
4345
|
+
forceRender = props.forceRender,
|
|
4346
|
+
getPopupContainer = props.getPopupContainer,
|
|
4347
|
+
autoDestroy = props.autoDestroy,
|
|
4348
|
+
Portal = props.portal,
|
|
4349
|
+
zIndex = props.zIndex,
|
|
4350
|
+
onMouseEnter = props.onMouseEnter,
|
|
4351
|
+
onMouseLeave = props.onMouseLeave,
|
|
4352
|
+
onPointerEnter = props.onPointerEnter,
|
|
4353
|
+
ready = props.ready,
|
|
4354
|
+
offsetX = props.offsetX,
|
|
4355
|
+
offsetY = props.offsetY,
|
|
4356
|
+
offsetR = props.offsetR,
|
|
4357
|
+
offsetB = props.offsetB,
|
|
4358
|
+
onAlign = props.onAlign,
|
|
4359
|
+
onPrepare = props.onPrepare,
|
|
4360
|
+
stretch = props.stretch,
|
|
4361
|
+
targetWidth = props.targetWidth,
|
|
4362
|
+
targetHeight = props.targetHeight;
|
|
4363
|
+
var childNode = typeof popup === 'function' ? popup() : popup;
|
|
4364
|
+
|
|
4365
|
+
// We can not remove holder only when motion finished.
|
|
4366
|
+
var isNodeVisible = open || keepDom;
|
|
4367
|
+
|
|
4368
|
+
// ======================= Container ========================
|
|
4369
|
+
var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;
|
|
4370
|
+
var _React$useState = React$4.useState(!getPopupContainer || !getPopupContainerNeedParams),
|
|
4371
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4372
|
+
show = _React$useState2[0],
|
|
4373
|
+
setShow = _React$useState2[1];
|
|
4374
|
+
|
|
4375
|
+
// Delay to show since `getPopupContainer` need target element
|
|
4376
|
+
useLayoutEffect$3(function () {
|
|
4377
|
+
if (!show && getPopupContainerNeedParams && target) {
|
|
4378
|
+
setShow(true);
|
|
4379
|
+
}
|
|
4380
|
+
}, [show, getPopupContainerNeedParams, target]);
|
|
4381
|
+
|
|
4382
|
+
// ========================= Render =========================
|
|
4383
|
+
if (!show) {
|
|
4384
|
+
return null;
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4387
|
+
// >>>>> Offset
|
|
4388
|
+
var AUTO = 'auto';
|
|
4389
|
+
var offsetStyle = {
|
|
4390
|
+
left: '-1000vw',
|
|
4391
|
+
top: '-1000vh',
|
|
4392
|
+
right: AUTO,
|
|
4393
|
+
bottom: AUTO
|
|
4394
|
+
};
|
|
4395
|
+
|
|
4396
|
+
// Set align style
|
|
4397
|
+
if (ready || !open) {
|
|
4398
|
+
var _experimental;
|
|
4399
|
+
var points = align.points;
|
|
4400
|
+
var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);
|
|
4401
|
+
var alignRight = dynamicInset && points[0][1] === 'r';
|
|
4402
|
+
var alignBottom = dynamicInset && points[0][0] === 'b';
|
|
4403
|
+
if (alignRight) {
|
|
4404
|
+
offsetStyle.right = offsetR;
|
|
4405
|
+
offsetStyle.left = AUTO;
|
|
4406
|
+
} else {
|
|
4407
|
+
offsetStyle.left = offsetX;
|
|
4408
|
+
offsetStyle.right = AUTO;
|
|
4409
|
+
}
|
|
4410
|
+
if (alignBottom) {
|
|
4411
|
+
offsetStyle.bottom = offsetB;
|
|
4412
|
+
offsetStyle.top = AUTO;
|
|
4413
|
+
} else {
|
|
4414
|
+
offsetStyle.top = offsetY;
|
|
4415
|
+
offsetStyle.bottom = AUTO;
|
|
4416
|
+
}
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4419
|
+
// >>>>> Misc
|
|
4420
|
+
var miscStyle = {};
|
|
4421
|
+
if (stretch) {
|
|
4422
|
+
if (stretch.includes('height') && targetHeight) {
|
|
4423
|
+
miscStyle.height = targetHeight;
|
|
4424
|
+
} else if (stretch.includes('minHeight') && targetHeight) {
|
|
4425
|
+
miscStyle.minHeight = targetHeight;
|
|
4426
|
+
}
|
|
4427
|
+
if (stretch.includes('width') && targetWidth) {
|
|
4428
|
+
miscStyle.width = targetWidth;
|
|
4429
|
+
} else if (stretch.includes('minWidth') && targetWidth) {
|
|
4430
|
+
miscStyle.minWidth = targetWidth;
|
|
4431
|
+
}
|
|
4432
|
+
}
|
|
4433
|
+
if (!open) {
|
|
4434
|
+
miscStyle.pointerEvents = 'none';
|
|
4435
|
+
}
|
|
4436
|
+
return /*#__PURE__*/React$4.createElement(Portal, {
|
|
4437
|
+
open: forceRender || isNodeVisible,
|
|
4438
|
+
getContainer: getPopupContainer && function () {
|
|
4439
|
+
return getPopupContainer(target);
|
|
4440
|
+
},
|
|
4441
|
+
autoDestroy: autoDestroy
|
|
4442
|
+
}, /*#__PURE__*/React$4.createElement(Mask, {
|
|
4443
|
+
prefixCls: prefixCls,
|
|
4444
|
+
open: open,
|
|
4445
|
+
zIndex: zIndex,
|
|
4446
|
+
mask: mask,
|
|
4447
|
+
motion: maskMotion
|
|
4448
|
+
}), /*#__PURE__*/React$4.createElement(RefResizeObserver, {
|
|
4449
|
+
onResize: onAlign,
|
|
4450
|
+
disabled: !open
|
|
4451
|
+
}, function (resizeObserverRef) {
|
|
4452
|
+
return /*#__PURE__*/React$4.createElement(CSSMotion, _extends({
|
|
4453
|
+
motionAppear: true,
|
|
4454
|
+
motionEnter: true,
|
|
4455
|
+
motionLeave: true,
|
|
4456
|
+
removeOnLeave: false,
|
|
4457
|
+
forceRender: forceRender,
|
|
4458
|
+
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
4459
|
+
}, motion, {
|
|
4460
|
+
onAppearPrepare: onPrepare,
|
|
4461
|
+
onEnterPrepare: onPrepare,
|
|
4462
|
+
visible: open,
|
|
4463
|
+
onVisibleChanged: function onVisibleChanged(nextVisible) {
|
|
4464
|
+
var _motion$onVisibleChan;
|
|
4465
|
+
motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
|
|
4466
|
+
_onVisibleChanged(nextVisible);
|
|
4467
|
+
}
|
|
4468
|
+
}), function (_ref, motionRef) {
|
|
4469
|
+
var motionClassName = _ref.className,
|
|
4470
|
+
motionStyle = _ref.style;
|
|
4471
|
+
var cls = classNames(prefixCls, motionClassName, className);
|
|
4472
|
+
return /*#__PURE__*/React$4.createElement("div", {
|
|
4473
|
+
ref: composeRef(resizeObserverRef, ref, motionRef),
|
|
4474
|
+
className: cls,
|
|
4475
|
+
style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
4476
|
+
'--arrow-x': "".concat(arrowPos.x || 0, "px"),
|
|
4477
|
+
'--arrow-y': "".concat(arrowPos.y || 0, "px")
|
|
4478
|
+
}, offsetStyle), miscStyle), motionStyle), {}, {
|
|
4479
|
+
boxSizing: 'border-box',
|
|
4480
|
+
zIndex: zIndex
|
|
4481
|
+
}, style),
|
|
4482
|
+
onMouseEnter: onMouseEnter,
|
|
4483
|
+
onMouseLeave: onMouseLeave,
|
|
4484
|
+
onPointerEnter: onPointerEnter,
|
|
4485
|
+
onClick: onClick
|
|
4486
|
+
}, arrow && /*#__PURE__*/React$4.createElement(Arrow, {
|
|
4487
|
+
prefixCls: prefixCls,
|
|
4488
|
+
arrow: arrow,
|
|
4489
|
+
arrowPos: arrowPos,
|
|
4490
|
+
align: align
|
|
4491
|
+
}), /*#__PURE__*/React$4.createElement(PopupContent, {
|
|
4492
|
+
cache: !open && !fresh
|
|
4493
|
+
}, childNode));
|
|
4494
|
+
});
|
|
4495
|
+
}));
|
|
4496
|
+
});
|
|
4497
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4498
|
+
Popup.displayName = 'Popup';
|
|
4499
|
+
}
|
|
4500
|
+
|
|
4501
|
+
var TriggerWrapper = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
4502
|
+
var children = props.children,
|
|
4503
|
+
getTriggerDOMNode = props.getTriggerDOMNode;
|
|
4504
|
+
var canUseRef = supportRef(children);
|
|
4505
|
+
|
|
4506
|
+
// When use `getTriggerDOMNode`, we should do additional work to get the real dom
|
|
4507
|
+
var setRef = React$4.useCallback(function (node) {
|
|
4508
|
+
fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node) : node);
|
|
4509
|
+
}, [getTriggerDOMNode]);
|
|
4510
|
+
var mergedRef = useComposeRef(setRef, children.ref);
|
|
4511
|
+
return canUseRef ? /*#__PURE__*/React$4.cloneElement(children, {
|
|
4512
|
+
ref: mergedRef
|
|
4513
|
+
}) : children;
|
|
4514
|
+
});
|
|
4515
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4516
|
+
TriggerWrapper.displayName = 'TriggerWrapper';
|
|
4517
|
+
}
|
|
4518
|
+
|
|
4519
|
+
var TriggerContext = /*#__PURE__*/React$4.createContext(null);
|
|
4520
|
+
|
|
4521
|
+
function toArray(val) {
|
|
4522
|
+
return val ? Array.isArray(val) ? val : [val] : [];
|
|
4523
|
+
}
|
|
4524
|
+
function useAction(mobile, action, showAction, hideAction) {
|
|
4525
|
+
return React$4.useMemo(function () {
|
|
4526
|
+
var mergedShowAction = toArray(showAction !== null && showAction !== void 0 ? showAction : action);
|
|
4527
|
+
var mergedHideAction = toArray(hideAction !== null && hideAction !== void 0 ? hideAction : action);
|
|
4528
|
+
var showActionSet = new Set(mergedShowAction);
|
|
4529
|
+
var hideActionSet = new Set(mergedHideAction);
|
|
4530
|
+
if (mobile) {
|
|
4531
|
+
if (showActionSet.has('hover')) {
|
|
4532
|
+
showActionSet.delete('hover');
|
|
4533
|
+
showActionSet.add('click');
|
|
4534
|
+
}
|
|
4535
|
+
if (hideActionSet.has('hover')) {
|
|
4536
|
+
hideActionSet.delete('hover');
|
|
4537
|
+
hideActionSet.add('click');
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
return [showActionSet, hideActionSet];
|
|
4541
|
+
}, [mobile, action, showAction, hideAction]);
|
|
4542
|
+
}
|
|
4543
|
+
|
|
4544
|
+
var isVisible = (function (element) {
|
|
4545
|
+
if (!element) {
|
|
4546
|
+
return false;
|
|
4547
|
+
}
|
|
4548
|
+
if (element instanceof Element) {
|
|
4549
|
+
if (element.offsetParent) {
|
|
4550
|
+
return true;
|
|
4551
|
+
}
|
|
4552
|
+
if (element.getBBox) {
|
|
4553
|
+
var _getBBox = element.getBBox(),
|
|
4554
|
+
width = _getBBox.width,
|
|
4555
|
+
height = _getBBox.height;
|
|
4556
|
+
if (width || height) {
|
|
4557
|
+
return true;
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
if (element.getBoundingClientRect) {
|
|
4561
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
4562
|
+
_width = _element$getBoundingC.width,
|
|
4563
|
+
_height = _element$getBoundingC.height;
|
|
4564
|
+
if (_width || _height) {
|
|
4565
|
+
return true;
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
return false;
|
|
4570
|
+
});
|
|
4571
|
+
|
|
4572
|
+
function isPointsEq() {
|
|
4573
|
+
var a1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4574
|
+
var a2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4575
|
+
var isAlignPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
4576
|
+
if (isAlignPoint) {
|
|
4577
|
+
return a1[0] === a2[0];
|
|
4578
|
+
}
|
|
4579
|
+
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
4580
|
+
}
|
|
4581
|
+
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
4582
|
+
var points = align.points;
|
|
4583
|
+
var placements = Object.keys(builtinPlacements);
|
|
4584
|
+
for (var i = 0; i < placements.length; i += 1) {
|
|
4585
|
+
var _builtinPlacements$pl;
|
|
4586
|
+
var placement = placements[i];
|
|
4587
|
+
if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
|
|
4588
|
+
return "".concat(prefixCls, "-placement-").concat(placement);
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
return '';
|
|
4592
|
+
}
|
|
4593
|
+
|
|
4594
|
+
/** @deprecated We should not use this if we can refactor all deps */
|
|
4595
|
+
function getMotion(prefixCls, motion, animation, transitionName) {
|
|
4596
|
+
if (motion) {
|
|
4597
|
+
return motion;
|
|
4598
|
+
}
|
|
4599
|
+
if (animation) {
|
|
4600
|
+
return {
|
|
4601
|
+
motionName: "".concat(prefixCls, "-").concat(animation)
|
|
4602
|
+
};
|
|
4603
|
+
}
|
|
4604
|
+
if (transitionName) {
|
|
4605
|
+
return {
|
|
4606
|
+
motionName: transitionName
|
|
4607
|
+
};
|
|
4608
|
+
}
|
|
4609
|
+
return null;
|
|
4610
|
+
}
|
|
4611
|
+
function getWin(ele) {
|
|
4612
|
+
return ele.ownerDocument.defaultView;
|
|
4613
|
+
}
|
|
4260
4614
|
|
|
4261
4615
|
/**
|
|
4262
4616
|
* Get all the scrollable parent elements of the element
|
|
@@ -4481,13 +4835,14 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4481
4835
|
var originTop = popupElement.style.top;
|
|
4482
4836
|
var originRight = popupElement.style.right;
|
|
4483
4837
|
var originBottom = popupElement.style.bottom;
|
|
4838
|
+
var originOverflow = popupElement.style.overflow;
|
|
4484
4839
|
|
|
4485
4840
|
// Placement
|
|
4486
4841
|
var placementInfo = _objectSpread2(_objectSpread2({}, builtinPlacements[placement]), popupAlign);
|
|
4487
4842
|
|
|
4488
4843
|
// placeholder element
|
|
4489
4844
|
var placeholderElement = doc.createElement('div');
|
|
4490
|
-
(_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0
|
|
4845
|
+
(_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
|
|
4491
4846
|
placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
|
|
4492
4847
|
placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
|
|
4493
4848
|
placeholderElement.style.position = popupPosition;
|
|
@@ -4499,6 +4854,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4499
4854
|
popupElement.style.top = '0';
|
|
4500
4855
|
popupElement.style.right = 'auto';
|
|
4501
4856
|
popupElement.style.bottom = 'auto';
|
|
4857
|
+
popupElement.style.overflow = 'hidden';
|
|
4502
4858
|
|
|
4503
4859
|
// Calculate align style, we should consider `transform` case
|
|
4504
4860
|
var targetRect;
|
|
@@ -4571,7 +4927,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4571
4927
|
popupElement.style.top = originTop;
|
|
4572
4928
|
popupElement.style.right = originRight;
|
|
4573
4929
|
popupElement.style.bottom = originBottom;
|
|
4574
|
-
|
|
4930
|
+
popupElement.style.overflow = originOverflow;
|
|
4931
|
+
(_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
|
|
4575
4932
|
|
|
4576
4933
|
// Calculate scale
|
|
4577
4934
|
var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
|
|
@@ -4790,491 +5147,206 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
4790
5147
|
}
|
|
4791
5148
|
var numShiftY = shiftY === true ? 0 : shiftY;
|
|
4792
5149
|
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();
|
|
5150
|
+
// Top
|
|
5151
|
+
if (nextPopupY < visibleRegionArea.top) {
|
|
5152
|
+
nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
|
|
5012
5153
|
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
};
|
|
5154
|
+
// When target if far away from visible area
|
|
5155
|
+
// Stop shift
|
|
5156
|
+
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
5157
|
+
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
5158
|
+
}
|
|
5159
|
+
}
|
|
5020
5160
|
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5161
|
+
// Bottom
|
|
5162
|
+
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
5163
|
+
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
5164
|
+
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
5165
|
+
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
}
|
|
5029
5169
|
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5170
|
+
// ============================ Arrow ============================
|
|
5171
|
+
// Arrow center align
|
|
5172
|
+
var popupLeft = popupRect.x + nextOffsetX;
|
|
5173
|
+
var popupRight = popupLeft + popupWidth;
|
|
5174
|
+
var popupTop = popupRect.y + nextOffsetY;
|
|
5175
|
+
var popupBottom = popupTop + popupHeight;
|
|
5176
|
+
var targetLeft = targetRect.x;
|
|
5177
|
+
var targetRight = targetLeft + targetWidth;
|
|
5178
|
+
var targetTop = targetRect.y;
|
|
5179
|
+
var targetBottom = targetTop + targetHeight;
|
|
5180
|
+
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
5181
|
+
var minRight = Math.min(popupRight, targetRight);
|
|
5182
|
+
var xCenter = (maxLeft + minRight) / 2;
|
|
5183
|
+
var nextArrowX = xCenter - popupLeft;
|
|
5184
|
+
var maxTop = Math.max(popupTop, targetTop);
|
|
5185
|
+
var minBottom = Math.min(popupBottom, targetBottom);
|
|
5186
|
+
var yCenter = (maxTop + minBottom) / 2;
|
|
5187
|
+
var nextArrowY = yCenter - popupTop;
|
|
5188
|
+
onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
|
|
5038
5189
|
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5190
|
+
// Additional calculate right & bottom position
|
|
5191
|
+
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
5192
|
+
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
5193
|
+
setOffsetInfo({
|
|
5194
|
+
ready: true,
|
|
5195
|
+
offsetX: nextOffsetX / _scaleX,
|
|
5196
|
+
offsetY: nextOffsetY / _scaleY,
|
|
5197
|
+
offsetR: offsetX4Right / _scaleX,
|
|
5198
|
+
offsetB: offsetY4Bottom / _scaleY,
|
|
5199
|
+
arrowX: nextArrowX / _scaleX,
|
|
5200
|
+
arrowY: nextArrowY / _scaleY,
|
|
5201
|
+
scaleX: _scaleX,
|
|
5202
|
+
scaleY: _scaleY,
|
|
5203
|
+
align: nextAlignInfo
|
|
5204
|
+
});
|
|
5046
5205
|
}
|
|
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
5206
|
});
|
|
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;
|
|
5207
|
+
var triggerAlign = function triggerAlign() {
|
|
5208
|
+
alignCountRef.current += 1;
|
|
5209
|
+
var id = alignCountRef.current;
|
|
5128
5210
|
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5211
|
+
// Merge all align requirement into one frame
|
|
5212
|
+
Promise.resolve().then(function () {
|
|
5213
|
+
if (alignCountRef.current === id) {
|
|
5214
|
+
onAlign();
|
|
5215
|
+
}
|
|
5216
|
+
});
|
|
5217
|
+
};
|
|
5135
5218
|
|
|
5136
|
-
//
|
|
5219
|
+
// Reset ready status when placement & open changed
|
|
5220
|
+
var resetReady = function resetReady() {
|
|
5221
|
+
setOffsetInfo(function (ori) {
|
|
5222
|
+
return _objectSpread2(_objectSpread2({}, ori), {}, {
|
|
5223
|
+
ready: false
|
|
5224
|
+
});
|
|
5225
|
+
});
|
|
5226
|
+
};
|
|
5227
|
+
useLayoutEffect$3(resetReady, [placement]);
|
|
5137
5228
|
useLayoutEffect$3(function () {
|
|
5138
|
-
if (!
|
|
5139
|
-
|
|
5229
|
+
if (!open) {
|
|
5230
|
+
resetReady();
|
|
5140
5231
|
}
|
|
5141
|
-
}, [
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
if (!show) {
|
|
5145
|
-
return null;
|
|
5146
|
-
}
|
|
5232
|
+
}, [open]);
|
|
5233
|
+
return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
|
|
5234
|
+
}
|
|
5147
5235
|
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5236
|
+
function useWatch(open, target, popup, onAlign, onScroll) {
|
|
5237
|
+
useLayoutEffect$3(function () {
|
|
5238
|
+
if (open && target && popup) {
|
|
5239
|
+
var targetElement = target;
|
|
5240
|
+
var popupElement = popup;
|
|
5241
|
+
var targetScrollList = collectScroller(targetElement);
|
|
5242
|
+
var popupScrollList = collectScroller(popupElement);
|
|
5243
|
+
var win = getWin(popupElement);
|
|
5244
|
+
var mergedList = new Set([win].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
|
|
5245
|
+
function notifyScroll() {
|
|
5246
|
+
onAlign();
|
|
5247
|
+
onScroll();
|
|
5248
|
+
}
|
|
5249
|
+
mergedList.forEach(function (scroller) {
|
|
5250
|
+
scroller.addEventListener('scroll', notifyScroll, {
|
|
5251
|
+
passive: true
|
|
5252
|
+
});
|
|
5253
|
+
});
|
|
5254
|
+
win.addEventListener('resize', notifyScroll, {
|
|
5255
|
+
passive: true
|
|
5256
|
+
});
|
|
5156
5257
|
|
|
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;
|
|
5258
|
+
// First time always do align
|
|
5259
|
+
onAlign();
|
|
5260
|
+
return function () {
|
|
5261
|
+
mergedList.forEach(function (scroller) {
|
|
5262
|
+
scroller.removeEventListener('scroll', notifyScroll);
|
|
5263
|
+
win.removeEventListener('resize', notifyScroll);
|
|
5264
|
+
});
|
|
5265
|
+
};
|
|
5177
5266
|
}
|
|
5178
|
-
}
|
|
5267
|
+
}, [open, target, popup]);
|
|
5268
|
+
}
|
|
5179
5269
|
|
|
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';
|
|
5270
|
+
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
|
|
5271
|
+
var openRef = React$4.useRef(open);
|
|
5272
|
+
|
|
5273
|
+
// Window click to hide should be lock to avoid trigger lock immediately
|
|
5274
|
+
var lockRef = React$4.useRef(false);
|
|
5275
|
+
if (openRef.current !== open) {
|
|
5276
|
+
lockRef.current = true;
|
|
5277
|
+
openRef.current = open;
|
|
5196
5278
|
}
|
|
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));
|
|
5279
|
+
React$4.useEffect(function () {
|
|
5280
|
+
var id = wrapperRaf(function () {
|
|
5281
|
+
lockRef.current = false;
|
|
5255
5282
|
});
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
}
|
|
5283
|
+
return function () {
|
|
5284
|
+
wrapperRaf.cancel(id);
|
|
5285
|
+
};
|
|
5286
|
+
}, [open]);
|
|
5261
5287
|
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5288
|
+
// Click to hide is special action since click popup element should not hide
|
|
5289
|
+
React$4.useEffect(function () {
|
|
5290
|
+
if (clickToHide && popupEle && (!mask || maskClosable)) {
|
|
5291
|
+
var genClickEvents = function genClickEvents() {
|
|
5292
|
+
var clickInside = false;
|
|
5266
5293
|
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5294
|
+
// User may mouseDown inside and drag out of popup and mouse up
|
|
5295
|
+
// Record here to prevent close
|
|
5296
|
+
var onWindowMouseDown = function onWindowMouseDown(_ref) {
|
|
5297
|
+
var target = _ref.target;
|
|
5298
|
+
clickInside = inPopupOrChild(target);
|
|
5299
|
+
};
|
|
5300
|
+
var onWindowClick = function onWindowClick(_ref2) {
|
|
5301
|
+
var target = _ref2.target;
|
|
5302
|
+
if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
|
|
5303
|
+
triggerOpen(false);
|
|
5304
|
+
}
|
|
5305
|
+
};
|
|
5306
|
+
return [onWindowMouseDown, onWindowClick];
|
|
5307
|
+
};
|
|
5308
|
+
|
|
5309
|
+
// Events
|
|
5310
|
+
var _genClickEvents = genClickEvents(),
|
|
5311
|
+
_genClickEvents2 = _slicedToArray(_genClickEvents, 2),
|
|
5312
|
+
onWinMouseDown = _genClickEvents2[0],
|
|
5313
|
+
onWinClick = _genClickEvents2[1];
|
|
5314
|
+
var _genClickEvents3 = genClickEvents(),
|
|
5315
|
+
_genClickEvents4 = _slicedToArray(_genClickEvents3, 2),
|
|
5316
|
+
onShadowMouseDown = _genClickEvents4[0],
|
|
5317
|
+
onShadowClick = _genClickEvents4[1];
|
|
5318
|
+
var win = getWin(popupEle);
|
|
5319
|
+
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
5320
|
+
win.addEventListener('click', onWinClick, true);
|
|
5321
|
+
win.addEventListener('contextmenu', onWinClick, true);
|
|
5322
|
+
|
|
5323
|
+
// shadow root
|
|
5324
|
+
var targetShadowRoot = getShadowRoot(targetEle);
|
|
5325
|
+
if (targetShadowRoot) {
|
|
5326
|
+
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
5327
|
+
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
5328
|
+
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
// Warning if target and popup not in same root
|
|
5332
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5333
|
+
var _targetEle$getRootNod, _popupEle$getRootNode;
|
|
5334
|
+
var targetRoot = targetEle === null || targetEle === void 0 || (_targetEle$getRootNod = targetEle.getRootNode) === null || _targetEle$getRootNod === void 0 ? void 0 : _targetEle$getRootNod.call(targetEle);
|
|
5335
|
+
var popupRoot = (_popupEle$getRootNode = popupEle.getRootNode) === null || _popupEle$getRootNode === void 0 ? void 0 : _popupEle$getRootNode.call(popupEle);
|
|
5336
|
+
warning(targetRoot === popupRoot, "trigger element and popup element should in same shadow root.");
|
|
5337
|
+
}
|
|
5338
|
+
return function () {
|
|
5339
|
+
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
5340
|
+
win.removeEventListener('click', onWinClick, true);
|
|
5341
|
+
win.removeEventListener('contextmenu', onWinClick, true);
|
|
5342
|
+
if (targetShadowRoot) {
|
|
5343
|
+
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
5344
|
+
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
5345
|
+
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
5346
|
+
}
|
|
5347
|
+
};
|
|
5348
|
+
}
|
|
5349
|
+
}, [clickToHide, targetEle, popupEle, mask, maskClosable]);
|
|
5278
5350
|
}
|
|
5279
5351
|
|
|
5280
5352
|
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 +5423,7 @@ function generateTrigger() {
|
|
|
5351
5423
|
return {
|
|
5352
5424
|
registerSubPopup: function registerSubPopup(id, subPopupEle) {
|
|
5353
5425
|
subPopupElements.current[id] = subPopupEle;
|
|
5354
|
-
parentContext === null || parentContext === void 0
|
|
5426
|
+
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, subPopupEle);
|
|
5355
5427
|
}
|
|
5356
5428
|
};
|
|
5357
5429
|
}, [parentContext]);
|
|
@@ -5366,7 +5438,7 @@ function generateTrigger() {
|
|
|
5366
5438
|
if (isDOM(node) && popupEle !== node) {
|
|
5367
5439
|
setPopupEle(node);
|
|
5368
5440
|
}
|
|
5369
|
-
parentContext === null || parentContext === void 0
|
|
5441
|
+
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, node);
|
|
5370
5442
|
});
|
|
5371
5443
|
|
|
5372
5444
|
// =========================== Target ===========================
|
|
@@ -5375,9 +5447,13 @@ function generateTrigger() {
|
|
|
5375
5447
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
5376
5448
|
targetEle = _React$useState6[0],
|
|
5377
5449
|
setTargetEle = _React$useState6[1];
|
|
5450
|
+
|
|
5451
|
+
// Used for forwardRef target. Not use internal
|
|
5452
|
+
var externalForwardRef = React$4.useRef(null);
|
|
5378
5453
|
var setTargetRef = useEvent$2(function (node) {
|
|
5379
5454
|
if (isDOM(node) && targetEle !== node) {
|
|
5380
5455
|
setTargetEle(node);
|
|
5456
|
+
externalForwardRef.current = node;
|
|
5381
5457
|
}
|
|
5382
5458
|
});
|
|
5383
5459
|
|
|
@@ -5417,15 +5493,19 @@ function generateTrigger() {
|
|
|
5417
5493
|
}, [popupVisible]);
|
|
5418
5494
|
var openRef = React$4.useRef(mergedOpen);
|
|
5419
5495
|
openRef.current = mergedOpen;
|
|
5496
|
+
var lastTriggerRef = React$4.useRef([]);
|
|
5497
|
+
lastTriggerRef.current = [];
|
|
5420
5498
|
var internalTriggerOpen = useEvent$2(function (nextOpen) {
|
|
5499
|
+
var _lastTriggerRef$curre;
|
|
5500
|
+
setMergedOpen(nextOpen);
|
|
5501
|
+
|
|
5421
5502
|
// Enter or Pointer will both trigger open state change
|
|
5422
5503
|
// We only need take one to avoid duplicated change event trigger
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
});
|
|
5504
|
+
// Use `lastTriggerRef` to record last open type
|
|
5505
|
+
if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
|
|
5506
|
+
lastTriggerRef.current.push(nextOpen);
|
|
5507
|
+
onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
|
|
5508
|
+
}
|
|
5429
5509
|
});
|
|
5430
5510
|
|
|
5431
5511
|
// Trigger for delay
|
|
@@ -5515,8 +5595,11 @@ function generateTrigger() {
|
|
|
5515
5595
|
var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
|
5516
5596
|
return classNames(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
|
|
5517
5597
|
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
|
|
5598
|
+
|
|
5599
|
+
// ============================ Refs ============================
|
|
5518
5600
|
React$4.useImperativeHandle(ref, function () {
|
|
5519
5601
|
return {
|
|
5602
|
+
nativeElement: externalForwardRef.current,
|
|
5520
5603
|
forceAlign: triggerAlign
|
|
5521
5604
|
};
|
|
5522
5605
|
});
|
|
@@ -5546,7 +5629,7 @@ function generateTrigger() {
|
|
|
5546
5629
|
var onVisibleChanged = function onVisibleChanged(visible) {
|
|
5547
5630
|
setInMotion(false);
|
|
5548
5631
|
onAlign();
|
|
5549
|
-
afterPopupVisibleChange === null || afterPopupVisibleChange === void 0
|
|
5632
|
+
afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
|
|
5550
5633
|
};
|
|
5551
5634
|
|
|
5552
5635
|
// We will trigger align when motion is in prepare
|
|
@@ -5573,14 +5656,14 @@ function generateTrigger() {
|
|
|
5573
5656
|
function wrapperAction(eventName, nextOpen, delay, preEvent) {
|
|
5574
5657
|
cloneProps[eventName] = function (event) {
|
|
5575
5658
|
var _originChildProps$eve;
|
|
5576
|
-
preEvent === null || preEvent === void 0
|
|
5659
|
+
preEvent === null || preEvent === void 0 || preEvent(event);
|
|
5577
5660
|
triggerOpen(nextOpen, delay);
|
|
5578
5661
|
|
|
5579
5662
|
// Pass to origin
|
|
5580
5663
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5581
5664
|
args[_key - 1] = arguments[_key];
|
|
5582
5665
|
}
|
|
5583
|
-
(_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0
|
|
5666
|
+
(_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
|
|
5584
5667
|
};
|
|
5585
5668
|
}
|
|
5586
5669
|
|
|
@@ -5599,7 +5682,7 @@ function generateTrigger() {
|
|
|
5599
5682
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
5600
5683
|
args[_key2 - 1] = arguments[_key2];
|
|
5601
5684
|
}
|
|
5602
|
-
(_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0
|
|
5685
|
+
(_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
|
|
5603
5686
|
};
|
|
5604
5687
|
}
|
|
5605
5688
|
|
|
@@ -5631,7 +5714,7 @@ function generateTrigger() {
|
|
|
5631
5714
|
cloneProps.onMouseMove = function (event) {
|
|
5632
5715
|
var _originChildProps$onM;
|
|
5633
5716
|
// setMousePosByEvent(event);
|
|
5634
|
-
(_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0
|
|
5717
|
+
(_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
|
|
5635
5718
|
};
|
|
5636
5719
|
}
|
|
5637
5720
|
}
|
|
@@ -5667,7 +5750,7 @@ function generateTrigger() {
|
|
|
5667
5750
|
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
5668
5751
|
args[_key3 - 1] = arguments[_key3];
|
|
5669
5752
|
}
|
|
5670
|
-
(_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0
|
|
5753
|
+
(_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
|
|
5671
5754
|
};
|
|
5672
5755
|
}
|
|
5673
5756
|
|
|
@@ -5689,7 +5772,7 @@ function generateTrigger() {
|
|
|
5689
5772
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5690
5773
|
args[_key4] = arguments[_key4];
|
|
5691
5774
|
}
|
|
5692
|
-
(_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0
|
|
5775
|
+
(_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
|
|
5693
5776
|
restProps[eventName].apply(restProps, args);
|
|
5694
5777
|
};
|
|
5695
5778
|
}
|
|
@@ -5901,6 +5984,10 @@ var SelectTrigger = function SelectTrigger(props, ref) {
|
|
|
5901
5984
|
var RefSelectTrigger = /*#__PURE__*/React$4.forwardRef(SelectTrigger);
|
|
5902
5985
|
RefSelectTrigger.displayName = 'SelectTrigger';
|
|
5903
5986
|
|
|
5987
|
+
function _toArray(arr) {
|
|
5988
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
5989
|
+
}
|
|
5990
|
+
|
|
5904
5991
|
function getKey(data, index) {
|
|
5905
5992
|
var key = data.key;
|
|
5906
5993
|
var value;
|
|
@@ -7289,13 +7376,11 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7289
7376
|
}
|
|
7290
7377
|
// Trigger next effect
|
|
7291
7378
|
if (needCollectHeight) {
|
|
7292
|
-
setSyncState(
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
});
|
|
7298
|
-
});
|
|
7379
|
+
setSyncState(_objectSpread2(_objectSpread2({}, syncState), {}, {
|
|
7380
|
+
times: syncState.times + 1,
|
|
7381
|
+
targetAlign: newTargetAlign,
|
|
7382
|
+
lastTop: targetTop
|
|
7383
|
+
}));
|
|
7299
7384
|
}
|
|
7300
7385
|
} else if (process.env.NODE_ENV !== 'production' && (syncState === null || syncState === void 0 ? void 0 : syncState.times) === MAX_TIMES) {
|
|
7301
7386
|
warningOnce(false, 'Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.');
|
|
@@ -9135,7 +9220,7 @@ var _typeof = _typeof$2.exports;
|
|
|
9135
9220
|
Object.defineProperty(useId$1, "__esModule", {
|
|
9136
9221
|
value: true
|
|
9137
9222
|
});
|
|
9138
|
-
var _default$
|
|
9223
|
+
var _default$2 = useId$1.default = useId;
|
|
9139
9224
|
useId$1.getUUID = getUUID;
|
|
9140
9225
|
useId$1.isBrowserClient = void 0;
|
|
9141
9226
|
var _slicedToArray2$2 = _interopRequireDefault$3(slicedToArray.exports);
|
|
@@ -9181,44 +9266,30 @@ var interopRequireWildcard = {exports: {}};
|
|
|
9181
9266
|
|
|
9182
9267
|
(function (module) {
|
|
9183
9268
|
var _typeof = _typeof$2.exports["default"];
|
|
9184
|
-
function _getRequireWildcardCache(
|
|
9185
|
-
if (typeof WeakMap
|
|
9186
|
-
var
|
|
9187
|
-
|
|
9188
|
-
return (_getRequireWildcardCache = function _getRequireWildcardCache(
|
|
9189
|
-
return
|
|
9190
|
-
})(
|
|
9269
|
+
function _getRequireWildcardCache(e) {
|
|
9270
|
+
if ("function" != typeof WeakMap) return null;
|
|
9271
|
+
var r = new WeakMap(),
|
|
9272
|
+
t = new WeakMap();
|
|
9273
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
9274
|
+
return e ? t : r;
|
|
9275
|
+
})(e);
|
|
9191
9276
|
}
|
|
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);
|
|
9277
|
+
function _interopRequireWildcard(e, r) {
|
|
9278
|
+
if (!r && e && e.__esModule) return e;
|
|
9279
|
+
if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
|
|
9280
|
+
"default": e
|
|
9281
|
+
};
|
|
9282
|
+
var t = _getRequireWildcardCache(r);
|
|
9283
|
+
if (t && t.has(e)) return t.get(e);
|
|
9284
|
+
var n = {
|
|
9285
|
+
__proto__: null
|
|
9286
|
+
},
|
|
9287
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
9288
|
+
for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) {
|
|
9289
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
9290
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
9220
9291
|
}
|
|
9221
|
-
return
|
|
9292
|
+
return n["default"] = e, t && t.set(e, n), n;
|
|
9222
9293
|
}
|
|
9223
9294
|
module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
9224
9295
|
} (interopRequireWildcard));
|
|
@@ -9227,7 +9298,7 @@ var _interopRequireWildcard$2 = interopRequireWildcard.exports.default;
|
|
|
9227
9298
|
Object.defineProperty(useEvent$1, "__esModule", {
|
|
9228
9299
|
value: true
|
|
9229
9300
|
});
|
|
9230
|
-
var _default$
|
|
9301
|
+
var _default$1 = useEvent$1.default = useEvent;
|
|
9231
9302
|
var React$2 = _interopRequireWildcard$2(React__default);
|
|
9232
9303
|
function useEvent(callback) {
|
|
9233
9304
|
var fnRef = React$2.useRef();
|
|
@@ -9272,16 +9343,14 @@ var useLayoutEffect = function useLayoutEffect(callback, deps) {
|
|
|
9272
9343
|
};
|
|
9273
9344
|
}, []);
|
|
9274
9345
|
};
|
|
9275
|
-
|
|
9346
|
+
useLayoutEffect$1.useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
9276
9347
|
useLayoutEffect(function (firstMount) {
|
|
9277
9348
|
if (!firstMount) {
|
|
9278
9349
|
return callback();
|
|
9279
9350
|
}
|
|
9280
9351
|
}, deps);
|
|
9281
9352
|
};
|
|
9282
|
-
useLayoutEffect$1.
|
|
9283
|
-
var _default$1 = useLayoutEffect;
|
|
9284
|
-
useLayoutEffect$1.default = _default$1;
|
|
9353
|
+
useLayoutEffect$1.default = useLayoutEffect;
|
|
9285
9354
|
|
|
9286
9355
|
var useState = {};
|
|
9287
9356
|
|
|
@@ -9848,7 +9917,6 @@ function Column(_ref) {
|
|
|
9848
9917
|
})]
|
|
9849
9918
|
})) : jsxs(Fragment, {
|
|
9850
9919
|
children: [renderMenuTilte(), optionInfoList.map(function (_ref2) {
|
|
9851
|
-
var _classNames;
|
|
9852
9920
|
var disabled = _ref2.disabled,
|
|
9853
9921
|
label = _ref2.label,
|
|
9854
9922
|
value = _ref2.value,
|
|
@@ -9896,7 +9964,7 @@ function Column(_ref) {
|
|
|
9896
9964
|
};
|
|
9897
9965
|
// >>>>> Render
|
|
9898
9966
|
return jsxs("li", Object.assign({
|
|
9899
|
-
className: classNames(menuItemPrefixCls, (
|
|
9967
|
+
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
9968
|
style: dropdownMenuColumnStyle,
|
|
9901
9969
|
role: "menuitemcheckbox",
|
|
9902
9970
|
"aria-checked": checked,
|
|
@@ -9982,12 +10050,10 @@ var useActive = (function () {
|
|
|
9982
10050
|
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
9983
10051
|
[open]
|
|
9984
10052
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
9985
|
-
|
|
9986
10053
|
return [activeValueCells, setActiveValueCells];
|
|
9987
10054
|
});
|
|
9988
10055
|
|
|
9989
10056
|
var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
9990
|
-
var _ref3, _classNames;
|
|
9991
10057
|
var _a, _b;
|
|
9992
10058
|
var _useBaseProps = useBaseProps(),
|
|
9993
10059
|
prefixCls = _useBaseProps.prefixCls,
|
|
@@ -10131,7 +10197,7 @@ var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10131
10197
|
// ========================== Render ==========================
|
|
10132
10198
|
// >>>>> Empty
|
|
10133
10199
|
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 = [(
|
|
10200
|
+
var emptyList = [_defineProperty(_defineProperty(_defineProperty({}, fieldNames.value, '__EMPTY__'), FIX_LABEL, notFoundContent), "disabled", true)];
|
|
10135
10201
|
var columnProps = Object.assign(Object.assign({}, props), {
|
|
10136
10202
|
multiple: !isEmpty && multiple,
|
|
10137
10203
|
onSelect: onPathSelect,
|
|
@@ -10164,7 +10230,7 @@ var RefOptionList = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10164
10230
|
open: open
|
|
10165
10231
|
}, {
|
|
10166
10232
|
children: jsx("div", Object.assign({
|
|
10167
|
-
className: classNames("".concat(mergedPrefixCls, "-menus"), (
|
|
10233
|
+
className: classNames("".concat(mergedPrefixCls, "-menus"), _defineProperty(_defineProperty({}, "".concat(mergedPrefixCls, "-menu-empty"), isEmpty), "".concat(mergedPrefixCls, "-rtl"), rtl)),
|
|
10168
10234
|
ref: containerRef
|
|
10169
10235
|
}, {
|
|
10170
10236
|
children: columnNodes
|
|
@@ -10182,258 +10248,221 @@ function toRawValues(value) {
|
|
|
10182
10248
|
if (isMultipleValue(value)) {
|
|
10183
10249
|
return value;
|
|
10184
10250
|
}
|
|
10185
|
-
return (value.length === 0 ? [] : [value]).map(
|
|
10186
|
-
return Array.isArray(val) ? val : [val];
|
|
10187
|
-
});
|
|
10251
|
+
return (value.length === 0 ? [] : [value]).map(val => Array.isArray(val) ? val : [val]);
|
|
10188
10252
|
}
|
|
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
|
-
|
|
10253
|
+
const Cascader = /*#__PURE__*/React$4.forwardRef((props, ref) => {
|
|
10254
|
+
const intl = useFormatMessage('Cascader', localeJson);
|
|
10255
|
+
const {
|
|
10256
|
+
// MISC
|
|
10257
|
+
id,
|
|
10258
|
+
prefixCls = "".concat($prefixCls, "-cascader"),
|
|
10259
|
+
fieldNames,
|
|
10260
|
+
// Value
|
|
10261
|
+
defaultValue,
|
|
10262
|
+
value,
|
|
10263
|
+
changeOnSelect,
|
|
10264
|
+
onChange,
|
|
10265
|
+
displayRender,
|
|
10266
|
+
// Trigger
|
|
10267
|
+
expandTrigger,
|
|
10268
|
+
// Options
|
|
10269
|
+
options,
|
|
10270
|
+
optionsTitle = [],
|
|
10271
|
+
dropdownPrefixCls,
|
|
10272
|
+
loadData,
|
|
10273
|
+
// Open
|
|
10274
|
+
popupVisible,
|
|
10275
|
+
open,
|
|
10276
|
+
popupClassName,
|
|
10277
|
+
dropdownClassName,
|
|
10278
|
+
dropdownMenuColumnStyle,
|
|
10279
|
+
popupPlacement,
|
|
10280
|
+
placement,
|
|
10281
|
+
onDropdownVisibleChange,
|
|
10282
|
+
onPopupVisibleChange,
|
|
10283
|
+
// Icon
|
|
10284
|
+
expandIcon = jsx(Right, {}),
|
|
10285
|
+
loadingIcon,
|
|
10286
|
+
// Placeholder
|
|
10287
|
+
placeholder = intl({
|
|
10288
|
+
id: 'placeholder'
|
|
10289
|
+
}),
|
|
10290
|
+
// Clear
|
|
10291
|
+
allClear = true,
|
|
10292
|
+
//MenuStlye
|
|
10293
|
+
menuMaxHight = 158,
|
|
10294
|
+
//Other
|
|
10295
|
+
expandJoin = '/',
|
|
10296
|
+
disabled = false,
|
|
10297
|
+
loading,
|
|
10298
|
+
disabledTooltip,
|
|
10299
|
+
// Children
|
|
10300
|
+
children,
|
|
10301
|
+
dropdownMatchSelectWidth = false,
|
|
10302
|
+
showCheckedStrategy = SHOW_PARENT
|
|
10303
|
+
} = props,
|
|
10237
10304
|
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
|
-
|
|
10305
|
+
const mergedId = _default$2(id);
|
|
10239
10306
|
// =========================== Values ===========================
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
10245
|
-
rawValues = _useMergedState2[0],
|
|
10246
|
-
setRawValues = _useMergedState2[1];
|
|
10307
|
+
const [rawValues, setRawValues] = _default(defaultValue, {
|
|
10308
|
+
value,
|
|
10309
|
+
postState: toRawValues
|
|
10310
|
+
});
|
|
10247
10311
|
// ========================= FieldNames =========================
|
|
10248
|
-
|
|
10249
|
-
return fillFieldNames$1(fieldNames);
|
|
10250
|
-
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
10312
|
+
const mergedFieldNames = React$4.useMemo(() => fillFieldNames$1(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
|
10251
10313
|
[JSON.stringify(fieldNames)]
|
|
10252
10314
|
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
10253
10315
|
// =========================== Option ===========================
|
|
10254
|
-
|
|
10255
|
-
return options || [];
|
|
10256
|
-
}, [options]);
|
|
10316
|
+
const mergedOptions = React$4.useMemo(() => options || [], [options]);
|
|
10257
10317
|
// Only used in multiple mode, this fn will not call in single mode
|
|
10258
|
-
|
|
10318
|
+
const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
10259
10319
|
/** Convert path key back to value format */
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
return pathKeys.map(
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10320
|
+
const getValueByKeyPath = React$4.useCallback(pathKeys => {
|
|
10321
|
+
const keyPathEntities = getPathKeyEntities();
|
|
10322
|
+
return pathKeys.map(pathKey => {
|
|
10323
|
+
const {
|
|
10324
|
+
nodes
|
|
10325
|
+
} = keyPathEntities[pathKey];
|
|
10326
|
+
return nodes.map(node => node[mergedFieldNames.value]);
|
|
10267
10327
|
});
|
|
10268
10328
|
}, [getPathKeyEntities, mergedFieldNames]);
|
|
10269
10329
|
// =========================== 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({
|
|
10330
|
+
const [inputLabel, setInputLable] = React$4.useState(); // 输入框选择文案
|
|
10331
|
+
const [dropdownVisible, setDropdownVisible] = React$4.useState(false); // dropDown显示状态
|
|
10332
|
+
const [menuWidth, setMenuWidth] = React$4.useState('auto'); //下拉框的宽度
|
|
10333
|
+
const inputRef = React$4.useRef({
|
|
10283
10334
|
id: UUID(),
|
|
10284
10335
|
level: 1
|
|
10285
10336
|
});
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
return toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(function (valueOpt) {
|
|
10290
|
-
return valueOpt.option;
|
|
10291
|
-
});
|
|
10292
|
-
});
|
|
10337
|
+
const handleValueToOptions = value => {
|
|
10338
|
+
const nextRawValues = toRawValues(value);
|
|
10339
|
+
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
|
|
10293
10340
|
return valueOptions;
|
|
10294
10341
|
};
|
|
10295
|
-
React$4.useEffect(
|
|
10342
|
+
React$4.useEffect(() => {
|
|
10296
10343
|
if (!value) return;
|
|
10297
|
-
|
|
10298
|
-
|
|
10344
|
+
const valueOptions = handleValueToOptions(value);
|
|
10345
|
+
const triggerOptions = valueOptions[0];
|
|
10299
10346
|
if (!triggerOptions) return;
|
|
10300
|
-
setInputLable(triggerOptions.map(
|
|
10301
|
-
return o.label;
|
|
10302
|
-
}).join(expandJoin));
|
|
10347
|
+
setInputLable(triggerOptions.map(o => o.label).join(expandJoin));
|
|
10303
10348
|
}, [value]);
|
|
10304
10349
|
// =========================== Values ===========================
|
|
10305
|
-
|
|
10350
|
+
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
10306
10351
|
// 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)));
|
|
10352
|
+
const [checkedValues, halfCheckedValues, missingCheckedValues] = React$4.useMemo(() => {
|
|
10353
|
+
const [existValues, missingValues] = getMissingValues(rawValues);
|
|
10354
|
+
if (!rawValues.length) {
|
|
10355
|
+
return [existValues, [], missingValues];
|
|
10356
|
+
}
|
|
10357
|
+
const keyPathValues = toPathKeys(existValues);
|
|
10358
|
+
const keyPathEntities = getPathKeyEntities();
|
|
10359
|
+
const {
|
|
10360
|
+
checkedKeys,
|
|
10361
|
+
halfCheckedKeys
|
|
10362
|
+
} = conductCheck(keyPathValues, true, keyPathEntities);
|
|
10363
|
+
// Convert key back to value cells
|
|
10364
|
+
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
10365
|
+
}, [rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
|
|
10366
|
+
const deDuplicatedValues = React$4.useMemo(() => {
|
|
10367
|
+
const checkedKeys = toPathKeys(checkedValues);
|
|
10368
|
+
const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
10369
|
+
return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
|
|
10331
10370
|
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
|
|
10332
|
-
|
|
10371
|
+
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, false, displayRender);
|
|
10333
10372
|
// =========================== Change ===========================
|
|
10334
|
-
|
|
10373
|
+
const triggerChange = _default$1(nextValues => {
|
|
10335
10374
|
setRawValues(nextValues);
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
});
|
|
10341
|
-
});
|
|
10342
|
-
var triggerValues = nextRawValues[0];
|
|
10343
|
-
var triggerOptions = valueOptions[0];
|
|
10375
|
+
const nextRawValues = toRawValues(nextValues);
|
|
10376
|
+
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
|
|
10377
|
+
const triggerValues = nextRawValues[0];
|
|
10378
|
+
const triggerOptions = valueOptions[0];
|
|
10344
10379
|
onChange && onChange(triggerValues, triggerOptions);
|
|
10345
10380
|
});
|
|
10346
10381
|
// =========================== Select ===========================
|
|
10347
|
-
|
|
10382
|
+
const onInternalSelect = _default$1(valuePath => {
|
|
10348
10383
|
triggerChange(valuePath);
|
|
10349
10384
|
});
|
|
10350
10385
|
// Display Value change logic
|
|
10351
|
-
|
|
10386
|
+
const onDisplayValuesChange = (_, info) => {
|
|
10352
10387
|
if (info.type === 'clear') {
|
|
10353
10388
|
triggerChange([]);
|
|
10354
10389
|
return;
|
|
10355
10390
|
}
|
|
10356
10391
|
// Cascader do not support `add` type. Only support `remove`
|
|
10357
|
-
|
|
10392
|
+
const {
|
|
10393
|
+
valueCells
|
|
10394
|
+
} = info.values[0];
|
|
10358
10395
|
onInternalSelect(valueCells);
|
|
10359
10396
|
};
|
|
10360
10397
|
// ============================ Open ============================
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10398
|
+
const mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
10399
|
+
const mergedPlacement = placement || popupPlacement;
|
|
10400
|
+
const onInternalDropdownVisibleChange = nextVisible => {
|
|
10364
10401
|
setDropdownVisible(nextVisible);
|
|
10365
10402
|
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
10366
10403
|
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
10367
10404
|
};
|
|
10368
10405
|
// ========================== 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]);
|
|
10406
|
+
const cascaderContext = React$4.useMemo(() => ({
|
|
10407
|
+
options: mergedOptions,
|
|
10408
|
+
optionsTitle,
|
|
10409
|
+
fieldNames: mergedFieldNames,
|
|
10410
|
+
values: checkedValues,
|
|
10411
|
+
menuMaxHight,
|
|
10412
|
+
halfValues: halfCheckedValues,
|
|
10413
|
+
changeOnSelect,
|
|
10414
|
+
onSelect: onInternalSelect,
|
|
10415
|
+
menuWidth,
|
|
10416
|
+
dropdownPrefixCls,
|
|
10417
|
+
loadData,
|
|
10418
|
+
expandTrigger,
|
|
10419
|
+
expandIcon,
|
|
10420
|
+
loadingIcon,
|
|
10421
|
+
dropdownMenuColumnStyle,
|
|
10422
|
+
loading
|
|
10423
|
+
}), [menuWidth, mergedOptions, inputRef, optionsTitle, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, loading]);
|
|
10389
10424
|
// ==============================================================
|
|
10390
10425
|
// == Render ==
|
|
10391
10426
|
// ==============================================================
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
depth = _stack$pop.depth;
|
|
10427
|
+
const emptyOptions = !mergedOptions.length;
|
|
10428
|
+
const getMaxDepth = function (options) {
|
|
10429
|
+
let depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
10430
|
+
let maxDepth = depth;
|
|
10431
|
+
const stack = [...options.map(option => ({
|
|
10432
|
+
option,
|
|
10433
|
+
depth: 1
|
|
10434
|
+
}))];
|
|
10435
|
+
while (stack.length > 0 && maxDepth < 3) {
|
|
10436
|
+
const {
|
|
10437
|
+
option,
|
|
10438
|
+
depth
|
|
10439
|
+
} = stack.pop();
|
|
10406
10440
|
maxDepth = Math.max(maxDepth, depth);
|
|
10407
10441
|
if (option.children && option.children.length > 0) {
|
|
10408
|
-
stack.push
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
depth: depth + 1
|
|
10412
|
-
};
|
|
10442
|
+
stack.push(...option.children.map(child => ({
|
|
10443
|
+
option: child,
|
|
10444
|
+
depth: depth + 1
|
|
10413
10445
|
})));
|
|
10414
10446
|
}
|
|
10415
|
-
};
|
|
10416
|
-
while (stack.length > 0 && maxDepth < 3) {
|
|
10417
|
-
_loop();
|
|
10418
10447
|
}
|
|
10419
10448
|
return maxDepth;
|
|
10420
10449
|
};
|
|
10421
|
-
React$4.useEffect(
|
|
10450
|
+
React$4.useEffect(() => {
|
|
10422
10451
|
setDropdownVisible(!!(open !== undefined ? open : popupVisible));
|
|
10423
10452
|
}, [open, popupVisible]); // dropDownVisible
|
|
10424
10453
|
// 监听屏幕宽度
|
|
10425
|
-
React$4.useEffect(
|
|
10454
|
+
React$4.useEffect(() => {
|
|
10426
10455
|
window.addEventListener('resize', handleCalcMenuWidth);
|
|
10427
|
-
return
|
|
10456
|
+
return () => {
|
|
10428
10457
|
window.removeEventListener('resize', handleCalcMenuWidth);
|
|
10429
10458
|
};
|
|
10430
10459
|
}, []);
|
|
10431
|
-
React$4.useEffect(
|
|
10432
|
-
|
|
10460
|
+
React$4.useEffect(() => {
|
|
10461
|
+
const option = (options === null || options === void 0 ? void 0 : options[0]) || [];
|
|
10433
10462
|
inputRef.current.level = (option === null || option === void 0 ? void 0 : option.length) < 1 || loading ? 1 : getMaxDepth(options);
|
|
10434
10463
|
handleCalcMenuWidth();
|
|
10435
10464
|
}, [options, loading]);
|
|
10436
|
-
|
|
10465
|
+
const handleClear = e => {
|
|
10437
10466
|
e.stopPropagation();
|
|
10438
10467
|
setInputLable('');
|
|
10439
10468
|
onChange && onChange([], []);
|
|
@@ -10441,14 +10470,16 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10441
10470
|
cascaderContext.values = [];
|
|
10442
10471
|
};
|
|
10443
10472
|
// 设置下拉框的宽度
|
|
10444
|
-
|
|
10445
|
-
|
|
10473
|
+
const handleCalcMenuWidth = () => {
|
|
10474
|
+
const inputEle = document.getElementById("".concat(inputRef.current.id));
|
|
10446
10475
|
if (!inputEle) return;
|
|
10447
|
-
|
|
10476
|
+
const {
|
|
10477
|
+
clientWidth
|
|
10478
|
+
} = inputEle;
|
|
10448
10479
|
setMenuWidth((clientWidth / inputRef.current.level).toFixed(2));
|
|
10449
10480
|
};
|
|
10450
10481
|
// 内标题memo
|
|
10451
|
-
|
|
10482
|
+
const InsideMemo = React$4.useMemo(() => {
|
|
10452
10483
|
return jsx(Fragment, {
|
|
10453
10484
|
children: !inputLabel ? disabled && disabledTooltip ? jsx(Tooltip, Object.assign({
|
|
10454
10485
|
disabled: true
|
|
@@ -10477,7 +10508,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10477
10508
|
}))
|
|
10478
10509
|
});
|
|
10479
10510
|
}, [inputLabel, placeholder]);
|
|
10480
|
-
|
|
10511
|
+
const clearRender = () => {
|
|
10481
10512
|
if (allClear) {
|
|
10482
10513
|
return jsx("span", Object.assign({
|
|
10483
10514
|
className: "clean-up-icon",
|
|
@@ -10487,10 +10518,14 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10487
10518
|
}));
|
|
10488
10519
|
}
|
|
10489
10520
|
};
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10521
|
+
const childrenMemo = React$4.useMemo(() => {
|
|
10522
|
+
const contentClass = clsx("".concat($prefixCls, "-cascader-select-content"), {
|
|
10523
|
+
["".concat($prefixCls, "-cascader-select-value")]: inputLabel,
|
|
10524
|
+
["".concat($prefixCls, "-cascader-select-disabled")]: disabled
|
|
10525
|
+
});
|
|
10526
|
+
const svgClass = clsx("select-svg", {
|
|
10527
|
+
["select-svg-open"]: dropdownVisible
|
|
10528
|
+
});
|
|
10494
10529
|
return children ? children : jsxs("div", Object.assign({
|
|
10495
10530
|
className: contentClass,
|
|
10496
10531
|
id: inputRef.current.id
|
|
@@ -10502,7 +10537,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10502
10537
|
}))]
|
|
10503
10538
|
}));
|
|
10504
10539
|
}, [inputLabel, dropdownVisible, inputRef]);
|
|
10505
|
-
|
|
10540
|
+
const dropdownStyle =
|
|
10506
10541
|
// Empty keep the width
|
|
10507
10542
|
emptyOptions ? {} : {
|
|
10508
10543
|
minWidth: 'auto'
|
|
@@ -10521,7 +10556,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10521
10556
|
// Search
|
|
10522
10557
|
showSearch: false,
|
|
10523
10558
|
searchValue: '',
|
|
10524
|
-
onSearch:
|
|
10559
|
+
onSearch: () => {
|
|
10525
10560
|
console.log('not search');
|
|
10526
10561
|
},
|
|
10527
10562
|
// Value
|
|
@@ -10536,9 +10571,7 @@ var Cascader = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
10536
10571
|
placement: mergedPlacement,
|
|
10537
10572
|
onDropdownVisibleChange: onInternalDropdownVisibleChange,
|
|
10538
10573
|
// Children
|
|
10539
|
-
getRawInputElement:
|
|
10540
|
-
return childrenMemo;
|
|
10541
|
-
}
|
|
10574
|
+
getRawInputElement: () => childrenMemo
|
|
10542
10575
|
}))
|
|
10543
10576
|
}));
|
|
10544
10577
|
});
|