Latest updates from IceHrmPro
This commit is contained in:
54
web/node_modules/rc-trigger/HISTORY.md
generated
vendored
Normal file
54
web/node_modules/rc-trigger/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# History
|
||||
----
|
||||
|
||||
## 2.5.0 / 2018-06-05
|
||||
|
||||
- support `alignPoint`
|
||||
|
||||
## 2.1.0 / 2017-10-16
|
||||
|
||||
- add action `contextMenu`
|
||||
|
||||
## 2.0.0 / 2017-09-25
|
||||
|
||||
- support React 16
|
||||
|
||||
## 1.11.0 / 2017-06-07
|
||||
|
||||
- add es
|
||||
|
||||
## 1.9.0 / 2017-02-27
|
||||
|
||||
- add getDocument prop
|
||||
|
||||
## 1.8.2 / 2017-02-24
|
||||
|
||||
- change default container to absolute to fix scrollbar change problem
|
||||
|
||||
## 1.7.0 / 2016-07-18
|
||||
|
||||
- use getContainerRenderMixin from 'rc-util'
|
||||
|
||||
## 1.6.0 / 2016-05-26
|
||||
|
||||
- support popup as function
|
||||
|
||||
## 1.5.0 / 2016-05-26
|
||||
|
||||
- add forcePopupAlign method
|
||||
|
||||
## 1.4.0 / 2016-04-06
|
||||
|
||||
- support onPopupAlign
|
||||
|
||||
## 1.3.0 / 2016-03-25
|
||||
|
||||
- support mask/maskTransitionName/zIndex
|
||||
|
||||
## 1.2.0 / 2016-03-01
|
||||
|
||||
- add showAction/hideAction
|
||||
|
||||
## 1.1.0 / 2016-01-06
|
||||
|
||||
- add root trigger node as parameter of getPopupContainer
|
||||
20
web/node_modules/rc-trigger/LICENSE
generated
vendored
Normal file
20
web/node_modules/rc-trigger/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015-present Alipay.com, https://www.alipay.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
327
web/node_modules/rc-trigger/README.md
generated
vendored
Normal file
327
web/node_modules/rc-trigger/README.md
generated
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
# rc-trigger
|
||||
---
|
||||
|
||||
React Trigger Component
|
||||
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![gemnasium deps][gemnasium-image]][gemnasium-url]
|
||||
[![npm download][download-image]][download-url]
|
||||
|
||||
[npm-image]: http://img.shields.io/npm/v/rc-trigger.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/rc-trigger
|
||||
[travis-image]: https://img.shields.io/travis/react-component/trigger.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/react-component/trigger
|
||||
[coveralls-image]: https://img.shields.io/coveralls/react-component/trigger.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/react-component/trigger?branch=master
|
||||
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square
|
||||
[gemnasium-url]: https://gemnasium.com/react-component/trigger
|
||||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-trigger.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-trigger
|
||||
|
||||
|
||||
## Browser Support
|
||||
|
||||
| |  |  |  | |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Edge / IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
http://localhost:8200/examples/
|
||||
|
||||
online example: http://react-component.github.io/trigger/examples/
|
||||
|
||||
## Feature
|
||||
|
||||
* supported on IE 8+, Chrome, Firefox, and Safari
|
||||
|
||||
## install
|
||||
|
||||
[](https://npmjs.org/package/rc-trigger)
|
||||
|
||||
## Usage
|
||||
|
||||
Include the default [styling](https://github.com/react-component/trigger/blob/master/assets/index.less#L4:L11) and then:
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Trigger from 'rc-trigger';
|
||||
|
||||
ReactDOM.render((
|
||||
<Trigger
|
||||
action={['click']}
|
||||
popup={<span>popup</span>}
|
||||
popupAlign={{
|
||||
points: ['tl', 'bl'],
|
||||
offset: [0, 3]
|
||||
}}
|
||||
>
|
||||
<a href='#'>hover</a>
|
||||
</Trigger>
|
||||
), container);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### props
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">name</th>
|
||||
<th style="width: 50px;">type</th>
|
||||
<th style="width: 50px;">default</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>alignPoint</td>
|
||||
<td>bool</td>
|
||||
<td>false</td>
|
||||
<td>Popup will align with mouse position (support action of 'click', 'hover' and 'contextMenu')</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupClassName</td>
|
||||
<td>string</td>
|
||||
<td></td>
|
||||
<td>additional className added to popup</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>forceRender</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether render popup before first show</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>destroyPopupOnHide</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether destroy popup when hide</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>getPopupClassNameFromAlign</td>
|
||||
<td>getPopupClassNameFromAlign(align: Object):String</td>
|
||||
<td></td>
|
||||
<td>additional className added to popup according to align</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>action</td>
|
||||
<td>string[]</td>
|
||||
<td>['hover']</td>
|
||||
<td>which actions cause popup shown. enum of 'hover','click','focus','contextMenu'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mouseEnterDelay</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>delay time to show when mouse enter. unit: s.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mouseLeaveDelay</td>
|
||||
<td>number</td>
|
||||
<td>0.1</td>
|
||||
<td>delay time to hide when mouse leave. unit: s.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupStyle</td>
|
||||
<td>Object</td>
|
||||
<td></td>
|
||||
<td>additional style of popup</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>prefixCls</td>
|
||||
<td>String</td>
|
||||
<td>rc-trigger-popup</td>
|
||||
<td>prefix class name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupTransitionName</td>
|
||||
<td>String|Object</td>
|
||||
<td></td>
|
||||
<td>https://github.com/react-component/animate</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maskTransitionName</td>
|
||||
<td>String|Object</td>
|
||||
<td></td>
|
||||
<td>https://github.com/react-component/animate</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPopupVisibleChange</td>
|
||||
<td>Function</td>
|
||||
<td></td>
|
||||
<td>call when popup visible is changed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mask</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>whether to support mask</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maskClosable</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>whether to support click mask to hide</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupVisible</td>
|
||||
<td>boolean</td>
|
||||
<td></td>
|
||||
<td>whether popup is visible</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zIndex</td>
|
||||
<td>number</td>
|
||||
<td></td>
|
||||
<td>popup's zIndex</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>defaultPopupVisible</td>
|
||||
<td>boolean</td>
|
||||
<td></td>
|
||||
<td>whether popup is visible initially</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupAlign</td>
|
||||
<td>Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align)</td>
|
||||
<td></td>
|
||||
<td>popup 's align config</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onPopupAlign</td>
|
||||
<td>function(popupDomNode, align)</td>
|
||||
<td></td>
|
||||
<td>callback when popup node is aligned</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popup</td>
|
||||
<td>React.Element | function() => React.Element</td>
|
||||
<td></td>
|
||||
<td>popup content</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>getPopupContainer</td>
|
||||
<td>getPopupContainer(): HTMLElement</td>
|
||||
<td></td>
|
||||
<td>function returning html node which will act as popup container</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>getDocument</td>
|
||||
<td>getDocument(): HTMLElement</td>
|
||||
<td></td>
|
||||
<td>function returning document node which will be attached click event to close trigger</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>popupPlacement</td>
|
||||
<td>string</td>
|
||||
<td></td>
|
||||
<td>use preset popup align config from builtinPlacements, can be merged by popupAlign prop</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>builtinPlacements</td>
|
||||
<td>object</td>
|
||||
<td></td>
|
||||
<td>builtin placement align map. used by placement prop</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>stretch</td>
|
||||
<td>string</td>
|
||||
<td></td>
|
||||
<td>Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth')</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
## Test Case
|
||||
|
||||
```
|
||||
npm test
|
||||
npm run chrome-test
|
||||
```
|
||||
|
||||
## Coverage
|
||||
|
||||
```
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
open coverage/ dir
|
||||
|
||||
## React 16 Note
|
||||
|
||||
After React 16, you won't access popup element's ref in parent component's componentDidMount, which means following code won't work.
|
||||
|
||||
```javascript
|
||||
class App extends React.Component {
|
||||
componentDidMount() {
|
||||
this.input.focus(); // error, this.input is undefined.
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Trigger
|
||||
action={['click']}
|
||||
popup={<div><input ref={node => this.input = node} type="text" /></div>}
|
||||
>
|
||||
<button>click</button>
|
||||
</Trigger>
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Consider wrap your popup element to a separate component:
|
||||
|
||||
```javascript
|
||||
class InputPopup extends React.Component {
|
||||
componentDidMount() {
|
||||
this.props.onMount();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<input ref={this.props.inputRef} type="text" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class App extends React.Component {
|
||||
handlePopupMount() {
|
||||
this.input.focus(); // error, this.input is undefined.
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Trigger
|
||||
action={['click']}
|
||||
popup={<InputPopup inputRef={node => this.input = node} onMount={this.handlePopupMount} />}
|
||||
>
|
||||
<button>click</button>
|
||||
</Trigger>
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
rc-trigger is released under the MIT license.
|
||||
67
web/node_modules/rc-trigger/assets/index.less
generated
vendored
Normal file
67
web/node_modules/rc-trigger/assets/index.less
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
@triggerPrefixCls: rc-trigger-popup;
|
||||
|
||||
.@{triggerPrefixCls} {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
top: -9999px;
|
||||
z-index: 1050;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.effect() {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
&-zoom-enter,&-zoom-appear {
|
||||
opacity: 0;
|
||||
.effect();
|
||||
animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-zoom-leave {
|
||||
.effect();
|
||||
animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-zoom-enter&-zoom-enter-active, &-zoom-appear&-zoom-appear-active {
|
||||
animation-name: rcTriggerZoomIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-zoom-leave&-zoom-leave-active {
|
||||
animation-name: rcTriggerZoomOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
@keyframes rcTriggerZoomIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 50%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform-origin: 50% 50%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes rcTriggerZoomOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
transform-origin: 50% 50%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 50%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@import "./index/Mask";
|
||||
63
web/node_modules/rc-trigger/assets/index/Mask.less
generated
vendored
Normal file
63
web/node_modules/rc-trigger/assets/index/Mask.less
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
.@{triggerPrefixCls} {
|
||||
&-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgb(55, 55, 55);
|
||||
background-color: rgba(55, 55, 55, 0.6);
|
||||
height: 100%;
|
||||
filter: alpha(opacity=50);
|
||||
z-index: 1050;
|
||||
|
||||
&-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fade-effect() {
|
||||
animation-duration: 0.3s;
|
||||
animation-fill-mode: both;
|
||||
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
||||
}
|
||||
|
||||
&-fade-enter,&-fade-appear {
|
||||
opacity: 0;
|
||||
.fade-effect();
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-fade-leave {
|
||||
.fade-effect();
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
&-fade-enter&-fade-enter-active,&-fade-appear&-fade-appear-active {
|
||||
animation-name: rcTriggerMaskFadeIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
&-fade-leave&-fade-leave-active {
|
||||
animation-name: rcDialogFadeOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
|
||||
@keyframes rcTriggerMaskFadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rcDialogFadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
96
web/node_modules/rc-trigger/es/Popup.d.ts
generated
vendored
Normal file
96
web/node_modules/rc-trigger/es/Popup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import React, { Component } from 'react';
|
||||
import { StretchType, AlignType, TransitionNameType, AnimationType, Point, MotionType } from './interface';
|
||||
/**
|
||||
* Popup should follow the steps for each component work correctly:
|
||||
* measure - check for the current stretch size
|
||||
* align - let component align the position
|
||||
* aligned - re-align again in case additional className changed the size
|
||||
* afterAlign - choice next step is trigger motion or finished
|
||||
* beforeMotion - should reset motion to invisible so that CSSMotion can do normal motion
|
||||
* motion - play the motion
|
||||
* stable - everything is done
|
||||
*/
|
||||
declare type PopupStatus = null | 'measure' | 'align' | 'aligned' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable';
|
||||
interface PopupProps {
|
||||
visible?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
getClassNameFromAlign?: (align: AlignType) => string;
|
||||
onAlign?: (element: HTMLElement, align: AlignType) => void;
|
||||
getRootDomNode?: () => HTMLElement;
|
||||
align?: AlignType;
|
||||
destroyPopupOnHide?: boolean;
|
||||
className?: string;
|
||||
prefixCls: string;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
||||
onTouchStart?: React.TouchEventHandler<HTMLElement>;
|
||||
stretch?: StretchType;
|
||||
children?: React.ReactNode;
|
||||
point?: Point;
|
||||
zIndex?: number;
|
||||
mask?: boolean;
|
||||
motion: MotionType;
|
||||
maskMotion: MotionType;
|
||||
animation: AnimationType;
|
||||
transitionName: TransitionNameType;
|
||||
maskAnimation: AnimationType;
|
||||
maskTransitionName: TransitionNameType;
|
||||
}
|
||||
interface PopupState {
|
||||
targetWidth: number;
|
||||
targetHeight: number;
|
||||
status: PopupStatus;
|
||||
prevVisible: boolean;
|
||||
alignClassName: string;
|
||||
}
|
||||
interface AlignRefType {
|
||||
forceAlign: () => void;
|
||||
}
|
||||
declare class Popup extends Component<PopupProps, PopupState> {
|
||||
state: PopupState;
|
||||
popupRef: React.RefObject<HTMLDivElement>;
|
||||
alignRef: React.RefObject<AlignRefType>;
|
||||
private nextFrameState;
|
||||
private nextFrameId;
|
||||
static getDerivedStateFromProps({ visible, ...props }: PopupProps, { prevVisible, status }: PopupState): Partial<PopupState>;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
componentWillUnmount(): void;
|
||||
onAlign: (popupDomNode: HTMLElement, align: AlignType) => void;
|
||||
onMotionEnd: () => void;
|
||||
setStateOnNextFrame: (state: Partial<PopupState>) => void;
|
||||
getMotion: () => {
|
||||
motionName?: string | {
|
||||
none?: string;
|
||||
enter?: string;
|
||||
appear?: string;
|
||||
leave?: string;
|
||||
"appear-active"?: string;
|
||||
"enter-active"?: string;
|
||||
"leave-active"?: string;
|
||||
};
|
||||
motionAppear?: boolean;
|
||||
motionEnter?: boolean;
|
||||
motionLeave?: boolean;
|
||||
motionLeaveImmediately?: boolean;
|
||||
removeOnLeave?: boolean;
|
||||
leavedClassName?: string;
|
||||
onAppearStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onAppearActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onAppearEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
};
|
||||
getAlignTarget: () => Point | (() => HTMLElement);
|
||||
getZIndexStyle(): React.CSSProperties;
|
||||
cancelFrameState: () => void;
|
||||
renderPopupElement: () => JSX.Element;
|
||||
renderMaskElement: () => JSX.Element;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Popup;
|
||||
409
web/node_modules/rc-trigger/es/Popup.js
generated
vendored
Normal file
409
web/node_modules/rc-trigger/es/Popup.js
generated
vendored
Normal file
@@ -0,0 +1,409 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
import React, { Component } from 'react';
|
||||
import raf from 'raf';
|
||||
import Align from 'rc-align';
|
||||
import { composeRef } from "rc-util/es/ref";
|
||||
import classNames from 'classnames';
|
||||
import RawCSSMotion from "rc-animate/es/CSSMotion";
|
||||
import PopupInner from './PopupInner';
|
||||
import { getMotion } from './utils/legacyUtil';
|
||||
var CSSMotion = RawCSSMotion;
|
||||
|
||||
function supportMotion(motion) {
|
||||
return motion && motion.motionName;
|
||||
}
|
||||
|
||||
var Popup =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
_inherits(Popup, _Component);
|
||||
|
||||
function Popup() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Popup);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Popup).apply(this, arguments));
|
||||
_this.state = {
|
||||
targetWidth: undefined,
|
||||
targetHeight: undefined,
|
||||
status: null,
|
||||
prevVisible: null,
|
||||
alignClassName: null
|
||||
};
|
||||
_this.popupRef = React.createRef();
|
||||
_this.alignRef = React.createRef();
|
||||
_this.nextFrameState = null;
|
||||
_this.nextFrameId = null;
|
||||
|
||||
_this.onAlign = function (popupDomNode, align) {
|
||||
var status = _this.state.status;
|
||||
var _this$props = _this.props,
|
||||
getClassNameFromAlign = _this$props.getClassNameFromAlign,
|
||||
onAlign = _this$props.onAlign;
|
||||
var alignClassName = getClassNameFromAlign(align);
|
||||
|
||||
if (status === 'align') {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName,
|
||||
status: 'aligned'
|
||||
}, function () {
|
||||
_this.alignRef.current.forceAlign();
|
||||
});
|
||||
} else if (status === 'aligned') {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName,
|
||||
status: 'afterAlign'
|
||||
});
|
||||
|
||||
onAlign(popupDomNode, align);
|
||||
} else {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMotionEnd = function () {
|
||||
var visible = _this.props.visible;
|
||||
|
||||
_this.setState({
|
||||
status: visible ? 'AfterMotion' : 'stable'
|
||||
});
|
||||
};
|
||||
|
||||
_this.setStateOnNextFrame = function (state) {
|
||||
_this.cancelFrameState();
|
||||
|
||||
_this.nextFrameState = _objectSpread({}, _this.nextFrameState, {}, state);
|
||||
_this.nextFrameId = raf(function () {
|
||||
var submitState = _objectSpread({}, _this.nextFrameState);
|
||||
|
||||
_this.nextFrameState = null;
|
||||
|
||||
_this.setState(submitState);
|
||||
});
|
||||
};
|
||||
|
||||
_this.getMotion = function () {
|
||||
return _objectSpread({}, getMotion(_this.props));
|
||||
}; // `target` on `rc-align` can accept as a function to get the bind element or a point.
|
||||
// ref: https://www.npmjs.com/package/rc-align
|
||||
|
||||
|
||||
_this.getAlignTarget = function () {
|
||||
var _this$props2 = _this.props,
|
||||
point = _this$props2.point,
|
||||
getRootDomNode = _this$props2.getRootDomNode;
|
||||
|
||||
if (point) {
|
||||
return point;
|
||||
}
|
||||
|
||||
return getRootDomNode;
|
||||
};
|
||||
|
||||
_this.cancelFrameState = function () {
|
||||
raf.cancel(_this.nextFrameId);
|
||||
};
|
||||
|
||||
_this.renderPopupElement = function () {
|
||||
var _this$state = _this.state,
|
||||
status = _this$state.status,
|
||||
targetHeight = _this$state.targetHeight,
|
||||
targetWidth = _this$state.targetWidth,
|
||||
alignClassName = _this$state.alignClassName;
|
||||
var _this$props3 = _this.props,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
className = _this$props3.className,
|
||||
style = _this$props3.style,
|
||||
stretch = _this$props3.stretch,
|
||||
visible = _this$props3.visible,
|
||||
align = _this$props3.align,
|
||||
destroyPopupOnHide = _this$props3.destroyPopupOnHide,
|
||||
onMouseEnter = _this$props3.onMouseEnter,
|
||||
onMouseLeave = _this$props3.onMouseLeave,
|
||||
onMouseDown = _this$props3.onMouseDown,
|
||||
onTouchStart = _this$props3.onTouchStart,
|
||||
children = _this$props3.children;
|
||||
var mergedClassName = classNames(prefixCls, className, alignClassName);
|
||||
var hiddenClassName = "".concat(prefixCls, "-hidden"); // ================== Style ==================
|
||||
|
||||
var sizeStyle = {};
|
||||
|
||||
if (stretch) {
|
||||
// Stretch with target
|
||||
if (stretch.indexOf('height') !== -1) {
|
||||
sizeStyle.height = targetHeight;
|
||||
} else if (stretch.indexOf('minHeight') !== -1) {
|
||||
sizeStyle.minHeight = targetHeight;
|
||||
}
|
||||
|
||||
if (stretch.indexOf('width') !== -1) {
|
||||
sizeStyle.width = targetWidth;
|
||||
} else if (stretch.indexOf('minWidth') !== -1) {
|
||||
sizeStyle.minWidth = targetWidth;
|
||||
}
|
||||
}
|
||||
|
||||
var mergedStyle = _objectSpread({}, sizeStyle, {}, _this.getZIndexStyle(), {}, style, {
|
||||
opacity: status === 'stable' || !visible ? undefined : 0
|
||||
}); // ================= Motions =================
|
||||
|
||||
|
||||
var mergedMotion = _this.getMotion();
|
||||
|
||||
var mergedMotionVisible = visible;
|
||||
|
||||
if (visible && status !== 'beforeMotion' && status !== 'motion' && status !== 'stable') {
|
||||
mergedMotion.motionAppear = false;
|
||||
mergedMotion.motionEnter = false;
|
||||
mergedMotion.motionLeave = false;
|
||||
}
|
||||
|
||||
if (status === 'afterAlign' || status === 'beforeMotion') {
|
||||
mergedMotionVisible = false;
|
||||
} // ================== Align ==================
|
||||
|
||||
|
||||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'aligned' && status !== 'stable'; // ================== Popup ==================
|
||||
|
||||
var mergedPopupVisible = true;
|
||||
|
||||
if (status === 'stable') {
|
||||
mergedPopupVisible = visible;
|
||||
} // Only remove popup since mask may still need animation
|
||||
|
||||
|
||||
if (destroyPopupOnHide && !mergedPopupVisible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return React.createElement(CSSMotion, Object.assign({
|
||||
visible: mergedMotionVisible
|
||||
}, mergedMotion, {
|
||||
removeOnLeave: false,
|
||||
onEnterEnd: _this.onMotionEnd,
|
||||
onLeaveEnd: _this.onMotionEnd
|
||||
}), function (_ref, motionRef) {
|
||||
var motionStyle = _ref.style,
|
||||
motionClassName = _ref.className;
|
||||
return React.createElement(Align, {
|
||||
target: _this.getAlignTarget(),
|
||||
key: "popup",
|
||||
ref: _this.alignRef,
|
||||
monitorWindowResize: true,
|
||||
disabled: mergedAlignDisabled,
|
||||
align: align,
|
||||
onAlign: _this.onAlign
|
||||
}, React.createElement(PopupInner, {
|
||||
prefixCls: prefixCls,
|
||||
visible: mergedPopupVisible,
|
||||
hiddenClassName: hiddenClassName,
|
||||
className: classNames(mergedClassName, motionClassName),
|
||||
ref: composeRef(motionRef, _this.popupRef),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onMouseDown: onMouseDown,
|
||||
onTouchStart: onTouchStart,
|
||||
style: _objectSpread({}, mergedStyle, {}, motionStyle)
|
||||
}, children));
|
||||
});
|
||||
};
|
||||
|
||||
_this.renderMaskElement = function () {
|
||||
var _this$props4 = _this.props,
|
||||
mask = _this$props4.mask,
|
||||
maskMotion = _this$props4.maskMotion,
|
||||
maskTransitionName = _this$props4.maskTransitionName,
|
||||
maskAnimation = _this$props4.maskAnimation,
|
||||
prefixCls = _this$props4.prefixCls,
|
||||
visible = _this$props4.visible;
|
||||
|
||||
if (!mask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var motion = {};
|
||||
|
||||
if (maskMotion && maskMotion.motionName) {
|
||||
motion = _objectSpread({
|
||||
motionAppear: true
|
||||
}, getMotion({
|
||||
motion: maskMotion,
|
||||
prefixCls: prefixCls,
|
||||
transitionName: maskTransitionName,
|
||||
animation: maskAnimation
|
||||
}));
|
||||
}
|
||||
|
||||
return React.createElement(CSSMotion, Object.assign({}, motion, {
|
||||
visible: visible,
|
||||
removeOnLeave: true
|
||||
}), function (_ref2) {
|
||||
var className = _ref2.className;
|
||||
return React.createElement("div", {
|
||||
style: _this.getZIndexStyle(),
|
||||
key: "mask",
|
||||
className: classNames("".concat(prefixCls, "-mask"), className)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Popup, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var status = this.state.status;
|
||||
var _this$props5 = this.props,
|
||||
getRootDomNode = _this$props5.getRootDomNode,
|
||||
visible = _this$props5.visible,
|
||||
stretch = _this$props5.stretch; // If there is a pending state update, cancel it, a new one will be set if necessary
|
||||
|
||||
this.cancelFrameState();
|
||||
|
||||
if (visible && status !== 'stable') {
|
||||
switch (status) {
|
||||
case null:
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: stretch ? 'measure' : 'align'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'afterAlign':
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: supportMotion(this.getMotion()) ? 'beforeMotion' : 'stable'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AfterMotion':
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: 'stable'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// Go to next status
|
||||
var queue = ['measure', 'align', null, 'beforeMotion', 'motion'];
|
||||
var index = queue.indexOf(status);
|
||||
var nextStatus = queue[index + 1];
|
||||
|
||||
if (index !== -1 && nextStatus) {
|
||||
this.setStateOnNextFrame({
|
||||
status: nextStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Measure stretch size
|
||||
|
||||
|
||||
if (status === 'measure') {
|
||||
var $ele = getRootDomNode();
|
||||
|
||||
if ($ele) {
|
||||
this.setStateOnNextFrame({
|
||||
targetHeight: $ele.offsetHeight,
|
||||
targetWidth: $ele.offsetWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.cancelFrameState();
|
||||
}
|
||||
}, {
|
||||
key: "getZIndexStyle",
|
||||
value: function getZIndexStyle() {
|
||||
var zIndex = this.props.zIndex;
|
||||
return {
|
||||
zIndex: zIndex
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return React.createElement("div", null, this.renderMaskElement(), this.renderPopupElement());
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(_ref3, _ref4) {
|
||||
var visible = _ref3.visible,
|
||||
props = _objectWithoutProperties(_ref3, ["visible"]);
|
||||
|
||||
var prevVisible = _ref4.prevVisible,
|
||||
status = _ref4.status;
|
||||
var newState = {
|
||||
prevVisible: visible,
|
||||
status: status
|
||||
};
|
||||
var mergedMotion = getMotion(props);
|
||||
|
||||
if (prevVisible === null && visible === false) {
|
||||
// Init render should always be stable
|
||||
newState.status = 'stable';
|
||||
} else if (visible !== prevVisible) {
|
||||
if (visible || supportMotion(mergedMotion) && ['motion', 'AfterMotion', 'stable'].includes(status)) {
|
||||
newState.status = null;
|
||||
} else {
|
||||
newState.status = 'stable';
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
newState.alignClassName = null;
|
||||
}
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Popup;
|
||||
}(Component);
|
||||
|
||||
export default Popup;
|
||||
/* eslint-enable */
|
||||
15
web/node_modules/rc-trigger/es/PopupInner.d.ts
generated
vendored
Normal file
15
web/node_modules/rc-trigger/es/PopupInner.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
interface PopupInnerProps {
|
||||
prefixCls: string;
|
||||
className: string;
|
||||
hiddenClassName?: string;
|
||||
visible?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
|
||||
}
|
||||
declare const RefPopupInner: React.ForwardRefExoticComponent<PopupInnerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
export default RefPopupInner;
|
||||
35
web/node_modules/rc-trigger/es/PopupInner.js
generated
vendored
Normal file
35
web/node_modules/rc-trigger/es/PopupInner.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
var PopupInner = function PopupInner(props, ref) {
|
||||
var prefixCls = props.prefixCls,
|
||||
className = props.className,
|
||||
visible = props.visible,
|
||||
style = props.style,
|
||||
children = props.children,
|
||||
onMouseEnter = props.onMouseEnter,
|
||||
onMouseLeave = props.onMouseLeave,
|
||||
onMouseDown = props.onMouseDown,
|
||||
onTouchStart = props.onTouchStart;
|
||||
var childNode = children;
|
||||
|
||||
if (React.Children.count(children) > 1) {
|
||||
childNode = React.createElement("div", {
|
||||
className: "".concat(prefixCls, "-content")
|
||||
}, children);
|
||||
}
|
||||
|
||||
return React.createElement("div", {
|
||||
ref: ref,
|
||||
className: classNames(className, !visible && "".concat(props.hiddenClassName)),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onMouseDown: onMouseDown,
|
||||
onTouchStart: onTouchStart,
|
||||
style: style
|
||||
}, childNode);
|
||||
};
|
||||
|
||||
var RefPopupInner = React.forwardRef(PopupInner);
|
||||
RefPopupInner.displayName = 'PopupInner';
|
||||
export default RefPopupInner;
|
||||
6
web/node_modules/rc-trigger/es/context.d.ts
generated
vendored
Normal file
6
web/node_modules/rc-trigger/es/context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
interface TriggerContextProps {
|
||||
onPopupMouseDown: React.MouseEventHandler<HTMLElement>;
|
||||
}
|
||||
declare const TriggerContext: React.Context<TriggerContextProps>;
|
||||
export default TriggerContext;
|
||||
3
web/node_modules/rc-trigger/es/context.js
generated
vendored
Normal file
3
web/node_modules/rc-trigger/es/context.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
var TriggerContext = React.createContext(null);
|
||||
export default TriggerContext;
|
||||
59
web/node_modules/rc-trigger/es/index.d.ts
generated
vendored
Normal file
59
web/node_modules/rc-trigger/es/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import React from 'react';
|
||||
import { ActionType, AlignType, BuildInPlacements, TransitionNameType, AnimationType, MotionType } from './interface';
|
||||
export interface TriggerProps {
|
||||
children: React.ReactElement;
|
||||
action?: ActionType | ActionType[];
|
||||
showAction?: ActionType[];
|
||||
hideAction?: ActionType[];
|
||||
getPopupClassNameFromAlign?: (align: AlignType) => string;
|
||||
onPopupVisibleChange?: (visible: boolean) => void;
|
||||
afterPopupVisibleChange?: (visible: boolean) => void;
|
||||
popup: React.ReactNode | (() => React.ReactNode);
|
||||
popupStyle?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
popupClassName?: string;
|
||||
className?: string;
|
||||
popupPlacement?: string;
|
||||
builtinPlacements?: BuildInPlacements;
|
||||
mouseEnterDelay?: number;
|
||||
mouseLeaveDelay?: number;
|
||||
zIndex?: number;
|
||||
focusDelay?: number;
|
||||
blurDelay?: number;
|
||||
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
||||
getDocument?: () => HTMLDocument;
|
||||
forceRender?: boolean;
|
||||
destroyPopupOnHide?: boolean;
|
||||
mask?: boolean;
|
||||
maskClosable?: boolean;
|
||||
onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
|
||||
popupAlign?: AlignType;
|
||||
popupVisible?: boolean;
|
||||
defaultPopupVisible?: boolean;
|
||||
stretch?: string;
|
||||
alignPoint?: boolean;
|
||||
/** Set popup motion. You can ref `rc-animate` for more info. */
|
||||
popupMotion?: MotionType;
|
||||
/** Set mask motion. You can ref `rc-animate` for more info. */
|
||||
maskMotion?: MotionType;
|
||||
/** @deprecated Please us `popupMotion` instead. */
|
||||
popupTransitionName?: TransitionNameType;
|
||||
/** @deprecated Please us `popupMotion` instead. */
|
||||
popupAnimation?: AnimationType;
|
||||
/** @deprecated Please us `maskMotion` instead. */
|
||||
maskTransitionName?: TransitionNameType;
|
||||
/** @deprecated Please us `maskMotion` instead. */
|
||||
maskAnimation?: string;
|
||||
/**
|
||||
* @private Get trigger DOM node.
|
||||
* Used for some component is function component which can not access by `findDOMNode`
|
||||
*/
|
||||
getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
|
||||
}
|
||||
/**
|
||||
* Internal usage. Do not use in your code since this will be removed.
|
||||
*/
|
||||
export declare function generateTrigger(PortalComponent: any): React.ComponentClass<TriggerProps>;
|
||||
export { BuildInPlacements };
|
||||
declare const _default: React.ComponentClass<TriggerProps, any>;
|
||||
export default _default;
|
||||
749
web/node_modules/rc-trigger/es/index.js
generated
vendored
Normal file
749
web/node_modules/rc-trigger/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,749 @@
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import contains from "rc-util/es/Dom/contains";
|
||||
import findDOMNode from "rc-util/es/Dom/findDOMNode";
|
||||
import { composeRef, supportRef } from "rc-util/es/ref";
|
||||
import addEventListener from "rc-util/es/Dom/addEventListener";
|
||||
import Portal from "rc-util/es/Portal";
|
||||
import classNames from 'classnames';
|
||||
import { getAlignFromPlacement, getAlignPopupClassName } from './utils/alignUtil';
|
||||
import Popup from './Popup';
|
||||
import TriggerContext from './context';
|
||||
|
||||
function noop() {}
|
||||
|
||||
function returnEmptyString() {
|
||||
return '';
|
||||
}
|
||||
|
||||
function returnDocument() {
|
||||
return window.document;
|
||||
}
|
||||
|
||||
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];
|
||||
/**
|
||||
* Internal usage. Do not use in your code since this will be removed.
|
||||
*/
|
||||
|
||||
export function generateTrigger(PortalComponent) {
|
||||
var Trigger =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Trigger, _React$Component);
|
||||
|
||||
function Trigger(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Trigger);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Trigger).call(this, props));
|
||||
_this.popupRef = React.createRef();
|
||||
_this.triggerRef = React.createRef();
|
||||
|
||||
_this.onMouseEnter = function (e) {
|
||||
var mouseEnterDelay = _this.props.mouseEnterDelay;
|
||||
|
||||
_this.fireEvents('onMouseEnter', e);
|
||||
|
||||
_this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);
|
||||
};
|
||||
|
||||
_this.onMouseMove = function (e) {
|
||||
_this.fireEvents('onMouseMove', e);
|
||||
|
||||
_this.setPoint(e);
|
||||
};
|
||||
|
||||
_this.onMouseLeave = function (e) {
|
||||
_this.fireEvents('onMouseLeave', e);
|
||||
|
||||
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
||||
};
|
||||
|
||||
_this.onPopupMouseEnter = function () {
|
||||
_this.clearDelayTimer();
|
||||
};
|
||||
|
||||
_this.onPopupMouseLeave = function (e) {
|
||||
// https://github.com/react-component/trigger/pull/13
|
||||
// react bug?
|
||||
if (e.relatedTarget && !e.relatedTarget.setTimeout && _this.popupRef.current && _this.popupRef.current.popupRef.current && contains(_this.popupRef.current.popupRef.current, e.relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
||||
};
|
||||
|
||||
_this.onFocus = function (e) {
|
||||
_this.fireEvents('onFocus', e); // incase focusin and focusout
|
||||
|
||||
|
||||
_this.clearDelayTimer();
|
||||
|
||||
if (_this.isFocusToShow()) {
|
||||
_this.focusTime = Date.now();
|
||||
|
||||
_this.delaySetPopupVisible(true, _this.props.focusDelay);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseDown = function (e) {
|
||||
_this.fireEvents('onMouseDown', e);
|
||||
|
||||
_this.preClickTime = Date.now();
|
||||
};
|
||||
|
||||
_this.onTouchStart = function (e) {
|
||||
_this.fireEvents('onTouchStart', e);
|
||||
|
||||
_this.preTouchTime = Date.now();
|
||||
};
|
||||
|
||||
_this.onBlur = function (e) {
|
||||
_this.fireEvents('onBlur', e);
|
||||
|
||||
_this.clearDelayTimer();
|
||||
|
||||
if (_this.isBlurToHide()) {
|
||||
_this.delaySetPopupVisible(false, _this.props.blurDelay);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onContextMenu = function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
_this.fireEvents('onContextMenu', e);
|
||||
|
||||
_this.setPopupVisible(true, e);
|
||||
};
|
||||
|
||||
_this.onContextMenuClose = function () {
|
||||
if (_this.isContextMenuToShow()) {
|
||||
_this.close();
|
||||
}
|
||||
};
|
||||
|
||||
_this.onClick = function (event) {
|
||||
_this.fireEvents('onClick', event); // focus will trigger click
|
||||
|
||||
|
||||
if (_this.focusTime) {
|
||||
var preTime;
|
||||
|
||||
if (_this.preClickTime && _this.preTouchTime) {
|
||||
preTime = Math.min(_this.preClickTime, _this.preTouchTime);
|
||||
} else if (_this.preClickTime) {
|
||||
preTime = _this.preClickTime;
|
||||
} else if (_this.preTouchTime) {
|
||||
preTime = _this.preTouchTime;
|
||||
}
|
||||
|
||||
if (Math.abs(preTime - _this.focusTime) < 20) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.focusTime = 0;
|
||||
}
|
||||
|
||||
_this.preClickTime = 0;
|
||||
_this.preTouchTime = 0; // Only prevent default when all the action is click.
|
||||
// https://github.com/ant-design/ant-design/issues/17043
|
||||
// https://github.com/ant-design/ant-design/issues/17291
|
||||
|
||||
if (_this.isClickToShow() && (_this.isClickToHide() || _this.isBlurToHide()) && event && event.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
var nextVisible = !_this.state.popupVisible;
|
||||
|
||||
if (_this.isClickToHide() && !nextVisible || nextVisible && _this.isClickToShow()) {
|
||||
_this.setPopupVisible(!_this.state.popupVisible, event);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onPopupMouseDown = function () {
|
||||
_this.hasPopupMouseDown = true;
|
||||
clearTimeout(_this.mouseDownTimeout);
|
||||
_this.mouseDownTimeout = window.setTimeout(function () {
|
||||
_this.hasPopupMouseDown = false;
|
||||
}, 0);
|
||||
|
||||
if (_this.context) {
|
||||
var _this$context;
|
||||
|
||||
(_this$context = _this.context).onPopupMouseDown.apply(_this$context, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onDocumentClick = function (event) {
|
||||
if (_this.props.mask && !_this.props.maskClosable) {
|
||||
return;
|
||||
}
|
||||
|
||||
var target = event.target;
|
||||
|
||||
var root = _this.getRootDomNode();
|
||||
|
||||
var popupNode = _this.getPopupDomNode();
|
||||
|
||||
if (!contains(root, target) && !contains(popupNode, target) && !_this.hasPopupMouseDown) {
|
||||
_this.close();
|
||||
}
|
||||
};
|
||||
|
||||
_this.getRootDomNode = function () {
|
||||
var getTriggerDOMNode = _this.props.getTriggerDOMNode;
|
||||
|
||||
if (getTriggerDOMNode) {
|
||||
return getTriggerDOMNode(_this.triggerRef.current);
|
||||
}
|
||||
|
||||
try {
|
||||
var domNode = findDOMNode(_this.triggerRef.current);
|
||||
|
||||
if (domNode) {
|
||||
return domNode;
|
||||
}
|
||||
} catch (err) {// Do nothing
|
||||
}
|
||||
|
||||
return ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
||||
};
|
||||
|
||||
_this.getPopupClassNameFromAlign = function (align) {
|
||||
var className = [];
|
||||
var _this$props = _this.props,
|
||||
popupPlacement = _this$props.popupPlacement,
|
||||
builtinPlacements = _this$props.builtinPlacements,
|
||||
prefixCls = _this$props.prefixCls,
|
||||
alignPoint = _this$props.alignPoint,
|
||||
getPopupClassNameFromAlign = _this$props.getPopupClassNameFromAlign;
|
||||
|
||||
if (popupPlacement && builtinPlacements) {
|
||||
className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint));
|
||||
}
|
||||
|
||||
if (getPopupClassNameFromAlign) {
|
||||
className.push(getPopupClassNameFromAlign(align));
|
||||
}
|
||||
|
||||
return className.join(' ');
|
||||
};
|
||||
|
||||
_this.getComponent = function () {
|
||||
var _this$props2 = _this.props,
|
||||
prefixCls = _this$props2.prefixCls,
|
||||
destroyPopupOnHide = _this$props2.destroyPopupOnHide,
|
||||
popupClassName = _this$props2.popupClassName,
|
||||
onPopupAlign = _this$props2.onPopupAlign,
|
||||
popupMotion = _this$props2.popupMotion,
|
||||
popupAnimation = _this$props2.popupAnimation,
|
||||
popupTransitionName = _this$props2.popupTransitionName,
|
||||
popupStyle = _this$props2.popupStyle,
|
||||
mask = _this$props2.mask,
|
||||
maskAnimation = _this$props2.maskAnimation,
|
||||
maskTransitionName = _this$props2.maskTransitionName,
|
||||
maskMotion = _this$props2.maskMotion,
|
||||
zIndex = _this$props2.zIndex,
|
||||
popup = _this$props2.popup,
|
||||
stretch = _this$props2.stretch,
|
||||
alignPoint = _this$props2.alignPoint;
|
||||
var _this$state = _this.state,
|
||||
popupVisible = _this$state.popupVisible,
|
||||
point = _this$state.point;
|
||||
|
||||
var align = _this.getPopupAlign();
|
||||
|
||||
var mouseProps = {};
|
||||
|
||||
if (_this.isMouseEnterToShow()) {
|
||||
mouseProps.onMouseEnter = _this.onPopupMouseEnter;
|
||||
}
|
||||
|
||||
if (_this.isMouseLeaveToHide()) {
|
||||
mouseProps.onMouseLeave = _this.onPopupMouseLeave;
|
||||
}
|
||||
|
||||
mouseProps.onMouseDown = _this.onPopupMouseDown;
|
||||
mouseProps.onTouchStart = _this.onPopupMouseDown;
|
||||
return React.createElement(Popup, Object.assign({
|
||||
prefixCls: prefixCls,
|
||||
destroyPopupOnHide: destroyPopupOnHide,
|
||||
visible: popupVisible,
|
||||
point: alignPoint && point,
|
||||
className: popupClassName,
|
||||
align: align,
|
||||
onAlign: onPopupAlign,
|
||||
animation: popupAnimation,
|
||||
getClassNameFromAlign: _this.getPopupClassNameFromAlign
|
||||
}, mouseProps, {
|
||||
stretch: stretch,
|
||||
getRootDomNode: _this.getRootDomNode,
|
||||
style: popupStyle,
|
||||
mask: mask,
|
||||
zIndex: zIndex,
|
||||
transitionName: popupTransitionName,
|
||||
maskAnimation: maskAnimation,
|
||||
maskTransitionName: maskTransitionName,
|
||||
maskMotion: maskMotion,
|
||||
ref: _this.popupRef,
|
||||
motion: popupMotion
|
||||
}), typeof popup === 'function' ? popup() : popup);
|
||||
};
|
||||
|
||||
_this.getContainer = function () {
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize.props;
|
||||
|
||||
var popupContainer = document.createElement('div'); // Make sure default popup container will never cause scrollbar appearing
|
||||
// https://github.com/react-component/trigger/issues/41
|
||||
|
||||
popupContainer.style.position = 'absolute';
|
||||
popupContainer.style.top = '0';
|
||||
popupContainer.style.left = '0';
|
||||
popupContainer.style.width = '100%';
|
||||
var mountNode = props.getPopupContainer ? props.getPopupContainer(_this.getRootDomNode()) : props.getDocument().body;
|
||||
mountNode.appendChild(popupContainer);
|
||||
return popupContainer;
|
||||
};
|
||||
|
||||
_this.setPoint = function (point) {
|
||||
var alignPoint = _this.props.alignPoint;
|
||||
if (!alignPoint || !point) return;
|
||||
|
||||
_this.setState({
|
||||
point: {
|
||||
pageX: point.pageX,
|
||||
pageY: point.pageY
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_this.handlePortalUpdate = function () {
|
||||
if (_this.state.prevPopupVisible !== _this.state.popupVisible) {
|
||||
_this.props.afterPopupVisibleChange(_this.state.popupVisible);
|
||||
}
|
||||
};
|
||||
|
||||
var popupVisible;
|
||||
|
||||
if ('popupVisible' in props) {
|
||||
popupVisible = !!props.popupVisible;
|
||||
} else {
|
||||
popupVisible = !!props.defaultPopupVisible;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
prevPopupVisible: popupVisible,
|
||||
popupVisible: popupVisible
|
||||
};
|
||||
ALL_HANDLERS.forEach(function (h) {
|
||||
_this["fire".concat(h)] = function (e) {
|
||||
_this.fireEvents(h, e);
|
||||
};
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Trigger, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var props = this.props;
|
||||
var state = this.state; // We must listen to `mousedown` or `touchstart`, edge case:
|
||||
// https://github.com/ant-design/ant-design/issues/5804
|
||||
// https://github.com/react-component/calendar/issues/250
|
||||
// https://github.com/react-component/trigger/issues/50
|
||||
|
||||
if (state.popupVisible) {
|
||||
var currentDocument;
|
||||
|
||||
if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {
|
||||
currentDocument = props.getDocument();
|
||||
this.clickOutsideHandler = addEventListener(currentDocument, 'mousedown', this.onDocumentClick);
|
||||
} // always hide on mobile
|
||||
|
||||
|
||||
if (!this.touchOutsideHandler) {
|
||||
currentDocument = currentDocument || props.getDocument();
|
||||
this.touchOutsideHandler = addEventListener(currentDocument, 'touchstart', this.onDocumentClick);
|
||||
} // close popup when trigger type contains 'onContextMenu' and document is scrolling.
|
||||
|
||||
|
||||
if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {
|
||||
currentDocument = currentDocument || props.getDocument();
|
||||
this.contextMenuOutsideHandler1 = addEventListener(currentDocument, 'scroll', this.onContextMenuClose);
|
||||
} // close popup when trigger type contains 'onContextMenu' and window is blur.
|
||||
|
||||
|
||||
if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {
|
||||
this.contextMenuOutsideHandler2 = addEventListener(window, 'blur', this.onContextMenuClose);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearOutsideHandler();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.clearDelayTimer();
|
||||
this.clearOutsideHandler();
|
||||
clearTimeout(this.mouseDownTimeout);
|
||||
}
|
||||
}, {
|
||||
key: "getPopupDomNode",
|
||||
value: function getPopupDomNode() {
|
||||
// for test
|
||||
if (this.popupRef.current && this.popupRef.current.popupRef.current) {
|
||||
return this.popupRef.current.popupRef.current;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "getPopupAlign",
|
||||
value: function getPopupAlign() {
|
||||
var props = this.props;
|
||||
var popupPlacement = props.popupPlacement,
|
||||
popupAlign = props.popupAlign,
|
||||
builtinPlacements = props.builtinPlacements;
|
||||
|
||||
if (popupPlacement && builtinPlacements) {
|
||||
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
|
||||
}
|
||||
|
||||
return popupAlign;
|
||||
}
|
||||
/**
|
||||
* @param popupVisible Show or not the popup element
|
||||
* @param event SyntheticEvent, used for `pointAlign`
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "setPopupVisible",
|
||||
value: function setPopupVisible(popupVisible, event) {
|
||||
var alignPoint = this.props.alignPoint;
|
||||
var prevPopupVisible = this.state.popupVisible;
|
||||
this.clearDelayTimer();
|
||||
|
||||
if (prevPopupVisible !== popupVisible) {
|
||||
if (!('popupVisible' in this.props)) {
|
||||
this.setState({
|
||||
popupVisible: popupVisible,
|
||||
prevPopupVisible: prevPopupVisible
|
||||
});
|
||||
}
|
||||
|
||||
this.props.onPopupVisibleChange(popupVisible);
|
||||
} // Always record the point position since mouseEnterDelay will delay the show
|
||||
|
||||
|
||||
if (alignPoint && event) {
|
||||
this.setPoint(event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "delaySetPopupVisible",
|
||||
value: function delaySetPopupVisible(visible, delayS, event) {
|
||||
var _this2 = this;
|
||||
|
||||
var delay = delayS * 1000;
|
||||
this.clearDelayTimer();
|
||||
|
||||
if (delay) {
|
||||
var point = event ? {
|
||||
pageX: event.pageX,
|
||||
pageY: event.pageY
|
||||
} : null;
|
||||
this.delayTimer = window.setTimeout(function () {
|
||||
_this2.setPopupVisible(visible, point);
|
||||
|
||||
_this2.clearDelayTimer();
|
||||
}, delay);
|
||||
} else {
|
||||
this.setPopupVisible(visible, event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clearDelayTimer",
|
||||
value: function clearDelayTimer() {
|
||||
if (this.delayTimer) {
|
||||
clearTimeout(this.delayTimer);
|
||||
this.delayTimer = null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clearOutsideHandler",
|
||||
value: function clearOutsideHandler() {
|
||||
if (this.clickOutsideHandler) {
|
||||
this.clickOutsideHandler.remove();
|
||||
this.clickOutsideHandler = null;
|
||||
}
|
||||
|
||||
if (this.contextMenuOutsideHandler1) {
|
||||
this.contextMenuOutsideHandler1.remove();
|
||||
this.contextMenuOutsideHandler1 = null;
|
||||
}
|
||||
|
||||
if (this.contextMenuOutsideHandler2) {
|
||||
this.contextMenuOutsideHandler2.remove();
|
||||
this.contextMenuOutsideHandler2 = null;
|
||||
}
|
||||
|
||||
if (this.touchOutsideHandler) {
|
||||
this.touchOutsideHandler.remove();
|
||||
this.touchOutsideHandler = null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "createTwoChains",
|
||||
value: function createTwoChains(event) {
|
||||
var childPros = this.props.children.props;
|
||||
var props = this.props;
|
||||
|
||||
if (childPros[event] && props[event]) {
|
||||
return this["fire".concat(event)];
|
||||
}
|
||||
|
||||
return childPros[event] || props[event];
|
||||
}
|
||||
}, {
|
||||
key: "isClickToShow",
|
||||
value: function isClickToShow() {
|
||||
var _this$props3 = this.props,
|
||||
action = _this$props3.action,
|
||||
showAction = _this$props3.showAction;
|
||||
return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isContextMenuToShow",
|
||||
value: function isContextMenuToShow() {
|
||||
var _this$props4 = this.props,
|
||||
action = _this$props4.action,
|
||||
showAction = _this$props4.showAction;
|
||||
return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isClickToHide",
|
||||
value: function isClickToHide() {
|
||||
var _this$props5 = this.props,
|
||||
action = _this$props5.action,
|
||||
hideAction = _this$props5.hideAction;
|
||||
return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isMouseEnterToShow",
|
||||
value: function isMouseEnterToShow() {
|
||||
var _this$props6 = this.props,
|
||||
action = _this$props6.action,
|
||||
showAction = _this$props6.showAction;
|
||||
return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isMouseLeaveToHide",
|
||||
value: function isMouseLeaveToHide() {
|
||||
var _this$props7 = this.props,
|
||||
action = _this$props7.action,
|
||||
hideAction = _this$props7.hideAction;
|
||||
return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isFocusToShow",
|
||||
value: function isFocusToShow() {
|
||||
var _this$props8 = this.props,
|
||||
action = _this$props8.action,
|
||||
showAction = _this$props8.showAction;
|
||||
return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isBlurToHide",
|
||||
value: function isBlurToHide() {
|
||||
var _this$props9 = this.props,
|
||||
action = _this$props9.action,
|
||||
hideAction = _this$props9.hideAction;
|
||||
return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "forcePopupAlign",
|
||||
value: function forcePopupAlign() {
|
||||
if (this.state.popupVisible && this.popupRef.current && this.popupRef.current.alignRef.current) {
|
||||
this.popupRef.current.alignRef.current.forceAlign();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "fireEvents",
|
||||
value: function fireEvents(type, e) {
|
||||
var childCallback = this.props.children.props[type];
|
||||
|
||||
if (childCallback) {
|
||||
childCallback(e);
|
||||
}
|
||||
|
||||
var callback = this.props[type];
|
||||
|
||||
if (callback) {
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "close",
|
||||
value: function close() {
|
||||
this.setPopupVisible(false);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var popupVisible = this.state.popupVisible;
|
||||
var _this$props10 = this.props,
|
||||
children = _this$props10.children,
|
||||
forceRender = _this$props10.forceRender,
|
||||
alignPoint = _this$props10.alignPoint,
|
||||
className = _this$props10.className;
|
||||
var child = React.Children.only(children);
|
||||
var newChildProps = {
|
||||
key: 'trigger'
|
||||
};
|
||||
|
||||
if (this.isContextMenuToShow()) {
|
||||
newChildProps.onContextMenu = this.onContextMenu;
|
||||
} else {
|
||||
newChildProps.onContextMenu = this.createTwoChains('onContextMenu');
|
||||
}
|
||||
|
||||
if (this.isClickToHide() || this.isClickToShow()) {
|
||||
newChildProps.onClick = this.onClick;
|
||||
newChildProps.onMouseDown = this.onMouseDown;
|
||||
newChildProps.onTouchStart = this.onTouchStart;
|
||||
} else {
|
||||
newChildProps.onClick = this.createTwoChains('onClick');
|
||||
newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
|
||||
newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
|
||||
}
|
||||
|
||||
if (this.isMouseEnterToShow()) {
|
||||
newChildProps.onMouseEnter = this.onMouseEnter;
|
||||
|
||||
if (alignPoint) {
|
||||
newChildProps.onMouseMove = this.onMouseMove;
|
||||
}
|
||||
} else {
|
||||
newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
|
||||
}
|
||||
|
||||
if (this.isMouseLeaveToHide()) {
|
||||
newChildProps.onMouseLeave = this.onMouseLeave;
|
||||
} else {
|
||||
newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
|
||||
}
|
||||
|
||||
if (this.isFocusToShow() || this.isBlurToHide()) {
|
||||
newChildProps.onFocus = this.onFocus;
|
||||
newChildProps.onBlur = this.onBlur;
|
||||
} else {
|
||||
newChildProps.onFocus = this.createTwoChains('onFocus');
|
||||
newChildProps.onBlur = this.createTwoChains('onBlur');
|
||||
}
|
||||
|
||||
var childrenClassName = classNames(child && child.props && child.props.className, className);
|
||||
|
||||
if (childrenClassName) {
|
||||
newChildProps.className = childrenClassName;
|
||||
}
|
||||
|
||||
var cloneProps = _objectSpread({}, newChildProps);
|
||||
|
||||
if (supportRef(child)) {
|
||||
cloneProps.ref = composeRef(this.triggerRef, child.ref);
|
||||
}
|
||||
|
||||
var trigger = React.cloneElement(child, cloneProps);
|
||||
var portal; // prevent unmounting after it's rendered
|
||||
|
||||
if (popupVisible || this.popupRef.current || forceRender) {
|
||||
portal = React.createElement(PortalComponent, {
|
||||
key: "portal",
|
||||
getContainer: this.getContainer,
|
||||
didUpdate: this.handlePortalUpdate
|
||||
}, this.getComponent());
|
||||
}
|
||||
|
||||
return React.createElement(TriggerContext.Provider, {
|
||||
value: {
|
||||
onPopupMouseDown: this.onPopupMouseDown
|
||||
}
|
||||
}, trigger, portal);
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(_ref, prevState) {
|
||||
var popupVisible = _ref.popupVisible;
|
||||
var newState = {};
|
||||
|
||||
if (popupVisible !== undefined && prevState.popupVisible !== popupVisible) {
|
||||
newState.popupVisible = popupVisible;
|
||||
newState.prevPopupVisible = prevState.popupVisible;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Trigger;
|
||||
}(React.Component);
|
||||
|
||||
Trigger.contextType = TriggerContext;
|
||||
Trigger.defaultProps = {
|
||||
prefixCls: 'rc-trigger-popup',
|
||||
getPopupClassNameFromAlign: returnEmptyString,
|
||||
getDocument: returnDocument,
|
||||
onPopupVisibleChange: noop,
|
||||
afterPopupVisibleChange: noop,
|
||||
onPopupAlign: noop,
|
||||
popupClassName: '',
|
||||
mouseEnterDelay: 0,
|
||||
mouseLeaveDelay: 0.1,
|
||||
focusDelay: 0,
|
||||
blurDelay: 0.15,
|
||||
popupStyle: {},
|
||||
destroyPopupOnHide: false,
|
||||
popupAlign: {},
|
||||
defaultPopupVisible: false,
|
||||
mask: false,
|
||||
maskClosable: true,
|
||||
action: [],
|
||||
showAction: [],
|
||||
hideAction: []
|
||||
};
|
||||
return Trigger;
|
||||
}
|
||||
export default generateTrigger(Portal);
|
||||
89
web/node_modules/rc-trigger/es/interface.d.ts
generated
vendored
Normal file
89
web/node_modules/rc-trigger/es/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/// <reference types="react" />
|
||||
/** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
|
||||
export declare type AlignPoint = string;
|
||||
export interface AlignType {
|
||||
/**
|
||||
* move point of source node to align with point of target node.
|
||||
* Such as ['tr','cc'], align top right point of source node with center point of target node.
|
||||
* Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
|
||||
points?: AlignPoint[];
|
||||
/**
|
||||
* offset source node by offset[0] in x and offset[1] in y.
|
||||
* If offset contains percentage string value, it is relative to sourceNode region.
|
||||
*/
|
||||
offset?: number[];
|
||||
/**
|
||||
* offset target node by offset[0] in x and offset[1] in y.
|
||||
* If targetOffset contains percentage string value, it is relative to targetNode region.
|
||||
*/
|
||||
targetOffset?: number[];
|
||||
/**
|
||||
* If adjustX field is true, will adjust source node in x direction if source node is invisible.
|
||||
* If adjustY field is true, will adjust source node in y direction if source node is invisible.
|
||||
*/
|
||||
overflow?: {
|
||||
adjustX?: boolean | number;
|
||||
adjustY?: boolean | number;
|
||||
};
|
||||
/**
|
||||
* Whether use css right instead of left to position
|
||||
*/
|
||||
useCssRight?: boolean;
|
||||
/**
|
||||
* Whether use css bottom instead of top to position
|
||||
*/
|
||||
useCssBottom?: boolean;
|
||||
/**
|
||||
* Whether use css transform instead of left/top/right/bottom to position if browser supports.
|
||||
* Defaults to false.
|
||||
*/
|
||||
useCssTransform?: boolean;
|
||||
ignoreShake?: boolean;
|
||||
}
|
||||
export interface BuildInPlacements {
|
||||
[placement: string]: AlignType;
|
||||
}
|
||||
export declare type StretchType = string;
|
||||
export declare type ActionType = string;
|
||||
export declare type AnimationType = string;
|
||||
export declare type TransitionNameType = string;
|
||||
export interface Point {
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
export interface CommonEventHandler {
|
||||
remove: () => void;
|
||||
}
|
||||
declare type MotionStatus = 'none' | 'appear' | 'enter' | 'leave';
|
||||
declare type MotionActiveStatus = 'appear-active' | 'enter-active' | 'leave-active';
|
||||
declare type MotionNameObject = {
|
||||
[key in MotionStatus | MotionActiveStatus]?: string;
|
||||
};
|
||||
declare type MotionEventHandler = (element: HTMLElement, event: React.TransitionEvent<HTMLElement> | React.AnimationEvent<HTMLElement> | undefined) => React.CSSProperties | false | null | undefined | void;
|
||||
export interface MotionType {
|
||||
motionName?: string | MotionNameObject;
|
||||
motionAppear?: boolean;
|
||||
motionEnter?: boolean;
|
||||
motionLeave?: boolean;
|
||||
motionLeaveImmediately?: boolean;
|
||||
removeOnLeave?: boolean;
|
||||
leavedClassName?: string;
|
||||
onAppearStart?: MotionEventHandler;
|
||||
onAppearActive?: MotionEventHandler;
|
||||
onAppearEnd?: MotionEventHandler;
|
||||
onEnterStart?: MotionEventHandler;
|
||||
onEnterActive?: MotionEventHandler;
|
||||
onEnterEnd?: MotionEventHandler;
|
||||
onLeaveStart?: MotionEventHandler;
|
||||
onLeaveActive?: MotionEventHandler;
|
||||
onLeaveEnd?: MotionEventHandler;
|
||||
}
|
||||
export interface MotionProps extends MotionType {
|
||||
visible?: boolean;
|
||||
children: (props: {
|
||||
className: string;
|
||||
style: React.CSSProperties;
|
||||
}, ref: React.Ref<any>) => React.ReactElement;
|
||||
}
|
||||
export declare type CSSMotionClass = React.ComponentClass<MotionProps>;
|
||||
export {};
|
||||
0
web/node_modules/rc-trigger/es/interface.js
generated
vendored
Normal file
0
web/node_modules/rc-trigger/es/interface.js
generated
vendored
Normal file
3
web/node_modules/rc-trigger/es/mock.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-trigger/es/mock.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const _default: React.ComponentClass<import(".").TriggerProps, any>;
|
||||
export default _default;
|
||||
15
web/node_modules/rc-trigger/es/mock.js
generated
vendored
Normal file
15
web/node_modules/rc-trigger/es/mock.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { generateTrigger } from './index';
|
||||
|
||||
var MockPortal = function MockPortal(_ref) {
|
||||
var didUpdate = _ref.didUpdate,
|
||||
children = _ref.children,
|
||||
getContainer = _ref.getContainer;
|
||||
React.useEffect(function () {
|
||||
didUpdate();
|
||||
getContainer();
|
||||
});
|
||||
return children;
|
||||
};
|
||||
|
||||
export default generateTrigger(MockPortal);
|
||||
3
web/node_modules/rc-trigger/es/utils/alignUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-trigger/es/utils/alignUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AlignType, BuildInPlacements } from '../interface';
|
||||
export declare function getAlignFromPlacement(builtinPlacements: BuildInPlacements, placementStr: string, align: AlignType): AlignType;
|
||||
export declare function getAlignPopupClassName(builtinPlacements: BuildInPlacements, prefixCls: string, align: AlignType, isAlignPoint: boolean): string;
|
||||
32
web/node_modules/rc-trigger/es/utils/alignUtil.js
generated
vendored
Normal file
32
web/node_modules/rc-trigger/es/utils/alignUtil.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function isPointsEq(a1, a2, isAlignPoint) {
|
||||
if (isAlignPoint) {
|
||||
return a1[0] === a2[0];
|
||||
}
|
||||
|
||||
return a1[0] === a2[0] && a1[1] === a2[1];
|
||||
}
|
||||
|
||||
export function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
||||
var baseAlign = builtinPlacements[placementStr] || {};
|
||||
return _objectSpread({}, baseAlign, {}, align);
|
||||
}
|
||||
export function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
||||
var points = align.points;
|
||||
var placements = Object.keys(builtinPlacements);
|
||||
|
||||
for (var i = 0; i < placements.length; i += 1) {
|
||||
var placement = placements[i];
|
||||
|
||||
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
||||
return "".concat(prefixCls, "-placement-").concat(placement);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
9
web/node_modules/rc-trigger/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-trigger/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MotionType, AnimationType, TransitionNameType } from '../interface';
|
||||
interface GetMotionProps {
|
||||
motion: MotionType;
|
||||
animation: AnimationType;
|
||||
transitionName: TransitionNameType;
|
||||
prefixCls: string;
|
||||
}
|
||||
export declare function getMotion({ prefixCls, motion, animation, transitionName, }: GetMotionProps): MotionType;
|
||||
export {};
|
||||
24
web/node_modules/rc-trigger/es/utils/legacyUtil.js
generated
vendored
Normal file
24
web/node_modules/rc-trigger/es/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
export function getMotion(_ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
motion = _ref.motion,
|
||||
animation = _ref.animation,
|
||||
transitionName = _ref.transitionName;
|
||||
|
||||
if (motion) {
|
||||
return motion;
|
||||
}
|
||||
|
||||
if (animation) {
|
||||
return {
|
||||
motionName: "".concat(prefixCls, "-").concat(animation)
|
||||
};
|
||||
}
|
||||
|
||||
if (transitionName) {
|
||||
return {
|
||||
motionName: transitionName
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
96
web/node_modules/rc-trigger/lib/Popup.d.ts
generated
vendored
Normal file
96
web/node_modules/rc-trigger/lib/Popup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import React, { Component } from 'react';
|
||||
import { StretchType, AlignType, TransitionNameType, AnimationType, Point, MotionType } from './interface';
|
||||
/**
|
||||
* Popup should follow the steps for each component work correctly:
|
||||
* measure - check for the current stretch size
|
||||
* align - let component align the position
|
||||
* aligned - re-align again in case additional className changed the size
|
||||
* afterAlign - choice next step is trigger motion or finished
|
||||
* beforeMotion - should reset motion to invisible so that CSSMotion can do normal motion
|
||||
* motion - play the motion
|
||||
* stable - everything is done
|
||||
*/
|
||||
declare type PopupStatus = null | 'measure' | 'align' | 'aligned' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable';
|
||||
interface PopupProps {
|
||||
visible?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
getClassNameFromAlign?: (align: AlignType) => string;
|
||||
onAlign?: (element: HTMLElement, align: AlignType) => void;
|
||||
getRootDomNode?: () => HTMLElement;
|
||||
align?: AlignType;
|
||||
destroyPopupOnHide?: boolean;
|
||||
className?: string;
|
||||
prefixCls: string;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
||||
onTouchStart?: React.TouchEventHandler<HTMLElement>;
|
||||
stretch?: StretchType;
|
||||
children?: React.ReactNode;
|
||||
point?: Point;
|
||||
zIndex?: number;
|
||||
mask?: boolean;
|
||||
motion: MotionType;
|
||||
maskMotion: MotionType;
|
||||
animation: AnimationType;
|
||||
transitionName: TransitionNameType;
|
||||
maskAnimation: AnimationType;
|
||||
maskTransitionName: TransitionNameType;
|
||||
}
|
||||
interface PopupState {
|
||||
targetWidth: number;
|
||||
targetHeight: number;
|
||||
status: PopupStatus;
|
||||
prevVisible: boolean;
|
||||
alignClassName: string;
|
||||
}
|
||||
interface AlignRefType {
|
||||
forceAlign: () => void;
|
||||
}
|
||||
declare class Popup extends Component<PopupProps, PopupState> {
|
||||
state: PopupState;
|
||||
popupRef: React.RefObject<HTMLDivElement>;
|
||||
alignRef: React.RefObject<AlignRefType>;
|
||||
private nextFrameState;
|
||||
private nextFrameId;
|
||||
static getDerivedStateFromProps({ visible, ...props }: PopupProps, { prevVisible, status }: PopupState): Partial<PopupState>;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
componentWillUnmount(): void;
|
||||
onAlign: (popupDomNode: HTMLElement, align: AlignType) => void;
|
||||
onMotionEnd: () => void;
|
||||
setStateOnNextFrame: (state: Partial<PopupState>) => void;
|
||||
getMotion: () => {
|
||||
motionName?: string | {
|
||||
none?: string;
|
||||
enter?: string;
|
||||
appear?: string;
|
||||
leave?: string;
|
||||
"appear-active"?: string;
|
||||
"enter-active"?: string;
|
||||
"leave-active"?: string;
|
||||
};
|
||||
motionAppear?: boolean;
|
||||
motionEnter?: boolean;
|
||||
motionLeave?: boolean;
|
||||
motionLeaveImmediately?: boolean;
|
||||
removeOnLeave?: boolean;
|
||||
leavedClassName?: string;
|
||||
onAppearStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onAppearActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onAppearEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onEnterEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveStart?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveActive?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
onLeaveEnd?: (element: HTMLElement, event: React.AnimationEvent<HTMLElement> | React.TransitionEvent<HTMLElement>) => false | void | React.CSSProperties;
|
||||
};
|
||||
getAlignTarget: () => Point | (() => HTMLElement);
|
||||
getZIndexStyle(): React.CSSProperties;
|
||||
cancelFrameState: () => void;
|
||||
renderPopupElement: () => JSX.Element;
|
||||
renderMaskElement: () => JSX.Element;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Popup;
|
||||
431
web/node_modules/rc-trigger/lib/Popup.js
generated
vendored
Normal file
431
web/node_modules/rc-trigger/lib/Popup.js
generated
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _raf = _interopRequireDefault(require("raf"));
|
||||
|
||||
var _rcAlign = _interopRequireDefault(require("rc-align"));
|
||||
|
||||
var _ref5 = require("rc-util/lib/ref");
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _CSSMotion = _interopRequireDefault(require("rc-animate/lib/CSSMotion"));
|
||||
|
||||
var _PopupInner = _interopRequireDefault(require("./PopupInner"));
|
||||
|
||||
var _legacyUtil = require("./utils/legacyUtil");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var CSSMotion = _CSSMotion.default;
|
||||
|
||||
function supportMotion(motion) {
|
||||
return motion && motion.motionName;
|
||||
}
|
||||
|
||||
var Popup =
|
||||
/*#__PURE__*/
|
||||
function (_Component) {
|
||||
_inherits(Popup, _Component);
|
||||
|
||||
function Popup() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Popup);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Popup).apply(this, arguments));
|
||||
_this.state = {
|
||||
targetWidth: undefined,
|
||||
targetHeight: undefined,
|
||||
status: null,
|
||||
prevVisible: null,
|
||||
alignClassName: null
|
||||
};
|
||||
_this.popupRef = _react.default.createRef();
|
||||
_this.alignRef = _react.default.createRef();
|
||||
_this.nextFrameState = null;
|
||||
_this.nextFrameId = null;
|
||||
|
||||
_this.onAlign = function (popupDomNode, align) {
|
||||
var status = _this.state.status;
|
||||
var _this$props = _this.props,
|
||||
getClassNameFromAlign = _this$props.getClassNameFromAlign,
|
||||
onAlign = _this$props.onAlign;
|
||||
var alignClassName = getClassNameFromAlign(align);
|
||||
|
||||
if (status === 'align') {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName,
|
||||
status: 'aligned'
|
||||
}, function () {
|
||||
_this.alignRef.current.forceAlign();
|
||||
});
|
||||
} else if (status === 'aligned') {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName,
|
||||
status: 'afterAlign'
|
||||
});
|
||||
|
||||
onAlign(popupDomNode, align);
|
||||
} else {
|
||||
_this.setState({
|
||||
alignClassName: alignClassName
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMotionEnd = function () {
|
||||
var visible = _this.props.visible;
|
||||
|
||||
_this.setState({
|
||||
status: visible ? 'AfterMotion' : 'stable'
|
||||
});
|
||||
};
|
||||
|
||||
_this.setStateOnNextFrame = function (state) {
|
||||
_this.cancelFrameState();
|
||||
|
||||
_this.nextFrameState = _objectSpread({}, _this.nextFrameState, {}, state);
|
||||
_this.nextFrameId = (0, _raf.default)(function () {
|
||||
var submitState = _objectSpread({}, _this.nextFrameState);
|
||||
|
||||
_this.nextFrameState = null;
|
||||
|
||||
_this.setState(submitState);
|
||||
});
|
||||
};
|
||||
|
||||
_this.getMotion = function () {
|
||||
return _objectSpread({}, (0, _legacyUtil.getMotion)(_this.props));
|
||||
}; // `target` on `rc-align` can accept as a function to get the bind element or a point.
|
||||
// ref: https://www.npmjs.com/package/rc-align
|
||||
|
||||
|
||||
_this.getAlignTarget = function () {
|
||||
var _this$props2 = _this.props,
|
||||
point = _this$props2.point,
|
||||
getRootDomNode = _this$props2.getRootDomNode;
|
||||
|
||||
if (point) {
|
||||
return point;
|
||||
}
|
||||
|
||||
return getRootDomNode;
|
||||
};
|
||||
|
||||
_this.cancelFrameState = function () {
|
||||
_raf.default.cancel(_this.nextFrameId);
|
||||
};
|
||||
|
||||
_this.renderPopupElement = function () {
|
||||
var _this$state = _this.state,
|
||||
status = _this$state.status,
|
||||
targetHeight = _this$state.targetHeight,
|
||||
targetWidth = _this$state.targetWidth,
|
||||
alignClassName = _this$state.alignClassName;
|
||||
var _this$props3 = _this.props,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
className = _this$props3.className,
|
||||
style = _this$props3.style,
|
||||
stretch = _this$props3.stretch,
|
||||
visible = _this$props3.visible,
|
||||
align = _this$props3.align,
|
||||
destroyPopupOnHide = _this$props3.destroyPopupOnHide,
|
||||
onMouseEnter = _this$props3.onMouseEnter,
|
||||
onMouseLeave = _this$props3.onMouseLeave,
|
||||
onMouseDown = _this$props3.onMouseDown,
|
||||
onTouchStart = _this$props3.onTouchStart,
|
||||
children = _this$props3.children;
|
||||
var mergedClassName = (0, _classnames.default)(prefixCls, className, alignClassName);
|
||||
var hiddenClassName = "".concat(prefixCls, "-hidden"); // ================== Style ==================
|
||||
|
||||
var sizeStyle = {};
|
||||
|
||||
if (stretch) {
|
||||
// Stretch with target
|
||||
if (stretch.indexOf('height') !== -1) {
|
||||
sizeStyle.height = targetHeight;
|
||||
} else if (stretch.indexOf('minHeight') !== -1) {
|
||||
sizeStyle.minHeight = targetHeight;
|
||||
}
|
||||
|
||||
if (stretch.indexOf('width') !== -1) {
|
||||
sizeStyle.width = targetWidth;
|
||||
} else if (stretch.indexOf('minWidth') !== -1) {
|
||||
sizeStyle.minWidth = targetWidth;
|
||||
}
|
||||
}
|
||||
|
||||
var mergedStyle = _objectSpread({}, sizeStyle, {}, _this.getZIndexStyle(), {}, style, {
|
||||
opacity: status === 'stable' || !visible ? undefined : 0
|
||||
}); // ================= Motions =================
|
||||
|
||||
|
||||
var mergedMotion = _this.getMotion();
|
||||
|
||||
var mergedMotionVisible = visible;
|
||||
|
||||
if (visible && status !== 'beforeMotion' && status !== 'motion' && status !== 'stable') {
|
||||
mergedMotion.motionAppear = false;
|
||||
mergedMotion.motionEnter = false;
|
||||
mergedMotion.motionLeave = false;
|
||||
}
|
||||
|
||||
if (status === 'afterAlign' || status === 'beforeMotion') {
|
||||
mergedMotionVisible = false;
|
||||
} // ================== Align ==================
|
||||
|
||||
|
||||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'aligned' && status !== 'stable'; // ================== Popup ==================
|
||||
|
||||
var mergedPopupVisible = true;
|
||||
|
||||
if (status === 'stable') {
|
||||
mergedPopupVisible = visible;
|
||||
} // Only remove popup since mask may still need animation
|
||||
|
||||
|
||||
if (destroyPopupOnHide && !mergedPopupVisible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _react.default.createElement(CSSMotion, Object.assign({
|
||||
visible: mergedMotionVisible
|
||||
}, mergedMotion, {
|
||||
removeOnLeave: false,
|
||||
onEnterEnd: _this.onMotionEnd,
|
||||
onLeaveEnd: _this.onMotionEnd
|
||||
}), function (_ref, motionRef) {
|
||||
var motionStyle = _ref.style,
|
||||
motionClassName = _ref.className;
|
||||
return _react.default.createElement(_rcAlign.default, {
|
||||
target: _this.getAlignTarget(),
|
||||
key: "popup",
|
||||
ref: _this.alignRef,
|
||||
monitorWindowResize: true,
|
||||
disabled: mergedAlignDisabled,
|
||||
align: align,
|
||||
onAlign: _this.onAlign
|
||||
}, _react.default.createElement(_PopupInner.default, {
|
||||
prefixCls: prefixCls,
|
||||
visible: mergedPopupVisible,
|
||||
hiddenClassName: hiddenClassName,
|
||||
className: (0, _classnames.default)(mergedClassName, motionClassName),
|
||||
ref: (0, _ref5.composeRef)(motionRef, _this.popupRef),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onMouseDown: onMouseDown,
|
||||
onTouchStart: onTouchStart,
|
||||
style: _objectSpread({}, mergedStyle, {}, motionStyle)
|
||||
}, children));
|
||||
});
|
||||
};
|
||||
|
||||
_this.renderMaskElement = function () {
|
||||
var _this$props4 = _this.props,
|
||||
mask = _this$props4.mask,
|
||||
maskMotion = _this$props4.maskMotion,
|
||||
maskTransitionName = _this$props4.maskTransitionName,
|
||||
maskAnimation = _this$props4.maskAnimation,
|
||||
prefixCls = _this$props4.prefixCls,
|
||||
visible = _this$props4.visible;
|
||||
|
||||
if (!mask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var motion = {};
|
||||
|
||||
if (maskMotion && maskMotion.motionName) {
|
||||
motion = _objectSpread({
|
||||
motionAppear: true
|
||||
}, (0, _legacyUtil.getMotion)({
|
||||
motion: maskMotion,
|
||||
prefixCls: prefixCls,
|
||||
transitionName: maskTransitionName,
|
||||
animation: maskAnimation
|
||||
}));
|
||||
}
|
||||
|
||||
return _react.default.createElement(CSSMotion, Object.assign({}, motion, {
|
||||
visible: visible,
|
||||
removeOnLeave: true
|
||||
}), function (_ref2) {
|
||||
var className = _ref2.className;
|
||||
return _react.default.createElement("div", {
|
||||
style: _this.getZIndexStyle(),
|
||||
key: "mask",
|
||||
className: (0, _classnames.default)("".concat(prefixCls, "-mask"), className)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Popup, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var status = this.state.status;
|
||||
var _this$props5 = this.props,
|
||||
getRootDomNode = _this$props5.getRootDomNode,
|
||||
visible = _this$props5.visible,
|
||||
stretch = _this$props5.stretch; // If there is a pending state update, cancel it, a new one will be set if necessary
|
||||
|
||||
this.cancelFrameState();
|
||||
|
||||
if (visible && status !== 'stable') {
|
||||
switch (status) {
|
||||
case null:
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: stretch ? 'measure' : 'align'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'afterAlign':
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: supportMotion(this.getMotion()) ? 'beforeMotion' : 'stable'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AfterMotion':
|
||||
{
|
||||
this.setStateOnNextFrame({
|
||||
status: 'stable'
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// Go to next status
|
||||
var queue = ['measure', 'align', null, 'beforeMotion', 'motion'];
|
||||
var index = queue.indexOf(status);
|
||||
var nextStatus = queue[index + 1];
|
||||
|
||||
if (index !== -1 && nextStatus) {
|
||||
this.setStateOnNextFrame({
|
||||
status: nextStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} // Measure stretch size
|
||||
|
||||
|
||||
if (status === 'measure') {
|
||||
var $ele = getRootDomNode();
|
||||
|
||||
if ($ele) {
|
||||
this.setStateOnNextFrame({
|
||||
targetHeight: $ele.offsetHeight,
|
||||
targetWidth: $ele.offsetWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.cancelFrameState();
|
||||
}
|
||||
}, {
|
||||
key: "getZIndexStyle",
|
||||
value: function getZIndexStyle() {
|
||||
var zIndex = this.props.zIndex;
|
||||
return {
|
||||
zIndex: zIndex
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return _react.default.createElement("div", null, this.renderMaskElement(), this.renderPopupElement());
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(_ref3, _ref4) {
|
||||
var visible = _ref3.visible,
|
||||
props = _objectWithoutProperties(_ref3, ["visible"]);
|
||||
|
||||
var prevVisible = _ref4.prevVisible,
|
||||
status = _ref4.status;
|
||||
var newState = {
|
||||
prevVisible: visible,
|
||||
status: status
|
||||
};
|
||||
var mergedMotion = (0, _legacyUtil.getMotion)(props);
|
||||
|
||||
if (prevVisible === null && visible === false) {
|
||||
// Init render should always be stable
|
||||
newState.status = 'stable';
|
||||
} else if (visible !== prevVisible) {
|
||||
if (visible || supportMotion(mergedMotion) && ['motion', 'AfterMotion', 'stable'].includes(status)) {
|
||||
newState.status = null;
|
||||
} else {
|
||||
newState.status = 'stable';
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
newState.alignClassName = null;
|
||||
}
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Popup;
|
||||
}(_react.Component);
|
||||
|
||||
var _default = Popup;
|
||||
/* eslint-enable */
|
||||
|
||||
exports.default = _default;
|
||||
15
web/node_modules/rc-trigger/lib/PopupInner.d.ts
generated
vendored
Normal file
15
web/node_modules/rc-trigger/lib/PopupInner.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
interface PopupInnerProps {
|
||||
prefixCls: string;
|
||||
className: string;
|
||||
hiddenClassName?: string;
|
||||
visible?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onTouchStart?: React.TouchEventHandler<HTMLDivElement>;
|
||||
}
|
||||
declare const RefPopupInner: React.ForwardRefExoticComponent<PopupInnerProps & React.RefAttributes<HTMLDivElement>>;
|
||||
export default RefPopupInner;
|
||||
47
web/node_modules/rc-trigger/lib/PopupInner.js
generated
vendored
Normal file
47
web/node_modules/rc-trigger/lib/PopupInner.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var PopupInner = function PopupInner(props, ref) {
|
||||
var prefixCls = props.prefixCls,
|
||||
className = props.className,
|
||||
visible = props.visible,
|
||||
style = props.style,
|
||||
children = props.children,
|
||||
onMouseEnter = props.onMouseEnter,
|
||||
onMouseLeave = props.onMouseLeave,
|
||||
onMouseDown = props.onMouseDown,
|
||||
onTouchStart = props.onTouchStart;
|
||||
var childNode = children;
|
||||
|
||||
if (_react.default.Children.count(children) > 1) {
|
||||
childNode = _react.default.createElement("div", {
|
||||
className: "".concat(prefixCls, "-content")
|
||||
}, children);
|
||||
}
|
||||
|
||||
return _react.default.createElement("div", {
|
||||
ref: ref,
|
||||
className: (0, _classnames.default)(className, !visible && "".concat(props.hiddenClassName)),
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onMouseDown: onMouseDown,
|
||||
onTouchStart: onTouchStart,
|
||||
style: style
|
||||
}, childNode);
|
||||
};
|
||||
|
||||
var RefPopupInner = _react.default.forwardRef(PopupInner);
|
||||
|
||||
RefPopupInner.displayName = 'PopupInner';
|
||||
var _default = RefPopupInner;
|
||||
exports.default = _default;
|
||||
6
web/node_modules/rc-trigger/lib/context.d.ts
generated
vendored
Normal file
6
web/node_modules/rc-trigger/lib/context.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
interface TriggerContextProps {
|
||||
onPopupMouseDown: React.MouseEventHandler<HTMLElement>;
|
||||
}
|
||||
declare const TriggerContext: React.Context<TriggerContextProps>;
|
||||
export default TriggerContext;
|
||||
15
web/node_modules/rc-trigger/lib/context.js
generated
vendored
Normal file
15
web/node_modules/rc-trigger/lib/context.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var TriggerContext = _react.default.createContext(null);
|
||||
|
||||
var _default = TriggerContext;
|
||||
exports.default = _default;
|
||||
59
web/node_modules/rc-trigger/lib/index.d.ts
generated
vendored
Normal file
59
web/node_modules/rc-trigger/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import React from 'react';
|
||||
import { ActionType, AlignType, BuildInPlacements, TransitionNameType, AnimationType, MotionType } from './interface';
|
||||
export interface TriggerProps {
|
||||
children: React.ReactElement;
|
||||
action?: ActionType | ActionType[];
|
||||
showAction?: ActionType[];
|
||||
hideAction?: ActionType[];
|
||||
getPopupClassNameFromAlign?: (align: AlignType) => string;
|
||||
onPopupVisibleChange?: (visible: boolean) => void;
|
||||
afterPopupVisibleChange?: (visible: boolean) => void;
|
||||
popup: React.ReactNode | (() => React.ReactNode);
|
||||
popupStyle?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
popupClassName?: string;
|
||||
className?: string;
|
||||
popupPlacement?: string;
|
||||
builtinPlacements?: BuildInPlacements;
|
||||
mouseEnterDelay?: number;
|
||||
mouseLeaveDelay?: number;
|
||||
zIndex?: number;
|
||||
focusDelay?: number;
|
||||
blurDelay?: number;
|
||||
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
||||
getDocument?: () => HTMLDocument;
|
||||
forceRender?: boolean;
|
||||
destroyPopupOnHide?: boolean;
|
||||
mask?: boolean;
|
||||
maskClosable?: boolean;
|
||||
onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
|
||||
popupAlign?: AlignType;
|
||||
popupVisible?: boolean;
|
||||
defaultPopupVisible?: boolean;
|
||||
stretch?: string;
|
||||
alignPoint?: boolean;
|
||||
/** Set popup motion. You can ref `rc-animate` for more info. */
|
||||
popupMotion?: MotionType;
|
||||
/** Set mask motion. You can ref `rc-animate` for more info. */
|
||||
maskMotion?: MotionType;
|
||||
/** @deprecated Please us `popupMotion` instead. */
|
||||
popupTransitionName?: TransitionNameType;
|
||||
/** @deprecated Please us `popupMotion` instead. */
|
||||
popupAnimation?: AnimationType;
|
||||
/** @deprecated Please us `maskMotion` instead. */
|
||||
maskTransitionName?: TransitionNameType;
|
||||
/** @deprecated Please us `maskMotion` instead. */
|
||||
maskAnimation?: string;
|
||||
/**
|
||||
* @private Get trigger DOM node.
|
||||
* Used for some component is function component which can not access by `findDOMNode`
|
||||
*/
|
||||
getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
|
||||
}
|
||||
/**
|
||||
* Internal usage. Do not use in your code since this will be removed.
|
||||
*/
|
||||
export declare function generateTrigger(PortalComponent: any): React.ComponentClass<TriggerProps>;
|
||||
export { BuildInPlacements };
|
||||
declare const _default: React.ComponentClass<TriggerProps, any>;
|
||||
export default _default;
|
||||
775
web/node_modules/rc-trigger/lib/index.js
generated
vendored
Normal file
775
web/node_modules/rc-trigger/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,775 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.generateTrigger = generateTrigger;
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
|
||||
var _contains = _interopRequireDefault(require("rc-util/lib/Dom/contains"));
|
||||
|
||||
var _findDOMNode = _interopRequireDefault(require("rc-util/lib/Dom/findDOMNode"));
|
||||
|
||||
var _ref2 = require("rc-util/lib/ref");
|
||||
|
||||
var _addEventListener = _interopRequireDefault(require("rc-util/lib/Dom/addEventListener"));
|
||||
|
||||
var _Portal = _interopRequireDefault(require("rc-util/lib/Portal"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _alignUtil = require("./utils/alignUtil");
|
||||
|
||||
var _Popup = _interopRequireDefault(require("./Popup"));
|
||||
|
||||
var _context = _interopRequireDefault(require("./context"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function noop() {}
|
||||
|
||||
function returnEmptyString() {
|
||||
return '';
|
||||
}
|
||||
|
||||
function returnDocument() {
|
||||
return window.document;
|
||||
}
|
||||
|
||||
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];
|
||||
/**
|
||||
* Internal usage. Do not use in your code since this will be removed.
|
||||
*/
|
||||
|
||||
function generateTrigger(PortalComponent) {
|
||||
var Trigger =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Trigger, _React$Component);
|
||||
|
||||
function Trigger(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Trigger);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Trigger).call(this, props));
|
||||
_this.popupRef = _react.default.createRef();
|
||||
_this.triggerRef = _react.default.createRef();
|
||||
|
||||
_this.onMouseEnter = function (e) {
|
||||
var mouseEnterDelay = _this.props.mouseEnterDelay;
|
||||
|
||||
_this.fireEvents('onMouseEnter', e);
|
||||
|
||||
_this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);
|
||||
};
|
||||
|
||||
_this.onMouseMove = function (e) {
|
||||
_this.fireEvents('onMouseMove', e);
|
||||
|
||||
_this.setPoint(e);
|
||||
};
|
||||
|
||||
_this.onMouseLeave = function (e) {
|
||||
_this.fireEvents('onMouseLeave', e);
|
||||
|
||||
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
||||
};
|
||||
|
||||
_this.onPopupMouseEnter = function () {
|
||||
_this.clearDelayTimer();
|
||||
};
|
||||
|
||||
_this.onPopupMouseLeave = function (e) {
|
||||
// https://github.com/react-component/trigger/pull/13
|
||||
// react bug?
|
||||
if (e.relatedTarget && !e.relatedTarget.setTimeout && _this.popupRef.current && _this.popupRef.current.popupRef.current && (0, _contains.default)(_this.popupRef.current.popupRef.current, e.relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
||||
};
|
||||
|
||||
_this.onFocus = function (e) {
|
||||
_this.fireEvents('onFocus', e); // incase focusin and focusout
|
||||
|
||||
|
||||
_this.clearDelayTimer();
|
||||
|
||||
if (_this.isFocusToShow()) {
|
||||
_this.focusTime = Date.now();
|
||||
|
||||
_this.delaySetPopupVisible(true, _this.props.focusDelay);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseDown = function (e) {
|
||||
_this.fireEvents('onMouseDown', e);
|
||||
|
||||
_this.preClickTime = Date.now();
|
||||
};
|
||||
|
||||
_this.onTouchStart = function (e) {
|
||||
_this.fireEvents('onTouchStart', e);
|
||||
|
||||
_this.preTouchTime = Date.now();
|
||||
};
|
||||
|
||||
_this.onBlur = function (e) {
|
||||
_this.fireEvents('onBlur', e);
|
||||
|
||||
_this.clearDelayTimer();
|
||||
|
||||
if (_this.isBlurToHide()) {
|
||||
_this.delaySetPopupVisible(false, _this.props.blurDelay);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onContextMenu = function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
_this.fireEvents('onContextMenu', e);
|
||||
|
||||
_this.setPopupVisible(true, e);
|
||||
};
|
||||
|
||||
_this.onContextMenuClose = function () {
|
||||
if (_this.isContextMenuToShow()) {
|
||||
_this.close();
|
||||
}
|
||||
};
|
||||
|
||||
_this.onClick = function (event) {
|
||||
_this.fireEvents('onClick', event); // focus will trigger click
|
||||
|
||||
|
||||
if (_this.focusTime) {
|
||||
var preTime;
|
||||
|
||||
if (_this.preClickTime && _this.preTouchTime) {
|
||||
preTime = Math.min(_this.preClickTime, _this.preTouchTime);
|
||||
} else if (_this.preClickTime) {
|
||||
preTime = _this.preClickTime;
|
||||
} else if (_this.preTouchTime) {
|
||||
preTime = _this.preTouchTime;
|
||||
}
|
||||
|
||||
if (Math.abs(preTime - _this.focusTime) < 20) {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.focusTime = 0;
|
||||
}
|
||||
|
||||
_this.preClickTime = 0;
|
||||
_this.preTouchTime = 0; // Only prevent default when all the action is click.
|
||||
// https://github.com/ant-design/ant-design/issues/17043
|
||||
// https://github.com/ant-design/ant-design/issues/17291
|
||||
|
||||
if (_this.isClickToShow() && (_this.isClickToHide() || _this.isBlurToHide()) && event && event.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
var nextVisible = !_this.state.popupVisible;
|
||||
|
||||
if (_this.isClickToHide() && !nextVisible || nextVisible && _this.isClickToShow()) {
|
||||
_this.setPopupVisible(!_this.state.popupVisible, event);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onPopupMouseDown = function () {
|
||||
_this.hasPopupMouseDown = true;
|
||||
clearTimeout(_this.mouseDownTimeout);
|
||||
_this.mouseDownTimeout = window.setTimeout(function () {
|
||||
_this.hasPopupMouseDown = false;
|
||||
}, 0);
|
||||
|
||||
if (_this.context) {
|
||||
var _this$context;
|
||||
|
||||
(_this$context = _this.context).onPopupMouseDown.apply(_this$context, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onDocumentClick = function (event) {
|
||||
if (_this.props.mask && !_this.props.maskClosable) {
|
||||
return;
|
||||
}
|
||||
|
||||
var target = event.target;
|
||||
|
||||
var root = _this.getRootDomNode();
|
||||
|
||||
var popupNode = _this.getPopupDomNode();
|
||||
|
||||
if (!(0, _contains.default)(root, target) && !(0, _contains.default)(popupNode, target) && !_this.hasPopupMouseDown) {
|
||||
_this.close();
|
||||
}
|
||||
};
|
||||
|
||||
_this.getRootDomNode = function () {
|
||||
var getTriggerDOMNode = _this.props.getTriggerDOMNode;
|
||||
|
||||
if (getTriggerDOMNode) {
|
||||
return getTriggerDOMNode(_this.triggerRef.current);
|
||||
}
|
||||
|
||||
try {
|
||||
var domNode = (0, _findDOMNode.default)(_this.triggerRef.current);
|
||||
|
||||
if (domNode) {
|
||||
return domNode;
|
||||
}
|
||||
} catch (err) {// Do nothing
|
||||
}
|
||||
|
||||
return _reactDom.default.findDOMNode(_assertThisInitialized(_this));
|
||||
};
|
||||
|
||||
_this.getPopupClassNameFromAlign = function (align) {
|
||||
var className = [];
|
||||
var _this$props = _this.props,
|
||||
popupPlacement = _this$props.popupPlacement,
|
||||
builtinPlacements = _this$props.builtinPlacements,
|
||||
prefixCls = _this$props.prefixCls,
|
||||
alignPoint = _this$props.alignPoint,
|
||||
getPopupClassNameFromAlign = _this$props.getPopupClassNameFromAlign;
|
||||
|
||||
if (popupPlacement && builtinPlacements) {
|
||||
className.push((0, _alignUtil.getAlignPopupClassName)(builtinPlacements, prefixCls, align, alignPoint));
|
||||
}
|
||||
|
||||
if (getPopupClassNameFromAlign) {
|
||||
className.push(getPopupClassNameFromAlign(align));
|
||||
}
|
||||
|
||||
return className.join(' ');
|
||||
};
|
||||
|
||||
_this.getComponent = function () {
|
||||
var _this$props2 = _this.props,
|
||||
prefixCls = _this$props2.prefixCls,
|
||||
destroyPopupOnHide = _this$props2.destroyPopupOnHide,
|
||||
popupClassName = _this$props2.popupClassName,
|
||||
onPopupAlign = _this$props2.onPopupAlign,
|
||||
popupMotion = _this$props2.popupMotion,
|
||||
popupAnimation = _this$props2.popupAnimation,
|
||||
popupTransitionName = _this$props2.popupTransitionName,
|
||||
popupStyle = _this$props2.popupStyle,
|
||||
mask = _this$props2.mask,
|
||||
maskAnimation = _this$props2.maskAnimation,
|
||||
maskTransitionName = _this$props2.maskTransitionName,
|
||||
maskMotion = _this$props2.maskMotion,
|
||||
zIndex = _this$props2.zIndex,
|
||||
popup = _this$props2.popup,
|
||||
stretch = _this$props2.stretch,
|
||||
alignPoint = _this$props2.alignPoint;
|
||||
var _this$state = _this.state,
|
||||
popupVisible = _this$state.popupVisible,
|
||||
point = _this$state.point;
|
||||
|
||||
var align = _this.getPopupAlign();
|
||||
|
||||
var mouseProps = {};
|
||||
|
||||
if (_this.isMouseEnterToShow()) {
|
||||
mouseProps.onMouseEnter = _this.onPopupMouseEnter;
|
||||
}
|
||||
|
||||
if (_this.isMouseLeaveToHide()) {
|
||||
mouseProps.onMouseLeave = _this.onPopupMouseLeave;
|
||||
}
|
||||
|
||||
mouseProps.onMouseDown = _this.onPopupMouseDown;
|
||||
mouseProps.onTouchStart = _this.onPopupMouseDown;
|
||||
return _react.default.createElement(_Popup.default, Object.assign({
|
||||
prefixCls: prefixCls,
|
||||
destroyPopupOnHide: destroyPopupOnHide,
|
||||
visible: popupVisible,
|
||||
point: alignPoint && point,
|
||||
className: popupClassName,
|
||||
align: align,
|
||||
onAlign: onPopupAlign,
|
||||
animation: popupAnimation,
|
||||
getClassNameFromAlign: _this.getPopupClassNameFromAlign
|
||||
}, mouseProps, {
|
||||
stretch: stretch,
|
||||
getRootDomNode: _this.getRootDomNode,
|
||||
style: popupStyle,
|
||||
mask: mask,
|
||||
zIndex: zIndex,
|
||||
transitionName: popupTransitionName,
|
||||
maskAnimation: maskAnimation,
|
||||
maskTransitionName: maskTransitionName,
|
||||
maskMotion: maskMotion,
|
||||
ref: _this.popupRef,
|
||||
motion: popupMotion
|
||||
}), typeof popup === 'function' ? popup() : popup);
|
||||
};
|
||||
|
||||
_this.getContainer = function () {
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize.props;
|
||||
|
||||
var popupContainer = document.createElement('div'); // Make sure default popup container will never cause scrollbar appearing
|
||||
// https://github.com/react-component/trigger/issues/41
|
||||
|
||||
popupContainer.style.position = 'absolute';
|
||||
popupContainer.style.top = '0';
|
||||
popupContainer.style.left = '0';
|
||||
popupContainer.style.width = '100%';
|
||||
var mountNode = props.getPopupContainer ? props.getPopupContainer(_this.getRootDomNode()) : props.getDocument().body;
|
||||
mountNode.appendChild(popupContainer);
|
||||
return popupContainer;
|
||||
};
|
||||
|
||||
_this.setPoint = function (point) {
|
||||
var alignPoint = _this.props.alignPoint;
|
||||
if (!alignPoint || !point) return;
|
||||
|
||||
_this.setState({
|
||||
point: {
|
||||
pageX: point.pageX,
|
||||
pageY: point.pageY
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_this.handlePortalUpdate = function () {
|
||||
if (_this.state.prevPopupVisible !== _this.state.popupVisible) {
|
||||
_this.props.afterPopupVisibleChange(_this.state.popupVisible);
|
||||
}
|
||||
};
|
||||
|
||||
var popupVisible;
|
||||
|
||||
if ('popupVisible' in props) {
|
||||
popupVisible = !!props.popupVisible;
|
||||
} else {
|
||||
popupVisible = !!props.defaultPopupVisible;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
prevPopupVisible: popupVisible,
|
||||
popupVisible: popupVisible
|
||||
};
|
||||
ALL_HANDLERS.forEach(function (h) {
|
||||
_this["fire".concat(h)] = function (e) {
|
||||
_this.fireEvents(h, e);
|
||||
};
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Trigger, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var props = this.props;
|
||||
var state = this.state; // We must listen to `mousedown` or `touchstart`, edge case:
|
||||
// https://github.com/ant-design/ant-design/issues/5804
|
||||
// https://github.com/react-component/calendar/issues/250
|
||||
// https://github.com/react-component/trigger/issues/50
|
||||
|
||||
if (state.popupVisible) {
|
||||
var currentDocument;
|
||||
|
||||
if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {
|
||||
currentDocument = props.getDocument();
|
||||
this.clickOutsideHandler = (0, _addEventListener.default)(currentDocument, 'mousedown', this.onDocumentClick);
|
||||
} // always hide on mobile
|
||||
|
||||
|
||||
if (!this.touchOutsideHandler) {
|
||||
currentDocument = currentDocument || props.getDocument();
|
||||
this.touchOutsideHandler = (0, _addEventListener.default)(currentDocument, 'touchstart', this.onDocumentClick);
|
||||
} // close popup when trigger type contains 'onContextMenu' and document is scrolling.
|
||||
|
||||
|
||||
if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {
|
||||
currentDocument = currentDocument || props.getDocument();
|
||||
this.contextMenuOutsideHandler1 = (0, _addEventListener.default)(currentDocument, 'scroll', this.onContextMenuClose);
|
||||
} // close popup when trigger type contains 'onContextMenu' and window is blur.
|
||||
|
||||
|
||||
if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {
|
||||
this.contextMenuOutsideHandler2 = (0, _addEventListener.default)(window, 'blur', this.onContextMenuClose);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearOutsideHandler();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.clearDelayTimer();
|
||||
this.clearOutsideHandler();
|
||||
clearTimeout(this.mouseDownTimeout);
|
||||
}
|
||||
}, {
|
||||
key: "getPopupDomNode",
|
||||
value: function getPopupDomNode() {
|
||||
// for test
|
||||
if (this.popupRef.current && this.popupRef.current.popupRef.current) {
|
||||
return this.popupRef.current.popupRef.current;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "getPopupAlign",
|
||||
value: function getPopupAlign() {
|
||||
var props = this.props;
|
||||
var popupPlacement = props.popupPlacement,
|
||||
popupAlign = props.popupAlign,
|
||||
builtinPlacements = props.builtinPlacements;
|
||||
|
||||
if (popupPlacement && builtinPlacements) {
|
||||
return (0, _alignUtil.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign);
|
||||
}
|
||||
|
||||
return popupAlign;
|
||||
}
|
||||
/**
|
||||
* @param popupVisible Show or not the popup element
|
||||
* @param event SyntheticEvent, used for `pointAlign`
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "setPopupVisible",
|
||||
value: function setPopupVisible(popupVisible, event) {
|
||||
var alignPoint = this.props.alignPoint;
|
||||
var prevPopupVisible = this.state.popupVisible;
|
||||
this.clearDelayTimer();
|
||||
|
||||
if (prevPopupVisible !== popupVisible) {
|
||||
if (!('popupVisible' in this.props)) {
|
||||
this.setState({
|
||||
popupVisible: popupVisible,
|
||||
prevPopupVisible: prevPopupVisible
|
||||
});
|
||||
}
|
||||
|
||||
this.props.onPopupVisibleChange(popupVisible);
|
||||
} // Always record the point position since mouseEnterDelay will delay the show
|
||||
|
||||
|
||||
if (alignPoint && event) {
|
||||
this.setPoint(event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "delaySetPopupVisible",
|
||||
value: function delaySetPopupVisible(visible, delayS, event) {
|
||||
var _this2 = this;
|
||||
|
||||
var delay = delayS * 1000;
|
||||
this.clearDelayTimer();
|
||||
|
||||
if (delay) {
|
||||
var point = event ? {
|
||||
pageX: event.pageX,
|
||||
pageY: event.pageY
|
||||
} : null;
|
||||
this.delayTimer = window.setTimeout(function () {
|
||||
_this2.setPopupVisible(visible, point);
|
||||
|
||||
_this2.clearDelayTimer();
|
||||
}, delay);
|
||||
} else {
|
||||
this.setPopupVisible(visible, event);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clearDelayTimer",
|
||||
value: function clearDelayTimer() {
|
||||
if (this.delayTimer) {
|
||||
clearTimeout(this.delayTimer);
|
||||
this.delayTimer = null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clearOutsideHandler",
|
||||
value: function clearOutsideHandler() {
|
||||
if (this.clickOutsideHandler) {
|
||||
this.clickOutsideHandler.remove();
|
||||
this.clickOutsideHandler = null;
|
||||
}
|
||||
|
||||
if (this.contextMenuOutsideHandler1) {
|
||||
this.contextMenuOutsideHandler1.remove();
|
||||
this.contextMenuOutsideHandler1 = null;
|
||||
}
|
||||
|
||||
if (this.contextMenuOutsideHandler2) {
|
||||
this.contextMenuOutsideHandler2.remove();
|
||||
this.contextMenuOutsideHandler2 = null;
|
||||
}
|
||||
|
||||
if (this.touchOutsideHandler) {
|
||||
this.touchOutsideHandler.remove();
|
||||
this.touchOutsideHandler = null;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "createTwoChains",
|
||||
value: function createTwoChains(event) {
|
||||
var childPros = this.props.children.props;
|
||||
var props = this.props;
|
||||
|
||||
if (childPros[event] && props[event]) {
|
||||
return this["fire".concat(event)];
|
||||
}
|
||||
|
||||
return childPros[event] || props[event];
|
||||
}
|
||||
}, {
|
||||
key: "isClickToShow",
|
||||
value: function isClickToShow() {
|
||||
var _this$props3 = this.props,
|
||||
action = _this$props3.action,
|
||||
showAction = _this$props3.showAction;
|
||||
return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isContextMenuToShow",
|
||||
value: function isContextMenuToShow() {
|
||||
var _this$props4 = this.props,
|
||||
action = _this$props4.action,
|
||||
showAction = _this$props4.showAction;
|
||||
return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isClickToHide",
|
||||
value: function isClickToHide() {
|
||||
var _this$props5 = this.props,
|
||||
action = _this$props5.action,
|
||||
hideAction = _this$props5.hideAction;
|
||||
return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isMouseEnterToShow",
|
||||
value: function isMouseEnterToShow() {
|
||||
var _this$props6 = this.props,
|
||||
action = _this$props6.action,
|
||||
showAction = _this$props6.showAction;
|
||||
return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isMouseLeaveToHide",
|
||||
value: function isMouseLeaveToHide() {
|
||||
var _this$props7 = this.props,
|
||||
action = _this$props7.action,
|
||||
hideAction = _this$props7.hideAction;
|
||||
return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isFocusToShow",
|
||||
value: function isFocusToShow() {
|
||||
var _this$props8 = this.props,
|
||||
action = _this$props8.action,
|
||||
showAction = _this$props8.showAction;
|
||||
return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "isBlurToHide",
|
||||
value: function isBlurToHide() {
|
||||
var _this$props9 = this.props,
|
||||
action = _this$props9.action,
|
||||
hideAction = _this$props9.hideAction;
|
||||
return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
|
||||
}
|
||||
}, {
|
||||
key: "forcePopupAlign",
|
||||
value: function forcePopupAlign() {
|
||||
if (this.state.popupVisible && this.popupRef.current && this.popupRef.current.alignRef.current) {
|
||||
this.popupRef.current.alignRef.current.forceAlign();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "fireEvents",
|
||||
value: function fireEvents(type, e) {
|
||||
var childCallback = this.props.children.props[type];
|
||||
|
||||
if (childCallback) {
|
||||
childCallback(e);
|
||||
}
|
||||
|
||||
var callback = this.props[type];
|
||||
|
||||
if (callback) {
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "close",
|
||||
value: function close() {
|
||||
this.setPopupVisible(false);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var popupVisible = this.state.popupVisible;
|
||||
var _this$props10 = this.props,
|
||||
children = _this$props10.children,
|
||||
forceRender = _this$props10.forceRender,
|
||||
alignPoint = _this$props10.alignPoint,
|
||||
className = _this$props10.className;
|
||||
|
||||
var child = _react.default.Children.only(children);
|
||||
|
||||
var newChildProps = {
|
||||
key: 'trigger'
|
||||
};
|
||||
|
||||
if (this.isContextMenuToShow()) {
|
||||
newChildProps.onContextMenu = this.onContextMenu;
|
||||
} else {
|
||||
newChildProps.onContextMenu = this.createTwoChains('onContextMenu');
|
||||
}
|
||||
|
||||
if (this.isClickToHide() || this.isClickToShow()) {
|
||||
newChildProps.onClick = this.onClick;
|
||||
newChildProps.onMouseDown = this.onMouseDown;
|
||||
newChildProps.onTouchStart = this.onTouchStart;
|
||||
} else {
|
||||
newChildProps.onClick = this.createTwoChains('onClick');
|
||||
newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
|
||||
newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
|
||||
}
|
||||
|
||||
if (this.isMouseEnterToShow()) {
|
||||
newChildProps.onMouseEnter = this.onMouseEnter;
|
||||
|
||||
if (alignPoint) {
|
||||
newChildProps.onMouseMove = this.onMouseMove;
|
||||
}
|
||||
} else {
|
||||
newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
|
||||
}
|
||||
|
||||
if (this.isMouseLeaveToHide()) {
|
||||
newChildProps.onMouseLeave = this.onMouseLeave;
|
||||
} else {
|
||||
newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
|
||||
}
|
||||
|
||||
if (this.isFocusToShow() || this.isBlurToHide()) {
|
||||
newChildProps.onFocus = this.onFocus;
|
||||
newChildProps.onBlur = this.onBlur;
|
||||
} else {
|
||||
newChildProps.onFocus = this.createTwoChains('onFocus');
|
||||
newChildProps.onBlur = this.createTwoChains('onBlur');
|
||||
}
|
||||
|
||||
var childrenClassName = (0, _classnames.default)(child && child.props && child.props.className, className);
|
||||
|
||||
if (childrenClassName) {
|
||||
newChildProps.className = childrenClassName;
|
||||
}
|
||||
|
||||
var cloneProps = _objectSpread({}, newChildProps);
|
||||
|
||||
if ((0, _ref2.supportRef)(child)) {
|
||||
cloneProps.ref = (0, _ref2.composeRef)(this.triggerRef, child.ref);
|
||||
}
|
||||
|
||||
var trigger = _react.default.cloneElement(child, cloneProps);
|
||||
|
||||
var portal; // prevent unmounting after it's rendered
|
||||
|
||||
if (popupVisible || this.popupRef.current || forceRender) {
|
||||
portal = _react.default.createElement(PortalComponent, {
|
||||
key: "portal",
|
||||
getContainer: this.getContainer,
|
||||
didUpdate: this.handlePortalUpdate
|
||||
}, this.getComponent());
|
||||
}
|
||||
|
||||
return _react.default.createElement(_context.default.Provider, {
|
||||
value: {
|
||||
onPopupMouseDown: this.onPopupMouseDown
|
||||
}
|
||||
}, trigger, portal);
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(_ref, prevState) {
|
||||
var popupVisible = _ref.popupVisible;
|
||||
var newState = {};
|
||||
|
||||
if (popupVisible !== undefined && prevState.popupVisible !== popupVisible) {
|
||||
newState.popupVisible = popupVisible;
|
||||
newState.prevPopupVisible = prevState.popupVisible;
|
||||
}
|
||||
|
||||
return newState;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Trigger;
|
||||
}(_react.default.Component);
|
||||
|
||||
Trigger.contextType = _context.default;
|
||||
Trigger.defaultProps = {
|
||||
prefixCls: 'rc-trigger-popup',
|
||||
getPopupClassNameFromAlign: returnEmptyString,
|
||||
getDocument: returnDocument,
|
||||
onPopupVisibleChange: noop,
|
||||
afterPopupVisibleChange: noop,
|
||||
onPopupAlign: noop,
|
||||
popupClassName: '',
|
||||
mouseEnterDelay: 0,
|
||||
mouseLeaveDelay: 0.1,
|
||||
focusDelay: 0,
|
||||
blurDelay: 0.15,
|
||||
popupStyle: {},
|
||||
destroyPopupOnHide: false,
|
||||
popupAlign: {},
|
||||
defaultPopupVisible: false,
|
||||
mask: false,
|
||||
maskClosable: true,
|
||||
action: [],
|
||||
showAction: [],
|
||||
hideAction: []
|
||||
};
|
||||
return Trigger;
|
||||
}
|
||||
|
||||
var _default = generateTrigger(_Portal.default);
|
||||
|
||||
exports.default = _default;
|
||||
89
web/node_modules/rc-trigger/lib/interface.d.ts
generated
vendored
Normal file
89
web/node_modules/rc-trigger/lib/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/// <reference types="react" />
|
||||
/** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
|
||||
export declare type AlignPoint = string;
|
||||
export interface AlignType {
|
||||
/**
|
||||
* move point of source node to align with point of target node.
|
||||
* Such as ['tr','cc'], align top right point of source node with center point of target node.
|
||||
* Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
|
||||
points?: AlignPoint[];
|
||||
/**
|
||||
* offset source node by offset[0] in x and offset[1] in y.
|
||||
* If offset contains percentage string value, it is relative to sourceNode region.
|
||||
*/
|
||||
offset?: number[];
|
||||
/**
|
||||
* offset target node by offset[0] in x and offset[1] in y.
|
||||
* If targetOffset contains percentage string value, it is relative to targetNode region.
|
||||
*/
|
||||
targetOffset?: number[];
|
||||
/**
|
||||
* If adjustX field is true, will adjust source node in x direction if source node is invisible.
|
||||
* If adjustY field is true, will adjust source node in y direction if source node is invisible.
|
||||
*/
|
||||
overflow?: {
|
||||
adjustX?: boolean | number;
|
||||
adjustY?: boolean | number;
|
||||
};
|
||||
/**
|
||||
* Whether use css right instead of left to position
|
||||
*/
|
||||
useCssRight?: boolean;
|
||||
/**
|
||||
* Whether use css bottom instead of top to position
|
||||
*/
|
||||
useCssBottom?: boolean;
|
||||
/**
|
||||
* Whether use css transform instead of left/top/right/bottom to position if browser supports.
|
||||
* Defaults to false.
|
||||
*/
|
||||
useCssTransform?: boolean;
|
||||
ignoreShake?: boolean;
|
||||
}
|
||||
export interface BuildInPlacements {
|
||||
[placement: string]: AlignType;
|
||||
}
|
||||
export declare type StretchType = string;
|
||||
export declare type ActionType = string;
|
||||
export declare type AnimationType = string;
|
||||
export declare type TransitionNameType = string;
|
||||
export interface Point {
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
export interface CommonEventHandler {
|
||||
remove: () => void;
|
||||
}
|
||||
declare type MotionStatus = 'none' | 'appear' | 'enter' | 'leave';
|
||||
declare type MotionActiveStatus = 'appear-active' | 'enter-active' | 'leave-active';
|
||||
declare type MotionNameObject = {
|
||||
[key in MotionStatus | MotionActiveStatus]?: string;
|
||||
};
|
||||
declare type MotionEventHandler = (element: HTMLElement, event: React.TransitionEvent<HTMLElement> | React.AnimationEvent<HTMLElement> | undefined) => React.CSSProperties | false | null | undefined | void;
|
||||
export interface MotionType {
|
||||
motionName?: string | MotionNameObject;
|
||||
motionAppear?: boolean;
|
||||
motionEnter?: boolean;
|
||||
motionLeave?: boolean;
|
||||
motionLeaveImmediately?: boolean;
|
||||
removeOnLeave?: boolean;
|
||||
leavedClassName?: string;
|
||||
onAppearStart?: MotionEventHandler;
|
||||
onAppearActive?: MotionEventHandler;
|
||||
onAppearEnd?: MotionEventHandler;
|
||||
onEnterStart?: MotionEventHandler;
|
||||
onEnterActive?: MotionEventHandler;
|
||||
onEnterEnd?: MotionEventHandler;
|
||||
onLeaveStart?: MotionEventHandler;
|
||||
onLeaveActive?: MotionEventHandler;
|
||||
onLeaveEnd?: MotionEventHandler;
|
||||
}
|
||||
export interface MotionProps extends MotionType {
|
||||
visible?: boolean;
|
||||
children: (props: {
|
||||
className: string;
|
||||
style: React.CSSProperties;
|
||||
}, ref: React.Ref<any>) => React.ReactElement;
|
||||
}
|
||||
export declare type CSSMotionClass = React.ComponentClass<MotionProps>;
|
||||
export {};
|
||||
1
web/node_modules/rc-trigger/lib/interface.js
generated
vendored
Normal file
1
web/node_modules/rc-trigger/lib/interface.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";
|
||||
3
web/node_modules/rc-trigger/lib/mock.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-trigger/lib/mock.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const _default: React.ComponentClass<import(".").TriggerProps, any>;
|
||||
export default _default;
|
||||
29
web/node_modules/rc-trigger/lib/mock.js
generated
vendored
Normal file
29
web/node_modules/rc-trigger/lib/mock.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var MockPortal = function MockPortal(_ref) {
|
||||
var didUpdate = _ref.didUpdate,
|
||||
children = _ref.children,
|
||||
getContainer = _ref.getContainer;
|
||||
|
||||
_react.default.useEffect(function () {
|
||||
didUpdate();
|
||||
getContainer();
|
||||
});
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
var _default = (0, _index.generateTrigger)(MockPortal);
|
||||
|
||||
exports.default = _default;
|
||||
3
web/node_modules/rc-trigger/lib/utils/alignUtil.d.ts
generated
vendored
Normal file
3
web/node_modules/rc-trigger/lib/utils/alignUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { AlignType, BuildInPlacements } from '../interface';
|
||||
export declare function getAlignFromPlacement(builtinPlacements: BuildInPlacements, placementStr: string, align: AlignType): AlignType;
|
||||
export declare function getAlignPopupClassName(builtinPlacements: BuildInPlacements, prefixCls: string, align: AlignType, isAlignPoint: boolean): string;
|
||||
41
web/node_modules/rc-trigger/lib/utils/alignUtil.js
generated
vendored
Normal file
41
web/node_modules/rc-trigger/lib/utils/alignUtil.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getAlignFromPlacement = getAlignFromPlacement;
|
||||
exports.getAlignPopupClassName = getAlignPopupClassName;
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function isPointsEq(a1, a2, isAlignPoint) {
|
||||
if (isAlignPoint) {
|
||||
return a1[0] === a2[0];
|
||||
}
|
||||
|
||||
return a1[0] === a2[0] && a1[1] === a2[1];
|
||||
}
|
||||
|
||||
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
||||
var baseAlign = builtinPlacements[placementStr] || {};
|
||||
return _objectSpread({}, baseAlign, {}, align);
|
||||
}
|
||||
|
||||
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
||||
var points = align.points;
|
||||
var placements = Object.keys(builtinPlacements);
|
||||
|
||||
for (var i = 0; i < placements.length; i += 1) {
|
||||
var placement = placements[i];
|
||||
|
||||
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
||||
return "".concat(prefixCls, "-placement-").concat(placement);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
9
web/node_modules/rc-trigger/lib/utils/legacyUtil.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-trigger/lib/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MotionType, AnimationType, TransitionNameType } from '../interface';
|
||||
interface GetMotionProps {
|
||||
motion: MotionType;
|
||||
animation: AnimationType;
|
||||
transitionName: TransitionNameType;
|
||||
prefixCls: string;
|
||||
}
|
||||
export declare function getMotion({ prefixCls, motion, animation, transitionName, }: GetMotionProps): MotionType;
|
||||
export {};
|
||||
31
web/node_modules/rc-trigger/lib/utils/legacyUtil.js
generated
vendored
Normal file
31
web/node_modules/rc-trigger/lib/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getMotion = getMotion;
|
||||
|
||||
function getMotion(_ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
motion = _ref.motion,
|
||||
animation = _ref.animation,
|
||||
transitionName = _ref.transitionName;
|
||||
|
||||
if (motion) {
|
||||
return motion;
|
||||
}
|
||||
|
||||
if (animation) {
|
||||
return {
|
||||
motionName: "".concat(prefixCls, "-").concat(animation)
|
||||
};
|
||||
}
|
||||
|
||||
if (transitionName) {
|
||||
return {
|
||||
motionName: transitionName
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
100
web/node_modules/rc-trigger/package.json
generated
vendored
Normal file
100
web/node_modules/rc-trigger/package.json
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"_from": "rc-trigger@~4.0.0",
|
||||
"_id": "rc-trigger@4.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-to5S1NhK10rWHIgQpoQdwIhuDc2Ok4R4/dh5NLrDt6C+gqkohsdBCYiPk97Z+NwGhRU8N+dbf251bivX8DkzQg==",
|
||||
"_location": "/rc-trigger",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rc-trigger@~4.0.0",
|
||||
"name": "rc-trigger",
|
||||
"escapedName": "rc-trigger",
|
||||
"rawSpec": "~4.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~4.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/antd",
|
||||
"/rc-cascader",
|
||||
"/rc-dropdown",
|
||||
"/rc-mentions",
|
||||
"/rc-menu",
|
||||
"/rc-picker",
|
||||
"/rc-select",
|
||||
"/rc-tooltip"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rc-trigger/-/rc-trigger-4.0.2.tgz",
|
||||
"_shasum": "42fe7bdb6a5b34035e20fa9ebfad69ec948b56be",
|
||||
"_spec": "rc-trigger@~4.0.0",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/antd",
|
||||
"author": "",
|
||||
"bugs": {
|
||||
"url": "https://github.com/react-component/trigger/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.6",
|
||||
"prop-types": "15.x",
|
||||
"raf": "^3.4.1",
|
||||
"rc-align": "^3.0.0-rc.0",
|
||||
"rc-animate": "^2.10.2",
|
||||
"rc-util": "^4.20.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "base abstract trigger component for react",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.1.3",
|
||||
"@types/react": "^16.8.19",
|
||||
"@types/react-dom": "^16.8.4",
|
||||
"cross-env": "^7.0.1",
|
||||
"enzyme": "^3.3.0",
|
||||
"enzyme-adapter-react-16": "^1.14.0",
|
||||
"enzyme-to-json": "^3.4.0",
|
||||
"father": "^2.13.2",
|
||||
"np": "^6.2.0",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"typescript": "^3.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.x"
|
||||
},
|
||||
"files": [
|
||||
"es",
|
||||
"lib",
|
||||
"assets/**/*.css",
|
||||
"assets/**/*.less"
|
||||
],
|
||||
"homepage": "https://github.com/react-component/trigger",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-trigger",
|
||||
"trigger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"module": "./es/index",
|
||||
"name": "rc-trigger",
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
"react-dom": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/react-component/trigger.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "father doc build --storybook",
|
||||
"compile": "father build",
|
||||
"coverage": "father test --coverage",
|
||||
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js",
|
||||
"now-build": "npm run build",
|
||||
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
|
||||
"start": "cross-env NODE_ENV=development father doc dev --storybook",
|
||||
"test": "father test"
|
||||
},
|
||||
"version": "4.0.2"
|
||||
}
|
||||
Reference in New Issue
Block a user