@vsn-ux/ngx-gaia 0.1.6 → 0.2.1
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/fesm2022/vsn-ux-ngx-gaia.mjs +713 -97
- package/fesm2022/vsn-ux-ngx-gaia.mjs.map +1 -1
- package/lib/checkbox/checkbox.component.d.ts +5 -0
- package/lib/input/input.directive.d.ts +1 -1
- package/lib/select/index.d.ts +10 -0
- package/lib/select/opt-group.component.d.ts +6 -0
- package/lib/select/option.component.d.ts +20 -0
- package/lib/select/select-content-loading.component.d.ts +5 -0
- package/lib/select/select-content.component.d.ts +7 -0
- package/lib/select/select-required.validator.d.ts +8 -0
- package/lib/select/select-value.component.d.ts +7 -0
- package/lib/select/select.component.d.ts +55 -0
- package/lib/select/select.module.d.ts +15 -0
- package/lib/select/triggers/select-custom-trigger.component.d.ts +5 -0
- package/lib/select/triggers/select-searchable-trigger.component.d.ts +22 -0
- package/lib/select/triggers/select-trigger-di.d.ts +2 -0
- package/lib/select/triggers/select-trigger.component.d.ts +15 -0
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, numberAttribute, Component, ViewEncapsulation, Attribute, NgModule, ChangeDetectionStrategy, Injectable, makeEnvironmentProviders, booleanAttribute, output, computed, contentChild, forwardRef, Injector, signal, linkedSignal, Directive, model, HostListener, InjectionToken, effect, TemplateRef, NgZone, Input } from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, numberAttribute, Component, ViewEncapsulation, Attribute, NgModule, ChangeDetectionStrategy, Injectable, makeEnvironmentProviders, booleanAttribute, output, computed, contentChild, forwardRef, Injector, signal, linkedSignal, Directive, model, HostListener, InjectionToken, effect, TemplateRef, NgZone, Input, viewChild, contentChildren, isDevMode, afterNextRender } from '@angular/core';
|
|
3
3
|
import * as i1 from 'lucide-angular';
|
|
4
|
-
import { LucideAngularModule, X, CircleCheck, TriangleAlert, OctagonAlert, Info, ChevronUp, ChevronDown } from 'lucide-angular';
|
|
5
|
-
import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, CheckboxRequiredValidator } from '@angular/forms';
|
|
4
|
+
import { LucideAngularModule, X, CircleCheck, TriangleAlert, OctagonAlert, Info, Minus, Check, ChevronUp, ChevronDown } from 'lucide-angular';
|
|
5
|
+
import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, CheckboxRequiredValidator, RequiredValidator } from '@angular/forms';
|
|
6
6
|
import * as i1$1 from '@angular/cdk/menu';
|
|
7
7
|
import { CdkMenu, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
|
|
8
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
9
|
-
import { merge, map, Subject, takeUntil } from 'rxjs';
|
|
10
|
-
import
|
|
8
|
+
import { toSignal, outputToObservable } from '@angular/core/rxjs-interop';
|
|
9
|
+
import { merge, map, Subject, takeUntil, firstValueFrom } from 'rxjs';
|
|
10
|
+
import * as i1$3 from '@angular/cdk/overlay';
|
|
11
|
+
import { Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
11
12
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
12
13
|
import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
13
14
|
import { NgTemplateOutlet } from '@angular/common';
|
|
15
|
+
import * as i1$2 from '@angular/cdk/listbox';
|
|
16
|
+
import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
|
|
17
|
+
import * as i2 from '@angular/cdk/observers';
|
|
18
|
+
import { ObserversModule } from '@angular/cdk/observers';
|
|
14
19
|
|
|
15
20
|
class GaIconComponent {
|
|
16
21
|
elementRef = inject(ElementRef);
|
|
@@ -324,6 +329,7 @@ class GaCheckboxComponent {
|
|
|
324
329
|
_uniqueId = `ga-checkbox-${++nextUniqueId$4}`;
|
|
325
330
|
/** @ignore */
|
|
326
331
|
injector = inject(Injector);
|
|
332
|
+
icons = { Minus, Check };
|
|
327
333
|
/** @ignore */
|
|
328
334
|
_onTouched;
|
|
329
335
|
/** @ignore */
|
|
@@ -420,11 +426,11 @@ class GaCheckboxComponent {
|
|
|
420
426
|
this.change.emit(this.checkedModel());
|
|
421
427
|
}
|
|
422
428
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxComponent, deps: [{ token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
423
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaCheckboxComponent, isStandalone: true, selector: "ga-checkbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, nameInput: { classPropertyName: "nameInput", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, ariaErrormessage: { classPropertyName: "ariaErrormessage", publicName: "aria-errormessage", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { change: "change", indeterminateChange: "indeterminateChange" }, host: { properties: { "class.ga-checkbox--invalid": "invalid()", "attr.id": "null", "attr.tabindex": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null", "attr.aria-invalid": "null", "attr.aria-errormessage": "null" }, classAttribute: "ga-checkbox" }, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<input\n type=\"checkbox\"\n class=\"ga-checkbox__native\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"disabledModel()\"\n [required]=\"required()\"\n [attr.value]=\"value()\"\n [attr.tabindex]=\"tabindex\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-checkbox__marker\">\n <
|
|
429
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaCheckboxComponent, isStandalone: true, selector: "ga-checkbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, nameInput: { classPropertyName: "nameInput", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, ariaErrormessage: { classPropertyName: "ariaErrormessage", publicName: "aria-errormessage", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { change: "change", indeterminateChange: "indeterminateChange" }, host: { properties: { "class.ga-checkbox--invalid": "invalid()", "attr.id": "null", "attr.tabindex": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null", "attr.aria-invalid": "null", "attr.aria-errormessage": "null" }, classAttribute: "ga-checkbox" }, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<input\n type=\"checkbox\"\n class=\"ga-checkbox__native\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"disabledModel()\"\n [required]=\"required()\"\n [attr.value]=\"value()\"\n [attr.tabindex]=\"tabindex\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-checkbox__marker\">\n <lucide-icon\n [img]=\"icons.Check\"\n class=\"ga-checkbox__marker__indicator-checked\"\n [size]=\"12\"\n [strokeWidth]=\"2\"\n [absoluteStrokeWidth]=\"true\"\n />\n <lucide-icon\n [img]=\"icons.Minus\"\n class=\"ga-checkbox__marker__indicator-indeterminate\"\n [size]=\"12\"\n [strokeWidth]=\"2\"\n [absoluteStrokeWidth]=\"true\"\n />\n</div>\n\n<label class=\"ga-checkbox__label\" [attr.for]=\"inputId()\"\n ><ng-content></ng-content\n></label>\n", dependencies: [{ kind: "ngmodule", type: LucideAngularModule }, { kind: "component", type: i1.LucideAngularComponent, selector: "lucide-angular, lucide-icon, i-lucide, span-lucide", inputs: ["class", "name", "img", "color", "absoluteStrokeWidth", "size", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
424
430
|
}
|
|
425
431
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxComponent, decorators: [{
|
|
426
432
|
type: Component,
|
|
427
|
-
args: [{ selector: 'ga-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], host: {
|
|
433
|
+
args: [{ selector: 'ga-checkbox', imports: [LucideAngularModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], host: {
|
|
428
434
|
class: 'ga-checkbox',
|
|
429
435
|
'[class.ga-checkbox--invalid]': 'invalid()',
|
|
430
436
|
'[attr.id]': 'null',
|
|
@@ -434,7 +440,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
434
440
|
'[attr.aria-describedby]': 'null',
|
|
435
441
|
'[attr.aria-invalid]': 'null',
|
|
436
442
|
'[attr.aria-errormessage]': 'null',
|
|
437
|
-
}, template: "<input\n type=\"checkbox\"\n class=\"ga-checkbox__native\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"disabledModel()\"\n [required]=\"required()\"\n [attr.value]=\"value()\"\n [attr.tabindex]=\"tabindex\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-checkbox__marker\">\n <
|
|
443
|
+
}, template: "<input\n type=\"checkbox\"\n class=\"ga-checkbox__native\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"disabledModel()\"\n [required]=\"required()\"\n [attr.value]=\"value()\"\n [attr.tabindex]=\"tabindex\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-checkbox__marker\">\n <lucide-icon\n [img]=\"icons.Check\"\n class=\"ga-checkbox__marker__indicator-checked\"\n [size]=\"12\"\n [strokeWidth]=\"2\"\n [absoluteStrokeWidth]=\"true\"\n />\n <lucide-icon\n [img]=\"icons.Minus\"\n class=\"ga-checkbox__marker__indicator-indeterminate\"\n [size]=\"12\"\n [strokeWidth]=\"2\"\n [absoluteStrokeWidth]=\"true\"\n />\n</div>\n\n<label class=\"ga-checkbox__label\" [attr.for]=\"inputId()\"\n ><ng-content></ng-content\n></label>\n" }]
|
|
438
444
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
439
445
|
type: Attribute,
|
|
440
446
|
args: ['tabindex']
|
|
@@ -465,7 +471,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
465
471
|
class GaCheckboxModule {
|
|
466
472
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
467
473
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxModule, imports: [GaCheckboxComponent, GaCheckboxRequiredValidator], exports: [GaCheckboxComponent, GaCheckboxRequiredValidator] });
|
|
468
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxModule });
|
|
474
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxModule, imports: [GaCheckboxComponent] });
|
|
469
475
|
}
|
|
470
476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaCheckboxModule, decorators: [{
|
|
471
477
|
type: NgModule,
|
|
@@ -591,7 +597,10 @@ class GaInputDirective {
|
|
|
591
597
|
hasWrapper = inject(GaInputComponent, { optional: true });
|
|
592
598
|
implicitInvalid = signal(false);
|
|
593
599
|
implicitErrors = signal(null);
|
|
594
|
-
invalidInput = input(null, {
|
|
600
|
+
invalidInput = input(null, {
|
|
601
|
+
alias: 'invalid',
|
|
602
|
+
transform: booleanAttribute,
|
|
603
|
+
});
|
|
595
604
|
idInput = input(undefined, { alias: 'id' });
|
|
596
605
|
invalid = computed(() => {
|
|
597
606
|
return this.invalidInput() ?? this.implicitInvalid();
|
|
@@ -611,7 +620,7 @@ class GaInputDirective {
|
|
|
611
620
|
}
|
|
612
621
|
}
|
|
613
622
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
614
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaInputDirective, isStandalone: true, selector: "[gaInput]", inputs: { invalidInput: { classPropertyName: "invalidInput", publicName: "
|
|
623
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaInputDirective, isStandalone: true, selector: "[gaInput]", inputs: { invalidInput: { classPropertyName: "invalidInput", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "class.ga-input": "!hasWrapper", "class.ga-input--invalid": "!hasWrapper && invalid()" } }, providers: [{ provide: GA_FORM_CONTROL, useExisting: GaInputDirective }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
615
624
|
}
|
|
616
625
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaInputDirective, decorators: [{
|
|
617
626
|
type: Component,
|
|
@@ -1244,90 +1253,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1244
1253
|
}]
|
|
1245
1254
|
}] });
|
|
1246
1255
|
|
|
1247
|
-
class GaSpinnerComponent {
|
|
1248
|
-
size = input(32, { transform: numberAttribute });
|
|
1249
|
-
strokeWidth = computed(() => this.size() / 5);
|
|
1250
|
-
center = computed(() => this.size() / 2);
|
|
1251
|
-
radius = computed(() => (this.size() - this.strokeWidth()) / 2);
|
|
1252
|
-
circumference = computed(() => 2 * Math.PI * this.radius());
|
|
1253
|
-
arcCircumference = computed(() => this.circumference() * 0.25);
|
|
1254
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1255
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaSpinnerComponent, isStandalone: true, selector: "ga-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-spinner" }, ngImport: i0, template: `
|
|
1256
|
-
<svg
|
|
1257
|
-
[attr.width]="size()"
|
|
1258
|
-
[attr.height]="size()"
|
|
1259
|
-
[attr.viewBox]="'0 0 ' + size() + ' ' + size()"
|
|
1260
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1261
|
-
>
|
|
1262
|
-
<circle
|
|
1263
|
-
[attr.cx]="center()"
|
|
1264
|
-
[attr.cy]="center()"
|
|
1265
|
-
[attr.r]="radius()"
|
|
1266
|
-
stroke="var(--ga-color-secondary)"
|
|
1267
|
-
[attr.stroke-width]="strokeWidth()"
|
|
1268
|
-
fill="none"
|
|
1269
|
-
></circle>
|
|
1270
|
-
<circle
|
|
1271
|
-
[attr.cx]="center()"
|
|
1272
|
-
[attr.cy]="center()"
|
|
1273
|
-
[attr.r]="radius()"
|
|
1274
|
-
stroke="var(--ga-color-primary-70)"
|
|
1275
|
-
[attr.stroke-width]="strokeWidth()"
|
|
1276
|
-
stroke-linecap="round"
|
|
1277
|
-
fill="none"
|
|
1278
|
-
[attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
|
|
1279
|
-
style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
|
|
1280
|
-
></circle>
|
|
1281
|
-
</svg>
|
|
1282
|
-
`, isInline: true, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
1283
|
-
}
|
|
1284
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, decorators: [{
|
|
1285
|
-
type: Component,
|
|
1286
|
-
args: [{ selector: 'ga-spinner', template: `
|
|
1287
|
-
<svg
|
|
1288
|
-
[attr.width]="size()"
|
|
1289
|
-
[attr.height]="size()"
|
|
1290
|
-
[attr.viewBox]="'0 0 ' + size() + ' ' + size()"
|
|
1291
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1292
|
-
>
|
|
1293
|
-
<circle
|
|
1294
|
-
[attr.cx]="center()"
|
|
1295
|
-
[attr.cy]="center()"
|
|
1296
|
-
[attr.r]="radius()"
|
|
1297
|
-
stroke="var(--ga-color-secondary)"
|
|
1298
|
-
[attr.stroke-width]="strokeWidth()"
|
|
1299
|
-
fill="none"
|
|
1300
|
-
></circle>
|
|
1301
|
-
<circle
|
|
1302
|
-
[attr.cx]="center()"
|
|
1303
|
-
[attr.cy]="center()"
|
|
1304
|
-
[attr.r]="radius()"
|
|
1305
|
-
stroke="var(--ga-color-primary-70)"
|
|
1306
|
-
[attr.stroke-width]="strokeWidth()"
|
|
1307
|
-
stroke-linecap="round"
|
|
1308
|
-
fill="none"
|
|
1309
|
-
[attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
|
|
1310
|
-
style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
|
|
1311
|
-
></circle>
|
|
1312
|
-
</svg>
|
|
1313
|
-
`, encapsulation: ViewEncapsulation.None, host: {
|
|
1314
|
-
class: 'ga-spinner',
|
|
1315
|
-
}, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"] }]
|
|
1316
|
-
}] });
|
|
1317
|
-
|
|
1318
|
-
class GaSpinnerModule {
|
|
1319
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1320
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, imports: [GaSpinnerComponent], exports: [GaSpinnerComponent] });
|
|
1321
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule });
|
|
1322
|
-
}
|
|
1323
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, decorators: [{
|
|
1324
|
-
type: NgModule,
|
|
1325
|
-
args: [{
|
|
1326
|
-
imports: [GaSpinnerComponent],
|
|
1327
|
-
exports: [GaSpinnerComponent],
|
|
1328
|
-
}]
|
|
1329
|
-
}] });
|
|
1330
|
-
|
|
1331
1256
|
/**
|
|
1332
1257
|
* Provider Expression that allows ga-radio-group to register as a ControlValueAccessor.
|
|
1333
1258
|
* This allows it to support [(ngModel)] and ngControl.
|
|
@@ -1489,6 +1414,697 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1489
1414
|
}]
|
|
1490
1415
|
}] });
|
|
1491
1416
|
|
|
1417
|
+
class GaOptionComponent {
|
|
1418
|
+
_isSelected = signal(false);
|
|
1419
|
+
_isActive = signal(false);
|
|
1420
|
+
selectComponent = inject(GaSelectComponent);
|
|
1421
|
+
cdkOption = inject(CdkOption, { self: true });
|
|
1422
|
+
value = input(null);
|
|
1423
|
+
disabled = input(false, { transform: booleanAttribute });
|
|
1424
|
+
withInput = input(false, { transform: booleanAttribute });
|
|
1425
|
+
selected = computed(() => this._isSelected() &&
|
|
1426
|
+
this.cdkOption.value !== undefined &&
|
|
1427
|
+
this.cdkOption.value !== null &&
|
|
1428
|
+
this.cdkOption.value !== '');
|
|
1429
|
+
active = this._isActive.asReadonly();
|
|
1430
|
+
ngDoCheck() {
|
|
1431
|
+
// NOTE: currently there is no other reliable way to track the selected state,
|
|
1432
|
+
// refactor once cdk will be based on signals or more appropriate events introduced
|
|
1433
|
+
this._isSelected.set(this.cdkOption.isSelected());
|
|
1434
|
+
this._isActive.set(this.cdkOption.isActive());
|
|
1435
|
+
}
|
|
1436
|
+
onClick() {
|
|
1437
|
+
if (!this.cdkOption.disabled) {
|
|
1438
|
+
this.selectComponent.autoClose();
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1442
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaOptionComponent, isStandalone: true, selector: "ga-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, withInput: { classPropertyName: "withInput", publicName: "withInput", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "class.ga-dropdown__item--selected": "selected()", "class.ga-dropdown__item--disabled": "cdkOption.disabled", "class.ga-dropdown__item--active": "active() && !cdkOption.disabled" }, classAttribute: "ga-dropdown__item" }, hostDirectives: [{ directive: i1$2.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled", "cdkOptionTypeaheadLabel", "typeaheadLabel"] }], ngImport: i0, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<ng-content />\n", dependencies: [{ kind: "ngmodule", type: GaCheckboxModule }, { kind: "component", type: GaCheckboxComponent, selector: "ga-checkbox", inputs: ["value", "disabled", "checked", "name", "id", "indeterminate", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage", "required"], outputs: ["change", "indeterminateChange"] }, { kind: "ngmodule", type: GaRadioModule }, { kind: "component", type: GaRadioButtonComponent, selector: "ga-radio-button", inputs: ["value", "id", "name", "checked", "disabled", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage"], outputs: ["change"] }] });
|
|
1443
|
+
}
|
|
1444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptionComponent, decorators: [{
|
|
1445
|
+
type: Component,
|
|
1446
|
+
args: [{ selector: 'ga-option', imports: [GaCheckboxModule, GaRadioModule], hostDirectives: [
|
|
1447
|
+
{
|
|
1448
|
+
directive: CdkOption,
|
|
1449
|
+
inputs: [
|
|
1450
|
+
'cdkOption: value',
|
|
1451
|
+
'cdkOptionDisabled: disabled',
|
|
1452
|
+
'cdkOptionTypeaheadLabel: typeaheadLabel',
|
|
1453
|
+
],
|
|
1454
|
+
},
|
|
1455
|
+
], host: {
|
|
1456
|
+
class: 'ga-dropdown__item',
|
|
1457
|
+
'[class.ga-dropdown__item--selected]': 'selected()',
|
|
1458
|
+
'[class.ga-dropdown__item--disabled]': 'cdkOption.disabled',
|
|
1459
|
+
'[class.ga-dropdown__item--active]': 'active() && !cdkOption.disabled',
|
|
1460
|
+
'(click)': 'onClick()',
|
|
1461
|
+
}, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<ng-content />\n" }]
|
|
1462
|
+
}] });
|
|
1463
|
+
|
|
1464
|
+
class GaSelectValueComponent {
|
|
1465
|
+
selectComponent = inject(GaSelectComponent);
|
|
1466
|
+
optionViewValue = computed(() => {
|
|
1467
|
+
const options = this.selectComponent.selectedOptions();
|
|
1468
|
+
if (!options.length) {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
return options
|
|
1472
|
+
.map((option) => option.cdkOption.element.textContent?.trim() ?? '')
|
|
1473
|
+
.join(', ');
|
|
1474
|
+
});
|
|
1475
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1476
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectValueComponent, isStandalone: true, selector: "ga-select-value", ngImport: i0, template: `{{ optionViewValue() }}`, isInline: true });
|
|
1477
|
+
}
|
|
1478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectValueComponent, decorators: [{
|
|
1479
|
+
type: Component,
|
|
1480
|
+
args: [{
|
|
1481
|
+
selector: 'ga-select-value',
|
|
1482
|
+
template: `{{ optionViewValue() }}`,
|
|
1483
|
+
}]
|
|
1484
|
+
}] });
|
|
1485
|
+
|
|
1486
|
+
const GA_SELECT_TRIGGER = new InjectionToken('gaSelectTrigger');
|
|
1487
|
+
|
|
1488
|
+
class GaSelectTriggerComponent {
|
|
1489
|
+
selectComponent = inject(GaSelectComponent);
|
|
1490
|
+
content = viewChild('ngContent', { read: ElementRef });
|
|
1491
|
+
hasCustomLabel = signal(false);
|
|
1492
|
+
menuStatusIcon = computed(() => {
|
|
1493
|
+
return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
|
|
1494
|
+
});
|
|
1495
|
+
leftIcon = input();
|
|
1496
|
+
ngAfterViewInit() {
|
|
1497
|
+
this.checkIfHasCustomLabel();
|
|
1498
|
+
}
|
|
1499
|
+
checkIfHasCustomLabel() {
|
|
1500
|
+
this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
|
|
1501
|
+
}
|
|
1502
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1503
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectTriggerComponent, isStandalone: true, selector: "ga-select-trigger", inputs: { leftIcon: { classPropertyName: "leftIcon", publicName: "leftIcon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "combobox", "aria-haspopup": "listbox" }, listeners: { "click": "selectComponent.toggle()", "keydown.arrowdown": "selectComponent.open(); $event.preventDefault()", "keydown.space": "selectComponent.open(); $event.preventDefault()", "keydown.enter": "selectComponent.open(); $event.preventDefault()" }, properties: { "class.ga-select--expanded": "selectComponent.isOpen()", "class.ga-select--disabled": "selectComponent.disabled()", "class.ga-select--invalid": "selectComponent.invalid()", "class.ga-select--empty": "!selectComponent.hasValue()", "attr.aria-expanded": "selectComponent.isOpen()", "attr.aria-controls": "selectComponent.listboxId()", "attr.aria-invalid": "selectComponent.invalid()", "attr.aria-disabled": "selectComponent.disabled()", "attr.aria-activedescendant": "selectComponent.activeDescendantId()", "attr.tabindex": "selectComponent.disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
|
|
1504
|
+
{
|
|
1505
|
+
provide: GA_SELECT_TRIGGER,
|
|
1506
|
+
useExisting: forwardRef(() => GaSelectTriggerComponent),
|
|
1507
|
+
},
|
|
1508
|
+
], viewQueries: [{ propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n", dependencies: [{ kind: "ngmodule", type: GaInputModule }, { kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { kind: "component", type: GaSelectValueComponent, selector: "ga-select-value" }, { kind: "ngmodule", type: ObserversModule }, { kind: "directive", type: i2.CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }] });
|
|
1509
|
+
}
|
|
1510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectTriggerComponent, decorators: [{
|
|
1511
|
+
type: Component,
|
|
1512
|
+
args: [{ selector: 'ga-select-trigger', imports: [
|
|
1513
|
+
GaInputModule,
|
|
1514
|
+
GaIconModule,
|
|
1515
|
+
GaSelectValueComponent,
|
|
1516
|
+
ObserversModule,
|
|
1517
|
+
], providers: [
|
|
1518
|
+
{
|
|
1519
|
+
provide: GA_SELECT_TRIGGER,
|
|
1520
|
+
useExisting: forwardRef(() => GaSelectTriggerComponent),
|
|
1521
|
+
},
|
|
1522
|
+
], host: {
|
|
1523
|
+
role: 'combobox',
|
|
1524
|
+
class: 'ga-select',
|
|
1525
|
+
'[class.ga-select--expanded]': 'selectComponent.isOpen()',
|
|
1526
|
+
'[class.ga-select--disabled]': 'selectComponent.disabled()',
|
|
1527
|
+
'[class.ga-select--invalid]': 'selectComponent.invalid()',
|
|
1528
|
+
'[class.ga-select--empty]': '!selectComponent.hasValue()',
|
|
1529
|
+
'aria-haspopup': 'listbox',
|
|
1530
|
+
'[attr.aria-expanded]': 'selectComponent.isOpen()',
|
|
1531
|
+
'[attr.aria-controls]': 'selectComponent.listboxId()',
|
|
1532
|
+
'[attr.aria-invalid]': 'selectComponent.invalid()',
|
|
1533
|
+
'[attr.aria-disabled]': 'selectComponent.disabled()',
|
|
1534
|
+
'[attr.aria-activedescendant]': 'selectComponent.activeDescendantId()',
|
|
1535
|
+
'[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
|
|
1536
|
+
'(click)': 'selectComponent.toggle()',
|
|
1537
|
+
'(keydown.arrowdown)': 'selectComponent.open(); $event.preventDefault()',
|
|
1538
|
+
'(keydown.space)': 'selectComponent.open(); $event.preventDefault()',
|
|
1539
|
+
'(keydown.enter)': 'selectComponent.open(); $event.preventDefault()',
|
|
1540
|
+
}, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n" }]
|
|
1541
|
+
}] });
|
|
1542
|
+
|
|
1543
|
+
class GaSelectCustomTriggerComponent {
|
|
1544
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1545
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectCustomTriggerComponent, isStandalone: true, selector: "ga-select-custom-trigger", providers: [
|
|
1546
|
+
{
|
|
1547
|
+
provide: GA_SELECT_TRIGGER,
|
|
1548
|
+
useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
|
|
1549
|
+
},
|
|
1550
|
+
], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
1551
|
+
}
|
|
1552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectCustomTriggerComponent, decorators: [{
|
|
1553
|
+
type: Component,
|
|
1554
|
+
args: [{
|
|
1555
|
+
selector: 'ga-select-custom-trigger',
|
|
1556
|
+
template: `<ng-content></ng-content>`,
|
|
1557
|
+
providers: [
|
|
1558
|
+
{
|
|
1559
|
+
provide: GA_SELECT_TRIGGER,
|
|
1560
|
+
useExisting: forwardRef(() => GaSelectCustomTriggerComponent),
|
|
1561
|
+
},
|
|
1562
|
+
],
|
|
1563
|
+
}]
|
|
1564
|
+
}] });
|
|
1565
|
+
|
|
1566
|
+
class GaSelectComponent {
|
|
1567
|
+
focusedTriggerElement = null;
|
|
1568
|
+
_onTouched;
|
|
1569
|
+
_onModelChanged;
|
|
1570
|
+
positions = [
|
|
1571
|
+
{
|
|
1572
|
+
originX: 'end',
|
|
1573
|
+
originY: 'bottom',
|
|
1574
|
+
overlayX: 'end',
|
|
1575
|
+
overlayY: 'top',
|
|
1576
|
+
offsetY: 8,
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
originX: 'end',
|
|
1580
|
+
originY: 'top',
|
|
1581
|
+
overlayX: 'end',
|
|
1582
|
+
overlayY: 'bottom',
|
|
1583
|
+
offsetY: -8,
|
|
1584
|
+
},
|
|
1585
|
+
];
|
|
1586
|
+
injector = inject(Injector);
|
|
1587
|
+
implicitInvalid = signal(false);
|
|
1588
|
+
_isOpen = signal(false);
|
|
1589
|
+
value = model(null);
|
|
1590
|
+
placeholder = input('');
|
|
1591
|
+
disabledInput = input(false, {
|
|
1592
|
+
alias: 'disabled',
|
|
1593
|
+
transform: booleanAttribute,
|
|
1594
|
+
});
|
|
1595
|
+
invalidInput = input(null, {
|
|
1596
|
+
alias: 'invalid',
|
|
1597
|
+
transform: booleanAttribute,
|
|
1598
|
+
});
|
|
1599
|
+
multiple = input(false, { transform: booleanAttribute });
|
|
1600
|
+
compareWith = input();
|
|
1601
|
+
withoutAutoFocus = signal(false);
|
|
1602
|
+
opened = output();
|
|
1603
|
+
closed = output();
|
|
1604
|
+
// TODO: if we rename this to options, it breaks, why?
|
|
1605
|
+
gaOptions = contentChildren(GaOptionComponent, {
|
|
1606
|
+
descendants: true,
|
|
1607
|
+
read: GaOptionComponent,
|
|
1608
|
+
});
|
|
1609
|
+
cdkListbox = contentChild.required(CdkListbox);
|
|
1610
|
+
explicitTrigger = contentChild(GA_SELECT_TRIGGER);
|
|
1611
|
+
isOpen = this._isOpen.asReadonly();
|
|
1612
|
+
disabled = linkedSignal(() => this.disabledInput());
|
|
1613
|
+
icon = computed(() => {
|
|
1614
|
+
return this._isOpen() ? ChevronUp : ChevronDown;
|
|
1615
|
+
});
|
|
1616
|
+
selectedOptions = computed(() => {
|
|
1617
|
+
return this.gaOptions().filter((option) => option.selected());
|
|
1618
|
+
});
|
|
1619
|
+
activeDescendantId = computed(() => {
|
|
1620
|
+
const activeOption = this.gaOptions().find((option) => option.active());
|
|
1621
|
+
return activeOption?.cdkOption.id;
|
|
1622
|
+
});
|
|
1623
|
+
hasValue = computed(() => {
|
|
1624
|
+
const value = this.value();
|
|
1625
|
+
if (this.multiple()) {
|
|
1626
|
+
return Array.isArray(value) && value.length > 0;
|
|
1627
|
+
}
|
|
1628
|
+
return value !== null && value !== undefined && value !== '';
|
|
1629
|
+
});
|
|
1630
|
+
invalid = computed(() => {
|
|
1631
|
+
return this.invalidInput() ?? this.implicitInvalid();
|
|
1632
|
+
});
|
|
1633
|
+
listboxId = computed(() => this.cdkListbox().id);
|
|
1634
|
+
constructor() {
|
|
1635
|
+
effect(() => {
|
|
1636
|
+
// if the select became disabled while open, close it
|
|
1637
|
+
if (this.disabled() && this._isOpen()) {
|
|
1638
|
+
this.close();
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
ngAfterContentInit() {
|
|
1643
|
+
effect(() => {
|
|
1644
|
+
this.cdkListbox().multiple = this.multiple();
|
|
1645
|
+
this.cdkListbox().useActiveDescendant = this.withoutAutoFocus();
|
|
1646
|
+
this.cdkListbox().compareWith = this.compareWith();
|
|
1647
|
+
this.cdkListbox().value = this.multiple()
|
|
1648
|
+
? this.value()
|
|
1649
|
+
: [this.value()];
|
|
1650
|
+
}, { injector: this.injector });
|
|
1651
|
+
// track value changes (pull)
|
|
1652
|
+
this.cdkListbox().valueChange.subscribe(({ value }) => {
|
|
1653
|
+
if (!this.multiple()) {
|
|
1654
|
+
[value] = value;
|
|
1655
|
+
}
|
|
1656
|
+
this.value.set(value);
|
|
1657
|
+
this._onModelChanged?.(value);
|
|
1658
|
+
// this is needed because value could be also changed via keyboard
|
|
1659
|
+
this.autoClose();
|
|
1660
|
+
});
|
|
1661
|
+
if (isDevMode() &&
|
|
1662
|
+
this.explicitTrigger() instanceof GaSelectCustomTriggerComponent) {
|
|
1663
|
+
if (this.multiple()) {
|
|
1664
|
+
console.warn('<ga-select>: The `multiple` property requires custom handling when using a custom trigger component. If you have implemented the multiple selection logic in your custom trigger, you can ignore this warning. [This message is visible in dev mode only]');
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
ngDoCheck() {
|
|
1669
|
+
const implicitNgControl = this.injector.get(NgControl, null);
|
|
1670
|
+
// we can rely on computed because `ivalid` of NgControl is not a signal, yet
|
|
1671
|
+
if (implicitNgControl) {
|
|
1672
|
+
this.implicitInvalid.set(!!implicitNgControl.invalid && !!implicitNgControl.dirty);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
writeValue(value) {
|
|
1676
|
+
this.value.set(value);
|
|
1677
|
+
}
|
|
1678
|
+
registerOnChange(fn) {
|
|
1679
|
+
this._onModelChanged = fn;
|
|
1680
|
+
}
|
|
1681
|
+
registerOnTouched(fn) {
|
|
1682
|
+
this._onTouched = fn;
|
|
1683
|
+
}
|
|
1684
|
+
setDisabledState(disabled) {
|
|
1685
|
+
this.disabled.set(disabled);
|
|
1686
|
+
}
|
|
1687
|
+
toggle() {
|
|
1688
|
+
if (this._isOpen()) {
|
|
1689
|
+
this.close();
|
|
1690
|
+
}
|
|
1691
|
+
else {
|
|
1692
|
+
this.open();
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
open() {
|
|
1696
|
+
if (this.disabled() || this._isOpen()) {
|
|
1697
|
+
return Promise.resolve();
|
|
1698
|
+
}
|
|
1699
|
+
this._isOpen.set(true);
|
|
1700
|
+
return firstValueFrom(outputToObservable(this.opened));
|
|
1701
|
+
}
|
|
1702
|
+
close() {
|
|
1703
|
+
if (!this._isOpen()) {
|
|
1704
|
+
return Promise.resolve();
|
|
1705
|
+
}
|
|
1706
|
+
this._isOpen.set(false);
|
|
1707
|
+
return firstValueFrom(outputToObservable(this.closed));
|
|
1708
|
+
}
|
|
1709
|
+
autoClose() {
|
|
1710
|
+
// close that was initiated by clicking the option
|
|
1711
|
+
if (!this.multiple()) {
|
|
1712
|
+
this.close();
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
focusListbox() {
|
|
1716
|
+
this.cdkListbox().focus();
|
|
1717
|
+
}
|
|
1718
|
+
setPreviousItemActive() {
|
|
1719
|
+
this.setItemActive(-1);
|
|
1720
|
+
}
|
|
1721
|
+
setNextItemActive() {
|
|
1722
|
+
this.setItemActive(1);
|
|
1723
|
+
}
|
|
1724
|
+
setActiveItemAsSelected() {
|
|
1725
|
+
const options = this.gaOptions();
|
|
1726
|
+
let activeOption = options.find((option) => option.cdkOption.isActive());
|
|
1727
|
+
if (!activeOption && options.length > 0) {
|
|
1728
|
+
activeOption = options[0];
|
|
1729
|
+
}
|
|
1730
|
+
if (activeOption) {
|
|
1731
|
+
const { cdkOption } = activeOption;
|
|
1732
|
+
this.cdkListbox().toggle(cdkOption);
|
|
1733
|
+
let { value } = this.cdkListbox();
|
|
1734
|
+
if (!this.multiple()) {
|
|
1735
|
+
[value] = value;
|
|
1736
|
+
}
|
|
1737
|
+
this.value.set(value);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
onOverlayAttach() {
|
|
1741
|
+
this._isOpen.set(true);
|
|
1742
|
+
this.focusedTriggerElement = document.activeElement;
|
|
1743
|
+
this.opened.emit();
|
|
1744
|
+
if (!this.withoutAutoFocus()) {
|
|
1745
|
+
this.focusListbox();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
onOverlayDetach() {
|
|
1749
|
+
this._isOpen.set(false);
|
|
1750
|
+
this.focusedTriggerElement?.focus();
|
|
1751
|
+
this._onTouched?.();
|
|
1752
|
+
this.closed.emit();
|
|
1753
|
+
}
|
|
1754
|
+
setItemActive(direction) {
|
|
1755
|
+
const options = this.gaOptions();
|
|
1756
|
+
const currentIndex = options.findIndex(({ cdkOption }) => cdkOption.isActive());
|
|
1757
|
+
const findNextEnabled = (startIndex) => {
|
|
1758
|
+
let index = startIndex;
|
|
1759
|
+
for (let i = 0; i < options.length; i++) {
|
|
1760
|
+
// calculate next index with wrapping (using modulo)
|
|
1761
|
+
index = (index + direction + options.length) % options.length;
|
|
1762
|
+
if (!options[index].cdkOption.disabled) {
|
|
1763
|
+
return index;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
return -1; // no enabled options found
|
|
1767
|
+
};
|
|
1768
|
+
const nextIndex = findNextEnabled(currentIndex);
|
|
1769
|
+
if (nextIndex !== -1) {
|
|
1770
|
+
this.cdkListbox()._setActiveOption(options[nextIndex].cdkOption);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1774
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectComponent, isStandalone: true, selector: "ga-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalidInput: { classPropertyName: "invalidInput", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", opened: "opened", closed: "closed" }, providers: [
|
|
1775
|
+
{
|
|
1776
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1777
|
+
useExisting: forwardRef(() => GaSelectComponent),
|
|
1778
|
+
multi: true,
|
|
1779
|
+
},
|
|
1780
|
+
], queries: [{ propertyName: "gaOptions", predicate: GaOptionComponent, descendants: true, read: GaOptionComponent, isSignal: true }, { propertyName: "cdkListbox", first: true, predicate: CdkListbox, descendants: true, isSignal: true }, { propertyName: "explicitTrigger", first: true, predicate: GA_SELECT_TRIGGER, descendants: true, isSignal: true }], ngImport: i0, template: "<div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n @if (explicitTrigger()) {\n <ng-content\n select=\"ga-select-custom-trigger, ga-select-trigger, ga-select-searchable-trigger\"\n />\n } @else {\n <ga-select-trigger />\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-content\" />\n</ng-template>\n", styles: ["ga-select{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "ngmodule", type: GaButtonModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$3.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$3.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: GaSelectTriggerComponent, selector: "ga-select-trigger", inputs: ["leftIcon"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1781
|
+
}
|
|
1782
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComponent, decorators: [{
|
|
1783
|
+
type: Component,
|
|
1784
|
+
args: [{ selector: 'ga-select', imports: [
|
|
1785
|
+
GaIconModule,
|
|
1786
|
+
GaButtonModule,
|
|
1787
|
+
OverlayModule,
|
|
1788
|
+
GaSelectTriggerComponent,
|
|
1789
|
+
], providers: [
|
|
1790
|
+
{
|
|
1791
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1792
|
+
useExisting: forwardRef(() => GaSelectComponent),
|
|
1793
|
+
multi: true,
|
|
1794
|
+
},
|
|
1795
|
+
], encapsulation: ViewEncapsulation.None, template: "<div cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n @if (explicitTrigger()) {\n <ng-content\n select=\"ga-select-custom-trigger, ga-select-trigger, ga-select-searchable-trigger\"\n />\n } @else {\n <ga-select-trigger />\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isOpen()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n (overlayOutsideClick)=\"close()\"\n (attach)=\"onOverlayAttach()\"\n (detach)=\"onOverlayDetach()\"\n>\n <ng-content select=\"ga-select-content\" />\n</ng-template>\n", styles: ["ga-select{display:inline-block}\n"] }]
|
|
1796
|
+
}], ctorParameters: () => [] });
|
|
1797
|
+
|
|
1798
|
+
class GaOptgroupComponent {
|
|
1799
|
+
label = input();
|
|
1800
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1801
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaOptgroupComponent, isStandalone: true, selector: "ga-optgroup", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" } }, ngImport: i0, template: `
|
|
1802
|
+
@if (label()) {
|
|
1803
|
+
<div class="ga-dropdown__caption">{{ label() }}</div>
|
|
1804
|
+
}
|
|
1805
|
+
<ng-content />
|
|
1806
|
+
`, isInline: true });
|
|
1807
|
+
}
|
|
1808
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaOptgroupComponent, decorators: [{
|
|
1809
|
+
type: Component,
|
|
1810
|
+
args: [{
|
|
1811
|
+
selector: 'ga-optgroup',
|
|
1812
|
+
template: `
|
|
1813
|
+
@if (label()) {
|
|
1814
|
+
<div class="ga-dropdown__caption">{{ label() }}</div>
|
|
1815
|
+
}
|
|
1816
|
+
<ng-content />
|
|
1817
|
+
`,
|
|
1818
|
+
host: {
|
|
1819
|
+
role: 'group',
|
|
1820
|
+
},
|
|
1821
|
+
}]
|
|
1822
|
+
}] });
|
|
1823
|
+
|
|
1824
|
+
class GaSpinnerComponent {
|
|
1825
|
+
size = input(32, { transform: numberAttribute });
|
|
1826
|
+
strokeWidth = computed(() => this.size() / 5);
|
|
1827
|
+
center = computed(() => this.size() / 2);
|
|
1828
|
+
radius = computed(() => (this.size() - this.strokeWidth()) / 2);
|
|
1829
|
+
circumference = computed(() => 2 * Math.PI * this.radius());
|
|
1830
|
+
arcCircumference = computed(() => this.circumference() * 0.25);
|
|
1831
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1832
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: GaSpinnerComponent, isStandalone: true, selector: "ga-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-spinner" }, ngImport: i0, template: `
|
|
1833
|
+
<svg
|
|
1834
|
+
[attr.width]="size()"
|
|
1835
|
+
[attr.height]="size()"
|
|
1836
|
+
[attr.viewBox]="'0 0 ' + size() + ' ' + size()"
|
|
1837
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1838
|
+
>
|
|
1839
|
+
<circle
|
|
1840
|
+
[attr.cx]="center()"
|
|
1841
|
+
[attr.cy]="center()"
|
|
1842
|
+
[attr.r]="radius()"
|
|
1843
|
+
stroke="var(--ga-color-secondary)"
|
|
1844
|
+
[attr.stroke-width]="strokeWidth()"
|
|
1845
|
+
fill="none"
|
|
1846
|
+
></circle>
|
|
1847
|
+
<circle
|
|
1848
|
+
[attr.cx]="center()"
|
|
1849
|
+
[attr.cy]="center()"
|
|
1850
|
+
[attr.r]="radius()"
|
|
1851
|
+
stroke="var(--ga-color-primary-70)"
|
|
1852
|
+
[attr.stroke-width]="strokeWidth()"
|
|
1853
|
+
stroke-linecap="round"
|
|
1854
|
+
fill="none"
|
|
1855
|
+
[attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
|
|
1856
|
+
style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
|
|
1857
|
+
></circle>
|
|
1858
|
+
</svg>
|
|
1859
|
+
`, isInline: true, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"], encapsulation: i0.ViewEncapsulation.None });
|
|
1860
|
+
}
|
|
1861
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerComponent, decorators: [{
|
|
1862
|
+
type: Component,
|
|
1863
|
+
args: [{ selector: 'ga-spinner', template: `
|
|
1864
|
+
<svg
|
|
1865
|
+
[attr.width]="size()"
|
|
1866
|
+
[attr.height]="size()"
|
|
1867
|
+
[attr.viewBox]="'0 0 ' + size() + ' ' + size()"
|
|
1868
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1869
|
+
>
|
|
1870
|
+
<circle
|
|
1871
|
+
[attr.cx]="center()"
|
|
1872
|
+
[attr.cy]="center()"
|
|
1873
|
+
[attr.r]="radius()"
|
|
1874
|
+
stroke="var(--ga-color-secondary)"
|
|
1875
|
+
[attr.stroke-width]="strokeWidth()"
|
|
1876
|
+
fill="none"
|
|
1877
|
+
></circle>
|
|
1878
|
+
<circle
|
|
1879
|
+
[attr.cx]="center()"
|
|
1880
|
+
[attr.cy]="center()"
|
|
1881
|
+
[attr.r]="radius()"
|
|
1882
|
+
stroke="var(--ga-color-primary-70)"
|
|
1883
|
+
[attr.stroke-width]="strokeWidth()"
|
|
1884
|
+
stroke-linecap="round"
|
|
1885
|
+
fill="none"
|
|
1886
|
+
[attr.stroke-dasharray]="arcCircumference() + ' ' + circumference()"
|
|
1887
|
+
style="transform-origin: center; animation: ga-spinner__animation 1100ms linear infinite;"
|
|
1888
|
+
></circle>
|
|
1889
|
+
</svg>
|
|
1890
|
+
`, encapsulation: ViewEncapsulation.None, host: {
|
|
1891
|
+
class: 'ga-spinner',
|
|
1892
|
+
}, styles: [".ga-spinner{display:inline-block}@keyframes ga-spinner__animation{0%{transform:rotate(0)}31.82%{transform:rotate(90deg)}63.64%{transform:rotate(180deg)}81.82%{transform:rotate(270deg)}to{transform:rotate(360deg)}}\n"] }]
|
|
1893
|
+
}] });
|
|
1894
|
+
|
|
1895
|
+
class GaSpinnerModule {
|
|
1896
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1897
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, imports: [GaSpinnerComponent], exports: [GaSpinnerComponent] });
|
|
1898
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule });
|
|
1899
|
+
}
|
|
1900
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSpinnerModule, decorators: [{
|
|
1901
|
+
type: NgModule,
|
|
1902
|
+
args: [{
|
|
1903
|
+
imports: [GaSpinnerComponent],
|
|
1904
|
+
exports: [GaSpinnerComponent],
|
|
1905
|
+
}]
|
|
1906
|
+
}] });
|
|
1907
|
+
|
|
1908
|
+
class GaSelectContentLoadingComponent {
|
|
1909
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1910
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectContentLoadingComponent, isStandalone: true, selector: "ga-select-content-loading", host: { classAttribute: "ga-dropdown__content-spinner" }, ngImport: i0, template: `<ga-spinner size="16" />`, isInline: true, dependencies: [{ kind: "ngmodule", type: GaSpinnerModule }, { kind: "component", type: GaSpinnerComponent, selector: "ga-spinner", inputs: ["size"] }] });
|
|
1911
|
+
}
|
|
1912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentLoadingComponent, decorators: [{
|
|
1913
|
+
type: Component,
|
|
1914
|
+
args: [{
|
|
1915
|
+
selector: 'ga-select-content-loading',
|
|
1916
|
+
template: `<ga-spinner size="16" />`,
|
|
1917
|
+
imports: [GaSpinnerModule],
|
|
1918
|
+
host: {
|
|
1919
|
+
class: 'ga-dropdown__content-spinner',
|
|
1920
|
+
},
|
|
1921
|
+
}]
|
|
1922
|
+
}] });
|
|
1923
|
+
|
|
1924
|
+
class GaSelectContentComponent {
|
|
1925
|
+
loading = input(false, { transform: booleanAttribute });
|
|
1926
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1927
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectContentComponent, isStandalone: true, selector: "ga-select-content", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ga-dropdown ga-dropdown__content" }, hostDirectives: [{ directive: i1$2.CdkListbox }], ngImport: i0, template: "@if (loading()) {\n <ga-select-content-loading />\n} @else {\n <ng-content />\n}\n", dependencies: [{ kind: "component", type: GaSelectContentLoadingComponent, selector: "ga-select-content-loading" }] });
|
|
1928
|
+
}
|
|
1929
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectContentComponent, decorators: [{
|
|
1930
|
+
type: Component,
|
|
1931
|
+
args: [{ selector: 'ga-select-content', imports: [GaSelectContentLoadingComponent], hostDirectives: [CdkListbox], host: {
|
|
1932
|
+
class: 'ga-dropdown ga-dropdown__content',
|
|
1933
|
+
}, template: "@if (loading()) {\n <ga-select-content-loading />\n} @else {\n <ng-content />\n}\n" }]
|
|
1934
|
+
}] });
|
|
1935
|
+
|
|
1936
|
+
class GaSelectComboboxTriggerComponent {
|
|
1937
|
+
injector = inject(Injector);
|
|
1938
|
+
selectComponent = inject(GaSelectComponent);
|
|
1939
|
+
content = viewChild('ngContent', { read: ElementRef });
|
|
1940
|
+
inputSearch = viewChild('inputSearch');
|
|
1941
|
+
hasCustomLabel = signal(false);
|
|
1942
|
+
menuStatusIcon = computed(() => {
|
|
1943
|
+
return this.selectComponent.isOpen() ? ChevronUp : ChevronDown;
|
|
1944
|
+
});
|
|
1945
|
+
textValue = model('');
|
|
1946
|
+
leftIcon = input();
|
|
1947
|
+
constructor() {
|
|
1948
|
+
this.selectComponent.withoutAutoFocus.set(true);
|
|
1949
|
+
this.selectComponent.opened.subscribe(() => {
|
|
1950
|
+
afterNextRender(() => {
|
|
1951
|
+
this.inputSearch().nativeElement.focus();
|
|
1952
|
+
}, { injector: this.injector });
|
|
1953
|
+
});
|
|
1954
|
+
this.selectComponent.closed.subscribe(() => this.textValue.set(''));
|
|
1955
|
+
}
|
|
1956
|
+
ngAfterViewInit() {
|
|
1957
|
+
this.checkIfHasCustomLabel();
|
|
1958
|
+
}
|
|
1959
|
+
checkIfHasCustomLabel() {
|
|
1960
|
+
this.hasCustomLabel.set(!!this.content()?.nativeElement.children.length);
|
|
1961
|
+
}
|
|
1962
|
+
toggle() {
|
|
1963
|
+
if (this.selectComponent.disabled()) {
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
if (!this.selectComponent.isOpen()) {
|
|
1967
|
+
this.open();
|
|
1968
|
+
}
|
|
1969
|
+
else {
|
|
1970
|
+
this.selectComponent.close();
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
open() {
|
|
1974
|
+
this.selectComponent.open();
|
|
1975
|
+
}
|
|
1976
|
+
onInputKeyDown(event) {
|
|
1977
|
+
switch (event.code) {
|
|
1978
|
+
case 'ArrowDown':
|
|
1979
|
+
this.selectComponent.setNextItemActive();
|
|
1980
|
+
event.preventDefault();
|
|
1981
|
+
event.stopPropagation();
|
|
1982
|
+
break;
|
|
1983
|
+
case 'ArrowUp':
|
|
1984
|
+
this.selectComponent.setPreviousItemActive();
|
|
1985
|
+
event.preventDefault();
|
|
1986
|
+
event.stopPropagation();
|
|
1987
|
+
break;
|
|
1988
|
+
case 'Space':
|
|
1989
|
+
event.stopPropagation();
|
|
1990
|
+
break;
|
|
1991
|
+
case 'Enter':
|
|
1992
|
+
this.selectComponent.setActiveItemAsSelected();
|
|
1993
|
+
this.selectComponent.autoClose();
|
|
1994
|
+
event.preventDefault();
|
|
1995
|
+
event.stopPropagation();
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2000
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: GaSelectComboboxTriggerComponent, isStandalone: true, selector: "ga-select-searchable-trigger", inputs: { textValue: { classPropertyName: "textValue", publicName: "textValue", isSignal: true, isRequired: false, transformFunction: null }, leftIcon: { classPropertyName: "leftIcon", publicName: "leftIcon", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { textValue: "textValueChange" }, host: { attributes: { "role": "combobox", "aria-haspopup": "listbox" }, listeners: { "click": "toggle()", "keydown.arrowdown": "open(); $event.preventDefault()", "keydown.space": "open(); $event.preventDefault()", "keydown.enter": "open(); $event.preventDefault()" }, properties: { "class.ga-select--expanded": "selectComponent.isOpen()", "class.ga-select--disabled": "selectComponent.disabled()", "class.ga-select--invalid": "selectComponent.invalid()", "class.ga-select--empty": "!selectComponent.hasValue()", "attr.aria-expanded": "selectComponent.isOpen()", "attr.aria-owns": "selectComponent.listboxId()", "attr.aria-invalid": "selectComponent.invalid()", "attr.aria-disabled": "selectComponent.disabled()", "attr.tabindex": "selectComponent.disabled() ? -1 : 0" }, classAttribute: "ga-select" }, providers: [
|
|
2001
|
+
{
|
|
2002
|
+
provide: GA_SELECT_TRIGGER,
|
|
2003
|
+
useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
|
|
2004
|
+
},
|
|
2005
|
+
], viewQueries: [{ propertyName: "content", first: true, predicate: ["ngContent"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "inputSearch", first: true, predicate: ["inputSearch"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.isOpen()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"textValue.set(inputSearch.value)\"\n (click)=\"$event.stopPropagation()\"\n [attr.aria-expanded]=\"selectComponent.isOpen()\"\n [attr.aria-controls]=\"selectComponent.listboxId()\"\n [attr.aria-activedescendant]=\"selectComponent.activeDescendantId()\"\n [placeholder]=\"selectComponent.placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n", dependencies: [{ kind: "ngmodule", type: GaInputModule }, { kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }, { kind: "component", type: GaSelectValueComponent, selector: "ga-select-value" }, { kind: "ngmodule", type: ObserversModule }, { kind: "directive", type: i2.CdkObserveContent, selector: "[cdkObserveContent]", inputs: ["cdkObserveContentDisabled", "debounce"], outputs: ["cdkObserveContent"], exportAs: ["cdkObserveContent"] }] });
|
|
2006
|
+
}
|
|
2007
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectComboboxTriggerComponent, decorators: [{
|
|
2008
|
+
type: Component,
|
|
2009
|
+
args: [{ selector: 'ga-select-searchable-trigger', imports: [
|
|
2010
|
+
GaInputModule,
|
|
2011
|
+
GaIconModule,
|
|
2012
|
+
GaSelectValueComponent,
|
|
2013
|
+
ObserversModule,
|
|
2014
|
+
], providers: [
|
|
2015
|
+
{
|
|
2016
|
+
provide: GA_SELECT_TRIGGER,
|
|
2017
|
+
useExisting: forwardRef(() => GaSelectComboboxTriggerComponent),
|
|
2018
|
+
},
|
|
2019
|
+
], host: {
|
|
2020
|
+
role: 'combobox',
|
|
2021
|
+
class: 'ga-select',
|
|
2022
|
+
'[class.ga-select--expanded]': 'selectComponent.isOpen()',
|
|
2023
|
+
'[class.ga-select--disabled]': 'selectComponent.disabled()',
|
|
2024
|
+
'[class.ga-select--invalid]': 'selectComponent.invalid()',
|
|
2025
|
+
'[class.ga-select--empty]': '!selectComponent.hasValue()',
|
|
2026
|
+
'aria-haspopup': 'listbox',
|
|
2027
|
+
'[attr.aria-expanded]': 'selectComponent.isOpen()',
|
|
2028
|
+
'[attr.aria-owns]': 'selectComponent.listboxId()',
|
|
2029
|
+
'[attr.aria-invalid]': 'selectComponent.invalid()',
|
|
2030
|
+
'[attr.aria-disabled]': 'selectComponent.disabled()',
|
|
2031
|
+
'[attr.tabindex]': 'selectComponent.disabled() ? -1 : 0',
|
|
2032
|
+
'(click)': 'toggle()',
|
|
2033
|
+
'(keydown.arrowdown)': 'open(); $event.preventDefault()',
|
|
2034
|
+
'(keydown.space)': 'open(); $event.preventDefault()',
|
|
2035
|
+
'(keydown.enter)': 'open(); $event.preventDefault()',
|
|
2036
|
+
}, template: "@if (leftIcon()) {\n <ga-icon [icon]=\"leftIcon()\" />\n}\n@if (selectComponent.isOpen()) {\n <input\n #inputSearch\n type=\"text\"\n class=\"ga-select__input\"\n aria-autocomplete=\"list\"\n [value]=\"textValue()\"\n (input)=\"textValue.set(inputSearch.value)\"\n (click)=\"$event.stopPropagation()\"\n [attr.aria-expanded]=\"selectComponent.isOpen()\"\n [attr.aria-controls]=\"selectComponent.listboxId()\"\n [attr.aria-activedescendant]=\"selectComponent.activeDescendantId()\"\n [placeholder]=\"selectComponent.placeholder()\"\n (keydown)=\"onInputKeyDown($event)\"\n tabindex=\"-1\"\n />\n} @else if (selectComponent.hasValue()) {\n <div class=\"ga-select__value\">\n <span #ngContent (cdkObserveContent)=\"checkIfHasCustomLabel()\">\n <ng-content />\n </span>\n @if (!hasCustomLabel()) {\n <ga-select-value />\n }\n </div>\n} @else {\n <div class=\"ga-select__placeholder\">\n {{ selectComponent.placeholder() }}\n </div>\n}\n<ga-icon [icon]=\"menuStatusIcon()\" />\n" }]
|
|
2037
|
+
}], ctorParameters: () => [] });
|
|
2038
|
+
|
|
2039
|
+
const GA_SELECT_REQUIRED_VALIDATOR = {
|
|
2040
|
+
provide: NG_VALIDATORS,
|
|
2041
|
+
useExisting: forwardRef(() => GaSelectRequiredValidator),
|
|
2042
|
+
multi: true,
|
|
2043
|
+
};
|
|
2044
|
+
class GaSelectRequiredValidator extends RequiredValidator {
|
|
2045
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectRequiredValidator, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2046
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: GaSelectRequiredValidator, isStandalone: true, selector: "ga-select[required][formControlName], ga-select[required][formControl], ga-select[required][ngModel]", providers: [GA_SELECT_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });
|
|
2047
|
+
}
|
|
2048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectRequiredValidator, decorators: [{
|
|
2049
|
+
type: Directive,
|
|
2050
|
+
args: [{
|
|
2051
|
+
selector: `ga-select[required][formControlName], ga-select[required][formControl], ga-select[required][ngModel]`,
|
|
2052
|
+
providers: [GA_SELECT_REQUIRED_VALIDATOR],
|
|
2053
|
+
}]
|
|
2054
|
+
}] });
|
|
2055
|
+
|
|
2056
|
+
class GaSelectModule {
|
|
2057
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2058
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
|
|
2059
|
+
GaOptionComponent,
|
|
2060
|
+
GaOptgroupComponent,
|
|
2061
|
+
GaSelectContentComponent,
|
|
2062
|
+
GaSelectCustomTriggerComponent,
|
|
2063
|
+
GaSelectTriggerComponent,
|
|
2064
|
+
GaSelectComboboxTriggerComponent,
|
|
2065
|
+
GaSelectContentLoadingComponent,
|
|
2066
|
+
GaSelectRequiredValidator], exports: [GaSelectComponent,
|
|
2067
|
+
GaOptionComponent,
|
|
2068
|
+
GaOptgroupComponent,
|
|
2069
|
+
GaSelectContentComponent,
|
|
2070
|
+
GaSelectCustomTriggerComponent,
|
|
2071
|
+
GaSelectComboboxTriggerComponent,
|
|
2072
|
+
GaSelectTriggerComponent,
|
|
2073
|
+
GaSelectContentLoadingComponent,
|
|
2074
|
+
GaSelectRequiredValidator] });
|
|
2075
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, imports: [GaSelectComponent,
|
|
2076
|
+
GaOptionComponent,
|
|
2077
|
+
GaSelectTriggerComponent,
|
|
2078
|
+
GaSelectComboboxTriggerComponent] });
|
|
2079
|
+
}
|
|
2080
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: GaSelectModule, decorators: [{
|
|
2081
|
+
type: NgModule,
|
|
2082
|
+
args: [{
|
|
2083
|
+
imports: [
|
|
2084
|
+
GaSelectComponent,
|
|
2085
|
+
GaOptionComponent,
|
|
2086
|
+
GaOptgroupComponent,
|
|
2087
|
+
GaSelectContentComponent,
|
|
2088
|
+
GaSelectCustomTriggerComponent,
|
|
2089
|
+
GaSelectTriggerComponent,
|
|
2090
|
+
GaSelectComboboxTriggerComponent,
|
|
2091
|
+
GaSelectContentLoadingComponent,
|
|
2092
|
+
GaSelectRequiredValidator,
|
|
2093
|
+
],
|
|
2094
|
+
exports: [
|
|
2095
|
+
GaSelectComponent,
|
|
2096
|
+
GaOptionComponent,
|
|
2097
|
+
GaOptgroupComponent,
|
|
2098
|
+
GaSelectContentComponent,
|
|
2099
|
+
GaSelectCustomTriggerComponent,
|
|
2100
|
+
GaSelectComboboxTriggerComponent,
|
|
2101
|
+
GaSelectTriggerComponent,
|
|
2102
|
+
GaSelectContentLoadingComponent,
|
|
2103
|
+
GaSelectRequiredValidator,
|
|
2104
|
+
],
|
|
2105
|
+
}]
|
|
2106
|
+
}] });
|
|
2107
|
+
|
|
1492
2108
|
/*
|
|
1493
2109
|
* Public API Surface of ngx-gaia
|
|
1494
2110
|
*/
|
|
@@ -1497,5 +2113,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
1497
2113
|
* Generated bundle index. Do not edit.
|
|
1498
2114
|
*/
|
|
1499
2115
|
|
|
1500
|
-
export { CHECKBOX_CONTROL_VALUE_ACCESSOR, GA_ALERT_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_FORM_CONTROL, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormFieldComponent, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlModule, GaSpinnerComponent, GaSpinnerModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, provideGaAlertI18n };
|
|
2116
|
+
export { CHECKBOX_CONTROL_VALUE_ACCESSOR, GA_ALERT_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_FORM_CONTROL, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormFieldComponent, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlModule, GaSelectComboboxTriggerComponent, GaSelectComponent, GaSelectContentComponent, GaSelectContentLoadingComponent, GaSelectCustomTriggerComponent, GaSelectModule, GaSelectRequiredValidator, GaSelectTriggerComponent, GaSpinnerComponent, GaSpinnerModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, provideGaAlertI18n };
|
|
1501
2117
|
//# sourceMappingURL=vsn-ux-ngx-gaia.mjs.map
|