refactor(dashboard): replace SiDashboardService with contentChildren query#2067
Open
chintankavathia wants to merge 18 commits into
Open
refactor(dashboard): replace SiDashboardService with contentChildren query#2067chintankavathia wants to merge 18 commits into
chintankavathia wants to merge 18 commits into
Conversation
…kerConfig BREAKING CHANGE: `CriterionDefinition.datepickerConfig` type narrowed The type of `datepickerConfig` in `CriterionDefinition` (filtered-search) changed from `DatepickerInputConfig` to `Omit<DatepickerInputConfig, 'enableDateRange' | 'enableTwoMonthDateRange'>`. The properties `enableDateRange` and `enableTwoMonthDateRange ` are no longer accepted in `datepickerConfig` when used with filtered-search criteria, as they had no effect in that context. Migration: Remove any `enableDateRange` and `enableTwoMonthDateRange` properties from your `datepickerConfig` objects passed to `CriterionDefinition`.
Adding a set of utilities that allows customers to create selects with custom backed value selection, for instance using `si-tree-view`. A very simple version of it can look like this: ```ts @component({ selector: 'app-tree-select', imports: [SiSelectComboboxComponent, SiSelectDropdownDirective, SiTreeViewComponent], template: ` <si-select-combobox> @if (select.value(); as val) { {{ val }} } @else { <span class="text-secondary">Select a location...</span> } </si-select-combobox> <ng-template si-select-dropdown> <si-tree-view class="d-block" ariaLabel="Locations" [items]="items()" [enableSelection]="true" [singleSelectMode]="true" [isVirtualized]="false" (treeItemClicked)="selectItem($event)" /> </ng-template> `, changeDetection: ChangeDetectionStrategy.OnPush, hostDirectives: [ { directive: SiCustomSelectDirective, inputs: ['disabled', 'readonly', 'value'], outputs: ['valueChange'] } ] }) export class TreeSelectComponent { protected readonly select = inject(SiCustomSelectDirective); /** The tree items to display. */ readonly items = input<TreeItem[]>([]); selectItem(item: TreeItem): void { if (item.label) { this.select.updateValue(item.label as string); this.select.close(); } } } ``` The goal is to empower applications to build selects with whatever content they need while we take care of accesibility and proper appereance. Closes #1840
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the dashboard implementation by replacing the SiDashboardService with Angular signal queries. Specifically, SiDashboardComponent now utilizes contentChildren to automatically track SiDashboardCardComponent instances, and the manual registration logic within the card components has been removed. The SiDashboardService and its associated tests have been deleted. I have no feedback to provide.
d445d3c to
1abba64
Compare
…query Remove SiDashboardService and its register/unregister lifecycle pattern. Use contentChildren signal query in SiDashboardComponent to discover SiDashboardCardComponent instances declaratively, simplifying card tracking and eliminating the need for OnDestroy in the card component.
1abba64 to
9b1be50
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove
SiDashboardServiceand its register/unregister lifecycle pattern. UsecontentChildrensignal query inSiDashboardComponentto discoverSiDashboardCardComponentinstances declaratively, simplifying card tracking and eliminating the need forOnDestroyin the card component.Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: