@quadrel-enterprise-ui/framework 18.25.5 → 18.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/index.mjs +74 -0
- package/esm2022/lib/core/services/push-events.service.mjs +7 -1
- package/esm2022/lib/table/__mocks__/mock-secondary-actions.service.mjs +26 -0
- package/esm2022/lib/table/model/table-data-resolver.mjs +1 -1
- package/esm2022/lib/table/services/resolver.service.mjs +18 -5
- package/esm2022/lib/table/store/table-store-selector.service.mjs +27 -6
- package/esm2022/lib/table/store/table-store.service.mjs +9 -3
- package/esm2022/lib/table/store/table-update.helper.mjs +1 -3
- package/esm2022/lib/table/store/table.actions.mjs +1 -1
- package/esm2022/lib/table/store/table.reducer.mjs +13 -3
- package/esm2022/lib/table/table.component.mjs +31 -25
- package/fesm2022/quadrel-enterprise-ui-framework.mjs +98 -38
- package/fesm2022/quadrel-enterprise-ui-framework.mjs.map +1 -1
- package/lib/table/__mocks__/mock-secondary-actions.service.d.ts +13 -0
- package/lib/table/model/table-data-resolver.d.ts +2 -2
- package/lib/table/services/resolver.service.d.ts +2 -1
- package/lib/table/store/table-store-selector.service.d.ts +2 -2
- package/lib/table/store/table-store.service.d.ts +1 -1
- package/lib/table/store/table.actions.d.ts +2 -0
- package/lib/table/table.component.d.ts +21 -18
- package/package.json +1 -1
|
@@ -8265,6 +8265,12 @@ class QdPushEventsService {
|
|
|
8265
8265
|
if (!this._eventSource || this._eventSource.readyState === EventSource.CLOSED || reconnect)
|
|
8266
8266
|
this._eventSource = new EventSourcePolyfill(url, options);
|
|
8267
8267
|
this._eventSource.onerror = (err) => {
|
|
8268
|
+
const status = err?.status || err?.target?.status;
|
|
8269
|
+
if (status === 401) {
|
|
8270
|
+
this.logError('SSE connection unauthorized (401):', err);
|
|
8271
|
+
this._eventSource.close();
|
|
8272
|
+
return;
|
|
8273
|
+
}
|
|
8268
8274
|
if (this._eventSource.readyState === EventSource.CLOSED)
|
|
8269
8275
|
this.reconnect();
|
|
8270
8276
|
this.logError('SSE connection error:', err);
|
|
@@ -20198,7 +20204,19 @@ class QdTableStoreSelectorService {
|
|
|
20198
20204
|
return createSelector(this.selectTables, tables => this.getTable(tables));
|
|
20199
20205
|
}
|
|
20200
20206
|
tableDataEntries() {
|
|
20201
|
-
return createSelector(this.selectTables, tables =>
|
|
20207
|
+
return createSelector(this.selectTables, tables => {
|
|
20208
|
+
const table = this.getTable(tables);
|
|
20209
|
+
if (!table || !table.data)
|
|
20210
|
+
return [];
|
|
20211
|
+
const { data, pageIndex, pageSize, hasPagination, hasResolver } = table;
|
|
20212
|
+
if (hasResolver || !hasPagination)
|
|
20213
|
+
return data;
|
|
20214
|
+
if (pageIndex === undefined || pageSize === undefined)
|
|
20215
|
+
return [];
|
|
20216
|
+
const start = pageIndex * pageSize;
|
|
20217
|
+
const end = start + pageSize;
|
|
20218
|
+
return data.slice(start, end);
|
|
20219
|
+
});
|
|
20202
20220
|
}
|
|
20203
20221
|
tableRow(rowIndex) {
|
|
20204
20222
|
return createSelector(this.selectTables, tables => this.getTable(tables)?.data[rowIndex]);
|
|
@@ -20277,18 +20295,27 @@ class QdTableStoreSelectorService {
|
|
|
20277
20295
|
});
|
|
20278
20296
|
}
|
|
20279
20297
|
selectDataResolutionCriteria() {
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20298
|
+
return createSelector(this.selectTables, (tables) => {
|
|
20299
|
+
const table = this.getTable(tables);
|
|
20300
|
+
if (!table)
|
|
20301
|
+
return undefined;
|
|
20302
|
+
const { connectors, connectorCriteria, pageIndex, pageSize, sort } = table;
|
|
20283
20303
|
const connectorsState = connectors?.some(c => c.connectorState === QdTableConnectorState.AWAITING)
|
|
20284
20304
|
? QdTableConnectorState.AWAITING
|
|
20285
20305
|
: connectors
|
|
20286
20306
|
? QdTableConnectorState.ESTABLISHED
|
|
20287
20307
|
: QdTableConnectorState.NONE;
|
|
20308
|
+
const tableParams = table.hasPagination === false
|
|
20309
|
+
? { sort: sort ?? [] }
|
|
20310
|
+
: pageIndex !== undefined && pageSize !== undefined
|
|
20311
|
+
? { page: pageIndex, size: pageSize, sort: sort ?? [] }
|
|
20312
|
+
: undefined;
|
|
20313
|
+
if (!tableParams)
|
|
20314
|
+
return undefined;
|
|
20288
20315
|
return {
|
|
20289
20316
|
hasConnectors: (connectors?.length ?? 0) > 0,
|
|
20290
20317
|
connectorsState,
|
|
20291
|
-
tableParams
|
|
20318
|
+
tableParams,
|
|
20292
20319
|
connectorParams: connectorCriteria ? { ...connectorCriteria } : undefined
|
|
20293
20320
|
};
|
|
20294
20321
|
});
|
|
@@ -20320,8 +20347,14 @@ class QdTableStoreService {
|
|
|
20320
20347
|
/**
|
|
20321
20348
|
* Actions
|
|
20322
20349
|
*/
|
|
20323
|
-
initTableState(data, hasResolver, connectors) {
|
|
20324
|
-
this.store.dispatch(QdTableActions.initTableState({
|
|
20350
|
+
initTableState(data, hasResolver, connectors, hasPagination = false) {
|
|
20351
|
+
this.store.dispatch(QdTableActions.initTableState({
|
|
20352
|
+
tableId: this.tableId,
|
|
20353
|
+
data,
|
|
20354
|
+
hasResolver,
|
|
20355
|
+
connectors,
|
|
20356
|
+
hasPagination
|
|
20357
|
+
}));
|
|
20325
20358
|
}
|
|
20326
20359
|
initTableStateSelectedRows(selectedRows) {
|
|
20327
20360
|
this.store.dispatch(QdTableActions.initTableStateSelectedRows({ tableId: this.tableId, selectedRows: [...selectedRows] }));
|
|
@@ -20616,6 +20649,7 @@ class QdTableResolverService {
|
|
|
20616
20649
|
actionResultService;
|
|
20617
20650
|
_destroyed$ = new Subject();
|
|
20618
20651
|
_refreshSubscription;
|
|
20652
|
+
_hasPagination = true;
|
|
20619
20653
|
constructor(tableDataResolver, tableStoreService, translateService, actionResultService) {
|
|
20620
20654
|
this.tableDataResolver = tableDataResolver;
|
|
20621
20655
|
this.tableStoreService = tableStoreService;
|
|
@@ -20626,15 +20660,25 @@ class QdTableResolverService {
|
|
|
20626
20660
|
ngOnDestroy() {
|
|
20627
20661
|
this._destroyed$.complete();
|
|
20628
20662
|
}
|
|
20629
|
-
init(refreshOnLanguageChange) {
|
|
20663
|
+
init(refreshOnLanguageChange, hasPagination = true) {
|
|
20630
20664
|
if (!this.tableDataResolver)
|
|
20631
20665
|
return;
|
|
20666
|
+
this._hasPagination = hasPagination;
|
|
20632
20667
|
if (refreshOnLanguageChange)
|
|
20633
20668
|
this.subscribeToLangChanges();
|
|
20634
20669
|
// TODO: Add Error handling
|
|
20635
20670
|
this.tableStoreService
|
|
20636
20671
|
.selectDataResolutionCriteria$()
|
|
20637
|
-
.pipe(takeUntil(this._destroyed$), distinctUntilChanged(isEqual$1), filter(
|
|
20672
|
+
.pipe(takeUntil(this._destroyed$), distinctUntilChanged(isEqual$1), filter((resolutionCriteria) => {
|
|
20673
|
+
return !!resolutionCriteria && this.shouldDataBeResolved(resolutionCriteria);
|
|
20674
|
+
}), map(({ tableParams, connectorParams }) => {
|
|
20675
|
+
return {
|
|
20676
|
+
...(this._hasPagination ? tableParams : {}),
|
|
20677
|
+
...connectorParams
|
|
20678
|
+
};
|
|
20679
|
+
}), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.PENDING)), switchMap(resolutionParams => this.tableDataResolver.resolve(resolutionParams)), tap(({ data, size, page, totalElements }) => {
|
|
20680
|
+
this.tableStoreService.setPage(page ?? 0, size, totalElements, data);
|
|
20681
|
+
}), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.SUCCESS)))
|
|
20638
20682
|
.subscribe();
|
|
20639
20683
|
}
|
|
20640
20684
|
refresh(resolverOptions = {}) {
|
|
@@ -20648,7 +20692,7 @@ class QdTableResolverService {
|
|
|
20648
20692
|
.pipe(first(), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.PENDING)), switchMap(resolutionCriteria => this.tableDataResolver.resolve({
|
|
20649
20693
|
...resolutionCriteria.tableParams,
|
|
20650
20694
|
...resolutionCriteria.connectorParams,
|
|
20651
|
-
...(pageIndex !== undefined ? { page: pageIndex } : {})
|
|
20695
|
+
...(this._hasPagination && pageIndex !== undefined ? { page: pageIndex } : {})
|
|
20652
20696
|
})), tap(({ page, data, size, totalElements }) => this.tableStoreService.setPage(page, size, totalElements, data)), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.SUCCESS)))
|
|
20653
20697
|
.subscribe();
|
|
20654
20698
|
}
|
|
@@ -20658,7 +20702,9 @@ class QdTableResolverService {
|
|
|
20658
20702
|
shouldDataBeResolved({ hasConnectors, connectorsState, tableParams }) {
|
|
20659
20703
|
if (hasConnectors && connectorsState === QdTableConnectorState.AWAITING)
|
|
20660
20704
|
return false;
|
|
20661
|
-
|
|
20705
|
+
if (!this._hasPagination)
|
|
20706
|
+
return true;
|
|
20707
|
+
return tableParams?.size !== undefined && tableParams?.page !== undefined;
|
|
20662
20708
|
}
|
|
20663
20709
|
subscribeToExternalRefresh() {
|
|
20664
20710
|
this.actionResultService.actionSuccess$
|
|
@@ -21710,7 +21756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
21710
21756
|
* #### **Features**
|
|
21711
21757
|
* - **RWD Ready**: Automatically adapts to various screen sizes.
|
|
21712
21758
|
* - **Custom Columns**: Define content types like text, date, chip, or icon.
|
|
21713
|
-
* - **Pagination & Sorting**: Supports data pagination and column sorting.
|
|
21759
|
+
* - **Pagination & Sorting**: Supports data pagination and column sorting. Pagination is optional.
|
|
21714
21760
|
* - **Row Selections**: Single or multiple row selection.
|
|
21715
21761
|
* - **Actions**: Primary and secondary row actions with refresh support.
|
|
21716
21762
|
* - **Internationalization (i18ns)**: Localize column headers and specific content types (e.g., text, chip).
|
|
@@ -21743,11 +21789,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
21743
21789
|
*
|
|
21744
21790
|
* Load data dynamically, manage pagination, and enable column sorting using Quadrel's interface and injection token.
|
|
21745
21791
|
*
|
|
21792
|
+
* Pagination is optional. If not configured, the full dataset is handled client-side.
|
|
21793
|
+
*
|
|
21746
21794
|
* ```typescript
|
|
21747
21795
|
* @Injectable()
|
|
21748
21796
|
* export class MyTableResolver implements QdTableDataResolver<ColumnDefinition> {
|
|
21749
|
-
* resolve(criteria: QdTableDataResolverProps<ColumnDefinition>): Observable<QdTableResolvedData<ColumnDefinition
|
|
21750
|
-
*
|
|
21797
|
+
* resolve(criteria: QdTableDataResolverProps<ColumnDefinition>): Observable<QdTableResolvedData<ColumnDefinition>> {
|
|
21798
|
+
* // custom implementation here
|
|
21751
21799
|
* }
|
|
21752
21800
|
* }
|
|
21753
21801
|
* ```
|
|
@@ -21757,24 +21805,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
21757
21805
|
* selector: 'my-table',
|
|
21758
21806
|
* template: '<qd-table [config]="config"></qd-table>',
|
|
21759
21807
|
* providers: [
|
|
21760
|
-
*
|
|
21761
|
-
*
|
|
21762
|
-
*
|
|
21763
|
-
*
|
|
21808
|
+
* {
|
|
21809
|
+
* provide: QD_TABLE_DATA_RESOLVER_TOKEN,
|
|
21810
|
+
* useClass: MyTableResolver
|
|
21811
|
+
* }
|
|
21764
21812
|
* ]
|
|
21765
21813
|
* })
|
|
21766
21814
|
* class MyTableComponent {
|
|
21767
|
-
*
|
|
21768
|
-
*
|
|
21769
|
-
*
|
|
21770
|
-
*
|
|
21771
|
-
*
|
|
21772
|
-
*
|
|
21773
|
-
*
|
|
21774
|
-
*
|
|
21775
|
-
*
|
|
21776
|
-
*
|
|
21777
|
-
*
|
|
21815
|
+
* config: QdTableConfig<ColumnDefinition> = {
|
|
21816
|
+
* columns: [
|
|
21817
|
+
* { column: 'name', type: 'text', sort: { direction: 'asc' } },
|
|
21818
|
+
* { column: 'age', type: 'integer', sort: {} },
|
|
21819
|
+
* { column: 'active', type: 'boolean' }
|
|
21820
|
+
* ],
|
|
21821
|
+
* pagination: {
|
|
21822
|
+
* pageSizes: [10, 20, 50],
|
|
21823
|
+
* pageSizeDefault: 10
|
|
21824
|
+
* } // ← omit this section to disable pagination
|
|
21825
|
+
* };
|
|
21826
|
+
* }
|
|
21778
21827
|
* ```
|
|
21779
21828
|
*
|
|
21780
21829
|
* #### **Selections and Actions**
|
|
@@ -21931,9 +21980,9 @@ class QdTableComponent {
|
|
|
21931
21980
|
}
|
|
21932
21981
|
ngOnInit() {
|
|
21933
21982
|
this.tableStoreService.tableId = this.config.uid || v4();
|
|
21934
|
-
this.resolverService.init(this.config.refreshOnLanguageChange);
|
|
21983
|
+
this.resolverService.init(this.config.refreshOnLanguageChange, this.hasPagination);
|
|
21935
21984
|
this.tableStoreService.init();
|
|
21936
|
-
this.tableStoreService.initTableState(this._data, this.hasResolver, this._connectors);
|
|
21985
|
+
this.tableStoreService.initTableState(this._data, this.hasResolver, this._connectors, this.hasPagination);
|
|
21937
21986
|
this.tableStoreService.updateTableStateRecentSecondaryAction(undefined);
|
|
21938
21987
|
this.tableStoreService.setupSort(this.config.columns);
|
|
21939
21988
|
this.data$ = this.tableStoreService.tableDataEntries$();
|
|
@@ -21947,7 +21996,7 @@ class QdTableComponent {
|
|
|
21947
21996
|
this.initializePushEventsService();
|
|
21948
21997
|
this.initRefresh();
|
|
21949
21998
|
this.table$ = this.tableStoreService.table$();
|
|
21950
|
-
this.hasData$ = this.
|
|
21999
|
+
this.hasData$ = this.data$.pipe(map(state => (state ?? []).length > 0));
|
|
21951
22000
|
this.hasEmptyStateView$ = this.hasData$.pipe(map(hasData => !hasData && !!this.config.emptyStateView && !this.config.emptyStateView.disabled));
|
|
21952
22001
|
}
|
|
21953
22002
|
ngOnChanges(changes) {
|
|
@@ -21955,6 +22004,9 @@ class QdTableComponent {
|
|
|
21955
22004
|
!changes['data'].firstChange &&
|
|
21956
22005
|
JSON.stringify(changes['data'].previousValue) !== JSON.stringify(changes['data'].currentValue)) {
|
|
21957
22006
|
this.tableStoreService.updateTableStateData(this._data);
|
|
22007
|
+
if (!this.hasPagination) {
|
|
22008
|
+
this.data$ = of(this._data);
|
|
22009
|
+
}
|
|
21958
22010
|
}
|
|
21959
22011
|
if (changes['config'] &&
|
|
21960
22012
|
!changes['config'].firstChange &&
|
|
@@ -22105,7 +22157,7 @@ class QdTableComponent {
|
|
|
22105
22157
|
QdTableFillingWidthService,
|
|
22106
22158
|
QdTableResolverService,
|
|
22107
22159
|
QdTableExternalActionResultService
|
|
22108
|
-
], viewQueries: [{ propertyName: "paginator", first: true, predicate: QdTablePaginatorComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<table [class]=\"'qd-table__table'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"data$ | async\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\" *ngIf=\"hasPagination\"></qd-table-paginator>\n<qd-table-empty-state *ngIf=\"hasEmptyStateView$ | async\" [config]=\"config.emptyStateView\"></qd-table-empty-state>\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QdTableBodyComponent, selector: "[qd-table-body]", inputs: ["config", "data", "data-test-id"] }, { kind: "component", type: QdTableEmptyStateComponent, selector: "qd-table-empty-state", inputs: ["config"] }, { kind: "component", type: QdTableHeadComponent, selector: "[qd-table-head]", inputs: ["config", "data-test-id"] }, { kind: "component", type: QdTablePaginatorComponent, selector: "qd-table-paginator", inputs: ["config", "data-test-id"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
22160
|
+
], viewQueries: [{ propertyName: "paginator", first: true, predicate: QdTablePaginatorComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<table [class]=\"'qd-table__table'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\" *ngIf=\"hasPagination\"></qd-table-paginator>\n<qd-table-empty-state *ngIf=\"hasEmptyStateView$ | async\" [config]=\"config.emptyStateView\"></qd-table-empty-state>\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QdTableBodyComponent, selector: "[qd-table-body]", inputs: ["config", "data", "data-test-id"] }, { kind: "component", type: QdTableEmptyStateComponent, selector: "qd-table-empty-state", inputs: ["config"] }, { kind: "component", type: QdTableHeadComponent, selector: "[qd-table-head]", inputs: ["config", "data-test-id"] }, { kind: "component", type: QdTablePaginatorComponent, selector: "qd-table-paginator", inputs: ["config", "data-test-id"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
22109
22161
|
}
|
|
22110
22162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: QdTableComponent, decorators: [{
|
|
22111
22163
|
type: Component,
|
|
@@ -22125,7 +22177,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
22125
22177
|
'[class.last-column-fills-width]': 'whichColumnFillsWidth === "last"',
|
|
22126
22178
|
'[class.harmonized]': 'whichColumnFillsWidth === "harmonized"',
|
|
22127
22179
|
'[attr.data-qd-no-horizontal-padding-small]': 'true'
|
|
22128
|
-
}, template: "<table [class]=\"'qd-table__table'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"data$ | async\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\" *ngIf=\"hasPagination\"></qd-table-paginator>\n<qd-table-empty-state *ngIf=\"hasEmptyStateView$ | async\" [config]=\"config.emptyStateView\"></qd-table-empty-state>\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"] }]
|
|
22180
|
+
}, template: "<table [class]=\"'qd-table__table'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\" *ngIf=\"hasPagination\"></qd-table-paginator>\n<qd-table-empty-state *ngIf=\"hasEmptyStateView$ | async\" [config]=\"config.emptyStateView\"></qd-table-empty-state>\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"] }]
|
|
22129
22181
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
22130
22182
|
type: Optional
|
|
22131
22183
|
}, {
|
|
@@ -32018,8 +32070,6 @@ const updateTableStateData = (state, tableId, data) => updateStateWithNewTable(s
|
|
|
32018
32070
|
const updateTableStateSelectedRows = (state, tableId, selectedRows) => updateStateWithNewTable(state, tableId, { ...state[tableId], selectedRows });
|
|
32019
32071
|
const updateTableStateRecentSecondaryAction = (state, tableId, action) => updateStateWithNewTable(state, tableId, { ...state[tableId], recentSecondaryAction: action });
|
|
32020
32072
|
const setupPagination = (state, tableId, pageSize = PAGE_SIZE_DEFAULT) => {
|
|
32021
|
-
if (state[tableId]?.hasPagination)
|
|
32022
|
-
return state;
|
|
32023
32073
|
return updateStateWithNewTable(state, tableId, {
|
|
32024
32074
|
...state[tableId],
|
|
32025
32075
|
pageIndex: 0,
|
|
@@ -32089,10 +32139,20 @@ const resetConnectorStates = (state, tableId) => {
|
|
|
32089
32139
|
};
|
|
32090
32140
|
|
|
32091
32141
|
const initialState = {};
|
|
32092
|
-
|
|
32142
|
+
function isTreeData(data) {
|
|
32143
|
+
return Array.isArray(data) && data.some(item => 'children' in item);
|
|
32144
|
+
}
|
|
32145
|
+
const _tableReducer = createReducer(initialState, on(QdTableActions.initTableState, (state, { tableId, data, hasResolver, connectors, hasPagination }) => {
|
|
32146
|
+
if (isTreeData(data))
|
|
32147
|
+
return state;
|
|
32093
32148
|
if ((state[tableId] && JSON.stringify(state[tableId].data) === JSON.stringify(data)) || state[tableId]?.hasResolver)
|
|
32094
32149
|
return state;
|
|
32095
|
-
return updateStateWithNewTable(state, tableId, {
|
|
32150
|
+
return updateStateWithNewTable(state, tableId, {
|
|
32151
|
+
data,
|
|
32152
|
+
hasResolver,
|
|
32153
|
+
connectors,
|
|
32154
|
+
hasPagination
|
|
32155
|
+
});
|
|
32096
32156
|
}), on(QdTableActions.initTableStateSelectedRows, (state, { tableId, selectedRows }) => {
|
|
32097
32157
|
if (state[tableId].selectedRows)
|
|
32098
32158
|
return state;
|