@leanix/components 0.2.48 → 0.2.52

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.
@@ -94,13 +94,13 @@
94
94
  return ButtonGroupComponent;
95
95
  }());
96
96
  ButtonGroupComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: ButtonGroupComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
97
- ButtonGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.4", type: ButtonGroupComponent, selector: "lx-button-group", inputs: { separator: "separator" }, host: { properties: { "class.marginSeparator": "this.hasMarginSeperator", "class.borderSeparator": "this.hasBorderSeparator" } }, ngImport: i0__namespace, template: "<ng-content></ng-content>\n", styles: [":host{display:inline-block}:host.marginSeparator>>>[lx-button]:not(:last-child){margin-right:1px}:host.borderSeparator>>>[lx-button]:not(:last-child){border-right:none!important}:host.borderSeparator>>>[lx-button]:not(:last-child):hover{border-right:none!important}:host>>>[lx-button]:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}:host>>>[lx-button]:not(:first-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host>>>lx-options-dropdown button[lx-button]:last-of-type{border-top-left-radius:0;border-bottom-left-radius:0}"] });
97
+ ButtonGroupComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.4", type: ButtonGroupComponent, selector: "lx-button-group", inputs: { separator: "separator" }, host: { properties: { "class.marginSeparator": "this.hasMarginSeperator", "class.borderSeparator": "this.hasBorderSeparator" } }, ngImport: i0__namespace, template: "<ng-content></ng-content>\n", styles: [":host{display:inline-block}:host.marginSeparator ::ng-deep [lx-button]:not(:last-child){margin-right:1px}:host.borderSeparator ::ng-deep [lx-button]:not(:last-child){border-right:none!important}:host.borderSeparator ::ng-deep [lx-button]:not(:last-child):hover{border-right:none!important}:host ::ng-deep [lx-button]:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}:host ::ng-deep [lx-button]:not(:first-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host ::ng-deep lx-options-dropdown button[lx-button]:last-of-type{border-top-left-radius:0;border-bottom-left-radius:0}"] });
98
98
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: ButtonGroupComponent, decorators: [{
99
99
  type: i0.Component,
100
100
  args: [{
101
101
  selector: 'lx-button-group',
102
102
  templateUrl: 'button-group.component.html',
103
- styleUrls: ['button-group.component.styl']
103
+ styleUrls: ['button-group.component.scss']
104
104
  }]
105
105
  }], propDecorators: { separator: [{
106
106
  type: i0.Input
@@ -1067,6 +1067,141 @@
1067
1067
  type: i0.Input
1068
1068
  }] } });
1069
1069
 
1070
+ var TableHeaderComponent = /** @class */ (function () {
1071
+ function TableHeaderComponent(elmentRef, changeDetection) {
1072
+ this.elmentRef = elmentRef;
1073
+ this.changeDetection = changeDetection;
1074
+ this.sortChange = new i0.EventEmitter();
1075
+ this.sortable = false;
1076
+ }
1077
+ TableHeaderComponent.prototype.onSort = function () {
1078
+ if (this.column) {
1079
+ if (!this.order) {
1080
+ this.order = 'ASC';
1081
+ }
1082
+ else if (this.order === 'ASC') {
1083
+ this.order = 'DESC';
1084
+ }
1085
+ else {
1086
+ this.order = undefined;
1087
+ }
1088
+ this.sortChange.emit({ key: this.order ? this.column : undefined, order: this.order });
1089
+ }
1090
+ };
1091
+ Object.defineProperty(TableHeaderComponent.prototype, "order", {
1092
+ get: function () {
1093
+ return this._order;
1094
+ },
1095
+ set: function (value) {
1096
+ this._order = value;
1097
+ this.changeDetection.markForCheck();
1098
+ },
1099
+ enumerable: false,
1100
+ configurable: true
1101
+ });
1102
+ Object.defineProperty(TableHeaderComponent.prototype, "isTabable", {
1103
+ set: function (tabable) {
1104
+ this.elmentRef.nativeElement.tabIndex = tabable ? 0 : -1;
1105
+ },
1106
+ enumerable: false,
1107
+ configurable: true
1108
+ });
1109
+ return TableHeaderComponent;
1110
+ }());
1111
+ TableHeaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: TableHeaderComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1112
+ TableHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.4", type: TableHeaderComponent, selector: "lx-th", inputs: { column: "column" }, outputs: { sortChange: "sortChange" }, host: { listeners: { "keydown.enter": "onSort()", "click": "onSort()" }, properties: { "class.sortable": "this.sortable" } }, ngImport: i0__namespace, template: "<span>\n <ng-content></ng-content>\n</span>\n<i class=\"fas\" [class.fa-sort-up]=\"order === 'ASC'\" [class.fa-sort-down]=\"order === 'DESC'\" *ngIf=\"order && sortable\"></i>\n", styles: [":root{--lx-color-danger:$colorFunctionalRed;--lx-color-grey80:$colorGray80;--lx-color-grey90:$colorGray90}:host{display:table-cell;padding:8px;vertical-align:bottom;border-bottom:2px solid #e1e5eb;border-top:none;font-weight:700}:host.sortable span{color:var(--lx-anchor-fontcolor);cursor:pointer}:host.sortable span:hover{text-decoration:underline}i{margin-left:4px;cursor:pointer}"], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1113
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: TableHeaderComponent, decorators: [{
1114
+ type: i0.Component,
1115
+ args: [{
1116
+ selector: 'lx-th',
1117
+ templateUrl: './table-header.component.html',
1118
+ styleUrls: ['./table-header.component.scss'],
1119
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1120
+ }]
1121
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { column: [{
1122
+ type: i0.Input
1123
+ }], sortChange: [{
1124
+ type: i0.Output
1125
+ }], sortable: [{
1126
+ type: i0.HostBinding,
1127
+ args: ['class.sortable']
1128
+ }], onSort: [{
1129
+ type: i0.HostListener,
1130
+ args: ['keydown.enter']
1131
+ }, {
1132
+ type: i0.HostListener,
1133
+ args: ['click']
1134
+ }] } });
1135
+
1136
+ // tslint:disable-next-line: directive-class-suffix
1137
+ var TableComponent = /** @class */ (function () {
1138
+ function TableComponent(elementRef) {
1139
+ this.elementRef = elementRef;
1140
+ this.isSortable = false;
1141
+ this.sortChange = new i0.EventEmitter();
1142
+ this.elementRef.nativeElement.classList.add('table', 'table-hover');
1143
+ }
1144
+ TableComponent.prototype.ngOnChanges = function (changes) {
1145
+ var _this = this;
1146
+ if (changes['sort'] && this.tableHeaders) {
1147
+ this.tableHeaders.forEach(function (header) {
1148
+ _this.setSortValueOnHeader(header);
1149
+ });
1150
+ }
1151
+ if (changes['isSortable'] && this.tableHeaders) {
1152
+ this.tableHeaders.forEach(function (header) {
1153
+ header.sortable = _this.isSortable;
1154
+ header.isTabable = _this.isSortable;
1155
+ });
1156
+ }
1157
+ };
1158
+ TableComponent.prototype.ngAfterContentInit = function () {
1159
+ var _this = this;
1160
+ this.tableHeaders.forEach(function (header) {
1161
+ header.sortable = _this.isSortable;
1162
+ header.isTabable = _this.isSortable;
1163
+ if (_this.sort) {
1164
+ _this.setSortValueOnHeader(header);
1165
+ }
1166
+ });
1167
+ var sortChange$ = i6.merge.apply(void 0, __spreadArray([], __read(this.tableHeaders.map(function (header) { return header.sortChange.asObservable(); }))));
1168
+ sortChange$.subscribe(function (change) {
1169
+ _this.tableHeaders.forEach(function (header) {
1170
+ _this.setSortValueOnHeader(header);
1171
+ });
1172
+ _this.sortChange.emit(change);
1173
+ });
1174
+ };
1175
+ TableComponent.prototype.setSortValueOnHeader = function (header) {
1176
+ var _a, _b;
1177
+ if (header.column !== ((_a = this.sort) === null || _a === void 0 ? void 0 : _a.key)) {
1178
+ header.order = undefined;
1179
+ }
1180
+ else {
1181
+ header.order = (_b = this.sort) === null || _b === void 0 ? void 0 : _b.order;
1182
+ }
1183
+ };
1184
+ return TableComponent;
1185
+ }());
1186
+ TableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: TableComponent, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1187
+ TableComponent.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.4", type: TableComponent, selector: "table[lx-table]", inputs: { isSortable: "isSortable", sort: "sort" }, outputs: { sortChange: "sortChange" }, queries: [{ propertyName: "tableHeaders", predicate: TableHeaderComponent, descendants: true }], usesOnChanges: true, ngImport: i0__namespace });
1188
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.4", ngImport: i0__namespace, type: TableComponent, decorators: [{
1189
+ type: i0.Directive,
1190
+ args: [{
1191
+ // tslint:disable-next-line: directive-selector
1192
+ selector: 'table[lx-table]'
1193
+ }]
1194
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { isSortable: [{
1195
+ type: i0.Input
1196
+ }], sort: [{
1197
+ type: i0.Input
1198
+ }], sortChange: [{
1199
+ type: i0.Output
1200
+ }], tableHeaders: [{
1201
+ type: i0.ContentChildren,
1202
+ args: [TableHeaderComponent, { descendants: true }]
1203
+ }] } });
1204
+
1070
1205
  /**
1071
1206
  * Allows to register an event handler for the "AfterViewInit" lifecycle hook.
1072
1207
  * This can be used to do something whenever a component enters the view. This
@@ -1477,10 +1612,12 @@
1477
1612
  if (!items) {
1478
1613
  return [];
1479
1614
  }
1480
- if (options.caseInsensitive) {
1481
- return options.key ? fp.sortBy(getValueForKey(options.key), items) : items.slice().sort(sortStringCaseInsensitive());
1615
+ if (options.order !== 'DESC') {
1616
+ return applySorting(options, items);
1617
+ }
1618
+ else {
1619
+ return applySorting(options, items).reverse();
1482
1620
  }
1483
- return options.key ? fp.sortBy(function (item) { return fp.get(options.key, item); }, items) : items.slice().sort();
1484
1621
  };
1485
1622
  return SortPipe;
1486
1623
  }());
@@ -1490,6 +1627,12 @@
1490
1627
  type: i0.Pipe,
1491
1628
  args: [{ name: 'lxSort' }]
1492
1629
  }] });
1630
+ function applySorting(options, items) {
1631
+ if (options.caseInsensitive) {
1632
+ return options.key ? fp.sortBy(getValueForKey(options.key), items) : items.slice().sort(sortStringCaseInsensitive());
1633
+ }
1634
+ return options.key ? fp.sortBy(function (item) { return fp.get(options.key, item); }, items) : items.slice().sort();
1635
+ }
1493
1636
  function sortStringCaseInsensitive() {
1494
1637
  return function (a, b) {
1495
1638
  if (typeof a === 'string' && typeof b === 'string') {
@@ -1716,6 +1859,8 @@
1716
1859
  NbspPipe,
1717
1860
  LxIsUuidPipe,
1718
1861
  SpinnerComponent,
1862
+ TableComponent,
1863
+ TableHeaderComponent,
1719
1864
  TinySpinnerComponent,
1720
1865
  TranslationAfterPipe,
1721
1866
  TranslationBeforePipe,
@@ -1744,6 +1889,8 @@
1744
1889
  NbspPipe,
1745
1890
  LxIsUuidPipe,
1746
1891
  SpinnerComponent,
1892
+ TableComponent,
1893
+ TableHeaderComponent,
1747
1894
  TinySpinnerComponent,
1748
1895
  TranslationAfterPipe,
1749
1896
  TranslationBeforePipe,
@@ -1779,6 +1926,8 @@
1779
1926
  NbspPipe,
1780
1927
  LxIsUuidPipe,
1781
1928
  SpinnerComponent,
1929
+ TableComponent,
1930
+ TableHeaderComponent,
1782
1931
  TinySpinnerComponent,
1783
1932
  TranslationAfterPipe,
1784
1933
  TranslationBeforePipe,
@@ -1811,6 +1960,8 @@
1811
1960
  NbspPipe,
1812
1961
  LxIsUuidPipe,
1813
1962
  SpinnerComponent,
1963
+ TableComponent,
1964
+ TableHeaderComponent,
1814
1965
  TinySpinnerComponent,
1815
1966
  TranslationAfterPipe,
1816
1967
  TranslationBeforePipe,
@@ -6324,6 +6475,8 @@
6324
6475
  exports.TAB = TAB;
6325
6476
  exports.TabComponent = TabComponent;
6326
6477
  exports.TabGroupComponent = TabGroupComponent;
6478
+ exports.TableComponent = TableComponent;
6479
+ exports.TableHeaderComponent = TableHeaderComponent;
6327
6480
  exports.TinySpinnerComponent = TinySpinnerComponent;
6328
6481
  exports.TooltipComponent = TooltipComponent;
6329
6482
  exports.TooltipDirective = TooltipDirective;