import { action } from '@ember/object';
import Component from '@glimmer/component';
import { type DataGroupBySelectSignature } from '../../../../interfaces/components/models-table/themes/default/data-group-by-select-signature.interface';
import ModelsTableColumn from '../../../../utils/emt/emt-column';
/**
* Dropdown to select property for table-rows grouping
*
* Also, component allows to select sort order for property used for grouping
*
* Usage example:
*
* ```html
*
*
* {{! ... }}
*
* ```
*
* Block usage example:
*
* ```html
*
*
*
*
*
*
*
* ```
*
* References to the following actions are yielded:
*
* * {@link doSort | sort} - do sort by property name used to group rows
*/
export default class DataGroupBySelect extends Component {
/**
* @event doSort
*/
@action
doSort(): void {
this.args.sort(
new ModelsTableColumn({
propertyName: this.args.currentGroupingPropertyName,
}),
);
}
/**
* @event noop
*/
@action
protected noop(): void {
// do nothing.
}
}