first commit
This commit is contained in:
24
frontend/node_modules/rc-util/lib/Dom/addEventListener.js
generated
vendored
Normal file
24
frontend/node_modules/rc-util/lib/Dom/addEventListener.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addEventListenerWrap;
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
function addEventListenerWrap(target, eventType, cb, option) {
|
||||
/* eslint camelcase: 2 */
|
||||
var callback = _reactDom.default.unstable_batchedUpdates ? function run(e) {
|
||||
_reactDom.default.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/lib/Dom/canUseDom.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-util/lib/Dom/canUseDom.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function canUseDom(): boolean;
|
||||
9
frontend/node_modules/rc-util/lib/Dom/canUseDom.js
generated
vendored
Normal file
9
frontend/node_modules/rc-util/lib/Dom/canUseDom.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = canUseDom;
|
||||
function canUseDom() {
|
||||
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
}
|
||||
34
frontend/node_modules/rc-util/lib/Dom/class.js
generated
vendored
Normal file
34
frontend/node_modules/rc-util/lib/Dom/class.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.addClass = addClass;
|
||||
exports.hasClass = hasClass;
|
||||
exports.removeClass = removeClass;
|
||||
function hasClass(node, className) {
|
||||
if (node.classList) {
|
||||
return node.classList.contains(className);
|
||||
}
|
||||
var originClass = node.className;
|
||||
return " ".concat(originClass, " ").indexOf(" ".concat(className, " ")) > -1;
|
||||
}
|
||||
function addClass(node, className) {
|
||||
if (node.classList) {
|
||||
node.classList.add(className);
|
||||
} else {
|
||||
if (!hasClass(node, className)) {
|
||||
node.className = "".concat(node.className, " ").concat(className);
|
||||
}
|
||||
}
|
||||
}
|
||||
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/lib/Dom/contains.d.ts
generated
vendored
Normal file
1
frontend/node_modules/rc-util/lib/Dom/contains.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function contains(root: Node | null | undefined, n?: Node): boolean;
|
||||
26
frontend/node_modules/rc-util/lib/Dom/contains.js
generated
vendored
Normal file
26
frontend/node_modules/rc-util/lib/Dom/contains.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = contains;
|
||||
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;
|
||||
}
|
||||
109
frontend/node_modules/rc-util/lib/Dom/css.js
generated
vendored
Normal file
109
frontend/node_modules/rc-util/lib/Dom/css.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.get = get;
|
||||
exports.getClientSize = getClientSize;
|
||||
exports.getDocSize = getDocSize;
|
||||
exports.getOffset = getOffset;
|
||||
exports.getOuterHeight = getOuterHeight;
|
||||
exports.getOuterWidth = getOuterWidth;
|
||||
exports.getScroll = getScroll;
|
||||
exports.set = set;
|
||||
/* 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;
|
||||
}
|
||||
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]);
|
||||
}
|
||||
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);
|
||||
}
|
||||
function getOuterWidth(el) {
|
||||
if (el === document.body) {
|
||||
return document.documentElement.clientWidth;
|
||||
}
|
||||
return el.offsetWidth;
|
||||
}
|
||||
function getOuterHeight(el) {
|
||||
if (el === document.body) {
|
||||
return window.innerHeight || document.documentElement.clientHeight;
|
||||
}
|
||||
return el.offsetHeight;
|
||||
}
|
||||
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
|
||||
};
|
||||
}
|
||||
function getClientSize() {
|
||||
var width = document.documentElement.clientWidth;
|
||||
var height = window.innerHeight || document.documentElement.clientHeight;
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
function getScroll() {
|
||||
return {
|
||||
scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
|
||||
scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
|
||||
};
|
||||
}
|
||||
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/lib/Dom/dynamicCSS.d.ts
generated
vendored
Normal file
25
frontend/node_modules/rc-util/lib/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 {};
|
||||
158
frontend/node_modules/rc-util/lib/Dom/dynamicCSS.js
generated
vendored
Normal file
158
frontend/node_modules/rc-util/lib/Dom/dynamicCSS.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.clearContainerCache = clearContainerCache;
|
||||
exports.injectCSS = injectCSS;
|
||||
exports.removeCSS = removeCSS;
|
||||
exports.updateCSS = updateCSS;
|
||||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
||||
var _canUseDom = _interopRequireDefault(require("./canUseDom"));
|
||||
var _contains = _interopRequireDefault(require("./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';
|
||||
});
|
||||
}
|
||||
function injectCSS(css) {
|
||||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
if (!(0, _canUseDom.default)()) {
|
||||
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;
|
||||
});
|
||||
}
|
||||
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 || !(0, _contains.default)(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
|
||||
*/
|
||||
function clearContainerCache() {
|
||||
containerCache.clear();
|
||||
}
|
||||
function updateCSS(css, key) {
|
||||
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var container = getContainer(originOption);
|
||||
var styles = findStyles(container);
|
||||
var option = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, 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/lib/Dom/findDOMNode.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-util/lib/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;
|
||||
45
frontend/node_modules/rc-util/lib/Dom/findDOMNode.js
generated
vendored
Normal file
45
frontend/node_modules/rc-util/lib/Dom/findDOMNode.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findDOMNode;
|
||||
exports.getDOM = getDOM;
|
||||
exports.isDOM = isDOM;
|
||||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
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`.
|
||||
*/
|
||||
function getDOM(node) {
|
||||
if (node && (0, _typeof2.default)(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`
|
||||
*/
|
||||
function findDOMNode(node) {
|
||||
var domNode = getDOM(node);
|
||||
if (domNode) {
|
||||
return domNode;
|
||||
}
|
||||
if (node instanceof _react.default.Component) {
|
||||
var _ReactDOM$findDOMNode;
|
||||
return (_ReactDOM$findDOMNode = _reactDom.default.findDOMNode) === null || _ReactDOM$findDOMNode === void 0 ? void 0 : _ReactDOM$findDOMNode.call(_reactDom.default, node);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
8
frontend/node_modules/rc-util/lib/Dom/focus.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-util/lib/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;
|
||||
93
frontend/node_modules/rc-util/lib/Dom/focus.js
generated
vendored
Normal file
93
frontend/node_modules/rc-util/lib/Dom/focus.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.backLastFocusNode = backLastFocusNode;
|
||||
exports.clearLastFocusNode = clearLastFocusNode;
|
||||
exports.getFocusNodeList = getFocusNodeList;
|
||||
exports.limitTabRange = limitTabRange;
|
||||
exports.saveLastFocusNode = saveLastFocusNode;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _isVisible = _interopRequireDefault(require("./isVisible"));
|
||||
function focusable(node) {
|
||||
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
if ((0, _isVisible.default)(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;
|
||||
}
|
||||
function getFocusNodeList(node) {
|
||||
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
var res = (0, _toConsumableArray2.default)(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 */
|
||||
function saveLastFocusNode() {
|
||||
lastFocusElement = document.activeElement;
|
||||
}
|
||||
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
function clearLastFocusNode() {
|
||||
lastFocusElement = null;
|
||||
}
|
||||
|
||||
/** @deprecated Do not use since this may failed when used in async */
|
||||
function backLastFocusNode() {
|
||||
if (lastFocusElement) {
|
||||
try {
|
||||
// 元素可能已经被移动了
|
||||
lastFocusElement.focus();
|
||||
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {
|
||||
// empty
|
||||
}
|
||||
/* eslint-enable no-empty */
|
||||
}
|
||||
}
|
||||
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/lib/Dom/isVisible.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-util/lib/Dom/isVisible.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: (element: Element) => boolean;
|
||||
export default _default;
|
||||
33
frontend/node_modules/rc-util/lib/Dom/isVisible.js
generated
vendored
Normal file
33
frontend/node_modules/rc-util/lib/Dom/isVisible.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = exports.default = function _default(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/lib/Dom/scrollLocker.d.ts
generated
vendored
Normal file
12
frontend/node_modules/rc-util/lib/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;
|
||||
}
|
||||
132
frontend/node_modules/rc-util/lib/Dom/scrollLocker.js
generated
vendored
Normal file
132
frontend/node_modules/rc-util/lib/Dom/scrollLocker.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
||||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
var _getScrollBarSize = _interopRequireDefault(require("../getScrollBarSize"));
|
||||
var _setStyle = _interopRequireDefault(require("../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 = exports.default = /*#__PURE__*/(0, _createClass2.default)(function ScrollLocker(_options) {
|
||||
var _this = this;
|
||||
(0, _classCallCheck2.default)(this, ScrollLocker);
|
||||
(0, _defineProperty2.default)(this, "lockTarget", void 0);
|
||||
(0, _defineProperty2.default)(this, "options", void 0);
|
||||
(0, _defineProperty2.default)(this, "getContainer", function () {
|
||||
var _this$options;
|
||||
return (_this$options = _this.options) === null || _this$options === void 0 ? void 0 : _this$options.container;
|
||||
});
|
||||
// if options change...
|
||||
(0, _defineProperty2.default)(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();
|
||||
}
|
||||
});
|
||||
(0, _defineProperty2.default)(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((0, _toConsumableArray2.default)(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 = (0, _getScrollBarSize.default)();
|
||||
}
|
||||
}
|
||||
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, (0, _setStyle.default)({
|
||||
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((0, _toConsumableArray2.default)(locks), [{
|
||||
target: _this.lockTarget,
|
||||
options: _this.options
|
||||
}]);
|
||||
});
|
||||
(0, _defineProperty2.default)(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;
|
||||
(0, _setStyle.default)(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;
|
||||
});
|
||||
8
frontend/node_modules/rc-util/lib/Dom/shadow.d.ts
generated
vendored
Normal file
8
frontend/node_modules/rc-util/lib/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;
|
||||
25
frontend/node_modules/rc-util/lib/Dom/shadow.js
generated
vendored
Normal file
25
frontend/node_modules/rc-util/lib/Dom/shadow.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getShadowRoot = getShadowRoot;
|
||||
exports.inShadow = inShadow;
|
||||
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
|
||||
*/
|
||||
function inShadow(ele) {
|
||||
return getRoot(ele) instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return shadowRoot if possible
|
||||
*/
|
||||
function getShadowRoot(ele) {
|
||||
return inShadow(ele) ? getRoot(ele) : null;
|
||||
}
|
||||
2
frontend/node_modules/rc-util/lib/Dom/styleChecker.d.ts
generated
vendored
Normal file
2
frontend/node_modules/rc-util/lib/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;
|
||||
33
frontend/node_modules/rc-util/lib/Dom/styleChecker.js
generated
vendored
Normal file
33
frontend/node_modules/rc-util/lib/Dom/styleChecker.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isStyleSupport = isStyleSupport;
|
||||
var _canUseDom = _interopRequireDefault(require("./canUseDom"));
|
||||
var isStyleNameSupport = function isStyleNameSupport(styleName) {
|
||||
if ((0, _canUseDom.default)() && 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;
|
||||
};
|
||||
function isStyleSupport(styleName, styleValue) {
|
||||
if (!Array.isArray(styleName) && styleValue !== undefined) {
|
||||
return isStyleValueSupport(styleName, styleValue);
|
||||
}
|
||||
return isStyleNameSupport(styleName);
|
||||
}
|
||||
31
frontend/node_modules/rc-util/lib/Dom/support.js
generated
vendored
Normal file
31
frontend/node_modules/rc-util/lib/Dom/support.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transition = exports.animation = void 0;
|
||||
var _canUseDom = _interopRequireDefault(require("./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;
|
||||
}
|
||||
var animation = exports.animation = (0, _canUseDom.default)() && supportEnd(animationEndEventNames);
|
||||
var transition = exports.transition = (0, _canUseDom.default)() && supportEnd(transitionEventNames);
|
||||
Reference in New Issue
Block a user