update Table
update Table
This commit is contained in:
parent
744eb0af93
commit
0d13646576
7 changed files with 306 additions and 59 deletions
|
@ -70,7 +70,7 @@ export function getStyle (element, styleName) {
|
|||
styleName = 'cssFloat';
|
||||
}
|
||||
try {
|
||||
var computed = document.defaultView.getComputedStyle(element, '');
|
||||
const computed = document.defaultView.getComputedStyle(element, '');
|
||||
return element.style[styleName] || computed ? computed[styleName] : null;
|
||||
} catch(e) {
|
||||
return element.style[styleName];
|
||||
|
@ -87,4 +87,48 @@ export function warnProp(component, prop, correctType, wrongType) {
|
|||
correctType = firstUpperCase(correctType);
|
||||
wrongType = firstUpperCase(wrongType);
|
||||
console.error(`[iView warn]: Invalid prop: type check failed for prop ${prop}. Expected ${correctType}, got ${wrongType}. (found in component: ${component})`);
|
||||
}
|
||||
}
|
||||
|
||||
function typeOf(obj) {
|
||||
const toString = Object.prototype.toString;
|
||||
const map = {
|
||||
'[object Boolean]' : 'boolean',
|
||||
'[object Number]' : 'number',
|
||||
'[object String]' : 'string',
|
||||
'[object Function]' : 'function',
|
||||
'[object Array]' : 'array',
|
||||
'[object Date]' : 'date',
|
||||
'[object RegExp]' : 'regExp',
|
||||
'[object Undefined]': 'undefined',
|
||||
'[object Null]' : 'null',
|
||||
'[object Object]' : 'object'
|
||||
};
|
||||
return map[toString.call(obj)];
|
||||
}
|
||||
|
||||
// deepCopy
|
||||
function deepCopy(data) {
|
||||
const t = typeOf(data);
|
||||
let o;
|
||||
|
||||
if (t === 'array') {
|
||||
o = [];
|
||||
} else if ( t === 'object') {
|
||||
o = {};
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (t === 'array') {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
o.push(deepCopy(data[i]));
|
||||
}
|
||||
} else if ( t === 'object') {
|
||||
for (let i in data) {
|
||||
o[i] = deepCopy(data[i]);
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
export {deepCopy}
|
Loading…
Add table
Add a link
Reference in a new issue