47bdcb11d8
## Context Moving isActive filtering to the frontend for page layout tabs and widgets, hiding inactive entities from the UI while keeping them in state for future reactivation Next we will implement deactivated standard tab re-activation during tab creation (cc @Devessier) <img width="234" height="303" alt="📋 Menu (Slots)" src="https://github.com/user-attachments/assets/17a25ac6-55e2-4778-b7f0-e7554ed69704" />
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
|
import {
|
|
FieldDisplayMode,
|
|
PageLayoutTabLayoutMode,
|
|
WidgetConfigurationType,
|
|
WidgetType,
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
export const createDefaultFieldWidget = ({
|
|
id,
|
|
pageLayoutTabId,
|
|
title,
|
|
fieldMetadataId,
|
|
fieldDisplayMode = FieldDisplayMode.CARD,
|
|
objectMetadataId,
|
|
positionIndex,
|
|
}: {
|
|
id: string;
|
|
pageLayoutTabId: string;
|
|
title: string;
|
|
fieldMetadataId: string;
|
|
fieldDisplayMode?: FieldDisplayMode;
|
|
objectMetadataId: string;
|
|
positionIndex: number;
|
|
}): PageLayoutWidget => {
|
|
return {
|
|
__typename: 'PageLayoutWidget',
|
|
id,
|
|
pageLayoutTabId,
|
|
title,
|
|
isActive: true,
|
|
type: WidgetType.FIELD,
|
|
configuration: {
|
|
__typename: 'FieldConfiguration',
|
|
configurationType: WidgetConfigurationType.FIELD,
|
|
fieldMetadataId,
|
|
fieldDisplayMode,
|
|
},
|
|
gridPosition: {
|
|
__typename: 'GridPosition',
|
|
row: 0,
|
|
column: 0,
|
|
rowSpan: 1,
|
|
columnSpan: 12,
|
|
},
|
|
position: {
|
|
__typename: 'PageLayoutWidgetVerticalListPosition',
|
|
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
index: positionIndex,
|
|
},
|
|
objectMetadataId: objectMetadataId ?? null,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
};
|
|
};
|