@freegridjs/core 1.7.1 → 1.8.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/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, b as RowTransaction, L as LocalePack } from './types-D8F0nn1a.js';
2
- export { A as AdvancedFilter, c as AdvancedFilterCondition, d as Aggregator, e as AssistantAction, f as AssistantColumn, g as AssistantOptions, h as AssistantRequest, i as AssistantResult, C as CellEvent, j as CellParams, k as CellStyle, l as ChartHandle, m as ChartOptions, n as ColumnDef, o as ColumnState, p as ColumnType, q as CombinedFilterModel, r as ConditionalFormat, s as ConditionalFormatType, t as ConditionalOp, u as ContextMenuItem, v as ContextMenuParams, w as CustomEditor, x as DateFilterModel, y as DateOp, z as EditorParams, B as EditorSpec, F as FilterModel, H as FilterOp, I as FilterType, J as GridEvents, K as GridRange, M as InvalidCell, N as JsonExportOptions, O as KeyAction, P as Messages, Q as NumberFilterModel, S as NumberOp, T as PdfOptions, U as PivotConfig, V as PrintOptions, W as Region, X as RowDragOptions, Y as RowDropParams, Z as RowDropPosition, _ as SavedGridState, $ as SavedStatePart, a0 as ScrollPosition, a1 as SelectOption, a2 as ServerParams, a3 as SetFilterModel, a4 as SortDir, a5 as SortItem, a6 as SpanParams, a7 as SummaryCell, a8 as SummaryOptions, a9 as SummaryRowDef, aa as TextFilterModel, ab as TextOp, ac as TransactionResult, ad as XlsxCell, ae as XlsxSheet, af as readXlsx, ag as writeXlsx } from './types-D8F0nn1a.js';
1
+ import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, b as RowTransaction, L as LocalePack } from './types-Cda4EHUz.js';
2
+ export { A as AdvancedFilter, c as AdvancedFilterCondition, d as Aggregator, e as AssistantAction, f as AssistantColumn, g as AssistantOptions, h as AssistantRequest, i as AssistantResult, C as CellEvent, j as CellParams, k as CellStyle, l as ChartHandle, m as ChartOptions, n as ColumnDef, o as ColumnState, p as ColumnType, q as CombinedFilterModel, r as ConditionalFormat, s as ConditionalFormatType, t as ConditionalOp, u as ContextMenuItem, v as ContextMenuParams, w as CustomEditor, x as DateFilterModel, y as DateOp, z as EditorParams, B as EditorSpec, F as FilterModel, H as FilterOp, I as FilterType, J as GridEvents, K as GridRange, M as InvalidCell, N as JsonExportOptions, O as KeyAction, P as Messages, Q as NumberFilterModel, S as NumberOp, T as PdfOptions, U as PivotConfig, V as PrintOptions, W as Region, X as RowDragOptions, Y as RowDropParams, Z as RowDropPosition, _ as SavedGridState, $ as SavedStatePart, a0 as ScrollPosition, a1 as SelectOption, a2 as ServerParams, a3 as SetFilterModel, a4 as SortDir, a5 as SortItem, a6 as SpanParams, a7 as SummaryCell, a8 as SummaryOptions, a9 as SummaryRowDef, aa as TextFilterModel, ab as TextOp, ac as TransactionResult, ad as XlsxCell, ae as XlsxSheet, af as readXlsx, ag as writeXlsx } from './types-Cda4EHUz.js';
3
3
  export { default as en } from './locales/en.js';
4
4
 
5
5
  declare function createGrid(host: HTMLElement, options: GridOptions): GridApi;
6
6
 
7
7
  /** FreeGrid version (kept in sync with releases.json by scripts/release.mjs). */
8
- declare const version = "1.7.1";
8
+ declare const version = "1.8.0";
9
9
 
10
10
  interface LicenseInfo {
11
11
  /** Licensed domains (plus their www. host); `*.example.com` also covers every subdomain. */
package/dist/index.js CHANGED
@@ -3511,7 +3511,7 @@ function attachBody(grid) {
3511
3511
  grid.setFocus(ev.rowIndex, ev.colId);
3512
3512
  grid.setRange(null);
3513
3513
  }
3514
- if (grid.options.rowSelection && !dragged) {
3514
+ if (grid.options.rowSelection && !dragged && (onBox || grid.options.rowClickSelection !== false)) {
3515
3515
  grid.selectFromClick(ev.rowIndex, onBox || e.ctrlKey || e.metaKey, e.shiftKey);
3516
3516
  }
3517
3517
  grid.events.emit("cellClick", ev);
@@ -7604,7 +7604,7 @@ function buildPivot(source, config, defOf, labels, locale) {
7604
7604
  }
7605
7605
 
7606
7606
  // src/version.ts
7607
- var version = "1.7.1";
7607
+ var version = "1.8.0";
7608
7608
 
7609
7609
  // src/license.ts
7610
7610
  var PUBLIC_KEY = { kty: "EC", crv: "P-256", x: "sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE", y: "j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8" };
@@ -10173,6 +10173,15 @@ var Grid = class {
10173
10173
  }
10174
10174
  const update = (r, k, row) => {
10175
10175
  const orig = this.tracker.originals.get(row);
10176
+ if (r === row) {
10177
+ for (const field of Object.keys(r)) {
10178
+ if (orig) orig[field] = r[field];
10179
+ changed.fields.add(field);
10180
+ }
10181
+ changed.ids.add(k);
10182
+ result.updated.push(row);
10183
+ return;
10184
+ }
10176
10185
  for (const [field, value] of Object.entries(r)) {
10177
10186
  if (orig) orig[field] = value;
10178
10187
  const old = row[field];
@@ -11109,30 +11118,31 @@ var Grid = class {
11109
11118
  this.renderer.invalidate({ rows: true });
11110
11119
  }
11111
11120
  // ── edits, change tracking, undo ────────────────────────────
11112
- /** Write one cell, record it for undo, and emit cellValueChanged. Returns false when unchanged. */
11121
+ /** Write one cell and record it for undo; endCellTx emits cellValueChanged. Returns false when unchanged. */
11113
11122
  writeCell(changes, row, field, colId, rowIndex, value) {
11114
11123
  const oldValue = row[field];
11115
11124
  if (Object.is(oldValue, value)) return false;
11116
11125
  if (this.veto("beforeCellChange", { row, rowIndex, colId, oldValue, newValue: value })) return false;
11117
11126
  this.tracker.beforeChange(row);
11118
11127
  row[field] = value;
11119
- changes.push({ row, field, colId, oldValue, newValue: value });
11120
- this.events.emit("cellValueChanged", { row, rowIndex, colId, oldValue, newValue: value });
11128
+ changes.push({ row, field, colId, rowIndex, oldValue, newValue: value });
11121
11129
  return true;
11122
11130
  }
11123
- /** Finish a batch of cell writes: one undo step, refresh summary and repaint. */
11131
+ /** Finish a batch of cell writes: one undo step, refresh summary and repaint, then emit cellValueChanged. */
11124
11132
  endCellTx(changes) {
11125
11133
  if (!changes.length) return;
11126
11134
  const apply = (list, key) => {
11127
- for (const c of list) {
11135
+ const done = list.map((c) => {
11128
11136
  const from = c.row[c.field];
11129
11137
  c.row[c.field] = c[key];
11130
- this.events.emit("cellValueChanged", { row: c.row, rowIndex: this.rowModel.indexOfId(this.rowModel.idOf(c.row)), colId: c.colId, oldValue: from, newValue: c[key] });
11131
- }
11138
+ return { row: c.row, rowIndex: this.rowModel.indexOfId(this.rowModel.idOf(c.row)), colId: c.colId, oldValue: from, newValue: c[key] };
11139
+ });
11132
11140
  this.afterDataEdit();
11141
+ for (const e of done) this.events.emit("cellValueChanged", e);
11133
11142
  };
11134
11143
  this.history.push({ undo: () => apply([...changes].reverse(), "oldValue"), redo: () => apply(changes, "newValue") });
11135
11144
  this.afterDataEdit();
11145
+ for (const c of changes) this.events.emit("cellValueChanged", { row: c.row, rowIndex: c.rowIndex, colId: c.colId, oldValue: c.oldValue, newValue: c.newValue });
11136
11146
  }
11137
11147
  afterDataEdit() {
11138
11148
  this.renderer.invalidateHeights();
@@ -11536,7 +11546,8 @@ var Grid = class {
11536
11546
  this.treeLoaded.clear();
11537
11547
  this.treeLoading.clear();
11538
11548
  this.renderer.dropDetail();
11539
- this.store.set({ data: cleanRows(rows) });
11549
+ const clean = cleanRows(rows);
11550
+ this.store.set({ data: clean === this.store.state.data ? [...clean] : clean });
11540
11551
  if (options?.scrollToTop) this.renderer.setScroll({ top: 0, left: 0 });
11541
11552
  const sel = this.store.state.selected;
11542
11553
  if (sel.size) {
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const de: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const en: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const es: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const fr: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const id: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const it: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const ja: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const ko: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const ptBR: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const ru: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const th: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const vi: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const zhCN: LocalePack;
4
4
 
@@ -1,4 +1,4 @@
1
- import { L as LocalePack } from '../types-D8F0nn1a.js';
1
+ import { L as LocalePack } from '../types-Cda4EHUz.js';
2
2
 
3
3
  declare const zhTW: LocalePack;
4
4
 
@@ -741,6 +741,8 @@ interface GridOptions {
741
741
  rowHeight?: number;
742
742
  headerHeight?: number;
743
743
  rowSelection?: 'single' | 'multiple';
744
+ /** Clicking a cell selects its row (Ctrl/Cmd toggles, Shift extends). `false`: only the checkboxes and Space select. Default true. */
745
+ rowClickSelection?: boolean;
744
746
  getRowId?: (row: Row) => string;
745
747
  theme?: string;
746
748
  locale?: string | Partial<LocalePack>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freegridjs/core",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "FreeGrid — a fast data grid for the web (free for personal use): virtual scrolling, grouping, pivot, charts, Excel export, 7 languages.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",