;
}),
// 这里不能把 columnsSchema 作为依赖,因为其每次都会变化,这里使用 hasChangedColumns 作为依赖
// eslint-disable-next-line react-hooks/exhaustive-deps
- [hasChangedColumns, field.value, field.address, collection, parentRecordData, schemaToolbarBigger],
+ [hasChangedColumns, field.value, field.address, collection, parentRecordData, schemaToolbarBigger, designable],
);
const tableColumns = useMemo(() => {
@@ -440,7 +453,25 @@ const HeaderWrapperComponent = (props) => {
);
};
+// Style when Hidden is enabled in table column configuration
+const columnHiddenStyle = {
+ borderRight: 'none',
+ paddingLeft: 0,
+ paddingRight: 0,
+};
+
+// Style when Hidden is enabled in configuration mode
+const columnOpacityStyle = {
+ opacity: 0.3,
+};
+
const HeaderCellComponent = (props) => {
+ const { designable } = useDesignable();
+
+ if (props.columnHidden) {
+ return {designable ? props.children : null} | ;
+ }
+
return | ;
};
@@ -453,7 +484,7 @@ const BodyRowComponent = (props: {
return ;
};
-const BodyCellComponent = (props) => {
+const InternalBodyCellComponent = (props) => {
const { token } = useToken();
const inView = useContext(InViewContext);
const isIndex = props.className?.includes('selection-column');
@@ -474,6 +505,21 @@ const BodyCellComponent = (props) => {
);
};
+const displayNone = { display: 'none' };
+const BodyCellComponent = (props) => {
+ const { designable } = useDesignable();
+
+ if (props.columnHidden) {
+ return (
+
+ {designable ? props.children : {props.children}}
+ |
+ );
+ }
+
+ return ;
+};
+
interface TableProps {
/** @deprecated */
useProps?: () => any;
diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx
index 7a74e28999..aa6d723fda 100644
--- a/packages/core/client/src/schema-settings/SchemaSettings.tsx
+++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx
@@ -363,7 +363,7 @@ export const SchemaSettingsFormItemTemplate = function FormItemTemplate(props) {
};
export interface SchemaSettingsItemProps extends Omit {
- title: string;
+ title: string | ReactNode;
}
export const SchemaSettingsItem: FC = (props) => {
const { pushMenuItem } = useCollectMenuItems();
@@ -544,7 +544,7 @@ export const SchemaSettingsCascaderItem: FC = (
};
export interface SchemaSettingsSwitchItemProps extends Omit {
- title: string;
+ title: string | ReactNode;
checked?: boolean;
onChange?: (v: boolean) => void;
}
@@ -598,9 +598,7 @@ export const SchemaSettingsPopupItem: FC = (props) =>
);
};
-export interface SchemaSettingsActionModalItemProps
- extends SchemaSettingsModalItemProps,
- Omit {
+export interface SchemaSettingsActionModalItemProps extends SchemaSettingsModalItemProps {
uid?: string;
initialSchema?: ISchema;
schema?: ISchema;