@apexara/ng-components 1.0.0
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/README.md +1867 -0
- package/fesm2022/apexara-ng-components-button.mjs +66 -0
- package/fesm2022/apexara-ng-components-button.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-carousel.mjs +161 -0
- package/fesm2022/apexara-ng-components-carousel.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-checkbox.mjs +64 -0
- package/fesm2022/apexara-ng-components-checkbox.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-chip.mjs +26 -0
- package/fesm2022/apexara-ng-components-chip.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-datepicker.mjs +2175 -0
- package/fesm2022/apexara-ng-components-datepicker.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-dialog.mjs +65 -0
- package/fesm2022/apexara-ng-components-dialog.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-drawer.mjs +69 -0
- package/fesm2022/apexara-ng-components-drawer.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-expander.mjs +41 -0
- package/fesm2022/apexara-ng-components-expander.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-image.mjs +201 -0
- package/fesm2022/apexara-ng-components-image.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-input.mjs +129 -0
- package/fesm2022/apexara-ng-components-input.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-listbox.mjs +308 -0
- package/fesm2022/apexara-ng-components-listbox.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-radiobutton.mjs +40 -0
- package/fesm2022/apexara-ng-components-radiobutton.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-select.mjs +620 -0
- package/fesm2022/apexara-ng-components-select.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-services.mjs +290 -0
- package/fesm2022/apexara-ng-components-services.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-snackbar.mjs +279 -0
- package/fesm2022/apexara-ng-components-snackbar.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-table.mjs +686 -0
- package/fesm2022/apexara-ng-components-table.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-textarea.mjs +82 -0
- package/fesm2022/apexara-ng-components-textarea.mjs.map +1 -0
- package/fesm2022/apexara-ng-components-tooltip.mjs +319 -0
- package/fesm2022/apexara-ng-components-tooltip.mjs.map +1 -0
- package/fesm2022/apexara-ng-components.mjs +8 -0
- package/fesm2022/apexara-ng-components.mjs.map +1 -0
- package/package.json +146 -0
- package/types/apexara-ng-components-button.d.ts +27 -0
- package/types/apexara-ng-components-carousel.d.ts +31 -0
- package/types/apexara-ng-components-checkbox.d.ts +29 -0
- package/types/apexara-ng-components-chip.d.ts +11 -0
- package/types/apexara-ng-components-datepicker.d.ts +172 -0
- package/types/apexara-ng-components-dialog.d.ts +24 -0
- package/types/apexara-ng-components-drawer.d.ts +22 -0
- package/types/apexara-ng-components-expander.d.ts +10 -0
- package/types/apexara-ng-components-image.d.ts +46 -0
- package/types/apexara-ng-components-input.d.ts +51 -0
- package/types/apexara-ng-components-listbox.d.ts +70 -0
- package/types/apexara-ng-components-radiobutton.d.ts +30 -0
- package/types/apexara-ng-components-select.d.ts +111 -0
- package/types/apexara-ng-components-services.d.ts +96 -0
- package/types/apexara-ng-components-snackbar.d.ts +73 -0
- package/types/apexara-ng-components-table.d.ts +157 -0
- package/types/apexara-ng-components-textarea.d.ts +34 -0
- package/types/apexara-ng-components-tooltip.d.ts +54 -0
- package/types/apexara-ng-components.d.ts +3 -0
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, HostListener, Output, Input, ViewChild, ViewChildren, Component } from '@angular/core';
|
|
3
|
+
import { formatDate, NgStyle, NgClass, NgTemplateOutlet, DecimalPipe } from '@angular/common';
|
|
4
|
+
import * as i3 from '@angular/cdk/scrolling';
|
|
5
|
+
import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
6
|
+
import * as i2 from '@angular/forms';
|
|
7
|
+
import { Validators } from '@angular/forms';
|
|
8
|
+
import { IpiChipComponent } from '@apexara/ng-components/chip';
|
|
9
|
+
import { IpiImageComponent } from '@apexara/ng-components/image';
|
|
10
|
+
import { IpiCheckboxComponent } from '@apexara/ng-components/checkbox';
|
|
11
|
+
import { IpiSelectComponent } from '@apexara/ng-components/select';
|
|
12
|
+
import * as i1 from '@apexara/ng-components/services';
|
|
13
|
+
import { MobileOS } from '@apexara/ng-components/services';
|
|
14
|
+
import { TooltipPosition, IpiTooltipDirective } from '@apexara/ng-components/tooltip';
|
|
15
|
+
|
|
16
|
+
var IpiTableColumnType;
|
|
17
|
+
(function (IpiTableColumnType) {
|
|
18
|
+
IpiTableColumnType[IpiTableColumnType["Text"] = 0] = "Text";
|
|
19
|
+
IpiTableColumnType[IpiTableColumnType["Date"] = 1] = "Date";
|
|
20
|
+
IpiTableColumnType[IpiTableColumnType["Currency"] = 2] = "Currency";
|
|
21
|
+
IpiTableColumnType[IpiTableColumnType["Chip"] = 3] = "Chip";
|
|
22
|
+
IpiTableColumnType[IpiTableColumnType["Number"] = 4] = "Number";
|
|
23
|
+
IpiTableColumnType[IpiTableColumnType["NumberMath"] = 5] = "NumberMath";
|
|
24
|
+
IpiTableColumnType[IpiTableColumnType["Actions"] = 6] = "Actions";
|
|
25
|
+
IpiTableColumnType[IpiTableColumnType["Checkbox"] = 7] = "Checkbox";
|
|
26
|
+
})(IpiTableColumnType || (IpiTableColumnType = {}));
|
|
27
|
+
class IpiTableComponent {
|
|
28
|
+
constructor(osService, formBuilder, changeDetectorRef) {
|
|
29
|
+
this.osService = osService;
|
|
30
|
+
this.formBuilder = formBuilder;
|
|
31
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
32
|
+
this.DropdownElement = null;
|
|
33
|
+
// Sorting configuration
|
|
34
|
+
this.sortIndex = 0;
|
|
35
|
+
this.sortable = true;
|
|
36
|
+
this.sortDirection = 'asc';
|
|
37
|
+
// Pagination configuration
|
|
38
|
+
this.pageSize = 10;
|
|
39
|
+
this.currentPage = 0;
|
|
40
|
+
this.pageable = false;
|
|
41
|
+
this.pageSizeOptions = [10, 25, 50, 100, 1000];
|
|
42
|
+
// Virtual scroll configuration (optimization for large datasets)
|
|
43
|
+
this.virtualScroll = false; // For local data only
|
|
44
|
+
this.tableMaxHeight = 800;
|
|
45
|
+
this.tableChange = new EventEmitter();
|
|
46
|
+
this.itemSize = 42; // Must match CSS table row height
|
|
47
|
+
this.tooltipPosition = TooltipPosition;
|
|
48
|
+
this.TableColumnType = IpiTableColumnType;
|
|
49
|
+
this.isDropdown = false;
|
|
50
|
+
}
|
|
51
|
+
onClick(event) {
|
|
52
|
+
// TO DO: When two tables exists the dropdown from first table is not closed
|
|
53
|
+
if (event.target !== this.DropdownElement?.nativeElement && event.target) {
|
|
54
|
+
if (this.currentActiveRow) {
|
|
55
|
+
this.currentActiveRow.isDropdown = false;
|
|
56
|
+
}
|
|
57
|
+
this.changeDetectorRef.detectChanges();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
onScroll() {
|
|
61
|
+
for (let item of this.moreActionsList) {
|
|
62
|
+
if (item.nativeElement.classList.contains('opened') && this.DropdownElement) {
|
|
63
|
+
let actionPos = item.nativeElement.getBoundingClientRect();
|
|
64
|
+
if (this.osService.mobileOS === MobileOS.iOS) {
|
|
65
|
+
actionPos.y += window.visualViewport.offsetTop;
|
|
66
|
+
}
|
|
67
|
+
this.DropdownElement.nativeElement.style.top = `${actionPos.y + actionPos.height}px`;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
onResize() {
|
|
73
|
+
for (let item of this.moreActionsList) {
|
|
74
|
+
if (item.nativeElement.classList.contains('opened') && this.DropdownElement) {
|
|
75
|
+
let actionPos = item.nativeElement.getBoundingClientRect();
|
|
76
|
+
if (this.osService.mobileOS === MobileOS.iOS) {
|
|
77
|
+
actionPos.x += window.visualViewport.offsetLeft;
|
|
78
|
+
}
|
|
79
|
+
const dropdownWidth = this.DropdownElement.nativeElement.offsetWidth;
|
|
80
|
+
const left = actionPos.x + dropdownWidth / 2 < window.innerWidth - 10 ? actionPos.x : window.innerWidth - 10 - dropdownWidth;
|
|
81
|
+
this.DropdownElement.nativeElement.style.transform = left === actionPos.x ? 'translateX(-50%)' : '';
|
|
82
|
+
this.DropdownElement.nativeElement.style.left = left + 'px';
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
ngOnInit() {
|
|
88
|
+
if (!this.virtualScroll) {
|
|
89
|
+
this.changeDetectorRef.detach();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
ngAfterViewInit() {
|
|
93
|
+
const from = this.currentPage * this.pageSize;
|
|
94
|
+
const to = from + this.pageSize;
|
|
95
|
+
if (this.serverSide && !this.data) {
|
|
96
|
+
this.tableChange.emit({ from, to, sort: { columnValue: this.columns[this.sortIndex].value, sortDirection: this.sortDirection } });
|
|
97
|
+
}
|
|
98
|
+
if (!this.serverSide) {
|
|
99
|
+
this.buildPaginationSelectDependecies();
|
|
100
|
+
}
|
|
101
|
+
this.getVirtualViewportHeight();
|
|
102
|
+
}
|
|
103
|
+
ngOnChanges(changes) {
|
|
104
|
+
if (changes['isLoading'] && changes['isLoading'].currentValue === false) {
|
|
105
|
+
if (this.data) {
|
|
106
|
+
this._dataLength = this.data.length;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (changes['data'] && changes['data'].currentValue) {
|
|
110
|
+
if (this.serverSide) {
|
|
111
|
+
this.filteredData = this.data;
|
|
112
|
+
this.preprocessData();
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.filteredData = this.filter ? this.filterData() : this.data;
|
|
116
|
+
this.preprocessData();
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
this.sortColumn(this.columns[this.sortIndex], false);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
this._dataLength = this.dataLength ? this.dataLength : this.filteredData.length;
|
|
122
|
+
}
|
|
123
|
+
if (changes['filter'] && !changes['filter'].firstChange) {
|
|
124
|
+
// The two ways of filtering data -> local and serverSide
|
|
125
|
+
if (!this.serverSide) {
|
|
126
|
+
this.filteredData = this.filterData();
|
|
127
|
+
this._dataLength = this.filteredData.length;
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
this.goToFirstPage();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
this.currentPage = 0;
|
|
135
|
+
this.tableChange.emit({ from: 0, to: 0 + this.pageSize, filter: this.filter, sort: { columnValue: this.columns[this.sortIndex].value, sortDirection: this.sortDirection } });
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (changes['pageable'] && changes['pageable'].currentValue !== undefined) {
|
|
140
|
+
this.buildPaginationSelectDependecies();
|
|
141
|
+
}
|
|
142
|
+
const from = this.currentPage * this.pageSize;
|
|
143
|
+
const to = Math.min(this._dataLength, from + this.pageSize);
|
|
144
|
+
this.calculateTotalPages();
|
|
145
|
+
this.updateVisibleRange(from, to);
|
|
146
|
+
this.refreshLayout();
|
|
147
|
+
this.changeDetectorRef.detectChanges();
|
|
148
|
+
}
|
|
149
|
+
getPageData() {
|
|
150
|
+
if (!this.filteredData) {
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
if (!this.pageable) {
|
|
154
|
+
return this.filteredData;
|
|
155
|
+
}
|
|
156
|
+
if (!this.serverSide) {
|
|
157
|
+
const start = this.currentPage * this.pageSize;
|
|
158
|
+
const end = start + this.pageSize;
|
|
159
|
+
return this.filteredData.slice(start, end);
|
|
160
|
+
}
|
|
161
|
+
return this.filteredData;
|
|
162
|
+
}
|
|
163
|
+
updateVisibleRange(start, end) {
|
|
164
|
+
this.visibleRange = `Showing ${start + 1} to ${end} of ${this._dataLength} results`;
|
|
165
|
+
this.changeDetectorRef.detectChanges();
|
|
166
|
+
}
|
|
167
|
+
calculateTotalPages() {
|
|
168
|
+
this.totalPages = Math.ceil(this._dataLength / this.pageSize);
|
|
169
|
+
}
|
|
170
|
+
trackByIndex(index) {
|
|
171
|
+
return index;
|
|
172
|
+
}
|
|
173
|
+
getVirtualViewportHeight() {
|
|
174
|
+
const headerHeight = this.theadRef?.nativeElement?.getBoundingClientRect().height || 0;
|
|
175
|
+
const renderedCount = this.serverSide
|
|
176
|
+
? (this.filteredData ? this.filteredData.length : 0)
|
|
177
|
+
: (this.getPageData() ? this.getPageData().length : 0);
|
|
178
|
+
if (renderedCount <= 0) {
|
|
179
|
+
return headerHeight;
|
|
180
|
+
}
|
|
181
|
+
const maxTotal = this.tableMaxHeight;
|
|
182
|
+
const bodyCapacity = Math.max(0, maxTotal - headerHeight);
|
|
183
|
+
const rowsHeight = Math.min(bodyCapacity, this.itemSize * renderedCount);
|
|
184
|
+
return Math.max(0, headerHeight + rowsHeight);
|
|
185
|
+
}
|
|
186
|
+
shouldShowViewportScroll() {
|
|
187
|
+
if (!this.virtualScroll) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const headerHeight = this.theadRef?.nativeElement?.getBoundingClientRect().height || 0;
|
|
191
|
+
const availableBodyHeight = Math.max(0, this.tableMaxHeight - headerHeight);
|
|
192
|
+
const renderedCount = this.serverSide
|
|
193
|
+
? (this.filteredData ? this.filteredData.length : 0)
|
|
194
|
+
: this.getPageData().length;
|
|
195
|
+
const rowsHeight = this.itemSize * renderedCount;
|
|
196
|
+
return rowsHeight > availableBodyHeight;
|
|
197
|
+
}
|
|
198
|
+
getCellTemplate(column) {
|
|
199
|
+
switch (column.type) {
|
|
200
|
+
case IpiTableColumnType.Number:
|
|
201
|
+
return this.numberCellTpl;
|
|
202
|
+
case IpiTableColumnType.Currency:
|
|
203
|
+
return this.currencyCellTpl;
|
|
204
|
+
case IpiTableColumnType.NumberMath:
|
|
205
|
+
return this.numberMathCellTpl;
|
|
206
|
+
case IpiTableColumnType.Date:
|
|
207
|
+
return this.dateCellTpl;
|
|
208
|
+
case IpiTableColumnType.Chip:
|
|
209
|
+
return this.chipCellTpl;
|
|
210
|
+
case IpiTableColumnType.Checkbox:
|
|
211
|
+
return this.checkboxCellTpl;
|
|
212
|
+
case IpiTableColumnType.Actions:
|
|
213
|
+
return this.actionCellTpl;
|
|
214
|
+
default:
|
|
215
|
+
return this.textCellTpl;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
refreshLayout() {
|
|
219
|
+
this.cdkViewport?.checkViewportSize();
|
|
220
|
+
this.changeDetectorRef.detectChanges();
|
|
221
|
+
}
|
|
222
|
+
goToPage(page) {
|
|
223
|
+
this.currentPage = page;
|
|
224
|
+
this.calculatePages();
|
|
225
|
+
}
|
|
226
|
+
goToPreviousPage() {
|
|
227
|
+
this.currentPage--;
|
|
228
|
+
this.calculatePages();
|
|
229
|
+
}
|
|
230
|
+
goToNextPage() {
|
|
231
|
+
this.currentPage++;
|
|
232
|
+
this.calculatePages();
|
|
233
|
+
}
|
|
234
|
+
goToFirstPage() {
|
|
235
|
+
this.currentPage = 0;
|
|
236
|
+
this.calculatePages();
|
|
237
|
+
}
|
|
238
|
+
goToLastPage() {
|
|
239
|
+
this.currentPage = this.totalPages - 1;
|
|
240
|
+
this.calculatePages();
|
|
241
|
+
}
|
|
242
|
+
cellEdit(event, column, currentPageRowIndex) {
|
|
243
|
+
const dataIndex = currentPageRowIndex + (this.currentPage * this.pageSize);
|
|
244
|
+
if (column.indexOf('.') === -1) {
|
|
245
|
+
this.filteredData[dataIndex][column] = event.target.innerText;
|
|
246
|
+
}
|
|
247
|
+
else { // Nested properties
|
|
248
|
+
let data = this.filteredData[dataIndex];
|
|
249
|
+
const fullPath = column.split('.');
|
|
250
|
+
for (let i = 0; i < fullPath.length; i++) {
|
|
251
|
+
if (i < fullPath.length - 1) {
|
|
252
|
+
data = data[fullPath[i]];
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
data[fullPath[i]] = event.target.innerText;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
formatDate(dateAsString, formatDateOptions = { format: 'shortDate', locale: 'en-US', timezone: undefined }) {
|
|
261
|
+
if (dateAsString === null || dateAsString === undefined || dateAsString === '') {
|
|
262
|
+
return '';
|
|
263
|
+
}
|
|
264
|
+
return formatDate(dateAsString, formatDateOptions.format, formatDateOptions.locale, formatDateOptions.timezone);
|
|
265
|
+
}
|
|
266
|
+
getClass(row, column) {
|
|
267
|
+
if (!column.class) {
|
|
268
|
+
return '';
|
|
269
|
+
}
|
|
270
|
+
if (typeof column.class === 'string') {
|
|
271
|
+
return column.class;
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
[column.class[this.getDescendantProp(row, column)]]: true
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
getDescendantProp(row, column) {
|
|
278
|
+
if (!column.value || column.value === null) {
|
|
279
|
+
return column.label;
|
|
280
|
+
}
|
|
281
|
+
// Case only on preprocessing - returns any numbers that have been passed in the column.value string
|
|
282
|
+
if (isFinite(Number(column.value))) {
|
|
283
|
+
return parseFloat(column.value);
|
|
284
|
+
}
|
|
285
|
+
if (column.type === this.TableColumnType.NumberMath) {
|
|
286
|
+
return row[column.value];
|
|
287
|
+
}
|
|
288
|
+
return column.value.split('.')
|
|
289
|
+
.reduce((prev, curr) => {
|
|
290
|
+
if (prev && curr in prev) {
|
|
291
|
+
return prev[curr];
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
}, row);
|
|
297
|
+
}
|
|
298
|
+
getChipLabel(row, column) {
|
|
299
|
+
if (!column.chipLabel) {
|
|
300
|
+
return column.label ? column.label : this.getDescendantProp(row, column);
|
|
301
|
+
}
|
|
302
|
+
return column.chipLabel[this.getDescendantProp(row, column)];
|
|
303
|
+
}
|
|
304
|
+
getCheckboxState(row, column) {
|
|
305
|
+
let state = this.getDescendantProp(row, column);
|
|
306
|
+
if (typeof state !== 'boolean') {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
return state;
|
|
310
|
+
}
|
|
311
|
+
handleActionShow(action, row, column) {
|
|
312
|
+
if (!action.showOn || action.showOn.length === 0) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
return action.showOn.every((condition) => {
|
|
316
|
+
const rowValue = this.getDescendantProp(row, { value: condition.property });
|
|
317
|
+
const ifValueExists = !!rowValue;
|
|
318
|
+
if (condition.exists != null && condition.exists === ifValueExists) {
|
|
319
|
+
return ifValueExists;
|
|
320
|
+
}
|
|
321
|
+
return condition.values.includes(rowValue);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
sortColumn(column, changeSortDirection = true) {
|
|
325
|
+
if (!this.sortable) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (!column.value) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (changeSortDirection) {
|
|
332
|
+
if (this.sortIndex == this.columns.indexOf(column)) {
|
|
333
|
+
switch (this.sortDirection) {
|
|
334
|
+
case 'asc':
|
|
335
|
+
this.sortDirection = 'desc';
|
|
336
|
+
break;
|
|
337
|
+
case 'desc':
|
|
338
|
+
this.sortDirection = 'asc';
|
|
339
|
+
break;
|
|
340
|
+
default:
|
|
341
|
+
this.sortDirection = 'asc';
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.sortDirection = 'asc';
|
|
347
|
+
this.sortIndex = this.columns.indexOf(column);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (this.serverSide) {
|
|
351
|
+
this.currentPage = 0;
|
|
352
|
+
const start = this.currentPage * this.pageSize;
|
|
353
|
+
const end = Math.min(this._dataLength, start + this.pageSize);
|
|
354
|
+
this.tableChange.emit({ from: start, to: end, filter: this.filter, sort: { columnValue: this.columns[this.sortIndex].value, sortDirection: this.sortDirection } });
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
this.goToFirstPage();
|
|
358
|
+
this.sortData(this.filteredData, column);
|
|
359
|
+
}
|
|
360
|
+
if (this.currentActiveRow) {
|
|
361
|
+
this.currentActiveRow.isDropdown = false;
|
|
362
|
+
}
|
|
363
|
+
this.changeDetectorRef.detectChanges();
|
|
364
|
+
}
|
|
365
|
+
async toggleActionDropdown(row, event) {
|
|
366
|
+
// Prevent the event to be processed by the Hostlistener
|
|
367
|
+
event.stopPropagation();
|
|
368
|
+
let actionPos;
|
|
369
|
+
if (this.currentActiveRow) {
|
|
370
|
+
this.currentActiveRow.isDropdown = false;
|
|
371
|
+
}
|
|
372
|
+
row.isDropdown = !row.isDropdown;
|
|
373
|
+
this.currentActiveRow = row;
|
|
374
|
+
this.changeDetectorRef.detectChanges();
|
|
375
|
+
for (let i of this.moreActionsList) {
|
|
376
|
+
if (i.nativeElement.classList.contains('opened')) {
|
|
377
|
+
actionPos = i.nativeElement.getBoundingClientRect();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (this.DropdownElement) {
|
|
381
|
+
if (this.osService.mobileOS === MobileOS.iOS) {
|
|
382
|
+
actionPos.y += window.visualViewport.offsetTop;
|
|
383
|
+
actionPos.x += window.visualViewport.offsetLeft;
|
|
384
|
+
}
|
|
385
|
+
const dropdownWidth = this.DropdownElement.nativeElement.offsetWidth;
|
|
386
|
+
const left = actionPos.x + dropdownWidth / 2 < window.innerWidth - 10 ? actionPos.x : window.innerWidth - 10 - dropdownWidth;
|
|
387
|
+
this.DropdownElement.nativeElement.style.transform = left === actionPos.x ? 'translateX(-50%)' : '';
|
|
388
|
+
this.DropdownElement.nativeElement.style.left = left + 'px';
|
|
389
|
+
this.DropdownElement.nativeElement.style.top = `${actionPos.y + actionPos.height}px`;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
onViewportScroll() {
|
|
393
|
+
// Reposition dropdown while body scrolls inside viewport
|
|
394
|
+
this.onScroll();
|
|
395
|
+
}
|
|
396
|
+
preprocessData() {
|
|
397
|
+
if (!this.data || this.data.length === 0) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
this.columns.forEach(column => {
|
|
401
|
+
if (!column.value || column.type !== this.TableColumnType.NumberMath) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.data.forEach(row => {
|
|
405
|
+
const result = this.calculateNumberMathCell(row, column);
|
|
406
|
+
row[column.value] = result;
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
calculateNumberMathCell(row, column) {
|
|
411
|
+
const expression = column.value.replace(/([a-zA-Z_][a-zA-Z0-9_.]*|\d*\.?\d+)/g, (match) => {
|
|
412
|
+
let value = this.getDescendantProp(row, { value: match });
|
|
413
|
+
return (typeof value === 'number') ? value : parseFloat(value) || 0;
|
|
414
|
+
});
|
|
415
|
+
let fn = new Function(`return ${expression};`);
|
|
416
|
+
let result = fn();
|
|
417
|
+
if (Number.isFinite(result)) {
|
|
418
|
+
return result;
|
|
419
|
+
}
|
|
420
|
+
return this.getDescendantProp(row, column);
|
|
421
|
+
}
|
|
422
|
+
filterData() {
|
|
423
|
+
if (!this.data || this.data.length === 0) {
|
|
424
|
+
return [];
|
|
425
|
+
}
|
|
426
|
+
let arrayToReturn = [];
|
|
427
|
+
for (let row of this.data) {
|
|
428
|
+
for (let column of this.columns) {
|
|
429
|
+
if (!column.value) {
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
let access = row[column.value];
|
|
433
|
+
if (column.value.indexOf('.') !== -1 && column.type !== this.TableColumnType.NumberMath) {
|
|
434
|
+
access = this.getAccessIfColumnValueIsObject(row, column);
|
|
435
|
+
}
|
|
436
|
+
if (access === undefined) {
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
const rowPropAsString = JSON.stringify(access).toLowerCase();
|
|
440
|
+
if (rowPropAsString.includes(this.filter.toLowerCase())) {
|
|
441
|
+
arrayToReturn.push(row);
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return arrayToReturn;
|
|
447
|
+
}
|
|
448
|
+
sortData(data, column) {
|
|
449
|
+
if (!data || data.length === 0 || !Array.isArray(data)) {
|
|
450
|
+
return [];
|
|
451
|
+
}
|
|
452
|
+
if (column) {
|
|
453
|
+
this.sortByProperty(data, column);
|
|
454
|
+
}
|
|
455
|
+
return data;
|
|
456
|
+
}
|
|
457
|
+
sortByProperty(arr, column) {
|
|
458
|
+
if (this.sortDirection === 'desc') {
|
|
459
|
+
this.sortReverse(arr, column);
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
return arr.sort((a, b) => {
|
|
463
|
+
let valueA = a[column.value];
|
|
464
|
+
let valueB = b[column.value];
|
|
465
|
+
let access = column.value;
|
|
466
|
+
if (access.indexOf('.') !== -1 && column.type !== this.TableColumnType.NumberMath) {
|
|
467
|
+
valueA = this.getAccessIfColumnValueIsObject(a, column);
|
|
468
|
+
valueB = this.getAccessIfColumnValueIsObject(b, column);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
if (typeof valueA === 'string' && valueB !== undefined) {
|
|
472
|
+
valueA = valueA.toLowerCase();
|
|
473
|
+
valueB = valueB.toLowerCase();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
477
|
+
return valueA - valueB;
|
|
478
|
+
}
|
|
479
|
+
if (!valueA && valueB)
|
|
480
|
+
return -1;
|
|
481
|
+
if (valueA && !valueB)
|
|
482
|
+
return 1;
|
|
483
|
+
if (!valueA && !valueB)
|
|
484
|
+
return 0;
|
|
485
|
+
if (valueA < valueB)
|
|
486
|
+
return -1;
|
|
487
|
+
if (valueA > valueB)
|
|
488
|
+
return 1;
|
|
489
|
+
return 0;
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
sortReverse(arr, column) {
|
|
493
|
+
return arr.sort((a, b) => {
|
|
494
|
+
let valueA = a[column.value];
|
|
495
|
+
let valueB = b[column.value];
|
|
496
|
+
let access = column.value;
|
|
497
|
+
if (access.indexOf('.') !== -1 && column.type !== this.TableColumnType.NumberMath) {
|
|
498
|
+
valueA = this.getAccessIfColumnValueIsObject(a, column);
|
|
499
|
+
valueB = this.getAccessIfColumnValueIsObject(b, column);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
if (typeof valueA === 'string' && valueB !== undefined) {
|
|
503
|
+
valueA = valueA.toLowerCase();
|
|
504
|
+
valueB = valueB.toLowerCase();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
508
|
+
return valueB - valueA;
|
|
509
|
+
}
|
|
510
|
+
if (!valueA && valueB)
|
|
511
|
+
return 1;
|
|
512
|
+
if (valueA && !valueB)
|
|
513
|
+
return -1;
|
|
514
|
+
if (!valueA && !valueB)
|
|
515
|
+
return 0;
|
|
516
|
+
if (valueA < valueB)
|
|
517
|
+
return 1;
|
|
518
|
+
if (valueA > valueB)
|
|
519
|
+
return -1;
|
|
520
|
+
return 0;
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
getAccessIfColumnValueIsObject(row, column) {
|
|
524
|
+
if (!column.value || column.value === null) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
const keys = column.value.split('.');
|
|
528
|
+
let access = row[keys[0]];
|
|
529
|
+
for (let i = 1; i < keys.length; i++) {
|
|
530
|
+
if (access && keys[i] in access) {
|
|
531
|
+
access = access[keys[i]];
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
return undefined;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return access;
|
|
538
|
+
}
|
|
539
|
+
buildPaginationSelectDependecies() {
|
|
540
|
+
const formControls = {
|
|
541
|
+
pageSize: this.formBuilder.control({ label: this.pageSize.toString(), value: this.pageSize }, { nonNullable: true, validators: [Validators.required] })
|
|
542
|
+
};
|
|
543
|
+
this.formGroup = this.formBuilder.group(formControls);
|
|
544
|
+
const selectData = this.pageSizeOptions.map(item => ({
|
|
545
|
+
label: item.toString(),
|
|
546
|
+
value: item
|
|
547
|
+
}));
|
|
548
|
+
this.pageSizeSelectOptions = {
|
|
549
|
+
label: '',
|
|
550
|
+
data: selectData,
|
|
551
|
+
formGroup: this.formGroup,
|
|
552
|
+
formControlName: 'pageSize'
|
|
553
|
+
};
|
|
554
|
+
this.subscribeToFormValueChanges();
|
|
555
|
+
}
|
|
556
|
+
subscribeToFormValueChanges() {
|
|
557
|
+
this.formGroup.controls.pageSize.valueChanges.subscribe((value) => {
|
|
558
|
+
if (this.pageSize === value.value) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const currentPageFirstRowIndex = this.currentPage * this.pageSize;
|
|
562
|
+
this.pageSize = value.value;
|
|
563
|
+
this.currentPage = Math.floor(currentPageFirstRowIndex / this.pageSize);
|
|
564
|
+
const start = this.currentPage * this.pageSize;
|
|
565
|
+
const end = Math.min(this._dataLength, start + this.pageSize);
|
|
566
|
+
if (this.serverSide) {
|
|
567
|
+
this.tableChange.emit({ from: start, to: end, filter: this.filter, sort: { columnValue: this.columns[this.sortIndex].value, sortDirection: this.sortDirection } });
|
|
568
|
+
}
|
|
569
|
+
this.calculateTotalPages();
|
|
570
|
+
this.updateVisibleRange(start, end);
|
|
571
|
+
this.cdkViewport?.checkViewportSize();
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
calculatePages() {
|
|
575
|
+
const start = this.currentPage * this.pageSize;
|
|
576
|
+
const end = Math.min(this._dataLength, start + this.pageSize);
|
|
577
|
+
if (!this.serverSide) {
|
|
578
|
+
this.updateVisibleRange(start, end);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
this.tableChange.emit({ from: start, to: end, filter: this.filter, sort: { columnValue: this.columns[this.sortIndex].value, sortDirection: this.sortDirection } });
|
|
582
|
+
}
|
|
583
|
+
this.changeDetectorRef.detectChanges();
|
|
584
|
+
}
|
|
585
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: IpiTableComponent, deps: [{ token: i1.OSService }, { token: i2.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
586
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: IpiTableComponent, isStandalone: true, selector: "ipi-table", inputs: { data: "data", dataLength: "dataLength", columns: "columns", filter: "filter", serverSide: "serverSide", isLoading: "isLoading", sortIndex: "sortIndex", sortable: "sortable", sortDirection: "sortDirection", pageSize: "pageSize", currentPage: "currentPage", pageable: "pageable", pageSizeOptions: "pageSizeOptions", virtualScroll: "virtualScroll", tableMaxHeight: "tableMaxHeight" }, outputs: { tableChange: "tableChange" }, host: { listeners: { "document:click": "onClick($event)", "document:scroll": "onScroll()", "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "theadRef", first: true, predicate: ["theadRef"], descendants: true }, { propertyName: "cdkViewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "DropdownElement", first: true, predicate: ["dropdownElement"], descendants: true }, { propertyName: "textCellTpl", first: true, predicate: ["textCell"], descendants: true, static: true }, { propertyName: "numberCellTpl", first: true, predicate: ["numberCell"], descendants: true, static: true }, { propertyName: "currencyCellTpl", first: true, predicate: ["currencyCell"], descendants: true, static: true }, { propertyName: "numberMathCellTpl", first: true, predicate: ["numberMathCell"], descendants: true, static: true }, { propertyName: "dateCellTpl", first: true, predicate: ["dateCell"], descendants: true, static: true }, { propertyName: "chipCellTpl", first: true, predicate: ["chipCell"], descendants: true, static: true }, { propertyName: "checkboxCellTpl", first: true, predicate: ["checkboxCell"], descendants: true, static: true }, { propertyName: "actionCellTpl", first: true, predicate: ["actionCell"], descendants: true, static: true }, { propertyName: "moreActionsList", predicate: ["moreActionsList"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"container\" [ngClass]=\"{ 'is-loading': isLoading }\">\n @if (virtualScroll) {\n <cdk-virtual-scroll-viewport [itemSize]=\"itemSize\" class=\"cdk-table-viewport\" [ngStyle]=\"{ height: getVirtualViewportHeight() + 'px' }\" [style.overflow-y]=\"shouldShowViewportScroll() ? 'auto' : 'hidden'\" (scrolled)=\"onViewportScroll()\">\n <table>\n <thead #theadRef>\n <tr>\n @for (column of columns; track $index) {\n <th [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n <div class=\"cell\">\n <span>{{ column.label }}</span>\n\n @if (column.type !== TableColumnType.Actions && sortable) {\n <div class=\"arranger\" (click)=\"sortColumn(column)\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 12 12\" fill=\"none\">\n <path d=\"M3.11445 5.50005H8.88795C9.31895 5.50005 9.54795 4.99005 9.26145 4.66755L6.37495 1.42005C6.32813 1.3672 6.27063 1.32489 6.20624 1.29591C6.14186 1.26694 6.07205 1.25195 6.00145 1.25195C5.93084 1.25195 5.86104 1.26694 5.79666 1.29591C5.73227 1.32489 5.67477 1.3672 5.62795 1.42005L2.74045 4.66755C2.45395 4.99005 2.68295 5.50005 3.11445 5.50005ZM5.62745 10.5795C5.67427 10.6324 5.73177 10.6747 5.79616 10.7037C5.86054 10.7327 5.93034 10.7476 6.00095 10.7476C6.07155 10.7476 6.14136 10.7327 6.20574 10.7037C6.27013 10.6747 6.32763 10.6324 6.37445 10.5795L9.26095 7.33205C9.54795 7.01005 9.31895 6.50005 8.88745 6.50005H3.11445C2.68345 6.50005 2.45445 7.01005 2.74095 7.33255L5.62745 10.5795Z\" fill=\"#C6C6C6\"/>\n </svg>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n\n <tbody>\n <tr *cdkVirtualFor=\"let row of getPageData(); trackBy: trackByIndex\">\n @for (column of columns; track $index) {\n <td tabindex=\"-1\">\n <ng-container [ngTemplateOutlet]=\"getCellTemplate(column)\"\n [ngTemplateOutletContext]=\"{ row: row, column: column, $index: $index }\">\n </ng-container>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n } @else {\n <table>\n <thead>\n <tr>\n @for (column of columns; track $index) {\n <th [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n <div class=\"cell\">\n <span>{{ column.label }}</span>\n\n @if (column.type !== TableColumnType.Actions && sortable) {\n <div class=\"arranger\" (click)=\"sortColumn(column)\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 12 12\" fill=\"none\">\n <path d=\"M3.11445 5.50005H8.88795C9.31895 5.50005 9.54795 4.99005 9.26145 4.66755L6.37495 1.42005C6.32813 1.3672 6.27063 1.32489 6.20624 1.29591C6.14186 1.26694 6.07205 1.25195 6.00145 1.25195C5.93084 1.25195 5.86104 1.26694 5.79666 1.29591C5.73227 1.32489 5.67477 1.3672 5.62795 1.42005L2.74045 4.66755C2.45395 4.99005 2.68295 5.50005 3.11445 5.50005ZM5.62745 10.5795C5.67427 10.6324 5.73177 10.6747 5.79616 10.7037C5.86054 10.7327 5.93034 10.7476 6.00095 10.7476C6.07155 10.7476 6.14136 10.7327 6.20574 10.7037C6.27013 10.6747 6.32763 10.6324 6.37445 10.5795L9.26095 7.33205C9.54795 7.01005 9.31895 6.50005 8.88745 6.50005H3.11445C2.68345 6.50005 2.45445 7.01005 2.74095 7.33255L5.62745 10.5795Z\" fill=\"#C6C6C6\"/>\n </svg>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n\n <tbody>\n @for (row of getPageData(); track $index) { \n <tr>\n @for (column of columns; track $index) {\n <td tabindex=\"-1\">\n <ng-container [ngTemplateOutlet]=\"getCellTemplate(column)\"\n [ngTemplateOutletContext]=\"{ row: row, column: column, $index: $index }\">\n </ng-container>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n\n @if (filter && filteredData && filteredData.length === 0) {\n <div class=\"row no-data\">\n <span>No data matching the filter:</span>\n\n <span>\"{{ filter }}\"</span>\n </div>\n }\n\n @if (!filter && data && data.length === 0) {\n <div class=\"row no-data\">No data available.</div>\n }\n\n @if (pageable && getPageData().length !== 0) {\n <div class=\"paging\">\n <div class=\"visible-range\">{{ visibleRange }}</div>\n\n <ng-container *ngTemplateOutlet=\"pagePicker; context: { totalPages: totalPages }\"></ng-container>\n\n <div class=\"page-size-option-picker\">\n <span>Items per page:</span>\n\n <ipi-select class=\"table\" [options]=\"pageSizeSelectOptions\"></ipi-select>\n </div>\n </div>\n }\n</div>\n\n<ng-template #textCell let-row=\"row\" let-column=\"column\" let-index=\"$index\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) }}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #dateCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\">\n {{ formatDate(getDescendantProp(row, column), column.dateFormat) }}\n </div>\n</ng-template>\n\n<ng-template #currencyCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n\n @if (getDescendantProp(row, column) !== undefined) {\n {{ column.prefix ? column.prefix : '' }}{{ (getDescendantProp(row, column) / 100) | number }}\n }\n </div>\n</ng-template>\n\n<ng-template #numberCell let-row=\"row\" let-column=\"column\" let-index=\"i\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) | number}}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #numberMathCell let-row=\"row\" let-column=\"column\" let-index=\"i\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) | number}}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #actionCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell actions\">\n\n @for (action of column.singleActions; track $index) {\n @if (handleActionShow(action, row, column)) {\n <div IpiTooltip (click)=\"action.execute && action.execute(row)\" [ipiTooltip]=\"action.label\" [tooltipPosition]=\"tooltipPosition.Above\" class=\"action-icon-wrapper\" [ngClass]=\"{ 'disabled': action.disabled }\">\n <ipi-img [src]=\" 'assets/img/' + action.icon\" [ngClass]=\"action.class\" [ariaLabel]=\"'Action icon for ' + action.label\"></ipi-img>\n </div>\n }\n }\n\n @if (column.multipleActions) {\n <div class=\"action-icon-wrapper\" #moreActionsList [ngClass]=\"{ 'opened': row.isDropdown }\" (click)=\"toggleActionDropdown(row, $event)\">\n <svg class=\"multiple-action-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 17 16\" fill=\"none\">\n <path d=\"M10.3047 8C10.3047 8.34612 10.2021 8.68446 10.0098 8.97225C9.81747 9.26004 9.54416 9.48434 9.22438 9.61679C8.90461 9.74924 8.55275 9.7839 8.21328 9.71638C7.87381 9.64885 7.56199 9.48218 7.31725 9.23744C7.07251 8.9927 6.90584 8.68088 6.83831 8.34141C6.77079 8.00194 6.80545 7.65008 6.9379 7.33031C7.07035 7.01053 7.29465 6.73722 7.58244 6.54493C7.87023 6.35264 8.20857 6.25 8.55469 6.25C9.01868 6.25046 9.46353 6.43498 9.79162 6.76307C10.1197 7.09116 10.3042 7.53601 10.3047 8ZM8.55469 4.75C8.90081 4.75 9.23915 4.64737 9.52694 4.45507C9.81472 4.26278 10.039 3.98947 10.1715 3.6697C10.3039 3.34993 10.3386 2.99806 10.2711 2.65859C10.2035 2.31913 10.0369 2.00731 9.79213 1.76256C9.54738 1.51782 9.23556 1.35115 8.8961 1.28363C8.55663 1.2161 8.20476 1.25076 7.88499 1.38321C7.56522 1.51566 7.29191 1.73997 7.09962 2.02775C6.90732 2.31554 6.80469 2.65388 6.80469 3C6.80515 3.46399 6.98967 3.90884 7.31776 4.23693C7.64585 4.56502 8.0907 4.74954 8.55469 4.75ZM8.55469 11.25C8.20857 11.25 7.87023 11.3526 7.58244 11.5449C7.29465 11.7372 7.07035 12.0105 6.9379 12.3303C6.80545 12.6501 6.77079 13.0019 6.83831 13.3414C6.90584 13.6809 7.07251 13.9927 7.31725 14.2374C7.56199 14.4822 7.87381 14.6489 8.21328 14.7164C8.55275 14.7839 8.90461 14.7492 9.22438 14.6168C9.54416 14.4843 9.81747 14.26 10.0098 13.9722C10.2021 13.6845 10.3047 13.3461 10.3047 13C10.3042 12.536 10.1197 12.0912 9.79162 11.7631C9.46353 11.435 9.01868 11.2505 8.55469 11.25Z\" fill=\"#5D6068\"/>\n </svg>\n </div>\n }\n\n </div>\n\n @if (row.isDropdown) {\n <ng-container class=\"dropdown-element\" *ngTemplateOutlet=\"multipleActionsDropdown; context: { row, column }\"></ng-container>\n }\n</ng-template>\n\n<ng-template #chipCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell chip\">\n @if (getChipLabel(row, column)) {\n <ipi-chip [ngClass]=\"getClass(row, column)\"> {{ getChipLabel(row, column) }}</ipi-chip>\n }\n </div>\n</ng-template>\n\n<ng-template #checkboxCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell checkbox\">\n <ipi-checkbox [checked]=\"getCheckboxState(row, column)\" [disabled]=\"true\"></ipi-checkbox>\n </div>\n</ng-template>\n\n<ng-template #multipleActionsDropdown let-row=\"row\" let-column=\"column\">\n <div #multipleActionsDropdownElement #dropdownElement class=\"more-actions-dropdown\">\n @for (action of column.multipleActions; track $index) {\n\n @if (handleActionShow(action, row, column)) {\n <div class=\"dropdown-row\" (click)=\"action.execute && action.execute(row)\">\n <ipi-img [src]=\"'assets/img/' + action.icon\" [ngClass]=\"action.class\" [ariaLabel]=\"'Action icon for ' + action.label\"></ipi-img>\n\n <span>{{ action.label }}</span>\n </div>\n }\n\n }\n </div>\n</ng-template>\n\n<ng-template #pagePicker let-totalPages=\"totalPages\">\n <div class=\"page-picker\">\n <!-- If page one should be visible -->\n @if (currentPage + 1 >= 3) {\n <span (click)=\"goToPage(0)\">1</span>\n <span class=\"style-excluded\">...</span>\n }\n\n <!-- Middle part of the page-picker -->\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage - 1 } \"></ng-container>\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage, class: 'highlighted' } \"></ng-container>\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage + 1 } \"></ng-container>\n\n <!-- If last page should be visible -->\n @if (currentPage + 1 <= totalPages - 2) {\n <span class=\"style-excluded\">...</span>\n <span (click)=\"goToPage(totalPages - 1)\">{{ totalPages }}</span>\n }\n\n </div>\n</ng-template>\n\n<ng-template #page let-page=\"page\" let-class=\"class\">\n @if (page >= 0 && page < totalPages) {\n <span [ngClass]=\"class\" (click)=\"goToPage(page)\">{{ page + 1 }}</span>\n }\n</ng-template>\n", styles: [":host{display:block;touch-action:manipulation}.container{width:100%;position:relative;overflow:auto;padding:24px 0}.cdk-table-viewport{width:100%;display:block;overflow:auto;scrollbar-gutter:stable}.cdk-table-viewport .cdk-virtual-scroll-content-wrapper{width:100%;display:block}table{width:100%;text-align:center;table-layout:fixed;border-collapse:collapse}thead tr{border:none}tr{height:42px;vertical-align:middle;border-bottom:1px solid var(--ipi-table-row-bottom-border-color, #E9E9E9)}th{min-width:60px;-webkit-user-select:none;user-select:none;font-weight:500;font-size:14px;color:var(--ipi-table-first-row-text-color, #5D6068)}th .cell{display:flex;justify-content:center;align-items:center}td{scrollbar-width:thin;overflow:auto;text-overflow:clip;font-size:14px}td:focus{outline:none}td .cell{text-wrap:nowrap}ipi-chip{max-width:100%;--ipi-chip-background-color: #FFF2EF;--ipi-chip-color: #F96138}.cell{line-height:16px;box-sizing:border-box}.cell span{margin-right:4px}.cell.checkbox{display:flex;justify-content:center;align-items:center;--ipi-checkbox-disabled-opacity: 1}.cell.actions{display:flex;justify-content:center;align-items:center;gap:4px}.cell.actions ipi-img{width:16px;height:16px}.cell.chip{display:flex;justify-content:center;align-items:center}.cell.chip .primary{--ipi-chip-background-color: var(--ipi-table-chip-background-color);--ipi-chip-color: var(--ipi-table-chip-color)}.cell.chip .secondary{--ipi-chip-background-color: var(--ipi-table-chip-background-color-secondary);--ipi-chip-color: var(--ipi-table-chip-color-secondary)}.no-data{display:flex;justify-content:center;font-size:14px;margin-top:16px}.more-actions-dropdown{min-width:184px;width:fit-content;position:fixed;background-color:var(--ipi-table-more-actions-dropdown-background-color, #FFFFFF);border-radius:8px;box-shadow:0 4px 8px #d6d6d659;z-index:10}.dropdown-row{height:44px;display:flex;align-items:center;justify-content:flex-start;font-size:14px;font-weight:500;box-sizing:border-box;overflow:visible;cursor:pointer;background-color:var(--ipi-table-more-actions-dropdown-background-color, #FFFFFF);padding:0 12px}.dropdown-row:hover{background-color:var(--ipi-table-more-actions-dropdown-hover-background-color, #F3F3F3)}.dropdown-row ipi-img{width:20px;height:20px}.dropdown-row ipi-img path{fill:var(--ipi-table-dropdown-action-icon-fill, #5D6068);stroke:var(--ipi-table-dropdown-action-icon-stroke, #FFFFFF00)}.dropdown-row:hover ipi-img path{fill:var(--ipi-table-action-icon-hover-fill, #F96138);stroke:var(--ipi-table-action-icon-hover-stroke, #FFFFFF00)}.dropdown-row span{margin:0 12px;text-wrap:nowrap}.is-loading{opacity:.5;pointer-events:none}.container.is-loading:after{width:0px;height:2px;content:\" \";position:sticky;top:0;left:-50%;display:block;background-color:var(--ipi-table-loading-bar-color, #FF7F50);animation:lineAnimation 1s linear infinite;border-radius:20px;z-index:1}.action-icon-wrapper{width:36px;height:36px;display:flex;align-items:center;justify-content:center;cursor:pointer}.action-icon-wrapper:not(.disabled):hover{border-radius:4px;background:var(--ipi-table-action-hover-background-color, #F7F8FB)}.action-icon-wrapper ipi-img path{fill:var(--ipi-table-action-icon-fill, #5D6068);stroke:var(--ipi-table-action-icon-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover ipi-img path{fill:var(--ipi-table-action-icon-hover-fill, #F96138);stroke:var(--ipi-table-action-icon-hover-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover svg path,.opened .multiple-action-icon path{fill:var(--ipi-table-action-more-icon-fill, #F96138);stroke:var(--ipi-table-action-more-icon-stroke, #FFFFFF00)}.action-icon-wrapper ipi-img.secondary path{fill:var(--ipi-table-action-secondary-icon-fill, #F96138);stroke:var(--ipi-table-action-secondary-icon-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover ipi-img.secondary path{fill:var(--ipi-table-action-secondary-icon-hover-fill, #5D6068);stroke:var(--ipi-table-action-secondary-icon-hover-stroke, #FFFFFF00)}.arranger{width:14px;height:14px;cursor:pointer}.arranger svg:hover{transform:scale(1.15)}.paging{display:flex;justify-content:space-between;align-items:center;font-size:14px;font-weight:600;-webkit-user-select:none;user-select:none;margin-top:12px}.paging .items-per-page{line-height:10px;margin-right:8px}.mobile .visible-range{margin:0 12px}.page-picker{display:flex;justify-content:center;gap:14px}.page-picker span{min-width:24px;height:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;border-radius:24px;gap:10px;transition:color .25s,background-color .25s}.page-picker span.highlighted,.page-picker span:hover:not(.style-excluded){cursor:pointer;color:var(--ipi-table-page-picker-text-color, #FFF);background:var(--ipi-table-page-picker-background, #F96138)}.page-size-option-picker{display:flex;align-items:center}.page-size-option-picker span{text-wrap:nowrap;margin-right:8px}@media(max-width:940px){.paging{flex-direction:column;row-gap:16px;margin-top:24px}.visible-range{order:1}}@keyframes lineAnimation{0%{width:0px}50%{left:20%;width:80%}to{left:100%;width:100%}}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IpiChipComponent, selector: "ipi-chip", inputs: ["closeIcon"], outputs: ["closeChange"] }, { kind: "component", type: IpiImageComponent, selector: "ipi-img", inputs: ["src", "ariaLabel"] }, { kind: "component", type: IpiSelectComponent, selector: "ipi-select", inputs: ["options"], outputs: ["selectChange", "helperTextChange"] }, { kind: "directive", type: IpiTooltipDirective, selector: "[ipiTooltip]", inputs: ["ipiTooltip", "tooltipPosition"] }, { kind: "component", type: IpiCheckboxComponent, selector: "ipi-checkbox", inputs: ["checked", "disabled", "tooltip", "options"], outputs: ["clickChange"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i3.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i3.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i3.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "pipe", type: DecimalPipe, name: "number" }] }); }
|
|
587
|
+
}
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: IpiTableComponent, decorators: [{
|
|
589
|
+
type: Component,
|
|
590
|
+
args: [{ standalone: true, selector: 'ipi-table', imports: [
|
|
591
|
+
NgStyle,
|
|
592
|
+
NgClass,
|
|
593
|
+
DecimalPipe,
|
|
594
|
+
NgTemplateOutlet,
|
|
595
|
+
IpiChipComponent,
|
|
596
|
+
IpiImageComponent,
|
|
597
|
+
IpiSelectComponent,
|
|
598
|
+
IpiTooltipDirective,
|
|
599
|
+
IpiCheckboxComponent,
|
|
600
|
+
ScrollingModule,
|
|
601
|
+
], template: "<div class=\"container\" [ngClass]=\"{ 'is-loading': isLoading }\">\n @if (virtualScroll) {\n <cdk-virtual-scroll-viewport [itemSize]=\"itemSize\" class=\"cdk-table-viewport\" [ngStyle]=\"{ height: getVirtualViewportHeight() + 'px' }\" [style.overflow-y]=\"shouldShowViewportScroll() ? 'auto' : 'hidden'\" (scrolled)=\"onViewportScroll()\">\n <table>\n <thead #theadRef>\n <tr>\n @for (column of columns; track $index) {\n <th [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n <div class=\"cell\">\n <span>{{ column.label }}</span>\n\n @if (column.type !== TableColumnType.Actions && sortable) {\n <div class=\"arranger\" (click)=\"sortColumn(column)\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 12 12\" fill=\"none\">\n <path d=\"M3.11445 5.50005H8.88795C9.31895 5.50005 9.54795 4.99005 9.26145 4.66755L6.37495 1.42005C6.32813 1.3672 6.27063 1.32489 6.20624 1.29591C6.14186 1.26694 6.07205 1.25195 6.00145 1.25195C5.93084 1.25195 5.86104 1.26694 5.79666 1.29591C5.73227 1.32489 5.67477 1.3672 5.62795 1.42005L2.74045 4.66755C2.45395 4.99005 2.68295 5.50005 3.11445 5.50005ZM5.62745 10.5795C5.67427 10.6324 5.73177 10.6747 5.79616 10.7037C5.86054 10.7327 5.93034 10.7476 6.00095 10.7476C6.07155 10.7476 6.14136 10.7327 6.20574 10.7037C6.27013 10.6747 6.32763 10.6324 6.37445 10.5795L9.26095 7.33205C9.54795 7.01005 9.31895 6.50005 8.88745 6.50005H3.11445C2.68345 6.50005 2.45445 7.01005 2.74095 7.33255L5.62745 10.5795Z\" fill=\"#C6C6C6\"/>\n </svg>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n\n <tbody>\n <tr *cdkVirtualFor=\"let row of getPageData(); trackBy: trackByIndex\">\n @for (column of columns; track $index) {\n <td tabindex=\"-1\">\n <ng-container [ngTemplateOutlet]=\"getCellTemplate(column)\"\n [ngTemplateOutletContext]=\"{ row: row, column: column, $index: $index }\">\n </ng-container>\n </td>\n }\n </tr>\n </tbody>\n </table>\n </cdk-virtual-scroll-viewport>\n } @else {\n <table>\n <thead>\n <tr>\n @for (column of columns; track $index) {\n <th [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n <div class=\"cell\">\n <span>{{ column.label }}</span>\n\n @if (column.type !== TableColumnType.Actions && sortable) {\n <div class=\"arranger\" (click)=\"sortColumn(column)\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 12 12\" fill=\"none\">\n <path d=\"M3.11445 5.50005H8.88795C9.31895 5.50005 9.54795 4.99005 9.26145 4.66755L6.37495 1.42005C6.32813 1.3672 6.27063 1.32489 6.20624 1.29591C6.14186 1.26694 6.07205 1.25195 6.00145 1.25195C5.93084 1.25195 5.86104 1.26694 5.79666 1.29591C5.73227 1.32489 5.67477 1.3672 5.62795 1.42005L2.74045 4.66755C2.45395 4.99005 2.68295 5.50005 3.11445 5.50005ZM5.62745 10.5795C5.67427 10.6324 5.73177 10.6747 5.79616 10.7037C5.86054 10.7327 5.93034 10.7476 6.00095 10.7476C6.07155 10.7476 6.14136 10.7327 6.20574 10.7037C6.27013 10.6747 6.32763 10.6324 6.37445 10.5795L9.26095 7.33205C9.54795 7.01005 9.31895 6.50005 8.88745 6.50005H3.11445C2.68345 6.50005 2.45445 7.01005 2.74095 7.33255L5.62745 10.5795Z\" fill=\"#C6C6C6\"/>\n </svg>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n\n <tbody>\n @for (row of getPageData(); track $index) { \n <tr>\n @for (column of columns; track $index) {\n <td tabindex=\"-1\">\n <ng-container [ngTemplateOutlet]=\"getCellTemplate(column)\"\n [ngTemplateOutletContext]=\"{ row: row, column: column, $index: $index }\">\n </ng-container>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n\n @if (filter && filteredData && filteredData.length === 0) {\n <div class=\"row no-data\">\n <span>No data matching the filter:</span>\n\n <span>\"{{ filter }}\"</span>\n </div>\n }\n\n @if (!filter && data && data.length === 0) {\n <div class=\"row no-data\">No data available.</div>\n }\n\n @if (pageable && getPageData().length !== 0) {\n <div class=\"paging\">\n <div class=\"visible-range\">{{ visibleRange }}</div>\n\n <ng-container *ngTemplateOutlet=\"pagePicker; context: { totalPages: totalPages }\"></ng-container>\n\n <div class=\"page-size-option-picker\">\n <span>Items per page:</span>\n\n <ipi-select class=\"table\" [options]=\"pageSizeSelectOptions\"></ipi-select>\n </div>\n </div>\n }\n</div>\n\n<ng-template #textCell let-row=\"row\" let-column=\"column\" let-index=\"$index\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) }}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #dateCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\">\n {{ formatDate(getDescendantProp(row, column), column.dateFormat) }}\n </div>\n</ng-template>\n\n<ng-template #currencyCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [ngStyle]=\"{ width: column.width ? column.width : '' }\">\n\n @if (getDescendantProp(row, column) !== undefined) {\n {{ column.prefix ? column.prefix : '' }}{{ (getDescendantProp(row, column) / 100) | number }}\n }\n </div>\n</ng-template>\n\n<ng-template #numberCell let-row=\"row\" let-column=\"column\" let-index=\"i\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) | number}}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #numberMathCell let-row=\"row\" let-column=\"column\" let-index=\"i\">\n <div class=\"cell\"\n [ngClass]=\"getClass(row, column)\"\n [attr.contenteditable]=\"column.editable\"\n (keyup)=\"cellEdit($event, column.value, index)\">\n\n {{ column.prefix ? column.prefix : '' }}{{ getDescendantProp(row, column) | number}}{{ column.suffix ? column.suffix : '' }}\n </div>\n</ng-template>\n\n<ng-template #actionCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell actions\">\n\n @for (action of column.singleActions; track $index) {\n @if (handleActionShow(action, row, column)) {\n <div IpiTooltip (click)=\"action.execute && action.execute(row)\" [ipiTooltip]=\"action.label\" [tooltipPosition]=\"tooltipPosition.Above\" class=\"action-icon-wrapper\" [ngClass]=\"{ 'disabled': action.disabled }\">\n <ipi-img [src]=\" 'assets/img/' + action.icon\" [ngClass]=\"action.class\" [ariaLabel]=\"'Action icon for ' + action.label\"></ipi-img>\n </div>\n }\n }\n\n @if (column.multipleActions) {\n <div class=\"action-icon-wrapper\" #moreActionsList [ngClass]=\"{ 'opened': row.isDropdown }\" (click)=\"toggleActionDropdown(row, $event)\">\n <svg class=\"multiple-action-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 17 16\" fill=\"none\">\n <path d=\"M10.3047 8C10.3047 8.34612 10.2021 8.68446 10.0098 8.97225C9.81747 9.26004 9.54416 9.48434 9.22438 9.61679C8.90461 9.74924 8.55275 9.7839 8.21328 9.71638C7.87381 9.64885 7.56199 9.48218 7.31725 9.23744C7.07251 8.9927 6.90584 8.68088 6.83831 8.34141C6.77079 8.00194 6.80545 7.65008 6.9379 7.33031C7.07035 7.01053 7.29465 6.73722 7.58244 6.54493C7.87023 6.35264 8.20857 6.25 8.55469 6.25C9.01868 6.25046 9.46353 6.43498 9.79162 6.76307C10.1197 7.09116 10.3042 7.53601 10.3047 8ZM8.55469 4.75C8.90081 4.75 9.23915 4.64737 9.52694 4.45507C9.81472 4.26278 10.039 3.98947 10.1715 3.6697C10.3039 3.34993 10.3386 2.99806 10.2711 2.65859C10.2035 2.31913 10.0369 2.00731 9.79213 1.76256C9.54738 1.51782 9.23556 1.35115 8.8961 1.28363C8.55663 1.2161 8.20476 1.25076 7.88499 1.38321C7.56522 1.51566 7.29191 1.73997 7.09962 2.02775C6.90732 2.31554 6.80469 2.65388 6.80469 3C6.80515 3.46399 6.98967 3.90884 7.31776 4.23693C7.64585 4.56502 8.0907 4.74954 8.55469 4.75ZM8.55469 11.25C8.20857 11.25 7.87023 11.3526 7.58244 11.5449C7.29465 11.7372 7.07035 12.0105 6.9379 12.3303C6.80545 12.6501 6.77079 13.0019 6.83831 13.3414C6.90584 13.6809 7.07251 13.9927 7.31725 14.2374C7.56199 14.4822 7.87381 14.6489 8.21328 14.7164C8.55275 14.7839 8.90461 14.7492 9.22438 14.6168C9.54416 14.4843 9.81747 14.26 10.0098 13.9722C10.2021 13.6845 10.3047 13.3461 10.3047 13C10.3042 12.536 10.1197 12.0912 9.79162 11.7631C9.46353 11.435 9.01868 11.2505 8.55469 11.25Z\" fill=\"#5D6068\"/>\n </svg>\n </div>\n }\n\n </div>\n\n @if (row.isDropdown) {\n <ng-container class=\"dropdown-element\" *ngTemplateOutlet=\"multipleActionsDropdown; context: { row, column }\"></ng-container>\n }\n</ng-template>\n\n<ng-template #chipCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell chip\">\n @if (getChipLabel(row, column)) {\n <ipi-chip [ngClass]=\"getClass(row, column)\"> {{ getChipLabel(row, column) }}</ipi-chip>\n }\n </div>\n</ng-template>\n\n<ng-template #checkboxCell let-row=\"row\" let-column=\"column\">\n <div class=\"cell checkbox\">\n <ipi-checkbox [checked]=\"getCheckboxState(row, column)\" [disabled]=\"true\"></ipi-checkbox>\n </div>\n</ng-template>\n\n<ng-template #multipleActionsDropdown let-row=\"row\" let-column=\"column\">\n <div #multipleActionsDropdownElement #dropdownElement class=\"more-actions-dropdown\">\n @for (action of column.multipleActions; track $index) {\n\n @if (handleActionShow(action, row, column)) {\n <div class=\"dropdown-row\" (click)=\"action.execute && action.execute(row)\">\n <ipi-img [src]=\"'assets/img/' + action.icon\" [ngClass]=\"action.class\" [ariaLabel]=\"'Action icon for ' + action.label\"></ipi-img>\n\n <span>{{ action.label }}</span>\n </div>\n }\n\n }\n </div>\n</ng-template>\n\n<ng-template #pagePicker let-totalPages=\"totalPages\">\n <div class=\"page-picker\">\n <!-- If page one should be visible -->\n @if (currentPage + 1 >= 3) {\n <span (click)=\"goToPage(0)\">1</span>\n <span class=\"style-excluded\">...</span>\n }\n\n <!-- Middle part of the page-picker -->\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage - 1 } \"></ng-container>\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage, class: 'highlighted' } \"></ng-container>\n <ng-container *ngTemplateOutlet=\"page; context: { page: currentPage + 1 } \"></ng-container>\n\n <!-- If last page should be visible -->\n @if (currentPage + 1 <= totalPages - 2) {\n <span class=\"style-excluded\">...</span>\n <span (click)=\"goToPage(totalPages - 1)\">{{ totalPages }}</span>\n }\n\n </div>\n</ng-template>\n\n<ng-template #page let-page=\"page\" let-class=\"class\">\n @if (page >= 0 && page < totalPages) {\n <span [ngClass]=\"class\" (click)=\"goToPage(page)\">{{ page + 1 }}</span>\n }\n</ng-template>\n", styles: [":host{display:block;touch-action:manipulation}.container{width:100%;position:relative;overflow:auto;padding:24px 0}.cdk-table-viewport{width:100%;display:block;overflow:auto;scrollbar-gutter:stable}.cdk-table-viewport .cdk-virtual-scroll-content-wrapper{width:100%;display:block}table{width:100%;text-align:center;table-layout:fixed;border-collapse:collapse}thead tr{border:none}tr{height:42px;vertical-align:middle;border-bottom:1px solid var(--ipi-table-row-bottom-border-color, #E9E9E9)}th{min-width:60px;-webkit-user-select:none;user-select:none;font-weight:500;font-size:14px;color:var(--ipi-table-first-row-text-color, #5D6068)}th .cell{display:flex;justify-content:center;align-items:center}td{scrollbar-width:thin;overflow:auto;text-overflow:clip;font-size:14px}td:focus{outline:none}td .cell{text-wrap:nowrap}ipi-chip{max-width:100%;--ipi-chip-background-color: #FFF2EF;--ipi-chip-color: #F96138}.cell{line-height:16px;box-sizing:border-box}.cell span{margin-right:4px}.cell.checkbox{display:flex;justify-content:center;align-items:center;--ipi-checkbox-disabled-opacity: 1}.cell.actions{display:flex;justify-content:center;align-items:center;gap:4px}.cell.actions ipi-img{width:16px;height:16px}.cell.chip{display:flex;justify-content:center;align-items:center}.cell.chip .primary{--ipi-chip-background-color: var(--ipi-table-chip-background-color);--ipi-chip-color: var(--ipi-table-chip-color)}.cell.chip .secondary{--ipi-chip-background-color: var(--ipi-table-chip-background-color-secondary);--ipi-chip-color: var(--ipi-table-chip-color-secondary)}.no-data{display:flex;justify-content:center;font-size:14px;margin-top:16px}.more-actions-dropdown{min-width:184px;width:fit-content;position:fixed;background-color:var(--ipi-table-more-actions-dropdown-background-color, #FFFFFF);border-radius:8px;box-shadow:0 4px 8px #d6d6d659;z-index:10}.dropdown-row{height:44px;display:flex;align-items:center;justify-content:flex-start;font-size:14px;font-weight:500;box-sizing:border-box;overflow:visible;cursor:pointer;background-color:var(--ipi-table-more-actions-dropdown-background-color, #FFFFFF);padding:0 12px}.dropdown-row:hover{background-color:var(--ipi-table-more-actions-dropdown-hover-background-color, #F3F3F3)}.dropdown-row ipi-img{width:20px;height:20px}.dropdown-row ipi-img path{fill:var(--ipi-table-dropdown-action-icon-fill, #5D6068);stroke:var(--ipi-table-dropdown-action-icon-stroke, #FFFFFF00)}.dropdown-row:hover ipi-img path{fill:var(--ipi-table-action-icon-hover-fill, #F96138);stroke:var(--ipi-table-action-icon-hover-stroke, #FFFFFF00)}.dropdown-row span{margin:0 12px;text-wrap:nowrap}.is-loading{opacity:.5;pointer-events:none}.container.is-loading:after{width:0px;height:2px;content:\" \";position:sticky;top:0;left:-50%;display:block;background-color:var(--ipi-table-loading-bar-color, #FF7F50);animation:lineAnimation 1s linear infinite;border-radius:20px;z-index:1}.action-icon-wrapper{width:36px;height:36px;display:flex;align-items:center;justify-content:center;cursor:pointer}.action-icon-wrapper:not(.disabled):hover{border-radius:4px;background:var(--ipi-table-action-hover-background-color, #F7F8FB)}.action-icon-wrapper ipi-img path{fill:var(--ipi-table-action-icon-fill, #5D6068);stroke:var(--ipi-table-action-icon-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover ipi-img path{fill:var(--ipi-table-action-icon-hover-fill, #F96138);stroke:var(--ipi-table-action-icon-hover-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover svg path,.opened .multiple-action-icon path{fill:var(--ipi-table-action-more-icon-fill, #F96138);stroke:var(--ipi-table-action-more-icon-stroke, #FFFFFF00)}.action-icon-wrapper ipi-img.secondary path{fill:var(--ipi-table-action-secondary-icon-fill, #F96138);stroke:var(--ipi-table-action-secondary-icon-stroke, #FFFFFF00)}.action-icon-wrapper:not(.disabled):hover ipi-img.secondary path{fill:var(--ipi-table-action-secondary-icon-hover-fill, #5D6068);stroke:var(--ipi-table-action-secondary-icon-hover-stroke, #FFFFFF00)}.arranger{width:14px;height:14px;cursor:pointer}.arranger svg:hover{transform:scale(1.15)}.paging{display:flex;justify-content:space-between;align-items:center;font-size:14px;font-weight:600;-webkit-user-select:none;user-select:none;margin-top:12px}.paging .items-per-page{line-height:10px;margin-right:8px}.mobile .visible-range{margin:0 12px}.page-picker{display:flex;justify-content:center;gap:14px}.page-picker span{min-width:24px;height:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;border-radius:24px;gap:10px;transition:color .25s,background-color .25s}.page-picker span.highlighted,.page-picker span:hover:not(.style-excluded){cursor:pointer;color:var(--ipi-table-page-picker-text-color, #FFF);background:var(--ipi-table-page-picker-background, #F96138)}.page-size-option-picker{display:flex;align-items:center}.page-size-option-picker span{text-wrap:nowrap;margin-right:8px}@media(max-width:940px){.paging{flex-direction:column;row-gap:16px;margin-top:24px}.visible-range{order:1}}@keyframes lineAnimation{0%{width:0px}50%{left:20%;width:80%}to{left:100%;width:100%}}\n"] }]
|
|
602
|
+
}], ctorParameters: () => [{ type: i1.OSService }, { type: i2.FormBuilder }, { type: i0.ChangeDetectorRef }], propDecorators: { theadRef: [{
|
|
603
|
+
type: ViewChild,
|
|
604
|
+
args: ['theadRef']
|
|
605
|
+
}], moreActionsList: [{
|
|
606
|
+
type: ViewChildren,
|
|
607
|
+
args: ['moreActionsList']
|
|
608
|
+
}], cdkViewport: [{
|
|
609
|
+
type: ViewChild,
|
|
610
|
+
args: [CdkVirtualScrollViewport]
|
|
611
|
+
}], DropdownElement: [{
|
|
612
|
+
type: ViewChild,
|
|
613
|
+
args: ['dropdownElement']
|
|
614
|
+
}], textCellTpl: [{
|
|
615
|
+
type: ViewChild,
|
|
616
|
+
args: ['textCell', { static: true }]
|
|
617
|
+
}], numberCellTpl: [{
|
|
618
|
+
type: ViewChild,
|
|
619
|
+
args: ['numberCell', { static: true }]
|
|
620
|
+
}], currencyCellTpl: [{
|
|
621
|
+
type: ViewChild,
|
|
622
|
+
args: ['currencyCell', { static: true }]
|
|
623
|
+
}], numberMathCellTpl: [{
|
|
624
|
+
type: ViewChild,
|
|
625
|
+
args: ['numberMathCell', { static: true }]
|
|
626
|
+
}], dateCellTpl: [{
|
|
627
|
+
type: ViewChild,
|
|
628
|
+
args: ['dateCell', { static: true }]
|
|
629
|
+
}], chipCellTpl: [{
|
|
630
|
+
type: ViewChild,
|
|
631
|
+
args: ['chipCell', { static: true }]
|
|
632
|
+
}], checkboxCellTpl: [{
|
|
633
|
+
type: ViewChild,
|
|
634
|
+
args: ['checkboxCell', { static: true }]
|
|
635
|
+
}], actionCellTpl: [{
|
|
636
|
+
type: ViewChild,
|
|
637
|
+
args: ['actionCell', { static: true }]
|
|
638
|
+
}], data: [{
|
|
639
|
+
type: Input
|
|
640
|
+
}], dataLength: [{
|
|
641
|
+
type: Input
|
|
642
|
+
}], columns: [{
|
|
643
|
+
type: Input
|
|
644
|
+
}], filter: [{
|
|
645
|
+
type: Input
|
|
646
|
+
}], serverSide: [{
|
|
647
|
+
type: Input
|
|
648
|
+
}], isLoading: [{
|
|
649
|
+
type: Input
|
|
650
|
+
}], sortIndex: [{
|
|
651
|
+
type: Input
|
|
652
|
+
}], sortable: [{
|
|
653
|
+
type: Input
|
|
654
|
+
}], sortDirection: [{
|
|
655
|
+
type: Input
|
|
656
|
+
}], pageSize: [{
|
|
657
|
+
type: Input
|
|
658
|
+
}], currentPage: [{
|
|
659
|
+
type: Input
|
|
660
|
+
}], pageable: [{
|
|
661
|
+
type: Input
|
|
662
|
+
}], pageSizeOptions: [{
|
|
663
|
+
type: Input
|
|
664
|
+
}], virtualScroll: [{
|
|
665
|
+
type: Input
|
|
666
|
+
}], tableMaxHeight: [{
|
|
667
|
+
type: Input
|
|
668
|
+
}], tableChange: [{
|
|
669
|
+
type: Output
|
|
670
|
+
}], onClick: [{
|
|
671
|
+
type: HostListener,
|
|
672
|
+
args: ['document:click', ['$event']]
|
|
673
|
+
}], onScroll: [{
|
|
674
|
+
type: HostListener,
|
|
675
|
+
args: ['document:scroll']
|
|
676
|
+
}], onResize: [{
|
|
677
|
+
type: HostListener,
|
|
678
|
+
args: ['window:resize']
|
|
679
|
+
}] } });
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Generated bundle index. Do not edit.
|
|
683
|
+
*/
|
|
684
|
+
|
|
685
|
+
export { IpiTableColumnType, IpiTableComponent };
|
|
686
|
+
//# sourceMappingURL=apexara-ng-components-table.mjs.map
|