| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import ActionSet from "./ActionSet";
- import ListButton from "./ListButton";
- import SearchBar from "./SearchBar";
- export default class ToolBar {
- constructor(onSearch, actions, options) {
- this.onSearch = onSearch;
- this.actions = actions;
- this.options = options;
- }
- render() {
- this.toolbar = document.createElement('div');
- this.toolbar.classList.add('input-group', 'mb-3');
- if (typeof this.actions !== 'undefined' && typeof this.options.selectable === 'undefined' && this.actions.length > 0) {
- this.actionSet = new ActionSet(this.actions, 'button');
- let { button, toggle, list } = this.actionSet.render();
- if (button) {
- this.toolbar.appendChild(button);
- }
- if (toggle) {
- this.toolbar.appendChild(toggle);
- }
- if (list) {
- this.toolbar.append(list);
- }
- }
- this.searchBar = new SearchBar(this.onSearch);
- this.toolbar.appendChild(this.searchBar.render());
- this.toolbar.appendChild(new ListButton('th', '').render());
- return this.toolbar;
- }
- getSearch() {
- return this.searchBar.getSearch();
- }
- }
|