innoboxrr-vue-datatable 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +1 -1
- package/src/useDataTable.js +4 -2
package/README.md
CHANGED
|
@@ -101,9 +101,11 @@ export const setFilters = (filters) => filters
|
|
|
101
101
|
// Opcionales
|
|
102
102
|
export const dataTableComponents = () => ({ CopyLink })
|
|
103
103
|
export const bulkActions = () => [
|
|
104
|
-
{ id: 'delete', name: 'Borrar', icon: 'delete', callback: 'bulkDelete', danger: true },
|
|
104
|
+
{ id: 'delete', name: 'Borrar', icon: 'delete', callback: 'bulkDelete', danger: true, success: 'Borrados' },
|
|
105
|
+
{ id: 'publish', name: 'Publicar', callback: 'bulkUpdate', params: { status: 'published' } },
|
|
105
106
|
]
|
|
106
107
|
export const bulkDelete = (ids, rows) => { /* … */ }
|
|
108
|
+
export const bulkUpdate = (ids, rows, data) => { /* … */ }
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
- **Acciones.** `route: true` navega a `params.to` con vue-router;
|
package/package.json
CHANGED
package/src/useDataTable.js
CHANGED
|
@@ -271,7 +271,9 @@ export default function useDataTable(props, { navigate = null, labels = core.DEF
|
|
|
271
271
|
|
|
272
272
|
/**
|
|
273
273
|
* Una acción masiva recibe los ids seleccionados —también los de otras
|
|
274
|
-
* páginas
|
|
274
|
+
* páginas—, las filas cargadas que están entre ellos y sus `params`. Con
|
|
275
|
+
* los params, una misma función sirve para varias acciones: marcar como
|
|
276
|
+
* publicado y marcar como borrador son la misma llamada con otro valor.
|
|
275
277
|
*/
|
|
276
278
|
const runBulk = async (action) => {
|
|
277
279
|
if (typeof props.model[action.callback] !== 'function') {
|
|
@@ -284,7 +286,7 @@ export default function useDataTable(props, { navigate = null, labels = core.DEF
|
|
|
284
286
|
const loaded = table.getSelectedRowModel().rows.map((row) => row.original)
|
|
285
287
|
|
|
286
288
|
try {
|
|
287
|
-
await props.model[action.callback](ids, loaded)
|
|
289
|
+
await props.model[action.callback](ids, loaded, action.params ?? {})
|
|
288
290
|
} catch (failure) {
|
|
289
291
|
if (! core.isCancelled(failure)) {
|
|
290
292
|
notifyError(core.describeError(failure, text(), text().actionFailed).message)
|