@updog/data-editor-wc 0.1.45 → 0.1.46

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 +2 -1
  2. package/index.js +32 -30
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -109,6 +109,7 @@ declare var export_default = {
109
109
  modal: {
110
110
  importTitle: "Import Data",
111
111
  editTitle: "Edit Data",
112
+ viewTitle: "View Data",
112
113
  },
113
114
  confirmClose: {
114
115
  title: "Discard changes?",
@@ -1148,7 +1149,7 @@ type RemoteSource = {
1148
1149
  * - `"editor"` — opens directly into the spreadsheet grid.
1149
1150
  * - `"uploader"` — opens the file import wizard first, then transitions to the grid.
1150
1151
  */
1151
- type DataEditorVariant = "editor" | "uploader";
1152
+ type DataEditorVariant = "editor" | "uploader" | "viewer";
1152
1153
  /** Base configuration shared by the public `DataEditorProps` and the internal provider. */
1153
1154
  type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
1154
1155
  /** Column definitions. Each entry describes one column in the grid. */
package/index.js CHANGED
@@ -8097,7 +8097,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8097
8097
  dataEditor: {
8098
8098
  modal: {
8099
8099
  importTitle: "Import Data",
8100
- editTitle: "Edit Data"
8100
+ editTitle: "Edit Data",
8101
+ viewTitle: "View Data"
8101
8102
  },
8102
8103
  confirmClose: {
8103
8104
  title: "Discard changes?",
@@ -29868,6 +29869,7 @@ function Xm({ columns: e, primaryKey: t, loadData: n, scaleClient: r, onComplete
29868
29869
  setPendingImportFile: ve,
29869
29870
  openUploaderWithFile: ye,
29870
29871
  variant: a ?? "editor",
29872
+ isViewer: a === "viewer",
29871
29873
  search: ne,
29872
29874
  setSearch: re,
29873
29875
  matchCase: ie,
@@ -29883,7 +29885,7 @@ function Xm({ columns: e, primaryKey: t, loadData: n, scaleClient: r, onComplete
29883
29885
  resetScrollRef: z,
29884
29886
  scrollToGridTop: B,
29885
29887
  portalRef: me,
29886
- readonly: _ ?? !1,
29888
+ readonly: a === "viewer" ? !0 : _ ?? !1,
29887
29889
  filtersResetKey: de,
29888
29890
  resetFilters: fe,
29889
29891
  originalColumns: e,
@@ -31766,7 +31768,7 @@ var kg = 9, Ag = 3, jg = [3, 2], Mg = 1, Ng = 6, Pg = .8, Fg = .5, Ig = 4, Lg =
31766
31768
  paintHeaderCell(e, t, n) {
31767
31769
  let { ctx: r, theme: i, layout: a, textCache: o, columns: s, controller: c, sortState: l } = e, u = c.selection, d = a.pinnedCount, f = a.rtl, p = a.getColumnX(t, n), m = a.getColumnWidth(t), h = a.contentToCanvasX(p, m);
31768
31770
  u.isColumnSelected(t) ? (r.fillStyle = i.headerBgSelected, ag(r, h, 0, m, 36)) : u.isColumnHighlighted(t) && (r.fillStyle = i.headerBgActive, ag(r, h, 0, m, 36));
31769
- let g = s[t], _ = t < d, v = l?.columnId === g.id, y = e.store.isColumnLocked(g.id), b = 0;
31771
+ let g = s[t], _ = t < d, v = l?.columnId === g.id, y = !c.readonly && e.store.isColumnLocked(g.id), b = 0;
31770
31772
  y && b++, _ && b++, v && b++;
31771
31773
  let x = b > 0 ? b * 14 + (b - 1) * Ng + Ng : 0, S = m - kg * 2 - x;
31772
31774
  r.font = i.headerFont, r.fillStyle = i.headerContentIdle;
@@ -45475,39 +45477,39 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
45475
45477
  /* @__PURE__ */ (0, O.jsx)(pj, {})
45476
45478
  ]
45477
45479
  }) }), gj = () => {
45478
- let { store: e, columns: t, chat: n, enableAddRow: r, readonly: i, navigateToCell: a, importFormats: o, openUploaderWithFile: s } = $m(), { rowCount: c, filteredCount: l, isLoading: u } = ed(e), { t: d } = j(), f = !u && l === 0, p = r && !i && c === 0, m = o !== !1 && o.length > 0, h = (0, y.useCallback)(async () => {
45479
- a(await sh(e, t, d("dataEditor.dataSources.manuallyAdded")), t[0].id);
45480
+ let { store: e, columns: t, chat: n, enableAddRow: r, readonly: i, isViewer: a, navigateToCell: o, importFormats: s, openUploaderWithFile: c } = $m(), { rowCount: l, filteredCount: u, isLoading: d } = ed(e), { t: f } = j(), p = !d && u === 0, m = r && !i && l === 0, h = s !== !1 && s.length > 0, g = (0, y.useCallback)(async () => {
45481
+ o(await sh(e, t, f("dataEditor.dataSources.manuallyAdded")), t[0].id);
45480
45482
  }, [
45481
45483
  e,
45482
45484
  t,
45483
- a,
45484
- d
45485
- ]), g = (0, y.useMemo)(() => {
45486
- if (p) return {
45487
- content: d("dataEditor.dataSources.addRow"),
45485
+ o,
45486
+ f
45487
+ ]), _ = (0, y.useMemo)(() => {
45488
+ if (m) return {
45489
+ content: f("dataEditor.dataSources.addRow"),
45488
45490
  startIcon: /* @__PURE__ */ (0, O.jsx)(Ae, { size: "1rem" }),
45489
45491
  variant: "filled",
45490
- onClick: h
45492
+ onClick: g
45491
45493
  };
45492
45494
  }, [
45493
- p,
45494
- h,
45495
- d
45496
- ]), _ = (0, y.useMemo)(() => th(o === !1 ? [] : o), [o]), v = (0, y.useCallback)((e) => {
45495
+ m,
45496
+ g,
45497
+ f
45498
+ ]), v = (0, y.useMemo)(() => th(s === !1 ? [] : s), [s]), b = (0, y.useCallback)((e) => {
45497
45499
  let t = e[0];
45498
- t && s(t);
45499
- }, [s]), { getRootProps: b, isDragActive: x } = Xu({
45500
- accept: _,
45500
+ t && c(t);
45501
+ }, [c]), { getRootProps: x, isDragActive: S } = Xu({
45502
+ accept: v,
45501
45503
  maxFiles: 1,
45502
45504
  noClick: !0,
45503
45505
  noKeyboard: !0,
45504
- disabled: i || !m,
45505
- onDrop: v
45506
+ disabled: i || !h,
45507
+ onDrop: b
45506
45508
  });
45507
45509
  return /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
45508
- ...b({ className: "updog__data-editor-inner" }),
45510
+ ...x({ className: "updog__data-editor-inner" }),
45509
45511
  children: [
45510
- /* @__PURE__ */ (0, O.jsx)(nh, { children: /* @__PURE__ */ (0, O.jsx)("div", {
45512
+ !a && /* @__PURE__ */ (0, O.jsx)(nh, { children: /* @__PURE__ */ (0, O.jsx)("div", {
45511
45513
  className: "updog__data-editor-aside",
45512
45514
  children: /* @__PURE__ */ (0, O.jsxs)("div", {
45513
45515
  className: "updog__data-editor-aside__content updog__scrollbar",
@@ -45521,18 +45523,18 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
45521
45523
  /* @__PURE__ */ (0, O.jsxs)(rh, { children: [
45522
45524
  /* @__PURE__ */ (0, O.jsxs)("div", {
45523
45525
  className: "updog__data-editor-grid-area",
45524
- children: [/* @__PURE__ */ (0, O.jsx)(TA, {}), f && /* @__PURE__ */ (0, O.jsx)(ac, {
45526
+ children: [/* @__PURE__ */ (0, O.jsx)(TA, {}), p && /* @__PURE__ */ (0, O.jsx)(ac, {
45525
45527
  className: "updog-grid__empty-state",
45526
- title: d("dataEditor.grid.emptyTitle"),
45527
- text: d("dataEditor.grid.emptyText"),
45528
- buttonProps: g
45528
+ title: f("dataEditor.grid.emptyTitle"),
45529
+ text: f("dataEditor.grid.emptyText"),
45530
+ buttonProps: _
45529
45531
  })]
45530
45532
  }),
45531
45533
  /* @__PURE__ */ (0, O.jsx)(oh, {}),
45532
- /* @__PURE__ */ (0, O.jsx)(Yh, {})
45534
+ !a && /* @__PURE__ */ (0, O.jsx)(Yh, {})
45533
45535
  ] }),
45534
- x && /* @__PURE__ */ (0, O.jsx)(ih, {}),
45535
- n && /* @__PURE__ */ (0, O.jsx)(hj, {})
45536
+ S && /* @__PURE__ */ (0, O.jsx)(ih, {}),
45537
+ n && !a && /* @__PURE__ */ (0, O.jsx)(hj, {})
45536
45538
  ]
45537
45539
  }) });
45538
45540
  }, _j = "RENDER_ERROR", vj = (e) => {
@@ -48207,7 +48209,7 @@ function _N(e) {
48207
48209
  g,
48208
48210
  v,
48209
48211
  e.readonly
48210
- ]), x = (0, y.useCallback)(() => v?.(), [v]), S = n(f ? "dataEditor.modal.importTitle" : "dataEditor.modal.editTitle");
48212
+ ]), x = (0, y.useCallback)(() => v?.(), [v]), S = f ? n("dataEditor.modal.importTitle") : e.variant === "viewer" ? n("dataEditor.modal.viewTitle") : n("dataEditor.modal.editTitle");
48211
48213
  (0, y.useEffect)(() => {
48212
48214
  t === "modal" && !o && p(e.variant === "uploader");
48213
48215
  }, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@updog/data-editor-wc",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Client-side CSV importer and spreadsheet editor as a Web Component. Drop into Vue, Angular, Svelte, or vanilla JS. Import CSV, Excel, JSON; edit 1M+ rows entirely in the browser.",
5
5
  "author": "Mikhail Kutateladze <admin@updog.tech>",
6
6
  "homepage": "https://updog.tech",