@toclocoinc/lattice-grid 1.5.5 → 1.6.1
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 +1 -1
- package/docs/AI-SKILL.md +0 -10
- package/docs/API.html +89 -9
- package/docs/api-detail.html +982 -6
- package/lattice-grid.d.ts +510 -21
- package/lattice-grid.esm.min.js +10467 -1699
- package/lattice-grid.min.cjs +10433 -1699
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +10433 -1699
- package/modules/devtools.esm.min.js +2 -2
- package/modules/react.esm.min.js +2 -2
- package/modules/svelte.esm.min.js +2 -2
- package/modules/vue.esm.min.js +2 -2
- package/modules/webcomponent.esm.min.js +10433 -1699
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
dependencies, no build step required. Optional adapters for React, Vue, Svelte
|
|
5
5
|
and Web Components ship alongside it.
|
|
6
6
|
|
|
7
|
-
Version 1.
|
|
7
|
+
Version 1.6.1 · [latticegrid.dev](https://www.latticegrid.dev) · TOCLOCO Inc
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
package/docs/AI-SKILL.md
CHANGED
|
@@ -219,16 +219,6 @@ ai: {
|
|
|
219
219
|
}
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
## What to wire, and where
|
|
223
|
-
|
|
224
|
-
| Piece | Where |
|
|
225
|
-
| --- | --- |
|
|
226
|
-
| `grid.ai` namespace (`schema()`, `plan()`, `apply()`) | `packages/core/src/grid.js` |
|
|
227
|
-
| `PromptBar` mount when `config.ai.ask` is present | `packages/dom/src/createGrid.js` |
|
|
228
|
-
| `prompt.css` in the stylesheet list | `tools/build.js` |
|
|
229
|
-
| `ai/schema.js`, `ai/intent.js` exports | the core barrel |
|
|
230
|
-
| `PromptBar` export | the DOM barrel |
|
|
231
|
-
|
|
232
222
|
## Events
|
|
233
223
|
|
|
234
224
|
Applying goes through `filters.set`, `sort.set`, `columns.group`,
|
package/docs/API.html
CHANGED
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
<div class="shell">
|
|
361
361
|
<aside class="rail">
|
|
362
362
|
<p class="rail__brand">Lattice Grid</p>
|
|
363
|
-
<p class="rail__sub">API reference · v1.
|
|
363
|
+
<p class="rail__sub">API reference · v1.6.1</p>
|
|
364
364
|
<nav>
|
|
365
365
|
<div class="rail__group">
|
|
366
366
|
<span class="rail__label">Start</span>
|
|
@@ -382,6 +382,7 @@
|
|
|
382
382
|
<a href="#filters">grid.filters</a>
|
|
383
383
|
<a href="#sort">grid.sort</a>
|
|
384
384
|
<a href="#edit">grid.edit</a>
|
|
385
|
+
<a href="#form">grid.form</a>
|
|
385
386
|
<a href="#pagination">grid.pagination</a>
|
|
386
387
|
<a href="#scroll">grid.scroll</a>
|
|
387
388
|
<a href="#export">grid.export</a>
|
|
@@ -436,7 +437,7 @@
|
|
|
436
437
|
</header>
|
|
437
438
|
|
|
438
439
|
<p class="chips">
|
|
439
|
-
<span class="chip">Version 1.
|
|
440
|
+
<span class="chip">Version 1.6.1</span>
|
|
440
441
|
<span class="chip">Zero dependencies</span>
|
|
441
442
|
<span class="chip"><a href="api-detail.html">Developer guide →</a></span>
|
|
442
443
|
</p>
|
|
@@ -650,6 +651,9 @@
|
|
|
650
651
|
<tr><td class="name">hostFilter</td><td class="type">{ active(), passes(row) }</td><td class="dflt">—</td><td class="desc">An application-level predicate composed with the grid's own filters.</td></tr>
|
|
651
652
|
<tr><td class="name">pivot</td><td class="type">object</td><td class="dflt">—</td><td class="desc"><code>{ enabled, groupTotals, totalsLabel, maxColumns, separator }</code>. <code>groupTotals: 'before' | 'after'</code> adds a column group totalling every value column across all pivot values, at the near or far edge; omitted, it adds none. <code>totalsLabel</code> heads it, defaulting to <code>Total</code>. <code>maxColumns</code> defaults to 500, counts the totals group, and fails with a message rather than locking the browser.</td></tr>
|
|
652
653
|
<tr><td class="name">grandTotalRow</td><td class="type">boolean | 'bottom'</td><td class="dflt">false</td><td class="desc"><code>true</code> puts it inline at the end of the rows; <code>'bottom'</code> pins it above the status bar. Maintained incrementally on a memory source — see <a href="api-detail.html#grouping">Grouping, totals and pivot</a>.</td></tr>
|
|
654
|
+
<tr><td class="name">pinnedTopRows</td><td class="type">object[]</td><td class="dflt">—</td><td class="desc">Rows held above the scrolling body. Rendered through the ordinary column pipeline, but not part of the data: not counted, sorted, filtered, grouped, selectable or exported. See <a href="api-detail.html#pinned-rows">Pinned rows</a>.</td></tr>
|
|
655
|
+
<tr><td class="name">pinnedBottomRows</td><td class="type">object[]</td><td class="dflt">—</td><td class="desc">As <code>pinnedTopRows</code>, held below the body instead. Sits under the grand total when both are shown.</td></tr>
|
|
656
|
+
<tr><td class="name">fullWidth</td><td class="type">{ when, render }</td><td class="dflt">—</td><td class="desc">Draw matching rows as one band across every column instead of dividing them into columns — a section banner, a note, a “load more” affordance. <code>when(row)</code> picks them, <code>render(params)</code> fills them. Still ordinary data rows in every other respect. See <a href="api-detail.html#full-width-rows">Full-width rows</a>.</td></tr>
|
|
653
657
|
<tr><td class="name">groupFooter</td><td class="type">boolean</td><td class="dflt">false</td><td class="desc">A closing total row per group.</td></tr>
|
|
654
658
|
<tr><td class="name">totalFilteredOnly</td><td class="type">boolean</td><td class="dflt">true</td><td class="desc">Totals reduce the filtered set. <code>false</code> totals the whole dataset, group totals included. See <a href="api-detail.html#total-filtered-only">Grouping, totals and pivot</a>.</td></tr>
|
|
655
659
|
<tr><td class="name">totalOnlyChangedColumns</td><td class="type">boolean</td><td class="dflt">false</td><td class="desc">Reduce only the totalled columns an edit actually changed. Off by default — it asserts that each total depends on nothing but its own column. See <a href="api-detail.html#grouping">Grouping, totals and pivot</a>.</td></tr>
|
|
@@ -665,7 +669,9 @@
|
|
|
665
669
|
<table>
|
|
666
670
|
<thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
|
667
671
|
<tbody>
|
|
672
|
+
<tr><td class="name">messages</td><td class="type">object</td><td class="dflt">en-GB</td><td class="desc">Replaces the grid's own text — labels, menus and screen-reader announcements. A partial catalogue laid over the built-in British English one, so anything you leave out stays in English. Twenty catalogues are bundled: <code>EN_GB</code>, <code>EN_US</code>, <code>FR_FR</code>, <code>FR_CA</code>, <code>IT_IT</code>, <code>ES_ES</code>, <code>PT_BR</code>, <code>DE_DE</code>, <code>NL_NL</code>, <code>SV_SE</code>, <code>DA_DK</code>, <code>NB_NO</code>, <code>FI_FI</code>, <code>PL_PL</code>, <code>CS_CZ</code>, <code>HU_HU</code>, <code>RO_RO</code>, <code>UK_UA</code>, <code>EL_GR</code>, <code>JA_JP</code> and <code>AR</code>. They are exports of the package, not separate files, so importing one does not reduce what is bundled. <code>EN_US</code> is a partial overlay carrying only what differs from British English. <code>AR_SA</code> is an alias for <code>AR</code>: the Arabic catalogue is pan-Arabic, and a region appears in a name only where two variants ship. <code>resolveCatalogue(tag)</code> finds the catalogue for any tag, so <code>resolveCatalogue('es-MX')</code> returns the Spanish one. Every key is listed in <code>MESSAGE_KEYS</code>; <code>auditCatalogue()</code> reports what a catalogue of your own is missing.</td></tr>
|
|
668
673
|
<tr><td class="name">locale</td><td class="type">string</td><td class="dflt">runtime</td><td class="desc">BCP-47. Drives every formatter and one shared <code>Intl.Collator</code>.</td></tr>
|
|
674
|
+
<tr><td class="name">direction</td><td class="type">'ltr' | 'rtl' | 'auto'</td><td class="dflt">auto</td><td class="desc">Writing direction. Left unset, it follows the element's computed <code>dir</code> and then the locale, so <code>locale: 'ar'</code> renders right to left without further configuration. Set it explicitly to override both.</td></tr>
|
|
669
675
|
<tr><td class="name">theme</td><td class="type">'light' | 'dark' | 'high-contrast' | 'terminal'</td><td class="dflt">—</td><td class="desc">Stamped as <code>data-theme</code> on the grid's root. Unset follows the viewer's <code>prefers-color-scheme</code>. See <a href="api-detail.html#theming">Theming</a>.</td></tr>
|
|
670
676
|
<tr><td class="name">density</td><td class="type">'compact' | 'standard' | 'comfortable' | 'spacious' | number</td><td class="dflt">'compact'</td><td class="desc">One scale that every geometry token derives from — row height, spacing, decoration sizes, and type at a damped rate. Row heights are 23.8 / 28 / 42 / 56px. A number scales 28px, so <code>1.4</code> gives 39.2px for anything between the presets. Virtualisation follows it; an explicit <code>rowHeight</code> overrides it.</td></tr>
|
|
671
677
|
<tr><td class="name">rowHeight</td><td class="type">number | (row) => number</td><td class="dflt">28</td><td class="desc">A function enables variable-height rows.</td></tr>
|
|
@@ -700,7 +706,21 @@
|
|
|
700
706
|
<tr><td class="name">maximise</td><td class="type">boolean</td><td class="dflt">true</td><td class="desc"><code>false</code> removes the rail button and <code>grid.maximise</code>, for an application with its own full-screen mode.</td></tr>
|
|
701
707
|
<tr><td class="name">toolPanel</td><td class="type">boolean | object</td><td class="desc">Side dock. <code>panels</code>: <code>columns</code>, <code>filters</code>, <code>views</code>, <code>quick</code>, <code>formatting</code>. <code>side: 'left'</code> makes it the icon rail, which also turns on <code>actions</code> (<code>undo</code>, <code>redo</code>, <code>pause</code>, <code>restore</code>, <code>maximise</code>, then the export group: <code>export</code>, <code>excel</code>, <code>clipboard</code>, <code>print</code> — nine in all, and an array takes these names rather than the button labels) and <code>icons</code>. An explicit array <em>replaces</em> that list rather than extending it; a bare <code>'-'</code> in it renders a divider between groups. <code>exportName</code> names the CSV.</td></tr>
|
|
702
708
|
<tr><td class="name">contextMenu</td><td class="type">boolean | (p) => MenuItem[]</td><td class="desc">Right-click menu. The function form is <code>(params, defaults) => items</code> — see <a href="#custom-menu">custom items</a>. <code>false</code> suppresses it — what a read-only grid wants, since the default menu offers Paste, Clear and Fill down.</td></tr>
|
|
703
|
-
<tr><td class="name">columnMenu</td><td class="type">boolean</td><td class="desc">The header's 3-dot menu. <code>false</code> suppresses it.</td></tr>
|
|
709
|
+
<tr><td class="name">columnMenu</td><td class="type">boolean | (p) => MenuItem[]</td><td class="desc">The header's 3-dot menu, and a right-click on a column heading. The function form is <code>(params, defaults) => items</code>, with <code>params</code> carrying <code>colId</code>, <code>column</code> and <code>grid</code> — see <a href="#custom-menu">custom items</a>. <code>false</code> suppresses it.</td></tr>
|
|
710
|
+
<tr><td class="name">shortcuts</td><td class="type">boolean</td><td class="dflt">true</td><td class="desc">The <kbd>?</kbd> keyboard shortcut overlay. <code>false</code> suppresses it, for a host that wants <kbd>?</kbd> for itself. See <a href="api-detail.html#keyboard">Keyboard</a>.</td></tr>
|
|
711
|
+
<tr><td class="name">rowReorder</td><td class="type">boolean | { column }</td><td class="dflt">—</td><td class="desc">Let a user reorder rows by dragging a handle or with <kbd>Alt</kbd>+<kbd>Shift</kbd>+arrows. The handle goes in the first visible column unless <code>column</code> names another. Refused, with a reason announced, while a sort, filter or grouping is active. See <a href="api-detail.html#row-reorder">Row reorder</a>.</td></tr>
|
|
712
|
+
<tr><td class="name">rowTransfer</td><td class="type">boolean | { send, receive, mode, group }</td><td class="dflt">—</td><td class="desc">Let rows be dragged between grids. Off by default. <code>send</code> and <code>receive</code> are both on when present, so one-way is <code>{ receive: false }</code> or <code>{ send: false }</code>. <code>mode: 'copy'</code> leaves the row behind; <code>group</code> restricts which grids may exchange. See <a href="api-detail.html#row-transfer">Moving rows between grids</a>.</td></tr>
|
|
713
|
+
<tr><td class="name">alignedGrids</td><td class="type">Grid[]</td><td class="dflt">—</td><td class="desc">Other grids to stay column-aligned with. Widths, order, visibility, pinning and horizontal scroll are shared; sort, filters, selection and rows stay independent. Declare it on the grid created last. See <a href="api-detail.html#aligned-grids">Aligned grids</a>.</td></tr>
|
|
714
|
+
<tr><td class="name">stickyGroupHeaders</td><td class="type">boolean | number | { depth }</td><td class="dflt">true</td><td class="desc">Keep the enclosing group headings pinned above the viewport while scrolling inside a group. Stacks at most two by default; each costs a row of viewport. See <a href="api-detail.html#sticky-group-headings">Sticky group headings</a>.</td></tr>
|
|
715
|
+
<tr><td class="name">gridLines</td><td class="type">boolean | 'both' | 'horizontal' | 'vertical' | 'none'</td><td class="dflt">'horizontal'</td><td class="desc">Which rules are drawn between cells. Horizontal is what the grid has always drawn; vertical rules are additive. <code>'rows'</code> and <code>'columns'</code> are accepted aliases. Only the rules between data are affected — the header underline and pinned seams are structure.</td></tr>
|
|
716
|
+
<tr><td class="name">cornerRadius</td><td class="type">boolean | number | string</td><td class="dflt">—</td><td class="desc">Round the grid's outer corners. <code>true</code> adopts the theme's radius, a number is pixels, a string is used as written.</td></tr>
|
|
717
|
+
<tr><td class="name">columnTagFilter</td><td class="type">boolean | { multiple, label }</td><td class="dflt">—</td><td class="desc">A bar above the headings for showing only the columns carrying a chosen tag. Draws nothing unless some column has <code>tags</code>. See <a href="api-detail.html#column-tags">Column tags</a>.</td></tr>
|
|
718
|
+
<tr><td class="name">rowTemplate</td><td class="type">string | { template, cardsPerRow, maxCardWidth, gap, className, role, itemRole }</td><td class="dflt">—</td><td class="desc">Draw each row with a template instead of dividing it into columns — a card list, a feed, a search-result list. Compiles once; binds with <code>{{data.field}}</code>. <code>cardsPerRow</code> or <code>maxCardWidth</code> puts several on a line. The pipeline underneath is unchanged. See <a href="api-detail.html#cards">Cards, lists and feeds</a>.</td></tr>
|
|
719
|
+
<tr><td class="name">responsive</td><td class="type">{ maxWidth, template, rowHeight }</td><td class="dflt">—</td><td class="desc">Collapse to cards when the <em>container</em> is at or below <code>maxWidth</code> (640 by default), and return to a table above it. Sorting, filtering and export keep working. Emits <code>presentation:changed</code>. See <a href="api-detail.html#cards">Cards, lists and feeds</a>.</td></tr>
|
|
720
|
+
<tr><td class="name">rowForm</td><td class="type">boolean | { mode, load, fields, title, width, trigger, timeout, container }</td><td class="dflt">—</td><td class="desc">Open a row for editing on a form. <code>mode: 'drawer'</code> (default) or <code>'dialog'</code>; without <code>load</code> the fields are the grid's own columns. A field entry is <code>{ field, label, editor, type, props, lookup }</code> — any editor, including your own. Takes double-click on the row unless <code>trigger: false</code>. A load that has not answered within <code>timeout</code> milliseconds (2000; <code>false</code> waits indefinitely) is reported as a failure with a retry. <code>container</code> builds the form in an element of your own instead of over the grid. See <a href="api-detail.html#row-form">Editing a row on a form</a>.</td></tr>
|
|
721
|
+
<tr><td class="name">showColumnFunctions</td><td class="type">boolean</td><td class="dflt">true</td><td class="desc"><code>false</code> leaves each heading as its label, with no sort, filter or menu control. Those remain reachable through the API, the keyboard and the tool panel.</td></tr>
|
|
722
|
+
<tr><td class="name">significantFigures</td><td class="type">number</td><td class="dflt">—</td><td class="desc">On a unit column, render to this many significant figures rather than a fixed number of decimals, so precision is the same on every rung of the ladder. Rounding is applied before the unit is chosen. Set inside the unit configuration a data type is built from. See <a href="api-detail.html#units">Units</a>.</td></tr>
|
|
723
|
+
<tr><td class="name">typeOptions</td><td class="type">object</td><td class="dflt">—</td><td class="desc">Per-column options a data type reads. <code>ratio</code> and <code>percentRate</code> use <code>{ weight }</code> to name the column their average is weighted by. See <a href="api-detail.html#aggregate-safety">Aggregate safety</a>.</td></tr>
|
|
704
724
|
<tr><td class="name">highlightOnChange</td><td class="type">boolean | string | object</td><td class="desc">Flash a cell when its value changes. <code>{ colour, duration }</code>; <code>duration: 0</code> stays until cleared.</td></tr>
|
|
705
725
|
<tr><td class="name">rowClass</td><td class="type">string | string[] | (p) => …</td><td class="desc">A class, or classes, for every row. Re-evaluated on each repaint.</td></tr>
|
|
706
726
|
<tr><td class="name">rowStyle</td><td class="type">CellStyle | (p) => CellStyle</td><td class="desc">Inline styles for every row. Camel-case or hyphenated property names.</td></tr>
|
|
@@ -728,6 +748,7 @@
|
|
|
728
748
|
<tr><td class="name">title</td><td class="type">string</td><td class="desc">Header text. Defaults to a humanised <code>field</code>.</td></tr>
|
|
729
749
|
<tr><td class="name">type</td><td class="type">TypeName | false</td><td class="desc">A data type bundles format, parse, compare, storage, editor, filter, renderer and Excel behaviour. <code>false</code> disables inference. <code>'image'</code> treats the value as a URL and draws it — see <a href="#image-guide">image columns</a>.</td></tr>
|
|
730
750
|
<tr><td class="name">preset</td><td class="type">string | string[]</td><td class="desc">Named bundles from <code>columnPresets</code>.</td></tr>
|
|
751
|
+
<tr><td class="name">tags</td><td class="type">string | string[]</td><td class="dflt">—</td><td class="desc">Labels grouping columns together, used by the column tag bar. A bare string is accepted for one tag.</td></tr>
|
|
731
752
|
<tr><td class="name">format</td><td class="type">FormatSpec | string</td><td class="desc">Shorthand strings like <code>'percent:1'</code> or <code>'date:dd MMM yyyy'</code>.</td></tr>
|
|
732
753
|
<tr><td class="name">lookup</td><td class="type">LookupSpec</td><td class="desc">Id-to-label mapping. Nested <code>children</code> are flattened, so a tree-shaped list resolves labels everywhere.</td></tr>
|
|
733
754
|
<tr><td class="name">value</td><td class="type">ColumnValueSpec</td><td class="desc">Computed values and the value lifecycle.</td></tr>
|
|
@@ -820,11 +841,13 @@
|
|
|
820
841
|
<table>
|
|
821
842
|
<thead><tr><th>Member</th><th>Returns</th><th>Description</th></tr></thead>
|
|
822
843
|
<tbody>
|
|
823
|
-
<tr><td class="sig">getVersion()</td><td class="type">string</td><td class="desc">The version this grid came from, e.g. <code>'1.
|
|
844
|
+
<tr><td class="sig">getVersion()</td><td class="type">string</td><td class="desc">The version this grid came from, e.g. <code>'1.6.1'</code>. Also on the module as <code>getVersion()</code>, for when you have no grid to hand.</td></tr>
|
|
824
845
|
<tr><td class="sig">get(key)</td><td class="type">unknown</td><td class="desc">Read any configuration key.</td></tr>
|
|
825
846
|
<tr><td class="sig">set(key, value)</td><td class="type">void</td><td class="desc">Write one key. Every key is live; nothing needs a rebuild.</td></tr>
|
|
826
847
|
<tr><td class="sig">setAll(values)</td><td class="type">void</td><td class="desc">Write several in one pass. Emits one <code>config:changed</code> for the batch, not one per key.</td></tr>
|
|
827
848
|
<tr><td class="sig">config()</td><td class="type">GridConfig</td><td class="desc">The whole live configuration as a shallow copy. Pairs with <code>setAll</code> for a read–modify–write round trip. Nested objects are shared by reference, so treat it as read-only.</td></tr>
|
|
849
|
+
<tr><td class="sig">setPinnedRows(rows, opts?)</td><td class="type">void</td><td class="desc">Pin rows outside the scrolling body. <code>opts.edge</code> is <code>'top'</code> (the default) or <code>'bottom'</code>. Pass a new array rather than mutating the previous one — array identity is the change signal. See <a href="api-detail.html#pinned-rows">Pinned rows</a>.</td></tr>
|
|
850
|
+
<tr><td class="sig">getPinnedRows(opts?)</td><td class="type">object[]</td><td class="desc">The objects pinned at one edge, as a copy.</td></tr>
|
|
828
851
|
<tr><td class="sig">on(event, handler)</td><td class="type">() => void</td><td class="desc">Returns its own unsubscribe. <code>'*'</code> subscribes to everything.</td></tr>
|
|
829
852
|
<tr><td class="sig">once(event, handler)</td><td class="type">() => void</td><td class="desc"></td></tr>
|
|
830
853
|
<tr><td class="sig">off(event, handler)</td><td class="type">void</td><td class="desc"></td></tr>
|
|
@@ -867,6 +890,8 @@ grid.overlay.hide();</code></pre>
|
|
|
867
890
|
<tr><td class="sig">apply(change)</td><td class="type">object</td><td class="desc">Transactional add / update / remove. Needs <code>rowKey</code>.</td></tr>
|
|
868
891
|
<tr><td class="sig">queue(change)</td><td class="type">void</td><td class="desc">Batches a change into the next frame — the high-frequency path.</td></tr>
|
|
869
892
|
<tr><td class="sig">refresh(opts)</td><td class="type">void</td><td class="desc">Force re-evaluation of computed values and cells.</td></tr>
|
|
893
|
+
<tr><td class="sig">move(key, to)</td><td class="type">{ moved, from, to, reason? }</td><td class="desc">Move a row to another position in the data. Refuses, naming the reason, while a sort, filter or grouping is active. Emits <code>row:moved</code>; persisting the new order is yours.</td></tr>
|
|
894
|
+
<tr><td class="sig">groupHeadings(index)</td><td class="type">Row[]</td><td class="desc">The group rows enclosing a display index, outermost first. Empty when the grid is not grouped. Useful for a breadcrumb of your own.</td></tr>
|
|
870
895
|
<tr><td class="sig">expand(key, deep?)</td><td class="type">void</td><td class="desc"></td></tr>
|
|
871
896
|
<tr><td class="sig">collapse(key)</td><td class="type">void</td><td class="desc"></td></tr>
|
|
872
897
|
<tr><td class="sig">expandAll() / collapseAll()</td><td class="type">void</td><td class="desc"></td></tr>
|
|
@@ -894,7 +919,7 @@ grid.overlay.hide();</code></pre>
|
|
|
894
919
|
<tr><td class="sig">setTotal(id, fn)</td><td class="type">void</td><td class="desc">Change one column's aggregation. <code>null</code> stops totalling it.</td></tr>
|
|
895
920
|
<tr><td class="sig">distinct(id)</td><td class="type">unknown[]</td><td class="desc">Distinct values, read from the dictionary rather than by scanning rows.</td></tr>
|
|
896
921
|
<tr><td class="sig">state()</td><td class="type">ColumnState[]</td><td class="desc">Serialisable column state.</td></tr>
|
|
897
|
-
<tr><td class="sig">apply(state)</td><td class="type">
|
|
922
|
+
<tr><td class="sig">apply(state)</td><td class="type">StateApplyReport</td><td class="desc">Restore it. Never throws and never refuses: a saved view written against an older column set applies as much of itself as still makes sense, and the returned <code>{ applied, skipped }</code> names what it could not use and why. Columns added since the view was saved appear in their declared state, after the ones it names. See <a href="api-detail.html#views-guide">Saved views</a>.</td></tr>
|
|
898
923
|
</tbody>
|
|
899
924
|
</table>
|
|
900
925
|
</div>
|
|
@@ -964,6 +989,25 @@ grid.overlay.hide();</code></pre>
|
|
|
964
989
|
</table>
|
|
965
990
|
</div>
|
|
966
991
|
|
|
992
|
+
<h2 id="form">grid.form</h2>
|
|
993
|
+
<p class="section-note">
|
|
994
|
+
The row edit form — a drawer or dialog holding one control per field. Present whether or not
|
|
995
|
+
<code>rowForm</code> is configured; without it every method declines rather than throwing, so
|
|
996
|
+
a caller need not guard. See
|
|
997
|
+
<a href="api-detail.html#row-form">Editing a row on a form</a>.
|
|
998
|
+
</p>
|
|
999
|
+
<div class="table-wrap">
|
|
1000
|
+
<table>
|
|
1001
|
+
<thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead>
|
|
1002
|
+
<tbody>
|
|
1003
|
+
<tr><td class="sig">open(key)</td><td class="type">boolean</td><td class="desc">Open a row by key. False if there is no such row, or no form is configured.</td></tr>
|
|
1004
|
+
<tr><td class="sig">close()</td><td class="type">void</td><td class="desc">Close without saving. Focus returns to where it was.</td></tr>
|
|
1005
|
+
<tr><td class="sig">save()</td><td class="type">boolean</td><td class="desc">Commit the fields and close. False if a validator refused, or there is nothing to save.</td></tr>
|
|
1006
|
+
<tr><td class="sig">isOpen()</td><td class="type">boolean</td><td class="desc">Whether the panel is showing.</td></tr>
|
|
1007
|
+
</tbody>
|
|
1008
|
+
</table>
|
|
1009
|
+
</div>
|
|
1010
|
+
|
|
967
1011
|
<h2 id="pagination">grid.pagination</h2>
|
|
968
1012
|
<p class="section-note">
|
|
969
1013
|
A window over the rows the query already produced — not another query. A page change
|
|
@@ -986,8 +1030,10 @@ grid.overlay.hide();</code></pre>
|
|
|
986
1030
|
<thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead>
|
|
987
1031
|
<tbody>
|
|
988
1032
|
<tr><td class="sig">position()</td><td class="type">{ top, left }</td><td class="desc"></td></tr>
|
|
989
|
-
<tr><td class="sig">toRow(
|
|
1033
|
+
<tr><td class="sig">toRow(row, align?)</td><td class="type">void</td><td class="desc"><code>align</code>: <code>'start'</code>, <code>'centre'</code>, <code>'end'</code>.</td></tr>
|
|
990
1034
|
<tr><td class="sig">toColumn(id)</td><td class="type">void</td><td class="desc"></td></tr>
|
|
1035
|
+
<tr><td class="sig">to(at)</td><td class="type">void</td><td class="desc">Scroll to <code>{ top, left }</code>. <code>left</code> is the logical offset — zero at the content's start whichever way the grid reads.</td></tr>
|
|
1036
|
+
<tr><td class="sig">toCell(row, colId, align?)</td><td class="type">void</td><td class="desc">Scroll a cell into view, both axes in one call. <code>row</code> is a row key or a display index.</td></tr>
|
|
991
1037
|
</tbody>
|
|
992
1038
|
</table>
|
|
993
1039
|
</div>
|
|
@@ -2019,6 +2065,21 @@ createGrid(el, {
|
|
|
2019
2065
|
Returning an empty array suppresses the menu; returning nothing at all leaves the defaults
|
|
2020
2066
|
alone, so a missing <code>return</code> cannot silently delete the menu.</p>
|
|
2021
2067
|
|
|
2068
|
+
<p><code>columnMenu</code> takes the same form for the header's menu — both the 3-dot button
|
|
2069
|
+
and a right-click on a heading. Its <code>params</code> is
|
|
2070
|
+
<code>{ colId, column, grid }</code>. Anything of your own that you put on a column definition
|
|
2071
|
+
is on <code>column.def</code>, so an item can appear on some columns and not others.</p>
|
|
2072
|
+
<pre><code>createGrid(el, {
|
|
2073
|
+
columns: [{ field: 'jan', title: 'Jan', context: { month: 1 } }],
|
|
2074
|
+
columnMenu: (params, defaults) => {
|
|
2075
|
+
<span class="cmt">// Your own keys live on the definition you wrote.</span>
|
|
2076
|
+
<span class="kw">const</span> month = params.column.def.context?.month;
|
|
2077
|
+
<span class="kw">if</span> (!month) <span class="kw">return</span> defaults;
|
|
2078
|
+
<span class="kw">return</span> [...defaults, { separator: <span class="kw">true</span> },
|
|
2079
|
+
{ name: 'Select quarter', action: () => selectQuarter(month) }];
|
|
2080
|
+
},
|
|
2081
|
+
});</code></pre>
|
|
2082
|
+
|
|
2022
2083
|
<p>The rail takes host buttons the same way. A string names a built-in and an object is yours,
|
|
2023
2084
|
placed where it appears in the list rather than appended after the built-ins.</p>
|
|
2024
2085
|
<pre><code>createGrid(el, {
|
|
@@ -2070,7 +2131,7 @@ createGrid(el, {
|
|
|
2070
2131
|
<p class="section-note">Every registry accepts a custom entry under the same name, which then wins over ours.</p>
|
|
2071
2132
|
|
|
2072
2133
|
<h3>Data types</h3>
|
|
2073
|
-
<p>Seven built-in, and
|
|
2134
|
+
<p>Seven built-in, and seventy-four in the extended catalogue. Inference only ever reaches the built-in
|
|
2074
2135
|
names: the candidates are tried in registration order, and every string settles on
|
|
2075
2136
|
<code>text</code> and every number on <code>number</code> before an extended type is reached. So a
|
|
2076
2137
|
column asks for an extended type by name.</p>
|
|
@@ -2085,13 +2146,32 @@ createGrid(el, {
|
|
|
2085
2146
|
<span class="chip chip--new">binary</span><span class="chip chip--new">binary8</span><span class="chip chip--new">octal</span>
|
|
2086
2147
|
<span class="chip chip--new">bytes</span><span class="chip chip--new">megabytes</span><span class="chip chip--new">gigabytes</span>
|
|
2087
2148
|
<span class="chip chip--new">bitrate</span><span class="chip chip--new">gigabits</span>
|
|
2149
|
+
<span class="chip chip--new">metres</span><span class="chip chip--new">millimetres</span><span class="chip chip--new">kilometres</span>
|
|
2150
|
+
<span class="chip chip--new">grams</span><span class="chip chip--new">kilograms</span><span class="chip chip--new">tonnes</span>
|
|
2151
|
+
<span class="chip chip--new">seconds</span><span class="chip chip--new">milliseconds</span><span class="chip chip--new">hours</span>
|
|
2152
|
+
<span class="chip chip--new">speed</span><span class="chip chip--new">kph</span><span class="chip chip--new">mph</span><span class="chip chip--new">knots</span>
|
|
2153
|
+
<span class="chip chip--new">acceleration</span><span class="chip chip--new">area</span><span class="chip chip--new">hectares</span>
|
|
2154
|
+
<span class="chip chip--new">volume</span><span class="chip chip--new">cubicMetres</span>
|
|
2155
|
+
<span class="chip chip--new">energy</span><span class="chip chip--new">kilowattHours</span>
|
|
2156
|
+
<span class="chip chip--new">power</span><span class="chip chip--new">kilowatts</span><span class="chip chip--new">force</span>
|
|
2157
|
+
<span class="chip chip--new">pressure</span><span class="chip chip--new">bar</span><span class="chip chip--new">psi</span>
|
|
2158
|
+
<span class="chip chip--new">torque</span><span class="chip chip--new">density</span>
|
|
2159
|
+
<span class="chip chip--new">flow</span><span class="chip chip--new">litresPerMinute</span>
|
|
2160
|
+
<span class="chip chip--new">radians</span><span class="chip chip--new">degrees</span>
|
|
2161
|
+
<span class="chip chip--new">voltage</span><span class="chip chip--new">current</span><span class="chip chip--new">resistance</span>
|
|
2162
|
+
<span class="chip chip--new">capacitance</span><span class="chip chip--new">inductance</span><span class="chip chip--new">charge</span>
|
|
2163
|
+
<span class="chip chip--new">conductance</span><span class="chip chip--new">fluxDensity</span>
|
|
2164
|
+
<span class="chip chip--new">luminousFlux</span><span class="chip chip--new">illuminance</span><span class="chip chip--new">substance</span>
|
|
2165
|
+
<span class="chip chip--new">absorbedDose</span><span class="chip chip--new">equivalentDose</span><span class="chip chip--new">radioactivity</span>
|
|
2166
|
+
<span class="chip chip--new">frequency</span>
|
|
2167
|
+
<span class="chip chip--new">celsius</span><span class="chip chip--new">fahrenheit</span><span class="chip chip--new">kelvin</span>
|
|
2088
2168
|
</div>
|
|
2089
2169
|
|
|
2090
2170
|
<h3>Editors</h3>
|
|
2091
2171
|
<div class="chips">
|
|
2092
2172
|
<span class="chip">text</span><span class="chip">textarea</span><span class="chip">number</span><span class="chip">date</span><span class="chip">checkbox</span><span class="chip">select</span><span class="chip">multiSelect</span>
|
|
2093
2173
|
<span class="chip">time</span><span class="chip">datetime</span><span class="chip">duration</span><span class="chip">ipaddress</span><span class="chip">password</span><span class="chip">code</span>
|
|
2094
|
-
<span class="chip">unit</span><span class="chip">radix</span><span class="chip">slider</span><span class="chip">rating</span><span class="chip">segmented</span>
|
|
2174
|
+
<span class="chip">unit</span><span class="chip">temperature</span><span class="chip">radix</span><span class="chip">slider</span><span class="chip">rating</span><span class="chip">segmented</span>
|
|
2095
2175
|
<span class="chip">treeSelect</span><span class="chip">objectPicker</span><span class="chip">iconPicker</span><span class="chip">colour</span>
|
|
2096
2176
|
</div>
|
|
2097
2177
|
|
|
@@ -2158,7 +2238,7 @@ createGrid(el, {
|
|
|
2158
2238
|
</div>
|
|
2159
2239
|
|
|
2160
2240
|
<footer>
|
|
2161
|
-
Lattice Grid 1.
|
|
2241
|
+
Lattice Grid 1.6.1 · Copyright © 2026 TOCLOCO Inc. All rights reserved.
|
|
2162
2242
|
This document describes the behaviour of the shipped library. Where this guide and the code
|
|
2163
2243
|
disagree, the code wins — please <a href="https://www.latticegrid.dev">tell us</a>.
|
|
2164
2244
|
</footer>
|