add category preset for desktop page

This commit is contained in:
MaysWind
2023-08-03 22:47:52 +08:00
parent 8c7875d7ea
commit 19d3d80013
5 changed files with 140 additions and 157 deletions
+36
View File
@@ -77,6 +77,24 @@ export function isEquals(obj1, obj2) {
}
}
export function getObjectOwnFieldCount(object) {
let count = 0;
if (!object || !isObject(object)) {
return count;
}
for (let field in object) {
if (!Object.prototype.hasOwnProperty.call(object, field)) {
continue;
}
count++;
}
return count;
}
export function appendThousandsSeparator(value, enable) {
if (!enable || value.length <= 3) {
return value;
@@ -284,6 +302,24 @@ export function copyArrayTo(fromArray, toArray) {
return toArray;
}
export function categoriedArrayToPlainArray(object) {
const ret = [];
for (let field in object) {
if (!Object.prototype.hasOwnProperty.call(object, field)) {
continue;
}
const array = object[field];
for (let i = 0; i < array.length; i++) {
ret.push(array[i]);
}
}
return ret;
}
export function arrangeArrayWithNewStartIndex(array, startIndex) {
if (startIndex <= 0 || startIndex >= array.length) {
return array;