@firestitch/list 18.0.79 → 18.0.81
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/app/components/body/body.component.d.ts +7 -0
- package/app/components/body/row/cell/cell.component.d.ts +1 -0
- package/app/components/body/row/row.component.d.ts +3 -0
- package/esm2022/app/components/body/body.component.mjs +13 -3
- package/esm2022/app/components/body/row/cell/cell.component.mjs +28 -6
- package/esm2022/app/components/body/row/row.component.mjs +37 -5
- package/fesm2022/firestitch-list.mjs +74 -10
- package/fesm2022/firestitch-list.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2113,17 +2113,29 @@ class FsCellComponent {
|
|
|
2113
2113
|
cellContext = {};
|
|
2114
2114
|
cellTemplate;
|
|
2115
2115
|
_destroy$ = new Subject();
|
|
2116
|
+
// Torn down and recreated every time the row() wrapper swaps, so the
|
|
2117
|
+
// per-wrapper data$/expanded$ subscriptions below never leak or keep
|
|
2118
|
+
// firing for a wrapper this cell no longer renders.
|
|
2119
|
+
_rowDestroy$ = new Subject();
|
|
2116
2120
|
constructor() {
|
|
2121
|
+
// React whenever the row() input swaps to a new wrapper. With row-level
|
|
2122
|
+
// trackBy (track row.data.id) a reload reuses this DOM cell but points it
|
|
2123
|
+
// at a brand-new Row wrapper holding fresh data, so we must rebuild the
|
|
2124
|
+
// cell context and re-subscribe to the new wrapper's data$ here -> without
|
|
2125
|
+
// this the cell stays frozen on the old wrapper's data (IEB-T117).
|
|
2117
2126
|
effect(() => {
|
|
2118
2127
|
const currentRow = this.row();
|
|
2128
|
+
this._rowDestroy$.next();
|
|
2119
2129
|
if (currentRow) {
|
|
2120
|
-
this.
|
|
2130
|
+
this._initCellTemplate();
|
|
2131
|
+
this._initCellContext();
|
|
2132
|
+
this._listenRowDataChange();
|
|
2133
|
+
this._listenGroupOpen();
|
|
2121
2134
|
}
|
|
2122
2135
|
});
|
|
2123
2136
|
}
|
|
2124
2137
|
ngOnInit() {
|
|
2125
|
-
|
|
2126
|
-
this._listenGroupOpen();
|
|
2138
|
+
// Context/subscriptions are wired reactively from the row() effect above.
|
|
2127
2139
|
}
|
|
2128
2140
|
ngOnChanges(changes) {
|
|
2129
2141
|
if (changes.rowIndex?.currentValue !== changes.rowIndex?.previousValue) {
|
|
@@ -2136,10 +2148,17 @@ class FsCellComponent {
|
|
|
2136
2148
|
}
|
|
2137
2149
|
}
|
|
2138
2150
|
ngOnDestroy() {
|
|
2151
|
+
this._rowDestroy$.next();
|
|
2152
|
+
this._rowDestroy$.complete();
|
|
2139
2153
|
this._destroy$.next(null);
|
|
2140
2154
|
this._destroy$.complete();
|
|
2141
2155
|
}
|
|
2142
2156
|
_initCellContext() {
|
|
2157
|
+
// The row() effect can fire before the column @Input is bound; bail until
|
|
2158
|
+
// it is, ngOnChanges(column) re-runs this once column arrives.
|
|
2159
|
+
if (!this.column) {
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2143
2162
|
const currentRow = this.row();
|
|
2144
2163
|
this.cellContext.index = this.rowIndex;
|
|
2145
2164
|
if (currentRow) {
|
|
@@ -2177,13 +2196,16 @@ class FsCellComponent {
|
|
|
2177
2196
|
const currentRow = this.row();
|
|
2178
2197
|
if (currentRow instanceof BaseRow) {
|
|
2179
2198
|
currentRow.data$
|
|
2180
|
-
.pipe(skip(1), takeUntil(this._destroy$))
|
|
2199
|
+
.pipe(skip(1), takeUntil(this._rowDestroy$), takeUntil(this._destroy$))
|
|
2181
2200
|
.subscribe(() => {
|
|
2182
2201
|
this._initCellContext();
|
|
2183
2202
|
});
|
|
2184
2203
|
}
|
|
2185
2204
|
}
|
|
2186
2205
|
_initCellTemplate() {
|
|
2206
|
+
if (!this.column) {
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2187
2209
|
const currentRow = this.row();
|
|
2188
2210
|
if (currentRow && isGroupRow(currentRow)) {
|
|
2189
2211
|
this.cellTemplate = this.column.groupHeaderTemplate || this.column.cellTemplate;
|
|
@@ -2199,7 +2221,7 @@ class FsCellComponent {
|
|
|
2199
2221
|
const currentRow = this.row();
|
|
2200
2222
|
if (currentRow && isGroupRow(currentRow)) {
|
|
2201
2223
|
currentRow.expanded$
|
|
2202
|
-
.pipe(takeUntil(this._destroy$))
|
|
2224
|
+
.pipe(takeUntil(this._rowDestroy$), takeUntil(this._destroy$))
|
|
2203
2225
|
.subscribe((status) => {
|
|
2204
2226
|
this.cellContext.expanded = status;
|
|
2205
2227
|
});
|
|
@@ -2294,10 +2316,37 @@ class FsRowComponent {
|
|
|
2294
2316
|
});
|
|
2295
2317
|
_eventListeners = [];
|
|
2296
2318
|
_destroy$ = new Subject();
|
|
2319
|
+
// Torn down and recreated every time the row() wrapper swaps so the
|
|
2320
|
+
// per-wrapper data$/selection subscriptions don't keep firing for a wrapper
|
|
2321
|
+
// this DOM row no longer renders.
|
|
2322
|
+
_rowDestroy$ = new Subject();
|
|
2323
|
+
// The wrapper the imperative lifecycle wiring (ngOnInit/ngAfterViewInit)
|
|
2324
|
+
// subscribed to. The row() effect re-wires only when the wrapper differs
|
|
2325
|
+
// from this, so the first effect run (same wrapper) doesn't double-subscribe.
|
|
2326
|
+
_wiredRow;
|
|
2297
2327
|
_el = inject(ElementRef);
|
|
2298
2328
|
_cdRef = inject(ChangeDetectorRef);
|
|
2299
2329
|
_renderer = inject(Renderer2);
|
|
2300
2330
|
_draggableList = inject(FsListDraggableListDirective, { optional: true });
|
|
2331
|
+
constructor() {
|
|
2332
|
+
// With row-level trackBy (track row.data.id) a reload reuses this DOM row
|
|
2333
|
+
// but binds it to a brand-new Row wrapper holding fresh data. Re-wire the
|
|
2334
|
+
// wrapper-scoped subscriptions (actions refresh via data$, selection) so
|
|
2335
|
+
// row actions and selection reflect the new data instead of freezing on
|
|
2336
|
+
// the previous wrapper (IEB-T117).
|
|
2337
|
+
effect(() => {
|
|
2338
|
+
const currentRow = this.row();
|
|
2339
|
+
// Skip until lifecycle has done the first wiring, and skip the run where
|
|
2340
|
+
// the wrapper is the one lifecycle already wired (avoids double-subscribe).
|
|
2341
|
+
if (!currentRow || currentRow === this._wiredRow || !this._wiredRow) {
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
this._rowDestroy$.next();
|
|
2345
|
+
this._wiredRow = currentRow;
|
|
2346
|
+
this._initRowActions();
|
|
2347
|
+
this._initSelection();
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2301
2350
|
get isDragDisabled() {
|
|
2302
2351
|
return !this.selected && this.reorderMultiple && !!this.selection.selectedRows.size;
|
|
2303
2352
|
}
|
|
@@ -2323,6 +2372,9 @@ class FsRowComponent {
|
|
|
2323
2372
|
}
|
|
2324
2373
|
ngAfterViewInit() {
|
|
2325
2374
|
this._initSelection();
|
|
2375
|
+
// Record the wrapper lifecycle just wired; from here the row() effect
|
|
2376
|
+
// re-wires the wrapper-scoped subscriptions whenever the wrapper swaps.
|
|
2377
|
+
this._wiredRow = this.row();
|
|
2326
2378
|
}
|
|
2327
2379
|
updateRowActions() {
|
|
2328
2380
|
this.rowActions
|
|
@@ -2336,6 +2388,8 @@ class FsRowComponent {
|
|
|
2336
2388
|
this._eventListeners.forEach((listener) => {
|
|
2337
2389
|
listener();
|
|
2338
2390
|
});
|
|
2391
|
+
this._rowDestroy$.next();
|
|
2392
|
+
this._rowDestroy$.complete();
|
|
2339
2393
|
this._destroy$.next(null);
|
|
2340
2394
|
this._destroy$.complete();
|
|
2341
2395
|
}
|
|
@@ -2389,7 +2443,7 @@ class FsRowComponent {
|
|
|
2389
2443
|
this._filterActionsByCategories();
|
|
2390
2444
|
}
|
|
2391
2445
|
merge(this.row().data$, this.row().actionsUpdated$)
|
|
2392
|
-
.pipe(takeUntil(this._destroy$))
|
|
2446
|
+
.pipe(takeUntil(this._rowDestroy$), takeUntil(this._destroy$))
|
|
2393
2447
|
.subscribe(() => {
|
|
2394
2448
|
this.updateRowActions();
|
|
2395
2449
|
this._cdRef.markForCheck();
|
|
@@ -2438,7 +2492,7 @@ class FsRowComponent {
|
|
|
2438
2492
|
// return type === SelectionChangeType.AllVisibleSelectionChange
|
|
2439
2493
|
// || type === SelectionChangeType.SelectedAll;
|
|
2440
2494
|
// }),
|
|
2441
|
-
takeUntil(this._destroy$))
|
|
2495
|
+
takeUntil(this._rowDestroy$), takeUntil(this._destroy$))
|
|
2442
2496
|
.subscribe(() => {
|
|
2443
2497
|
const currentRow = this.row();
|
|
2444
2498
|
this.selected = currentRow && this.selection.isRowSelected(currentRow.data);
|
|
@@ -2492,7 +2546,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
|
|
|
2492
2546
|
MatIcon,
|
|
2493
2547
|
AsyncPipe,
|
|
2494
2548
|
], template: "<!-- Drag -->\n@if (leftDragDropEnabled) {\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n}\n<!-- Selection -->\n@if (selection && (selection.enabled$ | async)) {\n <td class=\"fs-list-col fs-list-col-selection\">\n @if (!isGroupFooterRow()) {\n <mat-checkbox\n (change)=\"selectRow($event)\"\n [disabled]=\"!selection.selectable(row(), rowIndex)\"\n [checked]=\"selected\"\n [indeterminate]=\"indeterminateSelected\">\n </mat-checkbox>\n }\n </td>\n}\n<!-- Content -->\n@for (column of columns; track trackByFn($index); let isFirst = $first) {\n @if ((isGroupRow() && !column.groupHeaderColspanned) || (isGroupFooterRow() && !column.groupFooterColspanned) || (!isGroupRow() && !isGroupFooterRow() && !column.cellColspanned)) {\n <td\n fs-cell\n [column]=\"column\"\n [row]=\"row()\"\n [rowIndex]=\"rowIndex\"\n [class]=\"(isGroupRow() && column.groupHeaderConfigs.classesString)\n || (isGroupFooterRow() && column.groupFooterConfigs.classesString)\n || (!isGroupFooterRow() && column.cellConfigs.classesString)\"\n [ngClass]=\"{ 'primary-col': isFirst }\"\n [attr.colspan]=\"(isGroupRow() && column.groupHeaderConfigs.colspan)\n || (isGroupFooterRow() && column.groupFooterConfigs.colspan)\n || column.cellConfigs.colspan\"\n [attr.width]=\"column.width\">\n </td>\n }\n}\n<!-- Drag -->\n@if (rightDragDropEnabled) {\n <ng-container *ngTemplateOutlet=\"dragCell\"></ng-container>\n}\n<!-- Row Actions -->\n@if (hasRowActions && !(reorderEnabled && reorderStrategy === ReorderStrategy.Manual)) {\n <td class=\"fs-list-col actions-col\">\n @if (!isGroupFooterRow()) {\n <fs-list-row-actions\n [row]=\"row()\"\n [index]=\"rowIndex\"\n [rowActions]=\"rowActions\"\n [menuRowActions]=\"menuRowActions\"\n [inlineRowActions]=\"inlineRowActions\"\n [restoreAction]=\"restoreAction\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\">\n </fs-list-row-actions>\n }\n </td>\n}\n<ng-template #dragCell>\n @if (dragCellVisible() && !isGroupFooterRow()) {\n <td\n class=\"fs-list-col drag-col\"\n [class.drag-disabled]=\"isDragDisabled\"\n (mousedown)=\"dragStart($event)\"\n (touchstart)=\"dragStart($event)\">\n <mat-icon>\n drag_handle\n </mat-icon>\n </td>\n } @else {\n <td class=\"fs-list-col drag-col\"></td>\n }\n</ng-template>", styles: [":host.drag-hidden{display:none}:host.draggable{opacity:.8;position:fixed;z-index:9999;box-shadow:2px 2px 2px #9e9e9ea6;border-radius:5px}:host.draggable td{border:none;background-color:#fff}:host.draggable-elem td{background-color:#c3c3c3}:host.fs-list-row-clickable{cursor:pointer}td.drag-col{width:1%!important;white-space:nowrap;text-align:center;cursor:grab}td.drag-col.drag-disabled{opacity:.4;cursor:no-drop}td.drag-col mat-icon{display:flex}td.fs-list-col-selection{padding:10px;width:1%!important}td.actions-col{width:1%;white-space:nowrap;overflow:hidden}td.actions-col .row-inline-action{margin-left:12px;display:inline-block}td.actions-col .row-inline-action:first-child{margin-left:0}td.actions-col .row-inline-action-icon,td.actions-col .row-inline-action-fab,td.actions-col .row-inline-action-mini-fab,td.actions-col .row-menu-action{width:35px;justify-content:center;align-items:center}td.left{text-align:left}td.center{text-align:center}td.right{text-align:right}\n"] }]
|
|
2495
|
-
}], propDecorators: { role: [{
|
|
2549
|
+
}], ctorParameters: () => [], propDecorators: { role: [{
|
|
2496
2550
|
type: HostBinding,
|
|
2497
2551
|
args: ['attr.role']
|
|
2498
2552
|
}], rowActionsRaw: [{
|
|
@@ -2552,15 +2606,25 @@ class FsBodyComponent {
|
|
|
2552
2606
|
reorderMultiple;
|
|
2553
2607
|
rowsContainer;
|
|
2554
2608
|
headerTemplate;
|
|
2609
|
+
/**
|
|
2610
|
+
* Track rows by their underlying record id so that a reload (which creates
|
|
2611
|
+
* fresh Row wrapper objects) reuses the existing DOM instead of destroying
|
|
2612
|
+
* and recreating every row. Falls back to the row index when the data has
|
|
2613
|
+
* no id (e.g. group/footer rows or id-less records) -> avoids NG0956.
|
|
2614
|
+
*/
|
|
2615
|
+
trackByFn(index, row) {
|
|
2616
|
+
const id = row?.data?.id;
|
|
2617
|
+
return id ?? index;
|
|
2618
|
+
}
|
|
2555
2619
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2556
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsBodyComponent, isStandalone: true, selector: "[fs-list-body]", inputs: { rows: "rows", columns: "columns", hasFooter: "hasFooter", rowActionsRaw: "rowActionsRaw", groupActionsRaw: "groupActionsRaw", rowEvents: "rowEvents", rowClass: "rowClass", hasRowActions: "hasRowActions", selection: "selection", restoreMode: "restoreMode", rowRemoved: "rowRemoved", activeFiltersCount: "activeFiltersCount", reorderEnabled: "reorderEnabled", reorderPosition: "reorderPosition", reorderStrategy: "reorderStrategy", reorderMultiple: "reorderMultiple" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: FsRowComponent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "rowsContainer", first: true, predicate: ["rowsContainer"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "@for (row of rows; track row; let i = $index) {\n <tr\n fs-list-row\n fsListDraggableRow\n [row]=\"row\"\n [rowIndex]=\"i\"\n [columns]=\"columns\"\n [rowActionsRaw]=\"rowActionsRaw\"\n [groupActionsRaw]=\"groupActionsRaw\"\n [hasRowActions]=\"hasRowActions\"\n [rowEvents]=\"rowEvents\"\n [rowClass]=\"rowClass\"\n [selection]=\"selection\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n [activeFiltersCount]=\"activeFiltersCount\"\n [reorderEnabled]=\"reorderEnabled\"\n [reorderPosition]=\"reorderPosition\"\n [reorderStrategy]=\"reorderStrategy\"\n [reorderMultiple]=\"reorderMultiple\">\n </tr>\n}", styles: [":host.drag-hidden .drag-col{opacity:0!important;cursor:default}:host.disabled{opacity:.4;pointer-events:none}\n"], dependencies: [{ kind: "component", type: FsRowComponent, selector: "[fs-list-row]", inputs: ["row", "rowActionsRaw", "groupActionsRaw", "hasRowActions", "rowEvents", "rowClass", "restoreMode", "rowIndex", "columns", "selection", "rowRemoved", "activeFiltersCount", "reorderEnabled", "reorderPosition", "reorderStrategy", "reorderMultiple"] }, { kind: "directive", type: FsListDraggableRowDirective, selector: "[fsListDraggableRow]", inputs: ["row"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2620
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: FsBodyComponent, isStandalone: true, selector: "[fs-list-body]", inputs: { rows: "rows", columns: "columns", hasFooter: "hasFooter", rowActionsRaw: "rowActionsRaw", groupActionsRaw: "groupActionsRaw", rowEvents: "rowEvents", rowClass: "rowClass", hasRowActions: "hasRowActions", selection: "selection", restoreMode: "restoreMode", rowRemoved: "rowRemoved", activeFiltersCount: "activeFiltersCount", reorderEnabled: "reorderEnabled", reorderPosition: "reorderPosition", reorderStrategy: "reorderStrategy", reorderMultiple: "reorderMultiple" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: FsRowComponent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "rowsContainer", first: true, predicate: ["rowsContainer"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "@for (row of rows; track trackByFn(i, row); let i = $index) {\n <tr\n fs-list-row\n fsListDraggableRow\n [row]=\"row\"\n [rowIndex]=\"i\"\n [columns]=\"columns\"\n [rowActionsRaw]=\"rowActionsRaw\"\n [groupActionsRaw]=\"groupActionsRaw\"\n [hasRowActions]=\"hasRowActions\"\n [rowEvents]=\"rowEvents\"\n [rowClass]=\"rowClass\"\n [selection]=\"selection\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n [activeFiltersCount]=\"activeFiltersCount\"\n [reorderEnabled]=\"reorderEnabled\"\n [reorderPosition]=\"reorderPosition\"\n [reorderStrategy]=\"reorderStrategy\"\n [reorderMultiple]=\"reorderMultiple\">\n </tr>\n}", styles: [":host.drag-hidden .drag-col{opacity:0!important;cursor:default}:host.disabled{opacity:.4;pointer-events:none}\n"], dependencies: [{ kind: "component", type: FsRowComponent, selector: "[fs-list-row]", inputs: ["row", "rowActionsRaw", "groupActionsRaw", "hasRowActions", "rowEvents", "rowClass", "restoreMode", "rowIndex", "columns", "selection", "rowRemoved", "activeFiltersCount", "reorderEnabled", "reorderPosition", "reorderStrategy", "reorderMultiple"] }, { kind: "directive", type: FsListDraggableRowDirective, selector: "[fsListDraggableRow]", inputs: ["row"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2557
2621
|
}
|
|
2558
2622
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: FsBodyComponent, decorators: [{
|
|
2559
2623
|
type: Component,
|
|
2560
2624
|
args: [{ selector: '[fs-list-body]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
2561
2625
|
FsRowComponent,
|
|
2562
2626
|
FsListDraggableRowDirective,
|
|
2563
|
-
], template: "@for (row of rows; track row; let i = $index) {\n <tr\n fs-list-row\n fsListDraggableRow\n [row]=\"row\"\n [rowIndex]=\"i\"\n [columns]=\"columns\"\n [rowActionsRaw]=\"rowActionsRaw\"\n [groupActionsRaw]=\"groupActionsRaw\"\n [hasRowActions]=\"hasRowActions\"\n [rowEvents]=\"rowEvents\"\n [rowClass]=\"rowClass\"\n [selection]=\"selection\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n [activeFiltersCount]=\"activeFiltersCount\"\n [reorderEnabled]=\"reorderEnabled\"\n [reorderPosition]=\"reorderPosition\"\n [reorderStrategy]=\"reorderStrategy\"\n [reorderMultiple]=\"reorderMultiple\">\n </tr>\n}", styles: [":host.drag-hidden .drag-col{opacity:0!important;cursor:default}:host.disabled{opacity:.4;pointer-events:none}\n"] }]
|
|
2627
|
+
], template: "@for (row of rows; track trackByFn(i, row); let i = $index) {\n <tr\n fs-list-row\n fsListDraggableRow\n [row]=\"row\"\n [rowIndex]=\"i\"\n [columns]=\"columns\"\n [rowActionsRaw]=\"rowActionsRaw\"\n [groupActionsRaw]=\"groupActionsRaw\"\n [hasRowActions]=\"hasRowActions\"\n [rowEvents]=\"rowEvents\"\n [rowClass]=\"rowClass\"\n [selection]=\"selection\"\n [restoreMode]=\"restoreMode\"\n [rowRemoved]=\"rowRemoved\"\n [activeFiltersCount]=\"activeFiltersCount\"\n [reorderEnabled]=\"reorderEnabled\"\n [reorderPosition]=\"reorderPosition\"\n [reorderStrategy]=\"reorderStrategy\"\n [reorderMultiple]=\"reorderMultiple\">\n </tr>\n}", styles: [":host.drag-hidden .drag-col{opacity:0!important;cursor:default}:host.disabled{opacity:.4;pointer-events:none}\n"] }]
|
|
2564
2628
|
}], propDecorators: { rows: [{
|
|
2565
2629
|
type: Input
|
|
2566
2630
|
}], columns: [{
|