копирование есть

This commit is contained in:
gorbenko.pavel
2026-08-14 14:03:38 +05:00
parent 10f70609ad
commit d052fd41b8
10 changed files with 540 additions and 10 deletions
@@ -9,6 +9,10 @@ export interface IFormModalProps {
/** Текст ошибки: и валидации формы, и ответа бэкенда. */
error?: string;
isSaving: boolean;
/** Подпись кнопки подтверждения — по умолчанию «Сохранить» (см. копирование маршрута). */
submitLabel?: string;
/** Подпись той же кнопки во время запроса — по умолчанию «Сохранение...». */
savingLabel?: string;
onSubmit: () => void;
onClose: () => void;
children: React.ReactNode;
@@ -18,7 +22,16 @@ export interface IFormModalProps {
* Модальное окно формы: одинаковая обвязка «ошибка сверху, Отмена/Сохранить снизу»
* для всех справочников, чтобы экраны описывали только поля.
*/
export const FormModal: React.FC<IFormModalProps> = ({ title, error, isSaving, onSubmit, onClose, children }) => (
export const FormModal: React.FC<IFormModalProps> = ({
title,
error,
isSaving,
submitLabel = texts.common.save,
savingLabel = texts.common.saving,
onSubmit,
onClose,
children
}) => (
<Modal
title={title}
onClose={onClose}
@@ -26,7 +39,7 @@ export const FormModal: React.FC<IFormModalProps> = ({ title, error, isSaving, o
<>
<Button variant="secondary" onClick={onClose} disabled={isSaving}>{texts.common.cancel}</Button>
<Button variant="accent" icon="check" onClick={onSubmit} disabled={isSaving}>
{isSaving ? texts.common.saving : texts.common.save}
{isSaving ? savingLabel : submitLabel}
</Button>
</>
}
@@ -24,7 +24,8 @@ export type IconName =
| 'briefcase'
| 'flag'
| 'crown'
| 'refresh';
| 'refresh'
| 'copy';
let spriteInjected = false;
@@ -51,6 +52,7 @@ const SPRITE_SVG = `
<symbol id="i-flag" viewBox="0 0 24 24"><path d="M5 3v18"/><path d="M5 4h13l-3 4 3 4H5"/></symbol>
<symbol id="i-crown" viewBox="0 0 24 24"><path d="m3 8 4 3 5-6 5 6 4-3-2 11H5z"/></symbol>
<symbol id="i-refresh" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-3-6.7"/><path d="M21 3v6h-6"/></symbol>
<symbol id="i-copy" viewBox="0 0 24 24"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/></symbol>
`;
function ensureSpriteInjected(): void {