Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ A section is any routable component. A table with search and sorting:
| Navigation | Sections with icons and live counters, captions, account menu, language switch. |
| Listings | Server or in-memory data, filters, selection, live reload, loading, empty and error states. |
| Forms and dialogs | Side and bottom sheets, validation, field errors, unsaved-changes guard. |
| Blocks | Figures with change, line and bar charts, rankings, meters, tabs, timeline, facts. |
| Blocks | Figures with change, line and bar charts, rankings, meters, tabs, timeline, facts, [expandable catalogs](https://github.com/Echways/Enfilade/blob/main/docs/en/components.md#catalogs). |
| Errors | Readable messages for your own exceptions, contained failures, retry. |
| Access | Host authentication, roles and policies, per-section visibility. |
| Formatting | Numbers, sizes, durations, ICU plurals, the viewer's time zone. |
Expand All @@ -113,7 +113,7 @@ A section is any routable component. A table with search and sorting:
| [Actions](https://github.com/Echways/Enfilade/blob/main/docs/en/actions.md) | `Button`, `Act`, `CurrentPage` |
| [Listings](https://github.com/Echways/Enfilade/blob/main/docs/en/listings.md) | Tables, filters, selection |
| [Dialogs and forms](https://github.com/Echways/Enfilade/blob/main/docs/en/forms.md) | Sheets, `Form`, `Field` |
| [Components](https://github.com/Echways/Enfilade/blob/main/docs/en/components.md) | Figures, charts, tabs and the rest |
| [Components](https://github.com/Echways/Enfilade/blob/main/docs/en/components.md) | Figures, charts, tabs and catalogs |
| [Error messages](https://github.com/Echways/Enfilade/blob/main/docs/en/errors.md) | What users see on failure |
| [Formatting](https://github.com/Echways/Enfilade/blob/main/docs/en/formatting.md) | `Words`, `ViewerTime` |
| [Styling](https://github.com/Echways/Enfilade/blob/main/docs/en/styling.md) | Themes, accent, tokens |
Expand Down
4 changes: 2 additions & 2 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ app.Run();
| Навигация | Разделы с иконками и живыми счётчиками, заголовки групп, меню аккаунта, переключатель языка. |
| Списки | Данные с сервера или из памяти, фильтры, выбор строк, живое обновление, состояния загрузки, пустоты и ошибки. |
| Формы и диалоги | Боковые и нижние панели, валидация, ошибки у полей, защита от потери изменений. |
| Блоки | Показатели с динамикой, линейные и столбчатые графики, рейтинги, шкалы, вкладки, хронология, карточки фактов. |
| Блоки | Показатели с динамикой, линейные и столбчатые графики, рейтинги, шкалы, вкладки, хронология, карточки фактов, [раскрываемые каталоги](https://github.com/Echways/Enfilade/blob/main/docs/ru/components.md#каталоги). |
| Ошибки | Понятные сообщения для ваших исключений, локализованные сбои, повтор. |
| Доступ | Аутентификация хоста, роли и политики, видимость разделов. |
| Форматирование | Числа, размеры, длительности, ICU-множественные, часовой пояс зрителя. |
Expand All @@ -113,7 +113,7 @@ app.Run();
| [Действия](https://github.com/Echways/Enfilade/blob/main/docs/ru/actions.md) | `Button`, `Act`, `CurrentPage` |
| [Списки](https://github.com/Echways/Enfilade/blob/main/docs/ru/listings.md) | Таблицы, фильтры, выбор строк |
| [Диалоги и формы](https://github.com/Echways/Enfilade/blob/main/docs/ru/forms.md) | Панели, `Form`, `Field` |
| [Компоненты](https://github.com/Echways/Enfilade/blob/main/docs/ru/components.md) | Показатели, графики, вкладки и остальное |
| [Компоненты](https://github.com/Echways/Enfilade/blob/main/docs/ru/components.md) | Показатели, графики, вкладки и каталоги |
| [Сообщения об ошибках](https://github.com/Echways/Enfilade/blob/main/docs/ru/errors.md) | Что видит пользователь при сбое |
| [Форматирование](https://github.com/Echways/Enfilade/blob/main/docs/ru/formatting.md) | `Words`, `ViewerTime` |
| [Оформление](https://github.com/Echways/Enfilade/blob/main/docs/ru/styling.md) | Темы, акцентный цвет, токены |
Expand Down
2 changes: 1 addition & 1 deletion docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Enfilade is a Blazor Server shell for admin panels. These pages describe every p
| [Actions](actions.md) | `Button` and `Act`: confirmation, busy state, readable errors, refreshing the page. |
| [Listings](listings.md) | Tables over any store: sorting, paging, filters, selection, live reload, address state. |
| [Dialogs and forms](forms.md) | Side sheets, forms from data annotations, unsaved changes. |
| [Components](components.md) | Figures, charts, rankings, tabs, timeline, facts, panes and the rest. |
| [Components](components.md) | Figures, charts, tabs, timeline, facts, panes and [expandable catalogs](components.md#catalogs). |
| [Error messages](errors.md) | What the user sees when something fails, and how to control it. |

## Around the page
Expand Down
2 changes: 1 addition & 1 deletion docs/en/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (result is ActResult.Done)

| Parameter | Description |
| ----------------- | ------------------------------------------------------------------------ |
| `Kind` | `Primary` (default), `Danger` or `Quiet`. |
| `Kind` | `Primary` (default) for the main action, `Danger` for destructive actions, `Quiet` for secondary actions. |
| `OnClick` | The action. The button is disabled and shows that it is busy until it ends. |
| `Confirm` | `Confirm(Question, Message, Yes, Danger)` asked before the action. |
| `Done` | Message shown after success. |
Expand Down
44 changes: 44 additions & 0 deletions docs/en/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| `Steps` | A vertical progress of a process from `Step(Title, State, Detail)`; `State` is `Pending`, `Current`, `Done` or `Failed`. |
| `Wizard`, `WizardStep` | A multi-step flow: `Steps` and the open `WizardStep` (`Title`, `Detail`, `OnLeave`) with Back, Next and Finish. `@bind-Current`, `OnFinish`, `Done`, `Confirm`. See below. |
| `Tabs`, `Tab` | Tabs whose choice lives in the address (`tab=`, or `Name`). A `Tab` has `Title` and optional `Name`; only the open tab renders. |
| `Catalog` | An [expandable group](#catalogs) with a title, an optional count and an actions slot. |
| `Timeline` | Events from `TimelineEntry(At, Text, Who, Tone)`, newest first, in the viewer's time zone. |
| `Pane` | A titled section of a page with `Hint` and `Actions`. |
| `Setting` | A settings row: `Title`, `Hint` and the control on the right. Group rows in `<div class="settings">`. |
Expand Down Expand Up @@ -135,6 +136,49 @@ A `Menu` is a "⋯" button for the actions of one row. Put it in a `Slot`; click

`Label` names the button for screen readers (default "Row actions"). For a link, use `MudMenuItem Href`.

## Catalogs

`Catalog` displays an expandable group on the current page. Several catalogs can be open at once. Content is mounted on expansion and disposed on collapse.

![The Clients page with Group 124 expanded and Group 134 collapsed](../screenshots/catalogs.png)

[View the same page on a phone](../screenshots/catalogs-mobile.png).

```razor
@inject IDialogService Dialogs

<PageHead Title="Clients" Count="@Groups.Sum(group => group.ClientCount)">
<Actions>
<Button OnClick="CreateGroupAsync" Refresh="false">New catalog</Button>
</Actions>
</PageHead>

@foreach (var group in Groups)
{
<Catalog @key="group.Id" Title="@group.Name" Count="@group.ClientCount">
<Listing TItem="Client" Name="@($"clients-{group.Id}")"
Load="(query, token) => Store.ClientsAsync(group.Id, query, token)">
<Columns>
<Cell Title="Name" Value="client => client.Name" Sort />
<Cell Title="Email" Value="client => client.Email" />
</Columns>
</Listing>
</Catalog>
}

@code {
private async Task CreateGroupAsync()
{
if (await Dialogs.ShowFormAsync<NewClientGroup, ClientGroupDraft>("New catalog") is not null)
Groups = await Store.GroupsAsync();
}
}
```

`NewClientGroup` is a [form in a sheet](forms.md) with a required name field. Save the group in the form's `OnSubmit` handler. `ShowFormAsync` returns the draft when the save succeeds. Reload the groups at that point. The `@key` preserves the expanded groups across that update.

Put a [menu](#row-menu) in the catalog's `Actions` slot for actions such as rename and delete. Give each nested `Listing` a distinct `Name` to keep its paging and filters independent. For concurrent EF Core loads, give each request its own context.

## Wizard

A `Wizard` shows `Steps` next to the open step and the buttons that move between them. Only the open `WizardStep` renders. `Current` is the index of the open step; bind it with `@bind-Current` to read or set it, or leave it out and the wizard keeps it itself.
Expand Down
4 changes: 3 additions & 1 deletion docs/en/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ For a plain confirmation before an action, `Button` with `Confirm` is shorter; s
var order = await Dialogs.ShowFormAsync<OrderSheet, OrderDraft>("New order");
```

![A form in a side sheet](../screenshots/sheet.png)
![New order form with a rounded Create button in a side sheet](../screenshots/sheet.png)

The [Catalogs](components.md#catalogs) example shows how to open a form and refresh the groups after saving.

`Form` validates with data annotations, shows a busy submit button and submits once on Enter. On success it reports `Done`, reloads the page's blocks, and inside a sheet closes it with the model, which `ShowFormAsync` returns; a closed sheet returns `null`.

Expand Down
3 changes: 2 additions & 1 deletion docs/en/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Use the tokens in your own stylesheets and they follow the theme:
| --------------------------------------------- | ------------------------------------------------ |
| `btn-k pigment` | Primary button. |
| `btn-danger` | Destructive button. |
| `link` | Quiet text button. |
| `btn-quiet` | Secondary button with a hover background. |
| `link` | Inline text action. |
| `tbl`, `tbl dense` | On `MudTable`. Add `num` to numeric columns. |
| `empty` | Empty state; `EmptyState` renders it. |
| `block`, `lead` | Titled section further down a page; `Pane` replaces them. |
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Enfilade — оболочка для админ-панелей на Blazor Serve
| [Действия](actions.md) | `Button` и `Act`: подтверждение, состояние занятости, понятные ошибки, обновление страницы. |
| [Списки](listings.md) | Таблицы над любым хранилищем: сортировка, страницы, фильтры, выбор строк, живое обновление, состояние в адресе. |
| [Диалоги и формы](forms.md) | Боковые панели, формы из атрибутов данных, несохранённые изменения. |
| [Компоненты](components.md) | Показатели, графики, рейтинги, вкладки, хронология, блоки и остальное. |
| [Компоненты](components.md) | Показатели, графики, вкладки, хронология, блоки и [раскрываемые каталоги](components.md#каталоги). |
| [Сообщения об ошибках](errors.md) | Что видит пользователь, когда что-то не получилось, и как этим управлять. |

## Вокруг страницы
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (result is ActResult.Done)

| Параметр | Описание |
| ----------------- | ------------------------------------------------------------------------ |
| `Kind` | `Primary` (по умолчанию), `Danger` или `Quiet`. |
| `Kind` | `Primary` (по умолчанию) для основного действия, `Danger` для опасного, `Quiet` для второстепенного. |
| `OnClick` | Действие. Пока оно идёт, кнопка отключена и показывает занятость. |
| `Confirm` | `Confirm(Question, Message, Yes, Danger)` — вопрос перед действием. |
| `Done` | Сообщение после успеха. |
Expand Down
44 changes: 44 additions & 0 deletions docs/ru/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| `Steps` | Вертикальный ход процесса из `Step(Title, State, Detail)`; `State` — `Pending`, `Current`, `Done` или `Failed`. |
| `Wizard`, `WizardStep` | Многошаговый сценарий: `Steps` и открытый `WizardStep` (`Title`, `Detail`, `OnLeave`) с кнопками «Назад», «Далее» и «Готово». `@bind-Current`, `OnFinish`, `Done`, `Confirm`. См. ниже. |
| `Tabs`, `Tab` | Вкладки, выбор которых хранится в адресе (`tab=` или `Name`). У `Tab` есть `Title` и необязательный `Name`; рендерится только открытая вкладка. |
| `Catalog` | [Раскрываемая группа](#каталоги) с названием, необязательным счётчиком и слотом действий. |
| `Timeline` | События из `TimelineEntry(At, Text, Who, Tone)`, новые сверху, в часовом поясе зрителя. |
| `Pane` | Блок страницы с заголовком, `Hint` и `Actions`. |
| `Setting` | Строка настроек: `Title`, `Hint` и элемент управления справа. Строки группируются в `<div class="settings">`. |
Expand Down Expand Up @@ -135,6 +136,49 @@

`Label` называет кнопку для скринридера (по умолчанию «Действия со строкой»). Для ссылки используйте `MudMenuItem Href`.

## Каталоги

`Catalog` показывает раскрываемую группу на текущей странице. Несколько каталогов можно открыть одновременно. Содержимое создаётся при раскрытии и освобождается при сворачивании.

![Страница клиентов с раскрытой группой 124 и свёрнутой группой 134](../screenshots/catalogs.png)

[Та же страница на телефоне](../screenshots/catalogs-mobile.png).

```razor
@inject IDialogService Dialogs

<PageHead Title="Клиенты" Count="@Groups.Sum(group => group.ClientCount)">
<Actions>
<Button OnClick="CreateGroupAsync" Refresh="false">Новый каталог</Button>
</Actions>
</PageHead>

@foreach (var group in Groups)
{
<Catalog @key="group.Id" Title="@group.Name" Count="@group.ClientCount">
<Listing TItem="Client" Name="@($"clients-{group.Id}")"
Load="(query, token) => Store.ClientsAsync(group.Id, query, token)">
<Columns>
<Cell Title="Имя" Value="client => client.Name" Sort />
<Cell Title="Email" Value="client => client.Email" />
</Columns>
</Listing>
</Catalog>
}

@code {
private async Task CreateGroupAsync()
{
if (await Dialogs.ShowFormAsync<NewClientGroup, ClientGroupDraft>("Новый каталог") is not null)
Groups = await Store.GroupsAsync();
}
}
```

`NewClientGroup` — это [форма в панели](forms.md) с обязательным полем «Название». Сохраняйте группу в обработчике `OnSubmit`. После успешного сохранения `ShowFormAsync` вернёт модель, и можно перечитать группы. Ключ `@key` сохраняет раскрытые группы при таком обновлении.

Поместите [меню](#меню-строки) в слот `Actions` каталога, чтобы добавить переименование или удаление. Укажите отдельный `Name` для каждого вложенного `Listing`, чтобы страницы и фильтры групп были независимы. Для параллельных загрузок через EF Core используйте отдельный контекст на каждый запрос.

## Wizard

`Wizard` показывает `Steps` рядом с открытым шагом и кнопки перехода между шагами. Рисуется только открытый `WizardStep`. `Current` — номер открытого шага: привяжите его через `@bind-Current`, чтобы читать или задавать, или не указывайте, и мастер сам его хранит.
Expand Down
4 changes: 3 additions & 1 deletion docs/ru/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ var result = await sheet.Result;
var order = await Dialogs.ShowFormAsync<OrderSheet, OrderDraft>("New order");
```

![A form in a side sheet](../screenshots/sheet.png)
![Форма нового заказа со скруглённой кнопкой создания в боковой панели](../screenshots/sheet.png)

В разделе [Каталоги](components.md#каталоги) показано, как открыть форму и обновить группы после сохранения.

`Form` проверяет модель по атрибутам данных, показывает занятую кнопку отправки и отправляет один раз по Enter. После успеха он сообщает `Done`, перезагружает блоки страницы, а внутри панели закрывает её и возвращает модель, которую отдаёт `ShowFormAsync`; закрытая панель возвращает `null`.

Expand Down
Loading