@alaarab/ogrid-angular-material 2.0.19 → 2.0.22
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/dist/esm/column-chooser/column-chooser.component.js +1 -1
- package/dist/esm/column-header-filter/column-header-filter.component.js +1 -19
- package/dist/esm/datagrid-table/datagrid-table.component.js +29 -88
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +5 -107
- package/dist/esm/datagrid-table/popover-cell-editor.component.js +5 -96
- package/dist/esm/index.js +3 -1
- package/dist/types/datagrid-table/datagrid-table.component.d.ts +0 -12
- package/dist/types/datagrid-table/popover-cell-editor.component.d.ts +2 -20
- package/package.json +2 -2
|
@@ -75,7 +75,7 @@ ColumnChooserComponent = __decorate([
|
|
|
75
75
|
.ogrid-column-chooser__trigger:hover { background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04)); }
|
|
76
76
|
.ogrid-column-chooser__caret { font-size: 10px; }
|
|
77
77
|
.ogrid-column-chooser__dropdown {
|
|
78
|
-
position: absolute; top: 100%; right: 0; z-index:
|
|
78
|
+
position: absolute; top: 100%; right: 0; z-index: 1000;
|
|
79
79
|
min-width: 220px; margin-top: 4px;
|
|
80
80
|
background: var(--ogrid-bg, #ffffff); border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12)); border-radius: 4px;
|
|
81
81
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
@@ -35,24 +35,6 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
37
|
<div class="ogrid-header-filter__actions">
|
|
38
|
-
@if (onSort) {
|
|
39
|
-
<button
|
|
40
|
-
class="ogrid-header-filter__btn"
|
|
41
|
-
[class.ogrid-header-filter__btn--active]="isSorted"
|
|
42
|
-
(click)="onSort!()"
|
|
43
|
-
[attr.aria-label]="'Sort by ' + columnName"
|
|
44
|
-
[title]="isSorted ? (isSortedDescending ? 'Sorted descending' : 'Sorted ascending') : 'Sort'"
|
|
45
|
-
>
|
|
46
|
-
@if (isSorted && isSortedDescending) {
|
|
47
|
-
▼
|
|
48
|
-
} @else if (isSorted) {
|
|
49
|
-
▲
|
|
50
|
-
} @else {
|
|
51
|
-
↕
|
|
52
|
-
}
|
|
53
|
-
</button>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
38
|
@if (filterType !== 'none') {
|
|
57
39
|
<button
|
|
58
40
|
class="ogrid-header-filter__filter-btn"
|
|
@@ -268,7 +250,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
268
250
|
background: var(--mat-sys-primary, #1976d2);
|
|
269
251
|
}
|
|
270
252
|
.ogrid-header-filter__popover {
|
|
271
|
-
position: fixed; z-index:
|
|
253
|
+
position: fixed; z-index: 1000;
|
|
272
254
|
background: var(--ogrid-bg, #ffffff); border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.2));
|
|
273
255
|
border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.1);
|
|
274
256
|
margin-top: 4px; color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ViewChild, signal } from '@angular/core';
|
|
8
|
-
import { BaseDataGridTableComponent, DataGridStateService, MarchingAntsOverlayComponent, StatusBarComponent, GridContextMenuComponent, EmptyStateComponent, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, } from '@alaarab/ogrid-angular';
|
|
8
|
+
import { BaseDataGridTableComponent, DataGridStateService, MarchingAntsOverlayComponent, StatusBarComponent, GridContextMenuComponent, EmptyStateComponent, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, OGRID_THEME_VARS_CSS, } from '@alaarab/ogrid-angular';
|
|
9
9
|
import { ColumnHeaderFilterComponent } from '../column-header-filter/column-header-filter.component';
|
|
10
10
|
import { ColumnHeaderMenuComponent } from '../column-header-menu/column-header-menu.component';
|
|
11
11
|
import { InlineCellEditorComponent } from './inline-cell-editor.component';
|
|
@@ -32,20 +32,6 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
32
32
|
getTableContainerRef() {
|
|
33
33
|
return this.tableContainerRef;
|
|
34
34
|
}
|
|
35
|
-
/** Build column header menu handlers for a given column */
|
|
36
|
-
getColumnMenuHandlers(columnId) {
|
|
37
|
-
return {
|
|
38
|
-
onPinLeft: () => this.onPinColumn(columnId, 'left'),
|
|
39
|
-
onPinRight: () => this.onPinColumn(columnId, 'right'),
|
|
40
|
-
onUnpin: () => this.onUnpinColumn(columnId),
|
|
41
|
-
onSortAsc: () => this.onSortAsc(columnId),
|
|
42
|
-
onSortDesc: () => this.onSortDesc(columnId),
|
|
43
|
-
onClearSort: () => this.onClearSort(columnId),
|
|
44
|
-
onAutosizeThis: () => this.onAutosizeColumn(columnId),
|
|
45
|
-
onAutosizeAll: () => this.onAutosizeAllColumns(),
|
|
46
|
-
onClose: () => { }
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
35
|
};
|
|
50
36
|
__decorate([
|
|
51
37
|
Input({ required: true, alias: 'props' })
|
|
@@ -72,6 +58,7 @@ DataGridTableComponent = __decorate([
|
|
|
72
58
|
[class.ogrid-datagrid-wrapper--fit]="layoutModeFit()"
|
|
73
59
|
[class.ogrid-datagrid-wrapper--overflow-x]="allowOverflowX()"
|
|
74
60
|
[class.ogrid-datagrid-wrapper--loading-empty]="isLoading() && items().length === 0"
|
|
61
|
+
[style.--ogrid-row-height]="rowHeightCssVar()"
|
|
75
62
|
tabindex="0"
|
|
76
63
|
role="region"
|
|
77
64
|
[attr.aria-label]="ariaLabel()"
|
|
@@ -114,7 +101,7 @@ DataGridTableComponent = __decorate([
|
|
|
114
101
|
@if (rowIdx === 0 && rowIdx < headerRows().length - 1 && hasRowNumbersCol()) {
|
|
115
102
|
<th [attr.rowSpan]="headerRows().length - 1" class="ogrid-datagrid-th" [style.width.px]="50" [style.min-width.px]="50" style="padding: 0;"></th>
|
|
116
103
|
}
|
|
117
|
-
@for (cell of row; track $index; let cellIdx = $index) {
|
|
104
|
+
@for (cell of row; track cell.columnDef?.columnId ?? $index; let cellIdx = $index) {
|
|
118
105
|
@if (cell.isGroup) {
|
|
119
106
|
<th [attr.colSpan]="cell.colSpan" scope="colgroup" class="ogrid-datagrid-th ogrid-datagrid-group-header">
|
|
120
107
|
{{ cell.label }}
|
|
@@ -127,6 +114,7 @@ DataGridTableComponent = __decorate([
|
|
|
127
114
|
@let pinnedRight = pinned === 'right';
|
|
128
115
|
@let sortState = getSortState(col.columnId);
|
|
129
116
|
@let ariaSort = sortState === 'asc' ? 'ascending' : sortState === 'desc' ? 'descending' : null;
|
|
117
|
+
@let config = getFilterConfig(col);
|
|
130
118
|
<th scope="col"
|
|
131
119
|
class="ogrid-datagrid-th"
|
|
132
120
|
[class.ogrid-datagrid-th--pinned-left]="pinnedLeft"
|
|
@@ -146,24 +134,23 @@ DataGridTableComponent = __decorate([
|
|
|
146
134
|
<ogrid-column-header-filter
|
|
147
135
|
[columnKey]="col.columnId"
|
|
148
136
|
[columnName]="col.name"
|
|
149
|
-
[filterType]="
|
|
150
|
-
[isSorted]="
|
|
151
|
-
[isSortedDescending]="
|
|
152
|
-
[onSort]="
|
|
153
|
-
[selectedValues]="
|
|
154
|
-
[onFilterChange]="
|
|
155
|
-
[options]="
|
|
156
|
-
[isLoadingOptions]="
|
|
157
|
-
[textValue]="
|
|
158
|
-
[onTextChange]="
|
|
159
|
-
[selectedUser]="
|
|
160
|
-
[onUserChange]="
|
|
161
|
-
[peopleSearch]="
|
|
162
|
-
[dateValue]="
|
|
163
|
-
[onDateChange]="
|
|
137
|
+
[filterType]="config.filterType"
|
|
138
|
+
[isSorted]="config.isSorted"
|
|
139
|
+
[isSortedDescending]="config.isSortedDescending"
|
|
140
|
+
[onSort]="config.onSort"
|
|
141
|
+
[selectedValues]="config.selectedValues"
|
|
142
|
+
[onFilterChange]="config.onFilterChange"
|
|
143
|
+
[options]="config.options"
|
|
144
|
+
[isLoadingOptions]="config.isLoadingOptions ?? false"
|
|
145
|
+
[textValue]="config.textValue ?? ''"
|
|
146
|
+
[onTextChange]="config.onTextChange"
|
|
147
|
+
[selectedUser]="config.selectedUser"
|
|
148
|
+
[onUserChange]="config.onUserChange"
|
|
149
|
+
[peopleSearch]="config.peopleSearch"
|
|
150
|
+
[dateValue]="config.dateValue"
|
|
151
|
+
[onDateChange]="config.onDateChange"
|
|
164
152
|
/>
|
|
165
153
|
@let pinState = getPinState(col.columnId);
|
|
166
|
-
@let sortState = getSortState(col.columnId);
|
|
167
154
|
<column-header-menu
|
|
168
155
|
[columnId]="col.columnId"
|
|
169
156
|
[canPinLeft]="pinState.canPinLeft"
|
|
@@ -172,7 +159,7 @@ DataGridTableComponent = __decorate([
|
|
|
172
159
|
[currentSort]="sortState"
|
|
173
160
|
[isSortable]="col.sortable !== false"
|
|
174
161
|
[isResizable]="col.resizable !== false"
|
|
175
|
-
[handlers]="
|
|
162
|
+
[handlers]="getColumnMenuHandlersMemoized(col.columnId)"
|
|
176
163
|
/>
|
|
177
164
|
</div>
|
|
178
165
|
<div class="ogrid-datagrid-resize-handle" (mousedown)="onResizeStart($event, col)"></div>
|
|
@@ -357,14 +344,15 @@ DataGridTableComponent = __decorate([
|
|
|
357
344
|
}
|
|
358
345
|
</div>
|
|
359
346
|
|
|
360
|
-
@
|
|
347
|
+
@let sbConfig = statusBarConfig();
|
|
348
|
+
@if (sbConfig) {
|
|
361
349
|
<ogrid-status-bar
|
|
362
|
-
[totalCount]="
|
|
363
|
-
[filteredCount]="
|
|
364
|
-
[selectedCount]="
|
|
350
|
+
[totalCount]="sbConfig.totalCount"
|
|
351
|
+
[filteredCount]="sbConfig.filteredCount"
|
|
352
|
+
[selectedCount]="sbConfig.selectedCount ?? selectedRowIds().size"
|
|
365
353
|
[selectedCellCount]="selectionCellCount()"
|
|
366
|
-
[aggregation]="
|
|
367
|
-
[suppressRowCount]="
|
|
354
|
+
[aggregation]="sbConfig.aggregation"
|
|
355
|
+
[suppressRowCount]="sbConfig.suppressRowCount"
|
|
368
356
|
/>
|
|
369
357
|
}
|
|
370
358
|
|
|
@@ -378,55 +366,7 @@ DataGridTableComponent = __decorate([
|
|
|
378
366
|
}
|
|
379
367
|
</div>
|
|
380
368
|
`,
|
|
381
|
-
styles: [`
|
|
382
|
-
/* ─── OGrid Theme Variables ─── */
|
|
383
|
-
:root {
|
|
384
|
-
--ogrid-bg: #ffffff;
|
|
385
|
-
--ogrid-fg: rgba(0, 0, 0, 0.87);
|
|
386
|
-
--ogrid-fg-secondary: rgba(0, 0, 0, 0.6);
|
|
387
|
-
--ogrid-fg-muted: rgba(0, 0, 0, 0.5);
|
|
388
|
-
--ogrid-border: rgba(0, 0, 0, 0.12);
|
|
389
|
-
--ogrid-header-bg: rgba(0, 0, 0, 0.04);
|
|
390
|
-
--ogrid-hover-bg: rgba(0, 0, 0, 0.04);
|
|
391
|
-
--ogrid-selected-row-bg: #e6f0fb;
|
|
392
|
-
--ogrid-active-cell-bg: rgba(0, 0, 0, 0.02);
|
|
393
|
-
--ogrid-range-bg: rgba(33, 115, 70, 0.12);
|
|
394
|
-
--ogrid-accent: #0078d4;
|
|
395
|
-
--ogrid-selection-color: #217346;
|
|
396
|
-
--ogrid-loading-overlay: rgba(255, 255, 255, 0.7);
|
|
397
|
-
}
|
|
398
|
-
@media (prefers-color-scheme: dark) {
|
|
399
|
-
:root:not([data-theme="light"]) {
|
|
400
|
-
--ogrid-bg: #1e1e1e;
|
|
401
|
-
--ogrid-fg: rgba(255, 255, 255, 0.87);
|
|
402
|
-
--ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
|
|
403
|
-
--ogrid-fg-muted: rgba(255, 255, 255, 0.5);
|
|
404
|
-
--ogrid-border: rgba(255, 255, 255, 0.12);
|
|
405
|
-
--ogrid-header-bg: rgba(255, 255, 255, 0.06);
|
|
406
|
-
--ogrid-hover-bg: rgba(255, 255, 255, 0.08);
|
|
407
|
-
--ogrid-selected-row-bg: #1a3a5c;
|
|
408
|
-
--ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
|
|
409
|
-
--ogrid-range-bg: rgba(46, 160, 67, 0.15);
|
|
410
|
-
--ogrid-accent: #4da6ff;
|
|
411
|
-
--ogrid-selection-color: #2ea043;
|
|
412
|
-
--ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
[data-theme="dark"] {
|
|
416
|
-
--ogrid-bg: #1e1e1e;
|
|
417
|
-
--ogrid-fg: rgba(255, 255, 255, 0.87);
|
|
418
|
-
--ogrid-fg-secondary: rgba(255, 255, 255, 0.6);
|
|
419
|
-
--ogrid-fg-muted: rgba(255, 255, 255, 0.5);
|
|
420
|
-
--ogrid-border: rgba(255, 255, 255, 0.12);
|
|
421
|
-
--ogrid-header-bg: rgba(255, 255, 255, 0.06);
|
|
422
|
-
--ogrid-hover-bg: rgba(255, 255, 255, 0.08);
|
|
423
|
-
--ogrid-selected-row-bg: #1a3a5c;
|
|
424
|
-
--ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);
|
|
425
|
-
--ogrid-range-bg: rgba(46, 160, 67, 0.15);
|
|
426
|
-
--ogrid-accent: #4da6ff;
|
|
427
|
-
--ogrid-selection-color: #2ea043;
|
|
428
|
-
--ogrid-loading-overlay: rgba(0, 0, 0, 0.7);
|
|
429
|
-
}
|
|
369
|
+
styles: [OGRID_THEME_VARS_CSS, `
|
|
430
370
|
:host { display: block; }
|
|
431
371
|
.ogrid-datagrid-root { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
432
372
|
.ogrid-datagrid-wrapper {
|
|
@@ -444,6 +384,7 @@ DataGridTableComponent = __decorate([
|
|
|
444
384
|
.ogrid-datagrid-table {
|
|
445
385
|
width: 100%; border-collapse: collapse; table-layout: fixed;
|
|
446
386
|
}
|
|
387
|
+
.ogrid-datagrid-table tbody tr { height: var(--ogrid-row-height, auto); }
|
|
447
388
|
.ogrid-datagrid-thead {
|
|
448
389
|
z-index: 8; background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04));
|
|
449
390
|
}
|
|
@@ -4,119 +4,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Component } from '@angular/core';
|
|
8
|
-
import {
|
|
9
|
-
import { BaseInlineCellEditorComponent } from '@alaarab/ogrid-angular';
|
|
7
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
8
|
+
import { BaseInlineCellEditorComponent, INLINE_CELL_EDITOR_TEMPLATE, INLINE_CELL_EDITOR_STYLES } from '@alaarab/ogrid-angular';
|
|
10
9
|
let InlineCellEditorComponent = class InlineCellEditorComponent extends BaseInlineCellEditorComponent {
|
|
11
10
|
};
|
|
12
11
|
InlineCellEditorComponent = __decorate([
|
|
13
12
|
Component({
|
|
14
13
|
selector: 'ogrid-mat-inline-cell-editor',
|
|
15
14
|
standalone: true,
|
|
16
|
-
|
|
17
|
-
template:
|
|
18
|
-
|
|
19
|
-
@case ('text') {
|
|
20
|
-
<input
|
|
21
|
-
#inputEl
|
|
22
|
-
type="text"
|
|
23
|
-
[value]="localValue()"
|
|
24
|
-
(input)="localValue.set($any($event.target).value)"
|
|
25
|
-
(keydown)="onTextKeyDown($event)"
|
|
26
|
-
(blur)="onTextBlur()"
|
|
27
|
-
[style]="getInputStyle()"
|
|
28
|
-
/>
|
|
29
|
-
}
|
|
30
|
-
@case ('richSelect') {
|
|
31
|
-
<div #richSelectWrapper
|
|
32
|
-
style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative">
|
|
33
|
-
<input
|
|
34
|
-
#richSelectInput
|
|
35
|
-
type="text"
|
|
36
|
-
[value]="searchText()"
|
|
37
|
-
(input)="onRichSelectSearch($any($event.target).value)"
|
|
38
|
-
(keydown)="onRichSelectKeyDown($event)"
|
|
39
|
-
placeholder="Search..."
|
|
40
|
-
style="width:100%;padding:0;border:none;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none;min-width:0"
|
|
41
|
-
/>
|
|
42
|
-
<div #richSelectDropdown role="listbox"
|
|
43
|
-
style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2)">
|
|
44
|
-
@for (opt of filteredOptions(); track opt; let i = $index) {
|
|
45
|
-
<div role="option"
|
|
46
|
-
[attr.aria-selected]="i === highlightedIndex()"
|
|
47
|
-
(click)="commitValue(opt)"
|
|
48
|
-
[style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
|
|
49
|
-
{{ getDisplayText(opt) }}
|
|
50
|
-
</div>
|
|
51
|
-
}
|
|
52
|
-
@if (filteredOptions().length === 0) {
|
|
53
|
-
<div style="padding:6px 8px;color:var(--ogrid-muted, #999)">No matches</div>
|
|
54
|
-
}
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
}
|
|
58
|
-
@case ('select') {
|
|
59
|
-
<div #selectWrapper tabindex="0"
|
|
60
|
-
style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative"
|
|
61
|
-
(keydown)="onCustomSelectKeyDown($event)">
|
|
62
|
-
<div style="display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit">
|
|
63
|
-
<span>{{ getDisplayText(value) }}</span>
|
|
64
|
-
<span style="margin-left:4px;font-size:10px;opacity:0.5">▾</span>
|
|
65
|
-
</div>
|
|
66
|
-
<div #selectDropdown role="listbox"
|
|
67
|
-
style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2)">
|
|
68
|
-
@for (opt of selectOptions(); track opt; let i = $index) {
|
|
69
|
-
<div role="option"
|
|
70
|
-
[attr.aria-selected]="i === highlightedIndex()"
|
|
71
|
-
(click)="commitValue(opt)"
|
|
72
|
-
[style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
|
|
73
|
-
{{ getDisplayText(opt) }}
|
|
74
|
-
</div>
|
|
75
|
-
}
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
}
|
|
79
|
-
@case ('checkbox') {
|
|
80
|
-
<div style="display:flex;align-items:center;justify-content:center;width:100%;height:100%">
|
|
81
|
-
<input
|
|
82
|
-
type="checkbox"
|
|
83
|
-
[checked]="!!localValue()"
|
|
84
|
-
(change)="commitValue($any($event.target).checked)"
|
|
85
|
-
(keydown)="onCheckboxKeyDown($event)"
|
|
86
|
-
/>
|
|
87
|
-
</div>
|
|
88
|
-
}
|
|
89
|
-
@case ('date') {
|
|
90
|
-
<input
|
|
91
|
-
#inputEl
|
|
92
|
-
type="date"
|
|
93
|
-
[value]="localValue()"
|
|
94
|
-
(change)="commitValue($any($event.target).value)"
|
|
95
|
-
(keydown)="onTextKeyDown($event)"
|
|
96
|
-
(blur)="onTextBlur()"
|
|
97
|
-
[style]="getInputStyle()"
|
|
98
|
-
/>
|
|
99
|
-
}
|
|
100
|
-
@default {
|
|
101
|
-
<input
|
|
102
|
-
#inputEl
|
|
103
|
-
type="text"
|
|
104
|
-
[value]="localValue()"
|
|
105
|
-
(input)="localValue.set($any($event.target).value)"
|
|
106
|
-
(keydown)="onTextKeyDown($event)"
|
|
107
|
-
(blur)="onTextBlur()"
|
|
108
|
-
[style]="getInputStyle()"
|
|
109
|
-
/>
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
`,
|
|
113
|
-
styles: [`
|
|
114
|
-
:host {
|
|
115
|
-
display: block;
|
|
116
|
-
width: 100%;
|
|
117
|
-
height: 100%;
|
|
118
|
-
}
|
|
119
|
-
`],
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
template: INLINE_CELL_EDITOR_TEMPLATE,
|
|
17
|
+
styles: [INLINE_CELL_EDITOR_STYLES],
|
|
120
18
|
})
|
|
121
19
|
], InlineCellEditorComponent);
|
|
122
20
|
export { InlineCellEditorComponent };
|
|
@@ -4,98 +4,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Component, ChangeDetectionStrategy
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Renders custom popover editor when anchor element is set.
|
|
11
|
-
*/
|
|
12
|
-
let PopoverCellEditorComponent = class PopoverCellEditorComponent {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.injector = inject(Injector);
|
|
15
|
-
this.envInjector = inject(EnvironmentInjector);
|
|
16
|
-
this.showEditor = signal(false);
|
|
17
|
-
// Show editor after anchor is rendered
|
|
18
|
-
effect(() => {
|
|
19
|
-
const anchor = this.anchorRef;
|
|
20
|
-
if (anchor) {
|
|
21
|
-
setTimeout(() => this.showEditor.set(true), 0);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
// Render custom editor component when container is available
|
|
25
|
-
effect(() => {
|
|
26
|
-
const container = this.editorContainerRef;
|
|
27
|
-
const props = this.editorProps;
|
|
28
|
-
const col = this.column;
|
|
29
|
-
if (!container || !this.showEditor() || typeof col.cellEditor !== 'function')
|
|
30
|
-
return;
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
const EditorComponent = col.cellEditor; // ComponentType
|
|
33
|
-
const componentRef = createComponent(EditorComponent, {
|
|
34
|
-
environmentInjector: this.envInjector,
|
|
35
|
-
elementInjector: this.injector,
|
|
36
|
-
});
|
|
37
|
-
// Pass props to component instance
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
Object.assign(componentRef.instance, props);
|
|
40
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
41
|
-
// Append to DOM
|
|
42
|
-
container.nativeElement.appendChild(componentRef.location.nativeElement);
|
|
43
|
-
// Cleanup on destroy
|
|
44
|
-
return () => componentRef.destroy();
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
handleOverlayClick() {
|
|
48
|
-
this.onCancel();
|
|
49
|
-
}
|
|
7
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
8
|
+
import { BasePopoverCellEditorComponent, POPOVER_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES } from '@alaarab/ogrid-angular';
|
|
9
|
+
let PopoverCellEditorComponent = class PopoverCellEditorComponent extends BasePopoverCellEditorComponent {
|
|
50
10
|
};
|
|
51
|
-
__decorate([
|
|
52
|
-
Input({ required: true })
|
|
53
|
-
], PopoverCellEditorComponent.prototype, "item", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
Input({ required: true })
|
|
56
|
-
], PopoverCellEditorComponent.prototype, "column", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
Input({ required: true })
|
|
59
|
-
], PopoverCellEditorComponent.prototype, "rowIndex", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
Input({ required: true })
|
|
62
|
-
], PopoverCellEditorComponent.prototype, "globalColIndex", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
Input({ required: true })
|
|
65
|
-
], PopoverCellEditorComponent.prototype, "displayValue", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
Input({ required: true })
|
|
68
|
-
], PopoverCellEditorComponent.prototype, "editorProps", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
Input({ required: true })
|
|
71
|
-
], PopoverCellEditorComponent.prototype, "onCancel", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
ViewChild('anchorEl')
|
|
74
|
-
], PopoverCellEditorComponent.prototype, "anchorRef", void 0);
|
|
75
|
-
__decorate([
|
|
76
|
-
ViewChild('editorContainer')
|
|
77
|
-
], PopoverCellEditorComponent.prototype, "editorContainerRef", void 0);
|
|
78
11
|
PopoverCellEditorComponent = __decorate([
|
|
79
12
|
Component({
|
|
80
13
|
selector: 'ogrid-mat-popover-cell-editor',
|
|
81
14
|
standalone: true,
|
|
82
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
83
|
-
template:
|
|
84
|
-
<div #anchorEl
|
|
85
|
-
class="ogrid-popover-anchor"
|
|
86
|
-
[attr.data-row-index]="rowIndex"
|
|
87
|
-
[attr.data-col-index]="globalColIndex"
|
|
88
|
-
>
|
|
89
|
-
{{ displayValue }}
|
|
90
|
-
</div>
|
|
91
|
-
@if (showEditor()) {
|
|
92
|
-
<div class="ogrid-popover-editor-overlay" (click)="handleOverlayClick()">
|
|
93
|
-
<div class="ogrid-popover-editor-content" #editorContainer></div>
|
|
94
|
-
</div>
|
|
95
|
-
}
|
|
96
|
-
`,
|
|
16
|
+
template: POPOVER_CELL_EDITOR_TEMPLATE,
|
|
97
17
|
styles: [`
|
|
98
|
-
|
|
18
|
+
${POPOVER_CELL_EDITOR_OVERLAY_STYLES}
|
|
99
19
|
.ogrid-popover-anchor {
|
|
100
20
|
width: 100%; height: 100%; display: flex; align-items: center; min-width: 0;
|
|
101
21
|
padding: 6px 10px; box-sizing: border-box; overflow: hidden;
|
|
@@ -103,17 +23,6 @@ PopoverCellEditorComponent = __decorate([
|
|
|
103
23
|
outline: 2px solid var(--ogrid-selection, #217346); outline-offset: -1px;
|
|
104
24
|
z-index: 2; position: relative;
|
|
105
25
|
}
|
|
106
|
-
.ogrid-popover-editor-overlay {
|
|
107
|
-
position: fixed; inset: 0; z-index: 1000;
|
|
108
|
-
background: rgba(0,0,0,0.3);
|
|
109
|
-
display: flex; align-items: center; justify-content: center;
|
|
110
|
-
}
|
|
111
|
-
.ogrid-popover-editor-content {
|
|
112
|
-
background: var(--ogrid-bg, #ffffff); border-radius: 4px; padding: 16px;
|
|
113
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
114
|
-
max-width: 90vw; max-height: 90vh; overflow: auto;
|
|
115
|
-
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
116
|
-
}
|
|
117
26
|
`],
|
|
118
27
|
})
|
|
119
28
|
], PopoverCellEditorComponent);
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// Re-export
|
|
1
|
+
// Re-export all from base package for consumer convenience.
|
|
2
|
+
// Note: This prevents tree-shaking of unused utilities.
|
|
3
|
+
// Consider explicit named exports in a future major version.
|
|
2
4
|
export * from '@alaarab/ogrid-angular';
|
|
3
5
|
// Components
|
|
4
6
|
export { OGridComponent } from './ogrid/ogrid.component';
|
|
@@ -14,16 +14,4 @@ export declare class DataGridTableComponent<T> extends BaseDataGridTableComponen
|
|
|
14
14
|
protected getProps(): IOGridDataGridProps<T> | undefined;
|
|
15
15
|
protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
|
|
16
16
|
protected getTableContainerRef(): ElementRef<HTMLElement> | undefined;
|
|
17
|
-
/** Build column header menu handlers for a given column */
|
|
18
|
-
protected getColumnMenuHandlers(columnId: string): {
|
|
19
|
-
onPinLeft: () => void;
|
|
20
|
-
onPinRight: () => void;
|
|
21
|
-
onUnpin: () => void;
|
|
22
|
-
onSortAsc: () => void;
|
|
23
|
-
onSortDesc: () => void;
|
|
24
|
-
onClearSort: () => void;
|
|
25
|
-
onAutosizeThis: () => void;
|
|
26
|
-
onAutosizeAll: () => void;
|
|
27
|
-
onClose: () => void;
|
|
28
|
-
};
|
|
29
17
|
}
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* PopoverCellEditor component for Angular Material.
|
|
4
|
-
* Renders custom popover editor when anchor element is set.
|
|
5
|
-
*/
|
|
6
|
-
export declare class PopoverCellEditorComponent<T> {
|
|
7
|
-
item: T;
|
|
8
|
-
column: IColumnDef<T>;
|
|
9
|
-
rowIndex: number;
|
|
10
|
-
globalColIndex: number;
|
|
11
|
-
displayValue: unknown;
|
|
12
|
-
editorProps: ICellEditorProps<T>;
|
|
13
|
-
onCancel: () => void;
|
|
14
|
-
private anchorRef?;
|
|
15
|
-
private editorContainerRef?;
|
|
16
|
-
private readonly injector;
|
|
17
|
-
private readonly envInjector;
|
|
18
|
-
protected readonly showEditor: import("@angular/core").WritableSignal<boolean>;
|
|
19
|
-
constructor();
|
|
20
|
-
protected handleOverlayClick(): void;
|
|
1
|
+
import { BasePopoverCellEditorComponent } from '@alaarab/ogrid-angular';
|
|
2
|
+
export declare class PopoverCellEditorComponent<T = unknown> extends BasePopoverCellEditorComponent<T> {
|
|
21
3
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-angular-material",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "OGrid Angular Material – MatTable-based data grid with sorting, filtering, pagination, column chooser, and CSV export.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@alaarab/ogrid-angular": "2.0.
|
|
40
|
+
"@alaarab/ogrid-angular": "2.0.22"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@angular/cdk": "^21.0.0",
|