@wizishop/angular-components 0.0.119 → 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 +4757 -4757
- package/bundles/wizishop-angular-components.umd.js +272 -156
- 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/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/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 +254 -147
- 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.119.tgz +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wizishop/ng-wizi-bulma'), require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('ngx-perfect-scrollbar'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/overlay'), require('@angular/cdk/table'), require('@angular/animations'), require('ngx-chips'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@wizishop/angular-components', ['exports', '@wizishop/ng-wizi-bulma', '@angular/core', '@angular/common', '@angular/forms', 'ngx-perfect-scrollbar', 'rxjs', 'rxjs/operators', '@angular/cdk/overlay', '@angular/cdk/table', '@angular/animations', 'ngx-chips', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wizishop = global.wizishop || {}, global.wizishop['angular-components'] = {}), global['ng-wizi-bulma'], global.ng.core, global.ng.common, global.ng.forms, global['ngx-perfect-scrollbar'], global.rxjs, global.rxjs.operators, global.ng.cdk.overlay, global.ng.cdk.table, global.ng.animations, global['ngx-chips'], global
|
|
5
|
-
}(this, (function (exports, i1$1, i0, common, forms, ngxPerfectScrollbar, rxjs, operators, i1, table, animations, ngxChips,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@wizishop/ng-wizi-bulma'), require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('ngx-perfect-scrollbar'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/overlay'), require('@angular/cdk/table'), require('@angular/animations'), require('ngx-chips'), require('@ngx-translate/core'), require('@angular/router')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@wizishop/angular-components', ['exports', '@wizishop/ng-wizi-bulma', '@angular/core', '@angular/common', '@angular/forms', 'ngx-perfect-scrollbar', 'rxjs', 'rxjs/operators', '@angular/cdk/overlay', '@angular/cdk/table', '@angular/animations', 'ngx-chips', '@ngx-translate/core', '@angular/router'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wizishop = global.wizishop || {}, global.wizishop['angular-components'] = {}), global['ng-wizi-bulma'], global.ng.core, global.ng.common, global.ng.forms, global['ngx-perfect-scrollbar'], global.rxjs, global.rxjs.operators, global.ng.cdk.overlay, global.ng.cdk.table, global.ng.animations, global['ngx-chips'], global['@ngx-translate/core'], global.ng.router));
|
|
5
|
+
}(this, (function (exports, i1$1, i0, common, forms, ngxPerfectScrollbar, rxjs, operators, i1, table, animations, ngxChips, core, router) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -781,16 +781,249 @@
|
|
|
781
781
|
{ type: i1$1.NwbFilterRoutingBuilder }
|
|
782
782
|
]; };
|
|
783
783
|
|
|
784
|
+
var HtmlContainer = /** @class */ (function () {
|
|
785
|
+
function HtmlContainer(hostElement, appRef, componentFactoryResolver, injector) {
|
|
786
|
+
this.hostElement = hostElement;
|
|
787
|
+
this.appRef = appRef;
|
|
788
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
789
|
+
this.injector = injector;
|
|
790
|
+
this.attached = false;
|
|
791
|
+
}
|
|
792
|
+
HtmlContainer.prototype.attach = function (component) {
|
|
793
|
+
var _this = this;
|
|
794
|
+
if (this.attached) {
|
|
795
|
+
throw new Error('component has already been attached');
|
|
796
|
+
}
|
|
797
|
+
this.attached = true;
|
|
798
|
+
var childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
799
|
+
var componentRef = childComponentFactory.create(this.injector);
|
|
800
|
+
this.appRef.attachView(componentRef.hostView);
|
|
801
|
+
this.disposeFn = function () {
|
|
802
|
+
_this.appRef.detachView(componentRef.hostView);
|
|
803
|
+
componentRef.destroy();
|
|
804
|
+
};
|
|
805
|
+
this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
|
|
806
|
+
return componentRef;
|
|
807
|
+
};
|
|
808
|
+
HtmlContainer.prototype.dispose = function () {
|
|
809
|
+
if (this.attached) {
|
|
810
|
+
this.disposeFn();
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
return HtmlContainer;
|
|
814
|
+
}());
|
|
815
|
+
|
|
816
|
+
var TableCheckboxIdService = /** @class */ (function () {
|
|
817
|
+
function TableCheckboxIdService() {
|
|
818
|
+
this.nbCheckboxInstances = 0;
|
|
819
|
+
TableCheckboxIdService.tableInstance++;
|
|
820
|
+
this.currentTableInstance = TableCheckboxIdService.tableInstance;
|
|
821
|
+
}
|
|
822
|
+
TableCheckboxIdService.prototype.getUniqueId = function () {
|
|
823
|
+
this.nbCheckboxInstances++;
|
|
824
|
+
return "wac-table-" + this.currentTableInstance + "-" + this.nbCheckboxInstances;
|
|
825
|
+
};
|
|
826
|
+
return TableCheckboxIdService;
|
|
827
|
+
}());
|
|
828
|
+
TableCheckboxIdService.tableInstance = 0;
|
|
829
|
+
TableCheckboxIdService.decorators = [
|
|
830
|
+
{ type: i0.Injectable }
|
|
831
|
+
];
|
|
832
|
+
TableCheckboxIdService.ctorParameters = function () { return []; };
|
|
833
|
+
|
|
834
|
+
var CheckBoxRow = /** @class */ (function () {
|
|
835
|
+
function CheckBoxRow(currentRow, appRef, renderer, document, resolver, injector, tableCheckboxIdService) {
|
|
836
|
+
this.currentRow = currentRow;
|
|
837
|
+
this.appRef = appRef;
|
|
838
|
+
this.renderer = renderer;
|
|
839
|
+
this.document = document;
|
|
840
|
+
this.resolver = resolver;
|
|
841
|
+
this.injector = injector;
|
|
842
|
+
this.tableCheckboxIdService = tableCheckboxIdService;
|
|
843
|
+
this.checkBoxValueChange = new i0.EventEmitter();
|
|
844
|
+
}
|
|
845
|
+
Object.defineProperty(CheckBoxRow.prototype, "checkBoxValue", {
|
|
846
|
+
get: function () {
|
|
847
|
+
return this._value;
|
|
848
|
+
},
|
|
849
|
+
set: function (value) {
|
|
850
|
+
this._value = value;
|
|
851
|
+
if (this.checkboxComponentRef) {
|
|
852
|
+
this.setCheckBoxValue();
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
enumerable: false,
|
|
856
|
+
configurable: true
|
|
857
|
+
});
|
|
858
|
+
CheckBoxRow.prototype.ngOnInit = function () {
|
|
859
|
+
this.createCheckBoxComponent();
|
|
860
|
+
this.handleChecboxInputs();
|
|
861
|
+
this.handleCheckboxOutputs();
|
|
862
|
+
};
|
|
863
|
+
CheckBoxRow.prototype.createCheckBoxComponent = function () {
|
|
864
|
+
// Create the container
|
|
865
|
+
this.checkBoxElement = document.createElement('div');
|
|
866
|
+
this.checkBoxElement.className = 'wac-table__body__line__cell wac-table__body__line__cell--checkbox';
|
|
867
|
+
// Insert divCheckBox in the DOM as the first child of the row
|
|
868
|
+
this.renderer.insertBefore(this.currentRow.nativeElement, this.checkBoxElement, this.currentRow.nativeElement.firstChild);
|
|
869
|
+
// Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
|
|
870
|
+
this.htmlContainer = new HtmlContainer(this.checkBoxElement, this.appRef, this.resolver, this.injector);
|
|
871
|
+
this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
|
|
872
|
+
};
|
|
873
|
+
CheckBoxRow.prototype.handleChecboxInputs = function () {
|
|
874
|
+
this.checkboxComponentRef.instance.id = this.checkBoxId ? '' + this.checkBoxId : this.tableCheckboxIdService.getUniqueId();
|
|
875
|
+
this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
|
|
876
|
+
this.checkboxComponentRef.instance.alone = true;
|
|
877
|
+
this.setCheckBoxValue();
|
|
878
|
+
};
|
|
879
|
+
CheckBoxRow.prototype.setCheckBoxValue = function () {
|
|
880
|
+
this.checkboxComponentRef.instance.value = this.checkBoxValue;
|
|
881
|
+
};
|
|
882
|
+
CheckBoxRow.prototype.handleCheckboxOutputs = function () {
|
|
883
|
+
var _this = this;
|
|
884
|
+
// Detect checkbox changes
|
|
885
|
+
this.checkboxComponentRef.instance.registerOnChange(function () {
|
|
886
|
+
_this._toggleCheckbox();
|
|
887
|
+
});
|
|
888
|
+
};
|
|
889
|
+
CheckBoxRow.prototype._toggleCheckbox = function () {
|
|
890
|
+
this.checkBoxValueChange.emit(this.checkBoxValue);
|
|
891
|
+
};
|
|
892
|
+
CheckBoxRow.prototype.getElement = function () {
|
|
893
|
+
return this.checkBoxElement.querySelector('.wac-field-checkbox');
|
|
894
|
+
};
|
|
895
|
+
CheckBoxRow.prototype.isActive = function () {
|
|
896
|
+
return !!this.checkboxComponentRef.instance.value;
|
|
897
|
+
};
|
|
898
|
+
CheckBoxRow.prototype.setActive = function (isActive) {
|
|
899
|
+
this.checkboxComponentRef.instance.value = isActive; //? does not trigger output
|
|
900
|
+
};
|
|
901
|
+
CheckBoxRow.prototype.ngOnDestroy = function () {
|
|
902
|
+
this.htmlContainer.dispose();
|
|
903
|
+
};
|
|
904
|
+
return CheckBoxRow;
|
|
905
|
+
}());
|
|
906
|
+
CheckBoxRow.decorators = [
|
|
907
|
+
{ type: i0.Directive, args: [{
|
|
908
|
+
selector: '[checkBoxRow]'
|
|
909
|
+
},] }
|
|
910
|
+
];
|
|
911
|
+
CheckBoxRow.ctorParameters = function () { return [
|
|
912
|
+
{ type: i0.ElementRef },
|
|
913
|
+
{ type: i0.ApplicationRef },
|
|
914
|
+
{ type: i0.Renderer2 },
|
|
915
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
|
|
916
|
+
{ type: i0.ComponentFactoryResolver },
|
|
917
|
+
{ type: i0.Injector },
|
|
918
|
+
{ type: TableCheckboxIdService }
|
|
919
|
+
]; };
|
|
920
|
+
CheckBoxRow.propDecorators = {
|
|
921
|
+
checkBoxId: [{ type: i0.Input, args: ['checkBoxId',] }],
|
|
922
|
+
checkBoxName: [{ type: i0.Input, args: ['checkBoxName',] }],
|
|
923
|
+
checkBoxValue: [{ type: i0.Input, args: ['checkBoxValue',] }],
|
|
924
|
+
checkBoxValueChange: [{ type: i0.Output }]
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
var MultiSelectionService = /** @class */ (function () {
|
|
928
|
+
function MultiSelectionService() {
|
|
929
|
+
this.activeChanges = new rxjs.Subject();
|
|
930
|
+
this.activeChanges$ = this.activeChanges.asObservable();
|
|
931
|
+
}
|
|
932
|
+
MultiSelectionService.prototype.handle = function (items, toggleSingleItem) {
|
|
933
|
+
var _this = this;
|
|
934
|
+
if (toggleSingleItem === void 0) { toggleSingleItem = false; }
|
|
935
|
+
if (!items || !items.first) {
|
|
936
|
+
this.destroy();
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
this.destroy(); // close previous subsciption
|
|
940
|
+
this.items = items;
|
|
941
|
+
var clicks$ = this.getListeners();
|
|
942
|
+
this.subscription = rxjs.merge.apply(void 0, __spread(clicks$)).subscribe(function (_b) {
|
|
943
|
+
var component = _b.component, isShiftKeyPressed = _b.isShift, index = _b.index;
|
|
944
|
+
if (!isShiftKeyPressed) {
|
|
945
|
+
if (toggleSingleItem) {
|
|
946
|
+
component.setActive(!component.isActive());
|
|
947
|
+
}
|
|
948
|
+
_this.activeChanges.next([index]);
|
|
949
|
+
_this.lastIndex = index;
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
var start = index;
|
|
953
|
+
var end = _this.lastIndex;
|
|
954
|
+
var _c = __read([Math.min(start, end), Math.max(start, end) + 1], 2), first = _c[0], last = _c[1];
|
|
955
|
+
var itemsSelection = _this.items.toArray().slice(first, last);
|
|
956
|
+
var isBeginnerItemActive = _this.items.get(end).isActive();
|
|
957
|
+
itemsSelection.forEach(function (current) { return current.setActive(isBeginnerItemActive); });
|
|
958
|
+
window.getSelection().removeAllRanges(); // remove text selection
|
|
959
|
+
var indexInRange = Array.from({ length: last - first }, function (x, i) { return i + first; });
|
|
960
|
+
_this.activeChanges.next(indexInRange);
|
|
961
|
+
});
|
|
962
|
+
};
|
|
963
|
+
MultiSelectionService.prototype.getListeners = function () {
|
|
964
|
+
return this.items.map(function (item, index) {
|
|
965
|
+
return rxjs.fromEvent(item.getElement(), 'click').pipe(operators.map(function (event) {
|
|
966
|
+
return {
|
|
967
|
+
index: index,
|
|
968
|
+
isShift: event.shiftKey,
|
|
969
|
+
component: item
|
|
970
|
+
};
|
|
971
|
+
}))
|
|
972
|
+
.pipe(operators.debounceTime(100)); // debounced, because when clicking on a wac-checkbox it is emitted twice and can not find why
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
MultiSelectionService.prototype.getActives = function () {
|
|
976
|
+
return this.items.filter(function (item) { return item.isActive(); });
|
|
977
|
+
};
|
|
978
|
+
MultiSelectionService.prototype.destroy = function () {
|
|
979
|
+
var _a;
|
|
980
|
+
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
981
|
+
};
|
|
982
|
+
return MultiSelectionService;
|
|
983
|
+
}());
|
|
984
|
+
MultiSelectionService.decorators = [
|
|
985
|
+
{ type: i0.Injectable }
|
|
986
|
+
];
|
|
987
|
+
MultiSelectionService.ctorParameters = function () { return []; };
|
|
988
|
+
|
|
989
|
+
var TableRow = /** @class */ (function () {
|
|
990
|
+
function TableRow(currentCell, renderer, document) {
|
|
991
|
+
this.currentCell = currentCell;
|
|
992
|
+
this.renderer = renderer;
|
|
993
|
+
this.document = document;
|
|
994
|
+
}
|
|
995
|
+
TableRow.prototype.ngAfterViewInit = function () {
|
|
996
|
+
this.applyCustomStylesOnCell();
|
|
997
|
+
};
|
|
998
|
+
TableRow.prototype.applyCustomStylesOnCell = function () {
|
|
999
|
+
this.renderer.addClass(this.currentCell.nativeElement, 'wac-table__body__line');
|
|
1000
|
+
};
|
|
1001
|
+
return TableRow;
|
|
1002
|
+
}());
|
|
1003
|
+
TableRow.decorators = [
|
|
1004
|
+
{ type: i0.Directive, args: [{
|
|
1005
|
+
// The selector has the same name as the tableRaw selector in table.component.html
|
|
1006
|
+
selector: '[tableRow]'
|
|
1007
|
+
},] }
|
|
1008
|
+
];
|
|
1009
|
+
TableRow.ctorParameters = function () { return [
|
|
1010
|
+
{ type: i0.ElementRef },
|
|
1011
|
+
{ type: i0.Renderer2 },
|
|
1012
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
|
1013
|
+
]; };
|
|
1014
|
+
|
|
784
1015
|
var TableComponent = /** @class */ (function () {
|
|
785
|
-
function TableComponent(filtersTableService) {
|
|
1016
|
+
function TableComponent(filtersTableService, tableCheckboxIdService, multiSelectionService) {
|
|
786
1017
|
this.filtersTableService = filtersTableService;
|
|
1018
|
+
this.tableCheckboxIdService = tableCheckboxIdService;
|
|
1019
|
+
this.multiSelectionService = multiSelectionService;
|
|
787
1020
|
this.tableFiltersChange = new i0.EventEmitter();
|
|
788
1021
|
this.placeholder = '';
|
|
789
1022
|
/// Input/Output of checkbox ///
|
|
790
1023
|
/** Pass to true to display checkbox in the header table */
|
|
791
1024
|
this.checkbox = false;
|
|
792
|
-
|
|
793
|
-
this.
|
|
1025
|
+
this.toggleAllCheckBox = new i0.EventEmitter(); // todo replace by checkBoxSelectionChange
|
|
1026
|
+
this.checkBoxSelectionChange = new i0.EventEmitter(); // todo add to doc
|
|
794
1027
|
/// Input to disable section ///
|
|
795
1028
|
/** Pass to true to hide search input */
|
|
796
1029
|
this.disableSearch = false;
|
|
@@ -801,17 +1034,28 @@
|
|
|
801
1034
|
}
|
|
802
1035
|
TableComponent.prototype.ngOnInit = function () {
|
|
803
1036
|
var _this = this;
|
|
804
|
-
this.headerCheckBoxId =
|
|
1037
|
+
this.headerCheckBoxId = this.tableCheckboxIdService.getUniqueId(); // Create checkbox unique id
|
|
805
1038
|
/* Handle routing filters */
|
|
806
1039
|
if (this.tableRoutingName) {
|
|
807
1040
|
this.filtersTableService.setInitialPaginationFiltersIfNotExist(this.tableRoutingName, this.tableFilters.itemsPerPage, this.tableFilters.currentPage);
|
|
808
1041
|
this._tableFiltersGroup = this.filtersTableService.getTableFilterGroup(this.tableRoutingName);
|
|
809
1042
|
this.setTablesFilters();
|
|
810
1043
|
// Listen to filters changes with debounced time to limit multiple api calls
|
|
811
|
-
this.filterGroupChangeSub = this._tableFiltersGroup.valuesChange$.subscribe(function (
|
|
1044
|
+
this.filterGroupChangeSub = this._tableFiltersGroup.valuesChange$.subscribe(function () {
|
|
812
1045
|
_this.setTablesFilters();
|
|
813
1046
|
});
|
|
814
1047
|
}
|
|
1048
|
+
this.multiSelectionService.activeChanges$.subscribe(function (selectionIndexRawCheckChange) {
|
|
1049
|
+
_this.checkBoxSelectionChange.emit(selectionIndexRawCheckChange);
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
TableComponent.prototype.ngAfterViewInit = function () {
|
|
1053
|
+
var _this = this;
|
|
1054
|
+
this.multiSelectionService.handle(this.checkBoxRows);
|
|
1055
|
+
this.checkBoxRows.changes.subscribe(function () {
|
|
1056
|
+
_this.multiSelectionService.handle(_this.checkBoxRows);
|
|
1057
|
+
});
|
|
1058
|
+
console.log('this.tableRows', this.tableRows);
|
|
815
1059
|
};
|
|
816
1060
|
TableComponent.prototype.onToggleAllCheckBox = function (event) {
|
|
817
1061
|
this.toggleAllCheckBox.emit(event.target.checked);
|
|
@@ -856,10 +1100,11 @@
|
|
|
856
1100
|
this.tableFiltersChange.emit(this.tableFilters);
|
|
857
1101
|
this._tableFiltersGroup.tableFiltersValuesChange$.next(this.tableFilters);
|
|
858
1102
|
};
|
|
859
|
-
TableComponent.prototype.
|
|
1103
|
+
TableComponent.prototype.ngOnDestroy = function () {
|
|
860
1104
|
if (this.filterGroupChangeSub) {
|
|
861
1105
|
this.filterGroupChangeSub.unsubscribe();
|
|
862
1106
|
}
|
|
1107
|
+
this.multiSelectionService.destroy();
|
|
863
1108
|
};
|
|
864
1109
|
return TableComponent;
|
|
865
1110
|
}());
|
|
@@ -867,19 +1112,28 @@
|
|
|
867
1112
|
{ type: i0.Component, args: [{
|
|
868
1113
|
selector: 'wac-table',
|
|
869
1114
|
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",
|
|
870
|
-
encapsulation: i0.ViewEncapsulation.None
|
|
1115
|
+
encapsulation: i0.ViewEncapsulation.None,
|
|
1116
|
+
providers: [
|
|
1117
|
+
TableCheckboxIdService,
|
|
1118
|
+
MultiSelectionService
|
|
1119
|
+
]
|
|
871
1120
|
},] }
|
|
872
1121
|
];
|
|
873
1122
|
TableComponent.ctorParameters = function () { return [
|
|
874
|
-
{ type: FiltersTableService }
|
|
1123
|
+
{ type: FiltersTableService },
|
|
1124
|
+
{ type: TableCheckboxIdService },
|
|
1125
|
+
{ type: MultiSelectionService }
|
|
875
1126
|
]; };
|
|
876
1127
|
TableComponent.propDecorators = {
|
|
1128
|
+
checkBoxRows: [{ type: i0.ContentChildren, args: [CheckBoxRow,] }],
|
|
1129
|
+
tableRows: [{ type: i0.ContentChildren, args: [TableRow,] }],
|
|
877
1130
|
tableFilters: [{ type: i0.Input }],
|
|
878
1131
|
tableFiltersChange: [{ type: i0.Output }],
|
|
879
1132
|
tableRoutingName: [{ type: i0.Input }],
|
|
880
1133
|
placeholder: [{ type: i0.Input }],
|
|
881
1134
|
checkbox: [{ type: i0.Input }],
|
|
882
1135
|
toggleAllCheckBox: [{ type: i0.Output }],
|
|
1136
|
+
checkBoxSelectionChange: [{ type: i0.Output }],
|
|
883
1137
|
disableSearch: [{ type: i0.Input }],
|
|
884
1138
|
disablePagniation: [{ type: i0.Input }],
|
|
885
1139
|
isLoading: [{ type: i0.Input }]
|
|
@@ -1703,6 +1957,7 @@
|
|
|
1703
1957
|
|
|
1704
1958
|
var TextAreaComponent = /** @class */ (function () {
|
|
1705
1959
|
function TextAreaComponent() {
|
|
1960
|
+
// todo simplify and improve progress bar
|
|
1706
1961
|
this.label = '';
|
|
1707
1962
|
this.value = '';
|
|
1708
1963
|
this.placeholder = '';
|
|
@@ -2445,121 +2700,6 @@
|
|
|
2445
2700
|
},] }
|
|
2446
2701
|
];
|
|
2447
2702
|
|
|
2448
|
-
var HtmlContainer = /** @class */ (function () {
|
|
2449
|
-
function HtmlContainer(hostElement, appRef, componentFactoryResolver, injector) {
|
|
2450
|
-
this.hostElement = hostElement;
|
|
2451
|
-
this.appRef = appRef;
|
|
2452
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
2453
|
-
this.injector = injector;
|
|
2454
|
-
this.attached = false;
|
|
2455
|
-
}
|
|
2456
|
-
HtmlContainer.prototype.attach = function (component) {
|
|
2457
|
-
var _this = this;
|
|
2458
|
-
if (this.attached) {
|
|
2459
|
-
throw new Error('component has already been attached');
|
|
2460
|
-
}
|
|
2461
|
-
this.attached = true;
|
|
2462
|
-
var childComponentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
|
|
2463
|
-
var componentRef = childComponentFactory.create(this.injector);
|
|
2464
|
-
this.appRef.attachView(componentRef.hostView);
|
|
2465
|
-
this.disposeFn = function () {
|
|
2466
|
-
_this.appRef.detachView(componentRef.hostView);
|
|
2467
|
-
componentRef.destroy();
|
|
2468
|
-
};
|
|
2469
|
-
this.hostElement.appendChild(componentRef.hostView.rootNodes[0]);
|
|
2470
|
-
return componentRef;
|
|
2471
|
-
};
|
|
2472
|
-
HtmlContainer.prototype.dispose = function () {
|
|
2473
|
-
if (this.attached) {
|
|
2474
|
-
this.disposeFn();
|
|
2475
|
-
}
|
|
2476
|
-
};
|
|
2477
|
-
return HtmlContainer;
|
|
2478
|
-
}());
|
|
2479
|
-
|
|
2480
|
-
var CheckBoxRow = /** @class */ (function () {
|
|
2481
|
-
function CheckBoxRow(currentRow, appRef, renderer, document, resolver, injector) {
|
|
2482
|
-
this.currentRow = currentRow;
|
|
2483
|
-
this.appRef = appRef;
|
|
2484
|
-
this.renderer = renderer;
|
|
2485
|
-
this.document = document;
|
|
2486
|
-
this.resolver = resolver;
|
|
2487
|
-
this.injector = injector;
|
|
2488
|
-
this.checkBoxValueChange = new i0.EventEmitter();
|
|
2489
|
-
}
|
|
2490
|
-
Object.defineProperty(CheckBoxRow.prototype, "checkBoxValue", {
|
|
2491
|
-
get: function () {
|
|
2492
|
-
return this._value;
|
|
2493
|
-
},
|
|
2494
|
-
set: function (value) {
|
|
2495
|
-
this._value = value;
|
|
2496
|
-
if (this.checkboxComponentRef) {
|
|
2497
|
-
this.setCheckBoxValue();
|
|
2498
|
-
}
|
|
2499
|
-
},
|
|
2500
|
-
enumerable: false,
|
|
2501
|
-
configurable: true
|
|
2502
|
-
});
|
|
2503
|
-
CheckBoxRow.prototype.ngOnInit = function () {
|
|
2504
|
-
this.createCheckBoxComponent();
|
|
2505
|
-
this.handleChecboxInputs();
|
|
2506
|
-
this.handleCheckboxOutputs();
|
|
2507
|
-
};
|
|
2508
|
-
CheckBoxRow.prototype.createCheckBoxComponent = function () {
|
|
2509
|
-
// Create the container
|
|
2510
|
-
var checkBoxContainer = document.createElement('div');
|
|
2511
|
-
checkBoxContainer.className = 'wac-table__body__line__cell wac-table__body__line__cell--checkbox';
|
|
2512
|
-
// Insert divCheckBox in the DOM as the first child of the row
|
|
2513
|
-
this.renderer.insertBefore(this.currentRow.nativeElement, checkBoxContainer, this.currentRow.nativeElement.firstChild);
|
|
2514
|
-
// Insert the CheckBoxComponent inside the container (DOM and Angular DOM)
|
|
2515
|
-
this.htmlContainer = new HtmlContainer(checkBoxContainer, this.appRef, this.resolver, this.injector);
|
|
2516
|
-
this.checkboxComponentRef = this.htmlContainer.attach(CheckboxComponent);
|
|
2517
|
-
};
|
|
2518
|
-
CheckBoxRow.prototype.handleChecboxInputs = function () {
|
|
2519
|
-
this.checkboxComponentRef.instance.id = this.checkBoxId ? this.checkBoxId : uuid.v4();
|
|
2520
|
-
this.checkboxComponentRef.instance.name = this.checkBoxName ? this.checkBoxName : undefined;
|
|
2521
|
-
this.checkboxComponentRef.instance.alone = true;
|
|
2522
|
-
this.setCheckBoxValue();
|
|
2523
|
-
};
|
|
2524
|
-
CheckBoxRow.prototype.setCheckBoxValue = function () {
|
|
2525
|
-
this.checkboxComponentRef.instance.value = this.checkBoxValue;
|
|
2526
|
-
};
|
|
2527
|
-
CheckBoxRow.prototype.handleCheckboxOutputs = function () {
|
|
2528
|
-
var _this = this;
|
|
2529
|
-
// Detect checkbox changes
|
|
2530
|
-
this.checkboxComponentRef.instance.registerOnChange(function () {
|
|
2531
|
-
_this._toggleCheckbox();
|
|
2532
|
-
});
|
|
2533
|
-
};
|
|
2534
|
-
CheckBoxRow.prototype._toggleCheckbox = function () {
|
|
2535
|
-
this.checkBoxValue = !this.checkBoxValue;
|
|
2536
|
-
this.checkBoxValueChange.emit(this.checkBoxValue);
|
|
2537
|
-
};
|
|
2538
|
-
CheckBoxRow.prototype.ngOnDestroy = function () {
|
|
2539
|
-
this.htmlContainer.dispose();
|
|
2540
|
-
};
|
|
2541
|
-
return CheckBoxRow;
|
|
2542
|
-
}());
|
|
2543
|
-
CheckBoxRow.decorators = [
|
|
2544
|
-
{ type: i0.Directive, args: [{
|
|
2545
|
-
selector: '[checkBoxRow]'
|
|
2546
|
-
},] }
|
|
2547
|
-
];
|
|
2548
|
-
CheckBoxRow.ctorParameters = function () { return [
|
|
2549
|
-
{ type: i0.ElementRef },
|
|
2550
|
-
{ type: i0.ApplicationRef },
|
|
2551
|
-
{ type: i0.Renderer2 },
|
|
2552
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
|
|
2553
|
-
{ type: i0.ComponentFactoryResolver },
|
|
2554
|
-
{ type: i0.Injector }
|
|
2555
|
-
]; };
|
|
2556
|
-
CheckBoxRow.propDecorators = {
|
|
2557
|
-
checkBoxId: [{ type: i0.Input, args: ['checkBoxId',] }],
|
|
2558
|
-
checkBoxName: [{ type: i0.Input, args: ['checkBoxName',] }],
|
|
2559
|
-
checkBoxValue: [{ type: i0.Input, args: ['checkBoxValue',] }],
|
|
2560
|
-
checkBoxValueChange: [{ type: i0.Output }]
|
|
2561
|
-
};
|
|
2562
|
-
|
|
2563
2703
|
var TableColumn = /** @class */ (function () {
|
|
2564
2704
|
function TableColumn(currentCell, renderer, document) {
|
|
2565
2705
|
this.currentCell = currentCell;
|
|
@@ -2793,32 +2933,6 @@
|
|
|
2793
2933
|
tableFiltersChange: [{ type: i0.Output }]
|
|
2794
2934
|
};
|
|
2795
2935
|
|
|
2796
|
-
var TableRow = /** @class */ (function () {
|
|
2797
|
-
function TableRow(currentCell, renderer, document) {
|
|
2798
|
-
this.currentCell = currentCell;
|
|
2799
|
-
this.renderer = renderer;
|
|
2800
|
-
this.document = document;
|
|
2801
|
-
}
|
|
2802
|
-
TableRow.prototype.ngAfterViewInit = function () {
|
|
2803
|
-
this.applyCustomStylesOnCell();
|
|
2804
|
-
};
|
|
2805
|
-
TableRow.prototype.applyCustomStylesOnCell = function () {
|
|
2806
|
-
this.renderer.addClass(this.currentCell.nativeElement, 'wac-table__body__line');
|
|
2807
|
-
};
|
|
2808
|
-
return TableRow;
|
|
2809
|
-
}());
|
|
2810
|
-
TableRow.decorators = [
|
|
2811
|
-
{ type: i0.Directive, args: [{
|
|
2812
|
-
// The selector has the same name as the tableRaw selector in table.component.html
|
|
2813
|
-
selector: '[tableRow]'
|
|
2814
|
-
},] }
|
|
2815
|
-
];
|
|
2816
|
-
TableRow.ctorParameters = function () { return [
|
|
2817
|
-
{ type: i0.ElementRef },
|
|
2818
|
-
{ type: i0.Renderer2 },
|
|
2819
|
-
{ type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
|
|
2820
|
-
]; };
|
|
2821
|
-
|
|
2822
2936
|
var directives$1 = [TableColumn, CheckBoxRow, TableColumnHeader, TableRow,];
|
|
2823
2937
|
var TableModule = /** @class */ (function () {
|
|
2824
2938
|
function TableModule() {
|
|
@@ -3288,7 +3402,7 @@
|
|
|
3288
3402
|
}
|
|
3289
3403
|
});
|
|
3290
3404
|
};
|
|
3291
|
-
InputWithSelectComponent.prototype.
|
|
3405
|
+
InputWithSelectComponent.prototype.onClickItem = function (index) {
|
|
3292
3406
|
this.unActiveAll();
|
|
3293
3407
|
var optionSelected = this.options[index];
|
|
3294
3408
|
optionSelected.active = true;
|
|
@@ -3315,7 +3429,7 @@
|
|
|
3315
3429
|
InputWithSelectComponent.decorators = [
|
|
3316
3430
|
{ type: i0.Component, args: [{
|
|
3317
3431
|
selector: 'wac-input-with-select',
|
|
3318
|
-
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)=\"
|
|
3432
|
+
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"
|
|
3319
3433
|
},] }
|
|
3320
3434
|
];
|
|
3321
3435
|
InputWithSelectComponent.ctorParameters = function () { return []; };
|
|
@@ -4228,7 +4342,9 @@
|
|
|
4228
4342
|
exports.ɵk = LoaderModule;
|
|
4229
4343
|
exports.ɵl = CheckboxModule;
|
|
4230
4344
|
exports.ɵm = inOutY;
|
|
4231
|
-
exports.ɵn =
|
|
4345
|
+
exports.ɵn = TableCheckboxIdService;
|
|
4346
|
+
exports.ɵo = MultiSelectionService;
|
|
4347
|
+
exports.ɵp = inOutX;
|
|
4232
4348
|
|
|
4233
4349
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4234
4350
|
|