Skip to content
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

Version > 3: calculatePosition is not overwriteable anymore #545

Open
ghost opened this issue Apr 20, 2020 · 0 comments
Open

Version > 3: calculatePosition is not overwriteable anymore #545

ghost opened this issue Apr 20, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2020

In your docs cookbook you are providing a example for how to create a custom EBD version by extending the component and add some configurations/options like custom calculatePosition (by overwriting the function):

import EmberBasicDropdown from 'ember-basic-dropdown/components/basic-dropdown';

export default class extends EmberBasicDropdown {
  // Place here your system-wide preferences
  triggerComponent = 'my-custom-trigger'
  calculatePosition() {
    // your custom function to position the dropdown
  }
}

with version > 3 and the re-write to glimmer-components, it looks like this is not possible anymore, as you're only checking for this.args.calculatePosition otherwise it will use the imported calculatePosition from the util:

let calculatePositionFn = this.args.calculatePosition || calculatePosition

Noticed this, while I was updating our app to use EBD > 3 and was using this system-wide config before.

Am I missing something or is this not possible anymore?

Maybe remove this from docs or make it work, something like:

let calculatePositionFn = this.args.calculatePosition || 
                          typeof this.calculatePosition === 'function' ? this.calculatePosition : null ||
                          calculatePosition

I ended up by creating a wrapper-component which is passing calculatePosition-function as arg instead of extending

@ghost ghost changed the title > 3 calculatePosition is not overwriteable anymore Version > 3: calculatePosition is not overwriteable anymore Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants