@cute-widgets/base 20.0.1 → 20.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/core/directives/index.d.ts +1 -1
- package/fesm2022/cute-widgets-base-core-directives.mjs +1 -1
- package/fesm2022/cute-widgets-base-core-directives.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-core.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-select.mjs +132 -94
- package/fesm2022/cute-widgets-base-select.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-sort.mjs +4 -4
- package/fesm2022/cute-widgets-base-sort.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-table.mjs +16 -13
- package/fesm2022/cute-widgets-base-table.mjs.map +1 -1
- package/fesm2022/cute-widgets-base-tree.mjs +11 -2
- package/fesm2022/cute-widgets-base-tree.mjs.map +1 -1
- package/fesm2022/cute-widgets-base.mjs +1 -3
- package/fesm2022/cute-widgets-base.mjs.map +1 -1
- package/package.json +16 -17
- package/select/index.d.ts +21 -44
- package/sort/index.d.ts +4 -4
- package/table/index.d.ts +16 -13
- package/tree/index.d.ts +5 -0
- package/cute-widgets-base-20.0.1.tgz +0 -0
|
@@ -1,58 +1,21 @@
|
|
|
1
1
|
import { LiveAnnouncer, removeAriaReferencedId, addAriaReferencedId, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
2
2
|
import { Directionality } from '@angular/cdk/bidi';
|
|
3
3
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
4
|
-
import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, hasModifierKey, A } from '@angular/cdk/keycodes';
|
|
5
|
-
import {
|
|
4
|
+
import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, hasModifierKey, A, ESCAPE } from '@angular/cdk/keycodes';
|
|
5
|
+
import { createRepositionScrollStrategy, CdkOverlayOrigin, CdkConnectedOverlay } from '@angular/cdk/overlay';
|
|
6
6
|
import { ViewportRuler } from '@angular/cdk/scrolling';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { InjectionToken, inject, isDevMode, NgZone, EventEmitter, HostAttributeToken, booleanAttribute, numberAttribute, Output, Input, ViewChild, ContentChild, ContentChildren, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive, NgModule } from '@angular/core';
|
|
8
|
+
import { InjectionToken, inject, Injector, isDevMode, NgZone, EventEmitter, HostAttributeToken, booleanAttribute, numberAttribute, Output, Input, ViewChild, ContentChild, ContentChildren, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive, NgModule } from '@angular/core';
|
|
9
9
|
import { Validators, NgControl, NgForm, FormGroupDirective } from '@angular/forms';
|
|
10
10
|
import { NgClass, CommonModule } from '@angular/common';
|
|
11
11
|
import { Subject, defer, merge } from 'rxjs';
|
|
12
|
-
import { startWith, switchMap, take, filter, map,
|
|
13
|
-
import { trigger, state, transition, style, animate, query, animateChild } from '@angular/animations';
|
|
12
|
+
import { startWith, switchMap, take, filter, map, takeUntil } from 'rxjs/operators';
|
|
14
13
|
import { _countGroupLabelsBeforeOption, _getOptionScrollPosition, CuteOption, CUTE_OPTGROUP, CUTE_OPTION_PARENT_COMPONENT, CuteOptgroup } from '@cute-widgets/base/core/option';
|
|
15
14
|
import { CUTE_FORM_FIELD, CuteFormFieldControl } from '@cute-widgets/base/form-field';
|
|
16
15
|
import { ErrorStateMatcher, _ErrorStateTracker } from '@cute-widgets/base/core/error';
|
|
17
16
|
import { CuteInputDropdownControl } from '@cute-widgets/base/abstract';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @license Apache-2.0
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
|
|
23
|
-
*
|
|
24
|
-
* You may not use this file except in compliance with the License
|
|
25
|
-
* that can be found at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* The following are all the animations for the mat-select component, with each
|
|
29
|
-
* const containing the metadata for one animation.
|
|
30
|
-
*
|
|
31
|
-
* The values below match the implementation of the AngularJS Material mat-select animation.
|
|
32
|
-
* @docs-private
|
|
33
|
-
*/
|
|
34
|
-
const cuteSelectAnimations = {
|
|
35
|
-
/**
|
|
36
|
-
* This animation ensures the select's overlay panel animation (transformPanel) is called when
|
|
37
|
-
* closing the select.
|
|
38
|
-
* This is needed due to https://github.com/angular/angular/issues/23302
|
|
39
|
-
*/
|
|
40
|
-
transformPanelWrap: trigger('transformPanelWrap', [
|
|
41
|
-
transition('* => void', query('@transformPanel', [animateChild()], { optional: true })),
|
|
42
|
-
]),
|
|
43
|
-
/** This animation transforms the select's overlay panel on and off the page. */
|
|
44
|
-
transformPanel: trigger('transformPanel', [
|
|
45
|
-
state('void', style({
|
|
46
|
-
opacity: 0,
|
|
47
|
-
transform: 'scale(1, 0.8)',
|
|
48
|
-
})),
|
|
49
|
-
transition('void => showing', animate('120ms cubic-bezier(0, 0, 0.2, 1)', style({
|
|
50
|
-
opacity: 1,
|
|
51
|
-
transform: 'scale(1, 1)',
|
|
52
|
-
}))),
|
|
53
|
-
transition('* => void', animate('100ms linear', style({ opacity: 0 }))),
|
|
54
|
-
]),
|
|
55
|
-
};
|
|
17
|
+
import { _animationsDisabled } from '@cute-widgets/base/core';
|
|
18
|
+
import { _getEventTarget } from '@angular/cdk/platform';
|
|
56
19
|
|
|
57
20
|
/**
|
|
58
21
|
* @license Apache-2.0
|
|
@@ -105,22 +68,12 @@ let nextUniqueId = 0;
|
|
|
105
68
|
const CUTE_SELECT_SCROLL_STRATEGY = new InjectionToken('cute-select-scroll-strategy', {
|
|
106
69
|
providedIn: 'root',
|
|
107
70
|
factory: () => {
|
|
108
|
-
const
|
|
109
|
-
return () =>
|
|
71
|
+
const injector = inject(Injector);
|
|
72
|
+
return () => createRepositionScrollStrategy(injector);
|
|
110
73
|
},
|
|
111
74
|
});
|
|
112
|
-
/** @docs-private */
|
|
113
|
-
function CUTE_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
|
|
114
|
-
return () => overlay.scrollStrategies.reposition();
|
|
115
|
-
}
|
|
116
75
|
/** Injection token that can be used to provide the default options the select module. */
|
|
117
76
|
const CUTE_SELECT_CONFIG = new InjectionToken('CUTE_SELECT_CONFIG');
|
|
118
|
-
/** @docs-private */
|
|
119
|
-
const CUTE_SELECT_SCROLL_STRATEGY_PROVIDER = {
|
|
120
|
-
provide: CUTE_SELECT_SCROLL_STRATEGY,
|
|
121
|
-
deps: [Overlay],
|
|
122
|
-
useFactory: CUTE_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY,
|
|
123
|
-
};
|
|
124
77
|
/**
|
|
125
78
|
* Injection token that can be used to reference instances of `CuteSelectTrigger`. It serves as
|
|
126
79
|
* an alternative token to the actual `CuteSelectTrigger` class which could cause unnecessary
|
|
@@ -139,6 +92,15 @@ class CuteSelectChange {
|
|
|
139
92
|
}
|
|
140
93
|
}
|
|
141
94
|
class CuteSelect extends CuteInputDropdownControl {
|
|
95
|
+
get bsColorVarName() {
|
|
96
|
+
if (this.color) {
|
|
97
|
+
if (this.color == "link") {
|
|
98
|
+
return `--bs-${this.color}-color-rgb`;
|
|
99
|
+
}
|
|
100
|
+
return `--bs-${this.color}-rgb`;
|
|
101
|
+
}
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
142
104
|
/** Scrolls a particular option into the view. */
|
|
143
105
|
_scrollOptionIntoView(index) {
|
|
144
106
|
const option = this.options?.toArray()[index];
|
|
@@ -259,6 +221,8 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
259
221
|
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
260
222
|
this._liveAnnouncer = inject(LiveAnnouncer);
|
|
261
223
|
this._defaultOptions = inject(CUTE_SELECT_CONFIG, { optional: true });
|
|
224
|
+
this._animationsDisabled = _animationsDisabled();
|
|
225
|
+
this._initialized = new Subject();
|
|
262
226
|
/**
|
|
263
227
|
* This position config ensures that the top "start" corner of the overlay
|
|
264
228
|
* is aligned with the top "start" of the origin by default (overlapping
|
|
@@ -344,7 +308,7 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
344
308
|
* By default, selecting an option with a `null` or `undefined` value will reset the select's
|
|
345
309
|
* value. Enable this option if the reset behavior doesn't match your requirements and instead,
|
|
346
310
|
* the nullable options should become selected. The value of this input can be controlled app-wide
|
|
347
|
-
* using the `
|
|
311
|
+
* using the `CUTE_SELECT_CONFIG` injection token.
|
|
348
312
|
*/
|
|
349
313
|
this.canSelectNullableOptions = this._defaultOptions?.canSelectNullableOptions ?? false;
|
|
350
314
|
/** Combined stream of all of the child options' change events. */
|
|
@@ -422,12 +386,6 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
422
386
|
super.ngOnInit();
|
|
423
387
|
this._selectionModel = new SelectionModel(this.multiple);
|
|
424
388
|
this.stateChanges.next();
|
|
425
|
-
// We need `distinctUntilChanged` here, because some browsers will
|
|
426
|
-
// fire the animation end event twice for the same animation. See:
|
|
427
|
-
// https://github.com/angular/angular/issues/24084
|
|
428
|
-
this._panelDoneAnimatingStream
|
|
429
|
-
.pipe(distinctUntilChanged(), takeUntil(this._destroy))
|
|
430
|
-
.subscribe(() => this._panelDoneAnimating(this.panelOpen));
|
|
431
389
|
this._viewportRuler
|
|
432
390
|
.change()
|
|
433
391
|
.pipe(takeUntil(this._destroy))
|
|
@@ -440,6 +398,8 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
440
398
|
}
|
|
441
399
|
ngAfterContentInit() {
|
|
442
400
|
super.ngAfterContentInit();
|
|
401
|
+
this._initialized.next();
|
|
402
|
+
this._initialized.complete();
|
|
443
403
|
this._initKeyManager();
|
|
444
404
|
this._selectionModel?.changed.pipe(takeUntil(this._destroy)).subscribe(event => {
|
|
445
405
|
event.added.forEach(option => option.select());
|
|
@@ -492,6 +452,7 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
492
452
|
}
|
|
493
453
|
ngOnDestroy() {
|
|
494
454
|
super.ngOnDestroy();
|
|
455
|
+
this._cleanupDetach?.();
|
|
495
456
|
this._keyManager?.destroy();
|
|
496
457
|
this._destroy.next();
|
|
497
458
|
this._destroy.complete();
|
|
@@ -504,22 +465,31 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
504
465
|
}
|
|
505
466
|
/** Opens the overlay panel. */
|
|
506
467
|
open() {
|
|
468
|
+
if (!this._canOpen()) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
507
471
|
// It's important that we read this as late as possible, because doing so earlier will
|
|
508
472
|
// return a different element since it's based on queries in the form field which may
|
|
509
473
|
// not have run yet. Also, this needs to be assigned before we measure the overlay width.
|
|
510
474
|
if (this._parentFormField) {
|
|
511
475
|
this._preferredOverlayOrigin = this._parentFormField.getConnectedOverlayOrigin();
|
|
512
476
|
}
|
|
477
|
+
this._cleanupDetach?.();
|
|
513
478
|
this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this.
|
|
518
|
-
this.
|
|
519
|
-
|
|
520
|
-
|
|
479
|
+
this._applyModalPanelOwnership();
|
|
480
|
+
this._panelOpen = true;
|
|
481
|
+
this._overlayDir?.positionChange.pipe(take(1)).subscribe(() => {
|
|
482
|
+
this._changeDetectorRef.detectChanges();
|
|
483
|
+
this._positioningSettled();
|
|
484
|
+
});
|
|
485
|
+
this._overlayDir?.attachOverlay();
|
|
486
|
+
this._keyManager?.withHorizontalOrientation(null);
|
|
487
|
+
this._highlightCorrectOption();
|
|
488
|
+
this.markForCheck();
|
|
521
489
|
// Required for the MDC form field to pick up when the overlay has been opened.
|
|
522
490
|
this.stateChanges.next();
|
|
491
|
+
// Simulate the animation event before we moved away from `@angular/animations`.
|
|
492
|
+
Promise.resolve().then(() => this.openedChange.emit(true));
|
|
523
493
|
}
|
|
524
494
|
/**
|
|
525
495
|
* If the autocomplete trigger is inside of an `aria-modal` element, connect
|
|
@@ -573,14 +543,53 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
573
543
|
close() {
|
|
574
544
|
if (this._panelOpen) {
|
|
575
545
|
this._panelOpen = false;
|
|
546
|
+
this._exitAndDetach();
|
|
576
547
|
this._keyManager?.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr');
|
|
577
548
|
this.markForCheck();
|
|
578
549
|
this._onTouched();
|
|
550
|
+
// Required for the MDC form field to pick up when the overlay has been closed.
|
|
551
|
+
this.stateChanges.next();
|
|
552
|
+
// Simulate the animation event before we moved away from `@angular/animations`.
|
|
553
|
+
Promise.resolve().then(() => this.openedChange.emit(false));
|
|
579
554
|
}
|
|
580
555
|
this.focus();
|
|
581
556
|
// Required for the MDC form field to pick up when the overlay has been closed.
|
|
582
557
|
this.stateChanges.next();
|
|
583
558
|
}
|
|
559
|
+
/** Triggers the exit animation and detaches the overlay at the end. */
|
|
560
|
+
_exitAndDetach() {
|
|
561
|
+
if (this._animationsDisabled || !this.panel) {
|
|
562
|
+
this._detachOverlay();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
this._cleanupDetach?.();
|
|
566
|
+
this._cleanupDetach = () => {
|
|
567
|
+
cleanupEvent();
|
|
568
|
+
clearTimeout(exitFallbackTimer);
|
|
569
|
+
this._cleanupDetach = undefined;
|
|
570
|
+
};
|
|
571
|
+
const panel = this.panel.nativeElement;
|
|
572
|
+
const cleanupEvent = this._renderer.listen(panel, 'animationend', (event) => {
|
|
573
|
+
if (event.animationName === '_cute-select-exit') {
|
|
574
|
+
this._cleanupDetach?.();
|
|
575
|
+
this._detachOverlay();
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
// Since closing the overlay depends on the animation, we have a fallback in case the panel
|
|
579
|
+
// doesn't animate. This can happen in some internal tests that do `* {animation: none}`.
|
|
580
|
+
const exitFallbackTimer = setTimeout(() => {
|
|
581
|
+
this._cleanupDetach?.();
|
|
582
|
+
this._detachOverlay();
|
|
583
|
+
}, 200);
|
|
584
|
+
panel.classList.add('cute-select-panel-exit');
|
|
585
|
+
}
|
|
586
|
+
/** Detaches the current overlay directive. */
|
|
587
|
+
_detachOverlay() {
|
|
588
|
+
this._overlayDir?.detachOverlay();
|
|
589
|
+
// Some of the overlay detachment logic depends on change detection.
|
|
590
|
+
// Mark for check to ensure that things get picked up in a timely manner.
|
|
591
|
+
this.markForCheck();
|
|
592
|
+
}
|
|
584
593
|
/**
|
|
585
594
|
* Sets the select' value. Part of the ControlValueAccessor interface
|
|
586
595
|
* required to integrate with Angular core forms API.
|
|
@@ -695,6 +704,17 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
695
704
|
}
|
|
696
705
|
}
|
|
697
706
|
}
|
|
707
|
+
/** Handles keyboard events coming from the overlay. */
|
|
708
|
+
_handleOverlayKeydown(event) {
|
|
709
|
+
// TODO(crisbeto): prior to #30363 this was being handled inside the overlay directive, but we
|
|
710
|
+
// need control over the animation timing so we do it manually. We should remove the `keydown`
|
|
711
|
+
// listener from `.cute-select-panel` and handle all the events here. That may cause
|
|
712
|
+
// further test breakages so it's left for a follow-up.
|
|
713
|
+
if (event.keyCode === ESCAPE && !hasModifierKey(event)) {
|
|
714
|
+
event.preventDefault();
|
|
715
|
+
this.close();
|
|
716
|
+
}
|
|
717
|
+
}
|
|
698
718
|
_onFocus() {
|
|
699
719
|
if (!this.disabled) {
|
|
700
720
|
this._focused = true;
|
|
@@ -714,15 +734,6 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
714
734
|
this.stateChanges.next();
|
|
715
735
|
}
|
|
716
736
|
}
|
|
717
|
-
/**
|
|
718
|
-
* Callback that is invoked when the overlay panel has been attached.
|
|
719
|
-
*/
|
|
720
|
-
_onAttached() {
|
|
721
|
-
this._overlayDir?.positionChange.pipe(take(1)).subscribe(() => {
|
|
722
|
-
this._changeDetectorRef.detectChanges();
|
|
723
|
-
this._positioningSettled();
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
737
|
/** Returns the theme to be used on the panel. */
|
|
727
738
|
_getPanelTheme() {
|
|
728
739
|
return this._parentFormField ? `cute-${this._parentFormField.color}` : '';
|
|
@@ -1006,11 +1017,26 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
1006
1017
|
if (this.ariaLabelledby) {
|
|
1007
1018
|
value += ' ' + this.ariaLabelledby;
|
|
1008
1019
|
}
|
|
1020
|
+
// The value should not be used for the trigger's aria-labelledby,
|
|
1021
|
+
// but this currently "breaks" accessibility tests since they complain
|
|
1022
|
+
// there is no aria-labelledby. This is because they are not setting an
|
|
1023
|
+
// appropriate label on the form field or select.
|
|
1024
|
+
// TODO: remove this conditional after fixing clients by ensuring their
|
|
1025
|
+
// selects have a label applied.
|
|
1026
|
+
if (!value) {
|
|
1027
|
+
//value = this._valueId;
|
|
1028
|
+
value = this.inputId;
|
|
1029
|
+
}
|
|
1009
1030
|
return value;
|
|
1010
1031
|
}
|
|
1011
|
-
/**
|
|
1012
|
-
|
|
1013
|
-
|
|
1032
|
+
/**
|
|
1033
|
+
* Implemented as part of CuteFormFieldControl.
|
|
1034
|
+
* @docs-private
|
|
1035
|
+
*/
|
|
1036
|
+
get describedByIds() {
|
|
1037
|
+
const element = this._elementRef.nativeElement;
|
|
1038
|
+
const existingDescribedBy = element.getAttribute('aria-describedby');
|
|
1039
|
+
return existingDescribedBy?.split(' ') || [];
|
|
1014
1040
|
}
|
|
1015
1041
|
/**
|
|
1016
1042
|
* Implemented as part of CuteFormFieldControl.
|
|
@@ -1026,7 +1052,18 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
1026
1052
|
/**
|
|
1027
1053
|
* Implemented as part of CuteFormFieldControl.
|
|
1028
1054
|
*/
|
|
1029
|
-
onContainerClick() {
|
|
1055
|
+
onContainerClick(event) {
|
|
1056
|
+
const target = _getEventTarget(event);
|
|
1057
|
+
// Since the overlay is inside the form field, this handler can fire for interactions
|
|
1058
|
+
// with the container. Note that while it's redundant to select both for the popover
|
|
1059
|
+
// and select panel, we need to do it because it tests the clicks can occur after
|
|
1060
|
+
// the panel was detached from the popover.
|
|
1061
|
+
if (target &&
|
|
1062
|
+
(target.tagName === 'CUTE-OPTION' ||
|
|
1063
|
+
target.classList.contains('cdk-overlay-backdrop') ||
|
|
1064
|
+
target.closest('.cute-select-panel'))) {
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1030
1067
|
this.focus();
|
|
1031
1068
|
this.open();
|
|
1032
1069
|
}
|
|
@@ -1038,11 +1075,17 @@ class CuteSelect extends CuteInputDropdownControl {
|
|
|
1038
1075
|
// want the label to only float when there's a value.
|
|
1039
1076
|
return this.panelOpen || !this.empty || (this.focused && !!this.placeholder);
|
|
1040
1077
|
}
|
|
1078
|
+
/** `input` element gets focus. */
|
|
1079
|
+
onInputFocus(event) {
|
|
1080
|
+
const elem = event.target;
|
|
1081
|
+
// CWT: disable auto select input text
|
|
1082
|
+
elem.selectionStart = elem.selectionEnd;
|
|
1083
|
+
}
|
|
1041
1084
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSelect, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1042
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: CuteSelect, isStandalone: true, selector: "cute-select", inputs: { userAriaDescribedBy: ["aria-describedby", "userAriaDescribedBy"], panelClass: "panelClass", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute], placeholder: "placeholder", multiple: ["multiple", "multiple", booleanAttribute], disableOptionCentering: ["disableOptionCentering", "disableOptionCentering", booleanAttribute], compareWith: "compareWith", value: "value", errorStateMatcher: "errorStateMatcher", magnitude: "magnitude", typeaheadDebounceInterval: ["typeaheadDebounceInterval", "typeaheadDebounceInterval", numberAttribute], sortComparator: "sortComparator", panelWidth: "panelWidth", panelHeight: "panelHeight", canSelectNullableOptions: ["canSelectNullableOptions", "canSelectNullableOptions", booleanAttribute] }, outputs: { openedChange: "openedChange", _openedStream: "opened", _closedStream: "closed", selectionChange: "selectionChange", valueChange: "valueChange" }, host: { attributes: { "role": "combobox", "aria-autocomplete": "none", "aria-haspopup": "listbox"
|
|
1085
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: CuteSelect, isStandalone: true, selector: "cute-select", inputs: { userAriaDescribedBy: ["aria-describedby", "userAriaDescribedBy"], panelClass: "panelClass", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute], placeholder: "placeholder", multiple: ["multiple", "multiple", booleanAttribute], disableOptionCentering: ["disableOptionCentering", "disableOptionCentering", booleanAttribute], compareWith: "compareWith", value: "value", errorStateMatcher: "errorStateMatcher", magnitude: "magnitude", typeaheadDebounceInterval: ["typeaheadDebounceInterval", "typeaheadDebounceInterval", numberAttribute], sortComparator: "sortComparator", panelWidth: "panelWidth", panelHeight: "panelHeight", canSelectNullableOptions: ["canSelectNullableOptions", "canSelectNullableOptions", booleanAttribute] }, outputs: { openedChange: "openedChange", _openedStream: "opened", _closedStream: "closed", selectionChange: "selectionChange", valueChange: "valueChange" }, host: { attributes: { "role": "combobox", "aria-autocomplete": "none", "aria-haspopup": "listbox" }, listeners: { "keydown": "_handleKeydown($event)", "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "class.active": "focused", "class.cute-select-disabled": "disabled", "class.cute-select-invalid": "errorState", "class.cute-select-required": "required", "class.cute-select-empty": "empty", "class.cute-select-multiple": "multiple", "attr.id": "id", "attr.tabindex": "-1", "attr.aria-controls": "panelOpen ? id + \"-panel\" : null", "attr.aria-expanded": "panelOpen", "attr.aria-label": "ariaLabel || null", "attr.aria-required": "required", "attr.aria-disabled": "disabled", "attr.aria-invalid": "errorState", "attr.aria-activedescendant": "_getAriaActiveDescendant()" }, classAttribute: "cute-select" }, providers: [
|
|
1043
1086
|
{ provide: CuteFormFieldControl, useExisting: CuteSelect },
|
|
1044
1087
|
{ provide: CUTE_OPTION_PARENT_COMPONENT, useExisting: CuteSelect },
|
|
1045
|
-
], queries: [{ propertyName: "customTrigger", first: true, predicate: CUTE_SELECT_TRIGGER, descendants: true }, { propertyName: "options", predicate: CuteOption, descendants: true }, { propertyName: "optionGroups", predicate: CUTE_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }, { propertyName: "_overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true }], exportAs: ["cuteSelect"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div cdk-overlay-origin\r\n class=\"cute-select-trigger-wrapper\"\r\n [class.required]=\"required\"\r\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\r\n>\r\n\r\n @if (!customTrigger) {\r\n <input #trigger\r\n class=\"form-select cute-select-trigger__input\"\r\n [class.form-select-sm]=\"magnitude=='small'\"\r\n [class.form-select-lg]=\"magnitude=='large'\"\r\n [attr.id]=\"inputId\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n readonly\r\n [value]=\"triggerValue\"\r\n (click)=\"toggle()\"\r\n autocomplete=\"off\">\r\n } @else {\r\n <div #trigger\r\n class=\"form-select cute-select-trigger__custom\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [attr.id]=\"inputId\">\r\n <ng-content select=\"cute-select-trigger\"></ng-content>\r\n </div>\r\n }\r\n\r\n</div>\r\n\r\n<ng-template cdk-connected-overlay\r\n cdkConnectedOverlayHasBackdrop\r\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\r\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\r\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\r\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\r\n [cdkConnectedOverlayOpen]=\"panelOpen\"\r\n [cdkConnectedOverlayPositions]=\"_positions\"\r\n [cdkConnectedOverlayWidth]=\"_overlayWidth!\"\r\n (backdropClick)=\"close()\"\r\n (
|
|
1088
|
+
], queries: [{ propertyName: "customTrigger", first: true, predicate: CUTE_SELECT_TRIGGER, descendants: true }, { propertyName: "options", predicate: CuteOption, descendants: true }, { propertyName: "optionGroups", predicate: CUTE_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }, { propertyName: "_overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true }], exportAs: ["cuteSelect"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div cdk-overlay-origin\r\n class=\"cute-select-trigger-wrapper\"\r\n [class.required]=\"required\"\r\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\r\n>\r\n\r\n @if (!customTrigger) {\r\n <input #trigger\r\n class=\"form-select cute-select-trigger__input\"\r\n [class.form-select-sm]=\"magnitude=='small'\"\r\n [class.form-select-lg]=\"magnitude=='large'\"\r\n [style.--bs-focus-ring-color]='color? \"rgba(var(\"+bsColorVarName+\"), var(--bs-focus-ring-opacity))\" : null'\r\n [attr.id]=\"inputId\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n readonly\r\n [value]=\"triggerValue\"\r\n (click)=\"toggle()\"\r\n (focus)=\"onInputFocus($event)\"\r\n autocomplete=\"off\"\r\n >\r\n <!-- Prevents selection -->\r\n <!-- (mousedown)=\"$event.preventDefault()\"-->\r\n } @else {\r\n <div #trigger\r\n class=\"form-select cute-select-trigger__custom\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [attr.id]=\"inputId\">\r\n <ng-content select=\"cute-select-trigger\"></ng-content>\r\n </div>\r\n }\r\n\r\n</div>\r\n\r\n<ng-template cdk-connected-overlay\r\n cdkConnectedOverlayHasBackdrop\r\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\r\n [cdkConnectedOverlayDisableClose]=\"true\"\r\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\r\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\r\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\r\n [cdkConnectedOverlayOpen]=\"panelOpen\"\r\n [cdkConnectedOverlayPositions]=\"_positions\"\r\n [cdkConnectedOverlayWidth]=\"_overlayWidth!\"\r\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\r\n (backdropClick)=\"close()\"\r\n (overlayKeydown)=\"_handleOverlayKeydown($event)\"\r\n (detach)=\"close()\"> <!-- cdkConnectedOverlayLockPosition -->\r\n <div #panel\r\n role=\"listbox\"\r\n tabindex=\"-1\"\r\n class=\"cute-dropdown-overlay-content bg-body-tertiary shadow\"\r\n [class.cute-select-panel-animations-enabled]=\"!_animationsDisabled\"\r\n [style.max-height]=\"panelHeight || null\"\r\n [attr.id]=\"id + '-panel'\"\r\n [attr.aria-multiselectable]=\"multiple\"\r\n [attr.aria-label]=\"ariaLabel || null\"\r\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby()\"\r\n [ngClass]=\"panelClass\"\r\n (keydown)=\"_handleKeydown($event)\">\r\n <div class=\"cute-dropdown-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <!--<ng-template [cdkPortalOutlet]=\"_portal\"></ng-template>-->\r\n </div>\r\n</ng-template>\r\n\r\n", styles: [".cute-select{display:inline-block;width:100%;outline:none}.cute-dropdown-overlay-content{display:block;width:100%;max-height:272px;overflow-y:auto;padding:var(--cute-select-padding-y, .5rem) 0;font-size:var(--bs-body-font-size);color:var(--bs-body-color);text-align:start;list-style:none;background-color:var(--bs-body-bg);border:var(--bs-border-width) solid var(--bs-border-color-translucent);border-radius:var(--bs-border-radius)}.cute-dropdown-overlay-content .cute-dropdown-content{overflow:auto;height:100%}.cute-dropdown-overlay-content .cute-dropdown-content .cute-option:hover:not(.disabled){background-color:var(--bs-secondary-bg)}.cute-select-trigger__input,.cute-select-trigger__custom{position:relative;cursor:pointer;user-select:none;-webkit-user-select:none}.cute-select-trigger__input:disabled,.cute-select-trigger__custom:disabled{cursor:auto;opacity:.65}[dir=rtl] .cute-select-trigger__input.form-select,[dir=rtl] .cute-select-trigger__custom.form-select{padding:.375rem .75rem .375rem 2.25rem;background-position:left .75rem center}cute-select-trigger{display:inline-block;-webkit-user-select:none;user-select:none}.cute-select-panel-animations-enabled{animation:_cute-select-enter .12s cubic-bezier(0,0,.2,1)}.cute-select-panel-animations-enabled.cute-select-panel-exit{animation:_cute-select-exit .1s linear}@keyframes _cute-select-enter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:none}}@keyframes _cute-select-exit{0%{opacity:1}to{opacity:0}}\n"], dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: 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: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1046
1089
|
}
|
|
1047
1090
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSelect, decorators: [{
|
|
1048
1091
|
type: Component,
|
|
@@ -1066,14 +1109,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1066
1109
|
'[attr.aria-disabled]': 'disabled',
|
|
1067
1110
|
'[attr.aria-invalid]': 'errorState',
|
|
1068
1111
|
'[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
|
|
1069
|
-
'ngSkipHydration': '',
|
|
1070
1112
|
'(keydown)': '_handleKeydown($event)',
|
|
1071
1113
|
'(focus)': '_onFocus()',
|
|
1072
1114
|
'(blur)': '_onBlur()',
|
|
1073
|
-
|
|
1115
|
+
//'ngSkipHydration': '',
|
|
1116
|
+
}, providers: [
|
|
1074
1117
|
{ provide: CuteFormFieldControl, useExisting: CuteSelect },
|
|
1075
1118
|
{ provide: CUTE_OPTION_PARENT_COMPONENT, useExisting: CuteSelect },
|
|
1076
|
-
], imports: [CdkOverlayOrigin, CdkConnectedOverlay, NgClass], template: "<div cdk-overlay-origin\r\n class=\"cute-select-trigger-wrapper\"\r\n [class.required]=\"required\"\r\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\r\n>\r\n\r\n @if (!customTrigger) {\r\n <input #trigger\r\n class=\"form-select cute-select-trigger__input\"\r\n [class.form-select-sm]=\"magnitude=='small'\"\r\n [class.form-select-lg]=\"magnitude=='large'\"\r\n [attr.id]=\"inputId\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n readonly\r\n [value]=\"triggerValue\"\r\n (click)=\"toggle()\"\r\n autocomplete=\"off\">\r\n } @else {\r\n <div #trigger\r\n class=\"form-select cute-select-trigger__custom\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [attr.id]=\"inputId\">\r\n <ng-content select=\"cute-select-trigger\"></ng-content>\r\n </div>\r\n }\r\n\r\n</div>\r\n\r\n<ng-template cdk-connected-overlay\r\n cdkConnectedOverlayHasBackdrop\r\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\r\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\r\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\r\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\r\n [cdkConnectedOverlayOpen]=\"panelOpen\"\r\n [cdkConnectedOverlayPositions]=\"_positions\"\r\n [cdkConnectedOverlayWidth]=\"_overlayWidth!\"\r\n (backdropClick)=\"close()\"\r\n (
|
|
1119
|
+
], imports: [CdkOverlayOrigin, CdkConnectedOverlay, NgClass], template: "<div cdk-overlay-origin\r\n class=\"cute-select-trigger-wrapper\"\r\n [class.required]=\"required\"\r\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\r\n>\r\n\r\n @if (!customTrigger) {\r\n <input #trigger\r\n class=\"form-select cute-select-trigger__input\"\r\n [class.form-select-sm]=\"magnitude=='small'\"\r\n [class.form-select-lg]=\"magnitude=='large'\"\r\n [style.--bs-focus-ring-color]='color? \"rgba(var(\"+bsColorVarName+\"), var(--bs-focus-ring-opacity))\" : null'\r\n [attr.id]=\"inputId\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\"\r\n readonly\r\n [value]=\"triggerValue\"\r\n (click)=\"toggle()\"\r\n (focus)=\"onInputFocus($event)\"\r\n autocomplete=\"off\"\r\n >\r\n <!-- Prevents selection -->\r\n <!-- (mousedown)=\"$event.preventDefault()\"-->\r\n } @else {\r\n <div #trigger\r\n class=\"form-select cute-select-trigger__custom\"\r\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n [attr.id]=\"inputId\">\r\n <ng-content select=\"cute-select-trigger\"></ng-content>\r\n </div>\r\n }\r\n\r\n</div>\r\n\r\n<ng-template cdk-connected-overlay\r\n cdkConnectedOverlayHasBackdrop\r\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\r\n [cdkConnectedOverlayDisableClose]=\"true\"\r\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\r\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\r\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\r\n [cdkConnectedOverlayOpen]=\"panelOpen\"\r\n [cdkConnectedOverlayPositions]=\"_positions\"\r\n [cdkConnectedOverlayWidth]=\"_overlayWidth!\"\r\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\r\n (backdropClick)=\"close()\"\r\n (overlayKeydown)=\"_handleOverlayKeydown($event)\"\r\n (detach)=\"close()\"> <!-- cdkConnectedOverlayLockPosition -->\r\n <div #panel\r\n role=\"listbox\"\r\n tabindex=\"-1\"\r\n class=\"cute-dropdown-overlay-content bg-body-tertiary shadow\"\r\n [class.cute-select-panel-animations-enabled]=\"!_animationsDisabled\"\r\n [style.max-height]=\"panelHeight || null\"\r\n [attr.id]=\"id + '-panel'\"\r\n [attr.aria-multiselectable]=\"multiple\"\r\n [attr.aria-label]=\"ariaLabel || null\"\r\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby()\"\r\n [ngClass]=\"panelClass\"\r\n (keydown)=\"_handleKeydown($event)\">\r\n <div class=\"cute-dropdown-content\">\r\n <ng-content></ng-content>\r\n </div>\r\n <!--<ng-template [cdkPortalOutlet]=\"_portal\"></ng-template>-->\r\n </div>\r\n</ng-template>\r\n\r\n", styles: [".cute-select{display:inline-block;width:100%;outline:none}.cute-dropdown-overlay-content{display:block;width:100%;max-height:272px;overflow-y:auto;padding:var(--cute-select-padding-y, .5rem) 0;font-size:var(--bs-body-font-size);color:var(--bs-body-color);text-align:start;list-style:none;background-color:var(--bs-body-bg);border:var(--bs-border-width) solid var(--bs-border-color-translucent);border-radius:var(--bs-border-radius)}.cute-dropdown-overlay-content .cute-dropdown-content{overflow:auto;height:100%}.cute-dropdown-overlay-content .cute-dropdown-content .cute-option:hover:not(.disabled){background-color:var(--bs-secondary-bg)}.cute-select-trigger__input,.cute-select-trigger__custom{position:relative;cursor:pointer;user-select:none;-webkit-user-select:none}.cute-select-trigger__input:disabled,.cute-select-trigger__custom:disabled{cursor:auto;opacity:.65}[dir=rtl] .cute-select-trigger__input.form-select,[dir=rtl] .cute-select-trigger__custom.form-select{padding:.375rem .75rem .375rem 2.25rem;background-position:left .75rem center}cute-select-trigger{display:inline-block;-webkit-user-select:none;user-select:none}.cute-select-panel-animations-enabled{animation:_cute-select-enter .12s cubic-bezier(0,0,.2,1)}.cute-select-panel-animations-enabled.cute-select-panel-exit{animation:_cute-select-exit .1s linear}@keyframes _cute-select-enter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:none}}@keyframes _cute-select-exit{0%{opacity:1}to{opacity:0}}\n"] }]
|
|
1077
1120
|
}], ctorParameters: () => [], propDecorators: { options: [{
|
|
1078
1121
|
type: ContentChildren,
|
|
1079
1122
|
args: [CuteOption, { descendants: true }]
|
|
@@ -1183,9 +1226,7 @@ class CuteSelectModule {
|
|
|
1183
1226
|
CuteSelectTrigger,
|
|
1184
1227
|
CuteOptgroup,
|
|
1185
1228
|
CuteOption] }); }
|
|
1186
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSelectModule,
|
|
1187
|
-
CUTE_SELECT_SCROLL_STRATEGY_PROVIDER
|
|
1188
|
-
], imports: [CommonModule, CuteOptgroup,
|
|
1229
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSelectModule, imports: [CommonModule, CuteOptgroup,
|
|
1189
1230
|
CuteOption] }); }
|
|
1190
1231
|
}
|
|
1191
1232
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSelectModule, decorators: [{
|
|
@@ -1193,9 +1234,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1193
1234
|
args: [{
|
|
1194
1235
|
imports: [CommonModule, ...TYPES],
|
|
1195
1236
|
exports: TYPES,
|
|
1196
|
-
providers: [
|
|
1197
|
-
CUTE_SELECT_SCROLL_STRATEGY_PROVIDER
|
|
1198
|
-
],
|
|
1199
1237
|
declarations: [],
|
|
1200
1238
|
}]
|
|
1201
1239
|
}] });
|
|
@@ -1204,5 +1242,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
1204
1242
|
* Generated bundle index. Do not edit.
|
|
1205
1243
|
*/
|
|
1206
1244
|
|
|
1207
|
-
export { CUTE_SELECT_CONFIG, CUTE_SELECT_SCROLL_STRATEGY,
|
|
1245
|
+
export { CUTE_SELECT_CONFIG, CUTE_SELECT_SCROLL_STRATEGY, CUTE_SELECT_TRIGGER, CuteSelect, CuteSelectChange, CuteSelectModule, CuteSelectTrigger };
|
|
1208
1246
|
//# sourceMappingURL=cute-widgets-base-select.mjs.map
|