@updevs/components 1.0.0-alpha.1 → 1.0.0-alpha.100
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/README.md +1 -24
- package/assets/styles/_bootstrap-components.scss +55 -0
- package/assets/styles/_bootstrap-config.scss +7 -0
- package/assets/styles/_bootstrap-override.scss +78 -0
- package/assets/styles/_config.scss +9 -0
- package/assets/styles/_core.scss +80 -0
- package/assets/styles/_debug.scss +49 -0
- package/assets/styles/_mixins.scss +2 -0
- package/assets/styles/_props.scss +91 -0
- package/assets/styles/_seven-columns.scss +73 -0
- package/assets/styles/_updevs.scss +25 -0
- package/assets/styles/_utilities-marketing.scss +209 -0
- package/assets/styles/_utilities.scss +133 -0
- package/assets/styles/_variables-dark.scss +19 -0
- package/assets/styles/_variables.scss +1003 -0
- package/assets/styles/fonts/_webfonts.scss +15 -0
- package/assets/styles/helpers/_index.scss +143 -0
- package/assets/styles/layout/_animations.scss +62 -0
- package/assets/styles/layout/_core.scss +62 -0
- package/assets/styles/layout/_dark.scss +77 -0
- package/assets/styles/layout/_footer.scss +12 -0
- package/assets/styles/layout/_navbar.scss +392 -0
- package/assets/styles/layout/_page.scss +170 -0
- package/assets/styles/layout/_root.scss +64 -0
- package/assets/styles/marketing/_browser.scss +67 -0
- package/assets/styles/marketing/_core.scss +8 -0
- package/assets/styles/marketing/_filters.scss +0 -0
- package/assets/styles/marketing/_hero.scss +70 -0
- package/assets/styles/marketing/_pricing.scss +111 -0
- package/assets/styles/marketing/_sections.scss +124 -0
- package/assets/styles/marketing/_shape.scss +31 -0
- package/assets/styles/mixins/_functions.scss +96 -0
- package/assets/styles/mixins/_mixins.scss +68 -0
- package/assets/styles/ui/_accordion.scss +178 -0
- package/assets/styles/ui/_alerts.scss +101 -0
- package/assets/styles/ui/_avatars.scss +145 -0
- package/assets/styles/ui/_badges.scss +113 -0
- package/assets/styles/ui/_breadcrumbs.scss +50 -0
- package/assets/styles/ui/_button-group.scss +16 -0
- package/assets/styles/ui/_buttons.scss +261 -0
- package/assets/styles/ui/_calendars.scss +104 -0
- package/assets/styles/ui/_cards.scss +595 -0
- package/assets/styles/ui/_carousel.scss +68 -0
- package/assets/styles/ui/_charts.scss +61 -0
- package/assets/styles/ui/_chat.scss +38 -0
- package/assets/styles/ui/_chips.scss +0 -0
- package/assets/styles/ui/_close.scss +60 -0
- package/assets/styles/ui/_datagrid.scss +17 -0
- package/assets/styles/ui/_dropdowns.scss +120 -0
- package/assets/styles/ui/_empty.scss +60 -0
- package/assets/styles/ui/_flags.scss +31 -0
- package/assets/styles/ui/_forms.scss +250 -0
- package/assets/styles/ui/_grid.scss +115 -0
- package/assets/styles/ui/_icons.scss +72 -0
- package/assets/styles/ui/_images.scss +19 -0
- package/assets/styles/ui/_legend.scss +12 -0
- package/assets/styles/ui/_lists.scss +123 -0
- package/assets/styles/ui/_loaders.scss +72 -0
- package/assets/styles/ui/_login.scss +3 -0
- package/assets/styles/ui/_markdown.scss +53 -0
- package/assets/styles/ui/_modals.scss +67 -0
- package/assets/styles/ui/_nav.scss +106 -0
- package/assets/styles/ui/_offcanvas.scss +17 -0
- package/assets/styles/ui/_pagination.scss +58 -0
- package/assets/styles/ui/_payments.scss +28 -0
- package/assets/styles/ui/_placeholder.scss +9 -0
- package/assets/styles/ui/_popovers.scss +2 -0
- package/assets/styles/ui/_progress.scss +107 -0
- package/assets/styles/ui/_ribbons.scss +157 -0
- package/assets/styles/ui/_segmented.scss +101 -0
- package/assets/styles/ui/_signature.scss +15 -0
- package/assets/styles/ui/_social.scss +52 -0
- package/assets/styles/ui/_stars.scss +13 -0
- package/assets/styles/ui/_status.scss +163 -0
- package/assets/styles/ui/_steps.scss +156 -0
- package/assets/styles/ui/_switch-icon.scss +211 -0
- package/assets/styles/ui/_tables.scss +176 -0
- package/assets/styles/ui/_tags.scss +57 -0
- package/assets/styles/ui/_timeline.scss +61 -0
- package/assets/styles/ui/_toasts.scss +18 -0
- package/assets/styles/ui/_toolbar.scss +10 -0
- package/assets/styles/ui/_tracking.scss +29 -0
- package/assets/styles/ui/_type.scss +330 -0
- package/assets/styles/ui/forms/_form-check.scss +91 -0
- package/assets/styles/ui/forms/_form-colorinput.scss +54 -0
- package/assets/styles/ui/forms/_form-custom.scss +28 -0
- package/assets/styles/ui/forms/_form-icon.scss +35 -0
- package/assets/styles/ui/forms/_form-imagecheck.scss +105 -0
- package/assets/styles/ui/forms/_form-selectgroup.scss +153 -0
- package/assets/styles/ui/forms/_validation.scss +13 -0
- package/assets/styles/ui/typo/_hr.scss +76 -0
- package/assets/styles/utils/_background.scss +15 -0
- package/assets/styles/utils/_colors.scss +101 -0
- package/assets/styles/utils/_opacity.scss +7 -0
- package/assets/styles/utils/_scroll.scss +45 -0
- package/assets/styles/utils/_shadow.scss +17 -0
- package/assets/styles/utils/_sizing.scss +10 -0
- package/assets/styles/utils/_text.scss +14 -0
- package/assets/styles/vendor/_apexcharts.scss +52 -0
- package/assets/styles/vendor/_coloris.scss +72 -0
- package/assets/styles/vendor/_dropzone.scss +27 -0
- package/assets/styles/vendor/_fslightbox.scss +13 -0
- package/assets/styles/vendor/_jsvectormap.scss +47 -0
- package/assets/styles/vendor/_litepicker.scss +69 -0
- package/assets/styles/vendor/_nouislider.scss +49 -0
- package/assets/styles/vendor/_plyr.scss +3 -0
- package/assets/styles/vendor/_stars-rating.scss +22 -0
- package/assets/styles/vendor/_tom-select.scss +81 -0
- package/assets/styles/vendor/_turbo.scss +3 -0
- package/assets/styles/vendor/_typed.scss +4 -0
- package/assets/styles/vendor/_wysiwyg.scss +46 -0
- package/fesm2022/updevs-components-badge.mjs +89 -0
- package/fesm2022/updevs-components-badge.mjs.map +1 -0
- package/fesm2022/updevs-components-button.mjs +193 -0
- package/fesm2022/updevs-components-button.mjs.map +1 -0
- package/fesm2022/updevs-components-calendar.mjs +582 -0
- package/fesm2022/updevs-components-calendar.mjs.map +1 -0
- package/fesm2022/updevs-components-card.mjs +242 -0
- package/fesm2022/updevs-components-card.mjs.map +1 -0
- package/fesm2022/updevs-components-drag-and-drop.mjs +185 -0
- package/fesm2022/updevs-components-drag-and-drop.mjs.map +1 -0
- package/fesm2022/updevs-components-dropdown.mjs +247 -0
- package/fesm2022/updevs-components-dropdown.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-abstractions.mjs +106 -0
- package/fesm2022/updevs-components-form-controls-abstractions.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-checkbox.mjs +99 -0
- package/fesm2022/updevs-components-form-controls-checkbox.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-date-picker.mjs +175 -0
- package/fesm2022/updevs-components-form-controls-date-picker.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-file-upload.mjs +272 -0
- package/fesm2022/updevs-components-form-controls-file-upload.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-input.mjs +281 -0
- package/fesm2022/updevs-components-form-controls-input.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-radio.mjs +98 -0
- package/fesm2022/updevs-components-form-controls-radio.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-select.mjs +600 -0
- package/fesm2022/updevs-components-form-controls-select.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-textarea.mjs +79 -0
- package/fesm2022/updevs-components-form-controls-textarea.mjs.map +1 -0
- package/fesm2022/updevs-components-form-controls-time-picker.mjs +345 -0
- package/fesm2022/updevs-components-form-controls-time-picker.mjs.map +1 -0
- package/fesm2022/updevs-components-form.mjs +562 -0
- package/fesm2022/updevs-components-form.mjs.map +1 -0
- package/fesm2022/updevs-components-layout.mjs +1054 -0
- package/fesm2022/updevs-components-layout.mjs.map +1 -0
- package/fesm2022/updevs-components-link.mjs +79 -0
- package/fesm2022/updevs-components-link.mjs.map +1 -0
- package/fesm2022/updevs-components-list.mjs +215 -0
- package/fesm2022/updevs-components-list.mjs.map +1 -0
- package/fesm2022/updevs-components-modal.mjs +505 -0
- package/fesm2022/updevs-components-modal.mjs.map +1 -0
- package/fesm2022/updevs-components-paginator.mjs +160 -0
- package/fesm2022/updevs-components-paginator.mjs.map +1 -0
- package/fesm2022/updevs-components-popover.mjs +215 -0
- package/fesm2022/updevs-components-popover.mjs.map +1 -0
- package/fesm2022/updevs-components-pricing.mjs +130 -0
- package/fesm2022/updevs-components-pricing.mjs.map +1 -0
- package/fesm2022/updevs-components-table.mjs +2060 -0
- package/fesm2022/updevs-components-table.mjs.map +1 -0
- package/fesm2022/updevs-components.mjs +33 -0
- package/fesm2022/updevs-components.mjs.map +1 -0
- package/package.json +127 -14
- package/types/updevs-components-badge.d.ts +44 -0
- package/types/updevs-components-button.d.ts +75 -0
- package/types/updevs-components-calendar.d.ts +175 -0
- package/types/updevs-components-card.d.ts +92 -0
- package/types/updevs-components-drag-and-drop.d.ts +74 -0
- package/types/updevs-components-dropdown.d.ts +124 -0
- package/types/updevs-components-form-controls-abstractions.d.ts +49 -0
- package/types/updevs-components-form-controls-checkbox.d.ts +33 -0
- package/types/updevs-components-form-controls-date-picker.d.ts +80 -0
- package/types/updevs-components-form-controls-file-upload.d.ts +69 -0
- package/types/updevs-components-form-controls-input.d.ts +95 -0
- package/types/updevs-components-form-controls-radio.d.ts +32 -0
- package/types/updevs-components-form-controls-select.d.ts +200 -0
- package/types/updevs-components-form-controls-textarea.d.ts +31 -0
- package/types/updevs-components-form-controls-time-picker.d.ts +164 -0
- package/types/updevs-components-form.d.ts +356 -0
- package/types/updevs-components-layout.d.ts +490 -0
- package/types/updevs-components-link.d.ts +34 -0
- package/types/updevs-components-list.d.ts +107 -0
- package/types/updevs-components-modal.d.ts +155 -0
- package/types/updevs-components-paginator.d.ts +58 -0
- package/types/updevs-components-popover.d.ts +63 -0
- package/types/updevs-components-pricing.d.ts +91 -0
- package/types/updevs-components-table.d.ts +619 -0
- package/types/updevs-components.d.ts +44 -0
- package/CHANGELOG.md +0 -8
- package/ng-package.json +0 -7
- package/src/lib/components.component.spec.ts +0 -23
- package/src/lib/components.component.ts +0 -14
- package/src/lib/components.module.ts +0 -17
- package/src/lib/components.service.spec.ts +0 -16
- package/src/lib/components.service.ts +0 -9
- package/src/public-api.ts +0 -7
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { viewChild, ElementRef, output, input, computed, signal, inject, Renderer2, NgZone, Injector, effect, afterNextRender, RendererStyleFlags2, HostBinding, Directive, model, ViewEncapsulation, Component, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { DomEventsService, PositioningService, UpdCoreLayoutModule } from '@updevs/sdk/layout';
|
|
4
|
+
import { Tools } from '@updevs/sdk/core';
|
|
5
|
+
import { ColumnSizeHelper } from '@updevs/components';
|
|
6
|
+
import { BaseControl } from '@updevs/components/form-controls/abstractions';
|
|
7
|
+
import { Subject, tap, debounceTime } from 'rxjs';
|
|
8
|
+
import * as i1 from '@angular/common';
|
|
9
|
+
import { CommonModule } from '@angular/common';
|
|
10
|
+
import * as i2 from '@updevs/components/list';
|
|
11
|
+
import { UpdListModule } from '@updevs/components/list';
|
|
12
|
+
import * as i3 from '@updevs/components/form-controls/input';
|
|
13
|
+
import { UpdInputModule } from '@updevs/components/form-controls/input';
|
|
14
|
+
import * as i4 from '@updevs/icons';
|
|
15
|
+
import { UpdIconsModule } from '@updevs/icons';
|
|
16
|
+
import * as i5 from '@updevs/components/button';
|
|
17
|
+
import { UpdButtonModule } from '@updevs/components/button';
|
|
18
|
+
import * as i6 from '@updevs/components/popover';
|
|
19
|
+
import { UpdPopoverModule } from '@updevs/components/popover';
|
|
20
|
+
import { TranslocoModule } from '@jsverse/transloco';
|
|
21
|
+
|
|
22
|
+
class Defaults {
|
|
23
|
+
static { this.dropdownMaxHeight = 300; }
|
|
24
|
+
static { this.typeaheadDebounce = 200; }
|
|
25
|
+
static { this.shouldAutoSearch = true; }
|
|
26
|
+
static { this.shouldCloseOnOutsideClick = true; }
|
|
27
|
+
static { this.layout = 'vertical'; }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var Utils = Tools.Utils;
|
|
31
|
+
class BaseSelectComponent extends BaseControl {
|
|
32
|
+
get wrapperClasses() {
|
|
33
|
+
return this.hostWrapperClasses();
|
|
34
|
+
}
|
|
35
|
+
get isDropdownOpen() {
|
|
36
|
+
return this._isDropdownOpen;
|
|
37
|
+
}
|
|
38
|
+
set isDropdownOpen(value) {
|
|
39
|
+
this._isDropdownOpen = value;
|
|
40
|
+
this.dropdownOpenStatusChange.emit(value);
|
|
41
|
+
if (value) {
|
|
42
|
+
this.dropdownClasses += ' select-dropdown-content-open';
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.dropdownClasses = this.dropdownClasses.replace(' select-dropdown-content-open', '');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get labelSizeClasses() {
|
|
49
|
+
if (this.layout() !== 'horizontal') {
|
|
50
|
+
return 'form-label';
|
|
51
|
+
}
|
|
52
|
+
return ColumnSizeHelper.getClasses('col-form-label', ColumnSizeHelper.getSizeClasses(this.labelColSize(), 3));
|
|
53
|
+
}
|
|
54
|
+
constructor() {
|
|
55
|
+
super();
|
|
56
|
+
this.componentBox = viewChild('componentBox', { ...(ngDevMode ? { debugName: "componentBox" } : {}), read: ElementRef });
|
|
57
|
+
this.searchBox = viewChild('searchBox', { ...(ngDevMode ? { debugName: "searchBox" } : {}), read: ElementRef });
|
|
58
|
+
this.searchBoxChild = viewChild('searchBoxChild', { ...(ngDevMode ? { debugName: "searchBoxChild" } : {}), read: ElementRef });
|
|
59
|
+
this.list = viewChild('list', { ...(ngDevMode ? { debugName: "list" } : {}), read: ElementRef });
|
|
60
|
+
this.dropdownOpenStatusChange = output();
|
|
61
|
+
/**
|
|
62
|
+
* Select items.
|
|
63
|
+
* If provided, the select will be considered static.
|
|
64
|
+
*/
|
|
65
|
+
this.items = input(...(ngDevMode ? [undefined, { debugName: "items" }] : []));
|
|
66
|
+
/**
|
|
67
|
+
* Store used to load/filter the items.
|
|
68
|
+
*/
|
|
69
|
+
this.store = input(...(ngDevMode ? [undefined, { debugName: "store" }] : []));
|
|
70
|
+
/**
|
|
71
|
+
* Observable used to load/filter the items.
|
|
72
|
+
*/
|
|
73
|
+
this.observable = input(...(ngDevMode ? [undefined, { debugName: "observable" }] : []));
|
|
74
|
+
/**
|
|
75
|
+
* Name of the property in the object that represents the ID/key of the option.
|
|
76
|
+
* **Note:** used only for remote data.
|
|
77
|
+
*/
|
|
78
|
+
this.itemKey = input(...(ngDevMode ? [undefined, { debugName: "itemKey" }] : []));
|
|
79
|
+
/**
|
|
80
|
+
* Name of the property in the object that represents the value/description of the option.
|
|
81
|
+
* **Note:** used only for remote data.
|
|
82
|
+
*/
|
|
83
|
+
this.itemValue = input(...(ngDevMode ? [undefined, { debugName: "itemValue" }] : []));
|
|
84
|
+
/**
|
|
85
|
+
* Maximum height of the dropdown.
|
|
86
|
+
*/
|
|
87
|
+
this.dropdownMaxHeight = input(Defaults.dropdownMaxHeight, ...(ngDevMode ? [{ debugName: "dropdownMaxHeight" }] : []));
|
|
88
|
+
this.typeaheadDebounce = input(Defaults.typeaheadDebounce, ...(ngDevMode ? [{ debugName: "typeaheadDebounce" }] : []));
|
|
89
|
+
this.shouldAutoSearch = input(Defaults.shouldAutoSearch, ...(ngDevMode ? [{ debugName: "shouldAutoSearch" }] : []));
|
|
90
|
+
this.shouldCloseOnOutsideClick = input(Defaults.shouldCloseOnOutsideClick, ...(ngDevMode ? [{ debugName: "shouldCloseOnOutsideClick" }] : []));
|
|
91
|
+
this.layout = input(Defaults.layout, ...(ngDevMode ? [{ debugName: "layout" }] : []));
|
|
92
|
+
/**
|
|
93
|
+
* Value coming from a parent field when the rule `AttachmentTypeEnum.ParentLoad` is active.
|
|
94
|
+
* `upd-select` can use it to fetch the dependent list.
|
|
95
|
+
*/
|
|
96
|
+
this.parentValue = input(...(ngDevMode ? [undefined, { debugName: "parentValue" }] : []));
|
|
97
|
+
this.parentSelectedId = input(...(ngDevMode ? [undefined, { debugName: "parentSelectedId" }] : []));
|
|
98
|
+
this.parentDependentLoader = input(...(ngDevMode ? [undefined, { debugName: "parentDependentLoader" }] : []));
|
|
99
|
+
this.getItemById = input(...(ngDevMode ? [undefined, { debugName: "getItemById" }] : []));
|
|
100
|
+
this.layoutClasses = computed(() => this.layout() === 'horizontal' ? ['col', 'align-self-center'] : [], ...(ngDevMode ? [{ debugName: "layoutClasses" }] : []));
|
|
101
|
+
this.isLoading = false;
|
|
102
|
+
this.localItems = signal([], ...(ngDevMode ? [{ debugName: "localItems" }] : []));
|
|
103
|
+
this.listItems = [];
|
|
104
|
+
this.dropdownClasses = 'select-dropdown-content remove-top-radius';
|
|
105
|
+
this._localBackupItems = [];
|
|
106
|
+
this.hasInternalList = false;
|
|
107
|
+
this._isDropdownOpen = false;
|
|
108
|
+
this.hostWrapperClasses = computed(() => this.layout() === 'horizontal' ? 'row' : '', ...(ngDevMode ? [{ debugName: "hostWrapperClasses" }] : []));
|
|
109
|
+
this.searchInputSubject = new Subject();
|
|
110
|
+
this.renderer = inject(Renderer2);
|
|
111
|
+
this.ngZone = inject(NgZone);
|
|
112
|
+
this.domEventsService = inject(DomEventsService);
|
|
113
|
+
this.positioningService = inject(PositioningService);
|
|
114
|
+
this.injector = inject(Injector);
|
|
115
|
+
effect(() => {
|
|
116
|
+
if (!!this.items()) {
|
|
117
|
+
this._setupLocalItems(this.items());
|
|
118
|
+
}
|
|
119
|
+
if (this.parentValue() !== this.previousParentValue) {
|
|
120
|
+
this.previousParentValue = this.parentValue();
|
|
121
|
+
this.clearSelection();
|
|
122
|
+
this.search();
|
|
123
|
+
}
|
|
124
|
+
}, { allowSignalWrites: true });
|
|
125
|
+
}
|
|
126
|
+
ngOnInit() {
|
|
127
|
+
this.hasInternalList = !this.observable() && !this.store() && !this.parentDependentLoader();
|
|
128
|
+
if (this.shouldAutoSearch()) {
|
|
129
|
+
if (this.hasInternalList) {
|
|
130
|
+
this._setupLocalItems(this.items());
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.searchExternal();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (this.hasInternalList) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const typeaheadSubscription = this.searchInputSubject
|
|
140
|
+
.pipe(tap(value => this._currentTerm = value), debounceTime(this.typeaheadDebounce()))
|
|
141
|
+
.subscribe(() => this.searchExternal());
|
|
142
|
+
this.addSubscriptions(typeaheadSubscription);
|
|
143
|
+
}
|
|
144
|
+
openDropdown() {
|
|
145
|
+
if (this.isDisabled()) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.isDropdownOpen = true;
|
|
149
|
+
if (this.shouldCloseOnOutsideClick()) {
|
|
150
|
+
const outsideClickSub = this.domEventsService.startOutsideClickListener(() => this.ngZone.run(() => this.isDropdownOpen = false), this.list()?.nativeElement, true, this.componentBox()?.nativeElement, this.searchBox()?.nativeElement);
|
|
151
|
+
this.addSubscriptions(outsideClickSub);
|
|
152
|
+
}
|
|
153
|
+
afterNextRender(() => {
|
|
154
|
+
this.ngZone.runOutsideAngular(() => this.positioningService
|
|
155
|
+
.computePosition(this.componentBox(), this.list(), { placement: 'bottom' })
|
|
156
|
+
.subscribe(resp => this.updatePosition(resp)));
|
|
157
|
+
}, { injector: this.injector });
|
|
158
|
+
}
|
|
159
|
+
search(term) {
|
|
160
|
+
if (this.hasInternalList) {
|
|
161
|
+
this._currentTerm = term;
|
|
162
|
+
this.searchLocal();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
this.searchInputSubject.next(term || '');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
_setupLocalItems(items) {
|
|
169
|
+
const copiedItems = Utils.deepCopy(items);
|
|
170
|
+
this.localItems.set(copiedItems);
|
|
171
|
+
this._localBackupItems = Utils.deepCopy(items);
|
|
172
|
+
const tempItems = [];
|
|
173
|
+
for (const item of this._localBackupItems) {
|
|
174
|
+
const listItem = this.getListItem(item);
|
|
175
|
+
item.listItem = Object.assign(listItem, {});
|
|
176
|
+
tempItems.push(listItem);
|
|
177
|
+
}
|
|
178
|
+
this.listItems = [...tempItems];
|
|
179
|
+
this.isLoading = false;
|
|
180
|
+
}
|
|
181
|
+
searchLocal() {
|
|
182
|
+
if (!this._currentTerm) {
|
|
183
|
+
this.listItems = Utils.deepCopy(this._localBackupItems.map(li => li.listItem));
|
|
184
|
+
this.localItems.set(Utils.deepCopy(this._localBackupItems));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.ngZone.run(() => this.listItems = Utils
|
|
188
|
+
.deepCopy(this._localBackupItems)
|
|
189
|
+
.filter(si => {
|
|
190
|
+
let hasChildrenInSearch = false;
|
|
191
|
+
if ((si.children?.length || 0) > 0) {
|
|
192
|
+
hasChildrenInSearch = si.children.filter(ci => ci.text.toLowerCase().includes(this._currentTerm.toLowerCase())).length > 0;
|
|
193
|
+
}
|
|
194
|
+
return si.text.toLowerCase().includes(this._currentTerm.toLowerCase()) || hasChildrenInSearch;
|
|
195
|
+
})
|
|
196
|
+
.map(si => {
|
|
197
|
+
const bkpItem = this._localBackupItems.find(lbi => lbi.value === si.value);
|
|
198
|
+
if ((bkpItem?.children?.length || 0) > 0) {
|
|
199
|
+
si.children = [...bkpItem.children].filter(ci => ci.text.toLowerCase().includes(this._currentTerm.toLowerCase()));
|
|
200
|
+
}
|
|
201
|
+
return this.getListItem(si);
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
searchExternal() {
|
|
205
|
+
this.isLoading = true;
|
|
206
|
+
const request = { description: this._currentTerm };
|
|
207
|
+
const parentLoader = this.parentDependentLoader();
|
|
208
|
+
const parentId = this.parentSelectedId() ?? this.parentValue();
|
|
209
|
+
if (!!parentLoader && !!parentId) {
|
|
210
|
+
parentLoader(parentId, this._currentTerm).subscribe({
|
|
211
|
+
next: (items) => this._setupLocalItems(items),
|
|
212
|
+
error: () => this._setupLocalItems([])
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const observable = !!this.observable()
|
|
217
|
+
? this.observable()(request, this.parentValue())
|
|
218
|
+
: this.store().search(request, this.parentValue());
|
|
219
|
+
observable.subscribe(r => {
|
|
220
|
+
const items = [];
|
|
221
|
+
r.records.forEach(item => {
|
|
222
|
+
items.push({
|
|
223
|
+
value: item[this.itemKey()],
|
|
224
|
+
text: item[this.itemValue()],
|
|
225
|
+
objectData: item
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
this._setupLocalItems(items);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
getListItem(item) {
|
|
232
|
+
let listItem;
|
|
233
|
+
if (!!item.listItem) {
|
|
234
|
+
listItem = item.listItem;
|
|
235
|
+
listItem.id = item.value;
|
|
236
|
+
listItem.text = item.text;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
listItem = {
|
|
240
|
+
id: item.value,
|
|
241
|
+
text: item.text
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
if ((item.children?.length || 0) > 0) {
|
|
245
|
+
listItem.children = [...item.children].map(c => this.getListItem(c));
|
|
246
|
+
}
|
|
247
|
+
return listItem;
|
|
248
|
+
}
|
|
249
|
+
updatePosition(result) {
|
|
250
|
+
const componentBox = this.componentBox().nativeElement.getBoundingClientRect();
|
|
251
|
+
const searchBoxChildElement = this.searchBoxChild()?.nativeElement;
|
|
252
|
+
const ddElement = this.list().nativeElement;
|
|
253
|
+
this.renderer.setStyle(searchBoxChildElement, 'width', `${Math.abs(componentBox.width)}px`, RendererStyleFlags2.Important);
|
|
254
|
+
this.renderer.setStyle(ddElement, 'top', `${result.y + searchBoxChildElement.scrollHeight}px`, RendererStyleFlags2.Important);
|
|
255
|
+
this.renderer.setStyle(ddElement, 'left', 0, RendererStyleFlags2.Important);
|
|
256
|
+
this.renderer.setStyle(ddElement, 'width', `${Math.abs(componentBox.width)}px`, RendererStyleFlags2.Important);
|
|
257
|
+
}
|
|
258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: BaseSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
259
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.1.4", type: BaseSelectComponent, isStandalone: false, inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, store: { classPropertyName: "store", publicName: "store", isSignal: true, isRequired: false, transformFunction: null }, observable: { classPropertyName: "observable", publicName: "observable", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: false, transformFunction: null }, itemValue: { classPropertyName: "itemValue", publicName: "itemValue", isSignal: true, isRequired: false, transformFunction: null }, dropdownMaxHeight: { classPropertyName: "dropdownMaxHeight", publicName: "dropdownMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, typeaheadDebounce: { classPropertyName: "typeaheadDebounce", publicName: "typeaheadDebounce", isSignal: true, isRequired: false, transformFunction: null }, shouldAutoSearch: { classPropertyName: "shouldAutoSearch", publicName: "shouldAutoSearch", isSignal: true, isRequired: false, transformFunction: null }, shouldCloseOnOutsideClick: { classPropertyName: "shouldCloseOnOutsideClick", publicName: "shouldCloseOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, parentValue: { classPropertyName: "parentValue", publicName: "parentValue", isSignal: true, isRequired: false, transformFunction: null }, parentSelectedId: { classPropertyName: "parentSelectedId", publicName: "parentSelectedId", isSignal: true, isRequired: false, transformFunction: null }, parentDependentLoader: { classPropertyName: "parentDependentLoader", publicName: "parentDependentLoader", isSignal: true, isRequired: false, transformFunction: null }, getItemById: { classPropertyName: "getItemById", publicName: "getItemById", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropdownOpenStatusChange: "dropdownOpenStatusChange" }, host: { properties: { "class": "this.wrapperClasses" } }, viewQueries: [{ propertyName: "componentBox", first: true, predicate: ["componentBox"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "searchBox", first: true, predicate: ["searchBox"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "searchBoxChild", first: true, predicate: ["searchBoxChild"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
|
|
260
|
+
}
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: BaseSelectComponent, decorators: [{
|
|
262
|
+
type: Directive,
|
|
263
|
+
args: [{ standalone: false }]
|
|
264
|
+
}], ctorParameters: () => [], propDecorators: { wrapperClasses: [{
|
|
265
|
+
type: HostBinding,
|
|
266
|
+
args: ['class']
|
|
267
|
+
}], componentBox: [{ type: i0.ViewChild, args: ['componentBox', { ...{ read: ElementRef }, isSignal: true }] }], searchBox: [{ type: i0.ViewChild, args: ['searchBox', { ...{ read: ElementRef }, isSignal: true }] }], searchBoxChild: [{ type: i0.ViewChild, args: ['searchBoxChild', { ...{ read: ElementRef }, isSignal: true }] }], list: [{ type: i0.ViewChild, args: ['list', { ...{ read: ElementRef }, isSignal: true }] }], dropdownOpenStatusChange: [{ type: i0.Output, args: ["dropdownOpenStatusChange"] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], store: [{ type: i0.Input, args: [{ isSignal: true, alias: "store", required: false }] }], observable: [{ type: i0.Input, args: [{ isSignal: true, alias: "observable", required: false }] }], itemKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemKey", required: false }] }], itemValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemValue", required: false }] }], dropdownMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownMaxHeight", required: false }] }], typeaheadDebounce: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeaheadDebounce", required: false }] }], shouldAutoSearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "shouldAutoSearch", required: false }] }], shouldCloseOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "shouldCloseOnOutsideClick", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], parentValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentValue", required: false }] }], parentSelectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentSelectedId", required: false }] }], parentDependentLoader: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentDependentLoader", required: false }] }], getItemById: [{ type: i0.Input, args: [{ isSignal: true, alias: "getItemById", required: false }] }] } });
|
|
268
|
+
|
|
269
|
+
class SelectComponent extends BaseSelectComponent {
|
|
270
|
+
get canTruncateText() {
|
|
271
|
+
return this.shouldTruncateSelectedText() === true || this.shouldTruncateSelectedText() === undefined;
|
|
272
|
+
}
|
|
273
|
+
constructor() {
|
|
274
|
+
super();
|
|
275
|
+
/**
|
|
276
|
+
* If true, it'll use the default style of the OS, no search capabilities.
|
|
277
|
+
*/
|
|
278
|
+
this.useSystemStyle = input(false, ...(ngDevMode ? [{ debugName: "useSystemStyle" }] : []));
|
|
279
|
+
this.shouldShowClearButton = input(true, ...(ngDevMode ? [{ debugName: "shouldShowClearButton" }] : []));
|
|
280
|
+
this.shouldTruncateSelectedText = input(true, ...(ngDevMode ? [{ debugName: "shouldTruncateSelectedText" }] : []));
|
|
281
|
+
this.isCompact = input(false, ...(ngDevMode ? [{ debugName: "isCompact" }] : []));
|
|
282
|
+
this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
283
|
+
this.shouldShowHintWithoutLabel = computed(() => !this.labelText && (!!this.hintText || !!this.hintTemplate()), ...(ngDevMode ? [{ debugName: "shouldShowHintWithoutLabel" }] : []));
|
|
284
|
+
/**
|
|
285
|
+
* Triggered when an item is selected.
|
|
286
|
+
*/
|
|
287
|
+
this.selectedItem = output();
|
|
288
|
+
this.isFetchingMissingItem = false;
|
|
289
|
+
// This effect is the single source of truth for syncing the value with the selection.
|
|
290
|
+
effect(() => {
|
|
291
|
+
const val = this.value();
|
|
292
|
+
const items = this.localItems();
|
|
293
|
+
const getItemFn = this.getItemById();
|
|
294
|
+
// eslint-disable-next-line no-null/no-null
|
|
295
|
+
if (val === undefined || val === null) {
|
|
296
|
+
this.currentSelection = undefined;
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
// eslint-disable-next-line eqeqeq
|
|
300
|
+
let item = items.find(i => i.value == val);
|
|
301
|
+
if (!item) {
|
|
302
|
+
for (const i of items) {
|
|
303
|
+
if ((i.children?.length || 0) > 0) {
|
|
304
|
+
// eslint-disable-next-line eqeqeq
|
|
305
|
+
item = i.children?.find(c => c.value == val);
|
|
306
|
+
if (!!item) {
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (!!item) {
|
|
313
|
+
this.currentSelection = item;
|
|
314
|
+
this.isFetchingMissingItem = false;
|
|
315
|
+
}
|
|
316
|
+
else if (!!getItemFn) {
|
|
317
|
+
this.fetchMissingItem(val, getItemFn);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.currentSelection = undefined;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
effect(() => {
|
|
324
|
+
const parentId = this.parentSelectedId();
|
|
325
|
+
const loader = this.parentDependentLoader();
|
|
326
|
+
const val = this.value();
|
|
327
|
+
// eslint-disable-next-line eqeqeq
|
|
328
|
+
const hasCurrent = val !== undefined && this.localItems().some(i => i.value == val);
|
|
329
|
+
if (!!parentId && !!loader && !hasCurrent && !this.isFetchingMissingItem) {
|
|
330
|
+
this.loadDependentData(parentId, loader);
|
|
331
|
+
}
|
|
332
|
+
else if (!parentId && !!loader) {
|
|
333
|
+
this.clearData();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
onSelectItem(item) {
|
|
338
|
+
this._currentTerm = item.text;
|
|
339
|
+
this.isDropdownOpen = false;
|
|
340
|
+
let selectedItem;
|
|
341
|
+
for (const localBackupItem of this._localBackupItems) {
|
|
342
|
+
if ((localBackupItem.children?.length || 0) > 0) {
|
|
343
|
+
// eslint-disable-next-line eqeqeq
|
|
344
|
+
selectedItem = localBackupItem.children?.find(c => c.value == item.id);
|
|
345
|
+
if (!!selectedItem) {
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
// eslint-disable-next-line eqeqeq
|
|
349
|
+
}
|
|
350
|
+
else if (localBackupItem.value == item.id) {
|
|
351
|
+
selectedItem = localBackupItem;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
this.value.set(selectedItem?.value);
|
|
356
|
+
this.selectedItem.emit(selectedItem);
|
|
357
|
+
this._updateFormControl(selectedItem?.value, true);
|
|
358
|
+
}
|
|
359
|
+
search(term) {
|
|
360
|
+
const parentId = this.parentSelectedId();
|
|
361
|
+
const loader = this.parentDependentLoader();
|
|
362
|
+
if (!!parentId && !!loader) {
|
|
363
|
+
this.loadDependentData(parentId, loader, term);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
super.search(term);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
clearSelection(isInternalCall = false) {
|
|
370
|
+
if (this.isDisabled() && !isInternalCall) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this._currentTerm = undefined;
|
|
374
|
+
this.value.set(undefined);
|
|
375
|
+
this.selectedItem.emit(undefined);
|
|
376
|
+
this._updateFormControl(undefined, true);
|
|
377
|
+
}
|
|
378
|
+
onSystemSelect(event) {
|
|
379
|
+
// eslint-disable-next-line eqeqeq
|
|
380
|
+
const selectedItem = this.localItems().find(c => c.value == event.target.value);
|
|
381
|
+
this.value.set(selectedItem?.value);
|
|
382
|
+
this.selectedItem.emit(selectedItem);
|
|
383
|
+
this._updateFormControl(selectedItem?.value, true);
|
|
384
|
+
}
|
|
385
|
+
_getValue() {
|
|
386
|
+
return this.value();
|
|
387
|
+
}
|
|
388
|
+
_updateValue(value) {
|
|
389
|
+
this.value.set(value);
|
|
390
|
+
}
|
|
391
|
+
loadDependentData(parentId, loader, term) {
|
|
392
|
+
loader(parentId, term).subscribe({
|
|
393
|
+
next: (items) => {
|
|
394
|
+
this._setupLocalItems(items);
|
|
395
|
+
const val = this.value();
|
|
396
|
+
// eslint-disable-next-line eqeqeq
|
|
397
|
+
if (val !== undefined && !items.some(i => i.value == val) && !this.getItemById()) {
|
|
398
|
+
this.clearSelection(true);
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
error: () => {
|
|
402
|
+
this._setupLocalItems([]);
|
|
403
|
+
this.clearSelection(true);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
clearData() {
|
|
408
|
+
this._setupLocalItems([]);
|
|
409
|
+
this.clearSelection(true);
|
|
410
|
+
}
|
|
411
|
+
fetchMissingItem(id, getItemFn) {
|
|
412
|
+
this.isFetchingMissingItem = true;
|
|
413
|
+
getItemFn(id).subscribe({
|
|
414
|
+
next: (item) => {
|
|
415
|
+
if (!!item) {
|
|
416
|
+
// eslint-disable-next-line eqeqeq
|
|
417
|
+
if (this.value() == id) {
|
|
418
|
+
this.currentSelection = item;
|
|
419
|
+
}
|
|
420
|
+
const currentItems = this.localItems();
|
|
421
|
+
// eslint-disable-next-line eqeqeq
|
|
422
|
+
if (!currentItems.find(i => i.value == item.value)) {
|
|
423
|
+
this._setupLocalItems([...currentItems, item]);
|
|
424
|
+
}
|
|
425
|
+
// eslint-disable-next-line eqeqeq
|
|
426
|
+
}
|
|
427
|
+
else if (this.value() == id) {
|
|
428
|
+
this.currentSelection = undefined;
|
|
429
|
+
}
|
|
430
|
+
this.isFetchingMissingItem = false;
|
|
431
|
+
this.selectedItem.emit(this.currentSelection);
|
|
432
|
+
},
|
|
433
|
+
error: () => {
|
|
434
|
+
// eslint-disable-next-line eqeqeq
|
|
435
|
+
if (this.value() == id) {
|
|
436
|
+
this.currentSelection = undefined;
|
|
437
|
+
}
|
|
438
|
+
this.isFetchingMissingItem = false;
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
443
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: SelectComponent, isStandalone: false, selector: "upd-select", inputs: { useSystemStyle: { classPropertyName: "useSystemStyle", publicName: "useSystemStyle", isSignal: true, isRequired: false, transformFunction: null }, shouldShowClearButton: { classPropertyName: "shouldShowClearButton", publicName: "shouldShowClearButton", isSignal: true, isRequired: false, transformFunction: null }, shouldTruncateSelectedText: { classPropertyName: "shouldTruncateSelectedText", publicName: "shouldTruncateSelectedText", isSignal: true, isRequired: false, transformFunction: null }, isCompact: { classPropertyName: "isCompact", publicName: "isCompact", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", selectedItem: "selectedItem" }, usesInheritance: true, ngImport: i0, template: "@if (!!labelText) {\n @if (!!hintText || !!hintTemplate()) {\n <div class=\"row g-2\">\n <div class=\"col-auto\">\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n </div>\n <div class=\"col-auto\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n }\n}\n\n@if (!useSystemStyle()) {\n <div class=\"dropdown\" [attr.id]=\"name()\" [ngClass]=\"layoutClasses()\">\n @if (shouldShowHintWithoutLabel()) {\n <div class=\"row g-2\">\n <div class=\"col\">\n <ng-template [ngTemplateOutlet]=\"contentTpl\"></ng-template>\n </div>\n <div class=\"col-auto align-self-center\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <ng-template [ngTemplateOutlet]=\"contentTpl\"></ng-template>\n }\n\n <div #searchBox>\n <div #searchBoxChild [style.visibility]=\"isDropdownOpen ? 'visible' : 'hidden'\" class=\"select-search-box\">\n <upd-input [placeholder]=\"placeholder()\" [isInputGroupFlat]=\"true\" (valueChange)=\"search($event)\">\n <ng-template updInputPrepend>\n <upd-icon tablerIcon=\"search\"></upd-icon>\n </ng-template>\n </upd-input>\n </div>\n </div>\n <upd-list #list [items]=\"listItems\" [maxHeight]=\"dropdownMaxHeight() + 'px'\" (selectedItem)=\"onSelectItem($event)\"\n [wrapperClasses]=\"dropdownClasses\" [isVisible]=\"isDropdownOpen\" [shouldOverflow]=\"true\" [shouldDisplayItemsCounter]=\"true\">\n </upd-list>\n </div>\n} @else {\n @if (shouldShowHintWithoutLabel()) {\n <div class=\"row g-2\">\n <div class=\"col\">\n <ng-template [ngTemplateOutlet]=\"contentDefaultStyleTpl\"></ng-template>\n </div>\n <div class=\"col-auto align-self-center\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <ng-template [ngTemplateOutlet]=\"contentDefaultStyleTpl\"></ng-template>\n }\n}\n\n<ng-template #hintTpl>\n <span class=\"form-help\" [updPopover]=\"hintText\" [updPopoverTemplate]=\"hintTemplate()\" [updPopoverActAsTooltip]=\"hintAsTooltip()\">\n ?\n </span>\n</ng-template>\n\n<ng-template #contentTpl>\n <div #componentBox class=\"input-group input-group-flat\">\n <div class=\"form-control\" [class.remove-bottom-radius]=\"isDropdownOpen\" [class.disabled]=\"isDisabled()\"\n [class.pe-none]=\"isDisabled()\" [class.select-cursor-default]=\"!isDisabled()\"\n [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\" (click)=\"openDropdown()\">\n @if (!!currentSelection) {\n <span [ngClass]=\"canTruncateText ? 'd-block text-truncate' : ''\">{{ currentSelection.text }}</span>\n }\n </div>\n <div class=\"input-group-text\" [class.remove-bottom-radius]=\"isDropdownOpen\">\n @if (!!currentSelection && shouldShowClearButton()) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"clearSelection()\"\n customClasses=\"link-secondary\" [class.select-cursor-pointer]=\"!isDisabled()\"\n [iconModel]=\"{tablerIcon:'x', tablerIconSize: 16}\">\n </upd-button>\n }\n @if (!isLoading) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"openDropdown()\"\n customClasses=\"link-secondary ms-2\" [class.select-cursor-pointer]=\"!isDisabled()\"\n [iconModel]=\"{tablerIcon:'chevron-down', tablerIconSize: 16}\">\n </upd-button>\n } @else {\n <div class=\"select-loader-wrapper\">\n <div class=\"spinner-border spinner-border-sm text-muted select-loader\" role=\"status\"></div>\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #contentDefaultStyleTpl>\n <select class=\"form-select\" [class.compact]=\"isCompact()\" [attr.placeholder]=\"placeholder()\" [attr.name]=\"name()\"\n [class.select-cursor-pointer]=\"!isDisabled()\" [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\"\n [class.disabled]=\"isDisabled()\" (change)=\"onSystemSelect($event)\">\n @for (item of localItems(); track item) {\n @if ((item.children?.length || 0) > 0) {\n <optgroup [label]=\"item.text\">\n @for (child of item.children; track child) {\n <option [attr.selected]=\"!!currentSelection && child.value === currentSelection.value ? true : undefined\"\n [value]=\"child.value\">\n {{ child.text }}\n </option>\n }\n </optgroup>\n } @else {\n <option [attr.selected]=\"!!currentSelection && item.value === currentSelection.value ? true : undefined\"\n [value]=\"item.value\">\n {{ item.text }}\n </option>\n }\n }\n </select>\n</ng-template>\n", styles: [".select-dropdown-content{position:absolute!important;background-color:var(--upd-card-bg);z-index:1;border:var(--upd-card-border-width) solid var(--upd-card-border-color)!important;border-radius:var(--upd-card-border-radius)!important;box-shadow:0 1px 1px #0000002e}.select-dropdown-content-open{display:block!important}.select-loader-wrapper{height:16px}.select-loader-wrapper .select-loader{height:16px;width:16px}.select-search-box{position:absolute;z-index:1;padding:.5rem;margin-top:-1px;background:var(--upd-body-bg);border:var(--upd-border-width) var(--upd-border-style) var(--upd-border-color)}.remove-bottom-radius{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.remove-top-radius{border-top-left-radius:0!important;border-top-right-radius:0!important}.compact{padding:.25rem 2rem .25rem .75rem!important}.select-cursor-default{cursor:default}.select-cursor-pointer{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.ListComponent, selector: "upd-list", inputs: ["items", "shouldOverflow", "isFlush", "isVisible", "isHoverable", "shouldDisplayItemsCounter", "wrapperClasses", "maxHeight"], outputs: ["checkboxChanged", "selectedItem"] }, { kind: "component", type: i3.InputComponent, selector: "upd-input", inputs: ["type", "mask", "maskConfig", "value", "size", "customClasses", "wrapperClasses", "maxLength", "isPlainText", "isReadOnly", "isLoading", "isRound", "isFlush", "isInputGroupFlat", "isPrependButton", "isAppendButton", "isFloating", "loaderPosition", "prependIconModel", "appendIconModel", "isValidationStatusLight", "layout"], outputs: ["valueChange", "blurred", "keyDown", "keyDownEsc", "keyUpEnter"] }, { kind: "directive", type: i3.InputPrependDirective, selector: "ng-template[updInputPrepend]" }, { kind: "component", type: i4.IconComponent, selector: "upd-icon", inputs: ["model", "wrapperClasses", "color", "colorClass", "removeDefaultClasses", "customClasses", "tablerIcon", "tablerIconWeight", "tablerIconType", "tablerIconSize", "heroIcon", "heroIconSize", "heroIconType"] }, { kind: "component", type: i5.ButtonComponent, selector: "upd-button", inputs: ["model", "text", "brandColorStyle", "customClasses", "isOutline", "isGhost", "isSquare", "isPill", "isIcon", "isLoading", "isList", "isFloating", "isAction", "isNavigationLink", "isLink", "shouldIgnoreBtnClass", "iconModel", "iconPosition", "isDisabled", "isActive", "badgeConfig", "colorStyle", "size", "title", "stopPropagation"], outputs: ["clicked"] }, { kind: "directive", type: i6.PopoverDirective, selector: "[updPopover]", inputs: ["updPopover", "updPopoverTitle", "updPopoverTitleTemplate", "updPopoverTemplate", "updPopoverPlacement", "updPopoverCustomClasses", "updPopoverActAsTooltip"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
444
|
+
}
|
|
445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SelectComponent, decorators: [{
|
|
446
|
+
type: Component,
|
|
447
|
+
args: [{ standalone: false, selector: 'upd-select', encapsulation: ViewEncapsulation.None, template: "@if (!!labelText) {\n @if (!!hintText || !!hintTemplate()) {\n <div class=\"row g-2\">\n <div class=\"col-auto\">\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n </div>\n <div class=\"col-auto\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n }\n}\n\n@if (!useSystemStyle()) {\n <div class=\"dropdown\" [attr.id]=\"name()\" [ngClass]=\"layoutClasses()\">\n @if (shouldShowHintWithoutLabel()) {\n <div class=\"row g-2\">\n <div class=\"col\">\n <ng-template [ngTemplateOutlet]=\"contentTpl\"></ng-template>\n </div>\n <div class=\"col-auto align-self-center\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <ng-template [ngTemplateOutlet]=\"contentTpl\"></ng-template>\n }\n\n <div #searchBox>\n <div #searchBoxChild [style.visibility]=\"isDropdownOpen ? 'visible' : 'hidden'\" class=\"select-search-box\">\n <upd-input [placeholder]=\"placeholder()\" [isInputGroupFlat]=\"true\" (valueChange)=\"search($event)\">\n <ng-template updInputPrepend>\n <upd-icon tablerIcon=\"search\"></upd-icon>\n </ng-template>\n </upd-input>\n </div>\n </div>\n <upd-list #list [items]=\"listItems\" [maxHeight]=\"dropdownMaxHeight() + 'px'\" (selectedItem)=\"onSelectItem($event)\"\n [wrapperClasses]=\"dropdownClasses\" [isVisible]=\"isDropdownOpen\" [shouldOverflow]=\"true\" [shouldDisplayItemsCounter]=\"true\">\n </upd-list>\n </div>\n} @else {\n @if (shouldShowHintWithoutLabel()) {\n <div class=\"row g-2\">\n <div class=\"col\">\n <ng-template [ngTemplateOutlet]=\"contentDefaultStyleTpl\"></ng-template>\n </div>\n <div class=\"col-auto align-self-center\">\n <ng-template [ngTemplateOutlet]=\"hintTpl\"></ng-template>\n </div>\n </div>\n } @else {\n <ng-template [ngTemplateOutlet]=\"contentDefaultStyleTpl\"></ng-template>\n }\n}\n\n<ng-template #hintTpl>\n <span class=\"form-help\" [updPopover]=\"hintText\" [updPopoverTemplate]=\"hintTemplate()\" [updPopoverActAsTooltip]=\"hintAsTooltip()\">\n ?\n </span>\n</ng-template>\n\n<ng-template #contentTpl>\n <div #componentBox class=\"input-group input-group-flat\">\n <div class=\"form-control\" [class.remove-bottom-radius]=\"isDropdownOpen\" [class.disabled]=\"isDisabled()\"\n [class.pe-none]=\"isDisabled()\" [class.select-cursor-default]=\"!isDisabled()\"\n [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\" (click)=\"openDropdown()\">\n @if (!!currentSelection) {\n <span [ngClass]=\"canTruncateText ? 'd-block text-truncate' : ''\">{{ currentSelection.text }}</span>\n }\n </div>\n <div class=\"input-group-text\" [class.remove-bottom-radius]=\"isDropdownOpen\">\n @if (!!currentSelection && shouldShowClearButton()) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"clearSelection()\"\n customClasses=\"link-secondary\" [class.select-cursor-pointer]=\"!isDisabled()\"\n [iconModel]=\"{tablerIcon:'x', tablerIconSize: 16}\">\n </upd-button>\n }\n @if (!isLoading) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"openDropdown()\"\n customClasses=\"link-secondary ms-2\" [class.select-cursor-pointer]=\"!isDisabled()\"\n [iconModel]=\"{tablerIcon:'chevron-down', tablerIconSize: 16}\">\n </upd-button>\n } @else {\n <div class=\"select-loader-wrapper\">\n <div class=\"spinner-border spinner-border-sm text-muted select-loader\" role=\"status\"></div>\n </div>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #contentDefaultStyleTpl>\n <select class=\"form-select\" [class.compact]=\"isCompact()\" [attr.placeholder]=\"placeholder()\" [attr.name]=\"name()\"\n [class.select-cursor-pointer]=\"!isDisabled()\" [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\"\n [class.disabled]=\"isDisabled()\" (change)=\"onSystemSelect($event)\">\n @for (item of localItems(); track item) {\n @if ((item.children?.length || 0) > 0) {\n <optgroup [label]=\"item.text\">\n @for (child of item.children; track child) {\n <option [attr.selected]=\"!!currentSelection && child.value === currentSelection.value ? true : undefined\"\n [value]=\"child.value\">\n {{ child.text }}\n </option>\n }\n </optgroup>\n } @else {\n <option [attr.selected]=\"!!currentSelection && item.value === currentSelection.value ? true : undefined\"\n [value]=\"item.value\">\n {{ item.text }}\n </option>\n }\n }\n </select>\n</ng-template>\n", styles: [".select-dropdown-content{position:absolute!important;background-color:var(--upd-card-bg);z-index:1;border:var(--upd-card-border-width) solid var(--upd-card-border-color)!important;border-radius:var(--upd-card-border-radius)!important;box-shadow:0 1px 1px #0000002e}.select-dropdown-content-open{display:block!important}.select-loader-wrapper{height:16px}.select-loader-wrapper .select-loader{height:16px;width:16px}.select-search-box{position:absolute;z-index:1;padding:.5rem;margin-top:-1px;background:var(--upd-body-bg);border:var(--upd-border-width) var(--upd-border-style) var(--upd-border-color)}.remove-bottom-radius{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.remove-top-radius{border-top-left-radius:0!important;border-top-right-radius:0!important}.compact{padding:.25rem 2rem .25rem .75rem!important}.select-cursor-default{cursor:default}.select-cursor-pointer{cursor:pointer}\n"] }]
|
|
448
|
+
}], ctorParameters: () => [], propDecorators: { useSystemStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "useSystemStyle", required: false }] }], shouldShowClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "shouldShowClearButton", required: false }] }], shouldTruncateSelectedText: [{ type: i0.Input, args: [{ isSignal: true, alias: "shouldTruncateSelectedText", required: false }] }], isCompact: [{ type: i0.Input, args: [{ isSignal: true, alias: "isCompact", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], selectedItem: [{ type: i0.Output, args: ["selectedItem"] }] } });
|
|
449
|
+
|
|
450
|
+
class SelectMultipleComponent extends BaseSelectComponent {
|
|
451
|
+
constructor() {
|
|
452
|
+
super();
|
|
453
|
+
/**
|
|
454
|
+
* Returns the selected items.
|
|
455
|
+
* Triggered when items are selected.
|
|
456
|
+
*/
|
|
457
|
+
this.selectedItems = new EventEmitter();
|
|
458
|
+
/**
|
|
459
|
+
* Returns the selected Ids.
|
|
460
|
+
* Triggered when items are selected.
|
|
461
|
+
*/
|
|
462
|
+
this.selectedIds = new EventEmitter();
|
|
463
|
+
/**
|
|
464
|
+
* An array of primitive values to set the selection programmatically.
|
|
465
|
+
*/
|
|
466
|
+
this.selectedValues = input(...(ngDevMode ? [undefined, { debugName: "selectedValues" }] : []));
|
|
467
|
+
this.currentSelection = [];
|
|
468
|
+
effect(() => {
|
|
469
|
+
const values = this.selectedValues();
|
|
470
|
+
if (!!values && values.length > 0) {
|
|
471
|
+
this.currentSelection = this._localBackupItems.filter(item => values.includes(item.value));
|
|
472
|
+
this.updateActiveItemsOnList();
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
clearSelection() {
|
|
477
|
+
this.currentSelection = [];
|
|
478
|
+
this._currentTerm = undefined;
|
|
479
|
+
this.updateActiveItemsOnList();
|
|
480
|
+
this._updateFormControl([], true);
|
|
481
|
+
}
|
|
482
|
+
onSelectItem(item) {
|
|
483
|
+
// eslint-disable-next-line eqeqeq
|
|
484
|
+
const selectedItem = this.currentSelection.find(cs => cs.value == item.id);
|
|
485
|
+
if (!!selectedItem) {
|
|
486
|
+
this.onRemoveItem(selectedItem);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
for (const localBackupItem of this._localBackupItems) {
|
|
490
|
+
if ((localBackupItem.children?.length || 0) > 0) {
|
|
491
|
+
// eslint-disable-next-line eqeqeq
|
|
492
|
+
const child = localBackupItem.children?.find(c => c.value == item.id);
|
|
493
|
+
if (!!child) {
|
|
494
|
+
this.currentSelection.push(child);
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
// eslint-disable-next-line eqeqeq
|
|
498
|
+
}
|
|
499
|
+
else if (localBackupItem.value == item.id) {
|
|
500
|
+
this.currentSelection.push(localBackupItem);
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
this.updateActiveItemsOnList();
|
|
505
|
+
const currentSelectedIds = this.currentSelection.map(cs => cs.value);
|
|
506
|
+
this.selectedItems.emit(this.currentSelection);
|
|
507
|
+
this.selectedIds.emit(currentSelectedIds);
|
|
508
|
+
this._updateFormControl(currentSelectedIds, true);
|
|
509
|
+
}
|
|
510
|
+
onRemoveItem(item) {
|
|
511
|
+
// eslint-disable-next-line eqeqeq
|
|
512
|
+
const idx = this.currentSelection.findIndex(cs => cs.value == item.value);
|
|
513
|
+
this.currentSelection.splice(idx, 1);
|
|
514
|
+
this.updateActiveItemsOnList();
|
|
515
|
+
this._updateFormControl(this.currentSelection.map(cs => cs.value), true);
|
|
516
|
+
}
|
|
517
|
+
_getValue() {
|
|
518
|
+
return this.currentSelection.map(item => item.value);
|
|
519
|
+
}
|
|
520
|
+
_updateValue(value) {
|
|
521
|
+
if (!Array.isArray(value)) {
|
|
522
|
+
this.currentSelection = [];
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
this.currentSelection = this._localBackupItems.filter(item => value.includes(item.value));
|
|
526
|
+
this.updateActiveItemsOnList();
|
|
527
|
+
}
|
|
528
|
+
updateActiveItemsOnList() {
|
|
529
|
+
for (const backupItem of this._localBackupItems) {
|
|
530
|
+
// eslint-disable-next-line eqeqeq
|
|
531
|
+
const selectedItem = this.currentSelection.find(cs => cs.value == backupItem.value);
|
|
532
|
+
if (!!backupItem.listItem) {
|
|
533
|
+
backupItem.listItem.isActive = !!selectedItem;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
this._setupLocalItems(this._localBackupItems);
|
|
537
|
+
}
|
|
538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SelectMultipleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
539
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: SelectMultipleComponent, isStandalone: false, selector: "upd-select-multiple", inputs: { selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedItems: "selectedItems", selectedIds: "selectedIds" }, usesInheritance: true, ngImport: i0, template: "@if (!!labelText) {\n @if (!!hintText || !!hintTemplate()) {\n <div class=\"row g-2\">\n <div class=\"col-auto\">\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n </div>\n <div class=\"col-auto\">\n <span class=\"form-help\" [updPopover]=\"hintText\" [updPopoverTemplate]=\"hintTemplate()\"\n [updPopoverActAsTooltip]=\"hintAsTooltip()\">\n ?\n </span>\n </div>\n </div>\n } @else {\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n }\n}\n\n<div class=\"dropdown\" [attr.id]=\"name()\">\n <div #componentBox class=\"input-group input-group-flat\">\n <div class=\"form-control\" [class.remove-bottom-radius]=\"isDropdownOpen\" [class.disabled]=\"isDisabled()\"\n [class.pe-none]=\"isDisabled()\" [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\" (click)=\"openDropdown()\">\n @for (sel of currentSelection; track sel) {\n <span class=\"badge bg-primary select-multiple-value\">{{ sel.text }}\n <upd-button [isIcon]=\"true\" [shouldIgnoreBtnClass]=\"true\" (clicked)=\"onRemoveItem(sel)\">\n <upd-icon tablerIcon=\"x\"></upd-icon>\n </upd-button></span> \n }\n </div>\n <div class=\"input-group-text\" [class.remove-bottom-radius]=\"isDropdownOpen\">\n @if (currentSelection.length > 0) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"clearSelection()\"\n customClasses=\"link-secondary\">\n <upd-icon tablerIcon=\"x\"></upd-icon>\n </upd-button>\n }\n @if (!isLoading) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"openDropdown()\"\n customClasses=\"link-secondary ms-2\">\n <upd-icon tablerIcon=\"chevron-down\"></upd-icon>\n </upd-button>\n } @else {\n <div class=\"select-loader-wrapper\">\n <div class=\"spinner-border spinner-border-sm text-muted select-loader\" role=\"status\"></div>\n </div>\n }\n </div>\n </div>\n <div #searchBox>\n <div #searchBoxChild [style.visibility]=\"isDropdownOpen ? 'visible' : 'hidden'\" class=\"select-search-box\">\n <upd-input [placeholder]=\"placeholder()\" [isInputGroupFlat]=\"true\" (valueChange)=\"search($event)\">\n <ng-template updInputPrepend>\n <upd-icon tablerIcon=\"search\"></upd-icon>\n </ng-template>\n </upd-input>\n </div>\n </div>\n <upd-list #list [items]=\"listItems\" [maxHeight]=\"dropdownMaxHeight() + 'px'\" (selectedItem)=\"onSelectItem($event)\"\n [wrapperClasses]=\"dropdownClasses\" [isVisible]=\"isDropdownOpen\" [shouldOverflow]=\"true\" [shouldDisplayItemsCounter]=\"true\">\n </upd-list>\n</div>\n", styles: [".select-dropdown-content{position:absolute!important;background-color:var(--upd-card-bg);z-index:1;border:var(--upd-card-border-width) solid var(--upd-card-border-color)!important;border-radius:var(--upd-card-border-radius)!important;box-shadow:0 1px 1px #0000002e}.select-dropdown-content-open{display:block!important}.select-loader-wrapper{height:16px}.select-loader-wrapper .select-loader{height:16px;width:16px}.select-search-box{position:absolute;z-index:1;padding:.5rem;margin-top:-1px;background:var(--upd-body-bg);border:var(--upd-border-width) var(--upd-border-style) var(--upd-border-color)}.remove-bottom-radius{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.remove-top-radius{border-top-left-radius:0!important;border-top-right-radius:0!important}.compact{padding:.25rem 2rem .25rem .75rem!important}.select-multiple-value{display:inline-flex;align-items:center}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2.ListComponent, selector: "upd-list", inputs: ["items", "shouldOverflow", "isFlush", "isVisible", "isHoverable", "shouldDisplayItemsCounter", "wrapperClasses", "maxHeight"], outputs: ["checkboxChanged", "selectedItem"] }, { kind: "component", type: i3.InputComponent, selector: "upd-input", inputs: ["type", "mask", "maskConfig", "value", "size", "customClasses", "wrapperClasses", "maxLength", "isPlainText", "isReadOnly", "isLoading", "isRound", "isFlush", "isInputGroupFlat", "isPrependButton", "isAppendButton", "isFloating", "loaderPosition", "prependIconModel", "appendIconModel", "isValidationStatusLight", "layout"], outputs: ["valueChange", "blurred", "keyDown", "keyDownEsc", "keyUpEnter"] }, { kind: "directive", type: i3.InputPrependDirective, selector: "ng-template[updInputPrepend]" }, { kind: "component", type: i4.IconComponent, selector: "upd-icon", inputs: ["model", "wrapperClasses", "color", "colorClass", "removeDefaultClasses", "customClasses", "tablerIcon", "tablerIconWeight", "tablerIconType", "tablerIconSize", "heroIcon", "heroIconSize", "heroIconType"] }, { kind: "component", type: i5.ButtonComponent, selector: "upd-button", inputs: ["model", "text", "brandColorStyle", "customClasses", "isOutline", "isGhost", "isSquare", "isPill", "isIcon", "isLoading", "isList", "isFloating", "isAction", "isNavigationLink", "isLink", "shouldIgnoreBtnClass", "iconModel", "iconPosition", "isDisabled", "isActive", "badgeConfig", "colorStyle", "size", "title", "stopPropagation"], outputs: ["clicked"] }, { kind: "directive", type: i6.PopoverDirective, selector: "[updPopover]", inputs: ["updPopover", "updPopoverTitle", "updPopoverTitleTemplate", "updPopoverTemplate", "updPopoverPlacement", "updPopoverCustomClasses", "updPopoverActAsTooltip"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
540
|
+
}
|
|
541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: SelectMultipleComponent, decorators: [{
|
|
542
|
+
type: Component,
|
|
543
|
+
args: [{ standalone: false, selector: 'upd-select-multiple', encapsulation: ViewEncapsulation.None, template: "@if (!!labelText) {\n @if (!!hintText || !!hintTemplate()) {\n <div class=\"row g-2\">\n <div class=\"col-auto\">\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n </div>\n <div class=\"col-auto\">\n <span class=\"form-help\" [updPopover]=\"hintText\" [updPopoverTemplate]=\"hintTemplate()\"\n [updPopoverActAsTooltip]=\"hintAsTooltip()\">\n ?\n </span>\n </div>\n </div>\n } @else {\n <label [ngClass]=\"labelSizeClasses\">{{ labelText }}</label>\n }\n}\n\n<div class=\"dropdown\" [attr.id]=\"name()\">\n <div #componentBox class=\"input-group input-group-flat\">\n <div class=\"form-control\" [class.remove-bottom-radius]=\"isDropdownOpen\" [class.disabled]=\"isDisabled()\"\n [class.pe-none]=\"isDisabled()\" [attr.disabled]=\"isDisabled() ? 'disabled' : undefined\" (click)=\"openDropdown()\">\n @for (sel of currentSelection; track sel) {\n <span class=\"badge bg-primary select-multiple-value\">{{ sel.text }}\n <upd-button [isIcon]=\"true\" [shouldIgnoreBtnClass]=\"true\" (clicked)=\"onRemoveItem(sel)\">\n <upd-icon tablerIcon=\"x\"></upd-icon>\n </upd-button></span> \n }\n </div>\n <div class=\"input-group-text\" [class.remove-bottom-radius]=\"isDropdownOpen\">\n @if (currentSelection.length > 0) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"clearSelection()\"\n customClasses=\"link-secondary\">\n <upd-icon tablerIcon=\"x\"></upd-icon>\n </upd-button>\n }\n @if (!isLoading) {\n <upd-button [shouldIgnoreBtnClass]=\"true\" [isDisabled]=\"isDisabled()\" (clicked)=\"openDropdown()\"\n customClasses=\"link-secondary ms-2\">\n <upd-icon tablerIcon=\"chevron-down\"></upd-icon>\n </upd-button>\n } @else {\n <div class=\"select-loader-wrapper\">\n <div class=\"spinner-border spinner-border-sm text-muted select-loader\" role=\"status\"></div>\n </div>\n }\n </div>\n </div>\n <div #searchBox>\n <div #searchBoxChild [style.visibility]=\"isDropdownOpen ? 'visible' : 'hidden'\" class=\"select-search-box\">\n <upd-input [placeholder]=\"placeholder()\" [isInputGroupFlat]=\"true\" (valueChange)=\"search($event)\">\n <ng-template updInputPrepend>\n <upd-icon tablerIcon=\"search\"></upd-icon>\n </ng-template>\n </upd-input>\n </div>\n </div>\n <upd-list #list [items]=\"listItems\" [maxHeight]=\"dropdownMaxHeight() + 'px'\" (selectedItem)=\"onSelectItem($event)\"\n [wrapperClasses]=\"dropdownClasses\" [isVisible]=\"isDropdownOpen\" [shouldOverflow]=\"true\" [shouldDisplayItemsCounter]=\"true\">\n </upd-list>\n</div>\n", styles: [".select-dropdown-content{position:absolute!important;background-color:var(--upd-card-bg);z-index:1;border:var(--upd-card-border-width) solid var(--upd-card-border-color)!important;border-radius:var(--upd-card-border-radius)!important;box-shadow:0 1px 1px #0000002e}.select-dropdown-content-open{display:block!important}.select-loader-wrapper{height:16px}.select-loader-wrapper .select-loader{height:16px;width:16px}.select-search-box{position:absolute;z-index:1;padding:.5rem;margin-top:-1px;background:var(--upd-body-bg);border:var(--upd-border-width) var(--upd-border-style) var(--upd-border-color)}.remove-bottom-radius{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important}.remove-top-radius{border-top-left-radius:0!important;border-top-right-radius:0!important}.compact{padding:.25rem 2rem .25rem .75rem!important}.select-multiple-value{display:inline-flex;align-items:center}\n"] }]
|
|
544
|
+
}], ctorParameters: () => [], propDecorators: { selectedItems: [{
|
|
545
|
+
type: Output
|
|
546
|
+
}], selectedIds: [{
|
|
547
|
+
type: Output
|
|
548
|
+
}], selectedValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValues", required: false }] }] } });
|
|
549
|
+
|
|
550
|
+
class UpdSelectModule {
|
|
551
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: UpdSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
552
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.4", ngImport: i0, type: UpdSelectModule, declarations: [SelectComponent,
|
|
553
|
+
SelectMultipleComponent], imports: [CommonModule,
|
|
554
|
+
UpdCoreLayoutModule,
|
|
555
|
+
UpdListModule,
|
|
556
|
+
UpdInputModule,
|
|
557
|
+
UpdIconsModule,
|
|
558
|
+
UpdButtonModule,
|
|
559
|
+
UpdPopoverModule,
|
|
560
|
+
TranslocoModule], exports: [SelectComponent,
|
|
561
|
+
SelectMultipleComponent] }); }
|
|
562
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: UpdSelectModule, imports: [CommonModule,
|
|
563
|
+
UpdCoreLayoutModule,
|
|
564
|
+
UpdListModule,
|
|
565
|
+
UpdInputModule,
|
|
566
|
+
UpdIconsModule,
|
|
567
|
+
UpdButtonModule,
|
|
568
|
+
UpdPopoverModule,
|
|
569
|
+
TranslocoModule] }); }
|
|
570
|
+
}
|
|
571
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: UpdSelectModule, decorators: [{
|
|
572
|
+
type: NgModule,
|
|
573
|
+
args: [{
|
|
574
|
+
imports: [
|
|
575
|
+
CommonModule,
|
|
576
|
+
UpdCoreLayoutModule,
|
|
577
|
+
UpdListModule,
|
|
578
|
+
UpdInputModule,
|
|
579
|
+
UpdIconsModule,
|
|
580
|
+
UpdButtonModule,
|
|
581
|
+
UpdPopoverModule,
|
|
582
|
+
TranslocoModule
|
|
583
|
+
],
|
|
584
|
+
declarations: [
|
|
585
|
+
SelectComponent,
|
|
586
|
+
SelectMultipleComponent
|
|
587
|
+
],
|
|
588
|
+
exports: [
|
|
589
|
+
SelectComponent,
|
|
590
|
+
SelectMultipleComponent
|
|
591
|
+
]
|
|
592
|
+
}]
|
|
593
|
+
}] });
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Generated bundle index. Do not edit.
|
|
597
|
+
*/
|
|
598
|
+
|
|
599
|
+
export { Defaults, SelectComponent, SelectMultipleComponent, UpdSelectModule };
|
|
600
|
+
//# sourceMappingURL=updevs-components-form-controls-select.mjs.map
|