--no-edit

This commit is contained in:
Тимур Городецкий
2026-08-07 10:59:43 +05:00
24 changed files with 960 additions and 267 deletions
@@ -8,6 +8,7 @@ import { getRequestsByCategory, REQUEST_TYPES } from '../../data/requests';
import { getFormComponent } from '../../forms/registry';
import { IRequestType } from '../../models/types';
import { emitRequestsChanged } from '../../shared/requestEvents';
import { confirmDiscardFormChanges, markFormClean } from '../../shared/unsavedChanges';
export interface ISubmitFeatureProps {
context: WebPartContext;
@@ -51,7 +52,15 @@ const SubmitFeature: React.FC<ISubmitFeatureProps> = ({
const requests = getRequestsByCategory(activeCategoryId);
const handleBack = (): void => setSelectedRequest(null);
// Возврат к плиткам закрывает форму и теряет введённое (раздел остаётся
// смонтированным, но состояние формы живёт в самом FormComponent). Спрашиваем,
// если правки есть и они не сохранены; после согласия флаг снимаем — терять
// уже нечего.
const handleBack = (): void => {
if (!confirmDiscardFormChanges()) return;
markFormClean();
setSelectedRequest(null);
};
const renderSelected = (request: IRequestType): React.ReactNode => {
const FormComponent = getFormComponent(request.id);