@affino/datagrid-vue-app 0.1.13 → 0.1.14
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 +86 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -268,6 +268,85 @@ Recommended usage:
|
|
|
268
268
|
- enable them together for spreadsheet-heavy editing surfaces
|
|
269
269
|
- keep them off for read-only, reporting, and embedded summary tables unless the interaction model is explicitly spreadsheet-like
|
|
270
270
|
|
|
271
|
+
## Custom Toolbar Modules
|
|
272
|
+
|
|
273
|
+
`DataGrid` exposes a public `toolbar-modules` prop for additive toolbar actions.
|
|
274
|
+
Use it when you want to keep the built-in app renderer and append custom buttons, popovers, or small workflow panels to the same toolbar row.
|
|
275
|
+
|
|
276
|
+
- built-in modules such as column layout, advanced filter, and aggregations still render first
|
|
277
|
+
- custom modules are appended after the built-in modules in declaration order
|
|
278
|
+
- each module provides a stable `key`, a Vue `component`, and optional props passed into that component
|
|
279
|
+
|
|
280
|
+
Type shape:
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
interface DataGridAppToolbarModule {
|
|
284
|
+
key: string
|
|
285
|
+
component: Component
|
|
286
|
+
props?: Record<string, unknown>
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Practical guidance:
|
|
291
|
+
|
|
292
|
+
- use a stable `key` per module instance
|
|
293
|
+
- keep the rendered trigger on the shared toolbar button class when you want built-in styling: `datagrid-app-toolbar__button`
|
|
294
|
+
- add your own `data-datagrid-toolbar-action` when you want deterministic selectors for tests or analytics
|
|
295
|
+
|
|
296
|
+
```vue
|
|
297
|
+
<script setup lang="ts">
|
|
298
|
+
import { DataGrid, type DataGridAppToolbarModule } from "@affino/datagrid-vue-app"
|
|
299
|
+
import { defineComponent, h } from "vue"
|
|
300
|
+
|
|
301
|
+
const ExportButton = defineComponent({
|
|
302
|
+
name: "ExportButton",
|
|
303
|
+
props: {
|
|
304
|
+
label: {
|
|
305
|
+
type: String,
|
|
306
|
+
required: true,
|
|
307
|
+
},
|
|
308
|
+
onTrigger: {
|
|
309
|
+
type: Function,
|
|
310
|
+
required: true,
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
setup(props) {
|
|
314
|
+
return () => h("button", {
|
|
315
|
+
type: "button",
|
|
316
|
+
class: "datagrid-app-toolbar__button",
|
|
317
|
+
onClick: () => props.onTrigger(),
|
|
318
|
+
}, props.label)
|
|
319
|
+
},
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
const toolbarModules: readonly DataGridAppToolbarModule[] = [
|
|
323
|
+
{
|
|
324
|
+
key: "export",
|
|
325
|
+
component: ExportButton,
|
|
326
|
+
props: {
|
|
327
|
+
label: "Export",
|
|
328
|
+
onTrigger: () => {
|
|
329
|
+
console.log("export current view")
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
]
|
|
334
|
+
</script>
|
|
335
|
+
|
|
336
|
+
<template>
|
|
337
|
+
<DataGrid
|
|
338
|
+
:rows="rows"
|
|
339
|
+
:columns="columns"
|
|
340
|
+
:toolbar-modules="toolbarModules"
|
|
341
|
+
column-layout
|
|
342
|
+
advanced-filter
|
|
343
|
+
/>
|
|
344
|
+
</template>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Prefer `toolbar-modules` over replacing the whole default slot when the only goal is to extend the built-in toolbar.
|
|
348
|
+
Use the default slot only when you need to take over the entire runtime renderer contract.
|
|
349
|
+
|
|
271
350
|
## Declarative Column Menu
|
|
272
351
|
|
|
273
352
|
Enable the built-in header menu with one prop:
|
|
@@ -1106,6 +1185,8 @@ The component emits:
|
|
|
1106
1185
|
|
|
1107
1186
|
- `cell-change`
|
|
1108
1187
|
- `selection-change`
|
|
1188
|
+
- `row-selection-change`
|
|
1189
|
+
- `row-select` (legacy alias; prefer `row-selection-change` for typed row-selection snapshots)
|
|
1109
1190
|
- `update:column-state`
|
|
1110
1191
|
- `update:column-order`
|
|
1111
1192
|
- `update:hidden-column-keys`
|
|
@@ -1114,6 +1195,11 @@ The component emits:
|
|
|
1114
1195
|
- `update:state`
|
|
1115
1196
|
- `ready`
|
|
1116
1197
|
|
|
1198
|
+
## Advanced Filter UX
|
|
1199
|
+
|
|
1200
|
+
- When at least one filter is active, the `Advanced filter` toolbar button shows an active filter icon and active button styling.
|
|
1201
|
+
- Removing the only advanced-filter clause does not lock the UI; the builder keeps one empty clause row so the user can clear and rebuild the expression in place.
|
|
1202
|
+
|
|
1117
1203
|
## Ref API
|
|
1118
1204
|
|
|
1119
1205
|
### Runtime access
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affino/datagrid-vue-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Declarative Vue DataGrid component for Affino",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@affino/menu-vue": "^2.1.1",
|
|
35
35
|
"@affino/popover-vue": "^1.1.0",
|
|
36
|
-
"@affino/datagrid-
|
|
36
|
+
"@affino/datagrid-vue": "0.3.8",
|
|
37
37
|
"@affino/datagrid-gantt": "0.1.1",
|
|
38
38
|
"@affino/datagrid-theme": "0.2.2",
|
|
39
|
-
"@affino/datagrid-
|
|
39
|
+
"@affino/datagrid-chrome": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"vue": "^3.3.0"
|