@fle-ui/next 2.0.0-alpha.6 → 2.0.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/es/affix/index.d.ts +54 -0
- package/es/affix/index.js +330 -0
- package/es/affix/style/css.js +2 -0
- package/es/affix/style/index-pure.less +6 -0
- package/es/affix/style/index.css +8 -0
- package/es/affix/style/index.d.ts +2 -0
- package/es/affix/style/index.js +2 -0
- package/es/affix/style/index.less +3 -0
- package/es/affix/utils.d.ts +15 -0
- package/es/affix/utils.js +86 -0
- package/es/config-provider/DisabledContext.d.ts +9 -0
- package/es/config-provider/DisabledContext.js +11 -0
- package/es/config-provider/SizeContext.d.ts +9 -0
- package/es/config-provider/SizeContext.js +12 -0
- package/es/config-provider/context.d.ts +58 -0
- package/es/config-provider/context.js +41 -0
- package/es/config-provider/cssVariables.d.ts +3 -0
- package/es/config-provider/cssVariables.js +97 -0
- package/es/config-provider/defaultRenderEmpty.d.ts +4 -0
- package/es/config-provider/defaultRenderEmpty.js +36 -0
- package/es/config-provider/index.d.ts +61 -5
- package/es/config-provider/index.js +209 -10
- package/es/config-provider/style/css.js +1 -0
- package/es/config-provider/style/index-pure.less +2 -0
- package/es/config-provider/style/index.css +4 -0
- package/es/config-provider/style/index.d.ts +1 -0
- package/es/config-provider/style/index.js +1 -0
- package/es/config-provider/style/index.less +3 -0
- package/lib/config-provider/DisabledContext.d.ts +9 -0
- package/lib/config-provider/DisabledContext.js +25 -0
- package/lib/config-provider/SizeContext.d.ts +9 -0
- package/lib/config-provider/SizeContext.js +26 -0
- package/lib/config-provider/context.d.ts +58 -0
- package/lib/config-provider/context.js +57 -0
- package/lib/config-provider/cssVariables.d.ts +3 -0
- package/lib/config-provider/cssVariables.js +115 -0
- package/lib/config-provider/defaultRenderEmpty.d.ts +4 -0
- package/lib/config-provider/defaultRenderEmpty.js +50 -0
- package/lib/config-provider/index.d.ts +61 -5
- package/lib/config-provider/index.js +250 -10
- package/lib/config-provider/style/css.js +3 -0
- package/lib/config-provider/style/index-pure.less +2 -0
- package/lib/config-provider/style/index.css +4 -0
- package/lib/config-provider/style/index.d.ts +1 -0
- package/lib/config-provider/style/index.js +3 -0
- package/lib/config-provider/style/index.less +3 -0
- package/package.json +1 -2
- package/es/affix/ActionButton.d.ts +0 -15
- package/es/affix/ActionButton.js +0 -118
- package/es/affix/colors.d.ts +0 -5
- package/es/affix/colors.js +0 -4
- package/es/affix/easings.d.ts +0 -1
- package/es/affix/easings.js +0 -12
- package/es/affix/getDataOrAriaProps.d.ts +0 -1
- package/es/affix/getDataOrAriaProps.js +0 -9
- package/es/affix/getRenderPropValue.d.ts +0 -3
- package/es/affix/getRenderPropValue.js +0 -11
- package/es/affix/getScroll.d.ts +0 -2
- package/es/affix/getScroll.js +0 -34
- package/es/affix/hooks/useFlexGapSupport.d.ts +0 -2
- package/es/affix/hooks/useFlexGapSupport.js +0 -14
- package/es/affix/hooks/useForceUpdate.d.ts +0 -2
- package/es/affix/hooks/useForceUpdate.js +0 -11
- package/es/affix/hooks/usePatchElement.d.ts +0 -5
- package/es/affix/hooks/usePatchElement.js +0 -26
- package/es/affix/hooks/useSyncState.d.ts +0 -3
- package/es/affix/hooks/useSyncState.js +0 -13
- package/es/affix/isNumeric.d.ts +0 -2
- package/es/affix/isNumeric.js +0 -5
- package/es/affix/motion.d.ts +0 -8
- package/es/affix/motion.js +0 -60
- package/es/affix/placements.d.ts +0 -17
- package/es/affix/placements.js +0 -88
- package/es/affix/raf.d.ts +0 -9
- package/es/affix/raf.js +0 -31
- package/es/affix/reactNode.d.ts +0 -8
- package/es/affix/reactNode.js +0 -16
- package/es/affix/responsiveObserve.d.ts +0 -21
- package/es/affix/responsiveObserve.js +0 -67
- package/es/affix/scrollTo.d.ts +0 -10
- package/es/affix/scrollTo.js +0 -38
- package/es/affix/statusUtils.d.ts +0 -6
- package/es/affix/statusUtils.js +0 -12
- package/es/affix/styleChecker.d.ts +0 -4
- package/es/affix/styleChecker.js +0 -31
- package/es/affix/throttleByAnimationFrame.d.ts +0 -8
- package/es/affix/throttleByAnimationFrame.js +0 -58
- package/es/affix/transButton.d.ts +0 -9
- package/es/affix/transButton.js +0 -75
- package/es/affix/type.d.ts +0 -9
- package/es/affix/type.js +0 -15
- package/es/affix/warning.d.ts +0 -6
- package/es/affix/warning.js +0 -17
- package/es/affix/wave.d.ts +0 -32
- package/es/affix/wave.js +0 -247
@@ -1,58 +0,0 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
-
import raf from "rc-util/es/raf";
|
3
|
-
export function throttleByAnimationFrame(fn) {
|
4
|
-
var requestId;
|
5
|
-
|
6
|
-
var later = function later(args) {
|
7
|
-
return function () {
|
8
|
-
requestId = null;
|
9
|
-
fn.apply(void 0, _toConsumableArray(args));
|
10
|
-
};
|
11
|
-
};
|
12
|
-
|
13
|
-
var throttled = function throttled() {
|
14
|
-
if (requestId == null) {
|
15
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
16
|
-
args[_key] = arguments[_key];
|
17
|
-
}
|
18
|
-
|
19
|
-
requestId = raf(later(args));
|
20
|
-
}
|
21
|
-
};
|
22
|
-
|
23
|
-
throttled.cancel = function () {
|
24
|
-
raf.cancel(requestId);
|
25
|
-
requestId = null;
|
26
|
-
};
|
27
|
-
|
28
|
-
return throttled;
|
29
|
-
}
|
30
|
-
export function throttleByAnimationFrameDecorator() {
|
31
|
-
return function throttle(target, key, descriptor) {
|
32
|
-
var fn = descriptor.value;
|
33
|
-
var definingProperty = false;
|
34
|
-
return {
|
35
|
-
configurable: true,
|
36
|
-
get: function get() {
|
37
|
-
// In IE11 calling Object.defineProperty has a side-effect of evaluating the
|
38
|
-
// getter for the property which is being replaced. This causes infinite
|
39
|
-
// recursion and an "Out of stack space" error.
|
40
|
-
// eslint-disable-next-line no-prototype-builtins
|
41
|
-
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
|
42
|
-
/* istanbul ignore next */
|
43
|
-
return fn;
|
44
|
-
}
|
45
|
-
|
46
|
-
var boundFn = throttleByAnimationFrame(fn.bind(this));
|
47
|
-
definingProperty = true;
|
48
|
-
Object.defineProperty(this, key, {
|
49
|
-
value: boundFn,
|
50
|
-
configurable: true,
|
51
|
-
writable: true
|
52
|
-
});
|
53
|
-
definingProperty = false;
|
54
|
-
return boundFn;
|
55
|
-
}
|
56
|
-
};
|
57
|
-
};
|
58
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
interface TransButtonProps extends React.HTMLAttributes<HTMLDivElement> {
|
3
|
-
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
|
4
|
-
noStyle?: boolean;
|
5
|
-
autoFocus?: boolean;
|
6
|
-
disabled?: boolean;
|
7
|
-
}
|
8
|
-
declare const TransButton: React.ForwardRefExoticComponent<TransButtonProps & React.RefAttributes<HTMLDivElement>>;
|
9
|
-
export default TransButton;
|
package/es/affix/transButton.js
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
|
3
|
-
var __rest = this && this.__rest || function (s, e) {
|
4
|
-
var t = {};
|
5
|
-
|
6
|
-
for (var p in s) {
|
7
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
8
|
-
}
|
9
|
-
|
10
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
11
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
12
|
-
}
|
13
|
-
return t;
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* Wrap of sub component which need use as Button capacity (like Icon component).
|
17
|
-
*
|
18
|
-
* This helps accessibility reader to tread as a interactive button to operation.
|
19
|
-
*/
|
20
|
-
|
21
|
-
|
22
|
-
import KeyCode from "rc-util/es/KeyCode";
|
23
|
-
import * as React from 'react';
|
24
|
-
var inlineStyle = {
|
25
|
-
border: 0,
|
26
|
-
background: 'transparent',
|
27
|
-
padding: 0,
|
28
|
-
lineHeight: 'inherit',
|
29
|
-
display: 'inline-block'
|
30
|
-
};
|
31
|
-
var TransButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
32
|
-
var onKeyDown = function onKeyDown(event) {
|
33
|
-
var keyCode = event.keyCode;
|
34
|
-
|
35
|
-
if (keyCode === KeyCode.ENTER) {
|
36
|
-
event.preventDefault();
|
37
|
-
}
|
38
|
-
};
|
39
|
-
|
40
|
-
var onKeyUp = function onKeyUp(event) {
|
41
|
-
var keyCode = event.keyCode;
|
42
|
-
var onClick = props.onClick;
|
43
|
-
|
44
|
-
if (keyCode === KeyCode.ENTER && onClick) {
|
45
|
-
onClick();
|
46
|
-
}
|
47
|
-
};
|
48
|
-
|
49
|
-
var style = props.style,
|
50
|
-
noStyle = props.noStyle,
|
51
|
-
disabled = props.disabled,
|
52
|
-
restProps = __rest(props, ["style", "noStyle", "disabled"]);
|
53
|
-
|
54
|
-
var mergedStyle = {};
|
55
|
-
|
56
|
-
if (!noStyle) {
|
57
|
-
mergedStyle = _extends({}, inlineStyle);
|
58
|
-
}
|
59
|
-
|
60
|
-
if (disabled) {
|
61
|
-
mergedStyle.pointerEvents = 'none';
|
62
|
-
}
|
63
|
-
|
64
|
-
mergedStyle = _extends(_extends({}, mergedStyle), style);
|
65
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
66
|
-
role: "button",
|
67
|
-
tabIndex: 0,
|
68
|
-
ref: ref
|
69
|
-
}, restProps, {
|
70
|
-
onKeyDown: onKeyDown,
|
71
|
-
onKeyUp: onKeyUp,
|
72
|
-
style: mergedStyle
|
73
|
-
}));
|
74
|
-
});
|
75
|
-
export default TransButton;
|
package/es/affix/type.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
export declare const tuple: <T extends string[]>(...args: T) => T;
|
2
|
-
export declare const tupleNum: <T extends number[]>(...args: T) => T;
|
3
|
-
/**
|
4
|
-
* https://stackoverflow.com/a/59187769 Extract the type of an element of an array/tuple without
|
5
|
-
* performing indexing
|
6
|
-
*/
|
7
|
-
export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never;
|
8
|
-
/** https://github.com/Microsoft/TypeScript/issues/29729 */
|
9
|
-
export type LiteralUnion<T extends U, U> = T | (U & {});
|
package/es/affix/type.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
|
2
|
-
export var tuple = function tuple() {
|
3
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
4
|
-
args[_key] = arguments[_key];
|
5
|
-
}
|
6
|
-
|
7
|
-
return args;
|
8
|
-
};
|
9
|
-
export var tupleNum = function tupleNum() {
|
10
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
11
|
-
args[_key2] = arguments[_key2];
|
12
|
-
}
|
13
|
-
|
14
|
-
return args;
|
15
|
-
};
|
package/es/affix/warning.d.ts
DELETED
package/es/affix/warning.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import rcWarning, { resetWarned } from "rc-util/es/warning";
|
2
|
-
export { resetWarned };
|
3
|
-
export function noop() {} // eslint-disable-next-line import/no-mutable-exports
|
4
|
-
|
5
|
-
var warning = noop;
|
6
|
-
|
7
|
-
if (process.env.NODE_ENV !== 'production') {
|
8
|
-
warning = function warning(valid, component, message) {
|
9
|
-
rcWarning(valid, "[antd: ".concat(component, "] ").concat(message)); // StrictMode will inject console which will not throw warning in React 17.
|
10
|
-
|
11
|
-
if (process.env.NODE_ENV === 'test') {
|
12
|
-
resetWarned();
|
13
|
-
}
|
14
|
-
};
|
15
|
-
}
|
16
|
-
|
17
|
-
export default warning;
|
package/es/affix/wave.d.ts
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { ConfigConsumerProps } from '../config-provider';
|
3
|
-
export interface WaveProps {
|
4
|
-
insertExtraNode?: boolean;
|
5
|
-
disabled?: boolean;
|
6
|
-
children?: React.ReactNode;
|
7
|
-
}
|
8
|
-
declare class Wave extends React.Component<WaveProps> {
|
9
|
-
static contextType: React.Context<ConfigConsumerProps>;
|
10
|
-
private instance?;
|
11
|
-
private containerRef;
|
12
|
-
private extraNode;
|
13
|
-
private clickWaveTimeoutId;
|
14
|
-
private animationStartId;
|
15
|
-
private animationStart;
|
16
|
-
private destroyed;
|
17
|
-
private csp?;
|
18
|
-
context: ConfigConsumerProps;
|
19
|
-
componentDidMount(): void;
|
20
|
-
componentWillUnmount(): void;
|
21
|
-
onClick: (node: HTMLElement, waveColor: string) => void;
|
22
|
-
onTransitionStart: (e: AnimationEvent) => void;
|
23
|
-
onTransitionEnd: (e: AnimationEvent) => void;
|
24
|
-
getAttributeName(): string;
|
25
|
-
bindAnimationEvent: (node?: HTMLElement) => {
|
26
|
-
cancel: () => void;
|
27
|
-
} | undefined;
|
28
|
-
resetEffect(node: HTMLElement): void;
|
29
|
-
renderWave: ({ csp }: ConfigConsumerProps) => string | number | boolean | React.ReactFragment | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined;
|
30
|
-
render(): JSX.Element;
|
31
|
-
}
|
32
|
-
export default Wave;
|
package/es/affix/wave.js
DELETED
@@ -1,247 +0,0 @@
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
6
|
-
import { updateCSS } from "rc-util/es/Dom/dynamicCSS";
|
7
|
-
import { composeRef, supportRef } from "rc-util/es/ref";
|
8
|
-
import * as React from 'react';
|
9
|
-
import { ConfigConsumer, ConfigContext } from "../config-provider";
|
10
|
-
import raf from "./raf";
|
11
|
-
import { cloneElement } from "./reactNode";
|
12
|
-
var styleForPseudo; // Where el is the DOM element you'd like to test for visibility
|
13
|
-
|
14
|
-
function isHidden(element) {
|
15
|
-
if (process.env.NODE_ENV === 'test') {
|
16
|
-
return false;
|
17
|
-
}
|
18
|
-
|
19
|
-
return !element || element.offsetParent === null || element.hidden;
|
20
|
-
}
|
21
|
-
|
22
|
-
function getValidateContainer(nodeRoot) {
|
23
|
-
if (nodeRoot instanceof Document) {
|
24
|
-
return nodeRoot.body;
|
25
|
-
}
|
26
|
-
|
27
|
-
return Array.from(nodeRoot.childNodes).find(function (ele) {
|
28
|
-
return (ele === null || ele === void 0 ? void 0 : ele.nodeType) === Node.ELEMENT_NODE;
|
29
|
-
});
|
30
|
-
}
|
31
|
-
|
32
|
-
function isNotGrey(color) {
|
33
|
-
// eslint-disable-next-line no-useless-escape
|
34
|
-
var match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);
|
35
|
-
|
36
|
-
if (match && match[1] && match[2] && match[3]) {
|
37
|
-
return !(match[1] === match[2] && match[2] === match[3]);
|
38
|
-
}
|
39
|
-
|
40
|
-
return true;
|
41
|
-
}
|
42
|
-
|
43
|
-
var Wave = /*#__PURE__*/function (_React$Component) {
|
44
|
-
_inherits(Wave, _React$Component);
|
45
|
-
|
46
|
-
var _super = _createSuper(Wave);
|
47
|
-
|
48
|
-
function Wave() {
|
49
|
-
var _this;
|
50
|
-
|
51
|
-
_classCallCheck(this, Wave);
|
52
|
-
|
53
|
-
_this = _super.apply(this, arguments);
|
54
|
-
_this.containerRef = /*#__PURE__*/React.createRef();
|
55
|
-
_this.animationStart = false;
|
56
|
-
_this.destroyed = false;
|
57
|
-
|
58
|
-
_this.onClick = function (node, waveColor) {
|
59
|
-
var _a, _b;
|
60
|
-
|
61
|
-
var _this$props = _this.props,
|
62
|
-
insertExtraNode = _this$props.insertExtraNode,
|
63
|
-
disabled = _this$props.disabled;
|
64
|
-
|
65
|
-
if (disabled || !node || isHidden(node) || node.className.includes('-leave')) {
|
66
|
-
return;
|
67
|
-
}
|
68
|
-
|
69
|
-
_this.extraNode = document.createElement('div');
|
70
|
-
|
71
|
-
var _assertThisInitialize = _assertThisInitialized(_this),
|
72
|
-
extraNode = _assertThisInitialize.extraNode;
|
73
|
-
|
74
|
-
var getPrefixCls = _this.context.getPrefixCls;
|
75
|
-
extraNode.className = "".concat(getPrefixCls(''), "-click-animating-node");
|
76
|
-
|
77
|
-
var attributeName = _this.getAttributeName();
|
78
|
-
|
79
|
-
node.setAttribute(attributeName, 'true'); // Not white or transparent or grey
|
80
|
-
|
81
|
-
if (waveColor && waveColor !== '#fff' && waveColor !== '#ffffff' && waveColor !== 'rgb(255, 255, 255)' && waveColor !== 'rgba(255, 255, 255, 1)' && isNotGrey(waveColor) && !/rgba\((?:\d*, ){3}0\)/.test(waveColor) && // any transparent rgba color
|
82
|
-
waveColor !== 'transparent') {
|
83
|
-
extraNode.style.borderColor = waveColor;
|
84
|
-
var nodeRoot = ((_a = node.getRootNode) === null || _a === void 0 ? void 0 : _a.call(node)) || node.ownerDocument;
|
85
|
-
var nodeBody = (_b = getValidateContainer(nodeRoot)) !== null && _b !== void 0 ? _b : nodeRoot;
|
86
|
-
styleForPseudo = updateCSS("\n [".concat(getPrefixCls(''), "-click-animating-without-extra-node='true']::after, .").concat(getPrefixCls(''), "-click-animating-node {\n --antd-wave-shadow-color: ").concat(waveColor, ";\n }"), 'antd-wave', {
|
87
|
-
csp: _this.csp,
|
88
|
-
attachTo: nodeBody
|
89
|
-
});
|
90
|
-
}
|
91
|
-
|
92
|
-
if (insertExtraNode) {
|
93
|
-
node.appendChild(extraNode);
|
94
|
-
}
|
95
|
-
|
96
|
-
['transition', 'animation'].forEach(function (name) {
|
97
|
-
node.addEventListener("".concat(name, "start"), _this.onTransitionStart);
|
98
|
-
node.addEventListener("".concat(name, "end"), _this.onTransitionEnd);
|
99
|
-
});
|
100
|
-
};
|
101
|
-
|
102
|
-
_this.onTransitionStart = function (e) {
|
103
|
-
if (_this.destroyed) {
|
104
|
-
return;
|
105
|
-
}
|
106
|
-
|
107
|
-
var node = _this.containerRef.current;
|
108
|
-
|
109
|
-
if (!e || e.target !== node || _this.animationStart) {
|
110
|
-
return;
|
111
|
-
}
|
112
|
-
|
113
|
-
_this.resetEffect(node);
|
114
|
-
};
|
115
|
-
|
116
|
-
_this.onTransitionEnd = function (e) {
|
117
|
-
if (!e || e.animationName !== 'fadeEffect') {
|
118
|
-
return;
|
119
|
-
}
|
120
|
-
|
121
|
-
_this.resetEffect(e.target);
|
122
|
-
};
|
123
|
-
|
124
|
-
_this.bindAnimationEvent = function (node) {
|
125
|
-
if (!node || !node.getAttribute || node.getAttribute('disabled') || node.className.includes('disabled')) {
|
126
|
-
return;
|
127
|
-
}
|
128
|
-
|
129
|
-
var onClick = function onClick(e) {
|
130
|
-
// Fix radio button click twice
|
131
|
-
if (e.target.tagName === 'INPUT' || isHidden(e.target)) {
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
|
135
|
-
_this.resetEffect(node); // Get wave color from target
|
136
|
-
|
137
|
-
|
138
|
-
var waveColor = getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible
|
139
|
-
getComputedStyle(node).getPropertyValue('border-color') || getComputedStyle(node).getPropertyValue('background-color');
|
140
|
-
_this.clickWaveTimeoutId = window.setTimeout(function () {
|
141
|
-
return _this.onClick(node, waveColor);
|
142
|
-
}, 0);
|
143
|
-
raf.cancel(_this.animationStartId);
|
144
|
-
_this.animationStart = true; // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.
|
145
|
-
|
146
|
-
_this.animationStartId = raf(function () {
|
147
|
-
_this.animationStart = false;
|
148
|
-
}, 10);
|
149
|
-
};
|
150
|
-
|
151
|
-
node.addEventListener('click', onClick, true);
|
152
|
-
return {
|
153
|
-
cancel: function cancel() {
|
154
|
-
node.removeEventListener('click', onClick, true);
|
155
|
-
}
|
156
|
-
};
|
157
|
-
};
|
158
|
-
|
159
|
-
_this.renderWave = function (_ref) {
|
160
|
-
var csp = _ref.csp;
|
161
|
-
var children = _this.props.children;
|
162
|
-
_this.csp = csp;
|
163
|
-
if (! /*#__PURE__*/React.isValidElement(children)) return children;
|
164
|
-
var ref = _this.containerRef;
|
165
|
-
|
166
|
-
if (supportRef(children)) {
|
167
|
-
ref = composeRef(children.ref, _this.containerRef);
|
168
|
-
}
|
169
|
-
|
170
|
-
return cloneElement(children, {
|
171
|
-
ref: ref
|
172
|
-
});
|
173
|
-
};
|
174
|
-
|
175
|
-
return _this;
|
176
|
-
}
|
177
|
-
|
178
|
-
_createClass(Wave, [{
|
179
|
-
key: "componentDidMount",
|
180
|
-
value: function componentDidMount() {
|
181
|
-
this.destroyed = false;
|
182
|
-
var node = this.containerRef.current;
|
183
|
-
|
184
|
-
if (!node || node.nodeType !== 1) {
|
185
|
-
return;
|
186
|
-
}
|
187
|
-
|
188
|
-
this.instance = this.bindAnimationEvent(node);
|
189
|
-
}
|
190
|
-
}, {
|
191
|
-
key: "componentWillUnmount",
|
192
|
-
value: function componentWillUnmount() {
|
193
|
-
if (this.instance) {
|
194
|
-
this.instance.cancel();
|
195
|
-
}
|
196
|
-
|
197
|
-
if (this.clickWaveTimeoutId) {
|
198
|
-
clearTimeout(this.clickWaveTimeoutId);
|
199
|
-
}
|
200
|
-
|
201
|
-
this.destroyed = true;
|
202
|
-
}
|
203
|
-
}, {
|
204
|
-
key: "getAttributeName",
|
205
|
-
value: function getAttributeName() {
|
206
|
-
var getPrefixCls = this.context.getPrefixCls;
|
207
|
-
var insertExtraNode = this.props.insertExtraNode;
|
208
|
-
return insertExtraNode ? "".concat(getPrefixCls(''), "-click-animating") : "".concat(getPrefixCls(''), "-click-animating-without-extra-node");
|
209
|
-
}
|
210
|
-
}, {
|
211
|
-
key: "resetEffect",
|
212
|
-
value: function resetEffect(node) {
|
213
|
-
var _this2 = this;
|
214
|
-
|
215
|
-
if (!node || node === this.extraNode || !(node instanceof Element)) {
|
216
|
-
return;
|
217
|
-
}
|
218
|
-
|
219
|
-
var insertExtraNode = this.props.insertExtraNode;
|
220
|
-
var attributeName = this.getAttributeName();
|
221
|
-
node.setAttribute(attributeName, 'false'); // edge has bug on `removeAttribute` #14466
|
222
|
-
|
223
|
-
if (styleForPseudo) {
|
224
|
-
styleForPseudo.innerHTML = '';
|
225
|
-
}
|
226
|
-
|
227
|
-
if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {
|
228
|
-
node.removeChild(this.extraNode);
|
229
|
-
}
|
230
|
-
|
231
|
-
['transition', 'animation'].forEach(function (name) {
|
232
|
-
node.removeEventListener("".concat(name, "start"), _this2.onTransitionStart);
|
233
|
-
node.removeEventListener("".concat(name, "end"), _this2.onTransitionEnd);
|
234
|
-
});
|
235
|
-
}
|
236
|
-
}, {
|
237
|
-
key: "render",
|
238
|
-
value: function render() {
|
239
|
-
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderWave);
|
240
|
-
}
|
241
|
-
}]);
|
242
|
-
|
243
|
-
return Wave;
|
244
|
-
}(React.Component);
|
245
|
-
|
246
|
-
Wave.contextType = ConfigContext;
|
247
|
-
export default Wave;
|