first commit
This commit is contained in:
17
frontend/node_modules/rc-util/es/Dom/addEventListener.js
generated
vendored
Normal file
17
frontend/node_modules/rc-util/es/Dom/addEventListener.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import ReactDOM from 'react-dom';
|
||||
export default function addEventListenerWrap(target, eventType, cb, option) {
|
||||
/* eslint camelcase: 2 */
|
||||
var callback = ReactDOM.unstable_batchedUpdates ? function run(e) {
|
||||
ReactDOM.unstable_batchedUpdates(cb, e);
|
||||
} : cb;
|
||||
if (target !== null && target !== void 0 && target.addEventListener) {
|
||||
target.addEventListener(eventType, callback, option);
|
||||
}
|
||||
return {
|
||||
remove: function remove() {
|
||||
if (target !== null && target !== void 0 && target.removeEventListener) {
|
||||
target.removeEventListener(eventType, callback, option);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
1
frontend/node_modules/rc-util/es/Dom/canUseDom.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-util/es/Dom/canUseDom.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function canUseDom(): boolean;
|
||||
3
frontend/node_modules/rc-util/es/Dom/canUseDom.js
generated
vendored
Normal file
3
frontend/node_modules/rc-util/es/Dom/canUseDom.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function canUseDom() {
|
||||
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
}
|
||||
26
frontend/node_modules/rc-util/es/Dom/class.js
generated
vendored
Normal file
26
frontend/node_modules/rc-util/es/Dom/class.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
export function hasClass(node, className) {
|
||||
if (node.classList) {
|
||||
return node.classList.contains(className);
|
||||
}
|
||||
var originClass = node.className;
|
||||
return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1;
|
||||
}
|
||||
export function addClass(node, className) {
|
||||
if (node.classList) {
|
||||
node.classList.add(className);
|
||||
} else {
|
||||
if (!hasClass(node, className)) {
|
||||
node.className = "".concat(node.className, " ").concat(className);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function removeClass(node, className) {
|
||||
if (node.classList) {
|
||||
node.classList.remove(className);
|
||||
} else {
|
||||
if (hasClass(node, className)) {
|
||||
var originClass = node.className;
|
||||
node.className = " ".concat(originClass, " ").replace(" ".concat(className, " "), ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
1
frontend/node_modules/rc-util/es/Dom/contains.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-util/es/Dom/contains.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function contains(root: Node | null | undefined, n?: Node): boolean;
|
||||
20
frontend/node_modules/rc-util/es/Dom/contains.js
generated
vendored
Normal file
20
frontend/node_modules/rc-util/es/Dom/contains.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export default function contains(root, n) {
|
||||
if (!root) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use native if support
|
||||
if (root.contains) {
|
||||
return root.contains(n);
|
||||
}
|
||||
|
||||
// `document.contains` not support with IE11
|
||||
var node = n;
|
||||
while (node) {
|
||||
if (node === root) {
|
||||
return true;
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
96
frontend/node_modules/rc-util/es/Dom/css.js
generated
vendored
Normal file
96
frontend/node_modules/rc-util/es/Dom/css.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
var PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
|
||||
var removePixel = {
|
||||
left: true,
|
||||
top: true
|
||||
};
|
||||
var floatMap = {
|
||||
cssFloat: 1,
|
||||
styleFloat: 1,
|
||||
float: 1
|
||||
};
|
||||
function getComputedStyle(node) {
|
||||
return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
|
||||
}
|
||||
function getStyleValue(node, type, value) {
|
||||
type = type.toLowerCase();
|
||||
if (value === 'auto') {
|
||||
if (type === 'height') {
|
||||
return node.offsetHeight;
|
||||
}
|
||||
if (type === 'width') {
|
||||
return node.offsetWidth;
|
||||
}
|
||||
}
|
||||
if (!(type in removePixel)) {
|
||||
removePixel[type] = PIXEL_PATTERN.test(type);
|
||||
}
|
||||
return removePixel[type] ? parseFloat(value) || 0 : value;
|
||||
}
|
||||
export function get(node, name) {
|
||||
var length = arguments.length;
|
||||
var style = getComputedStyle(node);
|
||||
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
||||
return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
|
||||
}
|
||||
export function set(node, name, value) {
|
||||
var length = arguments.length;
|
||||
name = floatMap[name] ? 'cssFloat' in node.style ? 'cssFloat' : 'styleFloat' : name;
|
||||
if (length === 3) {
|
||||
if (typeof value === 'number' && PIXEL_PATTERN.test(name)) {
|
||||
value = "".concat(value, "px");
|
||||
}
|
||||
node.style[name] = value; // Number
|
||||
return value;
|
||||
}
|
||||
for (var x in name) {
|
||||
if (name.hasOwnProperty(x)) {
|
||||
set(node, x, name[x]);
|
||||
}
|
||||
}
|
||||
return getComputedStyle(node);
|
||||
}
|
||||
export function getOuterWidth(el) {
|
||||
if (el === document.body) {
|
||||
return document.documentElement.clientWidth;
|
||||
}
|
||||
return el.offsetWidth;
|
||||
}
|
||||
export function getOuterHeight(el) {
|
||||
if (el === document.body) {
|
||||
return window.innerHeight || document.documentElement.clientHeight;
|
||||
}
|
||||
return el.offsetHeight;
|
||||
}
|
||||
export function getDocSize() {
|
||||
var width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
|
||||
var height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
export function getClientSize() {
|
||||
var width = document.documentElement.clientWidth;
|
||||
var height = window.innerHeight || document.documentElement.clientHeight;
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
export function getScroll() {
|
||||
return {
|
||||
scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
|
||||
scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
|
||||
};
|
||||
}
|
||||
export function getOffset(node) {
|
||||
var box = node.getBoundingClientRect();
|
||||
var docElem = document.documentElement;
|
||||
|
||||
// < ie8 不支持 win.pageXOffset, 则使用 docElem.scrollLeft
|
||||
return {
|
||||
left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
|
||||
top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
|
||||
};
|
||||
}
|
||||
25
frontend/node_modules/rc-util/es/Dom/dynamicCSS.d.ts
generated
vendored
Normal file
25
frontend/node_modules/rc-util/es/Dom/dynamicCSS.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
export type ContainerType = Element | ShadowRoot;
|
||||
export type Prepend = boolean | 'queue';
|
||||
export type AppendType = 'prependQueue' | 'append' | 'prepend';
|
||||
interface Options {
|
||||
attachTo?: ContainerType;
|
||||
csp?: {
|
||||
nonce?: string;
|
||||
};
|
||||
prepend?: Prepend;
|
||||
/**
|
||||
* Config the `priority` of `prependQueue`. Default is `0`.
|
||||
* It's useful if you need to insert style before other style.
|
||||
*/
|
||||
priority?: number;
|
||||
mark?: string;
|
||||
styles?: HTMLElement[];
|
||||
}
|
||||
export declare function injectCSS(css: string, option?: Options): HTMLStyleElement;
|
||||
export declare function removeCSS(key: string, option?: Options): void;
|
||||
/**
|
||||
* manually clear container cache to avoid global cache in unit testes
|
||||
*/
|
||||
export declare function clearContainerCache(): void;
|
||||
export declare function updateCSS(css: string, key: string, originOption?: Options): HTMLElement;
|
||||
export {};
|
||||
148
frontend/node_modules/rc-util/es/Dom/dynamicCSS.js
generated
vendored
Normal file
148
frontend/node_modules/rc-util/es/Dom/dynamicCSS.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
||||
import canUseDom from "./canUseDom";
|
||||
import contains from "./contains";
|
||||
var APPEND_ORDER = 'data-rc-order';
|
||||
var APPEND_PRIORITY = 'data-rc-priority';
|
||||
var MARK_KEY = "rc-util-key";
|
||||
var containerCache = new Map();
|
||||
function getMark() {
|
||||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
mark = _ref.mark;
|
||||
if (mark) {
|
||||
return mark.startsWith('data-') ? mark : "data-".concat(mark);
|
||||
}
|
||||
return MARK_KEY;
|
||||
}
|
||||
function getContainer(option) {
|
||||
if (option.attachTo) {
|
||||
return option.attachTo;
|
||||
}
|
||||
var head = document.querySelector('head');
|
||||
return head || document.body;
|
||||
}
|
||||
function getOrder(prepend) {
|
||||
if (prepend === 'queue') {
|
||||
return 'prependQueue';
|
||||
}
|
||||
return prepend ? 'prepend' : 'append';
|
||||
}
|
||||
|
||||
/**
|
||||
* Find style which inject by rc-util
|
||||
*/
|
||||
function findStyles(container) {
|
||||
return Array.from((containerCache.get(container) || container).children).filter(function (node) {
|
||||
return node.tagName === 'STYLE';
|
||||
});
|
||||
}
|
||||
export function injectCSS(css) {
|
||||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
if (!canUseDom()) {
|
||||
return null;
|
||||
}
|
||||
var csp = option.csp,
|
||||
prepend = option.prepend,
|
||||
_option$priority = option.priority,
|
||||
priority = _option$priority === void 0 ? 0 : _option$priority;
|
||||
var mergedOrder = getOrder(prepend);
|
||||
var isPrependQueue = mergedOrder === 'prependQueue';
|
||||
var styleNode = document.createElement('style');
|
||||
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
||||
if (isPrependQueue && priority) {
|
||||
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
|
||||
}
|
||||
if (csp !== null && csp !== void 0 && csp.nonce) {
|
||||
styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
|
||||
}
|
||||
styleNode.innerHTML = css;
|
||||
var container = getContainer(option);
|
||||
var firstChild = container.firstChild;
|
||||
if (prepend) {
|
||||
// If is queue `prepend`, it will prepend first style and then append rest style
|
||||
if (isPrependQueue) {
|
||||
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
|
||||
// Ignore style which not injected by rc-util with prepend
|
||||
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ignore style which priority less then new style
|
||||
var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
||||
return priority >= nodePriority;
|
||||
});
|
||||
if (existStyle.length) {
|
||||
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
||||
return styleNode;
|
||||
}
|
||||
}
|
||||
|
||||
// Use `insertBefore` as `prepend`
|
||||
container.insertBefore(styleNode, firstChild);
|
||||
} else {
|
||||
container.appendChild(styleNode);
|
||||
}
|
||||
return styleNode;
|
||||
}
|
||||
function findExistNode(key) {
|
||||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var container = getContainer(option);
|
||||
return (option.styles || findStyles(container)).find(function (node) {
|
||||
return node.getAttribute(getMark(option)) === key;
|
||||
});
|
||||
}
|
||||
export function removeCSS(key) {
|
||||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var existNode = findExistNode(key, option);
|
||||
if (existNode) {
|
||||
var container = getContainer(option);
|
||||
container.removeChild(existNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* qiankun will inject `appendChild` to insert into other
|
||||
*/
|
||||
function syncRealContainer(container, option) {
|
||||
var cachedRealContainer = containerCache.get(container);
|
||||
|
||||
// Find real container when not cached or cached container removed
|
||||
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
||||
var placeholderStyle = injectCSS('', option);
|
||||
var parentNode = placeholderStyle.parentNode;
|
||||
containerCache.set(container, parentNode);
|
||||
container.removeChild(placeholderStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* manually clear container cache to avoid global cache in unit testes
|
||||
*/
|
||||
export function clearContainerCache() {
|
||||
containerCache.clear();
|
||||
}
|
||||
export function updateCSS(css, key) {
|
||||
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var container = getContainer(originOption);
|
||||
var styles = findStyles(container);
|
||||
var option = _objectSpread(_objectSpread({}, originOption), {}, {
|
||||
styles: styles
|
||||
});
|
||||
|
||||
// Sync real parent
|
||||
syncRealContainer(container, option);
|
||||
var existNode = findExistNode(key, option);
|
||||
if (existNode) {
|
||||
var _option$csp, _option$csp2;
|
||||
if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
|
||||
var _option$csp3;
|
||||
existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
|
||||
}
|
||||
if (existNode.innerHTML !== css) {
|
||||
existNode.innerHTML = css;
|
||||
}
|
||||
return existNode;
|
||||
}
|
||||
var newNode = injectCSS(css, option);
|
||||
newNode.setAttribute(getMark(option), key);
|
||||
return newNode;
|
||||
}
|
||||
12
frontend/node_modules/rc-util/es/Dom/findDOMNode.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-util/es/Dom/findDOMNode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
export declare function isDOM(node: any): node is HTMLElement | SVGElement;
|
||||
/**
|
||||
* Retrieves a DOM node via a ref, and does not invoke `findDOMNode`.
|
||||
*/
|
||||
export declare function getDOM(node: any): HTMLElement | SVGElement | null;
|
||||
/**
|
||||
* Return if a node is a DOM node. Else will return by `findDOMNode`
|
||||
*/
|
||||
export default function findDOMNode<T = Element | Text>(node: React.ReactInstance | HTMLElement | SVGElement | {
|
||||
nativeElement: T;
|
||||
}): T;
|
||||
36
frontend/node_modules/rc-util/es/Dom/findDOMNode.js
generated
vendored
Normal file
36
frontend/node_modules/rc-util/es/Dom/findDOMNode.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
export function isDOM(node) {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Element
|
||||
// Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement
|
||||
return node instanceof HTMLElement || node instanceof SVGElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOM node via a ref, and does not invoke `findDOMNode`.
|
||||
*/
|
||||
export function getDOM(node) {
|
||||
if (node && _typeof(node) === 'object' && isDOM(node.nativeElement)) {
|
||||
return node.nativeElement;
|
||||
}
|
||||
if (isDOM(node)) {
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a node is a DOM node. Else will return by `findDOMNode`
|
||||
*/
|
||||
export default function findDOMNode(node) {
|
||||
var domNode = getDOM(node);
|
||||
if (domNode) {
|
||||
return domNode;
|
||||
}
|
||||
if (node instanceof React.Component) {
|
||||
var _ReactDOM$findDOMNode;
|
||||
return (_ReactDOM$findDOMNode = ReactDOM.findDOMNode) === null || _ReactDOM$findDOMNode === void 0 ? void 0 : _ReactDOM$findDOMNode.call(ReactDOM, node);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
8
frontend/node_modules/rc-util/es/Dom/focus.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-util/es/Dom/focus.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare function getFocusNodeList(node: HTMLElement, includePositive?: boolean): HTMLElement[];
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export declare function saveLastFocusNode(): void;
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export declare function clearLastFocusNode(): void;
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export declare function backLastFocusNode(): void;
|
||||
export declare function limitTabRange(node: HTMLElement, e: KeyboardEvent): void;
|
||||
82
frontend/node_modules/rc-util/es/Dom/focus.js
generated
vendored
Normal file
82
frontend/node_modules/rc-util/es/Dom/focus.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import isVisible from "./isVisible";
|
||||
function focusable(node) {
|
||||
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
if (isVisible(node)) {
|
||||
var nodeName = node.nodeName.toLowerCase();
|
||||
var isFocusableElement =
|
||||
// Focusable element
|
||||
['input', 'select', 'textarea', 'button'].includes(nodeName) ||
|
||||
// Editable element
|
||||
node.isContentEditable ||
|
||||
// Anchor with href element
|
||||
nodeName === 'a' && !!node.getAttribute('href');
|
||||
|
||||
// Get tabIndex
|
||||
var tabIndexAttr = node.getAttribute('tabindex');
|
||||
var tabIndexNum = Number(tabIndexAttr);
|
||||
|
||||
// Parse as number if validate
|
||||
var tabIndex = null;
|
||||
if (tabIndexAttr && !Number.isNaN(tabIndexNum)) {
|
||||
tabIndex = tabIndexNum;
|
||||
} else if (isFocusableElement && tabIndex === null) {
|
||||
tabIndex = 0;
|
||||
}
|
||||
|
||||
// Block focusable if disabled
|
||||
if (isFocusableElement && node.disabled) {
|
||||
tabIndex = null;
|
||||
}
|
||||
return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export function getFocusNodeList(node) {
|
||||
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
var res = _toConsumableArray(node.querySelectorAll('*')).filter(function (child) {
|
||||
return focusable(child, includePositive);
|
||||
});
|
||||
if (focusable(node, includePositive)) {
|
||||
res.unshift(node);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
var lastFocusElement = null;
|
||||
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export function saveLastFocusNode() {
|
||||
lastFocusElement = document.activeElement;
|
||||
}
|
||||
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export function clearLastFocusNode() {
|
||||
lastFocusElement = null;
|
||||
}
|
||||
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
export function backLastFocusNode() {
|
||||
if (lastFocusElement) {
|
||||
try {
|
||||
// 元素可能已经被移动了
|
||||
lastFocusElement.focus();
|
||||
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
/* eslint-enable no-empty */
|
||||
}
|
||||
}
|
||||
export function limitTabRange(node, e) {
|
||||
if (e.keyCode === 9) {
|
||||
var tabNodeList = getFocusNodeList(node);
|
||||
var lastTabNode = tabNodeList[e.shiftKey ? 0 : tabNodeList.length - 1];
|
||||
var leavingTab = lastTabNode === document.activeElement || node === document.activeElement;
|
||||
if (leavingTab) {
|
||||
var target = tabNodeList[e.shiftKey ? tabNodeList.length - 1 : 0];
|
||||
target.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
frontend/node_modules/rc-util/es/Dom/isVisible.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-util/es/Dom/isVisible.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: (element: Element) => boolean;
|
||||
export default _default;
|
||||
27
frontend/node_modules/rc-util/es/Dom/isVisible.js
generated
vendored
Normal file
27
frontend/node_modules/rc-util/es/Dom/isVisible.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export default (function (element) {
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
if (element instanceof Element) {
|
||||
if (element.offsetParent) {
|
||||
return true;
|
||||
}
|
||||
if (element.getBBox) {
|
||||
var _getBBox = element.getBBox(),
|
||||
width = _getBBox.width,
|
||||
height = _getBBox.height;
|
||||
if (width || height) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (element.getBoundingClientRect) {
|
||||
var _element$getBoundingC = element.getBoundingClientRect(),
|
||||
_width = _element$getBoundingC.width,
|
||||
_height = _element$getBoundingC.height;
|
||||
if (_width || _height) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
12
frontend/node_modules/rc-util/es/Dom/scrollLocker.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-util/es/Dom/scrollLocker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export interface scrollLockOptions {
|
||||
container: HTMLElement;
|
||||
}
|
||||
export default class ScrollLocker {
|
||||
private lockTarget;
|
||||
private options;
|
||||
constructor(options?: scrollLockOptions);
|
||||
getContainer: () => HTMLElement | undefined;
|
||||
reLock: (options?: scrollLockOptions) => void;
|
||||
lock: () => void;
|
||||
unLock: () => void;
|
||||
}
|
||||
126
frontend/node_modules/rc-util/es/Dom/scrollLocker.js
generated
vendored
Normal file
126
frontend/node_modules/rc-util/es/Dom/scrollLocker.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
||||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
||||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||||
import getScrollBarSize from "../getScrollBarSize";
|
||||
import setStyle from "../setStyle";
|
||||
var uuid = 0;
|
||||
var locks = [];
|
||||
var scrollingEffectClassName = 'ant-scrolling-effect';
|
||||
var scrollingEffectClassNameReg = new RegExp("".concat(scrollingEffectClassName), 'g');
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/19340
|
||||
// https://github.com/ant-design/ant-design/issues/19332
|
||||
var cacheStyle = new Map();
|
||||
var ScrollLocker = /*#__PURE__*/_createClass(function ScrollLocker(_options) {
|
||||
var _this = this;
|
||||
_classCallCheck(this, ScrollLocker);
|
||||
_defineProperty(this, "lockTarget", void 0);
|
||||
_defineProperty(this, "options", void 0);
|
||||
_defineProperty(this, "getContainer", function () {
|
||||
var _this$options;
|
||||
return (_this$options = _this.options) === null || _this$options === void 0 ? void 0 : _this$options.container;
|
||||
});
|
||||
// if options change...
|
||||
_defineProperty(this, "reLock", function (options) {
|
||||
var findLock = locks.find(function (_ref) {
|
||||
var target = _ref.target;
|
||||
return target === _this.lockTarget;
|
||||
});
|
||||
if (findLock) {
|
||||
_this.unLock();
|
||||
}
|
||||
_this.options = options;
|
||||
if (findLock) {
|
||||
findLock.options = options;
|
||||
_this.lock();
|
||||
}
|
||||
});
|
||||
_defineProperty(this, "lock", function () {
|
||||
var _this$options3;
|
||||
// If lockTarget exist return
|
||||
if (locks.some(function (_ref2) {
|
||||
var target = _ref2.target;
|
||||
return target === _this.lockTarget;
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If same container effect, return
|
||||
if (locks.some(function (_ref3) {
|
||||
var _this$options2;
|
||||
var options = _ref3.options;
|
||||
return (options === null || options === void 0 ? void 0 : options.container) === ((_this$options2 = _this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.container);
|
||||
})) {
|
||||
locks = [].concat(_toConsumableArray(locks), [{
|
||||
target: _this.lockTarget,
|
||||
options: _this.options
|
||||
}]);
|
||||
return;
|
||||
}
|
||||
var scrollBarSize = 0;
|
||||
var container = ((_this$options3 = _this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.container) || document.body;
|
||||
if (container === document.body && window.innerWidth - document.documentElement.clientWidth > 0 || container.scrollHeight > container.clientHeight) {
|
||||
if (getComputedStyle(container).overflow !== 'hidden') {
|
||||
scrollBarSize = getScrollBarSize();
|
||||
}
|
||||
}
|
||||
var containerClassName = container.className;
|
||||
if (locks.filter(function (_ref4) {
|
||||
var _this$options4;
|
||||
var options = _ref4.options;
|
||||
return (options === null || options === void 0 ? void 0 : options.container) === ((_this$options4 = _this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.container);
|
||||
}).length === 0) {
|
||||
cacheStyle.set(container, setStyle({
|
||||
width: scrollBarSize !== 0 ? "calc(100% - ".concat(scrollBarSize, "px)") : undefined,
|
||||
overflow: 'hidden',
|
||||
overflowX: 'hidden',
|
||||
overflowY: 'hidden'
|
||||
}, {
|
||||
element: container
|
||||
}));
|
||||
}
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/19729
|
||||
if (!scrollingEffectClassNameReg.test(containerClassName)) {
|
||||
var addClassName = "".concat(containerClassName, " ").concat(scrollingEffectClassName);
|
||||
container.className = addClassName.trim();
|
||||
}
|
||||
locks = [].concat(_toConsumableArray(locks), [{
|
||||
target: _this.lockTarget,
|
||||
options: _this.options
|
||||
}]);
|
||||
});
|
||||
_defineProperty(this, "unLock", function () {
|
||||
var _this$options5;
|
||||
var findLock = locks.find(function (_ref5) {
|
||||
var target = _ref5.target;
|
||||
return target === _this.lockTarget;
|
||||
});
|
||||
locks = locks.filter(function (_ref6) {
|
||||
var target = _ref6.target;
|
||||
return target !== _this.lockTarget;
|
||||
});
|
||||
if (!findLock || locks.some(function (_ref7) {
|
||||
var _findLock$options;
|
||||
var options = _ref7.options;
|
||||
return (options === null || options === void 0 ? void 0 : options.container) === ((_findLock$options = findLock.options) === null || _findLock$options === void 0 ? void 0 : _findLock$options.container);
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove Effect
|
||||
var container = ((_this$options5 = _this.options) === null || _this$options5 === void 0 ? void 0 : _this$options5.container) || document.body;
|
||||
var containerClassName = container.className;
|
||||
if (!scrollingEffectClassNameReg.test(containerClassName)) return;
|
||||
setStyle(cacheStyle.get(container), {
|
||||
element: container
|
||||
});
|
||||
cacheStyle.delete(container);
|
||||
container.className = container.className.replace(scrollingEffectClassNameReg, '').trim();
|
||||
});
|
||||
// eslint-disable-next-line no-plusplus
|
||||
this.lockTarget = uuid++;
|
||||
this.options = _options;
|
||||
});
|
||||
export { ScrollLocker as default };
|
||||
8
frontend/node_modules/rc-util/es/Dom/shadow.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-util/es/Dom/shadow.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Check if is in shadowRoot
|
||||
*/
|
||||
export declare function inShadow(ele: Node): boolean;
|
||||
/**
|
||||
* Return shadowRoot if possible
|
||||
*/
|
||||
export declare function getShadowRoot(ele: Node): ShadowRoot;
|
||||
18
frontend/node_modules/rc-util/es/Dom/shadow.js
generated
vendored
Normal file
18
frontend/node_modules/rc-util/es/Dom/shadow.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
function getRoot(ele) {
|
||||
var _ele$getRootNode;
|
||||
return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if is in shadowRoot
|
||||
*/
|
||||
export function inShadow(ele) {
|
||||
return getRoot(ele) instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return shadowRoot if possible
|
||||
*/
|
||||
export function getShadowRoot(ele) {
|
||||
return inShadow(ele) ? getRoot(ele) : null;
|
||||
}
|
||||
2
frontend/node_modules/rc-util/es/Dom/styleChecker.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-util/es/Dom/styleChecker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function isStyleSupport(styleName: string | string[]): boolean;
|
||||
export declare function isStyleSupport(styleName: string, styleValue: any): boolean;
|
||||
26
frontend/node_modules/rc-util/es/Dom/styleChecker.js
generated
vendored
Normal file
26
frontend/node_modules/rc-util/es/Dom/styleChecker.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import canUseDom from "./canUseDom";
|
||||
var isStyleNameSupport = function isStyleNameSupport(styleName) {
|
||||
if (canUseDom() && window.document.documentElement) {
|
||||
var styleNameList = Array.isArray(styleName) ? styleName : [styleName];
|
||||
var documentElement = window.document.documentElement;
|
||||
return styleNameList.some(function (name) {
|
||||
return name in documentElement.style;
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var isStyleValueSupport = function isStyleValueSupport(styleName, value) {
|
||||
if (!isStyleNameSupport(styleName)) {
|
||||
return false;
|
||||
}
|
||||
var ele = document.createElement('div');
|
||||
var origin = ele.style[styleName];
|
||||
ele.style[styleName] = value;
|
||||
return ele.style[styleName] !== origin;
|
||||
};
|
||||
export function isStyleSupport(styleName, styleValue) {
|
||||
if (!Array.isArray(styleName) && styleValue !== undefined) {
|
||||
return isStyleValueSupport(styleName, styleValue);
|
||||
}
|
||||
return isStyleNameSupport(styleName);
|
||||
}
|
||||
24
frontend/node_modules/rc-util/es/Dom/support.js
generated
vendored
Normal file
24
frontend/node_modules/rc-util/es/Dom/support.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import canUseDOM from "./canUseDom";
|
||||
var animationEndEventNames = {
|
||||
WebkitAnimation: 'webkitAnimationEnd',
|
||||
OAnimation: 'oAnimationEnd',
|
||||
animation: 'animationend'
|
||||
};
|
||||
var transitionEventNames = {
|
||||
WebkitTransition: 'webkitTransitionEnd',
|
||||
OTransition: 'oTransitionEnd',
|
||||
transition: 'transitionend'
|
||||
};
|
||||
function supportEnd(names) {
|
||||
var el = document.createElement('div');
|
||||
for (var name in names) {
|
||||
if (names.hasOwnProperty(name) && el.style[name] !== undefined) {
|
||||
return {
|
||||
end: names[name]
|
||||
};
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export var animation = canUseDOM() && supportEnd(animationEndEventNames);
|
||||
export var transition = canUseDOM() && supportEnd(transitionEventNames);
|
||||
Reference in New Issue
Block a user