fix(bee-table): ie11下removeEventListener报错bug
This commit is contained in:
parent
42fac60c77
commit
59d03c3e54
|
@ -3,11 +3,11 @@
|
|||
/* Navlayout */
|
||||
/* FormGroup */
|
||||
/* Navlayout */
|
||||
/**
|
||||
* 加载背景
|
||||
/**
|
||||
* 加载背景
|
||||
*/
|
||||
/**
|
||||
* 文字
|
||||
/**
|
||||
* 文字
|
||||
*/
|
||||
.u-loading-desc {
|
||||
position: absolute;
|
||||
|
@ -18,8 +18,8 @@
|
|||
color: #212121;
|
||||
text-align: center; }
|
||||
|
||||
/**
|
||||
* default样式 单个圆圈加载
|
||||
/**
|
||||
* default样式 单个圆圈加载
|
||||
*/
|
||||
.u-loading.u-loading-rotate > div {
|
||||
position: absolute;
|
||||
|
@ -191,7 +191,7 @@
|
|||
.u-table th ::last-child {
|
||||
overflow: hidden; }
|
||||
.u-table td {
|
||||
border-bottom: 1px solid rgb(193, 199, 208);
|
||||
border-bottom: 1px solid rgb(233,233,233);
|
||||
line-height: 1.33; }
|
||||
.u-table td a {
|
||||
color: #2196F3; }
|
||||
|
@ -242,7 +242,7 @@
|
|||
.u-table-scroll {
|
||||
overflow: auto; }
|
||||
.u-table-bordered table {
|
||||
border: 1px solid rgb(193, 199, 208);
|
||||
border: 1px solid rgb(233,233,233);
|
||||
box-sizing: border-box;
|
||||
table-layout: fixed; }
|
||||
.u-table-bordered .u-table-header > table {
|
||||
|
@ -250,18 +250,18 @@
|
|||
.u-table-bordered .u-table-header ~ .u-table-body table, .u-table-bordered .u-table-header ~ .u-table-body-outer table {
|
||||
border-top: 0px; }
|
||||
.u-table-bordered th {
|
||||
border-bottom: 1px solid rgb(193, 199, 208);
|
||||
border-bottom: 1px solid rgb(233,233,233);
|
||||
box-sizing: border-box; }
|
||||
.u-table-bordered th,
|
||||
.u-table-bordered td {
|
||||
border-right: 1px solid rgb(193, 199, 208);
|
||||
border-right: 1px solid rgb(233,233,233);
|
||||
box-sizing: border-box; }
|
||||
.u-table-drag-border tr th.th-can-not-drag {
|
||||
overflow: hidden; }
|
||||
.u-table-header {
|
||||
overflow: hidden;
|
||||
background: rgb(241, 242, 245);
|
||||
color: rgb(33, 33, 33); }
|
||||
background: rgb(247,247,247);
|
||||
color: rgb(102, 102, 102); }
|
||||
.u-table.fixed-height td {
|
||||
padding: 0px 8px; }
|
||||
.u-table-fixed-header .u-table-body {
|
||||
|
@ -282,12 +282,12 @@
|
|||
box-sizing: border-box; }
|
||||
.u-table-title {
|
||||
padding: 12px 8px;
|
||||
border-top: 1px solid rgb(193, 199, 208); }
|
||||
border-top: 1px solid rgb(233,233,233); }
|
||||
.u-table-content {
|
||||
position: relative; }
|
||||
.u-table-footer {
|
||||
padding: 12px 8px;
|
||||
border-bottom: 1px solid rgb(193, 199, 208); }
|
||||
border-bottom: 1px solid rgb(233,233,233); }
|
||||
.u-table-footer .u-table-scroll {
|
||||
overflow-x: hidden; }
|
||||
.u-table-footer .u-table {
|
||||
|
@ -295,7 +295,7 @@
|
|||
.u-table-placeholder {
|
||||
padding: 12px 8px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid rgb(193, 199, 208);
|
||||
border-bottom: 1px solid rgb(233,233,233);
|
||||
text-align: center;
|
||||
position: relative; }
|
||||
.u-table-placeholder .table-nodata {
|
||||
|
@ -398,8 +398,8 @@
|
|||
.u-table-thead .filter-wrap .filter-btns {
|
||||
min-width: 58px; }
|
||||
.u-table-thead th {
|
||||
background: rgb(241, 242, 245);
|
||||
color: rgb(33, 33, 33);
|
||||
background: rgb(247,247,247);
|
||||
color: rgb(102, 102, 102);
|
||||
background-clip: padding-box;
|
||||
-moz-user-select: -moz-none;
|
||||
-khtml-user-select: none;
|
||||
|
@ -500,7 +500,7 @@
|
|||
right: 0px;
|
||||
top: 1px;
|
||||
z-index: 2;
|
||||
background: rgb(241, 242, 245);
|
||||
background: rgb(247,247,247);
|
||||
text-align: center;
|
||||
cursor: pointer; }
|
||||
.u-table-filter-column-filter-icon i.uf {
|
||||
|
@ -578,7 +578,7 @@
|
|||
|
||||
.u-table.bordered th,
|
||||
.u-table.bordered td {
|
||||
border: 1px solid rgb(193, 199, 208); }
|
||||
border: 1px solid rgb(233,233,233); }
|
||||
|
||||
.move-enter,
|
||||
.move-appear {
|
||||
|
|
|
@ -106,9 +106,9 @@ function sum(Table) {
|
|||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前的表格类型。
|
||||
*
|
||||
/**
|
||||
* 获取当前的表格类型。
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
@ -9,71 +9,71 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
|||
exports.sortBy = sortBy;
|
||||
exports.compare = compare;
|
||||
exports.ObjectAssign = ObjectAssign;
|
||||
/*
|
||||
* 快速排序,按某个属性,或按“获取排序依据的函数”,来排序.
|
||||
* @method soryBy
|
||||
* @static
|
||||
* @param {array} arr 待处理数组
|
||||
* @param {string|function} prop 排序依据属性,获取
|
||||
* @param {boolean} desc 降序
|
||||
* @return {array} 返回排序后的新数组
|
||||
/*
|
||||
* 快速排序,按某个属性,或按“获取排序依据的函数”,来排序.
|
||||
* @method soryBy
|
||||
* @static
|
||||
* @param {array} arr 待处理数组
|
||||
* @param {string|function} prop 排序依据属性,获取
|
||||
* @param {boolean} desc 降序
|
||||
* @return {array} 返回排序后的新数组
|
||||
*/
|
||||
|
||||
function sortBy(arr, prop, desc) {
|
||||
var props = [],
|
||||
ret = [],
|
||||
i = 0,
|
||||
len = arr.length;
|
||||
if (typeof prop == 'string') {
|
||||
for (; i < len; i++) {
|
||||
var oI = arr[i];
|
||||
(props[i] = new String(oI && oI[prop] || ''))._obj = oI;
|
||||
var props = [],
|
||||
ret = [],
|
||||
i = 0,
|
||||
len = arr.length;
|
||||
if (typeof prop == 'string') {
|
||||
for (; i < len; i++) {
|
||||
var oI = arr[i];
|
||||
(props[i] = new String(oI && oI[prop] || ''))._obj = oI;
|
||||
}
|
||||
} else if (typeof prop == 'function') {
|
||||
for (; i < len; i++) {
|
||||
var _oI = arr[i];
|
||||
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
|
||||
}
|
||||
} else {
|
||||
throw '参数类型错误';
|
||||
}
|
||||
} else if (typeof prop == 'function') {
|
||||
for (; i < len; i++) {
|
||||
var _oI = arr[i];
|
||||
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
|
||||
props.sort();
|
||||
for (i = 0; i < len; i++) {
|
||||
ret[i] = props[i]._obj;
|
||||
}
|
||||
} else {
|
||||
throw '参数类型错误';
|
||||
}
|
||||
props.sort();
|
||||
for (i = 0; i < len; i++) {
|
||||
ret[i] = props[i]._obj;
|
||||
}
|
||||
if (desc) ret.reverse();
|
||||
return ret;
|
||||
if (desc) ret.reverse();
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* 数组对象排序
|
||||
* console.log(arr.sort(compare('age')))
|
||||
* @param {} property
|
||||
/**
|
||||
* 数组对象排序
|
||||
* console.log(arr.sort(compare('age')))
|
||||
* @param {} property
|
||||
*/
|
||||
function compare(property) {
|
||||
return function (a, b) {
|
||||
var value1 = a[property];
|
||||
var value2 = b[property];
|
||||
return value1 - value2;
|
||||
};
|
||||
return function (a, b) {
|
||||
var value1 = a[property];
|
||||
var value2 = b[property];
|
||||
return value1 - value2;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单数组数据对象拷贝
|
||||
* @param {*} obj 要拷贝的对象
|
||||
/**
|
||||
* 简单数组数据对象拷贝
|
||||
* @param {*} obj 要拷贝的对象
|
||||
*/
|
||||
function ObjectAssign(obj) {
|
||||
var b = obj instanceof Array;
|
||||
var tagObj = b ? [] : {};
|
||||
if (b) {
|
||||
//数组
|
||||
obj.forEach(function (da) {
|
||||
var _da = {};
|
||||
_extends(_da, da);
|
||||
tagObj.push(_da);
|
||||
});
|
||||
} else {
|
||||
_extends(tagObj, obj);
|
||||
}
|
||||
return tagObj;
|
||||
var b = obj instanceof Array;
|
||||
var tagObj = b ? [] : {};
|
||||
if (b) {
|
||||
//数组
|
||||
obj.forEach(function (da) {
|
||||
var _da = {};
|
||||
_extends(_da, da);
|
||||
tagObj.push(_da);
|
||||
});
|
||||
} else {
|
||||
_extends(tagObj, obj);
|
||||
}
|
||||
return tagObj;
|
||||
}
|
|
@ -19,11 +19,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
||||
|
||||
/**
|
||||
* 渲染checkbox
|
||||
* @param Checkbox
|
||||
* @param Icon
|
||||
* @returns {CheckboxRender}
|
||||
/**
|
||||
* 渲染checkbox
|
||||
* @param Checkbox
|
||||
* @param Icon
|
||||
* @returns {CheckboxRender}
|
||||
*/
|
||||
function renderCheckbox(Checkbox, Icon) {
|
||||
return function (_Component) {
|
||||
|
|
|
@ -28,12 +28,12 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
||||
|
||||
/**
|
||||
* 渲染输入框
|
||||
* @param Form
|
||||
* @param Input
|
||||
* @param Icon
|
||||
* @returns {InputRender}
|
||||
/**
|
||||
* 渲染输入框
|
||||
* @param Form
|
||||
* @param Input
|
||||
* @param Icon
|
||||
* @returns {InputRender}
|
||||
*/
|
||||
function renderInput(Form, Input, Icon) {
|
||||
var _class, _temp2;
|
||||
|
|
|
@ -26,11 +26,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
||||
|
||||
/**
|
||||
* 渲染下拉框
|
||||
* @param Select
|
||||
* @param Icon
|
||||
* @returns {SelectRender}
|
||||
/**
|
||||
* 渲染下拉框
|
||||
* @param Select
|
||||
* @param Icon
|
||||
* @returns {SelectRender}
|
||||
*/
|
||||
function renderSelect(Select, Icon) {
|
||||
var _class, _temp2;
|
||||
|
|
|
@ -230,11 +230,12 @@ function addHandler(element, type, handler) {
|
|||
}
|
||||
|
||||
function removeHandler(element, type, handler) {
|
||||
if (element.removeEventListener) {
|
||||
if (element && element.removeEventListener) {
|
||||
//element&& ie11报错兼容
|
||||
element.removeEventListener(type, handler, false);
|
||||
} else if (element.detachEvent) {
|
||||
} else if (element && element.detachEvent) {
|
||||
element.detachEvent("on" + type, handler);
|
||||
} else {
|
||||
} else if (element) {
|
||||
element["on" + type] = null;
|
||||
}
|
||||
}
|
||||
|
@ -278,11 +279,12 @@ var EventUtil = exports.EventUtil = {
|
|||
},
|
||||
|
||||
removeHandler: function removeHandler(element, type, handler) {
|
||||
if (element.removeEventListener) {
|
||||
//element&& ie11报错兼容
|
||||
if (element && element.removeEventListener) {
|
||||
element.removeEventListener(type, handler, false);
|
||||
} else if (element.detachEvent) {
|
||||
} else if (element && element.detachEvent) {
|
||||
element.detachEvent('on' + type, handler);
|
||||
} else {
|
||||
} else if (element) {
|
||||
element['on' + type] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "2.0.18",
|
||||
"version": "2.0.19",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
14
src/utils.js
14
src/utils.js
|
@ -205,11 +205,11 @@ export function getColChildrenLength(columns,chilrenLen){
|
|||
}
|
||||
|
||||
function removeHandler(element, type, handler){
|
||||
if (element.removeEventListener){
|
||||
if (element&&element.removeEventListener){//element&& ie11报错兼容
|
||||
element.removeEventListener(type, handler, false);
|
||||
} else if (element.detachEvent){
|
||||
} else if (element&&element.detachEvent){
|
||||
element.detachEvent("on" + type, handler);
|
||||
} else {
|
||||
} else if(element) {
|
||||
element["on" + type] = null;
|
||||
}
|
||||
}
|
||||
|
@ -255,15 +255,15 @@ export const EventUtil = {
|
|||
}
|
||||
},
|
||||
|
||||
removeHandler: function(element,type,handler) {
|
||||
if (element.removeEventListener)
|
||||
removeHandler: function(element,type,handler) {//element&& ie11报错兼容
|
||||
if (element&&element.removeEventListener)
|
||||
{
|
||||
element.removeEventListener(type,handler,false);
|
||||
}
|
||||
else if(element.detachEvent) {
|
||||
else if(element&&element.detachEvent) {
|
||||
element.detachEvent('on' +type,handler);
|
||||
}
|
||||
else {
|
||||
else if(element){
|
||||
element['on'+type] = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue