-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: sbb autocomplete grid #2512
base: main
Are you sure you want to change the base?
Conversation
2600e46
to
ed2b24b
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2512 +/- ##
==========================================
+ Coverage 93.18% 93.24% +0.05%
==========================================
Files 316 316
Lines 25389 24613 -776
Branches 2063 1986 -77
==========================================
- Hits 23660 22950 -710
+ Misses 1696 1631 -65
+ Partials 33 32 -1 ☔ View full report in Codecov by Sentry. |
15d25eb
to
a8cc8c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job as usual
Only a partial review ( around half of it ) 😵💫
src/components/autocomplete-grid/autocomplete-grid-actions/autocomplete-grid-actions.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-actions/autocomplete-grid-actions.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid/autocomplete-grid.spec.ts
Outdated
Show resolved
Hide resolved
1276487
to
673be75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, few things to fix
src/components/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid/autocomplete-grid.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid/autocomplete-grid.spec.ts
Outdated
Show resolved
Hide resolved
src/components/autocomplete-grid/autocomplete-grid/autocomplete-grid.spec.ts
Outdated
Show resolved
Hide resolved
8dedb4f
to
5985077
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
…-grid # Conflicts: # src/elements/autocomplete/autocomplete.spec.ts # src/elements/button/mini-button/mini-button.ts # src/elements/option/optgroup/optgroup.ts # src/elements/option/option/option.ts
Note for reviewers: A fix was made in the commit 'fix: enable autocomplete behavior' 89538b1 but since i'm not fully aware of what exactly is rendered in SSR, the change should be reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 😃
Some minor nitpicks, but there is an issue with the mini button base.
After that it should be good to merge!
); | ||
|
||
/** Observe changes on data attributes and set the appropriate values. */ | ||
private _onOptionAttributesChange(mutationsList: MutationRecord[]): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick; This could probably be inlined, as it is only used in the observer.
|
||
public constructor() { | ||
super(); | ||
new SbbSlotStateController(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick; You could now use the slotState
decorator.
/** | ||
* Used to dispatch a click event when users interact with the button via keyboard (the component does not receive focus). | ||
*/ | ||
public dispatchClick(event: KeyboardEvent): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this needs to be a public method on this class. Could we not just dispatch a click event from the autocomplete grid, where this method is called from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual, the click on the ac-grid-button emits a click
event with the button component as a target;
I could move this method in the ac-grid, however this will cause to emit a forced click
event on keyboard selection with the ac-grid as a target, even if the 'visual-focus' is on the button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I fully understand.
My suggestion would be to move the dispatch click event logic to the grid (or somewhere re-usable?), but still dispatch the event on the grid button in the selection via keyboard scenario.
Could you elaborate again?
) as SbbAutocompleteGridOptionElement[]; | ||
} | ||
|
||
private get _buttons(): SbbAutocompleteGridButtonElement[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick; Could be inlined.
@@ -0,0 +1,78 @@ | |||
The `sbb-optgroup` is a component used to group more [sbb-autocomplete-grid-option](/docs/elements-sbb-autocomplete-grid-sbb-autocomplete-grid-option--docs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `sbb-optgroup` is a component used to group more [sbb-autocomplete-grid-option](/docs/elements-sbb-autocomplete-grid-sbb-autocomplete-grid-option--docs) | |
The `sbb-autocomplete-grid-optgroup` is a component used to group more [sbb-autocomplete-grid-option](/docs/elements-sbb-autocomplete-grid-sbb-autocomplete-grid-option--docs) |
} | ||
}; | ||
|
||
private _dispatchClickEvent = (event: KeyboardEvent): void => { | ||
protected dispatchClickEvent = (event: KeyboardEvent): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is no longer needed. If this functionality is needed externally, we can extract it as a function or as a static method.
|
||
@slotState() | ||
export abstract class SbbMiniButtonBaseElement extends SbbNegativeMixin( | ||
SbbIconNameMixin(SbbButtonBaseElement), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must never import from outside the core directory from inside the core directory.
I would suggest moving this base element to the mini button.
What do you think?
…-grid # Conflicts: # src/elements/datepicker/datepicker/datepicker.ts
Preflight Checklist
Issue
This PR Closes #1945
Pull request checklist
Please check if your PR fulfills the following requirements:
See Review Guidelines for more information what is checked during review process.
Changes
Changes in this pull request:
sbb-autocomplete-grid
component added, with related components:sbb-autocomplete-grid-optgroup
, similar to native optgroupsbb-autocomplete-grid-row
, which acts as a container for both option and actionssbb-autocomplete-grid-option
, similar to native optionsbb-autocomplete-grid-actions
, which acts as a container for buttonsbb-autocomplete-grid-button
Browsers
I tested the build on the following browsers:
Screen readers
I tested the build on the following browsers:
Pull request type
Please check the type of change your PR introduces:
Does this introduce a breaking change?
Other information