wt-front-shared 19.0.45 → 19.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-form/index.d.ts +5 -0
- package/{lib/core/components/auto-form → auto-form/lib}/auto-form.module.d.ts +22 -28
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-cheditor/form-field-cheditor.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-date/form-field-date.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-file/form-field-file.component.d.ts +8 -8
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-file-show/form-field-file-show.component.d.ts +4 -4
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-files/form-field-files.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-files-show/form-field-files-show.component.d.ts +4 -4
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-input/form-field-input.component.d.ts +3 -3
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-input-show/form-field-input-show.component.d.ts +3 -3
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-json-show/form-field-json-show.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-rating/form-field-rating.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-select/form-field-select.component.d.ts +5 -5
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-select-show/form-field-select-show.component.d.ts +4 -4
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-slide-toggle/form-field-slide-toggle.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-slide-toggle-show/form-field-slide-toggle-show.component.d.ts +3 -3
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-string-list-input/form-field-string-list-input.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-tags/form-field-tags.component.d.ts +4 -4
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-textarea-show/form-field-textarea-show.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/components/form-message-box/form-message-box.component.d.ts +2 -2
- package/{lib/core/components/auto-form → auto-form/lib}/containers/auto-form-main/auto-form-main.component.d.ts +10 -10
- package/{lib/core/components/auto-form → auto-form/lib}/containers/auto-form-show/auto-form-show.component.d.ts +5 -5
- package/{lib/core/components/auto-form → auto-form/lib}/containers/auto-form-show-field/auto-form-show-field.component.d.ts +5 -5
- package/{lib/core/components/auto-form → auto-form/lib}/containers/form-field/form-field.component.d.ts +5 -5
- package/{lib/core/components/auto-form → auto-form/lib}/containers/publish-messages/publish-messages.component.d.ts +6 -6
- package/{lib/core → auto-form/lib}/dialogs/form-dialog/form-dialog.component.d.ts +13 -13
- package/auto-form/public-api.d.ts +3 -0
- package/entities/README.md +46 -0
- package/entities/index.d.ts +5 -0
- package/entities/lib/guards/entity-sections.guard.d.ts +11 -0
- package/entities/lib/guards/route-wait.service.d.ts +10 -0
- package/entities/lib/services/entities-adapter.service.d.ts +72 -0
- package/entities/lib/services/entities-api.service.d.ts +13 -0
- package/entities/lib/services/entities-events.service.d.ts +9 -0
- package/entities/lib/services/entities-sections.service.d.ts +42 -0
- package/entities/lib/settings/code-editor.component.d.ts +24 -0
- package/entities/lib/settings/code-lint.util.d.ts +11 -0
- package/entities/lib/settings/entities-settings.component.d.ts +27 -0
- package/entities/lib/settings/entities-settings.facade.d.ts +23 -0
- package/entities/lib/settings/entities-settings.models.d.ts +99 -0
- package/entities/lib/settings/entities-settings.util.d.ts +122 -0
- package/entities/lib/settings/entity-form.component.d.ts +256 -0
- package/entities/lib/settings/entity-plan-dialog.component.d.ts +15 -0
- package/entities/lib/state/entities.actions.d.ts +35 -0
- package/entities/lib/state/entities.effects.d.ts +34 -0
- package/entities/lib/state/entities.facade.d.ts +17 -0
- package/entities/lib/state/entities.models.d.ts +157 -0
- package/entities/lib/state/entities.reducer.d.ts +13 -0
- package/entities/lib/state/entities.selectors.d.ts +15 -0
- package/entities/lib/tokens.d.ts +8 -0
- package/entities/lib/ui/confirm-dialog.component.d.ts +13 -0
- package/entities/lib/ui/empty-state.component.d.ts +8 -0
- package/entities/lib/ui/index.d.ts +5 -0
- package/entities/lib/ui/inline-alert.component.d.ts +11 -0
- package/entities/lib/ui/page-header.component.d.ts +8 -0
- package/entities/lib/ui/status-chip.component.d.ts +8 -0
- package/entities/public-api.d.ts +19 -0
- package/fesm2022/wt-front-shared-auto-form.mjs +2781 -0
- package/fesm2022/wt-front-shared-auto-form.mjs.map +1 -0
- package/fesm2022/wt-front-shared-entities.mjs +2850 -0
- package/fesm2022/wt-front-shared-entities.mjs.map +1 -0
- package/fesm2022/wt-front-shared-panel-ui.mjs +2056 -0
- package/fesm2022/wt-front-shared-panel-ui.mjs.map +1 -0
- package/fesm2022/wt-front-shared-static-data.mjs +5058 -0
- package/fesm2022/wt-front-shared-static-data.mjs.map +1 -0
- package/fesm2022/wt-front-shared.mjs +829 -10491
- package/fesm2022/wt-front-shared.mjs.map +1 -1
- package/lib/core/+state/router/router.effects.d.ts +1 -1
- package/lib/core/+state/static-data/static-data.actions.d.ts +1 -1
- package/lib/core/+state/static-data/static-data.facade.d.ts +1 -1
- package/lib/core/animations/appearFromLeftWithDelay.d.ts +10 -1
- package/lib/core/components/external-services/external-service.models.d.ts +3 -0
- package/lib/core/components/index.d.ts +7 -47
- package/lib/core/components/star-rating/star-rating.component.d.ts +2 -2
- package/lib/core/dialogs/dialogs.module.d.ts +7 -9
- package/lib/core/{components/auto-form → forms-shared}/interfaces/form-field-others.d.ts +1 -1
- package/lib/core/interceptors/headers.interceptor.d.ts +4 -3
- package/lib/core/services/auto-form/auto-form.service.d.ts +2 -2
- package/lib/core/services/base-auto-form/base-auto-form.service.d.ts +3 -3
- package/lib/core/{components/static-data → static-data-shared}/interfaces/static-data.interface.d.ts +1 -1
- package/lib/core/{components/static-data → static-data-shared}/services/static-data.service.service.d.ts +3 -3
- package/lib/core/utils/deep-equal.d.ts +6 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/models/config/app-config.d.ts +2 -1
- package/lib/models/endpoints/static-data/board-settings-request.d.ts +1 -1
- package/lib/models/endpoints/static-data/preset-settings-request.d.ts +1 -1
- package/lib/models/endpoints/static-data/static-data-get-list/request/static-data-get-list-request-config.d.ts +1 -1
- package/package.json +39 -2
- package/panel-ui/index.d.ts +5 -0
- package/{lib/core/components → panel-ui/lib}/files-upload/constants.d.ts +1 -1
- package/{lib/core/components → panel-ui/lib}/files-upload/file-list-card/file-list-card.component.d.ts +6 -6
- package/{lib/core/components → panel-ui/lib}/files-upload/files-upload/files-upload.component.d.ts +5 -5
- package/{lib/core/components → panel-ui/lib}/files-upload/files-upload-list-images/files-upload-list-images.component.d.ts +3 -3
- package/{lib/core/components → panel-ui/lib}/files-upload/files-upload.module.d.ts +2 -3
- package/{lib/core/components → panel-ui/lib}/files-upload/table-files-uploading/table-files-uploading.component.d.ts +4 -4
- package/{lib/core/components → panel-ui/lib}/form-field-error/form-field-error.component.d.ts +2 -2
- package/{lib/core/components → panel-ui/lib}/form-field-publish-error/form-field-publish-error.component.d.ts +3 -3
- package/{lib/core/components → panel-ui/lib}/panel/panel.component.d.ts +1 -1
- package/{lib/core/components → panel-ui/lib}/panel/panel.module.d.ts +1 -1
- package/{lib/core/components → panel-ui/lib}/profile/profile.component.d.ts +3 -3
- package/{lib/core/components → panel-ui/lib}/site-helper/site-helper.component.d.ts +3 -3
- package/{lib/core/components → panel-ui/lib}/tag-cloud/tag-cloud.component.d.ts +1 -1
- package/{lib/core/components → panel-ui/lib}/tag-cloud/tag-cloud.module.d.ts +1 -1
- package/panel-ui/public-api.d.ts +30 -0
- package/public-api.d.ts +10 -3
- package/static-data/index.d.ts +5 -0
- package/{lib/core/components/static-data → static-data/lib}/boards/board-edit-dialog.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/boards/board-filter.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/boards/board-settings-dialog.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/boards/boards.facade.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/boards/index.d.ts +0 -1
- package/{lib/core/components/static-data → static-data/lib}/boards/kanban.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/components/field-settings-dialog/field-settings-dialog.component.d.ts +4 -4
- package/{lib/core/components/static-data → static-data/lib}/components/filtering-dialog/filtering-dialog.component.d.ts +5 -5
- package/{lib/core/components/static-data → static-data/lib}/components/filtering-form/filtering-form.component.d.ts +6 -6
- package/{lib/core/components/static-data → static-data/lib}/components/list-sub-entities/list-sub-entities.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/components/static-data-create-new-dynamic-form-dialog/static-data-create-new-dynamic-form-dialog.component.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/components/static-data-create-new-item-dialog/static-data-create-new-item-dialog.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/components/static-data-filter-options/static-data-filter-options.component.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/components/static-data-list-filtering/static-data-list-filtering.component.d.ts +5 -5
- package/{lib/core/components/static-data → static-data/lib}/components/static-data-list-items/static-data-list-items.component.d.ts +12 -10
- package/{lib/core/components/static-data → static-data/lib}/components/view-static-data-details-dialog/view-static-data-details-dialog.component.d.ts +2 -2
- package/{lib/core/components/static-data → static-data/lib}/containers/static-data-details/static-data-details.component.d.ts +28 -27
- package/{lib/core/components/static-data → static-data/lib}/containers/static-data-items/column-filter.component.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/containers/static-data-items/static-data-items.component.d.ts +5 -5
- package/{lib/core/components/static-data → static-data/lib}/containers/static-data-list/static-data-list.component.d.ts +6 -5
- package/{lib/core/components/static-data → static-data/lib}/containers/static-data-view/static-data-view.component.d.ts +10 -10
- package/{lib/core/components/static-data → static-data/lib}/presets/index.d.ts +0 -1
- package/{lib/core/components/static-data → static-data/lib}/presets/presets.component.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/presets/presets.facade.d.ts +1 -1
- package/{lib/core/components/static-data → static-data/lib}/presets/save-preset-dialog.component.d.ts +1 -1
- package/static-data/lib/static-data.module.d.ts +40 -0
- package/static-data/public-api.d.ts +8 -0
- package/lib/core/components/button/index.d.ts +0 -2
- package/lib/core/components/static-data/static-data.module.d.ts +0 -46
- /package/{lib/core/components/auto-form → auto-form/lib}/components/form-field-spinner/form-field-spinner.component.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/constants/auto-form-show-value.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/constants/errors.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/auto-form.interfaces.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/dynamic-form-question-type.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/field-type.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/form-field-format.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/form-field-option.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/form-field.d.ts +0 -0
- /package/lib/core/{components/auto-form → forms-shared}/interfaces/input-type.d.ts +0 -0
- /package/lib/core/{components/static-data → static-data-shared}/interfaces/component-input-data.interface.d.ts +0 -0
- /package/lib/core/{components/static-data/boards → static-data-shared/models}/board.models.d.ts +0 -0
- /package/lib/core/{components/static-data/presets → static-data-shared/models}/preset.models.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/access-denied/access-denied.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/access-denied/access-denied.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/chips-input/chips-input.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/chips-input/chips-input.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/form-field-error/form-field-error.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/form-field-publish-error/form-field-publish-error.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/header/header.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/header/header.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/input-tags/input-tags.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/input-tags/input-tags.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/panel-header/panel-header.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/panel-header/panel-header.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/profile/profile.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/site-helper/configs/publication-error-tour.config.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/site-helper/configs/unpublish-tour.config.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/site-helper/interfaces/config.interfaces.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/site-helper/site-helper.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/smart-progress-bar/smart-progress-bar.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/smart-progress-bar/smart-progress-bar.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/sticky-sidebar/sticky-sidebar.directive.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/sticky-sidebar/sticky-sidebar.module.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/table-menu/table-menu.component.d.ts +0 -0
- /package/{lib/core/components → panel-ui/lib}/table-menu/table-menu.module.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/components/static-data-create-new-dialog/static-data-create-new-dialog.component.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/components/static-data-list-items/column-preferences.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/components/static-data-list-items/group-nested-items.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/components/static-data-list-items/visible-nested-rows.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/containers/static-data-items/column-resize.directive.d.ts +0 -0
- /package/{lib/core/components/static-data → static-data/lib}/static-data-routing.module.d.ts +0 -0
|
@@ -0,0 +1,2850 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Injectable, Inject, Optional, signal, inject, input, ChangeDetectionStrategy, Component, output, computed, ChangeDetectorRef, ViewChild } from '@angular/core';
|
|
3
|
+
import * as i1 from '@ngrx/store';
|
|
4
|
+
import { createAction, props, createReducer, on, createFeatureSelector, createSelector, select } from '@ngrx/store';
|
|
5
|
+
import * as i1$2 from '@ngrx/effects';
|
|
6
|
+
import { createEffect, ofType } from '@ngrx/effects';
|
|
7
|
+
import { Subject, of, combineLatest, take, map as map$1, defer, filter as filter$1, timeout, switchMap as switchMap$1, catchError as catchError$1, finalize, Subscription } from 'rxjs';
|
|
8
|
+
import { map, distinctUntilChanged, switchMap, catchError, withLatestFrom, filter } from 'rxjs/operators';
|
|
9
|
+
import * as i5 from 'wt-front-shared';
|
|
10
|
+
import { CORE_CONFIG, FieldType, IFormFieldFormat, ValidatorsType, AuthenticationService } from 'wt-front-shared';
|
|
11
|
+
import * as i1$1 from '@angular/common/http';
|
|
12
|
+
import { HttpParams } from '@angular/common/http';
|
|
13
|
+
import * as i1$5 from '@angular/common';
|
|
14
|
+
import { CommonModule } from '@angular/common';
|
|
15
|
+
import * as i2$1 from '@angular/forms';
|
|
16
|
+
import { FormsModule } from '@angular/forms';
|
|
17
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
18
|
+
import * as i1$4 from '@angular/material/button';
|
|
19
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
20
|
+
import * as i2 from '@angular/material/dialog';
|
|
21
|
+
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
|
|
22
|
+
import * as i6 from '@angular/material/form-field';
|
|
23
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
24
|
+
import * as i1$3 from '@angular/material/icon';
|
|
25
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
26
|
+
import * as i6$1 from '@angular/material/input';
|
|
27
|
+
import { MatInputModule } from '@angular/material/input';
|
|
28
|
+
import * as i7 from '@angular/material/progress-spinner';
|
|
29
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
30
|
+
import * as i8 from '@angular/material/table';
|
|
31
|
+
import { MatTableModule } from '@angular/material/table';
|
|
32
|
+
import * as i9 from '@angular/material/tooltip';
|
|
33
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
34
|
+
import * as i3 from '@angular/cdk/drag-drop';
|
|
35
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
36
|
+
import * as i2$2 from '@angular/material/checkbox';
|
|
37
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
38
|
+
import * as i10 from '@angular/material/select';
|
|
39
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
40
|
+
import { Compartment, EditorState } from '@codemirror/state';
|
|
41
|
+
import { EditorView, lineNumbers, highlightActiveLine, keymap } from '@codemirror/view';
|
|
42
|
+
import { history, defaultKeymap, historyKeymap, indentWithTab } from '@codemirror/commands';
|
|
43
|
+
import { javascriptLanguage, javascript } from '@codemirror/lang-javascript';
|
|
44
|
+
import { lintGutter, setDiagnostics } from '@codemirror/lint';
|
|
45
|
+
|
|
46
|
+
const ENTITIES_NOTIFIER = new InjectionToken('ENTITIES_NOTIFIER', {
|
|
47
|
+
providedIn: 'root',
|
|
48
|
+
factory: () => ({
|
|
49
|
+
success: (message) => console.info('[ entities ]', message),
|
|
50
|
+
warning: (message) => console.warn('[ entities ]', message),
|
|
51
|
+
error: (message) => console.error('[ entities ]', message),
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const EntitiesLoad = createAction('[ Entities ] Load');
|
|
56
|
+
const EntitiesLoadSuccess = createAction('[ Entities ] Load Success', props());
|
|
57
|
+
const EntitiesLoadFail = createAction('[ Entities ] Load Fail', props());
|
|
58
|
+
const EntitiesRemove = createAction('[ Entities ] Remove', props());
|
|
59
|
+
const EntitiesClear = createAction('[ Entities ] Clear');
|
|
60
|
+
// Raw websocket event; the effect decides between refetch / remove / ignore.
|
|
61
|
+
const EntitiesEventReceived = createAction('[ Entities ] Event Received', props());
|
|
62
|
+
|
|
63
|
+
const ENTITIES_FEATURE_KEY = 'entities';
|
|
64
|
+
const initialEntitiesState = {
|
|
65
|
+
ids: [],
|
|
66
|
+
byKey: {},
|
|
67
|
+
status: 'idle',
|
|
68
|
+
};
|
|
69
|
+
const _entitiesReducer = createReducer(initialEntitiesState, on(EntitiesLoad, (state) => ({ ...state, status: 'loading', error: undefined })), on(EntitiesLoadSuccess, (state, { payload }) => {
|
|
70
|
+
const byKey = {};
|
|
71
|
+
const ids = [];
|
|
72
|
+
(payload.data || []).forEach((d) => {
|
|
73
|
+
if (!d || !d.key || byKey[d.key])
|
|
74
|
+
return;
|
|
75
|
+
byKey[d.key] = d;
|
|
76
|
+
ids.push(d.key);
|
|
77
|
+
});
|
|
78
|
+
return { ids, byKey, status: 'loaded' };
|
|
79
|
+
}), on(EntitiesLoadFail, (state, { payload }) => ({ ...state, status: 'error', error: payload.error })), on(EntitiesRemove, (state, { payload }) => {
|
|
80
|
+
if (!state.byKey[payload.key])
|
|
81
|
+
return state;
|
|
82
|
+
const byKey = { ...state.byKey };
|
|
83
|
+
delete byKey[payload.key];
|
|
84
|
+
return { ...state, byKey, ids: state.ids.filter((k) => k !== payload.key) };
|
|
85
|
+
}), on(EntitiesClear, () => initialEntitiesState));
|
|
86
|
+
function entitiesReducer(state, action) {
|
|
87
|
+
return _entitiesReducer(state, action);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const getState = createFeatureSelector(ENTITIES_FEATURE_KEY);
|
|
91
|
+
const getAll = createSelector(getState, (s) => (s?.ids || []).map((k) => s.byKey[k]));
|
|
92
|
+
const getActive = createSelector(getAll, (all) => all.filter((e) => e.isActive !== false));
|
|
93
|
+
const getUiOnly = createSelector(getActive, (all) => all.filter((e) => e.source === 'ui'));
|
|
94
|
+
const getByKey = (key) => createSelector(getState, (s) => s?.byKey?.[key]);
|
|
95
|
+
const getStatus = createSelector(getState, (s) => s?.status || 'idle');
|
|
96
|
+
const getLoaded = createSelector(getStatus, (st) => st === 'loaded');
|
|
97
|
+
const getVersions = createSelector(getState, (s) => {
|
|
98
|
+
const r = {};
|
|
99
|
+
(s?.ids || []).forEach((k) => (r[k] = s.byKey[k].version));
|
|
100
|
+
return r;
|
|
101
|
+
});
|
|
102
|
+
const entitiesQuery = { getState, getAll, getActive, getUiOnly, getByKey, getStatus, getLoaded, getVersions };
|
|
103
|
+
|
|
104
|
+
class EntitiesFacade {
|
|
105
|
+
constructor(store) {
|
|
106
|
+
this.store = store;
|
|
107
|
+
this.all$ = this.store.pipe(select(entitiesQuery.getAll));
|
|
108
|
+
this.active$ = this.store.pipe(select(entitiesQuery.getActive));
|
|
109
|
+
this.uiOnly$ = this.store.pipe(select(entitiesQuery.getUiOnly));
|
|
110
|
+
this.status$ = this.store.pipe(select(entitiesQuery.getStatus));
|
|
111
|
+
this.loaded$ = this.store.pipe(select(entitiesQuery.getLoaded));
|
|
112
|
+
}
|
|
113
|
+
byKey$(key) {
|
|
114
|
+
return this.store.pipe(select(entitiesQuery.getByKey(key)));
|
|
115
|
+
}
|
|
116
|
+
reload() {
|
|
117
|
+
this.store.dispatch(EntitiesLoad());
|
|
118
|
+
}
|
|
119
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
120
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesFacade, providedIn: 'root' }); }
|
|
121
|
+
}
|
|
122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesFacade, decorators: [{
|
|
123
|
+
type: Injectable,
|
|
124
|
+
args: [{ providedIn: 'root' }]
|
|
125
|
+
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
126
|
+
|
|
127
|
+
class EntitiesApiService {
|
|
128
|
+
constructor(http, config) {
|
|
129
|
+
this.http = http;
|
|
130
|
+
this.config = config;
|
|
131
|
+
}
|
|
132
|
+
// GET /api/entities -> { data: EntityDefinition[] } (JWT added by the shared interceptor)
|
|
133
|
+
list() {
|
|
134
|
+
const base = (this.config?.apiUrl || '').replace(/\/$/, '');
|
|
135
|
+
return this.http.get(`${base}/api/entities`).pipe(map((r) => r?.data || []));
|
|
136
|
+
}
|
|
137
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesApiService, deps: [{ token: i1$1.HttpClient }, { token: CORE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
138
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesApiService, providedIn: 'root' }); }
|
|
139
|
+
}
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesApiService, decorators: [{
|
|
141
|
+
type: Injectable,
|
|
142
|
+
args: [{ providedIn: 'root' }]
|
|
143
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: undefined, decorators: [{
|
|
144
|
+
type: Inject,
|
|
145
|
+
args: [CORE_CONFIG]
|
|
146
|
+
}] }] });
|
|
147
|
+
|
|
148
|
+
// Bridge between the websocket client (panel SdWebsocketService.actionHandlers) and the entities store.
|
|
149
|
+
// The WS handler calls `publish(message.data)` for actions entity.created|updated|deleted|entities.reload.
|
|
150
|
+
class EntitiesEventsService {
|
|
151
|
+
constructor() {
|
|
152
|
+
this.events$ = new Subject();
|
|
153
|
+
}
|
|
154
|
+
publish(payload) {
|
|
155
|
+
if (payload && typeof payload === 'object')
|
|
156
|
+
this.events$.next(payload);
|
|
157
|
+
}
|
|
158
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
159
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEventsService, providedIn: 'root' }); }
|
|
160
|
+
}
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEventsService, decorators: [{
|
|
162
|
+
type: Injectable,
|
|
163
|
+
args: [{ providedIn: 'root' }]
|
|
164
|
+
}] });
|
|
165
|
+
|
|
166
|
+
class EntitiesEffects {
|
|
167
|
+
constructor(actions$, store, api, events, authenticationService) {
|
|
168
|
+
this.actions$ = actions$;
|
|
169
|
+
this.store = store;
|
|
170
|
+
this.api = api;
|
|
171
|
+
this.events = events;
|
|
172
|
+
this.authenticationService = authenticationService;
|
|
173
|
+
// Login completion = authenticated user id appears (same signal SdWebsocketService uses); logout clears the store.
|
|
174
|
+
this.onAuth$ = createEffect(() => this.authenticationService.currentUser.pipe(map((user) => {
|
|
175
|
+
const id = user?.id || user?.userData?.id;
|
|
176
|
+
return id ? String(id) : null;
|
|
177
|
+
}), distinctUntilChanged(), map((id) => (id ? EntitiesLoad() : EntitiesClear()))));
|
|
178
|
+
this.load$ = createEffect(() => this.actions$.pipe(ofType(EntitiesLoad), switchMap(() => this.api.list().pipe(map((data) => EntitiesLoadSuccess({ payload: { data } })), catchError((error) => of(EntitiesLoadFail({ payload: { error } })))))));
|
|
179
|
+
this.wsToAction$ = createEffect(() => this.events.events$.pipe(map((payload) => EntitiesEventReceived({ payload }))));
|
|
180
|
+
this.onEvent$ = createEffect(() => this.actions$.pipe(ofType(EntitiesEventReceived), withLatestFrom(this.store.select(entitiesQuery.getVersions)), map(([{ payload }, versions]) => {
|
|
181
|
+
switch (payload.type) {
|
|
182
|
+
case 'entity.deleted':
|
|
183
|
+
return payload.key ? EntitiesRemove({ payload: { key: payload.key } }) : EntitiesLoad();
|
|
184
|
+
case 'entity.created':
|
|
185
|
+
case 'entity.updated': {
|
|
186
|
+
const known = payload.key ? versions[payload.key] : undefined;
|
|
187
|
+
// stale or duplicate event (we already have this version or newer) -> nothing to do
|
|
188
|
+
if (payload.key && known != null && payload.version != null && payload.version <= known)
|
|
189
|
+
return null;
|
|
190
|
+
return EntitiesLoad();
|
|
191
|
+
}
|
|
192
|
+
case 'entities.reload':
|
|
193
|
+
return EntitiesLoad();
|
|
194
|
+
default:
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
}), filter((a) => !!a)));
|
|
198
|
+
}
|
|
199
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEffects, deps: [{ token: i1$2.Actions }, { token: i1.Store }, { token: EntitiesApiService }, { token: EntitiesEventsService }, { token: i5.AuthenticationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
200
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEffects }); }
|
|
201
|
+
}
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesEffects, decorators: [{
|
|
203
|
+
type: Injectable
|
|
204
|
+
}], ctorParameters: () => [{ type: i1$2.Actions }, { type: i1.Store }, { type: EntitiesApiService }, { type: EntitiesEventsService }, { type: i5.AuthenticationService }] });
|
|
205
|
+
|
|
206
|
+
/** Physical table / Sequelize model name of a UI entity (mirrors the server's tableNameFor). */
|
|
207
|
+
const entityTableName = (key) => `Ent_${key.split(/[-_]+/).filter(Boolean).map((p) => p[0].toUpperCase() + p.slice(1)).join('')}`;
|
|
208
|
+
/** Form-engine async validator -> server check type (GET /api/form-validation/:type/...). */
|
|
209
|
+
const ASYNC_VALIDATOR_TYPES = { 'item-uniq-value': 'common-uniq-item', 'item-value-exists': 'common-item-exists' };
|
|
210
|
+
const MAX_LIST_COLUMNS = 5;
|
|
211
|
+
// Runtime adapter (SD-009 T09): EntityDefinition -> IFormField[] / list columns / filters. Pure, no I/O.
|
|
212
|
+
// Type mapping follows base/entity-field-type-map.md (D1). Store key of an entity = `staticData.list.<key>`.
|
|
213
|
+
class EntityAdapterService {
|
|
214
|
+
storeKey(entityKey) {
|
|
215
|
+
return `staticData.list.${entityKey}`;
|
|
216
|
+
}
|
|
217
|
+
/** Static-data slug of a relation target: UI entity = key; code entity = url slug of its hand-written service (`slug`), else the key. */
|
|
218
|
+
targetSlug(target, lookup) {
|
|
219
|
+
const def = lookup?.(target);
|
|
220
|
+
return def?.source === 'code' && def.slug ? def.slug : target;
|
|
221
|
+
}
|
|
222
|
+
/** Fields ordered by group order (ungrouped first), then field.order, then original position. */
|
|
223
|
+
orderedFields(def) {
|
|
224
|
+
const groupOrder = {};
|
|
225
|
+
(def.groups || []).forEach((g, i) => (groupOrder[g.key] = g.order ?? i));
|
|
226
|
+
const rank = (f) => (f.group && groupOrder[f.group] !== undefined ? groupOrder[f.group] + 1 : f.group ? 1e6 : 0);
|
|
227
|
+
return (def.fields || [])
|
|
228
|
+
.map((f, i) => ({ f, i }))
|
|
229
|
+
.sort((a, b) => rank(a.f) - rank(b.f) || (a.f.order ?? 1e6) - (b.f.order ?? 1e6) || a.i - b.i)
|
|
230
|
+
.map((x) => x.f);
|
|
231
|
+
}
|
|
232
|
+
toFormFields(def, lookup) {
|
|
233
|
+
const groupTitle = {};
|
|
234
|
+
(def.groups || []).forEach((g) => (groupTitle[g.key] = g.title));
|
|
235
|
+
return this.orderedFields(def).map((f) => this.toFormField(f, groupTitle, lookup, def.key));
|
|
236
|
+
}
|
|
237
|
+
toFormField(f, groupTitle = {}, lookup, entityKey = '') {
|
|
238
|
+
const o = f.options || {};
|
|
239
|
+
const options = {};
|
|
240
|
+
let type;
|
|
241
|
+
switch (f.type) {
|
|
242
|
+
case 'text':
|
|
243
|
+
type = o.rich ? FieldType.FieldTypeTextareaEditor : FieldType.FieldTypeTextarea;
|
|
244
|
+
break;
|
|
245
|
+
case 'integer':
|
|
246
|
+
type = FieldType.FieldTypeInput;
|
|
247
|
+
options.format = IFormFieldFormat.Number;
|
|
248
|
+
break;
|
|
249
|
+
case 'boolean':
|
|
250
|
+
type = FieldType.FieldTypeSlideToggle;
|
|
251
|
+
break;
|
|
252
|
+
case 'date':
|
|
253
|
+
type = FieldType.FieldTypeInput;
|
|
254
|
+
options.format = o.datetime ? IFormFieldFormat.DateTime : IFormFieldFormat.Date;
|
|
255
|
+
break;
|
|
256
|
+
case 'json':
|
|
257
|
+
type = FieldType.FieldTypeJSON;
|
|
258
|
+
break;
|
|
259
|
+
case 'select-one':
|
|
260
|
+
case 'select-many':
|
|
261
|
+
type = FieldType.FieldTypeSelect;
|
|
262
|
+
options.selectOptions = [];
|
|
263
|
+
options.loading = true;
|
|
264
|
+
if (f.type === 'select-many')
|
|
265
|
+
options.multiple = true;
|
|
266
|
+
if (f.relation?.target)
|
|
267
|
+
this.applyRelation(f, options, lookup);
|
|
268
|
+
break;
|
|
269
|
+
case 'string-list':
|
|
270
|
+
type = FieldType.FieldTypeInputStringList;
|
|
271
|
+
options.inputStringList = { separator: o.separator || ',' };
|
|
272
|
+
break;
|
|
273
|
+
case 'string':
|
|
274
|
+
default:
|
|
275
|
+
type = FieldType.FieldTypeInput;
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
if (o.hidden)
|
|
279
|
+
options.hide = true;
|
|
280
|
+
if (o.notEditable)
|
|
281
|
+
options.notEditable = true;
|
|
282
|
+
if (o.searchable)
|
|
283
|
+
options.innerSearch = false;
|
|
284
|
+
if (o.col)
|
|
285
|
+
options.col = o.col;
|
|
286
|
+
if (o.hint)
|
|
287
|
+
options.hint = o.hint;
|
|
288
|
+
if (o.placeholder)
|
|
289
|
+
options.placeholder = o.placeholder;
|
|
290
|
+
if (f.group && groupTitle[f.group] !== undefined)
|
|
291
|
+
options.groupName = groupTitle[f.group];
|
|
292
|
+
const cond = f.showIf || (f.type !== 'select-one' && f.type !== 'select-many' ? f.dependsOn : undefined);
|
|
293
|
+
if (cond)
|
|
294
|
+
options.showIf = this.toShowIf(cond);
|
|
295
|
+
if (f.relation?.filter && f.relation.filter.byField) {
|
|
296
|
+
options.subscribeToFormChanges = {
|
|
297
|
+
relatedField: f.relation.filter.byField,
|
|
298
|
+
loadOptionsParameters: { entity: f.relation.target, filteredField: f.relation.filter.field },
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
delete options.innerSearch; // `searchable` is a list/filter concern, not a form-control option
|
|
302
|
+
// SD-009 field settings stored as data (definition field.options.*): presentation, client-side checks, relation pickers
|
|
303
|
+
if (o.example)
|
|
304
|
+
options.example = o.example;
|
|
305
|
+
['colSm', 'colMd', 'colLg', 'colXl', 'colXxl'].forEach((k) => { if (o[k])
|
|
306
|
+
options[k] = o[k]; });
|
|
307
|
+
if (o.isSortable)
|
|
308
|
+
options.isSortable = true;
|
|
309
|
+
if (f.type === 'boolean' && (o.trueTitle || o.falseTitle))
|
|
310
|
+
options.toggleView = { trueTitle: o.trueTitle || 'Да', falseTitle: o.falseTitle || 'Нет' };
|
|
311
|
+
if (f.type === 'select-one' || f.type === 'select-many') {
|
|
312
|
+
if (o.selectShowAllOptions)
|
|
313
|
+
options.selectShowAllOptions = true;
|
|
314
|
+
if (o.innerSearch)
|
|
315
|
+
options.innerSearch = true;
|
|
316
|
+
if (o.lazyLoading && f.relation?.target) {
|
|
317
|
+
options.innerSearchOptions = {
|
|
318
|
+
lazyLoading: true,
|
|
319
|
+
entityType: this.targetSlug(f.relation.target, lookup),
|
|
320
|
+
minValueLengthForRequest: o.minSearchLength || 3,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
if (o.filterOptions?.length)
|
|
324
|
+
options.filterOptions = o.filterOptions.map((x) => ({ field: x.field, value: String(x.value) }));
|
|
325
|
+
}
|
|
326
|
+
const validators = [];
|
|
327
|
+
if (f.required && f.type !== 'boolean')
|
|
328
|
+
validators.push(ValidatorsType.Required);
|
|
329
|
+
if (f.type === 'boolean' && o.mustBeTrue)
|
|
330
|
+
validators.push(ValidatorsType.RequiredTrue);
|
|
331
|
+
if ((f.type === 'string' || f.type === 'text') && o.minLength) {
|
|
332
|
+
validators.push(ValidatorsType.MinLength);
|
|
333
|
+
options.validations = { ...(options.validations || {}), [ValidatorsType.MinLength]: { type: ValidatorsType.MinLength, length: o.minLength } };
|
|
334
|
+
}
|
|
335
|
+
if ((f.type === 'string' || f.type === 'text') && o.pattern) {
|
|
336
|
+
validators.push(ValidatorsType.Pattern);
|
|
337
|
+
options.validations = {
|
|
338
|
+
...(options.validations || {}),
|
|
339
|
+
[ValidatorsType.Pattern]: { type: ValidatorsType.Pattern, pattern: o.pattern, ...(o.patternMessage ? { errorText: o.patternMessage } : {}) },
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const asyncValidators = (o.asyncValidators || []).filter((v) => ASYNC_VALIDATOR_TYPES[v]);
|
|
343
|
+
if (entityKey && asyncValidators.length && ['string', 'text', 'integer'].includes(f.type)) {
|
|
344
|
+
// both engine validators read `validations.uniq`; the shared GET /api/form-validation/:type/:value/:itemId/:table/:field counts rows of
|
|
345
|
+
// the entity's table (generated model `Ent_<Key>`) by field
|
|
346
|
+
const v = asyncValidators[0];
|
|
347
|
+
options.validations = {
|
|
348
|
+
...(options.validations || {}),
|
|
349
|
+
uniq: {
|
|
350
|
+
type: ASYNC_VALIDATOR_TYPES[v],
|
|
351
|
+
entity: entityTableName(entityKey),
|
|
352
|
+
entityField: f.key,
|
|
353
|
+
errorKey: v === 'item-uniq-value' ? 'itemUniqValue' : 'itemValueExists',
|
|
354
|
+
errorText: v === 'item-uniq-value' ? `«${f.title}»: такое значение уже используется` : `«${f.title}»: значение не найдено`,
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
const res = { field: f.key, title: f.title, type, options };
|
|
359
|
+
if (validators.length)
|
|
360
|
+
res.validators = validators;
|
|
361
|
+
if (asyncValidators.length && options.validations?.uniq)
|
|
362
|
+
res.asyncValidators = asyncValidators.slice(0, 1);
|
|
363
|
+
if (o.description)
|
|
364
|
+
res.description = o.description;
|
|
365
|
+
if (f.default !== undefined && f.default !== null)
|
|
366
|
+
res.value = f.default;
|
|
367
|
+
if (o.calculated)
|
|
368
|
+
res.status = 'calculated';
|
|
369
|
+
return res;
|
|
370
|
+
}
|
|
371
|
+
listConfig(def, lookup) {
|
|
372
|
+
const fields = this.orderedFields(def).filter((f) => !f.options?.hidden);
|
|
373
|
+
const marked = fields.filter((f) => f.options?.listColumn);
|
|
374
|
+
const chosen = marked.length ? marked : fields.filter((f) => f.type !== 'json' && f.type !== 'text').slice(0, MAX_LIST_COLUMNS);
|
|
375
|
+
const columns = chosen.map((f) => this.toColumn(f));
|
|
376
|
+
const filters = [];
|
|
377
|
+
fields.forEach((f) => {
|
|
378
|
+
if (f.type === 'select-one' || f.type === 'select-many') {
|
|
379
|
+
if (f.relation?.target) {
|
|
380
|
+
filters.push({ field: f.key, title: f.title, kind: 'select', loadOptionFromStore: this.storeKey(this.targetSlug(f.relation.target, lookup)), multiple: f.type === 'select-many' });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
else if (f.type === 'boolean')
|
|
384
|
+
filters.push({ field: f.key, title: f.title, kind: 'boolean' });
|
|
385
|
+
else if (f.type === 'date')
|
|
386
|
+
filters.push({ field: f.key, title: f.title, kind: 'date' });
|
|
387
|
+
else if (f.options?.searchable && (f.type === 'string' || f.type === 'text'))
|
|
388
|
+
filters.push({ field: f.key, title: f.title, kind: 'search' });
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
fieldsOnListPage: columns.map((c) => c.field),
|
|
392
|
+
columns,
|
|
393
|
+
filters,
|
|
394
|
+
search: fields.some((f) => f.options?.searchable),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
/** `<target>(paging:{perPage:-1})` entries so relation pickers have options in the store. */
|
|
398
|
+
preLoadSections(def, lookup) {
|
|
399
|
+
// an explicit list (entity settings) wins: it can hold more or fewer sections than the relation fields point at
|
|
400
|
+
if (Array.isArray(def.options?.preLoadSections))
|
|
401
|
+
return [...def.options.preLoadSections];
|
|
402
|
+
const targets = [];
|
|
403
|
+
(def.fields || []).forEach((f) => {
|
|
404
|
+
if (!f.relation?.target)
|
|
405
|
+
return;
|
|
406
|
+
const slug = this.targetSlug(f.relation.target, lookup);
|
|
407
|
+
if (!targets.includes(slug))
|
|
408
|
+
targets.push(slug);
|
|
409
|
+
});
|
|
410
|
+
return targets.map((t) => `${t}(paging:{perPage:-1})`);
|
|
411
|
+
}
|
|
412
|
+
toSection(def, lookup) {
|
|
413
|
+
const list = this.listConfig(def, lookup);
|
|
414
|
+
return {
|
|
415
|
+
key: def.key,
|
|
416
|
+
title: def.title,
|
|
417
|
+
fields: this.toFormFields(def, lookup),
|
|
418
|
+
preLoadSections: this.preLoadSections(def, lookup),
|
|
419
|
+
options: { fieldsOnListPage: list.fieldsOnListPage, search: list.search },
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* SD-009 T11: the section object the static-data pages (list, create/edit form, boards, presets) read from
|
|
424
|
+
* `AppConfig.staticDataMapping[<entity key>]`. System columns: id (list), isActive (editable toggle, default true, list column).
|
|
425
|
+
* Boards and presets are on: both are generic per content type (`/api/static-data/<key>/boards|presets`).
|
|
426
|
+
*/
|
|
427
|
+
toStaticDataSection(def, lookup) {
|
|
428
|
+
const list = this.listConfig(def, lookup);
|
|
429
|
+
const titles = {};
|
|
430
|
+
list.columns.forEach((c) => (titles[c.field] = c.title));
|
|
431
|
+
const isActive = {
|
|
432
|
+
field: 'isActive',
|
|
433
|
+
title: 'Активна',
|
|
434
|
+
type: FieldType.FieldTypeSlideToggle,
|
|
435
|
+
value: true,
|
|
436
|
+
options: { toggleView: { trueTitle: 'Да', falseTitle: 'Нет (скрыта из выбора)' } },
|
|
437
|
+
};
|
|
438
|
+
const so = def.options || {};
|
|
439
|
+
const section = {
|
|
440
|
+
title: def.title,
|
|
441
|
+
key: def.key,
|
|
442
|
+
fields: [...this.toFormFields(def, lookup), isActive],
|
|
443
|
+
preLoadSections: this.preLoadSections(def, lookup),
|
|
444
|
+
options: {
|
|
445
|
+
fieldsOnListPage: [
|
|
446
|
+
{ field: 'id', title: 'ID' },
|
|
447
|
+
...list.columns.map((c) => ({ field: c.field, title: c.title })),
|
|
448
|
+
{ field: 'isActive', title: 'Активна' },
|
|
449
|
+
],
|
|
450
|
+
search: so.search ?? list.search,
|
|
451
|
+
boards: so.boards ?? true,
|
|
452
|
+
showpresets: so.showpresets ?? true,
|
|
453
|
+
},
|
|
454
|
+
};
|
|
455
|
+
// section settings stored as data (definition.options): only what is set is passed on
|
|
456
|
+
['showSettings', 'allItems'].forEach((k) => { if (so[k] !== undefined)
|
|
457
|
+
section.options[k] = so[k]; });
|
|
458
|
+
['kanbanColumnField', 'kanbanField', 'orderByField'].forEach((k) => { if (so[k])
|
|
459
|
+
section.options[k] = so[k]; });
|
|
460
|
+
if (so.filteringType)
|
|
461
|
+
section.options.filteringType = so.filteringType;
|
|
462
|
+
if (so.filtering?.fields?.length)
|
|
463
|
+
section.options.filtering = { fields: so.filtering.fields.map((x) => ({ ...x })) };
|
|
464
|
+
if (so.viewSettings)
|
|
465
|
+
section.options.viewSettings = JSON.parse(JSON.stringify(so.viewSettings));
|
|
466
|
+
if (so.texts)
|
|
467
|
+
section.texts = JSON.parse(JSON.stringify(so.texts));
|
|
468
|
+
if (so.actions) {
|
|
469
|
+
const a = {};
|
|
470
|
+
['isNoViewAction', 'isNoDeleteAction', 'isNoEditAction'].forEach((k) => { if (so.actions[k])
|
|
471
|
+
a[k] = true; });
|
|
472
|
+
if (so.actions.defaultListAction)
|
|
473
|
+
a.defaultListAction = so.actions.defaultListAction;
|
|
474
|
+
if (Object.keys(a).length)
|
|
475
|
+
section.actions = a;
|
|
476
|
+
}
|
|
477
|
+
return section;
|
|
478
|
+
}
|
|
479
|
+
toColumn(f) {
|
|
480
|
+
const c = { field: f.key, title: f.title, type: String(f.type) };
|
|
481
|
+
if (f.type === 'date')
|
|
482
|
+
c.format = f.options?.datetime ? IFormFieldFormat.DateTime : IFormFieldFormat.Date;
|
|
483
|
+
if (f.relation?.target)
|
|
484
|
+
c.relationTarget = f.relation.target;
|
|
485
|
+
return c;
|
|
486
|
+
}
|
|
487
|
+
toShowIf(c) {
|
|
488
|
+
return { relatedField: c.field, conditions: [{ type: c.op || 'equals', value: c.value }] };
|
|
489
|
+
}
|
|
490
|
+
applyRelation(f, options, lookup) {
|
|
491
|
+
const r = f.relation;
|
|
492
|
+
const target = lookup?.(r.target);
|
|
493
|
+
options.loadOptionFromStore = this.storeKey(this.targetSlug(r.target, lookup));
|
|
494
|
+
const label = r.displayField || target?.displayField || 'name';
|
|
495
|
+
const display = label !== 'name' ? label : null;
|
|
496
|
+
if (display || r.activeOnly) {
|
|
497
|
+
// mirrors activeOptionsOnly / custom label pattern of code entities
|
|
498
|
+
const mapper = (items, keepIds = []) => {
|
|
499
|
+
const keep = new Set(keepIds.filter((id) => id !== null && id !== undefined).map((id) => String(id)));
|
|
500
|
+
return (items || [])
|
|
501
|
+
.filter((i) => !r.activeOnly || i?.isActive !== false || keep.has(String(i?.id)))
|
|
502
|
+
.map((i) => ({ id: i.id, name: display ? i[display] : i.name }));
|
|
503
|
+
};
|
|
504
|
+
options.loadOptionFromStoreGetItems = mapper;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
508
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityAdapterService, providedIn: 'root' }); }
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityAdapterService, decorators: [{
|
|
511
|
+
type: Injectable,
|
|
512
|
+
args: [{ providedIn: 'root' }]
|
|
513
|
+
}] });
|
|
514
|
+
|
|
515
|
+
const ENTITIES_CACHE_KEY = 'sd-entities-cache';
|
|
516
|
+
/**
|
|
517
|
+
* SD-009 T11: registers UI-managed entities as static-data sections at runtime.
|
|
518
|
+
*
|
|
519
|
+
* The static-data pages (list, create/edit/view, boards, presets, filters, pickers that list all types) read the section from
|
|
520
|
+
* `AppConfig.staticDataMapping[<contentType>]` lazily at route/component activation, and relation pickers read the list from the
|
|
521
|
+
* NgRx static-data reducer under the dynamic key `staticData.list.<key>` (reducer maps are keyed by content type, nothing to
|
|
522
|
+
* register there). So an active UI entity is made a section by adding its adapter output to those two maps; a disabled/removed one is
|
|
523
|
+
* removed again. Hand-written (code) sections are never touched: a key that exists in the config and was not registered here is skipped.
|
|
524
|
+
*/
|
|
525
|
+
class EntitySectionsService {
|
|
526
|
+
constructor(adapter, facade, config, auth) {
|
|
527
|
+
this.adapter = adapter;
|
|
528
|
+
this.facade = facade;
|
|
529
|
+
this.config = config;
|
|
530
|
+
this.auth = auth;
|
|
531
|
+
this.registered = new Set();
|
|
532
|
+
}
|
|
533
|
+
/** Subscribes to the entities store (idempotent). */
|
|
534
|
+
start() {
|
|
535
|
+
if (this.sub || !this.facade)
|
|
536
|
+
return;
|
|
537
|
+
// Sections of the last session register at once (before the first route is activated), so a deep link does not wait for the network;
|
|
538
|
+
// the store load below reconciles them (changed / removed / disabled entities).
|
|
539
|
+
this.restoreCache();
|
|
540
|
+
// Reconcile only while the store is 'loaded': boot clears and reloads the store (login / workspace switch), and an emptied-but-not-loaded
|
|
541
|
+
// store must not unregister sections that a deep-linked page is about to read.
|
|
542
|
+
this.sub = combineLatest([this.facade.all$, this.facade.status$]).subscribe(([all, status]) => {
|
|
543
|
+
if (status === 'loaded') {
|
|
544
|
+
this.sync(all);
|
|
545
|
+
this.saveCache(all);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
// ---- last known definitions (localStorage) ----------------------------------------------------------
|
|
550
|
+
// Per user, without snippet sources (`code`): the cache only feeds the form/section adapter. A stale cache is harmless: the store load replaces it.
|
|
551
|
+
cacheUser() {
|
|
552
|
+
const user = this.auth?.currentUserValue;
|
|
553
|
+
return user?.id ? String(user.id) : '';
|
|
554
|
+
}
|
|
555
|
+
restoreCache() {
|
|
556
|
+
const user = this.cacheUser();
|
|
557
|
+
if (!user)
|
|
558
|
+
return;
|
|
559
|
+
try {
|
|
560
|
+
const raw = JSON.parse(localStorage.getItem(ENTITIES_CACHE_KEY) || 'null');
|
|
561
|
+
if (raw?.user === user && Array.isArray(raw.defs))
|
|
562
|
+
this.sync(raw.defs);
|
|
563
|
+
}
|
|
564
|
+
catch { /* unreadable cache: ignore */ }
|
|
565
|
+
}
|
|
566
|
+
saveCache(all) {
|
|
567
|
+
const user = this.cacheUser();
|
|
568
|
+
if (!user)
|
|
569
|
+
return;
|
|
570
|
+
try {
|
|
571
|
+
const defs = (all || []).map((d) => (d.code ? { ...d, code: undefined } : d));
|
|
572
|
+
localStorage.setItem(ENTITIES_CACHE_KEY, JSON.stringify({ user, at: Date.now(), defs }));
|
|
573
|
+
}
|
|
574
|
+
catch { /* storage full or unavailable: the cache is optional */ }
|
|
575
|
+
}
|
|
576
|
+
ngOnDestroy() {
|
|
577
|
+
this.sub?.unsubscribe();
|
|
578
|
+
}
|
|
579
|
+
/** Keys of the sections this service registered. */
|
|
580
|
+
get keys() {
|
|
581
|
+
return [...this.registered];
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Reconciles the maps with the store content: active UI entities are (re)registered, everything registered earlier that is no
|
|
585
|
+
* longer an active UI entity is removed (soft-disabled entities disappear from sections and from all-type pickers).
|
|
586
|
+
*/
|
|
587
|
+
sync(all) {
|
|
588
|
+
const config = this.config;
|
|
589
|
+
if (!config)
|
|
590
|
+
return;
|
|
591
|
+
const mapping = (config.staticDataMapping = config.staticDataMapping || {});
|
|
592
|
+
const stores = (config.staticDataConfig = config.staticDataConfig || {});
|
|
593
|
+
const byKey = {};
|
|
594
|
+
(all || []).forEach((d) => (byKey[d.key] = d));
|
|
595
|
+
const lookup = (key) => byKey[key];
|
|
596
|
+
const wanted = new Set();
|
|
597
|
+
(all || []).forEach((def) => {
|
|
598
|
+
if (def.source !== 'ui' || def.isActive === false || !def.key)
|
|
599
|
+
return;
|
|
600
|
+
if (mapping[def.key] && !this.registered.has(def.key))
|
|
601
|
+
return; // never override a hand-written section
|
|
602
|
+
mapping[def.key] = this.adapter.toStaticDataSection(def, lookup);
|
|
603
|
+
const cfgKey = this.staticDataConfigKey(def.key);
|
|
604
|
+
if (!stores[cfgKey] || stores[cfgKey].key === def.key)
|
|
605
|
+
stores[cfgKey] = { key: def.key, store: this.adapter.storeKey(def.key) };
|
|
606
|
+
this.registered.add(def.key);
|
|
607
|
+
wanted.add(def.key);
|
|
608
|
+
});
|
|
609
|
+
[...this.registered].forEach((key) => {
|
|
610
|
+
if (wanted.has(key))
|
|
611
|
+
return;
|
|
612
|
+
delete mapping[key];
|
|
613
|
+
const cfgKey = this.staticDataConfigKey(key);
|
|
614
|
+
if (stores[cfgKey]?.key === key)
|
|
615
|
+
delete stores[cfgKey];
|
|
616
|
+
this.registered.delete(key);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
/** `AppConfig.staticData` is keyed by camelCase names (businessDivisions); the kebab key is converted the same way. */
|
|
620
|
+
staticDataConfigKey(key) {
|
|
621
|
+
return key.replace(/-([a-z0-9])/g, (_m, c) => c.toUpperCase());
|
|
622
|
+
}
|
|
623
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitySectionsService, deps: [{ token: EntityAdapterService }, { token: EntitiesFacade, optional: true }, { token: CORE_CONFIG, optional: true }, { token: i5.AuthenticationService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
624
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitySectionsService, providedIn: 'root' }); }
|
|
625
|
+
}
|
|
626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitySectionsService, decorators: [{
|
|
627
|
+
type: Injectable,
|
|
628
|
+
args: [{ providedIn: 'root' }]
|
|
629
|
+
}], ctorParameters: () => [{ type: EntityAdapterService }, { type: EntitiesFacade, decorators: [{
|
|
630
|
+
type: Optional
|
|
631
|
+
}] }, { type: undefined, decorators: [{
|
|
632
|
+
type: Optional
|
|
633
|
+
}, {
|
|
634
|
+
type: Inject,
|
|
635
|
+
args: [CORE_CONFIG]
|
|
636
|
+
}] }, { type: i5.AuthenticationService, decorators: [{
|
|
637
|
+
type: Optional
|
|
638
|
+
}] }] });
|
|
639
|
+
|
|
640
|
+
/** True while a route guard holds navigation (e.g. waiting for the entities store); the app root shows a loading indicator. */
|
|
641
|
+
class RouteWaitService {
|
|
642
|
+
constructor() {
|
|
643
|
+
this.count = 0;
|
|
644
|
+
this.waiting = signal(false);
|
|
645
|
+
}
|
|
646
|
+
begin() {
|
|
647
|
+
this.count++;
|
|
648
|
+
this.waiting.set(true);
|
|
649
|
+
}
|
|
650
|
+
end() {
|
|
651
|
+
this.count = Math.max(0, this.count - 1);
|
|
652
|
+
this.waiting.set(this.count > 0);
|
|
653
|
+
}
|
|
654
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: RouteWaitService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
655
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: RouteWaitService, providedIn: 'root' }); }
|
|
656
|
+
}
|
|
657
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: RouteWaitService, decorators: [{
|
|
658
|
+
type: Injectable,
|
|
659
|
+
args: [{ providedIn: 'root' }]
|
|
660
|
+
}] });
|
|
661
|
+
|
|
662
|
+
/** Deep links wait for the post-login entities load; boot + login + fetch can take a while on a cold start. Guests skip the wait (nothing will load), so the cap only bounds a stuck load. */
|
|
663
|
+
const ENTITY_SECTIONS_WAIT_MS = 15000;
|
|
664
|
+
/** `/static-data/<key>/...` -> `<key>` (empty for the bare `/static-data`). */
|
|
665
|
+
function staticDataSectionKey(url) {
|
|
666
|
+
const m = /^\/static-data\/([^/?#]+)/.exec(url || '');
|
|
667
|
+
return m ? decodeURIComponent(m[1]) : '';
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* SD-009 T11: a deep link to a UI-entity directory (`/static-data/<entity key>`) can be opened before the entity definitions arrived
|
|
671
|
+
* (they are loaded after login). Waits (max 30 s) for the entities store when the section is unknown yet; known sections pass at once.
|
|
672
|
+
* The EntitySectionsService registers the sections as soon as the store is filled, before the route is activated.
|
|
673
|
+
*/
|
|
674
|
+
const entitySectionsGuard = (_route, state) => {
|
|
675
|
+
const key = staticDataSectionKey(state.url);
|
|
676
|
+
const config = inject(CORE_CONFIG, { optional: true });
|
|
677
|
+
if (!key || !config || config.staticDataMapping?.[key])
|
|
678
|
+
return of(true);
|
|
679
|
+
const facade = inject(EntitiesFacade, { optional: true });
|
|
680
|
+
if (!facade)
|
|
681
|
+
return of(true);
|
|
682
|
+
// Not signed in: entities never load, the auth guard redirects to the login page - do not hold the route.
|
|
683
|
+
if (inject(AuthenticationService, { optional: true })?.isGuest)
|
|
684
|
+
return of(true);
|
|
685
|
+
const sections = inject(EntitySectionsService, { optional: true });
|
|
686
|
+
const register = () => facade.all$.pipe(take(1), map$1((all) => { sections?.sync(all); return true; }));
|
|
687
|
+
const wait = inject(RouteWaitService, { optional: true });
|
|
688
|
+
// While the route is held the app root shows a loading indicator (RouteWaitService) instead of a blank page.
|
|
689
|
+
return defer(() => { wait?.begin(); return facade.status$; }).pipe(filter$1((status) => status === 'loaded' || status === 'error'), take(1), timeout(ENTITY_SECTIONS_WAIT_MS),
|
|
690
|
+
// The sections service registers from the same store emission; the router can activate the page first (details/create deep links
|
|
691
|
+
// read the section map at init), so register here before releasing the route. sync() is idempotent.
|
|
692
|
+
switchMap$1(register),
|
|
693
|
+
// Timeout or error: never block navigation, but still register whatever the store holds.
|
|
694
|
+
catchError$1(() => register()), finalize(() => wait?.end()));
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
class PageHeaderComponent {
|
|
698
|
+
constructor() {
|
|
699
|
+
this.title = input.required();
|
|
700
|
+
this.subtitle = input();
|
|
701
|
+
this.icon = input();
|
|
702
|
+
}
|
|
703
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PageHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
704
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: PageHeaderComponent, isStandalone: true, selector: "shared-ent-page-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, subtitle: { classPropertyName: "subtitle", publicName: "subtitle", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
705
|
+
<div class="heading">
|
|
706
|
+
@if (icon()) {
|
|
707
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
708
|
+
}
|
|
709
|
+
<div class="text">
|
|
710
|
+
<h1 class="title">{{ title() }}</h1>
|
|
711
|
+
@if (subtitle()) {
|
|
712
|
+
<p class="subtitle">{{ subtitle() }}</p>
|
|
713
|
+
}
|
|
714
|
+
</div>
|
|
715
|
+
</div>
|
|
716
|
+
<div class="actions"><ng-content /></div>
|
|
717
|
+
`, isInline: true, styles: [":host{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px}.heading{display:flex;align-items:center;gap:12px;min-width:0}.icon{color:var(--mat-sys-primary)}.title{margin:0;font:var(--mat-sys-title-large);color:var(--mat-sys-on-surface)}.subtitle{margin:0;font:var(--mat-sys-body-medium);color:var(--mat-sys-on-surface-variant)}.actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
718
|
+
}
|
|
719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PageHeaderComponent, decorators: [{
|
|
720
|
+
type: Component,
|
|
721
|
+
args: [{ selector: 'shared-ent-page-header', standalone: true, imports: [MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
722
|
+
<div class="heading">
|
|
723
|
+
@if (icon()) {
|
|
724
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
725
|
+
}
|
|
726
|
+
<div class="text">
|
|
727
|
+
<h1 class="title">{{ title() }}</h1>
|
|
728
|
+
@if (subtitle()) {
|
|
729
|
+
<p class="subtitle">{{ subtitle() }}</p>
|
|
730
|
+
}
|
|
731
|
+
</div>
|
|
732
|
+
</div>
|
|
733
|
+
<div class="actions"><ng-content /></div>
|
|
734
|
+
`, styles: [":host{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px}.heading{display:flex;align-items:center;gap:12px;min-width:0}.icon{color:var(--mat-sys-primary)}.title{margin:0;font:var(--mat-sys-title-large);color:var(--mat-sys-on-surface)}.subtitle{margin:0;font:var(--mat-sys-body-medium);color:var(--mat-sys-on-surface-variant)}.actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n"] }]
|
|
735
|
+
}] });
|
|
736
|
+
|
|
737
|
+
class StatusChipComponent {
|
|
738
|
+
constructor() {
|
|
739
|
+
this.tone = input('neutral');
|
|
740
|
+
this.icon = input();
|
|
741
|
+
}
|
|
742
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StatusChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
743
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: StatusChipComponent, isStandalone: true, selector: "shared-ent-status-chip", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"tone-\" + tone()" } }, ngImport: i0, template: `
|
|
744
|
+
@if (icon()) {
|
|
745
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
746
|
+
}
|
|
747
|
+
<ng-content />
|
|
748
|
+
`, isInline: true, styles: [":host{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border-radius:var(--mat-sys-corner-small);font:var(--mat-sys-label-medium);white-space:nowrap}.icon{width:16px;height:16px;font-size:16px}:host(.tone-neutral){background:var(--mat-sys-surface-container-high);color:var(--mat-sys-on-surface-variant)}:host(.tone-info){background:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}:host(.tone-success){background:var(--app-success-container);color:var(--app-on-success-container)}:host(.tone-warning){background:var(--app-warning-container);color:var(--app-on-warning-container)}:host(.tone-error){background:var(--mat-sys-error-container);color:var(--mat-sys-on-error-container)}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
749
|
+
}
|
|
750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StatusChipComponent, decorators: [{
|
|
751
|
+
type: Component,
|
|
752
|
+
args: [{ selector: 'shared-ent-status-chip', standalone: true, imports: [MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': '"tone-" + tone()' }, template: `
|
|
753
|
+
@if (icon()) {
|
|
754
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
755
|
+
}
|
|
756
|
+
<ng-content />
|
|
757
|
+
`, styles: [":host{display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 8px;border-radius:var(--mat-sys-corner-small);font:var(--mat-sys-label-medium);white-space:nowrap}.icon{width:16px;height:16px;font-size:16px}:host(.tone-neutral){background:var(--mat-sys-surface-container-high);color:var(--mat-sys-on-surface-variant)}:host(.tone-info){background:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}:host(.tone-success){background:var(--app-success-container);color:var(--app-on-success-container)}:host(.tone-warning){background:var(--app-warning-container);color:var(--app-on-warning-container)}:host(.tone-error){background:var(--mat-sys-error-container);color:var(--mat-sys-on-error-container)}\n"] }]
|
|
758
|
+
}] });
|
|
759
|
+
|
|
760
|
+
const ICONS = {
|
|
761
|
+
info: 'info',
|
|
762
|
+
success: 'check_circle',
|
|
763
|
+
warning: 'warning',
|
|
764
|
+
error: 'error',
|
|
765
|
+
};
|
|
766
|
+
class InlineAlertComponent {
|
|
767
|
+
constructor() {
|
|
768
|
+
this.tone = input('info');
|
|
769
|
+
this.dismissible = input(false);
|
|
770
|
+
this.dismissed = output();
|
|
771
|
+
this.iconName = computed(() => ICONS[this.tone()]);
|
|
772
|
+
this.role = computed(() => (this.tone() === 'error' || this.tone() === 'warning' ? 'alert' : 'status'));
|
|
773
|
+
}
|
|
774
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: InlineAlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
775
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: InlineAlertComponent, isStandalone: true, selector: "shared-ent-inline-alert", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismissed: "dismissed" }, host: { properties: { "class": "\"tone-\" + tone()", "attr.role": "role()" } }, ngImport: i0, template: `
|
|
776
|
+
<mat-icon class="icon" aria-hidden="true">{{ iconName() }}</mat-icon>
|
|
777
|
+
<div class="content"><ng-content /></div>
|
|
778
|
+
@if (dismissible()) {
|
|
779
|
+
<button mat-icon-button type="button" aria-label="Закрыть" (click)="dismissed.emit()">
|
|
780
|
+
<mat-icon>close</mat-icon>
|
|
781
|
+
</button>
|
|
782
|
+
}
|
|
783
|
+
`, isInline: true, styles: [":host{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-radius:var(--mat-sys-corner-medium);font:var(--mat-sys-body-medium)}.content{flex:1;min-width:0;align-self:center}:host(.tone-info){background:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}:host(.tone-success){background:var(--app-success-container);color:var(--app-on-success-container)}:host(.tone-warning){background:var(--app-warning-container);color:var(--app-on-warning-container)}:host(.tone-error){background:var(--mat-sys-error-container);color:var(--mat-sys-on-error-container)}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
784
|
+
}
|
|
785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: InlineAlertComponent, decorators: [{
|
|
786
|
+
type: Component,
|
|
787
|
+
args: [{ selector: 'shared-ent-inline-alert', standalone: true, imports: [MatButtonModule, MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
788
|
+
'[class]': '"tone-" + tone()',
|
|
789
|
+
'[attr.role]': 'role()',
|
|
790
|
+
}, template: `
|
|
791
|
+
<mat-icon class="icon" aria-hidden="true">{{ iconName() }}</mat-icon>
|
|
792
|
+
<div class="content"><ng-content /></div>
|
|
793
|
+
@if (dismissible()) {
|
|
794
|
+
<button mat-icon-button type="button" aria-label="Закрыть" (click)="dismissed.emit()">
|
|
795
|
+
<mat-icon>close</mat-icon>
|
|
796
|
+
</button>
|
|
797
|
+
}
|
|
798
|
+
`, styles: [":host{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-radius:var(--mat-sys-corner-medium);font:var(--mat-sys-body-medium)}.content{flex:1;min-width:0;align-self:center}:host(.tone-info){background:var(--mat-sys-secondary-container);color:var(--mat-sys-on-secondary-container)}:host(.tone-success){background:var(--app-success-container);color:var(--app-on-success-container)}:host(.tone-warning){background:var(--app-warning-container);color:var(--app-on-warning-container)}:host(.tone-error){background:var(--mat-sys-error-container);color:var(--mat-sys-on-error-container)}\n"] }]
|
|
799
|
+
}] });
|
|
800
|
+
|
|
801
|
+
class EmptyStateComponent {
|
|
802
|
+
constructor() {
|
|
803
|
+
this.icon = input();
|
|
804
|
+
this.title = input();
|
|
805
|
+
this.text = input();
|
|
806
|
+
}
|
|
807
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
808
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: EmptyStateComponent, isStandalone: true, selector: "shared-ent-empty-state", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
809
|
+
@if (icon()) {
|
|
810
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
811
|
+
}
|
|
812
|
+
@if (title()) {
|
|
813
|
+
<h3 class="title">{{ title() }}</h3>
|
|
814
|
+
}
|
|
815
|
+
@if (text()) {
|
|
816
|
+
<p class="text">{{ text() }}</p>
|
|
817
|
+
}
|
|
818
|
+
<ng-content />
|
|
819
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:column;align-items:center;gap:8px;padding:48px 16px;text-align:center}.icon{width:48px;height:48px;font-size:48px;color:var(--mat-sys-on-surface-variant)}.title{margin:0;font:var(--mat-sys-title-medium);color:var(--mat-sys-on-surface)}.text{margin:0;font:var(--mat-sys-body-medium);color:var(--mat-sys-on-surface-variant)}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
820
|
+
}
|
|
821
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EmptyStateComponent, decorators: [{
|
|
822
|
+
type: Component,
|
|
823
|
+
args: [{ selector: 'shared-ent-empty-state', standalone: true, imports: [MatIconModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
824
|
+
@if (icon()) {
|
|
825
|
+
<mat-icon class="icon" aria-hidden="true">{{ icon() }}</mat-icon>
|
|
826
|
+
}
|
|
827
|
+
@if (title()) {
|
|
828
|
+
<h3 class="title">{{ title() }}</h3>
|
|
829
|
+
}
|
|
830
|
+
@if (text()) {
|
|
831
|
+
<p class="text">{{ text() }}</p>
|
|
832
|
+
}
|
|
833
|
+
<ng-content />
|
|
834
|
+
`, styles: [":host{display:flex;flex-direction:column;align-items:center;gap:8px;padding:48px 16px;text-align:center}.icon{width:48px;height:48px;font-size:48px;color:var(--mat-sys-on-surface-variant)}.title{margin:0;font:var(--mat-sys-title-medium);color:var(--mat-sys-on-surface)}.text{margin:0;font:var(--mat-sys-body-medium);color:var(--mat-sys-on-surface-variant)}\n"] }]
|
|
835
|
+
}] });
|
|
836
|
+
|
|
837
|
+
class ConfirmDialogComponent {
|
|
838
|
+
constructor() {
|
|
839
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
840
|
+
}
|
|
841
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
842
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ConfirmDialogComponent, isStandalone: true, selector: "shared-ent-confirm-dialog", ngImport: i0, template: `
|
|
843
|
+
<h2 mat-dialog-title>{{ data.title }}</h2>
|
|
844
|
+
@if (data.message) {
|
|
845
|
+
<mat-dialog-content>{{ data.message }}</mat-dialog-content>
|
|
846
|
+
}
|
|
847
|
+
<mat-dialog-actions align="end">
|
|
848
|
+
<button mat-button type="button" [mat-dialog-close]="false">{{ data.cancelLabel || 'Отмена' }}</button>
|
|
849
|
+
<button mat-flat-button type="button" [class.app-danger]="data.danger" [mat-dialog-close]="true">
|
|
850
|
+
{{ data.confirmLabel || 'Подтвердить' }}
|
|
851
|
+
</button>
|
|
852
|
+
</mat-dialog-actions>
|
|
853
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
854
|
+
}
|
|
855
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
856
|
+
type: Component,
|
|
857
|
+
args: [{
|
|
858
|
+
selector: 'shared-ent-confirm-dialog',
|
|
859
|
+
standalone: true,
|
|
860
|
+
imports: [MatButtonModule, MatDialogModule],
|
|
861
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
862
|
+
template: `
|
|
863
|
+
<h2 mat-dialog-title>{{ data.title }}</h2>
|
|
864
|
+
@if (data.message) {
|
|
865
|
+
<mat-dialog-content>{{ data.message }}</mat-dialog-content>
|
|
866
|
+
}
|
|
867
|
+
<mat-dialog-actions align="end">
|
|
868
|
+
<button mat-button type="button" [mat-dialog-close]="false">{{ data.cancelLabel || 'Отмена' }}</button>
|
|
869
|
+
<button mat-flat-button type="button" [class.app-danger]="data.danger" [mat-dialog-close]="true">
|
|
870
|
+
{{ data.confirmLabel || 'Подтвердить' }}
|
|
871
|
+
</button>
|
|
872
|
+
</mat-dialog-actions>
|
|
873
|
+
`,
|
|
874
|
+
}]
|
|
875
|
+
}] });
|
|
876
|
+
|
|
877
|
+
// Mirrors sd-api libs/entity-definition.js (server stays the authority; this is instant feedback only).
|
|
878
|
+
const KEY_RE = /^[a-z][a-z0-9-]{2,40}$/;
|
|
879
|
+
const FIELD_KEY_RE = /^[a-z][a-zA-Z0-9]{0,47}$/;
|
|
880
|
+
const GROUP_KEY_RE = /^[a-z][a-zA-Z0-9_-]{0,47}$/;
|
|
881
|
+
const COLUMN_RE = /^[A-Za-z][A-Za-z0-9_]{0,62}$/;
|
|
882
|
+
const SYSTEM_FIELDS = ['id', 'accessGroupId', 'createdAt', 'updatedAt', 'isActive', 'version'];
|
|
883
|
+
const HOOK_NAMES = ['beforeCreate', 'afterCreate', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'];
|
|
884
|
+
const P = {
|
|
885
|
+
db: { name: 'db', description: 'доступ к базе данных (модели Sequelize)' },
|
|
886
|
+
di: { name: 'di', description: 'контейнер сервисов приложения' },
|
|
887
|
+
data: { name: 'data', description: 'данные запроса (поля записи)' },
|
|
888
|
+
user: { name: 'user', description: 'текущий пользователь' },
|
|
889
|
+
req: { name: 'req', description: 'HTTP-запрос' },
|
|
890
|
+
id: { name: 'id', description: 'id записи' },
|
|
891
|
+
savedData: { name: 'savedData', description: 'сохранённая запись' },
|
|
892
|
+
inputData: { name: 'inputData', description: 'исходные данные запроса' },
|
|
893
|
+
transaction: { name: 'transaction', description: 'транзакция БД' }
|
|
894
|
+
};
|
|
895
|
+
const BEFORE_SAVE_RETURNS = 'Верните данные записи (data). Пустой результат оставляет входные данные без изменений. Исключение прерывает сохранение.';
|
|
896
|
+
const AFTER_RETURNS = 'Результат не используется. Исключение прерывает операцию.';
|
|
897
|
+
/** Parameters mirror sd-api libs/entity-codegen.js HOOK_PARAMS (same order); keep both in sync. */
|
|
898
|
+
const HOOK_META = {
|
|
899
|
+
beforeCreate: {
|
|
900
|
+
title: 'Перед созданием записи',
|
|
901
|
+
params: [P['db'], P['di'], P['data'], P['user'], P['req']],
|
|
902
|
+
returns: BEFORE_SAVE_RETURNS,
|
|
903
|
+
template: '// Перед созданием записи. Измените data при необходимости.\nreturn data;'
|
|
904
|
+
},
|
|
905
|
+
afterCreate: {
|
|
906
|
+
title: 'После создания записи',
|
|
907
|
+
params: [P['di'], P['db'], P['id'], P['savedData'], P['inputData'], P['user']],
|
|
908
|
+
returns: AFTER_RETURNS,
|
|
909
|
+
template: '// После создания записи: id, savedData, inputData.\n'
|
|
910
|
+
},
|
|
911
|
+
beforeUpdate: {
|
|
912
|
+
title: 'Перед изменением записи',
|
|
913
|
+
params: [P['db'], P['di'], P['data'], P['user'], P['req']],
|
|
914
|
+
returns: BEFORE_SAVE_RETURNS,
|
|
915
|
+
template: '// Перед изменением записи. Измените data при необходимости.\nreturn data;'
|
|
916
|
+
},
|
|
917
|
+
afterUpdate: {
|
|
918
|
+
title: 'После изменения записи',
|
|
919
|
+
params: [P['di'], P['db'], P['id'], P['savedData'], P['inputData']],
|
|
920
|
+
returns: AFTER_RETURNS,
|
|
921
|
+
template: '// После изменения записи: id, savedData, inputData.\n'
|
|
922
|
+
},
|
|
923
|
+
beforeDelete: {
|
|
924
|
+
title: 'Перед удалением записи',
|
|
925
|
+
params: [P['di'], P['db'], P['id'], P['user'], P['req']],
|
|
926
|
+
returns: AFTER_RETURNS,
|
|
927
|
+
template: '// Перед удалением записи с id. Выбросите исключение, чтобы запретить удаление.\n'
|
|
928
|
+
},
|
|
929
|
+
afterDelete: {
|
|
930
|
+
title: 'После удаления записи',
|
|
931
|
+
params: [P['di'], P['db'], P['id'], P['transaction']],
|
|
932
|
+
returns: AFTER_RETURNS,
|
|
933
|
+
template: '// После удаления записи с id.\n'
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
/** Field-level code. Parameters mirror sd-api libs/entity-codegen.js CALCULATED_PARAMS / VALIDATOR_PARAMS. */
|
|
937
|
+
const FIELD_CODE_META = {
|
|
938
|
+
calculated: {
|
|
939
|
+
title: 'Вычисляемое поле',
|
|
940
|
+
params: [
|
|
941
|
+
P['user'], P['di'], P['db'],
|
|
942
|
+
{ name: 'field', description: 'описание этого поля' },
|
|
943
|
+
{ name: 'listIds', description: 'id записей текущей выборки' },
|
|
944
|
+
{ name: 'itemsData', description: 'записи текущей выборки' },
|
|
945
|
+
{ name: 'languageId', description: 'id языка запроса' }
|
|
946
|
+
],
|
|
947
|
+
returns: 'Функция вызывается один раз для всей выборки, а не для каждой записи. Верните массив объектов { entityId: <id записи>, … }: объекты с совпадающим entityId попадают в значение поля этой записи. В базе поле не хранится.',
|
|
948
|
+
template: '// Вызывается один раз для выборки: listIds — id записей, itemsData — сами записи.\n// Верните массив { entityId: <id записи>, ... } — он станет значением поля записи.\nreturn (itemsData || []).map((item) => ({ entityId: item.id }));'
|
|
949
|
+
},
|
|
950
|
+
validators: {
|
|
951
|
+
title: 'Валидатор поля',
|
|
952
|
+
params: [{ name: 'value', description: 'проверяемое значение поля' }],
|
|
953
|
+
returns: 'Результат не используется. Выбросите ошибку (throw new Error(\'сообщение\')), чтобы отклонить значение; без исключения значение принято.',
|
|
954
|
+
template: '// value — проверяемое значение поля. Выбросите ошибку, чтобы отклонить его.\nif (value === undefined || value === null) return;\n'
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
function codeMetaOf(s) {
|
|
958
|
+
if (s.kind === 'hooks')
|
|
959
|
+
return HOOK_META[s.name] || null;
|
|
960
|
+
return FIELD_CODE_META[s.kind] || null;
|
|
961
|
+
}
|
|
962
|
+
/** Function header shown above the editor: `async function name(params) {`. */
|
|
963
|
+
function snippetSignature(s) {
|
|
964
|
+
const m = codeMetaOf(s);
|
|
965
|
+
if (!m)
|
|
966
|
+
return '';
|
|
967
|
+
const name = s.kind === 'hooks' ? ` ${s.name}` : '';
|
|
968
|
+
return `async function${name}(${m.params.map((p) => p.name).join(', ')}) {`;
|
|
969
|
+
}
|
|
970
|
+
/** `async function beforeCreate(db, di, data, user, req) {` header shown above the editor. */
|
|
971
|
+
function hookSignature(name) {
|
|
972
|
+
const m = HOOK_META[name];
|
|
973
|
+
return m ? `async function ${name}(${m.params.map((p) => p.name).join(', ')}) {` : '';
|
|
974
|
+
}
|
|
975
|
+
const MAX_FIELDS = 100;
|
|
976
|
+
const MAX_GROUPS = 20;
|
|
977
|
+
const FIELD_TYPES = [
|
|
978
|
+
{ value: 'string', label: 'Строка' },
|
|
979
|
+
{ value: 'text', label: 'Текст' },
|
|
980
|
+
{ value: 'integer', label: 'Целое число' },
|
|
981
|
+
{ value: 'boolean', label: 'Да / нет' },
|
|
982
|
+
{ value: 'date', label: 'Дата' },
|
|
983
|
+
{ value: 'json', label: 'JSON' },
|
|
984
|
+
{ value: 'select-one', label: 'Связь (один)' },
|
|
985
|
+
{ value: 'select-many', label: 'Связь (несколько)' },
|
|
986
|
+
{ value: 'string-list', label: 'Список строк' }
|
|
987
|
+
];
|
|
988
|
+
const SHOW_IF_OPS = [
|
|
989
|
+
{ value: 'equals', label: 'равно' },
|
|
990
|
+
{ value: 'in', label: 'одно из' }
|
|
991
|
+
];
|
|
992
|
+
function fieldTypeLabel(type) {
|
|
993
|
+
return FIELD_TYPES.find((t) => t.value === type)?.label ?? type;
|
|
994
|
+
}
|
|
995
|
+
const isRelationType = (type) => type === 'select-one' || type === 'select-many';
|
|
996
|
+
/** Physical table name preview (server computes the real one). */
|
|
997
|
+
function tableNamePreview(key) {
|
|
998
|
+
if (!KEY_RE.test(key || ''))
|
|
999
|
+
return '';
|
|
1000
|
+
return 'Ent_' + key.split(/[-_]+/).filter(Boolean).map((p) => p[0].toUpperCase() + p.slice(1)).join('');
|
|
1001
|
+
}
|
|
1002
|
+
let uidSeq = 0;
|
|
1003
|
+
const nextUid = () => `f${++uidSeq}`;
|
|
1004
|
+
function emptyCode(lang = 'js') {
|
|
1005
|
+
return { lang, calculated: {}, validators: {}, hooks: {} };
|
|
1006
|
+
}
|
|
1007
|
+
function emptyField(position = 0) {
|
|
1008
|
+
return { uid: nextUid(), key: '', title: '', type: 'string', required: false, unique: false, options: {}, position };
|
|
1009
|
+
}
|
|
1010
|
+
function emptyDraft() {
|
|
1011
|
+
return { id: null, key: '', title: '', version: null, isActive: true, groups: [], fields: [emptyField(0)], code: emptyCode(), options: {} };
|
|
1012
|
+
}
|
|
1013
|
+
/** Definition from the API -> editable draft (deep copy). */
|
|
1014
|
+
function draftFromEntity(e) {
|
|
1015
|
+
const fields = [...(e.fields || [])]
|
|
1016
|
+
.map((f, i) => ({ f, i, pos: Number.isFinite(f.position) ? f.position : Number.isFinite(f.order) ? f.order : i }))
|
|
1017
|
+
.sort((a, b) => a.pos - b.pos || a.i - b.i)
|
|
1018
|
+
// the details form binds to `options.*`, so a stored field without options still needs the object
|
|
1019
|
+
.map(({ f }, idx) => ({ ...JSON.parse(JSON.stringify(f)), options: JSON.parse(JSON.stringify(f.options || {})), uid: nextUid(), position: idx }));
|
|
1020
|
+
const groups = [...(e.groups || [])].sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map((g, i) => ({ key: g.key, title: g.title, order: i }));
|
|
1021
|
+
const c = e.code || {};
|
|
1022
|
+
return {
|
|
1023
|
+
id: e.id,
|
|
1024
|
+
key: e.key,
|
|
1025
|
+
title: e.title,
|
|
1026
|
+
version: e.version,
|
|
1027
|
+
isActive: e.isActive !== false,
|
|
1028
|
+
groups,
|
|
1029
|
+
fields,
|
|
1030
|
+
code: {
|
|
1031
|
+
lang: c.lang === 'ts' ? 'ts' : 'js',
|
|
1032
|
+
calculated: { ...(c.calculated || {}) },
|
|
1033
|
+
validators: { ...(c.validators || {}) },
|
|
1034
|
+
hooks: { ...(c.hooks || {}) }
|
|
1035
|
+
},
|
|
1036
|
+
options: JSON.parse(JSON.stringify(e.options || {}))
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function cleanOptions(o, type) {
|
|
1040
|
+
const out = {};
|
|
1041
|
+
if (!o)
|
|
1042
|
+
return out;
|
|
1043
|
+
['hidden', 'notEditable', 'searchable', 'listColumn'].forEach((k) => { if (o[k])
|
|
1044
|
+
out[k] = true; });
|
|
1045
|
+
if (o.rich && type === 'text')
|
|
1046
|
+
out.rich = true;
|
|
1047
|
+
if (o.datetime && type === 'date')
|
|
1048
|
+
out.datetime = true;
|
|
1049
|
+
if (o.hint)
|
|
1050
|
+
out.hint = String(o.hint);
|
|
1051
|
+
if (o.placeholder)
|
|
1052
|
+
out.placeholder = String(o.placeholder);
|
|
1053
|
+
if (o.col)
|
|
1054
|
+
out.col = Number(o.col);
|
|
1055
|
+
if (type === 'string-list' && o.separator)
|
|
1056
|
+
out.separator = String(o.separator);
|
|
1057
|
+
const text = (k) => { if (typeof o[k] === 'string' && o[k].trim())
|
|
1058
|
+
out[k] = o[k].trim(); };
|
|
1059
|
+
text('description');
|
|
1060
|
+
text('example');
|
|
1061
|
+
['colSm', 'colMd', 'colLg', 'colXl', 'colXxl'].forEach((k) => { if (o[k])
|
|
1062
|
+
out[k] = Number(o[k]); });
|
|
1063
|
+
if (o.isSortable)
|
|
1064
|
+
out.isSortable = true;
|
|
1065
|
+
if (type === 'string' || type === 'text') {
|
|
1066
|
+
if (o.minLength)
|
|
1067
|
+
out.minLength = Number(o.minLength);
|
|
1068
|
+
if (typeof o.pattern === 'string' && o.pattern) {
|
|
1069
|
+
out.pattern = o.pattern;
|
|
1070
|
+
text('patternMessage');
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
if (Array.isArray(o.asyncValidators) && o.asyncValidators.length && ['string', 'text', 'integer'].includes(type)) {
|
|
1074
|
+
out.asyncValidators = o.asyncValidators.filter((v) => ASYNC_VALIDATOR_OPTIONS.some((a) => a.value === v));
|
|
1075
|
+
}
|
|
1076
|
+
if (type === 'boolean') {
|
|
1077
|
+
if (o.mustBeTrue)
|
|
1078
|
+
out.mustBeTrue = true;
|
|
1079
|
+
text('trueTitle');
|
|
1080
|
+
text('falseTitle');
|
|
1081
|
+
}
|
|
1082
|
+
if (isRelationType(type)) {
|
|
1083
|
+
['selectShowAllOptions', 'innerSearch'].forEach((k) => { if (o[k])
|
|
1084
|
+
out[k] = true; });
|
|
1085
|
+
if (o.lazyLoading) {
|
|
1086
|
+
out.lazyLoading = true;
|
|
1087
|
+
if (o.minSearchLength)
|
|
1088
|
+
out.minSearchLength = Number(o.minSearchLength);
|
|
1089
|
+
}
|
|
1090
|
+
const fo = (o.filterOptions || []).filter((x) => x && (x.field || '').trim() && x.value !== undefined && x.value !== '');
|
|
1091
|
+
if (fo.length)
|
|
1092
|
+
out.filterOptions = fo.map((x) => ({ field: x.field.trim(), value: x.value }));
|
|
1093
|
+
}
|
|
1094
|
+
return out;
|
|
1095
|
+
}
|
|
1096
|
+
/** Form-engine validators a field can have (names of ValidatorsType / AsyncValidators); `custom` is code and lives in "Валидатор" (code editor). */
|
|
1097
|
+
const SYNC_VALIDATOR_OPTIONS = [
|
|
1098
|
+
{ value: 'required', title: 'Обязательное значение', types: ['string', 'text', 'integer', 'date', 'json', 'string-list', 'select-one', 'select-many'] },
|
|
1099
|
+
{ value: 'requiredTrue', title: 'Должно быть включено', types: ['boolean'] },
|
|
1100
|
+
{ value: 'minLength', title: 'Минимальная длина', types: ['string', 'text'] },
|
|
1101
|
+
{ value: 'pattern', title: 'Шаблон (регулярное выражение)', types: ['string', 'text'] },
|
|
1102
|
+
];
|
|
1103
|
+
const ASYNC_VALIDATOR_OPTIONS = [
|
|
1104
|
+
{ value: 'item-uniq-value', title: 'Уникальное значение (проверка на сервере)' },
|
|
1105
|
+
{ value: 'item-value-exists', title: 'Значение должно существовать (проверка на сервере)' },
|
|
1106
|
+
];
|
|
1107
|
+
const prune = (v) => {
|
|
1108
|
+
if (Array.isArray(v)) {
|
|
1109
|
+
const a = v.map(prune).filter((x) => x !== undefined);
|
|
1110
|
+
return a.length ? a : undefined;
|
|
1111
|
+
}
|
|
1112
|
+
if (v && typeof v === 'object') {
|
|
1113
|
+
const o = {};
|
|
1114
|
+
Object.keys(v).forEach((k) => { const x = prune(v[k]); if (x !== undefined)
|
|
1115
|
+
o[k] = x; });
|
|
1116
|
+
return Object.keys(o).length ? o : undefined;
|
|
1117
|
+
}
|
|
1118
|
+
if (typeof v === 'string')
|
|
1119
|
+
return v.trim() === '' ? undefined : v.trim();
|
|
1120
|
+
return v === null ? undefined : v;
|
|
1121
|
+
};
|
|
1122
|
+
/** Section settings -> payload: only known keys, empty values dropped, booleans that equal the default (off) dropped. */
|
|
1123
|
+
function cleanSectionOptions(o) {
|
|
1124
|
+
const s = o || {};
|
|
1125
|
+
const out = {};
|
|
1126
|
+
// default ON in the app: an explicit false is a setting
|
|
1127
|
+
['boards', 'showpresets'].forEach((k) => { if (typeof s[k] === 'boolean')
|
|
1128
|
+
out[k] = s[k]; });
|
|
1129
|
+
// auto (derived from the fields): both values are settings
|
|
1130
|
+
if (typeof s.search === 'boolean')
|
|
1131
|
+
out.search = s.search;
|
|
1132
|
+
['showSettings', 'allItems'].forEach((k) => { if (s[k] === true)
|
|
1133
|
+
out[k] = true; });
|
|
1134
|
+
['kanbanColumnField', 'kanbanField', 'orderByField', 'filteringType'].forEach((k) => { if (typeof s[k] === 'string' && s[k])
|
|
1135
|
+
out[k] = s[k]; });
|
|
1136
|
+
const ff = (s.filtering?.fields || []).filter((x) => x && x.field).map((x) => ({ field: x.field, title: x.title, type: x.type }));
|
|
1137
|
+
if (ff.length)
|
|
1138
|
+
out.filtering = { fields: ff };
|
|
1139
|
+
out.texts = s.texts && {
|
|
1140
|
+
list: s.texts.list && { topText: s.texts.list.topText, bottomText: s.texts.list.bottomText },
|
|
1141
|
+
details: s.texts.details && { topText: s.texts.details.topText, bottomText: s.texts.details.bottomText }
|
|
1142
|
+
};
|
|
1143
|
+
const lm = s.viewSettings?.listMode || {};
|
|
1144
|
+
const vm = s.viewSettings?.viewMode || {};
|
|
1145
|
+
const flag = (v) => (v === true ? true : undefined);
|
|
1146
|
+
const cols = (v) => (v ? Number(v) : undefined);
|
|
1147
|
+
out.viewSettings = {
|
|
1148
|
+
listMode: {
|
|
1149
|
+
hideAddAction: flag(lm.hideAddAction), hideEditAction: flag(lm.hideEditAction), hideDeleteAction: flag(lm.hideDeleteAction), hideViewAction: flag(lm.hideViewAction),
|
|
1150
|
+
mainBlockCols: cols(lm.mainBlockCols), filterBlockCols: cols(lm.filterBlockCols), menuBlockCols: cols(lm.menuBlockCols)
|
|
1151
|
+
},
|
|
1152
|
+
viewMode: { mainBlockCols: cols(vm.mainBlockCols), menuBlockCols: cols(vm.menuBlockCols) }
|
|
1153
|
+
};
|
|
1154
|
+
const a = s.actions || {};
|
|
1155
|
+
out.actions = { isNoViewAction: flag(a.isNoViewAction), isNoDeleteAction: flag(a.isNoDeleteAction), isNoEditAction: flag(a.isNoEditAction), defaultListAction: a.defaultListAction || undefined };
|
|
1156
|
+
const res = prune(out) || {};
|
|
1157
|
+
// an explicit empty list is a setting too ("preload nothing"), so it is kept
|
|
1158
|
+
if (Array.isArray(s.preLoadSections))
|
|
1159
|
+
res.preLoadSections = s.preLoadSections.map((x) => String(x ?? '').trim()).filter(Boolean);
|
|
1160
|
+
return res;
|
|
1161
|
+
}
|
|
1162
|
+
/** Draft -> request body (definition JSON per the Story data contract). */
|
|
1163
|
+
function buildPayload(d) {
|
|
1164
|
+
const fields = d.fields.map((f, i) => {
|
|
1165
|
+
const out = { key: f.key.trim(), title: (f.title || '').trim(), type: f.type, position: i };
|
|
1166
|
+
if (f.required)
|
|
1167
|
+
out.required = true;
|
|
1168
|
+
if (f.unique)
|
|
1169
|
+
out.unique = true;
|
|
1170
|
+
if (f.default !== undefined && f.default !== null && f.default !== '')
|
|
1171
|
+
out.default = f.default;
|
|
1172
|
+
const options = cleanOptions(f.options, f.type);
|
|
1173
|
+
if (Object.keys(options).length)
|
|
1174
|
+
out.options = options;
|
|
1175
|
+
if (f.group)
|
|
1176
|
+
out.group = f.group;
|
|
1177
|
+
// DB column: only when it differs from the key (the server defaults it to the key); never dropped on edit.
|
|
1178
|
+
const column = (f.column || '').trim();
|
|
1179
|
+
if (column && column !== out.key)
|
|
1180
|
+
out.column = column;
|
|
1181
|
+
// Not editable in the form but kept as stored: the server owns/uses them (dependsOn is a showIf alias, rules are reserved).
|
|
1182
|
+
if (f.dependsOn)
|
|
1183
|
+
out.dependsOn = f.dependsOn;
|
|
1184
|
+
if (f.rules && f.rules.length)
|
|
1185
|
+
out.rules = f.rules;
|
|
1186
|
+
if (isRelationType(f.type) && f.relation) {
|
|
1187
|
+
const r = f.relation;
|
|
1188
|
+
out.relation = { type: f.type === 'select-one' ? 'one' : 'many', target: r.target, targetSource: r.targetSource };
|
|
1189
|
+
if (r.displayField)
|
|
1190
|
+
out.relation.displayField = r.displayField;
|
|
1191
|
+
if (r.activeOnly)
|
|
1192
|
+
out.relation.activeOnly = true;
|
|
1193
|
+
if (r.filter && r.filter.field && r.filter.byField)
|
|
1194
|
+
out.relation.filter = { field: r.filter.field, byField: r.filter.byField };
|
|
1195
|
+
if (!out.relation.targetSource)
|
|
1196
|
+
delete out.relation.targetSource;
|
|
1197
|
+
}
|
|
1198
|
+
if (f.showIf && f.showIf.field) {
|
|
1199
|
+
out.showIf = { field: f.showIf.field, op: f.showIf.op || 'equals', value: f.showIf.value };
|
|
1200
|
+
}
|
|
1201
|
+
return out;
|
|
1202
|
+
});
|
|
1203
|
+
const code = { lang: d.code.lang };
|
|
1204
|
+
['calculated', 'validators', 'hooks'].forEach((k) => {
|
|
1205
|
+
const entries = Object.entries(d.code[k] || {}).filter(([, v]) => (v || '').trim() !== '');
|
|
1206
|
+
code[k] = Object.fromEntries(entries);
|
|
1207
|
+
});
|
|
1208
|
+
const body = {
|
|
1209
|
+
key: d.key.trim(),
|
|
1210
|
+
title: d.title.trim(),
|
|
1211
|
+
storageMode: 'physical',
|
|
1212
|
+
groups: d.groups.map((g, i) => ({ key: g.key, title: g.title.trim(), order: i })),
|
|
1213
|
+
fields,
|
|
1214
|
+
code,
|
|
1215
|
+
options: cleanSectionOptions(d.options)
|
|
1216
|
+
};
|
|
1217
|
+
if (d.id)
|
|
1218
|
+
body.version = d.version;
|
|
1219
|
+
return body;
|
|
1220
|
+
}
|
|
1221
|
+
/** Section settings checks (field references must exist, block widths 1..12). Keys are `options.*` like the server paths. */
|
|
1222
|
+
function validateSectionOptionsDraft(d) {
|
|
1223
|
+
const e = {};
|
|
1224
|
+
const o = d.options || {};
|
|
1225
|
+
(o.preLoadSections || []).forEach((x, j) => {
|
|
1226
|
+
if ((x || '').trim() && !/^[A-Za-z0-9_-]+(\([^()]*\))?$/.test((x || '').trim()))
|
|
1227
|
+
e[`options.preLoadSections[${j}]`] = 'Формат: раздел или раздел(paging:{perPage:-1}).';
|
|
1228
|
+
});
|
|
1229
|
+
const keys = new Set(d.fields.map((f) => f.key));
|
|
1230
|
+
[['kanbanColumnField', 'Колонка доски'], ['kanbanField', 'Поле карточки'], ['orderByField', 'Сортировка']].forEach(([k, label]) => {
|
|
1231
|
+
if (o[k] && !keys.has(o[k]))
|
|
1232
|
+
e[`options.${k}`] = `${label}: поле не найдено.`;
|
|
1233
|
+
});
|
|
1234
|
+
(o.filtering?.fields || []).forEach((x, i) => {
|
|
1235
|
+
if (x && x.field && !keys.has(x.field) && !['id', 'isActive', 'createdAt', 'updatedAt'].includes(x.field))
|
|
1236
|
+
e[`options.filtering.fields[${i}].field`] = 'Фильтр: поле не найдено.';
|
|
1237
|
+
});
|
|
1238
|
+
const cols = [
|
|
1239
|
+
['viewSettings.listMode.mainBlockCols', o.viewSettings?.listMode?.mainBlockCols], ['viewSettings.listMode.filterBlockCols', o.viewSettings?.listMode?.filterBlockCols],
|
|
1240
|
+
['viewSettings.listMode.menuBlockCols', o.viewSettings?.listMode?.menuBlockCols], ['viewSettings.viewMode.mainBlockCols', o.viewSettings?.viewMode?.mainBlockCols],
|
|
1241
|
+
['viewSettings.viewMode.menuBlockCols', o.viewSettings?.viewMode?.menuBlockCols]
|
|
1242
|
+
];
|
|
1243
|
+
cols.forEach(([path, v]) => {
|
|
1244
|
+
if (v !== undefined && v !== null && v !== '' && !(Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= 12))
|
|
1245
|
+
e[`options.${path}`] = 'Ширина блока: целое число от 1 до 12.';
|
|
1246
|
+
});
|
|
1247
|
+
['list', 'details'].forEach((page) => ['topText', 'bottomText'].forEach((k) => {
|
|
1248
|
+
const t = o.texts?.[page]?.[k];
|
|
1249
|
+
if (typeof t === 'string' && t.length > 2000)
|
|
1250
|
+
e[`options.texts.${page}.${k}`] = 'Текст: не более 2000 символов.';
|
|
1251
|
+
}));
|
|
1252
|
+
return e;
|
|
1253
|
+
}
|
|
1254
|
+
/** Instant client-side checks. Returns RU messages keyed by path-like id. */
|
|
1255
|
+
function validateDraft(d, isNew) {
|
|
1256
|
+
const e = {};
|
|
1257
|
+
if (isNew && !KEY_RE.test(d.key || ''))
|
|
1258
|
+
e['key'] = 'Ключ: латиница в нижнем регистре, цифры и дефис, 3–41 символ, начинается с буквы.';
|
|
1259
|
+
if (!(d.title || '').trim())
|
|
1260
|
+
e['title'] = 'Укажите название.';
|
|
1261
|
+
if (!d.fields.length)
|
|
1262
|
+
e['fields'] = 'Добавьте хотя бы одно поле.';
|
|
1263
|
+
if (d.fields.length > MAX_FIELDS)
|
|
1264
|
+
e['fields'] = `Не более ${MAX_FIELDS} полей.`;
|
|
1265
|
+
const gkeys = new Set();
|
|
1266
|
+
d.groups.forEach((g, i) => {
|
|
1267
|
+
if (!GROUP_KEY_RE.test(g.key || ''))
|
|
1268
|
+
e[`groups[${i}].key`] = 'Ключ группы: латиница, цифры, _ и -, начинается с буквы.';
|
|
1269
|
+
else if (gkeys.has(g.key))
|
|
1270
|
+
e[`groups[${i}].key`] = 'Ключ группы повторяется.';
|
|
1271
|
+
gkeys.add(g.key);
|
|
1272
|
+
if (!(g.title || '').trim())
|
|
1273
|
+
e[`groups[${i}].title`] = 'Укажите название группы.';
|
|
1274
|
+
});
|
|
1275
|
+
const seen = new Set();
|
|
1276
|
+
d.fields.forEach((f, i) => {
|
|
1277
|
+
const p = `fields[${i}]`;
|
|
1278
|
+
if (!FIELD_KEY_RE.test(f.key || ''))
|
|
1279
|
+
e[`${p}.key`] = 'Ключ поля: латиница и цифры (camelCase), начинается с буквы.';
|
|
1280
|
+
else if (SYSTEM_FIELDS.includes(f.key))
|
|
1281
|
+
e[`${p}.key`] = 'Это системное поле.';
|
|
1282
|
+
else if (seen.has(f.key))
|
|
1283
|
+
e[`${p}.key`] = 'Ключ поля повторяется.';
|
|
1284
|
+
seen.add(f.key);
|
|
1285
|
+
if (!(f.title || '').trim())
|
|
1286
|
+
e[`${p}.title`] = 'Укажите название поля.';
|
|
1287
|
+
if (f.unique && ['json', 'select-many', 'string-list'].includes(f.type))
|
|
1288
|
+
e[`${p}.unique`] = 'Уникальность недоступна для этого типа.';
|
|
1289
|
+
if (f.group && !gkeys.has(f.group))
|
|
1290
|
+
e[`${p}.group`] = 'Группа не найдена.';
|
|
1291
|
+
const column = (f.column || '').trim();
|
|
1292
|
+
if (column) {
|
|
1293
|
+
if (!COLUMN_RE.test(column))
|
|
1294
|
+
e[`${p}.column`] = 'Колонка: латиница, цифры и _, начинается с буквы, до 63 символов.';
|
|
1295
|
+
else if (SYSTEM_FIELDS.some((s) => s.toLowerCase() === column.toLowerCase()))
|
|
1296
|
+
e[`${p}.column`] = 'Это системная колонка.';
|
|
1297
|
+
}
|
|
1298
|
+
['col', 'colSm', 'colMd', 'colLg', 'colXl', 'colXxl'].forEach((k) => {
|
|
1299
|
+
const v = f.options?.[k];
|
|
1300
|
+
if (v !== undefined && v !== null && v !== '' && !(Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= 12))
|
|
1301
|
+
e[`${p}.options.${k}`] = 'Ширина: целое число от 1 до 12.';
|
|
1302
|
+
});
|
|
1303
|
+
const fo = (f.options || {});
|
|
1304
|
+
if (fo.minLength !== undefined && fo.minLength !== null && fo.minLength !== '' && !(Number.isInteger(Number(fo.minLength)) && Number(fo.minLength) >= 1 && Number(fo.minLength) <= 1000))
|
|
1305
|
+
e[`${p}.options.minLength`] = 'Минимальная длина: целое число от 1 до 1000.';
|
|
1306
|
+
if (typeof fo.pattern === 'string' && fo.pattern) {
|
|
1307
|
+
if (fo.pattern.length > 200)
|
|
1308
|
+
e[`${p}.options.pattern`] = 'Шаблон: не более 200 символов.';
|
|
1309
|
+
else {
|
|
1310
|
+
try {
|
|
1311
|
+
new RegExp(fo.pattern);
|
|
1312
|
+
}
|
|
1313
|
+
catch {
|
|
1314
|
+
e[`${p}.options.pattern`] = 'Шаблон не является корректным регулярным выражением.';
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (fo.pattern === '')
|
|
1319
|
+
e[`${p}.options.pattern`] = 'Шаблон выбран как валидатор: укажите регулярное выражение или снимите валидатор.';
|
|
1320
|
+
if ((fo.asyncValidators || []).length > 1)
|
|
1321
|
+
e[`${p}.options.asyncValidators`] = 'Нельзя выбрать оба асинхронных валидатора: у них общая настройка.';
|
|
1322
|
+
if (fo.minSearchLength !== undefined && fo.minSearchLength !== null && fo.minSearchLength !== '' && !(Number.isInteger(Number(fo.minSearchLength)) && Number(fo.minSearchLength) >= 1 && Number(fo.minSearchLength) <= 10))
|
|
1323
|
+
e[`${p}.options.minSearchLength`] = 'Минимум символов для поиска: от 1 до 10.';
|
|
1324
|
+
(fo.filterOptions || []).forEach((x, j) => {
|
|
1325
|
+
if (x && ((x.field || x.value !== undefined && x.value !== '')) && !COLUMN_RE.test((x.field || '').trim()))
|
|
1326
|
+
e[`${p}.options.filterOptions[${j}]`] = 'Фильтр списка: укажите корректное имя поля цели.';
|
|
1327
|
+
});
|
|
1328
|
+
if (f.key && hasFieldCode(d, 'calculated', f.key) && !(d.code.calculated[f.key] || '').trim())
|
|
1329
|
+
e[`${p}.code`] = 'Укажите код вычисляемого поля.';
|
|
1330
|
+
else if (f.key && hasFieldCode(d, 'validators', f.key) && !(d.code.validators[f.key] || '').trim())
|
|
1331
|
+
e[`${p}.code`] = 'Укажите код валидатора или снимите отметку.';
|
|
1332
|
+
if (isRelationType(f.type) && !(f.relation && f.relation.target))
|
|
1333
|
+
e[`${p}.relation.target`] = 'Выберите целевую сущность.';
|
|
1334
|
+
if (f.showIf && f.showIf.field) {
|
|
1335
|
+
if (f.showIf.field === f.key)
|
|
1336
|
+
e[`${p}.showIf`] = 'Поле не может зависеть от себя.';
|
|
1337
|
+
else if (!d.fields.some((o) => o.key === f.showIf.field))
|
|
1338
|
+
e[`${p}.showIf`] = 'Поле условия не найдено.';
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
Object.assign(e, validateSectionOptionsDraft(d));
|
|
1342
|
+
const columns = new Map();
|
|
1343
|
+
d.fields.forEach((f, i) => {
|
|
1344
|
+
if (hasFieldCode(d, 'calculated', f.key))
|
|
1345
|
+
return; // calculated fields own no column
|
|
1346
|
+
const eff = ((f.column || '').trim() || f.key || '').toLowerCase();
|
|
1347
|
+
if (!eff)
|
|
1348
|
+
return;
|
|
1349
|
+
if (columns.has(eff) && !e[`fields[${i}].column`])
|
|
1350
|
+
e[`fields[${i}].column`] = 'Колонка уже используется другим полем.';
|
|
1351
|
+
else
|
|
1352
|
+
columns.set(eff, i);
|
|
1353
|
+
});
|
|
1354
|
+
return e;
|
|
1355
|
+
}
|
|
1356
|
+
function moveItem(list, from, to) {
|
|
1357
|
+
if (from === to || from < 0 || to < 0 || from >= list.length || to >= list.length)
|
|
1358
|
+
return list;
|
|
1359
|
+
const copy = [...list];
|
|
1360
|
+
const [it] = copy.splice(from, 1);
|
|
1361
|
+
copy.splice(to, 0, it);
|
|
1362
|
+
return copy;
|
|
1363
|
+
}
|
|
1364
|
+
/** Remove references to a deleted/renamed group from fields. */
|
|
1365
|
+
function dropGroup(d, groupKey) {
|
|
1366
|
+
d.groups = d.groups.filter((g) => g.key !== groupKey);
|
|
1367
|
+
d.fields.forEach((f) => { if (f.group === groupKey)
|
|
1368
|
+
f.group = undefined; });
|
|
1369
|
+
}
|
|
1370
|
+
/** Field-level code (calculated value / validator) is stored under the field key. */
|
|
1371
|
+
function hasFieldCode(d, kind, key) {
|
|
1372
|
+
return !!key && Object.prototype.hasOwnProperty.call(d.code[kind] || {}, key);
|
|
1373
|
+
}
|
|
1374
|
+
/** Field key renamed: its calculated/validator code follows the field (unless the new key already has code). */
|
|
1375
|
+
function renameFieldCode(d, from, to) {
|
|
1376
|
+
const moved = [];
|
|
1377
|
+
if (!from || !to || from === to)
|
|
1378
|
+
return moved;
|
|
1379
|
+
['calculated', 'validators'].forEach((kind) => {
|
|
1380
|
+
if (!hasFieldCode(d, kind, from) || hasFieldCode(d, kind, to))
|
|
1381
|
+
return;
|
|
1382
|
+
const copy = { ...d.code[kind] };
|
|
1383
|
+
copy[to] = copy[from];
|
|
1384
|
+
delete copy[from];
|
|
1385
|
+
d.code[kind] = copy;
|
|
1386
|
+
moved.push(kind);
|
|
1387
|
+
});
|
|
1388
|
+
return moved;
|
|
1389
|
+
}
|
|
1390
|
+
/** Field removed: drop its calculated/validator code. */
|
|
1391
|
+
function dropFieldCode(d, key) {
|
|
1392
|
+
['calculated', 'validators'].forEach((kind) => {
|
|
1393
|
+
if (!hasFieldCode(d, kind, key))
|
|
1394
|
+
return;
|
|
1395
|
+
const copy = { ...d.code[kind] };
|
|
1396
|
+
delete copy[key];
|
|
1397
|
+
d.code[kind] = copy;
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
/** Snippet list: all stored snippets (any kind). */
|
|
1401
|
+
function listSnippets(code) {
|
|
1402
|
+
const out = [];
|
|
1403
|
+
['calculated', 'validators', 'hooks'].forEach((kind) => {
|
|
1404
|
+
Object.keys(code[kind] || {}).forEach((name) => out.push({ kind, name }));
|
|
1405
|
+
});
|
|
1406
|
+
return out;
|
|
1407
|
+
}
|
|
1408
|
+
const snippetId = (s) => `${s.kind}.${s.name}`;
|
|
1409
|
+
function snippetLabel(s) {
|
|
1410
|
+
const kinds = { calculated: 'Вычисляемое поле', validators: 'Валидатор', hooks: 'Событие' };
|
|
1411
|
+
return `${kinds[s.kind]}: ${s.name}`;
|
|
1412
|
+
}
|
|
1413
|
+
/** Snippets in `code` that point to a field that no longer exists. */
|
|
1414
|
+
function orphanSnippets(d) {
|
|
1415
|
+
const keys = new Set(d.fields.map((f) => f.key));
|
|
1416
|
+
return listSnippets(d.code).filter((s) => s.kind !== 'hooks' && !keys.has(s.name));
|
|
1417
|
+
}
|
|
1418
|
+
function hasBlockingDiagnostics(diags) {
|
|
1419
|
+
return Object.values(diags).some((l) => (l || []).some((x) => (x.severity || 'error') === 'error'));
|
|
1420
|
+
}
|
|
1421
|
+
function diagnosticText(d) {
|
|
1422
|
+
return `стр. ${d.line}, кол. ${d.column}: ${d.message}`;
|
|
1423
|
+
}
|
|
1424
|
+
function planFromResponse(raw) {
|
|
1425
|
+
const r = raw?.data ?? raw ?? {};
|
|
1426
|
+
// BE: `statements` = sql strings, `details` = [{sql, kind, destructive, field?, column?}] (same order) -> prefer details
|
|
1427
|
+
const list = Array.isArray(r.details) && r.details.length ? r.details : Array.isArray(r.statements) ? r.statements : Array.isArray(r.ddl) ? r.ddl : [];
|
|
1428
|
+
const statements = list.map((s) => (typeof s === 'string' ? { sql: s } : { sql: s.sql, destructive: !!s.destructive, kind: s.kind }));
|
|
1429
|
+
const items = Array.isArray(r.destructiveItems) ? r.destructiveItems : [];
|
|
1430
|
+
return { statements, destructive: !!r.destructive, destructiveItems: items };
|
|
1431
|
+
}
|
|
1432
|
+
/** Response `{data, activation?}` of POST/PUT/DELETE -> entity with the optional activation result. */
|
|
1433
|
+
function savedFromResponse(raw) {
|
|
1434
|
+
const activation = raw?.activation && typeof raw.activation === 'object' ? raw.activation : undefined;
|
|
1435
|
+
return activation ? { ...(raw.data || {}), activation } : raw?.data;
|
|
1436
|
+
}
|
|
1437
|
+
const isActivationFailed = (a) => !!a && a.status === 'failed';
|
|
1438
|
+
const ACTIVATION_FAILED_HINT = 'Определение сохранено, но сущность пока не активна на сервере (генерация или загрузка модели не завершились). Нажмите «Перезагрузить данные» или повторите сохранение; сервер повторит активацию автоматически, ошибка записана в журнале сервера.';
|
|
1439
|
+
function destructiveItemText(it) {
|
|
1440
|
+
if (it.message)
|
|
1441
|
+
return it.message;
|
|
1442
|
+
const what = it.column || it.field || '';
|
|
1443
|
+
const kinds = {
|
|
1444
|
+
'drop-column': 'Удаление колонки',
|
|
1445
|
+
'rename-column': 'Переименование колонки',
|
|
1446
|
+
'alter-type': 'Смена типа колонки',
|
|
1447
|
+
'drop-join-table': 'Удаление связующей таблицы'
|
|
1448
|
+
};
|
|
1449
|
+
return `${kinds[it.kind || ''] || 'Деструктивное изменение'}${what ? ` «${what}»` : ''}`;
|
|
1450
|
+
}
|
|
1451
|
+
function isStatementDestructive(s) {
|
|
1452
|
+
return !!s.destructive || /\bDROP\b/i.test(s.sql || '');
|
|
1453
|
+
}
|
|
1454
|
+
const ERROR_MESSAGES = {
|
|
1455
|
+
'administrator-required': 'Недостаточно прав. Раздел доступен только администраторам.',
|
|
1456
|
+
'entity-not-found': 'Сущность не найдена.',
|
|
1457
|
+
'key-exists': 'Сущность с таким ключом уже существует (ключи уникальны глобально).',
|
|
1458
|
+
'version-conflict': 'Сущность изменена другим пользователем. Перезагрузите данные и повторите правки.',
|
|
1459
|
+
'validation-failed': 'Определение сущности содержит ошибки. Исправьте их и повторите.',
|
|
1460
|
+
'syntax-error': 'В коде есть синтаксические ошибки. Сохранение невозможно.',
|
|
1461
|
+
'destructive-confirm-required': 'Изменения удаляют данные, требуется явное подтверждение.',
|
|
1462
|
+
'ddl-failed': 'Не удалось изменить структуру таблицы. Изменения откачены.',
|
|
1463
|
+
'invalid-version': 'Некорректная версия сущности.',
|
|
1464
|
+
'authentication-required': 'Требуется вход в систему.',
|
|
1465
|
+
forbidden: 'Недостаточно прав.',
|
|
1466
|
+
internal: 'Внутренняя ошибка сервера.'
|
|
1467
|
+
};
|
|
1468
|
+
function entitiesErrorCode(err) {
|
|
1469
|
+
if (err?.status === 403)
|
|
1470
|
+
return 'forbidden';
|
|
1471
|
+
return err?.error?.error?.code || (err?.status === 409 ? 'version-conflict' : 'internal');
|
|
1472
|
+
}
|
|
1473
|
+
function entitiesErrorMessage(err) {
|
|
1474
|
+
const code = entitiesErrorCode(err);
|
|
1475
|
+
return ERROR_MESSAGES[code] || 'Не удалось выполнить операцию.';
|
|
1476
|
+
}
|
|
1477
|
+
const isVersionConflict = (err) => err?.status === 409 && entitiesErrorCode(err) === 'version-conflict';
|
|
1478
|
+
const isForbidden = (err) => err?.status === 403 || entitiesErrorCode(err) === 'administrator-required';
|
|
1479
|
+
function serverValidationErrors(err) {
|
|
1480
|
+
const list = err?.error?.error?.details?.errors;
|
|
1481
|
+
return Array.isArray(list) ? list : [];
|
|
1482
|
+
}
|
|
1483
|
+
function serverDiagnostics(err) {
|
|
1484
|
+
const list = err?.error?.error?.details?.diagnostics;
|
|
1485
|
+
return Array.isArray(list) ? list : [];
|
|
1486
|
+
}
|
|
1487
|
+
function serverDestructiveItems(err) {
|
|
1488
|
+
const list = err?.error?.error?.details?.items;
|
|
1489
|
+
return Array.isArray(list) ? list : [];
|
|
1490
|
+
}
|
|
1491
|
+
/** Map server validation errors by path (`fields[1].key`) for inline display. */
|
|
1492
|
+
function errorsByPath(list) {
|
|
1493
|
+
const out = {};
|
|
1494
|
+
const put = (p, m) => { if (!out[p])
|
|
1495
|
+
out[p] = m; };
|
|
1496
|
+
list.forEach((e) => {
|
|
1497
|
+
const p = e.path || '';
|
|
1498
|
+
const m = e.message || e.code;
|
|
1499
|
+
put(p, m);
|
|
1500
|
+
// server paths are deeper than the form controls: also expose the control-level path
|
|
1501
|
+
const showIf = /^(fields\[\d+\])\.(showIf|dependsOn)\./.exec(p);
|
|
1502
|
+
if (showIf)
|
|
1503
|
+
put(`${showIf[1]}.showIf`, m);
|
|
1504
|
+
const rel = /^(fields\[\d+\]\.relation)\.(?!target$)/.exec(p);
|
|
1505
|
+
if (rel)
|
|
1506
|
+
put(rel[1], m);
|
|
1507
|
+
});
|
|
1508
|
+
return out;
|
|
1509
|
+
}
|
|
1510
|
+
function entityStatusLabel(e) {
|
|
1511
|
+
if (e.source === 'code')
|
|
1512
|
+
return 'Из кода';
|
|
1513
|
+
return e.isActive ? 'Активна' : 'Отключена';
|
|
1514
|
+
}
|
|
1515
|
+
function filterEntities(list, query) {
|
|
1516
|
+
const q = (query || '').trim().toLowerCase();
|
|
1517
|
+
if (!q)
|
|
1518
|
+
return list;
|
|
1519
|
+
return list.filter((e) => (e.title || '').toLowerCase().includes(q) || (e.key || '').toLowerCase().includes(q));
|
|
1520
|
+
}
|
|
1521
|
+
/** Default value editor helpers (text <-> typed value). */
|
|
1522
|
+
function defaultToText(v) {
|
|
1523
|
+
if (v === undefined || v === null)
|
|
1524
|
+
return '';
|
|
1525
|
+
return typeof v === 'object' ? JSON.stringify(v) : String(v);
|
|
1526
|
+
}
|
|
1527
|
+
function parseDefault(type, raw) {
|
|
1528
|
+
const t = (raw ?? '').trim();
|
|
1529
|
+
if (t === '')
|
|
1530
|
+
return undefined;
|
|
1531
|
+
if (type === 'integer') {
|
|
1532
|
+
const n = Number(t);
|
|
1533
|
+
return Number.isInteger(n) ? n : undefined;
|
|
1534
|
+
}
|
|
1535
|
+
if (type === 'boolean')
|
|
1536
|
+
return t === 'true';
|
|
1537
|
+
if (type === 'json') {
|
|
1538
|
+
try {
|
|
1539
|
+
return JSON.parse(t);
|
|
1540
|
+
}
|
|
1541
|
+
catch {
|
|
1542
|
+
return undefined;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
return raw;
|
|
1546
|
+
}
|
|
1547
|
+
function showIfValueText(c) {
|
|
1548
|
+
if (!c || c.value === undefined || c.value === null)
|
|
1549
|
+
return '';
|
|
1550
|
+
return Array.isArray(c.value) ? c.value.join(', ') : String(c.value);
|
|
1551
|
+
}
|
|
1552
|
+
function parseShowIfValue(op, text) {
|
|
1553
|
+
if (op === 'in')
|
|
1554
|
+
return (text || '').split(',').map((s) => s.trim()).filter((s) => s !== '');
|
|
1555
|
+
const t = (text ?? '').trim();
|
|
1556
|
+
if (t === 'true')
|
|
1557
|
+
return true;
|
|
1558
|
+
if (t === 'false')
|
|
1559
|
+
return false;
|
|
1560
|
+
if (t !== '' && /^-?\d+$/.test(t))
|
|
1561
|
+
return Number(t);
|
|
1562
|
+
return text;
|
|
1563
|
+
}
|
|
1564
|
+
/** Hooks not yet used + fields not yet used for the given snippet kind. */
|
|
1565
|
+
function availableSnippetNames(d, kind) {
|
|
1566
|
+
const used = Object.keys(d.code[kind] || {});
|
|
1567
|
+
const all = kind === 'hooks' ? [...HOOK_NAMES] : d.fields.map((f) => f.key).filter((k) => !!k);
|
|
1568
|
+
return all.filter((n) => !used.includes(n));
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
/** The only HTTP layer of the entities settings UI (`/api/settings/entities`, admin only). */
|
|
1572
|
+
class EntitiesSettingsFacade {
|
|
1573
|
+
constructor(http, config) {
|
|
1574
|
+
this.http = http;
|
|
1575
|
+
this.opts = { withCredentials: true };
|
|
1576
|
+
this.baseUrl = `${(config?.apiUrl || '').replace(/\/$/, '')}/api/settings/entities`;
|
|
1577
|
+
}
|
|
1578
|
+
list() {
|
|
1579
|
+
return this.http.get(this.baseUrl, this.opts).pipe(map$1((r) => r.data || []));
|
|
1580
|
+
}
|
|
1581
|
+
/** Dry run: POST /plan (new definition) or POST /:id/plan. Returns DDL statements + destructive flag. */
|
|
1582
|
+
plan(id, body) {
|
|
1583
|
+
const url = id ? `${this.baseUrl}/${id}/plan` : `${this.baseUrl}/plan`;
|
|
1584
|
+
return this.http.post(url, body, this.opts).pipe(map$1((r) => planFromResponse(r)));
|
|
1585
|
+
}
|
|
1586
|
+
/** 201 `{data, activation?}`: `activation.status==='failed'` = saved but not live yet (see savedFromResponse). */
|
|
1587
|
+
create(body, confirmDestructive = false) {
|
|
1588
|
+
return this.http.post(this.baseUrl, { ...body, confirmDestructive }, this.opts).pipe(map$1((r) => savedFromResponse(r)));
|
|
1589
|
+
}
|
|
1590
|
+
update(id, body, confirmDestructive = false) {
|
|
1591
|
+
return this.http.put(`${this.baseUrl}/${id}`, { ...body, confirmDestructive }, this.opts).pipe(map$1((r) => savedFromResponse(r)));
|
|
1592
|
+
}
|
|
1593
|
+
remove(id, version) {
|
|
1594
|
+
const body = version ? { version } : {};
|
|
1595
|
+
return this.http.delete(`${this.baseUrl}/${id}`, { ...this.opts, body }).pipe(map$1((r) => savedFromResponse(r)));
|
|
1596
|
+
}
|
|
1597
|
+
checkCode(lang, source) {
|
|
1598
|
+
return this.http
|
|
1599
|
+
.post(`${this.baseUrl}/check-code`, { lang, source }, this.opts)
|
|
1600
|
+
.pipe(map$1((r) => r.data?.diagnostics || []));
|
|
1601
|
+
}
|
|
1602
|
+
schemaLog(id, limit = 50, offset = 0) {
|
|
1603
|
+
const params = new HttpParams().set('limit', String(limit)).set('offset', String(offset));
|
|
1604
|
+
return this.http.get(`${this.baseUrl}/${id}/schema-log`, { ...this.opts, params }).pipe(map$1((r) => r.data));
|
|
1605
|
+
}
|
|
1606
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesSettingsFacade, deps: [{ token: i1$1.HttpClient }, { token: CORE_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1607
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesSettingsFacade, providedIn: 'root' }); }
|
|
1608
|
+
}
|
|
1609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesSettingsFacade, decorators: [{
|
|
1610
|
+
type: Injectable,
|
|
1611
|
+
args: [{ providedIn: 'root' }]
|
|
1612
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: undefined, decorators: [{
|
|
1613
|
+
type: Optional
|
|
1614
|
+
}, {
|
|
1615
|
+
type: Inject,
|
|
1616
|
+
args: [CORE_CONFIG]
|
|
1617
|
+
}] }] });
|
|
1618
|
+
|
|
1619
|
+
class EntitiesSettingsComponent {
|
|
1620
|
+
constructor() {
|
|
1621
|
+
this.facade = inject(EntitiesSettingsFacade);
|
|
1622
|
+
this.dialog = inject(MatDialog);
|
|
1623
|
+
this.toast = inject(ENTITIES_NOTIFIER);
|
|
1624
|
+
this.router = inject(Router);
|
|
1625
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
1626
|
+
this.columns = ['title', 'key', 'source', 'storage', 'fields', 'status', 'updated', 'actions'];
|
|
1627
|
+
this.state = 'loading';
|
|
1628
|
+
this.entities = [];
|
|
1629
|
+
this.search = '';
|
|
1630
|
+
this.busyKeys = new Set();
|
|
1631
|
+
this.statusLabel = entityStatusLabel;
|
|
1632
|
+
}
|
|
1633
|
+
ngOnInit() {
|
|
1634
|
+
this.load();
|
|
1635
|
+
}
|
|
1636
|
+
get filtered() {
|
|
1637
|
+
return filterEntities(this.entities, this.search);
|
|
1638
|
+
}
|
|
1639
|
+
load() {
|
|
1640
|
+
this.state = 'loading';
|
|
1641
|
+
this.facade.list().subscribe({
|
|
1642
|
+
next: (list) => {
|
|
1643
|
+
this.entities = list;
|
|
1644
|
+
this.state = list.length ? 'ready' : 'empty';
|
|
1645
|
+
this.cdr.markForCheck();
|
|
1646
|
+
},
|
|
1647
|
+
error: (err) => {
|
|
1648
|
+
this.state = isForbidden(err) ? 'forbidden' : 'error';
|
|
1649
|
+
this.cdr.markForCheck();
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
create() {
|
|
1654
|
+
this.router.navigate(['/settings/entities/new']);
|
|
1655
|
+
}
|
|
1656
|
+
open(e) {
|
|
1657
|
+
this.router.navigate(['/settings/entities', e.key]);
|
|
1658
|
+
}
|
|
1659
|
+
statusTone(e) {
|
|
1660
|
+
return e.source === 'code' ? 'neutral' : e.isActive ? 'success' : 'warning';
|
|
1661
|
+
}
|
|
1662
|
+
disable(e) {
|
|
1663
|
+
if (e.source !== 'ui' || !e.id)
|
|
1664
|
+
return;
|
|
1665
|
+
this.dialog
|
|
1666
|
+
.open(ConfirmDialogComponent, {
|
|
1667
|
+
data: {
|
|
1668
|
+
title: `Отключить сущность «${e.title}»?`,
|
|
1669
|
+
message: 'Сущность исчезнет из справочников и выбора связей. Таблица и данные сохранятся.',
|
|
1670
|
+
confirmLabel: 'Отключить',
|
|
1671
|
+
danger: true
|
|
1672
|
+
}
|
|
1673
|
+
})
|
|
1674
|
+
.afterClosed()
|
|
1675
|
+
.subscribe((ok) => {
|
|
1676
|
+
if (!ok)
|
|
1677
|
+
return;
|
|
1678
|
+
this.busyKeys.add(e.key);
|
|
1679
|
+
this.facade.remove(e.id, e.version).subscribe({
|
|
1680
|
+
next: (res) => {
|
|
1681
|
+
this.busyKeys.delete(e.key);
|
|
1682
|
+
if (res?.activation?.status === 'failed')
|
|
1683
|
+
this.toast.warning('Сущность отключена в определении, но сервер не завершил деактивацию. Перезагрузите страницу и повторите при необходимости.');
|
|
1684
|
+
else
|
|
1685
|
+
this.toast.success('Сущность отключена');
|
|
1686
|
+
this.load();
|
|
1687
|
+
},
|
|
1688
|
+
error: (err) => {
|
|
1689
|
+
this.busyKeys.delete(e.key);
|
|
1690
|
+
this.toast.error(entitiesErrorMessage(err));
|
|
1691
|
+
this.cdr.markForCheck();
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesSettingsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1697
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: EntitiesSettingsComponent, isStandalone: true, selector: "shared-entities-settings", ngImport: i0, template: "<div class=\"entities-settings\">\n <shared-ent-page-header\n title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438\"\n subtitle=\"\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0438, \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u043C\u044B\u0435 \u0432 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435: \u043F\u043E\u043B\u044F, \u0441\u0432\u044F\u0437\u0438, \u043A\u043E\u0434. \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0438\u0437 \u043A\u043E\u0434\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430.\"\n icon=\"database\"\n >\n <button mat-flat-button type=\"button\" class=\"create-btn\" (click)=\"create()\" aria-label=\"\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\" [disabled]=\"state === 'forbidden'\">\n <mat-icon>add</mat-icon>\n \u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\n </button>\n </shared-ent-page-header>\n\n @switch (state) {\n @case ('loading') {\n <div class=\"state-box\" role=\"status\" aria-live=\"polite\">\n <mat-spinner diameter=\"36\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\" />\n <span>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\u2026</span>\n </div>\n }\n @case ('forbidden') {\n <shared-ent-inline-alert tone=\"error\">\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432. \u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C.</shared-ent-inline-alert>\n }\n @case ('error') {\n <shared-ent-inline-alert tone=\"error\">\n \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438.\n <button mat-button type=\"button\" (click)=\"load()\">\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @case ('empty') {\n <shared-ent-empty-state icon=\"database\" title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442\" text=\"\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 \u043F\u0435\u0440\u0432\u0443\u044E \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C, \u0447\u0442\u043E\u0431\u044B \u0443\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u043E\u043C \u0438\u0437 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.\">\n <button mat-flat-button type=\"button\" (click)=\"create()\">\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C</button>\n </shared-ent-empty-state>\n }\n @default {\n <mat-form-field class=\"search\" appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0438\u0441\u043A</mat-label>\n <input matInput type=\"search\" [(ngModel)]=\"search\" name=\"search\" aria-label=\"\u041F\u043E\u0438\u0441\u043A \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439 \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E \u0438\u043B\u0438 \u043A\u043B\u044E\u0447\u0443\" />\n <mat-icon matSuffix aria-hidden=\"true\">search</mat-icon>\n </mat-form-field>\n\n @if (!filtered.length) {\n <p class=\"muted nothing\" role=\"status\">\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.</p>\n } @else {\n <div class=\"table-wrap\">\n <table mat-table [dataSource]=\"filtered\" aria-label=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438\">\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</th>\n <td mat-cell *matCellDef=\"let e\" class=\"name-cell\">{{ e.title }}</td>\n </ng-container>\n <ng-container matColumnDef=\"key\">\n <th mat-header-cell *matHeaderCellDef>\u041A\u043B\u044E\u0447</th>\n <td mat-cell *matCellDef=\"let e\"><code>{{ e.key }}</code></td>\n </ng-container>\n <ng-container matColumnDef=\"source\">\n <th mat-header-cell *matHeaderCellDef>\u0418\u0441\u0442\u043E\u0447\u043D\u0438\u043A</th>\n <td mat-cell *matCellDef=\"let e\">\n <shared-ent-status-chip [tone]=\"e.source === 'ui' ? 'info' : 'neutral'\" class=\"source-badge\">{{ e.source === 'ui' ? 'UI' : '\u041A\u043E\u0434' }}</shared-ent-status-chip>\n </td>\n </ng-container>\n <ng-container matColumnDef=\"storage\">\n <th mat-header-cell *matHeaderCellDef>\u0425\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435</th>\n <td mat-cell *matCellDef=\"let e\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0442\u0430\u0431\u043B\u0438\u0446\u0430</td>\n </ng-container>\n <ng-container matColumnDef=\"fields\">\n <th mat-header-cell *matHeaderCellDef>\u041F\u043E\u043B\u0435\u0439</th>\n <td mat-cell *matCellDef=\"let e\">{{ e.fields?.length ?? 0 }}</td>\n </ng-container>\n <ng-container matColumnDef=\"status\">\n <th mat-header-cell *matHeaderCellDef>\u0421\u0442\u0430\u0442\u0443\u0441</th>\n <td mat-cell *matCellDef=\"let e\"><shared-ent-status-chip [tone]=\"statusTone(e)\">{{ statusLabel(e) }}</shared-ent-status-chip></td>\n </ng-container>\n <ng-container matColumnDef=\"updated\">\n <th mat-header-cell *matHeaderCellDef>\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E</th>\n <td mat-cell *matCellDef=\"let e\">\n @if (e.updatedAt) { {{ e.updatedAt | date: 'dd.MM.yyyy HH:mm' }} } @else { <span class=\"muted\">\u2014</span> }\n </td>\n </ng-container>\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef><span class=\"visually-hidden\">\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span></th>\n <td mat-cell *matCellDef=\"let e\" class=\"actions-cell\">\n <button mat-icon-button type=\"button\" class=\"open-btn\" [matTooltip]=\"e.source === 'code' ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440' : '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C'\" [attr.aria-label]=\"(e.source === 'code' ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C ' : '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C ') + e.title\" (click)=\"open(e)\">\n <mat-icon>{{ e.source === 'code' ? 'visibility' : 'edit' }}</mat-icon>\n </button>\n @if (e.source === 'ui' && e.isActive) {\n <button mat-icon-button type=\"button\" class=\"disable-btn\" matTooltip=\"\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C\" [attr.aria-label]=\"'\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C ' + e.title\" [disabled]=\"busyKeys.has(e.key)\" (click)=\"disable(e)\">\n <mat-icon>block</mat-icon>\n </button>\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columns\"></tr>\n </table>\n </div>\n }\n }\n }\n</div>\n", styles: [".entities-settings{padding:4px}.state-box{display:flex;align-items:center;gap:16px;padding:32px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}.table-wrap{overflow-x:auto;background:var(--mat-sys-surface-container-low);border-radius:var(--mat-sys-corner-medium)}table{width:100%;background:transparent}.name-cell{font-weight:500}.muted{color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-small)}.actions-cell{white-space:nowrap;text-align:end}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.search{width:360px;max-width:100%;margin-bottom:12px}.nothing{padding:16px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$5.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i1$4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i9.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: PageHeaderComponent, selector: "shared-ent-page-header", inputs: ["title", "subtitle", "icon"] }, { kind: "component", type: InlineAlertComponent, selector: "shared-ent-inline-alert", inputs: ["tone", "dismissible"], outputs: ["dismissed"] }, { kind: "component", type: EmptyStateComponent, selector: "shared-ent-empty-state", inputs: ["icon", "title", "text"] }, { kind: "component", type: StatusChipComponent, selector: "shared-ent-status-chip", inputs: ["tone", "icon"] }] }); }
|
|
1698
|
+
}
|
|
1699
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntitiesSettingsComponent, decorators: [{
|
|
1700
|
+
type: Component,
|
|
1701
|
+
args: [{ selector: 'shared-entities-settings', standalone: true, imports: [
|
|
1702
|
+
CommonModule,
|
|
1703
|
+
FormsModule,
|
|
1704
|
+
MatButtonModule,
|
|
1705
|
+
MatDialogModule,
|
|
1706
|
+
MatFormFieldModule,
|
|
1707
|
+
MatIconModule,
|
|
1708
|
+
MatInputModule,
|
|
1709
|
+
MatProgressSpinnerModule,
|
|
1710
|
+
MatTableModule,
|
|
1711
|
+
MatTooltipModule,
|
|
1712
|
+
PageHeaderComponent,
|
|
1713
|
+
InlineAlertComponent,
|
|
1714
|
+
EmptyStateComponent,
|
|
1715
|
+
StatusChipComponent
|
|
1716
|
+
], template: "<div class=\"entities-settings\">\n <shared-ent-page-header\n title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438\"\n subtitle=\"\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0438, \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u043C\u044B\u0435 \u0432 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435: \u043F\u043E\u043B\u044F, \u0441\u0432\u044F\u0437\u0438, \u043A\u043E\u0434. \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0438\u0437 \u043A\u043E\u0434\u0430 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430.\"\n icon=\"database\"\n >\n <button mat-flat-button type=\"button\" class=\"create-btn\" (click)=\"create()\" aria-label=\"\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\" [disabled]=\"state === 'forbidden'\">\n <mat-icon>add</mat-icon>\n \u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\n </button>\n </shared-ent-page-header>\n\n @switch (state) {\n @case ('loading') {\n <div class=\"state-box\" role=\"status\" aria-live=\"polite\">\n <mat-spinner diameter=\"36\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\" />\n <span>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\u2026</span>\n </div>\n }\n @case ('forbidden') {\n <shared-ent-inline-alert tone=\"error\">\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432. \u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C.</shared-ent-inline-alert>\n }\n @case ('error') {\n <shared-ent-inline-alert tone=\"error\">\n \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438.\n <button mat-button type=\"button\" (click)=\"load()\">\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @case ('empty') {\n <shared-ent-empty-state icon=\"database\" title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442\" text=\"\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 \u043F\u0435\u0440\u0432\u0443\u044E \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C, \u0447\u0442\u043E\u0431\u044B \u0443\u043F\u0440\u0430\u0432\u043B\u044F\u0442\u044C \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u043E\u043C \u0438\u0437 \u0438\u043D\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.\">\n <button mat-flat-button type=\"button\" (click)=\"create()\">\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C</button>\n </shared-ent-empty-state>\n }\n @default {\n <mat-form-field class=\"search\" appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0438\u0441\u043A</mat-label>\n <input matInput type=\"search\" [(ngModel)]=\"search\" name=\"search\" aria-label=\"\u041F\u043E\u0438\u0441\u043A \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439 \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044E \u0438\u043B\u0438 \u043A\u043B\u044E\u0447\u0443\" />\n <mat-icon matSuffix aria-hidden=\"true\">search</mat-icon>\n </mat-form-field>\n\n @if (!filtered.length) {\n <p class=\"muted nothing\" role=\"status\">\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E.</p>\n } @else {\n <div class=\"table-wrap\">\n <table mat-table [dataSource]=\"filtered\" aria-label=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u0438\">\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</th>\n <td mat-cell *matCellDef=\"let e\" class=\"name-cell\">{{ e.title }}</td>\n </ng-container>\n <ng-container matColumnDef=\"key\">\n <th mat-header-cell *matHeaderCellDef>\u041A\u043B\u044E\u0447</th>\n <td mat-cell *matCellDef=\"let e\"><code>{{ e.key }}</code></td>\n </ng-container>\n <ng-container matColumnDef=\"source\">\n <th mat-header-cell *matHeaderCellDef>\u0418\u0441\u0442\u043E\u0447\u043D\u0438\u043A</th>\n <td mat-cell *matCellDef=\"let e\">\n <shared-ent-status-chip [tone]=\"e.source === 'ui' ? 'info' : 'neutral'\" class=\"source-badge\">{{ e.source === 'ui' ? 'UI' : '\u041A\u043E\u0434' }}</shared-ent-status-chip>\n </td>\n </ng-container>\n <ng-container matColumnDef=\"storage\">\n <th mat-header-cell *matHeaderCellDef>\u0425\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435</th>\n <td mat-cell *matCellDef=\"let e\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0442\u0430\u0431\u043B\u0438\u0446\u0430</td>\n </ng-container>\n <ng-container matColumnDef=\"fields\">\n <th mat-header-cell *matHeaderCellDef>\u041F\u043E\u043B\u0435\u0439</th>\n <td mat-cell *matCellDef=\"let e\">{{ e.fields?.length ?? 0 }}</td>\n </ng-container>\n <ng-container matColumnDef=\"status\">\n <th mat-header-cell *matHeaderCellDef>\u0421\u0442\u0430\u0442\u0443\u0441</th>\n <td mat-cell *matCellDef=\"let e\"><shared-ent-status-chip [tone]=\"statusTone(e)\">{{ statusLabel(e) }}</shared-ent-status-chip></td>\n </ng-container>\n <ng-container matColumnDef=\"updated\">\n <th mat-header-cell *matHeaderCellDef>\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E</th>\n <td mat-cell *matCellDef=\"let e\">\n @if (e.updatedAt) { {{ e.updatedAt | date: 'dd.MM.yyyy HH:mm' }} } @else { <span class=\"muted\">\u2014</span> }\n </td>\n </ng-container>\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef><span class=\"visually-hidden\">\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F</span></th>\n <td mat-cell *matCellDef=\"let e\" class=\"actions-cell\">\n <button mat-icon-button type=\"button\" class=\"open-btn\" [matTooltip]=\"e.source === 'code' ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440' : '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C'\" [attr.aria-label]=\"(e.source === 'code' ? '\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C ' : '\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C ') + e.title\" (click)=\"open(e)\">\n <mat-icon>{{ e.source === 'code' ? 'visibility' : 'edit' }}</mat-icon>\n </button>\n @if (e.source === 'ui' && e.isActive) {\n <button mat-icon-button type=\"button\" class=\"disable-btn\" matTooltip=\"\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C\" [attr.aria-label]=\"'\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C ' + e.title\" [disabled]=\"busyKeys.has(e.key)\" (click)=\"disable(e)\">\n <mat-icon>block</mat-icon>\n </button>\n }\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columns\"></tr>\n </table>\n </div>\n }\n }\n }\n</div>\n", styles: [".entities-settings{padding:4px}.state-box{display:flex;align-items:center;gap:16px;padding:32px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}.table-wrap{overflow-x:auto;background:var(--mat-sys-surface-container-low);border-radius:var(--mat-sys-corner-medium)}table{width:100%;background:transparent}.name-cell{font-weight:500}.muted{color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-small)}.actions-cell{white-space:nowrap;text-align:end}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.search{width:360px;max-width:100%;margin-bottom:12px}.nothing{padding:16px}\n"] }]
|
|
1717
|
+
}] });
|
|
1718
|
+
|
|
1719
|
+
function lineCol(source, pos) {
|
|
1720
|
+
const before = source.slice(0, pos);
|
|
1721
|
+
const line = before.split('\n').length;
|
|
1722
|
+
const column = pos - (before.lastIndexOf('\n') + 1) + 1;
|
|
1723
|
+
return { line, column };
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Instant syntax check for a JS snippet (function body) using the CodeMirror/lezer parser.
|
|
1727
|
+
* Parse only: nothing is evaluated (no eval / new Function). TS snippets go through POST /check-code.
|
|
1728
|
+
*/
|
|
1729
|
+
function localJsDiagnostics(source, limit = 20) {
|
|
1730
|
+
const text = source || '';
|
|
1731
|
+
if (!text.trim())
|
|
1732
|
+
return [];
|
|
1733
|
+
const out = [];
|
|
1734
|
+
const tree = javascriptLanguage.parser.parse(text);
|
|
1735
|
+
tree.iterate({
|
|
1736
|
+
enter(node) {
|
|
1737
|
+
if (out.length >= limit)
|
|
1738
|
+
return false;
|
|
1739
|
+
if (node.type.isError) {
|
|
1740
|
+
const from = Math.min(node.from, text.length);
|
|
1741
|
+
const to = Math.max(Math.min(node.to, text.length), from);
|
|
1742
|
+
const a = lineCol(text, from);
|
|
1743
|
+
const b = lineCol(text, to);
|
|
1744
|
+
out.push({ line: a.line, column: a.column, endLine: b.line, endColumn: b.column, message: 'Синтаксическая ошибка', severity: 'error' });
|
|
1745
|
+
return false;
|
|
1746
|
+
}
|
|
1747
|
+
return undefined;
|
|
1748
|
+
}
|
|
1749
|
+
});
|
|
1750
|
+
return out;
|
|
1751
|
+
}
|
|
1752
|
+
/** Offsets for a diagnostic inside `source` (used by the editor to draw the underline). */
|
|
1753
|
+
function diagnosticRange(source, d) {
|
|
1754
|
+
const lines = source.split('\n');
|
|
1755
|
+
const offsetOf = (line, col) => {
|
|
1756
|
+
const l = Math.min(Math.max(line, 1), lines.length);
|
|
1757
|
+
let off = 0;
|
|
1758
|
+
for (let i = 0; i < l - 1; i++)
|
|
1759
|
+
off += lines[i].length + 1;
|
|
1760
|
+
return Math.min(off + Math.max(col - 1, 0), source.length);
|
|
1761
|
+
};
|
|
1762
|
+
const from = offsetOf(d.line, d.column);
|
|
1763
|
+
let to = d.endLine ? offsetOf(d.endLine, d.endColumn ?? d.column) : from;
|
|
1764
|
+
if (to <= from)
|
|
1765
|
+
to = Math.min(from + 1, source.length);
|
|
1766
|
+
return { from: Math.min(from, Math.max(source.length - 1, 0)), to: Math.max(to, Math.min(from + 1, source.length)) };
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* CodeMirror 6 wrapper. `diagnostics` (local JS parse or server TS check, computed by the parent) are drawn inline;
|
|
1771
|
+
* `valueChange` emits on every edit. The code is never executed.
|
|
1772
|
+
*/
|
|
1773
|
+
class CodeEditorComponent {
|
|
1774
|
+
constructor() {
|
|
1775
|
+
this.value = input('');
|
|
1776
|
+
this.lang = input('js');
|
|
1777
|
+
this.readOnly = input(false);
|
|
1778
|
+
this.diagnostics = input([]);
|
|
1779
|
+
this.ariaLabel = input('Редактор кода');
|
|
1780
|
+
this.valueChange = output();
|
|
1781
|
+
this.editable = new Compartment();
|
|
1782
|
+
}
|
|
1783
|
+
ngAfterViewInit() {
|
|
1784
|
+
this.view = new EditorView({
|
|
1785
|
+
parent: this.host.nativeElement,
|
|
1786
|
+
state: EditorState.create({
|
|
1787
|
+
doc: this.value() || '',
|
|
1788
|
+
extensions: [
|
|
1789
|
+
lineNumbers(),
|
|
1790
|
+
highlightActiveLine(),
|
|
1791
|
+
history(),
|
|
1792
|
+
keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
|
|
1793
|
+
javascript({ typescript: this.lang() === 'ts' }),
|
|
1794
|
+
lintGutter(),
|
|
1795
|
+
this.editable.of(EditorView.editable.of(!this.readOnly())),
|
|
1796
|
+
EditorView.contentAttributes.of({ 'aria-label': this.ariaLabel() }),
|
|
1797
|
+
EditorView.updateListener.of((u) => {
|
|
1798
|
+
if (u.docChanged)
|
|
1799
|
+
this.valueChange.emit(u.state.doc.toString());
|
|
1800
|
+
})
|
|
1801
|
+
]
|
|
1802
|
+
})
|
|
1803
|
+
});
|
|
1804
|
+
this.applyDiagnostics();
|
|
1805
|
+
}
|
|
1806
|
+
ngOnChanges(ch) {
|
|
1807
|
+
if (!this.view)
|
|
1808
|
+
return;
|
|
1809
|
+
if (ch['value'] && (this.value() || '') !== this.view.state.doc.toString()) {
|
|
1810
|
+
this.view.dispatch({ changes: { from: 0, to: this.view.state.doc.length, insert: this.value() || '' } });
|
|
1811
|
+
}
|
|
1812
|
+
if (ch['readOnly'])
|
|
1813
|
+
this.view.dispatch({ effects: this.editable.reconfigure(EditorView.editable.of(!this.readOnly())) });
|
|
1814
|
+
if (ch['diagnostics'] || ch['value'])
|
|
1815
|
+
this.applyDiagnostics();
|
|
1816
|
+
}
|
|
1817
|
+
ngOnDestroy() {
|
|
1818
|
+
this.view?.destroy();
|
|
1819
|
+
}
|
|
1820
|
+
applyDiagnostics() {
|
|
1821
|
+
if (!this.view)
|
|
1822
|
+
return;
|
|
1823
|
+
const text = this.view.state.doc.toString();
|
|
1824
|
+
const list = (this.diagnostics() || []).map((d) => {
|
|
1825
|
+
const r = diagnosticRange(text, d);
|
|
1826
|
+
return { from: r.from, to: r.to, severity: d.severity === 'warning' ? 'warning' : 'error', message: d.message };
|
|
1827
|
+
});
|
|
1828
|
+
this.view.dispatch(setDiagnostics(this.view.state, list));
|
|
1829
|
+
}
|
|
1830
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CodeEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1831
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.25", type: CodeEditorComponent, isStandalone: true, selector: "shared-ent-code-editor", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, lang: { classPropertyName: "lang", publicName: "lang", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, diagnostics: { classPropertyName: "diagnostics", publicName: "diagnostics", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<div #host class="cm-host" role="group" [attr.aria-label]="ariaLabel()"></div>`, isInline: true, styles: [":host{display:block}.cm-host{border:1px solid var(--app-border, #c7c7cc);border-radius:6px;overflow:hidden}.cm-host :is(.cm-editor){min-height:140px;max-height:360px}.cm-host :is(.cm-scroller){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}.cm-host :is(.cm-focused){outline:2px solid var(--mat-sys-primary, #3f51b5)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1832
|
+
}
|
|
1833
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CodeEditorComponent, decorators: [{
|
|
1834
|
+
type: Component,
|
|
1835
|
+
args: [{ selector: 'shared-ent-code-editor', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `<div #host class="cm-host" role="group" [attr.aria-label]="ariaLabel()"></div>`, styles: [":host{display:block}.cm-host{border:1px solid var(--app-border, #c7c7cc);border-radius:6px;overflow:hidden}.cm-host :is(.cm-editor){min-height:140px;max-height:360px}.cm-host :is(.cm-scroller){font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}.cm-host :is(.cm-focused){outline:2px solid var(--mat-sys-primary, #3f51b5)}\n"] }]
|
|
1836
|
+
}], propDecorators: { host: [{
|
|
1837
|
+
type: ViewChild,
|
|
1838
|
+
args: ['host', { static: true }]
|
|
1839
|
+
}] } });
|
|
1840
|
+
|
|
1841
|
+
/** DDL preview before save. A destructive plan needs the explicit checkbox before "Применить" is enabled. */
|
|
1842
|
+
class EntityPlanDialogComponent {
|
|
1843
|
+
constructor() {
|
|
1844
|
+
this.data = inject(MAT_DIALOG_DATA);
|
|
1845
|
+
this.confirmed = false;
|
|
1846
|
+
this.isDestructive = isStatementDestructive;
|
|
1847
|
+
this.itemText = destructiveItemText;
|
|
1848
|
+
}
|
|
1849
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityPlanDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1850
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: EntityPlanDialogComponent, isStandalone: true, selector: "shared-ent-plan-dialog", ngImport: i0, template: `
|
|
1851
|
+
<h2 mat-dialog-title>{{ data.isNew ? 'Создание таблицы' : 'Изменение структуры таблицы' }} «{{ data.entityKey }}»</h2>
|
|
1852
|
+
<mat-dialog-content>
|
|
1853
|
+
@if (!data.plan.statements.length) {
|
|
1854
|
+
<p class="none">Структура таблицы не изменится.</p>
|
|
1855
|
+
} @else {
|
|
1856
|
+
<p>Будут выполнены SQL-команды (в одной транзакции, с записью в журнал схемы):</p>
|
|
1857
|
+
<ol class="sql-list" aria-label="SQL-команды">
|
|
1858
|
+
@for (s of data.plan.statements; track $index) {
|
|
1859
|
+
<li [class.destructive]="isDestructive(s)"><code>{{ s.sql }}</code></li>
|
|
1860
|
+
}
|
|
1861
|
+
</ol>
|
|
1862
|
+
}
|
|
1863
|
+
@if (data.plan.destructive) {
|
|
1864
|
+
<shared-ent-inline-alert tone="warning">
|
|
1865
|
+
<strong>Изменения удалят данные и не могут быть отменены:</strong>
|
|
1866
|
+
<ul class="items">
|
|
1867
|
+
@for (it of data.plan.destructiveItems; track $index) {
|
|
1868
|
+
<li>{{ itemText(it) }}</li>
|
|
1869
|
+
}
|
|
1870
|
+
</ul>
|
|
1871
|
+
</shared-ent-inline-alert>
|
|
1872
|
+
<mat-checkbox class="confirm" [checked]="confirmed" (change)="confirmed = $event.checked">
|
|
1873
|
+
Я понимаю, что данные будут потеряны, и подтверждаю изменения
|
|
1874
|
+
</mat-checkbox>
|
|
1875
|
+
}
|
|
1876
|
+
</mat-dialog-content>
|
|
1877
|
+
<mat-dialog-actions align="end">
|
|
1878
|
+
<button mat-button type="button" [mat-dialog-close]="{ confirmed: false }">Отмена</button>
|
|
1879
|
+
<button mat-flat-button type="button" class="apply-btn" [class.app-danger]="data.plan.destructive" [disabled]="data.plan.destructive && !confirmed" [mat-dialog-close]="{ confirmed: true }">
|
|
1880
|
+
{{ data.plan.destructive ? 'Применить и удалить данные' : 'Применить' }}
|
|
1881
|
+
</button>
|
|
1882
|
+
</mat-dialog-actions>
|
|
1883
|
+
`, isInline: true, styles: [".sql-list{margin:8px 0;padding-left:24px}.sql-list li{margin-bottom:6px}.sql-list code{white-space:pre-wrap;word-break:break-word;font-size:12px}.sql-list li.destructive code{color:var(--mat-sys-error)}.items{margin:4px 0 0;padding-left:20px}.confirm{display:block;margin-top:12px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: InlineAlertComponent, selector: "shared-ent-inline-alert", inputs: ["tone", "dismissible"], outputs: ["dismissed"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
1884
|
+
}
|
|
1885
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityPlanDialogComponent, decorators: [{
|
|
1886
|
+
type: Component,
|
|
1887
|
+
args: [{ selector: 'shared-ent-plan-dialog', standalone: true, imports: [MatButtonModule, MatCheckboxModule, MatDialogModule, InlineAlertComponent], changeDetection: ChangeDetectionStrategy.Default, template: `
|
|
1888
|
+
<h2 mat-dialog-title>{{ data.isNew ? 'Создание таблицы' : 'Изменение структуры таблицы' }} «{{ data.entityKey }}»</h2>
|
|
1889
|
+
<mat-dialog-content>
|
|
1890
|
+
@if (!data.plan.statements.length) {
|
|
1891
|
+
<p class="none">Структура таблицы не изменится.</p>
|
|
1892
|
+
} @else {
|
|
1893
|
+
<p>Будут выполнены SQL-команды (в одной транзакции, с записью в журнал схемы):</p>
|
|
1894
|
+
<ol class="sql-list" aria-label="SQL-команды">
|
|
1895
|
+
@for (s of data.plan.statements; track $index) {
|
|
1896
|
+
<li [class.destructive]="isDestructive(s)"><code>{{ s.sql }}</code></li>
|
|
1897
|
+
}
|
|
1898
|
+
</ol>
|
|
1899
|
+
}
|
|
1900
|
+
@if (data.plan.destructive) {
|
|
1901
|
+
<shared-ent-inline-alert tone="warning">
|
|
1902
|
+
<strong>Изменения удалят данные и не могут быть отменены:</strong>
|
|
1903
|
+
<ul class="items">
|
|
1904
|
+
@for (it of data.plan.destructiveItems; track $index) {
|
|
1905
|
+
<li>{{ itemText(it) }}</li>
|
|
1906
|
+
}
|
|
1907
|
+
</ul>
|
|
1908
|
+
</shared-ent-inline-alert>
|
|
1909
|
+
<mat-checkbox class="confirm" [checked]="confirmed" (change)="confirmed = $event.checked">
|
|
1910
|
+
Я понимаю, что данные будут потеряны, и подтверждаю изменения
|
|
1911
|
+
</mat-checkbox>
|
|
1912
|
+
}
|
|
1913
|
+
</mat-dialog-content>
|
|
1914
|
+
<mat-dialog-actions align="end">
|
|
1915
|
+
<button mat-button type="button" [mat-dialog-close]="{ confirmed: false }">Отмена</button>
|
|
1916
|
+
<button mat-flat-button type="button" class="apply-btn" [class.app-danger]="data.plan.destructive" [disabled]="data.plan.destructive && !confirmed" [mat-dialog-close]="{ confirmed: true }">
|
|
1917
|
+
{{ data.plan.destructive ? 'Применить и удалить данные' : 'Применить' }}
|
|
1918
|
+
</button>
|
|
1919
|
+
</mat-dialog-actions>
|
|
1920
|
+
`, styles: [".sql-list{margin:8px 0;padding-left:24px}.sql-list li{margin-bottom:6px}.sql-list code{white-space:pre-wrap;word-break:break-word;font-size:12px}.sql-list li.destructive code{color:var(--mat-sys-error)}.items{margin:4px 0 0;padding-left:20px}.confirm{display:block;margin-top:12px}\n"] }]
|
|
1921
|
+
}] });
|
|
1922
|
+
|
|
1923
|
+
const TS_DEBOUNCE_MS = 600;
|
|
1924
|
+
/** UI-only pseudo type: the field is computed on read from its code (stored in code.calculated[key]). */
|
|
1925
|
+
const CALCULATED_TYPE = 'calculated';
|
|
1926
|
+
class EntityFormComponent {
|
|
1927
|
+
constructor() {
|
|
1928
|
+
this.facade = inject(EntitiesSettingsFacade);
|
|
1929
|
+
this.route = inject(ActivatedRoute);
|
|
1930
|
+
this.router = inject(Router);
|
|
1931
|
+
this.dialog = inject(MatDialog);
|
|
1932
|
+
this.toast = inject(ENTITIES_NOTIFIER);
|
|
1933
|
+
this.events = inject(EntitiesEventsService);
|
|
1934
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
1935
|
+
this.fieldTypes = FIELD_TYPES;
|
|
1936
|
+
this.calcType = CALCULATED_TYPE;
|
|
1937
|
+
this.showIfOps = SHOW_IF_OPS;
|
|
1938
|
+
this.maxFields = MAX_FIELDS;
|
|
1939
|
+
this.maxGroups = MAX_GROUPS;
|
|
1940
|
+
this.tableName = tableNamePreview;
|
|
1941
|
+
this.snippetId = snippetId;
|
|
1942
|
+
this.snippetLabel = snippetLabel;
|
|
1943
|
+
this.snippetSignature = snippetSignature;
|
|
1944
|
+
this.isRel = isRelationType;
|
|
1945
|
+
this.diagText = diagnosticText;
|
|
1946
|
+
this.defaultText = defaultToText;
|
|
1947
|
+
this.showIfText = showIfValueText;
|
|
1948
|
+
this.activationHint = ACTIVATION_FAILED_HINT;
|
|
1949
|
+
this.state = 'loading';
|
|
1950
|
+
this.isNew = true;
|
|
1951
|
+
this.loadedKey = '';
|
|
1952
|
+
this.readOnly = false;
|
|
1953
|
+
this.draft = emptyDraft();
|
|
1954
|
+
this.entity = null;
|
|
1955
|
+
this.targets = [];
|
|
1956
|
+
this.expanded = new Set();
|
|
1957
|
+
/** Top tabs of the form (all panels stay in the DOM, so form state and validation survive a tab switch). */
|
|
1958
|
+
this.tabs = [
|
|
1959
|
+
{ id: 'settings', title: 'Настройки', icon: 'settings' },
|
|
1960
|
+
{ id: 'fields', title: 'Поля', icon: 'list_alt' },
|
|
1961
|
+
{ id: 'events', title: 'События модели', icon: 'bolt' },
|
|
1962
|
+
];
|
|
1963
|
+
this.tab = 'settings';
|
|
1964
|
+
this.clientErrors = {};
|
|
1965
|
+
this.serverErrors = {};
|
|
1966
|
+
this.diagnostics = {};
|
|
1967
|
+
this.globalDiagnostics = [];
|
|
1968
|
+
this.pendingChecks = new Set();
|
|
1969
|
+
this.newSnippet = { kind: 'hooks', name: '' };
|
|
1970
|
+
/** last non-empty key of a field whose key input was cleared (so retyping a key keeps its code) */
|
|
1971
|
+
this.keyMemo = new Map();
|
|
1972
|
+
this.saving = false;
|
|
1973
|
+
this.saveError = '';
|
|
1974
|
+
this.conflict = false;
|
|
1975
|
+
this.remoteChanged = false;
|
|
1976
|
+
/** save succeeded but the server could not activate the entity (response `activation.status==='failed'`) */
|
|
1977
|
+
this.activationFailed = false;
|
|
1978
|
+
this.schemaLog = [];
|
|
1979
|
+
this.schemaLogState = 'idle';
|
|
1980
|
+
this.schemaLogTotal = 0;
|
|
1981
|
+
this.timers = new Map();
|
|
1982
|
+
this.sub = new Subscription();
|
|
1983
|
+
/** Responsive widths (colSm … colXxl) share the 1..12 handling of `col`. */
|
|
1984
|
+
this.widthKeys = [
|
|
1985
|
+
{ key: 'colSm', label: 'sm' }, { key: 'colMd', label: 'md' }, { key: 'colLg', label: 'lg' }, { key: 'colXl', label: 'xl' }, { key: 'colXxl', label: 'xxl' }
|
|
1986
|
+
];
|
|
1987
|
+
// ---- sub-tabs inside the field details -----------------------------------------------------------
|
|
1988
|
+
this.subTabs = new Map();
|
|
1989
|
+
this.allSubTabs = [
|
|
1990
|
+
{ id: 'general', title: 'Общее', icon: 'tune' },
|
|
1991
|
+
{ id: 'display', title: 'Отображение', icon: 'visibility' },
|
|
1992
|
+
{ id: 'list', title: 'Список', icon: 'view_list' },
|
|
1993
|
+
{ id: 'checks', title: 'Проверки', icon: 'fact_check' },
|
|
1994
|
+
{ id: 'storage', title: 'Хранение', icon: 'storage' },
|
|
1995
|
+
{ id: 'cond', title: 'Условия', icon: 'call_split' },
|
|
1996
|
+
];
|
|
1997
|
+
// ---- validators multi-select ------------------------------------------------------------------------
|
|
1998
|
+
this.asyncValidatorOptions = ASYNC_VALIDATOR_OPTIONS;
|
|
1999
|
+
this.validatorSelections = new Map();
|
|
2000
|
+
this.noValidators = [];
|
|
2001
|
+
// ---- sub-tabs of the "Настройки" tab ---------------------------------------------------------------
|
|
2002
|
+
this.settingsTabs = [
|
|
2003
|
+
{ id: 'general', title: 'Общее', icon: 'info' },
|
|
2004
|
+
{ id: 'view', title: 'Вид', icon: 'palette' },
|
|
2005
|
+
{ id: 'list', title: 'Список и фильтры', icon: 'filter_list' },
|
|
2006
|
+
{ id: 'boards', title: 'Доски', icon: 'view_kanban' },
|
|
2007
|
+
{ id: 'buttons', title: 'Кнопки и действия', icon: 'touch_app' },
|
|
2008
|
+
{ id: 'preload', title: 'Предзагрузка', icon: 'cloud_download' },
|
|
2009
|
+
];
|
|
2010
|
+
this.settingsTab = 'general';
|
|
2011
|
+
this.trackField = (_, f) => f.uid;
|
|
2012
|
+
}
|
|
2013
|
+
ngOnInit() {
|
|
2014
|
+
this.sub.add(this.events.events$.subscribe((ev) => {
|
|
2015
|
+
if (this.state !== 'ready' || this.isNew || !ev?.key || ev.key !== this.draft.key || this.saving)
|
|
2016
|
+
return;
|
|
2017
|
+
if (ev.type === 'entity.updated' && ev.version != null && ev.version !== this.draft.version) {
|
|
2018
|
+
this.remoteChanged = true;
|
|
2019
|
+
this.cdr.markForCheck();
|
|
2020
|
+
}
|
|
2021
|
+
}));
|
|
2022
|
+
this.load();
|
|
2023
|
+
// The create route and the edit route share this component: after the first save the URL changes to the new key without
|
|
2024
|
+
// re-creating it, so reload when the key in the URL differs from what is shown (otherwise the form stays in "new" mode).
|
|
2025
|
+
this.sub.add(this.route.paramMap?.subscribe(() => {
|
|
2026
|
+
if (this.state !== 'loading' && this.key !== this.loadedKey)
|
|
2027
|
+
this.load();
|
|
2028
|
+
}));
|
|
2029
|
+
}
|
|
2030
|
+
ngOnDestroy() {
|
|
2031
|
+
this.sub.unsubscribe();
|
|
2032
|
+
this.timers.forEach((t) => clearTimeout(t));
|
|
2033
|
+
this.timers.clear();
|
|
2034
|
+
}
|
|
2035
|
+
get key() {
|
|
2036
|
+
return this.route.snapshot.paramMap.get('key') || 'new';
|
|
2037
|
+
}
|
|
2038
|
+
load() {
|
|
2039
|
+
this.state = 'loading';
|
|
2040
|
+
this.activationFailed = false;
|
|
2041
|
+
this.isNew = this.key === 'new';
|
|
2042
|
+
this.loadedKey = this.key;
|
|
2043
|
+
this.facade.list().subscribe({
|
|
2044
|
+
next: (list) => {
|
|
2045
|
+
this.targets = list.filter((e) => e.isActive !== false);
|
|
2046
|
+
this.conflict = false;
|
|
2047
|
+
this.remoteChanged = false;
|
|
2048
|
+
if (this.isNew) {
|
|
2049
|
+
this.draft = emptyDraft();
|
|
2050
|
+
this.draft.options.preLoadSections = [];
|
|
2051
|
+
this.readOnly = false;
|
|
2052
|
+
this.state = 'ready';
|
|
2053
|
+
}
|
|
2054
|
+
else {
|
|
2055
|
+
const found = list.find((e) => e.key === this.key);
|
|
2056
|
+
if (!found) {
|
|
2057
|
+
this.state = 'notfound';
|
|
2058
|
+
}
|
|
2059
|
+
else {
|
|
2060
|
+
this.entity = found;
|
|
2061
|
+
this.readOnly = found.source === 'code' || !found.id;
|
|
2062
|
+
this.draft = draftFromEntity(found);
|
|
2063
|
+
// an entity saved before this setting existed preloaded its relation targets implicitly: show that list so it can be edited
|
|
2064
|
+
if (!this.readOnly && this.draft.options.preLoadSections === undefined)
|
|
2065
|
+
this.addPreloadFromRelations();
|
|
2066
|
+
this.state = 'ready';
|
|
2067
|
+
this.runAllChecks();
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
this.cdr.markForCheck();
|
|
2071
|
+
},
|
|
2072
|
+
error: (err) => {
|
|
2073
|
+
this.state = isForbidden(err) ? 'forbidden' : 'error';
|
|
2074
|
+
this.cdr.markForCheck();
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
back() {
|
|
2079
|
+
this.router.navigate(['/settings/entities']);
|
|
2080
|
+
}
|
|
2081
|
+
// ---- section settings (definition.options) -------------------------------------------------------
|
|
2082
|
+
secVal(path) {
|
|
2083
|
+
return path.split('.').reduce((o, k) => (o === undefined || o === null ? undefined : o[k]), this.draft.options);
|
|
2084
|
+
}
|
|
2085
|
+
/** Writes `draft.options.<path>`; an empty value removes the key. */
|
|
2086
|
+
setSec(path, value) {
|
|
2087
|
+
const keys = path.split('.');
|
|
2088
|
+
let o = this.draft.options;
|
|
2089
|
+
keys.slice(0, -1).forEach((k) => { o[k] = o[k] && typeof o[k] === 'object' ? o[k] : {}; o = o[k]; });
|
|
2090
|
+
const last = keys[keys.length - 1];
|
|
2091
|
+
if (value === '' || value === null || value === undefined)
|
|
2092
|
+
delete o[last];
|
|
2093
|
+
else
|
|
2094
|
+
o[last] = value;
|
|
2095
|
+
}
|
|
2096
|
+
setSecNumber(path, raw) {
|
|
2097
|
+
this.setSec(path, raw === '' || raw === null || raw === undefined ? undefined : Number(raw));
|
|
2098
|
+
}
|
|
2099
|
+
/** Tri-state: boards/presets are ON unless explicitly switched off. */
|
|
2100
|
+
secOn(path) {
|
|
2101
|
+
return this.secVal(path) !== false;
|
|
2102
|
+
}
|
|
2103
|
+
get filteringFields() {
|
|
2104
|
+
return this.draft.options.filtering?.fields || [];
|
|
2105
|
+
}
|
|
2106
|
+
addFilteringField() {
|
|
2107
|
+
const f = this.draft.options.filtering || {};
|
|
2108
|
+
this.draft.options.filtering = { ...f, fields: [...(f.fields || []), { field: '', type: 'input' }] };
|
|
2109
|
+
}
|
|
2110
|
+
removeFilteringField(i) {
|
|
2111
|
+
const f = this.draft.options.filtering || {};
|
|
2112
|
+
this.draft.options.filtering = { ...f, fields: (f.fields || []).filter((_, idx) => idx !== i) };
|
|
2113
|
+
}
|
|
2114
|
+
// ---- preloaded sections (options.preLoadSections) ------------------------------------------------
|
|
2115
|
+
get preloadList() {
|
|
2116
|
+
return this.draft.options.preLoadSections || [];
|
|
2117
|
+
}
|
|
2118
|
+
/** `<slug>(paging:{perPage:-1})` for a relation target (code targets use their static-data slug, UI targets their key). */
|
|
2119
|
+
preloadEntry(targetKey) {
|
|
2120
|
+
const t = this.targets.find((x) => x.key === targetKey);
|
|
2121
|
+
const slug = t?.source === 'code' ? t.slug || t.key : targetKey;
|
|
2122
|
+
return `${slug}(paging:{perPage:-1})`;
|
|
2123
|
+
}
|
|
2124
|
+
preloadName(entry) {
|
|
2125
|
+
return entry.split('(')[0].trim();
|
|
2126
|
+
}
|
|
2127
|
+
/** Adds the section of a relation target unless the list already preloads it (the user may have tuned or removed other entries). */
|
|
2128
|
+
ensurePreload(targetKey) {
|
|
2129
|
+
if (!targetKey)
|
|
2130
|
+
return;
|
|
2131
|
+
const entry = this.preloadEntry(targetKey);
|
|
2132
|
+
const list = this.preloadList;
|
|
2133
|
+
if (list.some((x) => this.preloadName(x) === this.preloadName(entry)))
|
|
2134
|
+
return;
|
|
2135
|
+
this.draft.options.preLoadSections = [...list, entry];
|
|
2136
|
+
}
|
|
2137
|
+
addPreloadFromRelations() {
|
|
2138
|
+
this.draft.fields.forEach((f) => this.ensurePreload(f.relation?.target));
|
|
2139
|
+
}
|
|
2140
|
+
addPreload() {
|
|
2141
|
+
this.draft.options.preLoadSections = [...this.preloadList, ''];
|
|
2142
|
+
}
|
|
2143
|
+
setPreload(i, value) {
|
|
2144
|
+
this.draft.options.preLoadSections = this.preloadList.map((x, idx) => (idx === i ? value : x));
|
|
2145
|
+
}
|
|
2146
|
+
removePreload(i) {
|
|
2147
|
+
this.draft.options.preLoadSections = this.preloadList.filter((_, idx) => idx !== i);
|
|
2148
|
+
}
|
|
2149
|
+
/** Fields offered for kanban / ordering / filtering. */
|
|
2150
|
+
get sectionFieldKeys() {
|
|
2151
|
+
return this.draft.fields.filter((f) => f.key).map((f) => ({ key: f.key, title: f.title || f.key }));
|
|
2152
|
+
}
|
|
2153
|
+
// ---- groups -------------------------------------------------------------------------------------
|
|
2154
|
+
addGroup() {
|
|
2155
|
+
if (this.draft.groups.length >= MAX_GROUPS)
|
|
2156
|
+
return;
|
|
2157
|
+
let n = this.draft.groups.length + 1;
|
|
2158
|
+
while (this.draft.groups.some((g) => g.key === `group${n}`))
|
|
2159
|
+
n++;
|
|
2160
|
+
this.draft.groups = [...this.draft.groups, { key: `group${n}`, title: '', order: this.draft.groups.length }];
|
|
2161
|
+
}
|
|
2162
|
+
/** Group key edit: fields that belong to the group follow the new key. */
|
|
2163
|
+
onGroupKeyChange(g, next) {
|
|
2164
|
+
const prev = g.key;
|
|
2165
|
+
g.key = next;
|
|
2166
|
+
if (!prev || prev === next)
|
|
2167
|
+
return;
|
|
2168
|
+
this.draft.fields.forEach((f) => { if (f.group === prev)
|
|
2169
|
+
f.group = next; });
|
|
2170
|
+
}
|
|
2171
|
+
fieldsInGroup(key) {
|
|
2172
|
+
return this.draft.fields.filter((f) => f.group === key).length;
|
|
2173
|
+
}
|
|
2174
|
+
/** New field that belongs to the group; its details are opened (group is optional and can be changed there). */
|
|
2175
|
+
addFieldToGroup(groupKey) {
|
|
2176
|
+
if (!groupKey || this.draft.fields.length >= MAX_FIELDS)
|
|
2177
|
+
return;
|
|
2178
|
+
const f = { ...emptyField(this.draft.fields.length), group: groupKey };
|
|
2179
|
+
this.draft.fields = [...this.draft.fields, f];
|
|
2180
|
+
this.expanded.add(f.uid);
|
|
2181
|
+
}
|
|
2182
|
+
/** Deleting a group deletes its fields (and their data on save) — always behind a confirmation. */
|
|
2183
|
+
removeGroup(i) {
|
|
2184
|
+
const g = this.draft.groups[i];
|
|
2185
|
+
if (!g)
|
|
2186
|
+
return;
|
|
2187
|
+
const title = g.title || g.key || 'Группа';
|
|
2188
|
+
const fields = g.key ? this.fieldsOf(g.key) : [];
|
|
2189
|
+
const message = fields.length
|
|
2190
|
+
? `Будут удалены группа «${title}» и все её поля (${fields.length}): ${fields.map((f) => f.title || f.key || 'без названия').join(', ')}. ` +
|
|
2191
|
+
'После сохранения сущности данные этих полей будут безвозвратно удалены из таблицы.'
|
|
2192
|
+
: `Группа «${title}» будет удалена.`;
|
|
2193
|
+
this.dialog
|
|
2194
|
+
.open(ConfirmDialogComponent, { data: { title: 'Удалить группу?', message, confirmLabel: fields.length ? 'Удалить группу и поля' : 'Удалить группу', danger: true }, width: '480px' })
|
|
2195
|
+
.afterClosed()
|
|
2196
|
+
.subscribe((ok) => {
|
|
2197
|
+
if (!ok)
|
|
2198
|
+
return;
|
|
2199
|
+
fields.forEach((f) => this.removeFieldRef(f));
|
|
2200
|
+
this.draft.groups = this.draft.groups.filter((x) => x !== g);
|
|
2201
|
+
this.cdr.markForCheck();
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
removeGroupByKey(key) {
|
|
2205
|
+
const i = this.draft.groups.findIndex((g) => g.key === key);
|
|
2206
|
+
if (i >= 0)
|
|
2207
|
+
this.removeGroup(i);
|
|
2208
|
+
}
|
|
2209
|
+
moveGroup(i, delta) {
|
|
2210
|
+
this.draft.groups = moveItem(this.draft.groups, i, i + delta);
|
|
2211
|
+
}
|
|
2212
|
+
// ---- fields -------------------------------------------------------------------------------------
|
|
2213
|
+
addField() {
|
|
2214
|
+
if (this.draft.fields.length >= MAX_FIELDS)
|
|
2215
|
+
return;
|
|
2216
|
+
const f = emptyField(this.draft.fields.length);
|
|
2217
|
+
this.draft.fields = [...this.draft.fields, f];
|
|
2218
|
+
this.expanded.add(f.uid);
|
|
2219
|
+
}
|
|
2220
|
+
removeField(i) {
|
|
2221
|
+
const f = this.draft.fields[i];
|
|
2222
|
+
if (f)
|
|
2223
|
+
this.removeFieldRef(f);
|
|
2224
|
+
}
|
|
2225
|
+
removeFieldRef(f) {
|
|
2226
|
+
[...['calculated', 'validators']].forEach((k) => this.clearDiagnostics(`${k}.${f.key}`));
|
|
2227
|
+
dropFieldCode(this.draft, f.key);
|
|
2228
|
+
this.draft.fields = this.draft.fields.filter((x) => x !== f);
|
|
2229
|
+
this.expanded.delete(f.uid);
|
|
2230
|
+
}
|
|
2231
|
+
/** Blocks of the fields list: one per group, then the ungrouped fields (no headers while there are no groups). */
|
|
2232
|
+
get fieldBlocks() {
|
|
2233
|
+
const hasGroups = this.draft.groups.length > 0;
|
|
2234
|
+
const blocks = this.draft.groups.map((g) => ({ key: g.key, title: g.title || g.key || 'Группа', header: true }));
|
|
2235
|
+
blocks.push({ key: '', title: 'Без группы', header: hasGroups });
|
|
2236
|
+
return blocks;
|
|
2237
|
+
}
|
|
2238
|
+
/** Fields of a group; key '' = fields without a (known) group. */
|
|
2239
|
+
fieldsOf(key) {
|
|
2240
|
+
if (key)
|
|
2241
|
+
return this.draft.fields.filter((f) => f.group === key);
|
|
2242
|
+
const known = new Set(this.draft.groups.map((g) => g.key));
|
|
2243
|
+
return this.draft.fields.filter((f) => !f.group || !known.has(f.group));
|
|
2244
|
+
}
|
|
2245
|
+
siblings(f) {
|
|
2246
|
+
const known = new Set(this.draft.groups.map((g) => g.key));
|
|
2247
|
+
return this.fieldsOf(f.group && known.has(f.group) ? f.group : '');
|
|
2248
|
+
}
|
|
2249
|
+
isFirstInBlock(f) {
|
|
2250
|
+
return this.siblings(f)[0] === f;
|
|
2251
|
+
}
|
|
2252
|
+
isLastInBlock(f) {
|
|
2253
|
+
const s = this.siblings(f);
|
|
2254
|
+
return s[s.length - 1] === f;
|
|
2255
|
+
}
|
|
2256
|
+
/** Up/down moves the field among the fields of its own group. */
|
|
2257
|
+
moveField(i, delta) {
|
|
2258
|
+
const f = this.draft.fields[i];
|
|
2259
|
+
if (!f)
|
|
2260
|
+
return;
|
|
2261
|
+
const s = this.siblings(f);
|
|
2262
|
+
const neighbour = s[s.indexOf(f) + delta];
|
|
2263
|
+
if (!neighbour)
|
|
2264
|
+
return;
|
|
2265
|
+
this.draft.fields = moveItem(this.draft.fields, i, this.draft.fields.indexOf(neighbour));
|
|
2266
|
+
}
|
|
2267
|
+
/** Drag and drop between the group blocks: the target block's key becomes the field's group. */
|
|
2268
|
+
dropField(ev) {
|
|
2269
|
+
const f = ev.item.data;
|
|
2270
|
+
if (!f)
|
|
2271
|
+
return;
|
|
2272
|
+
const target = ev.container.data || '';
|
|
2273
|
+
const before = this.fieldsOf(target).filter((x) => x !== f)[ev.currentIndex];
|
|
2274
|
+
f.group = target || undefined;
|
|
2275
|
+
const rest = this.draft.fields.filter((x) => x !== f);
|
|
2276
|
+
const last = this.fieldsOf(target).filter((x) => x !== f).pop();
|
|
2277
|
+
const at = before ? rest.indexOf(before) : last ? rest.indexOf(last) + 1 : rest.length;
|
|
2278
|
+
rest.splice(at, 0, f);
|
|
2279
|
+
this.draft.fields = rest;
|
|
2280
|
+
}
|
|
2281
|
+
toggleExpand(f) {
|
|
2282
|
+
if (this.expanded.has(f.uid))
|
|
2283
|
+
this.expanded.delete(f.uid);
|
|
2284
|
+
else
|
|
2285
|
+
this.expanded.add(f.uid);
|
|
2286
|
+
}
|
|
2287
|
+
// ---- field-level code: calculated type and validator ------------------------------------------
|
|
2288
|
+
isCalculated(f) {
|
|
2289
|
+
return hasFieldCode(this.draft, 'calculated', f.key);
|
|
2290
|
+
}
|
|
2291
|
+
hasValidator(f) {
|
|
2292
|
+
return hasFieldCode(this.draft, 'validators', f.key);
|
|
2293
|
+
}
|
|
2294
|
+
/** Value of the type select: calculated fields show the pseudo type. */
|
|
2295
|
+
typeValue(f) {
|
|
2296
|
+
return this.isCalculated(f) ? CALCULATED_TYPE : f.type;
|
|
2297
|
+
}
|
|
2298
|
+
onTypeSelect(f, value) {
|
|
2299
|
+
if (value === CALCULATED_TYPE) {
|
|
2300
|
+
if (!f.key)
|
|
2301
|
+
return;
|
|
2302
|
+
this.setFieldCode(f, 'calculated', true);
|
|
2303
|
+
this.setFieldCode(f, 'validators', false);
|
|
2304
|
+
f.type = 'string';
|
|
2305
|
+
f.required = false;
|
|
2306
|
+
f.unique = false;
|
|
2307
|
+
f.relation = undefined;
|
|
2308
|
+
f.default = undefined;
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
this.setFieldCode(f, 'calculated', false);
|
|
2312
|
+
f.type = value;
|
|
2313
|
+
this.onTypeChange(f);
|
|
2314
|
+
}
|
|
2315
|
+
toggleValidator(f, on) {
|
|
2316
|
+
this.setFieldCode(f, 'validators', on);
|
|
2317
|
+
}
|
|
2318
|
+
setFieldCode(f, kind, on) {
|
|
2319
|
+
const has = hasFieldCode(this.draft, kind, f.key);
|
|
2320
|
+
if (on && !has) {
|
|
2321
|
+
this.draft.code[kind] = { ...this.draft.code[kind], [f.key]: codeMetaOf({ kind, name: f.key })?.template || '' };
|
|
2322
|
+
this.checkSnippet({ kind, name: f.key }, true);
|
|
2323
|
+
}
|
|
2324
|
+
if (!on && has)
|
|
2325
|
+
this.removeSnippet({ kind, name: f.key });
|
|
2326
|
+
}
|
|
2327
|
+
/** Key edit: calculated/validator code is stored under the field key, so it moves with a rename. */
|
|
2328
|
+
onKeyChange(f, next) {
|
|
2329
|
+
const prev = f.key;
|
|
2330
|
+
f.key = next;
|
|
2331
|
+
if (!next) {
|
|
2332
|
+
if (prev)
|
|
2333
|
+
this.keyMemo.set(f.uid, prev);
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
const from = prev || this.keyMemo.get(f.uid) || '';
|
|
2337
|
+
this.keyMemo.delete(f.uid);
|
|
2338
|
+
renameFieldCode(this.draft, from, next).forEach((kind) => {
|
|
2339
|
+
this.clearDiagnostics(`${kind}.${from}`);
|
|
2340
|
+
this.checkSnippet({ kind: kind, name: next }, true);
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
fieldSnippets(f) {
|
|
2344
|
+
return ['calculated', 'validators'].filter((k) => hasFieldCode(this.draft, k, f.key)).map((kind) => ({ kind, name: f.key }));
|
|
2345
|
+
}
|
|
2346
|
+
onTypeChange(f) {
|
|
2347
|
+
f.default = undefined;
|
|
2348
|
+
f.options = { ...(f.options || {}) };
|
|
2349
|
+
if (f.type !== 'text')
|
|
2350
|
+
delete f.options.rich;
|
|
2351
|
+
if (f.type !== 'date')
|
|
2352
|
+
delete f.options.datetime;
|
|
2353
|
+
if (f.type !== 'string-list')
|
|
2354
|
+
delete f.options.separator;
|
|
2355
|
+
if (isRelationType(f.type)) {
|
|
2356
|
+
f.unique = false;
|
|
2357
|
+
f.relation = f.relation || { target: '' };
|
|
2358
|
+
}
|
|
2359
|
+
else {
|
|
2360
|
+
f.relation = undefined;
|
|
2361
|
+
}
|
|
2362
|
+
if (['json', 'select-many', 'string-list'].includes(f.type))
|
|
2363
|
+
f.unique = false;
|
|
2364
|
+
}
|
|
2365
|
+
/** Form width in grid columns (1..12); empty clears it. */
|
|
2366
|
+
setCol(f, raw) {
|
|
2367
|
+
f.options = { ...(f.options || {}) };
|
|
2368
|
+
if (raw === null || raw === undefined || raw === '')
|
|
2369
|
+
delete f.options.col;
|
|
2370
|
+
else
|
|
2371
|
+
f.options.col = Number(raw);
|
|
2372
|
+
}
|
|
2373
|
+
setWidth(f, key, raw) {
|
|
2374
|
+
f.options = { ...(f.options || {}) };
|
|
2375
|
+
const o = f.options;
|
|
2376
|
+
if (raw === null || raw === undefined || raw === '')
|
|
2377
|
+
delete o[key];
|
|
2378
|
+
else
|
|
2379
|
+
o[key] = Number(raw);
|
|
2380
|
+
}
|
|
2381
|
+
/** Tabs with content for this field (calculated fields have no stored column; some types have no validators). */
|
|
2382
|
+
fieldTabs(f) {
|
|
2383
|
+
return this.allSubTabs.filter((t) => {
|
|
2384
|
+
// "Общее" holds the group picker and the default value: nothing to show for a relation/calculated field when there are no groups
|
|
2385
|
+
if (t.id === 'general')
|
|
2386
|
+
return this.draft.groups.length > 0 || (!this.isRel(f.type) && !this.isCalculated(f));
|
|
2387
|
+
if (t.id === 'checks')
|
|
2388
|
+
return !this.isCalculated(f) && (this.syncValidatorOptions(f).length > 0 || this.canAsyncValidate(f));
|
|
2389
|
+
if (t.id === 'storage')
|
|
2390
|
+
return !this.isCalculated(f);
|
|
2391
|
+
return true;
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
subTab(f) {
|
|
2395
|
+
const tabs = this.fieldTabs(f);
|
|
2396
|
+
const id = this.subTabs.get(f.uid);
|
|
2397
|
+
return tabs.find((t) => t.id === id)?.id || tabs[0].id;
|
|
2398
|
+
}
|
|
2399
|
+
setSubTab(f, id) {
|
|
2400
|
+
this.subTabs.set(f.uid, id);
|
|
2401
|
+
}
|
|
2402
|
+
/** Errors of field `i` that belong to a sub-tab (badge on the tab, so an error on a hidden tab is not missed). */
|
|
2403
|
+
subTabErrors(i, id) {
|
|
2404
|
+
const prefix = `fields[${i}].`;
|
|
2405
|
+
const tabOf = (rest) => {
|
|
2406
|
+
if (/^column\b/.test(rest))
|
|
2407
|
+
return 'storage';
|
|
2408
|
+
if (/^options\.(minLength|pattern|asyncValidators)\b/.test(rest))
|
|
2409
|
+
return 'checks';
|
|
2410
|
+
if (/^options\.col/.test(rest))
|
|
2411
|
+
return 'display';
|
|
2412
|
+
if (/^(options\.showIf|dependsOn|showIf)/.test(rest))
|
|
2413
|
+
return 'cond';
|
|
2414
|
+
return 'general';
|
|
2415
|
+
};
|
|
2416
|
+
return this.errorList.filter((e) => e.path.startsWith(prefix) && tabOf(e.path.slice(prefix.length)) === id).length;
|
|
2417
|
+
}
|
|
2418
|
+
syncValidatorOptions(f) {
|
|
2419
|
+
return SYNC_VALIDATOR_OPTIONS.filter((o) => o.types.includes(f.type));
|
|
2420
|
+
}
|
|
2421
|
+
canAsyncValidate(f) {
|
|
2422
|
+
return ['string', 'text', 'integer'].includes(f.type);
|
|
2423
|
+
}
|
|
2424
|
+
/** The selected validators are the settings themselves: required <-> "Обяз.", requiredTrue <-> mustBeTrue, minLength/pattern <-> their parameters. */
|
|
2425
|
+
selectedValidators(f) {
|
|
2426
|
+
const o = f.options || {};
|
|
2427
|
+
const sel = [];
|
|
2428
|
+
if (f.required && f.type !== 'boolean')
|
|
2429
|
+
sel.push('required');
|
|
2430
|
+
if (f.type === 'boolean' && o.mustBeTrue)
|
|
2431
|
+
sel.push('requiredTrue');
|
|
2432
|
+
if (o.minLength !== undefined && o.minLength !== null && (f.type === 'string' || f.type === 'text'))
|
|
2433
|
+
sel.push('minLength');
|
|
2434
|
+
if (o.pattern !== undefined && o.pattern !== null && (f.type === 'string' || f.type === 'text'))
|
|
2435
|
+
sel.push('pattern');
|
|
2436
|
+
// ngModel re-writes the control whenever the bound array identity changes: keep the same array while the content is the same
|
|
2437
|
+
const prev = this.validatorSelections.get(f.uid);
|
|
2438
|
+
if (prev && prev.length === sel.length && prev.every((v, i) => v === sel[i]))
|
|
2439
|
+
return prev;
|
|
2440
|
+
this.validatorSelections.set(f.uid, sel);
|
|
2441
|
+
return sel;
|
|
2442
|
+
}
|
|
2443
|
+
setValidators(f, names) {
|
|
2444
|
+
const has = (n) => names.includes(n);
|
|
2445
|
+
const o = { ...(f.options || {}) };
|
|
2446
|
+
if (this.syncValidatorOptions(f).some((x) => x.value === 'required'))
|
|
2447
|
+
f.required = has('required');
|
|
2448
|
+
if (f.type === 'boolean') {
|
|
2449
|
+
if (has('requiredTrue'))
|
|
2450
|
+
o.mustBeTrue = true;
|
|
2451
|
+
else
|
|
2452
|
+
delete o.mustBeTrue;
|
|
2453
|
+
}
|
|
2454
|
+
if (f.type === 'string' || f.type === 'text') {
|
|
2455
|
+
if (has('minLength'))
|
|
2456
|
+
o.minLength = o.minLength ?? 1;
|
|
2457
|
+
else
|
|
2458
|
+
delete o.minLength;
|
|
2459
|
+
if (has('pattern'))
|
|
2460
|
+
o.pattern = o.pattern ?? '';
|
|
2461
|
+
else {
|
|
2462
|
+
delete o.pattern;
|
|
2463
|
+
delete o.patternMessage;
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
f.options = o;
|
|
2467
|
+
}
|
|
2468
|
+
setAsyncValidators(f, names) {
|
|
2469
|
+
const o = { ...(f.options || {}) };
|
|
2470
|
+
if (names.length)
|
|
2471
|
+
o.asyncValidators = names;
|
|
2472
|
+
else
|
|
2473
|
+
delete o.asyncValidators;
|
|
2474
|
+
f.options = o;
|
|
2475
|
+
}
|
|
2476
|
+
/** Numeric field option (minLength, minSearchLength): empty clears it. */
|
|
2477
|
+
setOptNumber(f, key, raw) {
|
|
2478
|
+
this.setWidth(f, key, raw);
|
|
2479
|
+
}
|
|
2480
|
+
addFilterOption(f) {
|
|
2481
|
+
f.options = { ...(f.options || {}) };
|
|
2482
|
+
f.options.filterOptions = [...(f.options.filterOptions || []), { field: '', value: '' }];
|
|
2483
|
+
}
|
|
2484
|
+
removeFilterOption(f, j) {
|
|
2485
|
+
f.options = { ...(f.options || {}) };
|
|
2486
|
+
f.options.filterOptions = (f.options.filterOptions || []).filter((_, i) => i !== j);
|
|
2487
|
+
}
|
|
2488
|
+
/** Filter value text -> boolean / number / string (the server stores the typed value). */
|
|
2489
|
+
setFilterValue(item, raw) {
|
|
2490
|
+
const t = (raw ?? '').trim();
|
|
2491
|
+
item.value = t === 'true' ? true : t === 'false' ? false : /^-?\d+$/.test(t) ? Number(t) : raw;
|
|
2492
|
+
}
|
|
2493
|
+
setColumn(f, text) {
|
|
2494
|
+
f.column = (text || '').trim() || undefined;
|
|
2495
|
+
}
|
|
2496
|
+
setDefault(f, raw) {
|
|
2497
|
+
f.default = parseDefault(f.type, raw);
|
|
2498
|
+
}
|
|
2499
|
+
setShowIfField(f, key) {
|
|
2500
|
+
f.showIf = key ? { field: key, op: f.showIf?.op || 'equals', value: f.showIf?.value } : undefined;
|
|
2501
|
+
}
|
|
2502
|
+
setShowIfOp(f, op) {
|
|
2503
|
+
if (!f.showIf)
|
|
2504
|
+
return;
|
|
2505
|
+
const text = showIfValueText(f.showIf);
|
|
2506
|
+
f.showIf = { ...f.showIf, op: op, value: parseShowIfValue(op, text) };
|
|
2507
|
+
}
|
|
2508
|
+
setShowIfValue(f, text) {
|
|
2509
|
+
if (f.showIf)
|
|
2510
|
+
f.showIf = { ...f.showIf, value: parseShowIfValue(f.showIf.op, text) };
|
|
2511
|
+
}
|
|
2512
|
+
/** Other fields usable in conditions / relation filters. */
|
|
2513
|
+
otherFields(f) {
|
|
2514
|
+
return this.draft.fields.filter((o) => o.key && o !== f);
|
|
2515
|
+
}
|
|
2516
|
+
targetEntity(f) {
|
|
2517
|
+
return this.targets.find((t) => t.key === f.relation?.target);
|
|
2518
|
+
}
|
|
2519
|
+
targetFieldKeys(f) {
|
|
2520
|
+
const t = this.targetEntity(f);
|
|
2521
|
+
return (t?.fields || []).map((x) => x.key);
|
|
2522
|
+
}
|
|
2523
|
+
setRelationTarget(f, key) {
|
|
2524
|
+
const t = this.targets.find((x) => x.key === key);
|
|
2525
|
+
f.relation = { ...(f.relation || { target: '' }), target: key, targetSource: t?.source };
|
|
2526
|
+
if (f.relation.displayField && !this.targetFieldKeys(f).includes(f.relation.displayField) && this.targetFieldKeys(f).length) {
|
|
2527
|
+
f.relation.displayField = undefined;
|
|
2528
|
+
}
|
|
2529
|
+
this.ensurePreload(key);
|
|
2530
|
+
}
|
|
2531
|
+
setRelationFilter(f, patch) {
|
|
2532
|
+
const cur = f.relation?.filter || { field: '', byField: '' };
|
|
2533
|
+
const next = { ...cur, ...patch };
|
|
2534
|
+
if (f.relation)
|
|
2535
|
+
f.relation = { ...f.relation, filter: next.field || next.byField ? next : undefined };
|
|
2536
|
+
}
|
|
2537
|
+
// ---- code ---------------------------------------------------------------------------------------
|
|
2538
|
+
get snippets() {
|
|
2539
|
+
return listSnippets(this.draft.code);
|
|
2540
|
+
}
|
|
2541
|
+
codeMeta(s) {
|
|
2542
|
+
return codeMetaOf(s);
|
|
2543
|
+
}
|
|
2544
|
+
/** Actions section: hooks only (calculated/validator code lives in the field rows). */
|
|
2545
|
+
get hookSnippets() {
|
|
2546
|
+
return this.snippets.filter((s) => s.kind === 'hooks');
|
|
2547
|
+
}
|
|
2548
|
+
get orphans() {
|
|
2549
|
+
return orphanSnippets(this.draft);
|
|
2550
|
+
}
|
|
2551
|
+
get namesForNewSnippet() {
|
|
2552
|
+
return availableSnippetNames(this.draft, this.newSnippet.kind);
|
|
2553
|
+
}
|
|
2554
|
+
onNewKindChange() {
|
|
2555
|
+
this.newSnippet.name = '';
|
|
2556
|
+
}
|
|
2557
|
+
addSnippet() {
|
|
2558
|
+
const { kind, name } = this.newSnippet;
|
|
2559
|
+
if (!name)
|
|
2560
|
+
return;
|
|
2561
|
+
this.draft.code[kind] = { ...this.draft.code[kind], [name]: kind === 'hooks' ? HOOK_META[name]?.template || '' : '' };
|
|
2562
|
+
this.newSnippet = { kind, name: '' };
|
|
2563
|
+
this.checkSnippet({ kind, name }, true);
|
|
2564
|
+
}
|
|
2565
|
+
removeSnippet(s) {
|
|
2566
|
+
const copy = { ...this.draft.code[s.kind] };
|
|
2567
|
+
delete copy[s.name];
|
|
2568
|
+
this.draft.code[s.kind] = copy;
|
|
2569
|
+
this.clearDiagnostics(snippetId(s));
|
|
2570
|
+
}
|
|
2571
|
+
snippetValue(s) {
|
|
2572
|
+
return this.draft.code[s.kind][s.name] || '';
|
|
2573
|
+
}
|
|
2574
|
+
setLang(lang) {
|
|
2575
|
+
this.draft.code.lang = lang;
|
|
2576
|
+
this.runAllChecks();
|
|
2577
|
+
}
|
|
2578
|
+
onSnippetChange(s, source) {
|
|
2579
|
+
this.draft.code[s.kind][s.name] = source;
|
|
2580
|
+
this.checkSnippet(s);
|
|
2581
|
+
}
|
|
2582
|
+
clearDiagnostics(id) {
|
|
2583
|
+
delete this.diagnostics[id];
|
|
2584
|
+
this.pendingChecks.delete(id);
|
|
2585
|
+
const t = this.timers.get(id);
|
|
2586
|
+
if (t)
|
|
2587
|
+
clearTimeout(t);
|
|
2588
|
+
this.timers.delete(id);
|
|
2589
|
+
}
|
|
2590
|
+
runAllChecks() {
|
|
2591
|
+
this.snippets.forEach((s) => this.checkSnippet(s, true));
|
|
2592
|
+
}
|
|
2593
|
+
/** JS: instant local parse. TS: debounced POST /check-code (nothing is executed on the server either). */
|
|
2594
|
+
checkSnippet(s, immediate = false) {
|
|
2595
|
+
const id = snippetId(s);
|
|
2596
|
+
const source = this.snippetValue(s);
|
|
2597
|
+
const t = this.timers.get(id);
|
|
2598
|
+
if (t)
|
|
2599
|
+
clearTimeout(t);
|
|
2600
|
+
this.timers.delete(id);
|
|
2601
|
+
if (!source.trim()) {
|
|
2602
|
+
this.diagnostics[id] = [];
|
|
2603
|
+
this.pendingChecks.delete(id);
|
|
2604
|
+
return;
|
|
2605
|
+
}
|
|
2606
|
+
if (this.draft.code.lang === 'js') {
|
|
2607
|
+
this.pendingChecks.delete(id);
|
|
2608
|
+
this.diagnostics[id] = localJsDiagnostics(source);
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
this.pendingChecks.add(id);
|
|
2612
|
+
const run = () => {
|
|
2613
|
+
this.timers.delete(id);
|
|
2614
|
+
this.facade.checkCode('ts', source).subscribe({
|
|
2615
|
+
next: (list) => {
|
|
2616
|
+
if (this.snippetValueSafe(s) !== source)
|
|
2617
|
+
return; // stale response
|
|
2618
|
+
this.diagnostics[id] = list;
|
|
2619
|
+
this.pendingChecks.delete(id);
|
|
2620
|
+
this.cdr.markForCheck();
|
|
2621
|
+
},
|
|
2622
|
+
error: () => {
|
|
2623
|
+
this.pendingChecks.delete(id);
|
|
2624
|
+
this.diagnostics[id] = [{ line: 1, column: 1, message: 'Не удалось проверить код на сервере. Повторите позже.', severity: 'error' }];
|
|
2625
|
+
this.cdr.markForCheck();
|
|
2626
|
+
}
|
|
2627
|
+
});
|
|
2628
|
+
};
|
|
2629
|
+
if (immediate)
|
|
2630
|
+
run();
|
|
2631
|
+
else
|
|
2632
|
+
this.timers.set(id, setTimeout(run, TS_DEBOUNCE_MS));
|
|
2633
|
+
}
|
|
2634
|
+
snippetValueSafe(s) {
|
|
2635
|
+
return this.draft.code[s.kind]?.[s.name];
|
|
2636
|
+
}
|
|
2637
|
+
diagFor(s) {
|
|
2638
|
+
return this.diagnostics[snippetId(s)] || [];
|
|
2639
|
+
}
|
|
2640
|
+
get allDiagnosticCount() {
|
|
2641
|
+
return Object.values(this.diagnostics).reduce((n, l) => n + (l?.length || 0), 0) + this.globalDiagnostics.length;
|
|
2642
|
+
}
|
|
2643
|
+
get codeBlocked() {
|
|
2644
|
+
return hasBlockingDiagnostics(this.diagnostics) || this.globalDiagnostics.length > 0 || this.pendingChecks.size > 0 || this.orphans.length > 0;
|
|
2645
|
+
}
|
|
2646
|
+
// ---- errors -------------------------------------------------------------------------------------
|
|
2647
|
+
err(path) {
|
|
2648
|
+
return this.clientErrors[path] || this.serverErrors[path] || '';
|
|
2649
|
+
}
|
|
2650
|
+
settingsTabOfPath(path) {
|
|
2651
|
+
if (/^options\.(texts|viewSettings)\b/.test(path))
|
|
2652
|
+
return 'view';
|
|
2653
|
+
if (/^options\.(filtering|filteringType|orderByField|search|allItems|showpresets|showSettings)\b/.test(path))
|
|
2654
|
+
return 'list';
|
|
2655
|
+
if (/^options\.(kanban|boards)/.test(path))
|
|
2656
|
+
return 'boards';
|
|
2657
|
+
if (/^options\.actions\b/.test(path))
|
|
2658
|
+
return 'buttons';
|
|
2659
|
+
if (/^options\.preLoadSections\b/.test(path))
|
|
2660
|
+
return 'preload';
|
|
2661
|
+
return 'general';
|
|
2662
|
+
}
|
|
2663
|
+
settingsTabErrors(id) {
|
|
2664
|
+
return this.errorList.filter((e) => this.tabOfPath(e.path) === 'settings' && this.settingsTabOfPath(e.path) === id).length;
|
|
2665
|
+
}
|
|
2666
|
+
/** Tab that owns a validation path. */
|
|
2667
|
+
tabOfPath(path) {
|
|
2668
|
+
if (/^(fields|groups)\b/.test(path))
|
|
2669
|
+
return 'fields';
|
|
2670
|
+
if (/^code\b/.test(path))
|
|
2671
|
+
return 'events';
|
|
2672
|
+
return 'settings';
|
|
2673
|
+
}
|
|
2674
|
+
/** Number of current errors on a tab (shown as a badge so errors on a hidden tab are not missed). */
|
|
2675
|
+
tabErrors(id) {
|
|
2676
|
+
const n = this.errorList.filter((e) => this.tabOfPath(e.path) === id).length;
|
|
2677
|
+
return id === 'events' ? n + this.globalDiagnostics.length + this.orphans.length : n;
|
|
2678
|
+
}
|
|
2679
|
+
showFirstErrorTab() {
|
|
2680
|
+
const first = this.errorList[0];
|
|
2681
|
+
if (first && this.tabOfPath(first.path) !== this.tab && !this.errorList.some((e) => this.tabOfPath(e.path) === this.tab)) {
|
|
2682
|
+
this.tab = this.tabOfPath(first.path);
|
|
2683
|
+
}
|
|
2684
|
+
// inside "Настройки": open the group that has the first error (unless the open one already has one)
|
|
2685
|
+
const settingsErrors = this.errorList.filter((e) => this.tabOfPath(e.path) === 'settings');
|
|
2686
|
+
if (settingsErrors.length && !settingsErrors.some((e) => this.settingsTabOfPath(e.path) === this.settingsTab)) {
|
|
2687
|
+
this.settingsTab = this.settingsTabOfPath(settingsErrors[0].path);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
get errorList() {
|
|
2691
|
+
const merged = { ...this.serverErrors, ...this.clientErrors };
|
|
2692
|
+
return Object.entries(merged).map(([path, message]) => ({ path, message }));
|
|
2693
|
+
}
|
|
2694
|
+
// ---- save ---------------------------------------------------------------------------------------
|
|
2695
|
+
get canSave() {
|
|
2696
|
+
return !this.readOnly && !this.saving && !this.codeBlocked && this.state === 'ready';
|
|
2697
|
+
}
|
|
2698
|
+
save() {
|
|
2699
|
+
if (!this.canSave)
|
|
2700
|
+
return;
|
|
2701
|
+
this.saveError = '';
|
|
2702
|
+
this.serverErrors = {};
|
|
2703
|
+
this.globalDiagnostics = [];
|
|
2704
|
+
this.conflict = false;
|
|
2705
|
+
this.activationFailed = false;
|
|
2706
|
+
this.clientErrors = validateDraft(this.draft, this.isNew);
|
|
2707
|
+
if (Object.keys(this.clientErrors).length) {
|
|
2708
|
+
this.saveError = 'Исправьте ошибки в форме.';
|
|
2709
|
+
this.showFirstErrorTab();
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
this.saving = true;
|
|
2713
|
+
const body = buildPayload(this.draft);
|
|
2714
|
+
this.facade.plan(this.draft.id, body).subscribe({
|
|
2715
|
+
next: (plan) => this.afterPlan(plan, body),
|
|
2716
|
+
error: (err) => this.handleError(err, body)
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
afterPlan(plan, body) {
|
|
2720
|
+
if (!plan.statements.length && !plan.destructive) {
|
|
2721
|
+
this.persist(body, false);
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
this.askConfirm(plan, body);
|
|
2725
|
+
}
|
|
2726
|
+
askConfirm(plan, body) {
|
|
2727
|
+
this.dialog
|
|
2728
|
+
.open(EntityPlanDialogComponent, {
|
|
2729
|
+
data: { plan, entityKey: body.key, isNew: this.isNew },
|
|
2730
|
+
width: '720px',
|
|
2731
|
+
maxWidth: '96vw',
|
|
2732
|
+
maxHeight: '92vh'
|
|
2733
|
+
})
|
|
2734
|
+
.afterClosed()
|
|
2735
|
+
.subscribe((res) => {
|
|
2736
|
+
if (!res?.confirmed) {
|
|
2737
|
+
this.saving = false;
|
|
2738
|
+
this.cdr.markForCheck();
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
this.persist(body, plan.destructive);
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2744
|
+
persist(body, confirmDestructive) {
|
|
2745
|
+
const call = this.draft.id ? this.facade.update(this.draft.id, body, confirmDestructive) : this.facade.create(body, confirmDestructive);
|
|
2746
|
+
call.subscribe({
|
|
2747
|
+
next: (saved) => {
|
|
2748
|
+
this.saving = false;
|
|
2749
|
+
const failed = isActivationFailed(saved?.activation);
|
|
2750
|
+
if (failed)
|
|
2751
|
+
this.toast.warning(ACTIVATION_FAILED_HINT);
|
|
2752
|
+
else
|
|
2753
|
+
this.toast.success('Сущность сохранена');
|
|
2754
|
+
this.cdr.markForCheck();
|
|
2755
|
+
if (this.isNew && saved?.key)
|
|
2756
|
+
this.router.navigate(['/settings/entities', saved.key]);
|
|
2757
|
+
else {
|
|
2758
|
+
this.load();
|
|
2759
|
+
this.activationFailed = failed;
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
error: (err) => this.handleError(err, body)
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2765
|
+
handleError(err, body) {
|
|
2766
|
+
this.saving = false;
|
|
2767
|
+
const code = entitiesErrorCode(err);
|
|
2768
|
+
this.saveError = entitiesErrorMessage(err);
|
|
2769
|
+
if (code === 'validation-failed') {
|
|
2770
|
+
this.serverErrors = errorsByPath(serverValidationErrors(err));
|
|
2771
|
+
this.showFirstErrorTab();
|
|
2772
|
+
}
|
|
2773
|
+
else if (code === 'syntax-error')
|
|
2774
|
+
this.applyServerDiagnostics(serverDiagnostics(err));
|
|
2775
|
+
else if (isVersionConflict(err))
|
|
2776
|
+
this.conflict = true;
|
|
2777
|
+
else if (code === 'destructive-confirm-required' && body) {
|
|
2778
|
+
const items = serverDestructiveItems(err);
|
|
2779
|
+
this.saving = true;
|
|
2780
|
+
this.askConfirm({ statements: [], destructive: true, destructiveItems: items }, body);
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
this.cdr.markForCheck();
|
|
2784
|
+
}
|
|
2785
|
+
applyServerDiagnostics(list) {
|
|
2786
|
+
this.globalDiagnostics = [];
|
|
2787
|
+
list.forEach((d) => {
|
|
2788
|
+
const m = /^code\.(calculated|validators|hooks)\.(.+)$/.exec(d.path || '');
|
|
2789
|
+
if (m) {
|
|
2790
|
+
const id = `${m[1]}.${m[2]}`;
|
|
2791
|
+
this.diagnostics[id] = [...(this.diagnostics[id] || []), d];
|
|
2792
|
+
}
|
|
2793
|
+
else {
|
|
2794
|
+
this.globalDiagnostics.push(d);
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
// ---- schema log ---------------------------------------------------------------------------------
|
|
2799
|
+
loadSchemaLog() {
|
|
2800
|
+
if (!this.draft.id)
|
|
2801
|
+
return;
|
|
2802
|
+
this.schemaLogState = 'loading';
|
|
2803
|
+
this.facade.schemaLog(this.draft.id).subscribe({
|
|
2804
|
+
next: (page) => {
|
|
2805
|
+
this.schemaLog = page.items || [];
|
|
2806
|
+
this.schemaLogTotal = page.total || 0;
|
|
2807
|
+
this.schemaLogState = 'ready';
|
|
2808
|
+
this.cdr.markForCheck();
|
|
2809
|
+
},
|
|
2810
|
+
error: () => {
|
|
2811
|
+
this.schemaLogState = 'error';
|
|
2812
|
+
this.cdr.markForCheck();
|
|
2813
|
+
}
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2817
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: EntityFormComponent, isStandalone: true, selector: "shared-entity-form", ngImport: i0, template: "<div class=\"entity-form\">\n <shared-ent-page-header\n [title]=\"isNew ? '\u041D\u043E\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C' : (draft.title || '\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C')\"\n [subtitle]=\"readOnly ? '\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0430 \u0432 \u043A\u043E\u0434\u0435: \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440.' : '\u041E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430: \u043F\u043E\u043B\u044F, \u0433\u0440\u0443\u043F\u043F\u044B, \u0441\u0432\u044F\u0437\u0438 \u0438 \u043A\u043E\u0434.'\"\n icon=\"database\"\n >\n <button mat-button type=\"button\" class=\"back-btn\" (click)=\"back()\" aria-label=\"\u041D\u0430\u0437\u0430\u0434 \u043A \u0441\u043F\u0438\u0441\u043A\u0443 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\">\n <mat-icon>arrow_back</mat-icon>\n \u041A \u0441\u043F\u0438\u0441\u043A\u0443\n </button>\n @if (!readOnly && state === 'ready') {\n <button mat-flat-button type=\"button\" class=\"save-btn\" (click)=\"save()\" [disabled]=\"!canSave\" aria-label=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\">\n @if (saving) { <mat-spinner diameter=\"18\" aria-label=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435\" /> } @else { <mat-icon>save</mat-icon> }\n \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n </button>\n }\n </shared-ent-page-header>\n\n @switch (state) {\n @case ('loading') {\n <div class=\"state-box\" role=\"status\" aria-live=\"polite\">\n <mat-spinner diameter=\"36\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n <span>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026</span>\n </div>\n }\n @case ('forbidden') {\n <shared-ent-inline-alert tone=\"error\">\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432. \u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C.</shared-ent-inline-alert>\n }\n @case ('error') {\n <shared-ent-inline-alert tone=\"error\">\n \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C.\n <button mat-button type=\"button\" (click)=\"load()\">\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @case ('notfound') {\n <shared-ent-empty-state icon=\"search_off\" title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430\" text=\"\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043E\u043D\u0430 \u0431\u044B\u043B\u0430 \u0443\u0434\u0430\u043B\u0435\u043D\u0430 \u0438\u043B\u0438 \u043A\u043B\u044E\u0447 \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0435\u0432\u0435\u0440\u043D\u043E.\">\n <button mat-flat-button type=\"button\" (click)=\"back()\">\u041A \u0441\u043F\u0438\u0441\u043A\u0443</button>\n </shared-ent-empty-state>\n }\n @default {\n @if (conflict) {\n <shared-ent-inline-alert tone=\"error\" class=\"conflict-alert\">\n \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0431\u044B\u043B\u0430 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430 \u0434\u0440\u0443\u0433\u0438\u043C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u043C (\u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442 \u0432\u0435\u0440\u0441\u0438\u0439). \u0412\u0430\u0448\u0438 \u043F\u0440\u0430\u0432\u043A\u0438 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435</button>\n </shared-ent-inline-alert>\n } @else if (remoteChanged) {\n <shared-ent-inline-alert tone=\"warning\" class=\"remote-alert\">\n \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430 \u0432 \u0434\u0440\u0443\u0433\u043E\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435, \u0438\u043D\u0430\u0447\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u0441\u044F \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u043E\u043C \u0432\u0435\u0440\u0441\u0438\u0439.\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @if (activationFailed) {\n <shared-ent-inline-alert tone=\"warning\" class=\"activation-alert\">\n {{ activationHint }}\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435</button>\n </shared-ent-inline-alert>\n }\n @if (saveError && !conflict) {\n <shared-ent-inline-alert tone=\"error\" class=\"save-error\">\n {{ saveError }}\n @if (errorList.length) {\n <ul class=\"error-list\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u043E\u0448\u0438\u0431\u043E\u043A\">\n @for (e of errorList; track e.path) { <li><code>{{ e.path || '\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435' }}</code>: {{ e.message }}</li> }\n </ul>\n }\n </shared-ent-inline-alert>\n }\n @if (!readOnly && !draft.isActive && !isNew) {\n <shared-ent-inline-alert tone=\"warning\">\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0430: \u043E\u043D\u0430 \u0441\u043A\u0440\u044B\u0442\u0430 \u0432 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430\u0445 \u0438 \u0432\u044B\u0431\u043E\u0440\u0435 \u0441\u0432\u044F\u0437\u0435\u0439, \u0442\u0430\u0431\u043B\u0438\u0446\u0430 \u0438 \u0434\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.</shared-ent-inline-alert>\n }\n\n <!-- Tabs -->\n <div class=\"form-tabs\" role=\"tablist\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B\u044B \u0444\u043E\u0440\u043C\u044B\">\n @for (t of tabs; track t.id) {\n <button type=\"button\" role=\"tab\" class=\"form-tab\" [class.active]=\"tab === t.id\" [attr.aria-selected]=\"tab === t.id\" [attr.id]=\"'tab-' + t.id\" [attr.aria-controls]=\"'panel-' + t.id\" (click)=\"tab = t.id\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (tabErrors(t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n\n @if (tab === 'settings' && !readOnly) {\n <div class=\"sub-tabs settings-tabs\" role=\"tablist\" aria-label=\"\u0413\u0440\u0443\u043F\u043F\u044B \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A\">\n @for (t of settingsTabs; track t.id) {\n <button type=\"button\" role=\"tab\" class=\"sub-tab\" [class.active]=\"settingsTab === t.id\" [attr.aria-selected]=\"settingsTab === t.id\" (click)=\"settingsTab = t.id\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (settingsTabErrors(t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n }\n\n <!-- General -->\n <section class=\"card\" aria-labelledby=\"sec-general\" role=\"tabpanel\" id=\"panel-settings\" [hidden]=\"tab !== 'settings' || (!readOnly && settingsTab !== 'general')\">\n <h2 id=\"sec-general\">\u041E\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F</h2>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput name=\"title\" [(ngModel)]=\"draft.title\" [disabled]=\"readOnly\" maxlength=\"200\" required aria-label=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n @if (err('title')) { <mat-error>{{ err('title') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043B\u044E\u0447</mat-label>\n <input matInput name=\"key\" [(ngModel)]=\"draft.key\" [disabled]=\"!isNew\" maxlength=\"41\" required aria-label=\"\u041A\u043B\u044E\u0447 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 (\u043D\u0435\u043B\u044C\u0437\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0441\u043B\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F)\" />\n <mat-hint>{{ isNew ? '\u041D\u0435\u043B\u044C\u0437\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0441\u043B\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F' : '\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F' }}</mat-hint>\n </mat-form-field>\n <div class=\"storage\">\n <span class=\"label\">\u0425\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435</span>\n <span class=\"storage-value\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0442\u0430\u0431\u043B\u0438\u0446\u0430</span>\n @if (tableName(draft.key)) { <code class=\"muted\">{{ tableName(draft.key) }}</code> }\n </div>\n </div>\n @if (err('key')) { <p class=\"field-error\" role=\"alert\">{{ err('key') }}</p> }\n </section>\n\n <!-- Groups -->\n <section class=\"card\" aria-labelledby=\"sec-groups\" [hidden]=\"tab !== 'fields'\">\n <div class=\"card-head\">\n <h2 id=\"sec-groups\">\u0413\u0440\u0443\u043F\u043F\u044B \u043F\u043E\u043B\u0435\u0439</h2>\n @if (!readOnly) {\n <button mat-stroked-button type=\"button\" class=\"add-group-btn\" (click)=\"addGroup()\" [disabled]=\"draft.groups.length >= maxGroups\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443\n </button>\n }\n </div>\n @if (!draft.groups.length) { <p class=\"muted\">\u0413\u0440\u0443\u043F\u043F \u043D\u0435\u0442: \u0432\u0441\u0435 \u043F\u043E\u043B\u044F \u0432\u044B\u0432\u043E\u0434\u044F\u0442\u0441\u044F \u0432 \u043E\u0434\u043D\u043E\u043C \u0431\u043B\u043E\u043A\u0435.</p> }\n @for (g of draft.groups; track $index; let i = $index) {\n <div class=\"row group-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043B\u044E\u0447 \u0433\u0440\u0443\u043F\u043F\u044B</mat-label>\n <input matInput [name]=\"'gk' + i\" [ngModel]=\"g.key\" (ngModelChange)=\"onGroupKeyChange(g, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041A\u043B\u044E\u0447 \u0433\u0440\u0443\u043F\u043F\u044B ' + (i + 1)\" />\n @if (err('groups[' + i + '].key')) { <mat-error>{{ err('groups[' + i + '].key') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B</mat-label>\n <input matInput [name]=\"'gt' + i\" [(ngModel)]=\"g.title\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B ' + (i + 1)\" />\n @if (err('groups[' + i + '].title')) { <mat-error>{{ err('groups[' + i + '].title') }}</mat-error> }\n </mat-form-field>\n @if (!readOnly) {\n <button mat-icon-button type=\"button\" (click)=\"moveGroup(i, -1)\" [disabled]=\"i === 0\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 \u0432\u044B\u0448\u0435\"><mat-icon>arrow_upward</mat-icon></button>\n <button mat-icon-button type=\"button\" (click)=\"moveGroup(i, 1)\" [disabled]=\"i === draft.groups.length - 1\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 \u043D\u0438\u0436\u0435\"><mat-icon>arrow_downward</mat-icon></button>\n <button mat-icon-button type=\"button\" class=\"remove-group-btn\" (click)=\"removeGroup(i)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n }\n </section>\n\n <!-- one code editor (field-level calculated/validator or an action) -->\n <ng-template #snip let-s>\n <div class=\"snippet\" [attr.data-snippet]=\"snippetId(s)\">\n <div class=\"row\">\n <strong class=\"snippet-title\">{{ snippetLabel(s) }}</strong>\n @if (pendingChecks.has(snippetId(s))) { <span class=\"muted\" role=\"status\">\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430\u2026</span> }\n @if (!readOnly && s.kind === 'hooks') {\n <button mat-icon-button type=\"button\" class=\"remove-snippet-btn\" (click)=\"removeSnippet(s)\" [attr.aria-label]=\"'\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u043E\u0434 ' + snippetLabel(s)\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n @if (codeMeta(s); as m) {\n <div class=\"hook-info\">\n <div class=\"hook-title\">{{ m.title }}</div>\n <div class=\"hook-io\">\n <div>\n <div class=\"hook-io-head\">\u0412\u0445\u043E\u0434\u043D\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B</div>\n <ul class=\"hook-params\">\n @for (p of m.params; track p.name) { <li><code>{{ p.name }}</code> \u2014 {{ p.description }}</li> }\n </ul>\n </div>\n <div>\n <div class=\"hook-io-head\">\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442</div>\n <p class=\"hook-returns\">{{ m.returns }}</p>\n </div>\n </div>\n <code class=\"hook-signature\">{{ snippetSignature(s) }}</code>\n </div>\n }\n <shared-ent-code-editor [value]=\"snippetValue(s)\" [lang]=\"draft.code.lang\" [readOnly]=\"readOnly\" [diagnostics]=\"diagFor(s)\" [ariaLabel]=\"'\u041A\u043E\u0434: ' + snippetLabel(s)\" (valueChange)=\"onSnippetChange(s, $event)\" />\n @if (diagFor(s).length) {\n <ul class=\"diag-list\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043A\u0438 \u043A\u043E\u0434\u0430: ' + snippetLabel(s)\">\n @for (d of diagFor(s); track $index) { <li class=\"diag\">{{ diagText(d) }}</li> }\n </ul>\n }\n </div>\n </ng-template>\n\n <!-- Fields -->\n <section class=\"card\" aria-labelledby=\"sec-fields\" role=\"tabpanel\" id=\"panel-fields\" [hidden]=\"tab !== 'fields'\">\n <div class=\"card-head\">\n <h2 id=\"sec-fields\">\u041F\u043E\u043B\u044F ({{ draft.fields.length }})</h2>\n @if (!readOnly) {\n <button mat-stroked-button type=\"button\" class=\"add-field-btn\" (click)=\"addField()\" [disabled]=\"draft.fields.length >= maxFields\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435\n </button>\n }\n </div>\n @if (err('fields')) { <p class=\"field-error\" role=\"alert\">{{ err('fields') }}</p> }\n <div cdkDropListGroup class=\"field-blocks\">\n @for (b of fieldBlocks; track $index) {\n <div class=\"field-block\" [attr.data-group]=\"b.key\">\n @if (b.header) {\n <div class=\"field-block-head\">\n <strong>{{ b.title }}</strong>\n <span class=\"muted\">({{ fieldsOf(b.key).length }})</span>\n @if (!readOnly && b.key) {\n <button mat-stroked-button type=\"button\" class=\"add-group-field-btn\" (click)=\"addFieldToGroup(b.key)\" [disabled]=\"draft.fields.length >= maxFields\" [attr.aria-label]=\"'\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432 \u0433\u0440\u0443\u043F\u043F\u0443 ' + b.title\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432 \u0433\u0440\u0443\u043F\u043F\u0443\n </button>\n <button mat-icon-button type=\"button\" class=\"remove-group-block-btn\" (click)=\"removeGroupByKey(b.key)\" [attr.aria-label]=\"'\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 ' + b.title\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n }\n <div cdkDropList [cdkDropListData]=\"b.key\" [cdkDropListDisabled]=\"readOnly\" (cdkDropListDropped)=\"dropField($event)\" class=\"fields\" role=\"list\" [attr.aria-label]=\"'\u041F\u043E\u043B\u044F: ' + b.title\">\n @for (f of fieldsOf(b.key); track f.uid) {\n @let i = draft.fields.indexOf(f);\n <div class=\"field\" cdkDrag [cdkDragData]=\"f\" role=\"listitem\" [class.invalid]=\"err('fields[' + i + '].key') || err('fields[' + i + '].title')\">\n <div class=\"row field-main\">\n @if (!readOnly) {\n <mat-icon cdkDragHandle class=\"handle\" aria-hidden=\"true\">drag_indicator</mat-icon>\n }\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-key\">\n <mat-label>\u041A\u043B\u044E\u0447</mat-label>\n <input matInput [name]=\"'fk' + f.uid\" [ngModel]=\"f.key\" (ngModelChange)=\"onKeyChange(f, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041A\u043B\u044E\u0447 \u043F\u043E\u043B\u044F ' + (i + 1)\" />\n @if (err('fields[' + i + '].key')) { <mat-error>{{ err('fields[' + i + '].key') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-title\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'ft' + f.uid\" [(ngModel)]=\"f.title\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044F ' + (i + 1)\" />\n @if (err('fields[' + i + '].title')) { <mat-error>{{ err('fields[' + i + '].title') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-type\">\n <mat-label>\u0422\u0438\u043F</mat-label>\n <select matNativeControl [name]=\"'fy' + f.uid\" [ngModel]=\"typeValue(f)\" (ngModelChange)=\"onTypeSelect(f, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u0422\u0438\u043F \u043F\u043E\u043B\u044F ' + (i + 1)\">\n @for (t of fieldTypes; track t.value) { <option [value]=\"t.value\">{{ t.label }}</option> }\n <option [value]=\"calcType\" [disabled]=\"!f.key\">\u0412\u044B\u0447\u0438\u0441\u043B\u044F\u0435\u043C\u043E\u0435</option>\n </select>\n </mat-form-field>\n </div>\n <div class=\"row field-options\">\n <div class=\"flags-inline\">\n <mat-checkbox [name]=\"'fr' + f.uid\" [(ngModel)]=\"f.required\" [disabled]=\"readOnly || isCalculated(f)\" [attr.aria-label]=\"'\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435 ' + (i + 1)\">\u041E\u0431\u044F\u0437.</mat-checkbox>\n <mat-checkbox [name]=\"'fu' + f.uid\" [(ngModel)]=\"f.unique\" [disabled]=\"readOnly || isCalculated(f) || ['json', 'select-many', 'string-list'].includes($any(f.type)) || isRel($any(f.type))\" [attr.aria-label]=\"'\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435 ' + (i + 1)\">\u0423\u043D\u0438\u043A.</mat-checkbox>\n <mat-checkbox [name]=\"'fv' + f.uid\" [ngModel]=\"hasValidator(f)\" (ngModelChange)=\"toggleValidator(f, $event)\" [disabled]=\"readOnly || !f.key || isCalculated(f)\" [attr.aria-label]=\"'\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440 \u043F\u043E\u043B\u044F ' + (i + 1)\">\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440</mat-checkbox>\n <button mat-button type=\"button\" class=\"expand-btn\" (click)=\"toggleExpand(f)\" [attr.aria-expanded]=\"expanded.has(f.uid)\" [attr.aria-label]=\"'\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043F\u043E\u043B\u044F ' + (i + 1)\">\n \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B <mat-icon iconPositionEnd>{{ expanded.has(f.uid) ? 'expand_less' : 'expand_more' }}</mat-icon>\n </button>\n </div>\n <div class=\"field-actions\">\n @if (!readOnly) {\n <button mat-icon-button type=\"button\" (click)=\"moveField(i, -1)\" [disabled]=\"isFirstInBlock(f)\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432\u044B\u0448\u0435\"><mat-icon>arrow_upward</mat-icon></button>\n <button mat-icon-button type=\"button\" (click)=\"moveField(i, 1)\" [disabled]=\"isLastInBlock(f)\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435\"><mat-icon>arrow_downward</mat-icon></button>\n <button mat-icon-button type=\"button\" class=\"remove-field-btn\" (click)=\"removeField(i)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u043E\u043B\u0435\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n </div>\n\n @for (s of fieldSnippets(f); track snippetId(s)) {\n <ng-container *ngTemplateOutlet=\"snip; context: { $implicit: s }\"></ng-container>\n }\n @if (err('fields[' + i + '].code')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].code') }}</p> }\n\n @if (isRel($any(f.type)) && f.relation) {\n <fieldset class=\"relation\" aria-label=\"\u0421\u0432\u044F\u0437\u044C\">\n <legend>\u0421\u0432\u044F\u0437\u044C ({{ f.type === 'select-one' ? '\u043E\u0434\u0438\u043D' : '\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E' }})</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0426\u0435\u043B\u0435\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C</mat-label>\n <select matNativeControl [name]=\"'rt' + f.uid\" [ngModel]=\"f.relation.target\" (ngModelChange)=\"setRelationTarget(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0426\u0435\u043B\u0435\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0441\u0432\u044F\u0437\u0438\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (t of targets; track t.key) { <option [value]=\"t.key\">{{ t.title }} ({{ t.source === 'ui' ? 'UI' : '\u043A\u043E\u0434' }})</option> }\n </select>\n @if (err('fields[' + i + '].relation.target')) { <mat-error>{{ err('fields[' + i + '].relation.target') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435</mat-label>\n @if (targetFieldKeys(f).length) {\n <select matNativeControl [name]=\"'rd' + f.uid\" [(ngModel)]=\"f.relation.displayField\" [disabled]=\"readOnly\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435 \u0441\u0432\u044F\u0437\u0438\">\n <option [ngValue]=\"undefined\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n @for (k of targetFieldKeys(f); track k) { <option [value]=\"k\">{{ k }}</option> }\n </select>\n } @else {\n <input matInput [name]=\"'rd' + f.uid\" [(ngModel)]=\"f.relation.displayField\" [disabled]=\"readOnly\" placeholder=\"name\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435 \u0441\u0432\u044F\u0437\u0438\" />\n }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0424\u0438\u043B\u044C\u0442\u0440: \u043F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438</mat-label>\n <input matInput [name]=\"'rff' + f.uid\" [ngModel]=\"f.relation.filter?.field\" (ngModelChange)=\"setRelationFilter(f, { field: $event })\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0424\u0438\u043B\u044C\u0442\u0440: \u043F\u043E \u043F\u043E\u043B\u044E</mat-label>\n <select matNativeControl [name]=\"'rfb' + f.uid\" [ngModel]=\"f.relation.filter?.byField || ''\" (ngModelChange)=\"setRelationFilter(f, { byField: $event })\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u044D\u0442\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"\">\u0411\u0435\u0437 \u0444\u0438\u043B\u044C\u0442\u0440\u0430</option>\n @for (o of otherFields(f); track o.uid) { <option [value]=\"o.key\">{{ o.title || o.key }}</option> }\n </select>\n </mat-form-field>\n </div>\n <mat-checkbox [name]=\"'ra' + f.uid\" [(ngModel)]=\"f.relation.activeOnly\" [disabled]=\"readOnly\">\u0422\u043E\u043B\u044C\u043A\u043E \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438</mat-checkbox>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'rsa' + f.uid\" [(ngModel)]=\"f.options!.selectShowAllOptions\" [disabled]=\"readOnly\">\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B</mat-checkbox>\n <mat-checkbox [name]=\"'ris' + f.uid\" [(ngModel)]=\"f.options!.innerSearch\" [disabled]=\"readOnly\">\u041F\u043E\u0438\u0441\u043A \u0432\u043D\u0443\u0442\u0440\u0438 \u0441\u043F\u0438\u0441\u043A\u0430</mat-checkbox>\n <mat-checkbox [name]=\"'rlz' + f.uid\" [(ngModel)]=\"f.options!.lazyLoading\" [disabled]=\"readOnly\">\u041F\u043E\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u043F\u0440\u0438 \u043F\u043E\u0438\u0441\u043A\u0435</mat-checkbox>\n </div>\n @if (f.options!.lazyLoading) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\">\n <mat-label>\u041C\u0438\u043D\u0438\u043C\u0443\u043C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"10\" step=\"1\" [name]=\"'rms' + f.uid\" [ngModel]=\"f.options!.minSearchLength\" (ngModelChange)=\"setOptNumber(f, 'minSearchLength', $event)\" [disabled]=\"readOnly\" aria-label=\"\u041C\u0438\u043D\u0438\u043C\u0443\u043C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430\" />\n @if (err('fields[' + i + '].options.minSearchLength')) { <mat-error>{{ err('fields[' + i + '].options.minSearchLength') }}</mat-error> }\n </mat-form-field>\n }\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0424\u0438\u043B\u044C\u0442\u0440 \u0441\u043F\u0438\u0441\u043A\u0430 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432 (\u043F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438 = \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435)</span>\n @if (!readOnly) { <button mat-stroked-button type=\"button\" class=\"add-filter-option-btn\" (click)=\"addFilterOption(f)\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C</button> }\n </div>\n @for (fo of f.options!.filterOptions || []; track $index; let j = $index) {\n <div class=\"sub-list-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438</mat-label>\n <input matInput [name]=\"'rfof' + f.uid + j\" [(ngModel)]=\"fo.field\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'rfov' + f.uid + j\" [ngModel]=\"fo.value\" (ngModelChange)=\"setFilterValue(fo, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n @if (!readOnly) { <button mat-icon-button type=\"button\" (click)=\"removeFilterOption(f, j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435\"><mat-icon>delete</mat-icon></button> }\n @if (err('fields[' + i + '].options.filterOptions[' + j + ']')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].options.filterOptions[' + j + ']') }}</p> }\n </div>\n }\n </div>\n </fieldset>\n }\n\n @if (expanded.has(f.uid)) {\n <div class=\"field-details\">\n <div class=\"sub-tabs\" role=\"tablist\" [attr.aria-label]=\"'\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043F\u043E\u043B\u044F ' + (i + 1)\">\n @for (t of fieldTabs(f); track t.id) {\n <button type=\"button\" role=\"tab\" class=\"sub-tab\" [class.active]=\"subTab(f) === t.id\" [attr.aria-selected]=\"subTab(f) === t.id\" (click)=\"setSubTab(f, t.id)\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (subTabErrors(i, t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n <fieldset class=\"detail-group\" aria-label=\"\u041E\u0431\u0449\u0435\u0435\" [hidden]=\"subTab(f) !== 'general'\">\n <legend>\u041E\u0431\u0449\u0435\u0435</legend>\n <div class=\"grid\">\n @if (draft.groups.length) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0413\u0440\u0443\u043F\u043F\u0430 (\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E)</mat-label>\n <select matNativeControl [name]=\"'fg' + f.uid\" [(ngModel)]=\"f.group\" [disabled]=\"readOnly\" aria-label=\"\u0413\u0440\u0443\u043F\u043F\u0430 \u043F\u043E\u043B\u044F\">\n <option [ngValue]=\"undefined\">\u0411\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B</option>\n @for (g of draft.groups; track g.key) { <option [value]=\"g.key\">{{ g.title || g.key }}</option> }\n </select>\n </mat-form-field>\n }\n @if (!isRel($any(f.type)) && !isCalculated(f)) {\n @if (f.type === 'boolean') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <select matNativeControl [name]=\"'fd' + f.uid\" [ngModel]=\"defaultText(f.default)\" (ngModelChange)=\"setDefault(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n <option value=\"true\">\u0414\u0430</option>\n <option value=\"false\">\u041D\u0435\u0442</option>\n </select>\n </mat-form-field>\n } @else {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <input matInput [name]=\"'fd' + f.uid\" [ngModel]=\"defaultText(f.default)\" (ngModelChange)=\"setDefault(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\" />\n </mat-form-field>\n }\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432 \u0444\u043E\u0440\u043C\u0435\" [hidden]=\"subTab(f) !== 'display'\">\n <legend>\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432 \u0444\u043E\u0440\u043C\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 (\u043F\u043E\u0434 \u043F\u043E\u043B\u0435\u043C)</mat-label>\n <textarea matInput rows=\"2\" [name]=\"'fdesc' + f.uid\" [(ngModel)]=\"f.options!.description\" [disabled]=\"readOnly\" maxlength=\"500\" aria-label=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044F\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430</mat-label>\n <input matInput [name]=\"'fh' + f.uid\" [(ngModel)]=\"f.options!.hint\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 \u043F\u043E\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440</mat-label>\n <input matInput [name]=\"'fp' + f.uid\" [(ngModel)]=\"f.options!.placeholder\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440 \u043F\u043E\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0428\u0438\u0440\u0438\u043D\u0430 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12)</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" [name]=\"'fc' + f.uid\" [ngModel]=\"f.options!.col\" (ngModelChange)=\"setCol(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043F\u043E\u043B\u044F \u0432 \u0444\u043E\u0440\u043C\u0435, \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12\" />\n @if (err('fields[' + i + '].options.col')) { <mat-error>{{ err('fields[' + i + '].options.col') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u0440\u0438\u043C\u0435\u0440 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F</mat-label>\n <input matInput [name]=\"'fex' + f.uid\" [(ngModel)]=\"f.options!.example\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u0440\u0438\u043C\u0435\u0440 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" />\n </mat-form-field>\n @if (f.type === 'boolean') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u00AB\u0432\u043A\u043B\u044E\u0447\u0435\u043D\u043E\u00BB</mat-label>\n <input matInput [name]=\"'ftt' + f.uid\" [(ngModel)]=\"f.options!.trueTitle\" [disabled]=\"readOnly\" maxlength=\"100\" aria-label=\"\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0432\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u00AB\u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D\u043E\u00BB</mat-label>\n <input matInput [name]=\"'ffl' + f.uid\" [(ngModel)]=\"f.options!.falseTitle\" [disabled]=\"readOnly\" maxlength=\"100\" aria-label=\"\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044F\" />\n </mat-form-field>\n }\n @if (f.type === 'string-list') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C</mat-label>\n <input matInput [name]=\"'fs' + f.uid\" [(ngModel)]=\"f.options!.separator\" [disabled]=\"readOnly\" maxlength=\"3\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C \u0441\u043F\u0438\u0441\u043A\u0430\" />\n </mat-form-field>\n }\n </div>\n <div class=\"widths\">\n <span class=\"muted\">\u0428\u0438\u0440\u0438\u043D\u0430 \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430\u043C \u044D\u043A\u0440\u0430\u043D\u0430 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12):</span>\n @for (w of widthKeys; track w.key) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\">\n <mat-label>{{ w.label }}</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" [name]=\"'fw' + w.key + f.uid\" [ngModel]=\"$any(f.options)[w.key]\" (ngModelChange)=\"setWidth(f, w.key, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u0428\u0438\u0440\u0438\u043D\u0430 ' + w.label + ', \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12'\" />\n @if (err('fields[' + i + '].options.' + w.key)) { <mat-error>{{ err('fields[' + i + '].options.' + w.key) }}</mat-error> }\n </mat-form-field>\n }\n </div>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'oh' + f.uid\" [(ngModel)]=\"f.options!.hidden\" [disabled]=\"readOnly\">\u0421\u043A\u0440\u044B\u0442\u043E\u0435</mat-checkbox>\n <mat-checkbox [name]=\"'on' + f.uid\" [(ngModel)]=\"f.options!.notEditable\" [disabled]=\"readOnly\">\u041D\u0435 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044F</mat-checkbox>\n @if (f.type === 'text') { <mat-checkbox [name]=\"'or' + f.uid\" [(ngModel)]=\"f.options!.rich\" [disabled]=\"readOnly\">\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442</mat-checkbox> }\n @if (f.type === 'date') { <mat-checkbox [name]=\"'od' + f.uid\" [(ngModel)]=\"f.options!.datetime\" [disabled]=\"readOnly\">\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F</mat-checkbox> }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u043F\u043E\u0438\u0441\u043A\" [hidden]=\"subTab(f) !== 'list'\">\n <legend>\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u043F\u043E\u0438\u0441\u043A</legend>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'ol' + f.uid\" [(ngModel)]=\"f.options!.listColumn\" [disabled]=\"readOnly\">\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0441\u043F\u0438\u0441\u043A\u0430</mat-checkbox>\n <mat-checkbox [name]=\"'os' + f.uid\" [(ngModel)]=\"f.options!.searchable\" [disabled]=\"readOnly\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043F\u043E\u043B\u044E</mat-checkbox>\n <mat-checkbox [name]=\"'oso' + f.uid\" [(ngModel)]=\"f.options!.isSortable\" [disabled]=\"readOnly\">\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043B\u043E\u043D\u043A\u0435</mat-checkbox>\n </div>\n </fieldset>\n\n @if (!isCalculated(f) && (syncValidatorOptions(f).length || canAsyncValidate(f))) {\n <fieldset class=\"detail-group\" aria-label=\"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043F\u0440\u0438 \u0432\u0432\u043E\u0434\u0435\" [hidden]=\"subTab(f) !== 'checks'\">\n <legend>\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043F\u0440\u0438 \u0432\u0432\u043E\u0434\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B</mat-label>\n <mat-select multiple [name]=\"'fvs' + f.uid\" [ngModel]=\"selectedValidators(f)\" (ngModelChange)=\"setValidators(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B \u043F\u043E\u043B\u044F\">\n @for (o of syncValidatorOptions(f); track o.value) { <mat-option [value]=\"o.value\">{{ o.title }}</mat-option> }\n </mat-select>\n <mat-hint>\u00AB\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u00BB \u0441\u0432\u044F\u0437\u0430\u043D\u043E \u0441 \u0444\u043B\u0430\u0433\u043E\u043C \u00AB\u041E\u0431\u044F\u0437.\u00BB; \u0441\u0432\u043E\u0439 \u043A\u043E\u0434 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0432\u043A\u043B\u044E\u0447\u0430\u0435\u0442\u0441\u044F \u0444\u043B\u0430\u0433\u043E\u043C \u00AB\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u00BB.</mat-hint>\n </mat-form-field>\n @if (canAsyncValidate(f)) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u0410\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u044B\u0435 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B</mat-label>\n <mat-select multiple [name]=\"'fva' + f.uid\" [ngModel]=\"f.options!.asyncValidators || noValidators\" (ngModelChange)=\"setAsyncValidators(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0410\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u044B\u0435 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B \u043F\u043E\u043B\u044F\">\n @for (o of asyncValidatorOptions; track o.value) { <mat-option [value]=\"o.value\">{{ o.title }}</mat-option> }\n </mat-select>\n <mat-hint>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442\u0441\u044F \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043F\u043E \u0442\u0430\u0431\u043B\u0438\u0446\u0435 \u044D\u0442\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 (\u043E\u0442 3 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432). \u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043C\u043E\u0436\u043D\u043E \u043E\u0434\u0438\u043D \u0438\u0437 \u0434\u0432\u0443\u0445.</mat-hint>\n @if (err('fields[' + i + '].options.asyncValidators')) { <mat-error>{{ err('fields[' + i + '].options.asyncValidators') }}</mat-error> }\n </mat-form-field>\n }\n @if (selectedValidators(f).includes('minLength')) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"1000\" step=\"1\" [name]=\"'fml' + f.uid\" [ngModel]=\"f.options!.minLength\" (ngModelChange)=\"setOptNumber(f, 'minLength', $event)\" [disabled]=\"readOnly\" aria-label=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430\" />\n @if (err('fields[' + i + '].options.minLength')) { <mat-error>{{ err('fields[' + i + '].options.minLength') }}</mat-error> }\n </mat-form-field>\n }\n @if (selectedValidators(f).includes('pattern')) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0428\u0430\u0431\u043B\u043E\u043D (\u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435)</mat-label>\n <input matInput [name]=\"'fpt' + f.uid\" [(ngModel)]=\"f.options!.pattern\" [disabled]=\"readOnly\" maxlength=\"200\" aria-label=\"\u0428\u0430\u0431\u043B\u043E\u043D \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F (\u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435)\" />\n @if (err('fields[' + i + '].options.pattern')) { <mat-error>{{ err('fields[' + i + '].options.pattern') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u043D\u0435\u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0438</mat-label>\n <input matInput [name]=\"'fpm' + f.uid\" [(ngModel)]=\"f.options!.patternMessage\" [disabled]=\"readOnly\" maxlength=\"200\" aria-label=\"\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u043D\u0435\u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0438 \u0441 \u0448\u0430\u0431\u043B\u043E\u043D\u043E\u043C\" />\n </mat-form-field>\n }\n </div>\n </fieldset>\n }\n\n\n @if (!isCalculated(f)) {\n <fieldset class=\"detail-group\" aria-label=\"\u0425\u0440\u0430\u043D\u0435\u043D\u0438\u0435\" [hidden]=\"subTab(f) !== 'storage'\">\n <legend>\u0425\u0440\u0430\u043D\u0435\u043D\u0438\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043D\u043D\u044B\u0445</mat-label>\n <input matInput [name]=\"'fcol' + f.uid\" [ngModel]=\"f.column\" (ngModelChange)=\"setColumn(f, $event)\" [disabled]=\"readOnly\" maxlength=\"63\" [placeholder]=\"f.key || '\u043F\u043E \u043A\u043B\u044E\u0447\u0443 \u043F\u043E\u043B\u044F'\" aria-label=\"\u0418\u043C\u044F \u043A\u043E\u043B\u043E\u043D\u043A\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043D\u043D\u044B\u0445\" />\n <mat-hint>\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E \u0440\u0430\u0432\u043D\u0430 \u043A\u043B\u044E\u0447\u0443. \u0421\u043C\u0435\u043D\u0430 \u0438\u043C\u0435\u043D\u0438 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E \u043F\u043E\u043B\u044F \u043F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u0443\u0435\u0442 \u043A\u043E\u043B\u043E\u043D\u043A\u0443 (\u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0438\u0432\u043D\u043E\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435).</mat-hint>\n @if (err('fields[' + i + '].column')) { <mat-error>{{ err('fields[' + i + '].column') }}</mat-error> }\n </mat-form-field>\n </div>\n </fieldset>\n }\n\n <fieldset class=\"show-if\" aria-label=\"\u0423\u0441\u043B\u043E\u0432\u0438\u0435 \u0432\u0438\u0434\u0438\u043C\u043E\u0441\u0442\u0438\" [hidden]=\"subTab(f) !== 'cond'\">\n <legend>\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C, \u0435\u0441\u043B\u0438</legend>\n <div class=\"row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435</mat-label>\n <select matNativeControl [name]=\"'sf' + f.uid\" [ngModel]=\"f.showIf?.field || ''\" (ngModelChange)=\"setShowIfField(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0432\u0438\u0434\u0438\u043C\u043E\u0441\u0442\u0438\">\n <option value=\"\">\u0412\u0441\u0435\u0433\u0434\u0430</option>\n @for (o of otherFields(f); track o.uid) { <option [value]=\"o.key\">{{ o.title || o.key }}</option> }\n </select>\n </mat-form-field>\n @if (f.showIf) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0423\u0441\u043B\u043E\u0432\u0438\u0435</mat-label>\n <select matNativeControl [name]=\"'so' + f.uid\" [ngModel]=\"f.showIf.op || 'equals'\" (ngModelChange)=\"setShowIfOp(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\">\n @for (o of showIfOps; track o.value) { <option [value]=\"o.value\">{{ o.label }}</option> }\n </select>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>{{ f.showIf.op === 'in' ? '\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F (\u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E)' : '\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435' }}</mat-label>\n <input matInput [name]=\"'sv' + f.uid\" [ngModel]=\"showIfText(f.showIf)\" (ngModelChange)=\"setShowIfValue(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\" />\n </mat-form-field>\n }\n </div>\n @if (err('fields[' + i + '].showIf')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].showIf') }}</p> }\n </fieldset>\n </div>\n }\n </div>\n }\n @if (!fieldsOf(b.key).length) { <p class=\"muted empty-block\">{{ b.key ? '\u0412 \u0433\u0440\u0443\u043F\u043F\u0435 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442 \u043F\u043E\u043B\u0435\u0439.' : '\u041D\u0435\u0442 \u043F\u043E\u043B\u0435\u0439 \u0431\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B.' }}</p> }\n </div>\n </div>\n }\n </div>\n </section>\n\n <!-- Section settings (definition.options) -->\n @if (!readOnly) {\n <section class=\"card\" aria-labelledby=\"sec-section\" [hidden]=\"tab !== 'settings' || settingsTab === 'general'\">\n <div class=\"card-head\"><h2 id=\"sec-section\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0440\u0430\u0437\u0434\u0435\u043B\u0430</h2></div>\n <p class=\"muted\">\u041A\u0430\u043A \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A \u0432\u044B\u0433\u043B\u044F\u0434\u0438\u0442 \u0438 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \u00AB\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0438 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\u00BB: \u0442\u0435\u043A\u0441\u0442\u044B, \u0441\u043F\u0438\u0441\u043E\u043A, \u0434\u043E\u0441\u043A\u0438, \u043A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0448\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432.</p>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0422\u0435\u043A\u0441\u0442\u044B\" [hidden]=\"settingsTab !== 'view'\">\n <legend>\u0422\u0435\u043A\u0441\u0442\u044B \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0445</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0442\u0435\u043A\u0441\u0442 \u0441\u0432\u0435\u0440\u0445\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-lt\" [ngModel]=\"secVal('texts.list.topText')\" (ngModelChange)=\"setSec('texts.list.topText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043D\u0430\u0434 \u0441\u043F\u0438\u0441\u043A\u043E\u043C\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0442\u0435\u043A\u0441\u0442 \u0441\u043D\u0438\u0437\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-lb\" [ngModel]=\"secVal('texts.list.bottomText')\" (ngModelChange)=\"setSec('texts.list.bottomText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0434 \u0441\u043F\u0438\u0441\u043A\u043E\u043C\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u0442\u0435\u043A\u0441\u0442 \u0441\u0432\u0435\u0440\u0445\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-dt\" [ngModel]=\"secVal('texts.details.topText')\" (ngModelChange)=\"setSec('texts.details.topText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043D\u0430\u0434 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u043E\u0439\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u0442\u0435\u043A\u0441\u0442 \u0441\u043D\u0438\u0437\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-db\" [ngModel]=\"secVal('texts.details.bottomText')\" (ngModelChange)=\"setSec('texts.details.bottomText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0434 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u043E\u0439\"></textarea>\n </mat-form-field>\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u044B\" [hidden]=\"settingsTab !== 'list'\">\n <legend>\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u044B</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-search\" [ngModel]=\"secVal('search') !== false\" (ngModelChange)=\"setSec('search', $event)\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043F\u0438\u0441\u043A\u0443</mat-checkbox>\n <mat-checkbox name=\"sec-all\" [ngModel]=\"secVal('allItems') === true\" (ngModelChange)=\"setSec('allItems', $event ? true : undefined)\">\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 (\u0431\u0435\u0437 \u043F\u0430\u0433\u0438\u043D\u0430\u0446\u0438\u0438)</mat-checkbox>\n <mat-checkbox name=\"sec-presets\" [ngModel]=\"secOn('showpresets')\" (ngModelChange)=\"setSec('showpresets', $event ? undefined : false)\">\u0421\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B (\u043F\u0440\u0435\u0441\u0435\u0442\u044B)</mat-checkbox>\n <mat-checkbox name=\"sec-settings\" [ngModel]=\"secVal('showSettings') === true\" (ngModelChange)=\"setSec('showSettings', $event ? true : undefined)\">\u041A\u043D\u043E\u043F\u043A\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A \u0440\u0430\u0437\u0434\u0435\u043B\u0430</mat-checkbox>\n </div>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <select matNativeControl name=\"sec-order\" [ngModel]=\"secVal('orderByField') || ''\" (ngModelChange)=\"setSec('orderByField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.orderByField')) { <mat-error>{{ err('options.orderByField') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432</mat-label>\n <select matNativeControl name=\"sec-ftype\" [ngModel]=\"secVal('filteringType') || ''\" (ngModelChange)=\"setSec('filteringType', $event)\" aria-label=\"\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n <option value=\"modal\">\u0412 \u043E\u043A\u043D\u0435</option>\n <option value=\"left-block\">\u0421\u043B\u0435\u0432\u0430 \u043E\u0442 \u0441\u043F\u0438\u0441\u043A\u0430</option>\n </select>\n </mat-form-field>\n </div>\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0424\u0438\u043B\u044C\u0442\u0440\u044B \u0441\u043F\u0438\u0441\u043A\u0430 (\u0435\u0441\u043B\u0438 \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u044B, \u0441\u0442\u0440\u043E\u044F\u0442\u0441\u044F \u0438\u0437 \u043F\u043E\u043B\u0435\u0439)</span>\n <button mat-stroked-button type=\"button\" class=\"add-filtering-field-btn\" (click)=\"addFilteringField()\" [disabled]=\"filteringFields.length >= 10\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440</button>\n </div>\n @for (ff of filteringFields; track $index; let j = $index) {\n <div class=\"sub-list-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435</mat-label>\n <select matNativeControl [name]=\"'sec-ff' + j\" [(ngModel)]=\"ff.field\" aria-label=\"\u041F\u043E\u043B\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n <option value=\"id\">ID</option>\n <option value=\"isActive\">\u0410\u043A\u0442\u0438\u0432\u043D\u0430</option>\n </select>\n @if (err('options.filtering.fields[' + j + '].field')) { <mat-error>{{ err('options.filtering.fields[' + j + '].field') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'sec-fft' + j\" [(ngModel)]=\"ff.title\" maxlength=\"100\" aria-label=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0422\u0438\u043F</mat-label>\n <select matNativeControl [name]=\"'sec-fftp' + j\" [(ngModel)]=\"ff.type\" aria-label=\"\u0422\u0438\u043F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"input\">\u0422\u0435\u043A\u0441\u0442</option>\n <option value=\"between\">\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D</option>\n <option value=\"toggle\">\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C</option>\n <option value=\"select\">\u0412\u044B\u0431\u043E\u0440</option>\n </select>\n </mat-form-field>\n <button mat-icon-button type=\"button\" (click)=\"removeFilteringField(j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\"><mat-icon>delete</mat-icon></button>\n </div>\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0414\u043E\u0441\u043A\u0438\" [hidden]=\"settingsTab !== 'boards'\">\n <legend>\u0414\u043E\u0441\u043A\u0438 (Kanban)</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-boards\" [ngModel]=\"secOn('boards')\" (ngModelChange)=\"setSec('boards', $event ? undefined : false)\">\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0434\u043E\u0441\u043A\u0438</mat-checkbox>\n </div>\n @if (secOn('boards')) {\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u043A\u043E\u043B\u043E\u043D\u043E\u043A</mat-label>\n <select matNativeControl name=\"sec-kcol\" [ngModel]=\"secVal('kanbanColumnField') || ''\" (ngModelChange)=\"setSec('kanbanColumnField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0434\u043E\u0441\u043A\u0438\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.kanbanColumnField')) { <mat-error>{{ err('options.kanbanColumnField') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438</mat-label>\n <select matNativeControl name=\"sec-kfield\" [ngModel]=\"secVal('kanbanField') || ''\" (ngModelChange)=\"setSec('kanbanField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438 \u0434\u043E\u0441\u043A\u0438\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.kanbanField')) { <mat-error>{{ err('options.kanbanField') }}</mat-error> }\n </mat-form-field>\n </div>\n }\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\" [hidden]=\"settingsTab !== 'buttons'\">\n <legend>\u041A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-noview\" [ngModel]=\"secVal('actions.isNoViewAction') === true\" (ngModelChange)=\"setSec('actions.isNoViewAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430</mat-checkbox>\n <mat-checkbox name=\"sec-noedit\" [ngModel]=\"secVal('actions.isNoEditAction') === true\" (ngModelChange)=\"setSec('actions.isNoEditAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F</mat-checkbox>\n <mat-checkbox name=\"sec-nodel\" [ngModel]=\"secVal('actions.isNoDeleteAction') === true\" (ngModelChange)=\"setSec('actions.isNoDeleteAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u044F</mat-checkbox>\n <mat-checkbox name=\"sec-hadd\" [ngModel]=\"secVal('viewSettings.listMode.hideAddAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideAddAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hedit\" [ngModel]=\"secVal('viewSettings.listMode.hideEditAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideEditAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hdel\" [ngModel]=\"secVal('viewSettings.listMode.hideDeleteAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideDeleteAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0423\u0434\u0430\u043B\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hview\" [ngModel]=\"secVal('viewSettings.listMode.hideViewAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideViewAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n </div>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0443</mat-label>\n <select matNativeControl name=\"sec-dla\" [ngModel]=\"secVal('actions.defaultListAction') || ''\" (ngModelChange)=\"setSec('actions.defaultListAction', $event)\" aria-label=\"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0443 \u0441\u043F\u0438\u0441\u043A\u0430\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n <option value=\"view\">\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440</option>\n <option value=\"edit\">\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435</option>\n </select>\n </mat-form-field>\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0440\u0430\u0437\u0434\u0435\u043B\u043E\u0432\" [hidden]=\"settingsTab !== 'preload'\">\n <legend>\u041F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0440\u0430\u0437\u0434\u0435\u043B\u043E\u0432</legend>\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0420\u0430\u0437\u0434\u0435\u043B\u044B, \u0434\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044E\u0442\u0441\u044F \u0434\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0444\u043E\u0440\u043C\u044B (\u0441\u043F\u0438\u0441\u043A\u0438 \u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u0430 \u0432 \u0441\u0432\u044F\u0437\u044F\u0445). \u0421\u0432\u044F\u0437\u044C \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0432\u043E\u0439 \u0440\u0430\u0437\u0434\u0435\u043B \u0441\u0430\u043C\u0430, \u0441\u043F\u0438\u0441\u043E\u043A \u043C\u043E\u0436\u043D\u043E \u043C\u0435\u043D\u044F\u0442\u044C.</span>\n <span class=\"sub-list-actions\">\n <button mat-stroked-button type=\"button\" class=\"preload-from-relations-btn\" (click)=\"addPreloadFromRelations()\"><mat-icon>sync</mat-icon> \u0418\u0437 \u0441\u0432\u044F\u0437\u0435\u0439</button>\n <button mat-stroked-button type=\"button\" class=\"add-preload-btn\" (click)=\"addPreload()\" [disabled]=\"preloadList.length >= 30\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B</button>\n </span>\n </div>\n @if (!preloadList.length) { <p class=\"muted\">\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044F \u0437\u0430\u0440\u0430\u043D\u0435\u0435.</p> }\n @for (p of preloadList; track $index; let j = $index) {\n <div class=\"sub-list-row preload-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0437\u0434\u0435\u043B</mat-label>\n <input matInput [name]=\"'sec-pl' + j\" [ngModel]=\"p\" (ngModelChange)=\"setPreload(j, $event)\" maxlength=\"120\" placeholder=\"countries(paging:{perPage:-1})\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438\" />\n @if (err('options.preLoadSections[' + j + ']')) { <mat-error>{{ err('options.preLoadSections[' + j + ']') }}</mat-error> }\n </mat-form-field>\n <button mat-icon-button type=\"button\" (click)=\"removePreload(j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B \u0438\u0437 \u043F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438\"><mat-icon>delete</mat-icon></button>\n </div>\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432\" [hidden]=\"settingsTab !== 'view'\">\n <legend>\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12)</legend>\n <div class=\"widths\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lm\" [ngModel]=\"secVal('viewSettings.listMode.mainBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.mainBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u0441\u043F\u0438\u0441\u043A\u0430\" />\n @if (err('options.viewSettings.listMode.mainBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.mainBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0444\u0438\u043B\u044C\u0442\u0440\u044B</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lf\" [ngModel]=\"secVal('viewSettings.listMode.filterBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.filterBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432\" />\n @if (err('options.viewSettings.listMode.filterBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.filterBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u043C\u0435\u043D\u044E</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lmn\" [ngModel]=\"secVal('viewSettings.listMode.menuBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.menuBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u043C\u0435\u043D\u044E \u0441\u043F\u0438\u0441\u043A\u0430\" />\n @if (err('options.viewSettings.listMode.menuBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.menuBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-vm\" [ngModel]=\"secVal('viewSettings.viewMode.mainBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.viewMode.mainBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438\" />\n @if (err('options.viewSettings.viewMode.mainBlockCols')) { <mat-error>{{ err('options.viewSettings.viewMode.mainBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u043C\u0435\u043D\u044E</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-vmn\" [ngModel]=\"secVal('viewSettings.viewMode.menuBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.viewMode.menuBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u043C\u0435\u043D\u044E \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438\" />\n @if (err('options.viewSettings.viewMode.menuBlockCols')) { <mat-error>{{ err('options.viewSettings.viewMode.menuBlockCols') }}</mat-error> }</mat-form-field>\n </div>\n </fieldset>\n </section>\n }\n\n <!-- Actions (hooks) -->\n @if (!readOnly || hookSnippets.length || orphans.length) {\n <section class=\"card\" aria-labelledby=\"sec-code\" role=\"tabpanel\" id=\"panel-events\" [hidden]=\"tab !== 'events'\">\n <div class=\"card-head\">\n <h2 id=\"sec-code\">\u0421\u043E\u0431\u044B\u0442\u0438\u044F \u043C\u043E\u0434\u0435\u043B\u0438</h2>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"lang\">\n <mat-label>\u042F\u0437\u044B\u043A \u043A\u043E\u0434\u0430</mat-label>\n <select matNativeControl name=\"lang\" [ngModel]=\"draft.code.lang\" (ngModelChange)=\"setLang($event)\" [disabled]=\"readOnly\" aria-label=\"\u042F\u0437\u044B\u043A \u043A\u043E\u0434\u0430\">\n <option value=\"js\">JavaScript</option>\n <option value=\"ts\">TypeScript</option>\n </select>\n </mat-form-field>\n </div>\n <p class=\"muted\">\u041A\u043E\u0434 (\u0441\u043E\u0431\u044B\u0442\u0438\u044F, \u0432\u044B\u0447\u0438\u0441\u043B\u044F\u0435\u043C\u044B\u0435 \u043F\u043E\u043B\u044F \u0438 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B) \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043A\u0430\u043A \u0442\u0435\u043A\u0441\u0442 \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u0441\u0438\u043D\u0442\u0430\u043A\u0441\u0438\u0441. \u041F\u0440\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0438 \u043E\u043D \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F.</p>\n\n @if (!readOnly) {\n <div class=\"row add-snippet\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u0431\u044B\u0442\u0438\u0435</mat-label>\n <select matNativeControl name=\"nsn\" [(ngModel)]=\"newSnippet.name\" aria-label=\"\u0418\u043C\u044F \u0441\u043E\u0431\u044B\u0442\u0438\u044F\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (n of namesForNewSnippet; track n) { <option [value]=\"n\">{{ n }}</option> }\n </select>\n </mat-form-field>\n <button mat-stroked-button type=\"button\" class=\"add-snippet-btn\" (click)=\"addSnippet()\" [disabled]=\"!newSnippet.name\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u043E\u0431\u044B\u0442\u0438\u0435\n </button>\n </div>\n }\n\n @if (orphans.length) {\n <shared-ent-inline-alert tone=\"error\" class=\"orphan-alert\">\n \u041A\u043E\u0434 \u0441\u0441\u044B\u043B\u0430\u0435\u0442\u0441\u044F \u043D\u0430 \u043F\u043E\u043B\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435\u0442:\n @for (o of orphans; track snippetId(o)) { <code>{{ o.name }}</code> }\n \u0423\u0434\u0430\u043B\u0438\u0442\u0435 \u044D\u0442\u043E\u0442 \u043A\u043E\u0434 \u0438\u043B\u0438 \u0432\u0435\u0440\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u044F.\n </shared-ent-inline-alert>\n }\n\n @for (s of hookSnippets; track snippetId(s)) {\n <ng-container *ngTemplateOutlet=\"snip; context: { $implicit: s }\"></ng-container>\n }\n @if (globalDiagnostics.length) {\n <ul class=\"diag-list\" aria-label=\"\u041E\u0448\u0438\u0431\u043A\u0438 \u043A\u043E\u0434\u0430\">\n @for (d of globalDiagnostics; track $index) { <li class=\"diag\">{{ diagText(d) }}</li> }\n </ul>\n }\n @if (codeBlocked && !readOnly) {\n <p class=\"field-error code-blocked\" role=\"alert\">\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E, \u043F\u043E\u043A\u0430 \u0432 \u043A\u043E\u0434\u0435 \u0435\u0441\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438 \u0438\u043B\u0438 \u0438\u0434\u0451\u0442 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430.</p>\n }\n </section>\n }\n\n <!-- Schema log -->\n @if (!isNew && draft.id) {\n <section class=\"card\" aria-labelledby=\"sec-log\" [hidden]=\"tab !== 'events'\">\n <div class=\"card-head\">\n <h2 id=\"sec-log\">\u0416\u0443\u0440\u043D\u0430\u043B \u0441\u0445\u0435\u043C\u044B</h2>\n <button mat-stroked-button type=\"button\" class=\"load-log-btn\" (click)=\"loadSchemaLog()\" [disabled]=\"schemaLogState === 'loading'\">\n {{ schemaLogState === 'idle' ? '\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0436\u0443\u0440\u043D\u0430\u043B' : '\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C' }}\n </button>\n </div>\n @switch (schemaLogState) {\n @case ('loading') { <div class=\"state-box\" role=\"status\"><mat-spinner diameter=\"24\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0436\u0443\u0440\u043D\u0430\u043B\u0430\" /></div> }\n @case ('error') { <shared-ent-inline-alert tone=\"error\">\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0436\u0443\u0440\u043D\u0430\u043B.</shared-ent-inline-alert> }\n @case ('ready') {\n @if (!schemaLog.length) { <p class=\"muted\">\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u0441\u0445\u0435\u043C\u044B \u043F\u043E\u043A\u0430 \u043D\u0435 \u0431\u044B\u043B\u043E.</p> } @else {\n <div class=\"table-wrap\">\n <table class=\"log-table\" aria-label=\"\u0416\u0443\u0440\u043D\u0430\u043B \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u0441\u0445\u0435\u043C\u044B\">\n <thead><tr><th>\u0412\u0440\u0435\u043C\u044F</th><th>\u0412\u0435\u0440\u0441\u0438\u044F</th><th>\u041A\u043E\u043C\u0430\u043D\u0434\u0430</th><th>\u041A\u0442\u043E</th><th>\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442</th></tr></thead>\n <tbody>\n @for (l of schemaLog; track l.id) {\n <tr [class.destructive]=\"l.destructive\">\n <td>{{ l.createdAt | date: 'dd.MM.yyyy HH:mm:ss' }}</td>\n <td>{{ l.entityVersion ?? '\u2014' }}</td>\n <td><code>{{ l.statement }}</code>@if (l.destructive) { <shared-ent-status-chip tone=\"warning\">\u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0438\u0432\u043D\u043E</shared-ent-status-chip> }</td>\n <td>{{ l.actor ?? '\u2014' }}</td>\n <td>{{ l.result }}@if (l.error) { <div class=\"muted\">{{ l.error }}</div> }</td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n @if (schemaLogTotal > schemaLog.length) { <p class=\"muted\">\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u044B \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 {{ schemaLog.length }} \u0438\u0437 {{ schemaLogTotal }}.</p> }\n }\n }\n }\n </section>\n }\n }\n }\n</div>\n", styles: [".entity-form{padding:4px}.state-box{display:flex;align-items:center;gap:16px;padding:32px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}.card{background:var(--mat-sys-surface-container-low);border-radius:var(--mat-sys-corner-medium);padding:20px;margin:16px 0}.card h2{font:var(--mat-sys-title-medium);margin:0 0 12px}.card-head{margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.card-head h2{margin:0}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;align-items:start}.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.muted{color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-small)}.storage{display:flex;flex-direction:column;gap:2px}.storage .label{font:var(--mat-sys-label-small);color:var(--mat-sys-on-surface-variant)}.field-error{color:var(--mat-sys-error);font:var(--mat-sys-body-small);margin:4px 0}.group-row{margin-bottom:12px;gap:12px;flex-wrap:wrap}.group-row mat-form-field{flex:1 1 200px;min-width:0}.group-row button.add-group-field-btn{flex:0 0 auto;width:auto;min-width:0;white-space:nowrap}.fields{display:flex;flex-direction:column;gap:12px;margin-top:12px;min-height:8px}.field-blocks{display:flex;flex-direction:column;gap:20px}.field-block-head{display:flex;align-items:center;gap:12px;margin-top:8px}.field-block-head strong{font:var(--mat-sys-title-small)}.field-block-head .muted{flex:1 1 auto}.field-block-head button.add-group-field-btn{width:auto;flex:0 0 auto;white-space:nowrap}.empty-block{margin:0;padding:8px 4px}.field{display:flex;flex-direction:column;gap:8px;background:var(--mat-sys-surface);border:1px solid var(--mat-sys-outline-variant);border-radius:var(--mat-sys-corner-small);padding:12px}.field.invalid{border-color:var(--mat-sys-error)}.field-options{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:0 4px 0 36px}.field-actions{display:flex;align-items:center;flex:0 0 auto;margin-left:auto}.flags-inline{display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px}.field-main{gap:12px}.field-main .w-key{flex:1 1 140px}.field-main .w-title{flex:2 1 200px}.field-main .w-type{flex:1 1 160px}.handle{cursor:grab;color:var(--mat-sys-on-surface-variant)}.cdk-drag-preview{box-shadow:var(--mat-sys-level3, 0 4px 12px rgba(0, 0, 0, .25))}.field-details{padding:8px 4px 0;display:flex;flex-direction:column;gap:8px}.flags{display:flex;flex-wrap:wrap;gap:4px 16px}fieldset{border:1px solid var(--mat-sys-outline-variant);border-radius:var(--mat-sys-corner-small);padding:8px 12px;margin:0}fieldset legend{font:var(--mat-sys-label-medium);padding:0 4px}.detail-group{margin:0;display:flex;flex-direction:column;gap:12px;padding:12px 16px 16px}.snippet{margin:4px 0 4px 36px}.snippet-title{font:var(--mat-sys-label-large)}.diag-list{margin:6px 0 0;padding-left:20px;color:var(--mat-sys-error);font:var(--mat-sys-body-small)}.error-list{margin:6px 0 0;padding-left:20px}.lang{width:180px}.table-wrap{overflow-x:auto}.log-table{width:100%;border-collapse:collapse}.log-table th,.log-table td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--mat-sys-outline-variant);vertical-align:top}.log-table code{white-space:pre-wrap;word-break:break-word;font-size:12px}.log-table tr.destructive code{color:var(--mat-sys-error)}.hook-info{margin:6px 0 8px;padding:10px 12px;background:var(--mat-sys-surface-container);border-radius:var(--mat-sys-corner-small);font:var(--mat-sys-body-small)}.hook-title{font:var(--mat-sys-label-large);margin-bottom:6px}.hook-io{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.hook-io-head{font:var(--mat-sys-label-medium);color:var(--mat-sys-on-surface-variant);margin-bottom:2px}.hook-params{margin:0;padding-left:18px}.hook-returns{margin:0}.hook-signature{display:block;margin-top:8px;font-size:12px;color:var(--mat-sys-on-surface-variant)}.relation{margin:0 4px 0 36px;background:var(--mat-sys-surface-container);border-radius:var(--mat-sys-corner-small)}.add-snippet{margin:12px 0;gap:12px}.add-snippet mat-form-field{flex:1 1 240px;min-width:0}.add-snippet button.add-snippet-btn{flex:0 0 auto;width:auto;white-space:nowrap}.card>.muted{margin:0 0 12px}.field-details{padding:12px 4px 4px 36px;gap:12px}.flags{gap:8px 24px}.orphan-alert{display:block;margin:12px 0}.flags-inline .expand-btn{width:auto;flex:0 0 auto;white-space:nowrap}.narrow{max-width:160px;flex:0 0 160px}.wide{grid-column:1/-1}.widths .narrow{max-width:190px;flex:0 0 190px}.widths{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.widths>.muted{flex:1 0 100%}.sub-list{display:flex;flex-direction:column;gap:8px}.sub-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.sub-list-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr)) auto;gap:12px;align-items:start}.sub-list-row .field-error{grid-column:1/-1}[hidden]{display:none!important}.form-tabs{display:flex;gap:8px;border-bottom:1px solid var(--mat-sys-outline-variant);margin:20px 0 0;padding:0 8px;overflow-x:auto}.form-tab{appearance:none;background:none;border:0;border-bottom:3px solid transparent;padding:12px 20px;font:var(--mat-sys-title-small);color:var(--mat-sys-on-surface-variant);cursor:pointer;display:inline-flex;align-items:center;gap:8px;white-space:nowrap}.form-tab:hover{background:var(--mat-sys-surface-container)}.form-tab.active{color:var(--mat-sys-primary);border-bottom-color:var(--mat-sys-primary)}.form-tab:focus-visible{outline:2px solid var(--mat-sys-primary);outline-offset:-2px}.tab-badge{min-width:20px;padding:0 6px;border-radius:10px;background:var(--mat-sys-error);color:var(--mat-sys-on-error);font:var(--mat-sys-label-small);line-height:20px;text-align:center}.sub-list-actions{display:inline-flex;gap:8px;flex-wrap:wrap}.preload-row{grid-template-columns:1fr auto}.sub-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 16px;padding:0 4px;border-bottom:1px solid var(--mat-sys-outline-variant)}.settings-tabs{margin:16px 0 8px;padding:0 8px}.sub-tab{appearance:none;background:none;border:0;border-bottom:2px solid transparent;padding:10px 16px;font:var(--mat-sys-label-large);color:var(--mat-sys-on-surface-variant);cursor:pointer;display:inline-flex;align-items:center;gap:6px}.sub-tab:hover{background:var(--mat-sys-surface-container)}.sub-tab.active{color:var(--mat-sys-primary);border-bottom-color:var(--mat-sys-primary)}.sub-tab:focus-visible{outline:2px solid var(--mat-sys-primary);outline-offset:-2px}.tab-icon{font-size:18px;width:18px;height:18px;line-height:18px}.sub-tab .tab-icon{font-size:16px;width:16px;height:16px;line-height:16px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$5.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i2$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i3.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3.CdkDropListGroup, selector: "[cdkDropListGroup]", inputs: ["cdkDropListGroupDisabled"], exportAs: ["cdkDropListGroup"] }, { kind: "directive", type: i3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i1$4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i10.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "component", type: PageHeaderComponent, selector: "shared-ent-page-header", inputs: ["title", "subtitle", "icon"] }, { kind: "component", type: InlineAlertComponent, selector: "shared-ent-inline-alert", inputs: ["tone", "dismissible"], outputs: ["dismissed"] }, { kind: "component", type: EmptyStateComponent, selector: "shared-ent-empty-state", inputs: ["icon", "title", "text"] }, { kind: "component", type: StatusChipComponent, selector: "shared-ent-status-chip", inputs: ["tone", "icon"] }, { kind: "component", type: CodeEditorComponent, selector: "shared-ent-code-editor", inputs: ["value", "lang", "readOnly", "diagnostics", "ariaLabel"], outputs: ["valueChange"] }] }); }
|
|
2818
|
+
}
|
|
2819
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EntityFormComponent, decorators: [{
|
|
2820
|
+
type: Component,
|
|
2821
|
+
args: [{ selector: 'shared-entity-form', standalone: true, imports: [
|
|
2822
|
+
CommonModule,
|
|
2823
|
+
FormsModule,
|
|
2824
|
+
DragDropModule,
|
|
2825
|
+
MatButtonModule,
|
|
2826
|
+
MatCheckboxModule,
|
|
2827
|
+
MatDialogModule,
|
|
2828
|
+
MatFormFieldModule,
|
|
2829
|
+
MatIconModule,
|
|
2830
|
+
MatInputModule,
|
|
2831
|
+
MatProgressSpinnerModule,
|
|
2832
|
+
MatSelectModule,
|
|
2833
|
+
MatTooltipModule,
|
|
2834
|
+
PageHeaderComponent,
|
|
2835
|
+
InlineAlertComponent,
|
|
2836
|
+
EmptyStateComponent,
|
|
2837
|
+
StatusChipComponent,
|
|
2838
|
+
CodeEditorComponent
|
|
2839
|
+
], template: "<div class=\"entity-form\">\n <shared-ent-page-header\n [title]=\"isNew ? '\u041D\u043E\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C' : (draft.title || '\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C')\"\n [subtitle]=\"readOnly ? '\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0430 \u0432 \u043A\u043E\u0434\u0435: \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440.' : '\u041E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430: \u043F\u043E\u043B\u044F, \u0433\u0440\u0443\u043F\u043F\u044B, \u0441\u0432\u044F\u0437\u0438 \u0438 \u043A\u043E\u0434.'\"\n icon=\"database\"\n >\n <button mat-button type=\"button\" class=\"back-btn\" (click)=\"back()\" aria-label=\"\u041D\u0430\u0437\u0430\u0434 \u043A \u0441\u043F\u0438\u0441\u043A\u0443 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\">\n <mat-icon>arrow_back</mat-icon>\n \u041A \u0441\u043F\u0438\u0441\u043A\u0443\n </button>\n @if (!readOnly && state === 'ready') {\n <button mat-flat-button type=\"button\" class=\"save-btn\" (click)=\"save()\" [disabled]=\"!canSave\" aria-label=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C\">\n @if (saving) { <mat-spinner diameter=\"18\" aria-label=\"\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435\" /> } @else { <mat-icon>save</mat-icon> }\n \u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\n </button>\n }\n </shared-ent-page-header>\n\n @switch (state) {\n @case ('loading') {\n <div class=\"state-box\" role=\"status\" aria-live=\"polite\">\n <mat-spinner diameter=\"36\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n <span>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026</span>\n </div>\n }\n @case ('forbidden') {\n <shared-ent-inline-alert tone=\"error\">\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432. \u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C.</shared-ent-inline-alert>\n }\n @case ('error') {\n <shared-ent-inline-alert tone=\"error\">\n \u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C.\n <button mat-button type=\"button\" (click)=\"load()\">\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @case ('notfound') {\n <shared-ent-empty-state icon=\"search_off\" title=\"\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430\" text=\"\u0412\u043E\u0437\u043C\u043E\u0436\u043D\u043E, \u043E\u043D\u0430 \u0431\u044B\u043B\u0430 \u0443\u0434\u0430\u043B\u0435\u043D\u0430 \u0438\u043B\u0438 \u043A\u043B\u044E\u0447 \u0443\u043A\u0430\u0437\u0430\u043D \u043D\u0435\u0432\u0435\u0440\u043D\u043E.\">\n <button mat-flat-button type=\"button\" (click)=\"back()\">\u041A \u0441\u043F\u0438\u0441\u043A\u0443</button>\n </shared-ent-empty-state>\n }\n @default {\n @if (conflict) {\n <shared-ent-inline-alert tone=\"error\" class=\"conflict-alert\">\n \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0431\u044B\u043B\u0430 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430 \u0434\u0440\u0443\u0433\u0438\u043C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u043C (\u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442 \u0432\u0435\u0440\u0441\u0438\u0439). \u0412\u0430\u0448\u0438 \u043F\u0440\u0430\u0432\u043A\u0438 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435</button>\n </shared-ent-inline-alert>\n } @else if (remoteChanged) {\n <shared-ent-inline-alert tone=\"warning\" class=\"remote-alert\">\n \u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430 \u0432 \u0434\u0440\u0443\u0433\u043E\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435, \u0438\u043D\u0430\u0447\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u0437\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u0441\u044F \u043A\u043E\u043D\u0444\u043B\u0438\u043A\u0442\u043E\u043C \u0432\u0435\u0440\u0441\u0438\u0439.\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C</button>\n </shared-ent-inline-alert>\n }\n @if (activationFailed) {\n <shared-ent-inline-alert tone=\"warning\" class=\"activation-alert\">\n {{ activationHint }}\n <button mat-button type=\"button\" class=\"reload-btn\" (click)=\"load()\">\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435</button>\n </shared-ent-inline-alert>\n }\n @if (saveError && !conflict) {\n <shared-ent-inline-alert tone=\"error\" class=\"save-error\">\n {{ saveError }}\n @if (errorList.length) {\n <ul class=\"error-list\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u043E\u0448\u0438\u0431\u043E\u043A\">\n @for (e of errorList; track e.path) { <li><code>{{ e.path || '\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u0438\u0435' }}</code>: {{ e.message }}</li> }\n </ul>\n }\n </shared-ent-inline-alert>\n }\n @if (!readOnly && !draft.isActive && !isNew) {\n <shared-ent-inline-alert tone=\"warning\">\u0421\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0430: \u043E\u043D\u0430 \u0441\u043A\u0440\u044B\u0442\u0430 \u0432 \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0430\u0445 \u0438 \u0432\u044B\u0431\u043E\u0440\u0435 \u0441\u0432\u044F\u0437\u0435\u0439, \u0442\u0430\u0431\u043B\u0438\u0446\u0430 \u0438 \u0434\u0430\u043D\u043D\u044B\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.</shared-ent-inline-alert>\n }\n\n <!-- Tabs -->\n <div class=\"form-tabs\" role=\"tablist\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B\u044B \u0444\u043E\u0440\u043C\u044B\">\n @for (t of tabs; track t.id) {\n <button type=\"button\" role=\"tab\" class=\"form-tab\" [class.active]=\"tab === t.id\" [attr.aria-selected]=\"tab === t.id\" [attr.id]=\"'tab-' + t.id\" [attr.aria-controls]=\"'panel-' + t.id\" (click)=\"tab = t.id\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (tabErrors(t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n\n @if (tab === 'settings' && !readOnly) {\n <div class=\"sub-tabs settings-tabs\" role=\"tablist\" aria-label=\"\u0413\u0440\u0443\u043F\u043F\u044B \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A\">\n @for (t of settingsTabs; track t.id) {\n <button type=\"button\" role=\"tab\" class=\"sub-tab\" [class.active]=\"settingsTab === t.id\" [attr.aria-selected]=\"settingsTab === t.id\" (click)=\"settingsTab = t.id\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (settingsTabErrors(t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n }\n\n <!-- General -->\n <section class=\"card\" aria-labelledby=\"sec-general\" role=\"tabpanel\" id=\"panel-settings\" [hidden]=\"tab !== 'settings' || (!readOnly && settingsTab !== 'general')\">\n <h2 id=\"sec-general\">\u041E\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043D\u0438\u044F</h2>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput name=\"title\" [(ngModel)]=\"draft.title\" [disabled]=\"readOnly\" maxlength=\"200\" required aria-label=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n @if (err('title')) { <mat-error>{{ err('title') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043B\u044E\u0447</mat-label>\n <input matInput name=\"key\" [(ngModel)]=\"draft.key\" [disabled]=\"!isNew\" maxlength=\"41\" required aria-label=\"\u041A\u043B\u044E\u0447 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 (\u043D\u0435\u043B\u044C\u0437\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0441\u043B\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F)\" />\n <mat-hint>{{ isNew ? '\u041D\u0435\u043B\u044C\u0437\u044F \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0441\u043B\u0435 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F' : '\u041D\u0435 \u0438\u0437\u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F' }}</mat-hint>\n </mat-form-field>\n <div class=\"storage\">\n <span class=\"label\">\u0425\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435</span>\n <span class=\"storage-value\">\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0442\u0430\u0431\u043B\u0438\u0446\u0430</span>\n @if (tableName(draft.key)) { <code class=\"muted\">{{ tableName(draft.key) }}</code> }\n </div>\n </div>\n @if (err('key')) { <p class=\"field-error\" role=\"alert\">{{ err('key') }}</p> }\n </section>\n\n <!-- Groups -->\n <section class=\"card\" aria-labelledby=\"sec-groups\" [hidden]=\"tab !== 'fields'\">\n <div class=\"card-head\">\n <h2 id=\"sec-groups\">\u0413\u0440\u0443\u043F\u043F\u044B \u043F\u043E\u043B\u0435\u0439</h2>\n @if (!readOnly) {\n <button mat-stroked-button type=\"button\" class=\"add-group-btn\" (click)=\"addGroup()\" [disabled]=\"draft.groups.length >= maxGroups\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443\n </button>\n }\n </div>\n @if (!draft.groups.length) { <p class=\"muted\">\u0413\u0440\u0443\u043F\u043F \u043D\u0435\u0442: \u0432\u0441\u0435 \u043F\u043E\u043B\u044F \u0432\u044B\u0432\u043E\u0434\u044F\u0442\u0441\u044F \u0432 \u043E\u0434\u043D\u043E\u043C \u0431\u043B\u043E\u043A\u0435.</p> }\n @for (g of draft.groups; track $index; let i = $index) {\n <div class=\"row group-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043B\u044E\u0447 \u0433\u0440\u0443\u043F\u043F\u044B</mat-label>\n <input matInput [name]=\"'gk' + i\" [ngModel]=\"g.key\" (ngModelChange)=\"onGroupKeyChange(g, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041A\u043B\u044E\u0447 \u0433\u0440\u0443\u043F\u043F\u044B ' + (i + 1)\" />\n @if (err('groups[' + i + '].key')) { <mat-error>{{ err('groups[' + i + '].key') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B</mat-label>\n <input matInput [name]=\"'gt' + i\" [(ngModel)]=\"g.title\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B ' + (i + 1)\" />\n @if (err('groups[' + i + '].title')) { <mat-error>{{ err('groups[' + i + '].title') }}</mat-error> }\n </mat-form-field>\n @if (!readOnly) {\n <button mat-icon-button type=\"button\" (click)=\"moveGroup(i, -1)\" [disabled]=\"i === 0\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 \u0432\u044B\u0448\u0435\"><mat-icon>arrow_upward</mat-icon></button>\n <button mat-icon-button type=\"button\" (click)=\"moveGroup(i, 1)\" [disabled]=\"i === draft.groups.length - 1\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 \u043D\u0438\u0436\u0435\"><mat-icon>arrow_downward</mat-icon></button>\n <button mat-icon-button type=\"button\" class=\"remove-group-btn\" (click)=\"removeGroup(i)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n }\n </section>\n\n <!-- one code editor (field-level calculated/validator or an action) -->\n <ng-template #snip let-s>\n <div class=\"snippet\" [attr.data-snippet]=\"snippetId(s)\">\n <div class=\"row\">\n <strong class=\"snippet-title\">{{ snippetLabel(s) }}</strong>\n @if (pendingChecks.has(snippetId(s))) { <span class=\"muted\" role=\"status\">\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430\u2026</span> }\n @if (!readOnly && s.kind === 'hooks') {\n <button mat-icon-button type=\"button\" class=\"remove-snippet-btn\" (click)=\"removeSnippet(s)\" [attr.aria-label]=\"'\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u043E\u0434 ' + snippetLabel(s)\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n @if (codeMeta(s); as m) {\n <div class=\"hook-info\">\n <div class=\"hook-title\">{{ m.title }}</div>\n <div class=\"hook-io\">\n <div>\n <div class=\"hook-io-head\">\u0412\u0445\u043E\u0434\u043D\u044B\u0435 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B</div>\n <ul class=\"hook-params\">\n @for (p of m.params; track p.name) { <li><code>{{ p.name }}</code> \u2014 {{ p.description }}</li> }\n </ul>\n </div>\n <div>\n <div class=\"hook-io-head\">\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442</div>\n <p class=\"hook-returns\">{{ m.returns }}</p>\n </div>\n </div>\n <code class=\"hook-signature\">{{ snippetSignature(s) }}</code>\n </div>\n }\n <shared-ent-code-editor [value]=\"snippetValue(s)\" [lang]=\"draft.code.lang\" [readOnly]=\"readOnly\" [diagnostics]=\"diagFor(s)\" [ariaLabel]=\"'\u041A\u043E\u0434: ' + snippetLabel(s)\" (valueChange)=\"onSnippetChange(s, $event)\" />\n @if (diagFor(s).length) {\n <ul class=\"diag-list\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043A\u0438 \u043A\u043E\u0434\u0430: ' + snippetLabel(s)\">\n @for (d of diagFor(s); track $index) { <li class=\"diag\">{{ diagText(d) }}</li> }\n </ul>\n }\n </div>\n </ng-template>\n\n <!-- Fields -->\n <section class=\"card\" aria-labelledby=\"sec-fields\" role=\"tabpanel\" id=\"panel-fields\" [hidden]=\"tab !== 'fields'\">\n <div class=\"card-head\">\n <h2 id=\"sec-fields\">\u041F\u043E\u043B\u044F ({{ draft.fields.length }})</h2>\n @if (!readOnly) {\n <button mat-stroked-button type=\"button\" class=\"add-field-btn\" (click)=\"addField()\" [disabled]=\"draft.fields.length >= maxFields\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435\n </button>\n }\n </div>\n @if (err('fields')) { <p class=\"field-error\" role=\"alert\">{{ err('fields') }}</p> }\n <div cdkDropListGroup class=\"field-blocks\">\n @for (b of fieldBlocks; track $index) {\n <div class=\"field-block\" [attr.data-group]=\"b.key\">\n @if (b.header) {\n <div class=\"field-block-head\">\n <strong>{{ b.title }}</strong>\n <span class=\"muted\">({{ fieldsOf(b.key).length }})</span>\n @if (!readOnly && b.key) {\n <button mat-stroked-button type=\"button\" class=\"add-group-field-btn\" (click)=\"addFieldToGroup(b.key)\" [disabled]=\"draft.fields.length >= maxFields\" [attr.aria-label]=\"'\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432 \u0433\u0440\u0443\u043F\u043F\u0443 ' + b.title\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432 \u0433\u0440\u0443\u043F\u043F\u0443\n </button>\n <button mat-icon-button type=\"button\" class=\"remove-group-block-btn\" (click)=\"removeGroupByKey(b.key)\" [attr.aria-label]=\"'\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0433\u0440\u0443\u043F\u043F\u0443 ' + b.title\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n }\n <div cdkDropList [cdkDropListData]=\"b.key\" [cdkDropListDisabled]=\"readOnly\" (cdkDropListDropped)=\"dropField($event)\" class=\"fields\" role=\"list\" [attr.aria-label]=\"'\u041F\u043E\u043B\u044F: ' + b.title\">\n @for (f of fieldsOf(b.key); track f.uid) {\n @let i = draft.fields.indexOf(f);\n <div class=\"field\" cdkDrag [cdkDragData]=\"f\" role=\"listitem\" [class.invalid]=\"err('fields[' + i + '].key') || err('fields[' + i + '].title')\">\n <div class=\"row field-main\">\n @if (!readOnly) {\n <mat-icon cdkDragHandle class=\"handle\" aria-hidden=\"true\">drag_indicator</mat-icon>\n }\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-key\">\n <mat-label>\u041A\u043B\u044E\u0447</mat-label>\n <input matInput [name]=\"'fk' + f.uid\" [ngModel]=\"f.key\" (ngModelChange)=\"onKeyChange(f, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041A\u043B\u044E\u0447 \u043F\u043E\u043B\u044F ' + (i + 1)\" />\n @if (err('fields[' + i + '].key')) { <mat-error>{{ err('fields[' + i + '].key') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-title\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'ft' + f.uid\" [(ngModel)]=\"f.title\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044F ' + (i + 1)\" />\n @if (err('fields[' + i + '].title')) { <mat-error>{{ err('fields[' + i + '].title') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"w-type\">\n <mat-label>\u0422\u0438\u043F</mat-label>\n <select matNativeControl [name]=\"'fy' + f.uid\" [ngModel]=\"typeValue(f)\" (ngModelChange)=\"onTypeSelect(f, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u0422\u0438\u043F \u043F\u043E\u043B\u044F ' + (i + 1)\">\n @for (t of fieldTypes; track t.value) { <option [value]=\"t.value\">{{ t.label }}</option> }\n <option [value]=\"calcType\" [disabled]=\"!f.key\">\u0412\u044B\u0447\u0438\u0441\u043B\u044F\u0435\u043C\u043E\u0435</option>\n </select>\n </mat-form-field>\n </div>\n <div class=\"row field-options\">\n <div class=\"flags-inline\">\n <mat-checkbox [name]=\"'fr' + f.uid\" [(ngModel)]=\"f.required\" [disabled]=\"readOnly || isCalculated(f)\" [attr.aria-label]=\"'\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435 ' + (i + 1)\">\u041E\u0431\u044F\u0437.</mat-checkbox>\n <mat-checkbox [name]=\"'fu' + f.uid\" [(ngModel)]=\"f.unique\" [disabled]=\"readOnly || isCalculated(f) || ['json', 'select-many', 'string-list'].includes($any(f.type)) || isRel($any(f.type))\" [attr.aria-label]=\"'\u0423\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435 ' + (i + 1)\">\u0423\u043D\u0438\u043A.</mat-checkbox>\n <mat-checkbox [name]=\"'fv' + f.uid\" [ngModel]=\"hasValidator(f)\" (ngModelChange)=\"toggleValidator(f, $event)\" [disabled]=\"readOnly || !f.key || isCalculated(f)\" [attr.aria-label]=\"'\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440 \u043F\u043E\u043B\u044F ' + (i + 1)\">\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440</mat-checkbox>\n <button mat-button type=\"button\" class=\"expand-btn\" (click)=\"toggleExpand(f)\" [attr.aria-expanded]=\"expanded.has(f.uid)\" [attr.aria-label]=\"'\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043F\u043E\u043B\u044F ' + (i + 1)\">\n \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B <mat-icon iconPositionEnd>{{ expanded.has(f.uid) ? 'expand_less' : 'expand_more' }}</mat-icon>\n </button>\n </div>\n <div class=\"field-actions\">\n @if (!readOnly) {\n <button mat-icon-button type=\"button\" (click)=\"moveField(i, -1)\" [disabled]=\"isFirstInBlock(f)\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u0432\u044B\u0448\u0435\"><mat-icon>arrow_upward</mat-icon></button>\n <button mat-icon-button type=\"button\" (click)=\"moveField(i, 1)\" [disabled]=\"isLastInBlock(f)\" aria-label=\"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435\"><mat-icon>arrow_downward</mat-icon></button>\n <button mat-icon-button type=\"button\" class=\"remove-field-btn\" (click)=\"removeField(i)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043F\u043E\u043B\u0435\"><mat-icon>delete</mat-icon></button>\n }\n </div>\n </div>\n\n @for (s of fieldSnippets(f); track snippetId(s)) {\n <ng-container *ngTemplateOutlet=\"snip; context: { $implicit: s }\"></ng-container>\n }\n @if (err('fields[' + i + '].code')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].code') }}</p> }\n\n @if (isRel($any(f.type)) && f.relation) {\n <fieldset class=\"relation\" aria-label=\"\u0421\u0432\u044F\u0437\u044C\">\n <legend>\u0421\u0432\u044F\u0437\u044C ({{ f.type === 'select-one' ? '\u043E\u0434\u0438\u043D' : '\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E' }})</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0426\u0435\u043B\u0435\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C</mat-label>\n <select matNativeControl [name]=\"'rt' + f.uid\" [ngModel]=\"f.relation.target\" (ngModelChange)=\"setRelationTarget(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0426\u0435\u043B\u0435\u0432\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u0441\u0432\u044F\u0437\u0438\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (t of targets; track t.key) { <option [value]=\"t.key\">{{ t.title }} ({{ t.source === 'ui' ? 'UI' : '\u043A\u043E\u0434' }})</option> }\n </select>\n @if (err('fields[' + i + '].relation.target')) { <mat-error>{{ err('fields[' + i + '].relation.target') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435</mat-label>\n @if (targetFieldKeys(f).length) {\n <select matNativeControl [name]=\"'rd' + f.uid\" [(ngModel)]=\"f.relation.displayField\" [disabled]=\"readOnly\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435 \u0441\u0432\u044F\u0437\u0438\">\n <option [ngValue]=\"undefined\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n @for (k of targetFieldKeys(f); track k) { <option [value]=\"k\">{{ k }}</option> }\n </select>\n } @else {\n <input matInput [name]=\"'rd' + f.uid\" [(ngModel)]=\"f.relation.displayField\" [disabled]=\"readOnly\" placeholder=\"name\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0435\u043C\u043E\u0435 \u043F\u043E\u043B\u0435 \u0441\u0432\u044F\u0437\u0438\" />\n }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0424\u0438\u043B\u044C\u0442\u0440: \u043F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438</mat-label>\n <input matInput [name]=\"'rff' + f.uid\" [ngModel]=\"f.relation.filter?.field\" (ngModelChange)=\"setRelationFilter(f, { field: $event })\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0424\u0438\u043B\u044C\u0442\u0440: \u043F\u043E \u043F\u043E\u043B\u044E</mat-label>\n <select matNativeControl [name]=\"'rfb' + f.uid\" [ngModel]=\"f.relation.filter?.byField || ''\" (ngModelChange)=\"setRelationFilter(f, { byField: $event })\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u044D\u0442\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 \u0434\u043B\u044F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"\">\u0411\u0435\u0437 \u0444\u0438\u043B\u044C\u0442\u0440\u0430</option>\n @for (o of otherFields(f); track o.uid) { <option [value]=\"o.key\">{{ o.title || o.key }}</option> }\n </select>\n </mat-form-field>\n </div>\n <mat-checkbox [name]=\"'ra' + f.uid\" [(ngModel)]=\"f.relation.activeOnly\" [disabled]=\"readOnly\">\u0422\u043E\u043B\u044C\u043A\u043E \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438</mat-checkbox>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'rsa' + f.uid\" [(ngModel)]=\"f.options!.selectShowAllOptions\" [disabled]=\"readOnly\">\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B</mat-checkbox>\n <mat-checkbox [name]=\"'ris' + f.uid\" [(ngModel)]=\"f.options!.innerSearch\" [disabled]=\"readOnly\">\u041F\u043E\u0438\u0441\u043A \u0432\u043D\u0443\u0442\u0440\u0438 \u0441\u043F\u0438\u0441\u043A\u0430</mat-checkbox>\n <mat-checkbox [name]=\"'rlz' + f.uid\" [(ngModel)]=\"f.options!.lazyLoading\" [disabled]=\"readOnly\">\u041F\u043E\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044C \u043F\u0440\u0438 \u043F\u043E\u0438\u0441\u043A\u0435</mat-checkbox>\n </div>\n @if (f.options!.lazyLoading) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\">\n <mat-label>\u041C\u0438\u043D\u0438\u043C\u0443\u043C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"10\" step=\"1\" [name]=\"'rms' + f.uid\" [ngModel]=\"f.options!.minSearchLength\" (ngModelChange)=\"setOptNumber(f, 'minSearchLength', $event)\" [disabled]=\"readOnly\" aria-label=\"\u041C\u0438\u043D\u0438\u043C\u0443\u043C \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432 \u0434\u043B\u044F \u043F\u043E\u0438\u0441\u043A\u0430\" />\n @if (err('fields[' + i + '].options.minSearchLength')) { <mat-error>{{ err('fields[' + i + '].options.minSearchLength') }}</mat-error> }\n </mat-form-field>\n }\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0424\u0438\u043B\u044C\u0442\u0440 \u0441\u043F\u0438\u0441\u043A\u0430 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u043E\u0432 (\u043F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438 = \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435)</span>\n @if (!readOnly) { <button mat-stroked-button type=\"button\" class=\"add-filter-option-btn\" (click)=\"addFilterOption(f)\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C</button> }\n </div>\n @for (fo of f.options!.filterOptions || []; track $index; let j = $index) {\n <div class=\"sub-list-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0438</mat-label>\n <input matInput [name]=\"'rfof' + f.uid + j\" [(ngModel)]=\"fo.field\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'rfov' + f.uid + j\" [ngModel]=\"fo.value\" (ngModelChange)=\"setFilterValue(fo, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n @if (!readOnly) { <button mat-icon-button type=\"button\" (click)=\"removeFilterOption(f, j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0443\u0441\u043B\u043E\u0432\u0438\u0435\"><mat-icon>delete</mat-icon></button> }\n @if (err('fields[' + i + '].options.filterOptions[' + j + ']')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].options.filterOptions[' + j + ']') }}</p> }\n </div>\n }\n </div>\n </fieldset>\n }\n\n @if (expanded.has(f.uid)) {\n <div class=\"field-details\">\n <div class=\"sub-tabs\" role=\"tablist\" [attr.aria-label]=\"'\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043F\u043E\u043B\u044F ' + (i + 1)\">\n @for (t of fieldTabs(f); track t.id) {\n <button type=\"button\" role=\"tab\" class=\"sub-tab\" [class.active]=\"subTab(f) === t.id\" [attr.aria-selected]=\"subTab(f) === t.id\" (click)=\"setSubTab(f, t.id)\">\n <mat-icon class=\"tab-icon\" aria-hidden=\"true\">{{ t.icon }}</mat-icon>\n {{ t.title }}\n @if (subTabErrors(i, t.id); as n) { <span class=\"tab-badge\" role=\"status\" [attr.aria-label]=\"'\u041E\u0448\u0438\u0431\u043E\u043A: ' + n\">{{ n }}</span> }\n </button>\n }\n </div>\n <fieldset class=\"detail-group\" aria-label=\"\u041E\u0431\u0449\u0435\u0435\" [hidden]=\"subTab(f) !== 'general'\">\n <legend>\u041E\u0431\u0449\u0435\u0435</legend>\n <div class=\"grid\">\n @if (draft.groups.length) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0413\u0440\u0443\u043F\u043F\u0430 (\u043D\u0435\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E)</mat-label>\n <select matNativeControl [name]=\"'fg' + f.uid\" [(ngModel)]=\"f.group\" [disabled]=\"readOnly\" aria-label=\"\u0413\u0440\u0443\u043F\u043F\u0430 \u043F\u043E\u043B\u044F\">\n <option [ngValue]=\"undefined\">\u0411\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B</option>\n @for (g of draft.groups; track g.key) { <option [value]=\"g.key\">{{ g.title || g.key }}</option> }\n </select>\n </mat-form-field>\n }\n @if (!isRel($any(f.type)) && !isCalculated(f)) {\n @if (f.type === 'boolean') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <select matNativeControl [name]=\"'fd' + f.uid\" [ngModel]=\"defaultText(f.default)\" (ngModelChange)=\"setDefault(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n <option value=\"true\">\u0414\u0430</option>\n <option value=\"false\">\u041D\u0435\u0442</option>\n </select>\n </mat-form-field>\n } @else {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <input matInput [name]=\"'fd' + f.uid\" [ngModel]=\"defaultText(f.default)\" (ngModelChange)=\"setDefault(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\" />\n </mat-form-field>\n }\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432 \u0444\u043E\u0440\u043C\u0435\" [hidden]=\"subTab(f) !== 'display'\">\n <legend>\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0432 \u0444\u043E\u0440\u043C\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 (\u043F\u043E\u0434 \u043F\u043E\u043B\u0435\u043C)</mat-label>\n <textarea matInput rows=\"2\" [name]=\"'fdesc' + f.uid\" [(ngModel)]=\"f.options!.description\" [disabled]=\"readOnly\" maxlength=\"500\" aria-label=\"\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u043F\u043E\u043B\u044F\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430</mat-label>\n <input matInput [name]=\"'fh' + f.uid\" [(ngModel)]=\"f.options!.hint\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0430 \u043F\u043E\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440</mat-label>\n <input matInput [name]=\"'fp' + f.uid\" [(ngModel)]=\"f.options!.placeholder\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440 \u043F\u043E\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0428\u0438\u0440\u0438\u043D\u0430 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12)</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" [name]=\"'fc' + f.uid\" [ngModel]=\"f.options!.col\" (ngModelChange)=\"setCol(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043F\u043E\u043B\u044F \u0432 \u0444\u043E\u0440\u043C\u0435, \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12\" />\n @if (err('fields[' + i + '].options.col')) { <mat-error>{{ err('fields[' + i + '].options.col') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u0440\u0438\u043C\u0435\u0440 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F</mat-label>\n <input matInput [name]=\"'fex' + f.uid\" [(ngModel)]=\"f.options!.example\" [disabled]=\"readOnly\" maxlength=\"300\" aria-label=\"\u041F\u0440\u0438\u043C\u0435\u0440 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F\" />\n </mat-form-field>\n @if (f.type === 'boolean') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u00AB\u0432\u043A\u043B\u044E\u0447\u0435\u043D\u043E\u00BB</mat-label>\n <input matInput [name]=\"'ftt' + f.uid\" [(ngModel)]=\"f.options!.trueTitle\" [disabled]=\"readOnly\" maxlength=\"100\" aria-label=\"\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0432\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044F\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u00AB\u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D\u043E\u00BB</mat-label>\n <input matInput [name]=\"'ffl' + f.uid\" [(ngModel)]=\"f.options!.falseTitle\" [disabled]=\"readOnly\" maxlength=\"100\" aria-label=\"\u041F\u043E\u0434\u043F\u0438\u0441\u044C \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u043E\u0433\u043E \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044F\" />\n </mat-form-field>\n }\n @if (f.type === 'string-list') {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C</mat-label>\n <input matInput [name]=\"'fs' + f.uid\" [(ngModel)]=\"f.options!.separator\" [disabled]=\"readOnly\" maxlength=\"3\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C \u0441\u043F\u0438\u0441\u043A\u0430\" />\n </mat-form-field>\n }\n </div>\n <div class=\"widths\">\n <span class=\"muted\">\u0428\u0438\u0440\u0438\u043D\u0430 \u043F\u043E \u0440\u0430\u0437\u043C\u0435\u0440\u0430\u043C \u044D\u043A\u0440\u0430\u043D\u0430 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12):</span>\n @for (w of widthKeys; track w.key) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\">\n <mat-label>{{ w.label }}</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" [name]=\"'fw' + w.key + f.uid\" [ngModel]=\"$any(f.options)[w.key]\" (ngModelChange)=\"setWidth(f, w.key, $event)\" [disabled]=\"readOnly\" [attr.aria-label]=\"'\u0428\u0438\u0440\u0438\u043D\u0430 ' + w.label + ', \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12'\" />\n @if (err('fields[' + i + '].options.' + w.key)) { <mat-error>{{ err('fields[' + i + '].options.' + w.key) }}</mat-error> }\n </mat-form-field>\n }\n </div>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'oh' + f.uid\" [(ngModel)]=\"f.options!.hidden\" [disabled]=\"readOnly\">\u0421\u043A\u0440\u044B\u0442\u043E\u0435</mat-checkbox>\n <mat-checkbox [name]=\"'on' + f.uid\" [(ngModel)]=\"f.options!.notEditable\" [disabled]=\"readOnly\">\u041D\u0435 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044F</mat-checkbox>\n @if (f.type === 'text') { <mat-checkbox [name]=\"'or' + f.uid\" [(ngModel)]=\"f.options!.rich\" [disabled]=\"readOnly\">\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0442\u0435\u043A\u0441\u0442</mat-checkbox> }\n @if (f.type === 'date') { <mat-checkbox [name]=\"'od' + f.uid\" [(ngModel)]=\"f.options!.datetime\" [disabled]=\"readOnly\">\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F</mat-checkbox> }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u043F\u043E\u0438\u0441\u043A\" [hidden]=\"subTab(f) !== 'list'\">\n <legend>\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u043F\u043E\u0438\u0441\u043A</legend>\n <div class=\"flags\">\n <mat-checkbox [name]=\"'ol' + f.uid\" [(ngModel)]=\"f.options!.listColumn\" [disabled]=\"readOnly\">\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0441\u043F\u0438\u0441\u043A\u0430</mat-checkbox>\n <mat-checkbox [name]=\"'os' + f.uid\" [(ngModel)]=\"f.options!.searchable\" [disabled]=\"readOnly\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043F\u043E\u043B\u044E</mat-checkbox>\n <mat-checkbox [name]=\"'oso' + f.uid\" [(ngModel)]=\"f.options!.isSortable\" [disabled]=\"readOnly\">\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u043F\u043E \u043A\u043E\u043B\u043E\u043D\u043A\u0435</mat-checkbox>\n </div>\n </fieldset>\n\n @if (!isCalculated(f) && (syncValidatorOptions(f).length || canAsyncValidate(f))) {\n <fieldset class=\"detail-group\" aria-label=\"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043F\u0440\u0438 \u0432\u0432\u043E\u0434\u0435\" [hidden]=\"subTab(f) !== 'checks'\">\n <legend>\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043F\u0440\u0438 \u0432\u0432\u043E\u0434\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B</mat-label>\n <mat-select multiple [name]=\"'fvs' + f.uid\" [ngModel]=\"selectedValidators(f)\" (ngModelChange)=\"setValidators(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B \u043F\u043E\u043B\u044F\">\n @for (o of syncValidatorOptions(f); track o.value) { <mat-option [value]=\"o.value\">{{ o.title }}</mat-option> }\n </mat-select>\n <mat-hint>\u00AB\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435\u00BB \u0441\u0432\u044F\u0437\u0430\u043D\u043E \u0441 \u0444\u043B\u0430\u0433\u043E\u043C \u00AB\u041E\u0431\u044F\u0437.\u00BB; \u0441\u0432\u043E\u0439 \u043A\u043E\u0434 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0432\u043A\u043B\u044E\u0447\u0430\u0435\u0442\u0441\u044F \u0444\u043B\u0430\u0433\u043E\u043C \u00AB\u0412\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u00BB.</mat-hint>\n </mat-form-field>\n @if (canAsyncValidate(f)) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"wide\">\n <mat-label>\u0410\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u044B\u0435 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B</mat-label>\n <mat-select multiple [name]=\"'fva' + f.uid\" [ngModel]=\"f.options!.asyncValidators || noValidators\" (ngModelChange)=\"setAsyncValidators(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0410\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u044B\u0435 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B \u043F\u043E\u043B\u044F\">\n @for (o of asyncValidatorOptions; track o.value) { <mat-option [value]=\"o.value\">{{ o.title }}</mat-option> }\n </mat-select>\n <mat-hint>\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442\u0441\u044F \u043D\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043F\u043E \u0442\u0430\u0431\u043B\u0438\u0446\u0435 \u044D\u0442\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438 (\u043E\u0442 3 \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432). \u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043C\u043E\u0436\u043D\u043E \u043E\u0434\u0438\u043D \u0438\u0437 \u0434\u0432\u0443\u0445.</mat-hint>\n @if (err('fields[' + i + '].options.asyncValidators')) { <mat-error>{{ err('fields[' + i + '].options.asyncValidators') }}</mat-error> }\n </mat-form-field>\n }\n @if (selectedValidators(f).includes('minLength')) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"1000\" step=\"1\" [name]=\"'fml' + f.uid\" [ngModel]=\"f.options!.minLength\" (ngModelChange)=\"setOptNumber(f, 'minLength', $event)\" [disabled]=\"readOnly\" aria-label=\"\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0434\u043B\u0438\u043D\u0430\" />\n @if (err('fields[' + i + '].options.minLength')) { <mat-error>{{ err('fields[' + i + '].options.minLength') }}</mat-error> }\n </mat-form-field>\n }\n @if (selectedValidators(f).includes('pattern')) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0428\u0430\u0431\u043B\u043E\u043D (\u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435)</mat-label>\n <input matInput [name]=\"'fpt' + f.uid\" [(ngModel)]=\"f.options!.pattern\" [disabled]=\"readOnly\" maxlength=\"200\" aria-label=\"\u0428\u0430\u0431\u043B\u043E\u043D \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F (\u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E\u0435 \u0432\u044B\u0440\u0430\u0436\u0435\u043D\u0438\u0435)\" />\n @if (err('fields[' + i + '].options.pattern')) { <mat-error>{{ err('fields[' + i + '].options.pattern') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u043D\u0435\u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0438</mat-label>\n <input matInput [name]=\"'fpm' + f.uid\" [(ngModel)]=\"f.options!.patternMessage\" [disabled]=\"readOnly\" maxlength=\"200\" aria-label=\"\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435 \u043F\u0440\u0438 \u043D\u0435\u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0438 \u0441 \u0448\u0430\u0431\u043B\u043E\u043D\u043E\u043C\" />\n </mat-form-field>\n }\n </div>\n </fieldset>\n }\n\n\n @if (!isCalculated(f)) {\n <fieldset class=\"detail-group\" aria-label=\"\u0425\u0440\u0430\u043D\u0435\u043D\u0438\u0435\" [hidden]=\"subTab(f) !== 'storage'\">\n <legend>\u0425\u0440\u0430\u043D\u0435\u043D\u0438\u0435</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u043E\u043B\u043E\u043D\u043A\u0430 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043D\u043D\u044B\u0445</mat-label>\n <input matInput [name]=\"'fcol' + f.uid\" [ngModel]=\"f.column\" (ngModelChange)=\"setColumn(f, $event)\" [disabled]=\"readOnly\" maxlength=\"63\" [placeholder]=\"f.key || '\u043F\u043E \u043A\u043B\u044E\u0447\u0443 \u043F\u043E\u043B\u044F'\" aria-label=\"\u0418\u043C\u044F \u043A\u043E\u043B\u043E\u043D\u043A\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043D\u043D\u044B\u0445\" />\n <mat-hint>\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E \u0440\u0430\u0432\u043D\u0430 \u043A\u043B\u044E\u0447\u0443. \u0421\u043C\u0435\u043D\u0430 \u0438\u043C\u0435\u043D\u0438 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0435\u0433\u043E \u043F\u043E\u043B\u044F \u043F\u0435\u0440\u0435\u0438\u043C\u0435\u043D\u0443\u0435\u0442 \u043A\u043E\u043B\u043E\u043D\u043A\u0443 (\u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0438\u0432\u043D\u043E\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435).</mat-hint>\n @if (err('fields[' + i + '].column')) { <mat-error>{{ err('fields[' + i + '].column') }}</mat-error> }\n </mat-form-field>\n </div>\n </fieldset>\n }\n\n <fieldset class=\"show-if\" aria-label=\"\u0423\u0441\u043B\u043E\u0432\u0438\u0435 \u0432\u0438\u0434\u0438\u043C\u043E\u0441\u0442\u0438\" [hidden]=\"subTab(f) !== 'cond'\">\n <legend>\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C, \u0435\u0441\u043B\u0438</legend>\n <div class=\"row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435</mat-label>\n <select matNativeControl [name]=\"'sf' + f.uid\" [ngModel]=\"f.showIf?.field || ''\" (ngModelChange)=\"setShowIfField(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u041F\u043E\u043B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u0432\u0438\u0434\u0438\u043C\u043E\u0441\u0442\u0438\">\n <option value=\"\">\u0412\u0441\u0435\u0433\u0434\u0430</option>\n @for (o of otherFields(f); track o.uid) { <option [value]=\"o.key\">{{ o.title || o.key }}</option> }\n </select>\n </mat-form-field>\n @if (f.showIf) {\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0423\u0441\u043B\u043E\u0432\u0438\u0435</mat-label>\n <select matNativeControl [name]=\"'so' + f.uid\" [ngModel]=\"f.showIf.op || 'equals'\" (ngModelChange)=\"setShowIfOp(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u041E\u043F\u0435\u0440\u0430\u0442\u043E\u0440 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\">\n @for (o of showIfOps; track o.value) { <option [value]=\"o.value\">{{ o.label }}</option> }\n </select>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>{{ f.showIf.op === 'in' ? '\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F (\u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043F\u044F\u0442\u0443\u044E)' : '\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435' }}</mat-label>\n <input matInput [name]=\"'sv' + f.uid\" [ngModel]=\"showIfText(f.showIf)\" (ngModelChange)=\"setShowIfValue(f, $event)\" [disabled]=\"readOnly\" aria-label=\"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F\" />\n </mat-form-field>\n }\n </div>\n @if (err('fields[' + i + '].showIf')) { <p class=\"field-error\" role=\"alert\">{{ err('fields[' + i + '].showIf') }}</p> }\n </fieldset>\n </div>\n }\n </div>\n }\n @if (!fieldsOf(b.key).length) { <p class=\"muted empty-block\">{{ b.key ? '\u0412 \u0433\u0440\u0443\u043F\u043F\u0435 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442 \u043F\u043E\u043B\u0435\u0439.' : '\u041D\u0435\u0442 \u043F\u043E\u043B\u0435\u0439 \u0431\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B.' }}</p> }\n </div>\n </div>\n }\n </div>\n </section>\n\n <!-- Section settings (definition.options) -->\n @if (!readOnly) {\n <section class=\"card\" aria-labelledby=\"sec-section\" [hidden]=\"tab !== 'settings' || settingsTab === 'general'\">\n <div class=\"card-head\"><h2 id=\"sec-section\">\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0440\u0430\u0437\u0434\u0435\u043B\u0430</h2></div>\n <p class=\"muted\">\u041A\u0430\u043A \u0441\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A \u0432\u044B\u0433\u043B\u044F\u0434\u0438\u0442 \u0438 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \u00AB\u0421\u043F\u0440\u0430\u0432\u043E\u0447\u043D\u0438\u043A\u0438 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0435\u0439\u00BB: \u0442\u0435\u043A\u0441\u0442\u044B, \u0441\u043F\u0438\u0441\u043E\u043A, \u0434\u043E\u0441\u043A\u0438, \u043A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0448\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432.</p>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0422\u0435\u043A\u0441\u0442\u044B\" [hidden]=\"settingsTab !== 'view'\">\n <legend>\u0422\u0435\u043A\u0441\u0442\u044B \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0445</legend>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0442\u0435\u043A\u0441\u0442 \u0441\u0432\u0435\u0440\u0445\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-lt\" [ngModel]=\"secVal('texts.list.topText')\" (ngModelChange)=\"setSec('texts.list.topText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043D\u0430\u0434 \u0441\u043F\u0438\u0441\u043A\u043E\u043C\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0442\u0435\u043A\u0441\u0442 \u0441\u043D\u0438\u0437\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-lb\" [ngModel]=\"secVal('texts.list.bottomText')\" (ngModelChange)=\"setSec('texts.list.bottomText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0434 \u0441\u043F\u0438\u0441\u043A\u043E\u043C\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u0442\u0435\u043A\u0441\u0442 \u0441\u0432\u0435\u0440\u0445\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-dt\" [ngModel]=\"secVal('texts.details.topText')\" (ngModelChange)=\"setSec('texts.details.topText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043D\u0430\u0434 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u043E\u0439\"></textarea>\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u0442\u0435\u043A\u0441\u0442 \u0441\u043D\u0438\u0437\u0443</mat-label>\n <textarea matInput rows=\"2\" name=\"sec-db\" [ngModel]=\"secVal('texts.details.bottomText')\" (ngModelChange)=\"setSec('texts.details.bottomText', $event)\" maxlength=\"2000\" aria-label=\"\u0422\u0435\u043A\u0441\u0442 \u043F\u043E\u0434 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u043E\u0439\"></textarea>\n </mat-form-field>\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u044B\" [hidden]=\"settingsTab !== 'list'\">\n <legend>\u0421\u043F\u0438\u0441\u043E\u043A \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u044B</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-search\" [ngModel]=\"secVal('search') !== false\" (ngModelChange)=\"setSec('search', $event)\">\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043F\u0438\u0441\u043A\u0443</mat-checkbox>\n <mat-checkbox name=\"sec-all\" [ngModel]=\"secVal('allItems') === true\" (ngModelChange)=\"setSec('allItems', $event ? true : undefined)\">\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 (\u0431\u0435\u0437 \u043F\u0430\u0433\u0438\u043D\u0430\u0446\u0438\u0438)</mat-checkbox>\n <mat-checkbox name=\"sec-presets\" [ngModel]=\"secOn('showpresets')\" (ngModelChange)=\"setSec('showpresets', $event ? undefined : false)\">\u0421\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B (\u043F\u0440\u0435\u0441\u0435\u0442\u044B)</mat-checkbox>\n <mat-checkbox name=\"sec-settings\" [ngModel]=\"secVal('showSettings') === true\" (ngModelChange)=\"setSec('showSettings', $event ? true : undefined)\">\u041A\u043D\u043E\u043F\u043A\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043A \u0440\u0430\u0437\u0434\u0435\u043B\u0430</mat-checkbox>\n </div>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</mat-label>\n <select matNativeControl name=\"sec-order\" [ngModel]=\"secVal('orderByField') || ''\" (ngModelChange)=\"setSec('orderByField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u0441\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0438 \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.orderByField')) { <mat-error>{{ err('options.orderByField') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432</mat-label>\n <select matNativeControl name=\"sec-ftype\" [ngModel]=\"secVal('filteringType') || ''\" (ngModelChange)=\"setSec('filteringType', $event)\" aria-label=\"\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n <option value=\"modal\">\u0412 \u043E\u043A\u043D\u0435</option>\n <option value=\"left-block\">\u0421\u043B\u0435\u0432\u0430 \u043E\u0442 \u0441\u043F\u0438\u0441\u043A\u0430</option>\n </select>\n </mat-form-field>\n </div>\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0424\u0438\u043B\u044C\u0442\u0440\u044B \u0441\u043F\u0438\u0441\u043A\u0430 (\u0435\u0441\u043B\u0438 \u043D\u0435 \u0437\u0430\u0434\u0430\u043D\u044B, \u0441\u0442\u0440\u043E\u044F\u0442\u0441\u044F \u0438\u0437 \u043F\u043E\u043B\u0435\u0439)</span>\n <button mat-stroked-button type=\"button\" class=\"add-filtering-field-btn\" (click)=\"addFilteringField()\" [disabled]=\"filteringFields.length >= 10\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440</button>\n </div>\n @for (ff of filteringFields; track $index; let j = $index) {\n <div class=\"sub-list-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435</mat-label>\n <select matNativeControl [name]=\"'sec-ff' + j\" [(ngModel)]=\"ff.field\" aria-label=\"\u041F\u043E\u043B\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n <option value=\"id\">ID</option>\n <option value=\"isActive\">\u0410\u043A\u0442\u0438\u0432\u043D\u0430</option>\n </select>\n @if (err('options.filtering.fields[' + j + '].field')) { <mat-error>{{ err('options.filtering.fields[' + j + '].field') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435</mat-label>\n <input matInput [name]=\"'sec-fft' + j\" [(ngModel)]=\"ff.title\" maxlength=\"100\" aria-label=\"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\" />\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0422\u0438\u043F</mat-label>\n <select matNativeControl [name]=\"'sec-fftp' + j\" [(ngModel)]=\"ff.type\" aria-label=\"\u0422\u0438\u043F \u0444\u0438\u043B\u044C\u0442\u0440\u0430\">\n <option value=\"input\">\u0422\u0435\u043A\u0441\u0442</option>\n <option value=\"between\">\u0414\u0438\u0430\u043F\u0430\u0437\u043E\u043D</option>\n <option value=\"toggle\">\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0430\u0442\u0435\u043B\u044C</option>\n <option value=\"select\">\u0412\u044B\u0431\u043E\u0440</option>\n </select>\n </mat-form-field>\n <button mat-icon-button type=\"button\" (click)=\"removeFilteringField(j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\"><mat-icon>delete</mat-icon></button>\n </div>\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0414\u043E\u0441\u043A\u0438\" [hidden]=\"settingsTab !== 'boards'\">\n <legend>\u0414\u043E\u0441\u043A\u0438 (Kanban)</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-boards\" [ngModel]=\"secOn('boards')\" (ngModelChange)=\"setSec('boards', $event ? undefined : false)\">\u0412\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0434\u043E\u0441\u043A\u0438</mat-checkbox>\n </div>\n @if (secOn('boards')) {\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u043A\u043E\u043B\u043E\u043D\u043E\u043A</mat-label>\n <select matNativeControl name=\"sec-kcol\" [ngModel]=\"secVal('kanbanColumnField') || ''\" (ngModelChange)=\"setSec('kanbanColumnField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0434\u043E\u0441\u043A\u0438\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.kanbanColumnField')) { <mat-error>{{ err('options.kanbanColumnField') }}</mat-error> }\n </mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u041F\u043E\u043B\u0435 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438</mat-label>\n <select matNativeControl name=\"sec-kfield\" [ngModel]=\"secVal('kanbanField') || ''\" (ngModelChange)=\"setSec('kanbanField', $event)\" aria-label=\"\u041F\u043E\u043B\u0435 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438 \u0434\u043E\u0441\u043A\u0438\">\n <option value=\"\">\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E</option>\n @for (k of sectionFieldKeys; track k.key) { <option [value]=\"k.key\">{{ k.title }}</option> }\n </select>\n @if (err('options.kanbanField')) { <mat-error>{{ err('options.kanbanField') }}</mat-error> }\n </mat-form-field>\n </div>\n }\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F\" [hidden]=\"settingsTab !== 'buttons'\">\n <legend>\u041A\u043D\u043E\u043F\u043A\u0438 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F</legend>\n <div class=\"flags\">\n <mat-checkbox name=\"sec-noview\" [ngModel]=\"secVal('actions.isNoViewAction') === true\" (ngModelChange)=\"setSec('actions.isNoViewAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430</mat-checkbox>\n <mat-checkbox name=\"sec-noedit\" [ngModel]=\"secVal('actions.isNoEditAction') === true\" (ngModelChange)=\"setSec('actions.isNoEditAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u0440\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F</mat-checkbox>\n <mat-checkbox name=\"sec-nodel\" [ngModel]=\"secVal('actions.isNoDeleteAction') === true\" (ngModelChange)=\"setSec('actions.isNoDeleteAction', $event ? true : undefined)\">\u0411\u0435\u0437 \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u044F</mat-checkbox>\n <mat-checkbox name=\"sec-hadd\" [ngModel]=\"secVal('viewSettings.listMode.hideAddAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideAddAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hedit\" [ngModel]=\"secVal('viewSettings.listMode.hideEditAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideEditAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hdel\" [ngModel]=\"secVal('viewSettings.listMode.hideDeleteAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideDeleteAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u0423\u0434\u0430\u043B\u0438\u0442\u044C\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n <mat-checkbox name=\"sec-hview\" [ngModel]=\"secVal('viewSettings.listMode.hideViewAction') === true\" (ngModelChange)=\"setSec('viewSettings.listMode.hideViewAction', $event ? true : undefined)\">\u0421\u043A\u0440\u044B\u0442\u044C \u00AB\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u00BB \u0432 \u0441\u043F\u0438\u0441\u043A\u0435</mat-checkbox>\n </div>\n <div class=\"grid\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0443</mat-label>\n <select matNativeControl name=\"sec-dla\" [ngModel]=\"secVal('actions.defaultListAction') || ''\" (ngModelChange)=\"setSec('actions.defaultListAction', $event)\" aria-label=\"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043F\u043E \u043A\u043B\u0438\u043A\u0443 \u043D\u0430 \u0441\u0442\u0440\u043E\u043A\u0443 \u0441\u043F\u0438\u0441\u043A\u0430\">\n <option value=\"\">\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E</option>\n <option value=\"view\">\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440</option>\n <option value=\"edit\">\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435</option>\n </select>\n </mat-form-field>\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u041F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0440\u0430\u0437\u0434\u0435\u043B\u043E\u0432\" [hidden]=\"settingsTab !== 'preload'\">\n <legend>\u041F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0440\u0430\u0437\u0434\u0435\u043B\u043E\u0432</legend>\n <div class=\"sub-list\">\n <div class=\"sub-list-head\">\n <span class=\"muted\">\u0420\u0430\u0437\u0434\u0435\u043B\u044B, \u0434\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044E\u0442\u0441\u044F \u0434\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0444\u043E\u0440\u043C\u044B (\u0441\u043F\u0438\u0441\u043A\u0438 \u0434\u043B\u044F \u0432\u044B\u0431\u043E\u0440\u0430 \u0432 \u0441\u0432\u044F\u0437\u044F\u0445). \u0421\u0432\u044F\u0437\u044C \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442 \u0441\u0432\u043E\u0439 \u0440\u0430\u0437\u0434\u0435\u043B \u0441\u0430\u043C\u0430, \u0441\u043F\u0438\u0441\u043E\u043A \u043C\u043E\u0436\u043D\u043E \u043C\u0435\u043D\u044F\u0442\u044C.</span>\n <span class=\"sub-list-actions\">\n <button mat-stroked-button type=\"button\" class=\"preload-from-relations-btn\" (click)=\"addPreloadFromRelations()\"><mat-icon>sync</mat-icon> \u0418\u0437 \u0441\u0432\u044F\u0437\u0435\u0439</button>\n <button mat-stroked-button type=\"button\" class=\"add-preload-btn\" (click)=\"addPreload()\" [disabled]=\"preloadList.length >= 30\"><mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B</button>\n </span>\n </div>\n @if (!preloadList.length) { <p class=\"muted\">\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044F \u0437\u0430\u0440\u0430\u043D\u0435\u0435.</p> }\n @for (p of preloadList; track $index; let j = $index) {\n <div class=\"sub-list-row preload-row\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0420\u0430\u0437\u0434\u0435\u043B</mat-label>\n <input matInput [name]=\"'sec-pl' + j\" [ngModel]=\"p\" (ngModelChange)=\"setPreload(j, $event)\" maxlength=\"120\" placeholder=\"countries(paging:{perPage:-1})\" aria-label=\"\u0420\u0430\u0437\u0434\u0435\u043B \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438\" />\n @if (err('options.preLoadSections[' + j + ']')) { <mat-error>{{ err('options.preLoadSections[' + j + ']') }}</mat-error> }\n </mat-form-field>\n <button mat-icon-button type=\"button\" (click)=\"removePreload(j)\" aria-label=\"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u0437\u0434\u0435\u043B \u0438\u0437 \u043F\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438\"><mat-icon>delete</mat-icon></button>\n </div>\n }\n </div>\n </fieldset>\n\n <fieldset class=\"detail-group\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432\" [hidden]=\"settingsTab !== 'view'\">\n <legend>\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u043E\u0432 (\u043A\u043E\u043B\u043E\u043D\u043E\u043A \u0438\u0437 12)</legend>\n <div class=\"widths\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lm\" [ngModel]=\"secVal('viewSettings.listMode.mainBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.mainBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u0441\u043F\u0438\u0441\u043A\u0430\" />\n @if (err('options.viewSettings.listMode.mainBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.mainBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u0444\u0438\u043B\u044C\u0442\u0440\u044B</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lf\" [ngModel]=\"secVal('viewSettings.listMode.filterBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.filterBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432\" />\n @if (err('options.viewSettings.listMode.filterBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.filterBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u0421\u043F\u0438\u0441\u043E\u043A: \u043C\u0435\u043D\u044E</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-lmn\" [ngModel]=\"secVal('viewSettings.listMode.menuBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.listMode.menuBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u043C\u0435\u043D\u044E \u0441\u043F\u0438\u0441\u043A\u0430\" />\n @if (err('options.viewSettings.listMode.menuBlockCols')) { <mat-error>{{ err('options.viewSettings.listMode.menuBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-vm\" [ngModel]=\"secVal('viewSettings.viewMode.mainBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.viewMode.mainBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438\" />\n @if (err('options.viewSettings.viewMode.mainBlockCols')) { <mat-error>{{ err('options.viewSettings.viewMode.mainBlockCols') }}</mat-error> }</mat-form-field>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"narrow\"><mat-label>\u041A\u0430\u0440\u0442\u043E\u0447\u043A\u0430: \u043C\u0435\u043D\u044E</mat-label>\n <input matInput type=\"number\" min=\"1\" max=\"12\" step=\"1\" name=\"sec-vmn\" [ngModel]=\"secVal('viewSettings.viewMode.menuBlockCols')\" (ngModelChange)=\"setSecNumber('viewSettings.viewMode.menuBlockCols', $event)\" aria-label=\"\u0428\u0438\u0440\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0430 \u043C\u0435\u043D\u044E \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0438\" />\n @if (err('options.viewSettings.viewMode.menuBlockCols')) { <mat-error>{{ err('options.viewSettings.viewMode.menuBlockCols') }}</mat-error> }</mat-form-field>\n </div>\n </fieldset>\n </section>\n }\n\n <!-- Actions (hooks) -->\n @if (!readOnly || hookSnippets.length || orphans.length) {\n <section class=\"card\" aria-labelledby=\"sec-code\" role=\"tabpanel\" id=\"panel-events\" [hidden]=\"tab !== 'events'\">\n <div class=\"card-head\">\n <h2 id=\"sec-code\">\u0421\u043E\u0431\u044B\u0442\u0438\u044F \u043C\u043E\u0434\u0435\u043B\u0438</h2>\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\" class=\"lang\">\n <mat-label>\u042F\u0437\u044B\u043A \u043A\u043E\u0434\u0430</mat-label>\n <select matNativeControl name=\"lang\" [ngModel]=\"draft.code.lang\" (ngModelChange)=\"setLang($event)\" [disabled]=\"readOnly\" aria-label=\"\u042F\u0437\u044B\u043A \u043A\u043E\u0434\u0430\">\n <option value=\"js\">JavaScript</option>\n <option value=\"ts\">TypeScript</option>\n </select>\n </mat-form-field>\n </div>\n <p class=\"muted\">\u041A\u043E\u0434 (\u0441\u043E\u0431\u044B\u0442\u0438\u044F, \u0432\u044B\u0447\u0438\u0441\u043B\u044F\u0435\u043C\u044B\u0435 \u043F\u043E\u043B\u044F \u0438 \u0432\u0430\u043B\u0438\u0434\u0430\u0442\u043E\u0440\u044B) \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043A\u0430\u043A \u0442\u0435\u043A\u0441\u0442 \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u0441\u0438\u043D\u0442\u0430\u043A\u0441\u0438\u0441. \u041F\u0440\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0438 \u043E\u043D \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F.</p>\n\n @if (!readOnly) {\n <div class=\"row add-snippet\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-label>\u0421\u043E\u0431\u044B\u0442\u0438\u0435</mat-label>\n <select matNativeControl name=\"nsn\" [(ngModel)]=\"newSnippet.name\" aria-label=\"\u0418\u043C\u044F \u0441\u043E\u0431\u044B\u0442\u0438\u044F\">\n <option value=\"\">\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026</option>\n @for (n of namesForNewSnippet; track n) { <option [value]=\"n\">{{ n }}</option> }\n </select>\n </mat-form-field>\n <button mat-stroked-button type=\"button\" class=\"add-snippet-btn\" (click)=\"addSnippet()\" [disabled]=\"!newSnippet.name\">\n <mat-icon>add</mat-icon> \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u043E\u0431\u044B\u0442\u0438\u0435\n </button>\n </div>\n }\n\n @if (orphans.length) {\n <shared-ent-inline-alert tone=\"error\" class=\"orphan-alert\">\n \u041A\u043E\u0434 \u0441\u0441\u044B\u043B\u0430\u0435\u0442\u0441\u044F \u043D\u0430 \u043F\u043E\u043B\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435\u0442:\n @for (o of orphans; track snippetId(o)) { <code>{{ o.name }}</code> }\n \u0423\u0434\u0430\u043B\u0438\u0442\u0435 \u044D\u0442\u043E\u0442 \u043A\u043E\u0434 \u0438\u043B\u0438 \u0432\u0435\u0440\u043D\u0438\u0442\u0435 \u043F\u043E\u043B\u044F.\n </shared-ent-inline-alert>\n }\n\n @for (s of hookSnippets; track snippetId(s)) {\n <ng-container *ngTemplateOutlet=\"snip; context: { $implicit: s }\"></ng-container>\n }\n @if (globalDiagnostics.length) {\n <ul class=\"diag-list\" aria-label=\"\u041E\u0448\u0438\u0431\u043A\u0438 \u043A\u043E\u0434\u0430\">\n @for (d of globalDiagnostics; track $index) { <li class=\"diag\">{{ diagText(d) }}</li> }\n </ul>\n }\n @if (codeBlocked && !readOnly) {\n <p class=\"field-error code-blocked\" role=\"alert\">\u0421\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E, \u043F\u043E\u043A\u0430 \u0432 \u043A\u043E\u0434\u0435 \u0435\u0441\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438 \u0438\u043B\u0438 \u0438\u0434\u0451\u0442 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0430.</p>\n }\n </section>\n }\n\n <!-- Schema log -->\n @if (!isNew && draft.id) {\n <section class=\"card\" aria-labelledby=\"sec-log\" [hidden]=\"tab !== 'events'\">\n <div class=\"card-head\">\n <h2 id=\"sec-log\">\u0416\u0443\u0440\u043D\u0430\u043B \u0441\u0445\u0435\u043C\u044B</h2>\n <button mat-stroked-button type=\"button\" class=\"load-log-btn\" (click)=\"loadSchemaLog()\" [disabled]=\"schemaLogState === 'loading'\">\n {{ schemaLogState === 'idle' ? '\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0436\u0443\u0440\u043D\u0430\u043B' : '\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C' }}\n </button>\n </div>\n @switch (schemaLogState) {\n @case ('loading') { <div class=\"state-box\" role=\"status\"><mat-spinner diameter=\"24\" aria-label=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0436\u0443\u0440\u043D\u0430\u043B\u0430\" /></div> }\n @case ('error') { <shared-ent-inline-alert tone=\"error\">\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0436\u0443\u0440\u043D\u0430\u043B.</shared-ent-inline-alert> }\n @case ('ready') {\n @if (!schemaLog.length) { <p class=\"muted\">\u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u0441\u0445\u0435\u043C\u044B \u043F\u043E\u043A\u0430 \u043D\u0435 \u0431\u044B\u043B\u043E.</p> } @else {\n <div class=\"table-wrap\">\n <table class=\"log-table\" aria-label=\"\u0416\u0443\u0440\u043D\u0430\u043B \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439 \u0441\u0445\u0435\u043C\u044B\">\n <thead><tr><th>\u0412\u0440\u0435\u043C\u044F</th><th>\u0412\u0435\u0440\u0441\u0438\u044F</th><th>\u041A\u043E\u043C\u0430\u043D\u0434\u0430</th><th>\u041A\u0442\u043E</th><th>\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442</th></tr></thead>\n <tbody>\n @for (l of schemaLog; track l.id) {\n <tr [class.destructive]=\"l.destructive\">\n <td>{{ l.createdAt | date: 'dd.MM.yyyy HH:mm:ss' }}</td>\n <td>{{ l.entityVersion ?? '\u2014' }}</td>\n <td><code>{{ l.statement }}</code>@if (l.destructive) { <shared-ent-status-chip tone=\"warning\">\u0434\u0435\u0441\u0442\u0440\u0443\u043A\u0442\u0438\u0432\u043D\u043E</shared-ent-status-chip> }</td>\n <td>{{ l.actor ?? '\u2014' }}</td>\n <td>{{ l.result }}@if (l.error) { <div class=\"muted\">{{ l.error }}</div> }</td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n @if (schemaLogTotal > schemaLog.length) { <p class=\"muted\">\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u044B \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 {{ schemaLog.length }} \u0438\u0437 {{ schemaLogTotal }}.</p> }\n }\n }\n }\n </section>\n }\n }\n }\n</div>\n", styles: [".entity-form{padding:4px}.state-box{display:flex;align-items:center;gap:16px;padding:32px;color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-medium)}.card{background:var(--mat-sys-surface-container-low);border-radius:var(--mat-sys-corner-medium);padding:20px;margin:16px 0}.card h2{font:var(--mat-sys-title-medium);margin:0 0 12px}.card-head{margin-bottom:12px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.card-head h2{margin:0}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;align-items:start}.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.muted{color:var(--mat-sys-on-surface-variant);font:var(--mat-sys-body-small)}.storage{display:flex;flex-direction:column;gap:2px}.storage .label{font:var(--mat-sys-label-small);color:var(--mat-sys-on-surface-variant)}.field-error{color:var(--mat-sys-error);font:var(--mat-sys-body-small);margin:4px 0}.group-row{margin-bottom:12px;gap:12px;flex-wrap:wrap}.group-row mat-form-field{flex:1 1 200px;min-width:0}.group-row button.add-group-field-btn{flex:0 0 auto;width:auto;min-width:0;white-space:nowrap}.fields{display:flex;flex-direction:column;gap:12px;margin-top:12px;min-height:8px}.field-blocks{display:flex;flex-direction:column;gap:20px}.field-block-head{display:flex;align-items:center;gap:12px;margin-top:8px}.field-block-head strong{font:var(--mat-sys-title-small)}.field-block-head .muted{flex:1 1 auto}.field-block-head button.add-group-field-btn{width:auto;flex:0 0 auto;white-space:nowrap}.empty-block{margin:0;padding:8px 4px}.field{display:flex;flex-direction:column;gap:8px;background:var(--mat-sys-surface);border:1px solid var(--mat-sys-outline-variant);border-radius:var(--mat-sys-corner-small);padding:12px}.field.invalid{border-color:var(--mat-sys-error)}.field-options{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:0 4px 0 36px}.field-actions{display:flex;align-items:center;flex:0 0 auto;margin-left:auto}.flags-inline{display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px}.field-main{gap:12px}.field-main .w-key{flex:1 1 140px}.field-main .w-title{flex:2 1 200px}.field-main .w-type{flex:1 1 160px}.handle{cursor:grab;color:var(--mat-sys-on-surface-variant)}.cdk-drag-preview{box-shadow:var(--mat-sys-level3, 0 4px 12px rgba(0, 0, 0, .25))}.field-details{padding:8px 4px 0;display:flex;flex-direction:column;gap:8px}.flags{display:flex;flex-wrap:wrap;gap:4px 16px}fieldset{border:1px solid var(--mat-sys-outline-variant);border-radius:var(--mat-sys-corner-small);padding:8px 12px;margin:0}fieldset legend{font:var(--mat-sys-label-medium);padding:0 4px}.detail-group{margin:0;display:flex;flex-direction:column;gap:12px;padding:12px 16px 16px}.snippet{margin:4px 0 4px 36px}.snippet-title{font:var(--mat-sys-label-large)}.diag-list{margin:6px 0 0;padding-left:20px;color:var(--mat-sys-error);font:var(--mat-sys-body-small)}.error-list{margin:6px 0 0;padding-left:20px}.lang{width:180px}.table-wrap{overflow-x:auto}.log-table{width:100%;border-collapse:collapse}.log-table th,.log-table td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--mat-sys-outline-variant);vertical-align:top}.log-table code{white-space:pre-wrap;word-break:break-word;font-size:12px}.log-table tr.destructive code{color:var(--mat-sys-error)}.hook-info{margin:6px 0 8px;padding:10px 12px;background:var(--mat-sys-surface-container);border-radius:var(--mat-sys-corner-small);font:var(--mat-sys-body-small)}.hook-title{font:var(--mat-sys-label-large);margin-bottom:6px}.hook-io{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}.hook-io-head{font:var(--mat-sys-label-medium);color:var(--mat-sys-on-surface-variant);margin-bottom:2px}.hook-params{margin:0;padding-left:18px}.hook-returns{margin:0}.hook-signature{display:block;margin-top:8px;font-size:12px;color:var(--mat-sys-on-surface-variant)}.relation{margin:0 4px 0 36px;background:var(--mat-sys-surface-container);border-radius:var(--mat-sys-corner-small)}.add-snippet{margin:12px 0;gap:12px}.add-snippet mat-form-field{flex:1 1 240px;min-width:0}.add-snippet button.add-snippet-btn{flex:0 0 auto;width:auto;white-space:nowrap}.card>.muted{margin:0 0 12px}.field-details{padding:12px 4px 4px 36px;gap:12px}.flags{gap:8px 24px}.orphan-alert{display:block;margin:12px 0}.flags-inline .expand-btn{width:auto;flex:0 0 auto;white-space:nowrap}.narrow{max-width:160px;flex:0 0 160px}.wide{grid-column:1/-1}.widths .narrow{max-width:190px;flex:0 0 190px}.widths{display:flex;flex-wrap:wrap;align-items:center;gap:12px}.widths>.muted{flex:1 0 100%}.sub-list{display:flex;flex-direction:column;gap:8px}.sub-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.sub-list-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr)) auto;gap:12px;align-items:start}.sub-list-row .field-error{grid-column:1/-1}[hidden]{display:none!important}.form-tabs{display:flex;gap:8px;border-bottom:1px solid var(--mat-sys-outline-variant);margin:20px 0 0;padding:0 8px;overflow-x:auto}.form-tab{appearance:none;background:none;border:0;border-bottom:3px solid transparent;padding:12px 20px;font:var(--mat-sys-title-small);color:var(--mat-sys-on-surface-variant);cursor:pointer;display:inline-flex;align-items:center;gap:8px;white-space:nowrap}.form-tab:hover{background:var(--mat-sys-surface-container)}.form-tab.active{color:var(--mat-sys-primary);border-bottom-color:var(--mat-sys-primary)}.form-tab:focus-visible{outline:2px solid var(--mat-sys-primary);outline-offset:-2px}.tab-badge{min-width:20px;padding:0 6px;border-radius:10px;background:var(--mat-sys-error);color:var(--mat-sys-on-error);font:var(--mat-sys-label-small);line-height:20px;text-align:center}.sub-list-actions{display:inline-flex;gap:8px;flex-wrap:wrap}.preload-row{grid-template-columns:1fr auto}.sub-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 16px;padding:0 4px;border-bottom:1px solid var(--mat-sys-outline-variant)}.settings-tabs{margin:16px 0 8px;padding:0 8px}.sub-tab{appearance:none;background:none;border:0;border-bottom:2px solid transparent;padding:10px 16px;font:var(--mat-sys-label-large);color:var(--mat-sys-on-surface-variant);cursor:pointer;display:inline-flex;align-items:center;gap:6px}.sub-tab:hover{background:var(--mat-sys-surface-container)}.sub-tab.active{color:var(--mat-sys-primary);border-bottom-color:var(--mat-sys-primary)}.sub-tab:focus-visible{outline:2px solid var(--mat-sys-primary);outline-offset:-2px}.tab-icon{font-size:18px;width:18px;height:18px;line-height:18px}.sub-tab .tab-icon{font-size:16px;width:16px;height:16px;line-height:16px}\n"] }]
|
|
2840
|
+
}] });
|
|
2841
|
+
|
|
2842
|
+
// UI-managed entities (SD-009): NgRx state, adapter (definition -> static-data section / form fields), runtime section registration,
|
|
2843
|
+
// route guard and the admin designer screens. Opt-in: a host wires it up (see README.md).
|
|
2844
|
+
|
|
2845
|
+
/**
|
|
2846
|
+
* Generated bundle index. Do not edit.
|
|
2847
|
+
*/
|
|
2848
|
+
|
|
2849
|
+
export { ACTIVATION_FAILED_HINT, ASYNC_VALIDATOR_OPTIONS, CALCULATED_TYPE, COLUMN_RE, ConfirmDialogComponent, ENTITIES_CACHE_KEY, ENTITIES_FEATURE_KEY, ENTITIES_NOTIFIER, ENTITY_SECTIONS_WAIT_MS, EmptyStateComponent, EntitiesApiService, EntitiesClear, EntitiesEffects, EntitiesEventReceived, EntitiesEventsService, EntitiesFacade, EntitiesLoad, EntitiesLoadFail, EntitiesLoadSuccess, EntitiesRemove, EntitiesSettingsComponent, EntitiesSettingsFacade, EntityAdapterService, EntityFormComponent, EntitySectionsService, FIELD_CODE_META, FIELD_KEY_RE, FIELD_TYPES, GROUP_KEY_RE, HOOK_META, HOOK_NAMES, InlineAlertComponent, KEY_RE, MAX_FIELDS, MAX_GROUPS, PageHeaderComponent, RouteWaitService, SHOW_IF_OPS, SYNC_VALIDATOR_OPTIONS, SYSTEM_FIELDS, StatusChipComponent, availableSnippetNames, buildPayload, cleanSectionOptions, codeMetaOf, defaultToText, destructiveItemText, diagnosticText, draftFromEntity, dropFieldCode, dropGroup, emptyCode, emptyDraft, emptyField, entitiesErrorCode, entitiesErrorMessage, entitiesQuery, entitiesReducer, entitySectionsGuard, entityStatusLabel, entityTableName, errorsByPath, fieldTypeLabel, filterEntities, hasBlockingDiagnostics, hasFieldCode, hookSignature, initialEntitiesState, isActivationFailed, isForbidden, isRelationType, isStatementDestructive, isVersionConflict, listSnippets, moveItem, nextUid, orphanSnippets, parseDefault, parseShowIfValue, planFromResponse, renameFieldCode, savedFromResponse, serverDestructiveItems, serverDiagnostics, serverValidationErrors, showIfValueText, snippetId, snippetLabel, snippetSignature, staticDataSectionKey, tableNamePreview, validateDraft, validateSectionOptionsDraft };
|
|
2850
|
+
//# sourceMappingURL=wt-front-shared-entities.mjs.map
|