2018-10-19 15:17:02 +00:00
|
|
|
import Component from '@ember/component';
|
2019-01-30 10:56:04 +00:00
|
|
|
import SlotsMixin from 'block-slots';
|
2018-11-19 14:47:20 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2019-04-08 10:17:30 +00:00
|
|
|
import { get, set } from '@ember/object';
|
|
|
|
import { subscribe } from 'consul-ui/utils/computed/purify';
|
2018-10-19 15:17:02 +00:00
|
|
|
|
2019-04-08 10:17:30 +00:00
|
|
|
let uid = 0;
|
2018-10-19 15:17:02 +00:00
|
|
|
export default Component.extend(SlotsMixin, {
|
2018-11-19 14:47:20 +00:00
|
|
|
dom: service('dom'),
|
2018-10-19 15:17:02 +00:00
|
|
|
onchange: function() {},
|
2019-04-08 10:17:30 +00:00
|
|
|
init: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
set(this, 'uid', uid++);
|
|
|
|
},
|
|
|
|
inputId: subscribe('name', 'uid', function(name = 'name') {
|
|
|
|
return `tabular-details-${name}-toggle-${uid}_`;
|
|
|
|
}),
|
2018-10-19 15:17:02 +00:00
|
|
|
actions: {
|
|
|
|
click: function(e) {
|
2018-11-19 14:47:20 +00:00
|
|
|
get(this, 'dom').clickFirstAnchor(e);
|
2018-10-19 15:17:02 +00:00
|
|
|
},
|
|
|
|
change: function(item, e) {
|
|
|
|
this.onchange(e, item);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|