aril 1.1.64 → 1.1.66
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/boot/config/api/src/api.service.d.ts +1 -0
- package/esm2022/boot/config/api/src/api.service.mjs +15 -3
- package/esm2022/boot/host/src/bootstrap.mjs +4 -2
- package/esm2022/ui-business/assetPicker/src/asset-picker.component.mjs +63 -30
- package/esm2022/ui-business/assetPicker/src/interface.mjs +1 -1
- package/esm2022/util/directives/aril-util-directives.mjs +5 -0
- package/esm2022/util/directives/index.mjs +4 -0
- package/esm2022/util/directives/src/detail-page-customization/detail-page-customization.directive.mjs +298 -0
- package/esm2022/util/directives/src/detail-page-customization/index.mjs +3 -0
- package/esm2022/util/directives/src/detail-page-customization/models.mjs +4 -0
- package/esm2022/util/directives/src/dialog-component/plugin-dialog.component.mjs +25 -0
- package/esm2022/util/directives/src/dialog-service/plugin-dialog.service.mjs +16 -0
- package/fesm2022/aril-boot-config-api.mjs +15 -3
- package/fesm2022/aril-boot-config-api.mjs.map +1 -1
- package/fesm2022/aril-boot-host.mjs +3 -1
- package/fesm2022/aril-boot-host.mjs.map +1 -1
- package/fesm2022/aril-ui-business-assetPicker.mjs +62 -29
- package/fesm2022/aril-ui-business-assetPicker.mjs.map +1 -1
- package/fesm2022/aril-util-directives.mjs +343 -0
- package/fesm2022/aril-util-directives.mjs.map +1 -0
- package/fesm2022/aril.mjs +3 -1
- package/fesm2022/aril.mjs.map +1 -1
- package/package.json +72 -66
- package/ui-business/assetPicker/src/asset-picker.component.d.ts +7 -2
- package/ui-business/assetPicker/src/interface.d.ts +1 -0
- package/util/directives/index.d.ts +3 -0
- package/util/directives/src/detail-page-customization/detail-page-customization.directive.d.ts +26 -0
- package/util/directives/src/detail-page-customization/index.d.ts +2 -0
- package/util/directives/src/detail-page-customization/models.d.ts +53 -0
- package/util/directives/src/dialog-component/plugin-dialog.component.d.ts +10 -0
- package/util/directives/src/dialog-service/plugin-dialog.service.d.ts +7 -0
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, signal, inject, DestroyRef, EventEmitter, Component, ViewChild, Output } from '@angular/core';
|
|
2
|
+
import { input, signal, inject, DestroyRef, EventEmitter, effect, Component, ViewChild, Output } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
-
import * as
|
|
4
|
+
import * as i5 from '@angular/forms';
|
|
5
5
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
|
-
import * as
|
|
6
|
+
import * as i6 from 'primeng/autocomplete';
|
|
7
7
|
import { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';
|
|
8
8
|
import { ObjectUtils } from 'primeng/utils';
|
|
9
9
|
import { Subject, switchMap } from 'rxjs';
|
|
10
10
|
import { API_CONFIGS } from 'aril/boot/config/api';
|
|
11
11
|
import { Apps } from 'aril/boot/config/apps';
|
|
12
|
-
import * as
|
|
12
|
+
import * as i4 from 'aril/ui/lib';
|
|
13
13
|
import { BaseInputComponent, ValueAccessorDirective } from 'aril/ui/lib';
|
|
14
14
|
import * as i1 from '@angular/common/http';
|
|
15
15
|
import * as i2 from '@ngneat/transloco';
|
|
16
|
-
import * as
|
|
16
|
+
import * as i3 from 'aril/theme/layout';
|
|
17
|
+
import * as i7 from 'primeng/api';
|
|
17
18
|
|
|
18
19
|
class AssetPickerComponent extends BaseInputComponent {
|
|
19
|
-
constructor(http, translocoService) {
|
|
20
|
+
constructor(http, translocoService, selectionGroupService) {
|
|
20
21
|
super();
|
|
21
22
|
this.http = http;
|
|
22
23
|
this.translocoService = translocoService;
|
|
24
|
+
this.selectionGroupService = selectionGroupService;
|
|
23
25
|
this.assetCode = input(null);
|
|
24
26
|
this.type = input(null);
|
|
25
27
|
this.placeholder = input('Arama...');
|
|
@@ -29,36 +31,24 @@ class AssetPickerComponent extends BaseInputComponent {
|
|
|
29
31
|
this.optionValue = input(null);
|
|
30
32
|
this.appendTo = input('body');
|
|
31
33
|
this.mql = input();
|
|
34
|
+
this.excludedAttributeCodes = input([]);
|
|
32
35
|
this.isUpdateMode = signal(false);
|
|
33
36
|
this.cacheSearchRequest$ = new Subject();
|
|
34
37
|
this.destroyRef = inject(DestroyRef);
|
|
35
38
|
this.selectedDefinitionEvent = new EventEmitter();
|
|
39
|
+
effect(() => {
|
|
40
|
+
this.selectionGroupService.selectionGroups();
|
|
41
|
+
if (this.selectionDefinitions) {
|
|
42
|
+
this.refreshFilteredSelectionItems();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
36
45
|
}
|
|
37
46
|
ngOnInit() {
|
|
38
47
|
this.cacheSearchRequest$
|
|
39
48
|
.pipe(switchMap((payload) => this.http.post(API_CONFIGS.getExternalAppEndpoint(Apps.MNG) + '/master-data/cache-search', payload)), takeUntilDestroyed(this.destroyRef))
|
|
40
49
|
.subscribe((selectionGroup) => {
|
|
41
50
|
this.selectionDefinitions = selectionGroup;
|
|
42
|
-
|
|
43
|
-
Object.keys(selectionGroup).forEach((key) => {
|
|
44
|
-
const groupData = {
|
|
45
|
-
text: selectionGroup[key]?.result[0]?.assets[0]?.assetDefinitionName,
|
|
46
|
-
key: key,
|
|
47
|
-
items: selectionGroup[key].result.map((item) => ({
|
|
48
|
-
key: item.id,
|
|
49
|
-
text: this.getAttiributesValueDescr(item.attributes),
|
|
50
|
-
attributes: item.attributes,
|
|
51
|
-
assetDefinitionCode: item.assetDefinitionCode
|
|
52
|
-
}))
|
|
53
|
-
};
|
|
54
|
-
newFilteredGroupSuggestions.push(groupData);
|
|
55
|
-
// If the string value is patched in update mode and there is group data, select the first item
|
|
56
|
-
if (this.isUpdateMode() && groupData.items.length === 1 && !this.multiple()) {
|
|
57
|
-
this.ngControl?.control?.setValue(groupData.items[0]);
|
|
58
|
-
this.isUpdateMode.set(false);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
this.filteredSelectionItems = newFilteredGroupSuggestions;
|
|
51
|
+
this.refreshFilteredSelectionItems();
|
|
62
52
|
});
|
|
63
53
|
// If the form control's value is a string, perform a cache search to retrieve the ID.
|
|
64
54
|
const currentValue = this.ngControl?.control?.value;
|
|
@@ -67,6 +57,30 @@ class AssetPickerComponent extends BaseInputComponent {
|
|
|
67
57
|
this.search({ query: currentValue });
|
|
68
58
|
}
|
|
69
59
|
}
|
|
60
|
+
refreshFilteredSelectionItems() {
|
|
61
|
+
if (!this.selectionDefinitions)
|
|
62
|
+
return;
|
|
63
|
+
const newFilteredGroupSuggestions = [];
|
|
64
|
+
Object.keys(this.selectionDefinitions).forEach((key) => {
|
|
65
|
+
const groupData = {
|
|
66
|
+
text: this.selectionDefinitions[key]?.result[0]?.assets[0]?.assetDefinitionName,
|
|
67
|
+
key: key,
|
|
68
|
+
items: this.selectionDefinitions[key].result.map((item) => ({
|
|
69
|
+
key: item.id,
|
|
70
|
+
text: this.getAttiributesValueDescr(item.attributes),
|
|
71
|
+
attributes: item.attributes,
|
|
72
|
+
assetDefinitionCode: item.assetDefinitionCode
|
|
73
|
+
}))
|
|
74
|
+
};
|
|
75
|
+
newFilteredGroupSuggestions.push(groupData);
|
|
76
|
+
// If the string value is patched in update mode and there is group data, select the first item
|
|
77
|
+
if (this.isUpdateMode() && groupData.items.length === 1 && !this.multiple()) {
|
|
78
|
+
this.ngControl?.control?.setValue(groupData.items[0]);
|
|
79
|
+
this.isUpdateMode.set(false);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this.filteredSelectionItems = newFilteredGroupSuggestions;
|
|
83
|
+
}
|
|
70
84
|
ngAfterViewInit() {
|
|
71
85
|
this.autoCompleteRef.getOptionValue = this.getOptionValue.bind(this);
|
|
72
86
|
}
|
|
@@ -107,13 +121,32 @@ class AssetPickerComponent extends BaseInputComponent {
|
|
|
107
121
|
this.cacheSearchRequest$.next(payload);
|
|
108
122
|
}
|
|
109
123
|
getAttiributesValueDescr(attributes) {
|
|
124
|
+
const excludedAttributes = ['AssetId', 'AssetDefinitionName', ...this.excludedAttributeCodes()];
|
|
110
125
|
return attributes
|
|
126
|
+
?.filter((attr) => !excludedAttributes.includes(attr.attribute?.attributeCode))
|
|
111
127
|
?.map((attr) => {
|
|
128
|
+
// Handle SELECT type attributes using SelectionGroupService
|
|
129
|
+
if (attr.attribute?.attributeType === 'SELECT' && attr.attribute?.selectOption) {
|
|
130
|
+
return this.getSelectionDisplay(attr.attribute.selectOption, attr.value);
|
|
131
|
+
}
|
|
112
132
|
const value = attr.valueDesc ? attr.valueDesc : attr.value;
|
|
113
133
|
return typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
114
134
|
})
|
|
115
135
|
.join(' - ');
|
|
116
136
|
}
|
|
137
|
+
getSelectionDisplay(groupName, value) {
|
|
138
|
+
const key = `${groupName}~ALL`;
|
|
139
|
+
const selectionGroup = this.selectionGroupService.selectionGroups()[key];
|
|
140
|
+
if (!selectionGroup) {
|
|
141
|
+
this.selectionGroupService.fetchEnum(groupName, 'ALL');
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
const currentLang = this.translocoService.getActiveLang();
|
|
145
|
+
const selectionItem = selectionGroup.selectionItems?.find((t) => t.selectionKey === value);
|
|
146
|
+
if (!selectionItem)
|
|
147
|
+
return value;
|
|
148
|
+
return selectionItem.selectionMultiLanguageDisplays?.[currentLang] ?? selectionItem.selectionDisplay ?? value;
|
|
149
|
+
}
|
|
117
150
|
triggerSelectedEvents(event) {
|
|
118
151
|
const selectedItems = Object.keys(this.selectionDefinitions).map((key) => {
|
|
119
152
|
return this.selectionDefinitions[key].result.find((item) => item.id === event?.value?.key);
|
|
@@ -128,13 +161,13 @@ class AssetPickerComponent extends BaseInputComponent {
|
|
|
128
161
|
};
|
|
129
162
|
this.selectedDefinitionEvent.emit(selectedEvent);
|
|
130
163
|
}
|
|
131
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: AssetPickerComponent, deps: [{ token: i1.HttpClient }, { token: i2.TranslocoService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
132
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.1.2", type: AssetPickerComponent, isStandalone: true, selector: "aril-asset-picker[ngModel], aril-asset-picker[formControl], aril-asset-picker[formControlName]", inputs: { assetCode: { classPropertyName: "assetCode", publicName: "assetCode", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, forceSelection: { classPropertyName: "forceSelection", publicName: "forceSelection", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, mql: { classPropertyName: "mql", publicName: "mql", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedDefinitionEvent: "selectedDefinitionEvent" }, viewQueries: [{ propertyName: "autoCompleteRef", first: true, predicate: AutoComplete, descendants: true }], usesInheritance: true, hostDirectives: [{ directive:
|
|
164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: AssetPickerComponent, deps: [{ token: i1.HttpClient }, { token: i2.TranslocoService }, { token: i3.SelectionGroupService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
165
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.1.2", type: AssetPickerComponent, isStandalone: true, selector: "aril-asset-picker[ngModel], aril-asset-picker[formControl], aril-asset-picker[formControlName]", inputs: { assetCode: { classPropertyName: "assetCode", publicName: "assetCode", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, forceSelection: { classPropertyName: "forceSelection", publicName: "forceSelection", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, mql: { classPropertyName: "mql", publicName: "mql", isSignal: true, isRequired: false, transformFunction: null }, excludedAttributeCodes: { classPropertyName: "excludedAttributeCodes", publicName: "excludedAttributeCodes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedDefinitionEvent: "selectedDefinitionEvent" }, viewQueries: [{ propertyName: "autoCompleteRef", first: true, predicate: AutoComplete, descendants: true }], usesInheritance: true, hostDirectives: [{ directive: i4.ValueAccessorDirective }], ngImport: i0, template: "<p-autoComplete\r\n\toptionLabel=\"text\"\r\n\t[optionValue]=\"optionValue()!\"\r\n\t[placeholder]=\"placeholder()\"\r\n\t[multiple]=\"multiple()\"\r\n\t[group]=\"true\"\r\n\t[forceSelection]=\"forceSelection()\"\r\n\t[delay]=\"700\"\r\n\t[minLength]=\"3\"\r\n\t[suggestions]=\"filteredSelectionItems\"\r\n\t(completeMethod)=\"search($event)\"\r\n\t[formControl]=\"ngControl.control\"\r\n\t[autoHighlight]=\"true\"\r\n\t[type]=\"type()!\"\r\n\t(ngModelChange)=\"onNgModelChange($event)\"\r\n\t[showClear]=\"showClear()\"\r\n\t[emptyMessage]=\"translocoService.translate('messages.noDataToDisplay')\"\r\n\t(onSelect)=\"triggerSelectedEvents($event)\"\r\n\t[appendTo]=\"appendTo()\"\r\n\t(keyup.enter)=\"search($event)\">\r\n\t<ng-template let-group pTemplate=\"group\">\r\n\t\t<span class=\"font-bold\">{{ group.text }}</span>\r\n\t</ng-template>\r\n</p-autoComplete>\r\n", styles: ["::ng-deep .p-autocomplete-multiple-container{flex-wrap:wrap;max-height:50px;overflow-y:auto;align-items:center}::ng-deep .p-autocomplete-token{margin:0;flex-shrink:0}::ng-deep .p-autocomplete-input-token{flex:1;min-width:150px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: AutoCompleteModule }, { kind: "component", type: i6.AutoComplete, selector: "p-autoComplete", inputs: ["minLength", "delay", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "disabled", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "field", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "itemSize", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "variant"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "directive", type: i7.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }] }); }
|
|
133
166
|
}
|
|
134
167
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: AssetPickerComponent, decorators: [{
|
|
135
168
|
type: Component,
|
|
136
169
|
args: [{ standalone: true, selector: 'aril-asset-picker[ngModel], aril-asset-picker[formControl], aril-asset-picker[formControlName]', imports: [ReactiveFormsModule, AutoCompleteModule], hostDirectives: [ValueAccessorDirective], template: "<p-autoComplete\r\n\toptionLabel=\"text\"\r\n\t[optionValue]=\"optionValue()!\"\r\n\t[placeholder]=\"placeholder()\"\r\n\t[multiple]=\"multiple()\"\r\n\t[group]=\"true\"\r\n\t[forceSelection]=\"forceSelection()\"\r\n\t[delay]=\"700\"\r\n\t[minLength]=\"3\"\r\n\t[suggestions]=\"filteredSelectionItems\"\r\n\t(completeMethod)=\"search($event)\"\r\n\t[formControl]=\"ngControl.control\"\r\n\t[autoHighlight]=\"true\"\r\n\t[type]=\"type()!\"\r\n\t(ngModelChange)=\"onNgModelChange($event)\"\r\n\t[showClear]=\"showClear()\"\r\n\t[emptyMessage]=\"translocoService.translate('messages.noDataToDisplay')\"\r\n\t(onSelect)=\"triggerSelectedEvents($event)\"\r\n\t[appendTo]=\"appendTo()\"\r\n\t(keyup.enter)=\"search($event)\">\r\n\t<ng-template let-group pTemplate=\"group\">\r\n\t\t<span class=\"font-bold\">{{ group.text }}</span>\r\n\t</ng-template>\r\n</p-autoComplete>\r\n", styles: ["::ng-deep .p-autocomplete-multiple-container{flex-wrap:wrap;max-height:50px;overflow-y:auto;align-items:center}::ng-deep .p-autocomplete-token{margin:0;flex-shrink:0}::ng-deep .p-autocomplete-input-token{flex:1;min-width:150px}\n"] }]
|
|
137
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.TranslocoService }], propDecorators: { autoCompleteRef: [{
|
|
170
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.TranslocoService }, { type: i3.SelectionGroupService }], propDecorators: { autoCompleteRef: [{
|
|
138
171
|
type: ViewChild,
|
|
139
172
|
args: [AutoComplete]
|
|
140
173
|
}], selectedDefinitionEvent: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aril-ui-business-assetPicker.mjs","sources":["../../projects/aril/ui-business/assetPicker/src/asset-picker.component.ts","../../projects/aril/ui-business/assetPicker/src/asset-picker.component.html","../../projects/aril/ui-business/assetPicker/aril-ui-business-assetPicker.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport {\r\n\tAfterViewInit,\r\n\tComponent,\r\n\tDestroyRef,\r\n\tEventEmitter,\r\n\tOnInit,\r\n\tOutput,\r\n\tViewChild,\r\n\tinject,\r\n\tinput,\r\n\tsignal\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\n\r\nimport { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';\r\nimport { ObjectUtils } from 'primeng/utils';\r\n\r\nimport { TranslocoService } from '@ngneat/transloco';\r\nimport { Subject, switchMap } from 'rxjs';\r\n\r\nimport { API_CONFIGS } from 'aril/boot/config/api';\r\nimport { Apps } from 'aril/boot/config/apps';\r\nimport { BaseInputComponent, ValueAccessorDirective } from 'aril/ui/lib';\r\n\r\nimport {\r\n\tAssetAggregate,\r\n\tAttributeElement,\r\n\tCacheSearchRequestDTO,\r\n\tDefaultSearchAggregateAssetAggregate,\r\n\tSuggestionsDTO,\r\n\tSuggestionsGroupDTO\r\n} from './interface';\r\n\r\ntype ValueTypes = 'text' | 'number';\r\n@Component({\r\n\tstandalone: true,\r\n\tselector: 'aril-asset-picker[ngModel], aril-asset-picker[formControl], aril-asset-picker[formControlName]',\r\n\ttemplateUrl: './asset-picker.component.html',\r\n\tstyles: [\r\n\t\t`\r\n\t\t\t::ng-deep .p-autocomplete-multiple-container {\r\n\t\t\t\tflex-wrap: wrap;\r\n\t\t\t\tmax-height: 50px;\r\n\t\t\t\toverflow-y: auto;\r\n\t\t\t\talign-items: center;\r\n\t\t\t}\r\n\r\n\t\t\t::ng-deep .p-autocomplete-token {\r\n\t\t\t\tmargin: 0;\r\n\t\t\t\tflex-shrink: 0;\r\n\t\t\t}\r\n\r\n\t\t\t::ng-deep .p-autocomplete-input-token {\r\n\t\t\t\tflex: 1;\r\n\t\t\t\tmin-width: 150px;\r\n\t\t\t}\r\n\t\t`\r\n\t],\r\n\timports: [ReactiveFormsModule, AutoCompleteModule],\r\n\thostDirectives: [ValueAccessorDirective]\r\n})\r\nexport class AssetPickerComponent extends BaseInputComponent implements AfterViewInit, OnInit {\r\n\t@ViewChild(AutoComplete) autoCompleteRef!: AutoComplete;\r\n\tassetCode = input<string | string[] | null>(null);\r\n\ttype = input<ValueTypes | null>(null);\r\n\r\n\tplaceholder = input<string>('Arama...');\r\n\tforceSelection = input<boolean>(false);\r\n\tmultiple = input<boolean>(false);\r\n\tshowClear = input<boolean>(false);\r\n\toptionValue = input<keyof SuggestionsDTO | null>(null);\r\n\tappendTo = input<string | HTMLElement | null>('body');\r\n\tmql = input<string>();\r\n\tisUpdateMode = signal<boolean>(false);\r\n\r\n\tfilteredSelectionItems!: SuggestionsGroupDTO[];\r\n\tselectionDefinitions!: DefaultSearchAggregateAssetAggregate;\r\n\tcacheSearchRequest$ = new Subject<CacheSearchRequestDTO>();\r\n\tdestroyRef = inject(DestroyRef);\r\n\t@Output() selectedDefinitionEvent: EventEmitter<AssetAggregate> = new EventEmitter<AssetAggregate>();\r\n\r\n\tconstructor(\r\n\t\tprivate readonly http: HttpClient,\r\n\t\tpublic translocoService: TranslocoService\r\n\t) {\r\n\t\tsuper();\r\n\t}\r\n\r\n\tngOnInit() {\r\n\t\tthis.cacheSearchRequest$\r\n\t\t\t.pipe(\r\n\t\t\t\tswitchMap((payload) =>\r\n\t\t\t\t\tthis.http.post<any>(API_CONFIGS.getExternalAppEndpoint(Apps.MNG) + '/master-data/cache-search', payload)\r\n\t\t\t\t),\r\n\t\t\t\ttakeUntilDestroyed(this.destroyRef)\r\n\t\t\t)\r\n\t\t\t.subscribe((selectionGroup) => {\r\n\t\t\t\tthis.selectionDefinitions = selectionGroup;\r\n\r\n\t\t\t\tconst newFilteredGroupSuggestions: SuggestionsGroupDTO[] = [];\r\n\r\n\t\t\t\tObject.keys(selectionGroup).forEach((key: string) => {\r\n\t\t\t\t\tconst groupData: SuggestionsGroupDTO = {\r\n\t\t\t\t\t\ttext: selectionGroup[key]?.result[0]?.assets[0]?.assetDefinitionName,\r\n\t\t\t\t\t\tkey: key,\r\n\t\t\t\t\t\titems: selectionGroup[key].result.map(\r\n\t\t\t\t\t\t\t(item: AssetAggregate) =>\r\n\t\t\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\t\t\tkey: item.id,\r\n\t\t\t\t\t\t\t\t\ttext: this.getAttiributesValueDescr(item.attributes),\r\n\t\t\t\t\t\t\t\t\tattributes: item.attributes,\r\n\t\t\t\t\t\t\t\t\tassetDefinitionCode: item.assetDefinitionCode\r\n\t\t\t\t\t\t\t\t}) as SuggestionsDTO\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t};\r\n\t\t\t\t\tnewFilteredGroupSuggestions.push(groupData);\r\n\r\n\t\t\t\t\t// If the string value is patched in update mode and there is group data, select the first item\r\n\t\t\t\t\tif (this.isUpdateMode() && groupData.items.length === 1 && !this.multiple()) {\r\n\t\t\t\t\t\tthis.ngControl?.control?.setValue(groupData.items[0]);\r\n\t\t\t\t\t\tthis.isUpdateMode.set(false);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t\t\tthis.filteredSelectionItems = newFilteredGroupSuggestions;\r\n\t\t\t});\r\n\r\n\t\t// If the form control's value is a string, perform a cache search to retrieve the ID.\r\n\t\tconst currentValue = this.ngControl?.control?.value;\r\n\t\tif (currentValue && typeof currentValue === 'string'){\r\n\t\t\t\t\tthis.isUpdateMode.set(true);\r\n\t\t\t\t\tthis.search({ query: currentValue });\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tngAfterViewInit(): void {\r\n\t\tthis.autoCompleteRef.getOptionValue = this.getOptionValue.bind(this);\r\n\t}\r\n\r\n\tgetOptionValue(option: any) {\r\n\t\tif (!this.optionValue()) {\r\n\t\t\treturn option;\r\n\t\t}\r\n\r\n\t\tif (typeof option === 'object') {\r\n\t\t\treturn ObjectUtils.resolveFieldData(option, this.optionValue());\r\n\t\t}\r\n\r\n\t\treturn option;\r\n\t}\r\n\r\n\tonNgModelChange(value: string) {\r\n\t\tconst validatedValue = this.validateInput(value);\r\n\t\tthis.ngControl.viewToModelUpdate(validatedValue);\r\n\t}\r\n\r\n\tvalidateInput(value: string) {\r\n\t\tif (this.type() === 'number') {\r\n\t\t\treturn value.replace(/\\D/g, '');\r\n\t\t} else if (this.type() === 'text') {\r\n\t\t\treturn value.replace(/[^a-zA-ZğüşıöçĞÜŞİÖÇ\\s]/g, '');\r\n\t\t}\r\n\t\treturn value;\r\n\t}\r\n\r\n\tsearch(event: any) {\r\n\t\tconst query = this.validateInput(event.query);\r\n\t\tconst payload: CacheSearchRequestDTO = {\r\n\t\t\tsearchText: query?.trim(),\r\n\t\t\tassetDefinitionCodes: Array.isArray(this.assetCode()) ? this.assetCode() : ([this.assetCode()] as any),\r\n\t\t\tpager: {\r\n\t\t\t\tpageSize: 5,\r\n\t\t\t\tpageNumber: 1\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tif (this.mql()) payload.mql = this.mql();\r\n\r\n\t\tthis.cacheSearchRequest$.next(payload);\r\n\t}\r\n\r\n\tgetAttiributesValueDescr(attributes: AttributeElement[]): string {\r\n\t\treturn attributes\r\n\t\t\t?.map((attr) => {\r\n\t\t\t\tconst value = attr.valueDesc ? attr.valueDesc : attr.value;\r\n\t\t\t\treturn typeof value === 'object' ? JSON.stringify(value) : String(value);\r\n\t\t\t})\r\n\t\t\t.join(' - ');\r\n\t}\r\n\r\n\ttriggerSelectedEvents(event: any) {\r\n\t\tconst selectedItems: AssetAggregate[] = Object.keys(this.selectionDefinitions).map((key: string) => {\r\n\t\t\treturn this.selectionDefinitions[key].result.find((item: AssetAggregate) => item.id === event?.value?.key);\r\n\t\t}) as AssetAggregate[];\r\n\r\n\t\tconst selectedItem = selectedItems[0];\r\n\r\n\t\tconst selectedEvent = {\r\n\t\t\t...selectedItem,\r\n\t\t\tkey: selectedItem?.id,\r\n\t\t\ttext: selectedItem?.assetDefinitionName,\r\n\t\t\tattributes: selectedItem?.attributes,\r\n\t\t\tassetDefinitionCode: selectedItem?.assetDefinitionCode\r\n\t\t};\r\n\r\n\t\tthis.selectedDefinitionEvent.emit(selectedEvent);\r\n\t}\r\n}\r\n","<p-autoComplete\r\n\toptionLabel=\"text\"\r\n\t[optionValue]=\"optionValue()!\"\r\n\t[placeholder]=\"placeholder()\"\r\n\t[multiple]=\"multiple()\"\r\n\t[group]=\"true\"\r\n\t[forceSelection]=\"forceSelection()\"\r\n\t[delay]=\"700\"\r\n\t[minLength]=\"3\"\r\n\t[suggestions]=\"filteredSelectionItems\"\r\n\t(completeMethod)=\"search($event)\"\r\n\t[formControl]=\"ngControl.control\"\r\n\t[autoHighlight]=\"true\"\r\n\t[type]=\"type()!\"\r\n\t(ngModelChange)=\"onNgModelChange($event)\"\r\n\t[showClear]=\"showClear()\"\r\n\t[emptyMessage]=\"translocoService.translate('messages.noDataToDisplay')\"\r\n\t(onSelect)=\"triggerSelectedEvents($event)\"\r\n\t[appendTo]=\"appendTo()\"\r\n\t(keyup.enter)=\"search($event)\">\r\n\t<ng-template let-group pTemplate=\"group\">\r\n\t\t<span class=\"font-bold\">{{ group.text }}</span>\r\n\t</ng-template>\r\n</p-autoComplete>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA+DM,MAAO,oBAAqB,SAAQ,kBAAkB,CAAA;IAoB3D,WACkB,CAAA,IAAgB,EAC1B,gBAAkC,EAAA;AAEzC,QAA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I,EAAA,QAAA,EACN,gGAAgG,EAAA,OAAA,EAsBjG,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,EAAA,cAAA,EAClC,CAAC,sBAAsB,CAAC,EAAA,QAAA,EAAA,w2BAAA,EAAA,MAAA,EAAA,CAAA,uOAAA,CAAA,EAAA,CAAA;8GAGf,eAAe,EAAA,CAAA;sBAAvC,SAAS;uBAAC,YAAY,CAAA;gBAiBb,uBAAuB,EAAA,CAAA;sBAAhC,MAAM;;;AEjFR;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"aril-ui-business-assetPicker.mjs","sources":["../../projects/aril/ui-business/assetPicker/src/asset-picker.component.ts","../../projects/aril/ui-business/assetPicker/src/asset-picker.component.html","../../projects/aril/ui-business/assetPicker/aril-ui-business-assetPicker.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport {\r\n\tAfterViewInit,\r\n\tComponent,\r\n\tDestroyRef,\r\n\tEventEmitter,\r\n\tOnInit,\r\n\tOutput,\r\n\tViewChild,\r\n\teffect,\r\n\tinject,\r\n\tinput,\r\n\tsignal\r\n} from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\n\r\nimport { AutoComplete, AutoCompleteModule } from 'primeng/autocomplete';\r\nimport { ObjectUtils } from 'primeng/utils';\r\n\r\nimport { TranslocoService } from '@ngneat/transloco';\r\nimport { Subject, switchMap } from 'rxjs';\r\n\r\nimport { API_CONFIGS } from 'aril/boot/config/api';\r\nimport { Apps } from 'aril/boot/config/apps';\r\nimport { SelectionGroupService } from 'aril/theme/layout';\r\nimport { BaseInputComponent, ValueAccessorDirective } from 'aril/ui/lib';\r\n\r\nimport {\r\n\tAssetAggregate,\r\n\tAttributeElement,\r\n\tCacheSearchRequestDTO,\r\n\tDefaultSearchAggregateAssetAggregate,\r\n\tSuggestionsDTO,\r\n\tSuggestionsGroupDTO\r\n} from './interface';\r\n\r\ntype ValueTypes = 'text' | 'number';\r\n@Component({\r\n\tstandalone: true,\r\n\tselector: 'aril-asset-picker[ngModel], aril-asset-picker[formControl], aril-asset-picker[formControlName]',\r\n\ttemplateUrl: './asset-picker.component.html',\r\n\tstyles: [\r\n\t\t`\r\n\t\t\t::ng-deep .p-autocomplete-multiple-container {\r\n\t\t\t\tflex-wrap: wrap;\r\n\t\t\t\tmax-height: 50px;\r\n\t\t\t\toverflow-y: auto;\r\n\t\t\t\talign-items: center;\r\n\t\t\t}\r\n\r\n\t\t\t::ng-deep .p-autocomplete-token {\r\n\t\t\t\tmargin: 0;\r\n\t\t\t\tflex-shrink: 0;\r\n\t\t\t}\r\n\r\n\t\t\t::ng-deep .p-autocomplete-input-token {\r\n\t\t\t\tflex: 1;\r\n\t\t\t\tmin-width: 150px;\r\n\t\t\t}\r\n\t\t`\r\n\t],\r\n\timports: [ReactiveFormsModule, AutoCompleteModule],\r\n\thostDirectives: [ValueAccessorDirective]\r\n})\r\nexport class AssetPickerComponent extends BaseInputComponent implements AfterViewInit, OnInit {\r\n\t@ViewChild(AutoComplete) autoCompleteRef!: AutoComplete;\r\n\tassetCode = input<string | string[] | null>(null);\r\n\ttype = input<ValueTypes | null>(null);\r\n\r\n\tplaceholder = input<string>('Arama...');\r\n\tforceSelection = input<boolean>(false);\r\n\tmultiple = input<boolean>(false);\r\n\tshowClear = input<boolean>(false);\r\n\toptionValue = input<keyof SuggestionsDTO | null>(null);\r\n\tappendTo = input<string | HTMLElement | null>('body');\r\n\tmql = input<string>();\r\n\texcludedAttributeCodes = input<string[]>([]);\r\n\tisUpdateMode = signal<boolean>(false);\r\n\r\n\tfilteredSelectionItems!: SuggestionsGroupDTO[];\r\n\tselectionDefinitions!: DefaultSearchAggregateAssetAggregate;\r\n\tcacheSearchRequest$ = new Subject<CacheSearchRequestDTO>();\r\n\tdestroyRef = inject(DestroyRef);\r\n\t@Output() selectedDefinitionEvent: EventEmitter<AssetAggregate> = new EventEmitter<AssetAggregate>();\r\n\r\n\tconstructor(\r\n\t\tprivate readonly http: HttpClient,\r\n\t\tpublic translocoService: TranslocoService,\r\n\t\tprivate readonly selectionGroupService: SelectionGroupService\r\n\t) {\r\n\t\tsuper();\r\n\r\n\t\teffect(() => {\r\n\t\t\tthis.selectionGroupService.selectionGroups();\r\n\t\t\tif (this.selectionDefinitions) {\r\n\t\t\t\tthis.refreshFilteredSelectionItems();\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t}\r\n\r\n\tngOnInit() {\r\n\t\tthis.cacheSearchRequest$\r\n\t\t\t.pipe(\r\n\t\t\t\tswitchMap((payload) =>\r\n\t\t\t\t\tthis.http.post<any>(API_CONFIGS.getExternalAppEndpoint(Apps.MNG) + '/master-data/cache-search', payload)\r\n\t\t\t\t),\r\n\t\t\t\ttakeUntilDestroyed(this.destroyRef)\r\n\t\t\t)\r\n\t\t\t.subscribe((selectionGroup) => {\r\n\t\t\t\tthis.selectionDefinitions = selectionGroup;\r\n\t\t\t\tthis.refreshFilteredSelectionItems();\r\n\t\t\t});\r\n\r\n\t\t// If the form control's value is a string, perform a cache search to retrieve the ID.\r\n\t\tconst currentValue = this.ngControl?.control?.value;\r\n\t\tif (currentValue && typeof currentValue === 'string'){\r\n\t\t\t\t\tthis.isUpdateMode.set(true);\r\n\t\t\t\t\tthis.search({ query: currentValue });\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tprivate refreshFilteredSelectionItems(): void {\r\n\t\tif (!this.selectionDefinitions) return;\r\n\r\n\t\tconst newFilteredGroupSuggestions: SuggestionsGroupDTO[] = [];\r\n\r\n\t\tObject.keys(this.selectionDefinitions).forEach((key: string) => {\r\n\t\t\tconst groupData: SuggestionsGroupDTO = {\r\n\t\t\t\ttext: this.selectionDefinitions[key]?.result[0]?.assets[0]?.assetDefinitionName,\r\n\t\t\t\tkey: key,\r\n\t\t\t\titems: this.selectionDefinitions[key].result.map(\r\n\t\t\t\t\t(item: AssetAggregate) =>\r\n\t\t\t\t\t\t({\r\n\t\t\t\t\t\t\tkey: item.id,\r\n\t\t\t\t\t\t\ttext: this.getAttiributesValueDescr(item.attributes),\r\n\t\t\t\t\t\t\tattributes: item.attributes,\r\n\t\t\t\t\t\t\tassetDefinitionCode: item.assetDefinitionCode\r\n\t\t\t\t\t\t}) as SuggestionsDTO\r\n\t\t\t\t)\r\n\t\t\t};\r\n\t\t\tnewFilteredGroupSuggestions.push(groupData);\r\n\r\n\t\t\t// If the string value is patched in update mode and there is group data, select the first item\r\n\t\t\tif (this.isUpdateMode() && groupData.items.length === 1 && !this.multiple()) {\r\n\t\t\t\tthis.ngControl?.control?.setValue(groupData.items[0]);\r\n\t\t\t\tthis.isUpdateMode.set(false);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.filteredSelectionItems = newFilteredGroupSuggestions;\r\n\t}\r\n\r\n\tngAfterViewInit(): void {\r\n\t\tthis.autoCompleteRef.getOptionValue = this.getOptionValue.bind(this);\r\n\t}\r\n\r\n\tgetOptionValue(option: any) {\r\n\t\tif (!this.optionValue()) {\r\n\t\t\treturn option;\r\n\t\t}\r\n\r\n\t\tif (typeof option === 'object') {\r\n\t\t\treturn ObjectUtils.resolveFieldData(option, this.optionValue());\r\n\t\t}\r\n\r\n\t\treturn option;\r\n\t}\r\n\r\n\tonNgModelChange(value: string) {\r\n\t\tconst validatedValue = this.validateInput(value);\r\n\t\tthis.ngControl.viewToModelUpdate(validatedValue);\r\n\t}\r\n\r\n\tvalidateInput(value: string) {\r\n\t\tif (this.type() === 'number') {\r\n\t\t\treturn value.replace(/\\D/g, '');\r\n\t\t} else if (this.type() === 'text') {\r\n\t\t\treturn value.replace(/[^a-zA-ZğüşıöçĞÜŞİÖÇ\\s]/g, '');\r\n\t\t}\r\n\t\treturn value;\r\n\t}\r\n\r\n\tsearch(event: any) {\r\n\t\tconst query = this.validateInput(event.query);\r\n\t\tconst payload: CacheSearchRequestDTO = {\r\n\t\t\tsearchText: query?.trim(),\r\n\t\t\tassetDefinitionCodes: Array.isArray(this.assetCode()) ? this.assetCode() : ([this.assetCode()] as any),\r\n\t\t\tpager: {\r\n\t\t\t\tpageSize: 5,\r\n\t\t\t\tpageNumber: 1\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tif (this.mql()) payload.mql = this.mql();\r\n\r\n\t\tthis.cacheSearchRequest$.next(payload);\r\n\t}\r\n\r\n\tgetAttiributesValueDescr(attributes: AttributeElement[]): string {\r\n\t\tconst excludedAttributes = ['AssetId', 'AssetDefinitionName', ...this.excludedAttributeCodes()];\r\n\t\treturn attributes\r\n\t\t\t?.filter((attr) => !excludedAttributes.includes(attr.attribute?.attributeCode))\r\n\t\t\t?.map((attr) => {\r\n\t\t\t\t// Handle SELECT type attributes using SelectionGroupService\r\n\t\t\t\tif (attr.attribute?.attributeType === 'SELECT' && attr.attribute?.selectOption) {\r\n\t\t\t\t\treturn this.getSelectionDisplay(attr.attribute.selectOption, attr.value as string);\r\n\t\t\t\t}\r\n\t\t\t\tconst value = attr.valueDesc ? attr.valueDesc : attr.value;\r\n\t\t\t\treturn typeof value === 'object' ? JSON.stringify(value) : String(value);\r\n\t\t\t})\r\n\t\t\t.join(' - ');\r\n\t}\r\n\r\n\tprivate getSelectionDisplay(groupName: string, value: string): string {\r\n\t\tconst key = `${groupName}~ALL`;\r\n\t\tconst selectionGroup = this.selectionGroupService.selectionGroups()[key];\r\n\r\n\t\tif (!selectionGroup) {\r\n\t\t\tthis.selectionGroupService.fetchEnum(groupName, 'ALL');\r\n\t\t\treturn value;\r\n\t\t}\r\n\r\n\t\tconst currentLang = this.translocoService.getActiveLang();\r\n\t\tconst selectionItem = selectionGroup.selectionItems?.find((t) => t.selectionKey === value) as {\r\n\t\t\tselectionMultiLanguageDisplays?: { [lang: string]: string };\r\n\t\t\tselectionDisplay?: string;\r\n\t\t};\r\n\r\n\t\tif (!selectionItem) return value;\r\n\r\n\t\treturn selectionItem.selectionMultiLanguageDisplays?.[currentLang] ?? selectionItem.selectionDisplay ?? value;\r\n\t}\r\n\r\n\ttriggerSelectedEvents(event: any) {\r\n\t\tconst selectedItems: AssetAggregate[] = Object.keys(this.selectionDefinitions).map((key: string) => {\r\n\t\t\treturn this.selectionDefinitions[key].result.find((item: AssetAggregate) => item.id === event?.value?.key);\r\n\t\t}) as AssetAggregate[];\r\n\r\n\t\tconst selectedItem = selectedItems[0];\r\n\r\n\t\tconst selectedEvent = {\r\n\t\t\t...selectedItem,\r\n\t\t\tkey: selectedItem?.id,\r\n\t\t\ttext: selectedItem?.assetDefinitionName,\r\n\t\t\tattributes: selectedItem?.attributes,\r\n\t\t\tassetDefinitionCode: selectedItem?.assetDefinitionCode\r\n\t\t};\r\n\r\n\t\tthis.selectedDefinitionEvent.emit(selectedEvent);\r\n\t}\r\n}\r\n","<p-autoComplete\r\n\toptionLabel=\"text\"\r\n\t[optionValue]=\"optionValue()!\"\r\n\t[placeholder]=\"placeholder()\"\r\n\t[multiple]=\"multiple()\"\r\n\t[group]=\"true\"\r\n\t[forceSelection]=\"forceSelection()\"\r\n\t[delay]=\"700\"\r\n\t[minLength]=\"3\"\r\n\t[suggestions]=\"filteredSelectionItems\"\r\n\t(completeMethod)=\"search($event)\"\r\n\t[formControl]=\"ngControl.control\"\r\n\t[autoHighlight]=\"true\"\r\n\t[type]=\"type()!\"\r\n\t(ngModelChange)=\"onNgModelChange($event)\"\r\n\t[showClear]=\"showClear()\"\r\n\t[emptyMessage]=\"translocoService.translate('messages.noDataToDisplay')\"\r\n\t(onSelect)=\"triggerSelectedEvents($event)\"\r\n\t[appendTo]=\"appendTo()\"\r\n\t(keyup.enter)=\"search($event)\">\r\n\t<ng-template let-group pTemplate=\"group\">\r\n\t\t<span class=\"font-bold\">{{ group.text }}</span>\r\n\t</ng-template>\r\n</p-autoComplete>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAiEM,MAAO,oBAAqB,SAAQ,kBAAkB,CAAA;AAqB3D,IAAA,WAAA,CACk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AA,EAAA,kBAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,EAAA,UAAA,EAAA,YAAA,EAAA,SAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,SAAA,EAAA,QAAA,EAAA,QAAA,EAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,aAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGrC,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBA3BhC,SAAS;iCACG,IAAI,EAAA,QAAA,EACN,gGAAgG,EAAA,OAAA,EAsBjG,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,EAAA,cAAA,EAClC,CAAC,sBAAsB,CAAC,EAAA,QAAA,EAAA,w2BAAA,EAAA,MAAA,EAAA,CAAA,uOAAA,CAAA,EAAA,CAAA;kJAGf,eAAe,EAAA,CAAA;sBAAvC,SAAS;uBAAC,YAAY,CAAA;gBAkBb,uBAAuB,EAAA,CAAA;sBAAhC,MAAM;;;AEpFR;;AAEG;;;;"}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, signal, computed, effect, Directive, Inject, Component, Injectable } from '@angular/core';
|
|
3
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
4
|
+
import { TranslocoService } from '@ngneat/transloco';
|
|
5
|
+
import * as i1 from 'primeng/dynamicdialog';
|
|
6
|
+
import { DialogService } from 'primeng/dynamicdialog';
|
|
7
|
+
import * as i2 from '@angular-architects/module-federation-tools';
|
|
8
|
+
import { ModuleFederationToolsModule } from '@angular-architects/module-federation-tools';
|
|
9
|
+
import { PLUGINS } from 'aril/boot/config/plugins';
|
|
10
|
+
|
|
11
|
+
const DETAIL_COMPONENT = new InjectionToken('DETAIL_COMPONENT');
|
|
12
|
+
const PLUGIN_DIALOG_SERVICE = new InjectionToken('PLUGIN_DIALOG_SERVICE');
|
|
13
|
+
|
|
14
|
+
class DetailPageCustomizationDirective {
|
|
15
|
+
constructor(detailComponent) {
|
|
16
|
+
this.detailComponent = detailComponent;
|
|
17
|
+
this.route = inject(ActivatedRoute);
|
|
18
|
+
this.router = inject(Router);
|
|
19
|
+
this.dialogService = inject(PLUGIN_DIALOG_SERVICE); // Use token instead
|
|
20
|
+
this.translocoService = inject(TranslocoService);
|
|
21
|
+
// Internal signal to track when TabView and the menu are ready
|
|
22
|
+
this.viewsInitialized = signal(false);
|
|
23
|
+
this.getRouteConfig = () => {
|
|
24
|
+
const configs = globalThis.routeConfigs;
|
|
25
|
+
if (!configs || !Array.isArray(configs))
|
|
26
|
+
return undefined;
|
|
27
|
+
const currentUrl = this.router.url.split('?')[0];
|
|
28
|
+
let bestMatch;
|
|
29
|
+
for (const config of configs) {
|
|
30
|
+
if (!config.path)
|
|
31
|
+
continue;
|
|
32
|
+
const urlToCheck = config.path.startsWith('/') ? config.path : `/${config.path}`;
|
|
33
|
+
if (currentUrl.startsWith(urlToCheck)) {
|
|
34
|
+
bestMatch = config;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!bestMatch)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(bestMatch.content);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
console.error('Failed to parse route config content:', e);
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.getProcessedTabs = computed(() => {
|
|
49
|
+
if (!this.config?.tabs)
|
|
50
|
+
return [];
|
|
51
|
+
const activeLang = this.translocoService.getActiveLang();
|
|
52
|
+
return this.config.tabs
|
|
53
|
+
.filter((tab) => tab.visible !== false)
|
|
54
|
+
.map((tab) => ({
|
|
55
|
+
id: tab.id ?? null,
|
|
56
|
+
icon: tab.icon,
|
|
57
|
+
header: tab.label ? tab.label[activeLang] : '',
|
|
58
|
+
visible: tab.visible,
|
|
59
|
+
position: tab.position,
|
|
60
|
+
components: tab.components || []
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
this.config = this.getRouteConfig();
|
|
64
|
+
effect((onCleanup) => {
|
|
65
|
+
if (this.viewsInitialized())
|
|
66
|
+
return;
|
|
67
|
+
// Poll every animation frame until both TabView and the menu is ready
|
|
68
|
+
// The menu can be directly defined in the component from init step, or be built dynamically after waiting for a network response. So we must wait for it to be ready.
|
|
69
|
+
const checkViews = () => {
|
|
70
|
+
if (this.detailComponent.tabView?.tabs && this.detailComponent.mdInfoPluginProps?.generalMenu()?.length) {
|
|
71
|
+
this.viewsInitialized.set(true);
|
|
72
|
+
this.onViewsReady();
|
|
73
|
+
}
|
|
74
|
+
else if (!this.viewsInitialized()) {
|
|
75
|
+
frameId = requestAnimationFrame(checkViews);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
let frameId = requestAnimationFrame(checkViews);
|
|
79
|
+
onCleanup(() => {
|
|
80
|
+
cancelAnimationFrame(frameId);
|
|
81
|
+
});
|
|
82
|
+
}, { allowSignalWrites: true });
|
|
83
|
+
}
|
|
84
|
+
onViewsReady() {
|
|
85
|
+
if (!this.config)
|
|
86
|
+
return;
|
|
87
|
+
// step 1 - hide tabs based on config
|
|
88
|
+
if (this.detailComponent.tabView?.tabs) {
|
|
89
|
+
this.updateTabVisibility();
|
|
90
|
+
}
|
|
91
|
+
// step 2 - append config tabs to the static tabs (only new ones, not those matching static tabs)
|
|
92
|
+
const allConfigTabs = this.getProcessedTabs();
|
|
93
|
+
// Get IDs of existing static tabs
|
|
94
|
+
const staticTabIds = new Set();
|
|
95
|
+
if (this.detailComponent.tabView?.tabs) {
|
|
96
|
+
this.detailComponent.tabView.tabs.forEach((tabPanel) => {
|
|
97
|
+
const tabId = tabPanel?.el?.nativeElement?.id;
|
|
98
|
+
if (tabId) {
|
|
99
|
+
staticTabIds.add(tabId);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Filter out config tabs that are meant to *reorder* existing static tabs.
|
|
104
|
+
// Any tab whose id matches an existing static tab id is considered a "reorder"
|
|
105
|
+
// instruction; everything else (id === null OR an id that doesn't exist yet)
|
|
106
|
+
// is treated as a brand new tab.
|
|
107
|
+
const newConfigTabs = allConfigTabs.filter((tab) => {
|
|
108
|
+
// new tab when id is null/undefined
|
|
109
|
+
if (!tab.id)
|
|
110
|
+
return true;
|
|
111
|
+
// new tab when id is provided but doesn't match any static tab id
|
|
112
|
+
return !staticTabIds.has(tab.id);
|
|
113
|
+
});
|
|
114
|
+
if (newConfigTabs.length > 0 && this.detailComponent.configTabs) {
|
|
115
|
+
this.detailComponent.configTabs.set(newConfigTabs);
|
|
116
|
+
}
|
|
117
|
+
else if (newConfigTabs.length > 0) {
|
|
118
|
+
this.detailComponent.tabs = newConfigTabs;
|
|
119
|
+
}
|
|
120
|
+
// using setTimeout to ensure tabView is ready as we want to work directly with the generated elements
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
// step 3 - reorder tabs
|
|
123
|
+
this.reorderTabsByPosition();
|
|
124
|
+
// step 4 - activate tab from URL if specified
|
|
125
|
+
this.activateTabFromUrl();
|
|
126
|
+
// step 5 - update the menu
|
|
127
|
+
if (this.config?.menu) {
|
|
128
|
+
this.updateMenu(this.config.menu);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
updateTabVisibility() {
|
|
133
|
+
if (!this.config?.tabs)
|
|
134
|
+
return;
|
|
135
|
+
// Find tabs in config that have visible: false
|
|
136
|
+
const hiddenTabPositions = this.config.tabs.filter((tab) => tab.visible === false).map((tab) => tab.position);
|
|
137
|
+
hiddenTabPositions.forEach((position) => {
|
|
138
|
+
this.hideTabByPosition(position, true);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
hideTabByPosition(position, hide = true) {
|
|
142
|
+
if (!this.detailComponent.tabView?.tabs)
|
|
143
|
+
return;
|
|
144
|
+
const panelToHide = this.detailComponent.tabView.tabs[position];
|
|
145
|
+
const tabToHide = this.detailComponent.tabView.list?.children[position];
|
|
146
|
+
if (tabToHide && panelToHide) {
|
|
147
|
+
panelToHide.el.nativeElement.hidden = hide;
|
|
148
|
+
tabToHide.style.display = 'none';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Reorder tabs based on config positions
|
|
153
|
+
* Iterates over visible config tabs and rearranges both static and config tabs
|
|
154
|
+
*/
|
|
155
|
+
reorderTabsByPosition() {
|
|
156
|
+
if (!this.detailComponent.tabView?.tabs || !this.detailComponent.tabView?.list)
|
|
157
|
+
return;
|
|
158
|
+
const configTabs = this.getProcessedTabs();
|
|
159
|
+
const allTabs = this.detailComponent.tabView.tabs;
|
|
160
|
+
const navList = this.detailComponent.tabView.list;
|
|
161
|
+
const configTabMap = new Map();
|
|
162
|
+
configTabs.forEach((tab) => {
|
|
163
|
+
// Only treat tabs that both:
|
|
164
|
+
// - have an id
|
|
165
|
+
// - and have an explicit position
|
|
166
|
+
// as "reorder instructions" for existing static tabs.
|
|
167
|
+
// Tabs without a position (even if they have an id) are considered
|
|
168
|
+
// regular/new tabs and should keep their natural order.
|
|
169
|
+
if (tab.id && tab.position) {
|
|
170
|
+
configTabMap.set(tab.id, tab);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
// separate static from config tabs
|
|
174
|
+
const staticTabs = [];
|
|
175
|
+
const configTabInstances = [];
|
|
176
|
+
allTabs.forEach((tabPanel, index) => {
|
|
177
|
+
const tabId = tabPanel?.el?.nativeElement?.id || null;
|
|
178
|
+
const configTab = tabId ? configTabMap.get(tabId) : null;
|
|
179
|
+
if (configTab) {
|
|
180
|
+
configTabInstances.push({ tab: tabPanel, index, config: configTab });
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
staticTabs.push({ tab: tabPanel, index, id: tabId });
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
const positionMap = new Map();
|
|
187
|
+
// place config tabs at their specified positions
|
|
188
|
+
configTabInstances.forEach(({ tab, config }) => {
|
|
189
|
+
if (config.position !== undefined && config.position !== null) {
|
|
190
|
+
positionMap.set(config.position, { tab, isConfig: true, id: config.id });
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// place static tabs at available positions (maintaining relative order)
|
|
194
|
+
let staticIndex = 0;
|
|
195
|
+
let currentPosition = 0;
|
|
196
|
+
while (staticIndex < staticTabs.length) {
|
|
197
|
+
while (positionMap.has(currentPosition)) {
|
|
198
|
+
currentPosition++;
|
|
199
|
+
}
|
|
200
|
+
// place static tab at this position
|
|
201
|
+
const staticTab = staticTabs[staticIndex];
|
|
202
|
+
positionMap.set(currentPosition, { tab: staticTab.tab, isConfig: false, id: staticTab.id });
|
|
203
|
+
staticIndex++;
|
|
204
|
+
currentPosition++;
|
|
205
|
+
}
|
|
206
|
+
// build ordered array
|
|
207
|
+
const sortedPositions = Array.from(positionMap.keys()).sort((a, b) => a - b);
|
|
208
|
+
const reorderedTabs = [];
|
|
209
|
+
const reorderedHeaders = [];
|
|
210
|
+
sortedPositions.forEach((position) => {
|
|
211
|
+
const tabInfo = positionMap.get(position);
|
|
212
|
+
reorderedTabs.push(tabInfo.tab);
|
|
213
|
+
const originalIndex = allTabs.indexOf(tabInfo.tab);
|
|
214
|
+
if (originalIndex !== -1 && navList.children[originalIndex]) {
|
|
215
|
+
reorderedHeaders.push(navList.children[originalIndex]);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
// reorder tabs array
|
|
219
|
+
this.detailComponent.tabView.tabs.length = 0;
|
|
220
|
+
reorderedTabs.forEach((tab) => this.detailComponent.tabView.tabs.push(tab));
|
|
221
|
+
// reorder dom headers
|
|
222
|
+
reorderedHeaders.forEach((header, newIndex) => {
|
|
223
|
+
const targetHeader = navList.children[newIndex];
|
|
224
|
+
if (targetHeader && targetHeader !== header) {
|
|
225
|
+
navList.insertBefore(header, targetHeader);
|
|
226
|
+
}
|
|
227
|
+
else if (!targetHeader) {
|
|
228
|
+
navList.appendChild(header);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
// reorder dom panels
|
|
232
|
+
const panelsContainer = allTabs[0]?.el.nativeElement.parentElement;
|
|
233
|
+
if (panelsContainer) {
|
|
234
|
+
reorderedTabs.forEach((tabPanel, newIndex) => {
|
|
235
|
+
const targetPanel = panelsContainer.children[newIndex];
|
|
236
|
+
if (targetPanel && targetPanel !== tabPanel.el.nativeElement) {
|
|
237
|
+
panelsContainer.insertBefore(tabPanel.el.nativeElement, targetPanel);
|
|
238
|
+
}
|
|
239
|
+
else if (!targetPanel) {
|
|
240
|
+
panelsContainer.appendChild(tabPanel.el.nativeElement);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (this.detailComponent.tabView.cd) {
|
|
245
|
+
this.detailComponent.tabView.cd.markForCheck();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
activateTabFromUrl() {
|
|
249
|
+
if (!this.detailComponent.tabView)
|
|
250
|
+
return;
|
|
251
|
+
const activeTabParam = this.route.snapshot.queryParamMap.get('activeTab');
|
|
252
|
+
if (activeTabParam) {
|
|
253
|
+
const activeTabIndex = Number(activeTabParam);
|
|
254
|
+
if (!isNaN(activeTabIndex) &&
|
|
255
|
+
activeTabIndex >= 0 &&
|
|
256
|
+
this.detailComponent.tabView.tabs &&
|
|
257
|
+
activeTabIndex < this.detailComponent.tabView.tabs.length) {
|
|
258
|
+
this.detailComponent.tabView.activeIndex = activeTabIndex;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
updateMenu(menuConfig) {
|
|
263
|
+
const context = {
|
|
264
|
+
router: this.router,
|
|
265
|
+
route: this.route,
|
|
266
|
+
dialogService: this.dialogService,
|
|
267
|
+
component: this.detailComponent
|
|
268
|
+
};
|
|
269
|
+
const activeLang = this.translocoService.getActiveLang();
|
|
270
|
+
const dynamicMenu = menuConfig.map((m) => ({
|
|
271
|
+
label: m.label[activeLang] ?? '',
|
|
272
|
+
icon: m.icon,
|
|
273
|
+
command: (_event) => {
|
|
274
|
+
const commandFn = new Function('ctx', m.command);
|
|
275
|
+
commandFn(context)(context);
|
|
276
|
+
}
|
|
277
|
+
}));
|
|
278
|
+
// Update the existing signal instead of replacing it to ensure change
|
|
279
|
+
// detection picks up the menu update after browser back navigation.
|
|
280
|
+
const generalMenuSignal = this.detailComponent.mdInfoPluginProps.generalMenu;
|
|
281
|
+
const existingMenu = generalMenuSignal();
|
|
282
|
+
// Avoid duplicating previously added dynamic items (identified by label/icon match)
|
|
283
|
+
const mergedMenu = [
|
|
284
|
+
...existingMenu.filter((item) => !dynamicMenu.some((dyn) => dyn.label === item.label && dyn.icon === item.icon)),
|
|
285
|
+
...dynamicMenu
|
|
286
|
+
];
|
|
287
|
+
if (generalMenuSignal?.set) {
|
|
288
|
+
generalMenuSignal.set(mergedMenu);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.detailComponent.mdInfoPluginProps.generalMenu = signal(mergedMenu);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DetailPageCustomizationDirective, deps: [{ token: DETAIL_COMPONENT }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
295
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: DetailPageCustomizationDirective, isStandalone: true, ngImport: i0 }); }
|
|
296
|
+
}
|
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DetailPageCustomizationDirective, decorators: [{
|
|
298
|
+
type: Directive,
|
|
299
|
+
args: [{
|
|
300
|
+
standalone: true
|
|
301
|
+
}]
|
|
302
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
303
|
+
type: Inject,
|
|
304
|
+
args: [DETAIL_COMPONENT]
|
|
305
|
+
}] }] });
|
|
306
|
+
|
|
307
|
+
class CustomizedPluginDialogComponent {
|
|
308
|
+
constructor(dialogConfig) {
|
|
309
|
+
this.dialogConfig = dialogConfig;
|
|
310
|
+
this.PLUGINS = PLUGINS;
|
|
311
|
+
this.dialogConfig.draggable = true;
|
|
312
|
+
this.name = this.dialogConfig.data;
|
|
313
|
+
}
|
|
314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CustomizedPluginDialogComponent, deps: [{ token: i1.DynamicDialogConfig }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: CustomizedPluginDialogComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<mft-wc-wrapper [options]="PLUGINS[name].options" />`, isInline: true, dependencies: [{ kind: "ngmodule", type: ModuleFederationToolsModule }, { kind: "component", type: i2.WebComponentWrapper, selector: "mft-wc-wrapper", inputs: ["options", "props", "events"] }] }); }
|
|
316
|
+
}
|
|
317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CustomizedPluginDialogComponent, decorators: [{
|
|
318
|
+
type: Component,
|
|
319
|
+
args: [{
|
|
320
|
+
standalone: true,
|
|
321
|
+
imports: [ModuleFederationToolsModule],
|
|
322
|
+
template: `<mft-wc-wrapper [options]="PLUGINS[name].options" />`
|
|
323
|
+
}]
|
|
324
|
+
}], ctorParameters: () => [{ type: i1.DynamicDialogConfig }] });
|
|
325
|
+
|
|
326
|
+
class CustomizedPluginDialogService extends DialogService {
|
|
327
|
+
openDialog(config) {
|
|
328
|
+
return super.open(CustomizedPluginDialogComponent, config);
|
|
329
|
+
}
|
|
330
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CustomizedPluginDialogService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
331
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CustomizedPluginDialogService, providedIn: 'root' }); }
|
|
332
|
+
}
|
|
333
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: CustomizedPluginDialogService, decorators: [{
|
|
334
|
+
type: Injectable,
|
|
335
|
+
args: [{ providedIn: 'root' }]
|
|
336
|
+
}] });
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Generated bundle index. Do not edit.
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
export { CustomizedPluginDialogComponent, CustomizedPluginDialogService, DETAIL_COMPONENT, DetailPageCustomizationDirective, PLUGIN_DIALOG_SERVICE };
|
|
343
|
+
//# sourceMappingURL=aril-util-directives.mjs.map
|