@wizishop/angular-components 0.0.119 → 0.0.122

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.
Files changed (36) hide show
  1. package/angular-components.scss +4757 -4757
  2. package/bundles/wizishop-angular-components.umd.js +280 -158
  3. package/bundles/wizishop-angular-components.umd.js.map +1 -1
  4. package/bundles/wizishop-angular-components.umd.min.js +2 -2
  5. package/bundles/wizishop-angular-components.umd.min.js.map +1 -1
  6. package/esm2015/lib/components/checkbox/checkbox.component.js +1 -1
  7. package/esm2015/lib/components/edit-in-place/edit-in-place.component.js +1 -1
  8. package/esm2015/lib/components/inputs/input-with-select/input-with-select.component.js +3 -3
  9. package/esm2015/lib/components/selects/select/select.component.js +9 -3
  10. package/esm2015/lib/components/table/directives/checkBoxRow.directive.js +21 -11
  11. package/esm2015/lib/components/table/shared/table-checkbox-id.service.js +18 -0
  12. package/esm2015/lib/components/table/table.component.js +36 -11
  13. package/esm2015/lib/components/text-area/text-area.component.js +2 -1
  14. package/esm2015/lib/components/tooltip/tooltip.component.js +1 -1
  15. package/esm2015/lib/services/multiple-selection.service.js +61 -0
  16. package/esm2015/lib/utils/html-container.class.js +30 -0
  17. package/esm2015/lib/utils/slection-item.interface.js +2 -0
  18. package/esm2015/public-api.js +2 -2
  19. package/esm2015/wizishop-angular-components.js +4 -2
  20. package/fesm2015/wizishop-angular-components.js +262 -149
  21. package/fesm2015/wizishop-angular-components.js.map +1 -1
  22. package/lib/components/inputs/input-with-select/input-with-select.component.d.ts +1 -1
  23. package/lib/components/selects/select/select.component.d.ts +3 -1
  24. package/lib/components/table/directives/checkBoxRow.directive.d.ts +7 -1
  25. package/lib/components/table/shared/table-checkbox-id.service.d.ts +7 -0
  26. package/lib/components/table/table.component.d.ts +13 -4
  27. package/lib/services/multiple-selection.service.d.ts +14 -0
  28. package/lib/{models/html-container.model.d.ts → utils/html-container.class.d.ts} +0 -0
  29. package/lib/utils/slection-item.interface.d.ts +5 -0
  30. package/package.json +1 -1
  31. package/public-api.d.ts +1 -1
  32. package/wizishop-angular-components-0.0.122.tgz +0 -0
  33. package/wizishop-angular-components.d.ts +3 -1
  34. package/wizishop-angular-components.metadata.json +1 -1
  35. package/esm2015/lib/models/html-container.model.js +0 -30
  36. package/wizishop-angular-components-0.0.119.tgz +0 -0
@@ -1,15 +1,14 @@
1
1
  import { NwbFilterRoutingBuilder, NwbAllModule, NwbFilterGroup } from '@wizishop/ng-wizi-bulma';
2
- import { Component, ViewEncapsulation, Input, EventEmitter, Output, Directive, HostListener, ɵɵdefineInjectable, ɵɵinject, ComponentFactoryResolver, ApplicationRef, INJECTOR, Injectable, Injector, ElementRef, Renderer2, TemplateRef, ViewContainerRef, NgModule, ViewChild, Pipe, Inject } from '@angular/core';
2
+ import { Component, ViewEncapsulation, Input, EventEmitter, Output, Directive, HostListener, ɵɵdefineInjectable, ɵɵinject, ComponentFactoryResolver, ApplicationRef, INJECTOR, Injectable, Injector, ElementRef, Renderer2, TemplateRef, ViewContainerRef, NgModule, Inject, ContentChildren, ViewChild, Pipe } from '@angular/core';
3
3
  import { CommonModule, DOCUMENT } from '@angular/common';
4
4
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
6
- import { Subject, ReplaySubject, interval } from 'rxjs';
7
- import { takeUntil, debounceTime, distinctUntilChanged, tap, takeWhile } from 'rxjs/operators';
6
+ import { Subject, ReplaySubject, merge, fromEvent, interval } from 'rxjs';
7
+ import { takeUntil, debounceTime, distinctUntilChanged, tap, map, takeWhile } from 'rxjs/operators';
8
8
  import { OverlayContainer } from '@angular/cdk/overlay';
9
9
  import { CdkTableModule } from '@angular/cdk/table';
10
10
  import { trigger, transition, style, animate, state } from '@angular/animations';
11
11
  import { TagInputModule } from 'ngx-chips';
12
- import { v4 } from 'uuid';
13
12
  import { TranslateService, TranslateModule } from '@ngx-translate/core';
14
13
  import { RouterModule } from '@angular/router';
15
14
 
@@ -448,16 +447,235 @@ FiltersTableService.ctorParameters = () => [
448
447
  { type: NwbFilterRoutingBuilder }
449
448
  ];
450
449
 
450
+ class HtmlContainer {
451
+ constructor(hostElement, appRef, componentFactoryResolver, injector) {
452
+ this.hostElement = hostElement;
453
+ this.appRef = appRef;
454
+ this.componentFactoryResolver = componentFactoryResolver;
455
+ this.injector = injector;
456
+ this.attached = false;
457
+ }
458
+ attach(component) {
459
+ if (this.attached) {
460
+ throw new Error('component has already been attached');
461
+ }
462
+ this.attached = true;
463
+ const childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
464
+ let componentRef = childComponentFactory.create(this.injector);
465
+ this.appRef.attachView(componentRef.hostView);
466
+ this.disposeFn = () => {
467
+ this.appRef.detachView(componentRef.hostView);
468
+ componentRef.destroy();
469
+ };
470
+ this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
471
+ return componentRef;
472
+ }
473
+ dispose() {
474
+ if (this.attached) {
475
+ this.disposeFn();
476
+ }
477
+ }
478
+ }
479
+
480
+ class TableCheckboxIdService {
481
+ constructor() {
482
+ this.nbCheckboxInstances = 0;
483
+ TableCheckboxIdService.tableInstance++;
484
+ this.currentTableInstance = TableCheckboxIdService.tableInstance;
485
+ }
486
+ getUniqueId() {
487
+ this.nbCheckboxInstances++;
488
+ return `wac-table-${this.currentTableInstance}-${this.nbCheckboxInstances}`;
489
+ }
490
+ }
491
+ TableCheckboxIdService.tableInstance = 0;
492
+ TableCheckboxIdService.decorators = [
493
+ { type: Injectable }
494
+ ];
495
+ TableCheckboxIdService.ctorParameters = () => [];
496
+
497
+ class CheckBoxRow {
498
+ constructor(currentRow, appRef, renderer, document, resolver, injector, tableCheckboxIdService) {
499
+ this.currentRow = currentRow;
500
+ this.appRef = appRef;
501
+ this.renderer = renderer;
502
+ this.document = document;
503
+ this.resolver = resolver;
504
+ this.injector = injector;
505
+ this.tableCheckboxIdService = tableCheckboxIdService;
506
+ this.checkBoxValueChange = new EventEmitter();
507
+ }
508
+ set checkBoxValue(value) {
509
+ this._value = value;
510
+ if (this.checkboxComponentRef) {
511
+ this.setCheckBoxValue();
512
+ }
513
+ }
514
+ get checkBoxValue() {
515
+ return this._value;
516
+ }
517
+ ngOnInit() {
518
+ this.createCheckBoxComponent();
519
+ this.handleChecboxInputs();
520
+ this.handleCheckboxOutputs();
521
+ }
522
+ createCheckBoxComponent() {
523
+ // Create the container
524
+ this.checkBoxElement = document.createElement('div');
525
+ this.checkBoxElement.className = 'wac-table__body__line__cell wac-table__body__line__cell--checkbox';
526
+ // Insert divCheckBox in the DOM as the first child of the row
527
+ this.renderer.insertBefore(this.currentRow.nativeElement, this.checkBoxElement, this.currentRow.nativeElement.firstChild);
528
+ // Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
529
+ this.htmlContainer = new HtmlContainer(this.checkBoxElement, this.appRef, this.resolver, this.injector);
530
+ this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
531
+ }
532
+ handleChecboxInputs() {
533
+ this.checkboxComponentRef.instance.id = this.checkBoxId ? '' + this.checkBoxId : this.tableCheckboxIdService.getUniqueId();
534
+ this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
535
+ this.checkboxComponentRef.instance.alone = true;
536
+ this.setCheckBoxValue();
537
+ }
538
+ setCheckBoxValue() {
539
+ this.checkboxComponentRef.instance.value = this.checkBoxValue;
540
+ }
541
+ handleCheckboxOutputs() {
542
+ // Detect checkbox changes
543
+ this.checkboxComponentRef.instance.registerOnChange(() => {
544
+ this._toggleCheckbox();
545
+ });
546
+ }
547
+ _toggleCheckbox() {
548
+ this.checkBoxValueChange.emit(this.checkBoxValue);
549
+ }
550
+ getElement() {
551
+ return this.checkBoxElement.querySelector('.wac-field-checkbox');
552
+ }
553
+ isActive() {
554
+ return !!this.checkboxComponentRef.instance.value;
555
+ }
556
+ setActive(isActive) {
557
+ this.checkboxComponentRef.instance.value = isActive; //? does not trigger output
558
+ }
559
+ ngOnDestroy() {
560
+ this.htmlContainer.dispose();
561
+ }
562
+ }
563
+ CheckBoxRow.decorators = [
564
+ { type: Directive, args: [{
565
+ selector: '[checkBoxRow]'
566
+ },] }
567
+ ];
568
+ CheckBoxRow.ctorParameters = () => [
569
+ { type: ElementRef },
570
+ { type: ApplicationRef },
571
+ { type: Renderer2 },
572
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
573
+ { type: ComponentFactoryResolver },
574
+ { type: Injector },
575
+ { type: TableCheckboxIdService }
576
+ ];
577
+ CheckBoxRow.propDecorators = {
578
+ checkBoxId: [{ type: Input, args: ['checkBoxId',] }],
579
+ checkBoxName: [{ type: Input, args: ['checkBoxName',] }],
580
+ checkBoxValue: [{ type: Input, args: ['checkBoxValue',] }],
581
+ checkBoxValueChange: [{ type: Output }]
582
+ };
583
+
584
+ class MultiSelectionService {
585
+ constructor() {
586
+ this.activeChanges = new Subject();
587
+ this.activeChanges$ = this.activeChanges.asObservable();
588
+ }
589
+ handle(items, toggleSingleItem = false) {
590
+ if (!items || !items.first) {
591
+ this.destroy();
592
+ return;
593
+ }
594
+ this.destroy(); // close previous subsciption
595
+ this.items = items;
596
+ const clicks$ = this.getListeners();
597
+ this.subscription = merge(...clicks$).subscribe(({ component, isShift: isShiftKeyPressed, index }) => {
598
+ if (!isShiftKeyPressed) {
599
+ if (toggleSingleItem) {
600
+ component.setActive(!component.isActive());
601
+ }
602
+ this.activeChanges.next([index]);
603
+ this.lastIndex = index;
604
+ return;
605
+ }
606
+ const start = index;
607
+ const end = this.lastIndex;
608
+ const [first, last] = [Math.min(start, end), Math.max(start, end) + 1];
609
+ const itemsSelection = this.items.toArray().slice(first, last);
610
+ const isBeginnerItemActive = this.items.get(end).isActive();
611
+ itemsSelection.forEach(current => current.setActive(isBeginnerItemActive));
612
+ window.getSelection().removeAllRanges(); // remove text selection
613
+ const indexInRange = Array.from({ length: last - first }, (x, i) => i + first);
614
+ this.activeChanges.next(indexInRange);
615
+ });
616
+ }
617
+ getListeners() {
618
+ return this.items.map((item, index) => {
619
+ return fromEvent(item.getElement(), 'click').pipe(map((event) => {
620
+ return {
621
+ index,
622
+ isShift: event.shiftKey,
623
+ component: item
624
+ };
625
+ }))
626
+ .pipe(debounceTime(100)); // debounced, because when clicking on a wac-checkbox it is emitted twice and can not find why
627
+ });
628
+ }
629
+ getActives() {
630
+ return this.items.filter(item => item.isActive());
631
+ }
632
+ destroy() {
633
+ var _a;
634
+ (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
635
+ }
636
+ }
637
+ MultiSelectionService.decorators = [
638
+ { type: Injectable }
639
+ ];
640
+ MultiSelectionService.ctorParameters = () => [];
641
+
642
+ class TableRow {
643
+ constructor(currentCell, renderer, document) {
644
+ this.currentCell = currentCell;
645
+ this.renderer = renderer;
646
+ this.document = document;
647
+ }
648
+ ngAfterViewInit() {
649
+ this.applyCustomStylesOnCell();
650
+ }
651
+ applyCustomStylesOnCell() {
652
+ this.renderer.addClass(this.currentCell.nativeElement, 'wac-table__body__line');
653
+ }
654
+ }
655
+ TableRow.decorators = [
656
+ { type: Directive, args: [{
657
+ // The selector has the same name as the tableRaw selector in table.component.html
658
+ selector: '[tableRow]'
659
+ },] }
660
+ ];
661
+ TableRow.ctorParameters = () => [
662
+ { type: ElementRef },
663
+ { type: Renderer2 },
664
+ { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
665
+ ];
666
+
451
667
  class TableComponent {
452
- constructor(filtersTableService) {
668
+ constructor(filtersTableService, tableCheckboxIdService, multiSelectionService) {
453
669
  this.filtersTableService = filtersTableService;
670
+ this.tableCheckboxIdService = tableCheckboxIdService;
671
+ this.multiSelectionService = multiSelectionService;
454
672
  this.tableFiltersChange = new EventEmitter();
455
673
  this.placeholder = '';
456
674
  /// Input/Output of checkbox ///
457
675
  /** Pass to true to display checkbox in the header table */
458
676
  this.checkbox = false;
459
- /** Emit new header checboxValue */
460
- this.toggleAllCheckBox = new EventEmitter();
677
+ this.toggleAllCheckBox = new EventEmitter(); // todo replace by checkBoxSelectionChange
678
+ this.checkBoxSelectionChange = new EventEmitter(); // todo add to doc
461
679
  /// Input to disable section ///
462
680
  /** Pass to true to hide search input */
463
681
  this.disableSearch = false;
@@ -467,17 +685,27 @@ class TableComponent {
467
685
  this.isLoading = false;
468
686
  }
469
687
  ngOnInit() {
470
- this.headerCheckBoxId = v4(); // Create checkbox unique id
688
+ this.headerCheckBoxId = this.tableCheckboxIdService.getUniqueId(); // Create checkbox unique id
471
689
  /* Handle routing filters */
472
690
  if (this.tableRoutingName) {
473
691
  this.filtersTableService.setInitialPaginationFiltersIfNotExist(this.tableRoutingName, this.tableFilters.itemsPerPage, this.tableFilters.currentPage);
474
692
  this._tableFiltersGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
475
693
  this.setTablesFilters();
476
694
  // Listen to filters changes with debounced time to limit multiple api calls
477
- this.filterGroupChangeSub = this._tableFiltersGroup.valuesChange$.subscribe(filters => {
695
+ this.filterGroupChangeSub = this._tableFiltersGroup.valuesChange$.subscribe(() => {
478
696
  this.setTablesFilters();
479
697
  });
480
698
  }
699
+ this.multiSelectionService.activeChanges$.subscribe(selectionIndexRawCheckChange => {
700
+ this.checkBoxSelectionChange.emit(selectionIndexRawCheckChange);
701
+ });
702
+ }
703
+ ngAfterViewInit() {
704
+ this.multiSelectionService.handle(this.checkBoxRows);
705
+ this.checkBoxRows.changes.subscribe(() => {
706
+ this.multiSelectionService.handle(this.checkBoxRows);
707
+ });
708
+ console.log('this.tableRows', this.tableRows);
481
709
  }
482
710
  onToggleAllCheckBox(event) {
483
711
  this.toggleAllCheckBox.emit(event.target.checked);
@@ -522,29 +750,39 @@ class TableComponent {
522
750
  this.tableFiltersChange.emit(this.tableFilters);
523
751
  this._tableFiltersGroup.tableFiltersValuesChange$.next(this.tableFilters);
524
752
  }
525
- ngDestroy() {
753
+ ngOnDestroy() {
526
754
  if (this.filterGroupChangeSub) {
527
755
  this.filterGroupChangeSub.unsubscribe();
528
756
  }
757
+ this.multiSelectionService.destroy();
529
758
  }
530
759
  }
531
760
  TableComponent.decorators = [
532
761
  { type: Component, args: [{
533
762
  selector: 'wac-table',
534
763
  template: "<div class=\"wac-table\">\n <!-- Header section -->\n <div class=\"wac-table__head\" id=\"headerTable\">\n <div *ngIf=\"checkbox\" class=\"wac-table__head__cell wac-table__head__cell--checkbox\">\n <wac-checkbox [id]=\"headerCheckBoxId\" (change)=\"onToggleAllCheckBox($event)\" [alone]=\"true\"></wac-checkbox>\n </div>\n\n <!-- Header contents are added with the headerCell directive -->\n <ng-content select=\"[headerCell]\"></ng-content>\n </div>\n\n <!-- Search section -->\n <div *ngIf=\"!disableSearch\" class=\"wac-table__search\">\n <wac-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"searchChange()\"\n [placeholder]=\"placeholder\"\n [smallPadding]=\"true\"\n ></wac-input-search>\n </div>\n\n <!-- Body section -->\n <div class=\"wac-table__body\">\n <!-- Loader on body -->\n <div class=\"wac-table__body__loader\" *ngIf=\"isLoading\">\n <wac-loader [small]=\"true\"></wac-loader>\n </div>\n <!-- Body contents are added with the tableRow directive -->\n <ng-content select=\".complex-table\" *ngIf=\"!isLoading\"></ng-content>\n <ng-content select=\"[tableRow]\" *ngIf=\"!isLoading\"></ng-content>\n </div>\n\n <!-- Pagination section -->\n <wac-pagination *ngIf=\"!disablePagniation\" [pagination]=\"tableFilters\" (pageChange)=\"pageChange()\"></wac-pagination>\n</div>\n",
535
- encapsulation: ViewEncapsulation.None
764
+ encapsulation: ViewEncapsulation.None,
765
+ providers: [
766
+ TableCheckboxIdService,
767
+ MultiSelectionService
768
+ ]
536
769
  },] }
537
770
  ];
538
771
  TableComponent.ctorParameters = () => [
539
- { type: FiltersTableService }
772
+ { type: FiltersTableService },
773
+ { type: TableCheckboxIdService },
774
+ { type: MultiSelectionService }
540
775
  ];
541
776
  TableComponent.propDecorators = {
777
+ checkBoxRows: [{ type: ContentChildren, args: [CheckBoxRow,] }],
778
+ tableRows: [{ type: ContentChildren, args: [TableRow,] }],
542
779
  tableFilters: [{ type: Input }],
543
780
  tableFiltersChange: [{ type: Output }],
544
781
  tableRoutingName: [{ type: Input }],
545
782
  placeholder: [{ type: Input }],
546
783
  checkbox: [{ type: Input }],
547
784
  toggleAllCheckBox: [{ type: Output }],
785
+ checkBoxSelectionChange: [{ type: Output }],
548
786
  disableSearch: [{ type: Input }],
549
787
  disablePagniation: [{ type: Input }],
550
788
  isLoading: [{ type: Input }]
@@ -1333,6 +1571,7 @@ WzEditInPlaceComponent.propDecorators = {
1333
1571
 
1334
1572
  class TextAreaComponent {
1335
1573
  constructor() {
1574
+ // todo simplify and improve progress bar
1336
1575
  this.label = '';
1337
1576
  this.value = '';
1338
1577
  this.placeholder = '';
@@ -2021,113 +2260,6 @@ LoaderModule.decorators = [
2021
2260
  },] }
2022
2261
  ];
2023
2262
 
2024
- class HtmlContainer {
2025
- constructor(hostElement, appRef, componentFactoryResolver, injector) {
2026
- this.hostElement = hostElement;
2027
- this.appRef = appRef;
2028
- this.componentFactoryResolver = componentFactoryResolver;
2029
- this.injector = injector;
2030
- this.attached = false;
2031
- }
2032
- attach(component) {
2033
- if (this.attached) {
2034
- throw new Error('component has already been attached');
2035
- }
2036
- this.attached = true;
2037
- const childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
2038
- let componentRef = childComponentFactory.create(this.injector);
2039
- this.appRef.attachView(componentRef.hostView);
2040
- this.disposeFn = () => {
2041
- this.appRef.detachView(componentRef.hostView);
2042
- componentRef.destroy();
2043
- };
2044
- this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
2045
- return componentRef;
2046
- }
2047
- dispose() {
2048
- if (this.attached) {
2049
- this.disposeFn();
2050
- }
2051
- }
2052
- }
2053
-
2054
- class CheckBoxRow {
2055
- constructor(currentRow, appRef, renderer, document, resolver, injector) {
2056
- this.currentRow = currentRow;
2057
- this.appRef = appRef;
2058
- this.renderer = renderer;
2059
- this.document = document;
2060
- this.resolver = resolver;
2061
- this.injector = injector;
2062
- this.checkBoxValueChange = new EventEmitter();
2063
- }
2064
- set checkBoxValue(value) {
2065
- this._value = value;
2066
- if (this.checkboxComponentRef) {
2067
- this.setCheckBoxValue();
2068
- }
2069
- }
2070
- get checkBoxValue() {
2071
- return this._value;
2072
- }
2073
- ngOnInit() {
2074
- this.createCheckBoxComponent();
2075
- this.handleChecboxInputs();
2076
- this.handleCheckboxOutputs();
2077
- }
2078
- createCheckBoxComponent() {
2079
- // Create the container
2080
- const checkBoxContainer = document.createElement('div');
2081
- checkBoxContainer.className = 'wac-table__body__line__cell wac-table__body__line__cell--checkbox';
2082
- // Insert divCheckBox in the DOM as the first child of the row
2083
- this.renderer.insertBefore(this.currentRow.nativeElement, checkBoxContainer, this.currentRow.nativeElement.firstChild);
2084
- // Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
2085
- this.htmlContainer = new HtmlContainer(checkBoxContainer, this.appRef, this.resolver, this.injector);
2086
- this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
2087
- }
2088
- handleChecboxInputs() {
2089
- this.checkboxComponentRef.instance.id = this.checkBoxId ? this.checkBoxId : v4();
2090
- this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
2091
- this.checkboxComponentRef.instance.alone = true;
2092
- this.setCheckBoxValue();
2093
- }
2094
- setCheckBoxValue() {
2095
- this.checkboxComponentRef.instance.value = this.checkBoxValue;
2096
- }
2097
- handleCheckboxOutputs() {
2098
- // Detect checkbox changes
2099
- this.checkboxComponentRef.instance.registerOnChange(() => {
2100
- this._toggleCheckbox();
2101
- });
2102
- }
2103
- _toggleCheckbox() {
2104
- this.checkBoxValue = !this.checkBoxValue;
2105
- this.checkBoxValueChange.emit(this.checkBoxValue);
2106
- }
2107
- ngOnDestroy() {
2108
- this.htmlContainer.dispose();
2109
- }
2110
- }
2111
- CheckBoxRow.decorators = [
2112
- { type: Directive, args: [{
2113
- selector: '[checkBoxRow]'
2114
- },] }
2115
- ];
2116
- CheckBoxRow.ctorParameters = () => [
2117
- { type: ElementRef },
2118
- { type: ApplicationRef },
2119
- { type: Renderer2 },
2120
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
2121
- { type: ComponentFactoryResolver },
2122
- { type: Injector }
2123
- ];
2124
- CheckBoxRow.propDecorators = {
2125
- checkBoxId: [{ type: Input, args: ['checkBoxId',] }],
2126
- checkBoxName: [{ type: Input, args: ['checkBoxName',] }],
2127
- checkBoxValue: [{ type: Input, args: ['checkBoxValue',] }],
2128
- checkBoxValueChange: [{ type: Output }]
2129
- };
2130
-
2131
2263
  class TableColumn {
2132
2264
  constructor(currentCell, renderer, document) {
2133
2265
  this.currentCell = currentCell;
@@ -2352,31 +2484,6 @@ TableColumnHeader.propDecorators = {
2352
2484
  tableFiltersChange: [{ type: Output }]
2353
2485
  };
2354
2486
 
2355
- class TableRow {
2356
- constructor(currentCell, renderer, document) {
2357
- this.currentCell = currentCell;
2358
- this.renderer = renderer;
2359
- this.document = document;
2360
- }
2361
- ngAfterViewInit() {
2362
- this.applyCustomStylesOnCell();
2363
- }
2364
- applyCustomStylesOnCell() {
2365
- this.renderer.addClass(this.currentCell.nativeElement, 'wac-table__body__line');
2366
- }
2367
- }
2368
- TableRow.decorators = [
2369
- { type: Directive, args: [{
2370
- // The selector has the same name as the tableRaw selector in table.component.html
2371
- selector: '[tableRow]'
2372
- },] }
2373
- ];
2374
- TableRow.ctorParameters = () => [
2375
- { type: ElementRef },
2376
- { type: Renderer2 },
2377
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
2378
- ];
2379
-
2380
2487
  const directives$1 = [TableColumn, CheckBoxRow, TableColumnHeader, TableRow,];
2381
2488
  class TableModule {
2382
2489
  }
@@ -2535,13 +2642,14 @@ class SelectComponent {
2535
2642
  constructor(translateService) {
2536
2643
  this.translateService = translateService;
2537
2644
  this.search = false;
2645
+ this.searchValue = '';
2646
+ this.searchValueChange = new EventEmitter();
2538
2647
  this.type = 'default';
2539
2648
  this.maxWidth = '100%';
2540
2649
  this.disabled = false;
2541
2650
  this.selectValue = new EventEmitter();
2542
2651
  this.clickOnCallToAction = new EventEmitter();
2543
2652
  this.openCategories = false;
2544
- this.searchValue = '';
2545
2653
  this.indexItemSelected = -1;
2546
2654
  // ControlValueAccessor methods
2547
2655
  this.onChange = () => { };
@@ -2568,6 +2676,9 @@ class SelectComponent {
2568
2676
  this.onClose();
2569
2677
  this.clickOnCallToAction.emit(this.callToAction.value);
2570
2678
  }
2679
+ onSearcheValueChange() {
2680
+ this.searchValueChange.emit(this.searchValue);
2681
+ }
2571
2682
  getItemSelected() {
2572
2683
  return this.items[this.indexItemSelected];
2573
2684
  }
@@ -2601,7 +2712,7 @@ class SelectComponent {
2601
2712
  SelectComponent.decorators = [
2602
2713
  { type: Component, args: [{
2603
2714
  selector: 'wac-select',
2604
- template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" />\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name }}\n </div>\n </div>\n\n </perfect-scrollbar>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>",
2715
+ template: "<p *ngIf=\"label\" [innerHTML]=\"label\" class=\"wac-select__label\"></p>\n\n<div class=\"wac-select\" wzAutoHide (clickOutside)=\"onClose()\" [ngStyle]=\"{ 'max-width': maxWidth }\" [zIndexToggle]=\"openCategories\">\n\n <div class=\"wac-select__current\" [ngClass]=\"{ 'select-disabled' : disabled }\" (click)=\"!disabled && openCategories = !openCategories\" *ngIf=\"!search\">\n <span *ngIf=\"indexItemSelected !== -1\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span [innerHTML]=\"indexItemSelected !== -1 ? items[indexItemSelected].name : placeholder\"></span><span><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__current wac-select__current--withSearch\" [ngClass]=\"{ 'select-disabled' : disabled, 'open-search': openCategories }\" *ngIf=\"search\">\n <div class=\"wac-select__current__search\" *ngIf=\"openCategories && !disabled\">\n <i class=\"far fa-search\"></i>\n <input #search type=\"text\" [(ngModel)]=\"searchValue\" (ngModelChange)=\"onSearcheValueChange()\"/>\n </div>\n <span (click)=\"openCategories = !openCategories;\" *ngIf=\"items[indexItemSelected]?.icon && !openCategories\" class=\"icon\" [innerHTML]=\"items[indexItemSelected].icon\"></span>\n <span (click)=\"showCategories()\" [innerHTML]=\"items[indexItemSelected]?.name ? items[indexItemSelected].name : placeholder\"></span>\n <span (click)=\"openCategories = !openCategories;\"><i class=\"fas fa-chevron-down\"></i></span>\n </div>\n\n <div class=\"wac-select__content\" *ngIf=\"!disabled\" [ngClass]=\"{ hidden: !openCategories, open: type === 'open' }\" [ngStyle]=\"{ 'max-width': maxWidthItems }\">\n <perfect-scrollbar [config]=\"{ suppressScrollX: true }\" *ngIf=\"items.length\">\n\n <div *ngIf=\"callToAction\" class=\"wac-select__content__cta\">\n <div (click)=\"onClickCallToAction()\">\n <i *ngIf=\"callToAction.icon\" [classList]=\"callToAction.icon\"></i><strong *ngIf=\"callToAction.boldText\">{{ callToAction.boldText }}</strong\n ><span>{{ callToAction?.name }}</span>\n </div>\n </div>\n\n <div\n *ngFor=\"let item of items | selectFilters: searchValue; let index = index;\"\n (click)=\"onClose()\"\n class=\"wac-select__content__item\"\n >\n <div [ngClass]=\"{ selected: item.selected }\" (click)=\"onSelectItem(item.id)\">\n <span class=\"icon\" [innerHTML]=\"item.icon\" *ngIf=\"item.icon\"></span>{{ item.name }}\n </div>\n </div>\n\n </perfect-scrollbar>\n\n <div *ngIf=\"!(items | selectFilters: searchValue)?.length\" class=\"wac-select__content__empty\">\n <span>{{'wac.datatable.noresult' | translate}}</span>\n </div>\n\n </div>\n</div>",
2605
2716
  providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }]
2606
2717
  },] }
2607
2718
  ];
@@ -2614,6 +2725,8 @@ SelectComponent.propDecorators = {
2614
2725
  label: [{ type: Input }],
2615
2726
  maxWidthItems: [{ type: Input }],
2616
2727
  search: [{ type: Input }],
2728
+ searchValue: [{ type: Input }],
2729
+ searchValueChange: [{ type: Output }],
2617
2730
  type: [{ type: Input }],
2618
2731
  callToAction: [{ type: Input }],
2619
2732
  maxWidth: [{ type: Input }],
@@ -2829,7 +2942,7 @@ class InputWithSelectComponent {
2829
2942
  }
2830
2943
  });
2831
2944
  }
2832
- onChangeValue(index) {
2945
+ onClickItem(index) {
2833
2946
  this.unActiveAll();
2834
2947
  const optionSelected = this.options[index];
2835
2948
  optionSelected.active = true;
@@ -2855,7 +2968,7 @@ class InputWithSelectComponent {
2855
2968
  InputWithSelectComponent.decorators = [
2856
2969
  { type: Component, args: [{
2857
2970
  selector: 'wac-input-with-select',
2858
- template: "<div class=\"wac-input-with-select\" [zIndexToggle]=\"showSelect\">\n <label class=\"wac-input-with-select__label\" [for]=\"id\" [innerHTML]=\"label\"></label>\n <div class=\"wac-input-with-select__wrapper\">\n <div class=\"wac-input-with-select__wrapper__left\" wzAutoHide (clickOutside)=\"onCloseSelect()\">\n <input [id]=\"id\" type=\"text\" [placeholder]=\"placeholder\" (change)=\"onChangeInputValue($event)\" />\n <div class=\"wac-input-with-select__wrapper__left__current\">\n <span (click)=\"onToggleSelect()\">{{ currentLabel }}</span>\n </div>\n <div class=\"wac-input-with-select__wrapper__left__select\" *ngIf=\"showSelect\">\n <div class=\"wac-input-with-select__wrapper__left__select__item\" *ngFor=\"let option of options; let index = index\">\n <div (click)=\"onChangeValue(index)\">{{ option.label }}</div>\n </div>\n </div>\n </div>\n <div class=\"wac-input-with-select__wrapper__right\">\n <p [innerHTML]=\"text\"></p>\n </div>\n </div>\n</div>\n"
2971
+ template: "<div class=\"wac-input-with-select\" [zIndexToggle]=\"showSelect\">\n <label class=\"wac-input-with-select__label\" [for]=\"id\" [innerHTML]=\"label\"></label>\n <div class=\"wac-input-with-select__wrapper\">\n <div class=\"wac-input-with-select__wrapper__left\" wzAutoHide (clickOutside)=\"onCloseSelect()\">\n <input [id]=\"id\" type=\"text\" [placeholder]=\"placeholder\" (change)=\"onChangeInputValue($event)\" />\n <div class=\"wac-input-with-select__wrapper__left__current\">\n <span (click)=\"onToggleSelect()\">{{ currentLabel }}</span>\n </div>\n <div class=\"wac-input-with-select__wrapper__left__select\" *ngIf=\"showSelect\">\n <div class=\"wac-input-with-select__wrapper__left__select__item\" *ngFor=\"let option of options; let index = index\">\n <div (click)=\"onClickItem(index)\">{{ option.label }}</div>\n </div>\n </div>\n </div>\n <div class=\"wac-input-with-select__wrapper__right\">\n <p [innerHTML]=\"text\"></p>\n </div>\n </div>\n</div>\n"
2859
2972
  },] }
2860
2973
  ];
2861
2974
  InputWithSelectComponent.ctorParameters = () => [];
@@ -3623,5 +3736,5 @@ class TableFiltersGroup extends NwbFilterGroup {
3623
3736
  * Generated bundle index. Do not edit.
3624
3737
  */
3625
3738
 
3626
- export { AbstractDebounceDirective, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, ButtonComponent, CalendarComponent, CheckBoxRow, CheckboxComponent, DebounceKeyupDirective, DeleteComponent, DropdownComponent, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MultipleSearchComponent, MultipleSearchPlusComponent, PaginationComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectFiltersPipe, SelectInTextComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TextAreaComponent, TextComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WzEditInPlaceComponent, ZindexToggleDirective, DomService as ɵa, PaginationModule as ɵb, PagniationArrayTotalPages as ɵc, PagniationIsLastPage as ɵd, PagniationText as ɵe, TableModule as ɵf, InputSearchModule as ɵg, InputModule as ɵh, TooltipModule as ɵi, ProgressBarModule as ɵj, LoaderModule as ɵk, CheckboxModule as ɵl, inOutY as ɵm, inOutX as ɵn };
3739
+ export { AbstractDebounceDirective, AlertComponent, AlertPopupComponent, AlertPopupModule, AlertPopupService, AreAllOptionsSelectedPipe, AutoHideDirective, BackComponent, BlockComponent, ButtonComponent, CalendarComponent, CheckBoxRow, CheckboxComponent, DebounceKeyupDirective, DeleteComponent, DropdownComponent, FiltersComponent, FiltersTableService, FormatObjectToRecursifTreePipe, FormatObjectToSimpleTreePipe, FreePopinComponent, H1Component, H2Component, H3Component, H4Component, HeaderPageComponent, HtmlContainer, ImageComponent, InfoComponent, InputComponent, InputSearchComponent, InputWithSelectComponent, LabelComponent, LinkComponent, LoaderComponent, LogoComponent, MultipleSearchComponent, MultipleSearchPlusComponent, PaginationComponent, PopinComponent, ProgressBarComponent, RadioComponent, SearchComponent, SelectComponent, SelectFiltersPipe, SelectInTextComponent, SelectedListComponent, SeparatorComponent, SettingsComponent, SharedComponentsModule, SharedDirectives, SharedPipes, SnackbarComponent, StateComponent, SwitchComponent, TabComponent, TableColumn, TableColumnHeader, TableComponent, TableFiltersGroup, TableRow, TagComponent, TextAreaComponent, TextComponent, TooltipComponent, TreeComponent, TreeModule, UploadComponent, VarDirective, WiziComponentsModule, WrapperBlocsComponent, WrapperComponent, WzEditInPlaceComponent, ZindexToggleDirective, DomService as ɵa, PaginationModule as ɵb, PagniationArrayTotalPages as ɵc, PagniationIsLastPage as ɵd, PagniationText as ɵe, TableModule as ɵf, InputSearchModule as ɵg, InputModule as ɵh, TooltipModule as ɵi, ProgressBarModule as ɵj, LoaderModule as ɵk, CheckboxModule as ɵl, inOutY as ɵm, TableCheckboxIdService as ɵn, MultiSelectionService as ɵo, inOutX as ɵp };
3627
3740
  //# sourceMappingURL=wizishop-angular-components.js.map