@mediusinc/mng-commons 5.0.0-rc.1 → 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/router/route-builder.d.ts +149 -26
- package/core/router/routes-builder.d.ts +28 -13
- 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 +5 -5
- package/esm2022/core/components/pages/error/error.page.component.mjs +5 -5
- package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +5 -5
- 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 +12 -9
- package/esm2022/core/directives/dialog-keydown-handler.directive.mjs +3 -3
- package/esm2022/core/directives/template.directive.mjs +3 -3
- package/esm2022/core/index.mjs +2 -1
- package/esm2022/core/pipes/boolean.pipe.mjs +3 -3
- package/esm2022/core/pipes/class-map.pipe.mjs +3 -3
- package/esm2022/core/pipes/enum.pipe.mjs +3 -3
- package/esm2022/core/pipes/enumerate-async.pipe.mjs +3 -3
- package/esm2022/core/pipes/enumerate.pipe.mjs +3 -3
- package/esm2022/core/pipes/getter.pipe.mjs +3 -3
- package/esm2022/core/pipes/i18n-property.pipe.mjs +3 -3
- package/esm2022/core/pipes/json-path.pipe.mjs +3 -3
- package/esm2022/core/pipes/parametrize.pipe.mjs +3 -3
- package/esm2022/core/pipes/template.pipe.mjs +3 -3
- package/esm2022/core/router/route-builder.mjs +211 -84
- package/esm2022/core/router/routes-builder.mjs +41 -43
- package/esm2022/core/security/permission.service.mjs +7 -5
- package/esm2022/core/services/commons-init.service.mjs +5 -5
- package/esm2022/core/services/commons-router.service.mjs +18 -17
- package/esm2022/core/services/commons.service.mjs +112 -169
- package/esm2022/core/services/local-storage-config.service.mjs +3 -3
- 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 +105 -102
- package/esm2022/form/components/date-range/date-range.component.mjs +3 -3
- package/esm2022/form/components/dropdown/dropdown.component.mjs +148 -90
- package/esm2022/form/directives/input-trim.directive.mjs +3 -3
- 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 +8 -9
- package/esm2022/table/components/column-value/column-value.component.mjs +4 -4
- package/esm2022/table/components/table/table.component.mjs +7 -7
- package/esm2022/table/pipes/locale-default-row-class.pipe.mjs +5 -5
- package/esm2022/table/pipes/table-column-filter-class.pipe.mjs +3 -3
- package/esm2022/table/services/data-list.service.mjs +4 -4
- package/esm2022/tableview/action/components/action/action.component.mjs +142 -190
- package/esm2022/tableview/action/components/editor/action-editor.component.mjs +58 -68
- package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +133 -154
- package/esm2022/tableview/action/components/localization/data-language-dropdown.component.mjs +22 -40
- package/esm2022/tableview/action/components/route/action-route.component.mjs +21 -26
- package/esm2022/tableview/action/components/table/action-table.component.mjs +4 -4
- package/esm2022/tableview/action/models/execution/action-instance.model.mjs +1 -1
- package/esm2022/tableview/action/services/action-executor.service.mjs +10 -10
- package/esm2022/tableview/action/services/component-action-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/data-provider-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/navigation.service.mjs +6 -5
- package/esm2022/tableview/action/services/root-action-executor.service.mjs +3 -3
- package/esm2022/tableview/action/services/view-container.service.mjs +8 -24
- 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 +28 -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/action-instance.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 +24 -161
- 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 +3 -3
- 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 +36 -7
- package/esm2022/tableview/api/editor/helpers/editor-descriptor-helpers.mjs +95 -0
- package/esm2022/tableview/api/editor/helpers/field-validators.mjs +17 -27
- 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-custom-field.model.mjs +3 -3
- 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 +26 -186
- 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 +163 -138
- package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +9 -5
- package/esm2022/tableview/editor/components/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +13 -16
- package/esm2022/tableview/editor/components/formly/fields/formly-field-custom/formly-field-custom.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-datepicker/formly-field-datepicker.component.mjs +103 -0
- package/esm2022/tableview/editor/components/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +12 -16
- package/esm2022/tableview/editor/components/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-input/formly-field-input.component.mjs +36 -53
- package/esm2022/tableview/editor/components/formly/fields/formly-field-label/formly-field-label.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +20 -24
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +24 -28
- package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +30 -31
- package/esm2022/tableview/editor/components/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-no-label-wrapper/formly-field-no-label-wrapper.component.mjs +3 -3
- package/esm2022/tableview/editor/components/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +3 -3
- package/esm2022/tableview/editor/helpers/editor-formly.mjs +85 -56
- package/esm2022/tableview/editor/helpers/formly-config.mjs +5 -3
- package/esm2022/tableview/editor/models/formly-config.model.mjs +1 -1
- package/esm2022/tableview/editor/services/form-editor.service.mjs +96 -0
- package/esm2022/tableview/index.mjs +2 -1
- package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +10 -10
- package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +26 -43
- package/esm2022/tableview/tableview/router/tableview-route-builder.mjs +17 -43
- package/fesm2022/mediusinc-mng-commons-core.mjs +460 -390
- 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 +257 -195
- 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 +26 -27
- package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +906 -665
- package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
- package/fesm2022/mediusinc-mng-commons-tableview.mjs +1015 -960
- 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 +33 -24
- 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 +24 -26
- package/tableview/action/components/localization/data-language-dropdown.component.d.ts +11 -14
- package/tableview/action/components/route/action-route.component.d.ts +7 -12
- package/tableview/action/components/table/action-table.component.d.ts +3 -3
- package/tableview/action/models/execution/action-instance.model.d.ts +2 -1
- 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 +25 -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/action-instance.model.d.ts +2 -1
- 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 +44 -105
- package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +3 -3
- package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +35 -33
- package/tableview/api/editor/descriptors/field-group.descriptor.d.ts +8 -7
- 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 +10 -13
- package/tableview/api/editor/descriptors/field.descriptor.d.ts +16 -1
- package/tableview/api/editor/helpers/editor-descriptor-helpers.d.ts +43 -0
- package/tableview/api/editor/helpers/field-validators.d.ts +7 -3
- package/tableview/api/editor/models/editor-fields.model.d.ts +25 -21
- 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 -10
- package/tableview/api/editor/models/form-editor.event.d.ts +26 -16
- package/tableview/api/editor/models/form-editor.interface.d.ts +38 -8
- package/tableview/api/editor/models/formly-custom-field.model.d.ts +1 -1
- package/tableview/api/editor/models/formly-field.model.d.ts +9 -7
- 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 +41 -102
- 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 +54 -36
- 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-datepicker/formly-field-datepicker.component.d.ts +22 -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-input/formly-field-input.component.d.ts +5 -7
- 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 -5
- package/tableview/editor/helpers/editor-formly.d.ts +11 -10
- package/tableview/editor/models/formly-config.model.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 +2 -2
- package/tableview/tableview/components/tableview/tableview.component.d.ts +11 -10
- package/tableview/tableview/router/tableview-route-builder.d.ts +7 -13
- package/version-info.json +11 -0
|
@@ -1,74 +1,74 @@
|
|
|
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
|
-
import * as
|
|
8
|
+
import * as i1$1 from '@ngx-translate/core';
|
|
8
9
|
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,
|
|
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
|
-
import * as i2$
|
|
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
|
-
import * as i2$
|
|
32
|
+
import * as i2$2 from 'primeng/toolbar';
|
|
33
33
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
34
34
|
import { ZIndexUtils } from 'primeng/utils';
|
|
35
35
|
import * as i1$2 from '@angular/forms';
|
|
36
|
-
import { FormGroup, FormArray, ReactiveFormsModule, FormsModule, Validators, FormControl } from '@angular/forms';
|
|
37
|
-
import * as i2$
|
|
38
|
-
import { FormlyModule, FieldType, FieldWrapper, FORMLY_CONFIG } from '@ngx-formly/core';
|
|
39
|
-
import * as i3 from 'primeng/messages';
|
|
36
|
+
import { UntypedFormGroup, FormGroup, FormArray, ReactiveFormsModule, FormsModule, FormBuilder, Validators, FormControl } from '@angular/forms';
|
|
37
|
+
import * as i2$1 from '@ngx-formly/core';
|
|
38
|
+
import { FormlyConfig, FormlyModule, FieldType, FieldWrapper, FORMLY_CONFIG } from '@ngx-formly/core';
|
|
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';
|
|
46
46
|
import { MessageModule } from 'primeng/message';
|
|
47
47
|
import * as i1$4 from 'primeng/fieldset';
|
|
48
48
|
import { FieldsetModule } from 'primeng/fieldset';
|
|
49
|
-
import * as
|
|
50
|
-
import { CalendarModule } from 'primeng/calendar';
|
|
51
|
-
import * as i11 from 'primeng/fileupload';
|
|
49
|
+
import * as i9$1 from 'primeng/fileupload';
|
|
52
50
|
import { FileUploadModule } from 'primeng/fileupload';
|
|
53
51
|
import { TimesIcon } from 'primeng/icons/times';
|
|
54
|
-
import * as
|
|
52
|
+
import * as i11 from 'primeng/image';
|
|
55
53
|
import { ImageModule } from 'primeng/image';
|
|
56
|
-
import * as
|
|
54
|
+
import * as i8$1 from 'primeng/inputmask';
|
|
57
55
|
import { InputMaskModule } from 'primeng/inputmask';
|
|
58
|
-
import * as
|
|
56
|
+
import * as i1$5 from 'primeng/inputnumber';
|
|
59
57
|
import { InputNumberModule } from 'primeng/inputnumber';
|
|
60
58
|
import * as i6 from 'primeng/inputswitch';
|
|
61
59
|
import { InputSwitchModule } from 'primeng/inputswitch';
|
|
62
|
-
import * as
|
|
60
|
+
import * as i13 from 'primeng/inputtext';
|
|
63
61
|
import { InputTextModule } from 'primeng/inputtext';
|
|
64
|
-
import * as
|
|
62
|
+
import * as i12 from 'primeng/inputtextarea';
|
|
65
63
|
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
66
64
|
import * as i7$1 from 'primeng/radiobutton';
|
|
67
65
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
68
66
|
import * as i7$2 from 'primeng/dialog';
|
|
69
67
|
import { DialogModule } from 'primeng/dialog';
|
|
70
|
-
import * as i1$
|
|
68
|
+
import * as i1$6 from 'primeng/tabview';
|
|
71
69
|
import { TabViewModule } from 'primeng/tabview';
|
|
70
|
+
import * as i3$2 from 'primeng/calendar';
|
|
71
|
+
import { CalendarModule } from 'primeng/calendar';
|
|
72
72
|
|
|
73
73
|
function getI18nForAction(translate, action, actionPathKeys, customKey, item, fallbackKey, params, missingTranslationStrategy = 'returnFirstKey') {
|
|
74
74
|
const keys = getKeysByPriority(action, actionPathKeys, customKey, fallbackKey);
|
|
@@ -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
|
}
|
|
@@ -476,10 +476,10 @@ class NavigationService {
|
|
|
476
476
|
this.router.navigateByUrl('/');
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
480
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
479
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NavigationService, deps: [{ token: i1.Router }, { token: i2.Location }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
480
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NavigationService }); }
|
|
481
481
|
}
|
|
482
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NavigationService, decorators: [{
|
|
483
483
|
type: Injectable
|
|
484
484
|
}], ctorParameters: () => [{ type: i1.Router }, { type: i2.Location }] });
|
|
485
485
|
|
|
@@ -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,16 +515,10 @@ class ViewContainer {
|
|
|
525
515
|
closeEditor(event) {
|
|
526
516
|
this._editorCloseSubject.next(event ?? {});
|
|
527
517
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
set routeTriggeredActionInstance(instance) {
|
|
532
|
-
this._routeTriggeredActionInstance = instance;
|
|
533
|
-
}
|
|
534
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ViewContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
535
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ViewContainer }); }
|
|
518
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ViewContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
519
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ViewContainer }); }
|
|
536
520
|
}
|
|
537
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ViewContainer, decorators: [{
|
|
538
522
|
type: Injectable
|
|
539
523
|
}] });
|
|
540
524
|
|
|
@@ -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;
|
|
@@ -1113,13 +1097,13 @@ class ActionExecutorService {
|
|
|
1113
1097
|
// must skip initialization from view container, because it would only get old instance.
|
|
1114
1098
|
// we need new instance before we can set new one on the view container.
|
|
1115
1099
|
const newInstance = this.getOrCreateInstance(undefined, instance.action, undefined, newInstanceStatus, true);
|
|
1116
|
-
newInstance.
|
|
1100
|
+
newInstance.reactivationPreviousInstance = instance;
|
|
1117
1101
|
// copy some additional settings
|
|
1118
1102
|
newInstance.activationDialogRef = instance.activationDialogRef;
|
|
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) {
|
|
@@ -1293,10 +1277,10 @@ class RootActionExecutorService extends ActionExecutorService {
|
|
|
1293
1277
|
get instances() {
|
|
1294
1278
|
return this._instances;
|
|
1295
1279
|
}
|
|
1296
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
1297
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
1280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: RootActionExecutorService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1281
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: RootActionExecutorService }); }
|
|
1298
1282
|
}
|
|
1299
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
1283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: RootActionExecutorService, decorators: [{
|
|
1300
1284
|
type: Injectable
|
|
1301
1285
|
}] });
|
|
1302
1286
|
|
|
@@ -1308,10 +1292,10 @@ class ComponentActionExecutorService extends ActionExecutorService {
|
|
|
1308
1292
|
get instances() {
|
|
1309
1293
|
return this.rootActionExecutorService.instances;
|
|
1310
1294
|
}
|
|
1311
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
1312
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
1295
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ComponentActionExecutorService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1296
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ComponentActionExecutorService }); }
|
|
1313
1297
|
}
|
|
1314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
1298
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ComponentActionExecutorService, decorators: [{
|
|
1315
1299
|
type: Injectable
|
|
1316
1300
|
}] });
|
|
1317
1301
|
|
|
@@ -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,111 +1543,27 @@ 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.2", ngImport: i0, type: ActionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i2$1.TranslateService }, { token: i1$1.PermissionService }, { token: ActionExecutorService }, { token: ViewContainer, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1574
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", 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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
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:
|
|
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
|
-
function createFormlyConfigFromDescriptor(descriptor, formEditorComponent) {
|
|
1556
|
+
function createFormlyConfigFromDescriptor(descriptor, formlyConfig, formEditorComponent) {
|
|
1622
1557
|
const fields = [];
|
|
1623
1558
|
if (descriptor.isLocalized) {
|
|
1624
1559
|
descriptor = createFormlyLocalizationsTab(descriptor);
|
|
1625
1560
|
}
|
|
1626
1561
|
if (!descriptor.isLocalized && descriptor.tabs.length === 1 && descriptor.tabs[0].default) {
|
|
1627
1562
|
// dont use tabs
|
|
1628
|
-
fields.push(...createFormlyGroupType(descriptor.tabs[0].fields, formEditorComponent));
|
|
1563
|
+
fields.push(...createFormlyGroupType(descriptor.tabs[0].fields, formlyConfig, formEditorComponent));
|
|
1629
1564
|
}
|
|
1630
1565
|
else {
|
|
1631
|
-
fields.push(...createFormlyTabType(descriptor.tabs, formEditorComponent));
|
|
1566
|
+
fields.push(...createFormlyTabType(descriptor.tabs, formlyConfig, formEditorComponent));
|
|
1632
1567
|
}
|
|
1633
1568
|
return fields;
|
|
1634
1569
|
}
|
|
@@ -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 => {
|
|
@@ -1660,12 +1595,12 @@ function createFormlyLocalizationsTab(descriptor) {
|
|
|
1660
1595
|
if (!descriptor.localizationLocalizationProperty) {
|
|
1661
1596
|
throw new CommonsInternalError('Localization localization property must be defined');
|
|
1662
1597
|
}
|
|
1663
|
-
descriptorWithLocalizations.
|
|
1598
|
+
descriptorWithLocalizations.addFieldManyEditorUnsafe(descriptor.localizationLocalizationProperty, localizationsTableViewDescriptor);
|
|
1664
1599
|
return descriptorWithLocalizations;
|
|
1665
1600
|
}
|
|
1666
1601
|
return descriptor;
|
|
1667
1602
|
}
|
|
1668
|
-
function createFormlyTabType(tabGroups, formEditorComponent) {
|
|
1603
|
+
function createFormlyTabType(tabGroups, formlyConfig, formEditorComponent) {
|
|
1669
1604
|
const tabsField = {
|
|
1670
1605
|
type: 'tabs',
|
|
1671
1606
|
fieldGroup: [],
|
|
@@ -1685,15 +1620,15 @@ function createFormlyTabType(tabGroups, formEditorComponent) {
|
|
|
1685
1620
|
if (tab.title) {
|
|
1686
1621
|
tabField.props.label = tab.title;
|
|
1687
1622
|
}
|
|
1688
|
-
tabField.fieldGroup.push(...createFormlyGroupType(tab.fields, formEditorComponent));
|
|
1623
|
+
tabField.fieldGroup.push(...createFormlyGroupType(tab.fields, formlyConfig, formEditorComponent));
|
|
1689
1624
|
tabsField.fieldGroup.push(tabField);
|
|
1690
1625
|
}
|
|
1691
1626
|
return [tabsField];
|
|
1692
1627
|
}
|
|
1693
|
-
function createFormlyGroupType(groups, formEditorComponent) {
|
|
1628
|
+
function createFormlyGroupType(groups, formlyConfig, formEditorComponent) {
|
|
1694
1629
|
if (groups.length === 1 && groups[0].default) {
|
|
1695
1630
|
// dont use fieldset, just create fields
|
|
1696
|
-
return createFormlyFields(groups[0], formEditorComponent);
|
|
1631
|
+
return createFormlyFields(groups[0], formlyConfig, formEditorComponent);
|
|
1697
1632
|
}
|
|
1698
1633
|
else {
|
|
1699
1634
|
const groupsField = {
|
|
@@ -1716,26 +1651,27 @@ function createFormlyGroupType(groups, formEditorComponent) {
|
|
|
1716
1651
|
if (group.title) {
|
|
1717
1652
|
groupField.props.label = group.title;
|
|
1718
1653
|
}
|
|
1719
|
-
groupField.fieldGroup.push(...createFormlyFields(group, formEditorComponent));
|
|
1654
|
+
groupField.fieldGroup.push(...createFormlyFields(group, formlyConfig, formEditorComponent));
|
|
1720
1655
|
groupsField.fieldGroup.push(groupField);
|
|
1721
1656
|
}
|
|
1722
1657
|
return [groupsField];
|
|
1723
1658
|
}
|
|
1724
1659
|
}
|
|
1725
|
-
function createFormlyFields(descriptor, formEditorComponent) {
|
|
1660
|
+
function createFormlyFields(descriptor, formlyConfig, formEditorComponent) {
|
|
1726
1661
|
const fields = [];
|
|
1727
1662
|
for (const descriptorField of descriptor.fields) {
|
|
1728
|
-
fields.push(createFormlyField(descriptorField, formEditorComponent));
|
|
1663
|
+
fields.push(createFormlyField(descriptorField, formlyConfig, formEditorComponent));
|
|
1729
1664
|
}
|
|
1730
1665
|
// wrap in group to be able to use flex grid
|
|
1731
1666
|
const wrapperGroup = {
|
|
1732
1667
|
fieldGroupClassName: 'p-fluid formgrid grid',
|
|
1733
|
-
fieldGroup: fields
|
|
1668
|
+
fieldGroup: fields,
|
|
1669
|
+
props: {}
|
|
1734
1670
|
};
|
|
1735
|
-
addValidationsToFormlyField(wrapperGroup, descriptor.validations);
|
|
1671
|
+
addValidationsToFormlyField(wrapperGroup, descriptor.validations, formlyConfig);
|
|
1736
1672
|
return [wrapperGroup];
|
|
1737
1673
|
}
|
|
1738
|
-
function createFormlyField(descriptor, formEditorComponent) {
|
|
1674
|
+
function createFormlyField(descriptor, formlyConfig, formEditorComponent) {
|
|
1739
1675
|
const field = {
|
|
1740
1676
|
key: descriptor.property,
|
|
1741
1677
|
modelOptions: {
|
|
@@ -1878,6 +1814,7 @@ function createFormlyField(descriptor, formEditorComponent) {
|
|
|
1878
1814
|
}
|
|
1879
1815
|
if (descriptor.hiddenExpression) {
|
|
1880
1816
|
field.expressions['hide'] = descriptor.hiddenExpression;
|
|
1817
|
+
field.expressions['resetOnHide'] = () => descriptor.hiddenResetOnHide ?? true;
|
|
1881
1818
|
}
|
|
1882
1819
|
if (descriptor.disabledExpression) {
|
|
1883
1820
|
field.expressions['props.disabled'] = descriptor.disabledExpression;
|
|
@@ -1891,60 +1828,88 @@ function createFormlyField(descriptor, formEditorComponent) {
|
|
|
1891
1828
|
if (typeof descriptor.defaultValue !== 'undefined') {
|
|
1892
1829
|
field.defaultValue = descriptor.defaultValue;
|
|
1893
1830
|
}
|
|
1894
|
-
addValidationsToFormlyField(field, descriptor.validations);
|
|
1895
|
-
addAsyncValidationsToFormlyField(field, descriptor.asyncValidations);
|
|
1831
|
+
addValidationsToFormlyField(field, descriptor.validations, formlyConfig);
|
|
1832
|
+
addAsyncValidationsToFormlyField(field, descriptor.asyncValidations, formlyConfig);
|
|
1896
1833
|
return field;
|
|
1897
1834
|
}
|
|
1898
|
-
function addValidationsToFormlyField(config, validations) {
|
|
1835
|
+
function addValidationsToFormlyField(config, validations, formlyConfig) {
|
|
1899
1836
|
if (!config.validators) {
|
|
1900
1837
|
config.validators = {};
|
|
1901
1838
|
}
|
|
1902
1839
|
for (const validation of validations) {
|
|
1903
|
-
|
|
1904
|
-
config.validators[validation.name] = {
|
|
1905
|
-
expression: (control, field, options) => {
|
|
1906
|
-
const validatorRes = validation.validator(control, field, options);
|
|
1907
|
-
// formly validator only excepts true/false for validation
|
|
1908
|
-
// map possible angular validator result to true/false
|
|
1909
|
-
return typeof validatorRes === 'boolean' ? validatorRes : validatorRes === null;
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
|
-
if (typeof validation.message === 'function') {
|
|
1913
|
-
config.validators[validation.name].message = validation.message;
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
else {
|
|
1917
|
-
if (!Array.isArray(config.validators.validation)) {
|
|
1918
|
-
config.validators.validation = [];
|
|
1919
|
-
}
|
|
1920
|
-
config.validators.validation.push(validation.name);
|
|
1921
|
-
}
|
|
1840
|
+
createFormlyValidation(config.validators, validation, formlyConfig);
|
|
1922
1841
|
}
|
|
1923
1842
|
}
|
|
1924
|
-
function addAsyncValidationsToFormlyField(config, asyncValidations) {
|
|
1843
|
+
function addAsyncValidationsToFormlyField(config, asyncValidations, formlyConfig) {
|
|
1925
1844
|
if (!config.asyncValidators) {
|
|
1926
1845
|
config.asyncValidators = {};
|
|
1927
1846
|
}
|
|
1928
1847
|
for (const validation of asyncValidations) {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1848
|
+
createFormlyValidation(config.asyncValidators, validation, formlyConfig);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
function createFormlyValidation(config, validation, formlyConfig) {
|
|
1852
|
+
if (typeof validation.validator === 'function') {
|
|
1853
|
+
if (validation.options?.errorPath && validation.message != null) {
|
|
1854
|
+
// if this is used, the validator and message must be registered globally
|
|
1855
|
+
if (!formlyConfig.getValidatorMessage(validation.name)) {
|
|
1856
|
+
formlyConfig.addValidatorMessage(validation.name, validation.message);
|
|
1857
|
+
}
|
|
1858
|
+
if (!formlyConfig.validators[validation.name]) {
|
|
1859
|
+
formlyConfig.setValidator({
|
|
1860
|
+
name: validation.name,
|
|
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
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
if (!Array.isArray(config.validation)) {
|
|
1876
|
+
config.validation = [];
|
|
1877
|
+
}
|
|
1878
|
+
config.validation.push({
|
|
1879
|
+
name: validation.name,
|
|
1880
|
+
options: { errorPath: validation.options.errorPath }
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
config[validation.name] = {
|
|
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
|
+
});
|
|
1937
1894
|
}
|
|
1938
1895
|
};
|
|
1939
|
-
if (
|
|
1940
|
-
config
|
|
1896
|
+
if (validation.message != null) {
|
|
1897
|
+
config[validation.name].message = validation.message;
|
|
1941
1898
|
}
|
|
1942
1899
|
}
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
if (!Array.isArray(config.validation)) {
|
|
1903
|
+
config.validation = [];
|
|
1904
|
+
}
|
|
1905
|
+
if (validation.options?.errorPath) {
|
|
1906
|
+
config.validation.push({
|
|
1907
|
+
name: validation.name,
|
|
1908
|
+
options: { errorPath: validation.options.errorPath }
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1943
1911
|
else {
|
|
1944
|
-
|
|
1945
|
-
config.asyncValidators.validation = [];
|
|
1946
|
-
}
|
|
1947
|
-
config.asyncValidators.validation.push(validation.name);
|
|
1912
|
+
config.validation.push(validation.name);
|
|
1948
1913
|
}
|
|
1949
1914
|
}
|
|
1950
1915
|
}
|
|
@@ -1960,110 +1925,249 @@ function getFormEditorWarningMessage(translate, title, message) {
|
|
|
1960
1925
|
return { severity: 'warn', summary: actionErrorTitle, detail: actionErrorMessage };
|
|
1961
1926
|
}
|
|
1962
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
|
+
|
|
1963
2021
|
class FormEditorComponent {
|
|
2022
|
+
get parent() {
|
|
2023
|
+
return this.formService.parent;
|
|
2024
|
+
}
|
|
2025
|
+
get form() {
|
|
2026
|
+
return this._form;
|
|
2027
|
+
}
|
|
2028
|
+
get formUnsafe() {
|
|
2029
|
+
return this._form;
|
|
2030
|
+
}
|
|
2031
|
+
get formlyOptions() {
|
|
2032
|
+
return this._formlyOptions;
|
|
2033
|
+
}
|
|
2034
|
+
get formlyFields() {
|
|
2035
|
+
return this._formlyFields;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Only used for form initialization. Further changes should be done using {resetFormModel}.
|
|
2039
|
+
*/
|
|
2040
|
+
get formlyInitialItem() {
|
|
2041
|
+
return this._formlyInitialItem;
|
|
2042
|
+
}
|
|
1964
2043
|
constructor() {
|
|
2044
|
+
this.formlyConfig = inject(FormlyConfig);
|
|
1965
2045
|
this.translateService = inject(TranslateService);
|
|
1966
2046
|
this.commons = inject(CommonsService);
|
|
1967
2047
|
this.logger = inject(LoggerService).create('FormEditorComponent');
|
|
1968
|
-
this.
|
|
1969
|
-
this.
|
|
1970
|
-
|
|
1971
|
-
this.
|
|
2048
|
+
this.destroyRef = inject(DestroyRef);
|
|
2049
|
+
this.formService = inject((FormEditorService));
|
|
2050
|
+
this.descriptor = input.required();
|
|
2051
|
+
this.submitLoading = input(false);
|
|
2052
|
+
this.item = input(undefined);
|
|
2053
|
+
this.isFormDisabled = input(false);
|
|
1972
2054
|
// event outputs
|
|
1973
|
-
this.
|
|
1974
|
-
|
|
1975
|
-
this.
|
|
2055
|
+
this.formSubmit = output();
|
|
2056
|
+
// content and view queries
|
|
2057
|
+
this.submitButtonElementRef = viewChild('submitButton');
|
|
2058
|
+
// formly specifics
|
|
2059
|
+
this._form = new UntypedFormGroup({});
|
|
2060
|
+
this._formlyOptions = {
|
|
1976
2061
|
formState: {
|
|
1977
2062
|
add: false,
|
|
1978
2063
|
edit: false,
|
|
1979
2064
|
disabled: false
|
|
1980
2065
|
}
|
|
1981
2066
|
};
|
|
1982
|
-
this.
|
|
1983
|
-
this.
|
|
1984
|
-
this.
|
|
2067
|
+
this._formlyFields = []; // initialized in ngOnInit, should not be changed after
|
|
2068
|
+
this._formlyInitialItem = {}; // initialized in ngOnInit, should not be changed after
|
|
2069
|
+
this.formMessages = signal([]);
|
|
2070
|
+
this.formService.init(this);
|
|
2071
|
+
effect(() => {
|
|
2072
|
+
const item = this.item();
|
|
2073
|
+
if (item !== this.initialItemInput) {
|
|
2074
|
+
// new item is different from the one the form was initialized with. Must trigger reset of form model.
|
|
2075
|
+
this.resetFormModel(item);
|
|
2076
|
+
}
|
|
2077
|
+
},
|
|
2078
|
+
// resetModel uses signal like concept
|
|
2079
|
+
{ allowSignalWrites: true });
|
|
2080
|
+
effect(() => {
|
|
2081
|
+
this._formlyOptions.formState.disabled = this.isFormDisabled() || this._formlyOptions.formState.descriptor?.disabled === true || this._formlyOptions.formState.details;
|
|
2082
|
+
});
|
|
1985
2083
|
}
|
|
1986
2084
|
ngOnInit() {
|
|
1987
|
-
|
|
1988
|
-
this.
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
this.
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2085
|
+
// init form state
|
|
2086
|
+
if (this.descriptor().tableviewEditorType === TableviewEditorTypeEnum.Add) {
|
|
2087
|
+
this._formlyOptions.formState.add = true;
|
|
2088
|
+
}
|
|
2089
|
+
else if (this.descriptor().tableviewEditorType === TableviewEditorTypeEnum.Edit) {
|
|
2090
|
+
this._formlyOptions.formState.edit = true;
|
|
2091
|
+
}
|
|
2092
|
+
else if (this.descriptor().tableviewEditorType === TableviewEditorTypeEnum.Details) {
|
|
2093
|
+
this._formlyOptions.formState.details = true;
|
|
2094
|
+
}
|
|
2095
|
+
this._formlyOptions.formState.descriptor = this.descriptor();
|
|
2096
|
+
// init fields for formly
|
|
2097
|
+
this._formlyFields = createFormlyConfigFromDescriptor(this.descriptor(), this.formlyConfig, this);
|
|
2098
|
+
// int form model (only initial, no further changes to formModel should be allowed!)
|
|
2099
|
+
this.initialItemInput = this.item();
|
|
2100
|
+
this._formlyInitialItem = this.getFormModelFromItem(this.item());
|
|
2101
|
+
// handle localizations edit/add message
|
|
2102
|
+
if (this.descriptor().isLocalized &&
|
|
2103
|
+
(this.descriptor().tableviewEditorType === TableviewEditorTypeEnum.Add || this.descriptor().tableviewEditorType === TableviewEditorTypeEnum.Edit)) {
|
|
2104
|
+
this.formMessages.set([
|
|
2105
|
+
...this.formMessages(),
|
|
2106
|
+
getFormEditorInfoMessage(this.translateService, 'mngEditor.localizations.addInDefaultLanguageTitle', 'mngEditor.localizations.addInDefaultLanguageDescription', {
|
|
2107
|
+
defaultLanguage: this.commons.getDefaultLocale()
|
|
2108
|
+
})
|
|
2109
|
+
]);
|
|
1999
2110
|
}
|
|
2000
2111
|
// emit lifecycle event
|
|
2001
|
-
this.descriptor
|
|
2112
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle, this, {
|
|
2002
2113
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
2003
2114
|
});
|
|
2004
|
-
this.
|
|
2005
|
-
this.descriptor
|
|
2115
|
+
this._form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), debounceTime(250), distinctUntilChanged()).subscribe(v => {
|
|
2116
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ValueChange, this, {
|
|
2006
2117
|
value: v,
|
|
2007
2118
|
formValue: () => this.getFormValue()
|
|
2008
2119
|
});
|
|
2009
|
-
})
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
}
|
|
2015
|
-
if (changes['item'] && !changes['item'].firstChange) {
|
|
2016
|
-
this.resetFormModel(this.item);
|
|
2017
|
-
}
|
|
2120
|
+
});
|
|
2121
|
+
// mark form as pristine, should be done in next event hook to allow formly to initialize first
|
|
2122
|
+
setTimeout(() => {
|
|
2123
|
+
this._form.markAsPristine();
|
|
2124
|
+
});
|
|
2018
2125
|
}
|
|
2019
2126
|
ngOnDestroy() {
|
|
2020
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
2021
2127
|
// emit lifecycle event
|
|
2022
|
-
this.descriptor
|
|
2128
|
+
this.descriptor().nextEvent(FormEventTypeEnum.ComponentLifecycle, this, {
|
|
2023
2129
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
2024
2130
|
});
|
|
2025
|
-
// complete emitting events
|
|
2026
|
-
this.descriptor?.completeEvents();
|
|
2027
2131
|
}
|
|
2028
2132
|
submit() {
|
|
2029
|
-
this.submitButtonElementRef?.nativeElement.click();
|
|
2133
|
+
this.submitButtonElementRef()?.nativeElement.click();
|
|
2030
2134
|
}
|
|
2031
2135
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2032
2136
|
onSubmit(event) {
|
|
2033
|
-
this.
|
|
2034
|
-
this.formMessages
|
|
2137
|
+
this._formlyOptions.formState.submittedOn = Date.now();
|
|
2138
|
+
this.formMessages.set([]);
|
|
2035
2139
|
const formSubmitItem = this.getFormValue();
|
|
2036
|
-
if (this.
|
|
2037
|
-
this.
|
|
2140
|
+
if (this._form.valid) {
|
|
2141
|
+
this.formSubmit.emit({
|
|
2038
2142
|
success: true,
|
|
2039
2143
|
formItem: formSubmitItem
|
|
2040
2144
|
});
|
|
2041
|
-
this.descriptor
|
|
2145
|
+
this.descriptor().nextEvent(FormEventTypeEnum.Submit, this, {
|
|
2042
2146
|
submitValid: true,
|
|
2043
2147
|
submitValue: formSubmitItem
|
|
2044
2148
|
});
|
|
2045
2149
|
}
|
|
2046
2150
|
else {
|
|
2047
2151
|
// find and mark invalid tabs
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
this.
|
|
2152
|
+
const formFields = this._formlyFields;
|
|
2153
|
+
if (formFields[0].type === 'tabs' && formFields[0].fieldGroup) {
|
|
2154
|
+
for (const tab of formFields[0].fieldGroup) {
|
|
2155
|
+
this._formlyOptions.formState['tab_' + (tab.id ? tab.id : tab.props.props.label) + '_invalid'] = this.isAnyFieldInvalid(tab.fieldGroup);
|
|
2052
2156
|
}
|
|
2053
2157
|
}
|
|
2054
2158
|
const event = { success: false, formItem: formSubmitItem };
|
|
2055
2159
|
event.success = false;
|
|
2056
|
-
this.formMessages.push(getFormEditorWarningMessage(this.translateService, 'mngEditor.invalidFormToastTitle', 'mngEditor.invalidFormToastMessage'));
|
|
2057
|
-
this.
|
|
2058
|
-
this.descriptor
|
|
2160
|
+
this.formMessages().push(getFormEditorWarningMessage(this.translateService, 'mngEditor.invalidFormToastTitle', 'mngEditor.invalidFormToastMessage'));
|
|
2161
|
+
this.formSubmit.emit(event);
|
|
2162
|
+
this.descriptor().nextEvent(FormEventTypeEnum.Submit, this, {
|
|
2059
2163
|
submitValid: false,
|
|
2060
2164
|
submitValue: formSubmitItem
|
|
2061
2165
|
});
|
|
2062
2166
|
}
|
|
2063
2167
|
}
|
|
2064
2168
|
getFormValue() {
|
|
2065
|
-
const formValue = objectDeepCopy(this.
|
|
2066
|
-
this.descriptor
|
|
2169
|
+
const formValue = objectDeepCopy(this._form.getRawValue(), { mapGettersToProperties: true });
|
|
2170
|
+
this.descriptor().fields.forEach(field => {
|
|
2067
2171
|
if (field && field.setter) {
|
|
2068
2172
|
const splitPath = field.property.split('.');
|
|
2069
2173
|
let fieldValue = formValue;
|
|
@@ -2080,43 +2184,26 @@ class FormEditorComponent {
|
|
|
2080
2184
|
});
|
|
2081
2185
|
return formValue;
|
|
2082
2186
|
}
|
|
2083
|
-
resetFormModel(item,
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
const splitPath = field.property.split('.');
|
|
2091
|
-
let currentObject = formModel;
|
|
2092
|
-
for (let i = 0; i < splitPath.length; i++) {
|
|
2093
|
-
const currentSubPath = splitPath[i];
|
|
2094
|
-
if (i === splitPath.length - 1) {
|
|
2095
|
-
currentObject[currentSubPath] = field.getter(item?.[field.property], item);
|
|
2096
|
-
}
|
|
2097
|
-
else {
|
|
2098
|
-
if (typeof currentObject[currentSubPath] !== 'object') {
|
|
2099
|
-
currentObject[currentSubPath] = {};
|
|
2100
|
-
}
|
|
2101
|
-
currentObject = currentObject[currentSubPath];
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
});
|
|
2106
|
-
if (typeof this.formOptions.resetModel === 'function') {
|
|
2107
|
-
// could not be initiated yet
|
|
2108
|
-
this.formOptions.resetModel(this.formModel);
|
|
2109
|
-
}
|
|
2110
|
-
this.formModel = formModel;
|
|
2111
|
-
if (markAsPristine) {
|
|
2112
|
-
this.form.markAsPristine();
|
|
2187
|
+
resetFormModel(item, opts) {
|
|
2188
|
+
this._formlyOptions.resetModel?.(this.getFormModelFromItem(item));
|
|
2189
|
+
if (opts?.markAsPristine !== false) {
|
|
2190
|
+
// mark form as pristine, should be done in next event hook to allow formly to initialize first
|
|
2191
|
+
setTimeout(() => {
|
|
2192
|
+
this._form.markAsPristine();
|
|
2193
|
+
});
|
|
2113
2194
|
}
|
|
2114
2195
|
}
|
|
2115
|
-
|
|
2116
|
-
return this.
|
|
2196
|
+
getField(key) {
|
|
2197
|
+
return this.getFieldUnsafe(key);
|
|
2117
2198
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2199
|
+
getFieldUnsafe(key) {
|
|
2200
|
+
return this.findFormField(this._form, key.split('.'));
|
|
2201
|
+
}
|
|
2202
|
+
setFieldValue(key, value) {
|
|
2203
|
+
return this.setFieldValueUnsafe(key, value);
|
|
2204
|
+
}
|
|
2205
|
+
setFieldValueUnsafe(key, value) {
|
|
2206
|
+
const control = this.getFieldUnsafe(key);
|
|
2120
2207
|
if (control) {
|
|
2121
2208
|
control.setValue(value);
|
|
2122
2209
|
return true;
|
|
@@ -2126,8 +2213,11 @@ class FormEditorComponent {
|
|
|
2126
2213
|
return false;
|
|
2127
2214
|
}
|
|
2128
2215
|
}
|
|
2129
|
-
|
|
2130
|
-
|
|
2216
|
+
patchFieldValue(key, value) {
|
|
2217
|
+
return this.patchFieldValueUnsafe(key, value);
|
|
2218
|
+
}
|
|
2219
|
+
patchFieldValueUnsafe(key, value) {
|
|
2220
|
+
const control = this.getFieldUnsafe(key);
|
|
2131
2221
|
if (control) {
|
|
2132
2222
|
control.patchValue(value);
|
|
2133
2223
|
return true;
|
|
@@ -2137,8 +2227,11 @@ class FormEditorComponent {
|
|
|
2137
2227
|
return false;
|
|
2138
2228
|
}
|
|
2139
2229
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2230
|
+
resetFieldValue(key, value) {
|
|
2231
|
+
return this.resetFieldValueUnsafe(key, value);
|
|
2232
|
+
}
|
|
2233
|
+
resetFieldValueUnsafe(key, value) {
|
|
2234
|
+
const control = this.getFieldUnsafe(key);
|
|
2142
2235
|
if (control) {
|
|
2143
2236
|
control.reset(value);
|
|
2144
2237
|
return true;
|
|
@@ -2148,6 +2241,29 @@ class FormEditorComponent {
|
|
|
2148
2241
|
return false;
|
|
2149
2242
|
}
|
|
2150
2243
|
}
|
|
2244
|
+
getFormModelFromItem(item) {
|
|
2245
|
+
const formModel = objectDeepCopy(item, { mapGettersToProperties: true }) ?? {};
|
|
2246
|
+
const descriptor = this.descriptor();
|
|
2247
|
+
descriptor.fields.forEach(field => {
|
|
2248
|
+
if (field.getter && item) {
|
|
2249
|
+
const splitPath = field.property.split('.');
|
|
2250
|
+
let currentObject = formModel;
|
|
2251
|
+
for (let i = 0; i < splitPath.length; i++) {
|
|
2252
|
+
const currentSubPath = splitPath[i];
|
|
2253
|
+
if (i === splitPath.length - 1) {
|
|
2254
|
+
currentObject[currentSubPath] = field.getter(item?.[field.property], item);
|
|
2255
|
+
}
|
|
2256
|
+
else {
|
|
2257
|
+
if (typeof currentObject[currentSubPath] !== 'object') {
|
|
2258
|
+
currentObject[currentSubPath] = {};
|
|
2259
|
+
}
|
|
2260
|
+
currentObject = currentObject[currentSubPath];
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
return formModel;
|
|
2266
|
+
}
|
|
2151
2267
|
findFormField(control, keyPath) {
|
|
2152
2268
|
if (keyPath.length === 0) {
|
|
2153
2269
|
return control;
|
|
@@ -2185,54 +2301,18 @@ class FormEditorComponent {
|
|
|
2185
2301
|
}
|
|
2186
2302
|
return false;
|
|
2187
2303
|
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
this.formOptions.formState.disabled = isDisabled;
|
|
2191
|
-
}
|
|
2192
|
-
/**
|
|
2193
|
-
* @private Sets form state based on editor descriptor type.
|
|
2194
|
-
* Possible options are: disabled, add or edit.
|
|
2195
|
-
*/
|
|
2196
|
-
setInitialFormState() {
|
|
2197
|
-
if (this.descriptor?.tableviewEditorType === TableviewEditorTypeEnum.Add) {
|
|
2198
|
-
this.formOptions.formState.add = true;
|
|
2199
|
-
}
|
|
2200
|
-
else if (this.descriptor?.tableviewEditorType === TableviewEditorTypeEnum.Edit) {
|
|
2201
|
-
this.formOptions.formState.edit = true;
|
|
2202
|
-
}
|
|
2203
|
-
this.updateFormState();
|
|
2204
|
-
}
|
|
2205
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: FormEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2206
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.2", type: FormEditorComponent, isStandalone: true, selector: "mng-form-editor", inputs: { descriptor: "descriptor", submitLoading: "submitLoading", item: "item", isFormDisabled: "isFormDisabled" }, outputs: { formSubmitEventEmitter: "formSubmit" }, queries: [{ propertyName: "templates", predicate: TemplateDirective }], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"form\" (ngSubmit)=\"onSubmit($event)\">\n <formly-form [form]=\"form\" [fields]=\"formFields\" [options]=\"formOptions\" [model]=\"formModel\"></formly-form>\n <button\n #submitButton\n pButton\n type=\"submit\"\n class=\"hidden\"\n [disabled]=\"form.disabled\"\n [loading]=\"(submitLoading$ | async) ?? false\"\n 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$2.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.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
2207
2306
|
}
|
|
2208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
2307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormEditorComponent, decorators: [{
|
|
2209
2308
|
type: Component,
|
|
2210
|
-
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]=\"
|
|
2211
|
-
}],
|
|
2212
|
-
type: Input
|
|
2213
|
-
}], submitLoading: [{
|
|
2214
|
-
type: Input
|
|
2215
|
-
}], item: [{
|
|
2216
|
-
type: Input
|
|
2217
|
-
}], isFormDisabled: [{
|
|
2218
|
-
type: Input
|
|
2219
|
-
}], formSubmitEventEmitter: [{
|
|
2220
|
-
type: Output,
|
|
2221
|
-
args: ['formSubmit']
|
|
2222
|
-
}], templates: [{
|
|
2223
|
-
type: ContentChildren,
|
|
2224
|
-
args: [TemplateDirective]
|
|
2225
|
-
}], submitButtonElementRef: [{
|
|
2226
|
-
type: ViewChild,
|
|
2227
|
-
args: ['submitButton']
|
|
2228
|
-
}] } });
|
|
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" }]
|
|
2310
|
+
}], ctorParameters: () => [] });
|
|
2229
2311
|
|
|
2230
2312
|
class ActionEditorInjectorContextComponent {
|
|
2231
2313
|
constructor() {
|
|
2232
2314
|
this.ActionActivationTriggerEnum = ActionActivationTriggerEnum;
|
|
2233
2315
|
this.actionEditorSubmitTypeSubmit = ActionEditorSubmitTypeEnum.Submit;
|
|
2234
|
-
this.destroyRef = inject(DestroyRef);
|
|
2235
|
-
this.route = inject(ActivatedRoute);
|
|
2236
2316
|
this.translate = inject(TranslateService);
|
|
2237
2317
|
this.confirmationService = inject(ConfirmationService);
|
|
2238
2318
|
this.dialogService = inject(DialogService);
|
|
@@ -2240,72 +2320,125 @@ class ActionEditorInjectorContextComponent {
|
|
|
2240
2320
|
this.commonsService = inject(CommonsService);
|
|
2241
2321
|
this.actionExecutor = inject(ActionExecutorService);
|
|
2242
2322
|
this.viewContainer = inject(ViewContainer, { optional: true });
|
|
2243
|
-
|
|
2244
|
-
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);
|
|
2245
2330
|
this.title = signal(undefined);
|
|
2246
2331
|
this.isFormDisabled = signal(false);
|
|
2247
2332
|
// data
|
|
2248
2333
|
this.item = signal(undefined);
|
|
2249
2334
|
this.itemId = signal(undefined);
|
|
2250
2335
|
this.actionData = signal(undefined);
|
|
2336
|
+
this.editorAction = signal({}); // fake initial value
|
|
2251
2337
|
// actions
|
|
2252
|
-
this.
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
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());
|
|
2256
2379
|
this.loading = signal(false);
|
|
2257
2380
|
this.submitLoading = signal(false);
|
|
2381
|
+
// updates for title
|
|
2258
2382
|
effect(() => {
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
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
|
+
}
|
|
2268
2405
|
});
|
|
2269
|
-
}
|
|
2270
|
-
ngOnInit() {
|
|
2271
|
-
if (this.data.actionInstance) {
|
|
2272
|
-
this.processActionInstance(this.data.actionInstance);
|
|
2273
|
-
}
|
|
2274
|
-
if (!this.data.dataProvider) {
|
|
2275
|
-
this.data.dataProvider = this.viewContainer?.dataProvider;
|
|
2276
|
-
}
|
|
2277
|
-
this.item.set(this.data.item);
|
|
2278
|
-
this.itemId.set(this.data.itemId);
|
|
2279
|
-
this.actionData.set(this.data.actionData);
|
|
2280
|
-
// arrange the sub-actions
|
|
2281
|
-
this.initializeSubActions();
|
|
2282
|
-
// notify executor to for activation to end
|
|
2283
|
-
this.processActionInstance(this.actionExecutor.onActionEditorInit(this.data.descriptor, this.instance, this));
|
|
2284
|
-
// set title
|
|
2285
|
-
this.updateTitle();
|
|
2286
2406
|
// subscribe to events that could be triggered from outside from any reason
|
|
2287
|
-
this.viewContainer?.editorReset$.pipe(takeUntilDestroyed(
|
|
2407
|
+
this.viewContainer?.editorReset$.pipe(takeUntilDestroyed()).subscribe({
|
|
2288
2408
|
next: e => {
|
|
2289
2409
|
if (e.fetch) {
|
|
2290
2410
|
this.fetchItem();
|
|
2291
2411
|
}
|
|
2292
2412
|
else if (e.item) {
|
|
2293
|
-
this.formEditorCmp?.resetFormModel(e.item);
|
|
2413
|
+
this.formEditorCmp()?.resetFormModel(e.item);
|
|
2294
2414
|
}
|
|
2295
2415
|
else if (e.fields) {
|
|
2296
2416
|
for (const key in e.fields) {
|
|
2297
|
-
this.formEditorCmp?.
|
|
2417
|
+
this.formEditorCmp()?.resetFieldValue(key, e.fields[key]);
|
|
2298
2418
|
}
|
|
2299
2419
|
}
|
|
2300
2420
|
}
|
|
2301
2421
|
});
|
|
2302
|
-
this.viewContainer?.editorClose$.pipe(takeUntilDestroyed(
|
|
2422
|
+
this.viewContainer?.editorClose$.pipe(takeUntilDestroyed()).subscribe({
|
|
2303
2423
|
next: () => {
|
|
2304
2424
|
this.cancel();
|
|
2305
2425
|
}
|
|
2306
2426
|
});
|
|
2307
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
|
+
}
|
|
2308
2440
|
ngOnDestroy() {
|
|
2441
|
+
this.titleSubscription?.unsubscribe();
|
|
2309
2442
|
this.fetchExecutionSubscription?.unsubscribe();
|
|
2310
2443
|
this.submitExecutionSubscription?.unsubscribe();
|
|
2311
2444
|
const instance = this.instance;
|
|
@@ -2314,29 +2447,29 @@ class ActionEditorInjectorContextComponent {
|
|
|
2314
2447
|
}
|
|
2315
2448
|
onSubmit(event) {
|
|
2316
2449
|
if (!this.instance) {
|
|
2317
|
-
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}.`);
|
|
2318
2451
|
}
|
|
2319
2452
|
if (event.success) {
|
|
2320
|
-
this.instanceSubmitFormItem = event.formItem;
|
|
2321
2453
|
// prepare parameters
|
|
2322
2454
|
const actionParameters = {
|
|
2323
2455
|
itemId: this.itemId(),
|
|
2324
2456
|
item: event.formItem,
|
|
2325
2457
|
actionData: this.actionData()
|
|
2326
2458
|
};
|
|
2327
|
-
if (this.
|
|
2328
|
-
actionParameters.locale = this.commonsService.
|
|
2459
|
+
if (this.editorAction().editorDescriptor.isLocalized) {
|
|
2460
|
+
actionParameters.locale = this.commonsService.getDefaultLocale();
|
|
2329
2461
|
}
|
|
2330
|
-
const context = this.actionExecutor.prepareContextForEditorSubmit(this.
|
|
2462
|
+
const context = this.actionExecutor.prepareContextForEditorSubmit(this.editorAction(), actionParameters, this.dataProvider(), this.instance, this.data().previousActionInstance);
|
|
2331
2463
|
this.submitExecutionSubscription?.unsubscribe();
|
|
2332
2464
|
this.submitExecutionSubscription = context.execution$.pipe(take$1(1)).subscribe({
|
|
2333
2465
|
next: res => {
|
|
2334
|
-
|
|
2466
|
+
this.lastSubmitItem = event.formItem;
|
|
2467
|
+
const modelIdProp = this.editorAction().model?.idProperty;
|
|
2468
|
+
if (res && typeof res === 'object' && !this.itemId() && modelIdProp) {
|
|
2335
2469
|
// to cover creation!
|
|
2336
|
-
this.updateItemId(res[
|
|
2470
|
+
this.updateItemId(res[modelIdProp]);
|
|
2337
2471
|
}
|
|
2338
|
-
this.
|
|
2339
|
-
this.instanceSubmitResult = res;
|
|
2472
|
+
this.actionRun.emit(res);
|
|
2340
2473
|
}
|
|
2341
2474
|
});
|
|
2342
2475
|
this.actionExecutor.run(context);
|
|
@@ -2344,10 +2477,10 @@ class ActionEditorInjectorContextComponent {
|
|
|
2344
2477
|
}
|
|
2345
2478
|
cancel() {
|
|
2346
2479
|
if (!this.instance) {
|
|
2347
|
-
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`);
|
|
2348
2481
|
return;
|
|
2349
2482
|
}
|
|
2350
|
-
this.
|
|
2483
|
+
this.actionCancel.emit(undefined);
|
|
2351
2484
|
this.actionExecutor.finishAction(this.instance);
|
|
2352
2485
|
}
|
|
2353
2486
|
updateItemId(itemId) {
|
|
@@ -2357,55 +2490,23 @@ class ActionEditorInjectorContextComponent {
|
|
|
2357
2490
|
this.item.set(item);
|
|
2358
2491
|
}
|
|
2359
2492
|
triggerSubmit() {
|
|
2360
|
-
this.formEditorCmp?.submit();
|
|
2361
|
-
}
|
|
2362
|
-
initializeSubActions() {
|
|
2363
|
-
for (const action of this.data.descriptor.editorActions) {
|
|
2364
|
-
if (action instanceof ActionEditorSubmitDescriptorInst) {
|
|
2365
|
-
if (typeof action.button.icon === 'undefined') {
|
|
2366
|
-
action.button.withIcon(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'pi pi-check' : 'pi pi-times');
|
|
2367
|
-
}
|
|
2368
|
-
if (typeof action.button.label === 'undefined') {
|
|
2369
|
-
action.button.withLabel(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'general.save' : this.data.isDialog ? 'general.close' : 'general.cancel');
|
|
2370
|
-
}
|
|
2371
|
-
// assign run operations
|
|
2372
|
-
action.withRunNotificationSuccess(undefined, undefined, false);
|
|
2373
|
-
if (action.submitType === ActionEditorSubmitTypeEnum.Submit) {
|
|
2374
|
-
action.withRunFunction(() => {
|
|
2375
|
-
this.triggerSubmit();
|
|
2376
|
-
return of(null);
|
|
2377
|
-
});
|
|
2378
|
-
}
|
|
2379
|
-
else {
|
|
2380
|
-
action.withRunFunction(() => {
|
|
2381
|
-
this.closeWithUnsavedChangesConfirmation();
|
|
2382
|
-
return of(null);
|
|
2383
|
-
});
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
this.placeActionsOnPositions(action);
|
|
2387
|
-
}
|
|
2388
|
-
for (const action of this.viewContainer?.actions.filter(value => value.positionTableviewCategories?.includes(this.data.descriptor.tableviewCategory)) ?? []) {
|
|
2389
|
-
this.placeActionsOnPositions(action);
|
|
2390
|
-
}
|
|
2391
|
-
this.toolbarRightActions.update(v => v.reverse());
|
|
2392
|
-
this.footerRightActions.update(v => v.reverse());
|
|
2493
|
+
this.formEditorCmp()?.submit();
|
|
2393
2494
|
}
|
|
2394
2495
|
fetchItem() {
|
|
2395
2496
|
if (!this.instance) {
|
|
2396
|
-
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}.`);
|
|
2397
2498
|
}
|
|
2398
2499
|
const actionParameters = {
|
|
2399
2500
|
itemId: this.itemId(),
|
|
2400
2501
|
item: this.item(),
|
|
2401
2502
|
actionData: this.actionData()
|
|
2402
2503
|
};
|
|
2403
|
-
if (this.
|
|
2404
|
-
if (this.
|
|
2405
|
-
actionParameters.locale = this.commonsService.
|
|
2504
|
+
if (this.editorAction().editorDescriptor.isLocalized) {
|
|
2505
|
+
if (this.editorAction().editorDescriptor.disabled) {
|
|
2506
|
+
actionParameters.locale = this.commonsService.appDataLocale();
|
|
2406
2507
|
}
|
|
2407
2508
|
else {
|
|
2408
|
-
actionParameters.locale = this.commonsService.
|
|
2509
|
+
actionParameters.locale = this.commonsService.getDefaultLocale();
|
|
2409
2510
|
}
|
|
2410
2511
|
}
|
|
2411
2512
|
if (this.instance?.previousInstance instanceof ActionInstance && this.instance.previousInstance.context?.parameters.item) {
|
|
@@ -2414,39 +2515,13 @@ class ActionEditorInjectorContextComponent {
|
|
|
2414
2515
|
if (typeof this.instance?.previousInstance?.result !== 'undefined') {
|
|
2415
2516
|
actionParameters.submitResult = this.instance?.previousInstance?.result;
|
|
2416
2517
|
}
|
|
2417
|
-
const context = this.actionExecutor.prepareContextForEditorFetch(this.
|
|
2518
|
+
const context = this.actionExecutor.prepareContextForEditorFetch(this.editorAction(), actionParameters, this.dataProvider(), this.instance, this.data().previousActionInstance);
|
|
2418
2519
|
this.fetchExecutionSubscription?.unsubscribe();
|
|
2419
2520
|
this.fetchExecutionSubscription = context.execution$.pipe(take$1(1)).subscribe(res => {
|
|
2420
2521
|
this.updateItem(res ?? undefined);
|
|
2421
|
-
this.updateTitle();
|
|
2422
2522
|
});
|
|
2423
2523
|
this.actionExecutor.run(context);
|
|
2424
2524
|
}
|
|
2425
|
-
updateTitle() {
|
|
2426
|
-
if (this.data.descriptor.editorTitle === null) {
|
|
2427
|
-
this.title.set(undefined);
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
getI18nActionEditorTitleAsync(this.translate, this.data.descriptor, this.item()).subscribe(t => {
|
|
2431
|
-
this.title.set(t ?? undefined);
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
|
-
placeActionsOnPositions(action) {
|
|
2435
|
-
switch (action.position) {
|
|
2436
|
-
case ActionPositionEnum.ToolbarLeft:
|
|
2437
|
-
this.toolbarLeftActions.update(v => [...v, action]);
|
|
2438
|
-
break;
|
|
2439
|
-
case ActionPositionEnum.ToolbarRight:
|
|
2440
|
-
this.toolbarRightActions.update(v => [...v, action]);
|
|
2441
|
-
break;
|
|
2442
|
-
case ActionPositionEnum.FooterLeft:
|
|
2443
|
-
this.footerLeftActions.update(v => [...v, action]);
|
|
2444
|
-
break;
|
|
2445
|
-
case ActionPositionEnum.FooterRight:
|
|
2446
|
-
this.footerRightActions.update(v => [...v, action]);
|
|
2447
|
-
break;
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
2525
|
setEditorEnabled(isEnabled = true) {
|
|
2451
2526
|
this.isFormDisabled.set(!isEnabled);
|
|
2452
2527
|
}
|
|
@@ -2512,6 +2587,8 @@ class ActionEditorInjectorContextComponent {
|
|
|
2512
2587
|
break;
|
|
2513
2588
|
case ActionInstanceStateEnum.FinishSuccessReactivateFinal:
|
|
2514
2589
|
this.setEditorEnabled(false);
|
|
2590
|
+
// make copy of item and update title to be on the latest
|
|
2591
|
+
this.updateItem(objectDeepCopy(this.lastSubmitItem));
|
|
2515
2592
|
// should also unsetInstance, but let this for reactivationInstance$ listener to not interfere
|
|
2516
2593
|
break;
|
|
2517
2594
|
}
|
|
@@ -2527,18 +2604,29 @@ class ActionEditorInjectorContextComponent {
|
|
|
2527
2604
|
this.instanceReactivationSubscription?.unsubscribe();
|
|
2528
2605
|
}
|
|
2529
2606
|
beforeWindowUnload() {
|
|
2530
|
-
if (this.data.isDialog && this.formEditorCmp?.form.pristine === false) {
|
|
2607
|
+
if (this.data().isDialog && this.formEditorCmp()?.form.pristine === false) {
|
|
2531
2608
|
return confirm(this.translate.instant('mngEditor.unsavedChangesConfirmation.message'));
|
|
2532
2609
|
}
|
|
2533
2610
|
return true;
|
|
2534
2611
|
}
|
|
2535
2612
|
onEscapePressed() {
|
|
2536
|
-
if (this.data.isDialog &&
|
|
2537
|
-
this.
|
|
2613
|
+
if (this.data().isDialog &&
|
|
2614
|
+
this.editorAction().activationTrigger === ActionActivationTriggerEnum.OnRoute &&
|
|
2538
2615
|
this.instance?.activationDialogRef &&
|
|
2539
2616
|
parseInt(this.dialogService.dialogComponentRefMap.get(this.instance?.activationDialogRef)?.instance.container?.style.zIndex ?? '') === ZIndexUtils.getCurrent())
|
|
2540
2617
|
this.closeWithUnsavedChangesConfirmation();
|
|
2541
2618
|
}
|
|
2619
|
+
closeWithUnsavedChangesConfirmation(callFromGuard = false) {
|
|
2620
|
+
if (this.formEditorCmp()?.form.pristine === false && this.editorAction().unsavedChangesConfirmation) {
|
|
2621
|
+
return this.showUnsavedChangesConfirmationDialog(callFromGuard);
|
|
2622
|
+
}
|
|
2623
|
+
else {
|
|
2624
|
+
if (!callFromGuard) {
|
|
2625
|
+
this.cancel();
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
return of(true);
|
|
2629
|
+
}
|
|
2542
2630
|
showUnsavedChangesConfirmationDialog(callFromGuard) {
|
|
2543
2631
|
const subject = new Subject();
|
|
2544
2632
|
this.confirmationService.confirm({
|
|
@@ -2561,39 +2649,13 @@ class ActionEditorInjectorContextComponent {
|
|
|
2561
2649
|
});
|
|
2562
2650
|
return subject.asObservable();
|
|
2563
2651
|
}
|
|
2564
|
-
|
|
2565
|
-
if (this.
|
|
2566
|
-
return this.showUnsavedChangesConfirmationDialog(callFromGuard);
|
|
2567
|
-
}
|
|
2568
|
-
else {
|
|
2569
|
-
if (!callFromGuard) {
|
|
2570
|
-
this.cancel();
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
return of(true);
|
|
2574
|
-
}
|
|
2575
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.2", ngImport: i0, type: ActionEditorInjectorContextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2576
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", type: ActionEditorInjectorContextComponent, isStandalone: true, selector: "mng-action-editor-injector-context", inputs: { data: "data" }, outputs: { actionRunEventEmitter: "actionSubmit", actionCancelEventEmitter: "actionCancel" }, host: { listeners: { "window:beforeunload": "beforeWindowUnload()", "window:keydown.Escape": "onEscapePressed()" } }, providers: [provideActionExecutor()], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }, { propertyName: "formEditorCmp", first: true, predicate: FormEditorComponent, descendants: true }], ngImport: i0, template: "@if (!data.isDialog && title()) {\n <h5>{{ title() }}</h5>\n}\n@if (data.isDialog && data.descriptor.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 (data.descriptor.editorDescriptor && !loading()) {\n <mng-form-editor [descriptor]=\"data.descriptor.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$3.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass", "ariaLabelledBy"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2652
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorInjectorContextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
2577
2654
|
}
|
|
2578
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
2655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorInjectorContextComponent, decorators: [{
|
|
2579
2656
|
type: Component,
|
|
2580
|
-
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 &&
|
|
2581
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
2582
|
-
type: Input,
|
|
2583
|
-
args: [{ required: true }]
|
|
2584
|
-
}], actionRunEventEmitter: [{
|
|
2585
|
-
type: Output,
|
|
2586
|
-
args: ['actionSubmit']
|
|
2587
|
-
}], actionCancelEventEmitter: [{
|
|
2588
|
-
type: Output,
|
|
2589
|
-
args: ['actionCancel']
|
|
2590
|
-
}], submitButtonElementRef: [{
|
|
2591
|
-
type: ViewChild,
|
|
2592
|
-
args: ['submitButton']
|
|
2593
|
-
}], formEditorCmp: [{
|
|
2594
|
-
type: ViewChild,
|
|
2595
|
-
args: [FormEditorComponent]
|
|
2596
|
-
}], 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: [{
|
|
2597
2659
|
type: HostListener,
|
|
2598
2660
|
args: ['window:beforeunload']
|
|
2599
2661
|
}], onEscapePressed: [{
|
|
@@ -2602,59 +2664,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
2602
2664
|
}] } });
|
|
2603
2665
|
|
|
2604
2666
|
class ActionEditorComponent {
|
|
2605
|
-
constructor() {
|
|
2606
|
-
this.injContextCmpType = ActionEditorInjectorContextComponent;
|
|
2607
|
-
this.injector = inject(Injector);
|
|
2608
|
-
this.destroyRef = inject(DestroyRef);
|
|
2609
|
-
this.dialogConfig = inject(DynamicDialogConfig, { optional: true });
|
|
2610
|
-
this.actionRunEventEmitter = new EventEmitter();
|
|
2611
|
-
this.actionCancelEventEmitter = new EventEmitter();
|
|
2612
|
-
this.isDialog = false;
|
|
2613
|
-
}
|
|
2614
2667
|
get actionEditor() {
|
|
2615
2668
|
return this.actionEditorWInjContextCmp;
|
|
2616
2669
|
}
|
|
2617
2670
|
get formEditorCmp() {
|
|
2618
2671
|
return this.actionEditor?.formEditorCmp;
|
|
2619
2672
|
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
this.
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
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
|
+
});
|
|
2647
2720
|
}
|
|
2648
2721
|
onActionEditorWInjContextCmp(cmp) {
|
|
2649
2722
|
if (this.actionEditorWInjContextCmp) {
|
|
2650
2723
|
throw new CommonsInternalError('Action editor injection context component is already initialized');
|
|
2651
2724
|
}
|
|
2652
2725
|
this.actionEditorWInjContextCmp = cmp;
|
|
2653
|
-
this.actionEditorWInjContextCmp.
|
|
2654
|
-
this.
|
|
2726
|
+
this.actionEditorWInjContextCmp.actionCancel.subscribe(action => {
|
|
2727
|
+
this.actionCancel.emit(action);
|
|
2655
2728
|
});
|
|
2656
|
-
this.actionEditorWInjContextCmp.
|
|
2657
|
-
this.
|
|
2729
|
+
this.actionEditorWInjContextCmp.actionRun.subscribe(action => {
|
|
2730
|
+
this.actionRun.emit(action);
|
|
2658
2731
|
});
|
|
2659
2732
|
}
|
|
2660
2733
|
cancel() {
|
|
@@ -2663,108 +2736,70 @@ class ActionEditorComponent {
|
|
|
2663
2736
|
triggerSubmit() {
|
|
2664
2737
|
this.actionEditorWInjContextCmp?.triggerSubmit();
|
|
2665
2738
|
}
|
|
2666
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
2667
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
2739
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
2668
2741
|
}
|
|
2669
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
2742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionEditorComponent, decorators: [{
|
|
2670
2743
|
type: Component,
|
|
2671
|
-
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 [
|
|
2672
|
-
}],
|
|
2673
|
-
type: Input,
|
|
2674
|
-
args: [{ required: true }]
|
|
2675
|
-
}], itemIdInput: [{
|
|
2676
|
-
type: Input,
|
|
2677
|
-
args: ['itemId']
|
|
2678
|
-
}], itemInput: [{
|
|
2679
|
-
type: Input,
|
|
2680
|
-
args: ['item']
|
|
2681
|
-
}], actionData: [{
|
|
2682
|
-
type: Input
|
|
2683
|
-
}], dataProvider: [{
|
|
2684
|
-
type: Input
|
|
2685
|
-
}], actionRunEventEmitter: [{
|
|
2686
|
-
type: Output,
|
|
2687
|
-
args: ['actionSubmit']
|
|
2688
|
-
}], actionCancelEventEmitter: [{
|
|
2689
|
-
type: Output,
|
|
2690
|
-
args: ['actionCancel']
|
|
2691
|
-
}] } });
|
|
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: () => [] });
|
|
2692
2746
|
|
|
2693
2747
|
class DataLanguageDropdownComponent {
|
|
2694
|
-
constructor(
|
|
2695
|
-
this.commons = commons;
|
|
2748
|
+
constructor() {
|
|
2696
2749
|
this.viewContainer = inject(ViewContainer, { optional: true });
|
|
2697
|
-
this.
|
|
2698
|
-
this.
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
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);
|
|
2702
2763
|
this.viewContainer?.reloadTable({});
|
|
2703
2764
|
}
|
|
2704
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
2705
|
-
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 }); }
|
|
2706
2767
|
}
|
|
2707
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
2768
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DataLanguageDropdownComponent, decorators: [{
|
|
2708
2769
|
type: Component,
|
|
2709
|
-
args: [{ standalone: true, selector: 'mng-data-language-dropdown', imports: [DropdownComponent, FormsModule], template: "<mng-dropdown [dataProvider]=\"selectionItemsDataProvider\" [ngModel]=\"commons.
|
|
2710
|
-
}]
|
|
2711
|
-
type: Input,
|
|
2712
|
-
args: [{ required: true }]
|
|
2713
|
-
}], actionData: [{
|
|
2714
|
-
type: Input,
|
|
2715
|
-
args: [{ required: true }]
|
|
2716
|
-
}], item: [{
|
|
2717
|
-
type: Input,
|
|
2718
|
-
args: [{ required: true }]
|
|
2719
|
-
}], itemId: [{
|
|
2720
|
-
type: Input,
|
|
2721
|
-
args: [{ required: true }]
|
|
2722
|
-
}], enabled: [{
|
|
2723
|
-
type: Input,
|
|
2724
|
-
args: [{ required: true }]
|
|
2725
|
-
}], loading: [{
|
|
2726
|
-
type: Input,
|
|
2727
|
-
args: [{ required: true }]
|
|
2728
|
-
}], triggerActionEventEmitter: [{
|
|
2729
|
-
type: Output
|
|
2730
|
-
}], dropdown: [{
|
|
2731
|
-
type: ViewChild,
|
|
2732
|
-
args: [DropdownComponent]
|
|
2733
|
-
}] } });
|
|
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
|
+
}] });
|
|
2734
2772
|
|
|
2735
2773
|
class ActionRouteComponent {
|
|
2736
|
-
constructor(
|
|
2737
|
-
this.router =
|
|
2738
|
-
this.route =
|
|
2739
|
-
this.actionExecutor =
|
|
2740
|
-
this.viewContainer =
|
|
2741
|
-
this.
|
|
2742
|
-
this.actions = [];
|
|
2743
|
-
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) ?? [];
|
|
2744
2781
|
this.isRouterNavigationInProgress = false;
|
|
2745
2782
|
}
|
|
2746
2783
|
ngOnInit() {
|
|
2747
|
-
this.
|
|
2748
|
-
this.subscriptions.push(this.route.params.subscribe(p => {
|
|
2784
|
+
this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(p => {
|
|
2749
2785
|
const action = this.findActionForRoute(p) ?? undefined;
|
|
2750
2786
|
if (action) {
|
|
2751
2787
|
this.activateAction(action, p, this.route.snapshot.queryParams);
|
|
2752
2788
|
}
|
|
2753
|
-
})
|
|
2754
|
-
this.
|
|
2789
|
+
});
|
|
2790
|
+
this.router.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(e => {
|
|
2755
2791
|
if (e instanceof NavigationStart) {
|
|
2756
2792
|
this.isRouterNavigationInProgress = true;
|
|
2757
2793
|
}
|
|
2758
2794
|
else if (e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped) {
|
|
2759
2795
|
this.isRouterNavigationInProgress = false;
|
|
2760
2796
|
}
|
|
2761
|
-
})
|
|
2797
|
+
});
|
|
2762
2798
|
}
|
|
2763
2799
|
ngOnDestroy() {
|
|
2764
2800
|
const instance = this.instance;
|
|
2765
2801
|
this.unsetInstance();
|
|
2766
2802
|
this.actionExecutor.onActionRouteDestroy(instance);
|
|
2767
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
2768
2803
|
}
|
|
2769
2804
|
activateAction(action, p, qp) {
|
|
2770
2805
|
const itemId = p['itemId'];
|
|
@@ -2840,6 +2875,7 @@ class ActionRouteComponent {
|
|
|
2840
2875
|
this.viewContainer?.reloadTable(); // reload only if no error in action and
|
|
2841
2876
|
this.untriggerAction();
|
|
2842
2877
|
break;
|
|
2878
|
+
case ActionInstanceStateEnum.FinishErrorFinal:
|
|
2843
2879
|
case ActionInstanceStateEnum.FinishDismissedFinal:
|
|
2844
2880
|
this.untriggerAction();
|
|
2845
2881
|
break;
|
|
@@ -2861,15 +2897,18 @@ class ActionRouteComponent {
|
|
|
2861
2897
|
this.instanceStateSubscription?.unsubscribe();
|
|
2862
2898
|
this.instanceReactivationSubscription?.unsubscribe();
|
|
2863
2899
|
}
|
|
2864
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
2865
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.
|
|
2900
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
2866
2902
|
}
|
|
2867
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
2903
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionRouteComponent, decorators: [{
|
|
2868
2904
|
type: Component,
|
|
2869
2905
|
args: [{ standalone: true, selector: 'mng-action-route', changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideActionExecutor()], template: "" }]
|
|
2870
|
-
}]
|
|
2871
|
-
|
|
2872
|
-
|
|
2906
|
+
}] });
|
|
2907
|
+
|
|
2908
|
+
var actionRoute_component = /*#__PURE__*/Object.freeze({
|
|
2909
|
+
__proto__: null,
|
|
2910
|
+
default: ActionRouteComponent
|
|
2911
|
+
});
|
|
2873
2912
|
|
|
2874
2913
|
function calculateTableColumnActionWidth(table, actions) {
|
|
2875
2914
|
const buttonsWidth = actions.reduce((acc, action) => acc + getActionButtonRoundedWidth(action) + 2 * Styles.ACTION_BUTTON_MARGIN_X, 0);
|
|
@@ -2977,10 +3016,10 @@ class ActionTableComponent {
|
|
|
2977
3016
|
this.reload();
|
|
2978
3017
|
}
|
|
2979
3018
|
}
|
|
2980
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
2981
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
3019
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3020
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: ActionTableComponent, isStandalone: true, selector: "mng-action-table", inputs: { descriptor: "descriptor", items: "items", result: ["result", "result", (value) => (isObservable(value) ? value : of(value))], loading: ["loading", "loading", boolean$Attribute], dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", globalFilterFields: "globalFilterFields", actions: "actions", captionComponent: "captionComponent", columnActionComponent: "columnActionComponent", columnActionMinWidth: "columnActionMinWidth" }, outputs: { loadEventEmitter: "tableLoad", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnActionCmpInstEventEmitter: "columnActionComponentInstance" }, providers: [provideActionExecutor()], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], viewQueries: [{ propertyName: "table", first: true, predicate: TableComponent, descendants: true }, { propertyName: "components", predicate: ComponentDirective, descendants: true }], ngImport: i0, template: "<mng-table\n [descriptor]=\"descriptor\"\n [items]=\"items\"\n [result]=\"result\"\n [loading]=\"loading\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"useQueryParams\"\n [selectionMode]=\"selectionMode\"\n [selectionEnabled]=\"selectionEnabled\"\n [globalFilterFields]=\"globalFilterFields\"\n [captionComponent]=\"captionComponent\"\n [columnCustomLastComponent]=\"columnActionComponent\"\n [columnLastMinWidth]=\"columnActionMinWidth\"\n (tableLoad)=\"loadEventEmitter.next($event)\"\n (cellClick)=\"onCellClick($event)\"\n (selectionChange)=\"onSelectionChange($event)\"\n (captionComponentInstance)=\"captionCmpInstEventEmitter.next($event)\"\n (columnCustomLastComponentInstance)=\"columnActionCmpInstEventEmitter.next($event)\">\n @if (!columnActionComponent && rowInlineActions().length > 0) {\n <ng-template mngTemplate=\"columnCustomLast\" let-item=\"rowItem\" let-idx=\"rowIndex\">\n @for (action of rowInlineActions(); track action.actionNameLong) {\n <mng-action\n [action]=\"action\"\n [item]=\"item\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor.model.idProperty ? item[descriptor.model.idProperty!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n }\n </ng-template>\n }\n @if (captionTemplate() && !captionComponent) {\n <ng-template mngTemplate=\"caption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n </ng-template>\n }\n @if (rowExpandTemplate()) {\n <ng-template mngTemplate=\"rowExpandContent\" let-item=\"rowItem\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </ng-template>\n }\n @if (footerTemplate()) {\n <ng-template mngTemplate=\"footer\" let-data=\"data\" let-totalCount=\"totalCount\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data, totalCount}\"></ng-container>\n </ng-template>\n }\n</mng-table>\n", dependencies: [{ 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: "component", type: ActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "dataListParams", "dataProvider", "hostComponent", "route", "disabled", "loading", "selectedItems"], outputs: ["finish"] }, { kind: "directive", type: TemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2982
3021
|
}
|
|
2983
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: ActionTableComponent, decorators: [{
|
|
2984
3023
|
type: Component,
|
|
2985
3024
|
args: [{ standalone: true, selector: 'mng-action-table', imports: [TableComponent, ActionComponent, TemplateDirective, NgTemplateOutlet], providers: [provideActionExecutor()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table\n [descriptor]=\"descriptor\"\n [items]=\"items\"\n [result]=\"result\"\n [loading]=\"loading\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"useQueryParams\"\n [selectionMode]=\"selectionMode\"\n [selectionEnabled]=\"selectionEnabled\"\n [globalFilterFields]=\"globalFilterFields\"\n [captionComponent]=\"captionComponent\"\n [columnCustomLastComponent]=\"columnActionComponent\"\n [columnLastMinWidth]=\"columnActionMinWidth\"\n (tableLoad)=\"loadEventEmitter.next($event)\"\n (cellClick)=\"onCellClick($event)\"\n (selectionChange)=\"onSelectionChange($event)\"\n (captionComponentInstance)=\"captionCmpInstEventEmitter.next($event)\"\n (columnCustomLastComponentInstance)=\"columnActionCmpInstEventEmitter.next($event)\">\n @if (!columnActionComponent && rowInlineActions().length > 0) {\n <ng-template mngTemplate=\"columnCustomLast\" let-item=\"rowItem\" let-idx=\"rowIndex\">\n @for (action of rowInlineActions(); track action.actionNameLong) {\n <mng-action\n [action]=\"action\"\n [item]=\"item\"\n [hostComponent]=\"this\"\n [itemId]=\"descriptor.model.idProperty ? item[descriptor.model.idProperty!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n }\n </ng-template>\n }\n @if (captionTemplate() && !captionComponent) {\n <ng-template mngTemplate=\"caption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate()\"></ng-container>\n </ng-template>\n }\n @if (rowExpandTemplate()) {\n <ng-template mngTemplate=\"rowExpandContent\" let-item=\"rowItem\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </ng-template>\n }\n @if (footerTemplate()) {\n <ng-template mngTemplate=\"footer\" let-data=\"data\" let-totalCount=\"totalCount\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data, totalCount}\"></ng-container>\n </ng-template>\n }\n</mng-table>\n" }]
|
|
2986
3025
|
}], ctorParameters: () => [], propDecorators: { descriptor: [{
|
|
@@ -3067,10 +3106,10 @@ class DefaultDataProviderExecutor extends DataProviderExecutor {
|
|
|
3067
3106
|
runDelete(ctx, fallback) {
|
|
3068
3107
|
return fallback ? runFnFromDataProviderOrFallback(ctx, runDeleteFromDataProvider, fallback) : runDeleteFromDataProvider(ctx);
|
|
3069
3108
|
}
|
|
3070
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3071
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
3109
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DefaultDataProviderExecutor, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3110
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DefaultDataProviderExecutor }); }
|
|
3072
3111
|
}
|
|
3073
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: DefaultDataProviderExecutor, decorators: [{
|
|
3074
3113
|
type: Injectable
|
|
3075
3114
|
}] });
|
|
3076
3115
|
|
|
@@ -3084,6 +3123,9 @@ class FormlyFieldActionComponent extends FieldType {
|
|
|
3084
3123
|
this.props.fieldComponent = this;
|
|
3085
3124
|
this.buttonClass = this.descriptor.button.styleClass.build();
|
|
3086
3125
|
}
|
|
3126
|
+
ngOnDestroy() {
|
|
3127
|
+
this.resultSubscription?.unsubscribe();
|
|
3128
|
+
}
|
|
3087
3129
|
onClick() {
|
|
3088
3130
|
this.actionMessage = undefined;
|
|
3089
3131
|
const result = this.descriptor.runFunction?.({
|
|
@@ -3100,7 +3142,8 @@ class FormlyFieldActionComponent extends FieldType {
|
|
|
3100
3142
|
});
|
|
3101
3143
|
if (result) {
|
|
3102
3144
|
if (isObservable(result)) {
|
|
3103
|
-
|
|
3145
|
+
this.resultSubscription?.unsubscribe();
|
|
3146
|
+
this.resultSubscription = result.subscribe(res => this.processResult(res));
|
|
3104
3147
|
}
|
|
3105
3148
|
else {
|
|
3106
3149
|
this.processResult(result);
|
|
@@ -3112,10 +3155,10 @@ class FormlyFieldActionComponent extends FieldType {
|
|
|
3112
3155
|
this.actionMessage = res.message;
|
|
3113
3156
|
}
|
|
3114
3157
|
}
|
|
3115
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3116
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
3158
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3159
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldActionComponent, isStandalone: true, selector: "mng-formly-field-action", usesInheritance: true, ngImport: i0, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n @if (actionMessage) {\n <p-message [text]=\"actionMessage.content\" [severity]=\"actionMessage.severity ?? 'success'\"></p-message>\n }\n</div>\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: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { 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: "ngmodule", type: MessageModule }, { kind: "component", type: i5.UIMessage, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3117
3160
|
}
|
|
3118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldActionComponent, decorators: [{
|
|
3119
3162
|
type: Component,
|
|
3120
3163
|
args: [{ standalone: true, selector: 'mng-formly-field-action', imports: [ButtonModule, RippleModule, TranslateModule, TooltipModule, JsonPipe, MessageModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n @if (actionMessage) {\n <p-message [text]=\"actionMessage.content\" [severity]=\"actionMessage.severity ?? 'success'\"></p-message>\n }\n</div>\n" }]
|
|
3121
3164
|
}] });
|
|
@@ -3123,6 +3166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
3123
3166
|
class FormlyFieldAutocompleteComponent extends FieldType {
|
|
3124
3167
|
constructor() {
|
|
3125
3168
|
super(...arguments);
|
|
3169
|
+
this.destroyRef = inject(DestroyRef);
|
|
3126
3170
|
this.subscriptions = [];
|
|
3127
3171
|
}
|
|
3128
3172
|
ngOnInit() {
|
|
@@ -3130,36 +3174,31 @@ class FormlyFieldAutocompleteComponent extends FieldType {
|
|
|
3130
3174
|
this.descriptor = this.props.descriptor;
|
|
3131
3175
|
this.props.fieldComponent = this;
|
|
3132
3176
|
// emit lifecycle event
|
|
3133
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3177
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3134
3178
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3135
3179
|
});
|
|
3136
|
-
|
|
3137
|
-
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, {
|
|
3138
3182
|
value: v
|
|
3139
3183
|
});
|
|
3140
|
-
|
|
3141
|
-
this.props['onValueChange'](this.field, v);
|
|
3142
|
-
}
|
|
3184
|
+
this.props.onValueChange?.(this.field, v);
|
|
3143
3185
|
});
|
|
3144
|
-
this.subscriptions.push(subscription);
|
|
3145
3186
|
}
|
|
3146
3187
|
ngAfterViewInit() {
|
|
3147
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3188
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3148
3189
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3149
3190
|
});
|
|
3150
3191
|
}
|
|
3151
3192
|
ngOnDestroy() {
|
|
3152
|
-
// warning: formly calls on destroy before on init
|
|
3153
|
-
this.subscriptions.forEach(value => value.unsubscribe());
|
|
3154
3193
|
// emit lifecycle event
|
|
3155
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3194
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3156
3195
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3157
3196
|
});
|
|
3158
3197
|
}
|
|
3159
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3160
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.
|
|
3198
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
3161
3200
|
}
|
|
3162
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldAutocompleteComponent, decorators: [{
|
|
3163
3202
|
type: Component,
|
|
3164
3203
|
args: [{ standalone: true, selector: 'mng-formly-field-autocomplete', imports: [AutocompleteComponent, ReactiveFormsModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
|
|
3165
3204
|
}] });
|
|
@@ -3185,10 +3224,10 @@ class FormlyFieldCustomComponent extends FieldType {
|
|
|
3185
3224
|
...this.descriptor.customComponentInputs
|
|
3186
3225
|
};
|
|
3187
3226
|
}
|
|
3188
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3189
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.
|
|
3227
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldCustomComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
3190
3229
|
}
|
|
3191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldCustomComponent, decorators: [{
|
|
3192
3231
|
type: Component,
|
|
3193
3232
|
args: [{
|
|
3194
3233
|
standalone: true,
|
|
@@ -3202,38 +3241,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
3202
3241
|
class FormlyFieldDropdownComponent extends FieldType {
|
|
3203
3242
|
constructor() {
|
|
3204
3243
|
super(...arguments);
|
|
3205
|
-
this.
|
|
3244
|
+
this.destroyRef = inject(DestroyRef);
|
|
3206
3245
|
}
|
|
3207
3246
|
ngOnInit() {
|
|
3208
3247
|
this.dFormControl = this.formControl;
|
|
3209
3248
|
this.descriptor = this.props.descriptor;
|
|
3210
3249
|
this.props.fieldComponent = this;
|
|
3211
3250
|
// emit lifecycle event
|
|
3212
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3251
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3213
3252
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3214
3253
|
});
|
|
3215
|
-
|
|
3216
|
-
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, {
|
|
3217
3256
|
value: v
|
|
3218
3257
|
});
|
|
3219
|
-
|
|
3220
|
-
this.props['onValueChange'](this.field, v);
|
|
3221
|
-
}
|
|
3258
|
+
this.props.onValueChange?.(this.field, v);
|
|
3222
3259
|
});
|
|
3223
|
-
this.subscriptions.push(subscription);
|
|
3224
3260
|
}
|
|
3225
3261
|
ngOnDestroy() {
|
|
3226
|
-
// warning: formly calls on destroy before on init
|
|
3227
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3228
3262
|
// emit lifecycle event
|
|
3229
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3263
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3230
3264
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3231
3265
|
});
|
|
3232
3266
|
}
|
|
3233
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3234
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.
|
|
3267
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDropdownComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
3235
3269
|
}
|
|
3236
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDropdownComponent, decorators: [{
|
|
3237
3271
|
type: Component,
|
|
3238
3272
|
args: [{ standalone: true, selector: 'mng-formly-field-dropdown', imports: [DropdownComponent, ReactiveFormsModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
|
|
3239
3273
|
}] });
|
|
@@ -3248,67 +3282,57 @@ class FormlyFieldFieldsetComponent extends FieldType {
|
|
|
3248
3282
|
this.descriptor = this.props.descriptor;
|
|
3249
3283
|
this.props.fieldComponent = this;
|
|
3250
3284
|
}
|
|
3251
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3252
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
3285
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3286
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldFieldsetComponent, isStandalone: true, selector: "mng-formly-field-fieldset", usesInheritance: true, ngImport: i0, template: "@for (group of field.fieldGroup; track group) {\n @switch (group?.props?.['descriptor']?.type) {\n @case (typeFieldset) {\n <p-fieldset [legend]=\"group.props?.label! | translate\">\n <formly-field [field]=\"group\"></formly-field>\n </p-fieldset>\n }\n @default {\n <formly-field [field]=\"group\"></formly-field>\n }\n }\n}\n", dependencies: [{ kind: "ngmodule", type: FieldsetModule }, { kind: "component", type: i1$4.Fieldset, selector: "p-fieldset", inputs: ["legend", "toggleable", "collapsed", "style", "styleClass", "transitionOptions"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.FormlyField, selector: "formly-field", inputs: ["field"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3253
3287
|
}
|
|
3254
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldFieldsetComponent, decorators: [{
|
|
3255
3289
|
type: Component,
|
|
3256
3290
|
args: [{ standalone: true, selector: 'mng-formly-field-fieldset', imports: [FieldsetModule, FormlyModule, TranslateModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (group of field.fieldGroup; track group) {\n @switch (group?.props?.['descriptor']?.type) {\n @case (typeFieldset) {\n <p-fieldset [legend]=\"group.props?.label! | translate\">\n <formly-field [field]=\"group\"></formly-field>\n </p-fieldset>\n }\n @default {\n <formly-field [field]=\"group\"></formly-field>\n }\n }\n}\n" }]
|
|
3257
3291
|
}] });
|
|
3258
3292
|
|
|
3259
3293
|
class FormlyFieldInputComponent extends FieldType {
|
|
3260
|
-
constructor(
|
|
3261
|
-
super();
|
|
3262
|
-
this.applicationLocale = applicationLocale;
|
|
3263
|
-
this.formBuilder = formBuilder;
|
|
3264
|
-
this.translateService = translateService;
|
|
3294
|
+
constructor() {
|
|
3295
|
+
super(...arguments);
|
|
3265
3296
|
this.NUMBER_MIN_SAFE = Number.MIN_SAFE_INTEGER;
|
|
3266
3297
|
this.NUMBER_MAX_SAFE = Number.MAX_SAFE_INTEGER;
|
|
3267
3298
|
this.DESC_INPUT_TYPE_IMAGE_FILE = FieldInputTypeEnum.ImageFile;
|
|
3299
|
+
this.applicationLocale = inject(LOCALE_ID);
|
|
3300
|
+
this.destroyRef = inject(DestroyRef);
|
|
3301
|
+
this.formBuilder = inject(FormBuilder);
|
|
3302
|
+
this.translateService = inject(TranslateService);
|
|
3268
3303
|
this.numberFieldMode = 'decimal';
|
|
3269
3304
|
this.files = [];
|
|
3270
|
-
this.
|
|
3305
|
+
this.imageFormArray = this.formBuilder.array([]);
|
|
3271
3306
|
}
|
|
3272
3307
|
ngOnInit() {
|
|
3273
3308
|
this.iFormControl = this.formControl;
|
|
3274
3309
|
this.descriptor = this.props.descriptor;
|
|
3275
3310
|
this.props.fieldComponent = this;
|
|
3276
3311
|
this.formEditorComponent = this.props.formEditorComponent;
|
|
3277
|
-
this.imageFormArray = this.formBuilder.array([]);
|
|
3278
3312
|
if (this.descriptor.fieldType === FieldInputTypeEnum.Currency) {
|
|
3279
3313
|
this.numberFieldMode = 'currency';
|
|
3280
3314
|
if (this.descriptor.currencyFromProperty) {
|
|
3281
|
-
|
|
3315
|
+
this.iFormControl
|
|
3282
3316
|
.get(this.descriptor.currencyFromProperty)
|
|
3283
|
-
.valueChanges.pipe(startWith(this.model[this.descriptor.currencyFromProperty]), distinctUntilChanged())
|
|
3317
|
+
.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(this.model[this.descriptor.currencyFromProperty]), distinctUntilChanged())
|
|
3284
3318
|
.subscribe(c => {
|
|
3285
3319
|
this.currency = c;
|
|
3286
3320
|
});
|
|
3287
|
-
this.subscriptions.push(currencyFromPropSubscription);
|
|
3288
3321
|
}
|
|
3289
3322
|
else {
|
|
3290
3323
|
this.currency = this.descriptor.currency ?? 'EUR';
|
|
3291
3324
|
}
|
|
3292
3325
|
}
|
|
3293
3326
|
// emit lifecycle event
|
|
3294
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3327
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3295
3328
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3296
3329
|
});
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
const dateObject = new Date(this.iFormControl.value);
|
|
3300
|
-
this.iFormControl.setValue(dateObject);
|
|
3301
|
-
this.iFormControl.markAsPristine();
|
|
3302
|
-
}
|
|
3303
|
-
const subscription = this.formControl.valueChanges.pipe(startWith(this.formControl.value), distinctUntilChanged()).subscribe(v => {
|
|
3304
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, FormlyFieldInputComponent, this, {
|
|
3330
|
+
this.formControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(this.formControl.value), distinctUntilChanged()).subscribe(v => {
|
|
3331
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3305
3332
|
value: v
|
|
3306
3333
|
});
|
|
3307
|
-
|
|
3308
|
-
this.props['onValueChange'](this.field, v);
|
|
3309
|
-
}
|
|
3334
|
+
this.props.onValueChange?.(this.field, v);
|
|
3310
3335
|
});
|
|
3311
|
-
this.subscriptions.push(subscription);
|
|
3312
3336
|
if (this.props.type === 'imageUrl') {
|
|
3313
3337
|
const startValue = this.iFormControl.value;
|
|
3314
3338
|
if (this.descriptor.fileMultiple) {
|
|
@@ -3330,19 +3354,17 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3330
3354
|
this.addImageUrl();
|
|
3331
3355
|
}
|
|
3332
3356
|
}
|
|
3333
|
-
|
|
3357
|
+
this.imageFormArray.valueChanges.pipe(takeUntilDestroyed(this.destroyRef), distinctUntilChanged()).subscribe(v => {
|
|
3334
3358
|
const fcv = v.filter((i) => !!i && typeof i === 'string' && i.length > 0);
|
|
3335
3359
|
this.iFormControl.setValue(fcv.length > 0 ? (this.descriptor.fileMultiple ? fcv : fcv[0]) : undefined);
|
|
3336
3360
|
this.iFormControl.updateValueAndValidity();
|
|
3337
3361
|
});
|
|
3338
|
-
this.subscriptions.push(subscription);
|
|
3339
3362
|
}
|
|
3340
3363
|
}
|
|
3341
3364
|
ngOnDestroy() {
|
|
3342
3365
|
// warning: formly calls on destroy before on init
|
|
3343
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3344
3366
|
// emit lifecycle event
|
|
3345
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3367
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3346
3368
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3347
3369
|
});
|
|
3348
3370
|
}
|
|
@@ -3378,7 +3400,7 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3378
3400
|
onImageUrlLoadError() {
|
|
3379
3401
|
if (this.formEditorComponent) {
|
|
3380
3402
|
const message = getFormEditorWarningMessage(this.translateService, 'general.error', 'mngEditor.imageLoadError');
|
|
3381
|
-
this.formEditorComponent.formMessages
|
|
3403
|
+
this.formEditorComponent.formMessages.set([...this.formEditorComponent.formMessages(), message]);
|
|
3382
3404
|
}
|
|
3383
3405
|
}
|
|
3384
3406
|
updateFileFormControl() {
|
|
@@ -3413,10 +3435,10 @@ class FormlyFieldInputComponent extends FieldType {
|
|
|
3413
3435
|
return 'pi-file';
|
|
3414
3436
|
}
|
|
3415
3437
|
}
|
|
3416
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3417
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.2", 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]=\"$any(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 ('datepicker') {\n <p-calendar\n appendTo=\"body\"\n [formControl]=\"iFormControl\"\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 </p-calendar>\n }\n @case ('mask') {\n <p-inputMask\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 [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: i3$1.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$4.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$2.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }, { kind: "component", type: i2$2.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2$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: CalendarModule }, { kind: "component", type: i8$1.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"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i10$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: i11.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: "ngmodule", type: ImageModule }, { kind: "component", type: i12.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: i13.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i14.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
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
3418
3440
|
}
|
|
3419
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldInputComponent, decorators: [{
|
|
3420
3442
|
type: Component,
|
|
3421
3443
|
args: [{ standalone: true, selector: 'mng-formly-field-input', imports: [
|
|
3422
3444
|
InputNumberModule,
|
|
@@ -3425,7 +3447,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
3425
3447
|
TranslateModule,
|
|
3426
3448
|
InputSwitchModule,
|
|
3427
3449
|
RadioButtonModule,
|
|
3428
|
-
CalendarModule,
|
|
3429
3450
|
InputMaskModule,
|
|
3430
3451
|
FileUploadModule,
|
|
3431
3452
|
ImageModule,
|
|
@@ -3434,11 +3455,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
3434
3455
|
RippleModule,
|
|
3435
3456
|
TimesIcon,
|
|
3436
3457
|
InputTrimDirective
|
|
3437
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, 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]=\"
|
|
3438
|
-
}]
|
|
3439
|
-
type: Inject,
|
|
3440
|
-
args: [LOCALE_ID]
|
|
3441
|
-
}] }, { type: i1$2.FormBuilder }, { type: i2$1.TranslateService }] });
|
|
3458
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
|
|
3459
|
+
}] });
|
|
3442
3460
|
|
|
3443
3461
|
class FormlyFieldLabelComponent extends FieldType {
|
|
3444
3462
|
constructor() {
|
|
@@ -3450,10 +3468,10 @@ class FormlyFieldLabelComponent extends FieldType {
|
|
|
3450
3468
|
this.props.fieldComponent = this;
|
|
3451
3469
|
this.formControl?.patchValue(this.descriptor.label);
|
|
3452
3470
|
}
|
|
3453
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3454
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.
|
|
3471
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3472
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: FormlyFieldLabelComponent, isStandalone: true, selector: "mng-formly-field-label", host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: "", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3455
3473
|
}
|
|
3456
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3474
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldLabelComponent, decorators: [{
|
|
3457
3475
|
type: Component,
|
|
3458
3476
|
args: [{ standalone: true, selector: 'mng-formly-field-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "" }]
|
|
3459
3477
|
}], propDecorators: { className: [{
|
|
@@ -3465,6 +3483,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3465
3483
|
constructor(injector) {
|
|
3466
3484
|
super();
|
|
3467
3485
|
this.injector = injector;
|
|
3486
|
+
this.destroyRef = inject(DestroyRef);
|
|
3468
3487
|
this.logger = inject(LoggerService).create('FormlyFieldLookupDialogComponent');
|
|
3469
3488
|
this.fieldLabelFormControl = new FormControl();
|
|
3470
3489
|
this.addItemsSubject = new ReplaySubject(1);
|
|
@@ -3477,13 +3496,12 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3477
3496
|
this.dialogSelectedItem = null;
|
|
3478
3497
|
this.dialogMessages = [];
|
|
3479
3498
|
this.dialogIsLoading$ = this.dialogIsLoadingSubject.asObservable();
|
|
3480
|
-
this.subscriptions = [];
|
|
3481
3499
|
}
|
|
3482
3500
|
ngOnInit() {
|
|
3483
3501
|
this.descriptor = this.props.descriptor;
|
|
3484
3502
|
this.props.fieldComponent = this;
|
|
3485
3503
|
// emit lifecycle event
|
|
3486
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3504
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3487
3505
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3488
3506
|
});
|
|
3489
3507
|
this.config = this.descriptor.config;
|
|
@@ -3493,7 +3511,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3493
3511
|
}
|
|
3494
3512
|
// init values
|
|
3495
3513
|
this.setFieldLabelValue(this.formControl.value);
|
|
3496
|
-
|
|
3514
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), distinctUntilChanged((prev, curr) => {
|
|
3497
3515
|
const compareProp = this.descriptor.dialogTableDescriptor.trackProperty ?? this.descriptor.dialogTableDescriptor.model.idProperty;
|
|
3498
3516
|
if (compareProp && typeof prev === 'object' && typeof curr === 'object') {
|
|
3499
3517
|
return prev[compareProp] === curr[compareProp];
|
|
@@ -3501,28 +3519,23 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3501
3519
|
else {
|
|
3502
3520
|
return prev === curr;
|
|
3503
3521
|
}
|
|
3504
|
-
})).subscribe(v => {
|
|
3522
|
+
}), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3505
3523
|
this.setFieldLabelValue(v);
|
|
3506
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3524
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3507
3525
|
value: v
|
|
3508
3526
|
});
|
|
3509
|
-
|
|
3510
|
-
this.props['onValueChange'](this.field, v);
|
|
3511
|
-
}
|
|
3527
|
+
this.props.onValueChange?.(this.field, v);
|
|
3512
3528
|
});
|
|
3513
|
-
this.subscriptions.push(subscription);
|
|
3514
3529
|
}
|
|
3515
3530
|
ngAfterViewInit() {
|
|
3516
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3531
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3517
3532
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3518
3533
|
});
|
|
3519
3534
|
}
|
|
3520
3535
|
ngOnDestroy() {
|
|
3521
|
-
// warning: formly calls on destroy before on init
|
|
3522
3536
|
this.lookupDataProviderSubscription?.unsubscribe();
|
|
3523
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3524
3537
|
// emit lifecycle event
|
|
3525
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3538
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3526
3539
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3527
3540
|
});
|
|
3528
3541
|
}
|
|
@@ -3547,14 +3560,14 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3547
3560
|
this.addItemsSubject.next(dataList);
|
|
3548
3561
|
this.dialogAreItemsLoaded = true;
|
|
3549
3562
|
this.dialogIsLoadingSubject.next(false);
|
|
3550
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider,
|
|
3563
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider, this, {
|
|
3551
3564
|
eventSubtype: 'LookupNext',
|
|
3552
3565
|
queryResult: dataList
|
|
3553
3566
|
});
|
|
3554
3567
|
},
|
|
3555
3568
|
error: err => {
|
|
3556
3569
|
this.dialogIsLoadingSubject.next(false);
|
|
3557
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider,
|
|
3570
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DataProvider, this, {
|
|
3558
3571
|
eventSubtype: 'LookupError',
|
|
3559
3572
|
queryResult: err
|
|
3560
3573
|
});
|
|
@@ -3568,7 +3581,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3568
3581
|
this.dialogSelectedItem = null;
|
|
3569
3582
|
this.isDialogVisible = true;
|
|
3570
3583
|
this.formControl.markAsTouched();
|
|
3571
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3584
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3572
3585
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3573
3586
|
dialogVisible: true
|
|
3574
3587
|
});
|
|
@@ -3577,13 +3590,13 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3577
3590
|
this.dialogSelectedItem = item;
|
|
3578
3591
|
}
|
|
3579
3592
|
onCaptionCmpInst(instance) {
|
|
3580
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3593
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3581
3594
|
eventSubtype: FormFieldEventDialogSubtype.TABLE_CAPTION_COMPONENT_INSTANCE,
|
|
3582
3595
|
captionComponentInstance: instance
|
|
3583
3596
|
});
|
|
3584
3597
|
}
|
|
3585
3598
|
onColumnActionCmpInst(instance) {
|
|
3586
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3599
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3587
3600
|
eventSubtype: FormFieldEventDialogSubtype.TABLE_COLUMN_ACTIONS_COMPONENT_INSTANCE,
|
|
3588
3601
|
captionComponentInstance: instance
|
|
3589
3602
|
});
|
|
@@ -3598,7 +3611,7 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3598
3611
|
}
|
|
3599
3612
|
hideDialog() {
|
|
3600
3613
|
this.isDialogVisible = false;
|
|
3601
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3614
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3602
3615
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3603
3616
|
dialogVisible: false
|
|
3604
3617
|
});
|
|
@@ -3627,10 +3640,10 @@ class FormlyFieldLookupDialogComponent extends FieldType {
|
|
|
3627
3640
|
this.fieldLabelFormControl.setValue(value);
|
|
3628
3641
|
}
|
|
3629
3642
|
}
|
|
3630
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3631
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
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 }); }
|
|
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 }); }
|
|
3632
3645
|
}
|
|
3633
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldLookupDialogComponent, decorators: [{
|
|
3634
3647
|
type: Component,
|
|
3635
3648
|
args: [{ standalone: true, selector: 'mng-formly-field-lookup-dialog', imports: [
|
|
3636
3649
|
TranslateModule,
|
|
@@ -3651,14 +3664,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.2", ngImpor
|
|
|
3651
3664
|
}] } });
|
|
3652
3665
|
|
|
3653
3666
|
class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
3654
|
-
constructor(
|
|
3655
|
-
super();
|
|
3656
|
-
this.injector =
|
|
3667
|
+
constructor() {
|
|
3668
|
+
super(...arguments);
|
|
3669
|
+
this.injector = inject(Injector);
|
|
3670
|
+
this.destroyRef = inject(DestroyRef);
|
|
3657
3671
|
this.itemsSubject = new ReplaySubject(1);
|
|
3658
3672
|
this.items$ = this.itemsSubject.asObservable();
|
|
3659
3673
|
this.actions = [];
|
|
3660
3674
|
this.toolbarRightActions = [];
|
|
3661
|
-
this.subscriptions = [];
|
|
3662
3675
|
this.isDisabledSubject = new BehaviorSubject(false);
|
|
3663
3676
|
this.isEnabled$ = this.isDisabledSubject.asObservable().pipe(distinctUntilChanged(), map(e => !e));
|
|
3664
3677
|
}
|
|
@@ -3680,7 +3693,7 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3680
3693
|
this.formControl.markAsTouched();
|
|
3681
3694
|
return of(ctx.parameters.item || {});
|
|
3682
3695
|
});
|
|
3683
|
-
viewAction.withEditorActions([
|
|
3696
|
+
viewAction.withEditorActions([actionEditorCancel(viewAction)]);
|
|
3684
3697
|
viewAction.button.withLabel(null);
|
|
3685
3698
|
this.actions.push(viewAction);
|
|
3686
3699
|
}
|
|
@@ -3747,7 +3760,8 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3747
3760
|
this.actions.push(editAction);
|
|
3748
3761
|
}
|
|
3749
3762
|
if (hasDeleteAction) {
|
|
3750
|
-
const deleteAction =
|
|
3763
|
+
const deleteAction = new ActionDescriptorInst('delete', {
|
|
3764
|
+
model: this.descriptor.tableviewDescriptor.model,
|
|
3751
3765
|
parentType: this.descriptor.editor.model.type,
|
|
3752
3766
|
parentProperty: this.descriptor.property
|
|
3753
3767
|
})
|
|
@@ -3800,22 +3814,19 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3800
3814
|
this.formControl.patchValue([]);
|
|
3801
3815
|
}
|
|
3802
3816
|
// emit lifecycle event
|
|
3803
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3817
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3804
3818
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3805
3819
|
});
|
|
3806
|
-
|
|
3807
|
-
this.itemsSubject.next(v);
|
|
3820
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3821
|
+
this.itemsSubject.next(v ?? []);
|
|
3808
3822
|
// emit lifecycle event
|
|
3809
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3823
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3810
3824
|
value: v
|
|
3811
3825
|
});
|
|
3812
|
-
|
|
3813
|
-
this.props['onValueChange'](this.field, v);
|
|
3814
|
-
}
|
|
3826
|
+
this.props.onValueChange?.(this.field, v);
|
|
3815
3827
|
});
|
|
3816
|
-
this.subscriptions.push(subscription);
|
|
3817
3828
|
this.isDisabledSubject.next(this.formControl.disabled);
|
|
3818
|
-
|
|
3829
|
+
this.formControl.statusChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(status => {
|
|
3819
3830
|
if (status === 'DISABLED' && !this.isDisabledSubject.value) {
|
|
3820
3831
|
this.isDisabledSubject.next(true);
|
|
3821
3832
|
}
|
|
@@ -3823,47 +3834,44 @@ class FormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
3823
3834
|
this.isDisabledSubject.next(false);
|
|
3824
3835
|
}
|
|
3825
3836
|
});
|
|
3826
|
-
this.subscriptions.push(subscription);
|
|
3827
3837
|
}
|
|
3828
3838
|
ngAfterViewInit() {
|
|
3829
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3839
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3830
3840
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3831
3841
|
});
|
|
3832
3842
|
}
|
|
3833
3843
|
ngOnDestroy() {
|
|
3834
|
-
// warning: formly calls on destroy before on init
|
|
3835
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3836
3844
|
// emit lifecycle event
|
|
3837
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3845
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3838
3846
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3839
3847
|
});
|
|
3840
3848
|
}
|
|
3841
3849
|
hideActionsForRowWithDefaultLocalization(ctx) {
|
|
3842
3850
|
if (this.descriptor.tableDescriptor.isLocalized) {
|
|
3843
|
-
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()) {
|
|
3844
3852
|
return true;
|
|
3845
3853
|
}
|
|
3846
3854
|
}
|
|
3847
3855
|
return false;
|
|
3848
3856
|
}
|
|
3849
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
3850
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
3857
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
3851
3859
|
}
|
|
3852
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
3860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogFormComponent, decorators: [{
|
|
3853
3861
|
type: Component,
|
|
3854
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"] }]
|
|
3855
|
-
}]
|
|
3863
|
+
}] });
|
|
3856
3864
|
|
|
3857
3865
|
class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
3858
|
-
constructor(
|
|
3859
|
-
super();
|
|
3860
|
-
this.injector =
|
|
3866
|
+
constructor() {
|
|
3867
|
+
super(...arguments);
|
|
3868
|
+
this.injector = inject(Injector);
|
|
3869
|
+
this.destroyRef = inject(DestroyRef);
|
|
3861
3870
|
this.logger = inject(LoggerService).create('FormlyFieldTableDialogMultiselectComponent');
|
|
3862
3871
|
this.itemsSubject = new ReplaySubject(1);
|
|
3863
3872
|
this.itemsAsync = this.itemsSubject.asObservable();
|
|
3864
3873
|
this.addItemsSubject = new ReplaySubject(1);
|
|
3865
3874
|
this.addItemsAsync = this.addItemsSubject.asObservable();
|
|
3866
|
-
this.dialogUseDataProvider = false;
|
|
3867
3875
|
this.dialogDataProviderService = null;
|
|
3868
3876
|
this.dialogIsLoadingSubject = new ReplaySubject(1);
|
|
3869
3877
|
this.isDialogVisible = false;
|
|
@@ -3873,14 +3881,12 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3873
3881
|
this.hasAddAction = false;
|
|
3874
3882
|
this.hasDeleteAction = false;
|
|
3875
3883
|
this.searchDebounceSubject = new Subject();
|
|
3876
|
-
this.subscriptions = [];
|
|
3877
3884
|
}
|
|
3878
3885
|
ngOnInit() {
|
|
3879
3886
|
this.descriptor = this.props.descriptor;
|
|
3880
3887
|
this.props.fieldComponent = this;
|
|
3881
3888
|
this.dialogIsLoadingSubject.next(false);
|
|
3882
|
-
if (this.descriptor.lookupTableDataProvider
|
|
3883
|
-
this.dialogUseDataProvider = true;
|
|
3889
|
+
if (this.descriptor.lookupTableDataProvider.serviceType) {
|
|
3884
3890
|
this.dialogDataProviderService = this.injector.get(this.descriptor.lookupTableDataProvider.serviceType);
|
|
3885
3891
|
}
|
|
3886
3892
|
this.hasAddAction = this.descriptor.actions.some(a => a === FieldManyToManyEditorActionEnum.Add);
|
|
@@ -3890,43 +3896,38 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3890
3896
|
this.formControl.patchValue([]);
|
|
3891
3897
|
}
|
|
3892
3898
|
// emit lifecycle event
|
|
3893
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3899
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3894
3900
|
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
3895
3901
|
});
|
|
3896
|
-
|
|
3902
|
+
this.formControl.valueChanges.pipe(startWith(this.formControl.value), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(v => {
|
|
3897
3903
|
this.itemsSubject.next(v ?? []);
|
|
3898
3904
|
// emit lifecycle event
|
|
3899
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange,
|
|
3905
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
3900
3906
|
value: v ?? []
|
|
3901
3907
|
});
|
|
3902
|
-
|
|
3903
|
-
this.props['onValueChange'](this.field, v ?? []);
|
|
3904
|
-
}
|
|
3908
|
+
this.props.onValueChange?.(this.field, v);
|
|
3905
3909
|
});
|
|
3906
|
-
this.
|
|
3910
|
+
this.searchDebounceSubject.pipe(debounceTime(200), distinctUntilChanged(), takeUntilDestroyed(this.destroyRef)).subscribe(query => {
|
|
3907
3911
|
this.addTableComponent?.primeTable.filterGlobal(query, 'contains');
|
|
3908
|
-
})
|
|
3909
|
-
this.subscriptions.push(subscription);
|
|
3912
|
+
});
|
|
3910
3913
|
}
|
|
3911
3914
|
ngAfterViewInit() {
|
|
3912
3915
|
// emit lifecycle event
|
|
3913
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3916
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3914
3917
|
eventSubtype: FormFieldEventComponentSubtype.ON_VIEW_INIT
|
|
3915
3918
|
});
|
|
3916
3919
|
}
|
|
3917
3920
|
ngOnDestroy() {
|
|
3918
|
-
// warning: formly calls on destroy before on init
|
|
3919
3921
|
this.lookupDataProviderSubscription?.unsubscribe();
|
|
3920
|
-
this.subscriptions.forEach(s => s.unsubscribe());
|
|
3921
3922
|
// emit lifecycle event
|
|
3922
|
-
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle,
|
|
3923
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
3923
3924
|
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
3924
3925
|
});
|
|
3925
3926
|
}
|
|
3926
3927
|
openAddDialog() {
|
|
3927
3928
|
this.dialogSelectedAddItems = [];
|
|
3928
3929
|
this.isDialogVisible = true;
|
|
3929
|
-
if (!this.dialogAreItemsLoaded
|
|
3930
|
+
if (!this.dialogAreItemsLoaded) {
|
|
3930
3931
|
// wrapped in request animation frame due to primeng bug: https://github.com/primefaces/primeng/issues/12980
|
|
3931
3932
|
requestAnimationFrame(() => {
|
|
3932
3933
|
this.dialogIsLoadingSubject.next(true);
|
|
@@ -3941,7 +3942,7 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3941
3942
|
}
|
|
3942
3943
|
});
|
|
3943
3944
|
}
|
|
3944
|
-
if (this.descriptor.hasLookupExcludeValues) {
|
|
3945
|
+
if (this.descriptor.hasLookupExcludeValues && this.descriptor.lookupTableDataProvider.isLazy) {
|
|
3945
3946
|
const filterValues = this.formControl.value.map((i) => getObjectPropertyByPath(i, this.descriptor.excludeValueProperty));
|
|
3946
3947
|
params.filters = {
|
|
3947
3948
|
[this.descriptor.excludeFilterProperty]: {
|
|
@@ -3952,6 +3953,11 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3952
3953
|
}
|
|
3953
3954
|
this.lookupDataProviderSubscription = toObservable(this.descriptor.lookupTableDataProvider?.getAll(params, this.dialogDataProviderService)).subscribe({
|
|
3954
3955
|
next: res => {
|
|
3956
|
+
if (this.descriptor.hasLookupExcludeValues && !this.descriptor.lookupTableDataProvider.isLazy && res && Array.isArray(res.data) && res.data.length > 0) {
|
|
3957
|
+
const filterValues = this.formControl.value.map((i) => getObjectPropertyByPath(i, this.descriptor.excludeValueProperty));
|
|
3958
|
+
res.data = res.data.filter(i => filterValues.indexOf(i[this.descriptor.excludeFilterProperty]) < 0);
|
|
3959
|
+
res.totalCount = res.data.length;
|
|
3960
|
+
}
|
|
3955
3961
|
this.addItemsSubject.next(res);
|
|
3956
3962
|
this.dialogAreItemsLoaded = true;
|
|
3957
3963
|
this.dialogIsLoadingSubject.next(false);
|
|
@@ -3967,7 +3973,7 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3967
3973
|
});
|
|
3968
3974
|
}
|
|
3969
3975
|
this.formControl.markAsTouched();
|
|
3970
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3976
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3971
3977
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3972
3978
|
dialogVisible: true
|
|
3973
3979
|
});
|
|
@@ -3977,7 +3983,7 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
3977
3983
|
}
|
|
3978
3984
|
hideDialog() {
|
|
3979
3985
|
this.isDialogVisible = false;
|
|
3980
|
-
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle,
|
|
3986
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.DialogLifecycle, this, {
|
|
3981
3987
|
eventSubtype: FormFieldEventDialogSubtype.VISIBILITY,
|
|
3982
3988
|
dialogVisible: false
|
|
3983
3989
|
});
|
|
@@ -4018,22 +4024,22 @@ class FormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
|
4018
4024
|
const query = event.target.value;
|
|
4019
4025
|
this.searchDebounceSubject.next(query);
|
|
4020
4026
|
}
|
|
4021
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
4022
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
4027
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogMultiselectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
4023
4029
|
}
|
|
4024
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTableDialogMultiselectComponent, decorators: [{
|
|
4025
4031
|
type: Component,
|
|
4026
|
-
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=\"
|
|
4027
|
-
}],
|
|
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"] }]
|
|
4033
|
+
}], propDecorators: { addTableComponent: [{
|
|
4028
4034
|
type: ViewChild,
|
|
4029
4035
|
args: ['addTableComponent']
|
|
4030
4036
|
}] } });
|
|
4031
4037
|
|
|
4032
4038
|
class FormlyFieldTabsComponent extends FieldType {
|
|
4033
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
4034
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
4039
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTabsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4040
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldTabsComponent, isStandalone: true, selector: "mng-formly-field-tabs", usesInheritance: true, ngImport: i0, template: "<p-tabView [scrollable]=\"true\">\n @for (tab of field.fieldGroup; track tab) {\n <p-tabPanel [header]=\"tab.props?.label! | translate\" [headerStyleClass]=\"formControl!.valid ? 'p-tabview-title' : undefined\">\n <ng-template pTemplate=\"header\">\n <span class=\"p-tabview-title\" [class.p-tabview-title-error]=\"formState.submittedOn && formState['tab_' + (tab.id ? tab.id : tab.props?.label!) + '_invalid']\">{{\n tab.props?.label! | translate\n }}</span>\n </ng-template>\n <formly-field [field]=\"tab\"></formly-field>\n </p-tabPanel>\n }\n</p-tabView>\n", dependencies: [{ kind: "ngmodule", type: TabViewModule }, { kind: "component", type: i1$6.TabView, selector: "p-tabView", inputs: ["style", "styleClass", "controlClose", "scrollable", "activeIndex", "selectOnFocus", "nextButtonAriaLabel", "prevButtonAriaLabel", "autoHideButtons", "tabindex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { kind: "component", type: i1$6.TabPanel, selector: "p-tabPanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.FormlyField, selector: "formly-field", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4035
4041
|
}
|
|
4036
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldTabsComponent, decorators: [{
|
|
4037
4043
|
type: Component,
|
|
4038
4044
|
args: [{ standalone: true, selector: 'mng-formly-field-tabs', imports: [TabViewModule, TranslateModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-tabView [scrollable]=\"true\">\n @for (tab of field.fieldGroup; track tab) {\n <p-tabPanel [header]=\"tab.props?.label! | translate\" [headerStyleClass]=\"formControl!.valid ? 'p-tabview-title' : undefined\">\n <ng-template pTemplate=\"header\">\n <span class=\"p-tabview-title\" [class.p-tabview-title-error]=\"formState.submittedOn && formState['tab_' + (tab.id ? tab.id : tab.props?.label!) + '_invalid']\">{{\n tab.props?.label! | translate\n }}</span>\n </ng-template>\n <formly-field [field]=\"tab\"></formly-field>\n </p-tabPanel>\n }\n</p-tabView>\n" }]
|
|
4039
4045
|
}] });
|
|
@@ -4057,10 +4063,10 @@ class FormlyFieldNoLabelWrapperComponent extends FieldWrapper {
|
|
|
4057
4063
|
}
|
|
4058
4064
|
return field;
|
|
4059
4065
|
}
|
|
4060
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
4061
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
4066
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldNoLabelWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4067
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldNoLabelWrapperComponent, isStandalone: true, selector: "mng-formly-field-no-label-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field table'\">\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError && shouldShowError()) {\n <small class=\"block p-error\">\n <formly-validation-message [field]=\"sanitizeErrorsForGroups(field)\"></formly-validation-message>\n </small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4062
4068
|
}
|
|
4063
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4069
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldNoLabelWrapperComponent, decorators: [{
|
|
4064
4070
|
type: Component,
|
|
4065
4071
|
args: [{ standalone: true, selector: 'mng-formly-field-no-label-wrapper', imports: [FormlyModule, TranslateModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field table'\">\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError && shouldShowError()) {\n <small class=\"block p-error\">\n <formly-validation-message [field]=\"sanitizeErrorsForGroups(field)\"></formly-validation-message>\n </small>\n }\n</div>\n" }]
|
|
4066
4072
|
}] });
|
|
@@ -4081,14 +4087,104 @@ class FormlyFieldWrapperComponent extends FieldWrapper {
|
|
|
4081
4087
|
this.props?.['descriptor']?.withHelpText('');
|
|
4082
4088
|
}
|
|
4083
4089
|
}
|
|
4084
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
4085
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
4090
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4091
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: FormlyFieldWrapperComponent, isStandalone: true, selector: "mng-formly-field-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (props.label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ props!.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i2$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4086
4092
|
}
|
|
4087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4093
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldWrapperComponent, decorators: [{
|
|
4088
4094
|
type: Component,
|
|
4089
4095
|
args: [{ standalone: true, selector: 'mng-formly-field-wrapper', imports: [TranslateModule, FormlyModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"props['descriptor']?.['fieldClassName'] ?? 'field'\">\n <div class=\"grid mt-0\">\n @if (props.label) {\n <label [for]=\"key\" class=\"col\" [class]=\"props['descriptor']?.['labelClassName'] ?? ''\"\n >{{ props!.label! | translate }}\n @if (props.required && props['hideRequiredMarker'] !== true) {\n <span>*</span>\n }\n </label>\n }\n </div>\n <ng-container #fieldComponent></ng-container>\n @if (props['descriptor']?.['helpText']) {\n <small class=\"block\">{{ props['descriptor']?.['helpText'] | translate }}</small>\n }\n @if (showError) {\n <small class=\"p-error block\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n }\n</div>\n" }]
|
|
4090
4096
|
}] });
|
|
4091
4097
|
|
|
4098
|
+
class FormlyFieldDatepickerComponent extends FieldType {
|
|
4099
|
+
constructor() {
|
|
4100
|
+
super(...arguments);
|
|
4101
|
+
this.dpFormControl = new FormControl();
|
|
4102
|
+
this.styleClass = signal('');
|
|
4103
|
+
this.moduleConfig = inject(COMMONS_MODULE_CONFIG_IT, { optional: true });
|
|
4104
|
+
this.destroyRef = inject(DestroyRef);
|
|
4105
|
+
this.dateTimeInUtc = this.moduleConfig?.serialization?.dateTimeInUtc ?? false;
|
|
4106
|
+
this.dateTimeWithTimezone = this.moduleConfig?.serialization?.dateTimeWithTimezone ?? true;
|
|
4107
|
+
this.dateTimeWithMillis = this.moduleConfig?.serialization?.dateTimeWithMillis ?? true;
|
|
4108
|
+
}
|
|
4109
|
+
ngOnInit() {
|
|
4110
|
+
this.descriptor = this.props.descriptor;
|
|
4111
|
+
this.props.fieldComponent = this;
|
|
4112
|
+
// emit lifecycle event
|
|
4113
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
4114
|
+
eventSubtype: FormFieldEventComponentSubtype.ON_INIT
|
|
4115
|
+
});
|
|
4116
|
+
// init status changes
|
|
4117
|
+
this.formControl.statusChanges.pipe(takeUntilDestroyed(this.destroyRef), startWith(this.formControl.status)).subscribe(status => {
|
|
4118
|
+
if (status === 'INVALID') {
|
|
4119
|
+
this.styleClass.set('ng-invalid');
|
|
4120
|
+
}
|
|
4121
|
+
else {
|
|
4122
|
+
this.styleClass.set('ng-valid');
|
|
4123
|
+
}
|
|
4124
|
+
if (status === 'DISABLED' && this.dpFormControl.enabled) {
|
|
4125
|
+
this.dpFormControl.disable({ emitEvent: false });
|
|
4126
|
+
}
|
|
4127
|
+
else if (status !== 'DISABLED' && this.dpFormControl.disabled) {
|
|
4128
|
+
this.dpFormControl.enable({ emitEvent: false });
|
|
4129
|
+
}
|
|
4130
|
+
});
|
|
4131
|
+
// init values from form to datepicker
|
|
4132
|
+
if (typeof this.formControl?.value === 'string' || typeof this.formControl?.value === 'number') {
|
|
4133
|
+
this.dpFormControl.setValue(new Date(this.formControl.value));
|
|
4134
|
+
this.dpFormControl.markAsPristine(); // mark as pristine only on component initialization
|
|
4135
|
+
}
|
|
4136
|
+
this.formControl.valueChanges
|
|
4137
|
+
.pipe(takeUntilDestroyed(this.destroyRef), filter$1(formValue => !this.areDateValuesEqual(formValue, this.dpFormControl.value)))
|
|
4138
|
+
.subscribe(v => {
|
|
4139
|
+
this.dpFormControl.setValue(new Date(v), { emitEvent: false }); // do not emit event, because it can trigger infinite loop
|
|
4140
|
+
});
|
|
4141
|
+
// listen for changes from datepicker to form
|
|
4142
|
+
this.dpFormControl.valueChanges
|
|
4143
|
+
.pipe(takeUntilDestroyed(this.destroyRef), filter$1(value => !this.areDateValuesEqual(value, this.formControl.value)))
|
|
4144
|
+
.subscribe(v => {
|
|
4145
|
+
v = this.convertDateValue(v);
|
|
4146
|
+
this.formControl.setValue(v);
|
|
4147
|
+
this.descriptor.nextEvent(FormFieldEventTypeEnum.ValueChange, this, {
|
|
4148
|
+
value: v
|
|
4149
|
+
});
|
|
4150
|
+
this.props.onValueChange?.(this.field, v);
|
|
4151
|
+
});
|
|
4152
|
+
}
|
|
4153
|
+
onBlur() {
|
|
4154
|
+
this.formControl.markAsTouched();
|
|
4155
|
+
}
|
|
4156
|
+
convertDateValue(value) {
|
|
4157
|
+
const convertDateType = this.descriptor.datePickerValueNoTime || !this.descriptor.datePickerShowTime ? 'date' : 'date-time';
|
|
4158
|
+
const convertDateTimeOpts = {
|
|
4159
|
+
utc: this.descriptor.datePickerValueUtc ?? this.dateTimeInUtc,
|
|
4160
|
+
noMillis: !this.dateTimeWithMillis,
|
|
4161
|
+
noTimezone: this.descriptor.datePickerValueNoTimezone ?? !this.dateTimeWithTimezone
|
|
4162
|
+
};
|
|
4163
|
+
if (!this.descriptor.datePickerValueAsDateObj) {
|
|
4164
|
+
return dateToIsoString(value, convertDateType, convertDateTimeOpts);
|
|
4165
|
+
}
|
|
4166
|
+
return value;
|
|
4167
|
+
}
|
|
4168
|
+
areDateValuesEqual(val1, val2) {
|
|
4169
|
+
const date1 = this.convertDateValue(val1);
|
|
4170
|
+
const date2 = this.convertDateValue(val2);
|
|
4171
|
+
return (date1 instanceof Date && date2 instanceof Date && date1.toISOString() === date2.toISOString()) || date1 === date2;
|
|
4172
|
+
}
|
|
4173
|
+
ngOnDestroy() {
|
|
4174
|
+
// warning: formly calls on destroy before on init
|
|
4175
|
+
// emit lifecycle event
|
|
4176
|
+
this.descriptor?.nextEvent(FormFieldEventTypeEnum.ComponentLifecycle, this, {
|
|
4177
|
+
eventSubtype: FormFieldEventComponentSubtype.ON_DESTROY
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDatepickerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
4182
|
+
}
|
|
4183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: FormlyFieldDatepickerComponent, decorators: [{
|
|
4184
|
+
type: Component,
|
|
4185
|
+
args: [{ standalone: true, selector: 'mng-formly-field-datepicker', imports: [ReactiveFormsModule, FormlyModule, CalendarModule], changeDetection: ChangeDetectionStrategy.OnPush, 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" }]
|
|
4186
|
+
}] });
|
|
4187
|
+
|
|
4092
4188
|
const formlyWrappersConfig = [
|
|
4093
4189
|
{ name: 'field', component: FormlyFieldWrapperComponent },
|
|
4094
4190
|
{ name: 'field-no-label', component: FormlyFieldNoLabelWrapperComponent }
|
|
@@ -4161,12 +4257,13 @@ const formlyTypesConfig = [
|
|
|
4161
4257
|
},
|
|
4162
4258
|
{
|
|
4163
4259
|
name: 'datepicker',
|
|
4164
|
-
|
|
4260
|
+
component: FormlyFieldDatepickerComponent,
|
|
4165
4261
|
defaultOptions: {
|
|
4166
4262
|
props: {
|
|
4167
4263
|
type: 'datepicker'
|
|
4168
4264
|
}
|
|
4169
|
-
}
|
|
4265
|
+
},
|
|
4266
|
+
wrappers: ['field']
|
|
4170
4267
|
},
|
|
4171
4268
|
{
|
|
4172
4269
|
name: 'mask',
|
|
@@ -4369,77 +4466,60 @@ function commonsFormlyConfigProvider(translate, datePipe, config = {}) {
|
|
|
4369
4466
|
class TableviewComponent {
|
|
4370
4467
|
constructor() {
|
|
4371
4468
|
this.viewContainer = inject(ViewContainer, { optional: true });
|
|
4372
|
-
this.
|
|
4373
|
-
this.
|
|
4374
|
-
this.
|
|
4375
|
-
this.
|
|
4376
|
-
this.
|
|
4377
|
-
this.
|
|
4469
|
+
this.descriptor = input.required();
|
|
4470
|
+
this.dataProvider = input();
|
|
4471
|
+
this.actions = input([]);
|
|
4472
|
+
this.toolbarLeftActions = computed(() => this.filterActionsByPositions(this.actions(), [ActionPositionEnum.ToolbarLeft]));
|
|
4473
|
+
this.toolbarRightActions = computed(() => this.filterActionsByPositions(this.actions(), [ActionPositionEnum.ToolbarRight]).reverse());
|
|
4474
|
+
this.tableActions = computed(() => this.filterActionsByPositions(this.actions(), [ActionPositionEnum.TableHeader, ActionPositionEnum.RowInline, ActionPositionEnum.RowClick]));
|
|
4475
|
+
this.tableParams = signal(undefined);
|
|
4476
|
+
this.hasItemSelectionAction = computed(() => [...this.toolbarLeftActions(), ...this.toolbarRightActions()].some(e => e.hasItemsSelection));
|
|
4477
|
+
this.selectedItems = signal([]);
|
|
4378
4478
|
this.templates = contentChildren(TemplateDirective);
|
|
4379
4479
|
this.footerTemplate = computed(() => findTemplateByName([...this.templates()], 'footer'));
|
|
4380
4480
|
this.rowExpandTemplate = computed(() => findTemplateByName([...this.templates()], 'rowExpandContent'));
|
|
4381
4481
|
}
|
|
4382
4482
|
ngOnInit() {
|
|
4383
4483
|
if (this.viewContainer) {
|
|
4384
|
-
this.viewContainer.actions
|
|
4385
|
-
}
|
|
4386
|
-
if (this.viewContainer && this.dataProvider) {
|
|
4387
|
-
this.viewContainer.dataProvider = this.dataProvider;
|
|
4484
|
+
this.viewContainer.actions.set(this.actions());
|
|
4388
4485
|
}
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
this.toolbarLeftActions.push(action);
|
|
4393
|
-
break;
|
|
4394
|
-
case ActionPositionEnum.ToolbarRight:
|
|
4395
|
-
this.toolbarRightActions.push(action);
|
|
4396
|
-
break;
|
|
4397
|
-
case ActionPositionEnum.TableHeader:
|
|
4398
|
-
case ActionPositionEnum.RowInline:
|
|
4399
|
-
case ActionPositionEnum.RowClick:
|
|
4400
|
-
this.tableActions.push(action);
|
|
4401
|
-
break;
|
|
4402
|
-
}
|
|
4486
|
+
const dataProvider = this.dataProvider();
|
|
4487
|
+
if (this.viewContainer && dataProvider) {
|
|
4488
|
+
this.viewContainer.dataProvider.set(dataProvider);
|
|
4403
4489
|
}
|
|
4404
|
-
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
4405
|
-
this.hasItemSelectionAction = [...this.toolbarLeftActions, ...this.toolbarRightActions].some(e => e.hasItemsSelection);
|
|
4406
4490
|
}
|
|
4407
4491
|
onTableLoad(event) {
|
|
4408
|
-
this.tableParams
|
|
4492
|
+
this.tableParams.set(event.params);
|
|
4409
4493
|
}
|
|
4410
4494
|
selectionChange(selectedItems) {
|
|
4411
|
-
this.selectedItems
|
|
4495
|
+
this.selectedItems.set(selectedItems);
|
|
4496
|
+
}
|
|
4497
|
+
filterActionsByPositions(actions, actionPositions) {
|
|
4498
|
+
return actions.filter(action => (action.positionTableviewCategories?.includes(TableviewActionDefaultCategories.READ) ?? true) && actionPositions.includes(action.position));
|
|
4412
4499
|
}
|
|
4413
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
4414
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.
|
|
4500
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: TableviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4501
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.4", type: TableviewComponent, isStandalone: true, selector: "mng-tableview", inputs: { descriptor: { classPropertyName: "descriptor", publicName: "descriptor", isSignal: true, isRequired: true, transformFunction: null }, dataProvider: { classPropertyName: "dataProvider", publicName: "dataProvider", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideViewContainer()], queries: [{ propertyName: "templates", predicate: TemplateDirective, isSignal: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <div class=\"card\">\n @if (toolbarLeftActions().length > 0 || toolbarRightActions().length > 0) {\n <p-toolbar styleClass=\"mb-4\">\n <ng-template pTemplate=\"left\">\n @for (action of toolbarLeftActions(); track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams()\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems()\"></mng-action>\n }\n </ng-template>\n <ng-template pTemplate=\"right\">\n @for (action of toolbarRightActions(); track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams()\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems()\"></mng-action>\n }\n </ng-template>\n </p-toolbar>\n }\n\n <mng-action-table\n [descriptor]=\"descriptor().table\"\n [dataProvider]=\"dataProvider()\"\n [useQueryParams]=\"true\"\n [actions]=\"tableActions()\"\n [selectionEnabled]=\"hasItemSelectionAction()\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor().tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n @if (rowExpandTemplate()) {\n <ng-template mngTemplate=\"rowExpandContent\" let-item=\"rowItem\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </ng-template>\n }\n\n @if (footerTemplate()) {\n <ng-template mngTemplate=\"footer\" let-data=\"data\" let-totalCount=\"totalCount\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data, totalCount}\"></ng-container>\n </ng-template>\n }\n </mng-action-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n", dependencies: [{ kind: "ngmodule", type: ToolbarModule }, { kind: "component", type: i2$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass", "ariaLabelledBy"] }, { kind: "ngmodule", type: SharedModule }, { kind: "directive", type: i2$3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4415
4502
|
}
|
|
4416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: TableviewComponent, decorators: [{
|
|
4417
4504
|
type: Component,
|
|
4418
|
-
args: [{ standalone: true, selector: 'mng-tableview', imports: [ToolbarModule, SharedModule, TranslateModule, NgTemplateOutlet, ActionComponent, ActionTableComponent, TemplateDirective, RouterOutlet], providers: [provideViewContainer()], template: "<div class=\"mng-tableview\">\n <div class=\"card\">\n @if (toolbarLeftActions.length > 0 || toolbarRightActions.length > 0) {\n <p-toolbar styleClass=\"mb-4\">\n <ng-template pTemplate=\"left\">\n @for (action of toolbarLeftActions; track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems\"></mng-action>\n }\n </ng-template>\n <ng-template pTemplate=\"right\">\n @for (action of toolbarRightActions; track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems\"></mng-action>\n }\n </ng-template>\n </p-toolbar>\n }\n\n <mng-action-table\n [descriptor]=\"descriptor.table\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"true\"\n [actions]=\"tableActions\"\n [selectionEnabled]=\"hasItemSelectionAction\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor.tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n @if (rowExpandTemplate()) {\n <ng-template mngTemplate=\"rowExpandContent\" let-item=\"rowItem\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </ng-template>\n }\n\n @if (footerTemplate()) {\n <ng-template mngTemplate=\"footer\" let-data=\"data\" let-totalCount=\"totalCount\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data, totalCount}\"></ng-container>\n </ng-template>\n }\n </mng-action-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
|
|
4419
|
-
}]
|
|
4420
|
-
type: Input,
|
|
4421
|
-
args: [{ required: true }]
|
|
4422
|
-
}], dataProvider: [{
|
|
4423
|
-
type: Input
|
|
4424
|
-
}], actions: [{
|
|
4425
|
-
type: Input
|
|
4426
|
-
}] } });
|
|
4505
|
+
args: [{ standalone: true, selector: 'mng-tableview', imports: [ToolbarModule, SharedModule, TranslateModule, NgTemplateOutlet, ActionComponent, ActionTableComponent, TemplateDirective, RouterOutlet], providers: [provideViewContainer()], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mng-tableview\">\n <div class=\"card\">\n @if (toolbarLeftActions().length > 0 || toolbarRightActions().length > 0) {\n <p-toolbar styleClass=\"mb-4\">\n <ng-template pTemplate=\"left\">\n @for (action of toolbarLeftActions(); track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams()\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems()\"></mng-action>\n }\n </ng-template>\n <ng-template pTemplate=\"right\">\n @for (action of toolbarRightActions(); track action) {\n <mng-action [action]=\"action\" [dataListParams]=\"tableParams()\" [hostComponent]=\"this\" [selectedItems]=\"selectedItems()\"></mng-action>\n }\n </ng-template>\n </p-toolbar>\n }\n\n <mng-action-table\n [descriptor]=\"descriptor().table\"\n [dataProvider]=\"dataProvider()\"\n [useQueryParams]=\"true\"\n [actions]=\"tableActions()\"\n [selectionEnabled]=\"hasItemSelectionAction()\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor().tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n @if (rowExpandTemplate()) {\n <ng-template mngTemplate=\"rowExpandContent\" let-item=\"rowItem\">\n <ng-container *ngTemplateOutlet=\"rowExpandTemplate(); context: {rowItem: item}\"></ng-container>\n </ng-template>\n }\n\n @if (footerTemplate()) {\n <ng-template mngTemplate=\"footer\" let-data=\"data\" let-totalCount=\"totalCount\">\n <ng-container *ngTemplateOutlet=\"footerTemplate(); context: {data, totalCount}\"></ng-container>\n </ng-template>\n }\n </mng-action-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
|
|
4506
|
+
}] });
|
|
4427
4507
|
|
|
4428
4508
|
class TableviewRouteComponent {
|
|
4429
|
-
|
|
4430
|
-
|
|
4509
|
+
constructor() {
|
|
4510
|
+
this.tableview = input.required();
|
|
4511
|
+
}
|
|
4512
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: TableviewRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4513
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.4", type: TableviewRouteComponent, isStandalone: true, selector: "mng-tableview-route", inputs: { tableview: { classPropertyName: "tableview", publicName: "tableview", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<mng-tableview [descriptor]=\"tableview().descriptor\" [dataProvider]=\"tableview().dataProvider\" [actions]=\"tableview().actions\"> </mng-tableview>\n", dependencies: [{ kind: "component", type: TableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4431
4514
|
}
|
|
4432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
4515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: TableviewRouteComponent, decorators: [{
|
|
4433
4516
|
type: Component,
|
|
4434
|
-
args: [{ standalone: true, selector: 'mng-tableview-route', imports: [TableviewComponent], template: "<mng-tableview [descriptor]=\"tableview.descriptor\" [dataProvider]=\"tableview.dataProvider\" [actions]=\"tableview.actions\"> </mng-tableview>\n" }]
|
|
4435
|
-
}]
|
|
4436
|
-
type: Input,
|
|
4437
|
-
args: [{ required: true }]
|
|
4438
|
-
}] } });
|
|
4517
|
+
args: [{ standalone: true, selector: 'mng-tableview-route', imports: [TableviewComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-tableview [descriptor]=\"tableview().descriptor\" [dataProvider]=\"tableview().dataProvider\" [actions]=\"tableview().actions\"> </mng-tableview>\n" }]
|
|
4518
|
+
}] });
|
|
4439
4519
|
|
|
4440
|
-
class
|
|
4441
|
-
constructor(path,
|
|
4442
|
-
super({ path: path, component
|
|
4520
|
+
class TableviewRouteBuilder extends RouteBuilder {
|
|
4521
|
+
constructor(path, component, loadComponent) {
|
|
4522
|
+
super({ path: path, component, loadComponent });
|
|
4443
4523
|
this.path = path;
|
|
4444
4524
|
this.isFromComponent = true;
|
|
4445
4525
|
this.routeData = { breadcrumb: null };
|
|
@@ -4450,28 +4530,6 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4450
4530
|
this.hasAdd = true;
|
|
4451
4531
|
this.addPath = 'add';
|
|
4452
4532
|
this.hasDelete = true;
|
|
4453
|
-
if (!options.component) {
|
|
4454
|
-
this.isFromComponent = false;
|
|
4455
|
-
this.descriptor = options.descriptor;
|
|
4456
|
-
this.dataProvider = options.dataProvider;
|
|
4457
|
-
this.actions = options.actions;
|
|
4458
|
-
this.hasDetails = false;
|
|
4459
|
-
this.hasAdd = false;
|
|
4460
|
-
this.hasEdit = false;
|
|
4461
|
-
if (this.actions) {
|
|
4462
|
-
for (const action of this.actions) {
|
|
4463
|
-
if (action instanceof ActionEditorDetailsDescriptorInst) {
|
|
4464
|
-
this.hasDetails = true;
|
|
4465
|
-
}
|
|
4466
|
-
else if (action instanceof ActionEditorAddDescriptorInst) {
|
|
4467
|
-
this.hasAdd = true;
|
|
4468
|
-
}
|
|
4469
|
-
else if (action instanceof ActionEditorEditDescriptorInst) {
|
|
4470
|
-
this.hasEdit = true;
|
|
4471
|
-
}
|
|
4472
|
-
}
|
|
4473
|
-
}
|
|
4474
|
-
}
|
|
4475
4533
|
}
|
|
4476
4534
|
withReadOnly(permissions) {
|
|
4477
4535
|
if (permissions) {
|
|
@@ -4577,12 +4635,11 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4577
4635
|
// copy route data for children, reset breadcrumbs menu items and permission
|
|
4578
4636
|
const childrenRouteData = {
|
|
4579
4637
|
...this.routeData,
|
|
4580
|
-
breadcrumb: null
|
|
4581
|
-
menuItems: undefined,
|
|
4582
|
-
permissions: undefined
|
|
4638
|
+
breadcrumb: null
|
|
4583
4639
|
};
|
|
4640
|
+
const loadActionRoute = () => Promise.resolve().then(function () { return actionRoute_component; });
|
|
4584
4641
|
// list route
|
|
4585
|
-
const rootChildRouteBuilder =
|
|
4642
|
+
const rootChildRouteBuilder = createLazyRoute('', loadActionRoute);
|
|
4586
4643
|
rootChildRouteBuilder.withData({ ...childrenRouteData });
|
|
4587
4644
|
if (this.tableviewPermissions?.[TableviewActionDefaultCategories.READ]) {
|
|
4588
4645
|
rootChildRouteBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.READ]);
|
|
@@ -4590,7 +4647,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4590
4647
|
this.addChildBuilder(rootChildRouteBuilder);
|
|
4591
4648
|
// add route
|
|
4592
4649
|
if (this.hasAdd) {
|
|
4593
|
-
const routeBuilder =
|
|
4650
|
+
const routeBuilder = createLazyRoute(this.addPath, loadActionRoute);
|
|
4594
4651
|
routeBuilder.withData({ ...childrenRouteData });
|
|
4595
4652
|
if (this.tableviewPermissions?.[TableviewActionDefaultCategories.ADD]) {
|
|
4596
4653
|
routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.ADD]);
|
|
@@ -4599,7 +4656,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4599
4656
|
routeBuilder.withCanDeactivate(unsavedChangesGuard);
|
|
4600
4657
|
}
|
|
4601
4658
|
if (this.hasDetails) {
|
|
4602
|
-
const routeBuilder =
|
|
4659
|
+
const routeBuilder = createLazyRoute(this.detailsPath, loadActionRoute);
|
|
4603
4660
|
routeBuilder.withData({ ...childrenRouteData });
|
|
4604
4661
|
if (this.tableviewPermissions?.[TableviewActionDefaultCategories.DETAILS]) {
|
|
4605
4662
|
routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.DETAILS]);
|
|
@@ -4607,7 +4664,7 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4607
4664
|
this.addChildBuilder(routeBuilder);
|
|
4608
4665
|
}
|
|
4609
4666
|
if (this.hasEdit) {
|
|
4610
|
-
const routeBuilder =
|
|
4667
|
+
const routeBuilder = createLazyRoute(this.editPath, loadActionRoute);
|
|
4611
4668
|
routeBuilder.withData({ ...childrenRouteData });
|
|
4612
4669
|
if (this.tableviewPermissions?.[TableviewActionDefaultCategories.EDIT]) {
|
|
4613
4670
|
routeBuilder.withPermissions(this.tableviewPermissions[TableviewActionDefaultCategories.EDIT]);
|
|
@@ -4625,13 +4682,11 @@ class TableviewRouteBuilderInternal extends RouteBuilder {
|
|
|
4625
4682
|
return menuItemPermission;
|
|
4626
4683
|
}
|
|
4627
4684
|
}
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
return new TableviewRouteBuilderInternal(path, { descriptor, dataProvider, actions });
|
|
4634
|
-
}
|
|
4685
|
+
function createTableviewRoute(path, component) {
|
|
4686
|
+
return new TableviewRouteBuilder(path, component);
|
|
4687
|
+
}
|
|
4688
|
+
function createTableviewLazyRoute(path, loadComponent) {
|
|
4689
|
+
return new TableviewRouteBuilder(path, undefined, loadComponent);
|
|
4635
4690
|
}
|
|
4636
4691
|
|
|
4637
4692
|
/**
|
|
@@ -4687,5 +4742,5 @@ function withTableview(config) {
|
|
|
4687
4742
|
* Generated bundle index. Do not edit.
|
|
4688
4743
|
*/
|
|
4689
4744
|
|
|
4690
|
-
export { ACTION_EDITOR_COMPONENT_IT, ActionComponent, ActionContext, ActionEditorComponent, ActionErrorMapperService, ActionExecutorService, ActionInstance, ActionInstanceStateEnum,
|
|
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 };
|
|
4691
4746
|
//# sourceMappingURL=mediusinc-mng-commons-tableview.mjs.map
|