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,2781 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, signal, Input, Inject, Optional, ViewChild, PLATFORM_ID, Injectable, EventEmitter, Injector, Output, numberAttribute, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
4
|
+
import { isPlatformBrowser, DatePipe, NgIf, CommonModule } from '@angular/common';
|
|
5
|
+
import * as i3 from '@angular/forms';
|
|
6
|
+
import { FormControl, Validators, FormGroup, UntypedFormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
7
|
+
import * as i6$1 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i2$1 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
|
+
import * as i3$1 from '@angular/material/input';
|
|
12
|
+
import { MatInputModule } from '@angular/material/input';
|
|
13
|
+
import * as i2$2 from '@angular/material/slide-toggle';
|
|
14
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
15
|
+
import * as i6 from '@angular/material/select';
|
|
16
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
17
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
18
|
+
import * as i7$1 from '@angular/material/chips';
|
|
19
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
20
|
+
import * as i8$1 from '@angular/material/autocomplete';
|
|
21
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
22
|
+
import * as i7 from 'ngx-mask';
|
|
23
|
+
import { NgxMaskDirective, NgxMaskPipe } from 'ngx-mask';
|
|
24
|
+
import * as i8 from 'ngx-mat-select-search';
|
|
25
|
+
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
|
|
26
|
+
import * as i5 from '@angular/material/datepicker';
|
|
27
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
28
|
+
import { NativeDateAdapter, DateAdapter, MAT_DATE_FORMATS, MatNativeDateModule, provideNativeDateAdapter } from '@angular/material/core';
|
|
29
|
+
import * as i1 from 'wt-front-shared';
|
|
30
|
+
import { coreQuery, CORE_CONFIG, STATIC_DATA_CREATE_NEW_DIALOG, STATIC_DATA_CREATE_NEW_DYNAMIC_FORM_DIALOG, appearOpacity, InputType, IFormFieldFormat, RequestStatus, appearFromLeft, FieldType, FormFormateType, CommonDialogComponent, StaticDataComponentInputData, ERRORS, PublishErrors, expandCollapse, appearFromLeftWithDelay, ValidatorsType, STORAGE_KEY, StaticDataMetaStatus, GlobalErrorMessages, appearFromRightWithDelay, SharedSpinnerModule, ImageModule, ButtonModule, StarRatingModule, SharedIconModule } from 'wt-front-shared';
|
|
31
|
+
import { Subject, Subscription } from 'rxjs';
|
|
32
|
+
import { takeUntil, distinctUntilChanged, take, filter as filter$1, map } from 'rxjs/operators';
|
|
33
|
+
import { filter } from 'rxjs/internal/operators/filter';
|
|
34
|
+
import * as i1$1 from '@ngrx/store';
|
|
35
|
+
import { select } from '@ngrx/store';
|
|
36
|
+
import * as i1$2 from '@angular/material/dialog';
|
|
37
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
38
|
+
import * as i9 from '@angular/material/checkbox';
|
|
39
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
40
|
+
import * as i10 from '@angular/material/radio';
|
|
41
|
+
import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
|
|
42
|
+
import * as i2$4 from '@angular/router';
|
|
43
|
+
import * as i4 from 'wt-front-shared/panel-ui';
|
|
44
|
+
import { FormFieldErrorModule, FormFieldPublishErrorModule, FilesUploadModule, PanelModule, SmartProgressBarModule } from 'wt-front-shared/panel-ui';
|
|
45
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
46
|
+
import { ENTER } from '@angular/cdk/keycodes';
|
|
47
|
+
import * as i2$3 from '@ckeditor/ckeditor5-angular';
|
|
48
|
+
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
|
|
49
|
+
|
|
50
|
+
class FormFieldSpinnerComponent {
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldSpinnerComponent, isStandalone: false, selector: "shared-form-field-spinner", ngImport: i0, template: "<div class=\"spinner-overlay\">\n <shared-spinner [color]=\"'grey'\" [diameter]=\"30\" [overlay]=\"true\"></shared-spinner>\n</div>\n", styles: [".spinner-overlay{position:absolute;width:100%;height:46px;top:0;margin-top:0;border-radius:6px;overflow:hidden;opacity:.5}\n"], dependencies: [{ kind: "component", type: i1.SpinnerComponent, selector: "shared-spinner", inputs: ["overlay", "diameter", "color", "position"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSpinnerComponent, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{ selector: 'shared-form-field-spinner', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"spinner-overlay\">\n <shared-spinner [color]=\"'grey'\" [diameter]=\"30\" [overlay]=\"true\"></shared-spinner>\n</div>\n", styles: [".spinner-overlay{position:absolute;width:100%;height:46px;top:0;margin-top:0;border-radius:6px;overflow:hidden;opacity:.5}\n"] }]
|
|
57
|
+
}] });
|
|
58
|
+
|
|
59
|
+
class FormFieldSelectComponent {
|
|
60
|
+
constructor(appConfig, store, staticDataFacade, dialog, cd, createNewDialog, createNewDynamicFormDialog) {
|
|
61
|
+
this.appConfig = appConfig;
|
|
62
|
+
this.store = store;
|
|
63
|
+
this.staticDataFacade = staticDataFacade;
|
|
64
|
+
this.dialog = dialog;
|
|
65
|
+
this.cd = cd;
|
|
66
|
+
this.createNewDialog = createNewDialog;
|
|
67
|
+
this.createNewDynamicFormDialog = createNewDynamicFormDialog;
|
|
68
|
+
this.searchCtrl = new FormControl();
|
|
69
|
+
this.loaded = false;
|
|
70
|
+
this.options = [];
|
|
71
|
+
this.allOptions = [];
|
|
72
|
+
this.tempOptions = [];
|
|
73
|
+
this.defaultOptions = [];
|
|
74
|
+
this.placeholder = '';
|
|
75
|
+
this.isLoading = true;
|
|
76
|
+
this.hasRelatedData = false;
|
|
77
|
+
this.destroy$ = new Subject();
|
|
78
|
+
this.searchValue = '';
|
|
79
|
+
this.storeSubList = 'list';
|
|
80
|
+
this.selectedItem = signal(null);
|
|
81
|
+
}
|
|
82
|
+
ngOnInit() {
|
|
83
|
+
const { subscribeToFormChanges } = this.fieldData.options;
|
|
84
|
+
if (this.fieldData.options?.loadOptionFromStore && this.fieldData.options?.innerSearchOptions?.lazyLoading) {
|
|
85
|
+
const randomNumber = Math.ceil(Math.random() * 100);
|
|
86
|
+
this.storeSubList = `form_${this.form.get('id').value || 'new'}_${randomNumber}_${this.fieldData.field}`;
|
|
87
|
+
}
|
|
88
|
+
if (subscribeToFormChanges) {
|
|
89
|
+
if (subscribeToFormChanges.relatedField) {
|
|
90
|
+
this.checkRelatedFieldValue();
|
|
91
|
+
this.placeholder = subscribeToFormChanges.emptyTitle;
|
|
92
|
+
}
|
|
93
|
+
this.subscribeToFormChanges();
|
|
94
|
+
if (subscribeToFormChanges.loadOptionsParameters) {
|
|
95
|
+
const relatedFieldValue = this.form.get(subscribeToFormChanges.relatedField).value;
|
|
96
|
+
if (relatedFieldValue) {
|
|
97
|
+
const params = {
|
|
98
|
+
where: { [subscribeToFormChanges.loadOptionsParameters.filteredField]: relatedFieldValue },
|
|
99
|
+
paging: {
|
|
100
|
+
perPage: -1,
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
this.staticDataFacade.loadStaticData(subscribeToFormChanges.loadOptionsParameters.entity, params, this.storeSubList);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (this.fieldData.options?.loadOptionsAllStaticDataTypes) {
|
|
108
|
+
this.allOptions = Object.keys(this.appConfig?.staticDataMapping)
|
|
109
|
+
.map(configItemKey => {
|
|
110
|
+
return {
|
|
111
|
+
id: configItemKey,
|
|
112
|
+
name: this.appConfig?.staticDataMapping[configItemKey].title
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
this.isLoading = false;
|
|
116
|
+
this.options = [...this.allOptions];
|
|
117
|
+
}
|
|
118
|
+
if (this.autoCompleteFields) {
|
|
119
|
+
const findField = this.autoCompleteFields.find(item => item.field === this.fieldData.field);
|
|
120
|
+
if (findField?.field) {
|
|
121
|
+
this.form.get(findField.field).setValue(findField.value);
|
|
122
|
+
this.form.get(findField.field).disable();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this.subscribeToSearchChange();
|
|
126
|
+
if (this.fieldData.options?.loadOptionFromStore) {
|
|
127
|
+
// staticData.list.support-messages
|
|
128
|
+
this.selectOptionsFromStore(this.fieldData.options.loadOptionFromStore, this.storeSubList, this.fieldData.options?.loadOptionFromStoreGetItems);
|
|
129
|
+
}
|
|
130
|
+
if (this.fieldData.options?.selectOptions?.length) {
|
|
131
|
+
this.isLoading = false;
|
|
132
|
+
this.options = this.fieldData.options?.selectOptions;
|
|
133
|
+
this.setSelectedItem();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
ngOnDestroy() {
|
|
137
|
+
this.destroy$.next();
|
|
138
|
+
this.destroy$.complete();
|
|
139
|
+
}
|
|
140
|
+
ngOnChanges(changes) {
|
|
141
|
+
if (changes.fieldData && changes.fieldData.currentValue) {
|
|
142
|
+
const { loadOptionFromStore, selectOptions } = changes.fieldData.currentValue.options;
|
|
143
|
+
if (selectOptions && selectOptions.length) {
|
|
144
|
+
this.options = selectOptions;
|
|
145
|
+
this.setSelectedItem();
|
|
146
|
+
}
|
|
147
|
+
if (loadOptionFromStore) {
|
|
148
|
+
// this.loadOptionsFromStore(loadOptionFromStore);
|
|
149
|
+
this.loaded = true;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.loaded = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
checkActiveCheckBox(valueId) {
|
|
157
|
+
return this.form.get(this.fieldData.field).value?.includes(valueId);
|
|
158
|
+
}
|
|
159
|
+
changeCheckbox(event, data) {
|
|
160
|
+
if (event.checked) {
|
|
161
|
+
const newValue = [];
|
|
162
|
+
if (this.form.get(this.fieldData.field).value) {
|
|
163
|
+
newValue.push(...this.form.get(this.fieldData.field).value);
|
|
164
|
+
}
|
|
165
|
+
newValue.push(data.id);
|
|
166
|
+
this.form.get(this.fieldData.field).setValue(newValue);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.form.get(this.fieldData.field).setValue(this.form.get(this.fieldData.field).value.filter(item => item !== data.id));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
setSelectedItem() {
|
|
173
|
+
const fieldValue = this.form.get(this.fieldData.field).value;
|
|
174
|
+
if (fieldValue && this.options?.length) {
|
|
175
|
+
const findItem = this.options.find(item => +item.id === +fieldValue);
|
|
176
|
+
if (findItem) {
|
|
177
|
+
this.selectedItem.set({
|
|
178
|
+
id: String(findItem.id),
|
|
179
|
+
name: findItem.name,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
addNewClick() {
|
|
185
|
+
if (this.fieldData?.options?.relationToEntity?.isPossibleCreateNew) {
|
|
186
|
+
if (!this.createNewDialog) {
|
|
187
|
+
console.error('[ form-field-select.component ] STATIC_DATA_CREATE_NEW_DIALOG token is not provided!');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const isDynamicForm = this.fieldData?.options?.relationToEntity?.isDynamicForm || false;
|
|
191
|
+
let component;
|
|
192
|
+
if (isDynamicForm) {
|
|
193
|
+
component = this.createNewDynamicFormDialog;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
component = this.createNewDialog;
|
|
197
|
+
}
|
|
198
|
+
this.dialog.open(component, {
|
|
199
|
+
panelClass: 'right-modal',
|
|
200
|
+
height: '100vh',
|
|
201
|
+
width: '600px',
|
|
202
|
+
position: { right: '0' },
|
|
203
|
+
data: {
|
|
204
|
+
option: { ...this.fieldData?.options?.relationToEntity },
|
|
205
|
+
},
|
|
206
|
+
})
|
|
207
|
+
.afterClosed()
|
|
208
|
+
.toPromise()
|
|
209
|
+
.then((result) => {
|
|
210
|
+
if (result?.id) {
|
|
211
|
+
this.form.get(this.fieldData.field).setValue(result.id);
|
|
212
|
+
this.selectedItem.set({
|
|
213
|
+
id: result.id,
|
|
214
|
+
name: result.name,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
subscribeToSearchChange() {
|
|
221
|
+
if (this.searchCtrl) {
|
|
222
|
+
this.searchCtrl.valueChanges
|
|
223
|
+
.pipe(takeUntil(this.destroy$))
|
|
224
|
+
.subscribe((searchValue) => {
|
|
225
|
+
this.searchValue = searchValue;
|
|
226
|
+
if (this.fieldData.options?.innerSearchOptions?.lazyLoading) {
|
|
227
|
+
const innerSearchOptions = this.fieldData.options?.innerSearchOptions;
|
|
228
|
+
if (searchValue.length > innerSearchOptions.minValueLengthForRequest) {
|
|
229
|
+
const parameters = {
|
|
230
|
+
search: searchValue,
|
|
231
|
+
};
|
|
232
|
+
this.staticDataFacade.loadStaticData(innerSearchOptions?.entityType, parameters, this.storeSubList);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.options = this.defaultOptions;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
if (searchValue) {
|
|
240
|
+
if (!this.tempOptions.length) {
|
|
241
|
+
this.tempOptions = [...this.options];
|
|
242
|
+
}
|
|
243
|
+
this.options = this.allOptions.filter(item => {
|
|
244
|
+
return item.name.toLowerCase().indexOf(searchValue.toLowerCase()) !== -1;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
if (this.tempOptions.length) {
|
|
249
|
+
this.options = [...this.tempOptions];
|
|
250
|
+
this.tempOptions = [];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
this.setSelectedItem();
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Subscribe to the form changes for field with the property 'subscribeToFormChanges'
|
|
260
|
+
*/
|
|
261
|
+
subscribeToFormChanges() {
|
|
262
|
+
const { relatedField, currentFieldProperty, loadOptionsParameters } = this.fieldData.options?.subscribeToFormChanges;
|
|
263
|
+
if (relatedField) {
|
|
264
|
+
this.form.get(relatedField).valueChanges
|
|
265
|
+
.pipe(takeUntil(this.destroy$))
|
|
266
|
+
.subscribe(changes => {
|
|
267
|
+
this.checkRelatedFieldValue();
|
|
268
|
+
if (loadOptionsParameters) {
|
|
269
|
+
const params = {
|
|
270
|
+
where: { [currentFieldProperty]: changes },
|
|
271
|
+
paging: {
|
|
272
|
+
perPage: -1
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
this.staticDataFacade.loadStaticData(loadOptionsParameters.entity, params, this.storeSubList);
|
|
276
|
+
}
|
|
277
|
+
this.filterOptionsByRelatedFieldValue(changes);
|
|
278
|
+
this.defaultOptions = [...this.options];
|
|
279
|
+
this.cd.markForCheck();
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
checkRelatedFieldValue() {
|
|
284
|
+
const { relatedField } = this.fieldData.options?.subscribeToFormChanges;
|
|
285
|
+
if (relatedField) {
|
|
286
|
+
const relatedFieldValue = this.form.get(relatedField).value;
|
|
287
|
+
if (Array.isArray(relatedFieldValue)) {
|
|
288
|
+
this.hasRelatedData = !!relatedFieldValue?.length;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.hasRelatedData = !!relatedFieldValue;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// 'staticData.list.business-settings[0].settings.notifications.telegram.channels'
|
|
296
|
+
selectOptionsFromStore(loadOptionFromStore, subList, loadOptionFromStoreGetItems = undefined) {
|
|
297
|
+
const listKeys = loadOptionFromStore.split('.');
|
|
298
|
+
let storeSelector;
|
|
299
|
+
if (listKeys[0] === 'staticData') {
|
|
300
|
+
storeSelector = this.staticDataFacade.getStaticData$(listKeys[2], subList || 'list', null, null, loadOptionFromStore);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
storeSelector = this.store.pipe(select(coreQuery.getStore(loadOptionFromStore)));
|
|
304
|
+
}
|
|
305
|
+
storeSelector?.pipe(filter((listItems) => !!listItems), takeUntil(this.destroy$))
|
|
306
|
+
.subscribe((listItems) => {
|
|
307
|
+
let newOptions = [];
|
|
308
|
+
if (listItems && listItems?.items) {
|
|
309
|
+
newOptions = listItems.items;
|
|
310
|
+
}
|
|
311
|
+
else if (listItems.list?.length) {
|
|
312
|
+
newOptions = listItems.list;
|
|
313
|
+
}
|
|
314
|
+
else if (Array.isArray(listItems)) {
|
|
315
|
+
newOptions = listItems;
|
|
316
|
+
}
|
|
317
|
+
if (this.searchValue) {
|
|
318
|
+
newOptions = newOptions.filter(item => item.name.indexOf(this.searchValue) === 0);
|
|
319
|
+
}
|
|
320
|
+
/*
|
|
321
|
+
if (!this.searchValue && this.fieldData.options?.innerSearchOptions?.lazyLoading) {
|
|
322
|
+
newOptions = [];
|
|
323
|
+
}
|
|
324
|
+
*/
|
|
325
|
+
if (newOptions?.length && loadOptionFromStoreGetItems) {
|
|
326
|
+
try {
|
|
327
|
+
newOptions = loadOptionFromStoreGetItems(newOptions);
|
|
328
|
+
}
|
|
329
|
+
catch (e) {
|
|
330
|
+
console.error('[ form-list-select ][ loadOptionFromStoreGetItems ]', e, loadOptionFromStoreGetItems);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
newOptions = this.sortOptionItemsByName(newOptions);
|
|
334
|
+
if (this.fieldData.options?.nestedByField) {
|
|
335
|
+
newOptions = this.groupItemsByNestedField(newOptions);
|
|
336
|
+
}
|
|
337
|
+
this.allOptions = newOptions;
|
|
338
|
+
// Default options for the LazyLoading
|
|
339
|
+
if (!this.defaultOptions?.length) {
|
|
340
|
+
this.defaultOptions = [...newOptions];
|
|
341
|
+
}
|
|
342
|
+
this.isLoading = false;
|
|
343
|
+
if (!this.fieldData.options?.subscribeToFormChanges?.relatedField) {
|
|
344
|
+
this.options = newOptions?.length ? newOptions.map(item => ({ id: item.id, name: item.name })) : [];
|
|
345
|
+
this.setSelectedItem();
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.filterOptionsByRelatedFieldValue(this.form.value);
|
|
349
|
+
}
|
|
350
|
+
this.cd.markForCheck();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Filter option by the 'subscribeToFormChanges' property
|
|
355
|
+
* @param data
|
|
356
|
+
*/
|
|
357
|
+
filterOptionsByRelatedFieldValue(data) {
|
|
358
|
+
if (!this.fieldData.options?.subscribeToFormChanges?.relatedField) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const { relatedField, currentFieldProperty } = this.fieldData.options?.subscribeToFormChanges;
|
|
362
|
+
const relatedFieldValue = data[relatedField];
|
|
363
|
+
let newOptions = [];
|
|
364
|
+
if (Array.isArray(relatedFieldValue)) {
|
|
365
|
+
if (relatedFieldValue?.length) {
|
|
366
|
+
newOptions = this.allOptions.filter(item => {
|
|
367
|
+
return relatedFieldValue.includes(item[currentFieldProperty]);
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
newOptions = this.allOptions.filter(item => item[currentFieldProperty] === relatedFieldValue);
|
|
373
|
+
}
|
|
374
|
+
this.options = newOptions.map(item => ({ id: item.id, name: item.name }));
|
|
375
|
+
this.setSelectedItem();
|
|
376
|
+
}
|
|
377
|
+
groupItemsByNestedField(items) {
|
|
378
|
+
let newItems = [];
|
|
379
|
+
items.filter(item => !item[this.fieldData.options?.nestedByField])
|
|
380
|
+
.forEach(item => {
|
|
381
|
+
const newItem = { ...item };
|
|
382
|
+
const subItems = this.groupItemsByNestedFieldRecursion(items, +item.id);
|
|
383
|
+
newItems.push(newItem);
|
|
384
|
+
if (subItems?.length) {
|
|
385
|
+
newItems = [...newItems, ...subItems];
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return newItems;
|
|
389
|
+
}
|
|
390
|
+
groupItemsByNestedFieldRecursion(items, parentId, prefix = '---') {
|
|
391
|
+
const nestedByFieldName = this.fieldData.options?.nestedByField;
|
|
392
|
+
const findItems = items.filter(item => item[nestedByFieldName] === parentId);
|
|
393
|
+
if (findItems?.length) {
|
|
394
|
+
let newItems = [];
|
|
395
|
+
findItems.forEach(item => {
|
|
396
|
+
newItems.push({ ...item, name: `${prefix} ${item.name}` });
|
|
397
|
+
const subItems = this.groupItemsByNestedFieldRecursion(items, +item.id, prefix + '---');
|
|
398
|
+
if (subItems?.length) {
|
|
399
|
+
newItems = [...newItems, ...subItems];
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return newItems;
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
sortOptionItemsByName(items) {
|
|
407
|
+
return [...items].sort((a, b) => {
|
|
408
|
+
const field = a.name ? 'name' : 'title';
|
|
409
|
+
if (a[field] > b[field])
|
|
410
|
+
return 1;
|
|
411
|
+
if (a[field] < b[field])
|
|
412
|
+
return -1;
|
|
413
|
+
return 0;
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSelectComponent, deps: [{ token: CORE_CONFIG }, { token: i1$1.Store }, { token: i1.StaticDataFacade }, { token: i1$2.MatDialog }, { token: i0.ChangeDetectorRef }, { token: STATIC_DATA_CREATE_NEW_DIALOG, optional: true }, { token: STATIC_DATA_CREATE_NEW_DYNAMIC_FORM_DIALOG, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
417
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: FormFieldSelectComponent, isStandalone: false, selector: "shared-form-field-select", inputs: { config: "config", fieldData: "fieldData", form: "form", autoCompleteFields: "autoCompleteFields" }, usesOnChanges: true, ngImport: i0, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <ng-container *ngIf=\"!fieldData?.options?.relationToEntity?.isPossibleCreateNew\">\n\n <ng-container *ngIf=\"!fieldData.options?.selectShowAllOptions\">\n <mat-form-field appearance=\"outline\"\n class=\"width100\">\n <mat-label>{{ fieldData.title }}</mat-label>\n <mat-select [required]=\"fieldData.validators?.includes('required')\"\n [multiple]=\"fieldData.options?.multiple\"\n [formControlName]=\"fieldData.field\">\n <mat-option *ngIf=\"fieldData.options?.innerSearch\">\n <ngx-mat-select-search\n placeholderLabel=\"\u041F\u043E\u0438\u0441\u043A...\"\n [formControl]=\"searchCtrl\"></ngx-mat-select-search>\n </mat-option>\n <mat-option *ngIf=\"!fieldData.validators?.includes('required')\" value=\"0\">\n -----\n </mat-option>\n @if (options.length) {\n <mat-option *ngFor=\"let item of options\" [value]=\"item.id\">\n {{ item.name || item['title'] }}\n </mat-option>\n }\n\n <ng-container *ngIf=\"isLoading\">\n <mat-option>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430....</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"fieldData.options?.selectShowAllOptions\">\n <div class=\"form-select-list-options\">\n <mat-label class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n @if (options.length) {\n\n @if (fieldData.options?.multiple) {\n <input [formControlName]=\"fieldData.field\" [hidden]=\"true\"/>\n <p *ngFor=\"let item of options\">\n <mat-checkbox\n [value]=\"item.id\"\n [required]=\"fieldData.validators?.includes('required')\"\n [checked]=\"checkActiveCheckBox(item.id)\"\n (change)=\"changeCheckbox($event, item)\"\n >\n {{ item.name }}\n </mat-checkbox>\n </p>\n }\n\n @if (!fieldData.options?.multiple) {\n <mat-radio-group [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\">\n <p *ngFor=\"let item of options\">\n <mat-radio-button [value]=\"item.id\">\n {{ item.name }}\n </mat-radio-button>\n </p>\n </mat-radio-group>\n }\n }\n\n <ng-container *ngIf=\"isLoading\">\n \u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430....\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!hasRelatedData && placeholder\">\n <div @appearOpacity class=\"form-select-placeholder\">{{ placeholder }}</div>\n </ng-container>\n </ng-container>\n</div>\n<ng-container *ngIf=\"fieldData?.options?.relationToEntity?.isPossibleCreateNew\">\n <mat-label class=\"field-label\">{{ fieldData.title }}</mat-label>\n <div class=\"field-border\">\n <div *ngIf=\"selectedItem()?.id\" class=\"form-selected-item d-flex align-items-center justify-content-left\">\n <div class=\"form-selected-item-id mr-5\">Id: {{ selectedItem().id }}</div>\n <div class=\"form-selected-item-name mr-10\">\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435: {{ selectedItem().name }}</div>\n </div>\n <shared-button\n size=\"small\"\n type=\"button\"\n color=\"basic\"\n styleTheme=\"flat\"\n (click)=\"addNewClick()\"\n [icon]=\"'select'\">\u0412\u044B\u0431\u0440\u0430\u0442\u044C\n </shared-button>\n </div>\n</ng-container>\n<shared-form-field-spinner *ngIf=\"isLoading\"></shared-form-field-spinner>\n", styles: [".form-select-placeholder{position:absolute;margin-right:25px;margin-top:-22px;opacity:.8;right:0;color:#e53935}.field-border{border:1px solid #a3a3a3;padding:10px;border-radius:8px;display:flex;align-items:center}.field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px;max-height:300px;overflow:auto}.form-select-list-options p{margin-bottom:5px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i6.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: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i1.ButtonComponent, selector: "shared-button", inputs: ["icon", "iconColor", "iconSize", "rightIcon", "disabled", "loading", "active", "stopPropagation", "type", "color", "fullWidth", "size", "styleTheme", "tooltip", "tooltipPosition"], outputs: ["clickButton"] }, { kind: "component", type: i8.MatSelectSearchComponent, selector: "ngx-mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti", "recreateValuesArray"], outputs: ["toggleAll"] }, { kind: "component", type: i9.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: "component", type: i10.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i10.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: FormFieldSpinnerComponent, selector: "shared-form-field-spinner" }], animations: [appearOpacity], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
418
|
+
}
|
|
419
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSelectComponent, decorators: [{
|
|
420
|
+
type: Component,
|
|
421
|
+
args: [{ selector: 'shared-form-field-select', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearOpacity], standalone: false, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <ng-container *ngIf=\"!fieldData?.options?.relationToEntity?.isPossibleCreateNew\">\n\n <ng-container *ngIf=\"!fieldData.options?.selectShowAllOptions\">\n <mat-form-field appearance=\"outline\"\n class=\"width100\">\n <mat-label>{{ fieldData.title }}</mat-label>\n <mat-select [required]=\"fieldData.validators?.includes('required')\"\n [multiple]=\"fieldData.options?.multiple\"\n [formControlName]=\"fieldData.field\">\n <mat-option *ngIf=\"fieldData.options?.innerSearch\">\n <ngx-mat-select-search\n placeholderLabel=\"\u041F\u043E\u0438\u0441\u043A...\"\n [formControl]=\"searchCtrl\"></ngx-mat-select-search>\n </mat-option>\n <mat-option *ngIf=\"!fieldData.validators?.includes('required')\" value=\"0\">\n -----\n </mat-option>\n @if (options.length) {\n <mat-option *ngFor=\"let item of options\" [value]=\"item.id\">\n {{ item.name || item['title'] }}\n </mat-option>\n }\n\n <ng-container *ngIf=\"isLoading\">\n <mat-option>\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430....</mat-option>\n </ng-container>\n </mat-select>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"fieldData.options?.selectShowAllOptions\">\n <div class=\"form-select-list-options\">\n <mat-label class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n @if (options.length) {\n\n @if (fieldData.options?.multiple) {\n <input [formControlName]=\"fieldData.field\" [hidden]=\"true\"/>\n <p *ngFor=\"let item of options\">\n <mat-checkbox\n [value]=\"item.id\"\n [required]=\"fieldData.validators?.includes('required')\"\n [checked]=\"checkActiveCheckBox(item.id)\"\n (change)=\"changeCheckbox($event, item)\"\n >\n {{ item.name }}\n </mat-checkbox>\n </p>\n }\n\n @if (!fieldData.options?.multiple) {\n <mat-radio-group [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\">\n <p *ngFor=\"let item of options\">\n <mat-radio-button [value]=\"item.id\">\n {{ item.name }}\n </mat-radio-button>\n </p>\n </mat-radio-group>\n }\n }\n\n <ng-container *ngIf=\"isLoading\">\n \u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430....\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!hasRelatedData && placeholder\">\n <div @appearOpacity class=\"form-select-placeholder\">{{ placeholder }}</div>\n </ng-container>\n </ng-container>\n</div>\n<ng-container *ngIf=\"fieldData?.options?.relationToEntity?.isPossibleCreateNew\">\n <mat-label class=\"field-label\">{{ fieldData.title }}</mat-label>\n <div class=\"field-border\">\n <div *ngIf=\"selectedItem()?.id\" class=\"form-selected-item d-flex align-items-center justify-content-left\">\n <div class=\"form-selected-item-id mr-5\">Id: {{ selectedItem().id }}</div>\n <div class=\"form-selected-item-name mr-10\">\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435: {{ selectedItem().name }}</div>\n </div>\n <shared-button\n size=\"small\"\n type=\"button\"\n color=\"basic\"\n styleTheme=\"flat\"\n (click)=\"addNewClick()\"\n [icon]=\"'select'\">\u0412\u044B\u0431\u0440\u0430\u0442\u044C\n </shared-button>\n </div>\n</ng-container>\n<shared-form-field-spinner *ngIf=\"isLoading\"></shared-form-field-spinner>\n", styles: [".form-select-placeholder{position:absolute;margin-right:25px;margin-top:-22px;opacity:.8;right:0;color:#e53935}.field-border{border:1px solid #a3a3a3;padding:10px;border-radius:8px;display:flex;align-items:center}.field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px;max-height:300px;overflow:auto}.form-select-list-options p{margin-bottom:5px}\n"] }]
|
|
422
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
423
|
+
type: Inject,
|
|
424
|
+
args: [CORE_CONFIG]
|
|
425
|
+
}] }, { type: i1$1.Store }, { type: i1.StaticDataFacade }, { type: i1$2.MatDialog }, { type: i0.ChangeDetectorRef }, { type: i0.Type, decorators: [{
|
|
426
|
+
type: Optional
|
|
427
|
+
}, {
|
|
428
|
+
type: Inject,
|
|
429
|
+
args: [STATIC_DATA_CREATE_NEW_DIALOG]
|
|
430
|
+
}] }, { type: i0.Type, decorators: [{
|
|
431
|
+
type: Optional
|
|
432
|
+
}, {
|
|
433
|
+
type: Inject,
|
|
434
|
+
args: [STATIC_DATA_CREATE_NEW_DYNAMIC_FORM_DIALOG]
|
|
435
|
+
}] }], propDecorators: { config: [{
|
|
436
|
+
type: Input
|
|
437
|
+
}], fieldData: [{
|
|
438
|
+
type: Input
|
|
439
|
+
}], form: [{
|
|
440
|
+
type: Input
|
|
441
|
+
}], autoCompleteFields: [{
|
|
442
|
+
type: Input
|
|
443
|
+
}] } });
|
|
444
|
+
|
|
445
|
+
class FormFieldSlideToggleComponent {
|
|
446
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSlideToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
447
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldSlideToggleComponent, isStandalone: false, selector: "shared-form-field-slide-toggle", inputs: { config: "config", fieldData: "fieldData", form: "form" }, ngImport: i0, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\" class=\"field-slide-toggle\">\n <mat-slide-toggle\n [color]=\"'warn'\"\n [formControlName]=\"fieldData.field\">\n {{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}\n </mat-slide-toggle>\n</div>\n", styles: [".field-slide-toggle{margin-bottom:15px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2$2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
448
|
+
}
|
|
449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSlideToggleComponent, decorators: [{
|
|
450
|
+
type: Component,
|
|
451
|
+
args: [{ selector: 'shared-form-field-slide-toggle', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\" class=\"field-slide-toggle\">\n <mat-slide-toggle\n [color]=\"'warn'\"\n [formControlName]=\"fieldData.field\">\n {{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}\n </mat-slide-toggle>\n</div>\n", styles: [".field-slide-toggle{margin-bottom:15px}\n"] }]
|
|
452
|
+
}], propDecorators: { config: [{
|
|
453
|
+
type: Input
|
|
454
|
+
}], fieldData: [{
|
|
455
|
+
type: Input
|
|
456
|
+
}], form: [{
|
|
457
|
+
type: Input
|
|
458
|
+
}] } });
|
|
459
|
+
|
|
460
|
+
class FormFieldSelectShowComponent {
|
|
461
|
+
constructor(coreFacade, cd) {
|
|
462
|
+
this.coreFacade = coreFacade;
|
|
463
|
+
this.cd = cd;
|
|
464
|
+
this.listItems = [];
|
|
465
|
+
this.loading = true;
|
|
466
|
+
this.destroy$ = new Subject();
|
|
467
|
+
}
|
|
468
|
+
ngOnInit() {
|
|
469
|
+
}
|
|
470
|
+
ngOnDestroy() {
|
|
471
|
+
this.destroy$.next();
|
|
472
|
+
this.destroy$.complete();
|
|
473
|
+
}
|
|
474
|
+
ngOnChanges(changes) {
|
|
475
|
+
if (changes.fieldData.currentValue) {
|
|
476
|
+
let values = !Array.isArray(this.value) ? [this.value] : this.value;
|
|
477
|
+
const loadOptionFromStore = this.fieldData.options?.loadOptionFromStore;
|
|
478
|
+
if (!this.listItems.length) {
|
|
479
|
+
if (loadOptionFromStore) {
|
|
480
|
+
this.getItemsFromStore(loadOptionFromStore, values);
|
|
481
|
+
}
|
|
482
|
+
else if (this.fieldData.options?.selectOptions) {
|
|
483
|
+
this.listItems = this.fieldData.options?.selectOptions
|
|
484
|
+
.filter(item => values.includes(item.id) || values.includes(String(item.id)))
|
|
485
|
+
.map(item => item.name || `Номер ${item.id}`);
|
|
486
|
+
if (values.length && !this.listItems?.length) {
|
|
487
|
+
this.listItems = ([...values]);
|
|
488
|
+
}
|
|
489
|
+
this.loading = false;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
getItemsFromStore(keyFromStore, ids) {
|
|
495
|
+
this.coreFacade.getStoreByName(keyFromStore)
|
|
496
|
+
.pipe(takeUntil(this.destroy$))
|
|
497
|
+
.subscribe(items => {
|
|
498
|
+
if (items?.list?.length) {
|
|
499
|
+
this.listItems = items.list
|
|
500
|
+
.filter(item => ids.includes(item.id) || ids.includes(String(item.id)))
|
|
501
|
+
.map(item => item.name || `Номер ${item.id}`);
|
|
502
|
+
if (ids.length && !this.listItems?.length) {
|
|
503
|
+
this.listItems = ([...ids]);
|
|
504
|
+
}
|
|
505
|
+
this.loading = false;
|
|
506
|
+
this.cd.markForCheck();
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
getItemsFromFieldSettings(keyFromStore, ids) {
|
|
511
|
+
this.coreFacade.getStoreByName(keyFromStore)
|
|
512
|
+
.pipe(takeUntil(this.destroy$))
|
|
513
|
+
.subscribe(items => {
|
|
514
|
+
if (items?.list?.length) {
|
|
515
|
+
this.listItems = items.list
|
|
516
|
+
.filter(item => ids.includes(item.id) || ids.includes(String(item.id)))
|
|
517
|
+
.map(item => item.name || `Номер ${item.id}`);
|
|
518
|
+
if (ids.length && !this.listItems?.length) {
|
|
519
|
+
this.listItems = ([...ids]);
|
|
520
|
+
}
|
|
521
|
+
this.loading = false;
|
|
522
|
+
this.cd.markForCheck();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
trackById(index, item) {
|
|
527
|
+
return item?.id || undefined;
|
|
528
|
+
}
|
|
529
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSelectShowComponent, deps: [{ token: i1.CoreFacade }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
530
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldSelectShowComponent, isStandalone: false, selector: "shared-form-field-select-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"d-flex align-items-flex-start align-content-flex-start\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label class=\"show-label\">{{ fieldData.title }}:</label>\n <div class=\"d-flex align-items-flex-start form-field-value\">\n <span *ngFor=\"let value of listItems;trackBy: trackById\">{{ value }}</span>\n </div>\n</div>\n<shared-form-field-spinner *ngIf=\"loading\"></shared-form-field-spinner>\n", styles: [".form-field-value{display:flex;flex-direction:column}.small-form-width-form-field .show-label{margin-bottom:0}span{margin-left:5px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormFieldSpinnerComponent, selector: "shared-form-field-spinner" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
531
|
+
}
|
|
532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSelectShowComponent, decorators: [{
|
|
533
|
+
type: Component,
|
|
534
|
+
args: [{ selector: 'shared-form-field-select-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"d-flex align-items-flex-start align-content-flex-start\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label class=\"show-label\">{{ fieldData.title }}:</label>\n <div class=\"d-flex align-items-flex-start form-field-value\">\n <span *ngFor=\"let value of listItems;trackBy: trackById\">{{ value }}</span>\n </div>\n</div>\n<shared-form-field-spinner *ngIf=\"loading\"></shared-form-field-spinner>\n", styles: [".form-field-value{display:flex;flex-direction:column}.small-form-width-form-field .show-label{margin-bottom:0}span{margin-left:5px}\n"] }]
|
|
535
|
+
}], ctorParameters: () => [{ type: i1.CoreFacade }, { type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
536
|
+
type: Input
|
|
537
|
+
}], fieldData: [{
|
|
538
|
+
type: Input
|
|
539
|
+
}], value: [{
|
|
540
|
+
type: Input
|
|
541
|
+
}] } });
|
|
542
|
+
|
|
543
|
+
class FormFieldInputComponent {
|
|
544
|
+
constructor(cd) {
|
|
545
|
+
this.cd = cd;
|
|
546
|
+
this.pendingStatus = 'PENDING';
|
|
547
|
+
this.inputType = InputType.Text;
|
|
548
|
+
this.inputMask = null;
|
|
549
|
+
this.placeholder = '';
|
|
550
|
+
this.destroy$ = new Subject();
|
|
551
|
+
}
|
|
552
|
+
ngOnInit() {
|
|
553
|
+
this.checkInputType();
|
|
554
|
+
this.checkInputMask();
|
|
555
|
+
this.subscribeToFieldStatus();
|
|
556
|
+
}
|
|
557
|
+
ngOnDestroy() {
|
|
558
|
+
this.destroy$.next();
|
|
559
|
+
this.destroy$.complete();
|
|
560
|
+
}
|
|
561
|
+
subscribeToFieldStatus() {
|
|
562
|
+
this.form.get(this.fieldData.field).statusChanges
|
|
563
|
+
.pipe(takeUntil(this.destroy$))
|
|
564
|
+
.subscribe((data) => {
|
|
565
|
+
this.cd.markForCheck();
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
checkInputType() {
|
|
569
|
+
switch (this.fieldData.options?.format) {
|
|
570
|
+
case IFormFieldFormat.Email:
|
|
571
|
+
this.inputType = InputType.Email;
|
|
572
|
+
break;
|
|
573
|
+
case IFormFieldFormat.Phone:
|
|
574
|
+
this.inputType = InputType.Tel;
|
|
575
|
+
break;
|
|
576
|
+
case IFormFieldFormat.Number:
|
|
577
|
+
this.inputType = InputType.Number;
|
|
578
|
+
break;
|
|
579
|
+
case IFormFieldFormat.Password:
|
|
580
|
+
this.inputType = InputType.Password;
|
|
581
|
+
break;
|
|
582
|
+
default:
|
|
583
|
+
this.inputType = InputType.Text;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
checkInputMask() {
|
|
587
|
+
this.placeholder = this.fieldData.options?.placeholder;
|
|
588
|
+
switch (this.fieldData.options?.format) {
|
|
589
|
+
case IFormFieldFormat.Phone:
|
|
590
|
+
this.inputMask = '+0(0000)000-00-00';
|
|
591
|
+
this.placeholder = '+0(0000)000-00-00';
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
596
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldInputComponent, isStandalone: false, selector: "shared-form-field-input", inputs: { config: "config", fieldData: "fieldData", form: "form" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"form.get(fieldData.field) as field\">\n <div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <mat-form-field appearance=\"outline\"\n class=\"width100\">\n <mat-label>{{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}</mat-label>\n <div class=\"display-flex align-baseline \">\n <ng-container *ngIf=\"inputMask\">\n <input matInput\n #input\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [mask]=\"inputMask\"\n [formControlName]=\"fieldData.field\">\n </ng-container>\n <ng-container *ngIf=\"!inputMask\">\n <input matInput\n #input\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [formControlName]=\"fieldData.field\">\n </ng-container>\n <div class=\"form-field-suffix\"\n [ngClass]=\"{'input-field-icon-red': !field.valid}\"\n *ngIf=\"fieldData.asyncValidators && fieldData.asyncValidators.length\">\n <mat-icon *ngIf=\"field.status !== pendingStatus\"\n class=\"secondary-text mat-icon notranslate material-icons mat-icon-no-color\"\n role=\"img\" aria-hidden=\"true\">\n {{field.valid ? 'done' : field.errors['itemUniqValue'] ? 'assignment_late' : ''}}\n </mat-icon>\n <shared-spinner *ngIf=\"field.status === pendingStatus\"\n [diameter]=\"24\"></shared-spinner>\n </div>\n </div>\n </mat-form-field>\n </div>\n</ng-container>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$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: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "component", type: i1.SpinnerComponent, selector: "shared-spinner", inputs: ["overlay", "diameter", "color", "position"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
597
|
+
}
|
|
598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldInputComponent, decorators: [{
|
|
599
|
+
type: Component,
|
|
600
|
+
args: [{ selector: 'shared-form-field-input', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-container *ngIf=\"form.get(fieldData.field) as field\">\n <div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <mat-form-field appearance=\"outline\"\n class=\"width100\">\n <mat-label>{{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}</mat-label>\n <div class=\"display-flex align-baseline \">\n <ng-container *ngIf=\"inputMask\">\n <input matInput\n #input\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [mask]=\"inputMask\"\n [formControlName]=\"fieldData.field\">\n </ng-container>\n <ng-container *ngIf=\"!inputMask\">\n <input matInput\n #input\n [type]=\"inputType\"\n [placeholder]=\"placeholder\"\n [formControlName]=\"fieldData.field\">\n </ng-container>\n <div class=\"form-field-suffix\"\n [ngClass]=\"{'input-field-icon-red': !field.valid}\"\n *ngIf=\"fieldData.asyncValidators && fieldData.asyncValidators.length\">\n <mat-icon *ngIf=\"field.status !== pendingStatus\"\n class=\"secondary-text mat-icon notranslate material-icons mat-icon-no-color\"\n role=\"img\" aria-hidden=\"true\">\n {{field.valid ? 'done' : field.errors['itemUniqValue'] ? 'assignment_late' : ''}}\n </mat-icon>\n <shared-spinner *ngIf=\"field.status === pendingStatus\"\n [diameter]=\"24\"></shared-spinner>\n </div>\n </div>\n </mat-form-field>\n </div>\n</ng-container>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"] }]
|
|
601
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
602
|
+
type: Input
|
|
603
|
+
}], fieldData: [{
|
|
604
|
+
type: Input
|
|
605
|
+
}], form: [{
|
|
606
|
+
type: Input
|
|
607
|
+
}], input: [{
|
|
608
|
+
type: ViewChild,
|
|
609
|
+
args: ['input', { static: false }]
|
|
610
|
+
}] } });
|
|
611
|
+
|
|
612
|
+
class FormFieldStringListInputComponent {
|
|
613
|
+
constructor(fb) {
|
|
614
|
+
this.fb = fb;
|
|
615
|
+
// @ViewChild('input', {static: false}) input: ElementRef<HTMLInputElement>;
|
|
616
|
+
this.placeholder = '';
|
|
617
|
+
this.destroy$ = new Subject();
|
|
618
|
+
}
|
|
619
|
+
ngOnInit() {
|
|
620
|
+
this.initForm();
|
|
621
|
+
this.subscribeToFormChanges();
|
|
622
|
+
}
|
|
623
|
+
ngOnDestroy() {
|
|
624
|
+
this.destroy$.next();
|
|
625
|
+
this.destroy$.complete();
|
|
626
|
+
}
|
|
627
|
+
get items() {
|
|
628
|
+
return this.mainForm.get('items');
|
|
629
|
+
}
|
|
630
|
+
addItem() {
|
|
631
|
+
this.items.push(this.fb.control('', Validators.required));
|
|
632
|
+
}
|
|
633
|
+
// Remove a control by index
|
|
634
|
+
removeItem(index) {
|
|
635
|
+
this.items.removeAt(index);
|
|
636
|
+
this.setFieldValue();
|
|
637
|
+
}
|
|
638
|
+
subscribeToFormChanges() {
|
|
639
|
+
this.items.valueChanges
|
|
640
|
+
.pipe(takeUntil(this.destroy$))
|
|
641
|
+
.subscribe(() => {
|
|
642
|
+
this.setFieldValue();
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
setFieldValue() {
|
|
646
|
+
this.form.patchValue({ [this.fieldData.field]: this.getFormValue() });
|
|
647
|
+
}
|
|
648
|
+
getFormValue() {
|
|
649
|
+
if (this.fieldData.options?.inputStringList?.separator) {
|
|
650
|
+
return this.items.value.join(this.fieldData.options?.inputStringList?.separator);
|
|
651
|
+
}
|
|
652
|
+
return this.items.value;
|
|
653
|
+
}
|
|
654
|
+
initForm() {
|
|
655
|
+
this.mainForm = new FormGroup({
|
|
656
|
+
items: this.fb.array([]),
|
|
657
|
+
});
|
|
658
|
+
const fieldInputValue = this.form.get(this.fieldData.field).value;
|
|
659
|
+
if (fieldInputValue) {
|
|
660
|
+
if (this.fieldData.options?.inputStringList?.separator) {
|
|
661
|
+
fieldInputValue.split(this.fieldData.options?.inputStringList?.separator)
|
|
662
|
+
.forEach(item => this.items.push(this.fb.control(item)));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
this.form.updateValueAndValidity();
|
|
666
|
+
}
|
|
667
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldStringListInputComponent, deps: [{ token: i3.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
668
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldStringListInputComponent, isStandalone: false, selector: "shared-form-field-string-list-input", inputs: { config: "config", fieldData: "fieldData", form: "form" }, ngImport: i0, template: "<div class=\"textarea-field-width string-list-field\">\n <form [formGroup]=\"mainForm\">\n <mat-label\n class=\"label-field\"\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n\n <div class=\"items\" formArrayName=\"items\">\n <div class=\"row\" *ngFor=\"let item of items.controls; let i = index\">\n <div class=\"col-11\">\n <input class=\"list-item\" matInput [formControlName]=\"i\" placeholder=\"\u0417\u0430\u043F\u0438\u0441\u044C {{ i + 1 }}\">\n </div>\n <div class=\"col-1 d-flex justify-content-center align-items-center\">\n <button class=\"no-border\" type=\"button\" (click)=\"removeItem(i)\">\n <shared-ui-icon icon=\"close\" color=\"red\"></shared-ui-icon>\n </button>\n </div>\n </div>\n <div class=\"text-center mt-10\">\n <button class=\"no-border\" type=\"button\" (click)=\"addItem()\">\n <shared-ui-icon icon=\"add\" size=\"xs\" color=\"green\"></shared-ui-icon>\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [".label-field{position:absolute;background:#f8f8f8;margin:-11px 0 0 13px;padding:0 10px;font-size:12px}.items{border:1px solid #bfb7b7;border-radius:8px;padding:10px}.list-item{background:#efefef}.list-item .row{margin-bottom:5px}.no-border{border:none;background:transparent!important}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$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: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i1.IconComponent, selector: "shared-ui-icon", inputs: ["icon", "size", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
669
|
+
}
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldStringListInputComponent, decorators: [{
|
|
671
|
+
type: Component,
|
|
672
|
+
args: [{ selector: 'shared-form-field-string-list-input', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"textarea-field-width string-list-field\">\n <form [formGroup]=\"mainForm\">\n <mat-label\n class=\"label-field\"\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n\n <div class=\"items\" formArrayName=\"items\">\n <div class=\"row\" *ngFor=\"let item of items.controls; let i = index\">\n <div class=\"col-11\">\n <input class=\"list-item\" matInput [formControlName]=\"i\" placeholder=\"\u0417\u0430\u043F\u0438\u0441\u044C {{ i + 1 }}\">\n </div>\n <div class=\"col-1 d-flex justify-content-center align-items-center\">\n <button class=\"no-border\" type=\"button\" (click)=\"removeItem(i)\">\n <shared-ui-icon icon=\"close\" color=\"red\"></shared-ui-icon>\n </button>\n </div>\n </div>\n <div class=\"text-center mt-10\">\n <button class=\"no-border\" type=\"button\" (click)=\"addItem()\">\n <shared-ui-icon icon=\"add\" size=\"xs\" color=\"green\"></shared-ui-icon>\n </button>\n </div>\n </div>\n </form>\n</div>\n", styles: [".label-field{position:absolute;background:#f8f8f8;margin:-11px 0 0 13px;padding:0 10px;font-size:12px}.items{border:1px solid #bfb7b7;border-radius:8px;padding:10px}.list-item{background:#efefef}.list-item .row{margin-bottom:5px}.no-border{border:none;background:transparent!important}\n"] }]
|
|
673
|
+
}], ctorParameters: () => [{ type: i3.FormBuilder }], propDecorators: { config: [{
|
|
674
|
+
type: Input
|
|
675
|
+
}], fieldData: [{
|
|
676
|
+
type: Input
|
|
677
|
+
}], form: [{
|
|
678
|
+
type: Input
|
|
679
|
+
}] } });
|
|
680
|
+
|
|
681
|
+
class FormFieldFileComponent {
|
|
682
|
+
constructor(cd, dialogService, requestsFacade, notificationsFacade, formDeleteFileFacade) {
|
|
683
|
+
this.cd = cd;
|
|
684
|
+
this.dialogService = dialogService;
|
|
685
|
+
this.requestsFacade = requestsFacade;
|
|
686
|
+
this.notificationsFacade = notificationsFacade;
|
|
687
|
+
this.formDeleteFileFacade = formDeleteFileFacade;
|
|
688
|
+
this.inputStatus = "1";
|
|
689
|
+
this.formDeleteFile = "form-delete-file";
|
|
690
|
+
this.putMethod = "put";
|
|
691
|
+
this.requestStatuses = RequestStatus;
|
|
692
|
+
this.currentPristineValue = false;
|
|
693
|
+
this.destroy$ = new Subject();
|
|
694
|
+
this.Math = Math;
|
|
695
|
+
}
|
|
696
|
+
ngOnInit() {
|
|
697
|
+
this.statusChanges$ = this.form.valueChanges;
|
|
698
|
+
// If the form reset, need to clear the field
|
|
699
|
+
/*
|
|
700
|
+
@TODO Need to test
|
|
701
|
+
this.form.statusChanges
|
|
702
|
+
.pipe(
|
|
703
|
+
untilComponentDestroyed(this)
|
|
704
|
+
)
|
|
705
|
+
.subscribe(() => {
|
|
706
|
+
if (!this.currentPristineValue && this.form.pristine) {
|
|
707
|
+
this.clearFile();
|
|
708
|
+
}
|
|
709
|
+
this.currentPristineValue = this.form.pristine;
|
|
710
|
+
});*/
|
|
711
|
+
}
|
|
712
|
+
ngOnChanges(changes) {
|
|
713
|
+
const field = this.fieldData.field;
|
|
714
|
+
if (field && this.form) {
|
|
715
|
+
this.fileName = this.form.get(field)?.value || "";
|
|
716
|
+
this.imageVersions = this.form.get(field)?.value?.versions || "";
|
|
717
|
+
if (this.fileName || this.imageVersions) {
|
|
718
|
+
this.inputStatus = "0";
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
ngOnDestroy() {
|
|
723
|
+
this.destroy$.next();
|
|
724
|
+
this.destroy$.complete();
|
|
725
|
+
}
|
|
726
|
+
ngAfterViewInit() {
|
|
727
|
+
this.form.get(this.fieldData.field).statusChanges
|
|
728
|
+
.pipe(distinctUntilChanged(), takeUntil(this.destroy$))
|
|
729
|
+
.subscribe(() => {
|
|
730
|
+
this.cd.markForCheck();
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
onFileChange(event) {
|
|
734
|
+
if (event.target.files.length > 0) {
|
|
735
|
+
const file = event.target.files[0];
|
|
736
|
+
if (this.isFileValid(file)) {
|
|
737
|
+
this.selectedFile = file;
|
|
738
|
+
this.form.get(this.fieldData.field).setValue(file);
|
|
739
|
+
const reader = new FileReader();
|
|
740
|
+
reader.readAsDataURL(file);
|
|
741
|
+
reader.onload = (_event) => {
|
|
742
|
+
this.imageSource = reader.result;
|
|
743
|
+
this.inputStatus = "0";
|
|
744
|
+
this.cd.markForCheck();
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
this.input.nativeElement.value = "";
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
isFileValid(file) {
|
|
753
|
+
let result = true;
|
|
754
|
+
const allowedExtensions = this.fieldData.options?.fileSettings?.allowedExtensions;
|
|
755
|
+
const sizeLimit = this.fieldData.options?.fileSettings?.sizeLimit;
|
|
756
|
+
if (allowedExtensions) {
|
|
757
|
+
const findType = allowedExtensions.split(',').find(type => {
|
|
758
|
+
return file.type.toLowerCase().indexOf(type.trim().toLowerCase()) !== -1;
|
|
759
|
+
});
|
|
760
|
+
if (!findType) {
|
|
761
|
+
const notification = {
|
|
762
|
+
id: 5,
|
|
763
|
+
type: 'error',
|
|
764
|
+
text: 'Не допустимый тип файла',
|
|
765
|
+
title: 'Ошибка загрузки файла',
|
|
766
|
+
timeout: 2000
|
|
767
|
+
};
|
|
768
|
+
this.notificationsFacade.addNotifications(notification);
|
|
769
|
+
result = false;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
if (result && sizeLimit && (file.size / 1024) > sizeLimit) {
|
|
773
|
+
const notification = {
|
|
774
|
+
id: 5,
|
|
775
|
+
type: 'error',
|
|
776
|
+
text: 'Не допустимый размер файла',
|
|
777
|
+
title: 'Ошибка загрузки файла',
|
|
778
|
+
timeout: 2000
|
|
779
|
+
};
|
|
780
|
+
this.notificationsFacade.addNotifications(notification);
|
|
781
|
+
result = false;
|
|
782
|
+
}
|
|
783
|
+
return result;
|
|
784
|
+
}
|
|
785
|
+
deleteImage() {
|
|
786
|
+
const id = this.form.get("id")?.value;
|
|
787
|
+
const field = this.fieldData.field;
|
|
788
|
+
if (id) {
|
|
789
|
+
this.dialogService.openDeleteDialog()
|
|
790
|
+
.pipe(takeUntil(this.destroy$))
|
|
791
|
+
.subscribe((result) => {
|
|
792
|
+
if (result) {
|
|
793
|
+
if (!this.imageSource) {
|
|
794
|
+
this.initRequest();
|
|
795
|
+
this.formDeleteFileFacade.formDeleteFile(this.entity, id, field);
|
|
796
|
+
this.form.get(this.fieldData.field).setValue("");
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
this.clearFile();
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
else if (this.selectedFile) {
|
|
805
|
+
this.selectedFile = null;
|
|
806
|
+
this.inputStatus = '1';
|
|
807
|
+
this.input.nativeElement.value = "";
|
|
808
|
+
this.form.get(this.fieldData.field).setValue("");
|
|
809
|
+
this.cd.markForCheck();
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
initRequest() {
|
|
813
|
+
if (!this.request$ && this.form.get("id")) {
|
|
814
|
+
this.requestsFacade.createRequestListener(this.formDeleteFile, this.putMethod);
|
|
815
|
+
this.request$ = this.requestsFacade.getRequestUpdates(this.formDeleteFile, this.putMethod);
|
|
816
|
+
this.request$
|
|
817
|
+
.pipe(filter(request => request.status === this.requestStatuses.LOADED), take(1), takeUntil(this.destroy$))
|
|
818
|
+
.subscribe((data) => {
|
|
819
|
+
this.clearFile();
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
clearFile() {
|
|
824
|
+
this.input.nativeElement.value = "";
|
|
825
|
+
this.imageSource = "";
|
|
826
|
+
this.imageVersions = null;
|
|
827
|
+
this.inputStatus = "1";
|
|
828
|
+
this.cd.markForCheck();
|
|
829
|
+
}
|
|
830
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFileComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.DialogService }, { token: i1.RequestsFacade }, { token: i1.NotificationsFacade }, { token: i1.FormDeleteFileFacade }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
831
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldFileComponent, isStandalone: false, selector: "shared-form-field-file", inputs: { config: "config", fieldData: "fieldData", form: "form", entity: "entity" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"form-field-file\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"form-select-list-options pb-10 width100\">\n <mat-label\n class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}\n </mat-label>\n <div\n @appearFromLeft\n *ngIf=\"selectedFile || fileName\"\n class=\"form-field-file-image\">\n <div *ngIf=\"selectedFile\" class=\"position-relative mat-elevation-z3 image-block\">\n <div class=\"form-field-file-close mat-elevation-z4\" (click)=\"deleteImage()\">\n <mat-icon class=\"fs-14\">close</mat-icon>\n </div>\n <ng-container *ngIf=\"fieldData.options?.fileSettings?.isImage\">\n <img [src]=\"imageSource\" [alt]=\"selectedFile.name\">\n </ng-container>\n <ng-container *ngIf=\"!fieldData.options?.fileSettings?.isImage\">\n <div class=\"form-field-file-selected-file\">\n \u0424\u0430\u0439\u043B: {{ selectedFile.name }} ( {{ Math.round(selectedFile.size / 1024) }}kb )\n </div>\n </ng-container>\n\n </div>\n <ng-container *ngIf=\"fileName && !selectedFile\">\n <div *ngIf=\"fieldData.options?.fileSettings?.isImage && fileName\" class=\"position-relative image-block\">\n <shared-image\n class=\"width150100 display-block\"\n [versions]=\"imageVersions\"\n [version]=\"1\"\n (delete)=\"deleteImage()\"></shared-image>\n </div>\n <div *ngIf=\"!fieldData.options?.fileSettings?.isImage && fileName\" class=\"position-relative image-block\">\n \u0424\u0430\u0439\u043B: {{ fileName }} Downloaded???\n </div>\n </ng-container>\n </div>\n <div\n [@inputAnim]=\"inputStatus\"\n class=\"input\">\n <input #input\n type=\"file\"\n (change)=\"onFileChange($event)\"/>\n </div>\n <div *ngIf=\"fieldData.options?.fileSettings?.allowedExtensions || fieldData.options?.fileSettings?.sizeLimit\"\n class=\"form-field-file-text\">\n <div *ngIf=\"fieldData.options?.fileSettings?.allowedExtensions\">\n \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0435 \u0442\u0438\u043F\u044B: <b>{{ fieldData.options?.fileSettings?.allowedExtensions }}</b>\n </div>\n <div *ngIf=\"fieldData.options?.fileSettings?.sizeLimit\">\n \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430: <b>{{ fieldData.options?.fileSettings?.sizeLimit }}kb</b>\n </div>\n </div>\n </div>\n <shared-spinner\n *ngIf=\"(request$ | async)?.status === requestStatuses.LOADING\"\n [overlay]=\"true\"\n [diameter]=\"20\"\n [color]=\"'blue'\"></shared-spinner>\n</div>\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336;transition:all .15s ease;opacity:.6}.form-field-file .form-field-file-image .form-field-file-close mat-icon{transition:transform .15s ease;width:15px;height:15px;min-width:15px;min-height:15px;margin-left:1px;margin-top:3px;font-size:14px}.form-field-file .form-field-file-image .form-field-file-close:hover{opacity:1}.form-field-file .form-field-file-image .form-field-file-close:hover mat-icon{transform:rotate(90deg);font-size:16px}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close{width:25px;height:25px;opacity:.8}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close mat-icon{width:18px;min-width:18px;height:18px;min-height:18px;font-size:18px}.form-field-file .position-absolute{position:absolute}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px}.field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-field-file-text{font-size:12px;margin-top:10px;margin-left:13px}.form-field-file-selected-file{padding:15px 30px 15px 15px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i1.SpinnerComponent, selector: "shared-spinner", inputs: ["overlay", "diameter", "color", "position"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i1.ImageComponent, selector: "shared-image", inputs: ["versions", "url", "version", "title", "index", "haveZoom", "imgClass", "loading", "width", "height", "sizes"], outputs: ["clickEvent", "delete"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], animations: [
|
|
832
|
+
appearFromLeft,
|
|
833
|
+
trigger("inputAnim", [
|
|
834
|
+
state("0", style({
|
|
835
|
+
opacity: 0,
|
|
836
|
+
height: "0px"
|
|
837
|
+
})),
|
|
838
|
+
state("1", style({
|
|
839
|
+
opacity: 1,
|
|
840
|
+
height: "auto"
|
|
841
|
+
})),
|
|
842
|
+
transition("0 => 1", [
|
|
843
|
+
animate("500ms")
|
|
844
|
+
]),
|
|
845
|
+
transition("1 => 0", [
|
|
846
|
+
animate("500ms")
|
|
847
|
+
])
|
|
848
|
+
])
|
|
849
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
850
|
+
}
|
|
851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFileComponent, decorators: [{
|
|
852
|
+
type: Component,
|
|
853
|
+
args: [{ selector: "shared-form-field-file", changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
854
|
+
appearFromLeft,
|
|
855
|
+
trigger("inputAnim", [
|
|
856
|
+
state("0", style({
|
|
857
|
+
opacity: 0,
|
|
858
|
+
height: "0px"
|
|
859
|
+
})),
|
|
860
|
+
state("1", style({
|
|
861
|
+
opacity: 1,
|
|
862
|
+
height: "auto"
|
|
863
|
+
})),
|
|
864
|
+
transition("0 => 1", [
|
|
865
|
+
animate("500ms")
|
|
866
|
+
]),
|
|
867
|
+
transition("1 => 0", [
|
|
868
|
+
animate("500ms")
|
|
869
|
+
])
|
|
870
|
+
])
|
|
871
|
+
], standalone: false, template: "<div class=\"form-field-file\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"form-select-list-options pb-10 width100\">\n <mat-label\n class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}\n </mat-label>\n <div\n @appearFromLeft\n *ngIf=\"selectedFile || fileName\"\n class=\"form-field-file-image\">\n <div *ngIf=\"selectedFile\" class=\"position-relative mat-elevation-z3 image-block\">\n <div class=\"form-field-file-close mat-elevation-z4\" (click)=\"deleteImage()\">\n <mat-icon class=\"fs-14\">close</mat-icon>\n </div>\n <ng-container *ngIf=\"fieldData.options?.fileSettings?.isImage\">\n <img [src]=\"imageSource\" [alt]=\"selectedFile.name\">\n </ng-container>\n <ng-container *ngIf=\"!fieldData.options?.fileSettings?.isImage\">\n <div class=\"form-field-file-selected-file\">\n \u0424\u0430\u0439\u043B: {{ selectedFile.name }} ( {{ Math.round(selectedFile.size / 1024) }}kb )\n </div>\n </ng-container>\n\n </div>\n <ng-container *ngIf=\"fileName && !selectedFile\">\n <div *ngIf=\"fieldData.options?.fileSettings?.isImage && fileName\" class=\"position-relative image-block\">\n <shared-image\n class=\"width150100 display-block\"\n [versions]=\"imageVersions\"\n [version]=\"1\"\n (delete)=\"deleteImage()\"></shared-image>\n </div>\n <div *ngIf=\"!fieldData.options?.fileSettings?.isImage && fileName\" class=\"position-relative image-block\">\n \u0424\u0430\u0439\u043B: {{ fileName }} Downloaded???\n </div>\n </ng-container>\n </div>\n <div\n [@inputAnim]=\"inputStatus\"\n class=\"input\">\n <input #input\n type=\"file\"\n (change)=\"onFileChange($event)\"/>\n </div>\n <div *ngIf=\"fieldData.options?.fileSettings?.allowedExtensions || fieldData.options?.fileSettings?.sizeLimit\"\n class=\"form-field-file-text\">\n <div *ngIf=\"fieldData.options?.fileSettings?.allowedExtensions\">\n \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0435 \u0442\u0438\u043F\u044B: <b>{{ fieldData.options?.fileSettings?.allowedExtensions }}</b>\n </div>\n <div *ngIf=\"fieldData.options?.fileSettings?.sizeLimit\">\n \u0414\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B\u0439 \u0440\u0430\u0437\u043C\u0435\u0440 \u0444\u0430\u0439\u043B\u0430: <b>{{ fieldData.options?.fileSettings?.sizeLimit }}kb</b>\n </div>\n </div>\n </div>\n <shared-spinner\n *ngIf=\"(request$ | async)?.status === requestStatuses.LOADING\"\n [overlay]=\"true\"\n [diameter]=\"20\"\n [color]=\"'blue'\"></shared-spinner>\n</div>\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336;transition:all .15s ease;opacity:.6}.form-field-file .form-field-file-image .form-field-file-close mat-icon{transition:transform .15s ease;width:15px;height:15px;min-width:15px;min-height:15px;margin-left:1px;margin-top:3px;font-size:14px}.form-field-file .form-field-file-image .form-field-file-close:hover{opacity:1}.form-field-file .form-field-file-image .form-field-file-close:hover mat-icon{transform:rotate(90deg);font-size:16px}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close{width:25px;height:25px;opacity:.8}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close mat-icon{width:18px;min-width:18px;height:18px;min-height:18px;font-size:18px}.form-field-file .position-absolute{position:absolute}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px}.field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-field-file-text{font-size:12px;margin-top:10px;margin-left:13px}.form-field-file-selected-file{padding:15px 30px 15px 15px}\n"] }]
|
|
872
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.DialogService }, { type: i1.RequestsFacade }, { type: i1.NotificationsFacade }, { type: i1.FormDeleteFileFacade }], propDecorators: { config: [{
|
|
873
|
+
type: Input
|
|
874
|
+
}], fieldData: [{
|
|
875
|
+
type: Input
|
|
876
|
+
}], form: [{
|
|
877
|
+
type: Input
|
|
878
|
+
}], entity: [{
|
|
879
|
+
type: Input
|
|
880
|
+
}], input: [{
|
|
881
|
+
type: ViewChild,
|
|
882
|
+
args: ["input", { static: false }]
|
|
883
|
+
}] } });
|
|
884
|
+
|
|
885
|
+
class FormFieldFilesComponent {
|
|
886
|
+
constructor(cd) {
|
|
887
|
+
this.cd = cd;
|
|
888
|
+
this.unSubscribeSubject$ = new Subject();
|
|
889
|
+
this.inputStatus = "1";
|
|
890
|
+
this.emptyTitle = "Вы сможете добавить фотографии после сохранения";
|
|
891
|
+
}
|
|
892
|
+
ngOnInit() {
|
|
893
|
+
}
|
|
894
|
+
ngOnChanges(changes) {
|
|
895
|
+
if (changes) {
|
|
896
|
+
const field = this.fieldData.field;
|
|
897
|
+
if (field && this.form) {
|
|
898
|
+
this.imageSource = this.getControlValue() || "";
|
|
899
|
+
if (this.imageSource) {
|
|
900
|
+
this.inputStatus = "0";
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
ngOnDestroy() {
|
|
906
|
+
this.unSubscribeSubject$.next();
|
|
907
|
+
this.unSubscribeSubject$.complete();
|
|
908
|
+
}
|
|
909
|
+
ngAfterViewInit() {
|
|
910
|
+
this.form.get(this.fieldData.field).statusChanges
|
|
911
|
+
.pipe(distinctUntilChanged(), takeUntil(this.unSubscribeSubject$))
|
|
912
|
+
.subscribe(() => {
|
|
913
|
+
this.cd.markForCheck();
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
getControlValue() {
|
|
917
|
+
const field = this.fieldData.field;
|
|
918
|
+
let value;
|
|
919
|
+
const controlValue = this.form.get(field).value;
|
|
920
|
+
if (controlValue && typeof controlValue === "object") {
|
|
921
|
+
if (controlValue[2]) {
|
|
922
|
+
value = controlValue[2];
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
else
|
|
926
|
+
value = controlValue;
|
|
927
|
+
return value;
|
|
928
|
+
}
|
|
929
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFilesComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
930
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldFilesComponent, isStandalone: false, selector: "shared-form-field-files", inputs: { config: "config", fieldData: "fieldData", form: "form", itemId: "itemId" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"form-field-file\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"pb-10 width100\">\n <div *ngIf=\"itemId\" class=\"mb-15 display-flex align-baseline form-field-input border-block\">\n <mat-label>{{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}</mat-label>\n <shared-files-upload [haveElevation]=\"false\"\n [section]=\"fieldData.options?.filesSection\"\n [filesType]=\"fieldData.options?.filesType\"\n [itemId]=\"itemId\"></shared-files-upload>\n\n </div>\n <div *ngIf=\"!itemId\" class=\"display-flex-align-center empty-list\">\n {{emptyTitle}}\n </div>\n </div>\n</div>\n\n\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-input mat-label{color:#5f5b5b;font-size:12px;padding:0 5px;position:absolute;background-color:#fff;top:-10px;left:10px}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336}.form-field-file .position-absolute{position:absolute}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.FilesUploadComponent, selector: "shared-files-upload", inputs: ["section", "itemId", "filesType", "haveElevation"] }], animations: [
|
|
931
|
+
appearFromLeft,
|
|
932
|
+
trigger("inputAnim", [
|
|
933
|
+
state("0", style({
|
|
934
|
+
opacity: 0
|
|
935
|
+
})),
|
|
936
|
+
state("1", style({
|
|
937
|
+
opacity: 1
|
|
938
|
+
})),
|
|
939
|
+
transition("0 => 1", [
|
|
940
|
+
animate("500ms")
|
|
941
|
+
]),
|
|
942
|
+
transition("1 => 0", [
|
|
943
|
+
animate("500ms")
|
|
944
|
+
])
|
|
945
|
+
])
|
|
946
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
947
|
+
}
|
|
948
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFilesComponent, decorators: [{
|
|
949
|
+
type: Component,
|
|
950
|
+
args: [{ selector: "shared-form-field-files", changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
951
|
+
appearFromLeft,
|
|
952
|
+
trigger("inputAnim", [
|
|
953
|
+
state("0", style({
|
|
954
|
+
opacity: 0
|
|
955
|
+
})),
|
|
956
|
+
state("1", style({
|
|
957
|
+
opacity: 1
|
|
958
|
+
})),
|
|
959
|
+
transition("0 => 1", [
|
|
960
|
+
animate("500ms")
|
|
961
|
+
]),
|
|
962
|
+
transition("1 => 0", [
|
|
963
|
+
animate("500ms")
|
|
964
|
+
])
|
|
965
|
+
])
|
|
966
|
+
], standalone: false, template: "<div class=\"form-field-file\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"pb-10 width100\">\n <div *ngIf=\"itemId\" class=\"mb-15 display-flex align-baseline form-field-input border-block\">\n <mat-label>{{fieldData.title}}{{fieldData.validators && fieldData.validators.includes('required') ? ' *' : ''}}</mat-label>\n <shared-files-upload [haveElevation]=\"false\"\n [section]=\"fieldData.options?.filesSection\"\n [filesType]=\"fieldData.options?.filesType\"\n [itemId]=\"itemId\"></shared-files-upload>\n\n </div>\n <div *ngIf=\"!itemId\" class=\"display-flex-align-center empty-list\">\n {{emptyTitle}}\n </div>\n </div>\n</div>\n\n\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-input mat-label{color:#5f5b5b;font-size:12px;padding:0 5px;position:absolute;background-color:#fff;top:-10px;left:10px}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336}.form-field-file .position-absolute{position:absolute}\n"] }]
|
|
967
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
968
|
+
type: Input
|
|
969
|
+
}], fieldData: [{
|
|
970
|
+
type: Input
|
|
971
|
+
}], form: [{
|
|
972
|
+
type: Input
|
|
973
|
+
}], itemId: [{
|
|
974
|
+
type: Input
|
|
975
|
+
}], input: [{
|
|
976
|
+
type: ViewChild,
|
|
977
|
+
args: ["input", { static: false }]
|
|
978
|
+
}] } });
|
|
979
|
+
|
|
980
|
+
class FormFieldFileShowComponent {
|
|
981
|
+
constructor(platformId, authenticationService) {
|
|
982
|
+
this.platformId = platformId;
|
|
983
|
+
this.authenticationService = authenticationService;
|
|
984
|
+
}
|
|
985
|
+
downloadFileHandler() {
|
|
986
|
+
const fullFileUrl = `http://localhost:3020/api/static-data/files?fileUrl=${this.value}`;
|
|
987
|
+
event.preventDefault();
|
|
988
|
+
const userData = this.authenticationService.currentUserValue;
|
|
989
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
990
|
+
// 2. Fetch the file from your API
|
|
991
|
+
fetch(fullFileUrl, {
|
|
992
|
+
method: 'GET',
|
|
993
|
+
headers: {
|
|
994
|
+
'Authorization': `Bearer ${userData.token}`,
|
|
995
|
+
}
|
|
996
|
+
})
|
|
997
|
+
.then(response => {
|
|
998
|
+
if (!response.ok)
|
|
999
|
+
throw new Error('Network response failed');
|
|
1000
|
+
return response.blob(); // Crucial: Parse response as a binary blob
|
|
1001
|
+
})
|
|
1002
|
+
.then(blob => {
|
|
1003
|
+
// 3. Create a local URL representing the file object
|
|
1004
|
+
const fileUrl = URL.createObjectURL(blob);
|
|
1005
|
+
// 4. Open the generated file URL in a new browser tab
|
|
1006
|
+
window.open(fileUrl, '_blank');
|
|
1007
|
+
// 5. Optional: Clean up memory after a short delay
|
|
1008
|
+
setTimeout(() => URL.revokeObjectURL(fileUrl), 100);
|
|
1009
|
+
})
|
|
1010
|
+
.catch(error => {
|
|
1011
|
+
console.error('Error opening file:', error);
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
console.error('[ form-field-file-show ][ action possible only in a browser ]');
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFileShowComponent, deps: [{ token: PLATFORM_ID }, { token: i1.AuthenticationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1019
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldFileShowComponent, isStandalone: false, selector: "shared-form-field-file-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div\n @appearFromLeft\n *ngIf=\"value\"\n class=\"form-field-file-image\">\n <div *ngIf=\"fieldData.options?.fileSettings?.isImage\" class=\"image-block mlr--5\">\n <shared-image class=\"mlr-5 mat-elevation-z3 width150100\"\n [versions]=\"value.versions\"\n [version]=\"1\"\n [haveZoom]=\"true\"></shared-image>\n </div>\n <div *ngIf=\"!fieldData.options?.fileSettings?.isImage\" class=\"image-block mlr--5\">\n \u0424\u0430\u0439\u043B: <a (click)=\"downloadFileHandler()\">{{value}}</a>\n </div>\n </div>\n </div>\n</div>\n", styles: [".image-block{display:flex;margin-bottom:10px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ImageComponent, selector: "shared-image", inputs: ["versions", "url", "version", "title", "index", "haveZoom", "imgClass", "loading", "width", "height", "sizes"], outputs: ["clickEvent", "delete"] }], animations: [
|
|
1020
|
+
appearFromLeft,
|
|
1021
|
+
trigger('inputAnim', [
|
|
1022
|
+
state('0', style({
|
|
1023
|
+
opacity: 0
|
|
1024
|
+
})),
|
|
1025
|
+
state('1', style({
|
|
1026
|
+
opacity: 1
|
|
1027
|
+
})),
|
|
1028
|
+
transition('0 => 1', [
|
|
1029
|
+
animate('500ms')
|
|
1030
|
+
]),
|
|
1031
|
+
transition('1 => 0', [
|
|
1032
|
+
animate('500ms')
|
|
1033
|
+
])
|
|
1034
|
+
])
|
|
1035
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1036
|
+
}
|
|
1037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFileShowComponent, decorators: [{
|
|
1038
|
+
type: Component,
|
|
1039
|
+
args: [{ selector: 'shared-form-field-file-show', changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
1040
|
+
appearFromLeft,
|
|
1041
|
+
trigger('inputAnim', [
|
|
1042
|
+
state('0', style({
|
|
1043
|
+
opacity: 0
|
|
1044
|
+
})),
|
|
1045
|
+
state('1', style({
|
|
1046
|
+
opacity: 1
|
|
1047
|
+
})),
|
|
1048
|
+
transition('0 => 1', [
|
|
1049
|
+
animate('500ms')
|
|
1050
|
+
]),
|
|
1051
|
+
transition('1 => 0', [
|
|
1052
|
+
animate('500ms')
|
|
1053
|
+
])
|
|
1054
|
+
])
|
|
1055
|
+
], standalone: false, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div\n @appearFromLeft\n *ngIf=\"value\"\n class=\"form-field-file-image\">\n <div *ngIf=\"fieldData.options?.fileSettings?.isImage\" class=\"image-block mlr--5\">\n <shared-image class=\"mlr-5 mat-elevation-z3 width150100\"\n [versions]=\"value.versions\"\n [version]=\"1\"\n [haveZoom]=\"true\"></shared-image>\n </div>\n <div *ngIf=\"!fieldData.options?.fileSettings?.isImage\" class=\"image-block mlr--5\">\n \u0424\u0430\u0439\u043B: <a (click)=\"downloadFileHandler()\">{{value}}</a>\n </div>\n </div>\n </div>\n</div>\n", styles: [".image-block{display:flex;margin-bottom:10px}\n"] }]
|
|
1056
|
+
}], ctorParameters: () => [{ type: Object, decorators: [{
|
|
1057
|
+
type: Inject,
|
|
1058
|
+
args: [PLATFORM_ID]
|
|
1059
|
+
}] }, { type: i1.AuthenticationService }], propDecorators: { config: [{
|
|
1060
|
+
type: Input
|
|
1061
|
+
}], fieldData: [{
|
|
1062
|
+
type: Input
|
|
1063
|
+
}], value: [{
|
|
1064
|
+
type: Input
|
|
1065
|
+
}] } });
|
|
1066
|
+
|
|
1067
|
+
class FormFieldSlideToggleShowComponent {
|
|
1068
|
+
constructor() {
|
|
1069
|
+
this.trueTitle = 'Да';
|
|
1070
|
+
this.falseTitle = 'Нет';
|
|
1071
|
+
}
|
|
1072
|
+
ngOnInit() {
|
|
1073
|
+
if (this.fieldData.options.toggleView?.trueTitle) {
|
|
1074
|
+
this.trueTitle = this.fieldData.options.toggleView?.trueTitle;
|
|
1075
|
+
}
|
|
1076
|
+
if (this.fieldData.options.toggleView?.falseTitle) {
|
|
1077
|
+
this.falseTitle = this.fieldData.options.toggleView?.falseTitle;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSlideToggleShowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1081
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldSlideToggleShowComponent, isStandalone: false, selector: "shared-form-field-slide-toggle-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\" class=\"d-flex align-items-center field-slide-toggle-show\">\n <label class=\"show-label\">{{ fieldData.title }}: </label>\n <div class=\"d-flex align-items-center display-flex-align-center form-field-value\" [ngClass]=\"{'color-green': value, 'color-red': !value }\">\n <ng-container *ngIf=\"value\">\n <mat-icon>check</mat-icon>\n {{ trueTitle }}\n </ng-container>\n <ng-container *ngIf=\"!value\">\n <mat-icon>clear</mat-icon>\n {{ falseTitle }}\n </ng-container>\n </div>\n</div>\n", styles: [".field-slide-toggle-show{display:flex;align-items:center}.field-slide-toggle-show .show-label{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1082
|
+
}
|
|
1083
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldSlideToggleShowComponent, decorators: [{
|
|
1084
|
+
type: Component,
|
|
1085
|
+
args: [{ selector: 'shared-form-field-slide-toggle-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\" class=\"d-flex align-items-center field-slide-toggle-show\">\n <label class=\"show-label\">{{ fieldData.title }}: </label>\n <div class=\"d-flex align-items-center display-flex-align-center form-field-value\" [ngClass]=\"{'color-green': value, 'color-red': !value }\">\n <ng-container *ngIf=\"value\">\n <mat-icon>check</mat-icon>\n {{ trueTitle }}\n </ng-container>\n <ng-container *ngIf=\"!value\">\n <mat-icon>clear</mat-icon>\n {{ falseTitle }}\n </ng-container>\n </div>\n</div>\n", styles: [".field-slide-toggle-show{display:flex;align-items:center}.field-slide-toggle-show .show-label{margin-bottom:0}\n"] }]
|
|
1086
|
+
}], propDecorators: { config: [{
|
|
1087
|
+
type: Input
|
|
1088
|
+
}], fieldData: [{
|
|
1089
|
+
type: Input
|
|
1090
|
+
}], value: [{
|
|
1091
|
+
type: Input
|
|
1092
|
+
}] } });
|
|
1093
|
+
|
|
1094
|
+
class FormFieldInputShowComponent {
|
|
1095
|
+
constructor(datePipe) {
|
|
1096
|
+
this.datePipe = datePipe;
|
|
1097
|
+
}
|
|
1098
|
+
ngOnChanges(changes) {
|
|
1099
|
+
if (changes?.value) {
|
|
1100
|
+
this.checkInputType(changes?.value.currentValue);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
checkInputType(value) {
|
|
1104
|
+
switch (this.fieldData.options?.format) {
|
|
1105
|
+
case IFormFieldFormat.Email:
|
|
1106
|
+
this.inputValue = value;
|
|
1107
|
+
break;
|
|
1108
|
+
case IFormFieldFormat.Phone:
|
|
1109
|
+
this.inputValue = value;
|
|
1110
|
+
break;
|
|
1111
|
+
case IFormFieldFormat.Date:
|
|
1112
|
+
const params = value?.split('-');
|
|
1113
|
+
this.inputValue = params?.length === 3 ? `${params[2]}.${params[1]}.${params[0]}` : '---';
|
|
1114
|
+
break;
|
|
1115
|
+
case IFormFieldFormat.DateTime:
|
|
1116
|
+
this.inputValue = this.datePipe.transform(value, 'hh:mm MM.dd.yyyy');
|
|
1117
|
+
break;
|
|
1118
|
+
default:
|
|
1119
|
+
this.inputValue = value;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldInputShowComponent, deps: [{ token: i2.DatePipe }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1123
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldInputShowComponent, isStandalone: false, selector: "shared-form-field-input-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, providers: [DatePipe], usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"field width100\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"display-flex align-baseline\">\n {{inputValue}}\n </div>\n </div>\n</div>\n", styles: [".small-form-width-form-field .show-label{margin-bottom:0}.field{display:flex}.field label{padding-right:5px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1124
|
+
}
|
|
1125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldInputShowComponent, decorators: [{
|
|
1126
|
+
type: Component,
|
|
1127
|
+
args: [{ selector: 'shared-form-field-input-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, providers: [DatePipe], template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"field width100\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"display-flex align-baseline\">\n {{inputValue}}\n </div>\n </div>\n</div>\n", styles: [".small-form-width-form-field .show-label{margin-bottom:0}.field{display:flex}.field label{padding-right:5px}\n"] }]
|
|
1128
|
+
}], ctorParameters: () => [{ type: i2.DatePipe }], propDecorators: { config: [{
|
|
1129
|
+
type: Input
|
|
1130
|
+
}], fieldData: [{
|
|
1131
|
+
type: Input
|
|
1132
|
+
}], value: [{
|
|
1133
|
+
type: Input
|
|
1134
|
+
}] } });
|
|
1135
|
+
|
|
1136
|
+
class FormFieldFilesShowComponent {
|
|
1137
|
+
constructor(filesFacade) {
|
|
1138
|
+
this.filesFacade = filesFacade;
|
|
1139
|
+
}
|
|
1140
|
+
ngOnInit() {
|
|
1141
|
+
if (this.entityId && this.entitySection) {
|
|
1142
|
+
this.loadFiles();
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
ngOnDestroy() {
|
|
1146
|
+
}
|
|
1147
|
+
loadFiles() {
|
|
1148
|
+
const params = {
|
|
1149
|
+
itemId: this.entityId,
|
|
1150
|
+
section: this.entitySection
|
|
1151
|
+
};
|
|
1152
|
+
this.files$ = this.filesFacade.getFiles(params)
|
|
1153
|
+
.pipe(take(1));
|
|
1154
|
+
}
|
|
1155
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFilesShowComponent, deps: [{ token: i1.FilesFacade }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1156
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldFilesShowComponent, isStandalone: false, selector: "shared-form-field-files-show", inputs: { config: "config", fieldData: "fieldData", entityId: "entityId", entitySection: "entitySection" }, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div class=\"display-flex align-baseline\">\n <ng-container *ngIf=\"files$ | async as files\">\n <div class=\"position-relative image-block mlr--5\">\n <shared-image *ngFor=\"let file of files\"\n class=\"mlr-5 mat-elevation-z3\"\n [versions]=\"file.versions\"\n [version]=\"1\"\n [haveZoom]=\"true\"></shared-image>\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [".image-block{display:flex}.image-block shared-image{max-width:150px;max-height:100px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ImageComponent, selector: "shared-image", inputs: ["versions", "url", "version", "title", "index", "haveZoom", "imgClass", "loading", "width", "height", "sizes"], outputs: ["clickEvent", "delete"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1157
|
+
}
|
|
1158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldFilesShowComponent, decorators: [{
|
|
1159
|
+
type: Component,
|
|
1160
|
+
args: [{ selector: 'shared-form-field-files-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div class=\"display-flex align-baseline\">\n <ng-container *ngIf=\"files$ | async as files\">\n <div class=\"position-relative image-block mlr--5\">\n <shared-image *ngFor=\"let file of files\"\n class=\"mlr-5 mat-elevation-z3\"\n [versions]=\"file.versions\"\n [version]=\"1\"\n [haveZoom]=\"true\"></shared-image>\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [".image-block{display:flex}.image-block shared-image{max-width:150px;max-height:100px}\n"] }]
|
|
1161
|
+
}], ctorParameters: () => [{ type: i1.FilesFacade }], propDecorators: { config: [{
|
|
1162
|
+
type: Input
|
|
1163
|
+
}], fieldData: [{
|
|
1164
|
+
type: Input
|
|
1165
|
+
}], entityId: [{
|
|
1166
|
+
type: Input
|
|
1167
|
+
}], entitySection: [{
|
|
1168
|
+
type: Input
|
|
1169
|
+
}] } });
|
|
1170
|
+
|
|
1171
|
+
class FormFieldJsonShowComponent {
|
|
1172
|
+
constructor() {
|
|
1173
|
+
}
|
|
1174
|
+
ngOnChanges(changes) {
|
|
1175
|
+
if (changes?.value) {
|
|
1176
|
+
this.inputValue = this.parseInputValue(changes?.value.currentValue);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
parseInputValue(inputValue) {
|
|
1180
|
+
let result = [];
|
|
1181
|
+
Object.keys(inputValue)
|
|
1182
|
+
.forEach((currentField) => {
|
|
1183
|
+
result.push({ field: currentField, value: inputValue[currentField] });
|
|
1184
|
+
});
|
|
1185
|
+
return result;
|
|
1186
|
+
}
|
|
1187
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldJsonShowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1188
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldJsonShowComponent, isStandalone: false, selector: "shared-form-field-json-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"d-flex align-center json-show-block\">\n <div *ngFor=\"let item of inputValue\" class=\"d-flex align-center display-flex-space-between ml-10\">\n <div class=\"json-line-field\">{{item.field}}: </div>\n <div class=\"json-line-value\">{{item.value}}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".small-form-width-form-field .show-label{margin-bottom:0}.json-line-field{margin-right:5px}.json-show-block{background:#efefef;flex-direction:column}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1189
|
+
}
|
|
1190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldJsonShowComponent, decorators: [{
|
|
1191
|
+
type: Component,
|
|
1192
|
+
args: [{ selector: 'shared-form-field-json-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"d-flex align-center json-show-block\">\n <div *ngFor=\"let item of inputValue\" class=\"d-flex align-center display-flex-space-between ml-10\">\n <div class=\"json-line-field\">{{item.field}}: </div>\n <div class=\"json-line-value\">{{item.value}}</div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".small-form-width-form-field .show-label{margin-bottom:0}.json-line-field{margin-right:5px}.json-show-block{background:#efefef;flex-direction:column}\n"] }]
|
|
1193
|
+
}], ctorParameters: () => [], propDecorators: { config: [{
|
|
1194
|
+
type: Input
|
|
1195
|
+
}], fieldData: [{
|
|
1196
|
+
type: Input
|
|
1197
|
+
}], value: [{
|
|
1198
|
+
type: Input
|
|
1199
|
+
}] } });
|
|
1200
|
+
|
|
1201
|
+
class FormFieldTagsComponent {
|
|
1202
|
+
constructor(cd, staticDataFacade) {
|
|
1203
|
+
this.cd = cd;
|
|
1204
|
+
this.staticDataFacade = staticDataFacade;
|
|
1205
|
+
this.tagsContentType = 'tags';
|
|
1206
|
+
this.visible = true;
|
|
1207
|
+
this.selectable = true;
|
|
1208
|
+
this.removable = true;
|
|
1209
|
+
this.separatorKeysCodes = [ENTER];
|
|
1210
|
+
this.tagInputControl = new UntypedFormControl();
|
|
1211
|
+
this.selectedTags = [];
|
|
1212
|
+
this.fruits = [{ name: 'Lemon' }, { name: 'Lime' }, { name: 'Apple' }];
|
|
1213
|
+
this.destroy$ = new Subject();
|
|
1214
|
+
}
|
|
1215
|
+
ngOnInit() {
|
|
1216
|
+
this.subscribeToSearchResult();
|
|
1217
|
+
this.subscribeToFieldStatus();
|
|
1218
|
+
const value = this.form.get(this.fieldData.field).value;
|
|
1219
|
+
if (value?.length) {
|
|
1220
|
+
this.selectedTags = [...value];
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
ngOnDestroy() {
|
|
1224
|
+
this.destroy$.next();
|
|
1225
|
+
this.destroy$.complete();
|
|
1226
|
+
}
|
|
1227
|
+
subscribeToFieldStatus() {
|
|
1228
|
+
this.form.get(this.fieldData.field).statusChanges
|
|
1229
|
+
.pipe(takeUntil(this.destroy$))
|
|
1230
|
+
.subscribe(() => {
|
|
1231
|
+
this.cd.markForCheck();
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
subscribeToSearchResult() {
|
|
1235
|
+
this.tagsList$ = this.staticDataFacade.getStaticData$(this.tagsContentType)
|
|
1236
|
+
.pipe(filter$1(tags => !!tags), map(tags => {
|
|
1237
|
+
const listCurrentTagIds = this.selectedTags.map(item => item.id);
|
|
1238
|
+
return tags.filter(item => !listCurrentTagIds.includes(item.id));
|
|
1239
|
+
}));
|
|
1240
|
+
}
|
|
1241
|
+
enterNew(event) {
|
|
1242
|
+
if (event?.length > 2) {
|
|
1243
|
+
this.staticDataFacade.loadStaticData(this.tagsContentType, { search: event });
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
add(event) {
|
|
1247
|
+
const input = event.input;
|
|
1248
|
+
const value = event.value;
|
|
1249
|
+
const currentValue = this.form.get(this.fieldData.field).value || [];
|
|
1250
|
+
this.form.get(this.fieldData.field).setValue([...currentValue, { name: value }]);
|
|
1251
|
+
if ((value || '').trim()) {
|
|
1252
|
+
this.selectedTags.push({ name: value.trim() });
|
|
1253
|
+
}
|
|
1254
|
+
// Reset the input value
|
|
1255
|
+
if (input) {
|
|
1256
|
+
input.value = '';
|
|
1257
|
+
}
|
|
1258
|
+
this.tagInputControl.setValue(null);
|
|
1259
|
+
}
|
|
1260
|
+
remove(tagId, tagName) {
|
|
1261
|
+
if (tagId) {
|
|
1262
|
+
this.selectedTags = this.selectedTags.filter(item => item.id !== tagId);
|
|
1263
|
+
}
|
|
1264
|
+
else {
|
|
1265
|
+
this.selectedTags = this.selectedTags.filter(item => item.name !== tagName);
|
|
1266
|
+
}
|
|
1267
|
+
this.form.get(this.fieldData.field).setValue([...this.selectedTags]);
|
|
1268
|
+
}
|
|
1269
|
+
selected(event) {
|
|
1270
|
+
this.selectedTags.push({ id: event.option.value, name: event.option.viewValue });
|
|
1271
|
+
this.tagInput.nativeElement.value = '';
|
|
1272
|
+
this.tagInputControl.setValue(null);
|
|
1273
|
+
const currentValue = this.form.get(this.fieldData.field).value || [];
|
|
1274
|
+
this.form.get(this.fieldData.field).setValue([...currentValue, {
|
|
1275
|
+
id: event.option.value,
|
|
1276
|
+
name: event.option.viewValue
|
|
1277
|
+
}]);
|
|
1278
|
+
}
|
|
1279
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldTagsComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.StaticDataFacade }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1280
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldTagsComponent, isStandalone: false, selector: "shared-form-field-tags", inputs: { config: "config", fieldData: "fieldData", form: "form", itemId: "itemId" }, viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "tagInput", first: true, predicate: ["tagInput"], descendants: true }, { propertyName: "matAutocomplete", first: true, predicate: ["auto"], descendants: true }], ngImport: i0, template: "<!--[ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\"-->\n<div [formGroup]=\"form\">\n <mat-form-field class=\"example-chip-list w-100\" appearance=\"outline\">\n <mat-label>\u0422\u044D\u0433\u0438</mat-label>\n <mat-chip-grid #chipGrid aria-label=\"\u0422\u0435\u0433\u0438\">\n <mat-chip-row *ngFor=\"let tag of selectedTags\"\n (removed)=\"remove(tag.id, tag.name)\">\n {{ tag.name }}\n <button matChipRemove [attr.aria-label]=\"'\u0443\u0434\u0430\u043B\u0438\u0442\u044C ' + tag.name\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n </mat-chip-grid>\n <input placeholder=\"\u041D\u043E\u0432\u044B\u0439 \u0442\u044D\u0433...\"\n #tagInput\n [formControl]=\"tagInputControl\"\n [matChipInputFor]=\"chipGrid\"\n [matAutocomplete]=\"auto\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n (matChipInputTokenEnd)=\"add($event)\"\n (ngModelChange)=\"enterNew($event)\"/>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let item of tagsList$ | async\" [value]=\"item.id\">\n {{ item['name'] }}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n</div>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7$1.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i7$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i7$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i7$1.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: i8$1.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i8$1.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1281
|
+
}
|
|
1282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldTagsComponent, decorators: [{
|
|
1283
|
+
type: Component,
|
|
1284
|
+
args: [{ selector: 'shared-form-field-tags', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<!--[ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\"-->\n<div [formGroup]=\"form\">\n <mat-form-field class=\"example-chip-list w-100\" appearance=\"outline\">\n <mat-label>\u0422\u044D\u0433\u0438</mat-label>\n <mat-chip-grid #chipGrid aria-label=\"\u0422\u0435\u0433\u0438\">\n <mat-chip-row *ngFor=\"let tag of selectedTags\"\n (removed)=\"remove(tag.id, tag.name)\">\n {{ tag.name }}\n <button matChipRemove [attr.aria-label]=\"'\u0443\u0434\u0430\u043B\u0438\u0442\u044C ' + tag.name\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-row>\n </mat-chip-grid>\n <input placeholder=\"\u041D\u043E\u0432\u044B\u0439 \u0442\u044D\u0433...\"\n #tagInput\n [formControl]=\"tagInputControl\"\n [matChipInputFor]=\"chipGrid\"\n [matAutocomplete]=\"auto\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n (matChipInputTokenEnd)=\"add($event)\"\n (ngModelChange)=\"enterNew($event)\"/>\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let item of tagsList$ | async\" [value]=\"item.id\">\n {{ item['name'] }}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n</div>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"] }]
|
|
1285
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.StaticDataFacade }], propDecorators: { config: [{
|
|
1286
|
+
type: Input
|
|
1287
|
+
}], fieldData: [{
|
|
1288
|
+
type: Input
|
|
1289
|
+
}], form: [{
|
|
1290
|
+
type: Input
|
|
1291
|
+
}], itemId: [{
|
|
1292
|
+
type: Input
|
|
1293
|
+
}], input: [{
|
|
1294
|
+
type: ViewChild,
|
|
1295
|
+
args: ['input', { static: false }]
|
|
1296
|
+
}], tagInput: [{
|
|
1297
|
+
type: ViewChild,
|
|
1298
|
+
args: ['tagInput']
|
|
1299
|
+
}], matAutocomplete: [{
|
|
1300
|
+
type: ViewChild,
|
|
1301
|
+
args: ['auto']
|
|
1302
|
+
}] } });
|
|
1303
|
+
|
|
1304
|
+
class FormFieldTextareaShowComponent {
|
|
1305
|
+
constructor(cd) {
|
|
1306
|
+
this.cd = cd;
|
|
1307
|
+
}
|
|
1308
|
+
ngOnInit() {
|
|
1309
|
+
this.checkInputType();
|
|
1310
|
+
}
|
|
1311
|
+
ngOnDestroy() {
|
|
1312
|
+
}
|
|
1313
|
+
checkInputType() {
|
|
1314
|
+
switch (this.fieldData.options?.format) {
|
|
1315
|
+
case IFormFieldFormat.Json:
|
|
1316
|
+
this.formatedText = JSON.stringify(this.value);
|
|
1317
|
+
break;
|
|
1318
|
+
default:
|
|
1319
|
+
this.formatedText = this.value;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldTextareaShowComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1323
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldTextareaShowComponent, isStandalone: false, selector: "shared-form-field-textarea-show", inputs: { config: "config", fieldData: "fieldData", value: "value" }, ngImport: i0, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div>{{ formatedText }}</div>\n</div>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1324
|
+
}
|
|
1325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldTextareaShowComponent, decorators: [{
|
|
1326
|
+
type: Component,
|
|
1327
|
+
args: [{ selector: 'shared-form-field-textarea-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div>{{ formatedText }}</div>\n</div>\n", styles: [".form-field-suffix{width:17px;height:17px}.form-field-suffix mat-icon{color:#4caf50;font-size:17px;height:17px!important;width:17px!important;min-width:17px;min-height:17px;font-weight:700!important}.form-field-suffix.input-field-icon-red mat-icon{color:#f44336}\n"] }]
|
|
1328
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
1329
|
+
type: Input
|
|
1330
|
+
}], fieldData: [{
|
|
1331
|
+
type: Input
|
|
1332
|
+
}], value: [{
|
|
1333
|
+
type: Input
|
|
1334
|
+
}] } });
|
|
1335
|
+
|
|
1336
|
+
class FormFieldRatingComponent {
|
|
1337
|
+
constructor() {
|
|
1338
|
+
this.options = new Array(10).fill(0);
|
|
1339
|
+
}
|
|
1340
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldRatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1341
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldRatingComponent, isStandalone: false, selector: "shared-form-field-rating", inputs: { config: "config", fieldData: "fieldData", form: "form" }, ngImport: i0, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100 form-select-list-options\">\n <mat-label class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n <div class=\"display-flex align-baseline\">\n\n <mat-radio-group [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\">\n <mat-radio-button\n *ngFor=\"let item of options; let i = index\"\n [value]=\"i + 1\">\n {{ i + 1 }}\n </mat-radio-button>\n\n </mat-radio-group>\n\n </div>\n </div>\n</div>\n", styles: [".field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i10.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i10.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1342
|
+
}
|
|
1343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldRatingComponent, decorators: [{
|
|
1344
|
+
type: Component,
|
|
1345
|
+
args: [{ selector: 'shared-form-field-rating', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <div class=\"width100 form-select-list-options\">\n <mat-label class=\"field-label\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</mat-label>\n <div class=\"display-flex align-baseline\">\n\n <mat-radio-group [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\">\n <mat-radio-button\n *ngFor=\"let item of options; let i = index\"\n [value]=\"i + 1\">\n {{ i + 1 }}\n </mat-radio-button>\n\n </mat-radio-group>\n\n </div>\n </div>\n</div>\n", styles: [".field-label{position:absolute;background:#f8f8f8;font-size:12px;left:15px;top:-13px;padding:0 5px}.form-select-list-options{border:1px solid #a3a3a3;padding:10px;border-radius:4px}\n"] }]
|
|
1346
|
+
}], propDecorators: { config: [{
|
|
1347
|
+
type: Input
|
|
1348
|
+
}], fieldData: [{
|
|
1349
|
+
type: Input
|
|
1350
|
+
}], form: [{
|
|
1351
|
+
type: Input
|
|
1352
|
+
}] } });
|
|
1353
|
+
|
|
1354
|
+
class CustomDateAdapter extends NativeDateAdapter {
|
|
1355
|
+
parse(value) {
|
|
1356
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
1357
|
+
const parts = value.split(/[\/\.-]/);
|
|
1358
|
+
if (parts.length === 3) {
|
|
1359
|
+
const day = parseInt(parts[0], 10);
|
|
1360
|
+
const month = parseInt(parts[1], 10) - 1;
|
|
1361
|
+
const year = parseInt(parts[2], 10);
|
|
1362
|
+
if (!isNaN(day) && !isNaN(month) && !isNaN(year)) {
|
|
1363
|
+
return new Date(year, month, day);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
const timestamp = typeof value === 'number' ? value : Date.parse(value);
|
|
1368
|
+
return isNaN(timestamp) ? null : new Date(timestamp);
|
|
1369
|
+
}
|
|
1370
|
+
format(date, displayFormat) {
|
|
1371
|
+
if (displayFormat === 'input') {
|
|
1372
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
1373
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
1374
|
+
const year = date.getFullYear();
|
|
1375
|
+
return `${day}/${month}/${year}`;
|
|
1376
|
+
}
|
|
1377
|
+
return super.format(date, displayFormat);
|
|
1378
|
+
}
|
|
1379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CustomDateAdapter, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1380
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CustomDateAdapter }); }
|
|
1381
|
+
}
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: CustomDateAdapter, decorators: [{
|
|
1383
|
+
type: Injectable
|
|
1384
|
+
}] });
|
|
1385
|
+
const CUSTOM_DATE_FORMATS = {
|
|
1386
|
+
parse: {
|
|
1387
|
+
dateInput: { month: 'short', year: 'numeric', day: 'numeric' },
|
|
1388
|
+
},
|
|
1389
|
+
display: {
|
|
1390
|
+
dateInput: 'input',
|
|
1391
|
+
monthYearLabel: { year: 'numeric', month: 'numeric' },
|
|
1392
|
+
dateA11yLabel: { year: 'numeric', month: 'long', day: 'numeric' },
|
|
1393
|
+
monthYearA11yLabel: { year: 'numeric', month: 'long' },
|
|
1394
|
+
},
|
|
1395
|
+
};
|
|
1396
|
+
class FormFieldDateComponent {
|
|
1397
|
+
constructor(cd) {
|
|
1398
|
+
this.cd = cd;
|
|
1399
|
+
this.withTime = false;
|
|
1400
|
+
this.placeholder = '';
|
|
1401
|
+
this.destroy$ = new Subject();
|
|
1402
|
+
}
|
|
1403
|
+
get isWithTime() {
|
|
1404
|
+
return (this.withTime ||
|
|
1405
|
+
!!this.fieldData?.options?.withTime ||
|
|
1406
|
+
this.fieldData?.type === FieldType.FieldTypeDateTime);
|
|
1407
|
+
}
|
|
1408
|
+
ngOnInit() {
|
|
1409
|
+
this.placeholder = this.fieldData?.options?.placeholder || 'dd/mm/yyyy';
|
|
1410
|
+
this.subscribeToFieldStatus();
|
|
1411
|
+
}
|
|
1412
|
+
ngOnDestroy() {
|
|
1413
|
+
this.destroy$.next();
|
|
1414
|
+
this.destroy$.complete();
|
|
1415
|
+
}
|
|
1416
|
+
subscribeToFieldStatus() {
|
|
1417
|
+
if (this.form && this.fieldData?.field) {
|
|
1418
|
+
const control = this.form.get(this.fieldData.field);
|
|
1419
|
+
if (control) {
|
|
1420
|
+
control.statusChanges
|
|
1421
|
+
.pipe(takeUntil(this.destroy$))
|
|
1422
|
+
.subscribe(() => {
|
|
1423
|
+
this.cd.markForCheck();
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldDateComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1429
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldDateComponent, isStandalone: false, selector: "shared-form-field-date", inputs: { config: "config", fieldData: "fieldData", form: "form", withTime: "withTime" }, providers: [
|
|
1430
|
+
{ provide: DateAdapter, useClass: CustomDateAdapter },
|
|
1431
|
+
{ provide: MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS }
|
|
1432
|
+
], ngImport: i0, template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <mat-form-field appearance=\"outline\" class=\"width100\">\n <mat-label>{{ fieldData.title }}</mat-label>\n\n <input *ngIf=\"!isWithTime\"\n matInput\n [matDatepicker]=\"picker\"\n [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\"\n [placeholder]=\"placeholder\">\n\n <input *ngIf=\"isWithTime\"\n matInput\n type=\"datetime-local\"\n [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\"\n [placeholder]=\"placeholder\">\n\n <mat-datepicker-toggle *ngIf=\"!isWithTime\" matIconSuffix matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</div>\n", styles: [":host{display:block;width:100%}::ng-deep shared-form-field-date .mat-mdc-form-field-infix{display:flex;align-items:center}::ng-deep shared-form-field-date input.mat-mdc-input-element{vertical-align:middle}::ng-deep shared-form-field-date .mat-mdc-form-field-icon-suffix{display:flex;align-items:center;align-self:center}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i3$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: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }], animations: [appearOpacity], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1433
|
+
}
|
|
1434
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldDateComponent, decorators: [{
|
|
1435
|
+
type: Component,
|
|
1436
|
+
args: [{ selector: 'shared-form-field-date', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearOpacity], standalone: false, providers: [
|
|
1437
|
+
{ provide: DateAdapter, useClass: CustomDateAdapter },
|
|
1438
|
+
{ provide: MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS }
|
|
1439
|
+
], template: "<div [formGroup]=\"form\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <mat-form-field appearance=\"outline\" class=\"width100\">\n <mat-label>{{ fieldData.title }}</mat-label>\n\n <input *ngIf=\"!isWithTime\"\n matInput\n [matDatepicker]=\"picker\"\n [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\"\n [placeholder]=\"placeholder\">\n\n <input *ngIf=\"isWithTime\"\n matInput\n type=\"datetime-local\"\n [formControlName]=\"fieldData.field\"\n [required]=\"fieldData.validators?.includes('required')\"\n [placeholder]=\"placeholder\">\n\n <mat-datepicker-toggle *ngIf=\"!isWithTime\" matIconSuffix matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n </mat-form-field>\n</div>\n", styles: [":host{display:block;width:100%}::ng-deep shared-form-field-date .mat-mdc-form-field-infix{display:flex;align-items:center}::ng-deep shared-form-field-date input.mat-mdc-input-element{vertical-align:middle}::ng-deep shared-form-field-date .mat-mdc-form-field-icon-suffix{display:flex;align-items:center;align-self:center}\n"] }]
|
|
1440
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { config: [{
|
|
1441
|
+
type: Input
|
|
1442
|
+
}], fieldData: [{
|
|
1443
|
+
type: Input
|
|
1444
|
+
}], form: [{
|
|
1445
|
+
type: Input
|
|
1446
|
+
}], withTime: [{
|
|
1447
|
+
type: Input
|
|
1448
|
+
}] } });
|
|
1449
|
+
|
|
1450
|
+
class FormFieldCheditorComponent {
|
|
1451
|
+
constructor(appConfig, platformId, authenticationService, cd) {
|
|
1452
|
+
this.appConfig = appConfig;
|
|
1453
|
+
this.platformId = platformId;
|
|
1454
|
+
this.authenticationService = authenticationService;
|
|
1455
|
+
this.cd = cd;
|
|
1456
|
+
this.Editor /*: typeof ClassicEditor | null */ = null;
|
|
1457
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
1458
|
+
import('ckeditor5').then((i) => {
|
|
1459
|
+
if (!this.Editor) {
|
|
1460
|
+
this.Editor = i.ClassicEditor;
|
|
1461
|
+
this.ckeModule = i;
|
|
1462
|
+
this.setEditorConfig();
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
ngOnInit() {
|
|
1468
|
+
this.editorData = this.form.get(this.fieldDataField).value;
|
|
1469
|
+
}
|
|
1470
|
+
setEditorConfig() {
|
|
1471
|
+
const { token } = this.authenticationService.loadAuthDataFromLocalStore();
|
|
1472
|
+
const { ClassicEditor, Essentials, Paragraph, Bold, Italic, List, SourceEditing, Table, TableToolbar, TableProperties, TableCellProperties, TableColumnResize, Alignment, Link, AutoLink, ImageEditing, ImageBlockEditing, Image, ImageInsert, ImageToolbar, ImageCaption, ImageStyle, ImageResize, LinkImage, ImageResizeEditing, ImageResizeHandles, ImageResizeButtons, Fullscreen, Font, Highlight, Heading, ShowBlocks, GeneralHtmlSupport, Style, RemoveFormat, SimpleUploadAdapter } = this.ckeModule;
|
|
1473
|
+
const newConfig = {
|
|
1474
|
+
apiUrl: this.appConfig.apiUrl,
|
|
1475
|
+
panelUrl: this.appConfig.panelUrl
|
|
1476
|
+
};
|
|
1477
|
+
const customColorPalette = [
|
|
1478
|
+
{
|
|
1479
|
+
color: 'hsl(4, 90%, 58%)',
|
|
1480
|
+
label: 'Red'
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
color: 'hsl(340, 82%, 52%)',
|
|
1484
|
+
label: 'Pink'
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
color: 'hsl(291, 64%, 42%)',
|
|
1488
|
+
label: 'Purple'
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
color: 'hsl(262, 52%, 47%)',
|
|
1492
|
+
label: 'Deep Purple'
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
color: 'hsl(231, 48%, 48%)',
|
|
1496
|
+
label: 'Indigo'
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
color: 'hsl(207, 90%, 54%)',
|
|
1500
|
+
label: 'Blue'
|
|
1501
|
+
},
|
|
1502
|
+
];
|
|
1503
|
+
this.Editor = ClassicEditor;
|
|
1504
|
+
this.ckeConfig = {
|
|
1505
|
+
licenseKey: 'GPL',
|
|
1506
|
+
plugins: [
|
|
1507
|
+
Essentials,
|
|
1508
|
+
Paragraph,
|
|
1509
|
+
Bold,
|
|
1510
|
+
Italic,
|
|
1511
|
+
List,
|
|
1512
|
+
SourceEditing,
|
|
1513
|
+
Table, TableToolbar, TableToolbar, TableProperties, TableCellProperties, TableColumnResize,
|
|
1514
|
+
Alignment,
|
|
1515
|
+
Link, AutoLink,
|
|
1516
|
+
ImageEditing, ImageBlockEditing,
|
|
1517
|
+
Image, ImageInsert, ImageToolbar, ImageCaption, ImageStyle, ImageResize, LinkImage,
|
|
1518
|
+
ImageResizeEditing, ImageResizeHandles, ImageResizeButtons,
|
|
1519
|
+
Fullscreen,
|
|
1520
|
+
Font, Highlight,
|
|
1521
|
+
Heading,
|
|
1522
|
+
ShowBlocks,
|
|
1523
|
+
GeneralHtmlSupport, Style, RemoveFormat,
|
|
1524
|
+
SimpleUploadAdapter
|
|
1525
|
+
],
|
|
1526
|
+
toolbar: [
|
|
1527
|
+
'undo', 'redo', '|',
|
|
1528
|
+
'heading', 'style', '|',
|
|
1529
|
+
'bold', 'italic', 'alignment', 'bulletedList', 'numberedList', '|',
|
|
1530
|
+
'insertTable', '|',
|
|
1531
|
+
'insertImage', 'resizeImage', '|', 'link', 'highlight', '|',
|
|
1532
|
+
'fontSize', 'fontColor', 'fontBackgroundColor', '|',
|
|
1533
|
+
'removeFormat', 'showBlocks', 'fullscreen', 'sourceEditing'
|
|
1534
|
+
],
|
|
1535
|
+
table: {
|
|
1536
|
+
contentToolbar: [
|
|
1537
|
+
'tableColumn', 'tableRow', 'mergeTableCells',
|
|
1538
|
+
'tableProperties', 'tableCellProperties'
|
|
1539
|
+
],
|
|
1540
|
+
// Set the palettes for tables.
|
|
1541
|
+
tableProperties: {
|
|
1542
|
+
borderColors: customColorPalette,
|
|
1543
|
+
backgroundColors: customColorPalette
|
|
1544
|
+
},
|
|
1545
|
+
// Set the palettes for table cells.
|
|
1546
|
+
tableCellProperties: {
|
|
1547
|
+
borderColors: customColorPalette,
|
|
1548
|
+
backgroundColors: customColorPalette
|
|
1549
|
+
}
|
|
1550
|
+
},
|
|
1551
|
+
heading: {
|
|
1552
|
+
options: [
|
|
1553
|
+
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
|
|
1554
|
+
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
|
|
1555
|
+
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
|
|
1556
|
+
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
|
|
1557
|
+
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' }
|
|
1558
|
+
]
|
|
1559
|
+
},
|
|
1560
|
+
style: {
|
|
1561
|
+
definitions: [
|
|
1562
|
+
{
|
|
1563
|
+
name: 'Отдельный текст',
|
|
1564
|
+
element: 'p',
|
|
1565
|
+
classes: ['info-box']
|
|
1566
|
+
},
|
|
1567
|
+
]
|
|
1568
|
+
},
|
|
1569
|
+
simpleUpload: {
|
|
1570
|
+
// The URL that the images are uploaded to.
|
|
1571
|
+
uploadUrl: `${newConfig.apiUrl}/api/files/browser/${this.entity.toLowerCase()}/${this.entityId}`,
|
|
1572
|
+
// Enable the XMLHttpRequest.withCredentials property.
|
|
1573
|
+
withCredentials: true,
|
|
1574
|
+
// Headers sent along with the XMLHttpRequest to the upload server.
|
|
1575
|
+
headers: {
|
|
1576
|
+
Authorization: `JWT ${token}`
|
|
1577
|
+
}
|
|
1578
|
+
},
|
|
1579
|
+
image: {
|
|
1580
|
+
toolbar: [
|
|
1581
|
+
'toggleImageCaption',
|
|
1582
|
+
'imageTextAlternative',
|
|
1583
|
+
'|',
|
|
1584
|
+
'imageStyle:wrapText',
|
|
1585
|
+
'imageStyle:breakText',
|
|
1586
|
+
'|',
|
|
1587
|
+
'resizeImage',
|
|
1588
|
+
'linkImage'
|
|
1589
|
+
],
|
|
1590
|
+
},
|
|
1591
|
+
};
|
|
1592
|
+
this.cd.markForCheck();
|
|
1593
|
+
/*
|
|
1594
|
+
extraPlugins:
|
|
1595
|
+
'image,uploadimage,tabletools,undo,indent,justify,showblocks',
|
|
1596
|
+
fileTools_requestHeaders: {
|
|
1597
|
+
'Authorization': `JWT ${token}`
|
|
1598
|
+
},
|
|
1599
|
+
|
|
1600
|
+
imagebrowserUrl: this.entity ? `${newConfig.apiUrl}/api/files/browser/${this.entity.toLowerCase()}/${entityId}` : '',
|
|
1601
|
+
filebrowserBrowseUrl: this.entity ? `${newConfig.panelUrl}/file-browser/${this.entity.toLowerCase()}/${entityId}` : '',
|
|
1602
|
+
filebrowserWindowWidth: '905',
|
|
1603
|
+
filebrowserWindowHeight: '480',
|
|
1604
|
+
filebrowserUploadUrl: this.entity ? `${newConfig.apiUrl}/api/files/${this.entity.toLowerCase()}/${entityId}/editor` : '',
|
|
1605
|
+
uploadUrl: this.entity ? `${newConfig.apiUrl}/api/files/${this.entity.toLowerCase()}/${entityId}/editor` : '',
|
|
1606
|
+
easyimage_toolbar: ['EasyImageAlignLeft', 'EasyImageAlignCenter', 'EasyImageAlignRight']
|
|
1607
|
+
*/
|
|
1608
|
+
/*
|
|
1609
|
+
removePlugins: 'removePlugins',
|
|
1610
|
+
extraPlugins:
|
|
1611
|
+
"image2, easyimage,enhancedimage, uploadimage,dialogui,dialog,a11yhelp,about,basicstyles,bidi,blockquote,clipboard," +
|
|
1612
|
+
"button,panelbutton,panel,floatpanel,colorbutton,colordialog,menu," +
|
|
1613
|
+
"contextmenu,dialogadvtab,div,elementspath,enterkey,entities,popup," +
|
|
1614
|
+
"filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo," +
|
|
1615
|
+
"font,format,forms,horizontalrule,htmlwriter,iframe,image,indent," +
|
|
1616
|
+
"indentblock,indentlist,justify,link,list,liststyle,magicline," +
|
|
1617
|
+
"maximize,newpage,pagebreak,pastefromword,pastetext,preview,print," +
|
|
1618
|
+
"removeformat,resize,save,menubutton,scayt,selectall,showblocks," +
|
|
1619
|
+
"showborders,smiley,sourcearea,specialchar,stylescombo,tab,table," +
|
|
1620
|
+
"tabletools,templates,toolbar,undo,wsc,wysiwygarea"
|
|
1621
|
+
*/
|
|
1622
|
+
}
|
|
1623
|
+
onChange(editorData) {
|
|
1624
|
+
this.form.get(this.fieldDataField).setValue(editorData.editor.data.get());
|
|
1625
|
+
}
|
|
1626
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldCheditorComponent, deps: [{ token: CORE_CONFIG }, { token: PLATFORM_ID }, { token: i1.AuthenticationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1627
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormFieldCheditorComponent, isStandalone: true, selector: "shared-form-field-cheditor", inputs: { entityId: "entityId", entity: "entity", form: "form", fieldDataField: "fieldDataField" }, ngImport: i0, template: "<ng-container *ngIf=\"Editor\">\n <!--[formControlName]=\"fieldDataField\"-->\n <ckeditor\n [data]=\"editorData\"\n [editor]=\"Editor\"\n (change)=\"onChange($event)\"\n [config]=\"ckeConfig\">\n </ckeditor>\n</ng-container>\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-input mat-label{color:#5f5b5b;font-size:12px;padding:0 5px 0 0;position:absolute;background-color:#fff;top:-10px}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336;transition:all .15s ease;opacity:.6}.form-field-file .form-field-file-image .form-field-file-close mat-icon{transition:transform .15s ease;width:15px;height:15px;min-width:15px;min-height:15px;margin-left:1px;margin-top:3px}.form-field-file .form-field-file-image .form-field-file-close:hover{opacity:1}.form-field-file .form-field-file-image .form-field-file-close:hover mat-icon{transform:rotate(90deg)}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close{width:25px;height:25px;opacity:.8}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close mat-icon{width:18px;min-width:18px;height:18px;min-height:18px;font-size:18px}.form-field-file .position-absolute{position:absolute}\n"], dependencies: [{ kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i2$3.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1628
|
+
}
|
|
1629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldCheditorComponent, decorators: [{
|
|
1630
|
+
type: Component,
|
|
1631
|
+
args: [{ selector: "shared-form-field-cheditor", changeDetection: ChangeDetectionStrategy.OnPush, imports: [CKEditorModule, ReactiveFormsModule, NgIf], template: "<ng-container *ngIf=\"Editor\">\n <!--[formControlName]=\"fieldDataField\"-->\n <ckeditor\n [data]=\"editorData\"\n [editor]=\"Editor\"\n (change)=\"onChange($event)\"\n [config]=\"ckeConfig\">\n </ckeditor>\n</ng-container>\n", styles: [".form-field-file .form-field-input{transition:all .2s ease;min-height:66px;align-items:center;padding-top:0;padding-bottom:0;position:relative}.form-field-file .form-field-input.height-0{height:0;padding:0;border:0}.form-field-file .form-field-input mat-label{color:#5f5b5b;font-size:12px;padding:0 5px 0 0;position:absolute;background-color:#fff;top:-10px}.form-field-file .form-field-file-image{position:relative;transition:all .2s ease;overflow:hidden;display:flex;justify-content:flex-start;margin:10px 0}.form-field-file .form-field-file-image.height-100{height:100px}.form-field-file .form-field-file-image img{object-fit:cover;width:150px;height:100px;border-radius:4px;overflow:hidden;background:#fff}.form-field-file .form-field-file-image .form-field-file-close{right:0;top:0;cursor:pointer;background:#fff;position:absolute;width:15px;height:15px;display:flex;align-items:center;justify-content:center;border-bottom-left-radius:4px;color:#f44336;transition:all .15s ease;opacity:.6}.form-field-file .form-field-file-image .form-field-file-close mat-icon{transition:transform .15s ease;width:15px;height:15px;min-width:15px;min-height:15px;margin-left:1px;margin-top:3px}.form-field-file .form-field-file-image .form-field-file-close:hover{opacity:1}.form-field-file .form-field-file-image .form-field-file-close:hover mat-icon{transform:rotate(90deg)}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close{width:25px;height:25px;opacity:.8}.form-field-file .form-field-file-image .image-block:hover .form-field-file-close mat-icon{width:18px;min-width:18px;height:18px;min-height:18px;font-size:18px}.form-field-file .position-absolute{position:absolute}\n"] }]
|
|
1632
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1633
|
+
type: Inject,
|
|
1634
|
+
args: [CORE_CONFIG]
|
|
1635
|
+
}] }, { type: Object, decorators: [{
|
|
1636
|
+
type: Inject,
|
|
1637
|
+
args: [PLATFORM_ID]
|
|
1638
|
+
}] }, { type: i1.AuthenticationService }, { type: i0.ChangeDetectorRef }], propDecorators: { entityId: [{
|
|
1639
|
+
type: Input
|
|
1640
|
+
}], entity: [{
|
|
1641
|
+
type: Input
|
|
1642
|
+
}], form: [{
|
|
1643
|
+
type: Input
|
|
1644
|
+
}], fieldDataField: [{
|
|
1645
|
+
type: Input
|
|
1646
|
+
}] } });
|
|
1647
|
+
|
|
1648
|
+
class FormFieldComponent {
|
|
1649
|
+
get fieldPublishError() {
|
|
1650
|
+
if (this.publicationMessages) {
|
|
1651
|
+
return this.publicationMessages.filter((item) => item.field === this.fieldData.field && item.isError);
|
|
1652
|
+
}
|
|
1653
|
+
return null;
|
|
1654
|
+
}
|
|
1655
|
+
get fieldPublicationMessages() {
|
|
1656
|
+
if (this.publicationMessages) {
|
|
1657
|
+
return this.publicationMessages.filter((item) => item.field === this.fieldData.field && !item.isError);
|
|
1658
|
+
}
|
|
1659
|
+
return null;
|
|
1660
|
+
}
|
|
1661
|
+
get haveFieldError() {
|
|
1662
|
+
return (this.fieldControl &&
|
|
1663
|
+
this.fieldControl.status === this.invalidStatus &&
|
|
1664
|
+
(!this.fieldControl.pristine || this.fieldControl.touched)) || !!this.fieldPublishError?.length;
|
|
1665
|
+
}
|
|
1666
|
+
get haveFieldWarning() {
|
|
1667
|
+
return !!this.fieldPublicationMessages?.length;
|
|
1668
|
+
}
|
|
1669
|
+
constructor(//@Inject(CORE_CONFIG) private appConfig: AppConfig,
|
|
1670
|
+
platformId, coreFacade, cd, dialog, injector) {
|
|
1671
|
+
this.platformId = platformId;
|
|
1672
|
+
this.coreFacade = coreFacade;
|
|
1673
|
+
this.cd = cd;
|
|
1674
|
+
this.dialog = dialog;
|
|
1675
|
+
this.injector = injector;
|
|
1676
|
+
this.config = {};
|
|
1677
|
+
this.editorImageUploadUrl = '';
|
|
1678
|
+
this.eventUpdateForm = new EventEmitter();
|
|
1679
|
+
this.eventSendAction = new EventEmitter();
|
|
1680
|
+
this.fieldTypes = FieldType;
|
|
1681
|
+
this.formFormateType = FormFormateType;
|
|
1682
|
+
this.invalidStatus = 'INVALID';
|
|
1683
|
+
this.unSubscribeSubject$ = new Subject();
|
|
1684
|
+
this.isDenyToUpdate = false;
|
|
1685
|
+
this.isBrowser = false;
|
|
1686
|
+
}
|
|
1687
|
+
ngOnInit() {
|
|
1688
|
+
this.field = this.fieldData.field;
|
|
1689
|
+
this.isDenyToUpdate = this.entityPermissionUpdateDanyFields?.includes(this.field);
|
|
1690
|
+
this.fieldControl = !this.fieldData.options?.notNeedFormControl ? this.form.get(this.field) : undefined;
|
|
1691
|
+
if (!this.fieldData.options?.notNeedFormControl) {
|
|
1692
|
+
this.subscribeToFormChange();
|
|
1693
|
+
}
|
|
1694
|
+
this.setComponentInjector();
|
|
1695
|
+
this.isBrowser = isPlatformBrowser(this.platformId);
|
|
1696
|
+
this.entityId = this.form.get('id')?.value;
|
|
1697
|
+
}
|
|
1698
|
+
ngOnDestroy() {
|
|
1699
|
+
this.unSubscribeSubject$.next();
|
|
1700
|
+
this.unSubscribeSubject$.complete();
|
|
1701
|
+
}
|
|
1702
|
+
fieldActionHandler(data) {
|
|
1703
|
+
try {
|
|
1704
|
+
if (data.action) {
|
|
1705
|
+
this.coreFacade.sendGlobalEvent(data.action, this.entity, this.itemId, this.fieldData, this.form.value);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
catch (e) {
|
|
1709
|
+
console.error('[ form-field ][ fieldActionHandler ]', { error: e, data, fieldData: this.fieldData });
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
openHintDialog(hint) {
|
|
1713
|
+
this.dialog.open(CommonDialogComponent, {
|
|
1714
|
+
panelClass: 'dialog-without-margin',
|
|
1715
|
+
data: {
|
|
1716
|
+
message: hint,
|
|
1717
|
+
falseButtonTitle: 'Закрыть',
|
|
1718
|
+
messageType: 'info',
|
|
1719
|
+
size: 'middle',
|
|
1720
|
+
hideTrueButton: true
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
setComponentInjector() {
|
|
1725
|
+
this.componentDataInjector = Injector.create({
|
|
1726
|
+
providers: [{
|
|
1727
|
+
provide: StaticDataComponentInputData,
|
|
1728
|
+
useValue: {
|
|
1729
|
+
fieldData: this.fieldData,
|
|
1730
|
+
controller: !this.fieldData.options.notNeedFormControl ? this.form.get(this.field) : undefined,
|
|
1731
|
+
allFields: this.fields,
|
|
1732
|
+
formData: this.formData,
|
|
1733
|
+
options: this.fieldData.options?.showing?.options
|
|
1734
|
+
}
|
|
1735
|
+
}],
|
|
1736
|
+
parent: this.injector
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
subscribeToFormChange() {
|
|
1740
|
+
this.form.get(this.field).statusChanges
|
|
1741
|
+
.pipe(takeUntil(this.unSubscribeSubject$))
|
|
1742
|
+
.subscribe(() => {
|
|
1743
|
+
this.cd.markForCheck();
|
|
1744
|
+
});
|
|
1745
|
+
this.form.get(this.field).valueChanges
|
|
1746
|
+
.pipe(takeUntil(this.unSubscribeSubject$))
|
|
1747
|
+
.subscribe((data) => {
|
|
1748
|
+
if (data?.[this.field] !== this.form.get(this.field)?.value) {
|
|
1749
|
+
if (this.fieldData?.options?.subscribeToFormChanges?.handleChanges) {
|
|
1750
|
+
this.fieldData?.options?.subscribeToFormChanges?.handleChanges(this.form, this.field);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
this.cd.markForCheck();
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldComponent, deps: [{ token: PLATFORM_ID }, { token: i1.CoreFacade }, { token: i0.ChangeDetectorRef }, { token: i1$2.MatDialog }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1757
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: FormFieldComponent, isStandalone: false, selector: "shared-form-field", inputs: { fields: "fields", formData: "formData", config: "config", fieldData: "fieldData", itemId: "itemId", form: "form", editorImageUploadUrl: "editorImageUploadUrl", errorMessageTexts: "errorMessageTexts", entity: "entity", publicationMessages: "publicationMessages", entityTypeUserRoleRights: "entityTypeUserRoleRights", autoCompleteFields: "autoCompleteFields", entityPermissionUpdateDanyFields: "entityPermissionUpdateDanyFields" }, outputs: { eventUpdateForm: "eventUpdateForm", eventSendAction: "eventSendAction" }, ngImport: i0, template: "<div *ngIf=\"!fieldData.options?.hide\"\n #formField\n class=\"position-relative form-field\"\n [id]=\"'field-' + fieldData.field\"\n [formGroup]=\"form\"\n [ngClass]=\"{\n 'border-block textarea-field mb-21': fieldData.type === fieldTypes.FieldTypeTextarea || fieldData.type === fieldTypes.FieldTypeTextareaEditor,\n 'form-field-error': haveFieldError,\n 'form-field-warning': haveFieldWarning,\n 'check-box-field': fieldData.type === fieldTypes.FieldTypeSlideToggle,\n 'preview-mode': isDenyToUpdate || fieldData.options.notEditable\n }\">\n <label *ngIf=\"config.formFormat === formFormateType.LABEL_INPUT\">{{ fieldData.title }}: </label>\n <div class=\"form-field-container\">\n @if (!fieldData.options?.showing?.customEditViewComponent && !fieldData.options?.notNeedFormControl) {\n <ng-container [ngSwitch]=\"fieldData.type\">\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelect\">\n <shared-form-field-select\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [autoCompleteFields]=\"autoCompleteFields\"\n ></shared-form-field-select>\n <shared-form-field-select-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSlideToggle\">\n <shared-form-field-slide-toggle\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-slide-toggle>\n <shared-form-field-slide-toggle-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-slide-toggle-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextarea\">\n <div class=\"textarea-field-width\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n <ng-container *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\">\n <textarea matInput rows=\"6\" [formControlName]=\"fieldData.field\"></textarea>\n <div class=\"textarea-field-length\">\n <span>\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0434\u043B\u0438\u043D\u0430: {{ form.get(fieldData.field).value?.length || 0 }}</span>\n </div>\n </ng-container>\n <ng-container *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\">\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextareaEditor\">\n <div class=\"textarea-field-width text-area-editor editor-field\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n <ng-container *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\">\n <div *ngIf=\"fieldData.description\" class=\"field-description\">\n {{ fieldData.description }}\n </div>\n @defer (on viewport(formField)) {\n <shared-form-field-cheditor [fieldDataField]=\"fieldData.field\"\n [form]=\"form\"\n [entityId]=\"entityId\"\n [entity]=\"entity\"></shared-form-field-cheditor>\n } @placeholder {\n shared-form-field-cheditor\n }\n <div class=\"textarea-field-length\">\n <b>\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0434\u043B\u0438\u043D\u0430: {{ form.get(fieldData.field).value?.length || 0 }}</b>\n </div>\n </ng-container>\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFile\">\n <shared-form-field-file\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [entity]=\"entity\"\n ></shared-form-field-file>\n <shared-form-field-file-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-file-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFiles\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-files\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [itemId]=\"itemId\"\n ></shared-form-field-files>\n } @else {\n <shared-form-field-files-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [entityId]=\"form.get('id').value\"\n [entitySection]=\"entity\"\n ></shared-form-field-files-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeJSON\">\n <div class=\"textarea-field-width\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <textarea matInput rows=\"6\" [formControlName]=\"fieldData.field\"></textarea>\n } @else {\n <shared-form-field-json-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-json-show>\n }\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeInputStringList\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-string-list-input\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-string-list-input>\n } @else {\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeRating\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-rating\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-rating>\n } @else {\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTags\">\n <shared-form-field-tags\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [itemId]=\"itemId\"\n ></shared-form-field-tags>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeDate\">\n <shared-form-field-date\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [withTime]=\"false\"\n ></shared-form-field-date>\n <shared-form-field-input-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeDateTime\">\n <shared-form-field-date\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [withTime]=\"true\"\n ></shared-form-field-date>\n <shared-form-field-input-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-input\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-input>\n } @else {\n <shared-form-field-input-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n }\n </ng-container>\n\n </ng-container>\n <div *ngIf=\"fieldData.actions\" class=\"field-actions\">\n <ng-container *ngFor=\"let action of fieldData.actions\">\n <div class=\"field-actions-action\" (click)=\"fieldActionHandler(action)\">{{ action.title }}</div>\n </ng-container>\n </div>\n <!-- <shared-form-field-spinner *ngIf=\"loading\"></shared-form-field-spinner>-->\n <ng-container *ngIf=\"fieldData.options?.hint\">\n <mat-icon class=\"hint-icons\" (click)=\"openHintDialog(fieldData.options?.hint)\">help_outline</mat-icon>\n </ng-container>\n } @else {\n <ng-container *ngComponentOutlet=\"fieldData.options?.showing?.customEditViewComponent;\n injector: componentDataInjector;\"/>\n }\n\n <shared-form-field-error\n @appearFromLeft\n *ngIf=\"fieldControl && fieldControl['touched'] && !fieldControl.valid\"\n [form]=\"form\"\n [fieldData]=\"fieldData\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [ngClass]=\"{'textarea-error': fieldData.type === fieldTypes.FieldTypeTextarea}\"\n ></shared-form-field-error>\n\n <shared-form-field-publish-error\n [form]=\"form\"\n [entity]=\"entity\"\n [fieldData]=\"fieldData\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [ngClass]=\"{'textarea-error': fieldData.type === fieldTypes.FieldTypeTextarea}\"\n ></shared-form-field-publish-error>\n </div>\n</div>\n", styles: [".mb-21{margin-bottom:21px}.field-description{border-radius:8px;color:#5f5b5b;margin:5px 5px 15px;border-left:3px solid #009ce5;padding:10px 0 10px 10px;background:#009ce542}.field-actions{display:flex;justify-content:flex-end;margin-bottom:5px}.field-actions .field-actions-action{padding:0 10px;text-align:right;background:#007bff;color:#fff;border-radius:4px}.textarea-field-length{background:#f8f8f8;text-align:right;padding-right:10px;color:#989494;border-bottom:1px solid #d1d1d1;font-size:11px;border-bottom-left-radius:7px;border-bottom-right-radius:7px}.hint-icons{position:absolute;right:0;margin-top:11px;top:0;font-size:20px;margin-right:-22px}.textarea-field-width{display:flex;flex-direction:column}.textarea-field-width.editor-field{margin-top:10px}.textarea-field-width.editor-field label{margin-top:-15px}.textarea-field-width.text-area-editor label{margin-top:-13px!important}.textarea-field-width label{position:absolute;margin-top:-8px!important;color:#939393;padding:0 5px;background:#fff;font-family:Inter,sans-serif;font-size:14px;margin-left:14px;line-height:10px}.textarea-field-width textarea{border-radius:7px;border-color:#74777f;padding:10px}.form-field{display:flex}.form-field label{margin-right:10px;margin-top:14px}.form-field .form-field-container{width:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i4.FormFieldErrorComponent, selector: "shared-form-field-error", inputs: ["fieldData", "form", "errorMessageTexts"] }, { kind: "component", type: i4.FormFieldPublishErrorComponent, selector: "shared-form-field-publish-error", inputs: ["fieldData", "form", "entity", "errorMessageTexts"] }, { kind: "directive", type: i3$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: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FormFieldSelectComponent, selector: "shared-form-field-select", inputs: ["config", "fieldData", "form", "autoCompleteFields"] }, { kind: "component", type: FormFieldSelectShowComponent, selector: "shared-form-field-select-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldSlideToggleComponent, selector: "shared-form-field-slide-toggle", inputs: ["config", "fieldData", "form"] }, { kind: "component", type: FormFieldInputComponent, selector: "shared-form-field-input", inputs: ["config", "fieldData", "form"] }, { kind: "component", type: FormFieldStringListInputComponent, selector: "shared-form-field-string-list-input", inputs: ["config", "fieldData", "form"] }, { kind: "component", type: FormFieldFileComponent, selector: "shared-form-field-file", inputs: ["config", "fieldData", "form", "entity"] }, { kind: "component", type: FormFieldFilesComponent, selector: "shared-form-field-files", inputs: ["config", "fieldData", "form", "itemId"] }, { kind: "component", type: FormFieldFileShowComponent, selector: "shared-form-field-file-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldSlideToggleShowComponent, selector: "shared-form-field-slide-toggle-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldInputShowComponent, selector: "shared-form-field-input-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldFilesShowComponent, selector: "shared-form-field-files-show", inputs: ["config", "fieldData", "entityId", "entitySection"] }, { kind: "component", type: FormFieldJsonShowComponent, selector: "shared-form-field-json-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldTagsComponent, selector: "shared-form-field-tags", inputs: ["config", "fieldData", "form", "itemId"] }, { kind: "component", type: FormFieldTextareaShowComponent, selector: "shared-form-field-textarea-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldRatingComponent, selector: "shared-form-field-rating", inputs: ["config", "fieldData", "form"] }, { kind: "component", type: FormFieldDateComponent, selector: "shared-form-field-date", inputs: ["config", "fieldData", "form", "withTime"] }], animations: [appearFromLeft], changeDetection: i0.ChangeDetectionStrategy.OnPush, deferBlockDependencies: [() => [FormFieldCheditorComponent]] }); }
|
|
1758
|
+
}
|
|
1759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
1760
|
+
type: Component,
|
|
1761
|
+
args: [{ selector: 'shared-form-field', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearFromLeft], standalone: false, template: "<div *ngIf=\"!fieldData.options?.hide\"\n #formField\n class=\"position-relative form-field\"\n [id]=\"'field-' + fieldData.field\"\n [formGroup]=\"form\"\n [ngClass]=\"{\n 'border-block textarea-field mb-21': fieldData.type === fieldTypes.FieldTypeTextarea || fieldData.type === fieldTypes.FieldTypeTextareaEditor,\n 'form-field-error': haveFieldError,\n 'form-field-warning': haveFieldWarning,\n 'check-box-field': fieldData.type === fieldTypes.FieldTypeSlideToggle,\n 'preview-mode': isDenyToUpdate || fieldData.options.notEditable\n }\">\n <label *ngIf=\"config.formFormat === formFormateType.LABEL_INPUT\">{{ fieldData.title }}: </label>\n <div class=\"form-field-container\">\n @if (!fieldData.options?.showing?.customEditViewComponent && !fieldData.options?.notNeedFormControl) {\n <ng-container [ngSwitch]=\"fieldData.type\">\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelect\">\n <shared-form-field-select\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [autoCompleteFields]=\"autoCompleteFields\"\n ></shared-form-field-select>\n <shared-form-field-select-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSlideToggle\">\n <shared-form-field-slide-toggle\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-slide-toggle>\n <shared-form-field-slide-toggle-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-slide-toggle-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextarea\">\n <div class=\"textarea-field-width\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n <ng-container *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\">\n <textarea matInput rows=\"6\" [formControlName]=\"fieldData.field\"></textarea>\n <div class=\"textarea-field-length\">\n <span>\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0434\u043B\u0438\u043D\u0430: {{ form.get(fieldData.field).value?.length || 0 }}</span>\n </div>\n </ng-container>\n <ng-container *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\">\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n </ng-container>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextareaEditor\">\n <div class=\"textarea-field-width text-area-editor editor-field\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n <ng-container *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\">\n <div *ngIf=\"fieldData.description\" class=\"field-description\">\n {{ fieldData.description }}\n </div>\n @defer (on viewport(formField)) {\n <shared-form-field-cheditor [fieldDataField]=\"fieldData.field\"\n [form]=\"form\"\n [entityId]=\"entityId\"\n [entity]=\"entity\"></shared-form-field-cheditor>\n } @placeholder {\n shared-form-field-cheditor\n }\n <div class=\"textarea-field-length\">\n <b>\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0434\u043B\u0438\u043D\u0430: {{ form.get(fieldData.field).value?.length || 0 }}</b>\n </div>\n </ng-container>\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFile\">\n <shared-form-field-file\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [entity]=\"entity\"\n ></shared-form-field-file>\n <shared-form-field-file-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-file-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFiles\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-files\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [itemId]=\"itemId\"\n ></shared-form-field-files>\n } @else {\n <shared-form-field-files-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [entityId]=\"form.get('id').value\"\n [entitySection]=\"entity\"\n ></shared-form-field-files-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeJSON\">\n <div class=\"textarea-field-width\" [ngClass]=\"{'small-form-width-form-field': config?.smallFormWidth}\">\n <label\n [id]=\"'field-' + fieldData.field\">{{ fieldData.title }}{{ fieldData.validators && fieldData.validators.includes('required') ? ' *' : '' }}</label>\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <textarea matInput rows=\"6\" [formControlName]=\"fieldData.field\"></textarea>\n } @else {\n <shared-form-field-json-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-json-show>\n }\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeInputStringList\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-string-list-input\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-string-list-input>\n } @else {\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeRating\">\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-rating\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-rating>\n } @else {\n <shared-form-field-textarea-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-textarea-show>\n }\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTags\">\n <shared-form-field-tags\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [itemId]=\"itemId\"\n ></shared-form-field-tags>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeDate\">\n <shared-form-field-date\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [withTime]=\"false\"\n ></shared-form-field-date>\n <shared-form-field-input-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeDateTime\">\n <shared-form-field-date\n *ngIf=\"!isDenyToUpdate && !fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n [withTime]=\"true\"\n ></shared-form-field-date>\n <shared-form-field-input-show\n *ngIf=\"isDenyToUpdate || fieldData.options.notEditable\"\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n @if (!isDenyToUpdate && !fieldData.options.notEditable) {\n <shared-form-field-input\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [form]=\"form\"\n ></shared-form-field-input>\n } @else {\n <shared-form-field-input-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"form.get(fieldData.field).value\"\n ></shared-form-field-input-show>\n }\n </ng-container>\n\n </ng-container>\n <div *ngIf=\"fieldData.actions\" class=\"field-actions\">\n <ng-container *ngFor=\"let action of fieldData.actions\">\n <div class=\"field-actions-action\" (click)=\"fieldActionHandler(action)\">{{ action.title }}</div>\n </ng-container>\n </div>\n <!-- <shared-form-field-spinner *ngIf=\"loading\"></shared-form-field-spinner>-->\n <ng-container *ngIf=\"fieldData.options?.hint\">\n <mat-icon class=\"hint-icons\" (click)=\"openHintDialog(fieldData.options?.hint)\">help_outline</mat-icon>\n </ng-container>\n } @else {\n <ng-container *ngComponentOutlet=\"fieldData.options?.showing?.customEditViewComponent;\n injector: componentDataInjector;\"/>\n }\n\n <shared-form-field-error\n @appearFromLeft\n *ngIf=\"fieldControl && fieldControl['touched'] && !fieldControl.valid\"\n [form]=\"form\"\n [fieldData]=\"fieldData\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [ngClass]=\"{'textarea-error': fieldData.type === fieldTypes.FieldTypeTextarea}\"\n ></shared-form-field-error>\n\n <shared-form-field-publish-error\n [form]=\"form\"\n [entity]=\"entity\"\n [fieldData]=\"fieldData\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [ngClass]=\"{'textarea-error': fieldData.type === fieldTypes.FieldTypeTextarea}\"\n ></shared-form-field-publish-error>\n </div>\n</div>\n", styles: [".mb-21{margin-bottom:21px}.field-description{border-radius:8px;color:#5f5b5b;margin:5px 5px 15px;border-left:3px solid #009ce5;padding:10px 0 10px 10px;background:#009ce542}.field-actions{display:flex;justify-content:flex-end;margin-bottom:5px}.field-actions .field-actions-action{padding:0 10px;text-align:right;background:#007bff;color:#fff;border-radius:4px}.textarea-field-length{background:#f8f8f8;text-align:right;padding-right:10px;color:#989494;border-bottom:1px solid #d1d1d1;font-size:11px;border-bottom-left-radius:7px;border-bottom-right-radius:7px}.hint-icons{position:absolute;right:0;margin-top:11px;top:0;font-size:20px;margin-right:-22px}.textarea-field-width{display:flex;flex-direction:column}.textarea-field-width.editor-field{margin-top:10px}.textarea-field-width.editor-field label{margin-top:-15px}.textarea-field-width.text-area-editor label{margin-top:-13px!important}.textarea-field-width label{position:absolute;margin-top:-8px!important;color:#939393;padding:0 5px;background:#fff;font-family:Inter,sans-serif;font-size:14px;margin-left:14px;line-height:10px}.textarea-field-width textarea{border-radius:7px;border-color:#74777f;padding:10px}.form-field{display:flex}.form-field label{margin-right:10px;margin-top:14px}.form-field .form-field-container{width:100%}\n"] }]
|
|
1762
|
+
}], ctorParameters: () => [{ type: Object, decorators: [{
|
|
1763
|
+
type: Inject,
|
|
1764
|
+
args: [PLATFORM_ID]
|
|
1765
|
+
}] }, { type: i1.CoreFacade }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }, { type: i0.Injector }], propDecorators: { fields: [{
|
|
1766
|
+
type: Input
|
|
1767
|
+
}], formData: [{
|
|
1768
|
+
type: Input
|
|
1769
|
+
}], config: [{
|
|
1770
|
+
type: Input
|
|
1771
|
+
}], fieldData: [{
|
|
1772
|
+
type: Input
|
|
1773
|
+
}], itemId: [{
|
|
1774
|
+
type: Input
|
|
1775
|
+
}], form: [{
|
|
1776
|
+
type: Input
|
|
1777
|
+
}], editorImageUploadUrl: [{
|
|
1778
|
+
type: Input
|
|
1779
|
+
}], errorMessageTexts: [{
|
|
1780
|
+
type: Input
|
|
1781
|
+
}], entity: [{
|
|
1782
|
+
type: Input
|
|
1783
|
+
}], publicationMessages: [{
|
|
1784
|
+
type: Input
|
|
1785
|
+
}], entityTypeUserRoleRights: [{
|
|
1786
|
+
type: Input
|
|
1787
|
+
}], autoCompleteFields: [{
|
|
1788
|
+
type: Input
|
|
1789
|
+
}], entityPermissionUpdateDanyFields: [{
|
|
1790
|
+
type: Input
|
|
1791
|
+
}], eventUpdateForm: [{
|
|
1792
|
+
type: Output
|
|
1793
|
+
}], eventSendAction: [{
|
|
1794
|
+
type: Output
|
|
1795
|
+
}] } });
|
|
1796
|
+
|
|
1797
|
+
class AutoFormShowFieldComponent {
|
|
1798
|
+
constructor() {
|
|
1799
|
+
this.fieldTypes = FieldType;
|
|
1800
|
+
this.inputType = InputType.Text;
|
|
1801
|
+
}
|
|
1802
|
+
ngOnInit() {
|
|
1803
|
+
this.setInputType();
|
|
1804
|
+
this.field = this.fieldData.field;
|
|
1805
|
+
this.value = this.data[this.field] || "";
|
|
1806
|
+
}
|
|
1807
|
+
setInputType() {
|
|
1808
|
+
switch (this.fieldData.options?.format) {
|
|
1809
|
+
case IFormFieldFormat.Email:
|
|
1810
|
+
this.inputType = InputType.Email;
|
|
1811
|
+
break;
|
|
1812
|
+
case IFormFieldFormat.Phone:
|
|
1813
|
+
this.inputType = InputType.Tel;
|
|
1814
|
+
break;
|
|
1815
|
+
default:
|
|
1816
|
+
this.inputType = InputType.Text;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormShowFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1820
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: AutoFormShowFieldComponent, isStandalone: false, selector: "shared-auto-form-show-field", inputs: { fieldData: "fieldData", data: "data", entityId: "entityId", entity: "entity", config: "config" }, ngImport: i0, template: "<div class=\"position-relative form-field\">\n <ng-container [ngSwitch]=\"fieldData.type\">\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeJSON\">\n <shared-form-field-json-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-json-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelect\">\n <shared-form-field-select-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelectMultiple\">\n <shared-form-field-select-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSlideToggle\">\n <shared-form-field-slide-toggle-show\n [config]=\"config\"\n [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-slide-toggle-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextarea\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div class=\"form-field-value\">{{value}}</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextareaEditor\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"form-field-value\" [innerHTML]=\"value\"></div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFile\">\n <shared-form-field-file-show\n [config]=\"config\"\n [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-file-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeRating\">\n <shared-star-rating\n [fieldData]=\"fieldData\"\n [config]=\"config\"\n [rating]=\"value\"></shared-star-rating>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFiles\">\n <shared-form-field-files-show [fieldData]=\"fieldData\"\n [entityId]=\"entityId\"\n [entitySection]=\"entity\"></shared-form-field-files-show>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <shared-form-field-input-show [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-input-show>\n </ng-container>\n </ng-container>\n</div>\n", styles: [".form-field{margin-bottom:20px}.form-field:last-child{margin-bottom:0}.show-label{font-size:12px;opacity:.5}.form-field-value{font-size:16px}.mb-21{margin-bottom:21px}.textarea-field-width{width:100%;max-width:1000px}\n"], dependencies: [{ kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: i1.StarRatingComponent, selector: "shared-star-rating", inputs: ["fieldData", "rating", "size", "config"] }, { kind: "component", type: FormFieldSelectShowComponent, selector: "shared-form-field-select-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldFileShowComponent, selector: "shared-form-field-file-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldSlideToggleShowComponent, selector: "shared-form-field-slide-toggle-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldInputShowComponent, selector: "shared-form-field-input-show", inputs: ["config", "fieldData", "value"] }, { kind: "component", type: FormFieldFilesShowComponent, selector: "shared-form-field-files-show", inputs: ["config", "fieldData", "entityId", "entitySection"] }, { kind: "component", type: FormFieldJsonShowComponent, selector: "shared-form-field-json-show", inputs: ["config", "fieldData", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1821
|
+
}
|
|
1822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormShowFieldComponent, decorators: [{
|
|
1823
|
+
type: Component,
|
|
1824
|
+
args: [{ selector: "shared-auto-form-show-field", changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"position-relative form-field\">\n <ng-container [ngSwitch]=\"fieldData.type\">\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeJSON\">\n <shared-form-field-json-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-json-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelect\">\n <shared-form-field-select-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSelectMultiple\">\n <shared-form-field-select-show\n [config]=\"config\"\n [fieldData]=\"fieldData\"\n [value]=\"value\"\n ></shared-form-field-select-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeSlideToggle\">\n <shared-form-field-slide-toggle-show\n [config]=\"config\"\n [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-slide-toggle-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextarea\">\n <label class=\"show-label\">{{fieldData.title}}</label>\n <div class=\"form-field-value\">{{value}}</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeTextareaEditor\">\n <label class=\"show-label\">{{fieldData.title}}: </label>\n <div class=\"form-field-value\" [innerHTML]=\"value\"></div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFile\">\n <shared-form-field-file-show\n [config]=\"config\"\n [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-file-show>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeRating\">\n <shared-star-rating\n [fieldData]=\"fieldData\"\n [config]=\"config\"\n [rating]=\"value\"></shared-star-rating>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"fieldTypes.FieldTypeFiles\">\n <shared-form-field-files-show [fieldData]=\"fieldData\"\n [entityId]=\"entityId\"\n [entitySection]=\"entity\"></shared-form-field-files-show>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <shared-form-field-input-show [fieldData]=\"fieldData\" [value]=\"value\"></shared-form-field-input-show>\n </ng-container>\n </ng-container>\n</div>\n", styles: [".form-field{margin-bottom:20px}.form-field:last-child{margin-bottom:0}.show-label{font-size:12px;opacity:.5}.form-field-value{font-size:16px}.mb-21{margin-bottom:21px}.textarea-field-width{width:100%;max-width:1000px}\n"] }]
|
|
1825
|
+
}], ctorParameters: () => [], propDecorators: { fieldData: [{
|
|
1826
|
+
type: Input
|
|
1827
|
+
}], data: [{
|
|
1828
|
+
type: Input
|
|
1829
|
+
}], entityId: [{
|
|
1830
|
+
type: Input
|
|
1831
|
+
}], entity: [{
|
|
1832
|
+
type: Input
|
|
1833
|
+
}], config: [{
|
|
1834
|
+
type: Input
|
|
1835
|
+
}] } });
|
|
1836
|
+
|
|
1837
|
+
class FormMessageBoxComponent {
|
|
1838
|
+
constructor(cd, baseAutoFormService) {
|
|
1839
|
+
this.cd = cd;
|
|
1840
|
+
this.baseAutoFormService = baseAutoFormService;
|
|
1841
|
+
this.listErrors = [];
|
|
1842
|
+
this.invalidFieldValidStatus = 'INVALID';
|
|
1843
|
+
this.titleUpdate = 'Внимание! Для сохранение нужно исправить:';
|
|
1844
|
+
this.titleAdd = 'Внимание! Необходимо исправить:';
|
|
1845
|
+
this.unSubscribeSubject$ = new Subject();
|
|
1846
|
+
this.fullPrefix = '_FULL';
|
|
1847
|
+
}
|
|
1848
|
+
ngOnInit() {
|
|
1849
|
+
this.checkFormField();
|
|
1850
|
+
this.subscribeToFormStatus();
|
|
1851
|
+
this.title = this.form.value.id ? this.titleUpdate : this.titleAdd;
|
|
1852
|
+
}
|
|
1853
|
+
ngOnDestroy() {
|
|
1854
|
+
this.unSubscribeSubject$.next();
|
|
1855
|
+
this.unSubscribeSubject$.complete();
|
|
1856
|
+
}
|
|
1857
|
+
subscribeToFormStatus() {
|
|
1858
|
+
this.form.statusChanges
|
|
1859
|
+
.pipe(takeUntil(this.unSubscribeSubject$))
|
|
1860
|
+
.subscribe(() => {
|
|
1861
|
+
this.checkFormField();
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
checkFormField() {
|
|
1865
|
+
this.listErrors = [];
|
|
1866
|
+
const fields = this.getPreparedFields();
|
|
1867
|
+
if (this.form.errors) {
|
|
1868
|
+
const formErrors = Object.keys(this.form.errors);
|
|
1869
|
+
if (formErrors.length) {
|
|
1870
|
+
formErrors.forEach(errorKey => {
|
|
1871
|
+
const message = this.getErrorMessage(errorKey);
|
|
1872
|
+
this.listErrors.push(message);
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
Object.keys(this.form.controls)
|
|
1877
|
+
.filter(controlKey => this.form.controls[controlKey].status === this.invalidFieldValidStatus)
|
|
1878
|
+
.forEach(controlKey => {
|
|
1879
|
+
const errors = this.form.controls[controlKey].errors;
|
|
1880
|
+
Object.keys(errors)
|
|
1881
|
+
.forEach(errorKey => {
|
|
1882
|
+
let message = this.getErrorMessage(errorKey, fields[controlKey]);
|
|
1883
|
+
if (errorKey === message && errors[errorKey]) {
|
|
1884
|
+
message = errors[errorKey];
|
|
1885
|
+
}
|
|
1886
|
+
this.listErrors.push(message);
|
|
1887
|
+
});
|
|
1888
|
+
});
|
|
1889
|
+
this.cd.markForCheck();
|
|
1890
|
+
}
|
|
1891
|
+
getPreparedFields() {
|
|
1892
|
+
const result = {};
|
|
1893
|
+
this.fields.forEach(fieldData => {
|
|
1894
|
+
result[fieldData.field] = fieldData;
|
|
1895
|
+
});
|
|
1896
|
+
return result;
|
|
1897
|
+
}
|
|
1898
|
+
;
|
|
1899
|
+
getErrorMessage(errorKey, field) {
|
|
1900
|
+
let baseErrorMessage = '';
|
|
1901
|
+
if (ERRORS[errorKey]) {
|
|
1902
|
+
baseErrorMessage = ERRORS[errorKey] ? ERRORS[errorKey].message2 : '';
|
|
1903
|
+
}
|
|
1904
|
+
if (!baseErrorMessage && this.errorMessageTexts && this.errorMessageTexts[errorKey]) {
|
|
1905
|
+
baseErrorMessage = this.errorMessageTexts[`${errorKey}${this.fullPrefix}`] || this.errorMessageTexts[errorKey];
|
|
1906
|
+
}
|
|
1907
|
+
if (!baseErrorMessage) {
|
|
1908
|
+
baseErrorMessage = errorKey;
|
|
1909
|
+
}
|
|
1910
|
+
return this.baseAutoFormService.prepareFieldError(baseErrorMessage, {
|
|
1911
|
+
['field']: field?.title,
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormMessageBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.BaseAutoFormService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1915
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormMessageBoxComponent, isStandalone: false, selector: "shred-form-message-box", inputs: { form: "form", fields: "fields", errorMessageTexts: "errorMessageTexts" }, ngImport: i0, template: "<ng-container *ngIf=\"!form.pristine\">\n <div @appearFromLeft *ngIf=\"listErrors && listErrors.length\" class=\"message-box error mb-10\">\n <b>{{title}}</b>\n <ul>\n <li *ngFor=\"let error of listErrors\" [innerHTML]=\"error\"></li>\n </ul>\n </div>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [appearFromLeft], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1916
|
+
}
|
|
1917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormMessageBoxComponent, decorators: [{
|
|
1918
|
+
type: Component,
|
|
1919
|
+
args: [{ selector: 'shred-form-message-box', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearFromLeft], standalone: false, template: "<ng-container *ngIf=\"!form.pristine\">\n <div @appearFromLeft *ngIf=\"listErrors && listErrors.length\" class=\"message-box error mb-10\">\n <b>{{title}}</b>\n <ul>\n <li *ngFor=\"let error of listErrors\" [innerHTML]=\"error\"></li>\n </ul>\n </div>\n</ng-container>\n" }]
|
|
1920
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.BaseAutoFormService }], propDecorators: { form: [{
|
|
1921
|
+
type: Input
|
|
1922
|
+
}], fields: [{
|
|
1923
|
+
type: Input
|
|
1924
|
+
}], errorMessageTexts: [{
|
|
1925
|
+
type: Input
|
|
1926
|
+
}] } });
|
|
1927
|
+
|
|
1928
|
+
class PublicationMessagesComponent {
|
|
1929
|
+
constructor(publicationMessagesFacade, autoFormService, cd) {
|
|
1930
|
+
this.publicationMessagesFacade = publicationMessagesFacade;
|
|
1931
|
+
this.autoFormService = autoFormService;
|
|
1932
|
+
this.cd = cd;
|
|
1933
|
+
this.config = { needToPublish: true };
|
|
1934
|
+
this.havePublication = true;
|
|
1935
|
+
this.scrollToField = new EventEmitter();
|
|
1936
|
+
this.errorOpened = false;
|
|
1937
|
+
this.messagesOpened = false;
|
|
1938
|
+
this.publishedTitle = 'Позиция опубликована до';
|
|
1939
|
+
this.unPublishedTitle = 'Внимание позиция НЕ опубликована';
|
|
1940
|
+
this.unPublishedMessage = 'Для публикации позиции нужно заполнить все поля и нажать на кнопку ОПУБЛИКОВАТЬ';
|
|
1941
|
+
this.errorTitleSource = 'Для публикации Вам обязательно нужно исправить <b>${pointCount}</b> пункт(а/ов)';
|
|
1942
|
+
this.recommendationTitleSource = 'Мы также рекомендуем Вам исправить <b>${pointCount}</b> пункт(а/ов)';
|
|
1943
|
+
this.errorTitle = '';
|
|
1944
|
+
this.recommendationTitle = '';
|
|
1945
|
+
this.publishErrorConstants = PublishErrors;
|
|
1946
|
+
this.itemPublishFinishedField = 'publishFinishedAt';
|
|
1947
|
+
this.itemPublishFinishedAt = '';
|
|
1948
|
+
this.itemPublishFinishedAtTmp = '';
|
|
1949
|
+
this.globalSubscription = new Subscription();
|
|
1950
|
+
}
|
|
1951
|
+
ngOnInit() {
|
|
1952
|
+
this.preparingComponent();
|
|
1953
|
+
}
|
|
1954
|
+
ngOnDestroy() {
|
|
1955
|
+
this.globalSubscription.unsubscribe();
|
|
1956
|
+
}
|
|
1957
|
+
ngOnChanges(changes) {
|
|
1958
|
+
if (changes?.form?.currentValue.value[this.itemPublishFinishedField]) {
|
|
1959
|
+
this.updateItemPublishFinishAt(changes.form.currentValue.value[this.itemPublishFinishedField]);
|
|
1960
|
+
}
|
|
1961
|
+
if (changes.entity || changes.itemId) {
|
|
1962
|
+
this.globalSubscription.unsubscribe();
|
|
1963
|
+
this.globalSubscription = new Subscription();
|
|
1964
|
+
this.preparingComponent();
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
preparingComponent() {
|
|
1968
|
+
this.subscribeToFormChanges();
|
|
1969
|
+
this.definitionPublicationMessages();
|
|
1970
|
+
}
|
|
1971
|
+
showScrollToFieldMethod(field) {
|
|
1972
|
+
this.scrollToField.emit(field);
|
|
1973
|
+
}
|
|
1974
|
+
subscribeToFormChanges() {
|
|
1975
|
+
const subscription = this.form.valueChanges
|
|
1976
|
+
.subscribe((data) => {
|
|
1977
|
+
this.updateItemPublishFinishAt(data?.publishFinishedAt);
|
|
1978
|
+
});
|
|
1979
|
+
this.globalSubscription.add(subscription);
|
|
1980
|
+
}
|
|
1981
|
+
updateItemPublishFinishAt(itemPublishFinishedAt) {
|
|
1982
|
+
if (this.itemPublishFinishedAtTmp !== itemPublishFinishedAt) {
|
|
1983
|
+
this.itemPublishFinishedAt = itemPublishFinishedAt;
|
|
1984
|
+
this.itemPublishFinishedAtTmp = itemPublishFinishedAt;
|
|
1985
|
+
this.cd.markForCheck();
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
definitionPublicationMessages() {
|
|
1989
|
+
if (typeof this.entity === 'string') {
|
|
1990
|
+
const subscription = this.publicationMessagesFacade.getPublicationMessage(this.entity?.toLowerCase(), this.itemId)
|
|
1991
|
+
.subscribe((messages) => {
|
|
1992
|
+
if (messages?.length) {
|
|
1993
|
+
const tmpErrors = this.filterMessages(true, messages);
|
|
1994
|
+
this.errors = this.prepareErrors(tmpErrors);
|
|
1995
|
+
const tmpRecommendation = this.filterMessages(false, messages);
|
|
1996
|
+
this.recommendation = this.prepareErrors(tmpRecommendation);
|
|
1997
|
+
if (this.errors.length) {
|
|
1998
|
+
this.errorTitle = this.errorTitleSource.replace('${pointCount}', String(this.errors.length));
|
|
1999
|
+
}
|
|
2000
|
+
if (this.recommendation.length) {
|
|
2001
|
+
this.recommendationTitle = this.recommendationTitleSource.replace('${pointCount}', String(this.recommendation.length));
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
this.errors = [];
|
|
2006
|
+
this.recommendation = [];
|
|
2007
|
+
}
|
|
2008
|
+
this.cd.markForCheck();
|
|
2009
|
+
});
|
|
2010
|
+
this.globalSubscription.add(subscription);
|
|
2011
|
+
}
|
|
2012
|
+
else {
|
|
2013
|
+
console.error('[ publish-messages ][ entity-type ]', { entity: this.entity }, 'INCORRECT_ENTITY_TYPE');
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
filterMessages(error = false, messages) {
|
|
2017
|
+
return messages.filter(item => item.isError === error);
|
|
2018
|
+
}
|
|
2019
|
+
toggleExpand(isError = false) {
|
|
2020
|
+
if (isError) {
|
|
2021
|
+
this.errorOpened = !this.errorOpened;
|
|
2022
|
+
}
|
|
2023
|
+
else {
|
|
2024
|
+
this.messagesOpened = !this.messagesOpened;
|
|
2025
|
+
}
|
|
2026
|
+
this.cd.markForCheck();
|
|
2027
|
+
}
|
|
2028
|
+
truckByField(index, item) {
|
|
2029
|
+
return item.field;
|
|
2030
|
+
}
|
|
2031
|
+
prepareErrors(messages) {
|
|
2032
|
+
return this.autoFormService.prepareFormFieldPublicationMessage(messages, this.publishErrorConstants, this.fields);
|
|
2033
|
+
}
|
|
2034
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PublicationMessagesComponent, deps: [{ token: i1.PublicationMessagesFacade }, { token: i1.AutoFormService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2035
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: PublicationMessagesComponent, isStandalone: false, selector: "shared-publication-messages", inputs: { entity: "entity", form: "form", itemId: "itemId", fields: "fields", config: "config", havePublication: "havePublication" }, outputs: { scrollToField: "scrollToField" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"itemPublishFinishedAt\" @appearFromLeftWithDelay class=\"message-box success mb-10\">\n <div>{{publishedTitle}} <b>{{itemPublishFinishedAt| date : 'MMM d, y'}}</b></div>\n</div>\n<div *ngIf=\"!itemPublishFinishedAt && havePublication\" @appearFromLeftWithDelay class=\"message-box error mb-10\">\n <div class=\"no-publish-error\">\n <mat-icon class=\"no-publish-error-ico\">assignment_late</mat-icon>\n <div class=\"no-publish-error-text\">\n <div>{{unPublishedTitle}}</div>\n <div class=\"fs-12 pt-0\">{{unPublishedMessage}}</div>\n </div>\n </div>\n</div>\n<ng-container *ngIf=\"errors?.length\">\n <ng-container\n *ngTemplateOutlet=\"listMessages; context: {title: errorTitle, isError: true, messages: errors}\"></ng-container>\n</ng-container>\n<ng-container *ngIf=\"recommendation?.length\">\n <ng-container\n *ngTemplateOutlet=\"listMessages; context: {title: recommendationTitle, isError: false, messages: recommendation}\"></ng-container>\n</ng-container>\n<ng-template #listMessages let-title=\"title\" let-isError=\"isError\" let-messages=\"messages\">\n <div class=\"publish-messages mb-10\"\n [ngClass]=\"{'error-messages': isError, 'warning-messages': !isError}\">\n <div class=\"title cursor-pointer\"\n fxLayout=\"row\"\n fxLayoutAlign=\"space-between center\"\n (click)=\"toggleExpand(isError)\">\n <div fxLayout=\"row\" fxLayoutAlign=\"left center\">\n <mat-icon class=\"f-28 ml-10 mr-20\">{{isError ? 'error' : 'report_problem'}}</mat-icon>\n <h4 [innerHTML]=\"title\"></h4>\n </div>\n <shared-button\n color=\"basic\"\n iconColor=\"orange_gray\"\n size=\"large\"\n [icon]=\"(isError && errorOpened) || (!isError && messagesOpened) ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></shared-button>\n </div>\n <div *ngIf=\"(errorOpened && isError) || (messagesOpened && !isError)\"\n [@expandCollapse]\n class=\"publish-messages-list\">\n <div *ngFor=\"let messageData of messages;trackBy: truckByField\" class=\"mb-10\">\n <shared-panel [title]=\"messageData.title\"\n [description]=\"messageData.description\"\n color=\"red-light\"\n buttonColor=\"accent\"\n ></shared-panel>\n <a class=\"cursor-pointer color-grey fs-12\" (click)=\"showScrollToFieldMethod(messageData.field)\">\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C\n \u043F\u043E\u043B\u0435</a>\n </div>\n </div>\n </div>\n</ng-template>\n<div *ngIf=\"errors?.length || recommendation?.length\" fxLayout=\"row\" fxLayoutAlign=\"end center\" class=\"fs-12\">\n \u0415\u0441\u043B\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044C \u0432\u043E\u043F\u0440\u043E\u0441\u044B \u043F\u043E \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438 \u043F\u0438\u0448\u0438\u0442\u0435 \u0432 <a class=\"pl-5\" href=\"mailto:support@world-travel.uz\">support@world-travel.uz</a>\n</div>\n", styles: [".publish-messages{border-radius:8px;overflow:hidden}.publish-messages.error-messages{background:linear-gradient(90deg,#ef847c,#f190af)}.publish-messages.error-messages .title{background:#f44336;background:linear-gradient(to bottom,#f44336,#af3b32);color:#fff}.publish-messages.warning-messages{background:linear-gradient(260deg,#faf0cd,#fab397)}.publish-messages.warning-messages .title{background:#e28d0b;background:linear-gradient(to bottom,#ffb646,#e28d0b);color:#fff}.publish-messages .title{padding:10px;border-top-left-radius:8px;border-top-right-radius:8px;text-shadow:0 0 6px rgba(56,56,56,.5803921569);font-size:16px}.publish-messages .publish-messages-list{padding:10px}.publish-messages .h4,.publish-messages h4{cursor:pointer}.no-publish-error{display:flex}.no-publish-error .no-publish-error-ico{font-size:43px;margin-right:10px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.PanelComponent, selector: "shared-panel", inputs: ["title", "smallDescription", "description", "color", "buttonColor"], outputs: ["close"] }, { kind: "component", type: i1.ButtonComponent, selector: "shared-button", inputs: ["icon", "iconColor", "iconSize", "rightIcon", "disabled", "loading", "active", "stopPropagation", "type", "color", "fullWidth", "size", "styleTheme", "tooltip", "tooltipPosition"], outputs: ["clickButton"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }], animations: [expandCollapse, appearFromLeftWithDelay], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2036
|
+
}
|
|
2037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: PublicationMessagesComponent, decorators: [{
|
|
2038
|
+
type: Component,
|
|
2039
|
+
args: [{ selector: 'shared-publication-messages', animations: [expandCollapse, appearFromLeftWithDelay], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div *ngIf=\"itemPublishFinishedAt\" @appearFromLeftWithDelay class=\"message-box success mb-10\">\n <div>{{publishedTitle}} <b>{{itemPublishFinishedAt| date : 'MMM d, y'}}</b></div>\n</div>\n<div *ngIf=\"!itemPublishFinishedAt && havePublication\" @appearFromLeftWithDelay class=\"message-box error mb-10\">\n <div class=\"no-publish-error\">\n <mat-icon class=\"no-publish-error-ico\">assignment_late</mat-icon>\n <div class=\"no-publish-error-text\">\n <div>{{unPublishedTitle}}</div>\n <div class=\"fs-12 pt-0\">{{unPublishedMessage}}</div>\n </div>\n </div>\n</div>\n<ng-container *ngIf=\"errors?.length\">\n <ng-container\n *ngTemplateOutlet=\"listMessages; context: {title: errorTitle, isError: true, messages: errors}\"></ng-container>\n</ng-container>\n<ng-container *ngIf=\"recommendation?.length\">\n <ng-container\n *ngTemplateOutlet=\"listMessages; context: {title: recommendationTitle, isError: false, messages: recommendation}\"></ng-container>\n</ng-container>\n<ng-template #listMessages let-title=\"title\" let-isError=\"isError\" let-messages=\"messages\">\n <div class=\"publish-messages mb-10\"\n [ngClass]=\"{'error-messages': isError, 'warning-messages': !isError}\">\n <div class=\"title cursor-pointer\"\n fxLayout=\"row\"\n fxLayoutAlign=\"space-between center\"\n (click)=\"toggleExpand(isError)\">\n <div fxLayout=\"row\" fxLayoutAlign=\"left center\">\n <mat-icon class=\"f-28 ml-10 mr-20\">{{isError ? 'error' : 'report_problem'}}</mat-icon>\n <h4 [innerHTML]=\"title\"></h4>\n </div>\n <shared-button\n color=\"basic\"\n iconColor=\"orange_gray\"\n size=\"large\"\n [icon]=\"(isError && errorOpened) || (!isError && messagesOpened) ? 'keyboard_arrow_up' : 'keyboard_arrow_down'\"></shared-button>\n </div>\n <div *ngIf=\"(errorOpened && isError) || (messagesOpened && !isError)\"\n [@expandCollapse]\n class=\"publish-messages-list\">\n <div *ngFor=\"let messageData of messages;trackBy: truckByField\" class=\"mb-10\">\n <shared-panel [title]=\"messageData.title\"\n [description]=\"messageData.description\"\n color=\"red-light\"\n buttonColor=\"accent\"\n ></shared-panel>\n <a class=\"cursor-pointer color-grey fs-12\" (click)=\"showScrollToFieldMethod(messageData.field)\">\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C\n \u043F\u043E\u043B\u0435</a>\n </div>\n </div>\n </div>\n</ng-template>\n<div *ngIf=\"errors?.length || recommendation?.length\" fxLayout=\"row\" fxLayoutAlign=\"end center\" class=\"fs-12\">\n \u0415\u0441\u043B\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044C \u0432\u043E\u043F\u0440\u043E\u0441\u044B \u043F\u043E \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438 \u043F\u0438\u0448\u0438\u0442\u0435 \u0432 <a class=\"pl-5\" href=\"mailto:support@world-travel.uz\">support@world-travel.uz</a>\n</div>\n", styles: [".publish-messages{border-radius:8px;overflow:hidden}.publish-messages.error-messages{background:linear-gradient(90deg,#ef847c,#f190af)}.publish-messages.error-messages .title{background:#f44336;background:linear-gradient(to bottom,#f44336,#af3b32);color:#fff}.publish-messages.warning-messages{background:linear-gradient(260deg,#faf0cd,#fab397)}.publish-messages.warning-messages .title{background:#e28d0b;background:linear-gradient(to bottom,#ffb646,#e28d0b);color:#fff}.publish-messages .title{padding:10px;border-top-left-radius:8px;border-top-right-radius:8px;text-shadow:0 0 6px rgba(56,56,56,.5803921569);font-size:16px}.publish-messages .publish-messages-list{padding:10px}.publish-messages .h4,.publish-messages h4{cursor:pointer}.no-publish-error{display:flex}.no-publish-error .no-publish-error-ico{font-size:43px;margin-right:10px}\n"] }]
|
|
2040
|
+
}], ctorParameters: () => [{ type: i1.PublicationMessagesFacade }, { type: i1.AutoFormService }, { type: i0.ChangeDetectorRef }], propDecorators: { entity: [{
|
|
2041
|
+
type: Input
|
|
2042
|
+
}], form: [{
|
|
2043
|
+
type: Input
|
|
2044
|
+
}], itemId: [{
|
|
2045
|
+
type: Input
|
|
2046
|
+
}], fields: [{
|
|
2047
|
+
type: Input
|
|
2048
|
+
}], config: [{
|
|
2049
|
+
type: Input
|
|
2050
|
+
}], havePublication: [{
|
|
2051
|
+
type: Input
|
|
2052
|
+
}], scrollToField: [{
|
|
2053
|
+
type: Output
|
|
2054
|
+
}] } });
|
|
2055
|
+
|
|
2056
|
+
class AutoFormMainComponent {
|
|
2057
|
+
constructor(formErrors, formsFacade, baseAutoFormService, autoFormService, publicationMessagesFacade, route, staticDataFacade, cd) {
|
|
2058
|
+
this.formErrors = formErrors;
|
|
2059
|
+
this.formsFacade = formsFacade;
|
|
2060
|
+
this.baseAutoFormService = baseAutoFormService;
|
|
2061
|
+
this.autoFormService = autoFormService;
|
|
2062
|
+
this.publicationMessagesFacade = publicationMessagesFacade;
|
|
2063
|
+
this.route = route;
|
|
2064
|
+
this.staticDataFacade = staticDataFacade;
|
|
2065
|
+
this.cd = cd;
|
|
2066
|
+
this.showPublicationMessages = false;
|
|
2067
|
+
this.useEntityPermissions = false;
|
|
2068
|
+
this.showProgressBar = true;
|
|
2069
|
+
this.showFormMessageBox = true;
|
|
2070
|
+
this.editorImageUploadUrl = '';
|
|
2071
|
+
this.havePublication = true;
|
|
2072
|
+
this.config = { needToPublish: true, smallFormWidth: false };
|
|
2073
|
+
this.changed = new EventEmitter();
|
|
2074
|
+
this.formCompleted = new EventEmitter();
|
|
2075
|
+
this.globalSubscription = new Subscription();
|
|
2076
|
+
this.object_ = Object;
|
|
2077
|
+
this.dataStored = false;
|
|
2078
|
+
this.dataStoredTitle = 'Данные сохранены';
|
|
2079
|
+
this.formSaveErrorKey = 'FORM_SAVE_ERROR';
|
|
2080
|
+
this.groupsState = {};
|
|
2081
|
+
this.isAvailableToUpdate = true;
|
|
2082
|
+
this.destroy$ = new Subject();
|
|
2083
|
+
this.fieldTypes = FieldType;
|
|
2084
|
+
}
|
|
2085
|
+
ngOnInit() {
|
|
2086
|
+
this.currentEntity = this.entity;
|
|
2087
|
+
this.currentItemId = this.itemId;
|
|
2088
|
+
if (this.itemId) {
|
|
2089
|
+
this.dataStored = true;
|
|
2090
|
+
}
|
|
2091
|
+
this.storedFormValue = this.form.value;
|
|
2092
|
+
// @TODO Need to test 31.01
|
|
2093
|
+
// this.preparingData();
|
|
2094
|
+
this.autoCompleteFields = [];
|
|
2095
|
+
if (this.autoCompleteFieldInput) {
|
|
2096
|
+
this.autoCompleteFields = [...this.autoCompleteFieldInput];
|
|
2097
|
+
}
|
|
2098
|
+
this.getQueryParams();
|
|
2099
|
+
if (this.useEntityPermissions) {
|
|
2100
|
+
this.loadEntityPermissions();
|
|
2101
|
+
}
|
|
2102
|
+
this.preLoadSections();
|
|
2103
|
+
}
|
|
2104
|
+
ngOnDestroy() {
|
|
2105
|
+
this.globalSubscription.unsubscribe();
|
|
2106
|
+
this.destroy$.next();
|
|
2107
|
+
this.destroy$.complete();
|
|
2108
|
+
}
|
|
2109
|
+
ngOnChanges(changes) {
|
|
2110
|
+
if ((changes.entity && changes.entity.currentValue !== this.currentEntity) ||
|
|
2111
|
+
(changes.itemId && changes.itemId.currentValue !== this.currentItemId)) {
|
|
2112
|
+
this.globalSubscription.unsubscribe();
|
|
2113
|
+
this.globalSubscription = new Subscription();
|
|
2114
|
+
this.preparingData();
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
groupClick(groupName) {
|
|
2118
|
+
this.groupsState[groupName] = !this.groupsState[groupName];
|
|
2119
|
+
}
|
|
2120
|
+
truckByFieldName(index, item) {
|
|
2121
|
+
return item.field;
|
|
2122
|
+
}
|
|
2123
|
+
scrollToField(field) {
|
|
2124
|
+
const fieldGroup = this.fields.find(item => item.field === field)?.options.groupName;
|
|
2125
|
+
this.groupsState[fieldGroup] = 1;
|
|
2126
|
+
setTimeout(() => {
|
|
2127
|
+
let el = document.getElementById(`field-${field}`);
|
|
2128
|
+
el.scrollIntoView();
|
|
2129
|
+
}, 0);
|
|
2130
|
+
}
|
|
2131
|
+
getFormFieldClass(data) {
|
|
2132
|
+
let className = [];
|
|
2133
|
+
if (data.options?.col) {
|
|
2134
|
+
className.push(`col-lg-${data.options.col}`);
|
|
2135
|
+
if (!data.options?.colXl) {
|
|
2136
|
+
className.push(`col-xl-${data.options.col}`);
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
if (data.options?.colXxl) {
|
|
2140
|
+
className.push(`col-xxl-${data.options.colXxl}`);
|
|
2141
|
+
}
|
|
2142
|
+
if (data.options?.colXl) {
|
|
2143
|
+
className.push(`col-xl-${data.options.colXl}`);
|
|
2144
|
+
}
|
|
2145
|
+
if (data.options?.colLg) {
|
|
2146
|
+
className.push(`col-lg-${data.options.colLg}`);
|
|
2147
|
+
}
|
|
2148
|
+
if (data.options?.colMd) {
|
|
2149
|
+
className.push(`col-md-${data.options.colMd}`);
|
|
2150
|
+
}
|
|
2151
|
+
if (!className.length) {
|
|
2152
|
+
className.push(`col-lg-12`);
|
|
2153
|
+
}
|
|
2154
|
+
if (data.options?.colSm) {
|
|
2155
|
+
className.push(`col-sm-${data.options.colSm}`);
|
|
2156
|
+
}
|
|
2157
|
+
else {
|
|
2158
|
+
className.push(`col-sm-12`);
|
|
2159
|
+
}
|
|
2160
|
+
return className.join(' ');
|
|
2161
|
+
}
|
|
2162
|
+
getQueryParams() {
|
|
2163
|
+
this.route.queryParamMap
|
|
2164
|
+
.pipe(takeUntil(this.destroy$))
|
|
2165
|
+
.subscribe(params => {
|
|
2166
|
+
const fields = params.getAll('fields');
|
|
2167
|
+
const fieldsValue = params.getAll('fieldsvalue');
|
|
2168
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2169
|
+
this.autoCompleteFields.push({
|
|
2170
|
+
field: fields[i],
|
|
2171
|
+
value: Number(fieldsValue[i])
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
preparingData() {
|
|
2177
|
+
this.groupFields();
|
|
2178
|
+
this.subscribeToFormErrors();
|
|
2179
|
+
this.subscribeToFormStatus();
|
|
2180
|
+
this.subscribeToFormChanges();
|
|
2181
|
+
this.subscribeToPublicationMessages();
|
|
2182
|
+
}
|
|
2183
|
+
groupFields() {
|
|
2184
|
+
this.groupedFields = {};
|
|
2185
|
+
this.fields.filter(formField => !formField.options?.hide)
|
|
2186
|
+
.forEach(formField => {
|
|
2187
|
+
let needToShow = true;
|
|
2188
|
+
if (formField.options?.showIf) {
|
|
2189
|
+
const relatedField = formField.options.showIf.relatedField;
|
|
2190
|
+
const relatedFieldValue = this.form.value?.[relatedField];
|
|
2191
|
+
if (relatedFieldValue) {
|
|
2192
|
+
needToShow = this.baseAutoFormService.checkShowIfConditions(relatedFieldValue, formField.options.showIf.conditions);
|
|
2193
|
+
}
|
|
2194
|
+
else {
|
|
2195
|
+
needToShow = false;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
const groupName = formField.options?.groupName || '';
|
|
2199
|
+
if (!this.groupedFields[groupName]) {
|
|
2200
|
+
this.groupedFields[groupName] = [];
|
|
2201
|
+
}
|
|
2202
|
+
if (needToShow) {
|
|
2203
|
+
this.groupedFields[groupName].push({ ...formField });
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
Object.keys(this.groupedFields)?.forEach((group, index) => {
|
|
2207
|
+
if (!this.groupsState[group]) {
|
|
2208
|
+
this.groupsState[group] = index === 0;
|
|
2209
|
+
}
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
subscribeToFormErrors() {
|
|
2213
|
+
const newSubscription = this.formErrors.getFormErrors(this.formId)
|
|
2214
|
+
.pipe(filter((errors) => !!(errors && errors.length)))
|
|
2215
|
+
.subscribe((errors) => {
|
|
2216
|
+
if (errors && errors.length) {
|
|
2217
|
+
errors.forEach(error => {
|
|
2218
|
+
const { field, code } = error;
|
|
2219
|
+
if (field && code) {
|
|
2220
|
+
const control = this.form.get(field);
|
|
2221
|
+
if (control) {
|
|
2222
|
+
const codeUpperCase = code.toUpperCase();
|
|
2223
|
+
control.setErrors({ [codeUpperCase]: codeUpperCase });
|
|
2224
|
+
control.markAsDirty();
|
|
2225
|
+
// control.markAsTouched();
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
this.cd.markForCheck();
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
this.globalSubscription.add(newSubscription);
|
|
2233
|
+
}
|
|
2234
|
+
subscribeToFormStatus() {
|
|
2235
|
+
this.formsFacade.initForm({
|
|
2236
|
+
formId: this.formId,
|
|
2237
|
+
loading: false
|
|
2238
|
+
});
|
|
2239
|
+
const newSubscription = this.formsFacade.getForm(this.formId)
|
|
2240
|
+
.pipe(distinctUntilChanged((a, b) => {
|
|
2241
|
+
return a?.isComplete === b?.isComplete;
|
|
2242
|
+
}))
|
|
2243
|
+
.subscribe((form) => {
|
|
2244
|
+
if (form.isComplete) {
|
|
2245
|
+
this.formCompleted.emit({ newId: form.data.itemId });
|
|
2246
|
+
}
|
|
2247
|
+
if (form && form.isComplete) {
|
|
2248
|
+
if (!form.hasError) {
|
|
2249
|
+
this.dataStored = true;
|
|
2250
|
+
}
|
|
2251
|
+
else {
|
|
2252
|
+
this.form.setErrors({ [this.formSaveErrorKey]: this.formSaveErrorKey });
|
|
2253
|
+
}
|
|
2254
|
+
this.cd.markForCheck();
|
|
2255
|
+
}
|
|
2256
|
+
});
|
|
2257
|
+
this.globalSubscription.add(newSubscription);
|
|
2258
|
+
}
|
|
2259
|
+
subscribeToFormChanges() {
|
|
2260
|
+
const newSubscription = this.form.valueChanges
|
|
2261
|
+
.pipe(distinctUntilChanged((a, b) => {
|
|
2262
|
+
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
2263
|
+
return false;
|
|
2264
|
+
}
|
|
2265
|
+
const haveUpdate = Object.keys(a).filter(field => a[field] !== b[field]);
|
|
2266
|
+
return !haveUpdate.length;
|
|
2267
|
+
}))
|
|
2268
|
+
.subscribe((formValue) => {
|
|
2269
|
+
// Need to update controls for fields with "option.showIf"
|
|
2270
|
+
this.checkShowIfFieldsAndAddRequiredValidations();
|
|
2271
|
+
this.groupFields();
|
|
2272
|
+
const areEquals = this.areObjectsEquals(formValue, this.storedFormValue);
|
|
2273
|
+
if (!areEquals) {
|
|
2274
|
+
this.storedFormValue = formValue;
|
|
2275
|
+
}
|
|
2276
|
+
this.dataStored = areEquals;
|
|
2277
|
+
this.changed.emit({ valueChanged: !areEquals });
|
|
2278
|
+
});
|
|
2279
|
+
this.globalSubscription.add(newSubscription);
|
|
2280
|
+
}
|
|
2281
|
+
checkShowIfFieldsAndAddRequiredValidations() {
|
|
2282
|
+
this.fields.filter(item => item.options.showIf)
|
|
2283
|
+
.forEach(item => {
|
|
2284
|
+
let needToShow;
|
|
2285
|
+
const relatedField = item.options.showIf.relatedField;
|
|
2286
|
+
const relatedFieldValue = this.form.value?.[relatedField];
|
|
2287
|
+
if (relatedFieldValue) {
|
|
2288
|
+
needToShow = this.baseAutoFormService.checkShowIfConditions(relatedFieldValue, item.options.showIf.conditions);
|
|
2289
|
+
}
|
|
2290
|
+
else {
|
|
2291
|
+
needToShow = false;
|
|
2292
|
+
}
|
|
2293
|
+
this.form.get(item.field).clearValidators();
|
|
2294
|
+
if (item.validators?.length) {
|
|
2295
|
+
if (needToShow) {
|
|
2296
|
+
const validators = this.autoFormService.getValidators(item.validators);
|
|
2297
|
+
this.form.get(item.field).addValidators(validators);
|
|
2298
|
+
}
|
|
2299
|
+
else {
|
|
2300
|
+
const validators = this.autoFormService.getValidators(item.validators.filter(validator => validator !== ValidatorsType.Required));
|
|
2301
|
+
this.form.get(item.field).addValidators(validators);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
this.form.get(item.field).updateValueAndValidity();
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
areObjectsEquals(a, b) {
|
|
2308
|
+
if (a && b) {
|
|
2309
|
+
return Object.keys(a)
|
|
2310
|
+
.every(field => {
|
|
2311
|
+
let theyEqual;
|
|
2312
|
+
if (typeof a[field] === 'object') {
|
|
2313
|
+
if (typeof b[field] === 'object') {
|
|
2314
|
+
theyEqual = this.areObjectsEquals(a[field], b[field]);
|
|
2315
|
+
}
|
|
2316
|
+
else {
|
|
2317
|
+
theyEqual = false;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
else {
|
|
2321
|
+
theyEqual = a[field] === b[field];
|
|
2322
|
+
}
|
|
2323
|
+
return theyEqual;
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
subscribeToPublicationMessages() {
|
|
2329
|
+
if (this.itemId) {
|
|
2330
|
+
const newSubscription = this.publicationMessagesFacade.getPublicationMessage(this.entity, this.itemId)
|
|
2331
|
+
.subscribe((publicationMessages) => {
|
|
2332
|
+
this.allPublicationMessages = publicationMessages;
|
|
2333
|
+
});
|
|
2334
|
+
this.globalSubscription.add(newSubscription);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
loadEntityPermissions() {
|
|
2338
|
+
const currentUserCookieKey = STORAGE_KEY.currentUser;
|
|
2339
|
+
const currentUserDataString = localStorage.getItem(currentUserCookieKey);
|
|
2340
|
+
if (currentUserDataString) {
|
|
2341
|
+
try {
|
|
2342
|
+
const currentUserData = JSON.parse(currentUserDataString);
|
|
2343
|
+
if (currentUserData?.entityPermissions) {
|
|
2344
|
+
const allEntityPermissions = currentUserData?.entityPermissions;
|
|
2345
|
+
const entityPermissions = Object.values(allEntityPermissions)
|
|
2346
|
+
.find((oneEntityPermissions) => oneEntityPermissions.dbModelAlias === this.entity);
|
|
2347
|
+
if (entityPermissions.update?.commonConditions?.length) {
|
|
2348
|
+
this.isAvailableToUpdate = this.isAvailableToUpdateChecking(entityPermissions.update?.commonConditions);
|
|
2349
|
+
}
|
|
2350
|
+
if (entityPermissions?.update?.denyFields?.length) {
|
|
2351
|
+
this.entityPermissionUpdateDanyFields = [];
|
|
2352
|
+
entityPermissions?.update?.denyFields
|
|
2353
|
+
.forEach(item => {
|
|
2354
|
+
this.entityPermissionUpdateDanyFields = [
|
|
2355
|
+
...this.entityPermissionUpdateDanyFields,
|
|
2356
|
+
...item.fields
|
|
2357
|
+
];
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
catch (e) {
|
|
2363
|
+
console.error('[ auto-form-main ][ parse-current-user-data ]', currentUserDataString);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
isAvailableToUpdateChecking(entityPermissionUpdateCommonConditions) {
|
|
2368
|
+
let result = true;
|
|
2369
|
+
if (entityPermissionUpdateCommonConditions?.length) {
|
|
2370
|
+
const formValues = this.form.value;
|
|
2371
|
+
result = entityPermissionUpdateCommonConditions.some(condition => {
|
|
2372
|
+
return Object.keys(condition).every(field => formValues[field] === condition[field]);
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
return result;
|
|
2376
|
+
}
|
|
2377
|
+
preLoadSections() {
|
|
2378
|
+
const preLoadSections = this.config.preLoadSections;
|
|
2379
|
+
if (preLoadSections) {
|
|
2380
|
+
this.staticDataFacade.staticDataLoadCategories(preLoadSections);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormMainComponent, deps: [{ token: i1.FormErrorsFacade }, { token: i1.FormsFacade }, { token: i1.BaseAutoFormService }, { token: i1.AutoFormService }, { token: i1.PublicationMessagesFacade }, { token: i2$4.ActivatedRoute }, { token: i1.StaticDataFacade }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2384
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.25", type: AutoFormMainComponent, isStandalone: false, selector: "shared-auto-form", inputs: { fields: "fields", itemId: ["itemId", "itemId", numberAttribute], formId: "formId", showPublicationMessages: "showPublicationMessages", useEntityPermissions: "useEntityPermissions", showProgressBar: "showProgressBar", showFormMessageBox: "showFormMessageBox", form: "form", editorImageUploadUrl: "editorImageUploadUrl", errorMessageTexts: "errorMessageTexts", entity: "entity", havePublication: "havePublication", autoCompleteFieldInput: "autoCompleteFieldInput", config: "config" }, outputs: { changed: "changed", formCompleted: "formCompleted" }, usesOnChanges: true, ngImport: i0, template: "<shared-smart-progress-bar *ngIf=\"showProgressBar && storedFormValue?._occupancyRating\"\n [value]=\"storedFormValue?._occupancyRating\"\n [title]=\"'\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u0444\u043E\u0440\u043C\u044B'\"></shared-smart-progress-bar>\n\n<ng-container *ngIf=\"showPublicationMessages && fields?.length\">\n <ng-container\n *ngTemplateOutlet=\"publicationMessages, context: {form: form, entity: entity, itemId: itemId, fields: fields}\"></ng-container>\n</ng-container>\n\n<div *ngFor=\"let group of object_.keys(groupedFields); trackBy: truckByFieldName\"\n class=\"form-group container\"\n [ngClass]=\"{'form-group-open': groupsState[group]}\">\n\n <h2 *ngIf=\"group && object_.keys(groupedFields)?.length > 1\" class=\"form-field-group-title\" (click)=\"groupClick(group)\">\n <mat-icon class=\"fs-20 field-group-icon\">expand_more</mat-icon>\n {{ group }}\n </h2>\n <div\n [ngClass]=\"{\n 'small-form-width': config?.smallFormWidth,\n 'form-group-field-open': groupsState[group]\n }\"\n class=\"row form-group-fields\">\n <div *ngFor=\"let item of groupedFields[group]; trackBy: truckByFieldName\"\n class=\"form-field-row\"\n [ngClass]=\"getFormFieldClass(item)\">\n <div *ngIf=\"isAvailableToUpdate\" [ngClass]=\"{'field-tab': group}\">\n <shared-form-field\n [config]=\"config\"\n [itemId]=\"itemId\"\n [fieldData]=\"item\"\n [form]=\"form\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [editorImageUploadUrl]=\"editorImageUploadUrl\"\n [entity]=\"entity\"\n [fields]=\"fields\"\n [formData]=\"form.value\"\n [publicationMessages]=\"allPublicationMessages\"\n [autoCompleteFields]=\"autoCompleteFields\"\n [entityPermissionUpdateDanyFields]=\"entityPermissionUpdateDanyFields\"\n ></shared-form-field>\n </div>\n <div *ngIf=\"!isAvailableToUpdate\" [ngClass]=\"{'field-tab': group}\">\n <shared-auto-form-show-field\n [config]=\"config\"\n [fieldData]=\"item\"\n [data]=\"form.value\"\n [entityId]=\"itemId\"\n [entity]=\"entity\"\n ></shared-auto-form-show-field>\n </div>\n </div>\n </div>\n</div>\n\n<div @appearFromLeft *ngIf=\"showFormMessageBox && dataStored && form.valid\" class=\"message-box warning mt-20 mb-10\">\n <ul>\n <li>{{ dataStoredTitle }}</li>\n </ul>\n</div>\n<shred-form-message-box\n *ngIf=\"showFormMessageBox\"\n [form]=\"form\"\n [fields]=\"fields\"\n [errorMessageTexts]=\"errorMessageTexts\"></shred-form-message-box>\n\n<ng-container *ngIf=\"showFormMessageBox && havePublication\">\n <ng-container *ngIf=\"showPublicationMessages && fields?.length\">\n <ng-container\n *ngTemplateOutlet=\"publicationMessages, context: {form: form, entity: entity, itemId: itemId, fields: fields}\"></ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #publicationMessages let-form=\"form\" let-entity=\"entity\" let-itemId=\"itemId\" let-fields=\"fields\">\n <shared-publication-messages\n *ngIf=\"itemId\"\n [@appearFromLeft]\n [form]=\"form\"\n [entity]=\"entity\"\n [itemId]=\"itemId\"\n [fields]=\"fields\"\n [havePublication]=\"havePublication\"\n (scrollToField)=\"scrollToField($event)\"></shared-publication-messages>\n</ng-template>\n\n<ng-container *ngIf=\"isAvailableToUpdate\">\n <ng-content select=\"[submitButton]\"></ng-content>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-wrap:wrap}.form-group-fields{display:none}.form-group-fields.form-group-field-open{display:flex;margin-left:0}.form-group{cursor:pointer;margin-bottom:0}.form-group h2{display:flex;transition:color .3s;align-items:center}.progress-bar{margin-bottom:10px}.form-field-row{margin:8px 0}.small-form-width .form-field-row{margin-bottom:10px}.small-form-width .show-label{margin-bottom:0!important}.form-field-group-title{font-size:18px;display:flex;margin-top:15px;background:#f5f5f5;padding:10px;border-radius:8px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.SmartProgressBarComponent, selector: "shared-smart-progress-bar", inputs: ["value", "title", "showValue"] }, { kind: "component", type: FormFieldComponent, selector: "shared-form-field", inputs: ["fields", "formData", "config", "fieldData", "itemId", "form", "editorImageUploadUrl", "errorMessageTexts", "entity", "publicationMessages", "entityTypeUserRoleRights", "autoCompleteFields", "entityPermissionUpdateDanyFields"], outputs: ["eventUpdateForm", "eventSendAction"] }, { kind: "component", type: AutoFormShowFieldComponent, selector: "shared-auto-form-show-field", inputs: ["fieldData", "data", "entityId", "entity", "config"] }, { kind: "component", type: FormMessageBoxComponent, selector: "shred-form-message-box", inputs: ["form", "fields", "errorMessageTexts"] }, { kind: "component", type: PublicationMessagesComponent, selector: "shared-publication-messages", inputs: ["entity", "form", "itemId", "fields", "config", "havePublication"], outputs: ["scrollToField"] }], animations: [appearFromLeft, appearOpacity], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2385
|
+
}
|
|
2386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormMainComponent, decorators: [{
|
|
2387
|
+
type: Component,
|
|
2388
|
+
args: [{ selector: 'shared-auto-form', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearFromLeft, appearOpacity], standalone: false, template: "<shared-smart-progress-bar *ngIf=\"showProgressBar && storedFormValue?._occupancyRating\"\n [value]=\"storedFormValue?._occupancyRating\"\n [title]=\"'\u0423\u0440\u043E\u0432\u0435\u043D\u044C \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u043D\u043E\u0441\u0442\u0438 \u0444\u043E\u0440\u043C\u044B'\"></shared-smart-progress-bar>\n\n<ng-container *ngIf=\"showPublicationMessages && fields?.length\">\n <ng-container\n *ngTemplateOutlet=\"publicationMessages, context: {form: form, entity: entity, itemId: itemId, fields: fields}\"></ng-container>\n</ng-container>\n\n<div *ngFor=\"let group of object_.keys(groupedFields); trackBy: truckByFieldName\"\n class=\"form-group container\"\n [ngClass]=\"{'form-group-open': groupsState[group]}\">\n\n <h2 *ngIf=\"group && object_.keys(groupedFields)?.length > 1\" class=\"form-field-group-title\" (click)=\"groupClick(group)\">\n <mat-icon class=\"fs-20 field-group-icon\">expand_more</mat-icon>\n {{ group }}\n </h2>\n <div\n [ngClass]=\"{\n 'small-form-width': config?.smallFormWidth,\n 'form-group-field-open': groupsState[group]\n }\"\n class=\"row form-group-fields\">\n <div *ngFor=\"let item of groupedFields[group]; trackBy: truckByFieldName\"\n class=\"form-field-row\"\n [ngClass]=\"getFormFieldClass(item)\">\n <div *ngIf=\"isAvailableToUpdate\" [ngClass]=\"{'field-tab': group}\">\n <shared-form-field\n [config]=\"config\"\n [itemId]=\"itemId\"\n [fieldData]=\"item\"\n [form]=\"form\"\n [errorMessageTexts]=\"errorMessageTexts\"\n [editorImageUploadUrl]=\"editorImageUploadUrl\"\n [entity]=\"entity\"\n [fields]=\"fields\"\n [formData]=\"form.value\"\n [publicationMessages]=\"allPublicationMessages\"\n [autoCompleteFields]=\"autoCompleteFields\"\n [entityPermissionUpdateDanyFields]=\"entityPermissionUpdateDanyFields\"\n ></shared-form-field>\n </div>\n <div *ngIf=\"!isAvailableToUpdate\" [ngClass]=\"{'field-tab': group}\">\n <shared-auto-form-show-field\n [config]=\"config\"\n [fieldData]=\"item\"\n [data]=\"form.value\"\n [entityId]=\"itemId\"\n [entity]=\"entity\"\n ></shared-auto-form-show-field>\n </div>\n </div>\n </div>\n</div>\n\n<div @appearFromLeft *ngIf=\"showFormMessageBox && dataStored && form.valid\" class=\"message-box warning mt-20 mb-10\">\n <ul>\n <li>{{ dataStoredTitle }}</li>\n </ul>\n</div>\n<shred-form-message-box\n *ngIf=\"showFormMessageBox\"\n [form]=\"form\"\n [fields]=\"fields\"\n [errorMessageTexts]=\"errorMessageTexts\"></shred-form-message-box>\n\n<ng-container *ngIf=\"showFormMessageBox && havePublication\">\n <ng-container *ngIf=\"showPublicationMessages && fields?.length\">\n <ng-container\n *ngTemplateOutlet=\"publicationMessages, context: {form: form, entity: entity, itemId: itemId, fields: fields}\"></ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #publicationMessages let-form=\"form\" let-entity=\"entity\" let-itemId=\"itemId\" let-fields=\"fields\">\n <shared-publication-messages\n *ngIf=\"itemId\"\n [@appearFromLeft]\n [form]=\"form\"\n [entity]=\"entity\"\n [itemId]=\"itemId\"\n [fields]=\"fields\"\n [havePublication]=\"havePublication\"\n (scrollToField)=\"scrollToField($event)\"></shared-publication-messages>\n</ng-template>\n\n<ng-container *ngIf=\"isAvailableToUpdate\">\n <ng-content select=\"[submitButton]\"></ng-content>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column;flex-wrap:wrap}.form-group-fields{display:none}.form-group-fields.form-group-field-open{display:flex;margin-left:0}.form-group{cursor:pointer;margin-bottom:0}.form-group h2{display:flex;transition:color .3s;align-items:center}.progress-bar{margin-bottom:10px}.form-field-row{margin:8px 0}.small-form-width .form-field-row{margin-bottom:10px}.small-form-width .show-label{margin-bottom:0!important}.form-field-group-title{font-size:18px;display:flex;margin-top:15px;background:#f5f5f5;padding:10px;border-radius:8px}\n"] }]
|
|
2389
|
+
}], ctorParameters: () => [{ type: i1.FormErrorsFacade }, { type: i1.FormsFacade }, { type: i1.BaseAutoFormService }, { type: i1.AutoFormService }, { type: i1.PublicationMessagesFacade }, { type: i2$4.ActivatedRoute }, { type: i1.StaticDataFacade }, { type: i0.ChangeDetectorRef }], propDecorators: { fields: [{
|
|
2390
|
+
type: Input,
|
|
2391
|
+
args: [{ required: true }]
|
|
2392
|
+
}], itemId: [{
|
|
2393
|
+
type: Input,
|
|
2394
|
+
args: [{ transform: numberAttribute }]
|
|
2395
|
+
}], formId: [{
|
|
2396
|
+
type: Input
|
|
2397
|
+
}], showPublicationMessages: [{
|
|
2398
|
+
type: Input
|
|
2399
|
+
}], useEntityPermissions: [{
|
|
2400
|
+
type: Input
|
|
2401
|
+
}], showProgressBar: [{
|
|
2402
|
+
type: Input
|
|
2403
|
+
}], showFormMessageBox: [{
|
|
2404
|
+
type: Input
|
|
2405
|
+
}], form: [{
|
|
2406
|
+
type: Input,
|
|
2407
|
+
args: [{ required: true }]
|
|
2408
|
+
}], editorImageUploadUrl: [{
|
|
2409
|
+
type: Input
|
|
2410
|
+
}], errorMessageTexts: [{
|
|
2411
|
+
type: Input
|
|
2412
|
+
}], entity: [{
|
|
2413
|
+
type: Input,
|
|
2414
|
+
args: [{ required: true }]
|
|
2415
|
+
}], havePublication: [{
|
|
2416
|
+
type: Input
|
|
2417
|
+
}], autoCompleteFieldInput: [{
|
|
2418
|
+
type: Input
|
|
2419
|
+
}], config: [{
|
|
2420
|
+
type: Input
|
|
2421
|
+
}], changed: [{
|
|
2422
|
+
type: Output
|
|
2423
|
+
}], formCompleted: [{
|
|
2424
|
+
type: Output
|
|
2425
|
+
}] } });
|
|
2426
|
+
|
|
2427
|
+
class AutoFormShowComponent {
|
|
2428
|
+
constructor(cd, staticDataServiceService) {
|
|
2429
|
+
this.cd = cd;
|
|
2430
|
+
this.staticDataServiceService = staticDataServiceService;
|
|
2431
|
+
this.config = { needToPublish: true, smallFormWidth: false };
|
|
2432
|
+
this.groupedFields = signal({});
|
|
2433
|
+
this.fieldGrouped = false;
|
|
2434
|
+
this.object_ = Object;
|
|
2435
|
+
this.loading = signal(true);
|
|
2436
|
+
}
|
|
2437
|
+
ngOnInit() {
|
|
2438
|
+
}
|
|
2439
|
+
async ngOnChanges(changes) {
|
|
2440
|
+
if (changes.fields || changes.data || changes.entity) {
|
|
2441
|
+
await this.preparingFields();
|
|
2442
|
+
this.fieldGrouped = false;
|
|
2443
|
+
if (this.entitySection.options.isDynamicForm) {
|
|
2444
|
+
this.allData = { ...this.data, ...this.data?.answers };
|
|
2445
|
+
}
|
|
2446
|
+
else {
|
|
2447
|
+
this.allData = { ...this.data };
|
|
2448
|
+
}
|
|
2449
|
+
this.groupFields();
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
truckByFieldName(index, item) {
|
|
2453
|
+
return item.field;
|
|
2454
|
+
}
|
|
2455
|
+
async preparingFields() {
|
|
2456
|
+
if (this.entitySection.options.isDynamicForm) {
|
|
2457
|
+
if (!this.data?.dynamicFormId) {
|
|
2458
|
+
throw new Error('[ auto-form-show.component ][ no dynamic form id ]');
|
|
2459
|
+
}
|
|
2460
|
+
this.dynamicFormFields = await this.staticDataServiceService.getDynamicFormFields(null, this.data?.dynamicFormId);
|
|
2461
|
+
if (!this.dynamicFormFields?.length) {
|
|
2462
|
+
throw new Error('[ auto-form-show.component ][ no dynamic form fields ] dynamicFormId: ' + this.data?.dynamicFormId);
|
|
2463
|
+
}
|
|
2464
|
+
this.loading.set(false);
|
|
2465
|
+
this.allFields = [...this.fields.filter(item => item.field !== 'answers'), ...this.dynamicFormFields];
|
|
2466
|
+
}
|
|
2467
|
+
else {
|
|
2468
|
+
this.loading.set(false);
|
|
2469
|
+
this.allFields = [...this.fields];
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
groupFields() {
|
|
2473
|
+
if (!this.fieldGrouped) {
|
|
2474
|
+
const newGroupedFields = {};
|
|
2475
|
+
this.allFields
|
|
2476
|
+
.filter(formField => !formField.options?.hide)
|
|
2477
|
+
.forEach(formField => {
|
|
2478
|
+
const groupName = formField?.options?.groupName || '';
|
|
2479
|
+
if (!newGroupedFields[groupName]) {
|
|
2480
|
+
newGroupedFields[groupName] = [];
|
|
2481
|
+
}
|
|
2482
|
+
newGroupedFields[groupName].push({ ...formField });
|
|
2483
|
+
});
|
|
2484
|
+
this.groupedFields.set(newGroupedFields);
|
|
2485
|
+
this.fieldGrouped = true;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
getFormFieldClass(data) {
|
|
2489
|
+
let className = [];
|
|
2490
|
+
if (data.options?.col) {
|
|
2491
|
+
className.push(`col-lg-${data.options.col}`);
|
|
2492
|
+
if (!data.options?.colXl) {
|
|
2493
|
+
className.push(`col-xl-${data.options.col}`);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
if (data.options?.colXxl) {
|
|
2497
|
+
className.push(`col-xxl-${data.options.colXxl}`);
|
|
2498
|
+
}
|
|
2499
|
+
if (data.options?.colXl) {
|
|
2500
|
+
className.push(`col-xl-${data.options.colXl}`);
|
|
2501
|
+
}
|
|
2502
|
+
if (data.options?.colLg) {
|
|
2503
|
+
className.push(`col-lg-${data.options.colLg}`);
|
|
2504
|
+
}
|
|
2505
|
+
if (data.options?.colMd) {
|
|
2506
|
+
className.push(`col-md-${data.options.colMd}`);
|
|
2507
|
+
}
|
|
2508
|
+
if (!className.length) {
|
|
2509
|
+
className.push(`col-lg-12`);
|
|
2510
|
+
}
|
|
2511
|
+
if (data.options?.colSm) {
|
|
2512
|
+
className.push(`col-sm-${data.options.colSm}`);
|
|
2513
|
+
}
|
|
2514
|
+
else {
|
|
2515
|
+
className.push(`col-sm-12`);
|
|
2516
|
+
}
|
|
2517
|
+
return className.join(' ');
|
|
2518
|
+
}
|
|
2519
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormShowComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.StaticDataServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2520
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: AutoFormShowComponent, isStandalone: false, selector: "shared-auto-form-show", inputs: { fields: "fields", data: "data", entity: "entity", entityId: "entityId", entitySection: "entitySection", config: "config" }, usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"!loading()\">\n <div *ngFor=\"let group of object_.keys(groupedFields()); trackBy: truckByFieldName\"\n class=\"form-group\">\n <h4 *ngIf=\"group\" class=\"form-field-group-title mb-0 text-left\">\n {{ group }}\n </h4>\n <div class=\"row form-group-fields mb-30 pt-10\">\n <div *ngFor=\"let item of groupedFields()[group]; trackBy: truckByFieldName\"\n class=\"form-field-row\"\n [ngClass]=\"getFormFieldClass(item)\">\n <!-- [ngClass]=\"item.options.col ? 'form-field-col-'+item.options.col : ''\" -->\n <div [ngClass]=\"{'field-tab': group}\">\n <shared-auto-form-show-field\n [config]=\"config\"\n [fieldData]=\"item\"\n [data]=\"allData\"\n [entityId]=\"entityId\"\n [entity]=\"entity\"\n ></shared-auto-form-show-field>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n<div *ngIf=\"loading()\">\n <shared-spinner [color]=\"'grey'\" [diameter]=\"30\" [overlay]=\"true\"></shared-spinner>\n</div>\n", styles: [":host{display:flex;flex-direction:column}.form-field-group-title{padding:0 20px;text-align:left}.form-group-fields{overflow:hidden;padding-left:20px;padding-right:20px}.form-group{margin-left:20px;width:calc(100% - 40px);margin-right:20px}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.SpinnerComponent, selector: "shared-spinner", inputs: ["overlay", "diameter", "color", "position"] }, { kind: "component", type: AutoFormShowFieldComponent, selector: "shared-auto-form-show-field", inputs: ["fieldData", "data", "entityId", "entity", "config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2521
|
+
}
|
|
2522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormShowComponent, decorators: [{
|
|
2523
|
+
type: Component,
|
|
2524
|
+
args: [{ selector: 'shared-auto-form-show', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-container *ngIf=\"!loading()\">\n <div *ngFor=\"let group of object_.keys(groupedFields()); trackBy: truckByFieldName\"\n class=\"form-group\">\n <h4 *ngIf=\"group\" class=\"form-field-group-title mb-0 text-left\">\n {{ group }}\n </h4>\n <div class=\"row form-group-fields mb-30 pt-10\">\n <div *ngFor=\"let item of groupedFields()[group]; trackBy: truckByFieldName\"\n class=\"form-field-row\"\n [ngClass]=\"getFormFieldClass(item)\">\n <!-- [ngClass]=\"item.options.col ? 'form-field-col-'+item.options.col : ''\" -->\n <div [ngClass]=\"{'field-tab': group}\">\n <shared-auto-form-show-field\n [config]=\"config\"\n [fieldData]=\"item\"\n [data]=\"allData\"\n [entityId]=\"entityId\"\n [entity]=\"entity\"\n ></shared-auto-form-show-field>\n </div>\n </div>\n </div>\n </div>\n</ng-container>\n<div *ngIf=\"loading()\">\n <shared-spinner [color]=\"'grey'\" [diameter]=\"30\" [overlay]=\"true\"></shared-spinner>\n</div>\n", styles: [":host{display:flex;flex-direction:column}.form-field-group-title{padding:0 20px;text-align:left}.form-group-fields{overflow:hidden;padding-left:20px;padding-right:20px}.form-group{margin-left:20px;width:calc(100% - 40px);margin-right:20px}\n"] }]
|
|
2525
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.StaticDataServiceService }], propDecorators: { fields: [{
|
|
2526
|
+
type: Input
|
|
2527
|
+
}], data: [{
|
|
2528
|
+
type: Input
|
|
2529
|
+
}], entity: [{
|
|
2530
|
+
type: Input
|
|
2531
|
+
}], entityId: [{
|
|
2532
|
+
type: Input
|
|
2533
|
+
}], entitySection: [{
|
|
2534
|
+
type: Input
|
|
2535
|
+
}], config: [{
|
|
2536
|
+
type: Input
|
|
2537
|
+
}] } });
|
|
2538
|
+
|
|
2539
|
+
class FormDialogComponent {
|
|
2540
|
+
constructor(dialogRef, staticDataFacade, fb, autoFormService, data) {
|
|
2541
|
+
this.dialogRef = dialogRef;
|
|
2542
|
+
this.staticDataFacade = staticDataFacade;
|
|
2543
|
+
this.fb = fb;
|
|
2544
|
+
this.autoFormService = autoFormService;
|
|
2545
|
+
this.data = data;
|
|
2546
|
+
this.sizeValues = {
|
|
2547
|
+
big: 'big',
|
|
2548
|
+
middle: 'middle',
|
|
2549
|
+
small: 'small'
|
|
2550
|
+
};
|
|
2551
|
+
this.typesValues = {
|
|
2552
|
+
success: 'success',
|
|
2553
|
+
error: 'error',
|
|
2554
|
+
info: 'info'
|
|
2555
|
+
};
|
|
2556
|
+
// fields: IFormField[];
|
|
2557
|
+
this.formStatus = 'loaded';
|
|
2558
|
+
this.statusType = StaticDataMetaStatus;
|
|
2559
|
+
this.globalErrorMessageTexts = GlobalErrorMessages;
|
|
2560
|
+
}
|
|
2561
|
+
ngOnInit() {
|
|
2562
|
+
if (this.data.formConfig) {
|
|
2563
|
+
if (this.data.formConfig.preLoadSections) {
|
|
2564
|
+
this.preLoadSections(this.data.formConfig.preLoadSections);
|
|
2565
|
+
}
|
|
2566
|
+
this.initForm();
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
onNoClick() {
|
|
2570
|
+
this.dialogRef.close(false);
|
|
2571
|
+
}
|
|
2572
|
+
onYesClick() {
|
|
2573
|
+
this.dialogRef.close(true);
|
|
2574
|
+
}
|
|
2575
|
+
changedFormValue() {
|
|
2576
|
+
}
|
|
2577
|
+
formCompleted(data) {
|
|
2578
|
+
}
|
|
2579
|
+
initForm() {
|
|
2580
|
+
if (this.data.formConfig?.fields) {
|
|
2581
|
+
this.fields = this.data.formConfig?.fields;
|
|
2582
|
+
const preparedFields = this.autoFormService.getPreparedFields(this.fields);
|
|
2583
|
+
this.form = this.fb.group(preparedFields);
|
|
2584
|
+
}
|
|
2585
|
+
else {
|
|
2586
|
+
console.error('[ common-dialog ][ initForm ] Incorrect form options', { formConfig: this.data.formConfig });
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
preLoadSections(preLoadSections) {
|
|
2590
|
+
if (preLoadSections) {
|
|
2591
|
+
this.staticDataFacade.staticDataLoadCategories(preLoadSections);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
async submitClick() {
|
|
2595
|
+
// Add disabled fields in the request
|
|
2596
|
+
const formData = this.form.value;
|
|
2597
|
+
Object.keys(this.form.controls)
|
|
2598
|
+
.filter(key => this.form.get(key).disabled)
|
|
2599
|
+
?.forEach(key => {
|
|
2600
|
+
formData[key] = this.form.get(key).value;
|
|
2601
|
+
});
|
|
2602
|
+
if (this.form.valid) {
|
|
2603
|
+
this.dialogRef.close(this.form.value);
|
|
2604
|
+
}
|
|
2605
|
+
else {
|
|
2606
|
+
this.dialogRef.close(undefined);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: i1.StaticDataFacade }, { token: i3.UntypedFormBuilder }, { token: i1.AutoFormService }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2610
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormDialogComponent, isStandalone: false, selector: "app-form-dialog", ngImport: i0, template: "<div class=\"text-center position-relative p-10\"\n [class.modal-size-big]=\"data.size === sizeValues.big\"\n [class.modal-size-middle]=\"data.size === sizeValues.middle\"\n [class.modal-size-small]=\"data.size === sizeValues.small\"\n [class.modal-style-success]=\"data.messageType === typesValues.success\"\n [class.modal-style-error]=\"data.messageType === typesValues.error\"\n [class.modal-style-info]=\"data.messageType === typesValues.info\">\n <div [class.display-none]=\"!data.hideButton\"\n class=\"modal-close-button\"\n (click)=\"onNoClick()\">\n x\n </div>\n\n <h1 class=\"mat-dialog-title\" [class.display-none]=\"!data.title\">{{data.title}}</h1>\n <div mat-dialog-content>\n <p *ngIf=\"data.message\" [innerHTML]=\"data.message\"></p>\n <ng-container *ngIf=\"data.formConfig\">\n <form [formGroup]=\"form\">\n <shared-auto-form\n class=\"mb-20\"\n [entity]=\"data.formConfig.entity\"\n [itemId]=\"data.formConfig.itemId\"\n [formId]=\"formId\"\n [fields]=\"data.formConfig.fields\"\n [form]=\"form\"\n [config]=\"{needToPublish: false}\"\n [errorMessageTexts]=\"globalErrorMessageTexts\"\n (changed)=\"changedFormValue()\"\n (formCompleted)=\"formCompleted($event)\"\n ></shared-auto-form>\n\n <!--<div *ngIf=\"staticSection.actions\" class=\"global-actions\">\n <div *ngFor=\"let action of staticSection.globalActions\"\n (click)=\"globalActionHandle(action)\" class=\"global-action\">\n {{ action.title }}\n </div>\n </div>-->\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"center center\"\n class=\"mt-20\">\n <shared-button\n id=\"form-create-button\"\n class=\"mr-8\"\n type=\"submit\"\n icon=\"edit\"\n iconColor=\"white\"\n color=\"accent\"\n styleTheme=\"raised\"\n [disabled]=\"!form.valid || formStatus === 'loading'\"\n (click)=\"submitClick()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C</shared-button>\n </div>\n </form>\n </ng-container>\n </div>\n <div [class.display-none]=\"data.hideButton\" mat-dialog-actions class=\"text-align-center mt-20\">\n <button mat-button (click)=\"onNoClick()\"\n class=\"mat-raised-button mr-10\"\n cdkFocusInitial>{{data.falseButtonTitle || '\u041D\u0435\u0442' }}</button>\n <button mat-button\n *ngIf=\"!data.formConfig\"\n [class.display-none]=\"data.hideTrueButton\"\n (click)=\"onYesClick()\"\n class=\"mat-raised-button mat-warn\">{{data.trueButtonTitle || '\u0414\u0430' }}</button>\n </div>\n</div>\n", styles: [".size-big{width:800px}.size-middle{width:600px}.size-small{width:300px}.style-success,.style-error,.style-info{padding:24px}.style-success{border-left:5px solid #4caf50;background:linear-gradient(15deg,#6dcf71c9,#f0f8f0)}.style-info{border-left:5px solid #fcb202;background:linear-gradient(15deg,#fcb20287,#fcb20208)}.style-error{border-left:5px solid #f44336;background:linear-gradient(15deg,#f2686494,#f7e6e4)}.close-button{right:0;margin:-8px 10px 0 0;position:absolute;cursor:pointer;font-size:16px;font-weight:700}.display-none{display:none}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i1.ButtonComponent, selector: "shared-button", inputs: ["icon", "iconColor", "iconSize", "rightIcon", "disabled", "loading", "active", "stopPropagation", "type", "color", "fullWidth", "size", "styleTheme", "tooltip", "tooltipPosition"], outputs: ["clickButton"] }, { kind: "component", type: AutoFormMainComponent, selector: "shared-auto-form", inputs: ["fields", "itemId", "formId", "showPublicationMessages", "useEntityPermissions", "showProgressBar", "showFormMessageBox", "form", "editorImageUploadUrl", "errorMessageTexts", "entity", "havePublication", "autoCompleteFieldInput", "config"], outputs: ["changed", "formCompleted"] }], animations: [appearFromRightWithDelay, appearFromLeftWithDelay, appearOpacity], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2611
|
+
}
|
|
2612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormDialogComponent, decorators: [{
|
|
2613
|
+
type: Component,
|
|
2614
|
+
args: [{ selector: 'app-form-dialog', changeDetection: ChangeDetectionStrategy.OnPush, animations: [appearFromRightWithDelay, appearFromLeftWithDelay, appearOpacity], standalone: false, template: "<div class=\"text-center position-relative p-10\"\n [class.modal-size-big]=\"data.size === sizeValues.big\"\n [class.modal-size-middle]=\"data.size === sizeValues.middle\"\n [class.modal-size-small]=\"data.size === sizeValues.small\"\n [class.modal-style-success]=\"data.messageType === typesValues.success\"\n [class.modal-style-error]=\"data.messageType === typesValues.error\"\n [class.modal-style-info]=\"data.messageType === typesValues.info\">\n <div [class.display-none]=\"!data.hideButton\"\n class=\"modal-close-button\"\n (click)=\"onNoClick()\">\n x\n </div>\n\n <h1 class=\"mat-dialog-title\" [class.display-none]=\"!data.title\">{{data.title}}</h1>\n <div mat-dialog-content>\n <p *ngIf=\"data.message\" [innerHTML]=\"data.message\"></p>\n <ng-container *ngIf=\"data.formConfig\">\n <form [formGroup]=\"form\">\n <shared-auto-form\n class=\"mb-20\"\n [entity]=\"data.formConfig.entity\"\n [itemId]=\"data.formConfig.itemId\"\n [formId]=\"formId\"\n [fields]=\"data.formConfig.fields\"\n [form]=\"form\"\n [config]=\"{needToPublish: false}\"\n [errorMessageTexts]=\"globalErrorMessageTexts\"\n (changed)=\"changedFormValue()\"\n (formCompleted)=\"formCompleted($event)\"\n ></shared-auto-form>\n\n <!--<div *ngIf=\"staticSection.actions\" class=\"global-actions\">\n <div *ngFor=\"let action of staticSection.globalActions\"\n (click)=\"globalActionHandle(action)\" class=\"global-action\">\n {{ action.title }}\n </div>\n </div>-->\n <div\n fxLayout=\"row\"\n fxLayoutAlign=\"center center\"\n class=\"mt-20\">\n <shared-button\n id=\"form-create-button\"\n class=\"mr-8\"\n type=\"submit\"\n icon=\"edit\"\n iconColor=\"white\"\n color=\"accent\"\n styleTheme=\"raised\"\n [disabled]=\"!form.valid || formStatus === 'loading'\"\n (click)=\"submitClick()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C</shared-button>\n </div>\n </form>\n </ng-container>\n </div>\n <div [class.display-none]=\"data.hideButton\" mat-dialog-actions class=\"text-align-center mt-20\">\n <button mat-button (click)=\"onNoClick()\"\n class=\"mat-raised-button mr-10\"\n cdkFocusInitial>{{data.falseButtonTitle || '\u041D\u0435\u0442' }}</button>\n <button mat-button\n *ngIf=\"!data.formConfig\"\n [class.display-none]=\"data.hideTrueButton\"\n (click)=\"onYesClick()\"\n class=\"mat-raised-button mat-warn\">{{data.trueButtonTitle || '\u0414\u0430' }}</button>\n </div>\n</div>\n", styles: [".size-big{width:800px}.size-middle{width:600px}.size-small{width:300px}.style-success,.style-error,.style-info{padding:24px}.style-success{border-left:5px solid #4caf50;background:linear-gradient(15deg,#6dcf71c9,#f0f8f0)}.style-info{border-left:5px solid #fcb202;background:linear-gradient(15deg,#fcb20287,#fcb20208)}.style-error{border-left:5px solid #f44336;background:linear-gradient(15deg,#f2686494,#f7e6e4)}.close-button{right:0;margin:-8px 10px 0 0;position:absolute;cursor:pointer;font-size:16px;font-weight:700}.display-none{display:none}\n"] }]
|
|
2615
|
+
}], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: i1.StaticDataFacade }, { type: i3.UntypedFormBuilder }, { type: i1.AutoFormService }, { type: undefined, decorators: [{
|
|
2616
|
+
type: Inject,
|
|
2617
|
+
args: [MAT_DIALOG_DATA]
|
|
2618
|
+
}] }] });
|
|
2619
|
+
|
|
2620
|
+
class AutoFormModule {
|
|
2621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2622
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.25", ngImport: i0, type: AutoFormModule, declarations: [FormFieldComponent,
|
|
2623
|
+
FormFieldSpinnerComponent,
|
|
2624
|
+
FormFieldSelectComponent,
|
|
2625
|
+
FormFieldSelectShowComponent,
|
|
2626
|
+
FormFieldSlideToggleComponent,
|
|
2627
|
+
AutoFormMainComponent,
|
|
2628
|
+
AutoFormShowComponent,
|
|
2629
|
+
AutoFormShowFieldComponent,
|
|
2630
|
+
FormFieldInputComponent,
|
|
2631
|
+
FormFieldStringListInputComponent,
|
|
2632
|
+
FormMessageBoxComponent,
|
|
2633
|
+
FormFieldFileComponent,
|
|
2634
|
+
FormFieldFilesComponent,
|
|
2635
|
+
FormFieldFileShowComponent,
|
|
2636
|
+
FormFieldSlideToggleShowComponent,
|
|
2637
|
+
FormFieldInputShowComponent,
|
|
2638
|
+
FormFieldFilesShowComponent,
|
|
2639
|
+
FormFieldJsonShowComponent,
|
|
2640
|
+
PublicationMessagesComponent,
|
|
2641
|
+
FormFieldTagsComponent,
|
|
2642
|
+
FormFieldTextareaShowComponent,
|
|
2643
|
+
FormFieldRatingComponent,
|
|
2644
|
+
FormFieldDateComponent,
|
|
2645
|
+
FormDialogComponent], imports: [CommonModule,
|
|
2646
|
+
MatDialogModule,
|
|
2647
|
+
FormFieldErrorModule,
|
|
2648
|
+
FormFieldPublishErrorModule,
|
|
2649
|
+
MatFormFieldModule,
|
|
2650
|
+
MatInputModule,
|
|
2651
|
+
MatSlideToggleModule,
|
|
2652
|
+
MatSelectModule,
|
|
2653
|
+
FormsModule,
|
|
2654
|
+
SharedSpinnerModule,
|
|
2655
|
+
ReactiveFormsModule,
|
|
2656
|
+
MatIconModule,
|
|
2657
|
+
MatTooltipModule,
|
|
2658
|
+
FilesUploadModule,
|
|
2659
|
+
ImageModule,
|
|
2660
|
+
PanelModule,
|
|
2661
|
+
ButtonModule,
|
|
2662
|
+
SmartProgressBarModule,
|
|
2663
|
+
StarRatingModule,
|
|
2664
|
+
MatChipsModule,
|
|
2665
|
+
MatAutocompleteModule,
|
|
2666
|
+
NgxMatSelectSearchModule,
|
|
2667
|
+
NgxMaskDirective,
|
|
2668
|
+
NgxMaskPipe,
|
|
2669
|
+
FormFieldCheditorComponent,
|
|
2670
|
+
SharedIconModule,
|
|
2671
|
+
MatCheckbox,
|
|
2672
|
+
MatRadioButton,
|
|
2673
|
+
MatRadioGroup,
|
|
2674
|
+
MatDatepickerModule,
|
|
2675
|
+
MatNativeDateModule], exports: [AutoFormMainComponent,
|
|
2676
|
+
AutoFormShowComponent] }); }
|
|
2677
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormModule, providers: [provideNativeDateAdapter()], imports: [CommonModule,
|
|
2678
|
+
MatDialogModule,
|
|
2679
|
+
FormFieldErrorModule,
|
|
2680
|
+
FormFieldPublishErrorModule,
|
|
2681
|
+
MatFormFieldModule,
|
|
2682
|
+
MatInputModule,
|
|
2683
|
+
MatSlideToggleModule,
|
|
2684
|
+
MatSelectModule,
|
|
2685
|
+
FormsModule,
|
|
2686
|
+
SharedSpinnerModule,
|
|
2687
|
+
ReactiveFormsModule,
|
|
2688
|
+
MatIconModule,
|
|
2689
|
+
MatTooltipModule,
|
|
2690
|
+
FilesUploadModule,
|
|
2691
|
+
ImageModule,
|
|
2692
|
+
PanelModule,
|
|
2693
|
+
ButtonModule,
|
|
2694
|
+
SmartProgressBarModule,
|
|
2695
|
+
StarRatingModule,
|
|
2696
|
+
MatChipsModule,
|
|
2697
|
+
MatAutocompleteModule,
|
|
2698
|
+
NgxMatSelectSearchModule,
|
|
2699
|
+
FormFieldCheditorComponent,
|
|
2700
|
+
SharedIconModule,
|
|
2701
|
+
MatCheckbox,
|
|
2702
|
+
MatRadioButton,
|
|
2703
|
+
MatDatepickerModule,
|
|
2704
|
+
MatNativeDateModule] }); }
|
|
2705
|
+
}
|
|
2706
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoFormModule, decorators: [{
|
|
2707
|
+
type: NgModule,
|
|
2708
|
+
args: [{
|
|
2709
|
+
declarations: [
|
|
2710
|
+
FormFieldComponent,
|
|
2711
|
+
FormFieldSpinnerComponent,
|
|
2712
|
+
FormFieldSelectComponent,
|
|
2713
|
+
FormFieldSelectShowComponent,
|
|
2714
|
+
FormFieldSlideToggleComponent,
|
|
2715
|
+
AutoFormMainComponent,
|
|
2716
|
+
AutoFormShowComponent,
|
|
2717
|
+
AutoFormShowFieldComponent,
|
|
2718
|
+
FormFieldInputComponent,
|
|
2719
|
+
FormFieldStringListInputComponent,
|
|
2720
|
+
FormMessageBoxComponent,
|
|
2721
|
+
FormFieldFileComponent,
|
|
2722
|
+
FormFieldFilesComponent,
|
|
2723
|
+
FormFieldFileShowComponent,
|
|
2724
|
+
FormFieldSlideToggleShowComponent,
|
|
2725
|
+
FormFieldInputShowComponent,
|
|
2726
|
+
FormFieldFilesShowComponent,
|
|
2727
|
+
FormFieldJsonShowComponent,
|
|
2728
|
+
PublicationMessagesComponent,
|
|
2729
|
+
FormFieldTagsComponent,
|
|
2730
|
+
FormFieldTextareaShowComponent,
|
|
2731
|
+
FormFieldRatingComponent,
|
|
2732
|
+
FormFieldDateComponent,
|
|
2733
|
+
FormDialogComponent
|
|
2734
|
+
],
|
|
2735
|
+
imports: [
|
|
2736
|
+
CommonModule,
|
|
2737
|
+
MatDialogModule,
|
|
2738
|
+
FormFieldErrorModule,
|
|
2739
|
+
FormFieldPublishErrorModule,
|
|
2740
|
+
MatFormFieldModule,
|
|
2741
|
+
MatInputModule,
|
|
2742
|
+
MatSlideToggleModule,
|
|
2743
|
+
MatSelectModule,
|
|
2744
|
+
FormsModule,
|
|
2745
|
+
SharedSpinnerModule,
|
|
2746
|
+
ReactiveFormsModule,
|
|
2747
|
+
MatIconModule,
|
|
2748
|
+
MatTooltipModule,
|
|
2749
|
+
FilesUploadModule,
|
|
2750
|
+
ImageModule,
|
|
2751
|
+
PanelModule,
|
|
2752
|
+
ButtonModule,
|
|
2753
|
+
SmartProgressBarModule,
|
|
2754
|
+
StarRatingModule,
|
|
2755
|
+
MatChipsModule,
|
|
2756
|
+
MatAutocompleteModule,
|
|
2757
|
+
NgxMatSelectSearchModule,
|
|
2758
|
+
NgxMaskDirective,
|
|
2759
|
+
NgxMaskPipe,
|
|
2760
|
+
FormFieldCheditorComponent,
|
|
2761
|
+
SharedIconModule,
|
|
2762
|
+
MatCheckbox,
|
|
2763
|
+
MatRadioButton,
|
|
2764
|
+
MatRadioGroup,
|
|
2765
|
+
MatDatepickerModule,
|
|
2766
|
+
MatNativeDateModule
|
|
2767
|
+
],
|
|
2768
|
+
exports: [
|
|
2769
|
+
AutoFormMainComponent,
|
|
2770
|
+
AutoFormShowComponent
|
|
2771
|
+
],
|
|
2772
|
+
providers: [provideNativeDateAdapter()]
|
|
2773
|
+
}]
|
|
2774
|
+
}] });
|
|
2775
|
+
|
|
2776
|
+
/**
|
|
2777
|
+
* Generated bundle index. Do not edit.
|
|
2778
|
+
*/
|
|
2779
|
+
|
|
2780
|
+
export { AutoFormMainComponent, AutoFormModule, AutoFormShowComponent };
|
|
2781
|
+
//# sourceMappingURL=wt-front-shared-auto-form.mjs.map
|