@alaarab/ogrid-angular-material 2.3.0 → 2.4.1
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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, OGRID_THEME_VARS_CSS, CHECKBOX_COLUMN_WIDTH,
|
|
1
|
+
import { INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, OGRID_THEME_VARS_CSS, CHECKBOX_COLUMN_WIDTH, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, FormulaRefOverlayComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, BaseColumnHeaderMenuComponent, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, formatCellReference, indexToColumnLetter, ROW_NUMBER_COLUMN_ID, BaseColumnChooserComponent, BasePaginationControlsComponent, BaseOGridComponent } from '@alaarab/ogrid-angular';
|
|
2
2
|
export { AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, BaseColumnChooserComponent, BaseColumnHeaderFilterComponent, BaseDataGridTableComponent, BaseInlineCellEditorComponent, BaseOGridComponent, BasePaginationControlsComponent, BasePopoverCellEditorComponent, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, ColumnReorderService, DEFAULT_DEBOUNCE_MS, DEFAULT_MIN_COLUMN_WIDTH, DataGridEditingHelper, DataGridInteractionHelper, DataGridLayoutHelper, DataGridStateService, EmptyStateComponent, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GridContextMenuComponent, INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, MAX_PAGE_BUTTONS, MarchingAntsOverlayComponent, OGRID_THEME_VARS_CSS, OGridLayoutComponent, OGridService, PAGE_SIZE_OPTIONS, PEOPLE_SEARCH_DEBOUNCE_MS, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, ROW_NUMBER_COLUMN_WIDTH, SIDEBAR_TRANSITION_MS, SideBarComponent, StatusBarComponent, UndoRedoStack, VirtualScrollService, Z_INDEX, applyCellDeletion, applyCutClear, applyFillValues, applyPastedValues, applyRangeRowSelection, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps, buildPopoverEditorProps, calculateDropTarget, clampSelectionToBounds, computeAggregations, computeArrowNavigation, computeAutoScrollSpeed, computeNextSortState, computeRowSelectionState, computeTabNavigation, computeTotalHeight, computeVisibleRange, createDebouncedCallback, createDebouncedSignal, createLatestCallback, currencyParser, dateParser, debounce, deriveFilterOptionsFromData, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellRenderDescriptor, getCellValue, getColumnHeaderMenuItems, getContextMenuHandlers, getDataGridStatusBarConfig, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getPinStateForColumn, getScrollTopForRow, getStatusBarParts, injectGlobalStyles, isFilterConfig, isInSelectionRange, isRowInRange, measureColumnContentWidth, measureRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, processClientSideData, rangesEqual, reorderColumnArray, resolveCellDisplayContent, resolveCellStyle, toUserLike, triggerCsvDownload, validateColumns, validateRowIds } from '@alaarab/ogrid-angular';
|
|
3
3
|
import { ViewChild, Component, ChangeDetectionStrategy, Input, ViewEncapsulation, signal, computed, effect } from '@angular/core';
|
|
4
4
|
import { MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
|
|
@@ -329,88 +329,8 @@ ColumnHeaderFilterComponent = __decorateClass([
|
|
|
329
329
|
}
|
|
330
330
|
})
|
|
331
331
|
], ColumnHeaderFilterComponent);
|
|
332
|
-
var ColumnHeaderMenuComponent = class {
|
|
333
|
-
constructor() {
|
|
334
|
-
// Signal-backed inputs so computed() tracks changes reactively
|
|
335
|
-
this._canPinLeft = signal(true);
|
|
336
|
-
this._canPinRight = signal(true);
|
|
337
|
-
this._canUnpin = signal(false);
|
|
338
|
-
this._currentSort = signal(null);
|
|
339
|
-
this._isSortable = signal(true);
|
|
340
|
-
this._isResizable = signal(true);
|
|
341
|
-
this.handlers = {};
|
|
342
|
-
this.menuItems = computed(
|
|
343
|
-
() => getColumnHeaderMenuItems({
|
|
344
|
-
canPinLeft: this._canPinLeft(),
|
|
345
|
-
canPinRight: this._canPinRight(),
|
|
346
|
-
canUnpin: this._canUnpin(),
|
|
347
|
-
currentSort: this._currentSort(),
|
|
348
|
-
isSortable: this._isSortable(),
|
|
349
|
-
isResizable: this._isResizable()
|
|
350
|
-
})
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
set canPinLeft(v) {
|
|
354
|
-
this._canPinLeft.set(v);
|
|
355
|
-
}
|
|
356
|
-
set canPinRight(v) {
|
|
357
|
-
this._canPinRight.set(v);
|
|
358
|
-
}
|
|
359
|
-
set canUnpin(v) {
|
|
360
|
-
this._canUnpin.set(v);
|
|
361
|
-
}
|
|
362
|
-
set currentSort(v) {
|
|
363
|
-
this._currentSort.set(v);
|
|
364
|
-
}
|
|
365
|
-
set isSortable(v) {
|
|
366
|
-
this._isSortable.set(v);
|
|
367
|
-
}
|
|
368
|
-
set isResizable(v) {
|
|
369
|
-
this._isResizable.set(v);
|
|
370
|
-
}
|
|
371
|
-
handleMenuItemClick(itemId) {
|
|
372
|
-
const h = this.handlers;
|
|
373
|
-
const actionMap = {
|
|
374
|
-
pinLeft: h.onPinLeft,
|
|
375
|
-
pinRight: h.onPinRight,
|
|
376
|
-
unpin: h.onUnpin,
|
|
377
|
-
sortAsc: h.onSortAsc,
|
|
378
|
-
sortDesc: h.onSortDesc,
|
|
379
|
-
clearSort: h.onClearSort,
|
|
380
|
-
autosizeThis: h.onAutosizeThis,
|
|
381
|
-
autosizeAll: h.onAutosizeAll
|
|
382
|
-
};
|
|
383
|
-
const action = actionMap[itemId];
|
|
384
|
-
if (action) {
|
|
385
|
-
action();
|
|
386
|
-
h.onClose?.();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
332
|
+
var ColumnHeaderMenuComponent = class extends BaseColumnHeaderMenuComponent {
|
|
389
333
|
};
|
|
390
|
-
__decorateClass([
|
|
391
|
-
Input({ required: true })
|
|
392
|
-
], ColumnHeaderMenuComponent.prototype, "columnId", 2);
|
|
393
|
-
__decorateClass([
|
|
394
|
-
Input()
|
|
395
|
-
], ColumnHeaderMenuComponent.prototype, "canPinLeft", 1);
|
|
396
|
-
__decorateClass([
|
|
397
|
-
Input()
|
|
398
|
-
], ColumnHeaderMenuComponent.prototype, "canPinRight", 1);
|
|
399
|
-
__decorateClass([
|
|
400
|
-
Input()
|
|
401
|
-
], ColumnHeaderMenuComponent.prototype, "canUnpin", 1);
|
|
402
|
-
__decorateClass([
|
|
403
|
-
Input()
|
|
404
|
-
], ColumnHeaderMenuComponent.prototype, "currentSort", 1);
|
|
405
|
-
__decorateClass([
|
|
406
|
-
Input()
|
|
407
|
-
], ColumnHeaderMenuComponent.prototype, "isSortable", 1);
|
|
408
|
-
__decorateClass([
|
|
409
|
-
Input()
|
|
410
|
-
], ColumnHeaderMenuComponent.prototype, "isResizable", 1);
|
|
411
|
-
__decorateClass([
|
|
412
|
-
Input()
|
|
413
|
-
], ColumnHeaderMenuComponent.prototype, "handlers", 2);
|
|
414
334
|
__decorateClass([
|
|
415
335
|
ViewChild(MatMenuTrigger)
|
|
416
336
|
], ColumnHeaderMenuComponent.prototype, "menuTrigger", 2);
|
|
@@ -507,6 +427,7 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
|
|
|
507
427
|
super();
|
|
508
428
|
this.propsSignal = signal(void 0);
|
|
509
429
|
this.showColumnLetters = computed(() => !!this.getProps()?.showColumnLetters);
|
|
430
|
+
this.formulaReferences = computed(() => this.getProps()?.formulaReferences);
|
|
510
431
|
this.initBase();
|
|
511
432
|
effect(() => {
|
|
512
433
|
const props = this.getProps();
|
|
@@ -537,6 +458,10 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
|
|
|
537
458
|
getColumnLetter(colIdx) {
|
|
538
459
|
return indexToColumnLetter(colIdx);
|
|
539
460
|
}
|
|
461
|
+
onResizeRowNumber(event) {
|
|
462
|
+
event.stopPropagation();
|
|
463
|
+
this.onResizeStart(event, { columnId: ROW_NUMBER_COLUMN_ID, name: "#" });
|
|
464
|
+
}
|
|
540
465
|
};
|
|
541
466
|
__decorateClass([
|
|
542
467
|
Input({ required: true, alias: "props" })
|
|
@@ -553,7 +478,7 @@ DataGridTableComponent = __decorateClass([
|
|
|
553
478
|
standalone: true,
|
|
554
479
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
555
480
|
encapsulation: ViewEncapsulation.None,
|
|
556
|
-
imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
|
|
481
|
+
imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, FormulaRefOverlayComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
|
|
557
482
|
providers: [DataGridStateService, ColumnReorderService, VirtualScrollService],
|
|
558
483
|
template: `
|
|
559
484
|
<div class="ogrid-datagrid-root">
|
|
@@ -615,12 +540,17 @@ DataGridTableComponent = __decorateClass([
|
|
|
615
540
|
<th [attr.rowSpan]="headerRows().length - 1" class="ogrid-datagrid-th" style="width: 48px; min-width: 48px; padding: 0;"></th>
|
|
616
541
|
}
|
|
617
542
|
@if (rowIdx === headerRows().length - 1 && hasRowNumbersCol()) {
|
|
618
|
-
<th class="ogrid-datagrid-th ogrid-row-number-header" [attr.rowSpan]="headerRows().length > 1 ? 1 : null"
|
|
543
|
+
<th class="ogrid-datagrid-th ogrid-row-number-header" [attr.rowSpan]="headerRows().length > 1 ? 1 : null"
|
|
544
|
+
[style.width.px]="getRowNumberWidth()"
|
|
545
|
+
[style.min-width.px]="getRowNumberWidth()"
|
|
546
|
+
[style.max-width.px]="getRowNumberWidth()"
|
|
547
|
+
>
|
|
619
548
|
<div class="ogrid-row-number-header-content">#</div>
|
|
549
|
+
<div class="ogrid-datagrid-resize-handle" (mousedown)="onResizeRowNumber($event)" (dblclick)="$event.stopPropagation()"></div>
|
|
620
550
|
</th>
|
|
621
551
|
}
|
|
622
552
|
@if (rowIdx === 0 && rowIdx < headerRows().length - 1 && hasRowNumbersCol()) {
|
|
623
|
-
<th [attr.rowSpan]="headerRows().length - 1" class="ogrid-datagrid-th" [style.width.px]="
|
|
553
|
+
<th [attr.rowSpan]="headerRows().length - 1" class="ogrid-datagrid-th" [style.width.px]="getRowNumberWidth()" [style.min-width.px]="getRowNumberWidth()" style="padding: 0;"></th>
|
|
624
554
|
}
|
|
625
555
|
@for (cell of row; track cell.columnDef?.columnId ?? $index; let cellIdx = $index) {
|
|
626
556
|
@if (cell.isGroup) {
|
|
@@ -724,7 +654,11 @@ DataGridTableComponent = __decorateClass([
|
|
|
724
654
|
</td>
|
|
725
655
|
}
|
|
726
656
|
@if (hasRowNumbersCol()) {
|
|
727
|
-
<td class="ogrid-datagrid-td ogrid-row-number-cell"
|
|
657
|
+
<td class="ogrid-datagrid-td ogrid-row-number-cell"
|
|
658
|
+
[style.width.px]="getRowNumberWidth()"
|
|
659
|
+
[style.min-width.px]="getRowNumberWidth()"
|
|
660
|
+
[style.max-width.px]="getRowNumberWidth()"
|
|
661
|
+
>
|
|
728
662
|
<div class="ogrid-row-number-cell-content">
|
|
729
663
|
{{ rowNumberOffset() + rowIndex + 1 }}
|
|
730
664
|
</div>
|
|
@@ -792,7 +726,11 @@ DataGridTableComponent = __decorateClass([
|
|
|
792
726
|
[attr.role]="descriptor.canEditAny ? 'button' : null"
|
|
793
727
|
[style]="cellStyle ?? undefined"
|
|
794
728
|
>
|
|
795
|
-
|
|
729
|
+
@if (colLayout.col.type === 'boolean') {
|
|
730
|
+
<input type="checkbox" [checked]="!!descriptor.displayValue" disabled style="margin:0;pointer-events:none" [attr.aria-label]="descriptor.displayValue ? 'True' : 'False'" />
|
|
731
|
+
} @else {
|
|
732
|
+
{{ content }}
|
|
733
|
+
}
|
|
796
734
|
@if (descriptor.canEditAny && descriptor.isSelectionEndCell) {
|
|
797
735
|
<div
|
|
798
736
|
class="ogrid-datagrid-fill-handle"
|
|
@@ -828,6 +766,14 @@ DataGridTableComponent = __decorateClass([
|
|
|
828
766
|
[columnOrder]="propsColumnOrder()"
|
|
829
767
|
></ogrid-marching-ants-overlay>
|
|
830
768
|
|
|
769
|
+
@if (formulaReferences() && formulaReferences()!.length > 0) {
|
|
770
|
+
<ogrid-formula-ref-overlay
|
|
771
|
+
[containerEl]="tableContainerEl()"
|
|
772
|
+
[references]="formulaReferences()!"
|
|
773
|
+
[colOffset]="colOffset()"
|
|
774
|
+
/>
|
|
775
|
+
}
|
|
776
|
+
|
|
831
777
|
@if (showEmptyInGrid() && emptyState()) {
|
|
832
778
|
<div class="ogrid-datagrid-empty">
|
|
833
779
|
<div class="ogrid-datagrid-empty__title">No results found</div>
|
|
@@ -948,8 +894,7 @@ DataGridTableComponent = __decorateClass([
|
|
|
948
894
|
}
|
|
949
895
|
.ogrid-datagrid-checkbox-wrapper { display: flex; align-items: center; justify-content: center; }
|
|
950
896
|
.ogrid-row-number-header, .ogrid-row-number-cell {
|
|
951
|
-
|
|
952
|
-
max-width: ${ROW_NUMBER_COLUMN_WIDTH}px; text-align: center;
|
|
897
|
+
text-align: center;
|
|
953
898
|
background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); font-weight: 600;
|
|
954
899
|
font-variant-numeric: tabular-nums; color: var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6));
|
|
955
900
|
position: sticky; left: 0; z-index: 3;
|
|
@@ -1337,8 +1282,13 @@ OGridComponent = __decorateClass([
|
|
|
1337
1282
|
[hasToolbarBelow]="false"
|
|
1338
1283
|
[hasPagination]="true"
|
|
1339
1284
|
[fullScreen]="ogridService.fullScreen()"
|
|
1340
|
-
[showNameBox]="!!ogridService.cellReferences()"
|
|
1285
|
+
[showNameBox]="!!(ogridService.cellReferences() && !ogridService.formulasEnabled())"
|
|
1341
1286
|
[activeCellRef]="ogridService.activeCellRef()"
|
|
1287
|
+
[formulaBar]="ogridService.formulasEnabled() ? ogridService.formulaBarState() : null"
|
|
1288
|
+
[sheetDefs]="ogridService.sheetDefs()"
|
|
1289
|
+
[activeSheet]="ogridService.activeSheet()"
|
|
1290
|
+
[onSheetChange]="ogridService.onSheetChange()"
|
|
1291
|
+
[onSheetAdd]="ogridService.onSheetAdd()"
|
|
1342
1292
|
>
|
|
1343
1293
|
<ng-container toolbarEnd>
|
|
1344
1294
|
@if (ogridService.columnChooserPlacement() === 'toolbar') {
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import { MatMenuTrigger } from '@angular/material/menu';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
* Column header dropdown menu for pin/unpin, sort, and autosize actions.
|
|
5
|
-
* Uses Angular Material MatMenu.
|
|
6
|
-
*
|
|
7
|
-
* Uses signal-backed @Input setters so that computed() tracks changes
|
|
8
|
-
* (plain @Input properties are not reactive in Angular signals).
|
|
9
|
-
*/
|
|
10
|
-
export declare class ColumnHeaderMenuComponent {
|
|
11
|
-
columnId: string;
|
|
12
|
-
private readonly _canPinLeft;
|
|
13
|
-
private readonly _canPinRight;
|
|
14
|
-
private readonly _canUnpin;
|
|
15
|
-
private readonly _currentSort;
|
|
16
|
-
private readonly _isSortable;
|
|
17
|
-
private readonly _isResizable;
|
|
18
|
-
set canPinLeft(v: boolean);
|
|
19
|
-
set canPinRight(v: boolean);
|
|
20
|
-
set canUnpin(v: boolean);
|
|
21
|
-
set currentSort(v: 'asc' | 'desc' | null);
|
|
22
|
-
set isSortable(v: boolean);
|
|
23
|
-
set isResizable(v: boolean);
|
|
24
|
-
handlers: Partial<ColumnHeaderMenuHandlers>;
|
|
2
|
+
import { BaseColumnHeaderMenuComponent } from '@alaarab/ogrid-angular';
|
|
3
|
+
export declare class ColumnHeaderMenuComponent extends BaseColumnHeaderMenuComponent {
|
|
25
4
|
menuTrigger?: MatMenuTrigger;
|
|
26
|
-
readonly menuItems: import("@angular/core").Signal<IColumnHeaderMenuItem[]>;
|
|
27
|
-
handleMenuItemClick(itemId: string): void;
|
|
28
5
|
}
|
|
@@ -11,9 +11,11 @@ export declare class DataGridTableComponent<T> extends BaseDataGridTableComponen
|
|
|
11
11
|
private wrapperRef?;
|
|
12
12
|
private tableContainerRef?;
|
|
13
13
|
readonly showColumnLetters: import("@angular/core").Signal<boolean>;
|
|
14
|
+
readonly formulaReferences: import("@angular/core").Signal<import("@alaarab/ogrid-core").FormulaReference[] | undefined>;
|
|
14
15
|
constructor();
|
|
15
16
|
protected getProps(): IOGridDataGridProps<T> | undefined;
|
|
16
17
|
protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
|
|
17
18
|
protected getTableContainerRef(): ElementRef<HTMLElement> | undefined;
|
|
18
19
|
getColumnLetter(colIdx: number): string;
|
|
20
|
+
onResizeRowNumber(event: MouseEvent): void;
|
|
19
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-angular-material",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
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.
|
|
40
|
+
"@alaarab/ogrid-angular": "2.4.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@angular/cdk": "^21.0.0",
|