@dcsl/flex-ui 0.0.4 → 0.0.5
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/fesm2022/dcsl-flex-ui.mjs +254 -4
- package/fesm2022/dcsl-flex-ui.mjs.map +1 -1
- package/index.d.ts +87 -2
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Renderer2, HostListener, ViewChild, Component } from '@angular/core';
|
|
2
|
+
import { inject, Renderer2, HostListener, ViewChild, Component, input, EventEmitter, effect, Output, ContentChild, Input, ContentChildren, output } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
3
7
|
|
|
4
8
|
class FlexPanelComponent {
|
|
5
9
|
resizeObserver;
|
|
@@ -56,15 +60,261 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
|
|
|
56
60
|
args: ['window:resize']
|
|
57
61
|
}] } });
|
|
58
62
|
|
|
63
|
+
class FlexPaginationComponent {
|
|
64
|
+
rowCount = input(0, ...(ngDevMode ? [{ debugName: "rowCount" }] : []));
|
|
65
|
+
_totalItems = 0;
|
|
66
|
+
pageSize = 50;
|
|
67
|
+
currentPage = 1;
|
|
68
|
+
pageChange = new EventEmitter();
|
|
69
|
+
maxPagesToShow = 5;
|
|
70
|
+
pageSizes = [50, 100, 200, 500];
|
|
71
|
+
constructor() {
|
|
72
|
+
effect(() => {
|
|
73
|
+
this.currentPage = 1;
|
|
74
|
+
this._totalItems = this.rowCount();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
ngOnInit() {
|
|
78
|
+
this.updateMaxPages();
|
|
79
|
+
}
|
|
80
|
+
// Update maxPagesToShow based on screen size
|
|
81
|
+
updateMaxPages() {
|
|
82
|
+
const width = window.innerWidth;
|
|
83
|
+
if (width < 576) {
|
|
84
|
+
this.maxPagesToShow = 1; // only current page
|
|
85
|
+
}
|
|
86
|
+
else if (width < 768) {
|
|
87
|
+
this.maxPagesToShow = 3;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.maxPagesToShow = 5;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
get totalPages() {
|
|
94
|
+
return Math.ceil(this._totalItems / this.pageSize) || 1;
|
|
95
|
+
}
|
|
96
|
+
get pages() {
|
|
97
|
+
const total = this.totalPages;
|
|
98
|
+
const max = this.maxPagesToShow;
|
|
99
|
+
if (max === 1) {
|
|
100
|
+
return [this.currentPage]; // mobile: only current page
|
|
101
|
+
}
|
|
102
|
+
const pages = [];
|
|
103
|
+
if (total <= max) {
|
|
104
|
+
for (let i = 1; i <= total; i++)
|
|
105
|
+
pages.push(i);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
let start = Math.max(this.currentPage - Math.floor(max / 2), 1);
|
|
109
|
+
let end = start + max - 1;
|
|
110
|
+
if (end > total) {
|
|
111
|
+
end = total;
|
|
112
|
+
start = end - max + 1;
|
|
113
|
+
}
|
|
114
|
+
if (start > 1)
|
|
115
|
+
pages.push(1, '...');
|
|
116
|
+
for (let i = start; i <= end; i++)
|
|
117
|
+
pages.push(i);
|
|
118
|
+
if (end < total)
|
|
119
|
+
pages.push('...', total);
|
|
120
|
+
}
|
|
121
|
+
return pages;
|
|
122
|
+
}
|
|
123
|
+
changePage(page) {
|
|
124
|
+
if (typeof page !== 'number')
|
|
125
|
+
return;
|
|
126
|
+
if (page < 1)
|
|
127
|
+
page = 1;
|
|
128
|
+
if (page > this.totalPages)
|
|
129
|
+
page = this.totalPages;
|
|
130
|
+
if (page === this.currentPage)
|
|
131
|
+
return;
|
|
132
|
+
this.currentPage = page;
|
|
133
|
+
this.pageChange.emit({
|
|
134
|
+
skip: (this.currentPage - 1) * this.pageSize,
|
|
135
|
+
take: this.pageSize,
|
|
136
|
+
pageSize: this.pageSize,
|
|
137
|
+
currentPage: this.currentPage,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
onPageSizeChange(pageSize) {
|
|
141
|
+
var value = Number(pageSize.target.value);
|
|
142
|
+
if (isNaN(value) || value <= 0)
|
|
143
|
+
return;
|
|
144
|
+
this.pageSize = value;
|
|
145
|
+
this.pageChange.emit({
|
|
146
|
+
skip: (this.currentPage - 1) * this.pageSize,
|
|
147
|
+
take: this.pageSize,
|
|
148
|
+
pageSize: this.pageSize,
|
|
149
|
+
currentPage: this.currentPage
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
firstPage() { this.changePage(1); }
|
|
153
|
+
lastPage() { this.changePage(this.totalPages); }
|
|
154
|
+
prevPage() { this.changePage(this.currentPage - 1); }
|
|
155
|
+
nextPage() { this.changePage(this.currentPage + 1); }
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
157
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.1", type: FlexPaginationComponent, isStandalone: true, selector: "flex-pagination", inputs: { rowCount: { classPropertyName: "rowCount", publicName: "rowCount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChange: "pageChange" }, host: { listeners: { "window:resize": "updateMaxPages()" } }, ngImport: i0, template: "<div class=\"d-flex justify-content-start align-items-center\">\r\n <!-- Pagination -->\r\n <div class=\"overflow-auto\">\r\n <ul class=\"pagination justify-content-center flex-nowrap mb-0\">\r\n <!-- First / Prev (hide First on xs) -->\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"firstPage()\"><i class=\"bi bi-chevron-double-left\"></i></button>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"prevPage()\"><i class=\"bi bi-chevron-left\"></i></button>\r\n </li>\r\n\r\n <!-- Page numbers -->\r\n <li class=\"page-item\" *ngFor=\"let page of pages\" [class.active]=\"page === currentPage\"\r\n [class.disabled]=\"page === '...'\">\r\n <button class=\"page-link\" [disabled]=\"page === '...'\" (click)=\"changePage(page)\">\r\n {{ page }}\r\n </button>\r\n </li>\r\n\r\n <!-- Next / Last (hide Last on xs) -->\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"nextPage()\"><i class=\"bi bi-chevron-right\"></i></button>\r\n </li>\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"lastPage()\"><i class=\"bi bi-chevron-double-right\"></i></button>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <!-- Page Size Dropdown -->\r\n <div class=\"ms-2\">\r\n <label class=\"me-2\">{{ \"page-size\" }}</label>\r\n <select class=\"form-select d-inline-block w-auto\" [(ngModel)]=\"pageSize\" (change)=\"onPageSizeChange($event)\">\r\n <option *ngFor=\"let size of pageSizes\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n </div>\r\n <div class=\"total-count ms-2\">\r\n {{ \"total-count\" }}: {{ _totalItems }}\r\n </div>\r\n</div>", styles: ["@media (max-width: 576px){.total-count{display:none!important}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
158
|
+
}
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexPaginationComponent, decorators: [{
|
|
160
|
+
type: Component,
|
|
161
|
+
args: [{ selector: 'flex-pagination', imports: [CommonModule, FormsModule], template: "<div class=\"d-flex justify-content-start align-items-center\">\r\n <!-- Pagination -->\r\n <div class=\"overflow-auto\">\r\n <ul class=\"pagination justify-content-center flex-nowrap mb-0\">\r\n <!-- First / Prev (hide First on xs) -->\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"firstPage()\"><i class=\"bi bi-chevron-double-left\"></i></button>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"prevPage()\"><i class=\"bi bi-chevron-left\"></i></button>\r\n </li>\r\n\r\n <!-- Page numbers -->\r\n <li class=\"page-item\" *ngFor=\"let page of pages\" [class.active]=\"page === currentPage\"\r\n [class.disabled]=\"page === '...'\">\r\n <button class=\"page-link\" [disabled]=\"page === '...'\" (click)=\"changePage(page)\">\r\n {{ page }}\r\n </button>\r\n </li>\r\n\r\n <!-- Next / Last (hide Last on xs) -->\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"nextPage()\"><i class=\"bi bi-chevron-right\"></i></button>\r\n </li>\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"lastPage()\"><i class=\"bi bi-chevron-double-right\"></i></button>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <!-- Page Size Dropdown -->\r\n <div class=\"ms-2\">\r\n <label class=\"me-2\">{{ \"page-size\" }}</label>\r\n <select class=\"form-select d-inline-block w-auto\" [(ngModel)]=\"pageSize\" (change)=\"onPageSizeChange($event)\">\r\n <option *ngFor=\"let size of pageSizes\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n </div>\r\n <div class=\"total-count ms-2\">\r\n {{ \"total-count\" }}: {{ _totalItems }}\r\n </div>\r\n</div>", styles: ["@media (max-width: 576px){.total-count{display:none!important}}\n"] }]
|
|
162
|
+
}], ctorParameters: () => [], propDecorators: { pageChange: [{
|
|
163
|
+
type: Output
|
|
164
|
+
}], updateMaxPages: [{
|
|
165
|
+
type: HostListener,
|
|
166
|
+
args: ['window:resize']
|
|
167
|
+
}] } });
|
|
168
|
+
|
|
169
|
+
// grid-column.component.ts
|
|
170
|
+
class FlexColumnComponent {
|
|
171
|
+
headerText = input('', ...(ngDevMode ? [{ debugName: "headerText" }] : []));
|
|
172
|
+
field;
|
|
173
|
+
width = 120;
|
|
174
|
+
headerTemplate;
|
|
175
|
+
cellTemplate;
|
|
176
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.1", type: FlexColumnComponent, isStandalone: true, selector: "flex-grid-column", inputs: { headerText: { classPropertyName: "headerText", publicName: "headerText", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: false, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: false, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "headerTemplate", first: true, predicate: ["headerTemplate"], descendants: true }, { propertyName: "cellTemplate", first: true, predicate: ["cellTemplate"], descendants: true }], ngImport: i0, template: '', isInline: true });
|
|
178
|
+
}
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexColumnComponent, decorators: [{
|
|
180
|
+
type: Component,
|
|
181
|
+
args: [{
|
|
182
|
+
selector: 'flex-grid-column',
|
|
183
|
+
template: ''
|
|
184
|
+
}]
|
|
185
|
+
}], propDecorators: { field: [{
|
|
186
|
+
type: Input
|
|
187
|
+
}], width: [{
|
|
188
|
+
type: Input
|
|
189
|
+
}], headerTemplate: [{
|
|
190
|
+
type: ContentChild,
|
|
191
|
+
args: ['headerTemplate']
|
|
192
|
+
}], cellTemplate: [{
|
|
193
|
+
type: ContentChild,
|
|
194
|
+
args: ['cellTemplate']
|
|
195
|
+
}] } });
|
|
196
|
+
|
|
197
|
+
// grid-columns.component.ts
|
|
198
|
+
class FlexColumnsComponent {
|
|
199
|
+
columns;
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexColumnsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: FlexColumnsComponent, isStandalone: true, selector: "flex-grid-columns", queries: [{ propertyName: "columns", predicate: FlexColumnComponent }], ngImport: i0, template: '', isInline: true });
|
|
202
|
+
}
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: FlexColumnsComponent, decorators: [{
|
|
204
|
+
type: Component,
|
|
205
|
+
args: [{
|
|
206
|
+
selector: 'flex-grid-columns',
|
|
207
|
+
template: ''
|
|
208
|
+
}]
|
|
209
|
+
}], propDecorators: { columns: [{
|
|
210
|
+
type: ContentChildren,
|
|
211
|
+
args: [FlexColumnComponent]
|
|
212
|
+
}] } });
|
|
213
|
+
|
|
214
|
+
class CustomGridComponent {
|
|
215
|
+
enablePaging = input(false, ...(ngDevMode ? [{ debugName: "enablePaging" }] : []));
|
|
216
|
+
totalDataCount = input(0, ...(ngDevMode ? [{ debugName: "totalDataCount" }] : []));
|
|
217
|
+
tableClass = input('', ...(ngDevMode ? [{ debugName: "tableClass" }] : []));
|
|
218
|
+
dataSource = [];
|
|
219
|
+
// @ContentChildren(GridColumnComponent) columns!: QueryList<GridColumnComponent>;
|
|
220
|
+
gridColumns;
|
|
221
|
+
rowClicked = output();
|
|
222
|
+
rowDblClicked = output();
|
|
223
|
+
// Optional: custom template when no data
|
|
224
|
+
emptyRecordTemplate;
|
|
225
|
+
isPagingEnabled = false;
|
|
226
|
+
gridHeader;
|
|
227
|
+
gridBody;
|
|
228
|
+
selectedIndex = -1;
|
|
229
|
+
_totalDataCount = 0;
|
|
230
|
+
_tableClass = "";
|
|
231
|
+
pageChange = output();
|
|
232
|
+
currentPage = 1;
|
|
233
|
+
pageSize = 50;
|
|
234
|
+
constructor() {
|
|
235
|
+
effect(() => {
|
|
236
|
+
this.isPagingEnabled = this.enablePaging();
|
|
237
|
+
});
|
|
238
|
+
effect(() => {
|
|
239
|
+
this._totalDataCount = this.totalDataCount();
|
|
240
|
+
});
|
|
241
|
+
effect(() => {
|
|
242
|
+
this._tableClass = this.tableClass();
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
ngAfterViewInit() {
|
|
246
|
+
this.syncColumnWidths();
|
|
247
|
+
}
|
|
248
|
+
check() {
|
|
249
|
+
console.log(this.gridColumns);
|
|
250
|
+
console.log(this.dataSource);
|
|
251
|
+
}
|
|
252
|
+
syncScroll(e) {
|
|
253
|
+
const body = e.target;
|
|
254
|
+
const header = this.gridHeader?.nativeElement; //document.querySelector('.grid-header');
|
|
255
|
+
if (header)
|
|
256
|
+
header.scrollLeft = body.scrollLeft;
|
|
257
|
+
}
|
|
258
|
+
syncColumnWidths() {
|
|
259
|
+
// const headerCols = this.gridHeader.nativeElement.querySelectorAll('th');
|
|
260
|
+
// const bodyCols = this.gridBody.nativeElement.querySelectorAll('tr:first-child td');
|
|
261
|
+
// bodyCols.forEach((td: HTMLElement, i: number) => {
|
|
262
|
+
// const width = td.getBoundingClientRect().width;
|
|
263
|
+
// (headerCols[i] as HTMLElement).style.width = width + 'px';
|
|
264
|
+
// });
|
|
265
|
+
}
|
|
266
|
+
// syncColumnWidths() {
|
|
267
|
+
// const headerCols = document.querySelectorAll('.grid-header th');
|
|
268
|
+
// const bodyCols = this.gridBody.nativeElement.querySelectorAll('tbody tr:first-child td');
|
|
269
|
+
// bodyCols.forEach((col: HTMLElement, i: number) => {
|
|
270
|
+
// const width = col.getBoundingClientRect().width;
|
|
271
|
+
// (headerCols[i] as HTMLElement).style.width = width + 'px';
|
|
272
|
+
// });
|
|
273
|
+
// }
|
|
274
|
+
onRowDblClick(index, data) {
|
|
275
|
+
this.selectedIndex = index;
|
|
276
|
+
// console.log(index);
|
|
277
|
+
this.rowDblClicked.emit({ index: index, data: data });
|
|
278
|
+
}
|
|
279
|
+
onRowClick(index, data) {
|
|
280
|
+
this.selectedIndex = index;
|
|
281
|
+
// console.log(index);
|
|
282
|
+
this.rowClicked.emit({ index: index, data: data });
|
|
283
|
+
}
|
|
284
|
+
onPageChanged(event) {
|
|
285
|
+
console.log(event);
|
|
286
|
+
this.currentPage = event.currentPage;
|
|
287
|
+
this.pageSize = event.pageSize;
|
|
288
|
+
this.pageChange.emit(event);
|
|
289
|
+
}
|
|
290
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
291
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.1", type: CustomGridComponent, isStandalone: true, selector: "flex-grid", inputs: { enablePaging: { classPropertyName: "enablePaging", publicName: "enablePaging", isSignal: true, isRequired: false, transformFunction: null }, totalDataCount: { classPropertyName: "totalDataCount", publicName: "totalDataCount", isSignal: true, isRequired: false, transformFunction: null }, tableClass: { classPropertyName: "tableClass", publicName: "tableClass", isSignal: true, isRequired: false, transformFunction: null }, dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: false, isRequired: false, transformFunction: null }, emptyRecordTemplate: { classPropertyName: "emptyRecordTemplate", publicName: "emptyRecordTemplate", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { rowClicked: "rowClicked", rowDblClicked: "rowDblClicked", pageChange: "pageChange" }, queries: [{ propertyName: "gridColumns", first: true, predicate: FlexColumnsComponent, descendants: true }], viewQueries: [{ propertyName: "gridHeader", first: true, predicate: ["gridHeader"], descendants: true }, { propertyName: "gridBody", first: true, predicate: ["gridBody"], descendants: true }], ngImport: i0, template: "<div class=\"grid-container\">\r\n <!-- Header row in its own div -->\r\n <div class=\"grid-scroll\">\r\n <div class=\"grid-container-sub\">\r\n <div class=\"grid-header\" #gridHeader>\r\n <table class=\"grid-table table table-bordered table-sm mb-0 header-table\">\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <thead>\r\n <tr>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <th class=\"text-truncate\">\r\n @if (col.headerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.headerTemplate\"></ng-container>\r\n }\r\n @else {\r\n <!-- <ng-template #defaultHeader><span [textContent]=\"col.field\"></span></ng-template> -->\r\n <!-- <span [textContent]=\"col.field\"></span> -->\r\n {{ col.headerText() }}\r\n }\r\n </th>\r\n }\r\n\r\n <!-- <th style=\"width: 20px;\"></th> -->\r\n </tr>\r\n </thead>\r\n\r\n </table>\r\n </div>\r\n <!-- Scrollable body in another div -->\r\n <div #gridBody class=\"grid-body\" (scroll)=\"syncScroll($event)\">\r\n @if(dataSource.length > 0){\r\n <table class=\"grid-table table table-bordered table-sm table-hover mb-0\" [ngClass]=\"_tableClass\">\r\n\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <tbody>\r\n @for (row of dataSource; track $index; let i = $index) {\r\n <tr [class.table-active]=\"$index === selectedIndex\" (click)=\"onRowClick($index, row)\"\r\n (dblclick)=\"onRowDblClick($index, row)\">\r\n @for (col of gridColumns?.columns; track $index) {\r\n <td>\r\n @if (col.cellTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.cellTemplate\" [ngTemplateOutletContext]=\"{ $implicit: row,\r\n rowIndex: (currentPage - 1) * pageSize + i,\r\n localIndex: i }\">\r\n </ng-container>\r\n } @else {\r\n <!-- {{ row[col.field] }} -->\r\n <span [textContent]=\"row[col.field]\"></span>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @else {\r\n No records found\r\n }\r\n\r\n\r\n </div>\r\n </div>\r\n\r\n </div>\r\n\r\n @if(isPagingEnabled){\r\n <!-- Footer -->\r\n <div class=\"grid-footer\">\r\n <flex-pagination [rowCount]=\"_totalDataCount\" (pageChange)=\"onPageChanged($event)\"></flex-pagination>\r\n </div>\r\n }\r\n\r\n</div>", styles: [":host{display:block;height:100%}.grid-container{display:flex;flex-direction:column;height:100%}.grid-scroll{flex:1 1 auto;overflow:auto}.grid-footer{flex:0 0 auto;padding:.3rem;background:#f8f9fa;border-top:1px solid #dee2e6}.grid-container-sub{display:flex;flex-direction:column;height:100%}.grid-header{flex:0 0 auto;overflow-x:hidden;background-color:#f9f9f9;padding-right:15px;padding-left:0}.grid-body{flex:1 1 auto;overflow-y:scroll;overflow-x:auto}.grid-table{table-layout:fixed;width:100%}.grid-table th,.grid-table td{box-sizing:border-box}.selected{background-color:#dbeafe!important}:host-context([dir=\"rtl\"]) .grid-header{padding-left:15px;padding-right:0}.header-table{--bs-table-bg: #f9f9f9}.car-table{--bs-table-bg: #eefbe5}.contract-table{--bs-table-bg: #f9efe0}.table-active{--bs-table-active-bg: #87c8f7}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: FlexPaginationComponent, selector: "flex-pagination", inputs: ["rowCount"], outputs: ["pageChange"] }] });
|
|
292
|
+
}
|
|
293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomGridComponent, decorators: [{
|
|
294
|
+
type: Component,
|
|
295
|
+
args: [{ selector: 'flex-grid', imports: [CommonModule, FormsModule, FlexPaginationComponent], template: "<div class=\"grid-container\">\r\n <!-- Header row in its own div -->\r\n <div class=\"grid-scroll\">\r\n <div class=\"grid-container-sub\">\r\n <div class=\"grid-header\" #gridHeader>\r\n <table class=\"grid-table table table-bordered table-sm mb-0 header-table\">\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <thead>\r\n <tr>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <th class=\"text-truncate\">\r\n @if (col.headerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.headerTemplate\"></ng-container>\r\n }\r\n @else {\r\n <!-- <ng-template #defaultHeader><span [textContent]=\"col.field\"></span></ng-template> -->\r\n <!-- <span [textContent]=\"col.field\"></span> -->\r\n {{ col.headerText() }}\r\n }\r\n </th>\r\n }\r\n\r\n <!-- <th style=\"width: 20px;\"></th> -->\r\n </tr>\r\n </thead>\r\n\r\n </table>\r\n </div>\r\n <!-- Scrollable body in another div -->\r\n <div #gridBody class=\"grid-body\" (scroll)=\"syncScroll($event)\">\r\n @if(dataSource.length > 0){\r\n <table class=\"grid-table table table-bordered table-sm table-hover mb-0\" [ngClass]=\"_tableClass\">\r\n\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <tbody>\r\n @for (row of dataSource; track $index; let i = $index) {\r\n <tr [class.table-active]=\"$index === selectedIndex\" (click)=\"onRowClick($index, row)\"\r\n (dblclick)=\"onRowDblClick($index, row)\">\r\n @for (col of gridColumns?.columns; track $index) {\r\n <td>\r\n @if (col.cellTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.cellTemplate\" [ngTemplateOutletContext]=\"{ $implicit: row,\r\n rowIndex: (currentPage - 1) * pageSize + i,\r\n localIndex: i }\">\r\n </ng-container>\r\n } @else {\r\n <!-- {{ row[col.field] }} -->\r\n <span [textContent]=\"row[col.field]\"></span>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @else {\r\n No records found\r\n }\r\n\r\n\r\n </div>\r\n </div>\r\n\r\n </div>\r\n\r\n @if(isPagingEnabled){\r\n <!-- Footer -->\r\n <div class=\"grid-footer\">\r\n <flex-pagination [rowCount]=\"_totalDataCount\" (pageChange)=\"onPageChanged($event)\"></flex-pagination>\r\n </div>\r\n }\r\n\r\n</div>", styles: [":host{display:block;height:100%}.grid-container{display:flex;flex-direction:column;height:100%}.grid-scroll{flex:1 1 auto;overflow:auto}.grid-footer{flex:0 0 auto;padding:.3rem;background:#f8f9fa;border-top:1px solid #dee2e6}.grid-container-sub{display:flex;flex-direction:column;height:100%}.grid-header{flex:0 0 auto;overflow-x:hidden;background-color:#f9f9f9;padding-right:15px;padding-left:0}.grid-body{flex:1 1 auto;overflow-y:scroll;overflow-x:auto}.grid-table{table-layout:fixed;width:100%}.grid-table th,.grid-table td{box-sizing:border-box}.selected{background-color:#dbeafe!important}:host-context([dir=\"rtl\"]) .grid-header{padding-left:15px;padding-right:0}.header-table{--bs-table-bg: #f9f9f9}.car-table{--bs-table-bg: #eefbe5}.contract-table{--bs-table-bg: #f9efe0}.table-active{--bs-table-active-bg: #87c8f7}\n"] }]
|
|
296
|
+
}], ctorParameters: () => [], propDecorators: { dataSource: [{
|
|
297
|
+
type: Input
|
|
298
|
+
}], gridColumns: [{
|
|
299
|
+
type: ContentChild,
|
|
300
|
+
args: [FlexColumnsComponent]
|
|
301
|
+
}], emptyRecordTemplate: [{
|
|
302
|
+
type: Input
|
|
303
|
+
}], gridHeader: [{
|
|
304
|
+
type: ViewChild,
|
|
305
|
+
args: ['gridHeader']
|
|
306
|
+
}], gridBody: [{
|
|
307
|
+
type: ViewChild,
|
|
308
|
+
args: ['gridBody']
|
|
309
|
+
}] } });
|
|
310
|
+
|
|
59
311
|
/*
|
|
60
312
|
* Public API Surface of flex-ui-controls
|
|
61
313
|
*/
|
|
62
|
-
// export * from './lib/flex-ui-controls.service';
|
|
63
|
-
// export * from './lib/flex-ui-controls.component';
|
|
64
314
|
|
|
65
315
|
/**
|
|
66
316
|
* Generated bundle index. Do not edit.
|
|
67
317
|
*/
|
|
68
318
|
|
|
69
|
-
export { FlexPanelComponent };
|
|
319
|
+
export { CustomGridComponent, FlexPaginationComponent, FlexPanelComponent };
|
|
70
320
|
//# sourceMappingURL=dcsl-flex-ui.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcsl-flex-ui.mjs","sources":["../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.ts","../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.html","../../../projects/flex-ui-controls/src/public-api.ts","../../../projects/flex-ui-controls/src/dcsl-flex-ui.ts"],"sourcesContent":["import { Component, ElementRef, HostListener, inject, Renderer2, ViewChild } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-flex-panel',\r\n imports: [],\r\n templateUrl: './flex-panel.component.html',\r\n styleUrl: './flex-panel.component.css'\r\n})\r\n\r\nexport class FlexPanelComponent {\r\n private resizeObserver?: ResizeObserver;\r\n private mutationObserver?: MutationObserver;\r\n\r\n @ViewChild(\"abc\") comp?: ElementRef<HTMLDivElement>;\r\n\r\n private renderer = inject(Renderer2);\r\n\r\n constructor() { }\r\n\r\n ngAfterViewInit() {\r\n this.adjustHeight();\r\n\r\n // ✅ Recalculate on window resize\r\n if ('ResizeObserver' in window) {\r\n this.resizeObserver = new ResizeObserver(() => this.adjustHeight());\r\n this.resizeObserver.observe(document.body);\r\n }\r\n\r\n // ✅ Also observe DOM changes that may shift this element\r\n this.mutationObserver = new MutationObserver(() => this.adjustHeight());\r\n this.mutationObserver.observe(document.body, {\r\n attributes: true,\r\n childList: true,\r\n subtree: true\r\n });\r\n\r\n\r\n }\r\n\r\n @HostListener('window:resize')\r\n onWindowResize() {\r\n this.adjustHeight();\r\n }\r\n\r\n private adjustHeight() {\r\n // const host: HTMLElement = this.el.nativeElement;\r\n const top = this.comp!.nativeElement.getBoundingClientRect().top;\r\n const viewportHeight = window.innerHeight;\r\n const newHeight = viewportHeight - top;\r\n\r\n this.renderer.setStyle(this.comp?.nativeElement, 'height', `${newHeight}px`);\r\n this.renderer.setStyle(this.comp?.nativeElement, 'width', '100%');\r\n\r\n // console.log(host);\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n }\r\n if (this.mutationObserver) {\r\n this.mutationObserver.disconnect();\r\n }\r\n }\r\n}\r\n","<div class=\"stretch-container\" #abc>\r\n <ng-content></ng-content>\r\n</div>","/*\r\n * Public API Surface of flex-ui-controls\r\n */\r\n\r\n// export * from './lib/flex-ui-controls.service';\r\n// export * from './lib/flex-ui-controls.component';\r\nexport * from './lib/flex-panel/flex-panel.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MASa,kBAAkB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,gBAAgB;AAEN,IAAA,IAAI;AAEd,IAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAEpC,IAAA,WAAA,GAAA,EAAgB;IAEh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gBAAgB,CAAC,UAAU,EAAE;QACpC;IACF;uGAtDW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,kBAAkB,qOCT/B,mFAEM,EAAA,MAAA,EAAA,CAAA,8CAAA,CAAA,EAAA,CAAA;;2FDOO,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,WACjB,EAAE,EAAA,QAAA,EAAA,mFAAA,EAAA,MAAA,EAAA,CAAA,8CAAA,CAAA,EAAA;wDASO,IAAI,EAAA,CAAA;sBAArB,SAAS;uBAAC,KAAK;gBA2BhB,cAAc,EAAA,CAAA;sBADb,YAAY;uBAAC,eAAe;;;AEvC/B;;AAEG;AAEH;AACA;;ACLA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"dcsl-flex-ui.mjs","sources":["../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.ts","../../../projects/flex-ui-controls/src/lib/flex-panel/flex-panel.component.html","../../../projects/flex-ui-controls/src/lib/flex-pagination/flex-pagination.component.ts","../../../projects/flex-ui-controls/src/lib/flex-pagination/flex-pagination.component.html","../../../projects/flex-ui-controls/src/lib/flex-grid/flex-grid-column.ts","../../../projects/flex-ui-controls/src/lib/flex-grid/flex-grid-columns.ts","../../../projects/flex-ui-controls/src/lib/flex-grid/flex-grid.component.ts","../../../projects/flex-ui-controls/src/lib/flex-grid/flex-grid.component.html","../../../projects/flex-ui-controls/src/public-api.ts","../../../projects/flex-ui-controls/src/dcsl-flex-ui.ts"],"sourcesContent":["import { Component, ElementRef, HostListener, inject, Renderer2, ViewChild } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-flex-panel',\r\n imports: [],\r\n templateUrl: './flex-panel.component.html',\r\n styleUrl: './flex-panel.component.css'\r\n})\r\n\r\nexport class FlexPanelComponent {\r\n private resizeObserver?: ResizeObserver;\r\n private mutationObserver?: MutationObserver;\r\n\r\n @ViewChild(\"abc\") comp?: ElementRef<HTMLDivElement>;\r\n\r\n private renderer = inject(Renderer2);\r\n\r\n constructor() { }\r\n\r\n ngAfterViewInit() {\r\n this.adjustHeight();\r\n\r\n // ✅ Recalculate on window resize\r\n if ('ResizeObserver' in window) {\r\n this.resizeObserver = new ResizeObserver(() => this.adjustHeight());\r\n this.resizeObserver.observe(document.body);\r\n }\r\n\r\n // ✅ Also observe DOM changes that may shift this element\r\n this.mutationObserver = new MutationObserver(() => this.adjustHeight());\r\n this.mutationObserver.observe(document.body, {\r\n attributes: true,\r\n childList: true,\r\n subtree: true\r\n });\r\n\r\n\r\n }\r\n\r\n @HostListener('window:resize')\r\n onWindowResize() {\r\n this.adjustHeight();\r\n }\r\n\r\n private adjustHeight() {\r\n // const host: HTMLElement = this.el.nativeElement;\r\n const top = this.comp!.nativeElement.getBoundingClientRect().top;\r\n const viewportHeight = window.innerHeight;\r\n const newHeight = viewportHeight - top;\r\n\r\n this.renderer.setStyle(this.comp?.nativeElement, 'height', `${newHeight}px`);\r\n this.renderer.setStyle(this.comp?.nativeElement, 'width', '100%');\r\n\r\n // console.log(host);\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.resizeObserver) {\r\n this.resizeObserver.disconnect();\r\n }\r\n if (this.mutationObserver) {\r\n this.mutationObserver.disconnect();\r\n }\r\n }\r\n}\r\n","<div class=\"stretch-container\" #abc>\r\n <ng-content></ng-content>\r\n</div>","import { CommonModule } from '@angular/common';\r\nimport { Component, Input, Output, EventEmitter, HostListener, OnInit, input, effect } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { FlexPaging } from './flex_page';\r\n\r\n@Component({\r\n selector: 'flex-pagination',\r\n templateUrl: './flex-pagination.component.html',\r\n styleUrls: ['./flex-pagination.component.css'],\r\n imports: [CommonModule, FormsModule]\r\n})\r\nexport class FlexPaginationComponent implements OnInit {\r\n rowCount = input<number>(0);\r\n\r\n protected _totalItems: number = 0;\r\n pageSize = 50;\r\n currentPage = 1;\r\n @Output() pageChange = new EventEmitter<FlexPaging>();\r\n\r\n maxPagesToShow = 5;\r\n pageSizes = [50, 100, 200, 500];\r\n\r\n constructor() {\r\n effect(() => {\r\n this.currentPage = 1;\r\n this._totalItems = this.rowCount();\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.updateMaxPages();\r\n }\r\n\r\n // Update maxPagesToShow based on screen size\r\n @HostListener('window:resize')\r\n updateMaxPages() {\r\n const width = window.innerWidth;\r\n if (width < 576) {\r\n this.maxPagesToShow = 1; // only current page\r\n } else if (width < 768) {\r\n this.maxPagesToShow = 3;\r\n } else {\r\n this.maxPagesToShow = 5;\r\n }\r\n }\r\n\r\n\r\n get totalPages(): number {\r\n return Math.ceil(this._totalItems / this.pageSize) || 1;\r\n }\r\n\r\n get pages(): (number | string)[] {\r\n const total = this.totalPages;\r\n const max = this.maxPagesToShow;\r\n\r\n if (max === 1) {\r\n return [this.currentPage]; // mobile: only current page\r\n }\r\n\r\n const pages: (number | string)[] = [];\r\n\r\n if (total <= max) {\r\n for (let i = 1; i <= total; i++) pages.push(i);\r\n } else {\r\n let start = Math.max(this.currentPage - Math.floor(max / 2), 1);\r\n let end = start + max - 1;\r\n\r\n if (end > total) {\r\n end = total;\r\n start = end - max + 1;\r\n }\r\n\r\n if (start > 1) pages.push(1, '...');\r\n for (let i = start; i <= end; i++) pages.push(i);\r\n if (end < total) pages.push('...', total);\r\n }\r\n\r\n return pages;\r\n }\r\n\r\n changePage(page: number | string) {\r\n if (typeof page !== 'number') return;\r\n if (page < 1) page = 1;\r\n if (page > this.totalPages) page = this.totalPages;\r\n if (page === this.currentPage) return;\r\n\r\n this.currentPage = page;\r\n this.pageChange.emit({\r\n skip: (this.currentPage - 1) * this.pageSize,\r\n take: this.pageSize,\r\n pageSize: this.pageSize,\r\n currentPage: this.currentPage,\r\n });\r\n }\r\n\r\n onPageSizeChange(pageSize: any) {\r\n var value = Number(pageSize.target.value);\r\n if (isNaN(value) || value <= 0) return;\r\n\r\n this.pageSize = value;\r\n this.pageChange.emit({\r\n skip: (this.currentPage - 1) * this.pageSize,\r\n take: this.pageSize,\r\n pageSize: this.pageSize,\r\n currentPage: this.currentPage\r\n });\r\n }\r\n\r\n firstPage() { this.changePage(1); }\r\n lastPage() { this.changePage(this.totalPages); }\r\n prevPage() { this.changePage(this.currentPage - 1); }\r\n nextPage() { this.changePage(this.currentPage + 1); }\r\n}\r\n","<div class=\"d-flex justify-content-start align-items-center\">\r\n <!-- Pagination -->\r\n <div class=\"overflow-auto\">\r\n <ul class=\"pagination justify-content-center flex-nowrap mb-0\">\r\n <!-- First / Prev (hide First on xs) -->\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"firstPage()\"><i class=\"bi bi-chevron-double-left\"></i></button>\r\n </li>\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === 1\">\r\n <button class=\"page-link\" (click)=\"prevPage()\"><i class=\"bi bi-chevron-left\"></i></button>\r\n </li>\r\n\r\n <!-- Page numbers -->\r\n <li class=\"page-item\" *ngFor=\"let page of pages\" [class.active]=\"page === currentPage\"\r\n [class.disabled]=\"page === '...'\">\r\n <button class=\"page-link\" [disabled]=\"page === '...'\" (click)=\"changePage(page)\">\r\n {{ page }}\r\n </button>\r\n </li>\r\n\r\n <!-- Next / Last (hide Last on xs) -->\r\n <li class=\"page-item\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"nextPage()\"><i class=\"bi bi-chevron-right\"></i></button>\r\n </li>\r\n <li class=\"page-item d-none d-sm-block\" [class.disabled]=\"currentPage === totalPages\">\r\n <button class=\"page-link\" (click)=\"lastPage()\"><i class=\"bi bi-chevron-double-right\"></i></button>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <!-- Page Size Dropdown -->\r\n <div class=\"ms-2\">\r\n <label class=\"me-2\">{{ \"page-size\" }}</label>\r\n <select class=\"form-select d-inline-block w-auto\" [(ngModel)]=\"pageSize\" (change)=\"onPageSizeChange($event)\">\r\n <option *ngFor=\"let size of pageSizes\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n </div>\r\n <div class=\"total-count ms-2\">\r\n {{ \"total-count\" }}: {{ _totalItems }}\r\n </div>\r\n</div>","// grid-column.component.ts\r\nimport { Component, ContentChild, TemplateRef, Input, input } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'flex-grid-column',\r\n template: ''\r\n})\r\n\r\nexport class FlexColumnComponent {\r\n headerText = input<string>('');\r\n\r\n @Input() field!: string;\r\n @Input() width: any = 120;\r\n\r\n @ContentChild('headerTemplate') headerTemplate!: TemplateRef<any>;\r\n @ContentChild('cellTemplate') cellTemplate!: TemplateRef<any>;\r\n\r\n\r\n}\r\n","// grid-columns.component.ts\r\nimport { Component, ContentChildren, QueryList } from '@angular/core';\r\nimport { FlexColumnComponent } from './flex-grid-column';\r\n\r\n@Component({\r\n selector: 'flex-grid-columns',\r\n template: ''\r\n})\r\nexport class FlexColumnsComponent {\r\n @ContentChildren(FlexColumnComponent) columns!: QueryList<FlexColumnComponent>;\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { AfterViewInit, Component, ContentChild, effect, ElementRef, Input, input, output, TemplateRef, ViewChild } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport { FlexPaginationComponent } from \"../flex-pagination/flex-pagination.component\";\r\nimport { FlexColumnsComponent } from './flex-grid-columns';\r\nimport { FlexPaging } from '../flex-pagination/flex_page';\r\n\r\n@Component({\r\n selector: 'flex-grid',\r\n imports: [CommonModule, FormsModule, FlexPaginationComponent],\r\n templateUrl: './flex-grid.component.html',\r\n styleUrl: './flex-grid.component.css'\r\n})\r\n\r\nexport class CustomGridComponent implements AfterViewInit {\r\n\r\n\r\n enablePaging = input<boolean>(false);\r\n totalDataCount = input<number>(0);\r\n\r\n tableClass = input<string>('');\r\n\r\n @Input() dataSource: any[] = [];\r\n\r\n // @ContentChildren(GridColumnComponent) columns!: QueryList<GridColumnComponent>;\r\n @ContentChild(FlexColumnsComponent) gridColumns?: FlexColumnsComponent;\r\n\r\n rowClicked = output<{ index: number, data: any }>();\r\n rowDblClicked = output<{ index: number, data: any }>();\r\n\r\n // Optional: custom template when no data\r\n @Input() emptyRecordTemplate?: TemplateRef<any>;\r\n\r\n isPagingEnabled: boolean = false;\r\n\r\n @ViewChild('gridHeader') gridHeader!: ElementRef;\r\n\r\n @ViewChild('gridBody') gridBody!: ElementRef;\r\n\r\n selectedIndex: number = -1;\r\n protected _totalDataCount: number = 0;\r\n protected _tableClass: string = \"\";\r\n\r\n pageChange = output<{ skip: number, take: number }>();\r\n currentPage: number = 1;\r\n pageSize: number = 50;\r\n\r\n constructor() {\r\n effect(() => {\r\n this.isPagingEnabled = this.enablePaging();\r\n });\r\n\r\n effect(() => {\r\n this._totalDataCount = this.totalDataCount();\r\n });\r\n\r\n effect(() => {\r\n this._tableClass = this.tableClass();\r\n });\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.syncColumnWidths();\r\n }\r\n\r\n check() {\r\n console.log(this.gridColumns);\r\n console.log(this.dataSource);\r\n }\r\n\r\n syncScroll(e: Event) {\r\n const body = e.target as HTMLElement;\r\n const header = this.gridHeader?.nativeElement; //document.querySelector('.grid-header');\r\n if (header) (header as HTMLElement).scrollLeft = body.scrollLeft;\r\n }\r\n\r\n syncColumnWidths() {\r\n // const headerCols = this.gridHeader.nativeElement.querySelectorAll('th');\r\n // const bodyCols = this.gridBody.nativeElement.querySelectorAll('tr:first-child td');\r\n\r\n // bodyCols.forEach((td: HTMLElement, i: number) => {\r\n // const width = td.getBoundingClientRect().width;\r\n // (headerCols[i] as HTMLElement).style.width = width + 'px';\r\n // });\r\n }\r\n\r\n // syncColumnWidths() {\r\n // const headerCols = document.querySelectorAll('.grid-header th');\r\n // const bodyCols = this.gridBody.nativeElement.querySelectorAll('tbody tr:first-child td');\r\n\r\n // bodyCols.forEach((col: HTMLElement, i: number) => {\r\n // const width = col.getBoundingClientRect().width;\r\n // (headerCols[i] as HTMLElement).style.width = width + 'px';\r\n // });\r\n // }\r\n\r\n onRowDblClick(index: number, data: any) {\r\n this.selectedIndex = index;\r\n // console.log(index);\r\n\r\n this.rowDblClicked.emit({ index: index, data: data });\r\n }\r\n\r\n onRowClick(index: number, data: any) {\r\n this.selectedIndex = index;\r\n // console.log(index);\r\n\r\n this.rowClicked.emit({ index: index, data: data });\r\n }\r\n\r\n onPageChanged(event: FlexPaging) {\r\n console.log(event);\r\n this.currentPage = event.currentPage;\r\n this.pageSize = event.pageSize;\r\n\r\n this.pageChange.emit(event);\r\n\r\n\r\n }\r\n\r\n}\r\n","<div class=\"grid-container\">\r\n <!-- Header row in its own div -->\r\n <div class=\"grid-scroll\">\r\n <div class=\"grid-container-sub\">\r\n <div class=\"grid-header\" #gridHeader>\r\n <table class=\"grid-table table table-bordered table-sm mb-0 header-table\">\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <thead>\r\n <tr>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <th class=\"text-truncate\">\r\n @if (col.headerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.headerTemplate\"></ng-container>\r\n }\r\n @else {\r\n <!-- <ng-template #defaultHeader><span [textContent]=\"col.field\"></span></ng-template> -->\r\n <!-- <span [textContent]=\"col.field\"></span> -->\r\n {{ col.headerText() }}\r\n }\r\n </th>\r\n }\r\n\r\n <!-- <th style=\"width: 20px;\"></th> -->\r\n </tr>\r\n </thead>\r\n\r\n </table>\r\n </div>\r\n <!-- Scrollable body in another div -->\r\n <div #gridBody class=\"grid-body\" (scroll)=\"syncScroll($event)\">\r\n @if(dataSource.length > 0){\r\n <table class=\"grid-table table table-bordered table-sm table-hover mb-0\" [ngClass]=\"_tableClass\">\r\n\r\n <colgroup>\r\n @for (col of gridColumns?.columns; track $index) {\r\n <col [style.width.px]=\"col.width\" [style.maxWidth.px]=\"col.width\">\r\n }\r\n </colgroup>\r\n <tbody>\r\n @for (row of dataSource; track $index; let i = $index) {\r\n <tr [class.table-active]=\"$index === selectedIndex\" (click)=\"onRowClick($index, row)\"\r\n (dblclick)=\"onRowDblClick($index, row)\">\r\n @for (col of gridColumns?.columns; track $index) {\r\n <td>\r\n @if (col.cellTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"col.cellTemplate\" [ngTemplateOutletContext]=\"{ $implicit: row,\r\n rowIndex: (currentPage - 1) * pageSize + i,\r\n localIndex: i }\">\r\n </ng-container>\r\n } @else {\r\n <!-- {{ row[col.field] }} -->\r\n <span [textContent]=\"row[col.field]\"></span>\r\n }\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @else {\r\n No records found\r\n }\r\n\r\n\r\n </div>\r\n </div>\r\n\r\n </div>\r\n\r\n @if(isPagingEnabled){\r\n <!-- Footer -->\r\n <div class=\"grid-footer\">\r\n <flex-pagination [rowCount]=\"_totalDataCount\" (pageChange)=\"onPageChanged($event)\"></flex-pagination>\r\n </div>\r\n }\r\n\r\n</div>","/*\r\n * Public API Surface of flex-ui-controls\r\n */\r\n\r\nexport * from './lib/flex-panel/flex-panel.component';\r\nexport * from './lib/flex-pagination/flex-pagination.component';\r\nexport * from './lib/flex-grid/flex-grid.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,kBAAkB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,gBAAgB;AAEN,IAAA,IAAI;AAEd,IAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAEpC,IAAA,WAAA,GAAA,E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AA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,WAAW,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,uBAAuB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAKjD,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAP/B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,WACZ,CAAC,YAAY,EAAE,WAAW,EAAE,uBAAuB,CAAC,EAAA,QAAA,EAAA,qsHAAA,EAAA,MAAA,EAAA,CAAA,4zBAAA,CAAA,EAAA;wDAapD,UAAU,EAAA,CAAA;sBAAlB;gBAGmC,WAAW,EAAA,CAAA;sBAA9C,YAAY;uBAAC,oBAAoB;gBAMzB,mBAAmB,EAAA,CAAA;sBAA3B;gBAIwB,UAAU,EAAA,CAAA;sBAAlC,SAAS;uBAAC,YAAY;gBAEA,QAAQ,EAAA,CAAA;sBAA9B,SAAS;uBAAC,UAAU;;;AErCvB;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef } from '@angular/core';
|
|
2
|
+
import { ElementRef, OnInit, EventEmitter, TemplateRef, QueryList, AfterViewInit } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
declare class FlexPanelComponent {
|
|
5
5
|
private resizeObserver?;
|
|
@@ -15,4 +15,89 @@ declare class FlexPanelComponent {
|
|
|
15
15
|
static ɵcmp: i0.ɵɵComponentDeclaration<FlexPanelComponent, "lib-flex-panel", never, {}, {}, never, ["*"], true, never>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
interface FlexPaging {
|
|
19
|
+
skip: number;
|
|
20
|
+
take: number;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
currentPage: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare class FlexPaginationComponent implements OnInit {
|
|
26
|
+
rowCount: i0.InputSignal<number>;
|
|
27
|
+
protected _totalItems: number;
|
|
28
|
+
pageSize: number;
|
|
29
|
+
currentPage: number;
|
|
30
|
+
pageChange: EventEmitter<FlexPaging>;
|
|
31
|
+
maxPagesToShow: number;
|
|
32
|
+
pageSizes: number[];
|
|
33
|
+
constructor();
|
|
34
|
+
ngOnInit(): void;
|
|
35
|
+
updateMaxPages(): void;
|
|
36
|
+
get totalPages(): number;
|
|
37
|
+
get pages(): (number | string)[];
|
|
38
|
+
changePage(page: number | string): void;
|
|
39
|
+
onPageSizeChange(pageSize: any): void;
|
|
40
|
+
firstPage(): void;
|
|
41
|
+
lastPage(): void;
|
|
42
|
+
prevPage(): void;
|
|
43
|
+
nextPage(): void;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlexPaginationComponent, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FlexPaginationComponent, "flex-pagination", never, { "rowCount": { "alias": "rowCount"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; }, never, never, true, never>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare class FlexColumnComponent {
|
|
49
|
+
headerText: i0.InputSignal<string>;
|
|
50
|
+
field: string;
|
|
51
|
+
width: any;
|
|
52
|
+
headerTemplate: TemplateRef<any>;
|
|
53
|
+
cellTemplate: TemplateRef<any>;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlexColumnComponent, never>;
|
|
55
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FlexColumnComponent, "flex-grid-column", never, { "headerText": { "alias": "headerText"; "required": false; "isSignal": true; }; "field": { "alias": "field"; "required": false; }; "width": { "alias": "width"; "required": false; }; }, {}, ["headerTemplate", "cellTemplate"], never, true, never>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class FlexColumnsComponent {
|
|
59
|
+
columns: QueryList<FlexColumnComponent>;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlexColumnsComponent, never>;
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FlexColumnsComponent, "flex-grid-columns", never, {}, {}, ["columns"], never, true, never>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class CustomGridComponent implements AfterViewInit {
|
|
65
|
+
enablePaging: i0.InputSignal<boolean>;
|
|
66
|
+
totalDataCount: i0.InputSignal<number>;
|
|
67
|
+
tableClass: i0.InputSignal<string>;
|
|
68
|
+
dataSource: any[];
|
|
69
|
+
gridColumns?: FlexColumnsComponent;
|
|
70
|
+
rowClicked: i0.OutputEmitterRef<{
|
|
71
|
+
index: number;
|
|
72
|
+
data: any;
|
|
73
|
+
}>;
|
|
74
|
+
rowDblClicked: i0.OutputEmitterRef<{
|
|
75
|
+
index: number;
|
|
76
|
+
data: any;
|
|
77
|
+
}>;
|
|
78
|
+
emptyRecordTemplate?: TemplateRef<any>;
|
|
79
|
+
isPagingEnabled: boolean;
|
|
80
|
+
gridHeader: ElementRef;
|
|
81
|
+
gridBody: ElementRef;
|
|
82
|
+
selectedIndex: number;
|
|
83
|
+
protected _totalDataCount: number;
|
|
84
|
+
protected _tableClass: string;
|
|
85
|
+
pageChange: i0.OutputEmitterRef<{
|
|
86
|
+
skip: number;
|
|
87
|
+
take: number;
|
|
88
|
+
}>;
|
|
89
|
+
currentPage: number;
|
|
90
|
+
pageSize: number;
|
|
91
|
+
constructor();
|
|
92
|
+
ngAfterViewInit(): void;
|
|
93
|
+
check(): void;
|
|
94
|
+
syncScroll(e: Event): void;
|
|
95
|
+
syncColumnWidths(): void;
|
|
96
|
+
onRowDblClick(index: number, data: any): void;
|
|
97
|
+
onRowClick(index: number, data: any): void;
|
|
98
|
+
onPageChanged(event: FlexPaging): void;
|
|
99
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CustomGridComponent, never>;
|
|
100
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CustomGridComponent, "flex-grid", never, { "enablePaging": { "alias": "enablePaging"; "required": false; "isSignal": true; }; "totalDataCount": { "alias": "totalDataCount"; "required": false; "isSignal": true; }; "tableClass": { "alias": "tableClass"; "required": false; "isSignal": true; }; "dataSource": { "alias": "dataSource"; "required": false; }; "emptyRecordTemplate": { "alias": "emptyRecordTemplate"; "required": false; }; }, { "rowClicked": "rowClicked"; "rowDblClicked": "rowDblClicked"; "pageChange": "pageChange"; }, ["gridColumns"], never, true, never>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { CustomGridComponent, FlexPaginationComponent, FlexPanelComponent };
|