feat: add moduleType to configurations, introduce DetailPageProvider, and consolidate macOS detection into module provider context

This commit is contained in:
Firman Ramdhani
2026-07-13 15:39:10 +07:00
parent 0bbd376125
commit 383e2627e0
7 changed files with 41 additions and 41 deletions
@@ -46,6 +46,7 @@ export type ModuleActionType = (typeof ModuleAction)[keyof typeof ModuleAction]
* Defines the architectural category of the module (e.g., routed vs. modal-driven).
*/
export type ModuleCategoryType = 'SINGLE_PAGE' | 'FULL_PAGE';
type ModuleType = 'TRANSACTION' | 'MASTER_DATA';
/**
* Represents the current operational mode of a form instance.
@@ -95,6 +96,7 @@ export interface ModuleConfigEntity<E extends BaseEntity = BaseEntity> {
apiUrl: string;
tabTitle?: string;
moduleCategory: ModuleCategoryType;
moduleType: ModuleType;
translationNamespace: string;
singlePageFormConfig?: SinglePageConfig;
@@ -108,6 +110,7 @@ export interface ModuleConfigEntity<E extends BaseEntity = BaseEntity> {
export interface ConfigSlice<E extends BaseEntity = BaseEntity> {
config: ModuleConfigEntity<E>;
privileges: PrivilegeEntity;
IS_MACOS: boolean;
}
export interface DataServiceSlice<
@@ -187,20 +190,12 @@ export interface EnterpriseFormLifecycleHooks<E extends BaseEntity, TFormData =
afterGetData?: (data: E) => Promise<TFormData>;
}
export interface EnterpriseIndexPageConfig<E extends BaseEntity = BaseEntity> {
_data?: E; // Fix unused generic
export interface EnterpriseIndexPageConfig {
children?: ReactNode;
px?: string | number;
py?: string | number;
// customHiddenActions?: (selected: E[], defaultHidden: string[]) => string[];
// /** Strongly typed event handler to prevent arbitrary string usage for actions. */
// onCustomActionClick?: (key: ModuleActionType, data?: unknown) => void;
// filterDrawerContent?: ReactNode;
// registerRefreshCallback?: (callback: () => void) => void;
pageHeaderProps?: Omit<ModulePageHeaderProps, 'actions' | 'moduleKey'>;
// actions?: PageActionsProps['actions'];
customPageActions?: (actions: PageActionsProps['actions']) => PageActionsProps['actions'];
onClickCreate?: (key: string) => void;
}
@@ -227,11 +222,10 @@ export interface EnterpriseDetailPageConfig<E extends BaseEntity = BaseEntity> {
children?: ReactNode;
showPageHeader?: boolean;
useDefaultPadding?: boolean;
customHiddenActions?: (data: E | null, defaultHidden: string[]) => string[];
onCustomActionClick?: (key: ModuleActionType, data?: unknown) => void;
editMode?: 'FULL' | 'PARTIAL';
afterGetData?: (data: E) => Promise<unknown>;
pageHeaderProps?: Omit<ModulePageHeaderProps, 'actions' | 'moduleKey'>;
customPageActions?: (data: E, actions: PageActionsProps['actions']) => PageActionsProps['actions'];
}
export interface PrivilegeEntity {