@affino/datagrid-vue-app 0.1.6 → 0.1.7

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 CHANGED
@@ -56,6 +56,8 @@ In practice, the project sits somewhere between a data grid and a reactive data
56
56
  - Spreadsheet-style formulas
57
57
  - Built-in analytics features
58
58
  - Large dataset performance
59
+ - Package-level height integration via `layoutMode`
60
+ - Custom Vue cell content via per-column `cellRenderer`
59
61
 
60
62
  ## Install
61
63
 
@@ -158,9 +160,37 @@ Result:
158
160
  `presentation.numberFormat` and `presentation.dateTimeFormat` are display-only. Editing, clipboard and patch flows continue to use the raw cell value.
159
161
  The shared formatter implementation lives in `@affino/datagrid-format`, so the same column formatting rules can be reused by other adapters.
160
162
 
163
+ ## Layout Modes
164
+
165
+ `DataGrid` exposes a package-level height contract so pages do not need to wrap the grid in ad-hoc `height: 100%` containers.
166
+
167
+ - `fill`: app-shell behavior; the grid fills the available container height
168
+ - `auto-height`: the grid computes its own table height from header and rows
169
+ - `minRows`: optional lower bound for `auto-height`
170
+ - `maxRows`: optional upper bound for `auto-height`; scrolling stays inside the body after this clamp
171
+
172
+ ```vue
173
+ <DataGrid
174
+ :rows="rows"
175
+ :columns="columns"
176
+ layout-mode="auto-height"
177
+ :min-rows="6"
178
+ :max-rows="14"
179
+ />
180
+ ```
181
+
182
+ Normalization rules:
183
+
184
+ - row limits are only applied in `auto-height`
185
+ - `fill` always ignores `minRows` and `maxRows`
186
+ - `0`, negative, `NaN`, and non-finite row limits are treated as unset
187
+ - if both limits are present and `maxRows < minRows`, `maxRows` is clamped up to `minRows`
188
+ - prefer `fill` for full-screen shells such as split gantt layouts and `auto-height` for embedded cards, stacked dashboard sections, and form flows
189
+
161
190
  ## Spreadsheet Fill Handle
162
191
 
163
- `DataGrid` includes spreadsheet-style fill interactions in base table mode without any extra feature flag.
192
+ `DataGrid` keeps spreadsheet-style fill interactions off by default.
193
+ Enable them declaratively with `fill-handle` when the host flow actually wants spreadsheet editing affordances.
164
194
 
165
195
  - Drag the fill handle from the active selection corner to extend the fill range.
166
196
  - Double-click the fill handle to fill the selected range down to the last row in the current projection.
@@ -202,6 +232,7 @@ const columns = [
202
232
  :rows="rows"
203
233
  :columns="columns"
204
234
  :client-row-model-options="{ resolveRowId: row => row.id }"
235
+ fill-handle
205
236
  />
206
237
  </template>
207
238
  ```
@@ -212,6 +243,31 @@ Recommended usage:
212
243
  - Use fill for base table editing flows; it is not surfaced in pivot/tree/worker stage modes.
213
244
  - Prefer `@affino/datagrid-vue-app` for the built-in UX; custom renderers should use the app hooks exported from `@affino/datagrid-vue`.
214
245
 
246
+ ## Range Move
247
+
248
+ Selection drag-move is also off by default in `DataGrid`.
249
+ Enable it with `range-move` when you want spreadsheet-style move semantics for an existing selection.
250
+
251
+ - drag starts from inside the current selection
252
+ - the grid shows a move preview before commit
253
+ - dropping writes the moved cell payload back through the normal grid mutation path
254
+
255
+ ```vue
256
+ <DataGrid
257
+ :rows="rows"
258
+ :columns="columns"
259
+ :client-row-model-options="{ resolveRowId: row => row.id }"
260
+ fill-handle
261
+ range-move
262
+ />
263
+ ```
264
+
265
+ Recommended usage:
266
+
267
+ - leave both props off for form-like tables where accidental spreadsheet gestures are a UX risk
268
+ - enable them together for spreadsheet-heavy editing surfaces
269
+ - keep them off for read-only, reporting, and embedded summary tables unless the interaction model is explicitly spreadsheet-like
270
+
215
271
  ## Declarative Column Menu
216
272
 
217
273
  Enable the built-in header menu with one prop:
@@ -494,6 +550,11 @@ Affino DataGrid works well for:
494
550
  - `rows`
495
551
  - `columns`
496
552
  - `theme`
553
+ - `layout-mode`
554
+ - `min-rows`
555
+ - `max-rows`
556
+ - `fill-handle`
557
+ - `range-move`
497
558
  - `column-menu`
498
559
  - `column-layout`
499
560
  - `advanced-filter`
@@ -716,6 +777,64 @@ Object form:
716
777
  />
717
778
  ```
718
779
 
780
+ ## Custom Cell Renderers
781
+
782
+ Columns can provide a `cellRenderer` callback that returns Vue content for the display layer.
783
+
784
+ ```vue
785
+ <script setup lang="ts">
786
+ import { h } from "vue"
787
+ import { DataGrid, type DataGridAppColumnInput } from "@affino/datagrid-vue-app"
788
+
789
+ interface Row {
790
+ id: string
791
+ employee: string
792
+ status: string
793
+ approval: string
794
+ }
795
+
796
+ const rows: Row[] = [
797
+ { id: "w1", employee: "Maya Patel", status: "Submitted", approval: "Waiting" },
798
+ { id: "w2", employee: "Liam Chen", status: "Approved", approval: "Approved" },
799
+ ]
800
+
801
+ const columns: DataGridAppColumnInput<Row>[] = [
802
+ { key: "employee", label: "Employee" },
803
+ {
804
+ key: "status",
805
+ label: "Status",
806
+ cellRenderer: ({ displayValue, row }) => h("span", {
807
+ class: [
808
+ "status-pill",
809
+ row?.status === "Approved" ? "status-pill--success" : "status-pill--info",
810
+ ],
811
+ }, displayValue),
812
+ },
813
+ { key: "approval", label: "Approval" },
814
+ ]
815
+ </script>
816
+
817
+ <template>
818
+ <DataGrid :rows="rows" :columns="columns" />
819
+ </template>
820
+ ```
821
+
822
+ `cellRenderer` receives a context with:
823
+
824
+ - `row`: current authored row object when available
825
+ - `rowNode`: runtime row node
826
+ - `rowOffset`: visible row offset inside the current viewport lane
827
+ - `column` and `columnIndex`
828
+ - `value`: raw string value used by the stage
829
+ - `displayValue`: formatted display string after presentation rules
830
+
831
+ Guidelines:
832
+
833
+ - treat `cellRenderer` as display-only; editing, selection, fill, clipboard, and menus still belong to the grid shell
834
+ - prefer pure render output from row data over local mutable renderer state
835
+ - keep identifiers, derived values, and formula-result columns read-only where appropriate
836
+ - if a renderer caches local UI state, listen for targeted app-layer cell refresh and re-sync on refresh
837
+
719
838
  ## Theme
720
839
 
721
840
  Preset string:
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as yn, computed as u, ref as y, watch as de, nextTick as Mt, onMounted as wn, onBeforeUnmount as pn, openBlock as De, createElementBlock as We, createElementVNode as V, normalizeStyle as ne, createVNode as bn, mergeProps as Sn, unref as Mn, createCommentVNode as Tn } from "vue";
2
- import { o as Pn, q as Dn, _ as Wn } from "./DataGridTableStage.vue_vue_type_script_setup_true_lang-DUqp_TKD.js";
2
+ import { o as Pn, q as Dn, _ as Wn } from "./DataGridTableStage.vue_vue_type_script_setup_true_lang-Bb5ixAcf.js";
3
3
  import { resolveDataGridGanttAnalysis as _n, buildDataGridGanttVisibleBars as kn, buildDataGridGanttDependencyPaths as Rn, resolveDataGridGanttRangeFrame as Xe, buildDataGridTimelineRenderModels as Tt, resolveDataGridTimelineDateToPixel as Pt, resolveDataGridTimelineScrollLeftForDate as En, applyDataGridGanttDragDelta as In, hitTestDataGridGanttBar as Dt, clampDataGridTimelineScrollLeft as xn, buildDataGridGanttRowEditPatch as Cn } from "@affino/datagrid-gantt";
4
4
  const be = 0.5, Ln = 1.25;
5
5
  function Hn(s) {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as e, h as r } from "vue";
2
- import { _ as a } from "./DataGridGanttStage.vue_vue_type_script_setup_true_lang-BuF2sFwp.js";
2
+ import { _ as a } from "./DataGridGanttStage.vue_vue_type_script_setup_true_lang-DiaL9sUh.js";
3
3
  import { normalizeDataGridGanttOptions as n } from "@affino/datagrid-gantt";
4
4
  const m = e({
5
5
  name: "DataGridGanttStageEntry",