@updog/data-editor 0.1.16 → 0.1.18

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/LICENSE CHANGED
@@ -232,8 +232,10 @@ Sections 5, 8, 11, 12, and 14 survive termination of this License.
232
232
  --------------------------------------------------------------------------------
233
233
 
234
234
  This License shall be governed by and construed in accordance with the laws of
235
- the United Arab Emirates. Any disputes arising under this License shall be
236
- subject to the exclusive jurisdiction of the courts of the United Arab Emirates.
235
+ the Dubai International Financial Centre (DIFC), as applied by the DIFC Courts.
236
+ Any dispute arising out of or in connection with this License, including any
237
+ question regarding its existence, validity, or termination, shall be subject to
238
+ the exclusive jurisdiction of the courts of the DIFC.
237
239
 
238
240
  --------------------------------------------------------------------------------
239
241
  15. EXPORT COMPLIANCE
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",
@@ -22104,17 +22104,27 @@ var KS = ({ source: e }) => {
22104
22104
  })]
22105
22105
  })
22106
22106
  }), nC = ({ filtersResetKey: e }) => {
22107
- let { store: t, scrollToGridTop: n } = X(), { t: r } = q(), { filteredErrorCount: i, errorMessageCounts: a } = Mo(t), [o, s] = b(() => new Set(t.getFilters().errorMessageFilters ?? []));
22107
+ let { store: t, scrollToGridTop: n } = X(), { t: r } = q(), { filteredErrorCount: i, errorMessageCounts: a } = Mo(t), [o, s] = b(() => new Set(t.getFilters().errorMessageFilters ?? [])), [c, l] = b(!1);
22108
22108
  m(() => {
22109
- s(new Set(t.getFilters().errorMessageFilters ?? []));
22109
+ s(new Set(t.getFilters().errorMessageFilters ?? [])), l(!1);
22110
22110
  }, [e, t]);
22111
- let c = Object.keys(a), l = c.length > 0 && c.every((e) => o.has(e)), u = c.some((e) => o.has(e)) && !l, d = f((e) => {
22112
- s(e ? new Set(c) : /* @__PURE__ */ new Set()), n(), t.setFilters({ errorMessageFilters: e ? c : [] });
22111
+ let u = Object.keys(a), d = u.length > 0;
22112
+ m(() => {
22113
+ !c || !d || (s(new Set(u)), t.setFilters({ errorMessageFilters: u }), l(!1));
22113
22114
  }, [
22114
22115
  c,
22116
+ d,
22117
+ u,
22118
+ t
22119
+ ]);
22120
+ let p = d && u.every((e) => o.has(e)), h = u.some((e) => o.has(e)), g = d ? p : c, _ = d && h && !p, v = f((e) => {
22121
+ l(e), d && (s(e ? new Set(u) : /* @__PURE__ */ new Set()), n(), t.setFilters({ errorMessageFilters: e ? u : [] }));
22122
+ }, [
22123
+ d,
22124
+ u,
22115
22125
  n,
22116
22126
  t
22117
- ]), p = f((e, r) => {
22127
+ ]), y = f((e, r) => {
22118
22128
  s((i) => {
22119
22129
  let a = new Set(i);
22120
22130
  return r ? a.add(e) : a.delete(e), t.setFilters({ errorMessageFilters: [...a] }), n(), a;
@@ -22126,9 +22136,9 @@ var KS = ({ source: e }) => {
22126
22136
  trigger: ({ toggle: e, isOpen: t }) => {
22127
22137
  let n = r(t ? "dataEditor.filters.showLess" : "dataEditor.filters.showMore");
22128
22138
  return /* @__PURE__ */ C(Ni, {
22129
- checked: l,
22130
- indeterminate: u,
22131
- onChange: d,
22139
+ checked: g,
22140
+ indeterminate: _,
22141
+ onChange: v,
22132
22142
  checkboxPosition: "start",
22133
22143
  children: /* @__PURE__ */ w("div", {
22134
22144
  className: "updog__error-filter-section__checkbox-label",
@@ -22137,7 +22147,7 @@ var KS = ({ source: e }) => {
22137
22147
  className: "updog__error-filter-section__truncated",
22138
22148
  children: r("dataEditor.filters.rowsWithErrors")
22139
22149
  }),
22140
- c.length > 0 && /* @__PURE__ */ C(la, {
22150
+ u.length > 0 && /* @__PURE__ */ C(la, {
22141
22151
  content: n,
22142
22152
  children: /* @__PURE__ */ C(ui, {
22143
22153
  variant: "ghost",
@@ -22160,13 +22170,13 @@ var KS = ({ source: e }) => {
22160
22170
  })
22161
22171
  });
22162
22172
  },
22163
- content: c.length > 0 && /* @__PURE__ */ C("div", {
22173
+ content: u.length > 0 && /* @__PURE__ */ C("div", {
22164
22174
  className: "updog__error-filter-section__children",
22165
- children: c.map((e) => /* @__PURE__ */ C(tC, {
22175
+ children: u.map((e) => /* @__PURE__ */ C(tC, {
22166
22176
  message: e,
22167
22177
  count: a[e] ?? 0,
22168
22178
  checked: o.has(e),
22169
- onChange: p
22179
+ onChange: y
22170
22180
  }, e))
22171
22181
  })
22172
22182
  })
@@ -24133,7 +24143,7 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24133
24143
  title: e.description,
24134
24144
  children: e.label
24135
24145
  }), vw = () => {
24136
- let { importFormats: e, remoteSources: t } = X(), { t: n } = q(), { remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = aT();
24146
+ let { importFormats: e, remoteSources: t } = X(), n = e === !1 ? [] : e, { t: r } = q(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = aT();
24137
24147
  return /* @__PURE__ */ w("div", {
24138
24148
  className: "updog__source-picker",
24139
24149
  children: [
@@ -24146,108 +24156,108 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24146
24156
  size: "sm",
24147
24157
  weight: "medium",
24148
24158
  className: "updog__source-picker__link",
24149
- children: n("dataEditor.uploader.uploadFile.clickToUpload")
24159
+ children: r("dataEditor.uploader.uploadFile.clickToUpload")
24150
24160
  }), /* @__PURE__ */ C(J, {
24151
24161
  as: "span",
24152
24162
  size: "sm",
24153
- children: n("dataEditor.uploader.uploadFile.orDragAndDrop")
24163
+ children: r("dataEditor.uploader.uploadFile.orDragAndDrop")
24154
24164
  })]
24155
24165
  }), /* @__PURE__ */ C(J, {
24156
24166
  as: "span",
24157
24167
  size: "xs",
24158
- children: e.map((e) => e.toUpperCase()).join(", ")
24168
+ children: n.map((e) => e.toUpperCase()).join(", ")
24159
24169
  })]
24160
24170
  }),
24161
24171
  t.length > 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Ea, {}), /* @__PURE__ */ C("div", {
24162
24172
  className: "updog__source-picker__sources-list",
24163
24173
  children: t.map((e) => /* @__PURE__ */ C(_w, {
24164
24174
  source: e,
24165
- loading: r === e.id,
24166
- disabled: !!r,
24167
- onSelect: a
24175
+ loading: i === e.id,
24176
+ disabled: !!i,
24177
+ onSelect: o
24168
24178
  }, e.id))
24169
24179
  })] }),
24170
- i && /* @__PURE__ */ C(J, {
24180
+ a && /* @__PURE__ */ C(J, {
24171
24181
  size: "sm",
24172
24182
  className: "updog__source-picker__error",
24173
- children: i
24183
+ children: a
24174
24184
  })
24175
24185
  ]
24176
24186
  });
24177
24187
  }, yw = () => {
24178
- let { columns: e, importFormats: t, sampleData: n } = X(), { t: r } = q(), { parsedCsv: i, xlsxFile: a, handleFileRemoved: o, parseFile: s } = aT(), c = [
24188
+ 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
24189
  {
24180
24190
  id: "csv",
24181
24191
  format: "csv",
24182
- text: r("dataEditor.footer.csvFormat")
24192
+ text: i("dataEditor.footer.csvFormat")
24183
24193
  },
24184
24194
  {
24185
24195
  id: "tsv",
24186
24196
  format: "tsv",
24187
- text: r("dataEditor.footer.tsvFormat")
24197
+ text: i("dataEditor.footer.tsvFormat")
24188
24198
  },
24189
24199
  {
24190
24200
  id: "xlsx",
24191
24201
  format: "xlsx",
24192
- text: r("dataEditor.footer.excelFormat")
24202
+ text: i("dataEditor.footer.excelFormat")
24193
24203
  },
24194
24204
  {
24195
24205
  id: "json",
24196
24206
  format: "json",
24197
- text: r("dataEditor.footer.jsonFormat")
24207
+ text: i("dataEditor.footer.jsonFormat")
24198
24208
  },
24199
24209
  {
24200
24210
  id: "xml",
24201
24211
  format: "xml",
24202
- text: r("dataEditor.footer.xmlFormat")
24212
+ text: i("dataEditor.footer.xmlFormat")
24203
24213
  }
24204
- ].filter((e) => t.includes(e.format)), l = {
24214
+ ].filter((e) => r.includes(e.format)), u = {
24205
24215
  csv: "CSV",
24206
24216
  tsv: "TSV",
24207
24217
  xlsx: "Excel",
24208
24218
  json: "JSON",
24209
24219
  xml: "XML"
24210
- }, u = (() => {
24211
- let e = t.map((e) => l[e]);
24220
+ }, d = (() => {
24221
+ let e = r.map((e) => u[e]);
24212
24222
  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) => {
24223
+ if (e.length === 1) return i("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
24224
+ let t = e[e.length - 1];
24225
+ return i("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${t}` });
24226
+ })(), p = f((t) => {
24217
24227
  Ih(e, t, n);
24218
- }, [e, n]), p = {
24228
+ }, [e, n]), m = {
24219
24229
  csv: { "text/csv": [".csv"] },
24220
24230
  tsv: { "text/tab-separated-values": [".tsv"] },
24221
24231
  xlsx: { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"] },
24222
24232
  json: { "application/json": [".json"] },
24223
24233
  xml: { "application/xml": [".xml"] }
24224
- }, { getRootProps: m, getInputProps: h, isDragActive: g } = Ur({
24225
- accept: t.reduce((e, t) => ({
24234
+ }, { getRootProps: h, getInputProps: g, isDragActive: _ } = Ur({
24235
+ accept: r.reduce((e, t) => ({
24226
24236
  ...e,
24227
- ...p[t]
24237
+ ...m[t]
24228
24238
  }), {}),
24229
24239
  maxFiles: 1,
24230
- disabled: !!i || !!a,
24240
+ disabled: !!a || !!o,
24231
24241
  onDrop: (e) => {
24232
- e.length > 0 && s(e[0]);
24242
+ e.length > 0 && c(e[0]);
24233
24243
  }
24234
- }), _ = !!i || !!a, v = i?.fileName ?? a?.name, y = (e) => {
24235
- e.stopPropagation(), o();
24244
+ }), v = !!a || !!o, y = a?.fileName ?? o?.name, b = (e) => {
24245
+ e.stopPropagation(), s();
24236
24246
  };
24237
24247
  return /* @__PURE__ */ w(dl, { children: [/* @__PURE__ */ w(ll, { children: [/* @__PURE__ */ w("div", {
24238
24248
  className: "updog__step-select-files__aside-content",
24239
24249
  children: [/* @__PURE__ */ C(J, {
24240
24250
  weight: "bold",
24241
- children: r("dataEditor.uploader.uploadFile.title")
24251
+ children: i("dataEditor.uploader.uploadFile.title")
24242
24252
  }), /* @__PURE__ */ C(J, {
24243
24253
  className: "updog__step-select-files__text",
24244
- children: u
24254
+ children: d
24245
24255
  })]
24246
24256
  }), /* @__PURE__ */ C("footer", {
24247
24257
  className: "updog__step-select-files__footer",
24248
24258
  children: /* @__PURE__ */ C(Ma, {
24249
- options: c,
24250
- onSelect: d,
24259
+ options: l,
24260
+ onSelect: p,
24251
24261
  placement: "top-start",
24252
24262
  matchTriggerWidth: !0,
24253
24263
  children: /* @__PURE__ */ C(Y, {
@@ -24255,19 +24265,19 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24255
24265
  color: "neutral",
24256
24266
  className: "updog__step-select-files__download-btn",
24257
24267
  startIcon: /* @__PURE__ */ C(ae, {}),
24258
- children: r("dataEditor.uploader.uploadFile.downloadExample")
24268
+ children: i("dataEditor.uploader.uploadFile.downloadExample")
24259
24269
  })
24260
24270
  })
24261
24271
  })] }), /* @__PURE__ */ w(ul, { children: [/* @__PURE__ */ C("div", {
24262
24272
  className: "updog__step-select-files__content",
24263
24273
  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"),
24274
+ ...h(),
24275
+ className: E("updog__step-select-files__dropzone", v && "updog__step-select-files__dropzone--disabled", !v && _ && "updog__step-select-files__dropzone--active"),
24266
24276
  children: [
24267
- /* @__PURE__ */ C("input", { ...h() }),
24277
+ /* @__PURE__ */ C("input", { ...g() }),
24268
24278
  /* @__PURE__ */ C("div", {
24269
24279
  className: "updog__step-select-files__icon-container",
24270
- children: _ ? /* @__PURE__ */ C(I, {
24280
+ children: v ? /* @__PURE__ */ C(I, {
24271
24281
  size: "1rem",
24272
24282
  className: "updog__step-select-files__icon rtl-mirror"
24273
24283
  }) : /* @__PURE__ */ C(Ie, {
@@ -24275,19 +24285,19 @@ var EC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
24275
24285
  className: "updog__step-select-files__icon"
24276
24286
  })
24277
24287
  }),
24278
- !_ && /* @__PURE__ */ C(vw, {}),
24279
- _ && /* @__PURE__ */ w("div", {
24288
+ !v && /* @__PURE__ */ C(vw, {}),
24289
+ v && /* @__PURE__ */ w("div", {
24280
24290
  className: "updog__step-select-files__info",
24281
24291
  children: [/* @__PURE__ */ C(J, {
24282
24292
  as: "span",
24283
24293
  size: "sm",
24284
- children: v
24294
+ children: y
24285
24295
  }), /* @__PURE__ */ C(Y, {
24286
24296
  size: "xs",
24287
24297
  variant: "ghost",
24288
24298
  color: "danger",
24289
- onClick: y,
24290
- children: r("dataEditor.common.remove")
24299
+ onClick: b,
24300
+ children: i("dataEditor.common.remove")
24291
24301
  })]
24292
24302
  })
24293
24303
  ]
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.18",
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",