@fle-ui/next 2.0.0-alpha.6 → 2.0.0-alpha.7
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/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
package/es/affix/easings.js
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line import/prefer-default-export
|
2
|
-
export function easeInOutCubic(t, b, c, d) {
|
3
|
-
var cc = c - b;
|
4
|
-
t /= d / 2;
|
5
|
-
|
6
|
-
if (t < 1) {
|
7
|
-
return cc / 2 * t * t * t + b;
|
8
|
-
} // eslint-disable-next-line no-return-assign
|
9
|
-
|
10
|
-
|
11
|
-
return cc / 2 * ((t -= 2) * t * t + 2) + b;
|
12
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export default function getDataOrAriaProps(props: any): any;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
export default function getDataOrAriaProps(props) {
|
2
|
-
return Object.keys(props).reduce(function (prev, key) {
|
3
|
-
if ((key.startsWith('data-') || key.startsWith('aria-') || key === 'role') && !key.startsWith('data-__')) {
|
4
|
-
prev[key] = props[key];
|
5
|
-
}
|
6
|
-
|
7
|
-
return prev;
|
8
|
-
}, {});
|
9
|
-
}
|
package/es/affix/getScroll.d.ts
DELETED
package/es/affix/getScroll.js
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
export function isWindow(obj) {
|
2
|
-
return obj !== null && obj !== undefined && obj === obj.window;
|
3
|
-
}
|
4
|
-
export default function getScroll(target, top) {
|
5
|
-
var _a, _b;
|
6
|
-
|
7
|
-
if (typeof window === 'undefined') {
|
8
|
-
return 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
var method = top ? 'scrollTop' : 'scrollLeft';
|
12
|
-
var result = 0;
|
13
|
-
|
14
|
-
if (isWindow(target)) {
|
15
|
-
result = target[top ? 'pageYOffset' : 'pageXOffset'];
|
16
|
-
} else if (target instanceof Document) {
|
17
|
-
result = target.documentElement[method];
|
18
|
-
} else if (target instanceof HTMLElement) {
|
19
|
-
result = target[method];
|
20
|
-
} else if (target) {
|
21
|
-
// According to the type inference, the `target` is `never` type.
|
22
|
-
// Since we configured the loose mode type checking, and supports mocking the target with such shape below::
|
23
|
-
// `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
|
24
|
-
// the program may falls into this branch.
|
25
|
-
// Check the corresponding tests for details. Don't sure what is the real scenario this happens.
|
26
|
-
result = target[method];
|
27
|
-
}
|
28
|
-
|
29
|
-
if (target && !isWindow(target) && typeof result !== 'number') {
|
30
|
-
result = (_b = ((_a = target.ownerDocument) !== null && _a !== void 0 ? _a : target).documentElement) === null || _b === void 0 ? void 0 : _b[method];
|
31
|
-
}
|
32
|
-
|
33
|
-
return result;
|
34
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import * as React from 'react';
|
3
|
-
import { detectFlexGapSupported } from "../styleChecker";
|
4
|
-
export default (function () {
|
5
|
-
var _React$useState = React.useState(false),
|
6
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
7
|
-
flexible = _React$useState2[0],
|
8
|
-
setFlexible = _React$useState2[1];
|
9
|
-
|
10
|
-
React.useEffect(function () {
|
11
|
-
setFlexible(detectFlexGapSupported());
|
12
|
-
}, []);
|
13
|
-
return flexible;
|
14
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import * as React from 'react';
|
3
|
-
export default function useForceUpdate() {
|
4
|
-
var _React$useReducer = React.useReducer(function (x) {
|
5
|
-
return x + 1;
|
6
|
-
}, 0),
|
7
|
-
_React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
8
|
-
forceUpdate = _React$useReducer2[1];
|
9
|
-
|
10
|
-
return forceUpdate;
|
11
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import * as React from 'react';
|
4
|
-
export default function usePatchElement() {
|
5
|
-
var _React$useState = React.useState([]),
|
6
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
7
|
-
elements = _React$useState2[0],
|
8
|
-
setElements = _React$useState2[1];
|
9
|
-
|
10
|
-
var patchElement = React.useCallback(function (element) {
|
11
|
-
// append a new element to elements (and create a new ref)
|
12
|
-
setElements(function (originElements) {
|
13
|
-
return [].concat(_toConsumableArray(originElements), [element]);
|
14
|
-
}); // return a function that removes the new element out of elements (and create a new ref)
|
15
|
-
// it works a little like useEffect
|
16
|
-
|
17
|
-
return function () {
|
18
|
-
setElements(function (originElements) {
|
19
|
-
return originElements.filter(function (ele) {
|
20
|
-
return ele !== element;
|
21
|
-
});
|
22
|
-
});
|
23
|
-
};
|
24
|
-
}, []);
|
25
|
-
return [elements, patchElement];
|
26
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import useForceUpdate from "./useForceUpdate";
|
3
|
-
export default function useSyncState(initialValue) {
|
4
|
-
var ref = React.useRef(initialValue);
|
5
|
-
var forceUpdate = useForceUpdate();
|
6
|
-
return [function () {
|
7
|
-
return ref.current;
|
8
|
-
}, function (newValue) {
|
9
|
-
ref.current = newValue; // re-render
|
10
|
-
|
11
|
-
forceUpdate();
|
12
|
-
}];
|
13
|
-
}
|
package/es/affix/isNumeric.d.ts
DELETED
package/es/affix/isNumeric.js
DELETED
package/es/affix/motion.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { CSSMotionProps } from 'rc-motion';
|
2
|
-
declare const collapseMotion: CSSMotionProps;
|
3
|
-
declare const SelectPlacements: ["bottomLeft", "bottomRight", "topLeft", "topRight"];
|
4
|
-
export type SelectCommonPlacement = typeof SelectPlacements[number];
|
5
|
-
declare const getTransitionDirection: (placement: SelectCommonPlacement | undefined) => "slide-down" | "slide-up";
|
6
|
-
declare const getTransitionName: (rootPrefixCls: string, motion: string, transitionName?: string) => string;
|
7
|
-
export { getTransitionName, getTransitionDirection };
|
8
|
-
export default collapseMotion;
|
package/es/affix/motion.js
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
import { tuple } from "./type"; // ================== Collapse Motion ==================
|
2
|
-
|
3
|
-
var getCollapsedHeight = function getCollapsedHeight() {
|
4
|
-
return {
|
5
|
-
height: 0,
|
6
|
-
opacity: 0
|
7
|
-
};
|
8
|
-
};
|
9
|
-
|
10
|
-
var getRealHeight = function getRealHeight(node) {
|
11
|
-
var scrollHeight = node.scrollHeight;
|
12
|
-
return {
|
13
|
-
height: scrollHeight,
|
14
|
-
opacity: 1
|
15
|
-
};
|
16
|
-
};
|
17
|
-
|
18
|
-
var getCurrentHeight = function getCurrentHeight(node) {
|
19
|
-
return {
|
20
|
-
height: node ? node.offsetHeight : 0
|
21
|
-
};
|
22
|
-
};
|
23
|
-
|
24
|
-
var skipOpacityTransition = function skipOpacityTransition(_, event) {
|
25
|
-
return (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
|
26
|
-
};
|
27
|
-
|
28
|
-
var collapseMotion = {
|
29
|
-
motionName: 'ant-motion-collapse',
|
30
|
-
onAppearStart: getCollapsedHeight,
|
31
|
-
onEnterStart: getCollapsedHeight,
|
32
|
-
onAppearActive: getRealHeight,
|
33
|
-
onEnterActive: getRealHeight,
|
34
|
-
onLeaveStart: getCurrentHeight,
|
35
|
-
onLeaveActive: getCollapsedHeight,
|
36
|
-
onAppearEnd: skipOpacityTransition,
|
37
|
-
onEnterEnd: skipOpacityTransition,
|
38
|
-
onLeaveEnd: skipOpacityTransition,
|
39
|
-
motionDeadline: 500
|
40
|
-
};
|
41
|
-
var SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight');
|
42
|
-
|
43
|
-
var getTransitionDirection = function getTransitionDirection(placement) {
|
44
|
-
if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) {
|
45
|
-
return "slide-down";
|
46
|
-
}
|
47
|
-
|
48
|
-
return "slide-up";
|
49
|
-
};
|
50
|
-
|
51
|
-
var getTransitionName = function getTransitionName(rootPrefixCls, motion, transitionName) {
|
52
|
-
if (transitionName !== undefined) {
|
53
|
-
return transitionName;
|
54
|
-
}
|
55
|
-
|
56
|
-
return "".concat(rootPrefixCls, "-").concat(motion);
|
57
|
-
};
|
58
|
-
|
59
|
-
export { getTransitionName, getTransitionDirection };
|
60
|
-
export default collapseMotion;
|
package/es/affix/placements.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { BuildInPlacements } from 'rc-trigger';
|
2
|
-
export interface AdjustOverflow {
|
3
|
-
adjustX?: 0 | 1;
|
4
|
-
adjustY?: 0 | 1;
|
5
|
-
}
|
6
|
-
export interface PlacementsConfig {
|
7
|
-
arrowWidth?: number;
|
8
|
-
horizontalArrowShift?: number;
|
9
|
-
verticalArrowShift?: number;
|
10
|
-
arrowPointAtCenter?: boolean;
|
11
|
-
autoAdjustOverflow?: boolean | AdjustOverflow;
|
12
|
-
}
|
13
|
-
export declare function getOverflowOptions(autoAdjustOverflow?: boolean | AdjustOverflow): {
|
14
|
-
adjustX: number;
|
15
|
-
adjustY: number;
|
16
|
-
};
|
17
|
-
export default function getPlacements(config: PlacementsConfig): BuildInPlacements;
|
package/es/affix/placements.js
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import { placements } from "rc-tooltip/es/placements";
|
3
|
-
var autoAdjustOverflowEnabled = {
|
4
|
-
adjustX: 1,
|
5
|
-
adjustY: 1
|
6
|
-
};
|
7
|
-
var autoAdjustOverflowDisabled = {
|
8
|
-
adjustX: 0,
|
9
|
-
adjustY: 0
|
10
|
-
};
|
11
|
-
var targetOffset = [0, 0];
|
12
|
-
export function getOverflowOptions(autoAdjustOverflow) {
|
13
|
-
if (typeof autoAdjustOverflow === 'boolean') {
|
14
|
-
return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
|
15
|
-
}
|
16
|
-
|
17
|
-
return _extends(_extends({}, autoAdjustOverflowDisabled), autoAdjustOverflow);
|
18
|
-
}
|
19
|
-
export default function getPlacements(config) {
|
20
|
-
var _config$arrowWidth = config.arrowWidth,
|
21
|
-
arrowWidth = _config$arrowWidth === void 0 ? 4 : _config$arrowWidth,
|
22
|
-
_config$horizontalArr = config.horizontalArrowShift,
|
23
|
-
horizontalArrowShift = _config$horizontalArr === void 0 ? 16 : _config$horizontalArr,
|
24
|
-
_config$verticalArrow = config.verticalArrowShift,
|
25
|
-
verticalArrowShift = _config$verticalArrow === void 0 ? 8 : _config$verticalArrow,
|
26
|
-
autoAdjustOverflow = config.autoAdjustOverflow,
|
27
|
-
arrowPointAtCenter = config.arrowPointAtCenter;
|
28
|
-
var placementMap = {
|
29
|
-
left: {
|
30
|
-
points: ['cr', 'cl'],
|
31
|
-
offset: [-4, 0]
|
32
|
-
},
|
33
|
-
right: {
|
34
|
-
points: ['cl', 'cr'],
|
35
|
-
offset: [4, 0]
|
36
|
-
},
|
37
|
-
top: {
|
38
|
-
points: ['bc', 'tc'],
|
39
|
-
offset: [0, -4]
|
40
|
-
},
|
41
|
-
bottom: {
|
42
|
-
points: ['tc', 'bc'],
|
43
|
-
offset: [0, 4]
|
44
|
-
},
|
45
|
-
topLeft: {
|
46
|
-
points: ['bl', 'tc'],
|
47
|
-
offset: [-(horizontalArrowShift + arrowWidth), -4]
|
48
|
-
},
|
49
|
-
leftTop: {
|
50
|
-
points: ['tr', 'cl'],
|
51
|
-
offset: [-4, -(verticalArrowShift + arrowWidth)]
|
52
|
-
},
|
53
|
-
topRight: {
|
54
|
-
points: ['br', 'tc'],
|
55
|
-
offset: [horizontalArrowShift + arrowWidth, -4]
|
56
|
-
},
|
57
|
-
rightTop: {
|
58
|
-
points: ['tl', 'cr'],
|
59
|
-
offset: [4, -(verticalArrowShift + arrowWidth)]
|
60
|
-
},
|
61
|
-
bottomRight: {
|
62
|
-
points: ['tr', 'bc'],
|
63
|
-
offset: [horizontalArrowShift + arrowWidth, 4]
|
64
|
-
},
|
65
|
-
rightBottom: {
|
66
|
-
points: ['bl', 'cr'],
|
67
|
-
offset: [4, verticalArrowShift + arrowWidth]
|
68
|
-
},
|
69
|
-
bottomLeft: {
|
70
|
-
points: ['tl', 'bc'],
|
71
|
-
offset: [-(horizontalArrowShift + arrowWidth), 4]
|
72
|
-
},
|
73
|
-
leftBottom: {
|
74
|
-
points: ['br', 'cl'],
|
75
|
-
offset: [-4, verticalArrowShift + arrowWidth]
|
76
|
-
}
|
77
|
-
};
|
78
|
-
Object.keys(placementMap).forEach(function (key) {
|
79
|
-
placementMap[key] = arrowPointAtCenter ? _extends(_extends({}, placementMap[key]), {
|
80
|
-
overflow: getOverflowOptions(autoAdjustOverflow),
|
81
|
-
targetOffset: targetOffset
|
82
|
-
}) : _extends(_extends({}, placements[key]), {
|
83
|
-
overflow: getOverflowOptions(autoAdjustOverflow)
|
84
|
-
});
|
85
|
-
placementMap[key].ignoreShake = true;
|
86
|
-
});
|
87
|
-
return placementMap;
|
88
|
-
}
|
package/es/affix/raf.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
interface RafMap {
|
2
|
-
[id: number]: number;
|
3
|
-
}
|
4
|
-
declare function wrapperRaf(callback: () => void, delayFrames?: number): number;
|
5
|
-
declare namespace wrapperRaf {
|
6
|
-
var cancel: (pid?: number | undefined) => void;
|
7
|
-
var ids: RafMap;
|
8
|
-
}
|
9
|
-
export default wrapperRaf;
|
package/es/affix/raf.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import raf from "rc-util/es/raf";
|
2
|
-
var id = 0;
|
3
|
-
var ids = {}; // Support call raf with delay specified frame
|
4
|
-
|
5
|
-
export default function wrapperRaf(callback) {
|
6
|
-
var delayFrames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
7
|
-
var myId = id++;
|
8
|
-
var restFrames = delayFrames;
|
9
|
-
|
10
|
-
function internalCallback() {
|
11
|
-
restFrames -= 1;
|
12
|
-
|
13
|
-
if (restFrames <= 0) {
|
14
|
-
callback();
|
15
|
-
delete ids[myId];
|
16
|
-
} else {
|
17
|
-
ids[myId] = raf(internalCallback);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
ids[myId] = raf(internalCallback);
|
22
|
-
return myId;
|
23
|
-
}
|
24
|
-
|
25
|
-
wrapperRaf.cancel = function cancel(pid) {
|
26
|
-
if (pid === undefined) return;
|
27
|
-
raf.cancel(ids[pid]);
|
28
|
-
delete ids[pid];
|
29
|
-
};
|
30
|
-
|
31
|
-
wrapperRaf.ids = ids; // export this for test usage
|
package/es/affix/reactNode.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
export declare const isValidElement: typeof React.isValidElement;
|
3
|
-
export declare function isFragment(child: any): boolean;
|
4
|
-
type AnyObject = Record<PropertyKey, any>;
|
5
|
-
type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void);
|
6
|
-
export declare function replaceElement(element: React.ReactNode, replacement: React.ReactNode, props?: RenderProps): React.ReactNode;
|
7
|
-
export declare function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement;
|
8
|
-
export {};
|
package/es/affix/reactNode.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
var isValidElement = React.isValidElement;
|
3
|
-
export { isValidElement };
|
4
|
-
export function isFragment(child) {
|
5
|
-
return child && isValidElement(child) && child.type === React.Fragment;
|
6
|
-
}
|
7
|
-
export function replaceElement(element, replacement, props) {
|
8
|
-
if (!isValidElement(element)) {
|
9
|
-
return replacement;
|
10
|
-
}
|
11
|
-
|
12
|
-
return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props);
|
13
|
-
}
|
14
|
-
export function cloneElement(element, props) {
|
15
|
-
return replaceElement(element, element, props);
|
16
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
2
|
-
export type BreakpointMap = Record<Breakpoint, string>;
|
3
|
-
export type ScreenMap = Partial<Record<Breakpoint, boolean>>;
|
4
|
-
export type ScreenSizeMap = Partial<Record<Breakpoint, number>>;
|
5
|
-
export declare const responsiveArray: Breakpoint[];
|
6
|
-
export declare const responsiveMap: BreakpointMap;
|
7
|
-
type SubscribeFunc = (screens: ScreenMap) => void;
|
8
|
-
declare const responsiveObserve: {
|
9
|
-
matchHandlers: {
|
10
|
-
[prop: string]: {
|
11
|
-
mql: MediaQueryList;
|
12
|
-
listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;
|
13
|
-
};
|
14
|
-
};
|
15
|
-
dispatch(pointMap: ScreenMap): boolean;
|
16
|
-
subscribe(func: SubscribeFunc): number;
|
17
|
-
unsubscribe(token: number): void;
|
18
|
-
unregister(): void;
|
19
|
-
register(): void;
|
20
|
-
};
|
21
|
-
export default responsiveObserve;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
3
|
-
export var responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
4
|
-
export var responsiveMap = {
|
5
|
-
xs: '(max-width: 575px)',
|
6
|
-
sm: '(min-width: 576px)',
|
7
|
-
md: '(min-width: 768px)',
|
8
|
-
lg: '(min-width: 992px)',
|
9
|
-
xl: '(min-width: 1200px)',
|
10
|
-
xxl: '(min-width: 1600px)'
|
11
|
-
};
|
12
|
-
var subscribers = new Map();
|
13
|
-
var subUid = -1;
|
14
|
-
var screens = {};
|
15
|
-
var responsiveObserve = {
|
16
|
-
matchHandlers: {},
|
17
|
-
dispatch: function dispatch(pointMap) {
|
18
|
-
screens = pointMap;
|
19
|
-
subscribers.forEach(function (func) {
|
20
|
-
return func(screens);
|
21
|
-
});
|
22
|
-
return subscribers.size >= 1;
|
23
|
-
},
|
24
|
-
subscribe: function subscribe(func) {
|
25
|
-
if (!subscribers.size) this.register();
|
26
|
-
subUid += 1;
|
27
|
-
subscribers.set(subUid, func);
|
28
|
-
func(screens);
|
29
|
-
return subUid;
|
30
|
-
},
|
31
|
-
unsubscribe: function unsubscribe(token) {
|
32
|
-
subscribers["delete"](token);
|
33
|
-
if (!subscribers.size) this.unregister();
|
34
|
-
},
|
35
|
-
unregister: function unregister() {
|
36
|
-
var _this = this;
|
37
|
-
|
38
|
-
Object.keys(responsiveMap).forEach(function (screen) {
|
39
|
-
var matchMediaQuery = responsiveMap[screen];
|
40
|
-
var handler = _this.matchHandlers[matchMediaQuery];
|
41
|
-
handler === null || handler === void 0 ? void 0 : handler.mql.removeListener(handler === null || handler === void 0 ? void 0 : handler.listener);
|
42
|
-
});
|
43
|
-
subscribers.clear();
|
44
|
-
},
|
45
|
-
register: function register() {
|
46
|
-
var _this2 = this;
|
47
|
-
|
48
|
-
Object.keys(responsiveMap).forEach(function (screen) {
|
49
|
-
var matchMediaQuery = responsiveMap[screen];
|
50
|
-
|
51
|
-
var listener = function listener(_ref) {
|
52
|
-
var matches = _ref.matches;
|
53
|
-
|
54
|
-
_this2.dispatch(_extends(_extends({}, screens), _defineProperty({}, screen, matches)));
|
55
|
-
};
|
56
|
-
|
57
|
-
var mql = window.matchMedia(matchMediaQuery);
|
58
|
-
mql.addListener(listener);
|
59
|
-
_this2.matchHandlers[matchMediaQuery] = {
|
60
|
-
mql: mql,
|
61
|
-
listener: listener
|
62
|
-
};
|
63
|
-
listener(mql);
|
64
|
-
});
|
65
|
-
}
|
66
|
-
};
|
67
|
-
export default responsiveObserve;
|
package/es/affix/scrollTo.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
interface ScrollToOptions {
|
2
|
-
/** Scroll container, default as window */
|
3
|
-
getContainer?: () => HTMLElement | Window | Document;
|
4
|
-
/** Scroll end callback */
|
5
|
-
callback?: () => any;
|
6
|
-
/** Animation duration, default as 450 */
|
7
|
-
duration?: number;
|
8
|
-
}
|
9
|
-
export default function scrollTo(y: number, options?: ScrollToOptions): void;
|
10
|
-
export {};
|
package/es/affix/scrollTo.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import raf from "rc-util/es/raf";
|
2
|
-
import { easeInOutCubic } from "./easings";
|
3
|
-
import getScroll, { isWindow } from "./getScroll";
|
4
|
-
export default function scrollTo(y) {
|
5
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
6
|
-
var _options$getContainer = options.getContainer,
|
7
|
-
getContainer = _options$getContainer === void 0 ? function () {
|
8
|
-
return window;
|
9
|
-
} : _options$getContainer,
|
10
|
-
callback = options.callback,
|
11
|
-
_options$duration = options.duration,
|
12
|
-
duration = _options$duration === void 0 ? 450 : _options$duration;
|
13
|
-
var container = getContainer();
|
14
|
-
var scrollTop = getScroll(container, true);
|
15
|
-
var startTime = Date.now();
|
16
|
-
|
17
|
-
var frameFunc = function frameFunc() {
|
18
|
-
var timestamp = Date.now();
|
19
|
-
var time = timestamp - startTime;
|
20
|
-
var nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
|
21
|
-
|
22
|
-
if (isWindow(container)) {
|
23
|
-
container.scrollTo(window.pageXOffset, nextScrollTop);
|
24
|
-
} else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
|
25
|
-
container.documentElement.scrollTop = nextScrollTop;
|
26
|
-
} else {
|
27
|
-
container.scrollTop = nextScrollTop;
|
28
|
-
}
|
29
|
-
|
30
|
-
if (time < duration) {
|
31
|
-
raf(frameFunc);
|
32
|
-
} else if (typeof callback === 'function') {
|
33
|
-
callback();
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
raf(frameFunc);
|
38
|
-
}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { ValidateStatus } from '../form/FormItem';
|
2
|
-
declare const InputStatuses: ["warning", "error", ""];
|
3
|
-
export type InputStatus = typeof InputStatuses[number];
|
4
|
-
export declare function getStatusClassNames(prefixCls: string, status?: ValidateStatus, hasFeedback?: boolean): string;
|
5
|
-
export declare const getMergedStatus: (contextStatus?: ValidateStatus, customStatus?: InputStatus) => "" | "success" | "warning" | "error" | "validating" | undefined;
|
6
|
-
export {};
|
package/es/affix/statusUtils.js
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
-
import classNames from 'classnames';
|
3
|
-
import { tuple } from "./type";
|
4
|
-
var InputStatuses = tuple('warning', 'error', '');
|
5
|
-
export function getStatusClassNames(prefixCls, status, hasFeedback) {
|
6
|
-
var _classNames;
|
7
|
-
|
8
|
-
return classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-status-success"), status === 'success'), _defineProperty(_classNames, "".concat(prefixCls, "-status-warning"), status === 'warning'), _defineProperty(_classNames, "".concat(prefixCls, "-status-error"), status === 'error'), _defineProperty(_classNames, "".concat(prefixCls, "-status-validating"), status === 'validating'), _defineProperty(_classNames, "".concat(prefixCls, "-has-feedback"), hasFeedback), _classNames));
|
9
|
-
}
|
10
|
-
export var getMergedStatus = function getMergedStatus(contextStatus, customStatus) {
|
11
|
-
return customStatus || contextStatus;
|
12
|
-
};
|
package/es/affix/styleChecker.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import canUseDom from "rc-util/es/Dom/canUseDom";
|
2
|
-
import { isStyleSupport } from "rc-util/es/Dom/styleChecker";
|
3
|
-
export var canUseDocElement = function canUseDocElement() {
|
4
|
-
return canUseDom() && window.document.documentElement;
|
5
|
-
};
|
6
|
-
export { isStyleSupport };
|
7
|
-
var flexGapSupported;
|
8
|
-
export var detectFlexGapSupported = function detectFlexGapSupported() {
|
9
|
-
if (!canUseDocElement()) {
|
10
|
-
return false;
|
11
|
-
}
|
12
|
-
|
13
|
-
if (flexGapSupported !== undefined) {
|
14
|
-
return flexGapSupported;
|
15
|
-
} // create flex container with row-gap set
|
16
|
-
|
17
|
-
|
18
|
-
var flex = document.createElement('div');
|
19
|
-
flex.style.display = 'flex';
|
20
|
-
flex.style.flexDirection = 'column';
|
21
|
-
flex.style.rowGap = '1px'; // create two, elements inside it
|
22
|
-
|
23
|
-
flex.appendChild(document.createElement('div'));
|
24
|
-
flex.appendChild(document.createElement('div')); // append to the DOM (needed to obtain scrollHeight)
|
25
|
-
|
26
|
-
document.body.appendChild(flex);
|
27
|
-
flexGapSupported = flex.scrollHeight === 1; // flex container should be 1px high from the row-gap
|
28
|
-
|
29
|
-
document.body.removeChild(flex);
|
30
|
-
return flexGapSupported;
|
31
|
-
};
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare function throttleByAnimationFrame<T extends unknown[]>(fn: (...args: T) => void): {
|
2
|
-
(...args: T): void;
|
3
|
-
cancel: () => void;
|
4
|
-
};
|
5
|
-
export declare function throttleByAnimationFrameDecorator(): (target: any, key: string, descriptor: any) => {
|
6
|
-
configurable: boolean;
|
7
|
-
get(): any;
|
8
|
-
};
|