@wizishop/angular-components 0.0.117 → 0.0.120
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/angular-components.scss +4767 -4753
- package/bundles/wizishop-angular-components.umd.js +275 -158
- package/bundles/wizishop-angular-components.umd.js.map +1 -1
- package/bundles/wizishop-angular-components.umd.min.js +2 -2
- package/bundles/wizishop-angular-components.umd.min.js.map +1 -1
- package/esm2015/lib/components/button/button.component.js +3 -2
- package/esm2015/lib/components/checkbox/checkbox.component.js +1 -1
- package/esm2015/lib/components/edit-in-place/edit-in-place.component.js +1 -1
- package/esm2015/lib/components/inputs/input-with-select/input-with-select.component.js +3 -3
- package/esm2015/lib/components/inputs/input-with-select/option-item.dto.js +1 -1
- package/esm2015/lib/components/selected-list/selected-list.component.js +2 -2
- package/esm2015/lib/components/table/directives/checkBoxRow.directive.js +21 -11
- package/esm2015/lib/components/table/shared/table-checkbox-id.service.js +18 -0
- package/esm2015/lib/components/table/table.component.js +36 -11
- package/esm2015/lib/components/text-area/text-area.component.js +2 -1
- package/esm2015/lib/components/tooltip/tooltip.component.js +1 -1
- package/esm2015/lib/services/multiple-selection.service.js +61 -0
- package/esm2015/lib/utils/html-container.class.js +30 -0
- package/esm2015/lib/utils/slection-item.interface.js +2 -0
- package/esm2015/public-api.js +2 -2
- package/esm2015/wizishop-angular-components.js +4 -2
- package/fesm2015/wizishop-angular-components.js +257 -149
- package/fesm2015/wizishop-angular-components.js.map +1 -1
- package/lib/components/inputs/input-with-select/input-with-select.component.d.ts +1 -1
- package/lib/components/inputs/input-with-select/option-item.dto.d.ts +0 -1
- package/lib/components/table/directives/checkBoxRow.directive.d.ts +7 -1
- package/lib/components/table/shared/table-checkbox-id.service.d.ts +7 -0
- package/lib/components/table/table.component.d.ts +13 -4
- package/lib/services/multiple-selection.service.d.ts +14 -0
- package/lib/{models/html-container.model.d.ts → utils/html-container.class.d.ts} +0 -0
- package/lib/utils/slection-item.interface.d.ts +5 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- package/wizishop-angular-components-0.0.120.tgz +0 -0
- package/wizishop-angular-components.d.ts +3 -1
- package/wizishop-angular-components.metadata.json +1 -1
- package/esm2015/lib/models/html-container.model.js +0 -30
- package/wizishop-angular-components-0.0.117.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
|
|
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
|
-
|
|
460
|
-
this.
|
|
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 =
|
|
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(
|
|
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
|
-
|
|
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 }]
|
|
@@ -610,7 +848,7 @@ TabComponent.propDecorators = {
|
|
|
610
848
|
|
|
611
849
|
class ButtonComponent {
|
|
612
850
|
constructor() {
|
|
613
|
-
this.extraClasses = 'is-info';
|
|
851
|
+
this.extraClasses = 'is-info'; // todo make a list of existing class
|
|
614
852
|
this.label = '';
|
|
615
853
|
this.icon = '';
|
|
616
854
|
this.widthAuto = false;
|
|
@@ -620,6 +858,7 @@ class ButtonComponent {
|
|
|
620
858
|
this.disabled = false;
|
|
621
859
|
this.whiteSpaceNowrap = false;
|
|
622
860
|
this.opacity = false;
|
|
861
|
+
// TODO MAKE ANNIMATION AVAILABLE FOR MOBILE as CONFIRM DELETE DO (because, its doeant show the text and trigger click)
|
|
623
862
|
this.animation = false;
|
|
624
863
|
this.animationRight = false;
|
|
625
864
|
this.animationText = '';
|
|
@@ -1332,6 +1571,7 @@ WzEditInPlaceComponent.propDecorators = {
|
|
|
1332
1571
|
|
|
1333
1572
|
class TextAreaComponent {
|
|
1334
1573
|
constructor() {
|
|
1574
|
+
// todo simplify and improve progress bar
|
|
1335
1575
|
this.label = '';
|
|
1336
1576
|
this.value = '';
|
|
1337
1577
|
this.placeholder = '';
|
|
@@ -2020,113 +2260,6 @@ LoaderModule.decorators = [
|
|
|
2020
2260
|
},] }
|
|
2021
2261
|
];
|
|
2022
2262
|
|
|
2023
|
-
class HtmlContainer {
|
|
2024
|
-
constructor(hostElement, appRef, componentFactoryResolver, injector) {
|
|
2025
|
-
this.hostElement = hostElement;
|
|
2026
|
-
this.appRef = appRef;
|
|
2027
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
2028
|
-
this.injector = injector;
|
|
2029
|
-
this.attached = false;
|
|
2030
|
-
}
|
|
2031
|
-
attach(component) {
|
|
2032
|
-
if (this.attached) {
|
|
2033
|
-
throw new Error('component has already been attached');
|
|
2034
|
-
}
|
|
2035
|
-
this.attached = true;
|
|
2036
|
-
const childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
2037
|
-
let componentRef = childComponentFactory.create(this.injector);
|
|
2038
|
-
this.appRef.attachView(componentRef.hostView);
|
|
2039
|
-
this.disposeFn = () => {
|
|
2040
|
-
this.appRef.detachView(componentRef.hostView);
|
|
2041
|
-
componentRef.destroy();
|
|
2042
|
-
};
|
|
2043
|
-
this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
|
|
2044
|
-
return componentRef;
|
|
2045
|
-
}
|
|
2046
|
-
dispose() {
|
|
2047
|
-
if (this.attached) {
|
|
2048
|
-
this.disposeFn();
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
|
-
class CheckBoxRow {
|
|
2054
|
-
constructor(currentRow, appRef, renderer, document, resolver, injector) {
|
|
2055
|
-
this.currentRow = currentRow;
|
|
2056
|
-
this.appRef = appRef;
|
|
2057
|
-
this.renderer = renderer;
|
|
2058
|
-
this.document = document;
|
|
2059
|
-
this.resolver = resolver;
|
|
2060
|
-
this.injector = injector;
|
|
2061
|
-
this.checkBoxValueChange = new EventEmitter();
|
|
2062
|
-
}
|
|
2063
|
-
set checkBoxValue(value) {
|
|
2064
|
-
this._value = value;
|
|
2065
|
-
if (this.checkboxComponentRef) {
|
|
2066
|
-
this.setCheckBoxValue();
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
get checkBoxValue() {
|
|
2070
|
-
return this._value;
|
|
2071
|
-
}
|
|
2072
|
-
ngOnInit() {
|
|
2073
|
-
this.createCheckBoxComponent();
|
|
2074
|
-
this.handleChecboxInputs();
|
|
2075
|
-
this.handleCheckboxOutputs();
|
|
2076
|
-
}
|
|
2077
|
-
createCheckBoxComponent() {
|
|
2078
|
-
// Create the container
|
|
2079
|
-
const checkBoxContainer = document.createElement('div');
|
|
2080
|
-
checkBoxContainer.className = 'wac-table__body__line__cell wac-table__body__line__cell--checkbox';
|
|
2081
|
-
// Insert divCheckBox in the DOM as the first child of the row
|
|
2082
|
-
this.renderer.insertBefore(this.currentRow.nativeElement, checkBoxContainer, this.currentRow.nativeElement.firstChild);
|
|
2083
|
-
// Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
|
|
2084
|
-
this.htmlContainer = new HtmlContainer(checkBoxContainer, this.appRef, this.resolver, this.injector);
|
|
2085
|
-
this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
|
|
2086
|
-
}
|
|
2087
|
-
handleChecboxInputs() {
|
|
2088
|
-
this.checkboxComponentRef.instance.id = this.checkBoxId ? this.checkBoxId : v4();
|
|
2089
|
-
this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
|
|
2090
|
-
this.checkboxComponentRef.instance.alone = true;
|
|
2091
|
-
this.setCheckBoxValue();
|
|
2092
|
-
}
|
|
2093
|
-
setCheckBoxValue() {
|
|
2094
|
-
this.checkboxComponentRef.instance.value = this.checkBoxValue;
|
|
2095
|
-
}
|
|
2096
|
-
handleCheckboxOutputs() {
|
|
2097
|
-
// Detect checkbox changes
|
|
2098
|
-
this.checkboxComponentRef.instance.registerOnChange(() => {
|
|
2099
|
-
this._toggleCheckbox();
|
|
2100
|
-
});
|
|
2101
|
-
}
|
|
2102
|
-
_toggleCheckbox() {
|
|
2103
|
-
this.checkBoxValue = !this.checkBoxValue;
|
|
2104
|
-
this.checkBoxValueChange.emit(this.checkBoxValue);
|
|
2105
|
-
}
|
|
2106
|
-
ngOnDestroy() {
|
|
2107
|
-
this.htmlContainer.dispose();
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
CheckBoxRow.decorators = [
|
|
2111
|
-
{ type: Directive, args: [{
|
|
2112
|
-
selector: '[checkBoxRow]'
|
|
2113
|
-
},] }
|
|
2114
|
-
];
|
|
2115
|
-
CheckBoxRow.ctorParameters = () => [
|
|
2116
|
-
{ type: ElementRef },
|
|
2117
|
-
{ type: ApplicationRef },
|
|
2118
|
-
{ type: Renderer2 },
|
|
2119
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
2120
|
-
{ type: ComponentFactoryResolver },
|
|
2121
|
-
{ type: Injector }
|
|
2122
|
-
];
|
|
2123
|
-
CheckBoxRow.propDecorators = {
|
|
2124
|
-
checkBoxId: [{ type: Input, args: ['checkBoxId',] }],
|
|
2125
|
-
checkBoxName: [{ type: Input, args: ['checkBoxName',] }],
|
|
2126
|
-
checkBoxValue: [{ type: Input, args: ['checkBoxValue',] }],
|
|
2127
|
-
checkBoxValueChange: [{ type: Output }]
|
|
2128
|
-
};
|
|
2129
|
-
|
|
2130
2263
|
class TableColumn {
|
|
2131
2264
|
constructor(currentCell, renderer, document) {
|
|
2132
2265
|
this.currentCell = currentCell;
|
|
@@ -2351,31 +2484,6 @@ TableColumnHeader.propDecorators = {
|
|
|
2351
2484
|
tableFiltersChange: [{ type: Output }]
|
|
2352
2485
|
};
|
|
2353
2486
|
|
|
2354
|
-
class TableRow {
|
|
2355
|
-
constructor(currentCell, renderer, document) {
|
|
2356
|
-
this.currentCell = currentCell;
|
|
2357
|
-
this.renderer = renderer;
|
|
2358
|
-
this.document = document;
|
|
2359
|
-
}
|
|
2360
|
-
ngAfterViewInit() {
|
|
2361
|
-
this.applyCustomStylesOnCell();
|
|
2362
|
-
}
|
|
2363
|
-
applyCustomStylesOnCell() {
|
|
2364
|
-
this.renderer.addClass(this.currentCell.nativeElement, 'wac-table__body__line');
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
TableRow.decorators = [
|
|
2368
|
-
{ type: Directive, args: [{
|
|
2369
|
-
// The selector has the same name as the tableRaw selector in table.component.html
|
|
2370
|
-
selector: '[tableRow]'
|
|
2371
|
-
},] }
|
|
2372
|
-
];
|
|
2373
|
-
TableRow.ctorParameters = () => [
|
|
2374
|
-
{ type: ElementRef },
|
|
2375
|
-
{ type: Renderer2 },
|
|
2376
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
2377
|
-
];
|
|
2378
|
-
|
|
2379
2487
|
const directives$1 = [TableColumn, CheckBoxRow, TableColumnHeader, TableRow,];
|
|
2380
2488
|
class TableModule {
|
|
2381
2489
|
}
|
|
@@ -2828,7 +2936,7 @@ class InputWithSelectComponent {
|
|
|
2828
2936
|
}
|
|
2829
2937
|
});
|
|
2830
2938
|
}
|
|
2831
|
-
|
|
2939
|
+
onClickItem(index) {
|
|
2832
2940
|
this.unActiveAll();
|
|
2833
2941
|
const optionSelected = this.options[index];
|
|
2834
2942
|
optionSelected.active = true;
|
|
@@ -2854,7 +2962,7 @@ class InputWithSelectComponent {
|
|
|
2854
2962
|
InputWithSelectComponent.decorators = [
|
|
2855
2963
|
{ type: Component, args: [{
|
|
2856
2964
|
selector: 'wac-input-with-select',
|
|
2857
|
-
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)=\"
|
|
2965
|
+
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"
|
|
2858
2966
|
},] }
|
|
2859
2967
|
];
|
|
2860
2968
|
InputWithSelectComponent.ctorParameters = () => [];
|
|
@@ -3331,7 +3439,7 @@ class SelectedListComponent {
|
|
|
3331
3439
|
SelectedListComponent.decorators = [
|
|
3332
3440
|
{ type: Component, args: [{
|
|
3333
3441
|
selector: 'wac-selected-list',
|
|
3334
|
-
template: "<div class=\"selected-list\">\n <div class=\"selected-list__wrapper\">\n <div class=\"selected-list__wrapper__head\">\n <p *ngIf=\"label\" [innerHTML]=\"label\"></p>\n <ng-container *ngVar=\"(options | areAllOptionsSelected) as areAllOptionsSelected\">\n <
|
|
3442
|
+
template: "<div class=\"selected-list\">\n <div class=\"selected-list__wrapper\">\n <div class=\"selected-list__wrapper__head\">\n <p *ngIf=\"label\" [innerHTML]=\"label\"></p>\n <ng-container *ngVar=\"(options | areAllOptionsSelected) as areAllOptionsSelected\">\n <ng-container *ngIf=\"textSelectAll && !areAllOptionsSelected\">\n\n <span [innerHTML]=\"textSelectAll\" (click)=\"onSelectAll()\"></span>\n <div class=\"selected-list__wrapper__head__button\">\n <wac-button\n [extraClasses]=\"'is-grey'\"\n [icon]=\"'fa-duotone fa-check-double'\"\n (click)=\"onSelectAll()\"\n >\n </wac-button>\n </div>\n\n </ng-container>\n\n <ng-container *ngIf=\"textUnSelectAll && areAllOptionsSelected\">\n <span [innerHTML]=\"textUnSelectAll\" (click)=\"onUnSelectAll()\"></span>\n <div class=\"selected-list__wrapper__head__button\">\n <wac-button\n [extraClasses]=\"'is-grey'\"\n [icon]=\"'fa-duotone fa-check-double'\"\n (click)=\"onUnSelectAll()\"\n >\n </wac-button>\n </div>\n </ng-container>\n\n </ng-container>\n\n </div>\n <div class=\"selected-list__wrapper__content\">\n <div class=\"selected-list__wrapper__content__item\" *ngFor=\"let item of options;let i = index;\" [ngClass]=\"{'active': item.checked}\" (click)=\"onSelectItem(i)\">\n <span [innerHTML]=\"item.label\"></span>\n <i class=\"fas fa-check\"></i>\n </div>\n </div>\n </div>\n</div>\n"
|
|
3335
3443
|
},] }
|
|
3336
3444
|
];
|
|
3337
3445
|
SelectedListComponent.propDecorators = {
|
|
@@ -3622,5 +3730,5 @@ class TableFiltersGroup extends NwbFilterGroup {
|
|
|
3622
3730
|
* Generated bundle index. Do not edit.
|
|
3623
3731
|
*/
|
|
3624
3732
|
|
|
3625
|
-
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,
|
|
3733
|
+
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 };
|
|
3626
3734
|
//# sourceMappingURL=wizishop-angular-components.js.map
|