升级到最新的 dom-helpers

This commit is contained in:
2betop 2019-12-31 10:20:27 +08:00
parent 5952811808
commit 07dc57ccf7
4 changed files with 33 additions and 11 deletions

View File

@ -32,7 +32,7 @@
"autobind-decorator": "2.4.0",
"blueimp-canvastoblob": "2.1.0",
"classnames": "2.2.5",
"dom-helpers": "3.3.1",
"dom-helpers": "5.1.3",
"downshift": "3.1.4",
"echarts": "^4.1.0",
"flv.js": "1.5.0",
@ -76,7 +76,6 @@
"video-react": "0.9.4"
},
"devDependencies": {
"@types/dom-helpers": "^3.4.1",
"@types/async": "^2.0.45",
"@types/classnames": "^2.2.3",
"@types/history": "^4.6.0",

View File

@ -5,7 +5,7 @@
*/
import React from 'react';
import css = require('dom-helpers/style');
import css from 'dom-helpers/css';
import {ClassNamesFn, themeable} from '../theme';
import Transition, {
EXITED,

View File

@ -14,7 +14,7 @@ import hoistNonReactStatic = require('hoist-non-react-statics');
import onClickOutside from 'react-onclickoutside';
import {Action} from '../types';
import keycode from 'keycode';
import matches = require('dom-helpers/query/matches');
import matches from 'dom-helpers/matches';
import Overlay from '../components/Overlay';
import PopOver from '../components/PopOver';
@ -208,7 +208,12 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (
case 'right':
nextTd = current.nextSibling;
while (nextTd) {
if (matches(nextTd, `.${ns}Field--quickEditable[tabindex]`)) {
if (
matches(
nextTd as Element,
`.${ns}Field--quickEditable[tabindex]`
)
) {
break;
}
@ -224,7 +229,7 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (
);
if (nextTd) {
nextTd.focus();
(nextTd as any).focus();
}
}
break;

View File

@ -1,10 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import hoistNonReactStatic = require('hoist-non-react-statics');
import domHelperWwnerDocument = require('dom-helpers/ownerDocument');
import getOffset = require('dom-helpers/query/offset');
import getPosition = require('dom-helpers/query/position');
import getScrollTop = require('dom-helpers/query/scrollTop');
import domOwnerDocument from 'dom-helpers/ownerDocument';
import css from 'dom-helpers/css';
import getOffset from 'dom-helpers/offset';
import getPosition from 'dom-helpers/position';
import getScrollTop from 'dom-helpers/scrollTop';
const bsMapping: {
[propName: string]: string;
@ -55,7 +56,7 @@ export function getContainer(container: any, defaultContainer: any) {
}
export function ownerDocument(componentOrElement: any) {
return domHelperWwnerDocument(ReactDOM.findDOMNode(componentOrElement));
return domOwnerDocument(ReactDOM.findDOMNode(componentOrElement) as Element);
}
function getContainerDimensions(containerNode: any) {
@ -119,6 +120,23 @@ function getLeftDelta(
return 0;
}
// function position(node: HTMLElement, offsetParent: HTMLElement) {
// const rect = offsetParent.getBoundingClientRect();
// const rect2 = node.getBoundingClientRect();
// return {
// width:
// rect2.width -
// (parseInt(css(node, 'borderLeftWidth') || '', 10) || 0) -
// parseInt(css(node, 'borderRightWidth') || '', 10) || 0,
// height:
// rect2.height -
// (parseInt(css(node, 'borderTopWidth') || '', 10) || 0) -
// parseInt(css(node, 'borderBottomWidth') || '', 10) || 0,
// top: rect2.top - rect.top,
// left: rect2.left - rect.left
// };
// }
export function calculatePosition(
placement: any,
overlayNode: any,