mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 17:32:36 +00:00
Remove static from Utils
This commit is contained in:
parent
fe9413c7b7
commit
1e305ba7ff
2 changed files with 106 additions and 106 deletions
|
@ -1,13 +1,13 @@
|
|||
export default class ObjectUtils {
|
||||
export default {
|
||||
|
||||
static equals(obj1, obj2, field) {
|
||||
equals(obj1, obj2, field) {
|
||||
if (field)
|
||||
return (this.resolveFieldData(obj1, field) === this.resolveFieldData(obj2, field));
|
||||
else
|
||||
return this.deepEquals(obj1, obj2);
|
||||
}
|
||||
},
|
||||
|
||||
static deepEquals(a, b) {
|
||||
deepEquals(a, b) {
|
||||
if (a === b) return true;
|
||||
|
||||
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
||||
|
@ -55,9 +55,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
},
|
||||
|
||||
static resolveFieldData(data, field) {
|
||||
resolveFieldData(data, field) {
|
||||
if (data && Object.keys(data).length && field) {
|
||||
if (this.isFunction(field)) {
|
||||
return field(data);
|
||||
|
@ -80,13 +80,13 @@ export default class ObjectUtils {
|
|||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
static isFunction(obj) {
|
||||
isFunction(obj) {
|
||||
return !!(obj && obj.constructor && obj.call && obj.apply);
|
||||
}
|
||||
},
|
||||
|
||||
static filter(value, fields, filterValue) {
|
||||
filter(value, fields, filterValue) {
|
||||
var filteredItems = [];
|
||||
|
||||
if (value) {
|
||||
|
@ -101,9 +101,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
|
||||
return filteredItems;
|
||||
}
|
||||
},
|
||||
|
||||
static reorderArray(value, from, to) {
|
||||
reorderArray(value, from, to) {
|
||||
let target;
|
||||
if (value && (from !== to)) {
|
||||
if (to >= value.length) {
|
||||
|
@ -114,9 +114,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
value.splice(to, 0, value.splice(from, 1)[0]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
static findIndexInList(value, list) {
|
||||
findIndexInList(value, list) {
|
||||
let index = -1;
|
||||
|
||||
if (list) {
|
||||
|
@ -129,9 +129,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
},
|
||||
|
||||
static contains(value, list) {
|
||||
contains(value, list) {
|
||||
if (value != null && list && list.length) {
|
||||
for (let val of list) {
|
||||
if (this.equals(value, val))
|
||||
|
@ -140,9 +140,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
static insertIntoOrderedArray(item, index, arr, sourceArr) {
|
||||
insertIntoOrderedArray(item, index, arr, sourceArr) {
|
||||
if (arr.length > 0) {
|
||||
let injected = false;
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
|
@ -161,9 +161,9 @@ export default class ObjectUtils {
|
|||
else {
|
||||
arr.push(item);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
static removeAccents(str) {
|
||||
removeAccents(str) {
|
||||
if (str && str.search(/[\xC0-\xFF]/g) > -1) {
|
||||
str = str
|
||||
.replace(/[\xC0-\xC5]/g, "A")
|
||||
|
@ -190,9 +190,9 @@ export default class ObjectUtils {
|
|||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
},
|
||||
|
||||
static getVNodeProp(vnode, prop) {
|
||||
getVNodeProp(vnode, prop) {
|
||||
let props = vnode.props;
|
||||
if (props) {
|
||||
let kebapProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue