@updog/data-editor 0.1.60 → 0.1.61

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +56 -53
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2942,6 +2942,7 @@ type DataStoreSnapshot = {
2942
2942
  /** Details about the in-progress operation. Null when phase is "idle". */
2943
2943
  processing: ProcessingInfo | null;
2944
2944
  sources: DataSourceState[];
2945
+ hasBaselineData: boolean;
2945
2946
  canUndo: boolean;
2946
2947
  canRedo: boolean;
2947
2948
  /** Increments on undo/redo to force canvas grid re-render */
package/index.js CHANGED
@@ -6470,6 +6470,7 @@ var Gc = class {
6470
6470
  phase: "idle",
6471
6471
  processing: null,
6472
6472
  sources: [],
6473
+ hasBaselineData: !1,
6473
6474
  canUndo: !1,
6474
6475
  canRedo: !1,
6475
6476
  version: 0,
@@ -6530,9 +6531,9 @@ var Gc = class {
6530
6531
  return;
6531
6532
  }
6532
6533
  this._countsDirty && (this.recomputeVisibleCounts(e), this._filteredCountsDirty = !0), this._filteredCountsDirty && this.recomputeFilteredCounts(e);
6533
- let t = e.getFilteredRowIds()?.length ?? e.getRowCount(), n = e.getPendingValidationCount(), r = e.getShowOnlyDeletedRows(), i = e.getServerDeletedCount ? e.getServerDeletedCount() : e.getDeletedCount();
6534
+ let t = e.getFilteredRowIds()?.length ?? e.getRowCount(), n = e.getPendingValidationCount(), r = e.getShowOnlyDeletedRows(), i = e.getServerDeletedCount ? e.getServerDeletedCount() : e.getDeletedCount(), a = r ? i : e.getRowCount(), o = e.getSources(), s = o.some((e) => e.isInitialData && e.rowCount > 0);
6534
6535
  this.snapshot = {
6535
- rowCount: r ? i : e.getRowCount(),
6536
+ rowCount: a,
6536
6537
  filteredCount: t,
6537
6538
  newRowCount: this._visibleNewCount,
6538
6539
  editedRowCount: this._visibleEditedCount,
@@ -6553,7 +6554,8 @@ var Gc = class {
6553
6554
  isFiltering: e.isFiltering(),
6554
6555
  phase: this._phase,
6555
6556
  processing: this._processingInfo,
6556
- sources: e.getSources(),
6557
+ sources: o,
6558
+ hasBaselineData: s,
6557
6559
  canUndo: e.canUndo(),
6558
6560
  canRedo: e.canRedo(),
6559
6561
  version: e.getVersion(),
@@ -11902,18 +11904,18 @@ var fd = [3, 2], pd = .8, md = .5, hd = 1500;
11902
11904
  //#endregion
11903
11905
  //#region src/components/DataEditor/DataEditorGrid/engine/paint/FrameState.ts
11904
11906
  function gd(e) {
11905
- let { controller: t, layout: n, viewport: r, store: i, columns: a } = e, o = t.selection, s = t.clipboard.getClipboardOperation(), c = t.clipboard.getClipboardBounds(), l = i.getSnapshot().filteredCount, u = r.getVisibleRowRange(l), d = {
11906
- start: u.start,
11907
- end: u.end
11908
- }, f = r.getVisibleColRange(n, a.length), p = {
11909
- start: f.start,
11910
- end: f.end
11911
- }, m = n.pinnedCount, h = null;
11912
- if (m > 0) {
11907
+ let { controller: t, layout: n, viewport: r, store: i, columns: a } = e, o = t.selection, s = t.clipboard.getClipboardOperation(), c = t.clipboard.getClipboardBounds(), l = i.getSnapshot(), u = l.filteredCount, d = r.getVisibleRowRange(u), f = {
11908
+ start: d.start,
11909
+ end: d.end
11910
+ }, p = r.getVisibleColRange(n, a.length), m = {
11911
+ start: p.start,
11912
+ end: p.end
11913
+ }, h = n.pinnedCount, g = null;
11914
+ if (h > 0) {
11913
11915
  let e = n.getPinnedWidth(), t = n.contentToCanvasX(76, e);
11914
- h = {
11916
+ g = {
11915
11917
  colStart: 0,
11916
- colEnd: m,
11918
+ colEnd: h,
11917
11919
  scrollLeft: 0,
11918
11920
  clip: {
11919
11921
  x: t,
@@ -11939,10 +11941,10 @@ function gd(e) {
11939
11941
  findReplace: e.findReplace,
11940
11942
  time: e.time,
11941
11943
  resizeGuideX: e.resizeGuideX,
11942
- totalRows: l,
11944
+ totalRows: u,
11943
11945
  totalWidth: n.getTotalWidth(),
11944
- rowRange: d,
11945
- colRange: p,
11946
+ rowRange: f,
11947
+ colRange: m,
11946
11948
  selection: o.getSnapshot(),
11947
11949
  rowSelected: (e) => o.isRowSelected(e),
11948
11950
  rowHighlighted: (e) => o.isRowHighlighted(e),
@@ -11958,17 +11960,18 @@ function gd(e) {
11958
11960
  searchLength: e.findReplace?.getSearchLength() ?? 0,
11959
11961
  panes: {
11960
11962
  scrollable: {
11961
- colStart: p.start,
11962
- colEnd: p.end,
11963
+ colStart: m.start,
11964
+ colEnd: m.end,
11963
11965
  scrollLeft: r.scrollLeft,
11964
11966
  clip: null,
11965
11967
  shimmerWidth: r.viewportWidth,
11966
11968
  shimmerOffsetX: 0
11967
11969
  },
11968
- pinned: h
11970
+ pinned: g
11969
11971
  },
11970
11972
  hasSkeletons: !1,
11971
- hasPendingCells: !1
11973
+ hasPendingCells: !1,
11974
+ hasBaselineData: l.hasBaselineData
11972
11975
  };
11973
11976
  }
11974
11977
  function _d(e, t, n) {
@@ -12185,26 +12188,26 @@ var Od = class {
12185
12188
  }
12186
12189
  }, kd = class {
12187
12190
  paint(e) {
12188
- let { ctx: t, theme: n, layout: r, viewport: i, textCache: a, store: o, rowRange: s } = e, { scrollTop: c, viewportHeight: l } = i, u = r.rtl, d = r.getMarkerCanvasX(), f = o.getFilters().showOnlyDeletedRows;
12189
- t.fillStyle = n.markerBgIdle, Vu(t, d, 36, 76, l - 36);
12191
+ let { ctx: t, theme: n, layout: r, viewport: i, textCache: a, store: o, rowRange: s, hasBaselineData: c } = e, { scrollTop: l, viewportHeight: u } = i, d = r.rtl, f = r.getMarkerCanvasX(), p = o.getFilters().showOnlyDeletedRows;
12192
+ t.fillStyle = n.markerBgIdle, Vu(t, f, 36, 76, u - 36);
12190
12193
  for (let i = s.start; i < s.end; i++) {
12191
- let s = r.getRowY(i, c), l = o.getRowId(i);
12192
- if (e.rowSelected(i) ? (t.fillStyle = n.markerBgSelected, Vu(t, d, s, 76, 34)) : e.rowHighlighted(i) && (t.fillStyle = n.markerBgActive, Vu(t, d, s, 76, 34)), l !== void 0) {
12193
- let e = u ? d : 73;
12194
- if (o.hasRowErrors(l)) t.fillStyle = n.statusBarBgError, Vu(t, e, s, 3, 34);
12195
- else if (!f && o.hasRowMisplaced(l)) {
12194
+ let s = r.getRowY(i, l), u = o.getRowId(i);
12195
+ if (e.rowSelected(i) ? (t.fillStyle = n.markerBgSelected, Vu(t, f, s, 76, 34)) : e.rowHighlighted(i) && (t.fillStyle = n.markerBgActive, Vu(t, f, s, 76, 34)), u !== void 0) {
12196
+ let e = d ? f : 73;
12197
+ if (o.hasRowErrors(u)) t.fillStyle = n.statusBarBgError, Vu(t, e, s, 3, 34);
12198
+ else if (!p && o.hasRowMisplaced(u)) {
12196
12199
  let r = Uu(e + 3 / 2, 0, 3).x;
12197
12200
  t.strokeStyle = n.cellBorderMisplaced, t.lineWidth = 3, t.setLineDash(fd), t.beginPath(), t.moveTo(r, s), t.lineTo(r, s + 34), t.stroke(), t.setLineDash([]);
12198
- } else o.isEdited(l) ? (t.fillStyle = n.statusBarBgEdited, Vu(t, e, s, 3, 34)) : o.isNew(l) ? (t.fillStyle = n.statusBarBgNew, Vu(t, e, s, 3, 34)) : o.hasEmptyCells(l) && (t.fillStyle = n.statusBarBgEmpty, Vu(t, e, s, 3, 34));
12201
+ } else o.isEdited(u) ? (t.fillStyle = n.statusBarBgEdited, Vu(t, e, s, 3, 34)) : c && o.isNew(u) ? (t.fillStyle = n.statusBarBgNew, Vu(t, e, s, 3, 34)) : o.hasEmptyCells(u) && (t.fillStyle = n.statusBarBgEmpty, Vu(t, e, s, 3, 34));
12199
12202
  }
12200
- t.font = n.font, t.fillStyle = n.markerContentIdle, Ku(t, String(i + 1), d + 76 / 2, s + 34 / 2 + 2, 58, a, "center");
12203
+ t.font = n.font, t.fillStyle = n.markerContentIdle, Ku(t, String(i + 1), f + 76 / 2, s + 34 / 2 + 2, 58, a, "center");
12201
12204
  }
12202
12205
  t.strokeStyle = n.cellBorderIdle, t.lineWidth = 1, t.beginPath();
12203
- let p = u ? Uu(d, 0, 1).x : Uu(76, 0, 1).x;
12204
- t.moveTo(p, 36), t.lineTo(p, l);
12206
+ let m = d ? Uu(f, 0, 1).x : Uu(76, 0, 1).x;
12207
+ t.moveTo(m, 36), t.lineTo(m, u);
12205
12208
  for (let e = s.start; e <= s.end; e++) {
12206
- let n = Uu(0, r.getRowY(e, c), 1).y;
12207
- t.moveTo(d, n), t.lineTo(d + 76, n);
12209
+ let n = Uu(0, r.getRowY(e, l), 1).y;
12210
+ t.moveTo(f, n), t.lineTo(f + 76, n);
12208
12211
  }
12209
12212
  t.stroke();
12210
12213
  }
@@ -20628,21 +20631,21 @@ var $_ = {
20628
20631
  })
20629
20632
  });
20630
20633
  }, pv = () => {
20631
- let { store: e, scrollToGridTop: t, filtersResetKey: n, enableDeleteRow: r } = X(), { t: i } = K(), { filteredNewRowCount: a, filteredEditedRowCount: o, filteredEmptyRowCount: s, misplacedRowCount: c, deletedRowCount: l } = Vo(e), [u, d] = b(() => e.getFilters().showOnlyEditedRows), [p, h] = b(() => e.getFilters().showOnlyNewRows), [g, _] = b(() => e.getFilters().showOnlyEmptyCells), [v, y] = b(() => e.getFilters().showOnlyMisplacedRows), [x, S] = b(() => e.getFilters().showOnlyDeletedRows);
20634
+ let { store: e, scrollToGridTop: t, filtersResetKey: n, enableDeleteRow: r } = X(), { t: i } = K(), { filteredNewRowCount: a, filteredEditedRowCount: o, filteredEmptyRowCount: s, misplacedRowCount: c, deletedRowCount: l, hasBaselineData: u } = Vo(e), [d, p] = b(() => e.getFilters().showOnlyEditedRows), [h, g] = b(() => e.getFilters().showOnlyNewRows), [_, v] = b(() => e.getFilters().showOnlyEmptyCells), [y, x] = b(() => e.getFilters().showOnlyMisplacedRows), [S, T] = b(() => e.getFilters().showOnlyDeletedRows);
20632
20635
  m(() => {
20633
20636
  let t = e.getFilters();
20634
- d(t.showOnlyEditedRows), h(t.showOnlyNewRows), _(t.showOnlyEmptyCells), y(t.showOnlyMisplacedRows), S(t.showOnlyDeletedRows);
20637
+ p(t.showOnlyEditedRows), g(t.showOnlyNewRows), v(t.showOnlyEmptyCells), x(t.showOnlyMisplacedRows), T(t.showOnlyDeletedRows);
20635
20638
  }, [n, e]);
20636
- let T = f((n) => {
20637
- d(n), t(), e.setFilters({ showOnlyEditedRows: n });
20638
- }, [t, e]), E = f((n) => {
20639
- h(n), t(), e.setFilters({ showOnlyNewRows: n });
20639
+ let E = f((n) => {
20640
+ p(n), t(), e.setFilters({ showOnlyEditedRows: n });
20640
20641
  }, [t, e]), D = f((n) => {
20641
- _(n), t(), e.setFilters({ showOnlyEmptyCells: n });
20642
+ g(n), t(), e.setFilters({ showOnlyNewRows: n });
20642
20643
  }, [t, e]), O = f((n) => {
20643
- y(n), t(), e.setFilters({ showOnlyMisplacedRows: n });
20644
+ v(n), t(), e.setFilters({ showOnlyEmptyCells: n });
20644
20645
  }, [t, e]), k = f((n) => {
20645
- S(n), t(), e.setFilters({ showOnlyDeletedRows: n });
20646
+ x(n), t(), e.setFilters({ showOnlyMisplacedRows: n });
20647
+ }, [t, e]), A = f((n) => {
20648
+ T(n), t(), e.setFilters({ showOnlyDeletedRows: n });
20646
20649
  }, [t, e]);
20647
20650
  return /* @__PURE__ */ w("div", {
20648
20651
  className: "updog__rows-section",
@@ -20654,8 +20657,8 @@ var $_ = {
20654
20657
  children: [
20655
20658
  /* @__PURE__ */ C(fv, { filtersResetKey: n }),
20656
20659
  /* @__PURE__ */ C(Ni, {
20657
- checked: u,
20658
- onChange: T,
20660
+ checked: d,
20661
+ onChange: E,
20659
20662
  checkboxPosition: "start",
20660
20663
  children: /* @__PURE__ */ w("div", {
20661
20664
  className: "updog__rows-section__checkbox-label",
@@ -20669,9 +20672,9 @@ var $_ = {
20669
20672
  })]
20670
20673
  })
20671
20674
  }),
20672
- /* @__PURE__ */ C(Ni, {
20673
- checked: p,
20674
- onChange: E,
20675
+ u && /* @__PURE__ */ C(Ni, {
20676
+ checked: h,
20677
+ onChange: D,
20675
20678
  checkboxPosition: "start",
20676
20679
  children: /* @__PURE__ */ w("div", {
20677
20680
  className: "updog__rows-section__checkbox-label",
@@ -20686,8 +20689,8 @@ var $_ = {
20686
20689
  })
20687
20690
  }),
20688
20691
  /* @__PURE__ */ C(Ni, {
20689
- checked: g,
20690
- onChange: D,
20692
+ checked: _,
20693
+ onChange: O,
20691
20694
  checkboxPosition: "start",
20692
20695
  children: /* @__PURE__ */ w("div", {
20693
20696
  className: "updog__rows-section__checkbox-label",
@@ -20702,8 +20705,8 @@ var $_ = {
20702
20705
  })
20703
20706
  }),
20704
20707
  /* @__PURE__ */ C(Ni, {
20705
- checked: v,
20706
- onChange: O,
20708
+ checked: y,
20709
+ onChange: k,
20707
20710
  checkboxPosition: "start",
20708
20711
  children: /* @__PURE__ */ w("div", {
20709
20712
  className: "updog__rows-section__checkbox-label",
@@ -20718,8 +20721,8 @@ var $_ = {
20718
20721
  })
20719
20722
  }),
20720
20723
  r !== !1 && /* @__PURE__ */ C(Ni, {
20721
- checked: x,
20722
- onChange: k,
20724
+ checked: S,
20725
+ onChange: A,
20723
20726
  checkboxPosition: "start",
20724
20727
  children: /* @__PURE__ */ w("div", {
20725
20728
  className: "updog__rows-section__checkbox-label",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@updog/data-editor",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "Client-side CSV importer and spreadsheet editor for React. Import CSV, Excel, JSON, TSV, and XML, match columns, validate, and edit 1M+ rows entirely in the browser.",
5
5
  "author": "Mikhail Kutateladze <admin@updog.tech>",
6
6
  "homepage": "https://updog.tech",