Merge pull request #549 from ONLYOFFICE/bugfix/Bug69117
bugfix/Bug69117
This commit is contained in:
commit
55149f6599
@ -54,6 +54,8 @@ class FilesTableHeader extends React.Component {
|
||||
showStorageInfo,
|
||||
isArchiveFolder,
|
||||
tableStorageName,
|
||||
roomsFilter,
|
||||
filter,
|
||||
} = this.props;
|
||||
|
||||
const defaultColumns = [];
|
||||
@ -365,6 +367,9 @@ class FilesTableHeader extends React.Component {
|
||||
|
||||
const tableColumns = columns.map((c) => c.enable && c.key);
|
||||
|
||||
const sortBy = isRooms ? roomsFilter.sortBy : filter.sortBy;
|
||||
const sortOrder = isRooms ? roomsFilter.sortOrder : filter.sortOrder;
|
||||
|
||||
this.setTableColumns(tableColumns);
|
||||
if (fromUpdate) {
|
||||
this.setState({
|
||||
@ -372,6 +377,8 @@ class FilesTableHeader extends React.Component {
|
||||
resetColumnsSize,
|
||||
columnStorageName,
|
||||
columnInfoPanelStorageName,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
});
|
||||
} else {
|
||||
this.state = {
|
||||
@ -379,6 +386,8 @@ class FilesTableHeader extends React.Component {
|
||||
resetColumnsSize,
|
||||
columnStorageName,
|
||||
columnInfoPanelStorageName,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
};
|
||||
}
|
||||
};
|
||||
@ -425,8 +434,13 @@ class FilesTableHeader extends React.Component {
|
||||
isRecentTab,
|
||||
isArchiveFolder,
|
||||
showStorageInfo,
|
||||
roomsFilter,
|
||||
filter,
|
||||
} = this.props;
|
||||
|
||||
const sortBy = isRooms ? roomsFilter.sortBy : filter.sortBy;
|
||||
const sortOrder = isRooms ? roomsFilter.sortOrder : filter.sortOrder;
|
||||
|
||||
if (
|
||||
isArchiveFolder !== prevProps.isArchiveFolder ||
|
||||
isRooms !== prevProps.isRooms ||
|
||||
@ -434,12 +448,15 @@ class FilesTableHeader extends React.Component {
|
||||
columnStorageName !== prevProps.columnStorageName ||
|
||||
columnInfoPanelStorageName !== prevProps.columnInfoPanelStorageName ||
|
||||
isRecentTab !== prevProps.isRecentTab ||
|
||||
showStorageInfo !== prevProps.showStorageInfo
|
||||
showStorageInfo !== prevProps.showStorageInfo ||
|
||||
sortBy !== this.state.sortBy ||
|
||||
sortOrder !== this.state.sortOrder
|
||||
) {
|
||||
return this.getTableColumns(true);
|
||||
}
|
||||
|
||||
const { columns } = this.state;
|
||||
|
||||
if (this.props.withContent !== prevProps.withContent) {
|
||||
const columnIndex = columns.findIndex((c) => c.key === "Share");
|
||||
if (columnIndex === -1) return;
|
||||
@ -528,9 +545,6 @@ class FilesTableHeader extends React.Component {
|
||||
t,
|
||||
containerRef,
|
||||
isHeaderChecked,
|
||||
filter,
|
||||
roomsFilter,
|
||||
isRooms,
|
||||
firstElemChecked,
|
||||
sortingVisible,
|
||||
infoPanelVisible,
|
||||
@ -547,11 +561,10 @@ class FilesTableHeader extends React.Component {
|
||||
resetColumnsSize,
|
||||
columnStorageName,
|
||||
columnInfoPanelStorageName,
|
||||
sortBy,
|
||||
sortOrder,
|
||||
} = this.state;
|
||||
|
||||
const sortBy = isRooms ? roomsFilter.sortBy : filter.sortBy;
|
||||
const sortOrder = isRooms ? roomsFilter.sortOrder : filter.sortOrder;
|
||||
|
||||
return (
|
||||
<TableHeader
|
||||
isLengthenHeader={firstElemChecked || isHeaderChecked}
|
||||
|
@ -2012,42 +2012,8 @@ const SectionFilterContent = ({
|
||||
hideableColumns.Storage = storage;
|
||||
}
|
||||
|
||||
options.push(firstName, lastName);
|
||||
|
||||
if (accountsViewAs === "table") {
|
||||
const tableColumns = isInsideGroup
|
||||
? TABLE_INSIDE_GROUP_COLUMNS
|
||||
: TABLE_PEOPLE_COLUMNS;
|
||||
|
||||
const columnsSizeInfoPanel = isInsideGroup
|
||||
? COLUMNS_INSIDE_GROUP_SIZE_INFO_PANEL
|
||||
: COLUMNS_PEOPLE_SIZE_INFO_PANEL;
|
||||
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${tableColumns}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${columnsSizeInfoPanel}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
availableSort?.forEach((columnTitle) => {
|
||||
if (!hideableColumns[columnTitle]) return;
|
||||
|
||||
if (availableSort?.includes(columnTitle)) {
|
||||
const idx = availableSort.findIndex((x) => x === columnTitle);
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && options.push(hideableColumns[columnTitle]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
options.push(type, department, email);
|
||||
if (showStorageInfo) options.push(storage);
|
||||
}
|
||||
options.push(firstName, lastName, type, department, email);
|
||||
if (showStorageInfo) options.push(storage);
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -2069,29 +2035,7 @@ const SectionFilterContent = ({
|
||||
default: true,
|
||||
};
|
||||
|
||||
groupsOptions.push(title);
|
||||
|
||||
if (accountsViewAs === "table") {
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${TABLE_GROUPS_COLUMNS}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${COLUMNS_GROUPS_SIZE_INFO_PANEL}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
if (availableSort?.includes("Head of Group")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Head of Group");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && groupsOptions.push(manager);
|
||||
}
|
||||
} else {
|
||||
groupsOptions.push(manager);
|
||||
}
|
||||
groupsOptions.push(title, manager);
|
||||
|
||||
return groupsOptions;
|
||||
}
|
||||
@ -2181,220 +2125,25 @@ const SectionFilterContent = ({
|
||||
|
||||
commonOptions.push(name);
|
||||
|
||||
if (viewAs === "table") {
|
||||
if (isRooms) {
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${TABLE_ROOMS_COLUMNS}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${COLUMNS_ROOMS_SIZE_INFO_PANEL}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
const hideOption = infoPanelVisible && infoPanelColumnsSize;
|
||||
|
||||
if (availableSort?.includes("Type")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Type");
|
||||
const hide = hideOption && infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(roomType);
|
||||
}
|
||||
|
||||
if (availableSort?.includes("Tags")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Tags");
|
||||
const hide = hideOption && infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(tags);
|
||||
}
|
||||
|
||||
if (availableSort?.includes("Owner")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Owner");
|
||||
const hide = hideOption && infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(owner);
|
||||
}
|
||||
|
||||
if (availableSort?.includes("Activity")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Activity");
|
||||
const hide = hideOption && infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(modifiedDate);
|
||||
}
|
||||
|
||||
if (showStorageInfo && availableSort?.includes("Storage")) {
|
||||
const idx = availableSort.findIndex(
|
||||
(x) => x === SortByFieldName.UsedSpace,
|
||||
);
|
||||
const hide = hideOption && infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(sortByStorage);
|
||||
}
|
||||
} else if (isTrash) {
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${TABLE_TRASH_COLUMNS}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${COLUMNS_TRASH_SIZE_INFO_PANEL}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
if (availableSort?.includes("Room")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Room");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(room);
|
||||
}
|
||||
if (availableSort?.includes("AuthorTrash")) {
|
||||
const idx = availableSort.findIndex((x) => x === "AuthorTrash");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(authorOption);
|
||||
}
|
||||
if (availableSort?.includes("CreatedTrash")) {
|
||||
const idx = availableSort.findIndex((x) => x === "CreatedTrash");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(creationDate);
|
||||
}
|
||||
if (availableSort?.includes("Erasure")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Erasure");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(erasure);
|
||||
}
|
||||
if (availableSort?.includes("SizeTrash")) {
|
||||
const idx = availableSort.findIndex((x) => x === "SizeTrash");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(size);
|
||||
}
|
||||
if (availableSort?.includes("TypeTrash")) {
|
||||
const idx = availableSort.findIndex((x) => x === "TypeTrash");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(type);
|
||||
}
|
||||
} else if (isRecentTab) {
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${TABLE_RECENT_COLUMNS}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${COLUMNS_RECENT_SIZE_INFO_PANEL}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
if (availableSort?.includes("LastOpened")) {
|
||||
const idx = availableSort.findIndex((x) => x === "LastOpened");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(lastOpenedDate);
|
||||
}
|
||||
|
||||
if (availableSort?.includes("Size")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Size");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(size);
|
||||
}
|
||||
} else {
|
||||
const availableSort = localStorage
|
||||
?.getItem(`${TABLE_COLUMNS}=${userId}`)
|
||||
?.split(",");
|
||||
|
||||
const infoPanelColumnsSize = localStorage
|
||||
?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`)
|
||||
?.split(" ");
|
||||
|
||||
if (availableSort?.includes("Author")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Author");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(authorOption);
|
||||
}
|
||||
if (availableSort?.includes("Created")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Created");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(creationDate);
|
||||
}
|
||||
if (availableSort?.includes("Modified")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Modified");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(modifiedDate);
|
||||
}
|
||||
if (availableSort?.includes("Size")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Size");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
!hide && commonOptions.push(size);
|
||||
}
|
||||
if (availableSort?.includes("Type")) {
|
||||
const idx = availableSort.findIndex((x) => x === "Type");
|
||||
const hide =
|
||||
infoPanelVisible &&
|
||||
infoPanelColumnsSize &&
|
||||
infoPanelColumnsSize[idx] === "0px";
|
||||
|
||||
// !hide && commonOptions.push(type);
|
||||
}
|
||||
}
|
||||
if (isRooms) {
|
||||
commonOptions.push(roomType);
|
||||
commonOptions.push(tags);
|
||||
commonOptions.push(owner);
|
||||
commonOptions.push(modifiedDate);
|
||||
showStorageInfo && commonOptions.push(sortByStorage);
|
||||
} else if (isTrash) {
|
||||
// commonOptions.push(authorOption);
|
||||
// commonOptions.push(creationDate);
|
||||
commonOptions.push(erasure);
|
||||
commonOptions.push(size);
|
||||
// commonOptions.push(type);
|
||||
} else {
|
||||
if (isRooms) {
|
||||
commonOptions.push(roomType);
|
||||
commonOptions.push(tags);
|
||||
commonOptions.push(owner);
|
||||
commonOptions.push(modifiedDate);
|
||||
showStorageInfo && commonOptions.push(sortByStorage);
|
||||
} else if (isTrash) {
|
||||
// commonOptions.push(authorOption);
|
||||
// commonOptions.push(creationDate);
|
||||
commonOptions.push(erasure);
|
||||
commonOptions.push(size);
|
||||
// commonOptions.push(type);
|
||||
} else {
|
||||
// commonOptions.push(authorOption);
|
||||
// commonOptions.push(creationDate);
|
||||
commonOptions.push(modifiedDate);
|
||||
commonOptions.push(size);
|
||||
// commonOptions.push(type);
|
||||
}
|
||||
// commonOptions.push(authorOption);
|
||||
// commonOptions.push(creationDate);
|
||||
commonOptions.push(modifiedDate);
|
||||
commonOptions.push(size);
|
||||
// commonOptions.push(type);
|
||||
isRecentTab && commonOptions.push(lastOpenedDate);
|
||||
}
|
||||
|
||||
return commonOptions;
|
||||
|
@ -77,6 +77,8 @@ class TableHeaderComponent extends React.Component<
|
||||
infoPanelVisible,
|
||||
columnStorageName,
|
||||
columnInfoPanelStorageName,
|
||||
sortBy,
|
||||
sorted,
|
||||
} = this.props;
|
||||
|
||||
if (columnStorageName === prevProps.columnStorageName) {
|
||||
@ -84,6 +86,14 @@ class TableHeaderComponent extends React.Component<
|
||||
? localStorage.getItem(columnInfoPanelStorageName)
|
||||
: localStorage.getItem(columnStorageName);
|
||||
|
||||
if (sortBy !== prevProps.sortBy || sorted !== prevProps.sorted) {
|
||||
const columnIndex = columns.findIndex((c) => c?.sortBy === sortBy);
|
||||
|
||||
if (columnIndex > -1 && !columns[columnIndex].enable) {
|
||||
columns[columnIndex].onChange?.(columns[columnIndex].key);
|
||||
}
|
||||
}
|
||||
|
||||
// columns.length + 1 - its settings column
|
||||
if (storageSize && storageSize.split(" ").length !== columns.length + 1) {
|
||||
return this.resetColumns();
|
||||
|
Loading…
Reference in New Issue
Block a user