-
Notifications
You must be signed in to change notification settings - Fork 328
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
ComboBox - New methods + bullet proofing #479
base: main
Are you sure you want to change the base?
ComboBox - New methods + bullet proofing #479
Conversation
e6ea55b
to
1664ee2
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.
@mohsinhijazee Hi!
Thank you for your work! Please read the comments left. Correct the PR according to the comments and push changes.
Best regards!
pnpm-lock.yaml
Outdated
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.
Please remove this file from the PR. We don't use PNPM.
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.
Sure!
package.json
Outdated
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.
Please focus on TS files (src/plugins/combobox/*.ts).
You can create a separate PR in which you will provide your vision of bundling. But again, we do not use PNPM.
Please remove this file from the PR.
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 don't have clear idea on bundling, I thought that maybe there's some off line step that only maintainers have or similar. I'll remove them.
index.d.ts
Outdated
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.
Please focus on TS files (src/plugins/combobox/*.ts). You should not generate output files on your side. Please remove this file from the PR.
preline.d.ts
Outdated
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.
Please focus on TS files (src/plugins/combobox/*.ts). You should not generate output files on your side. Please remove this file from the PR.
dist/combobox.d.ts
Outdated
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.
Please focus on TS files (src/plugins/combobox/*.ts). You should not generate output files on your side. Please remove this file from the PR.
src/index.ts
Outdated
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 fixed this issue through another PR request from another user. Please remove this file from PR.
src/plugins/select/index.ts
Outdated
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.
Please create a separate PR for the select. We will be grateful if you will separate PRs by making them separate for each plugin.
src/utils/index.ts
Outdated
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.
Please do not use this as a separate helper. This check can be done with the standard Array method Array.isArray
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.
Yes, that's kinda pointless. 😄
src/plugins/combobox/index.ts
Outdated
@@ -13,12 +13,14 @@ import { | |||
afterTransition, | |||
htmlToElement, | |||
isParentOrElementHidden, | |||
isArray, |
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.
Please use Array.isArray instead.
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.
Makes sense. Will do.
src/plugins/combobox/index.ts
Outdated
@@ -376,6 +396,12 @@ class HSComboBox extends HSBasePlugin<IComboBoxOptions> implements IComboBox { | |||
} | |||
|
|||
private jsonItemsRender(items: any) { | |||
|
|||
// Bullet proofing. | |||
if (!isArray(items)) { |
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.
Please use Array.isArray instead.
1664ee2
to
cfe7ee6
Compare
Changes to the Combobox - Constructor does not rely on `window.$hsComboBoxCollection` being initalised. Thus users for bundlers (vite etc) don't have to load all of `preline.js` - Fixed an error about invalid nullish statement Public methods selectValue() and selectAttribute - selectedItem() returns elemnent that was selected - selectedValue() returns the value. - selectedAttr() returns the custom attribute. One option to the ComboBox options: - apiSearchQueryTransformer to allow transforming query before fetch package.json: Few watch commands and generation scripts added.
cfe7ee6
to
c742d2c
Compare
@olegpix Thank you for your feedback! I have removed everything that was not relevant ( Also, about packaging and bundling, I think some scripts or steps should be documented within the |
Hi,
We'll check and approve your PR after the next update, now we are focused on some other tasks. |
Hey @mohsinhijazee - thanks a lot for the PR, we will try to include this PR in v2.7.0 update. Thanks! |
private init() { | ||
// So that not to dpeendon preloading whole library. |
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.
Small typo in the comment.
This PR proposes few additions to the ComboBox.
I have tested this with SvelteKit and wrapped the Combox as a Svelte Component with full events and multiple instances of the component on the same page fetching data from difference sources so many copies/instances work seemlessly.
Few fixes/improvements:
window.$hsComboBoxCollection
being initialised. Thus users for bundlers (vite etc) don't have to load all ofpreline.js
.Additions to the CombBox:
apiSearchQueryTransformer
to allow transforming query beforefetch
. This is required in case some APIs use more advanced filtering DSL such as Google's AIP-160 for examplefilter=prefix('name', 'sh') OR contains('lastName', 'sh')
etc.selectedItem()
returns elemnent that was selectedselectedValue()
returns the value.selectedAttr(attr)
returns the custom attribute.Few other changes to the package.json (required dependencies added, deprecated type definitions replaced with updated packages), few scripts/watch/commands and generation scripts added.
Don't have full context on design choices so some things might seem absurd and I am here to revise as per your feedback FYI @jahaganiev and @olegpix