1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 06:44:16 +00:00

feat: metadata view part (#6289)

* feat: metadata view part

* feat: optimize code

---------

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-07-03 17:04:30 +08:00
committed by GitHub
parent 76af3d28ee
commit 8b6abc7855
59 changed files with 1823 additions and 815 deletions

View File

@@ -1,4 +1,3 @@
import { getRowsByIds } from '../table/row';
import { DateUtils } from '../date';
import {
sortDate,
@@ -16,6 +15,7 @@ import {
SORT_TYPE,
TEXT_SORTER_COLUMN_TYPES,
} from '../../constants/sort';
import { deleteInvalidGroupby } from './core';
const _getCellValue = (row, groupby) => {
const { column_key } = groupby;
@@ -236,15 +236,19 @@ const groupTableRows = (groupbys, rows) => {
* cell_value, original_cell_value, column_key,
row_ids, subgroups, summaries, ...}, ...], array
*/
const groupViewRows = (groupbys, table, rowsIds) => {
if (rowsIds.length === 0) {
return [];
const getGroupRows = (table, rows, groupbys) => {
if (rows.length === 0) return [];
if (groupbys.length === 0) return rows;
let validGroupbys = [];
try {
validGroupbys = deleteInvalidGroupby(groupbys, table.columns);
} catch (err) {
validGroupbys = [];
}
let rowsData = getRowsByIds(table, rowsIds);
return groupTableRows(groupbys, rowsData);
return groupTableRows(validGroupbys, rows);
};
export {
groupTableRows,
groupViewRows,
getGroupRows,
};