Files
request-portal/src/webparts/requestPortal/forms/viewRegistry.ts
T
gorbenko.pavel 364835eaf7
Tests / frontend-test (push) Successful in 1m16s
Обходной лист (#7)
Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz>
Reviewed-on: http://git.tnsu.kz/timur.gorodetskiy/request-portal/pulls/7
2026-08-17 05:43:38 +00:00

51 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import * as React from 'react';
import type { WebPartContext } from '@microsoft/sp-webpart-base';
export interface IApprovalViewProps {
context: WebPartContext;
itemId: number;
/**
* Ключ формы (= pageUrl типа заявки в approval-route API) — тот же, что и
* rptype в ссылке (см. ApproveFeature). Нужен режиму согласующего, чтобы
* самому резолвить числовой RequestTypeId через useRequestTypeId (форма
* подачи получает готовый requestType.id, а View — только itemId/context).
*/
formKey: string;
}
type ViewComponent = React.ComponentType<IApprovalViewProps>;
/**
* Реестр форм «только для чтения» (режим согласующего): ключ формы → ленивый просмотр.
* Добавить просмотр = создать <Форма>View.tsx + строка здесь.
*/
const viewRegistry: Record<string, React.LazyExoticComponent<ViewComponent>> = {
'recruiting-selection': React.lazy(
() => import(/* webpackChunkName: 'view-recruiting-selection' */ './RecruitingSelection/RecruitingSelectionView')
),
'recruiting-hire': React.lazy(
() => import(/* webpackChunkName: 'view-recruiting-hire' */ './RecruitingHire/RecruitingHireView')
),
'it-workplace-setup': React.lazy(
() => import(/* webpackChunkName: 'view-workplace-setup' */ './WorkplaceSetup/WorkplaceSetupView')
),
'it-1c-ticket': React.lazy(
() => import(/* webpackChunkName: 'view-1c-ticket' */ './Ticket1C/Ticket1CView')
),
'hr-vacation': React.lazy(
() => import(/* webpackChunkName: 'view-vacation' */ './Vacation/VacationView')
),
'wh-tmc-transfer': React.lazy(
() => import(/* webpackChunkName: 'view-tmc-transfer' */ './TmcTransfer/TmcTransferView')
),
'clearance-form': React.lazy(
() => import(/* webpackChunkName: 'view-clearance' */ './Clearance/ClearanceView')
)
};
export function getViewComponent(
formKey: string
): React.LazyExoticComponent<ViewComponent> | undefined {
return viewRegistry[formKey];
}