@toclocoinc/lattice-grid 1.37.0 → 1.39.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 +1 -1
- package/docs/API.html +411 -13
- package/docs/api-detail.html +72 -1
- package/lattice-grid.d.ts +587 -17
- package/lattice-grid.esm.min.js +1203 -58
- package/lattice-grid.min.cjs +1200 -58
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +1200 -58
- package/modules/angular.esm.min.js +4 -2
- package/modules/angular.min.cjs +4 -2
- package/modules/angular.min.js +4 -2
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/charts.esm.min.js +467 -10
- package/modules/charts.min.cjs +467 -10
- package/modules/charts.min.js +467 -10
- package/modules/data-router.esm.min.js +184 -7
- package/modules/data-router.min.cjs +184 -7
- package/modules/data-router.min.js +184 -7
- package/modules/devtools.esm.min.js +2 -2
- package/modules/devtools.min.cjs +2 -2
- package/modules/devtools.min.js +2 -2
- package/modules/dhtmlx-compat.esm.min.js +4 -4
- package/modules/dhtmlx-compat.min.cjs +4 -4
- package/modules/dhtmlx-compat.min.js +4 -4
- package/modules/gantt.esm.min.js +845 -16
- package/modules/gantt.min.cjs +842 -16
- package/modules/gantt.min.js +842 -16
- package/modules/htmx.esm.min.js +1197 -58
- package/modules/htmx.min.cjs +1197 -58
- package/modules/htmx.min.js +1197 -58
- package/modules/kanban.esm.min.js +379 -5
- package/modules/kanban.min.cjs +379 -5
- package/modules/kanban.min.js +379 -5
- package/modules/kpi.esm.min.js +4 -4
- package/modules/kpi.min.cjs +4 -4
- package/modules/kpi.min.js +4 -4
- package/modules/mock-socket.esm.min.js +2 -2
- package/modules/mock-socket.min.cjs +2 -2
- package/modules/mock-socket.min.js +2 -2
- package/modules/react.esm.min.js +4 -2
- package/modules/react.min.cjs +4 -2
- package/modules/react.min.js +4 -2
- package/modules/svelte.esm.min.js +4 -2
- package/modules/svelte.min.cjs +4 -2
- package/modules/svelte.min.js +4 -2
- package/modules/vue.esm.min.js +4 -2
- package/modules/vue.min.cjs +4 -2
- package/modules/vue.min.js +4 -2
- package/modules/webcomponent.esm.min.js +1200 -58
- package/modules/webcomponent.min.cjs +1200 -58
- package/modules/webcomponent.min.js +1200 -58
- package/package.json +1 -1
package/docs/api-detail.html
CHANGED
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
<div class="shell">
|
|
438
438
|
<aside class="rail">
|
|
439
439
|
<p class="rail__brand">Lattice Grid</p>
|
|
440
|
-
<p class="rail__sub">Developer guide · v1.
|
|
440
|
+
<p class="rail__sub">Developer guide · v1.39.0</p>
|
|
441
441
|
<nav>
|
|
442
442
|
<div class="rail__group">
|
|
443
443
|
<span class="rail__label">Start here</span>
|
|
@@ -3370,6 +3370,54 @@ columns: [
|
|
|
3370
3370
|
}}</code></pre>
|
|
3371
3371
|
</div>
|
|
3372
3372
|
|
|
3373
|
+
<h3 id="declarative-validation">Declarative validation</h3>
|
|
3374
|
+
<p class="lead-in">
|
|
3375
|
+
The <code>edit.validate</code> function above is the imperative form. Where the rules are simple
|
|
3376
|
+
and the same across columns, declare them as data on <code>validation</code> instead
|
|
3377
|
+
(BACKLOG-0000956): <code>required</code>, <code>min</code>/<code>max</code>,
|
|
3378
|
+
<code>minLength</code>/<code>maxLength</code>, <code>pattern</code>, <code>oneOf</code>, and a
|
|
3379
|
+
<code>crossField</code> predicate. Each is checked <strong>before the write</strong>, riding the
|
|
3380
|
+
cancellable <code>beforeEdit</code> event: a failing value cancels the commit, marks the cell
|
|
3381
|
+
with the same accessible invalid state an editor rejection uses, and fires
|
|
3382
|
+
<code>validation:failed</code>. Correcting the value clears the mark and fires
|
|
3383
|
+
<code>validation:cleared</code>. Only a user edit is gated — a host API write is the authority
|
|
3384
|
+
and is never self-vetoed.
|
|
3385
|
+
</p>
|
|
3386
|
+
<div class="example">
|
|
3387
|
+
<p class="example__label">Rules as data</p>
|
|
3388
|
+
<pre><code>columns: [
|
|
3389
|
+
{ field: 'name', edit: true, validation: { required: true, minLength: 2 } },
|
|
3390
|
+
{ field: 'age', type: 'number', edit: true, validation: { min: 0, max: 120 } },
|
|
3391
|
+
{ field: 'code', edit: true, validation: { pattern: '^[A-Z]{3}$', messages: { pattern: 'Three capitals.' } } },
|
|
3392
|
+
]
|
|
3393
|
+
|
|
3394
|
+
<span class="cmt">// Why a write was refused, and clearing a mark by hand.</span>
|
|
3395
|
+
grid.validation.errorFor('r1', 'age'); <span class="cmt">// { code, message, key, colId } or null</span>
|
|
3396
|
+
grid.on('validation:failed', (e) => report(e.failures));
|
|
3397
|
+
grid.on('validation:cleared', () => refreshBanner());</code></pre>
|
|
3398
|
+
</div>
|
|
3399
|
+
|
|
3400
|
+
<h3 id="deleting-rows">Deleting rows</h3>
|
|
3401
|
+
<p class="lead-in">
|
|
3402
|
+
Set <code>rowDelete: true</code> for the built-in delete gesture: Delete or Backspace on the
|
|
3403
|
+
selected rows, and a "Delete row" item in the cell menu. It works on a memory grid, not only a
|
|
3404
|
+
remote one, and every deletion flows through the cancellable <code>beforeDelete</code> event —
|
|
3405
|
+
so a confirm dialog is a handler that calls <code>e.preventDefault(reason)</code>. It is off by
|
|
3406
|
+
default because deleting data on a keystroke is destructive.
|
|
3407
|
+
</p>
|
|
3408
|
+
<div class="example">
|
|
3409
|
+
<p class="example__label">Confirm before delete</p>
|
|
3410
|
+
<pre><code>const grid = createGrid(el, { columns, rows, rowKey: 'id', selection: 'multiple', rowDelete: true });
|
|
3411
|
+
|
|
3412
|
+
grid.on('beforeDelete', async (e) => {
|
|
3413
|
+
const ok = await confirmDialog(`Delete ${e.rows.length} row(s)?`);
|
|
3414
|
+
if (!ok) e.preventDefault('cancelled'); <span class="cmt">// the rows stay; delete:cancelled fires</span>
|
|
3415
|
+
});
|
|
3416
|
+
|
|
3417
|
+
<span class="cmt">// The gesture calls this; you can call it too. Defaults to the selection.</span>
|
|
3418
|
+
grid.edit.deleteRows();</code></pre>
|
|
3419
|
+
</div>
|
|
3420
|
+
|
|
3373
3421
|
<h2 id="appearance">Grid lines and corners</h2>
|
|
3374
3422
|
<p class="lead-in">
|
|
3375
3423
|
Two settings that change how the grid is drawn rather than what it draws.
|
|
@@ -6208,6 +6256,28 @@ grid.state.apply(savedView.state);
|
|
|
6208
6256
|
to CSV takes about 100ms.</p>
|
|
6209
6257
|
</div>
|
|
6210
6258
|
|
|
6259
|
+
<h2 id="import-guide">Import</h2>
|
|
6260
|
+
<p class="lead-in">
|
|
6261
|
+
The mirror of export: rows coming in from a CSV or TSV file, a drop, or a pasted spreadsheet
|
|
6262
|
+
block. The pipeline is parse, infer each column's type, map the columns onto your fields, then
|
|
6263
|
+
preview and confirm — nothing lands until the user says so.
|
|
6264
|
+
</p>
|
|
6265
|
+
<div class="example">
|
|
6266
|
+
<p class="example__label">Preview, then confirm</p>
|
|
6267
|
+
<pre><code><span class="cmt">// Parse and map without touching the grid — this is what the dialog shows.</span>
|
|
6268
|
+
<span class="kw">const</span> preview = grid.import.preview(csvText);
|
|
6269
|
+
<span class="cmt">// preview.columns is the mapping the user can edit; preview.warnings flags a</span>
|
|
6270
|
+
<span class="cmt">// ragged file. Confirming appends (or, with { mode: 'replace' }, swaps).</span>
|
|
6271
|
+
grid.import.apply(preview);</code></pre>
|
|
6272
|
+
</div>
|
|
6273
|
+
<p class="lead-in">
|
|
6274
|
+
Set <code>config.import</code> to <code>true</code> to add the DOM affordances — a
|
|
6275
|
+
"Import rows from CSV…" cell-menu item, a file drop target, and paste — each opening the same
|
|
6276
|
+
preview dialog. The <code>grid.import</code> API is present whether or not you do, so a server-side
|
|
6277
|
+
or headless import runs the identical pipeline. <code>.xlsx</code> is not read (it needs an inflate
|
|
6278
|
+
and XML reader the zero-dependency envelope does not carry); save the sheet as CSV.
|
|
6279
|
+
</p>
|
|
6280
|
+
|
|
6211
6281
|
<h2 id="less-common">Options and calls you may not have met</h2>
|
|
6212
6282
|
<p class="lead-in">
|
|
6213
6283
|
The rest of the surface, in one place. Each of these is documented in full in the
|
|
@@ -6469,6 +6539,7 @@ el.grid.sort.set([{ col: 'charge', dir: 'desc' }]);</code></pre>
|
|
|
6469
6539
|
<thead><tr><th>Event</th><th>Fires when</th></tr></thead>
|
|
6470
6540
|
<tbody>
|
|
6471
6541
|
<tr><td class="name">column:filter:open</td><td class="desc">Header filter popup opened.</td></tr>
|
|
6542
|
+
<tr><td class="name">column:profile:open</td><td class="desc">The column statistics ("describe") panel was asked to open on a column, from the column menu's "Column statistics" item (<code>{ colId }</code>). A mounted tool panel opens its <code>statistics</code> panel seeded on that column.</td></tr>
|
|
6472
6543
|
<tr><td class="name">column:grouped</td><td class="desc">The row-group column list changed.</td></tr>
|
|
6473
6544
|
<tr><td class="name">column:menu:open</td><td class="desc">Header menu opened.</td></tr>
|
|
6474
6545
|
<tr><td class="name">column:moved</td><td class="desc">Reordered by drag or by API.</td></tr>
|