@updog/data-editor 0.1.16 → 0.1.17

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 +4 -4
  2. package/index.js +48 -48
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2888,9 +2888,9 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
2888
2888
  enableAddRow?: boolean;
2889
2889
  /**
2890
2890
  * Which file formats the user can import. `undefined` allows all formats,
2891
- * `[]` disables import entirely.
2891
+ * `false` disables import entirely.
2892
2892
  */
2893
- importFormats?: DataEditorFormat[];
2893
+ importFormats?: DataEditorFormat[] | false;
2894
2894
  /**
2895
2895
  * Client-defined remote data sources rendered as buttons on the upload
2896
2896
  * step. You own the integration; the SDK renders the button and processes
@@ -2899,9 +2899,9 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
2899
2899
  remoteSources?: RemoteSource[];
2900
2900
  /**
2901
2901
  * Which file formats the user can export to. `undefined` allows all
2902
- * formats, `[]` disables export entirely.
2902
+ * formats, `false` disables export entirely.
2903
2903
  */
2904
- exportFormats?: DataEditorFormat[];
2904
+ exportFormats?: DataEditorFormat[] | false;
2905
2905
  /** Row height in pixels. @default 34 */
2906
2906
  rowHeight?: number;
2907
2907
  /** Header row height in pixels. @default 36 */
package/index.js CHANGED
@@ -13127,8 +13127,8 @@ var Rh = ({ open: e, onClose: t, onConfirm: n, loading: r = !1 }) => {
13127
13127
  z,
13128
13128
  B,
13129
13129
  H
13130
- ]), U = r.length > 0 && (!e.isServer() || e.hasServerExport), te = v(() => {
13131
- let e = ee.filter((e) => r.includes(e.format));
13130
+ ]), U = r !== !1 && (!e.isServer() || e.hasServerExport), te = v(() => {
13131
+ let e = r === !1 ? [] : ee.filter((e) => r.includes(e.format));
13132
13132
  return [{
13133
13133
  id: "export-all",
13134
13134
  text: F,
@@ -21722,7 +21722,7 @@ var KS = ({ source: e }) => {
21722
21722
  }, qS = () => {
21723
21723
  let { store: e, columns: t, navigateToCell: n, navigateToCellRef: r, setShowUploader: i, enableAddRow: a, importFormats: o, readonly: s } = X(), { t: c } = q(), { sources: l, phase: u } = Mo(e), d = u !== "idle", p = v(() => {
21724
21724
  let e = [];
21725
- return o.length > 0 && e.push({
21725
+ return o !== !1 && o.length > 0 && e.push({
21726
21726
  id: "import_data",
21727
21727
  text: c("dataEditor.dataSources.importData"),
21728
21728
  icon: /* @__PURE__ */ C(Ie, { size: "1rem" })
@@ -21759,7 +21759,7 @@ var KS = ({ source: e }) => {
21759
21759
  n,
21760
21760
  r,
21761
21761
  c
21762
- ]), h = c("dataEditor.dataSources.addDataSource"), g = !s && (a || o.length > 0) ? /* @__PURE__ */ C(Ma, {
21762
+ ]), h = c("dataEditor.dataSources.addDataSource"), g = !s && (a || o !== !1 && o.length > 0) ? /* @__PURE__ */ C(Ma, {
21763
21763
  options: p,
21764
21764
  onSelect: m,
21765
21765
  placement: "bottom-end",
@@ -24133,7 +24133,7 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24133
24133
  title: e.description,
24134
24134
  children: e.label
24135
24135
  }), vw = () => {
24136
- let { importFormats: e, remoteSources: t } = X(), { t: n } = q(), { remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = aT();
24136
+ let { importFormats: e, remoteSources: t } = X(), n = e === !1 ? [] : e, { t: r } = q(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = aT();
24137
24137
  return /* @__PURE__ */ w("div", {
24138
24138
  className: "updog__source-picker",
24139
24139
  children: [
@@ -24146,108 +24146,108 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24146
24146
  size: "sm",
24147
24147
  weight: "medium",
24148
24148
  className: "updog__source-picker__link",
24149
- children: n("dataEditor.uploader.uploadFile.clickToUpload")
24149
+ children: r("dataEditor.uploader.uploadFile.clickToUpload")
24150
24150
  }), /* @__PURE__ */ C(J, {
24151
24151
  as: "span",
24152
24152
  size: "sm",
24153
- children: n("dataEditor.uploader.uploadFile.orDragAndDrop")
24153
+ children: r("dataEditor.uploader.uploadFile.orDragAndDrop")
24154
24154
  })]
24155
24155
  }), /* @__PURE__ */ C(J, {
24156
24156
  as: "span",
24157
24157
  size: "xs",
24158
- children: e.map((e) => e.toUpperCase()).join(", ")
24158
+ children: n.map((e) => e.toUpperCase()).join(", ")
24159
24159
  })]
24160
24160
  }),
24161
24161
  t.length > 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Ea, {}), /* @__PURE__ */ C("div", {
24162
24162
  className: "updog__source-picker__sources-list",
24163
24163
  children: t.map((e) => /* @__PURE__ */ C(_w, {
24164
24164
  source: e,
24165
- loading: r === e.id,
24166
- disabled: !!r,
24167
- onSelect: a
24165
+ loading: i === e.id,
24166
+ disabled: !!i,
24167
+ onSelect: o
24168
24168
  }, e.id))
24169
24169
  })] }),
24170
- i && /* @__PURE__ */ C(J, {
24170
+ a && /* @__PURE__ */ C(J, {
24171
24171
  size: "sm",
24172
24172
  className: "updog__source-picker__error",
24173
- children: i
24173
+ children: a
24174
24174
  })
24175
24175
  ]
24176
24176
  });
24177
24177
  }, yw = () => {
24178
- let { columns: e, importFormats: t, sampleData: n } = X(), { t: r } = q(), { parsedCsv: i, xlsxFile: a, handleFileRemoved: o, parseFile: s } = aT(), c = [
24178
+ let { columns: e, importFormats: t, sampleData: n } = X(), r = t === !1 ? [] : t, { t: i } = q(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c } = aT(), l = [
24179
24179
  {
24180
24180
  id: "csv",
24181
24181
  format: "csv",
24182
- text: r("dataEditor.footer.csvFormat")
24182
+ text: i("dataEditor.footer.csvFormat")
24183
24183
  },
24184
24184
  {
24185
24185
  id: "tsv",
24186
24186
  format: "tsv",
24187
- text: r("dataEditor.footer.tsvFormat")
24187
+ text: i("dataEditor.footer.tsvFormat")
24188
24188
  },
24189
24189
  {
24190
24190
  id: "xlsx",
24191
24191
  format: "xlsx",
24192
- text: r("dataEditor.footer.excelFormat")
24192
+ text: i("dataEditor.footer.excelFormat")
24193
24193
  },
24194
24194
  {
24195
24195
  id: "json",
24196
24196
  format: "json",
24197
- text: r("dataEditor.footer.jsonFormat")
24197
+ text: i("dataEditor.footer.jsonFormat")
24198
24198
  },
24199
24199
  {
24200
24200
  id: "xml",
24201
24201
  format: "xml",
24202
- text: r("dataEditor.footer.xmlFormat")
24202
+ text: i("dataEditor.footer.xmlFormat")
24203
24203
  }
24204
- ].filter((e) => t.includes(e.format)), l = {
24204
+ ].filter((e) => r.includes(e.format)), u = {
24205
24205
  csv: "CSV",
24206
24206
  tsv: "TSV",
24207
24207
  xlsx: "Excel",
24208
24208
  json: "JSON",
24209
24209
  xml: "XML"
24210
- }, u = (() => {
24211
- let e = t.map((e) => l[e]);
24210
+ }, d = (() => {
24211
+ let e = r.map((e) => u[e]);
24212
24212
  if (e.length === 0) return "";
24213
- if (e.length === 1) return r("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
24214
- let n = e[e.length - 1];
24215
- return r("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${n}` });
24216
- })(), d = f((t) => {
24213
+ if (e.length === 1) return i("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
24214
+ let t = e[e.length - 1];
24215
+ return i("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${t}` });
24216
+ })(), p = f((t) => {
24217
24217
  Ih(e, t, n);
24218
- }, [e, n]), p = {
24218
+ }, [e, n]), m = {
24219
24219
  csv: { "text/csv": [".csv"] },
24220
24220
  tsv: { "text/tab-separated-values": [".tsv"] },
24221
24221
  xlsx: { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"] },
24222
24222
  json: { "application/json": [".json"] },
24223
24223
  xml: { "application/xml": [".xml"] }
24224
- }, { getRootProps: m, getInputProps: h, isDragActive: g } = Ur({
24225
- accept: t.reduce((e, t) => ({
24224
+ }, { getRootProps: h, getInputProps: g, isDragActive: _ } = Ur({
24225
+ accept: r.reduce((e, t) => ({
24226
24226
  ...e,
24227
- ...p[t]
24227
+ ...m[t]
24228
24228
  }), {}),
24229
24229
  maxFiles: 1,
24230
- disabled: !!i || !!a,
24230
+ disabled: !!a || !!o,
24231
24231
  onDrop: (e) => {
24232
- e.length > 0 && s(e[0]);
24232
+ e.length > 0 && c(e[0]);
24233
24233
  }
24234
- }), _ = !!i || !!a, v = i?.fileName ?? a?.name, y = (e) => {
24235
- e.stopPropagation(), o();
24234
+ }), v = !!a || !!o, y = a?.fileName ?? o?.name, b = (e) => {
24235
+ e.stopPropagation(), s();
24236
24236
  };
24237
24237
  return /* @__PURE__ */ w(dl, { children: [/* @__PURE__ */ w(ll, { children: [/* @__PURE__ */ w("div", {
24238
24238
  className: "updog__step-select-files__aside-content",
24239
24239
  children: [/* @__PURE__ */ C(J, {
24240
24240
  weight: "bold",
24241
- children: r("dataEditor.uploader.uploadFile.title")
24241
+ children: i("dataEditor.uploader.uploadFile.title")
24242
24242
  }), /* @__PURE__ */ C(J, {
24243
24243
  className: "updog__step-select-files__text",
24244
- children: u
24244
+ children: d
24245
24245
  })]
24246
24246
  }), /* @__PURE__ */ C("footer", {
24247
24247
  className: "updog__step-select-files__footer",
24248
24248
  children: /* @__PURE__ */ C(Ma, {
24249
- options: c,
24250
- onSelect: d,
24249
+ options: l,
24250
+ onSelect: p,
24251
24251
  placement: "top-start",
24252
24252
  matchTriggerWidth: !0,
24253
24253
  children: /* @__PURE__ */ C(Y, {
@@ -24255,19 +24255,19 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24255
24255
  color: "neutral",
24256
24256
  className: "updog__step-select-files__download-btn",
24257
24257
  startIcon: /* @__PURE__ */ C(ae, {}),
24258
- children: r("dataEditor.uploader.uploadFile.downloadExample")
24258
+ children: i("dataEditor.uploader.uploadFile.downloadExample")
24259
24259
  })
24260
24260
  })
24261
24261
  })] }), /* @__PURE__ */ w(ul, { children: [/* @__PURE__ */ C("div", {
24262
24262
  className: "updog__step-select-files__content",
24263
24263
  children: /* @__PURE__ */ w("div", {
24264
- ...m(),
24265
- className: E("updog__step-select-files__dropzone", _ && "updog__step-select-files__dropzone--disabled", !_ && g && "updog__step-select-files__dropzone--active"),
24264
+ ...h(),
24265
+ className: E("updog__step-select-files__dropzone", v && "updog__step-select-files__dropzone--disabled", !v && _ && "updog__step-select-files__dropzone--active"),
24266
24266
  children: [
24267
- /* @__PURE__ */ C("input", { ...h() }),
24267
+ /* @__PURE__ */ C("input", { ...g() }),
24268
24268
  /* @__PURE__ */ C("div", {
24269
24269
  className: "updog__step-select-files__icon-container",
24270
- children: _ ? /* @__PURE__ */ C(I, {
24270
+ children: v ? /* @__PURE__ */ C(I, {
24271
24271
  size: "1rem",
24272
24272
  className: "updog__step-select-files__icon rtl-mirror"
24273
24273
  }) : /* @__PURE__ */ C(Ie, {
@@ -24275,19 +24275,19 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24275
24275
  className: "updog__step-select-files__icon"
24276
24276
  })
24277
24277
  }),
24278
- !_ && /* @__PURE__ */ C(vw, {}),
24279
- _ && /* @__PURE__ */ w("div", {
24278
+ !v && /* @__PURE__ */ C(vw, {}),
24279
+ v && /* @__PURE__ */ w("div", {
24280
24280
  className: "updog__step-select-files__info",
24281
24281
  children: [/* @__PURE__ */ C(J, {
24282
24282
  as: "span",
24283
24283
  size: "sm",
24284
- children: v
24284
+ children: y
24285
24285
  }), /* @__PURE__ */ C(Y, {
24286
24286
  size: "xs",
24287
24287
  variant: "ghost",
24288
24288
  color: "danger",
24289
- onClick: y,
24290
- children: r("dataEditor.common.remove")
24289
+ onClick: b,
24290
+ children: i("dataEditor.common.remove")
24291
24291
  })]
24292
24292
  })
24293
24293
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@updog/data-editor",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Client-side CSV importer and spreadsheet editor SDK 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",