fix(core): hidden not supported property in display menu (#12445)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **New Features**
  - Properties in the document list are now displayed only if they are explicitly marked to be shown, providing a more streamlined and relevant view.

- **Bug Fixes**
  - Improved filtering ensures that only designated properties appear in the document list, preventing unintended properties from being shown.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
EYHN
2025-05-22 09:13:10 +00:00
parent 83feb8ce24
commit 5897db6911
2 changed files with 12 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import { useLiveData, useService } from '@toeverything/infra';
import { useCallback, useMemo } from 'react';
import { WorkspacePropertyName } from '../../properties';
import { WorkspacePropertyTypes } from '../../workspace-property-types';
import { generateExplorerPropertyList } from '../properties';
import type { ExplorerDisplayPreference } from '../types';
import * as styles from './properties.css';
@@ -147,7 +148,12 @@ const PropertyRenderer = ({
: null;
const isActive = activeKey && displayProperties.includes(activeKey);
if (!key) {
const showInDocList =
systemProperty?.showInDocList ||
(workspaceProperty &&
WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList);
if (!key || !showInDocList) {
return null;
}
return (

View File

@@ -113,7 +113,7 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
if (!displayKey || !displayProperties?.includes(displayKey)) {
return null;
}
if (systemProperty) {
if (systemProperty && systemProperty.showInDocList) {
return (
<SystemPropertyRenderer
doc={doc}
@@ -121,7 +121,10 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
key={systemProperty.type}
/>
);
} else if (workspaceProperty) {
} else if (
workspaceProperty &&
WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList
) {
return (
<WorkspacePropertyRenderer
key={workspaceProperty.id}