@open-rlb/ng-bootstrap 3.3.34 → 3.3.36

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, output, viewChild, ChangeDetectionStrategy, Component, signal, computed, inject, ElementRef, Renderer2, effect, Directive, Injectable, contentChild, ViewContainerRef, contentChildren, numberAttribute, model, isSignal, Pipe, DOCUMENT, ViewChild, ChangeDetectorRef, DestroyRef, Self, Optional, HostListener, InjectionToken, afterNextRender, untracked, viewChildren, NgModule } from '@angular/core';
2
+ import { input, booleanAttribute, output, viewChild, ChangeDetectionStrategy, Component, signal, computed, inject, ElementRef, Renderer2, effect, Directive, Injectable, contentChild, ViewContainerRef, contentChildren, numberAttribute, model, isSignal, Pipe, DOCUMENT, ViewChild, ChangeDetectorRef, DestroyRef, Self, Optional, HostListener, InjectionToken, viewChildren, afterNextRender, untracked, NgModule } from '@angular/core';
3
3
  import * as i2$1 from '@angular/router';
4
4
  import { RouterLink, RouterLinkActive, RouterModule } from '@angular/router';
5
5
  import { Collapse, Carousel, Dropdown, Modal, Toast, Offcanvas, ScrollSpy, Popover, Tooltip } from 'bootstrap';
@@ -7,7 +7,7 @@ import { NgTemplateOutlet, formatDate, NgClass, TitleCasePipe, JsonPipe, CommonM
7
7
  import { Subject, of, map, shareReplay, take, filter, switchMap, Subscription, debounceTime, distinctUntilChanged, Observable, lastValueFrom, takeUntil } from 'rxjs';
8
8
  import * as i2 from '@angular/cdk/layout';
9
9
  import * as i1 from '@angular/forms';
10
- import { FormsModule, NgControl, FormControl, ReactiveFormsModule, FormGroup, Validators } from '@angular/forms';
10
+ import { FormsModule, NgControl, FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
11
11
  import { DateTz as DateTz$1 } from '@open-rlb/date-tz/date-tz';
12
12
  import { DateTz } from '@open-rlb/date-tz';
13
13
  import { CdkDropListGroup, CdkDropList, CdkDrag, CdkDragPlaceholder, CdkDragPreview } from '@angular/cdk/drag-drop';
@@ -9970,6 +9970,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
9970
9970
  }]
9971
9971
  }], ctorParameters: () => [], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], validate: [{ type: i0.Input, args: [{ isSignal: true, alias: "validate", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], inputs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => InputComponent), { isSignal: true }] }], validation: [{ type: i0.ContentChild, args: [i0.forwardRef(() => InputValidationComponent), { isSignal: true }] }] } });
9972
9972
 
9973
+ class LanguageChipsComponent extends AbstractComponent {
9974
+ constructor() {
9975
+ super(...arguments);
9976
+ this.options = input(['EN', 'IT', 'DE', 'FR', 'ES', 'PT'], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
9977
+ this.placeholder = input('Add...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
9978
+ /** How many chips to render inline before collapsing the rest into "(+N others)". */
9979
+ this.maxVisible = input(4, { ...(ngDevMode ? { debugName: "maxVisible" } : /* istanbul ignore next */ {}), transform: numberAttribute });
9980
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
9981
+ this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : /* istanbul ignore next */ {}), alias: 'id' });
9982
+ this.open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
9983
+ this.chips = computed(() => this.value() ?? [], ...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
9984
+ this.visibleChips = computed(() => this.chips().slice(0, this.maxVisible()), ...(ngDevMode ? [{ debugName: "visibleChips" }] : /* istanbul ignore next */ []));
9985
+ this.overflowCount = computed(() => Math.max(0, this.chips().length - this.maxVisible()), ...(ngDevMode ? [{ debugName: "overflowCount" }] : /* istanbul ignore next */ []));
9986
+ this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
9987
+ }
9988
+ toggle() {
9989
+ if (this.isDisabled())
9990
+ return;
9991
+ this.open.update(o => !o);
9992
+ }
9993
+ close() {
9994
+ if (!this.open())
9995
+ return;
9996
+ this.open.set(false);
9997
+ this.touch();
9998
+ }
9999
+ toggleOption(lang) {
10000
+ const next = this.chips().includes(lang)
10001
+ ? this.chips().filter(l => l !== lang)
10002
+ : [...this.chips(), lang];
10003
+ this.setValue(next);
10004
+ this.touch();
10005
+ }
10006
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: LanguageChipsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
10007
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: LanguageChipsComponent, isStandalone: true, selector: "rlb-language-chips", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, maxVisible: { classPropertyName: "maxVisible", publicName: "maxVisible", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, usesInheritance: true, ngImport: i0, template: `
10008
+ <div class="rlb-language-chips position-relative">
10009
+ <div
10010
+ class="form-select chips-control d-flex align-items-center gap-1"
10011
+ [class.disabled]="isDisabled()"
10012
+ [class.is-invalid]="showError() && invalid()"
10013
+ [class.is-valid]="showError() && !invalid()"
10014
+ role="combobox"
10015
+ [attr.aria-expanded]="open()"
10016
+ [attr.tabindex]="isDisabled() ? null : 0"
10017
+ (click)="toggle()"
10018
+ (keydown.enter)="toggle()"
10019
+ (keydown.space)="toggle(); $event.preventDefault()"
10020
+ (blur)="touch()"
10021
+ >
10022
+ @if (chips().length === 0) {
10023
+ <span class="text-muted text-truncate">{{ placeholder() }}</span>
10024
+ } @else {
10025
+ @for (lang of visibleChips(); track lang) {
10026
+ <span
10027
+ rlb-badge
10028
+ pill
10029
+ color="secondary"
10030
+ class="chip d-inline-flex align-items-center flex-shrink-0"
10031
+ >
10032
+ {{ lang }}
10033
+ </span>
10034
+ }
10035
+ @if (overflowCount() > 0) {
10036
+ <span class="text-muted small flex-shrink-0">(+{{ overflowCount() }} others)</span>
10037
+ }
10038
+ }
10039
+ </div>
10040
+
10041
+ @if (open() && !isDisabled()) {
10042
+ <div
10043
+ class="chips-backdrop"
10044
+ (click)="close()"
10045
+ ></div>
10046
+ <div class="dropdown-menu show w-100 chips-menu">
10047
+ @for (lang of options(); track lang) {
10048
+ <button
10049
+ type="button"
10050
+ class="dropdown-item d-flex align-items-center gap-2"
10051
+ [class.active]="chips().includes(lang)"
10052
+ (click)="toggleOption(lang)"
10053
+ >
10054
+ <input
10055
+ type="checkbox"
10056
+ class="form-check-input m-0 pe-none flex-shrink-0"
10057
+ [checked]="chips().includes(lang)"
10058
+ tabindex="-1"
10059
+ />
10060
+ <span class="text-truncate">{{ lang }}</span>
10061
+ </button>
10062
+ }
10063
+ </div>
10064
+ }
10065
+ </div>
10066
+ `, isInline: true, styles: [".chips-control{cursor:pointer;overflow:hidden;flex-wrap:nowrap;white-space:nowrap;min-height:calc(1.5em + .75rem + calc(var(--bs-border-width, 1px) * 2))}.chips-control.disabled{pointer-events:none;background-color:var(--bs-secondary-bg);opacity:1}.chips-backdrop{position:fixed;inset:0;z-index:1040}.chips-menu{position:absolute;top:100%;left:0;z-index:1045;max-height:16rem;overflow-y:auto}.chips-menu .dropdown-item{cursor:pointer}\n"], dependencies: [{ kind: "component", type: BadgeComponent, selector: "span[rlb-badge], img[rlb-badge]", inputs: ["pill", "color", "hidden-text", "border", "class", "badge-text-color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10067
+ }
10068
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: LanguageChipsComponent, decorators: [{
10069
+ type: Component,
10070
+ args: [{ selector: 'rlb-language-chips', template: `
10071
+ <div class="rlb-language-chips position-relative">
10072
+ <div
10073
+ class="form-select chips-control d-flex align-items-center gap-1"
10074
+ [class.disabled]="isDisabled()"
10075
+ [class.is-invalid]="showError() && invalid()"
10076
+ [class.is-valid]="showError() && !invalid()"
10077
+ role="combobox"
10078
+ [attr.aria-expanded]="open()"
10079
+ [attr.tabindex]="isDisabled() ? null : 0"
10080
+ (click)="toggle()"
10081
+ (keydown.enter)="toggle()"
10082
+ (keydown.space)="toggle(); $event.preventDefault()"
10083
+ (blur)="touch()"
10084
+ >
10085
+ @if (chips().length === 0) {
10086
+ <span class="text-muted text-truncate">{{ placeholder() }}</span>
10087
+ } @else {
10088
+ @for (lang of visibleChips(); track lang) {
10089
+ <span
10090
+ rlb-badge
10091
+ pill
10092
+ color="secondary"
10093
+ class="chip d-inline-flex align-items-center flex-shrink-0"
10094
+ >
10095
+ {{ lang }}
10096
+ </span>
10097
+ }
10098
+ @if (overflowCount() > 0) {
10099
+ <span class="text-muted small flex-shrink-0">(+{{ overflowCount() }} others)</span>
10100
+ }
10101
+ }
10102
+ </div>
10103
+
10104
+ @if (open() && !isDisabled()) {
10105
+ <div
10106
+ class="chips-backdrop"
10107
+ (click)="close()"
10108
+ ></div>
10109
+ <div class="dropdown-menu show w-100 chips-menu">
10110
+ @for (lang of options(); track lang) {
10111
+ <button
10112
+ type="button"
10113
+ class="dropdown-item d-flex align-items-center gap-2"
10114
+ [class.active]="chips().includes(lang)"
10115
+ (click)="toggleOption(lang)"
10116
+ >
10117
+ <input
10118
+ type="checkbox"
10119
+ class="form-check-input m-0 pe-none flex-shrink-0"
10120
+ [checked]="chips().includes(lang)"
10121
+ tabindex="-1"
10122
+ />
10123
+ <span class="text-truncate">{{ lang }}</span>
10124
+ </button>
10125
+ }
10126
+ </div>
10127
+ }
10128
+ </div>
10129
+ `, host: { '[attr.id]': 'null' }, changeDetection: ChangeDetectionStrategy.OnPush, imports: [BadgeComponent], styles: [".chips-control{cursor:pointer;overflow:hidden;flex-wrap:nowrap;white-space:nowrap;min-height:calc(1.5em + .75rem + calc(var(--bs-border-width, 1px) * 2))}.chips-control.disabled{pointer-events:none;background-color:var(--bs-secondary-bg);opacity:1}.chips-backdrop{position:fixed;inset:0;z-index:1040}.chips-menu{position:absolute;top:100%;left:0;z-index:1045;max-height:16rem;overflow-y:auto}.chips-menu .dropdown-item{cursor:pointer}\n"] }]
10130
+ }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], maxVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisible", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
10131
+
9973
10132
  class OptionComponent {
9974
10133
  constructor() {
9975
10134
  this.value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
@@ -10019,289 +10178,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
10019
10178
  }]
10020
10179
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], template: [{ type: i0.ViewChild, args: ['element', { isSignal: true }] }], contentTemplate: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
10021
10180
 
10022
- class SelectComponent extends AbstractComponent {
10023
- constructor() {
10024
- super();
10025
- this.placeholder = input(undefined, { ...(ngDevMode ? { debugName: "placeholder" } : /* istanbul ignore next */ {}), alias: 'placeholder' });
10026
- this.size = input(undefined, { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), alias: 'size' });
10027
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), alias: 'disabled',
10028
- transform: booleanAttribute });
10029
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), alias: 'readonly', transform: booleanAttribute });
10030
- this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), alias: 'multiple', transform: booleanAttribute });
10031
- this.display = input(undefined, { ...(ngDevMode ? { debugName: "display" } : /* istanbul ignore next */ {}), alias: 'display', transform: numberAttribute });
10032
- this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : /* istanbul ignore next */ {}), alias: 'inputId',
10033
- transform: (v) => v || '' });
10034
- this.enableValidation = input(false, { ...(ngDevMode ? { debugName: "enableValidation" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'enable-validation' });
10035
- this.el = viewChild('select', ...(ngDevMode ? [{ debugName: "el" }] : /* istanbul ignore next */ []));
10036
- this._projectedDisplayOptions = viewChild('projectedDisplayOptions', { ...(ngDevMode ? { debugName: "_projectedDisplayOptions" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
10037
- this.options = contentChildren(OptionComponent, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
10038
- afterNextRender(() => {
10039
- // This executes exactly when the DOM is fully painted and bindings are settled
10040
- this.onWrite(this.value());
10041
- });
10042
- effect(() => {
10043
- const vcr = this._projectedDisplayOptions(); // The ViewContainerRef in the Select
10044
- const options = this.options(); // The list of OptionComponents
10045
- if (!vcr)
10046
- return;
10047
- vcr.clear();
10048
- options.forEach(opt => {
10049
- const view = vcr.createEmbeddedView(opt.template());
10050
- view.detectChanges();
10051
- });
10052
- untracked(() => {
10053
- this.onWrite(this.value());
10054
- this.cdr.markForCheck();
10055
- });
10056
- });
10057
- }
10058
- update(ev) {
10059
- if (!this.disabled()) {
10060
- const t = ev;
10061
- if (this.multiple()) {
10062
- const selected = Array.from(t.selectedOptions)
10063
- .filter(o => o.selected)
10064
- .map(o => o.value);
10065
- this.setValue(selected);
10066
- }
10067
- else {
10068
- this.setValue(t?.value);
10069
- }
10070
- }
10071
- }
10072
- onWrite(data) {
10073
- const el = this.el?.();
10074
- if (el && el.nativeElement) {
10075
- if (data === undefined || data === null)
10076
- return;
10077
- const normalizedData = Array.isArray(data) ? data : [data];
10078
- if (this.multiple()) {
10079
- const opt = Array.from(el.nativeElement.options);
10080
- opt.forEach(o => {
10081
- o.selected = normalizedData.includes(o.value);
10082
- });
10083
- }
10084
- else {
10085
- const singleData = normalizedData.length > 0 ? normalizedData[0] : undefined;
10086
- if (singleData === undefined)
10087
- return;
10088
- const opt = Array.from(el.nativeElement.options);
10089
- const val = opt.find(o => o.value == singleData);
10090
- if (val)
10091
- val.selected = true;
10092
- }
10093
- }
10094
- }
10095
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10096
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SelectComponent, isStandalone: true, selector: "rlb-select", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, queries: [{ propertyName: "options", predicate: OptionComponent, isSignal: true }], viewQueries: [{ propertyName: "el", first: true, predicate: ["select"], descendants: true, isSignal: true }, { propertyName: "_projectedDisplayOptions", first: true, predicate: ["projectedDisplayOptions"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
10097
- <ng-content select="[before]"></ng-content>
10098
- <div class="input-group has-validation">
10099
- <select
10100
- #select
10101
- class="form-select d-inline-block"
10102
- [id]="id()"
10103
- [attr.disabled]="disabled() ? true : undefined"
10104
- [attr.readonly]="readonly() ? true : undefined"
10105
- [attr.multiple]="multiple() ? true : undefined"
10106
- [class.form-select-lg]="size() === 'large'"
10107
- [class.form-select-sm]="size() === 'small'"
10108
- [attr.placeholder]="placeholder()"
10109
- [attr.size]="display()"
10110
- (blur)="touch()"
10111
- [class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
10112
- [class.is-valid]="control?.touched && control?.valid && enableValidation()"
10113
- (change)="update($event.target)"
10114
- >
10115
- @if (placeholder()) {
10116
- <option
10117
- selected
10118
- disabled
10119
- >
10120
- {{ placeholder() }}
10121
- </option>
10122
- }
10123
- <ng-container #projectedDisplayOptions></ng-container>
10124
- </select>
10125
- @if (errors() && showError()) {
10126
- <rlb-input-validation [errors]="errors()" />
10127
- }
10128
- </div>
10129
- <ng-content select="[after]"></ng-content>
10130
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "component", type: InputValidationComponent, selector: "rlb-input-validation", inputs: ["errors"], outputs: ["errorsChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10131
- }
10132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, decorators: [{
10133
- type: Component,
10134
- args: [{
10135
- selector: 'rlb-select',
10136
- template: `
10137
- <ng-content select="[before]"></ng-content>
10138
- <div class="input-group has-validation">
10139
- <select
10140
- #select
10141
- class="form-select d-inline-block"
10142
- [id]="id()"
10143
- [attr.disabled]="disabled() ? true : undefined"
10144
- [attr.readonly]="readonly() ? true : undefined"
10145
- [attr.multiple]="multiple() ? true : undefined"
10146
- [class.form-select-lg]="size() === 'large'"
10147
- [class.form-select-sm]="size() === 'small'"
10148
- [attr.placeholder]="placeholder()"
10149
- [attr.size]="display()"
10150
- (blur)="touch()"
10151
- [class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
10152
- [class.is-valid]="control?.touched && control?.valid && enableValidation()"
10153
- (change)="update($event.target)"
10154
- >
10155
- @if (placeholder()) {
10156
- <option
10157
- selected
10158
- disabled
10159
- >
10160
- {{ placeholder() }}
10161
- </option>
10162
- }
10163
- <ng-container #projectedDisplayOptions></ng-container>
10164
- </select>
10165
- @if (errors() && showError()) {
10166
- <rlb-input-validation [errors]="errors()" />
10167
- }
10168
- </div>
10169
- <ng-content select="[after]"></ng-content>
10170
- `,
10171
- host: { '[attr.id]': 'null' },
10172
- changeDetection: ChangeDetectionStrategy.OnPush,
10173
- imports: [
10174
- FormsModule,
10175
- InputValidationComponent,
10176
- DataTableActionComponent,
10177
- ],
10178
- }]
10179
- }], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], enableValidation: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-validation", required: false }] }], el: [{ type: i0.ViewChild, args: ['select', { isSignal: true }] }], _projectedDisplayOptions: [{ type: i0.ViewChild, args: ['projectedDisplayOptions', { ...{
10180
- read: ViewContainerRef,
10181
- }, isSignal: true }] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OptionComponent), { isSignal: true }] }] } });
10182
-
10183
- class LanguageChipsComponent extends AbstractComponent {
10184
- constructor() {
10185
- super();
10186
- this.options = input(['EN', 'IT', 'DE', 'FR', 'ES', 'PT'], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
10187
- this.placeholder = input('Add...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
10188
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
10189
- this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : /* istanbul ignore next */ {}), alias: 'id' });
10190
- this.selectKey = signal(0, ...(ngDevMode ? [{ debugName: "selectKey" }] : /* istanbul ignore next */ []));
10191
- this.chips = computed(() => this.value() ?? [], ...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
10192
- this.isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
10193
- this.addControl = new FormControl(null);
10194
- this.addControl.valueChanges.pipe(filter(Boolean), takeUntilDestroyed()).subscribe(lang => {
10195
- this.add(lang);
10196
- this.addControl.setValue(null, { emitEvent: false });
10197
- // Reset the dropdown back to its placeholder after every pick, even when
10198
- // the value was ignored as a duplicate, so the already-selected option
10199
- // doesn't stay stuck as the visible selection.
10200
- this.selectKey.update(k => k + 1);
10201
- });
10202
- }
10203
- add(lang) {
10204
- if (this.chips().includes(lang))
10205
- return;
10206
- const next = [...this.chips(), lang];
10207
- this.setValue(next);
10208
- this.touch();
10209
- }
10210
- remove(lang) {
10211
- const next = this.chips().filter(l => l !== lang);
10212
- this.setValue(next);
10213
- this.touch();
10214
- }
10215
- setDisabledState(isDisabled) {
10216
- super.setDisabledState?.(isDisabled);
10217
- isDisabled ? this.addControl.disable() : this.addControl.enable();
10218
- }
10219
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: LanguageChipsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10220
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: LanguageChipsComponent, isStandalone: true, selector: "rlb-language-chips", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, usesInheritance: true, ngImport: i0, template: `
10221
- <div class="d-flex flex-column gap-2">
10222
- @if (!isDisabled()) {
10223
- @for (_ of [selectKey()]; track _) {
10224
- <div class="lang-add-select">
10225
- <rlb-select
10226
- [formControl]="addControl"
10227
- [placeholder]="placeholder()"
10228
- >
10229
- @for (lang of options(); track lang) {
10230
- <rlb-option [value]="lang">{{ lang }}</rlb-option>
10231
- }
10232
- </rlb-select>
10233
- </div>
10234
- }
10235
- }
10236
- @if (chips().length > 0) {
10237
- <div class="chips-box form-control d-flex flex-wrap align-items-center gap-2">
10238
- @for (lang of chips(); track lang) {
10239
- <span
10240
- rlb-badge
10241
- pill
10242
- color="secondary"
10243
- class="chip d-inline-flex align-items-center gap-1 mw-100"
10244
- >
10245
- <span class="chip-label">{{ lang }}</span>
10246
- @if (!isDisabled()) {
10247
- <button
10248
- type="button"
10249
- class="btn-close btn-close-white btn-close-sm flex-shrink-0"
10250
- (click)="remove(lang)"
10251
- [attr.aria-label]="'Remove ' + lang"
10252
- ></button>
10253
- }
10254
- </span>
10255
- }
10256
- </div>
10257
- }
10258
- </div>
10259
- `, isInline: true, styles: [".lang-add-select{min-width:130px}.chips-box{height:auto;max-height:7.5rem;overflow-y:auto}.chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:12rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: SelectComponent, selector: "rlb-select", inputs: ["placeholder", "size", "disabled", "readonly", "multiple", "display", "inputId", "enable-validation"] }, { kind: "component", type: OptionComponent, selector: "rlb-option", inputs: ["value", "disabled"] }, { kind: "component", type: BadgeComponent, selector: "span[rlb-badge], img[rlb-badge]", inputs: ["pill", "color", "hidden-text", "border", "class", "badge-text-color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10260
- }
10261
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: LanguageChipsComponent, decorators: [{
10262
- type: Component,
10263
- args: [{ selector: 'rlb-language-chips', template: `
10264
- <div class="d-flex flex-column gap-2">
10265
- @if (!isDisabled()) {
10266
- @for (_ of [selectKey()]; track _) {
10267
- <div class="lang-add-select">
10268
- <rlb-select
10269
- [formControl]="addControl"
10270
- [placeholder]="placeholder()"
10271
- >
10272
- @for (lang of options(); track lang) {
10273
- <rlb-option [value]="lang">{{ lang }}</rlb-option>
10274
- }
10275
- </rlb-select>
10276
- </div>
10277
- }
10278
- }
10279
- @if (chips().length > 0) {
10280
- <div class="chips-box form-control d-flex flex-wrap align-items-center gap-2">
10281
- @for (lang of chips(); track lang) {
10282
- <span
10283
- rlb-badge
10284
- pill
10285
- color="secondary"
10286
- class="chip d-inline-flex align-items-center gap-1 mw-100"
10287
- >
10288
- <span class="chip-label">{{ lang }}</span>
10289
- @if (!isDisabled()) {
10290
- <button
10291
- type="button"
10292
- class="btn-close btn-close-white btn-close-sm flex-shrink-0"
10293
- (click)="remove(lang)"
10294
- [attr.aria-label]="'Remove ' + lang"
10295
- ></button>
10296
- }
10297
- </span>
10298
- }
10299
- </div>
10300
- }
10301
- </div>
10302
- `, host: { '[attr.id]': 'null' }, changeDetection: ChangeDetectionStrategy.OnPush, imports: [ReactiveFormsModule, SelectComponent, OptionComponent, BadgeComponent], styles: [".lang-add-select{min-width:130px}.chips-box{height:auto;max-height:7.5rem;overflow-y:auto}.chip-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:12rem}\n"] }]
10303
- }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
10304
-
10305
10181
  class RadioComponent extends AbstractComponent {
10306
10182
  constructor() {
10307
10183
  super();
@@ -10514,6 +10390,167 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
10514
10390
  }]
10515
10391
  }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], el: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }] } });
10516
10392
 
10393
+ class SelectComponent extends AbstractComponent {
10394
+ constructor() {
10395
+ super();
10396
+ this.placeholder = input(undefined, { ...(ngDevMode ? { debugName: "placeholder" } : /* istanbul ignore next */ {}), alias: 'placeholder' });
10397
+ this.size = input(undefined, { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), alias: 'size' });
10398
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), alias: 'disabled',
10399
+ transform: booleanAttribute });
10400
+ this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), alias: 'readonly', transform: booleanAttribute });
10401
+ this.multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), alias: 'multiple', transform: booleanAttribute });
10402
+ this.display = input(undefined, { ...(ngDevMode ? { debugName: "display" } : /* istanbul ignore next */ {}), alias: 'display', transform: numberAttribute });
10403
+ this.userDefinedId = input('', { ...(ngDevMode ? { debugName: "userDefinedId" } : /* istanbul ignore next */ {}), alias: 'inputId',
10404
+ transform: (v) => v || '' });
10405
+ this.enableValidation = input(false, { ...(ngDevMode ? { debugName: "enableValidation" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'enable-validation' });
10406
+ this.el = viewChild('select', ...(ngDevMode ? [{ debugName: "el" }] : /* istanbul ignore next */ []));
10407
+ this._projectedDisplayOptions = viewChild('projectedDisplayOptions', { ...(ngDevMode ? { debugName: "_projectedDisplayOptions" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
10408
+ this.options = contentChildren(OptionComponent, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
10409
+ afterNextRender(() => {
10410
+ // This executes exactly when the DOM is fully painted and bindings are settled
10411
+ this.onWrite(this.value());
10412
+ });
10413
+ effect(() => {
10414
+ const vcr = this._projectedDisplayOptions(); // The ViewContainerRef in the Select
10415
+ const options = this.options(); // The list of OptionComponents
10416
+ if (!vcr)
10417
+ return;
10418
+ vcr.clear();
10419
+ options.forEach(opt => {
10420
+ const view = vcr.createEmbeddedView(opt.template());
10421
+ view.detectChanges();
10422
+ });
10423
+ untracked(() => {
10424
+ this.onWrite(this.value());
10425
+ this.cdr.markForCheck();
10426
+ });
10427
+ });
10428
+ }
10429
+ update(ev) {
10430
+ if (!this.disabled()) {
10431
+ const t = ev;
10432
+ if (this.multiple()) {
10433
+ const selected = Array.from(t.selectedOptions)
10434
+ .filter(o => o.selected)
10435
+ .map(o => o.value);
10436
+ this.setValue(selected);
10437
+ }
10438
+ else {
10439
+ this.setValue(t?.value);
10440
+ }
10441
+ }
10442
+ }
10443
+ onWrite(data) {
10444
+ const el = this.el?.();
10445
+ if (el && el.nativeElement) {
10446
+ if (data === undefined || data === null)
10447
+ return;
10448
+ const normalizedData = Array.isArray(data) ? data : [data];
10449
+ if (this.multiple()) {
10450
+ const opt = Array.from(el.nativeElement.options);
10451
+ opt.forEach(o => {
10452
+ o.selected = normalizedData.includes(o.value);
10453
+ });
10454
+ }
10455
+ else {
10456
+ const singleData = normalizedData.length > 0 ? normalizedData[0] : undefined;
10457
+ if (singleData === undefined)
10458
+ return;
10459
+ const opt = Array.from(el.nativeElement.options);
10460
+ const val = opt.find(o => o.value == singleData);
10461
+ if (val)
10462
+ val.selected = true;
10463
+ }
10464
+ }
10465
+ }
10466
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10467
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SelectComponent, isStandalone: true, selector: "rlb-select", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, userDefinedId: { classPropertyName: "userDefinedId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, enableValidation: { classPropertyName: "enableValidation", publicName: "enable-validation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "null" } }, queries: [{ propertyName: "options", predicate: OptionComponent, isSignal: true }], viewQueries: [{ propertyName: "el", first: true, predicate: ["select"], descendants: true, isSignal: true }, { propertyName: "_projectedDisplayOptions", first: true, predicate: ["projectedDisplayOptions"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
10468
+ <ng-content select="[before]"></ng-content>
10469
+ <div class="input-group has-validation">
10470
+ <select
10471
+ #select
10472
+ class="form-select d-inline-block"
10473
+ [id]="id()"
10474
+ [attr.disabled]="disabled() ? true : undefined"
10475
+ [attr.readonly]="readonly() ? true : undefined"
10476
+ [attr.multiple]="multiple() ? true : undefined"
10477
+ [class.form-select-lg]="size() === 'large'"
10478
+ [class.form-select-sm]="size() === 'small'"
10479
+ [attr.placeholder]="placeholder()"
10480
+ [attr.size]="display()"
10481
+ (blur)="touch()"
10482
+ [class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
10483
+ [class.is-valid]="control?.touched && control?.valid && enableValidation()"
10484
+ (change)="update($event.target)"
10485
+ >
10486
+ @if (placeholder()) {
10487
+ <option
10488
+ selected
10489
+ disabled
10490
+ >
10491
+ {{ placeholder() }}
10492
+ </option>
10493
+ }
10494
+ <ng-container #projectedDisplayOptions></ng-container>
10495
+ </select>
10496
+ @if (errors() && showError()) {
10497
+ <rlb-input-validation [errors]="errors()" />
10498
+ }
10499
+ </div>
10500
+ <ng-content select="[after]"></ng-content>
10501
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "component", type: InputValidationComponent, selector: "rlb-input-validation", inputs: ["errors"], outputs: ["errorsChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10502
+ }
10503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, decorators: [{
10504
+ type: Component,
10505
+ args: [{
10506
+ selector: 'rlb-select',
10507
+ template: `
10508
+ <ng-content select="[before]"></ng-content>
10509
+ <div class="input-group has-validation">
10510
+ <select
10511
+ #select
10512
+ class="form-select d-inline-block"
10513
+ [id]="id()"
10514
+ [attr.disabled]="disabled() ? true : undefined"
10515
+ [attr.readonly]="readonly() ? true : undefined"
10516
+ [attr.multiple]="multiple() ? true : undefined"
10517
+ [class.form-select-lg]="size() === 'large'"
10518
+ [class.form-select-sm]="size() === 'small'"
10519
+ [attr.placeholder]="placeholder()"
10520
+ [attr.size]="display()"
10521
+ (blur)="touch()"
10522
+ [class.is-invalid]="control?.touched && control?.invalid && enableValidation()"
10523
+ [class.is-valid]="control?.touched && control?.valid && enableValidation()"
10524
+ (change)="update($event.target)"
10525
+ >
10526
+ @if (placeholder()) {
10527
+ <option
10528
+ selected
10529
+ disabled
10530
+ >
10531
+ {{ placeholder() }}
10532
+ </option>
10533
+ }
10534
+ <ng-container #projectedDisplayOptions></ng-container>
10535
+ </select>
10536
+ @if (errors() && showError()) {
10537
+ <rlb-input-validation [errors]="errors()" />
10538
+ }
10539
+ </div>
10540
+ <ng-content select="[after]"></ng-content>
10541
+ `,
10542
+ host: { '[attr.id]': 'null' },
10543
+ changeDetection: ChangeDetectionStrategy.OnPush,
10544
+ imports: [
10545
+ FormsModule,
10546
+ InputValidationComponent,
10547
+ DataTableActionComponent,
10548
+ ],
10549
+ }]
10550
+ }], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], userDefinedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], enableValidation: [{ type: i0.Input, args: [{ isSignal: true, alias: "enable-validation", required: false }] }], el: [{ type: i0.ViewChild, args: ['select', { isSignal: true }] }], _projectedDisplayOptions: [{ type: i0.ViewChild, args: ['projectedDisplayOptions', { ...{
10551
+ read: ViewContainerRef,
10552
+ }, isSignal: true }] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OptionComponent), { isSignal: true }] }] } });
10553
+
10517
10554
  class SwitchComponent extends AbstractComponent {
10518
10555
  constructor() {
10519
10556
  super();
@@ -11503,7 +11540,7 @@ class RlbBootstrapModule {
11503
11540
  FormsModule,
11504
11541
  ReactiveFormsModule,
11505
11542
  TranslateModule,
11506
- RouterModule, DataTableComponent, SelectComponent, OptionComponent, LanguageChipsComponent, NavbarFormComponent, FormFieldsComponent] }); }
11543
+ RouterModule, DataTableComponent, SelectComponent, OptionComponent, NavbarFormComponent, FormFieldsComponent] }); }
11507
11544
  }
11508
11545
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: RlbBootstrapModule, decorators: [{
11509
11546
  type: NgModule,