@@ -52,6 +55,7 @@ import Pagination from './pagination.vue';
import CustomHeader from './tableHeader';
import ActionToolbar from './action_toolbar.vue';
import Toolbar from './toolbar.vue';
+import RowMenuRenderer from './row_menu_renderer.vue';
export default {
name: "App",
@@ -60,6 +64,10 @@ export default {
type: Boolean,
default: true,
},
+ withRowMenu: {
+ type: Boolean,
+ default: false,
+ },
tableId: {
type: String,
required: true,
@@ -108,7 +116,8 @@ export default {
Pagination,
agColumnHeader: CustomHeader,
ActionToolbar,
- Toolbar
+ Toolbar,
+ RowMenuRenderer
},
computed: {
perPageOptions() {
@@ -121,7 +130,7 @@ export default {
},
actionsParams() {
return {
- item_ids: this.selectedRows.map(row => row.id).join(',')
+ items: JSON.stringify(this.selectedRows.map(row => { return {id: row.id, type: row.type} }))
}
},
gridOptions() {
@@ -139,7 +148,23 @@ export default {
checkboxSelection: true,
width: 48,
minWidth: 48,
- resizable: false
+ resizable: false,
+ pinned: 'left'
+ });
+ }
+
+ if (this.withRowMenu) {
+ this.columnDefs.push({
+ field: "rowMenu",
+ headerName: '',
+ width: 72,
+ minWidth: 72,
+ resizable: false,
+ sortable: false,
+ cellRenderer: 'RowMenuRenderer',
+ cellStyle: {overflow: 'visible'},
+ pinned: 'right'
+
});
}
},
@@ -159,7 +184,7 @@ export default {
},
methods: {
formatData(data) {
- return data.map( (item) => Object.assign({}, item.attributes, { id: item.id }) );
+ return data.map( (item) => Object.assign({}, item.attributes, { id: item.id, type: item.type }) );
},
resize() {
if (this.tableState) return;
@@ -234,6 +259,11 @@ export default {
setSearchValue(value) {
this.searchValue = value;
this.loadData();
+ },
+ clickCell(e) {
+ if (e.column.colId !== 'rowMenu') {
+ e.node.setSelected(true);
+ }
}
}
};
diff --git a/app/javascript/vue/shared/menu_dropdown.vue b/app/javascript/vue/shared/menu_dropdown.vue
index 8ab614260..8e2530636 100644
--- a/app/javascript/vue/shared/menu_dropdown.vue
+++ b/app/javascript/vue/shared/menu_dropdown.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js
index b9b8f705a..326af2c33 100644
--- a/config/webpack/webpack.config.js
+++ b/config/webpack/webpack.config.js
@@ -46,7 +46,8 @@ const entryList = {
vue_components_export_stock_consumption_modal: './app/javascript/packs/vue/export_stock_consumption_modal.js',
vue_components_manage_stock_value_modal: './app/javascript/packs/vue/manage_stock_value_modal.js',
vue_legacy_datetime_picker: './app/javascript/packs/vue/legacy/datetime_picker.js',
- vue_label_templates_table: './app/javascript/packs/vue/label_templates_table.js'
+ vue_label_templates_table: './app/javascript/packs/vue/label_templates_table.js',
+ vue_projects_list: './app/javascript/packs/vue/projects_list.js',
}
// Engine pack loading based on https://github.com/rails/webpacker/issues/348#issuecomment-635480949