@wizishop/angular-components 14.3.2 → 14.3.4
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/esm2020/lib/components/button/button.component.mjs +20 -5
- package/esm2020/lib/components/selects/option/option.component.mjs +11 -9
- package/esm2020/lib/components/selects/option/select-option.directive.mjs +3 -5
- package/esm2020/lib/components/selects/select-test/select.component.mjs +18 -12
- package/esm2020/lib/components/selects/select-test/value-change.service.mjs +36 -4
- package/fesm2015/wizishop-angular-components.mjs +82 -29
- package/fesm2015/wizishop-angular-components.mjs.map +1 -1
- package/fesm2020/wizishop-angular-components.mjs +80 -29
- package/fesm2020/wizishop-angular-components.mjs.map +1 -1
- package/lib/components/button/button.component.d.ts +5 -2
- package/lib/components/selects/option/option.component.d.ts +4 -4
- package/lib/components/selects/option/select-option.directive.d.ts +1 -2
- package/lib/components/selects/select-test/value-change.service.d.ts +7 -2
- package/package.json +24 -14
- package/wizishop-angular-components-14.3.4.tgz +0 -0
- package/wizishop-angular-components-14.3.2.tgz +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i1$2 from '@wizishop/ng-wizi-bulma';
|
|
2
2
|
import { NwbAllModule, NwbFilterGroup } from '@wizishop/ng-wizi-bulma';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Component, ViewEncapsulation, Input, EventEmitter, Directive, Output, HostListener, Injectable, InjectionToken, NgModule, Inject, Pipe, ContentChildren, ViewChild, ChangeDetectionStrategy, HostBinding, ContentChild } from '@angular/core';
|
|
4
|
+
import { Component, ViewEncapsulation, Input, EventEmitter, Directive, Output, HostListener, Injectable, InjectionToken, NgModule, Inject, Pipe, ContentChildren, Attribute, Optional, ViewChild, ChangeDetectionStrategy, HostBinding, ContentChild } from '@angular/core';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
7
7
|
import * as i2 from '@angular/forms';
|
|
8
|
-
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
8
|
+
import { NG_VALUE_ACCESSOR, FormsModule, FormGroupDirective, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import * as i4$1 from 'ngx-perfect-scrollbar';
|
|
10
10
|
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
|
|
11
11
|
import { Subject, merge, fromEvent, ReplaySubject, interval, takeUntil as takeUntil$1, startWith as startWith$1, map as map$1 } from 'rxjs';
|
|
@@ -20,7 +20,7 @@ import * as i4 from 'ngx-autosize';
|
|
|
20
20
|
import { AutosizeModule } from 'ngx-autosize';
|
|
21
21
|
import * as i2$1 from '@angular/router';
|
|
22
22
|
import { RouterModule } from '@angular/router';
|
|
23
|
-
import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, hasModifierKey, ESCAPE } from '@angular/cdk/keycodes';
|
|
23
|
+
import { DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW, ENTER, SPACE, hasModifierKey, ESCAPE, A, Z, ZERO, NINE } from '@angular/cdk/keycodes';
|
|
24
24
|
import * as i2$2 from 'ngx-scrollbar';
|
|
25
25
|
import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
26
26
|
import * as i3 from 'ngx-scrollbar/reached-event';
|
|
@@ -357,8 +357,6 @@ class SelectOptionDirective {
|
|
|
357
357
|
onClick() {
|
|
358
358
|
this.onSelectOption();
|
|
359
359
|
}
|
|
360
|
-
ngOnInit() {
|
|
361
|
-
}
|
|
362
360
|
onSelectOption() {
|
|
363
361
|
if (this.disabled) {
|
|
364
362
|
return;
|
|
@@ -384,11 +382,11 @@ class SelectOptionDirective {
|
|
|
384
382
|
}
|
|
385
383
|
}
|
|
386
384
|
SelectOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectOptionDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
387
|
-
SelectOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: SelectOptionDirective, selector: "[
|
|
385
|
+
SelectOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.7", type: SelectOptionDirective, selector: "[wacSelectOption]", inputs: { disabled: "disabled", value: "value", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "click": "onClick()" } }, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: SelectOptionDirective }], ngImport: i0 });
|
|
388
386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectOptionDirective, decorators: [{
|
|
389
387
|
type: Directive,
|
|
390
388
|
args: [{
|
|
391
|
-
selector: '[
|
|
389
|
+
selector: '[wacSelectOption]',
|
|
392
390
|
providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: SelectOptionDirective }]
|
|
393
391
|
}]
|
|
394
392
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onClick: [{
|
|
@@ -1100,7 +1098,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
|
|
|
1100
1098
|
}] } });
|
|
1101
1099
|
|
|
1102
1100
|
class ButtonComponent {
|
|
1103
|
-
constructor() {
|
|
1101
|
+
constructor(type, formGroup) {
|
|
1102
|
+
this.type = type;
|
|
1103
|
+
this.formGroup = formGroup;
|
|
1104
1104
|
// todo add button type (ex: for submit and check if it works with template driven forms)
|
|
1105
1105
|
this.extraClasses = 'is-info'; // todo make a list of existing class
|
|
1106
1106
|
this.label = '';
|
|
@@ -1174,6 +1174,9 @@ class ButtonComponent {
|
|
|
1174
1174
|
if (this.disabled) {
|
|
1175
1175
|
return;
|
|
1176
1176
|
}
|
|
1177
|
+
if (this.type === 'submit' && this.formGroup) { // Maybe there is a better way to handle submit
|
|
1178
|
+
this.formGroup.onSubmit(this.formGroup.value);
|
|
1179
|
+
}
|
|
1177
1180
|
if (this.hasLoader) {
|
|
1178
1181
|
this.isLoading = false;
|
|
1179
1182
|
setTimeout(() => {
|
|
@@ -1201,12 +1204,20 @@ class ButtonComponent {
|
|
|
1201
1204
|
}, 1000);
|
|
1202
1205
|
}
|
|
1203
1206
|
}
|
|
1204
|
-
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1207
|
+
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ButtonComponent, deps: [{ token: 'type', attribute: true }, { token: FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1205
1208
|
ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: ButtonComponent, selector: "wac-button", inputs: { extraClasses: "extraClasses", label: "label", icon: "icon", iconNext: "iconNext", textcolor: "textcolor", widthAuto: "widthAuto", contentHorizontalPosition: "contentHorizontalPosition", iconFontSize: "iconFontSize", hasLoader: "hasLoader", disabled: "disabled", whiteSpaceNowrap: "whiteSpaceNowrap", opacity: "opacity", animation: "animation", animationRight: "animationRight", animationText: "animationText", confirmDelete: "confirmDelete", confirmDeleteText: "confirmDeleteText", coin: "coin", tooltip: "tooltip", tooltipWidth: "tooltipWidth", noPadding: "noPadding", tooltipPosition: "tooltipPosition", tooltipOneline: "tooltipOneline", confirmDeletePosition: "confirmDeletePosition", isLoading: "isLoading" }, outputs: { click: "click", isLoadingChange: "isLoadingChange" }, viewQueries: [{ propertyName: "calculWidth", first: true, predicate: ["calculWidth"], descendants: true }, { propertyName: "calculWidthDelete", first: true, predicate: ["calculWidthDelete"], descendants: true }], ngImport: i0, template: "<a\n [class]=\"'wac-button ' + extraClasses\"\n (click)=\"confirmDelete && waitForConfirmDelete ? addMaxWidthDelete() : '';onButtonClick($event);\"\n (mouseleave)=\"animation ? resetMaxWidth() : '';\"\n (mouseenter)=\"animation ? addMaxWidth() : '';\"\n wzAutoHide (clickOutside)=\"confirmDelete && !waitForConfirmDelete ? resetMaxWidthDelete() : ''\"\n [ngClass]=\"[\n label === '' ? 'alone' : '',\n coin ? 'has-coin width-auto' : '',\n animationRight ? 'animation-right' : '',\n animation ? 'animationText' : '',\n isLoading ? 'is-loading' : '',\n opacity ? 'opacity' : '',\n disabled ? 'disabled' : '',\n widthAuto ? 'width-auto' : '',\n noPadding ? 'no-padding' : '',\n whiteSpaceNowrap ? 'white-space-no-wrap' : '',\n !waitForConfirmDelete && confirmDelete ? 'step-delete' : '',\n confirmDelete ? 'deletePosition-' + confirmDeletePosition : ''\n ]\"\n [ngStyle]=\"{\n 'text-align': contentHorizontalPosition\n }\"\n>\n <span class=\"wac-button__wrapper\" [style.color]=\"textcolor ? textcolor : ''\">\n <i *ngIf=\"icon\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n <span class=\"wac-button__animation\" [style.maxWidth]=\"buttonMaxWidth\" [style.width]=\"buttonWidth + 'px'\">\n <span #calculWidth class=\"wac-button__animation__text\" [innerHTML]=\"animationText\"></span>\n </span>\n <span class=\"wac-button__confirmDelete\" [style.maxWidth]=\"buttonMaxWidthDelete\" [style.width]=\"buttonWidthDelete + 'px'\">\n <span #calculWidthDelete class=\"wac-button__confirmDelete__text\" [innerHTML]=\"confirmDeleteText\"></span>\n </span>\n <span *ngIf=\"coin\" class=\"wac-button__coin\"><i class=\"fa-solid fa-coin-front\"></i><span [innerHTML]=\"coin\"></span></span>\n <span\n class=\"wac-button__loader\"\n [ngClass]=\"extraClasses.includes('is-outlined') ? 'outlined' : ''\"\n *ngIf=\"isLoading\"\n [style.width]=\"currentLoading + '%'\"\n >\n <span *ngIf=\"extraClasses.includes('is-outlined')\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n </span>\n <span class=\"wac-button__tooltips {{ tooltipPosition }}\" [ngClass]=\"{'oneline': tooltipOneline}\" [style.minWidth]=\"tooltipWidth\" *ngIf=\"tooltip\">\n {{ tooltip }}\n </span>\n</a>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }] });
|
|
1206
1209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
1207
1210
|
type: Component,
|
|
1208
1211
|
args: [{ selector: 'wac-button', template: "<a\n [class]=\"'wac-button ' + extraClasses\"\n (click)=\"confirmDelete && waitForConfirmDelete ? addMaxWidthDelete() : '';onButtonClick($event);\"\n (mouseleave)=\"animation ? resetMaxWidth() : '';\"\n (mouseenter)=\"animation ? addMaxWidth() : '';\"\n wzAutoHide (clickOutside)=\"confirmDelete && !waitForConfirmDelete ? resetMaxWidthDelete() : ''\"\n [ngClass]=\"[\n label === '' ? 'alone' : '',\n coin ? 'has-coin width-auto' : '',\n animationRight ? 'animation-right' : '',\n animation ? 'animationText' : '',\n isLoading ? 'is-loading' : '',\n opacity ? 'opacity' : '',\n disabled ? 'disabled' : '',\n widthAuto ? 'width-auto' : '',\n noPadding ? 'no-padding' : '',\n whiteSpaceNowrap ? 'white-space-no-wrap' : '',\n !waitForConfirmDelete && confirmDelete ? 'step-delete' : '',\n confirmDelete ? 'deletePosition-' + confirmDeletePosition : ''\n ]\"\n [ngStyle]=\"{\n 'text-align': contentHorizontalPosition\n }\"\n>\n <span class=\"wac-button__wrapper\" [style.color]=\"textcolor ? textcolor : ''\">\n <i *ngIf=\"icon\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n <span class=\"wac-button__animation\" [style.maxWidth]=\"buttonMaxWidth\" [style.width]=\"buttonWidth + 'px'\">\n <span #calculWidth class=\"wac-button__animation__text\" [innerHTML]=\"animationText\"></span>\n </span>\n <span class=\"wac-button__confirmDelete\" [style.maxWidth]=\"buttonMaxWidthDelete\" [style.width]=\"buttonWidthDelete + 'px'\">\n <span #calculWidthDelete class=\"wac-button__confirmDelete__text\" [innerHTML]=\"confirmDeleteText\"></span>\n </span>\n <span *ngIf=\"coin\" class=\"wac-button__coin\"><i class=\"fa-solid fa-coin-front\"></i><span [innerHTML]=\"coin\"></span></span>\n <span\n class=\"wac-button__loader\"\n [ngClass]=\"extraClasses.includes('is-outlined') ? 'outlined' : ''\"\n *ngIf=\"isLoading\"\n [style.width]=\"currentLoading + '%'\"\n >\n <span *ngIf=\"extraClasses.includes('is-outlined')\">\n <i *ngIf=\"icon !== ''\" [ngClass]=\"icon\" [style.font-size.px]=\"iconFontSize\"></i>\n {{ label }}\n <i *ngIf=\"iconNext !== ''\" [ngClass]=\"iconNext\" [style.font-size.px]=\"iconFontSize\"></i>\n </span>\n </span>\n <span class=\"wac-button__tooltips {{ tooltipPosition }}\" [ngClass]=\"{'oneline': tooltipOneline}\" [style.minWidth]=\"tooltipWidth\" *ngIf=\"tooltip\">\n {{ tooltip }}\n </span>\n</a>\n" }]
|
|
1209
|
-
}], ctorParameters: function () { return [
|
|
1212
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1213
|
+
type: Attribute,
|
|
1214
|
+
args: ['type']
|
|
1215
|
+
}] }, { type: i2.FormGroupDirective, decorators: [{
|
|
1216
|
+
type: Optional
|
|
1217
|
+
}, {
|
|
1218
|
+
type: Inject,
|
|
1219
|
+
args: [FormGroupDirective]
|
|
1220
|
+
}] }]; }, propDecorators: { extraClasses: [{
|
|
1210
1221
|
type: Input
|
|
1211
1222
|
}], label: [{
|
|
1212
1223
|
type: Input
|
|
@@ -4224,10 +4235,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
|
|
|
4224
4235
|
}] } });
|
|
4225
4236
|
|
|
4226
4237
|
class ValueChangeService {
|
|
4227
|
-
constructor() {
|
|
4238
|
+
constructor(changeDetectorRef) {
|
|
4239
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
4228
4240
|
this.valueChange$ = new Subject();
|
|
4229
4241
|
this.indexSelectedOption = null;
|
|
4230
4242
|
this.resetListeners$ = new Subject();
|
|
4243
|
+
this.indexOfMatchedOption = (option, index, letter) => {
|
|
4244
|
+
const textOption = option.getContentRef().nativeElement.textContent.trim().toLowerCase();
|
|
4245
|
+
return textOption.startsWith(letter) ? index : null;
|
|
4246
|
+
};
|
|
4247
|
+
this.isNotNull = (index) => {
|
|
4248
|
+
return index !== null;
|
|
4249
|
+
};
|
|
4250
|
+
this.highestAndClosestIndex = (index) => {
|
|
4251
|
+
if (isNaN(this.indexSelectedOption)) {
|
|
4252
|
+
return true;
|
|
4253
|
+
}
|
|
4254
|
+
if (index > this.indexSelectedOption) {
|
|
4255
|
+
return true;
|
|
4256
|
+
}
|
|
4257
|
+
return false;
|
|
4258
|
+
};
|
|
4231
4259
|
}
|
|
4232
4260
|
set value(value) {
|
|
4233
4261
|
this._value = value;
|
|
@@ -4252,6 +4280,7 @@ class ValueChangeService {
|
|
|
4252
4280
|
handleValueChange() {
|
|
4253
4281
|
this.changeSelectedOption();
|
|
4254
4282
|
this.updateSelectPlaceholder();
|
|
4283
|
+
this.changeDetectorRef.markForCheck();
|
|
4255
4284
|
}
|
|
4256
4285
|
selectNextOption() {
|
|
4257
4286
|
if (this.indexSelectedOption + 1 >= this.optionChildren.length) {
|
|
@@ -4274,6 +4303,20 @@ class ValueChangeService {
|
|
|
4274
4303
|
this.indexSelectedOption = this.indexSelectedOption - 1;
|
|
4275
4304
|
this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
|
|
4276
4305
|
}
|
|
4306
|
+
searchOptionByFirstLetter(letter) {
|
|
4307
|
+
const matchedOptionsIndex = this.optionChildren
|
|
4308
|
+
.map((option, index) => this.indexOfMatchedOption(option, index, letter))
|
|
4309
|
+
.filter(this.isNotNull);
|
|
4310
|
+
if (!matchedOptionsIndex.length) { // reset the selection
|
|
4311
|
+
this.indexSelectedOption = null;
|
|
4312
|
+
this.assignValue(null);
|
|
4313
|
+
return;
|
|
4314
|
+
}
|
|
4315
|
+
// find the next option after the current selected option, or the first option
|
|
4316
|
+
const validOptionIndex = matchedOptionsIndex.find(this.highestAndClosestIndex);
|
|
4317
|
+
this.indexSelectedOption = isNaN(validOptionIndex) ? matchedOptionsIndex[0] : validOptionIndex;
|
|
4318
|
+
this.assignValue(this.optionChildren.get(this.indexSelectedOption).value);
|
|
4319
|
+
}
|
|
4277
4320
|
handleInitialSelectedOption() {
|
|
4278
4321
|
setTimeout(() => {
|
|
4279
4322
|
if (!this.value) {
|
|
@@ -4329,11 +4372,11 @@ class ValueChangeService {
|
|
|
4329
4372
|
this.resetListeners$.complete();
|
|
4330
4373
|
}
|
|
4331
4374
|
}
|
|
4332
|
-
ValueChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4375
|
+
ValueChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4333
4376
|
ValueChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService });
|
|
4334
4377
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: ValueChangeService, decorators: [{
|
|
4335
4378
|
type: Injectable
|
|
4336
|
-
}], ctorParameters: function () { return []; } });
|
|
4379
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
4337
4380
|
|
|
4338
4381
|
class SelectSearchTriggerComponent {
|
|
4339
4382
|
constructor() {
|
|
@@ -4387,7 +4430,8 @@ class SelectTestComponent {
|
|
|
4387
4430
|
constructor(valueChangeService) {
|
|
4388
4431
|
this.valueChangeService = valueChangeService;
|
|
4389
4432
|
//! Refacto improve sroll on mobile, see with Pauline
|
|
4390
|
-
// todo handle
|
|
4433
|
+
// todo handle when user search with first letter from keyboard event
|
|
4434
|
+
// angular material select https://github.com/angular/components/blob/main/src/material/select/select.ts
|
|
4391
4435
|
this.role = 'combobox';
|
|
4392
4436
|
this.valueChange = new EventEmitter();
|
|
4393
4437
|
this.disabled = false;
|
|
@@ -4508,22 +4552,27 @@ class SelectTestComponent {
|
|
|
4508
4552
|
keyCode === LEFT_ARROW ||
|
|
4509
4553
|
keyCode === RIGHT_ARROW;
|
|
4510
4554
|
const isEscapeKey = keyCode === ESCAPE || keyCode === ENTER || keyCode === SPACE;
|
|
4555
|
+
const isTyping = (keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE);
|
|
4511
4556
|
if ((isArrowKey && event.altKey) || isEscapeKey) {
|
|
4512
4557
|
// Close the select on ALT + arrow key to match the native <select>
|
|
4513
4558
|
event.preventDefault();
|
|
4514
4559
|
this.openPanel = false;
|
|
4515
4560
|
return;
|
|
4516
4561
|
}
|
|
4517
|
-
if (
|
|
4562
|
+
else if (isArrowKey) {
|
|
4563
|
+
event.preventDefault(); // prevents the page from scrolling
|
|
4564
|
+
// select the next option on arrow key down
|
|
4565
|
+
if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
|
|
4566
|
+
this.valueChangeService.selectNextOption();
|
|
4567
|
+
return;
|
|
4568
|
+
}
|
|
4569
|
+
this.valueChangeService.selectPreviousOption();
|
|
4518
4570
|
return;
|
|
4519
4571
|
}
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
if (keyCode === DOWN_ARROW || keyCode === RIGHT_ARROW) {
|
|
4523
|
-
this.valueChangeService.selectNextOption();
|
|
4572
|
+
if (isTyping && !this.customSearchTrigger) {
|
|
4573
|
+
this.valueChangeService.searchOptionByFirstLetter(event.key);
|
|
4524
4574
|
return;
|
|
4525
4575
|
}
|
|
4526
|
-
this.valueChangeService.selectPreviousOption();
|
|
4527
4576
|
}
|
|
4528
4577
|
writeValue(value) {
|
|
4529
4578
|
if (isNaN(value)) {
|
|
@@ -4546,13 +4595,13 @@ SelectTestComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", vers
|
|
|
4546
4595
|
SelectTestComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: SelectTestComponent, selector: "wac-select-test", inputs: { value: "value", required: "required", disabled: "disabled", keepPanelOpen: "keepPanelOpen", openPanel: "openPanel", enableSearch: "enableSearch" }, outputs: { valueChange: "valueChange", openPanelChange: "openPanelChange" }, host: { listeners: { "document:keydown": "_handleKeydown($event)" }, properties: { "attr.role": "this.role" } }, providers: [
|
|
4547
4596
|
{ provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
|
|
4548
4597
|
ValueChangeService
|
|
4549
|
-
], queries: [{ propertyName: "customSearchTrigger", first: true, predicate: SelectSearchTriggerComponent, descendants: true }, { propertyName: "label", first: true, predicate: LabelComponent, descendants: true }, { propertyName: "optionChildren", predicate: OPTION_SELECTION_HANDLER, descendants: true }], ngImport: i0, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "directive", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: ["zIndexToggle"], outputs: ["onEventChange"] }, { kind: "component", type: i4$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
4598
|
+
], queries: [{ propertyName: "customSearchTrigger", first: true, predicate: SelectSearchTriggerComponent, descendants: true }, { propertyName: "label", first: true, predicate: LabelComponent, descendants: true }, { propertyName: "optionChildren", predicate: OPTION_SELECTION_HANDLER, descendants: true }], ngImport: i0, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: AutoHideDirective, selector: "[wzAutoHide]", inputs: ["triggerElement", "forceOn"], outputs: ["clickOutside"] }, { kind: "directive", type: ZindexToggleDirective, selector: "[zIndexToggle]", inputs: ["zIndexToggle"], outputs: ["onEventChange"] }, { kind: "component", type: i4$1.PerfectScrollbarComponent, selector: "perfect-scrollbar", inputs: ["disabled", "usePSClass", "autoPropagation", "scrollIndicators", "config"], outputs: ["psScrollY", "psScrollX", "psScrollUp", "psScrollDown", "psScrollLeft", "psScrollRight", "psYReachEnd", "psYReachStart", "psXReachEnd", "psXReachStart"], exportAs: ["ngxPerfectScrollbar"] }, { kind: "pipe", type: i1$3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4550
4599
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: SelectTestComponent, decorators: [{
|
|
4551
4600
|
type: Component,
|
|
4552
4601
|
args: [{ selector: 'wac-select-test', providers: [
|
|
4553
4602
|
{ provide: NG_VALUE_ACCESSOR, useExisting: SelectTestComponent, multi: true },
|
|
4554
4603
|
ValueChangeService
|
|
4555
|
-
], encapsulation: ViewEncapsulation.None, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>" }]
|
|
4604
|
+
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<p *ngIf=\"!!label\" class=\"wac-select-test__label\">\n <ng-content select=\"wac-label, .wac-label\" ></ng-content>\n</p>\n\n\n<div\n class=\"wac-select-test\"\n wzAutoHide\n (clickOutside)=\"onClosePanel()\"\n [triggerElement]=\"'wac-select-test__header__selection'\"\n [zIndexToggle]=\"openPanel\"\n >\n\n <div class=\"wac-select-test__header\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && onTogglePanel()\" tabindex=\"0\">\n\n <ng-container [ngTemplateOutlet]=\"openPanel ? openPanelTrigger : closePanelTrigger\" >\n\n <ng-template #closePanelTrigger>\n <ng-container [ngTemplateOutlet]=\"defaultTrigger\"></ng-container>\n </ng-template>\n\n <ng-template #openPanelTrigger>\n <ng-content *ngIf=\"!!customSearchTrigger; else defaultTrigger\" select=\"wac-select-search-trigger\" ></ng-content>\n </ng-template>\n\n <ng-template #defaultTrigger>\n <ng-content *ngIf=\"!selectedOptionContent\" select=\"wac-placeholder,[role=placeholder]\"></ng-content>\n <div\n class=\"wac-select-test__header__selection wac-option__placeholder\"\n *ngIf=\"!!selectedOptionContent\"\n [innerHtml]=\"selectedOptionContent\">\n </div>\n </ng-template>\n\n </ng-container>\n\n <span class=\"wac-select-test__header__chevron\"><i class=\"fas fa-chevron-down\"></i></span>\n\n </div>\n\n\n <div class=\"wac-select-test__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openPanel, open: openPanel }\">\n\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\">\n <ng-content\n select=\"wac-option-call-to-action, wac-option, option, .option, [selectOption]\">\n </ng-content>\n </perfect-scrollbar>\n\n <div *ngIf=\"!optionChildren?.length\" class=\"wac-select-test__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>" }]
|
|
4556
4605
|
}], ctorParameters: function () { return [{ type: ValueChangeService }]; }, propDecorators: { role: [{
|
|
4557
4606
|
type: HostBinding,
|
|
4558
4607
|
args: ['attr.role']
|
|
@@ -4587,33 +4636,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
|
|
|
4587
4636
|
}] } });
|
|
4588
4637
|
|
|
4589
4638
|
class OptionComponent {
|
|
4590
|
-
constructor(renderer, elementRef) {
|
|
4639
|
+
constructor(renderer, elementRef, changeDetectorRef) {
|
|
4591
4640
|
this.renderer = renderer;
|
|
4592
4641
|
this.elementRef = elementRef;
|
|
4642
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
4593
4643
|
this.disabled = false;
|
|
4594
4644
|
this.selectedChange = new EventEmitter();
|
|
4595
4645
|
}
|
|
4596
4646
|
set selected(selected) {
|
|
4597
4647
|
this._selected = selected;
|
|
4598
4648
|
selected ? this.renderer.addClass(this.elementRef.nativeElement, 'selected') : this.renderer.removeClass(this.elementRef.nativeElement, 'selected');
|
|
4649
|
+
this.changeDetectorRef.markForCheck();
|
|
4599
4650
|
}
|
|
4600
4651
|
get selected() {
|
|
4601
4652
|
return this._selected;
|
|
4602
4653
|
}
|
|
4603
|
-
ngOnInit() {
|
|
4604
|
-
}
|
|
4605
4654
|
onSelectOption() {
|
|
4606
4655
|
if (this.disabled) {
|
|
4607
4656
|
return;
|
|
4608
4657
|
}
|
|
4609
4658
|
this.selected = !this.selected;
|
|
4610
4659
|
this.selectedChange.emit(this.value);
|
|
4660
|
+
this.changeDetectorRef.markForCheck();
|
|
4611
4661
|
}
|
|
4612
4662
|
getValue() {
|
|
4613
4663
|
return this.value;
|
|
4614
4664
|
}
|
|
4615
4665
|
setValue(value) {
|
|
4616
4666
|
this.value = value;
|
|
4667
|
+
this.changeDetectorRef.markForCheck();
|
|
4617
4668
|
}
|
|
4618
4669
|
isSelected() {
|
|
4619
4670
|
return this.selected;
|
|
@@ -4626,12 +4677,12 @@ class OptionComponent {
|
|
|
4626
4677
|
return this.contentRef;
|
|
4627
4678
|
}
|
|
4628
4679
|
}
|
|
4629
|
-
OptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: OptionComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4630
|
-
OptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: OptionComponent, selector: "wac-option", inputs: { disabled: "disabled", value: "value", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: OptionComponent }], viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentWrapper"], descendants: true }], ngImport: i0, template: "<div\n [ngClass]=\"{ 'disabled': disabled }\"\n class=\"wac-option\"\n (click)=\"onSelectOption()\"\n >\n <div [ngClass]=\"{ 'selected': !disabled && selected, 'disabled': disabled }\" #contentWrapper>\n <ng-content></ng-content>\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
4680
|
+
OptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: OptionComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
4681
|
+
OptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: OptionComponent, selector: "wac-option", inputs: { disabled: "disabled", value: "value", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: OptionComponent }], viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentWrapper"], descendants: true }], ngImport: i0, template: "<div\n [ngClass]=\"{ 'disabled': disabled }\"\n class=\"wac-option\"\n (click)=\"onSelectOption()\"\n >\n <div [ngClass]=\"{ 'selected': !disabled && selected, 'disabled': disabled }\" #contentWrapper>\n <ng-content></ng-content>\n </div>\n</div>", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4631
4682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: OptionComponent, decorators: [{
|
|
4632
4683
|
type: Component,
|
|
4633
|
-
args: [{ selector: 'wac-option', encapsulation: ViewEncapsulation.None, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: OptionComponent }], template: "<div\n [ngClass]=\"{ 'disabled': disabled }\"\n class=\"wac-option\"\n (click)=\"onSelectOption()\"\n >\n <div [ngClass]=\"{ 'selected': !disabled && selected, 'disabled': disabled }\" #contentWrapper>\n <ng-content></ng-content>\n </div>\n</div>" }]
|
|
4634
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { contentRef: [{
|
|
4684
|
+
args: [{ selector: 'wac-option', encapsulation: ViewEncapsulation.None, providers: [{ provide: OPTION_SELECTION_HANDLER, useExisting: OptionComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [ngClass]=\"{ 'disabled': disabled }\"\n class=\"wac-option\"\n (click)=\"onSelectOption()\"\n >\n <div [ngClass]=\"{ 'selected': !disabled && selected, 'disabled': disabled }\" #contentWrapper>\n <ng-content></ng-content>\n </div>\n</div>" }]
|
|
4685
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { contentRef: [{
|
|
4635
4686
|
type: ViewChild,
|
|
4636
4687
|
args: ['contentWrapper']
|
|
4637
4688
|
}], disabled: [{
|