@mediusinc/mng-commons 5.0.0-rc.2 → 5.0.0-rc.3
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/core/data-providers/base-data-provider.factory.d.ts +13 -0
- package/core/data-providers/base.data-provider.d.ts +2 -14
- package/core/descriptors/editor.descriptor.d.ts +1 -1
- package/core/descriptors/tableview.descriptor.d.ts +5 -5
- package/core/directives/component.directive.d.ts +2 -2
- package/core/index.d.ts +1 -0
- package/core/security/permission.service.d.ts +1 -0
- package/core/services/commons-router.service.d.ts +3 -3
- package/core/services/commons.service.d.ts +31 -42
- package/core/services/tokens/module-config.token.d.ts +2 -2
- package/esm2022/core/components/notification/notification-wrapper.component.mjs +3 -3
- package/esm2022/core/components/pages/error/error.page.component.mjs +3 -3
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +3 -3
- package/esm2022/core/data-providers/base-data-provider.factory.mjs +28 -0
- package/esm2022/core/data-providers/base.data-provider.mjs +1 -31
- package/esm2022/core/descriptors/editor.descriptor.mjs +1 -1
- package/esm2022/core/descriptors/tableview.descriptor.mjs +1 -1
- package/esm2022/core/directives/component.directive.mjs +10 -7
- package/esm2022/core/index.mjs +2 -1
- package/esm2022/core/security/permission.service.mjs +4 -2
- package/esm2022/core/services/commons-init.service.mjs +2 -2
- package/esm2022/core/services/commons-router.service.mjs +16 -15
- package/esm2022/core/services/commons.service.mjs +109 -166
- package/esm2022/core/services/tokens/module-config.token.mjs +1 -1
- package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +4 -4
- package/esm2022/form/api/data-providers/lookup-data-provider.factory.mjs +31 -0
- package/esm2022/form/api/data-providers/lookup.data-provider.mjs +1 -31
- package/esm2022/form/api/index.mjs +2 -1
- package/esm2022/form/components/autocomplete/autocomplete.component.mjs +92 -83
- package/esm2022/form/components/dropdown/dropdown.component.mjs +145 -87
- package/esm2022/model/data-providers/base-from-type-data-provider.factory.mjs +8 -0
- package/esm2022/model/descriptors/enum.descriptor.mjs +3 -6
- package/esm2022/model/descriptors/model.descriptor.mjs +22 -9
- package/esm2022/model/descriptors/type.descriptor.mjs +3 -9
- package/esm2022/model/index.mjs +3 -1
- package/esm2022/table/api/data-providers/table-data-provider.factory.mjs +33 -0
- package/esm2022/table/api/data-providers/table.data-provider.mjs +1 -31
- package/esm2022/table/api/descriptors/sort.descriptor.mjs +2 -2
- package/esm2022/table/api/descriptors/table-descriptor.factory.mjs +89 -0
- package/esm2022/table/api/descriptors/table.descriptor.mjs +4 -139
- package/esm2022/table/api/helpers/table-descriptor-helpers.mjs +97 -0
- package/esm2022/table/api/index.mjs +4 -1
- package/esm2022/table/components/column-filter-full/column-filter-full.component.mjs +6 -7
- package/esm2022/table/components/column-value/column-value.component.mjs +2 -2
- package/esm2022/table/components/table/table.component.mjs +5 -5
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +2 -2
- package/esm2022/table/services/data-list.service.mjs +1 -1
- package/esm2022/tableview/action/components/action/action.component.mjs +140 -188
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +56 -66
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +119 -141
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +21 -39
- package/esm2022/tableview/action/components/route/action-route.component.mjs +17 -23
- package/esm2022/tableview/action/components/table/action-table.component.mjs +1 -1
- package/esm2022/tableview/action/services/action-executor.service.mjs +9 -9
- package/esm2022/tableview/action/services/navigation.service.mjs +3 -2
- package/esm2022/tableview/action/services/view-container.service.mjs +5 -21
- package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +119 -0
- package/esm2022/tableview/api/action/descriptors/action-editor-descriptor.factory.mjs +77 -0
- package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +20 -80
- package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +45 -0
- package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +1 -32
- package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +3 -69
- package/esm2022/tableview/api/action/models/action-component.model.mjs +1 -1
- package/esm2022/tableview/api/action/models/execution/view-container.model.mjs +1 -1
- package/esm2022/tableview/api/editor/data-providers/editor-data-provider.factory.mjs +33 -0
- package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +1 -31
- package/esm2022/tableview/api/editor/descriptors/editor-descriptor.factory.mjs +81 -0
- package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +7 -133
- package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +13 -5
- package/esm2022/tableview/api/editor/descriptors/field-group.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +4 -4
- package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +3 -3
- package/esm2022/tableview/api/editor/descriptors/field-validation.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/descriptors/field.descriptor.mjs +1 -1
- package/esm2022/tableview/api/editor/helpers/editor-descriptor-helpers.mjs +95 -0
- package/esm2022/tableview/api/editor/helpers/field-validators.mjs +7 -7
- package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/field-action-context.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/field-validation.model.mjs +2 -0
- package/esm2022/tableview/api/editor/models/field.model.mjs +1 -1
- package/esm2022/tableview/api/editor/models/form-editor.event.mjs +1 -1
- package/esm2022/tableview/api/editor/models/form-editor.interface.mjs +1 -1
- package/esm2022/tableview/api/editor/models/formly-field.model.mjs +1 -1
- package/esm2022/tableview/api/index.mjs +11 -1
- package/esm2022/tableview/api/tableview/data-providers/tableview-data-provider.factory.mjs +47 -0
- package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +5 -46
- package/esm2022/tableview/api/tableview/descriptors/tableview-descriptor.factory.mjs +111 -0
- package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +15 -168
- package/esm2022/tableview/api/tableview/helpers/files-export.mjs +2 -2
- package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +5 -5
- package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +53 -18
- package/esm2022/tableview/api/tableview/helpers/tableview-descriptor-helpers.mjs +110 -0
- package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +2 -2
- package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +16 -11
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +6 -2
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +10 -11
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +1 -1
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +9 -11
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +4 -4
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +16 -18
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +20 -22
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +18 -20
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +27 -6
- package/esm2022/tableview/editor/services/form-editor.service.mjs +96 -0
- package/esm2022/tableview/index.mjs +2 -1
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +3 -3
- package/fesm2022/mediusinc-mng-commons-core.mjs +155 -210
- package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-filter.mjs +3 -3
- package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form-api.mjs +18 -18
- package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-form.mjs +236 -169
- package/fesm2022/mediusinc-mng-commons-form.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-model.mjs +43 -33
- package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table-api.mjs +192 -146
- package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-table.mjs +11 -12
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +822 -590
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +564 -571
- package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
- package/form/api/data-providers/lookup-data-provider.factory.d.ts +18 -0
- package/form/api/data-providers/lookup.data-provider.d.ts +2 -14
- package/form/api/index.d.ts +1 -0
- package/form/components/autocomplete/autocomplete.component.d.ts +31 -23
- package/form/components/dropdown/dropdown.component.d.ts +38 -25
- package/model/data-providers/base-from-type-data-provider.factory.d.ts +8 -0
- package/model/descriptors/enum.descriptor.d.ts +1 -2
- package/model/descriptors/model.descriptor.d.ts +11 -4
- package/model/descriptors/type.descriptor.d.ts +2 -4
- package/model/index.d.ts +1 -0
- package/package.json +1 -1
- package/table/api/data-providers/table-data-provider.factory.d.ts +18 -0
- package/table/api/data-providers/table.data-provider.d.ts +2 -14
- package/table/api/descriptors/table-descriptor.factory.d.ts +44 -0
- package/table/api/descriptors/table.descriptor.d.ts +4 -65
- package/table/api/helpers/table-descriptor-helpers.d.ts +44 -0
- package/table/api/index.d.ts +3 -0
- package/table/components/column-filter-full/column-filter-full.component.d.ts +5 -4
- package/table/components/table/table.component.d.ts +11 -11
- package/table/services/data-list.service.d.ts +9 -10
- package/tableview/action/components/action/action.component.d.ts +37 -44
- package/tableview/action/components/editor/action-editor.component.d.ts +20 -18
- package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +23 -23
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +11 -14
- package/tableview/action/components/route/action-route.component.d.ts +6 -11
- package/tableview/action/components/table/action-table.component.d.ts +3 -3
- package/tableview/action/services/view-container.service.d.ts +3 -9
- package/tableview/api/action/descriptors/action-descriptor.factory.d.ts +36 -0
- package/tableview/api/action/descriptors/action-editor-descriptor.factory.d.ts +31 -0
- package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +17 -37
- package/tableview/api/action/descriptors/action-link-descriptor.factory.d.ts +15 -0
- package/tableview/api/action/descriptors/action-link.descriptor.d.ts +1 -9
- package/tableview/api/action/descriptors/action.descriptor.d.ts +4 -27
- package/tableview/api/action/models/action-component.model.d.ts +8 -8
- package/tableview/api/action/models/execution/view-container.model.d.ts +4 -3
- package/tableview/api/editor/data-providers/editor-data-provider.factory.d.ts +18 -0
- package/tableview/api/editor/data-providers/editor.data-provider.d.ts +2 -14
- package/tableview/api/editor/descriptors/editor-descriptor.factory.d.ts +44 -0
- package/tableview/api/editor/descriptors/editor.descriptor.d.ts +34 -90
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +3 -3
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +15 -13
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +7 -6
- package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +2 -2
- package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +8 -8
- package/tableview/api/editor/descriptors/field-validation.descriptor.d.ts +6 -6
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +1 -1
- package/tableview/api/editor/helpers/editor-descriptor-helpers.d.ts +43 -0
- package/tableview/api/editor/helpers/field-validators.d.ts +1 -1
- package/tableview/api/editor/models/editor-fields.model.d.ts +24 -22
- package/tableview/api/editor/models/field-action-context.model.d.ts +10 -8
- package/tableview/api/editor/models/field-validation.model.d.ts +26 -0
- package/tableview/api/editor/models/field.model.d.ts +0 -19
- package/tableview/api/editor/models/form-editor.event.d.ts +24 -16
- package/tableview/api/editor/models/form-editor.interface.d.ts +2 -1
- package/tableview/api/editor/models/formly-custom-field.model.d.ts +1 -1
- package/tableview/api/editor/models/formly-field.model.d.ts +4 -4
- package/tableview/api/index.d.ts +10 -0
- package/tableview/api/tableview/data-providers/tableview-data-provider.factory.d.ts +25 -0
- package/tableview/api/tableview/data-providers/tableview.data-provider.d.ts +3 -20
- package/tableview/api/tableview/descriptors/tableview-descriptor.factory.d.ts +49 -0
- package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +40 -100
- package/tableview/api/tableview/helpers/tableview-create.d.ts +2 -2
- package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +4 -2
- package/tableview/api/tableview/helpers/tableview-descriptor-helpers.d.ts +42 -0
- package/tableview/api/tableview/helpers/tableview-input-builder.d.ts +1 -1
- package/tableview/editor/components/editor/form-editor.component.d.ts +6 -4
- package/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.d.ts +5 -3
- package/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +1 -0
- package/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +1 -1
- package/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.d.ts +1 -1
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +3 -4
- package/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +3 -4
- package/tableview/editor/helpers/editor-formly.d.ts +1 -1
- package/tableview/editor/services/form-editor.service.d.ts +39 -0
- package/tableview/index.d.ts +1 -0
- package/tableview/tableview/components/route/tableview-route.component.d.ts +1 -1
- package/tableview/tableview/components/tableview/tableview.component.d.ts +1 -1
- package/version-info.json +4 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as i2 from '@angular/common';
|
|
2
2
|
import { AsyncPipe, NgTemplateOutlet, JsonPipe, NgStyle, DatePipe } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, Injectable, inject, Injector,
|
|
4
|
+
import { InjectionToken, Injectable, signal, inject, Injector, DestroyRef, input, booleanAttribute, output, viewChild, computed, effect, Component, ChangeDetectionStrategy, Optional, HostListener, EventEmitter, contentChildren, Input, Output, ViewChildren, ViewChild, LOCALE_ID, HostBinding } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed, toSignal, toObservable as toObservable$1 } from '@angular/core/rxjs-interop';
|
|
5
6
|
import * as i1 from '@angular/router';
|
|
6
7
|
import { NavigationEnd, Router, ActivatedRoute, NavigationStart, NavigationCancel, NavigationError, NavigationSkipped, RouterOutlet } from '@angular/router';
|
|
7
8
|
import * as i1$1 from '@ngx-translate/core';
|
|
@@ -9,37 +10,36 @@ import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
|
9
10
|
import * as i4 from 'primeng/button';
|
|
10
11
|
import { ButtonModule } from 'primeng/button';
|
|
11
12
|
import * as i10 from 'primeng/menu';
|
|
12
|
-
import { MenuModule } from 'primeng/menu';
|
|
13
|
+
import { Menu, MenuModule } from 'primeng/menu';
|
|
13
14
|
import * as i7 from 'primeng/ripple';
|
|
14
15
|
import { RippleModule } from 'primeng/ripple';
|
|
15
16
|
import * as i9 from 'primeng/splitbutton';
|
|
16
17
|
import { SplitButtonModule } from 'primeng/splitbutton';
|
|
17
18
|
import * as i8 from 'primeng/tooltip';
|
|
18
19
|
import { TooltipModule } from 'primeng/tooltip';
|
|
19
|
-
import { ReplaySubject, BehaviorSubject, distinctUntilChanged, Subject, take, of, switchMap, mergeMap as mergeMap$1, from, timeout, combineLatest, debounceTime, isObservable, throwError, filter as filter$1 } from 'rxjs';
|
|
20
|
-
import * as
|
|
21
|
-
import { getI18n, getI18nAsync, toastMessage, getI18nForError, LoggerService, CommonsService, ParametrizePipe, escapeHtmlAny, toObservable, CommonsInternalError, StyleSizeEnum, CommonsHttpError, Permissions,
|
|
22
|
-
import { ActionActivationTriggerEnum, ActionTypeEnum, DataProviderExecutor, ActionDeleteDescriptorInst, ActionEditorEditDescriptorInst, ActionEditorAddDescriptorInst, ActionEditorDescriptorInst, CommonsActionError, ActionLinkDescriptorInst, TableviewEditorTypeEnum,
|
|
20
|
+
import { ReplaySubject, BehaviorSubject, distinctUntilChanged, Subject, take, of, switchMap, mergeMap as mergeMap$1, from, timeout, combineLatest, debounceTime, combineLatestWith, isObservable, throwError, filter as filter$1 } from 'rxjs';
|
|
21
|
+
import * as i3 from '@mediusinc/mng-commons/core';
|
|
22
|
+
import { getI18n, getI18nAsync, toastMessage, getI18nForError, LoggerService, CommonsService, ParametrizePipe, escapeHtmlAny, toObservable, CommonsInternalError, StyleSizeEnum, CommonsHttpError, Permissions, ComponentDirective, objectDeepCopy, DialogKeydownHandlerDirective, Styles, TemplateDirective, findTemplateByName, boolean$Attribute, fromSubscribeError, getErrorLogLevel, StyleLevelEnum, getObjectPropertyByPath, FilterMatchMode, COMMONS_MODULE_CONFIG_IT, dateToIsoString, RouteBuilder, createLazyRoute, CommonsFeatureTypeEnum } from '@mediusinc/mng-commons/core';
|
|
23
|
+
import { ActionActivationTriggerEnum, ActionTypeEnum, DataProviderExecutor, ActionDeleteDescriptorInst, ActionEditorEditDescriptorInst, ActionEditorAddDescriptorInst, ActionEditorDescriptorInst, CommonsActionError, ActionLinkDescriptorInst, TableviewEditorTypeEnum, TableviewDescriptorInst, FieldInputDescriptor, FieldInputTypeEnum, FieldActionDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldLookupDescriptor, FieldManyToManyEditorDescriptor, FieldManyEditorDescriptor, FormEventTypeEnum, FormFieldEventComponentSubtype, ActionEditorSubmitTypeEnum, ActionEditorSubmitDescriptorInst, ActionPositionEnum, runFnFromDataProviderOrFallback, runGetAllFromDataProvider, runFetchFromDataProvider, runCreateFromDataProvider, runUpdateFromDataProvider, runDeleteFromDataProvider, FormFieldEventTypeEnum, FieldGroupTypeEnum, FormFieldEventDialogSubtype, FieldManyEditorActionEnum, ActionEditorDescriptor, actionEditorCancel, ActionDescriptorInst, FieldManyToManyEditorActionEnum, TableviewActionDefaultCategories, DATA_LANGUAGE_DROPDOWN_COMPONENT_IT } from '@mediusinc/mng-commons/tableview/api';
|
|
23
24
|
import { mergeMap, map, filter, startWith, catchError, first, take as take$1 } from 'rxjs/operators';
|
|
24
25
|
import { getI18nModelParams, getI18nModelParamsAsync, type } from '@mediusinc/mng-commons/model';
|
|
25
26
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
26
27
|
import * as i2$3 from 'primeng/api';
|
|
27
28
|
import { MessageService, ConfirmationService, SharedModule } from 'primeng/api';
|
|
28
29
|
import { DialogService, DynamicDialogConfig } from 'primeng/dynamicdialog';
|
|
29
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
30
30
|
import * as i1$3 from 'primeng/progressspinner';
|
|
31
31
|
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
|
32
32
|
import * as i2$2 from 'primeng/toolbar';
|
|
33
33
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
34
34
|
import { ZIndexUtils } from 'primeng/utils';
|
|
35
|
-
import * as
|
|
35
|
+
import * as i1$2 from '@angular/forms';
|
|
36
36
|
import { UntypedFormGroup, FormGroup, FormArray, ReactiveFormsModule, FormsModule, FormBuilder, Validators, FormControl } from '@angular/forms';
|
|
37
37
|
import * as i2$1 from '@ngx-formly/core';
|
|
38
38
|
import { FormlyConfig, FormlyModule, FieldType, FieldWrapper, FORMLY_CONFIG } from '@ngx-formly/core';
|
|
39
39
|
import * as i3$1 from 'primeng/messages';
|
|
40
40
|
import { MessagesModule } from 'primeng/messages';
|
|
41
41
|
import { DropdownComponent, AutocompleteComponent, InputTrimDirective } from '@mediusinc/mng-commons/form';
|
|
42
|
-
import {
|
|
42
|
+
import { lookupDataProvider, ActionButtonDescriptor, ButtonStyleBuilder } from '@mediusinc/mng-commons/form/api';
|
|
43
43
|
import { TableComponent } from '@mediusinc/mng-commons/table';
|
|
44
44
|
import { TableSizeEnum } from '@mediusinc/mng-commons/table/api';
|
|
45
45
|
import * as i5 from 'primeng/message';
|
|
@@ -442,7 +442,7 @@ class NavigationService {
|
|
|
442
442
|
this.router = router;
|
|
443
443
|
this.location = location;
|
|
444
444
|
this.history = [];
|
|
445
|
-
this.router.events.subscribe(event => {
|
|
445
|
+
this.router.events.pipe(takeUntilDestroyed()).subscribe(event => {
|
|
446
446
|
if (event instanceof NavigationEnd) {
|
|
447
447
|
this.history.push(event.urlAfterRedirects);
|
|
448
448
|
}
|
|
@@ -490,23 +490,13 @@ const ACTION_EDITOR_COMPONENT_IT = new InjectionToken('ACTION_EDITOR_COMPONENT')
|
|
|
490
490
|
*/
|
|
491
491
|
class ViewContainer {
|
|
492
492
|
constructor() {
|
|
493
|
-
this.
|
|
493
|
+
this.dataProvider = signal(undefined);
|
|
494
|
+
this.routeTriggeredActionInstance = signal(undefined);
|
|
495
|
+
this.actions = signal([]);
|
|
494
496
|
this._tableReloadSubject = new Subject();
|
|
495
497
|
this._editorResetSubject = new Subject();
|
|
496
498
|
this._editorCloseSubject = new Subject();
|
|
497
499
|
}
|
|
498
|
-
set dataProvider(dataProvider) {
|
|
499
|
-
this._dataProvider = dataProvider;
|
|
500
|
-
}
|
|
501
|
-
get dataProvider() {
|
|
502
|
-
return this._dataProvider;
|
|
503
|
-
}
|
|
504
|
-
get actions() {
|
|
505
|
-
return this._actions;
|
|
506
|
-
}
|
|
507
|
-
set actions(actions) {
|
|
508
|
-
this._actions = actions;
|
|
509
|
-
}
|
|
510
500
|
get tableReload$() {
|
|
511
501
|
return this._tableReloadSubject.asObservable();
|
|
512
502
|
}
|
|
@@ -525,12 +515,6 @@ class ViewContainer {
|
|
|
525
515
|
closeEditor(event) {
|
|
526
516
|
this._editorCloseSubject.next(event ?? {});
|
|
527
517
|
}
|
|
528
|
-
get routeTriggeredActionInstance() {
|
|
529
|
-
return this._routeTriggeredActionInstance;
|
|
530
|
-
}
|
|
531
|
-
set routeTriggeredActionInstance(instance) {
|
|
532
|
-
this._routeTriggeredActionInstance = instance;
|
|
533
|
-
}
|
|
534
518
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ViewContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
535
519
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ViewContainer }); }
|
|
536
520
|
}
|
|
@@ -564,7 +548,7 @@ class ActionExecutorService {
|
|
|
564
548
|
* @param dataProvider Data provider.
|
|
565
549
|
*/
|
|
566
550
|
prepareActionContextValidation(action, parameters, dataProvider) {
|
|
567
|
-
const ctxDataProvider = dataProvider ?? action.dataProvider ?? this.viewContainer?.dataProvider;
|
|
551
|
+
const ctxDataProvider = dataProvider ?? action.dataProvider ?? this.viewContainer?.dataProvider();
|
|
568
552
|
return {
|
|
569
553
|
descriptor: action,
|
|
570
554
|
parameters: parameters,
|
|
@@ -883,7 +867,7 @@ class ActionExecutorService {
|
|
|
883
867
|
ctxDataProvider = editorAction.dataProvider;
|
|
884
868
|
}
|
|
885
869
|
if (!ctxDataProvider) {
|
|
886
|
-
const viewContainerDataProvider = this.viewContainer?.dataProvider;
|
|
870
|
+
const viewContainerDataProvider = this.viewContainer?.dataProvider();
|
|
887
871
|
if (viewContainerDataProvider) {
|
|
888
872
|
ctxDataProvider = viewContainerDataProvider;
|
|
889
873
|
}
|
|
@@ -906,7 +890,7 @@ class ActionExecutorService {
|
|
|
906
890
|
*/
|
|
907
891
|
prepareContext(action, parameters, dataProvider, instance, previousActionInstance) {
|
|
908
892
|
instance = this.getOrCreateInstance(instance, action, parameters, ActionInstanceStateEnum.ActivationEnd);
|
|
909
|
-
const ctxDataProvider = dataProvider ?? instance.action.dataProvider ?? this.viewContainer?.dataProvider;
|
|
893
|
+
const ctxDataProvider = dataProvider ?? instance.action.dataProvider ?? this.viewContainer?.dataProvider();
|
|
910
894
|
let service = undefined;
|
|
911
895
|
if (ctxDataProvider != null) {
|
|
912
896
|
const dataProviderService = this.dataProviderExecutor.getDataProviderService(this.injector, ctxDataProvider);
|
|
@@ -1007,7 +991,7 @@ class ActionExecutorService {
|
|
|
1007
991
|
throw new Error(`Action ${action.actionName} is not of type editor, cannot be activated through "onActionEditorOnInit"`);
|
|
1008
992
|
}
|
|
1009
993
|
if (instance && action.activationTrigger === ActionActivationTriggerEnum.OnRoute) {
|
|
1010
|
-
const triggeredInstance = this.viewContainer?.routeTriggeredActionInstance;
|
|
994
|
+
const triggeredInstance = this.viewContainer?.routeTriggeredActionInstance();
|
|
1011
995
|
if (triggeredInstance && triggeredInstance.instanceLongName !== instance.instanceLongName) {
|
|
1012
996
|
this.logger.debug(`WARNING: Found triggered parameters view container instance ${triggeredInstance.instanceLongName} and it does not match instance ${instance.instanceLongName} retrieved on editor init.`);
|
|
1013
997
|
}
|
|
@@ -1101,7 +1085,7 @@ class ActionExecutorService {
|
|
|
1101
1085
|
}
|
|
1102
1086
|
// unset instance in view container
|
|
1103
1087
|
if (this.viewContainer) {
|
|
1104
|
-
this.viewContainer.routeTriggeredActionInstance
|
|
1088
|
+
this.viewContainer.routeTriggeredActionInstance.set(undefined);
|
|
1105
1089
|
}
|
|
1106
1090
|
// set final state on instance
|
|
1107
1091
|
instance.state = finalState;
|
|
@@ -1119,7 +1103,7 @@ class ActionExecutorService {
|
|
|
1119
1103
|
newInstance.triggerParameters = instance.triggerParameters;
|
|
1120
1104
|
newInstance.activationParameters = instance.activationParameters;
|
|
1121
1105
|
if (this.viewContainer) {
|
|
1122
|
-
this.viewContainer.routeTriggeredActionInstance
|
|
1106
|
+
this.viewContainer.routeTriggeredActionInstance.set(newInstance);
|
|
1123
1107
|
}
|
|
1124
1108
|
instance.reactivationInstance = newInstance;
|
|
1125
1109
|
}
|
|
@@ -1156,7 +1140,7 @@ class ActionExecutorService {
|
|
|
1156
1140
|
const actionUrlSegments = this.parametrize.transform(actionUrl, parameters.itemId, parameters.item, parameters.actionData).split('/');
|
|
1157
1141
|
// set instance in view container
|
|
1158
1142
|
if (this.viewContainer) {
|
|
1159
|
-
this.viewContainer.routeTriggeredActionInstance
|
|
1143
|
+
this.viewContainer.routeTriggeredActionInstance.set(instance);
|
|
1160
1144
|
}
|
|
1161
1145
|
from(this.router.navigate([baseUrl, ...actionUrlSegments], { relativeTo: parameters.route, queryParams: parsedUrl.queryParams }))
|
|
1162
1146
|
.pipe(take(1))
|
|
@@ -1262,7 +1246,7 @@ class ActionExecutorService {
|
|
|
1262
1246
|
*/
|
|
1263
1247
|
getOrCreateInstance(instance, action, parameters, instanceInitialStatus, skipInitializationFromViewContainer = false) {
|
|
1264
1248
|
if (!skipInitializationFromViewContainer && !instance && action?.activationTrigger === ActionActivationTriggerEnum.OnRoute && parameters) {
|
|
1265
|
-
instance = this.viewContainer?.routeTriggeredActionInstance;
|
|
1249
|
+
instance = this.viewContainer?.routeTriggeredActionInstance();
|
|
1266
1250
|
}
|
|
1267
1251
|
if (!instance) {
|
|
1268
1252
|
if (!action) {
|
|
@@ -1329,68 +1313,51 @@ class ActionComponent {
|
|
|
1329
1313
|
this.authorization = authorization;
|
|
1330
1314
|
this.actionExecutor = actionExecutor;
|
|
1331
1315
|
this.viewContainer = viewContainer;
|
|
1332
|
-
this.
|
|
1333
|
-
|
|
1334
|
-
this.
|
|
1335
|
-
this.
|
|
1336
|
-
this.
|
|
1337
|
-
this.
|
|
1338
|
-
this.
|
|
1339
|
-
this
|
|
1340
|
-
this.
|
|
1341
|
-
this
|
|
1342
|
-
this.
|
|
1343
|
-
this
|
|
1344
|
-
this.
|
|
1345
|
-
this
|
|
1346
|
-
this.
|
|
1347
|
-
this
|
|
1348
|
-
this.
|
|
1349
|
-
this
|
|
1350
|
-
this.
|
|
1351
|
-
this.
|
|
1352
|
-
this.
|
|
1353
|
-
this.
|
|
1354
|
-
this.
|
|
1355
|
-
this.
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
this.
|
|
1360
|
-
this.
|
|
1361
|
-
this.
|
|
1362
|
-
this.
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
if (this.action.tableviewCategory && routeData.tableviewPermissions) {
|
|
1371
|
-
if (routeData.tableviewPermissions[this.action.tableviewCategory]) {
|
|
1372
|
-
this.routePermissions = routeData.tableviewPermissions[this.action.tableviewCategory];
|
|
1316
|
+
this.destroyRef = inject(DestroyRef);
|
|
1317
|
+
// metadata and editor mode input
|
|
1318
|
+
this.action = input.required();
|
|
1319
|
+
this.item = input();
|
|
1320
|
+
this.itemId = input();
|
|
1321
|
+
this.actionData = input();
|
|
1322
|
+
this.dataListParams = input();
|
|
1323
|
+
this.dataProvider = input();
|
|
1324
|
+
this.hostComponent = input();
|
|
1325
|
+
this.routeInit = input(undefined, { alias: 'route' });
|
|
1326
|
+
this.inputDisabled = input(false, { alias: 'disabled', transform: booleanAttribute });
|
|
1327
|
+
this.inputLoading = input(false, { alias: 'loading', transform: booleanAttribute });
|
|
1328
|
+
this.selectedItems = input([]);
|
|
1329
|
+
this.finish = output();
|
|
1330
|
+
this.subactionsMenu = viewChild(Menu);
|
|
1331
|
+
this.hostClass = computed(() => this.action().className ?? 'mng-action-button');
|
|
1332
|
+
this.isHostHidden = computed(() => !this.isVisible() || !this.isPermitted());
|
|
1333
|
+
this.loading = signal(false);
|
|
1334
|
+
this.isVisible = signal(true);
|
|
1335
|
+
this.isPermitted = signal(true);
|
|
1336
|
+
this.isEnabled = signal(true);
|
|
1337
|
+
this.label = signal('');
|
|
1338
|
+
this.tooltip = signal('');
|
|
1339
|
+
this.actionLink = computed(() => {
|
|
1340
|
+
const action = this.action();
|
|
1341
|
+
return action instanceof ActionLinkDescriptorInst ? action : undefined;
|
|
1342
|
+
});
|
|
1343
|
+
this.hasNoTitle = computed(() => this.action().button.label === null);
|
|
1344
|
+
this.route = computed(() => this.routeInit() ?? this.routeService);
|
|
1345
|
+
this.routeData = toSignal(this.route().data);
|
|
1346
|
+
this.routePermissions = computed(() => {
|
|
1347
|
+
const routeData = this.routeData();
|
|
1348
|
+
const action = this.action();
|
|
1349
|
+
if (action.tableviewCategory && routeData && routeData['tableviewPermissions']) {
|
|
1350
|
+
const tableviewPermissions = routeData['tableviewPermissions'];
|
|
1351
|
+
if (tableviewPermissions[action.tableviewCategory]) {
|
|
1352
|
+
return tableviewPermissions[action.tableviewCategory];
|
|
1353
|
+
}
|
|
1373
1354
|
}
|
|
1374
|
-
|
|
1375
|
-
this.processSubscriptions();
|
|
1376
|
-
if (this.action.className) {
|
|
1377
|
-
this.hostClass = this.action.className;
|
|
1378
|
-
}
|
|
1379
|
-
const hostVisibilitySubscription = combineLatest([this.$isVisible, this.$isPermitted]).subscribe(([isVisible, isPermitted]) => {
|
|
1380
|
-
this.isHostHidden = !isVisible || !isPermitted;
|
|
1355
|
+
return undefined;
|
|
1381
1356
|
});
|
|
1382
|
-
this.
|
|
1383
|
-
this.
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
}
|
|
1387
|
-
ngOnChanges(changes) {
|
|
1388
|
-
if (!(changes['item']?.firstChange ?? true) ||
|
|
1389
|
-
!(changes['itemId']?.firstChange ?? true) ||
|
|
1390
|
-
!(changes['actionData']?.firstChange ?? true) ||
|
|
1391
|
-
(this.action.hasItemsSelection && !(changes['selectedItems']?.firstChange ?? true))) {
|
|
1392
|
-
this.processSubscriptions();
|
|
1393
|
-
}
|
|
1357
|
+
this.buttonClass = computed(() => this.action().button.styleClass.build(this.hasNoTitle()));
|
|
1358
|
+
this.subactions = signal([]);
|
|
1359
|
+
this.subactionSubscriptions = [];
|
|
1360
|
+
effect(() => this.processSubscriptions(), { allowSignalWrites: true });
|
|
1394
1361
|
}
|
|
1395
1362
|
ngOnDestroy() {
|
|
1396
1363
|
this.actionExecutor.onActionDestroy(this.instance);
|
|
@@ -1399,24 +1366,27 @@ class ActionComponent {
|
|
|
1399
1366
|
this.isEnabledSubscription?.unsubscribe();
|
|
1400
1367
|
this.labelSubscription?.unsubscribe();
|
|
1401
1368
|
this.tooltipSubscription?.unsubscribe();
|
|
1402
|
-
this.
|
|
1369
|
+
this.resultSubscription?.unsubscribe();
|
|
1370
|
+
this.errorSubscription?.unsubscribe();
|
|
1371
|
+
this.stateSubscription?.unsubscribe();
|
|
1372
|
+
this.cmpInstSubscription?.unsubscribe();
|
|
1403
1373
|
this.subactionSubscriptions.forEach(s => s.unsubscribe());
|
|
1404
1374
|
}
|
|
1405
1375
|
triggerAction(action, parameters, event) {
|
|
1406
1376
|
if (action.subactionsAsMenu) {
|
|
1407
|
-
this.subactionsMenu?.toggle(event ?? new Event('trigger'));
|
|
1377
|
+
this.subactionsMenu()?.toggle(event ?? new Event('trigger'));
|
|
1408
1378
|
return;
|
|
1409
1379
|
}
|
|
1410
|
-
const actionData = this.actionData ? this.actionData : {};
|
|
1380
|
+
const actionData = this.actionData() ? this.actionData() : {};
|
|
1411
1381
|
parameters ??= {
|
|
1412
|
-
itemId: this.itemId,
|
|
1413
|
-
item: this.item,
|
|
1382
|
+
itemId: this.itemId(),
|
|
1383
|
+
item: this.item(),
|
|
1414
1384
|
actionData: actionData,
|
|
1415
|
-
dataListParams: this.dataListParams,
|
|
1416
|
-
route: this.route,
|
|
1385
|
+
dataListParams: this.dataListParams(),
|
|
1386
|
+
route: this.route(),
|
|
1417
1387
|
sourceComponent: this,
|
|
1418
|
-
hostComponent: this.hostComponent,
|
|
1419
|
-
selectedItems: this.selectedItems
|
|
1388
|
+
hostComponent: this.hostComponent(),
|
|
1389
|
+
selectedItems: this.selectedItems()
|
|
1420
1390
|
};
|
|
1421
1391
|
const instance = this.actionExecutor.triggerAction(action, parameters);
|
|
1422
1392
|
this.instance = instance;
|
|
@@ -1426,79 +1396,128 @@ class ActionComponent {
|
|
|
1426
1396
|
// it is in another component jurisdiction to handle contexts
|
|
1427
1397
|
return;
|
|
1428
1398
|
}
|
|
1429
|
-
this.
|
|
1399
|
+
this.resultSubscription?.unsubscribe();
|
|
1400
|
+
this.resultSubscription = instance.result$.subscribe({
|
|
1430
1401
|
next: () => {
|
|
1431
|
-
this.
|
|
1402
|
+
this.finish.emit(instance);
|
|
1432
1403
|
if (action.hasItemsSelection) {
|
|
1433
1404
|
this.viewContainer?.reloadTable({ data: { event: event } });
|
|
1434
1405
|
}
|
|
1435
1406
|
}
|
|
1436
|
-
})
|
|
1437
|
-
this.
|
|
1407
|
+
});
|
|
1408
|
+
this.errorSubscription?.unsubscribe();
|
|
1409
|
+
this.errorSubscription = instance.error$.subscribe({
|
|
1438
1410
|
next: () => {
|
|
1439
|
-
this.
|
|
1411
|
+
this.finish.emit(instance);
|
|
1440
1412
|
}
|
|
1441
|
-
})
|
|
1442
|
-
this.
|
|
1413
|
+
});
|
|
1414
|
+
this.stateSubscription?.unsubscribe();
|
|
1415
|
+
this.stateSubscription = this.instance.state$.subscribe(s => {
|
|
1443
1416
|
switch (s) {
|
|
1444
1417
|
case ActionInstanceStateEnum.RunStart:
|
|
1445
|
-
this.
|
|
1418
|
+
this.loading.set(true);
|
|
1446
1419
|
break;
|
|
1447
1420
|
case ActionInstanceStateEnum.RunEnd:
|
|
1448
1421
|
case ActionInstanceStateEnum.RunError:
|
|
1449
|
-
this.
|
|
1422
|
+
this.loading.set(false);
|
|
1450
1423
|
break;
|
|
1451
1424
|
case ActionInstanceStateEnum.NextActionStart:
|
|
1452
1425
|
if (this.instance?.nextActionInstance?.action.type === ActionTypeEnum.Direct) {
|
|
1453
|
-
this.
|
|
1426
|
+
this.loading.set(true);
|
|
1454
1427
|
}
|
|
1455
1428
|
break;
|
|
1456
1429
|
case ActionInstanceStateEnum.NextActionEnd:
|
|
1457
1430
|
if (this.instance?.nextActionInstance?.action.type === ActionTypeEnum.Direct) {
|
|
1458
|
-
this.
|
|
1431
|
+
this.loading.set(false);
|
|
1459
1432
|
}
|
|
1460
1433
|
break;
|
|
1461
1434
|
case ActionInstanceStateEnum.ErrorActionStart:
|
|
1462
1435
|
if (this.instance?.errorActionInstance?.action.type === ActionTypeEnum.Direct) {
|
|
1463
|
-
this.
|
|
1436
|
+
this.loading.set(true);
|
|
1464
1437
|
}
|
|
1465
1438
|
break;
|
|
1466
1439
|
case ActionInstanceStateEnum.ErrorActionEnd:
|
|
1467
1440
|
if (this.instance?.errorActionInstance?.action.type === ActionTypeEnum.Direct) {
|
|
1468
|
-
this.
|
|
1441
|
+
this.loading.set(false);
|
|
1469
1442
|
}
|
|
1470
1443
|
break;
|
|
1471
1444
|
}
|
|
1472
|
-
})
|
|
1445
|
+
});
|
|
1473
1446
|
this.actionExecutor.run(context);
|
|
1474
1447
|
}
|
|
1475
1448
|
onCustomActionCmpInst(instance) {
|
|
1476
|
-
|
|
1477
|
-
this.
|
|
1449
|
+
this.cmpInstSubscription?.unsubscribe();
|
|
1450
|
+
this.cmpInstSubscription = instance.trigger.subscribe(params => this.triggerAction(this.action(), params));
|
|
1451
|
+
}
|
|
1452
|
+
processSubscriptions() {
|
|
1453
|
+
const parameters = {
|
|
1454
|
+
itemId: this.itemId(),
|
|
1455
|
+
item: this.item(),
|
|
1456
|
+
actionData: this.actionData(),
|
|
1457
|
+
sourceComponent: this
|
|
1458
|
+
};
|
|
1459
|
+
const action = this.action();
|
|
1460
|
+
if (action.hasItemsSelection) {
|
|
1461
|
+
parameters.selectedItems = this.selectedItems();
|
|
1462
|
+
}
|
|
1463
|
+
const context = this.actionExecutor.prepareActionContextValidation(action, parameters, this.dataProvider());
|
|
1464
|
+
if (typeof action.isVisibleFunction === 'function') {
|
|
1465
|
+
this.isVisibleSubscription?.unsubscribe();
|
|
1466
|
+
this.isVisibleSubscription = toObservable(action.isVisibleFunction(context)).subscribe({
|
|
1467
|
+
next: res => this.isVisible.set(res)
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
const routePermissions = this.routePermissions();
|
|
1471
|
+
if (typeof action.permissions !== 'undefined' || typeof routePermissions !== 'undefined') {
|
|
1472
|
+
this.isPermittedSubscription?.unsubscribe();
|
|
1473
|
+
const permissions = action.permissions && routePermissions ? Permissions.All.of(routePermissions, action.permissions) : routePermissions ?? action.permissions;
|
|
1474
|
+
this.isVisibleSubscription = this.authorization.isPermitted(permissions, this.route().snapshot, context).subscribe({
|
|
1475
|
+
next: res => this.isPermitted.set(res)
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
if (typeof action.isEnabledFunction === 'function') {
|
|
1479
|
+
this.isEnabledSubscription?.unsubscribe();
|
|
1480
|
+
this.isEnabledSubscription = toObservable(action.isEnabledFunction(context)).subscribe({
|
|
1481
|
+
next: res => this.isEnabled.set(res)
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
if (!this.hasNoTitle()) {
|
|
1485
|
+
this.labelSubscription?.unsubscribe();
|
|
1486
|
+
this.labelSubscription = getI18nForActionAsync(this.translate, action, 'title', action.button.label ?? undefined, this.item()).subscribe({
|
|
1487
|
+
next: i18n => this.label.set(i18n ?? '')
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
this.tooltipSubscription?.unsubscribe();
|
|
1491
|
+
if (action.button.tooltip) {
|
|
1492
|
+
this.tooltipSubscription = getI18nForActionAsync(this.translate, action, 'tooltip', action.button.tooltip, this.item(), undefined, undefined).subscribe({
|
|
1493
|
+
next: i18n => this.tooltip.set(i18n ?? '')
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
this.subactions.set(this.processSubactions());
|
|
1478
1497
|
}
|
|
1479
1498
|
processSubactions() {
|
|
1480
1499
|
this.subactionSubscriptions.forEach(s => s.unsubscribe());
|
|
1481
1500
|
this.subactionSubscriptions = [];
|
|
1482
1501
|
const menuItems = [];
|
|
1483
|
-
for (const subaction of this.action.subactions) {
|
|
1502
|
+
for (const subaction of this.action().subactions) {
|
|
1484
1503
|
const menuItem = {};
|
|
1485
1504
|
menuItem.icon = subaction.button.icon ?? undefined;
|
|
1486
|
-
this.subactionSubscriptions.push(getI18nForActionAsync(this.translate, subaction, 'title', subaction.button.label ?? undefined, this.item).subscribe({
|
|
1505
|
+
this.subactionSubscriptions.push(getI18nForActionAsync(this.translate, subaction, 'title', subaction.button.label ?? undefined, this.item()).subscribe({
|
|
1487
1506
|
next: res => (menuItem.label = res)
|
|
1488
1507
|
}));
|
|
1489
|
-
this.subactionSubscriptions.push(getI18nForActionAsync(this.translate, subaction, 'tooltip', this.action.button.tooltip, this.item).subscribe({
|
|
1508
|
+
this.subactionSubscriptions.push(getI18nForActionAsync(this.translate, subaction, 'tooltip', this.action().button.tooltip, this.item()).subscribe({
|
|
1490
1509
|
next: res => (menuItem.tooltip = res)
|
|
1491
1510
|
}));
|
|
1492
1511
|
const parameters = {
|
|
1493
|
-
itemId: this.itemId,
|
|
1494
|
-
item: this.item,
|
|
1495
|
-
actionData: this.actionData,
|
|
1512
|
+
itemId: this.itemId(),
|
|
1513
|
+
item: this.item(),
|
|
1514
|
+
actionData: this.actionData(),
|
|
1496
1515
|
sourceComponent: this
|
|
1497
1516
|
};
|
|
1498
1517
|
if (subaction.hasItemsSelection) {
|
|
1499
|
-
parameters.selectedItems = this.selectedItems;
|
|
1518
|
+
parameters.selectedItems = this.selectedItems();
|
|
1500
1519
|
}
|
|
1501
|
-
const context = this.actionExecutor.prepareActionContextValidation(subaction, parameters, this.dataProvider);
|
|
1520
|
+
const context = this.actionExecutor.prepareActionContextValidation(subaction, parameters, this.dataProvider());
|
|
1502
1521
|
if (typeof subaction.isEnabledFunction === 'function') {
|
|
1503
1522
|
this.subactionSubscriptions.push(toObservable(subaction.isEnabledFunction(context)).subscribe({
|
|
1504
1523
|
next: res => (menuItem.disabled = !res)
|
|
@@ -1509,12 +1528,12 @@ class ActionComponent {
|
|
|
1509
1528
|
visibilityObservables.push(toObservable(subaction.isVisibleFunction(context)));
|
|
1510
1529
|
}
|
|
1511
1530
|
if (typeof subaction.permissions !== 'undefined') {
|
|
1512
|
-
visibilityObservables.push(this.authorization.isPermitted(subaction.permissions, this.route.snapshot, context));
|
|
1531
|
+
visibilityObservables.push(this.authorization.isPermitted(subaction.permissions, this.route().snapshot, context));
|
|
1513
1532
|
}
|
|
1514
|
-
const routeData = this.route.snapshot.data;
|
|
1533
|
+
const routeData = this.route().snapshot.data;
|
|
1515
1534
|
if (subaction.tableviewCategory && routeData.tableviewPermissions && routeData.tableviewPermissions[subaction.tableviewCategory]) {
|
|
1516
1535
|
const routePermissions = routeData.tableviewPermissions[subaction.tableviewCategory];
|
|
1517
|
-
visibilityObservables.push(this.authorization.isPermitted(routePermissions, this.route.snapshot, context));
|
|
1536
|
+
visibilityObservables.push(this.authorization.isPermitted(routePermissions, this.route().snapshot, context));
|
|
1518
1537
|
}
|
|
1519
1538
|
this.subactionSubscriptions.push(combineLatest(visibilityObservables).subscribe(visibilities => {
|
|
1520
1539
|
menuItem.visible = visibilities.every(value => value);
|
|
@@ -1524,99 +1543,15 @@ class ActionComponent {
|
|
|
1524
1543
|
}
|
|
1525
1544
|
return menuItems;
|
|
1526
1545
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
itemId: this.itemId,
|
|
1530
|
-
item: this.item,
|
|
1531
|
-
actionData: this.actionData,
|
|
1532
|
-
sourceComponent: this
|
|
1533
|
-
};
|
|
1534
|
-
if (this.action.hasItemsSelection) {
|
|
1535
|
-
parameters.selectedItems = this.selectedItems;
|
|
1536
|
-
}
|
|
1537
|
-
const context = this.actionExecutor.prepareActionContextValidation(this.action, parameters, this.dataProvider);
|
|
1538
|
-
if (typeof this.action.isVisibleFunction === 'function') {
|
|
1539
|
-
this.isVisibleSubscription?.unsubscribe();
|
|
1540
|
-
this.isVisibleSubscription = toObservable(this.action.isVisibleFunction(context)).subscribe({
|
|
1541
|
-
next: res => this.isVisibleSubject.next(res)
|
|
1542
|
-
});
|
|
1543
|
-
}
|
|
1544
|
-
if (typeof this.action.permissions !== 'undefined' || typeof this.routePermissions !== 'undefined') {
|
|
1545
|
-
this.isPermittedSubscription?.unsubscribe();
|
|
1546
|
-
const permissions = this.action.permissions && this.routePermissions
|
|
1547
|
-
? Permissions.All.of(this.routePermissions, this.action.permissions)
|
|
1548
|
-
: this.routePermissions ?? this.action.permissions;
|
|
1549
|
-
this.isVisibleSubscription = this.authorization.isPermitted(permissions, this.route.snapshot, context).subscribe({
|
|
1550
|
-
next: res => this.isPermittedSubject.next(res)
|
|
1551
|
-
});
|
|
1552
|
-
}
|
|
1553
|
-
if (typeof this.action.isEnabledFunction === 'function') {
|
|
1554
|
-
this.isEnabledSubscription?.unsubscribe();
|
|
1555
|
-
this.isEnabledSubscription = toObservable(this.action.isEnabledFunction(context)).subscribe({
|
|
1556
|
-
next: res => this.isEnabledSubject.next(res)
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
if (!this.hasNoTitle) {
|
|
1560
|
-
this.labelSubscription?.unsubscribe();
|
|
1561
|
-
this.labelSubscription = getI18nForActionAsync(this.translate, this.action, 'title', this.action.button.label ?? undefined, this.item).subscribe({
|
|
1562
|
-
next: i18n => this.labelSubject.next(i18n)
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
this.tooltipSubscription?.unsubscribe();
|
|
1566
|
-
if (this.action.button.tooltip) {
|
|
1567
|
-
this.tooltipSubscription = getI18nForActionAsync(this.translate, this.action, 'tooltip', this.action.button.tooltip, this.item, undefined, undefined).subscribe({
|
|
1568
|
-
next: i18n => this.tooltipSubject.next(i18n)
|
|
1569
|
-
});
|
|
1570
|
-
}
|
|
1571
|
-
this.subactions = this.processSubactions();
|
|
1572
|
-
}
|
|
1573
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1$1.TranslateService }, { token: i1$2.PermissionService }, { token: ActionExecutorService }, { token: ViewContainer, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1574
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: ActionComponent, isStandalone: true, selector: "mng-action", inputs: { action: "action", item: "item", itemId: "itemId", actionData: "actionData", dataListParams: "dataListParams", dataProvider: "dataProvider", hostComponent: "hostComponent", routeInit: ["route", "routeInit"], inputDisabled: ["disabled", "inputDisabled", boolean$Attribute], inputLoading: ["loading", "inputLoading", boolean$Attribute], selectedItems: "selectedItems" }, outputs: { finishEventEmitter: "finish" }, host: { properties: { "class": "this.hostClass", "class.m-0": "this.isHostHidden" } }, providers: [provideActionExecutor()], viewQueries: [{ propertyName: "subactionsMenu", first: true, predicate: ["subactionsMenu"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (($isVisible | async) && ($isPermitted | async)) {\n @if (actionLink && actionLink.url !== '') {\n <a\n pButton\n pRipple\n [label]=\"($label | async) ?? ''\"\n [icon]=\"$any(action.button.icon)\"\n [iconPos]=\"action.button.iconPosition\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | mngParametrize: itemId : item : actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [pTooltip]=\"($tooltip | async) ?? undefined\"\n [tooltipPosition]=\"action.button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass\"></a>\n } @else if (actionLink) {\n <a\n pButton\n pRipple\n [icon]=\"$any(action.button.icon)\"\n [iconPos]=\"action.button.iconPosition\"\n [label]=\"($label | async) ?? ''\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | mngParametrize: itemId : item : actionData)\"\n [relativeTo]=\"route\"\n [queryParams]=\"actionLink.queryParams | mngParametrize: itemId : item : actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [pTooltip]=\"($tooltip | async) ?? undefined\"\n [tooltipPosition]=\"action.button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass\"></a>\n } @else if (action.component || action.componentFromDi) {\n <ng-container\n [mngComponent]=\"action.component\"\n [injectionToken]=\"action.componentFromDi\"\n [inputs]=\"{\n action: action,\n item: item,\n itemId: itemId,\n actionData: actionData,\n enabled: $isEnabled,\n loading: $loading\n }\"\n (instanceCreated)=\"onCustomActionCmpInst($event)\">\n </ng-container>\n } @else if (action.subactions.length > 0 && !action.subactionsAsMenu) {\n <p-splitButton\n [icon]=\"action.button.icon ?? undefined\"\n [iconPos]=\"action.button.iconPosition\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"($tooltip | async) ?? undefined\"\n [tooltipPosition]=\"action.button.tooltipPosition ?? undefined\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (onClick)=\"triggerAction(action)\"\n [class]=\"buttonClass\"\n [model]=\"subactions\">\n </p-splitButton>\n } @else {\n <button\n pButton\n pRipple\n type=\"button\"\n [icon]=\"$any(action.button.icon)\"\n [iconPos]=\"action.button.iconPosition\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"($tooltip | async) ?? undefined\"\n [tooltipPosition]=\"action.button.tooltipPosition ?? undefined\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction(action, undefined, $event)\"\n [class]=\"buttonClass\"></button>\n <p-menu #subactionsMenu [model]=\"subactions\" [popup]=\"true\" appendTo=\"body\" styleClass=\"mng-action-menu\"></p-menu>\n }\n}\n", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "pipe", type: ParametrizePipe, name: "mngParametrize" }, { kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "nodeInjector"], outputs: ["instanceCreated"] }, { kind: "ngmodule", type: SplitButtonModule }, { kind: "component", type: i9.SplitButton, selector: "p-splitButton", inputs: ["model", "icon", "iconPos", "label", "style", "styleClass", "menuStyle", "menuStyleClass", "disabled", "tabindex", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps"], outputs: ["onClick", "onDropdownClick"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: i10.Menu, selector: "p-menu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaLabel", "ariaLabelledBy", "id", "tabindex"], outputs: ["onShow", "onHide", "onBlur", "onFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1546
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1$1.TranslateService }, { token: i3.PermissionService }, { token: ActionExecutorService }, { token: ViewContainer, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1547
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: ActionComponent, isStandalone: true, selector: "mng-action", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, itemId: { classPropertyName: "itemId", publicName: "itemId", isSignal: true, isRequired: false, transformFunction: null }, actionData: { classPropertyName: "actionData", publicName: "actionData", isSignal: true, isRequired: false, transformFunction: null }, dataListParams: { classPropertyName: "dataListParams", publicName: "dataListParams", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, hostComponent: { classPropertyName: "hostComponent", publicName: "hostComponent", isSignal: true, isRequired: false, transformFunction: null }, routeInit: { classPropertyName: "routeInit", publicName: "route", isSignal: true, isRequired: false, transformFunction: null }, inputDisabled: { classPropertyName: "inputDisabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputLoading: { classPropertyName: "inputLoading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { finish: "finish" }, host: { properties: { "class": "hostClass()", "class.m-0": "isHostHidden()" } }, providers: [provideActionExecutor()], viewQueries: [{ propertyName: "subactionsMenu", first: true, predicate: Menu, descendants: true, isSignal: true }], ngImport: i0, template: "@if (isVisible() && isPermitted()) {\n @if(actionLink(); as actionLink) {\n @if(actionLink.url !== '') {\n <a\n pButton\n pRipple\n [label]=\"label()\"\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [href]=\"!isEnabled() || inputDisabled() ? null : (actionLink.url | mngParametrize: itemId() : item() : actionData())\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"!isEnabled() || inputDisabled()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass()\"></a>\n } @else {\n <a\n pButton\n pRipple\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"!isEnabled() || inputDisabled() ? null : (actionLink.pathSegments | mngParametrize: itemId() : item() : actionData())\"\n [relativeTo]=\"route()\"\n [queryParams]=\"actionLink.queryParams | mngParametrize: itemId() : item() : actionData()\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"!isEnabled() || inputDisabled()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass()\"></a>\n }\n }\n @else if (action().component || action().componentFromDi) {\n <ng-container\n [mngComponent]=\"action().component\"\n [injectionToken]=\"action().componentFromDi\"\n [inputs]=\"{\n action: action(),\n item: item(),\n itemId: itemId(),\n actionData: actionData(),\n enabled: isEnabled(),\n loading: loading()\n }\"\n (instanceCreated)=\"onCustomActionCmpInst($event)\">\n </ng-container>\n }\n\n @else if (action().subactions.length > 0 && !action().subactionsAsMenu) {\n <p-splitButton\n [icon]=\"action().button.icon ?? undefined\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [disabled]=\"!isEnabled() || inputDisabled()\"\n (onClick)=\"triggerAction(action())\"\n [class]=\"buttonClass()\"\n [model]=\"subactions()\">\n </p-splitButton>\n } @else {\n <button\n pButton\n pRipple\n type=\"button\"\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [loading]=\"loading() || inputLoading()\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"!isEnabled() || inputDisabled()\"\n (click)=\"triggerAction(action(), undefined, $event)\"\n [class]=\"buttonClass()\"></button>\n <p-menu #subactionsMenu [model]=\"subactions()\" [popup]=\"true\" appendTo=\"body\" styleClass=\"mng-action-menu\"></p-menu>\n }\n}\n", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "pipe", type: ParametrizePipe, name: "mngParametrize" }, { kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }, { kind: "ngmodule", type: SplitButtonModule }, { kind: "component", type: i9.SplitButton, selector: "p-splitButton", inputs: ["model", "icon", "iconPos", "label", "style", "styleClass", "menuStyle", "menuStyleClass", "disabled", "tabindex", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps"], outputs: ["onClick", "onDropdownClick"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: i10.Menu, selector: "p-menu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaLabel", "ariaLabelledBy", "id", "tabindex"], outputs: ["onShow", "onHide", "onBlur", "onFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1575
1548
|
}
|
|
1576
1549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionComponent, decorators: [{
|
|
1577
1550
|
type: Component,
|
|
1578
|
-
args: [{ standalone: true, selector: 'mng-action', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, ButtonModule, RippleModule, TooltipModule, ParametrizePipe, ComponentDirective, SplitButtonModule, MenuModule], providers: [provideActionExecutor()], template: "@if ((
|
|
1579
|
-
}], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: i1$1.TranslateService }, { type:
|
|
1551
|
+
args: [{ standalone: true, selector: 'mng-action', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AsyncPipe, ButtonModule, RippleModule, TooltipModule, ParametrizePipe, ComponentDirective, SplitButtonModule, MenuModule], providers: [provideActionExecutor()], host: { '[class]': 'hostClass()', '[class.m-0]': 'isHostHidden()' }, template: "@if (isVisible() && isPermitted()) {\n @if(actionLink(); as actionLink) {\n @if(actionLink.url !== '') {\n <a\n pButton\n pRipple\n [label]=\"label()\"\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [href]=\"!isEnabled() || inputDisabled() ? null : (actionLink.url | mngParametrize: itemId() : item() : actionData())\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"!isEnabled() || inputDisabled()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass()\"></a>\n } @else {\n <a\n pButton\n pRipple\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"!isEnabled() || inputDisabled() ? null : (actionLink.pathSegments | mngParametrize: itemId() : item() : actionData())\"\n [relativeTo]=\"route()\"\n [queryParams]=\"actionLink.queryParams | mngParametrize: itemId() : item() : actionData()\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"!isEnabled() || inputDisabled()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [class]=\"buttonClass()\"></a>\n }\n }\n @else if (action().component || action().componentFromDi) {\n <ng-container\n [mngComponent]=\"action().component\"\n [injectionToken]=\"action().componentFromDi\"\n [inputs]=\"{\n action: action(),\n item: item(),\n itemId: itemId(),\n actionData: actionData(),\n enabled: isEnabled(),\n loading: loading()\n }\"\n (instanceCreated)=\"onCustomActionCmpInst($event)\">\n </ng-container>\n }\n\n @else if (action().subactions.length > 0 && !action().subactionsAsMenu) {\n <p-splitButton\n [icon]=\"action().button.icon ?? undefined\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [disabled]=\"!isEnabled() || inputDisabled()\"\n (onClick)=\"triggerAction(action())\"\n [class]=\"buttonClass()\"\n [model]=\"subactions()\">\n </p-splitButton>\n } @else {\n <button\n pButton\n pRipple\n type=\"button\"\n [icon]=\"$any(action().button.icon)\"\n [iconPos]=\"action().button.iconPosition\"\n [label]=\"label()\"\n [pTooltip]=\"tooltip()\"\n [tooltipPosition]=\"action().button.tooltipPosition ?? undefined\"\n [loading]=\"loading() || inputLoading()\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"!isEnabled() || inputDisabled()\"\n (click)=\"triggerAction(action(), undefined, $event)\"\n [class]=\"buttonClass()\"></button>\n <p-menu #subactionsMenu [model]=\"subactions()\" [popup]=\"true\" appendTo=\"body\" styleClass=\"mng-action-menu\"></p-menu>\n }\n}\n", styles: [":host{display:inline-block}\n"] }]
|
|
1552
|
+
}], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: i1$1.TranslateService }, { type: i3.PermissionService }, { type: ActionExecutorService }, { type: ViewContainer, decorators: [{
|
|
1580
1553
|
type: Optional
|
|
1581
|
-
}] }]
|
|
1582
|
-
type: HostBinding,
|
|
1583
|
-
args: ['class']
|
|
1584
|
-
}], isHostHidden: [{
|
|
1585
|
-
type: HostBinding,
|
|
1586
|
-
args: ['class.m-0']
|
|
1587
|
-
}], action: [{
|
|
1588
|
-
type: Input,
|
|
1589
|
-
args: [{ required: true }]
|
|
1590
|
-
}], item: [{
|
|
1591
|
-
type: Input
|
|
1592
|
-
}], itemId: [{
|
|
1593
|
-
type: Input
|
|
1594
|
-
}], actionData: [{
|
|
1595
|
-
type: Input
|
|
1596
|
-
}], dataListParams: [{
|
|
1597
|
-
type: Input
|
|
1598
|
-
}], dataProvider: [{
|
|
1599
|
-
type: Input
|
|
1600
|
-
}], hostComponent: [{
|
|
1601
|
-
type: Input
|
|
1602
|
-
}], routeInit: [{
|
|
1603
|
-
type: Input,
|
|
1604
|
-
args: ['route']
|
|
1605
|
-
}], inputDisabled: [{
|
|
1606
|
-
type: Input,
|
|
1607
|
-
args: [{ alias: 'disabled', transform: boolean$Attribute }]
|
|
1608
|
-
}], inputLoading: [{
|
|
1609
|
-
type: Input,
|
|
1610
|
-
args: [{ alias: 'loading', transform: boolean$Attribute }]
|
|
1611
|
-
}], selectedItems: [{
|
|
1612
|
-
type: Input
|
|
1613
|
-
}], finishEventEmitter: [{
|
|
1614
|
-
type: Output,
|
|
1615
|
-
args: ['finish']
|
|
1616
|
-
}], subactionsMenu: [{
|
|
1617
|
-
type: ViewChild,
|
|
1618
|
-
args: ['subactionsMenu']
|
|
1619
|
-
}] } });
|
|
1554
|
+
}] }] });
|
|
1620
1555
|
|
|
1621
1556
|
function createFormlyConfigFromDescriptor(descriptor, formlyConfig, formEditorComponent) {
|
|
1622
1557
|
const fields = [];
|
|
@@ -1637,7 +1572,7 @@ function createFormlyLocalizationsTab(descriptor) {
|
|
|
1637
1572
|
if (!descriptor.localizationModel) {
|
|
1638
1573
|
throw new CommonsInternalError('Localization model must be defined.');
|
|
1639
1574
|
}
|
|
1640
|
-
const localizationsTableViewDescriptor =
|
|
1575
|
+
const localizationsTableViewDescriptor = new TableviewDescriptorInst(descriptor.localizationModel);
|
|
1641
1576
|
if (!descriptor.localizationLocaleProperty) {
|
|
1642
1577
|
throw new CommonsInternalError('Localization locale property must be defined.');
|
|
1643
1578
|
}
|
|
@@ -1646,7 +1581,7 @@ function createFormlyLocalizationsTab(descriptor) {
|
|
|
1646
1581
|
localizationsTableViewDescriptor.detailsEditor.addField(descriptor.localizationLocaleProperty).withDisabled(true);
|
|
1647
1582
|
localizationsTableViewDescriptor.addEditor
|
|
1648
1583
|
.addFieldLookupWithProvider(descriptor.localizationLocaleProperty, CommonsService, type())
|
|
1649
|
-
.withLookup((qp, service) => service.
|
|
1584
|
+
.withLookup((qp, service) => service.appDataLocales())
|
|
1650
1585
|
.withDisabled(false)
|
|
1651
1586
|
.withRequired();
|
|
1652
1587
|
descriptor.fields.forEach(field => {
|
|
@@ -1879,6 +1814,7 @@ function createFormlyField(descriptor, formlyConfig, formEditorComponent) {
|
|
|
1879
1814
|
}
|
|
1880
1815
|
if (descriptor.hiddenExpression) {
|
|
1881
1816
|
field.expressions['hide'] = descriptor.hiddenExpression;
|
|
1817
|
+
field.expressions['resetOnHide'] = () => descriptor.hiddenResetOnHide ?? true;
|
|
1882
1818
|
}
|
|
1883
1819
|
if (descriptor.disabledExpression) {
|
|
1884
1820
|
field.expressions['props.disabled'] = descriptor.disabledExpression;
|
|
@@ -1922,7 +1858,18 @@ function createFormlyValidation(config, validation, formlyConfig) {
|
|
|
1922
1858
|
if (!formlyConfig.validators[validation.name]) {
|
|
1923
1859
|
formlyConfig.setValidator({
|
|
1924
1860
|
name: validation.name,
|
|
1925
|
-
validation: (control, field
|
|
1861
|
+
validation: (control, field) => {
|
|
1862
|
+
const commonsFieldFormlyConfig = field;
|
|
1863
|
+
return validation.validator({
|
|
1864
|
+
fieldFormControl: control,
|
|
1865
|
+
form: commonsFieldFormlyConfig.form,
|
|
1866
|
+
fieldFormlyConfig: field,
|
|
1867
|
+
formComponent: commonsFieldFormlyConfig.props?.formEditorComponent,
|
|
1868
|
+
fieldComponent: commonsFieldFormlyConfig.props?.fieldComponent
|
|
1869
|
+
})
|
|
1870
|
+
? null
|
|
1871
|
+
: { [validation.name]: true };
|
|
1872
|
+
}
|
|
1926
1873
|
});
|
|
1927
1874
|
}
|
|
1928
1875
|
if (!Array.isArray(config.validation)) {
|
|
@@ -1935,7 +1882,16 @@ function createFormlyValidation(config, validation, formlyConfig) {
|
|
|
1935
1882
|
}
|
|
1936
1883
|
else {
|
|
1937
1884
|
config[validation.name] = {
|
|
1938
|
-
expression:
|
|
1885
|
+
expression: (control, field) => {
|
|
1886
|
+
const commonsFieldFormlyConfig = field;
|
|
1887
|
+
return validation.validator({
|
|
1888
|
+
fieldFormControl: control,
|
|
1889
|
+
form: commonsFieldFormlyConfig.form,
|
|
1890
|
+
fieldFormlyConfig: commonsFieldFormlyConfig,
|
|
1891
|
+
formComponent: commonsFieldFormlyConfig.props?.formEditorComponent,
|
|
1892
|
+
fieldComponent: commonsFieldFormlyConfig.props?.fieldComponent
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1939
1895
|
};
|
|
1940
1896
|
if (validation.message != null) {
|
|
1941
1897
|
config[validation.name].message = validation.message;
|
|
@@ -1969,7 +1925,103 @@ function getFormEditorWarningMessage(translate, title, message) {
|
|
|
1969
1925
|
return { severity: 'warn', summary: actionErrorTitle, detail: actionErrorMessage };
|
|
1970
1926
|
}
|
|
1971
1927
|
|
|
1928
|
+
class FormEditorService {
|
|
1929
|
+
get parent() {
|
|
1930
|
+
return this._parentForm;
|
|
1931
|
+
}
|
|
1932
|
+
get parentService() {
|
|
1933
|
+
return this._parentForm;
|
|
1934
|
+
}
|
|
1935
|
+
get formComponent() {
|
|
1936
|
+
if (!this._formComponent) {
|
|
1937
|
+
throw new CommonsInternalError(`Form service was not initialized`);
|
|
1938
|
+
}
|
|
1939
|
+
return this._formComponent;
|
|
1940
|
+
}
|
|
1941
|
+
get descriptor() {
|
|
1942
|
+
return this.formComponent.descriptor;
|
|
1943
|
+
}
|
|
1944
|
+
get isFormDisabled() {
|
|
1945
|
+
return this.formComponent.isFormDisabled;
|
|
1946
|
+
}
|
|
1947
|
+
get formMessages() {
|
|
1948
|
+
return this.formComponent.formMessages;
|
|
1949
|
+
}
|
|
1950
|
+
get form() {
|
|
1951
|
+
return this.formComponent.form;
|
|
1952
|
+
}
|
|
1953
|
+
get formUnsafe() {
|
|
1954
|
+
return this.formComponent.formUnsafe;
|
|
1955
|
+
}
|
|
1956
|
+
get formlyOptions() {
|
|
1957
|
+
return this.formComponent.formlyOptions;
|
|
1958
|
+
}
|
|
1959
|
+
get formlyFields() {
|
|
1960
|
+
return this.formComponent.formlyFields;
|
|
1961
|
+
}
|
|
1962
|
+
get formlyInitialItem() {
|
|
1963
|
+
return this.formComponent.formlyInitialItem;
|
|
1964
|
+
}
|
|
1965
|
+
submit() {
|
|
1966
|
+
this.formComponent.submit();
|
|
1967
|
+
}
|
|
1968
|
+
getFormValue() {
|
|
1969
|
+
return this.formComponent.getFormValue();
|
|
1970
|
+
}
|
|
1971
|
+
resetFormModel(item, opts) {
|
|
1972
|
+
this.formComponent.resetFormModel(item, opts);
|
|
1973
|
+
}
|
|
1974
|
+
getField(key) {
|
|
1975
|
+
return this.formComponent.getField(key);
|
|
1976
|
+
}
|
|
1977
|
+
getFieldUnsafe(key) {
|
|
1978
|
+
return this.formComponent.getFieldUnsafe(key);
|
|
1979
|
+
}
|
|
1980
|
+
setFieldValue(key, value) {
|
|
1981
|
+
return this.formComponent.setFieldValue(key, value);
|
|
1982
|
+
}
|
|
1983
|
+
setFieldValueUnsafe(key, value) {
|
|
1984
|
+
return this.formComponent.setFieldValueUnsafe(key, value);
|
|
1985
|
+
}
|
|
1986
|
+
patchFieldValue(key, value) {
|
|
1987
|
+
return this.formComponent.patchFieldValue(key, value);
|
|
1988
|
+
}
|
|
1989
|
+
patchFieldValueUnsafe(key, value) {
|
|
1990
|
+
return this.formComponent.patchFieldValueUnsafe(key, value);
|
|
1991
|
+
}
|
|
1992
|
+
resetFieldValue(key, value) {
|
|
1993
|
+
return this.formComponent.resetFieldValue(key, value);
|
|
1994
|
+
}
|
|
1995
|
+
resetFieldValueUnsafe(key, value) {
|
|
1996
|
+
return this.formComponent.resetFieldValueUnsafe(key, value);
|
|
1997
|
+
}
|
|
1998
|
+
constructor(parentForm) {
|
|
1999
|
+
this._parentForm = parentForm;
|
|
2000
|
+
}
|
|
2001
|
+
init(formComponent) {
|
|
2002
|
+
this._formComponent = formComponent;
|
|
2003
|
+
}
|
|
2004
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorService, deps: [{ token: FormEditorService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2005
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorService }); }
|
|
2006
|
+
}
|
|
2007
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorService, decorators: [{
|
|
2008
|
+
type: Injectable
|
|
2009
|
+
}], ctorParameters: () => [{ type: FormEditorService }] });
|
|
2010
|
+
function provideFormComponent() {
|
|
2011
|
+
return {
|
|
2012
|
+
provide: FormEditorService,
|
|
2013
|
+
useFactory: (injector) => {
|
|
2014
|
+
const parent = injector.get(FormEditorService, null, { optional: true, skipSelf: true });
|
|
2015
|
+
return new FormEditorService(parent ?? undefined);
|
|
2016
|
+
},
|
|
2017
|
+
deps: [Injector]
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
|
|
1972
2021
|
class FormEditorComponent {
|
|
2022
|
+
get parent() {
|
|
2023
|
+
return this.formService.parent;
|
|
2024
|
+
}
|
|
1973
2025
|
get form() {
|
|
1974
2026
|
return this._form;
|
|
1975
2027
|
}
|
|
@@ -1994,6 +2046,7 @@ class FormEditorComponent {
|
|
|
1994
2046
|
this.commons = inject(CommonsService);
|
|
1995
2047
|
this.logger = inject(LoggerService).create('FormEditorComponent');
|
|
1996
2048
|
this.destroyRef = inject(DestroyRef);
|
|
2049
|
+
this.formService = inject((FormEditorService));
|
|
1997
2050
|
this.descriptor = input.required();
|
|
1998
2051
|
this.submitLoading = input(false);
|
|
1999
2052
|
this.item = input(undefined);
|
|
@@ -2014,6 +2067,7 @@ class FormEditorComponent {
|
|
|
2014
2067
|
this._formlyFields = []; // initialized in ngOnInit, should not be changed after
|
|
2015
2068
|
this._formlyInitialItem = {}; // initialized in ngOnInit, should not be changed after
|
|
2016
2069
|
this.formMessages = signal([]);
|
|
2070
|
+
this.formService.init(this);
|
|
2017
2071
|
effect(() => {
|
|
2018
2072
|
const item = this.item();
|
|
2019
2073
|
if (item !== this.initialItemInput) {
|
|
@@ -2050,16 +2104,16 @@ class FormEditorComponent {
|
|
|
2050
2104
|
this.formMessages.set([
|
|
2051
2105
|
...this.formMessages(),
|
|
2052
2106
|
getFormEditorInfoMessage(this.translateService, 'mngEditor.localizations.addInDefaultLanguageTitle', 'mngEditor.localizations.addInDefaultLanguageDescription', {
|
|
2053
|
-
defaultLanguage: this.commons.
|
|
2107
|
+
defaultLanguage: this.commons.getDefaultLocale()
|
|
2054
2108
|
})
|
|
2055
2109
|
]);
|
|
2056
2110
|
}
|
|
2057
2111
|
// emit lifecycle event
|
|
2058
|
-
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle,
|
|
2112
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle, this, {
|
|
2059
2113
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
2060
2114
|
});
|
|
2061
2115
|
this._form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250), distinctUntilChanged()).subscribe(v => {
|
|
2062
|
-
this.descriptor().nextEvent(FormEventTypeEnum.ValueChange,
|
|
2116
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ValueChange, this, {
|
|
2063
2117
|
value: v,
|
|
2064
2118
|
formValue: () => this.getFormValue()
|
|
2065
2119
|
});
|
|
@@ -2071,7 +2125,7 @@ class FormEditorComponent {
|
|
|
2071
2125
|
}
|
|
2072
2126
|
ngOnDestroy() {
|
|
2073
2127
|
// emit lifecycle event
|
|
2074
|
-
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle,
|
|
2128
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle, this, {
|
|
2075
2129
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
2076
2130
|
});
|
|
2077
2131
|
}
|
|
@@ -2088,7 +2142,7 @@ class FormEditorComponent {
|
|
|
2088
2142
|
success: true,
|
|
2089
2143
|
formItem: formSubmitItem
|
|
2090
2144
|
});
|
|
2091
|
-
this.descriptor().nextEvent(FormEventTypeEnum.Submit,
|
|
2145
|
+
this.descriptor().nextEvent(FormEventTypeEnum.Submit, this, {
|
|
2092
2146
|
submitValid: true,
|
|
2093
2147
|
submitValue: formSubmitItem
|
|
2094
2148
|
});
|
|
@@ -2098,15 +2152,14 @@ class FormEditorComponent {
|
|
|
2098
2152
|
const formFields = this._formlyFields;
|
|
2099
2153
|
if (formFields[0].type === 'tabs' && formFields[0].fieldGroup) {
|
|
2100
2154
|
for (const tab of formFields[0].fieldGroup) {
|
|
2101
|
-
|
|
2102
|
-
this._formlyOptions.formState['tab_' + (tab.id ? tab.id : tab.props.props.label) + '_invalid'] = isInvalid;
|
|
2155
|
+
this._formlyOptions.formState['tab_' + (tab.id ? tab.id : tab.props.props.label) + '_invalid'] = this.isAnyFieldInvalid(tab.fieldGroup);
|
|
2103
2156
|
}
|
|
2104
2157
|
}
|
|
2105
2158
|
const event = { success: false, formItem: formSubmitItem };
|
|
2106
2159
|
event.success = false;
|
|
2107
2160
|
this.formMessages().push(getFormEditorWarningMessage(this.translateService, 'mngEditor.invalidFormToastTitle', 'mngEditor.invalidFormToastMessage'));
|
|
2108
2161
|
this.formSubmit.emit(event);
|
|
2109
|
-
this.descriptor().nextEvent(FormEventTypeEnum.Submit,
|
|
2162
|
+
this.descriptor().nextEvent(FormEventTypeEnum.Submit, this, {
|
|
2110
2163
|
submitValid: false,
|
|
2111
2164
|
submitValue: formSubmitItem
|
|
2112
2165
|
});
|
|
@@ -2249,19 +2302,17 @@ class FormEditorComponent {
|
|
|
2249
2302
|
return false;
|
|
2250
2303
|
}
|
|
2251
2304
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2252
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.4", type: FormEditorComponent, isStandalone: true, selector: "mng-form-editor", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, submitLoading: { classPropertyName: "submitLoading", publicName: "submitLoading", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, isFormDisabled: { classPropertyName: "isFormDisabled", publicName: "isFormDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSubmit: "formSubmit" }, viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit($event)\">\n <formly-form [form]=\"form\" [fields]=\"formlyFields\" [options]=\"formlyOptions\" [model]=\"formlyInitialItem\"></formly-form>\n <button #submitButton pButton type=\"submit\" class=\"hidden\" [disabled]=\"form.disabled\" [loading]=\"submitLoading()\" loadingIcon=\"pi pi-spin pi-spinner\"></button>\n</form>\n<p-messages [value]=\"formMessages()\" [enableService]=\"false\"></p-messages>\n", dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
2305
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.4", type: FormEditorComponent, isStandalone: true, selector: "mng-form-editor", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, submitLoading: { classPropertyName: "submitLoading", publicName: "submitLoading", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, isFormDisabled: { classPropertyName: "isFormDisabled", publicName: "isFormDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSubmit: "formSubmit" }, providers: [provideFormComponent()], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit($event)\">\n <formly-form [form]=\"form\" [fields]=\"formlyFields\" [options]=\"formlyOptions\" [model]=\"formlyInitialItem\"></formly-form>\n <button #submitButton pButton type=\"submit\" class=\"hidden\" [disabled]=\"form.disabled\" [loading]=\"submitLoading()\" loadingIcon=\"pi pi-spin pi-spinner\"></button>\n</form>\n<p-messages [value]=\"formMessages()\" [enableService]=\"false\"></p-messages>\n", dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MessagesModule }, { kind: "component", type: i3$1.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2253
2306
|
}
|
|
2254
2307
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorComponent, decorators: [{
|
|
2255
2308
|
type: Component,
|
|
2256
|
-
args: [{ standalone: true, selector: 'mng-form-editor', imports: [FormlyModule, ReactiveFormsModule, MessagesModule, AsyncPipe, ButtonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit($event)\">\n <formly-form [form]=\"form\" [fields]=\"formlyFields\" [options]=\"formlyOptions\" [model]=\"formlyInitialItem\"></formly-form>\n <button #submitButton pButton type=\"submit\" class=\"hidden\" [disabled]=\"form.disabled\" [loading]=\"submitLoading()\" loadingIcon=\"pi pi-spin pi-spinner\"></button>\n</form>\n<p-messages [value]=\"formMessages()\" [enableService]=\"false\"></p-messages>\n" }]
|
|
2309
|
+
args: [{ standalone: true, selector: 'mng-form-editor', imports: [FormlyModule, ReactiveFormsModule, MessagesModule, AsyncPipe, ButtonModule], providers: [provideFormComponent()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit($event)\">\n <formly-form [form]=\"form\" [fields]=\"formlyFields\" [options]=\"formlyOptions\" [model]=\"formlyInitialItem\"></formly-form>\n <button #submitButton pButton type=\"submit\" class=\"hidden\" [disabled]=\"form.disabled\" [loading]=\"submitLoading()\" loadingIcon=\"pi pi-spin pi-spinner\"></button>\n</form>\n<p-messages [value]=\"formMessages()\" [enableService]=\"false\"></p-messages>\n" }]
|
|
2257
2310
|
}], ctorParameters: () => [] });
|
|
2258
2311
|
|
|
2259
2312
|
class ActionEditorInjectorContextComponent {
|
|
2260
2313
|
constructor() {
|
|
2261
2314
|
this.ActionActivationTriggerEnum = ActionActivationTriggerEnum;
|
|
2262
2315
|
this.actionEditorSubmitTypeSubmit = ActionEditorSubmitTypeEnum.Submit;
|
|
2263
|
-
this.destroyRef = inject(DestroyRef);
|
|
2264
|
-
this.route = inject(ActivatedRoute);
|
|
2265
2316
|
this.translate = inject(TranslateService);
|
|
2266
2317
|
this.confirmationService = inject(ConfirmationService);
|
|
2267
2318
|
this.dialogService = inject(DialogService);
|
|
@@ -2269,72 +2320,125 @@ class ActionEditorInjectorContextComponent {
|
|
|
2269
2320
|
this.commonsService = inject(CommonsService);
|
|
2270
2321
|
this.actionExecutor = inject(ActionExecutorService);
|
|
2271
2322
|
this.viewContainer = inject(ViewContainer, { optional: true });
|
|
2272
|
-
|
|
2273
|
-
this.
|
|
2323
|
+
// metadata and editor mode input
|
|
2324
|
+
this.data = input.required();
|
|
2325
|
+
this.actionRun = output();
|
|
2326
|
+
this.actionCancel = output();
|
|
2327
|
+
// content and view queries
|
|
2328
|
+
this.formEditorCmp = viewChild(FormEditorComponent);
|
|
2329
|
+
this.hasTitle = computed(() => this.editorAction().editorTitle !== null);
|
|
2274
2330
|
this.title = signal(undefined);
|
|
2275
2331
|
this.isFormDisabled = signal(false);
|
|
2276
2332
|
// data
|
|
2277
2333
|
this.item = signal(undefined);
|
|
2278
2334
|
this.itemId = signal(undefined);
|
|
2279
2335
|
this.actionData = signal(undefined);
|
|
2336
|
+
this.editorAction = signal({}); // fake initial value
|
|
2280
2337
|
// actions
|
|
2281
|
-
this.
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2338
|
+
this.actions = computed(() => {
|
|
2339
|
+
const actions = [];
|
|
2340
|
+
for (const action of this.editorAction().editorActions) {
|
|
2341
|
+
if (action instanceof ActionEditorSubmitDescriptorInst) {
|
|
2342
|
+
if (typeof action.button.icon === 'undefined') {
|
|
2343
|
+
action.button.withIcon(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'pi pi-check' : 'pi pi-times');
|
|
2344
|
+
}
|
|
2345
|
+
if (typeof action.button.label === 'undefined') {
|
|
2346
|
+
action.button.withLabel(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'general.save' : this.data().isDialog ? 'general.close' : 'general.cancel');
|
|
2347
|
+
}
|
|
2348
|
+
// assign run operations
|
|
2349
|
+
action.withRunNotificationSuccess(undefined, undefined, false);
|
|
2350
|
+
if (action.submitType === ActionEditorSubmitTypeEnum.Submit) {
|
|
2351
|
+
action.withRunFunction(() => {
|
|
2352
|
+
this.triggerSubmit();
|
|
2353
|
+
return of(null);
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
else {
|
|
2357
|
+
action.withRunFunction(() => {
|
|
2358
|
+
this.closeWithUnsavedChangesConfirmation();
|
|
2359
|
+
return of(null);
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
actions.push(action);
|
|
2364
|
+
}
|
|
2365
|
+
for (const action of this.viewContainer?.actions().filter(value => value.positionTableviewCategories?.includes(this.editorAction().tableviewCategory)) ?? []) {
|
|
2366
|
+
actions.push(action);
|
|
2367
|
+
}
|
|
2368
|
+
return actions;
|
|
2369
|
+
});
|
|
2370
|
+
this.toolbarLeftActions = computed(() => this.actions().filter(a => a.position === ActionPositionEnum.ToolbarLeft));
|
|
2371
|
+
this.toolbarRightActions = computed(() => this.actions()
|
|
2372
|
+
.filter(a => a.position === ActionPositionEnum.ToolbarRight)
|
|
2373
|
+
.reverse());
|
|
2374
|
+
this.footerLeftActions = computed(() => this.actions().filter(a => a.position === ActionPositionEnum.FooterLeft));
|
|
2375
|
+
this.footerRightActions = computed(() => this.actions()
|
|
2376
|
+
.filter(a => a.position === ActionPositionEnum.FooterRight)
|
|
2377
|
+
.reverse());
|
|
2378
|
+
this.dataProvider = computed(() => this.data().dataProvider ?? this.viewContainer?.dataProvider());
|
|
2285
2379
|
this.loading = signal(false);
|
|
2286
2380
|
this.submitLoading = signal(false);
|
|
2381
|
+
// updates for title
|
|
2287
2382
|
effect(() => {
|
|
2288
|
-
const
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2383
|
+
const hasTitle = this.hasTitle();
|
|
2384
|
+
if (!hasTitle) {
|
|
2385
|
+
this.title.set(undefined);
|
|
2386
|
+
}
|
|
2387
|
+
else {
|
|
2388
|
+
this.titleSubscription?.unsubscribe();
|
|
2389
|
+
this.titleSubscription = getI18nActionEditorTitleAsync(this.translate, this.editorAction(), this.item()).subscribe(t => {
|
|
2390
|
+
this.title.set(t ?? undefined);
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
}, { allowSignalWrites: true });
|
|
2394
|
+
toObservable$1(this.hasTitle)
|
|
2395
|
+
.pipe(combineLatestWith(toObservable$1(this.editorAction), toObservable$1(this.item)), mergeMap$1(([hasTitle, editorAction, item]) => (hasTitle ? getI18nActionEditorTitleAsync(this.translate, editorAction, item) : of(undefined))))
|
|
2396
|
+
.subscribe(title => {
|
|
2397
|
+
this.title.set(title ?? undefined);
|
|
2398
|
+
const dataDialogConfig = this.data().dialogConfig;
|
|
2399
|
+
if (dataDialogConfig) {
|
|
2400
|
+
dataDialogConfig.header = title ?? undefined;
|
|
2401
|
+
}
|
|
2402
|
+
if (this.editorAction().activationTrigger === ActionActivationTriggerEnum.OnRoute) {
|
|
2403
|
+
this.commonsService.setPageTitle(title ?? undefined);
|
|
2404
|
+
}
|
|
2297
2405
|
});
|
|
2298
|
-
}
|
|
2299
|
-
ngOnInit() {
|
|
2300
|
-
if (this.data.actionInstance) {
|
|
2301
|
-
this.processActionInstance(this.data.actionInstance);
|
|
2302
|
-
}
|
|
2303
|
-
if (!this.data.dataProvider) {
|
|
2304
|
-
this.data.dataProvider = this.viewContainer?.dataProvider;
|
|
2305
|
-
}
|
|
2306
|
-
this.item.set(this.data.item);
|
|
2307
|
-
this.itemId.set(this.data.itemId);
|
|
2308
|
-
this.actionData.set(this.data.actionData);
|
|
2309
|
-
// arrange the sub-actions
|
|
2310
|
-
this.initializeSubActions();
|
|
2311
|
-
// notify executor to for activation to end
|
|
2312
|
-
this.processActionInstance(this.actionExecutor.onActionEditorInit(this.data.descriptor, this.instance, this));
|
|
2313
|
-
// set title
|
|
2314
|
-
this.updateTitle();
|
|
2315
2406
|
// subscribe to events that could be triggered from outside from any reason
|
|
2316
|
-
this.viewContainer?.editorReset$.pipe(takeUntilDestroyed(
|
|
2407
|
+
this.viewContainer?.editorReset$.pipe(takeUntilDestroyed()).subscribe({
|
|
2317
2408
|
next: e => {
|
|
2318
2409
|
if (e.fetch) {
|
|
2319
2410
|
this.fetchItem();
|
|
2320
2411
|
}
|
|
2321
2412
|
else if (e.item) {
|
|
2322
|
-
this.formEditorCmp?.resetFormModel(e.item);
|
|
2413
|
+
this.formEditorCmp()?.resetFormModel(e.item);
|
|
2323
2414
|
}
|
|
2324
2415
|
else if (e.fields) {
|
|
2325
2416
|
for (const key in e.fields) {
|
|
2326
|
-
this.formEditorCmp?.resetFieldValue(key, e.fields[key]);
|
|
2417
|
+
this.formEditorCmp()?.resetFieldValue(key, e.fields[key]);
|
|
2327
2418
|
}
|
|
2328
2419
|
}
|
|
2329
2420
|
}
|
|
2330
2421
|
});
|
|
2331
|
-
this.viewContainer?.editorClose$.pipe(takeUntilDestroyed(
|
|
2422
|
+
this.viewContainer?.editorClose$.pipe(takeUntilDestroyed()).subscribe({
|
|
2332
2423
|
next: () => {
|
|
2333
2424
|
this.cancel();
|
|
2334
2425
|
}
|
|
2335
2426
|
});
|
|
2336
2427
|
}
|
|
2428
|
+
ngOnInit() {
|
|
2429
|
+
const data = this.data();
|
|
2430
|
+
this.editorAction.set(data.descriptor);
|
|
2431
|
+
this.item.set(data.item);
|
|
2432
|
+
this.itemId.set(data.itemId);
|
|
2433
|
+
this.actionData.set(data.actionData);
|
|
2434
|
+
if (data.actionInstance) {
|
|
2435
|
+
this.processActionInstance(data.actionInstance);
|
|
2436
|
+
}
|
|
2437
|
+
// notify executor to for activation to end
|
|
2438
|
+
this.processActionInstance(this.actionExecutor.onActionEditorInit(this.editorAction(), this.instance, this));
|
|
2439
|
+
}
|
|
2337
2440
|
ngOnDestroy() {
|
|
2441
|
+
this.titleSubscription?.unsubscribe();
|
|
2338
2442
|
this.fetchExecutionSubscription?.unsubscribe();
|
|
2339
2443
|
this.submitExecutionSubscription?.unsubscribe();
|
|
2340
2444
|
const instance = this.instance;
|
|
@@ -2343,7 +2447,7 @@ class ActionEditorInjectorContextComponent {
|
|
|
2343
2447
|
}
|
|
2344
2448
|
onSubmit(event) {
|
|
2345
2449
|
if (!this.instance) {
|
|
2346
|
-
throw new CommonsInternalError(`Action is not instantiated in action editor for action ${this.
|
|
2450
|
+
throw new CommonsInternalError(`Action is not instantiated in action editor for action ${this.editorAction().actionName}.`);
|
|
2347
2451
|
}
|
|
2348
2452
|
if (event.success) {
|
|
2349
2453
|
// prepare parameters
|
|
@@ -2352,18 +2456,20 @@ class ActionEditorInjectorContextComponent {
|
|
|
2352
2456
|
item: event.formItem,
|
|
2353
2457
|
actionData: this.actionData()
|
|
2354
2458
|
};
|
|
2355
|
-
if (this.
|
|
2356
|
-
actionParameters.locale = this.commonsService.
|
|
2459
|
+
if (this.editorAction().editorDescriptor.isLocalized) {
|
|
2460
|
+
actionParameters.locale = this.commonsService.getDefaultLocale();
|
|
2357
2461
|
}
|
|
2358
|
-
const context = this.actionExecutor.prepareContextForEditorSubmit(this.
|
|
2462
|
+
const context = this.actionExecutor.prepareContextForEditorSubmit(this.editorAction(), actionParameters, this.dataProvider(), this.instance, this.data().previousActionInstance);
|
|
2359
2463
|
this.submitExecutionSubscription?.unsubscribe();
|
|
2360
2464
|
this.submitExecutionSubscription = context.execution$.pipe(take$1(1)).subscribe({
|
|
2361
2465
|
next: res => {
|
|
2362
|
-
|
|
2466
|
+
this.lastSubmitItem = event.formItem;
|
|
2467
|
+
const modelIdProp = this.editorAction().model?.idProperty;
|
|
2468
|
+
if (res && typeof res === 'object' && !this.itemId() && modelIdProp) {
|
|
2363
2469
|
// to cover creation!
|
|
2364
|
-
this.updateItemId(res[
|
|
2470
|
+
this.updateItemId(res[modelIdProp]);
|
|
2365
2471
|
}
|
|
2366
|
-
this.
|
|
2472
|
+
this.actionRun.emit(res);
|
|
2367
2473
|
}
|
|
2368
2474
|
});
|
|
2369
2475
|
this.actionExecutor.run(context);
|
|
@@ -2371,10 +2477,10 @@ class ActionEditorInjectorContextComponent {
|
|
|
2371
2477
|
}
|
|
2372
2478
|
cancel() {
|
|
2373
2479
|
if (!this.instance) {
|
|
2374
|
-
this.logger.warn(`Action editor cannot be canceled for ${this.
|
|
2480
|
+
this.logger.warn(`Action editor cannot be canceled for ${this.editorAction().actionName}, because no action instance is present`);
|
|
2375
2481
|
return;
|
|
2376
2482
|
}
|
|
2377
|
-
this.
|
|
2483
|
+
this.actionCancel.emit(undefined);
|
|
2378
2484
|
this.actionExecutor.finishAction(this.instance);
|
|
2379
2485
|
}
|
|
2380
2486
|
updateItemId(itemId) {
|
|
@@ -2384,55 +2490,23 @@ class ActionEditorInjectorContextComponent {
|
|
|
2384
2490
|
this.item.set(item);
|
|
2385
2491
|
}
|
|
2386
2492
|
triggerSubmit() {
|
|
2387
|
-
this.formEditorCmp?.submit();
|
|
2388
|
-
}
|
|
2389
|
-
initializeSubActions() {
|
|
2390
|
-
for (const action of this.data.descriptor.editorActions) {
|
|
2391
|
-
if (action instanceof ActionEditorSubmitDescriptorInst) {
|
|
2392
|
-
if (typeof action.button.icon === 'undefined') {
|
|
2393
|
-
action.button.withIcon(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'pi pi-check' : 'pi pi-times');
|
|
2394
|
-
}
|
|
2395
|
-
if (typeof action.button.label === 'undefined') {
|
|
2396
|
-
action.button.withLabel(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'general.save' : this.data.isDialog ? 'general.close' : 'general.cancel');
|
|
2397
|
-
}
|
|
2398
|
-
// assign run operations
|
|
2399
|
-
action.withRunNotificationSuccess(undefined, undefined, false);
|
|
2400
|
-
if (action.submitType === ActionEditorSubmitTypeEnum.Submit) {
|
|
2401
|
-
action.withRunFunction(() => {
|
|
2402
|
-
this.triggerSubmit();
|
|
2403
|
-
return of(null);
|
|
2404
|
-
});
|
|
2405
|
-
}
|
|
2406
|
-
else {
|
|
2407
|
-
action.withRunFunction(() => {
|
|
2408
|
-
this.closeWithUnsavedChangesConfirmation();
|
|
2409
|
-
return of(null);
|
|
2410
|
-
});
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
this.placeActionsOnPositions(action);
|
|
2414
|
-
}
|
|
2415
|
-
for (const action of this.viewContainer?.actions.filter(value => value.positionTableviewCategories?.includes(this.data.descriptor.tableviewCategory)) ?? []) {
|
|
2416
|
-
this.placeActionsOnPositions(action);
|
|
2417
|
-
}
|
|
2418
|
-
this.toolbarRightActions.update(v => v.reverse());
|
|
2419
|
-
this.footerRightActions.update(v => v.reverse());
|
|
2493
|
+
this.formEditorCmp()?.submit();
|
|
2420
2494
|
}
|
|
2421
2495
|
fetchItem() {
|
|
2422
2496
|
if (!this.instance) {
|
|
2423
|
-
throw new CommonsInternalError(`Action is not instantiated in action editor for action ${this.
|
|
2497
|
+
throw new CommonsInternalError(`Action is not instantiated in action editor for action ${this.editorAction().actionName}.`);
|
|
2424
2498
|
}
|
|
2425
2499
|
const actionParameters = {
|
|
2426
2500
|
itemId: this.itemId(),
|
|
2427
2501
|
item: this.item(),
|
|
2428
2502
|
actionData: this.actionData()
|
|
2429
2503
|
};
|
|
2430
|
-
if (this.
|
|
2431
|
-
if (this.
|
|
2432
|
-
actionParameters.locale = this.commonsService.
|
|
2504
|
+
if (this.editorAction().editorDescriptor.isLocalized) {
|
|
2505
|
+
if (this.editorAction().editorDescriptor.disabled) {
|
|
2506
|
+
actionParameters.locale = this.commonsService.appDataLocale();
|
|
2433
2507
|
}
|
|
2434
2508
|
else {
|
|
2435
|
-
actionParameters.locale = this.commonsService.
|
|
2509
|
+
actionParameters.locale = this.commonsService.getDefaultLocale();
|
|
2436
2510
|
}
|
|
2437
2511
|
}
|
|
2438
2512
|
if (this.instance?.previousInstance instanceof ActionInstance && this.instance.previousInstance.context?.parameters.item) {
|
|
@@ -2441,39 +2515,13 @@ class ActionEditorInjectorContextComponent {
|
|
|
2441
2515
|
if (typeof this.instance?.previousInstance?.result !== 'undefined') {
|
|
2442
2516
|
actionParameters.submitResult = this.instance?.previousInstance?.result;
|
|
2443
2517
|
}
|
|
2444
|
-
const context = this.actionExecutor.prepareContextForEditorFetch(this.
|
|
2518
|
+
const context = this.actionExecutor.prepareContextForEditorFetch(this.editorAction(), actionParameters, this.dataProvider(), this.instance, this.data().previousActionInstance);
|
|
2445
2519
|
this.fetchExecutionSubscription?.unsubscribe();
|
|
2446
2520
|
this.fetchExecutionSubscription = context.execution$.pipe(take$1(1)).subscribe(res => {
|
|
2447
2521
|
this.updateItem(res ?? undefined);
|
|
2448
|
-
this.updateTitle();
|
|
2449
2522
|
});
|
|
2450
2523
|
this.actionExecutor.run(context);
|
|
2451
2524
|
}
|
|
2452
|
-
updateTitle() {
|
|
2453
|
-
if (this.data.descriptor.editorTitle === null) {
|
|
2454
|
-
this.title.set(undefined);
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
getI18nActionEditorTitleAsync(this.translate, this.data.descriptor, this.item()).subscribe(t => {
|
|
2458
|
-
this.title.set(t ?? undefined);
|
|
2459
|
-
});
|
|
2460
|
-
}
|
|
2461
|
-
placeActionsOnPositions(action) {
|
|
2462
|
-
switch (action.position) {
|
|
2463
|
-
case ActionPositionEnum.ToolbarLeft:
|
|
2464
|
-
this.toolbarLeftActions.update(v => [...v, action]);
|
|
2465
|
-
break;
|
|
2466
|
-
case ActionPositionEnum.ToolbarRight:
|
|
2467
|
-
this.toolbarRightActions.update(v => [...v, action]);
|
|
2468
|
-
break;
|
|
2469
|
-
case ActionPositionEnum.FooterLeft:
|
|
2470
|
-
this.footerLeftActions.update(v => [...v, action]);
|
|
2471
|
-
break;
|
|
2472
|
-
case ActionPositionEnum.FooterRight:
|
|
2473
|
-
this.footerRightActions.update(v => [...v, action]);
|
|
2474
|
-
break;
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
2525
|
setEditorEnabled(isEnabled = true) {
|
|
2478
2526
|
this.isFormDisabled.set(!isEnabled);
|
|
2479
2527
|
}
|
|
@@ -2540,8 +2588,7 @@ class ActionEditorInjectorContextComponent {
|
|
|
2540
2588
|
case ActionInstanceStateEnum.FinishSuccessReactivateFinal:
|
|
2541
2589
|
this.setEditorEnabled(false);
|
|
2542
2590
|
// make copy of item and update title to be on the latest
|
|
2543
|
-
this.
|
|
2544
|
-
this.updateTitle();
|
|
2591
|
+
this.updateItem(objectDeepCopy(this.lastSubmitItem));
|
|
2545
2592
|
// should also unsetInstance, but let this for reactivationInstance$ listener to not interfere
|
|
2546
2593
|
break;
|
|
2547
2594
|
}
|
|
@@ -2557,20 +2604,20 @@ class ActionEditorInjectorContextComponent {
|
|
|
2557
2604
|
this.instanceReactivationSubscription?.unsubscribe();
|
|
2558
2605
|
}
|
|
2559
2606
|
beforeWindowUnload() {
|
|
2560
|
-
if (this.data.isDialog && this.formEditorCmp?.form.pristine === false) {
|
|
2607
|
+
if (this.data().isDialog && this.formEditorCmp()?.form.pristine === false) {
|
|
2561
2608
|
return confirm(this.translate.instant('mngEditor.unsavedChangesConfirmation.message'));
|
|
2562
2609
|
}
|
|
2563
2610
|
return true;
|
|
2564
2611
|
}
|
|
2565
2612
|
onEscapePressed() {
|
|
2566
|
-
if (this.data.isDialog &&
|
|
2567
|
-
this.
|
|
2613
|
+
if (this.data().isDialog &&
|
|
2614
|
+
this.editorAction().activationTrigger === ActionActivationTriggerEnum.OnRoute &&
|
|
2568
2615
|
this.instance?.activationDialogRef &&
|
|
2569
2616
|
parseInt(this.dialogService.dialogComponentRefMap.get(this.instance?.activationDialogRef)?.instance.container?.style.zIndex ?? '') === ZIndexUtils.getCurrent())
|
|
2570
2617
|
this.closeWithUnsavedChangesConfirmation();
|
|
2571
2618
|
}
|
|
2572
2619
|
closeWithUnsavedChangesConfirmation(callFromGuard = false) {
|
|
2573
|
-
if (this.formEditorCmp?.form.pristine === false && this.
|
|
2620
|
+
if (this.formEditorCmp()?.form.pristine === false && this.editorAction().unsavedChangesConfirmation) {
|
|
2574
2621
|
return this.showUnsavedChangesConfirmationDialog(callFromGuard);
|
|
2575
2622
|
}
|
|
2576
2623
|
else {
|
|
@@ -2603,27 +2650,12 @@ class ActionEditorInjectorContextComponent {
|
|
|
2603
2650
|
return subject.asObservable();
|
|
2604
2651
|
}
|
|
2605
2652
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorInjectorContextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2606
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: ActionEditorInjectorContextComponent, isStandalone: true, selector: "mng-action-editor-injector-context", inputs: { data: "data" }, outputs: {
|
|
2653
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: ActionEditorInjectorContextComponent, isStandalone: true, selector: "mng-action-editor-injector-context", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { actionRun: "actionRun", actionCancel: "actionCancel" }, host: { listeners: { "window:beforeunload": "beforeWindowUnload()", "window:keydown.Escape": "onEscapePressed()" } }, providers: [provideActionExecutor()], viewQueries: [{ propertyName: "formEditorCmp", first: true, predicate: FormEditorComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (!data().isDialog && title()) {\n <h5>{{ title() }}</h5>\n}\n@if (data().isDialog && editorAction().activationTrigger === ActionActivationTriggerEnum.OnRoute) {\n <span class=\"p-dialog-header dialog-close-button-wrapper\">\n <button\n class=\"p-dialog-header-icon p-dialog-header-maximize p-link\"\n type=\"button\"\n (click)=\"closeWithUnsavedChangesConfirmation()\"\n (keydown.enter)=\"closeWithUnsavedChangesConfirmation()\">\n <span class=\"p-dialog-header-close-icon pi pi-times\"></span>\n </button>\n </span>\n}\n<div class=\"h-full flex flex-column\">\n @if (toolbarLeftActions().length > 0 || toolbarRightActions().length > 0) {\n <div class=\"flex-grow-1 mng-action-editor-toolbar-container\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n @for (action of toolbarLeftActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </ng-template>\n <ng-template pTemplate=\"right\">\n @for (action of toolbarRightActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </ng-template>\n </p-toolbar>\n </div>\n }\n\n <div class=\"flex-grow-1 mng-action-editor-form-container\">\n @if (loading()) {\n <div class=\"text-center\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n }\n @if (editorAction().editorDescriptor && !loading()) {\n <mng-form-editor [descriptor]=\"editorAction().editorDescriptor\" [item]=\"item()\" [isFormDisabled]=\"isFormDisabled()\" (formSubmit)=\"onSubmit($event)\"> </mng-form-editor>\n }\n </div>\n\n <div class=\"flex flex-row justify-content-between mng-action-editor-footer-container\">\n <div>\n @for (action of footerLeftActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </div>\n <div>\n @for (action of footerRightActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </div>\n </div>\n</div>\n", styles: [".dialog-close-button-wrapper{position:absolute;top:1.286rem;right:1.714rem;background:transparent;padding:0}\n"], dependencies: [{ kind: "component", type: ActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "dataListParams", "dataProvider", "hostComponent", "route", "disabled", "loading", "selectedItems"], outputs: ["finish"] }, { kind: "ngmodule", type: ProgressSpinnerModule }, { kind: "component", type: i1$3.ProgressSpinner, selector: "p-progressSpinner", inputs: ["styleClass", "style", "strokeWidth", "fill", "animationDuration", "ariaLabel"] }, { kind: "component", type: FormEditorComponent, selector: "mng-form-editor", inputs: ["descriptor", "submitLoading", "item", "isFormDisabled"], outputs: ["formSubmit"] }, { kind: "ngmodule", type: ToolbarModule }, { kind: "component", type: i2$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass", "ariaLabelledBy"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2607
2654
|
}
|
|
2608
2655
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorInjectorContextComponent, decorators: [{
|
|
2609
2656
|
type: Component,
|
|
2610
|
-
args: [{ standalone: true, selector: 'mng-action-editor-injector-context', imports: [ActionComponent, ProgressSpinnerModule, FormEditorComponent, ComponentDirective, ToolbarModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideActionExecutor()], template: "@if (!data.isDialog && title()) {\n <h5>{{ title() }}</h5>\n}\n@if (data.isDialog &&
|
|
2611
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
2612
|
-
type: Input,
|
|
2613
|
-
args: [{ required: true }]
|
|
2614
|
-
}], actionRunEventEmitter: [{
|
|
2615
|
-
type: Output,
|
|
2616
|
-
args: ['actionSubmit']
|
|
2617
|
-
}], actionCancelEventEmitter: [{
|
|
2618
|
-
type: Output,
|
|
2619
|
-
args: ['actionCancel']
|
|
2620
|
-
}], submitButtonElementRef: [{
|
|
2621
|
-
type: ViewChild,
|
|
2622
|
-
args: ['submitButton']
|
|
2623
|
-
}], formEditorCmp: [{
|
|
2624
|
-
type: ViewChild,
|
|
2625
|
-
args: [FormEditorComponent]
|
|
2626
|
-
}], beforeWindowUnload: [{
|
|
2657
|
+
args: [{ standalone: true, selector: 'mng-action-editor-injector-context', imports: [ActionComponent, ProgressSpinnerModule, FormEditorComponent, ComponentDirective, ToolbarModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideActionExecutor()], template: "@if (!data().isDialog && title()) {\n <h5>{{ title() }}</h5>\n}\n@if (data().isDialog && editorAction().activationTrigger === ActionActivationTriggerEnum.OnRoute) {\n <span class=\"p-dialog-header dialog-close-button-wrapper\">\n <button\n class=\"p-dialog-header-icon p-dialog-header-maximize p-link\"\n type=\"button\"\n (click)=\"closeWithUnsavedChangesConfirmation()\"\n (keydown.enter)=\"closeWithUnsavedChangesConfirmation()\">\n <span class=\"p-dialog-header-close-icon pi pi-times\"></span>\n </button>\n </span>\n}\n<div class=\"h-full flex flex-column\">\n @if (toolbarLeftActions().length > 0 || toolbarRightActions().length > 0) {\n <div class=\"flex-grow-1 mng-action-editor-toolbar-container\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n @for (action of toolbarLeftActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </ng-template>\n <ng-template pTemplate=\"right\">\n @for (action of toolbarRightActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </ng-template>\n </p-toolbar>\n </div>\n }\n\n <div class=\"flex-grow-1 mng-action-editor-form-container\">\n @if (loading()) {\n <div class=\"text-center\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n }\n @if (editorAction().editorDescriptor && !loading()) {\n <mng-form-editor [descriptor]=\"editorAction().editorDescriptor\" [item]=\"item()\" [isFormDisabled]=\"isFormDisabled()\" (formSubmit)=\"onSubmit($event)\"> </mng-form-editor>\n }\n </div>\n\n <div class=\"flex flex-row justify-content-between mng-action-editor-footer-container\">\n <div>\n @for (action of footerLeftActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </div>\n <div>\n @for (action of footerRightActions(); track action) {\n <mng-action\n [action]=\"action\"\n [disabled]=\"submitLoading()\"\n [loading]=\"$any(action).submitType === actionEditorSubmitTypeSubmit ? submitLoading() : false\"\n [hostComponent]=\"this\"\n [item]=\"item()\"\n [itemId]=\"itemId()\"></mng-action>\n }\n </div>\n </div>\n</div>\n", styles: [".dialog-close-button-wrapper{position:absolute;top:1.286rem;right:1.714rem;background:transparent;padding:0}\n"] }]
|
|
2658
|
+
}], ctorParameters: () => [], propDecorators: { beforeWindowUnload: [{
|
|
2627
2659
|
type: HostListener,
|
|
2628
2660
|
args: ['window:beforeunload']
|
|
2629
2661
|
}], onEscapePressed: [{
|
|
@@ -2632,59 +2664,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
2632
2664
|
}] } });
|
|
2633
2665
|
|
|
2634
2666
|
class ActionEditorComponent {
|
|
2635
|
-
constructor() {
|
|
2636
|
-
this.injContextCmpType = ActionEditorInjectorContextComponent;
|
|
2637
|
-
this.injector = inject(Injector);
|
|
2638
|
-
this.destroyRef = inject(DestroyRef);
|
|
2639
|
-
this.dialogConfig = inject(DynamicDialogConfig, { optional: true });
|
|
2640
|
-
this.actionRunEventEmitter = new EventEmitter();
|
|
2641
|
-
this.actionCancelEventEmitter = new EventEmitter();
|
|
2642
|
-
this.isDialog = false;
|
|
2643
|
-
}
|
|
2644
2667
|
get actionEditor() {
|
|
2645
2668
|
return this.actionEditorWInjContextCmp;
|
|
2646
2669
|
}
|
|
2647
2670
|
get formEditorCmp() {
|
|
2648
2671
|
return this.actionEditor?.formEditorCmp;
|
|
2649
2672
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
this.
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
}
|
|
2673
|
+
constructor() {
|
|
2674
|
+
this.injContextCmpType = ActionEditorInjectorContextComponent;
|
|
2675
|
+
this.dialogConfig = inject(DynamicDialogConfig, { optional: true });
|
|
2676
|
+
this.action = input.required();
|
|
2677
|
+
this.dialogData = this.dialogConfig?.data;
|
|
2678
|
+
this.isDialog = !!this.dialogData;
|
|
2679
|
+
this.parentInjector = this.dialogData?.injector;
|
|
2680
|
+
// data source inputs
|
|
2681
|
+
this.itemId = input();
|
|
2682
|
+
this.item = input();
|
|
2683
|
+
this.actionData = input();
|
|
2684
|
+
this.dataProvider = input();
|
|
2685
|
+
this.actionRun = output();
|
|
2686
|
+
this.actionCancel = output();
|
|
2687
|
+
this.actionEditorWInjContextInputData = computed(() => {
|
|
2688
|
+
return {
|
|
2689
|
+
isDialog: this.isDialog,
|
|
2690
|
+
dialogConfig: this.dialogConfig ?? undefined,
|
|
2691
|
+
descriptor: this.dialogData?.action.descriptor ?? this.action(),
|
|
2692
|
+
actionInstance: this.dialogData?.action.instance,
|
|
2693
|
+
previousActionInstance: this.dialogData?.action.previousInstance,
|
|
2694
|
+
itemId: this.dialogData?.action.instance.activationParameters?.itemId ?? this.itemId(),
|
|
2695
|
+
item: this.dialogData?.action.instance.activationParameters?.item ?? this.item(),
|
|
2696
|
+
actionData: this.dialogData?.action.instance.activationParameters?.actionData ?? this.actionData,
|
|
2697
|
+
dataProvider: this.dataProvider()
|
|
2698
|
+
};
|
|
2699
|
+
});
|
|
2700
|
+
this.itemIdFirstUpdate = true;
|
|
2701
|
+
this.itemFirstUpdate = true;
|
|
2702
|
+
effect(() => {
|
|
2703
|
+
const itemId = this.itemId();
|
|
2704
|
+
if (!this.itemIdFirstUpdate) {
|
|
2705
|
+
this.actionEditorWInjContextCmp?.updateItemId(itemId);
|
|
2706
|
+
}
|
|
2707
|
+
else {
|
|
2708
|
+
this.itemIdFirstUpdate = false;
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2711
|
+
effect(() => {
|
|
2712
|
+
const item = this.item();
|
|
2713
|
+
if (!this.itemFirstUpdate) {
|
|
2714
|
+
this.actionEditorWInjContextCmp?.updateItem(item);
|
|
2715
|
+
}
|
|
2716
|
+
else {
|
|
2717
|
+
this.itemFirstUpdate = false;
|
|
2718
|
+
}
|
|
2719
|
+
});
|
|
2677
2720
|
}
|
|
2678
2721
|
onActionEditorWInjContextCmp(cmp) {
|
|
2679
2722
|
if (this.actionEditorWInjContextCmp) {
|
|
2680
2723
|
throw new CommonsInternalError('Action editor injection context component is already initialized');
|
|
2681
2724
|
}
|
|
2682
2725
|
this.actionEditorWInjContextCmp = cmp;
|
|
2683
|
-
this.actionEditorWInjContextCmp.
|
|
2684
|
-
this.
|
|
2726
|
+
this.actionEditorWInjContextCmp.actionCancel.subscribe(action => {
|
|
2727
|
+
this.actionCancel.emit(action);
|
|
2685
2728
|
});
|
|
2686
|
-
this.actionEditorWInjContextCmp.
|
|
2687
|
-
this.
|
|
2729
|
+
this.actionEditorWInjContextCmp.actionRun.subscribe(action => {
|
|
2730
|
+
this.actionRun.emit(action);
|
|
2688
2731
|
});
|
|
2689
2732
|
}
|
|
2690
2733
|
cancel() {
|
|
@@ -2694,107 +2737,69 @@ class ActionEditorComponent {
|
|
|
2694
2737
|
this.actionEditorWInjContextCmp?.triggerSubmit();
|
|
2695
2738
|
}
|
|
2696
2739
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2697
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2740
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.4", type: ActionEditorComponent, isStandalone: true, selector: "mng-action-editor", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: true, transformFunction: null }, itemId: { classPropertyName: "itemId", publicName: "itemId", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, actionData: { classPropertyName: "actionData", publicName: "actionData", isSignal: true, isRequired: false, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { actionRun: "actionRun", actionCancel: "actionCancel" }, hostDirectives: [{ directive: i3.DialogKeydownHandlerDirective }], ngImport: i0, template: "<div\n [mngComponent]=\"injContextCmpType\"\n [inputs]=\"{\n data: actionEditorWInjContextInputData()\n }\"\n [parentInjector]=\"parentInjector\"\n (instanceCreated)=\"onActionEditorWInjContextCmp($event)\"></div>\n", dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2698
2741
|
}
|
|
2699
2742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorComponent, decorators: [{
|
|
2700
2743
|
type: Component,
|
|
2701
|
-
args: [{ standalone: true, selector: 'mng-action-editor', imports: [ComponentDirective], hostDirectives: [DialogKeydownHandlerDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [mngComponent]=\"injContextCmpType\"\n [inputs]=\"{\n data: actionEditorWInjContextInputData\n }\"\n [
|
|
2702
|
-
}],
|
|
2703
|
-
type: Input,
|
|
2704
|
-
args: [{ required: true }]
|
|
2705
|
-
}], itemIdInput: [{
|
|
2706
|
-
type: Input,
|
|
2707
|
-
args: ['itemId']
|
|
2708
|
-
}], itemInput: [{
|
|
2709
|
-
type: Input,
|
|
2710
|
-
args: ['item']
|
|
2711
|
-
}], actionData: [{
|
|
2712
|
-
type: Input
|
|
2713
|
-
}], dataProvider: [{
|
|
2714
|
-
type: Input
|
|
2715
|
-
}], actionRunEventEmitter: [{
|
|
2716
|
-
type: Output,
|
|
2717
|
-
args: ['actionSubmit']
|
|
2718
|
-
}], actionCancelEventEmitter: [{
|
|
2719
|
-
type: Output,
|
|
2720
|
-
args: ['actionCancel']
|
|
2721
|
-
}] } });
|
|
2744
|
+
args: [{ standalone: true, selector: 'mng-action-editor', imports: [ComponentDirective], hostDirectives: [DialogKeydownHandlerDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [mngComponent]=\"injContextCmpType\"\n [inputs]=\"{\n data: actionEditorWInjContextInputData()\n }\"\n [parentInjector]=\"parentInjector\"\n (instanceCreated)=\"onActionEditorWInjContextCmp($event)\"></div>\n" }]
|
|
2745
|
+
}], ctorParameters: () => [] });
|
|
2722
2746
|
|
|
2723
2747
|
class DataLanguageDropdownComponent {
|
|
2724
|
-
constructor(
|
|
2725
|
-
this.commons = commons;
|
|
2748
|
+
constructor() {
|
|
2726
2749
|
this.viewContainer = inject(ViewContainer, { optional: true });
|
|
2727
|
-
this.
|
|
2728
|
-
this.
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
this.
|
|
2750
|
+
this.commons = inject(CommonsService);
|
|
2751
|
+
this.action = input.required();
|
|
2752
|
+
this.actionData = input.required();
|
|
2753
|
+
this.item = input.required();
|
|
2754
|
+
this.itemId = input.required();
|
|
2755
|
+
this.enabled = input.required();
|
|
2756
|
+
this.loading = input.required();
|
|
2757
|
+
this.trigger = output();
|
|
2758
|
+
// dropdown properties
|
|
2759
|
+
this.selectionItemsDataProvider = computed(() => lookupDataProvider().withLookup(() => of(this.commons.appDataLocales())));
|
|
2760
|
+
}
|
|
2761
|
+
updateDataLocale(dataLang) {
|
|
2762
|
+
this.commons.setAppDataLocale(dataLang);
|
|
2732
2763
|
this.viewContainer?.reloadTable({});
|
|
2733
2764
|
}
|
|
2734
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DataLanguageDropdownComponent, deps: [
|
|
2735
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2765
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DataLanguageDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2766
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.4", type: DataLanguageDropdownComponent, isStandalone: true, selector: "mng-data-language-dropdown", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: true, transformFunction: null }, actionData: { classPropertyName: "actionData", publicName: "actionData", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, itemId: { classPropertyName: "itemId", publicName: "itemId", isSignal: true, isRequired: true, transformFunction: null }, enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: true, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { trigger: "trigger" }, ngImport: i0, template: "<mng-dropdown [dataProvider]=\"selectionItemsDataProvider()\" [ngModel]=\"commons.appDataLocale()\" [showClear]=\"false\" (valueChange)=\"updateDataLocale($event)\"></mng-dropdown>\n", dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2736
2767
|
}
|
|
2737
2768
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DataLanguageDropdownComponent, decorators: [{
|
|
2738
2769
|
type: Component,
|
|
2739
|
-
args: [{ standalone: true, selector: 'mng-data-language-dropdown', imports: [DropdownComponent, FormsModule], template: "<mng-dropdown [dataProvider]=\"selectionItemsDataProvider\" [ngModel]=\"commons.
|
|
2740
|
-
}]
|
|
2741
|
-
type: Input,
|
|
2742
|
-
args: [{ required: true }]
|
|
2743
|
-
}], actionData: [{
|
|
2744
|
-
type: Input,
|
|
2745
|
-
args: [{ required: true }]
|
|
2746
|
-
}], item: [{
|
|
2747
|
-
type: Input,
|
|
2748
|
-
args: [{ required: true }]
|
|
2749
|
-
}], itemId: [{
|
|
2750
|
-
type: Input,
|
|
2751
|
-
args: [{ required: true }]
|
|
2752
|
-
}], enabled: [{
|
|
2753
|
-
type: Input,
|
|
2754
|
-
args: [{ required: true }]
|
|
2755
|
-
}], loading: [{
|
|
2756
|
-
type: Input,
|
|
2757
|
-
args: [{ required: true }]
|
|
2758
|
-
}], triggerActionEventEmitter: [{
|
|
2759
|
-
type: Output
|
|
2760
|
-
}], dropdown: [{
|
|
2761
|
-
type: ViewChild,
|
|
2762
|
-
args: [DropdownComponent]
|
|
2763
|
-
}] } });
|
|
2770
|
+
args: [{ standalone: true, selector: 'mng-data-language-dropdown', imports: [DropdownComponent, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-dropdown [dataProvider]=\"selectionItemsDataProvider()\" [ngModel]=\"commons.appDataLocale()\" [showClear]=\"false\" (valueChange)=\"updateDataLocale($event)\"></mng-dropdown>\n" }]
|
|
2771
|
+
}] });
|
|
2764
2772
|
|
|
2765
2773
|
class ActionRouteComponent {
|
|
2766
|
-
constructor(
|
|
2767
|
-
this.router =
|
|
2768
|
-
this.route =
|
|
2769
|
-
this.actionExecutor =
|
|
2770
|
-
this.viewContainer =
|
|
2771
|
-
this.
|
|
2772
|
-
this.actions = [];
|
|
2773
|
-
this.subscriptions = [];
|
|
2774
|
+
constructor() {
|
|
2775
|
+
this.router = inject(Router);
|
|
2776
|
+
this.route = inject(ActivatedRoute);
|
|
2777
|
+
this.actionExecutor = inject(ActionExecutorService);
|
|
2778
|
+
this.viewContainer = inject((ViewContainer), { optional: true });
|
|
2779
|
+
this.destroyRef = inject(DestroyRef);
|
|
2780
|
+
this.actions = this.viewContainer?.actions().filter(a => a.activationTrigger === ActionActivationTriggerEnum.OnRoute) ?? [];
|
|
2774
2781
|
this.isRouterNavigationInProgress = false;
|
|
2775
2782
|
}
|
|
2776
2783
|
ngOnInit() {
|
|
2777
|
-
this.
|
|
2778
|
-
this.subscriptions.push(this.route.params.subscribe(p => {
|
|
2784
|
+
this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(p => {
|
|
2779
2785
|
const action = this.findActionForRoute(p) ?? undefined;
|
|
2780
2786
|
if (action) {
|
|
2781
2787
|
this.activateAction(action, p, this.route.snapshot.queryParams);
|
|
2782
2788
|
}
|
|
2783
|
-
})
|
|
2784
|
-
this.
|
|
2789
|
+
});
|
|
2790
|
+
this.router.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(e => {
|
|
2785
2791
|
if (e instanceof NavigationStart) {
|
|
2786
2792
|
this.isRouterNavigationInProgress = true;
|
|
2787
2793
|
}
|
|
2788
2794
|
else if (e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped) {
|
|
2789
2795
|
this.isRouterNavigationInProgress = false;
|
|
2790
2796
|
}
|
|
2791
|
-
})
|
|
2797
|
+
});
|
|
2792
2798
|
}
|
|
2793
2799
|
ngOnDestroy() {
|
|
2794
2800
|
const instance = this.instance;
|
|
2795
2801
|
this.unsetInstance();
|
|
2796
2802
|
this.actionExecutor.onActionRouteDestroy(instance);
|
|
2797
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
2798
2803
|
}
|
|
2799
2804
|
activateAction(action, p, qp) {
|
|
2800
2805
|
const itemId = p['itemId'];
|
|
@@ -2892,15 +2897,13 @@ class ActionRouteComponent {
|
|
|
2892
2897
|
this.instanceStateSubscription?.unsubscribe();
|
|
2893
2898
|
this.instanceReactivationSubscription?.unsubscribe();
|
|
2894
2899
|
}
|
|
2895
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionRouteComponent, deps: [
|
|
2900
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2896
2901
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: ActionRouteComponent, isStandalone: true, selector: "mng-action-route", providers: [provideActionExecutor()], ngImport: i0, template: "", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2897
2902
|
}
|
|
2898
2903
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionRouteComponent, decorators: [{
|
|
2899
2904
|
type: Component,
|
|
2900
2905
|
args: [{ standalone: true, selector: 'mng-action-route', changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideActionExecutor()], template: "" }]
|
|
2901
|
-
}]
|
|
2902
|
-
type: Optional
|
|
2903
|
-
}] }] });
|
|
2906
|
+
}] });
|
|
2904
2907
|
|
|
2905
2908
|
var actionRoute_component = /*#__PURE__*/Object.freeze({
|
|
2906
2909
|
__proto__: null,
|
|
@@ -3120,6 +3123,9 @@ class FormlyFieldActionComponent extends FieldType {
|
|
|
3120
3123
|
this.props.fieldComponent = this;
|
|
3121
3124
|
this.buttonClass = this.descriptor.button.styleClass.build();
|
|
3122
3125
|
}
|
|
3126
|
+
ngOnDestroy() {
|
|
3127
|
+
this.resultSubscription?.unsubscribe();
|
|
3128
|
+
}
|
|
3123
3129
|
onClick() {
|
|
3124
3130
|
this.actionMessage = undefined;
|
|
3125
3131
|
const result = this.descriptor.runFunction?.({
|
|
@@ -3136,7 +3142,8 @@ class FormlyFieldActionComponent extends FieldType {
|
|
|
3136
3142
|
});
|
|
3137
3143
|
if (result) {
|
|
3138
3144
|
if (isObservable(result)) {
|
|
3139
|
-
|
|
3145
|
+
this.resultSubscription?.unsubscribe();
|
|
3146
|
+
this.resultSubscription = result.subscribe(res => this.processResult(res));
|
|
3140
3147
|
}
|
|
3141
3148
|
else {
|
|
3142
3149
|
this.processResult(result);
|
|
@@ -3159,6 +3166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3159
3166
|
class FormlyFieldAutocompleteComponent extends FieldType {
|
|
3160
3167
|
constructor() {
|
|
3161
3168
|
super(...arguments);
|
|
3169
|
+
this.destroyRef = inject(DestroyRef);
|
|
3162
3170
|
this.subscriptions = [];
|
|
3163
3171
|
}
|
|
3164
3172
|
ngOnInit() {
|
|
@@ -3166,32 +3174,29 @@ class FormlyFieldAutocompleteComponent extends FieldType {
|
|
|
3166
3174
|
this.descriptor = this.props.descriptor;
|
|
3167
3175
|
this.props.fieldComponent = this;
|
|
3168
3176
|
// emit lifecycle event
|
|
3169
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3177
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3170
3178
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3171
3179
|
});
|
|
3172
|
-
|
|
3173
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3180
|
+
this.aFormControl.valueChanges.pipe(startWith(this.aFormControl.value), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3181
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3174
3182
|
value: v
|
|
3175
3183
|
});
|
|
3176
3184
|
this.props.onValueChange?.(this.field, v);
|
|
3177
3185
|
});
|
|
3178
|
-
this.subscriptions.push(subscription);
|
|
3179
3186
|
}
|
|
3180
3187
|
ngAfterViewInit() {
|
|
3181
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3188
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3182
3189
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3183
3190
|
});
|
|
3184
3191
|
}
|
|
3185
3192
|
ngOnDestroy() {
|
|
3186
|
-
// warning: formly calls on destroy before on init
|
|
3187
|
-
this.subscriptions.forEach(value => value.unsubscribe());
|
|
3188
3193
|
// emit lifecycle event
|
|
3189
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3194
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3190
3195
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3191
3196
|
});
|
|
3192
3197
|
}
|
|
3193
3198
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldAutocompleteComponent, isStandalone: true, selector: "mng-formly-field-autocomplete", usesInheritance: true, ngImport: i0, template: "<mng-autocomplete\n [id]=\"$any(key)\"\n [formControl]=\"aFormControl\"\n [formlyAttributes]=\"field\"\n [dataProvider]=\"descriptor.dataProvider\"\n [optionsTrackProperty]=\"descriptor.optionsTrackProperty\"\n [optionsLabelProperty]=\"descriptor.optionsLabelProperty\"\n [optionsValueProperty]=\"descriptor.optionsValueProperty\"\n [className]=\"descriptor.inputClassName\"\n [showClear]=\"!props.required\"\n [selectFirst]=\"descriptor.autocompleteSelectFirst ?? false\"\n [autoClear]=\"descriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"descriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"descriptor.autocompleteInlineSearch ?? false\">\n</mng-autocomplete>\n", dependencies: [{ kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim"], outputs: ["valueChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
3199
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldAutocompleteComponent, isStandalone: true, selector: "mng-formly-field-autocomplete", usesInheritance: true, ngImport: i0, template: "<mng-autocomplete\n [id]=\"$any(key)\"\n [formControl]=\"aFormControl\"\n [formlyAttributes]=\"field\"\n [dataProvider]=\"descriptor.dataProvider\"\n [optionsTrackProperty]=\"descriptor.optionsTrackProperty\"\n [optionsLabelProperty]=\"descriptor.optionsLabelProperty\"\n [optionsValueProperty]=\"descriptor.optionsValueProperty\"\n [className]=\"descriptor.inputClassName\"\n [showClear]=\"!props.required\"\n [selectFirst]=\"descriptor.autocompleteSelectFirst ?? false\"\n [autoClear]=\"descriptor.autocompleteAutoClear ?? false\"\n [openOnFocus]=\"descriptor.autocompleteAutoClear ?? true\"\n [inlineSearch]=\"descriptor.autocompleteInlineSearch ?? false\">\n</mng-autocomplete>\n", dependencies: [{ kind: "component", type: AutocompleteComponent, selector: "mng-autocomplete", inputs: ["dataProvider", "optionsTrackProperty", "optionsValueProperty", "optionsLabelProperty", "optionsLabelTranslate", "inlineSearch", "openOnFocus", "multiselect", "placeholder", "className", "dropdownClassName", "showClear", "autoClear", "selectFirst", "searchTrim", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3195
3200
|
}
|
|
3196
3201
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldAutocompleteComponent, decorators: [{
|
|
3197
3202
|
type: Component,
|
|
@@ -3220,7 +3225,7 @@ class FormlyFieldCustomComponent extends FieldType {
|
|
|
3220
3225
|
};
|
|
3221
3226
|
}
|
|
3222
3227
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldCustomComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3223
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldCustomComponent, isStandalone: true, selector: "mng-formly-field-custom", usesInheritance: true, ngImport: i0, template: ` <ng-container [mngComponent]="descriptor.customComponentType!" [inputs]="inputs"></ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "
|
|
3228
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldCustomComponent, isStandalone: true, selector: "mng-formly-field-custom", usesInheritance: true, ngImport: i0, template: ` <ng-container [mngComponent]="descriptor.customComponentType!" [inputs]="inputs"></ng-container> `, isInline: true, dependencies: [{ kind: "directive", type: ComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "injectionToken", "inputs", "attachToHost", "parentInjector"], outputs: ["instanceCreated"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3224
3229
|
}
|
|
3225
3230
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldCustomComponent, decorators: [{
|
|
3226
3231
|
type: Component,
|
|
@@ -3236,34 +3241,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3236
3241
|
class FormlyFieldDropdownComponent extends FieldType {
|
|
3237
3242
|
constructor() {
|
|
3238
3243
|
super(...arguments);
|
|
3239
|
-
this.
|
|
3244
|
+
this.destroyRef = inject(DestroyRef);
|
|
3240
3245
|
}
|
|
3241
3246
|
ngOnInit() {
|
|
3242
3247
|
this.dFormControl = this.formControl;
|
|
3243
3248
|
this.descriptor = this.props.descriptor;
|
|
3244
3249
|
this.props.fieldComponent = this;
|
|
3245
3250
|
// emit lifecycle event
|
|
3246
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3251
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3247
3252
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3248
3253
|
});
|
|
3249
|
-
|
|
3250
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3254
|
+
this.dFormControl.valueChanges.pipe(startWith(this.dFormControl.value), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3255
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3251
3256
|
value: v
|
|
3252
3257
|
});
|
|
3253
3258
|
this.props.onValueChange?.(this.field, v);
|
|
3254
3259
|
});
|
|
3255
|
-
this.subscriptions.push(subscription);
|
|
3256
3260
|
}
|
|
3257
3261
|
ngOnDestroy() {
|
|
3258
|
-
// warning: formly calls on destroy before on init
|
|
3259
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3260
3262
|
// emit lifecycle event
|
|
3261
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3263
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3262
3264
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3263
3265
|
});
|
|
3264
3266
|
}
|
|
3265
3267
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3266
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldDropdownComponent, isStandalone: true, selector: "mng-formly-field-dropdown", usesInheritance: true, ngImport: i0, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"descriptor.placeholder\"\n [dataProvider]=\"descriptor.dataProvider\"\n [optionsLabelProperty]=\"descriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"descriptor.optionsLabelTranslate\"\n [optionsValueProperty]=\"descriptor.optionsValueProperty\"\n [optionsDisabledProperty]=\"descriptor.optionsDisabledProperty\"\n [optionsTrackProperty]=\"descriptor.optionsTrackProperty\"\n [showClear]=\"!props.required\"\n [className]=\"descriptor.inputClassName\">\n</mng-dropdown>\n", dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur"], outputs: ["valueChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
3268
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldDropdownComponent, isStandalone: true, selector: "mng-formly-field-dropdown", usesInheritance: true, ngImport: i0, template: "<mng-dropdown\n [id]=\"$any(key)\"\n [formControl]=\"dFormControl\"\n [formlyAttributes]=\"field\"\n [placeholder]=\"descriptor.placeholder\"\n [dataProvider]=\"descriptor.dataProvider\"\n [optionsLabelProperty]=\"descriptor.optionsLabelProperty\"\n [optionsLabelTranslate]=\"descriptor.optionsLabelTranslate\"\n [optionsValueProperty]=\"descriptor.optionsValueProperty\"\n [optionsDisabledProperty]=\"descriptor.optionsDisabledProperty\"\n [optionsTrackProperty]=\"descriptor.optionsTrackProperty\"\n [showClear]=\"!props.required\"\n [className]=\"descriptor.inputClassName\">\n</mng-dropdown>\n", dependencies: [{ kind: "component", type: DropdownComponent, selector: "mng-dropdown", inputs: ["dataProvider", "options", "optionsTrackProperty", "optionsLabelProperty", "optionsLabelTranslate", "optionsValueProperty", "optionsDisabledProperty", "multiselect", "placeholder", "showClear", "selectFirstItem", "className", "dropdownClassName", "changeValueOnBlur", "loading", "disabled"], outputs: ["valueChange", "blur"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3267
3269
|
}
|
|
3268
3270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDropdownComponent, decorators: [{
|
|
3269
3271
|
type: Component,
|
|
@@ -3322,11 +3324,11 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3322
3324
|
}
|
|
3323
3325
|
}
|
|
3324
3326
|
// emit lifecycle event
|
|
3325
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3327
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3326
3328
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3327
3329
|
});
|
|
3328
3330
|
this.formControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(this.formControl.value), distinctUntilChanged()).subscribe(v => {
|
|
3329
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3331
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3330
3332
|
value: v
|
|
3331
3333
|
});
|
|
3332
3334
|
this.props.onValueChange?.(this.field, v);
|
|
@@ -3362,7 +3364,7 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3362
3364
|
ngOnDestroy() {
|
|
3363
3365
|
// warning: formly calls on destroy before on init
|
|
3364
3366
|
// emit lifecycle event
|
|
3365
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3367
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3366
3368
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3367
3369
|
});
|
|
3368
3370
|
}
|
|
@@ -3434,7 +3436,7 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3434
3436
|
}
|
|
3435
3437
|
}
|
|
3436
3438
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3437
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldInputComponent, isStandalone: true, selector: "mng-formly-field-input", usesInheritance: true, ngImport: i0, template: "@switch (props.type) {\n @case ('number') {\n <p-inputNumber\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"descriptor.numberAutoCorrect ? descriptor.numberMin ?? NUMBER_MIN_SAFE : undefined\"\n [max]=\"descriptor.numberAutoCorrect ? descriptor.numberMax ?? NUMBER_MAX_SAFE : undefined\"\n [step]=\"$any(descriptor.numberStep)\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\"\n [inputStyleClass]=\"descriptor.inputClassName\"\n [locale]=\"descriptor.locale ?? applicationLocale\"\n [mode]=\"numberFieldMode\"\n [currency]=\"currency\"\n [currencyDisplay]=\"descriptor.currencyDisplay\">\n </p-inputNumber>\n }\n\n @case ('switch') {\n <div class=\"field flex flex-column\">\n <label [for]=\"key\" [class]=\"descriptor.labelClassName\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [styleClass]=\"descriptor.inputClassName\"></p-inputSwitch>\n @if (showError) {\n <small class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n </div>\n }\n @case ('radio') {\n @for (option of descriptor.radioOptions; track option) {\n <div [id]=\"key\" class=\"field-radiobutton\">\n <p-radioButton\n [name]=\"$any(key)\"\n [value]=\"option.value\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [styleClass]=\"descriptor.inputClassName\"></p-radioButton>\n <label [for]=\"option.value\" [class]=\"'mng-radio-button-label ' + descriptor.labelClassName\">{{ option.title | translate }}</label>\n </div>\n }\n }\n @case ('textarea') {\n <textarea [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea [class]=\"descriptor.inputClassName\">\n </textarea>\n }\n @case ('mask') {\n <p-inputMask\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [mask]=\"descriptor.mask\"\n [placeholder]=\"descriptor.placeholder\"\n [slotChar]=\"$any(descriptor.slotChar)\"\n [styleClass]=\"descriptor.inputClassName\">\n </p-inputMask>\n }\n @case ('file') {\n <p-fileUpload\n #fileUploadInput\n [id]=\"$any(key)\"\n [disabled]=\"iFormControl.disabled\"\n [multiple]=\"descriptor.fileMultiple ?? false\"\n [accept]=\"descriptor.fileAccept ?? (descriptor.fieldType === DESC_INPUT_TYPE_IMAGE_FILE ? 'image/*' : undefined)\"\n [maxFileSize]=\"descriptor.fileMaxFileSize ?? 500000\"\n [showUploadButton]=\"false\"\n (onSelect)=\"onFileSelect($event)\"\n (onRemove)=\"onFileRemove($event)\"\n (onClear)=\"onFileClear($event)\">\n <ng-template let-file let-idx=\"index\" pTemplate=\"file\">\n <div class=\"p-fileupload-row\">\n <div>\n @if (fileUploadInput.isImage(file)) {\n @if (isFileImageSvg(file)) {\n <span class=\"flex align-items-center justify-content-center\">\n <i class=\"pi pi-image text-2xl\"></i>\n </span>\n } @else {\n <img [src]=\"file.objectURL\" [width]=\"fileUploadInput.previewWidth\" (error)=\"fileUploadInput.imageError($event)\" />\n }\n } @else {\n <span class=\"flex align-items-center justify-content-center\">\n <i [class]=\"'pi ' + getFileDocumentTypeIcon(file) + ' text-2xl'\"></i>\n </span>\n }\n </div>\n <div class=\"p-fileupload-filename\">{{ file.name }}</div>\n <div>{{ fileUploadInput.formatSize(file.size) }}</div>\n <div>\n <button\n type=\"button\"\n pButton\n (click)=\"fileUploadInput.remove($event, idx)\"\n [disabled]=\"fileUploadInput.uploading\"\n class=\"p-button-icon-only\"\n [class]=\"fileUploadInput.removeStyleClass\">\n @if (!fileUploadInput.cancelIconTemplate) {\n <TimesIcon />\n }\n </button>\n </div>\n </div>\n </ng-template>\n <ng-template pTemplate=\"content\" let-files>\n @if (files.length === 0) {\n <div class=\"text-gray-300 dropdown-area\">\n <span><i class=\"pi pi-file-import mr-2\"></i>{{ 'fileUpload.dragAndDrop' | translate }}</span>\n </div>\n }\n </ng-template>\n </p-fileUpload>\n }\n @case ('imageUrl') {\n <div>\n @if (descriptor.imagePreview) {\n <div class=\"flex flex-wrap justify-content-start\">\n @for (image of imageFormArray.controls; track image; let idx = $index) {\n @if (imageFormArray.at(idx).valid && imageFormArray.at(idx).value) {\n <p-image [src]=\"imageFormArray.at(idx).value\" [preview]=\"true\" (onImageError)=\"onImageUrlLoadError()\" styleClass=\"mng-image m-2\"></p-image>\n } @else {\n <span class=\"mng-image m-2 p-image-preview-container no-image\">\n <div class=\"p-image-preview-indicator\">\n <i class=\"p-image-preview-icon pi pi-ban\"></i>\n </div>\n </span>\n }\n }\n </div>\n }\n @if (!descriptor.imagePreview || descriptor.imageUrlInputVisibleOnDisabled || !iFormControl.disabled) {\n @for (imageCtrlName of imageFormArray.controls; track imageCtrlName; let idx = $index) {\n <div class=\"p-inputgroup mt-1\">\n <input\n pInputText\n [placeholder]=\"'mngEditor.imageUrlPlaceholder' | translate\"\n [id]=\"$any(key)\"\n type=\"text\"\n [formControl]=\"$any(imageFormArray.at(idx))\"\n [formlyAttributes]=\"field\" />\n @if (descriptor.fileMultiple && !iFormControl.disabled) {\n <button type=\"button\" pButton pRipple icon=\"pi pi-minus\" (click)=\"removeImageUrlAt(idx)\"></button>\n }\n </div>\n }\n @if (descriptor.fileMultiple && !iFormControl.disabled) {\n <button\n type=\"button\"\n pButton\n pRipple\n icon=\"pi pi-plus\"\n class=\"p-button-primary w-auto mt-1\"\n [label]=\"'mngEditor.imageUrlAdd' | translate\"\n (click)=\"addImageUrl()\"></button>\n }\n }\n </div>\n }\n @default {\n <input pInputText [id]=\"$any(key)\" [type]=\"props.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [mngInputTrim]=\"descriptor.trimOption\" />\n }\n}\n", dependencies: [{ kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i1$5.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: InputSwitchModule }, { kind: "component", type: i6.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy"], outputs: ["onChange"] }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i7$1.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i8$1.InputMask, selector: "p-inputMask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autoFocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FileUploadModule }, { kind: "component", type: i9$1.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "uploadStyleClass", "cancelStyleClass", "removeStyleClass", "chooseStyleClass", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler", "onImageError"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: ImageModule }, { kind: "component", type: i11.Image, selector: "p-image", inputs: ["imageClass", "imageStyle", "styleClass", "style", "src", "srcSet", "sizes", "previewImageSrc", "previewImageSrcSet", "previewImageSizes", "alt", "width", "height", "loading", "appendTo", "preview", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide", "onImageError"] }, { kind: "ngmodule", type: InputTextareaModule }, { kind: "directive", type: i12.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i13.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "component", type: TimesIcon, selector: "TimesIcon" }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3439
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldInputComponent, isStandalone: true, selector: "mng-formly-field-input", usesInheritance: true, ngImport: i0, template: "@switch (props.type) {\n @case ('number') {\n <p-inputNumber\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [min]=\"descriptor.numberAutoCorrect ? descriptor.numberMin ?? NUMBER_MIN_SAFE : undefined\"\n [max]=\"descriptor.numberAutoCorrect ? descriptor.numberMax ?? NUMBER_MAX_SAFE : undefined\"\n [step]=\"$any(descriptor.numberStep)\"\n [useGrouping]=\"descriptor.numberUseGrouping\"\n [minFractionDigits]=\"descriptor.numberMinFractionDigits || 0\"\n [maxFractionDigits]=\"descriptor.numberMaxFractionDigits || 0\"\n [inputStyleClass]=\"descriptor.inputClassName\"\n [locale]=\"descriptor.locale ?? applicationLocale\"\n [mode]=\"numberFieldMode\"\n [currency]=\"currency\"\n [currencyDisplay]=\"descriptor.currencyDisplay\">\n </p-inputNumber>\n }\n\n @case ('switch') {\n <div class=\"field flex flex-column\">\n <label [for]=\"key\" [class]=\"descriptor.labelClassName\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n <p-inputSwitch [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [styleClass]=\"descriptor.inputClassName\"></p-inputSwitch>\n @if (showError) {\n <small class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n </div>\n }\n @case ('radio') {\n @for (option of descriptor.radioOptions; track option) {\n <div [id]=\"key\" class=\"field-radiobutton\">\n <p-radioButton\n [name]=\"$any(key)\"\n [value]=\"option.value\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [styleClass]=\"descriptor.inputClassName\"></p-radioButton>\n <label [for]=\"option.value\" [class]=\"'mng-radio-button-label ' + descriptor.labelClassName\">{{ option.title | translate }}</label>\n </div>\n }\n }\n @case ('textarea') {\n <textarea [id]=\"$any(key)\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [rows]=\"descriptor.rows ?? 3\" pInputTextarea [class]=\"descriptor.inputClassName\">\n </textarea>\n }\n @case ('mask') {\n <p-inputMask\n [id]=\"$any(key)\"\n [formControl]=\"iFormControl\"\n [formlyAttributes]=\"field\"\n [mask]=\"descriptor.mask\"\n [placeholder]=\"descriptor.placeholder\"\n [slotChar]=\"$any(descriptor.slotChar)\"\n [styleClass]=\"descriptor.inputClassName\">\n </p-inputMask>\n }\n @case ('file') {\n <p-fileUpload\n #fileUploadInput\n [id]=\"$any(key)\"\n [disabled]=\"iFormControl.disabled\"\n [multiple]=\"descriptor.fileMultiple ?? false\"\n [accept]=\"descriptor.fileAccept ?? (descriptor.fieldType === DESC_INPUT_TYPE_IMAGE_FILE ? 'image/*' : undefined)\"\n [maxFileSize]=\"descriptor.fileMaxFileSize ?? 500000\"\n [showUploadButton]=\"false\"\n (onSelect)=\"onFileSelect($event)\"\n (onRemove)=\"onFileRemove($event)\"\n (onClear)=\"onFileClear($event)\">\n <ng-template let-file let-idx=\"index\" pTemplate=\"file\">\n <div class=\"p-fileupload-row\">\n <div>\n @if (fileUploadInput.isImage(file)) {\n @if (isFileImageSvg(file)) {\n <span class=\"flex align-items-center justify-content-center\">\n <i class=\"pi pi-image text-2xl\"></i>\n </span>\n } @else {\n <img [src]=\"file.objectURL\" [width]=\"fileUploadInput.previewWidth\" (error)=\"fileUploadInput.imageError($event)\" />\n }\n } @else {\n <span class=\"flex align-items-center justify-content-center\">\n <i [class]=\"'pi ' + getFileDocumentTypeIcon(file) + ' text-2xl'\"></i>\n </span>\n }\n </div>\n <div class=\"p-fileupload-filename\">{{ file.name }}</div>\n <div>{{ fileUploadInput.formatSize(file.size) }}</div>\n <div>\n <button\n type=\"button\"\n pButton\n (click)=\"fileUploadInput.remove($event, idx)\"\n [disabled]=\"fileUploadInput.uploading\"\n class=\"p-button-icon-only\"\n [class]=\"fileUploadInput.removeStyleClass\">\n @if (!fileUploadInput.cancelIconTemplate) {\n <TimesIcon />\n }\n </button>\n </div>\n </div>\n </ng-template>\n <ng-template pTemplate=\"content\" let-files>\n @if (files.length === 0) {\n <div class=\"text-gray-300 dropdown-area\">\n <span><i class=\"pi pi-file-import mr-2\"></i>{{ 'fileUpload.dragAndDrop' | translate }}</span>\n </div>\n }\n </ng-template>\n </p-fileUpload>\n }\n @case ('imageUrl') {\n <div>\n @if (descriptor.imagePreview) {\n <div class=\"flex flex-wrap justify-content-start\">\n @for (image of imageFormArray.controls; track image; let idx = $index) {\n @if (imageFormArray.at(idx).valid && imageFormArray.at(idx).value) {\n <p-image [src]=\"imageFormArray.at(idx).value\" [preview]=\"true\" (onImageError)=\"onImageUrlLoadError()\" styleClass=\"mng-image m-2\"></p-image>\n } @else {\n <span class=\"mng-image m-2 p-image-preview-container no-image\">\n <div class=\"p-image-preview-indicator\">\n <i class=\"p-image-preview-icon pi pi-ban\"></i>\n </div>\n </span>\n }\n }\n </div>\n }\n @if (!descriptor.imagePreview || descriptor.imageUrlInputVisibleOnDisabled || !iFormControl.disabled) {\n @for (imageCtrlName of imageFormArray.controls; track imageCtrlName; let idx = $index) {\n <div class=\"p-inputgroup mt-1\">\n <input\n pInputText\n [placeholder]=\"'mngEditor.imageUrlPlaceholder' | translate\"\n [id]=\"$any(key)\"\n type=\"text\"\n [formControl]=\"$any(imageFormArray.at(idx))\"\n [formlyAttributes]=\"field\" />\n @if (descriptor.fileMultiple && !iFormControl.disabled) {\n <button type=\"button\" pButton pRipple icon=\"pi pi-minus\" (click)=\"removeImageUrlAt(idx)\"></button>\n }\n </div>\n }\n @if (descriptor.fileMultiple && !iFormControl.disabled) {\n <button\n type=\"button\"\n pButton\n pRipple\n icon=\"pi pi-plus\"\n class=\"p-button-primary w-auto mt-1\"\n [label]=\"'mngEditor.imageUrlAdd' | translate\"\n (click)=\"addImageUrl()\"></button>\n }\n }\n </div>\n }\n @default {\n <input pInputText [id]=\"$any(key)\" [type]=\"props.type || 'text'\" [formControl]=\"iFormControl\" [formlyAttributes]=\"field\" [mngInputTrim]=\"descriptor.trimOption\" />\n }\n}\n", dependencies: [{ kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i1$5.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: InputSwitchModule }, { kind: "component", type: i6.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy"], outputs: ["onChange"] }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i7$1.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i8$1.InputMask, selector: "p-inputMask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autoFocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FileUploadModule }, { kind: "component", type: i9$1.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "uploadStyleClass", "cancelStyleClass", "removeStyleClass", "chooseStyleClass", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler", "onImageError"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: ImageModule }, { kind: "component", type: i11.Image, selector: "p-image", inputs: ["imageClass", "imageStyle", "styleClass", "style", "src", "srcSet", "sizes", "previewImageSrc", "previewImageSrcSet", "previewImageSizes", "alt", "width", "height", "loading", "appendTo", "preview", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide", "onImageError"] }, { kind: "ngmodule", type: InputTextareaModule }, { kind: "directive", type: i12.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i13.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "component", type: TimesIcon, selector: "TimesIcon" }, { kind: "directive", type: InputTrimDirective, selector: "[mngInputTrim]", inputs: ["mngInputTrim"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3438
3440
|
}
|
|
3439
3441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldInputComponent, decorators: [{
|
|
3440
3442
|
type: Component,
|
|
@@ -3481,6 +3483,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3481
3483
|
constructor(injector) {
|
|
3482
3484
|
super();
|
|
3483
3485
|
this.injector = injector;
|
|
3486
|
+
this.destroyRef = inject(DestroyRef);
|
|
3484
3487
|
this.logger = inject(LoggerService).create('FormlyFieldLookupDialogComponent');
|
|
3485
3488
|
this.fieldLabelFormControl = new FormControl();
|
|
3486
3489
|
this.addItemsSubject = new ReplaySubject(1);
|
|
@@ -3493,13 +3496,12 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3493
3496
|
this.dialogSelectedItem = null;
|
|
3494
3497
|
this.dialogMessages = [];
|
|
3495
3498
|
this.dialogIsLoading$ = this.dialogIsLoadingSubject.asObservable();
|
|
3496
|
-
this.subscriptions = [];
|
|
3497
3499
|
}
|
|
3498
3500
|
ngOnInit() {
|
|
3499
3501
|
this.descriptor = this.props.descriptor;
|
|
3500
3502
|
this.props.fieldComponent = this;
|
|
3501
3503
|
// emit lifecycle event
|
|
3502
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3504
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3503
3505
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3504
3506
|
});
|
|
3505
3507
|
this.config = this.descriptor.config;
|
|
@@ -3509,7 +3511,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3509
3511
|
}
|
|
3510
3512
|
// init values
|
|
3511
3513
|
this.setFieldLabelValue(this.formControl.value);
|
|
3512
|
-
|
|
3514
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), distinctUntilChanged((prev, curr) => {
|
|
3513
3515
|
const compareProp = this.descriptor.dialogTableDescriptor.trackProperty ?? this.descriptor.dialogTableDescriptor.model.idProperty;
|
|
3514
3516
|
if (compareProp && typeof prev === 'object' && typeof curr === 'object') {
|
|
3515
3517
|
return prev[compareProp] === curr[compareProp];
|
|
@@ -3517,26 +3519,23 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3517
3519
|
else {
|
|
3518
3520
|
return prev === curr;
|
|
3519
3521
|
}
|
|
3520
|
-
})).subscribe(v => {
|
|
3522
|
+
}), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3521
3523
|
this.setFieldLabelValue(v);
|
|
3522
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3524
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3523
3525
|
value: v
|
|
3524
3526
|
});
|
|
3525
3527
|
this.props.onValueChange?.(this.field, v);
|
|
3526
3528
|
});
|
|
3527
|
-
this.subscriptions.push(subscription);
|
|
3528
3529
|
}
|
|
3529
3530
|
ngAfterViewInit() {
|
|
3530
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3531
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3531
3532
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3532
3533
|
});
|
|
3533
3534
|
}
|
|
3534
3535
|
ngOnDestroy() {
|
|
3535
|
-
// warning: formly calls on destroy before on init
|
|
3536
3536
|
this.lookupDataProviderSubscription?.unsubscribe();
|
|
3537
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3538
3537
|
// emit lifecycle event
|
|
3539
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3538
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3540
3539
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3541
3540
|
});
|
|
3542
3541
|
}
|
|
@@ -3561,14 +3560,14 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3561
3560
|
this.addItemsSubject.next(dataList);
|
|
3562
3561
|
this.dialogAreItemsLoaded = true;
|
|
3563
3562
|
this.dialogIsLoadingSubject.next(false);
|
|
3564
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider,
|
|
3563
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider, this, {
|
|
3565
3564
|
eventSubtype: 'LookupNext',
|
|
3566
3565
|
queryResult: dataList
|
|
3567
3566
|
});
|
|
3568
3567
|
},
|
|
3569
3568
|
error: err => {
|
|
3570
3569
|
this.dialogIsLoadingSubject.next(false);
|
|
3571
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider,
|
|
3570
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider, this, {
|
|
3572
3571
|
eventSubtype: 'LookupError',
|
|
3573
3572
|
queryResult: err
|
|
3574
3573
|
});
|
|
@@ -3582,7 +3581,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3582
3581
|
this.dialogSelectedItem = null;
|
|
3583
3582
|
this.isDialogVisible = true;
|
|
3584
3583
|
this.formControl.markAsTouched();
|
|
3585
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3584
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3586
3585
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3587
3586
|
dialogVisible: true
|
|
3588
3587
|
});
|
|
@@ -3591,13 +3590,13 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3591
3590
|
this.dialogSelectedItem = item;
|
|
3592
3591
|
}
|
|
3593
3592
|
onCaptionCmpInst(instance) {
|
|
3594
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3593
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3595
3594
|
eventSubtype: FormFieldEventDialogSubtype.TABLE_CAPTION_COMPONENT_INSTANCE,
|
|
3596
3595
|
captionComponentInstance: instance
|
|
3597
3596
|
});
|
|
3598
3597
|
}
|
|
3599
3598
|
onColumnActionCmpInst(instance) {
|
|
3600
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3599
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3601
3600
|
eventSubtype: FormFieldEventDialogSubtype.TABLE_COLUMN_ACTIONS_COMPONENT_INSTANCE,
|
|
3602
3601
|
captionComponentInstance: instance
|
|
3603
3602
|
});
|
|
@@ -3612,7 +3611,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3612
3611
|
}
|
|
3613
3612
|
hideDialog() {
|
|
3614
3613
|
this.isDialogVisible = false;
|
|
3615
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3614
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3616
3615
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3617
3616
|
dialogVisible: false
|
|
3618
3617
|
});
|
|
@@ -3642,7 +3641,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3642
3641
|
}
|
|
3643
3642
|
}
|
|
3644
3643
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldLookupDialogComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3645
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldLookupDialogComponent, isStandalone: true, selector: "mng-formly-field-lookup-dialog", providers: [provideViewContainer(false)], viewQueries: [{ propertyName: "table", first: true, predicate: TableComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"'p-inputgroup mng-dropdown-dialog' + descriptor.inputClassName\" [class.p-inputtext-sm]=\"descriptor.isSizeSmall\" [class.p-inputtext-lg]=\"descriptor.isSizeLarge\">\n <input pInputText type=\"text\" [id]=\"$any(key)\" [readonly]=\"true\" [formlyAttributes]=\"field\" [formControl]=\"fieldLabelFormControl\" />\n @if (!props.required && formControl.value && !formControl.disabled) {\n <i class=\"mng-dropdown-clear-icon pi pi-times\" (click)=\"clear()\"></i>\n }\n <button\n pButton\n pRipple\n class=\"mng-dropdown-dialog-search-button\"\n type=\"button\"\n [label]=\"'general.search' | translate: {item: ''}\"\n [disabled]=\"formControl.disabled\"\n (click)=\"openSelectDialog()\"></button>\n</div>\n\n<p-dialog\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.search' | translate: {item: props.label!}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-formly-field-lookup-dialog\">\n <ng-template pTemplate=\"content\" mngDialogKeydownHandler>\n <mng-table\n [descriptor]=\"descriptor.dialogTableDescriptor!\"\n [dataProvider]=\"descriptor.dialogTableDataProvider\"\n [result]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [selectionMode]=\"'single'\"\n [loading]=\"dialogIsLoading$\"\n [captionComponent]=\"config.table?.captionComponent\"\n [columnCustomLastComponent]=\"config.table?.columnActionComponent\"\n (selectionChange)=\"onSelectionChange($event)\"\n (captionComponentInstance)=\"onCaptionCmpInst($event)\"\n (columnCustomLastComponentInstance)=\"onColumnActionCmpInst($event)\">\n </mng-table>\n <p-messages [value]=\"dialogMessages\"></p-messages>\n </ng-template>\n\n <ng-template pTemplate=\"footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.select' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-text\"\n (click)=\"addItem()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"form.disabled\"></button>\n </ng-template>\n</p-dialog>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
3644
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldLookupDialogComponent, isStandalone: true, selector: "mng-formly-field-lookup-dialog", providers: [provideViewContainer(false)], viewQueries: [{ propertyName: "table", first: true, predicate: TableComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"'p-inputgroup mng-dropdown-dialog' + descriptor.inputClassName\" [class.p-inputtext-sm]=\"descriptor.isSizeSmall\" [class.p-inputtext-lg]=\"descriptor.isSizeLarge\">\n <input pInputText type=\"text\" [id]=\"$any(key)\" [readonly]=\"true\" [formlyAttributes]=\"field\" [formControl]=\"fieldLabelFormControl\" />\n @if (!props.required && formControl.value && !formControl.disabled) {\n <i class=\"mng-dropdown-clear-icon pi pi-times\" (click)=\"clear()\"></i>\n }\n <button\n pButton\n pRipple\n class=\"mng-dropdown-dialog-search-button\"\n type=\"button\"\n [label]=\"'general.search' | translate: {item: ''}\"\n [disabled]=\"formControl.disabled\"\n (click)=\"openSelectDialog()\"></button>\n</div>\n\n<p-dialog\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.search' | translate: {item: props.label!}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-formly-field-lookup-dialog\">\n <ng-template pTemplate=\"content\" mngDialogKeydownHandler>\n <mng-table\n [descriptor]=\"descriptor.dialogTableDescriptor!\"\n [dataProvider]=\"descriptor.dialogTableDataProvider\"\n [result]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [selectionMode]=\"'single'\"\n [loading]=\"dialogIsLoading$\"\n [captionComponent]=\"config.table?.captionComponent\"\n [columnCustomLastComponent]=\"config.table?.columnActionComponent\"\n (selectionChange)=\"onSelectionChange($event)\"\n (captionComponentInstance)=\"onCaptionCmpInst($event)\"\n (columnCustomLastComponentInstance)=\"onColumnActionCmpInst($event)\">\n </mng-table>\n <p-messages [value]=\"dialogMessages\"></p-messages>\n </ng-template>\n\n <ng-template pTemplate=\"footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.select' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-text\"\n (click)=\"addItem()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"form.disabled\"></button>\n </ng-template>\n</p-dialog>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i7$2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: TableComponent, selector: "mng-table", inputs: ["descriptor", "items", "result", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "columnLastMinWidth", "captionComponent", "columnCustomLastComponent", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnCustomLastComponentInstance"] }, { kind: "ngmodule", type: MessagesModule }, { kind: "component", type: i3$1.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i13.InputText, selector: "[pInputText]" }, { kind: "directive", type: DialogKeydownHandlerDirective, selector: "[mngDialogKeydownHandler]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3646
3645
|
}
|
|
3647
3646
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldLookupDialogComponent, decorators: [{
|
|
3648
3647
|
type: Component,
|
|
@@ -3665,14 +3664,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3665
3664
|
}] } });
|
|
3666
3665
|
|
|
3667
3666
|
class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
3668
|
-
constructor(
|
|
3669
|
-
super();
|
|
3670
|
-
this.injector =
|
|
3667
|
+
constructor() {
|
|
3668
|
+
super(...arguments);
|
|
3669
|
+
this.injector = inject(Injector);
|
|
3670
|
+
this.destroyRef = inject(DestroyRef);
|
|
3671
3671
|
this.itemsSubject = new ReplaySubject(1);
|
|
3672
3672
|
this.items$ = this.itemsSubject.asObservable();
|
|
3673
3673
|
this.actions = [];
|
|
3674
3674
|
this.toolbarRightActions = [];
|
|
3675
|
-
this.subscriptions = [];
|
|
3676
3675
|
this.isDisabledSubject = new BehaviorSubject(false);
|
|
3677
3676
|
this.isEnabled$ = this.isDisabledSubject.asObservable().pipe(distinctUntilChanged(), map(e => !e));
|
|
3678
3677
|
}
|
|
@@ -3694,7 +3693,7 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3694
3693
|
this.formControl.markAsTouched();
|
|
3695
3694
|
return of(ctx.parameters.item || {});
|
|
3696
3695
|
});
|
|
3697
|
-
viewAction.withEditorActions([
|
|
3696
|
+
viewAction.withEditorActions([actionEditorCancel(viewAction)]);
|
|
3698
3697
|
viewAction.button.withLabel(null);
|
|
3699
3698
|
this.actions.push(viewAction);
|
|
3700
3699
|
}
|
|
@@ -3761,7 +3760,8 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3761
3760
|
this.actions.push(editAction);
|
|
3762
3761
|
}
|
|
3763
3762
|
if (hasDeleteAction) {
|
|
3764
|
-
const deleteAction =
|
|
3763
|
+
const deleteAction = new ActionDescriptorInst('delete', {
|
|
3764
|
+
model: this.descriptor.tableviewDescriptor.model,
|
|
3765
3765
|
parentType: this.descriptor.editor.model.type,
|
|
3766
3766
|
parentProperty: this.descriptor.property
|
|
3767
3767
|
})
|
|
@@ -3814,20 +3814,19 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3814
3814
|
this.formControl.patchValue([]);
|
|
3815
3815
|
}
|
|
3816
3816
|
// emit lifecycle event
|
|
3817
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3817
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3818
3818
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3819
3819
|
});
|
|
3820
|
-
|
|
3820
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3821
3821
|
this.itemsSubject.next(v ?? []);
|
|
3822
3822
|
// emit lifecycle event
|
|
3823
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3823
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3824
3824
|
value: v
|
|
3825
3825
|
});
|
|
3826
3826
|
this.props.onValueChange?.(this.field, v);
|
|
3827
3827
|
});
|
|
3828
|
-
this.subscriptions.push(subscription);
|
|
3829
3828
|
this.isDisabledSubject.next(this.formControl.disabled);
|
|
3830
|
-
|
|
3829
|
+
this.formControl.statusChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(status => {
|
|
3831
3830
|
if (status === 'DISABLED' && !this.isDisabledSubject.value) {
|
|
3832
3831
|
this.isDisabledSubject.next(true);
|
|
3833
3832
|
}
|
|
@@ -3835,41 +3834,39 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3835
3834
|
this.isDisabledSubject.next(false);
|
|
3836
3835
|
}
|
|
3837
3836
|
});
|
|
3838
|
-
this.subscriptions.push(subscription);
|
|
3839
3837
|
}
|
|
3840
3838
|
ngAfterViewInit() {
|
|
3841
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3839
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3842
3840
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3843
3841
|
});
|
|
3844
3842
|
}
|
|
3845
3843
|
ngOnDestroy() {
|
|
3846
|
-
// warning: formly calls on destroy before on init
|
|
3847
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3848
3844
|
// emit lifecycle event
|
|
3849
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3845
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3850
3846
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3851
3847
|
});
|
|
3852
3848
|
}
|
|
3853
3849
|
hideActionsForRowWithDefaultLocalization(ctx) {
|
|
3854
3850
|
if (this.descriptor.tableDescriptor.isLocalized) {
|
|
3855
|
-
if (ctx.parameters.item[this.descriptor.tableDescriptor.localizationLocaleProperty] === this.injector.get(CommonsService).
|
|
3851
|
+
if (ctx.parameters.item[this.descriptor.tableDescriptor.localizationLocaleProperty] === this.injector.get(CommonsService).getDefaultLocale()) {
|
|
3856
3852
|
return true;
|
|
3857
3853
|
}
|
|
3858
3854
|
}
|
|
3859
3855
|
return false;
|
|
3860
3856
|
}
|
|
3861
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogFormComponent, deps:
|
|
3857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3862
3858
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldTableDialogFormComponent, isStandalone: true, selector: "mng-formly-table-dialog-form-field", providers: [provideViewContainer(false)], usesInheritance: true, ngImport: i0, template: "<mng-action-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n @for (action of toolbarRightActions; track action) {\n <mng-action [action]=\"action\"></mng-action>\n }\n </div>\n </ng-template>\n</mng-action-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "component", type: ActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "dataListParams", "dataProvider", "hostComponent", "route", "disabled", "loading", "selectedItems"], outputs: ["finish"] }, { kind: "component", type: ActionTableComponent, selector: "mng-action-table", inputs: ["descriptor", "items", "result", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "globalFilterFields", "actions", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "directive", type: TemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3863
3859
|
}
|
|
3864
3860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogFormComponent, decorators: [{
|
|
3865
3861
|
type: Component,
|
|
3866
3862
|
args: [{ standalone: true, selector: 'mng-formly-table-dialog-form-field', imports: [TranslateModule, ActionComponent, ActionTableComponent, TemplateDirective], providers: [provideViewContainer(false)], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-action-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n @for (action of toolbarRightActions; track action) {\n <mng-action [action]=\"action\"></mng-action>\n }\n </div>\n </ng-template>\n</mng-action-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"] }]
|
|
3867
|
-
}]
|
|
3863
|
+
}] });
|
|
3868
3864
|
|
|
3869
3865
|
class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
3870
|
-
constructor(
|
|
3871
|
-
super();
|
|
3872
|
-
this.injector =
|
|
3866
|
+
constructor() {
|
|
3867
|
+
super(...arguments);
|
|
3868
|
+
this.injector = inject(Injector);
|
|
3869
|
+
this.destroyRef = inject(DestroyRef);
|
|
3873
3870
|
this.logger = inject(LoggerService).create('FormlyFieldTableDialogMultiselectComponent');
|
|
3874
3871
|
this.itemsSubject = new ReplaySubject(1);
|
|
3875
3872
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
@@ -3884,7 +3881,6 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3884
3881
|
this.hasAddAction = false;
|
|
3885
3882
|
this.hasDeleteAction = false;
|
|
3886
3883
|
this.searchDebounceSubject = new Subject();
|
|
3887
|
-
this.subscriptions = [];
|
|
3888
3884
|
}
|
|
3889
3885
|
ngOnInit() {
|
|
3890
3886
|
this.descriptor = this.props.descriptor;
|
|
@@ -3900,34 +3896,31 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3900
3896
|
this.formControl.patchValue([]);
|
|
3901
3897
|
}
|
|
3902
3898
|
// emit lifecycle event
|
|
3903
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3899
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3904
3900
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3905
3901
|
});
|
|
3906
|
-
|
|
3902
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3907
3903
|
this.itemsSubject.next(v ?? []);
|
|
3908
3904
|
// emit lifecycle event
|
|
3909
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3905
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3910
3906
|
value: v ?? []
|
|
3911
3907
|
});
|
|
3912
3908
|
this.props.onValueChange?.(this.field, v);
|
|
3913
3909
|
});
|
|
3914
|
-
this.
|
|
3910
|
+
this.searchDebounceSubject.pipe(debounceTime(200), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(query => {
|
|
3915
3911
|
this.addTableComponent?.primeTable.filterGlobal(query, 'contains');
|
|
3916
|
-
})
|
|
3917
|
-
this.subscriptions.push(subscription);
|
|
3912
|
+
});
|
|
3918
3913
|
}
|
|
3919
3914
|
ngAfterViewInit() {
|
|
3920
3915
|
// emit lifecycle event
|
|
3921
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3916
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3922
3917
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3923
3918
|
});
|
|
3924
3919
|
}
|
|
3925
3920
|
ngOnDestroy() {
|
|
3926
|
-
// warning: formly calls on destroy before on init
|
|
3927
3921
|
this.lookupDataProviderSubscription?.unsubscribe();
|
|
3928
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3929
3922
|
// emit lifecycle event
|
|
3930
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3923
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3931
3924
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3932
3925
|
});
|
|
3933
3926
|
}
|
|
@@ -3980,7 +3973,7 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3980
3973
|
});
|
|
3981
3974
|
}
|
|
3982
3975
|
this.formControl.markAsTouched();
|
|
3983
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3976
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3984
3977
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3985
3978
|
dialogVisible: true
|
|
3986
3979
|
});
|
|
@@ -3990,7 +3983,7 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3990
3983
|
}
|
|
3991
3984
|
hideDialog() {
|
|
3992
3985
|
this.isDialogVisible = false;
|
|
3993
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3986
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3994
3987
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3995
3988
|
dialogVisible: false
|
|
3996
3989
|
});
|
|
@@ -4031,13 +4024,13 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
4031
4024
|
const query = event.target.value;
|
|
4032
4025
|
this.searchDebounceSubject.next(query);
|
|
4033
4026
|
}
|
|
4034
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogMultiselectComponent, deps:
|
|
4027
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogMultiselectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4035
4028
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldTableDialogMultiselectComponent, isStandalone: true, selector: "mng-formly-table-multiselect-add-field", providers: [provideViewContainer(false)], viewQueries: [{ propertyName: "addTableComponent", first: true, predicate: ["addTableComponent"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n @if (hasAddAction && !options.formState?.disabled) {\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n }\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnCustomLast\" let-item=\"rowItem\">\n @if (hasDeleteAction && !options.formState?.disabled) {\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n }\n </ng-template>\n</mng-table>\n\n@if (hasAddAction) {\n <p-dialog\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate: {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\" mngDialogKeydownHandler>\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.lookupTableDescriptor\"\n [globalFilterFields]=\"descriptor.searchFields\"\n [result]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [loading]=\"dialogIsLoading$\"\n (selectionChange)=\"onSelectionChange($event)\">\n @if (descriptor.searchEnabled) {\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex\">\n <span class=\"p-input-icon-left ml-auto\" [ngStyle]=\"{width: 'unset'}\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n </span>\n </div>\n </ng-template>\n }\n </mng-table>\n </div>\n </div>\n <div class=\"flex flex-row justify-content-end mng-formly-field-table-multiselect-dialog-footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.add' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-primary\"\n (click)=\"addItems()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"form.disabled\"></button>\n </div>\n </div>\n </ng-template>\n </p-dialog>\n}\n", styles: [".table-footer{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;align-content:center;margin-top:2rem}.table-container{overflow:hidden}.table-footer button{width:8rem}.table-footer button:not(:first-child){margin-left:1.5rem}.table-scroll{max-height:75vh;overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: TableComponent, selector: "mng-table", inputs: ["descriptor", "items", "result", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "columnLastMinWidth", "captionComponent", "columnCustomLastComponent", "globalFilterFields"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnCustomLastComponentInstance"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i7$2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i7.Ripple, selector: "[pRipple]" }, { kind: "directive", type: TemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i13.InputText, selector: "[pInputText]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: DialogKeydownHandlerDirective, selector: "[mngDialogKeydownHandler]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4036
4029
|
}
|
|
4037
4030
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogMultiselectComponent, decorators: [{
|
|
4038
4031
|
type: Component,
|
|
4039
4032
|
args: [{ standalone: true, selector: 'mng-formly-table-multiselect-add-field', imports: [TranslateModule, AsyncPipe, TableComponent, DialogModule, ButtonModule, RippleModule, TemplateDirective, InputTextModule, NgStyle, DialogKeydownHandlerDirective], providers: [provideViewContainer(false)], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table [descriptor]=\"descriptor.mainTableDescriptor\" [items]=\"itemsAsync\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-row justify-content-end align-items-center table-header pt-0\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\"\n >{{ props.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n @if (hasAddAction && !options.formState?.disabled) {\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-plus\"\n class=\"p-button-rounded mng-button-xs\"\n (click)=\"openAddDialog()\"\n [disabled]=\"formControl!.disabled\"></button>\n }\n </div>\n </ng-template>\n <ng-template mngTemplate=\"columnCustomLast\" let-item=\"rowItem\">\n @if (hasDeleteAction && !options.formState?.disabled) {\n <button\n pButton\n pRipple\n type=\"button\"\n icon=\"pi pi-trash\"\n class=\"p-button-rounded p-button-danger mng-button-xs\"\n (click)=\"removeItem(item)\"\n [disabled]=\"formControl!.disabled\"></button>\n }\n </ng-template>\n</mng-table>\n\n@if (hasAddAction) {\n <p-dialog\n [(visible)]=\"isDialogVisible\"\n [draggable]=\"false\"\n [header]=\"'general.addItem' | translate: {item: props.label! | translate}\"\n [modal]=\"true\"\n appendTo=\"body\"\n styleClass=\"p-fluid mng-dialog mng-dialog-sm mng-formly-field-table-multiselect-dialog\">\n <ng-template pTemplate=\"content\" class=\"table-container\" mngDialogKeydownHandler>\n <div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1 formly-field-table-multiselect-dialog-form-container\">\n <div class=\"mng-formly-field-table-multiselect-dialog-table\">\n <mng-table\n #addTableComponent\n [descriptor]=\"descriptor.lookupTableDescriptor\"\n [globalFilterFields]=\"descriptor.searchFields\"\n [result]=\"addItemsAsync\"\n [selectionEnabled]=\"true\"\n [loading]=\"dialogIsLoading$\"\n (selectionChange)=\"onSelectionChange($event)\">\n @if (descriptor.searchEnabled) {\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex\">\n <span class=\"p-input-icon-left ml-auto\" [ngStyle]=\"{width: 'unset'}\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onSearch($event)\" [placeholder]=\"'general.search' | translate\" />\n </span>\n </div>\n </ng-template>\n }\n </mng-table>\n </div>\n </div>\n <div class=\"flex flex-row justify-content-end mng-formly-field-table-multiselect-dialog-footer\">\n <button pButton pRipple type=\"button\" [label]=\"'general.cancel' | translate\" icon=\"pi pi-times\" class=\"p-button-text\" (click)=\"hideDialog()\"></button>\n <button\n pButton\n pRipple\n type=\"button\"\n [label]=\"'general.add' | translate\"\n icon=\"pi pi-check\"\n class=\"p-button-primary\"\n (click)=\"addItems()\"\n [loading]=\"(dialogIsLoading$ | async) ?? false\"\n loadingIcon=\"pi pi-spin pi-spinner\"\n [disabled]=\"form.disabled\"></button>\n </div>\n </div>\n </ng-template>\n </p-dialog>\n}\n", styles: [".table-footer{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-end;align-items:center;align-content:center;margin-top:2rem}.table-container{overflow:hidden}.table-footer button{width:8rem}.table-footer button:not(:first-child){margin-left:1.5rem}.table-scroll{max-height:75vh;overflow-y:auto}\n"] }]
|
|
4040
|
-
}],
|
|
4033
|
+
}], propDecorators: { addTableComponent: [{
|
|
4041
4034
|
type: ViewChild,
|
|
4042
4035
|
args: ['addTableComponent']
|
|
4043
4036
|
}] } });
|
|
@@ -4117,7 +4110,7 @@ class FormlyFieldDatepickerComponent extends FieldType {
|
|
|
4117
4110
|
this.descriptor = this.props.descriptor;
|
|
4118
4111
|
this.props.fieldComponent = this;
|
|
4119
4112
|
// emit lifecycle event
|
|
4120
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
4113
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
4121
4114
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
4122
4115
|
});
|
|
4123
4116
|
// init status changes
|
|
@@ -4151,7 +4144,7 @@ class FormlyFieldDatepickerComponent extends FieldType {
|
|
|
4151
4144
|
.subscribe(v => {
|
|
4152
4145
|
v = this.convertDateValue(v);
|
|
4153
4146
|
this.formControl.setValue(v);
|
|
4154
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
4147
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
4155
4148
|
value: v
|
|
4156
4149
|
});
|
|
4157
4150
|
this.props.onValueChange?.(this.field, v);
|
|
@@ -4180,12 +4173,12 @@ class FormlyFieldDatepickerComponent extends FieldType {
|
|
|
4180
4173
|
ngOnDestroy() {
|
|
4181
4174
|
// warning: formly calls on destroy before on init
|
|
4182
4175
|
// emit lifecycle event
|
|
4183
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
4176
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
4184
4177
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
4185
4178
|
});
|
|
4186
4179
|
}
|
|
4187
4180
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4188
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldDatepickerComponent, isStandalone: true, selector: "mng-formly-field-datepicker", usesInheritance: true, ngImport: i0, template: "<p-calendar\n appendTo=\"body\"\n [class]=\"styleClass()\"\n [formControl]=\"dpFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime ?? false\"\n [showSeconds]=\"descriptor.datePickerShowSeconds ?? false\"\n [showIcon]=\"true\"\n [inputStyleClass]=\"descriptor.inputClassName\"\n [firstDayOfWeek]=\"1\"\n (onBlur)=\"onBlur()\">\n</p-calendar>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
4181
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldDatepickerComponent, isStandalone: true, selector: "mng-formly-field-datepicker", usesInheritance: true, ngImport: i0, template: "<p-calendar\n appendTo=\"body\"\n [class]=\"styleClass()\"\n [formControl]=\"dpFormControl\"\n [formlyAttributes]=\"field\"\n [dateFormat]=\"descriptor.datePickerFormat ?? 'dd.mm.yy'\"\n [minDate]=\"$any(descriptor.datePickerMin)\"\n [maxDate]=\"$any(descriptor.datePickerMax)\"\n [showTime]=\"descriptor.datePickerShowTime ?? false\"\n [showSeconds]=\"descriptor.datePickerShowSeconds ?? false\"\n [showIcon]=\"true\"\n [inputStyleClass]=\"descriptor.inputClassName\"\n [firstDayOfWeek]=\"1\"\n (onBlur)=\"onBlur()\">\n</p-calendar>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "directive", type: i2$1.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i3$2.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4189
4182
|
}
|
|
4190
4183
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDatepickerComponent, decorators: [{
|
|
4191
4184
|
type: Component,
|
|
@@ -4488,11 +4481,11 @@ class TableviewComponent {
|
|
|
4488
4481
|
}
|
|
4489
4482
|
ngOnInit() {
|
|
4490
4483
|
if (this.viewContainer) {
|
|
4491
|
-
this.viewContainer.actions
|
|
4484
|
+
this.viewContainer.actions.set(this.actions());
|
|
4492
4485
|
}
|
|
4493
4486
|
const dataProvider = this.dataProvider();
|
|
4494
4487
|
if (this.viewContainer && dataProvider) {
|
|
4495
|
-
this.viewContainer.dataProvider
|
|
4488
|
+
this.viewContainer.dataProvider.set(dataProvider);
|
|
4496
4489
|
}
|
|
4497
4490
|
}
|
|
4498
4491
|
onTableLoad(event) {
|
|
@@ -4749,5 +4742,5 @@ function withTableview(config) {
|
|
|
4749
4742
|
* Generated bundle index. Do not edit.
|
|
4750
4743
|
*/
|
|
4751
4744
|
|
|
4752
|
-
export { ACTION_EDITOR_COMPONENT_IT, ActionComponent, ActionContext, ActionEditorComponent, ActionErrorMapperService, ActionExecutorService, ActionInstance, ActionInstanceStateEnum, ActionTableComponent, COMMONS_TABLEVIEW_FEATURE_CONFIG_IT, ComponentActionExecutorService, DataLanguageDropdownComponent, DefaultActionErrorMapperService, DefaultDataProviderExecutor, FormEditorComponent, FormlyFieldActionComponent, FormlyFieldAutocompleteComponent, FormlyFieldCustomComponent, FormlyFieldDropdownComponent, FormlyFieldFieldsetComponent, FormlyFieldInputComponent, FormlyFieldLabelComponent, FormlyFieldLookupDialogComponent, FormlyFieldNoLabelWrapperComponent, FormlyFieldTableDialogFormComponent, FormlyFieldTableDialogMultiselectComponent, FormlyFieldTabsComponent, FormlyFieldWrapperComponent, NavigationService, RootActionExecutorService, TableviewComponent, TableviewRouteBuilder, TableviewRouteComponent, ViewContainer, actionNotificationError, actionNotificationSuccess, addAsyncValidationsToFormlyField, addValidationsToFormlyField, calculateTableColumnActionWidth, commonsFormlyConfigProvider, createFormlyConfigFromDescriptor, createFormlyField, createFormlyFields, createFormlyGroupType, createFormlyLocalizationsTab, createFormlyTabType, createFormlyValidation, createTableviewLazyRoute, createTableviewRoute, formlyTypesConfig, formlyWrappersConfig, getActionButtonRoundedWidth, getEmailValidationMessage, getFormEditorInfoMessage, getFormEditorWarningMessage, getFormlyValidationMessages, getI18nActionEditorTitleAsync, getI18nActionParams, getI18nActionParamsAsync, getI18nActionTitleAsync, getI18nForAction, getI18nForActionAsync, getMaxDateValidationMessage, getMaxLengthValidationMessage, getMaxValidationMessage, getMinDateValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTableCellPaddingX, getTextPatternValidationMessage, populateI18nActionParams, provideActionExecutor, provideViewContainer, unsavedChangesGuard, withTableview };
|
|
4745
|
+
export { ACTION_EDITOR_COMPONENT_IT, ActionComponent, ActionContext, ActionEditorComponent, ActionErrorMapperService, ActionExecutorService, ActionInstance, ActionInstanceStateEnum, ActionTableComponent, COMMONS_TABLEVIEW_FEATURE_CONFIG_IT, ComponentActionExecutorService, DataLanguageDropdownComponent, DefaultActionErrorMapperService, DefaultDataProviderExecutor, FormEditorComponent, FormEditorService, FormlyFieldActionComponent, FormlyFieldAutocompleteComponent, FormlyFieldCustomComponent, FormlyFieldDropdownComponent, FormlyFieldFieldsetComponent, FormlyFieldInputComponent, FormlyFieldLabelComponent, FormlyFieldLookupDialogComponent, FormlyFieldNoLabelWrapperComponent, FormlyFieldTableDialogFormComponent, FormlyFieldTableDialogMultiselectComponent, FormlyFieldTabsComponent, FormlyFieldWrapperComponent, NavigationService, RootActionExecutorService, TableviewComponent, TableviewRouteBuilder, TableviewRouteComponent, ViewContainer, actionNotificationError, actionNotificationSuccess, addAsyncValidationsToFormlyField, addValidationsToFormlyField, calculateTableColumnActionWidth, commonsFormlyConfigProvider, createFormlyConfigFromDescriptor, createFormlyField, createFormlyFields, createFormlyGroupType, createFormlyLocalizationsTab, createFormlyTabType, createFormlyValidation, createTableviewLazyRoute, createTableviewRoute, formlyTypesConfig, formlyWrappersConfig, getActionButtonRoundedWidth, getEmailValidationMessage, getFormEditorInfoMessage, getFormEditorWarningMessage, getFormlyValidationMessages, getI18nActionEditorTitleAsync, getI18nActionParams, getI18nActionParamsAsync, getI18nActionTitleAsync, getI18nForAction, getI18nForActionAsync, getMaxDateValidationMessage, getMaxLengthValidationMessage, getMaxValidationMessage, getMinDateValidationMessage, getMinLengthValidationMessage, getMinValidationMessage, getRequiredValidationMessage, getTableCellPaddingX, getTextPatternValidationMessage, populateI18nActionParams, provideActionExecutor, provideFormComponent, provideViewContainer, unsavedChangesGuard, withTableview };
|
|
4753
4746
|
//# sourceMappingURL=mediusinc-mng-commons-tableview.mjs.map
|