adopted-ember-addons / adopted-ember-addons/ember-light-table
Consider a better way to pass properties to a cellComponent
- Lenguaje dominante
- JavaScript
- Estrellas
- 311
- Forks
- 130
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Currently it seems that the suggested way to access properties passed to a `cellComponent` is on the `column` property. So you would do the following...
```js
new Table([{
cellComponent: 'my-component',
foo: 'bar'
}]);
```
Then in your `my-component` component, you can access `foo` using `this.get('column.foo')`, which is cool. But if `my-component` extended another component for instance, which had its own properties, we'd have to alias all of the properties in `my-component` to be mapped to the properties from the component it extends.
```js
// base-component.js
let BaseComponent = Ember.Component.extend({
foo: 'bar',
//... more and more properties here
});
// my-component.js
export default BaseComponent.extend({
foo: Ember.computed.alias('column.foo'),
// ... more and more aliased properties here
});
```
This works for just a few properties that we want exposed in our original `Table` constructor. But this gets really really messy and unmanageable when there are many properties that we want exposed.
Of course I could loop through all keys in `column` object and alias them dynamically, but its unreliable since I would have to decipher whether a `column` property is meant to be an alias vs a property that is expected by the `Table` class.
Is there a better way to handle this scenario?
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.