@updog/data-editor-wc 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
@@ -1189,9 +1189,9 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
1189
1189
  enableAddRow?: boolean;
1190
1190
  /**
1191
1191
  * Which file formats the user can import. `undefined` allows all formats,
1192
- * `[]` disables import entirely.
1192
+ * `false` disables import entirely.
1193
1193
  */
1194
- importFormats?: DataEditorFormat[];
1194
+ importFormats?: DataEditorFormat[] | false;
1195
1195
  /**
1196
1196
  * Client-defined remote data sources rendered as buttons on the upload
1197
1197
  * step. You own the integration; the SDK renders the button and processes
@@ -1200,9 +1200,9 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
1200
1200
  remoteSources?: RemoteSource[];
1201
1201
  /**
1202
1202
  * Which file formats the user can export to. `undefined` allows all
1203
- * formats, `[]` disables export entirely.
1203
+ * formats, `false` disables export entirely.
1204
1204
  */
1205
- exportFormats?: DataEditorFormat[];
1205
+ exportFormats?: DataEditorFormat[] | false;
1206
1206
  /** Row height in pixels. @default 34 */
1207
1207
  rowHeight?: number;
1208
1208
  /** Header row height in pixels. @default 36 */
package/index.js CHANGED
@@ -25342,8 +25342,8 @@ var Nv = ({ open: e, onClose: t, onConfirm: n, loading: r = !1 }) => {
25342
25342
  F,
25343
25343
  I,
25344
25344
  R
25345
- ]), B = r.length > 0 && (!e.isServer() || e.hasServerExport), V = (0, _.useMemo)(() => {
25346
- let e = z.filter((e) => r.includes(e.format));
25345
+ ]), B = r !== !1 && (!e.isServer() || e.hasServerExport), V = (0, _.useMemo)(() => {
25346
+ let e = r === !1 ? [] : z.filter((e) => r.includes(e.format));
25347
25347
  return [{
25348
25348
  id: "export-all",
25349
25349
  text: M,
@@ -38645,7 +38645,7 @@ var dN = ({ source: e }) => {
38645
38645
  }, fN = () => {
38646
38646
  let { store: e, columns: t, navigateToCell: n, navigateToCellRef: r, setShowUploader: i, enableAddRow: a, importFormats: o, readonly: s } = Bd(), { t: c } = k(), { sources: l, phase: u } = nl(e), d = u !== "idle", f = (0, _.useMemo)(() => {
38647
38647
  let e = [];
38648
- return o.length > 0 && e.push({
38648
+ return o !== !1 && o.length > 0 && e.push({
38649
38649
  id: "import_data",
38650
38650
  text: c("dataEditor.dataSources.importData"),
38651
38651
  icon: /* @__PURE__ */ (0, E.jsx)(Ve, { size: "1rem" })
@@ -38682,7 +38682,7 @@ var dN = ({ source: e }) => {
38682
38682
  n,
38683
38683
  r,
38684
38684
  c
38685
- ]), m = c("dataEditor.dataSources.addDataSource"), h = !s && (a || o.length > 0) ? /* @__PURE__ */ (0, E.jsx)(rc, {
38685
+ ]), m = c("dataEditor.dataSources.addDataSource"), h = !s && (a || o !== !1 && o.length > 0) ? /* @__PURE__ */ (0, E.jsx)(rc, {
38686
38686
  options: f,
38687
38687
  onSelect: p,
38688
38688
  placement: "bottom-end",
@@ -39027,17 +39027,27 @@ var dN = ({ source: e }) => {
39027
39027
  })]
39028
39028
  })
39029
39029
  }), xN = ({ filtersResetKey: e }) => {
39030
- let { store: t, scrollToGridTop: n } = Bd(), { t: r } = k(), { filteredErrorCount: i, errorMessageCounts: a } = nl(t), [o, s] = (0, _.useState)(() => new Set(t.getFilters().errorMessageFilters ?? []));
39030
+ let { store: t, scrollToGridTop: n } = Bd(), { t: r } = k(), { filteredErrorCount: i, errorMessageCounts: a } = nl(t), [o, s] = (0, _.useState)(() => new Set(t.getFilters().errorMessageFilters ?? [])), [c, l] = (0, _.useState)(!1);
39031
39031
  (0, _.useEffect)(() => {
39032
- s(new Set(t.getFilters().errorMessageFilters ?? []));
39032
+ s(new Set(t.getFilters().errorMessageFilters ?? [])), l(!1);
39033
39033
  }, [e, t]);
39034
- let c = Object.keys(a), l = c.length > 0 && c.every((e) => o.has(e)), u = c.some((e) => o.has(e)) && !l, d = (0, _.useCallback)((e) => {
39035
- s(e ? new Set(c) : /* @__PURE__ */ new Set()), n(), t.setFilters({ errorMessageFilters: e ? c : [] });
39034
+ let u = Object.keys(a), d = u.length > 0;
39035
+ (0, _.useEffect)(() => {
39036
+ !c || !d || (s(new Set(u)), t.setFilters({ errorMessageFilters: u }), l(!1));
39036
39037
  }, [
39037
39038
  c,
39039
+ d,
39040
+ u,
39041
+ t
39042
+ ]);
39043
+ let f = d && u.every((e) => o.has(e)), p = u.some((e) => o.has(e)), m = d ? f : c, h = d && p && !f, g = (0, _.useCallback)((e) => {
39044
+ l(e), d && (s(e ? new Set(u) : /* @__PURE__ */ new Set()), n(), t.setFilters({ errorMessageFilters: e ? u : [] }));
39045
+ }, [
39046
+ d,
39047
+ u,
39038
39048
  n,
39039
39049
  t
39040
- ]), f = (0, _.useCallback)((e, r) => {
39050
+ ]), v = (0, _.useCallback)((e, r) => {
39041
39051
  s((i) => {
39042
39052
  let a = new Set(i);
39043
39053
  return r ? a.add(e) : a.delete(e), t.setFilters({ errorMessageFilters: [...a] }), n(), a;
@@ -39049,9 +39059,9 @@ var dN = ({ source: e }) => {
39049
39059
  trigger: ({ toggle: e, isOpen: t }) => {
39050
39060
  let n = r(t ? "dataEditor.filters.showLess" : "dataEditor.filters.showMore");
39051
39061
  return /* @__PURE__ */ (0, E.jsx)(Tt, {
39052
- checked: l,
39053
- indeterminate: u,
39054
- onChange: d,
39062
+ checked: m,
39063
+ indeterminate: h,
39064
+ onChange: g,
39055
39065
  checkboxPosition: "start",
39056
39066
  children: /* @__PURE__ */ (0, E.jsxs)("div", {
39057
39067
  className: "updog__error-filter-section__checkbox-label",
@@ -39060,7 +39070,7 @@ var dN = ({ source: e }) => {
39060
39070
  className: "updog__error-filter-section__truncated",
39061
39071
  children: r("dataEditor.filters.rowsWithErrors")
39062
39072
  }),
39063
- c.length > 0 && /* @__PURE__ */ (0, E.jsx)(Ps, {
39073
+ u.length > 0 && /* @__PURE__ */ (0, E.jsx)(Ps, {
39064
39074
  content: n,
39065
39075
  children: /* @__PURE__ */ (0, E.jsx)(nt, {
39066
39076
  variant: "ghost",
@@ -39083,13 +39093,13 @@ var dN = ({ source: e }) => {
39083
39093
  })
39084
39094
  });
39085
39095
  },
39086
- content: c.length > 0 && /* @__PURE__ */ (0, E.jsx)("div", {
39096
+ content: u.length > 0 && /* @__PURE__ */ (0, E.jsx)("div", {
39087
39097
  className: "updog__error-filter-section__children",
39088
- children: c.map((e) => /* @__PURE__ */ (0, E.jsx)(bN, {
39098
+ children: u.map((e) => /* @__PURE__ */ (0, E.jsx)(bN, {
39089
39099
  message: e,
39090
39100
  count: a[e] ?? 0,
39091
39101
  checked: o.has(e),
39092
- onChange: f
39102
+ onChange: v
39093
39103
  }, e))
39094
39104
  })
39095
39105
  })
@@ -45020,7 +45030,7 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
45020
45030
  title: e.description,
45021
45031
  children: e.label
45022
45032
  }), hz = () => {
45023
- let { importFormats: e, remoteSources: t } = Bd(), { t: n } = k(), { remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = fB();
45033
+ let { importFormats: e, remoteSources: t } = Bd(), n = e === !1 ? [] : e, { t: r } = k(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = fB();
45024
45034
  return /* @__PURE__ */ (0, E.jsxs)("div", {
45025
45035
  className: "updog__source-picker",
45026
45036
  children: [
@@ -45033,108 +45043,108 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
45033
45043
  size: "sm",
45034
45044
  weight: "medium",
45035
45045
  className: "updog__source-picker__link",
45036
- children: n("dataEditor.uploader.uploadFile.clickToUpload")
45046
+ children: r("dataEditor.uploader.uploadFile.clickToUpload")
45037
45047
  }), /* @__PURE__ */ (0, E.jsx)(W, {
45038
45048
  as: "span",
45039
45049
  size: "sm",
45040
- children: n("dataEditor.uploader.uploadFile.orDragAndDrop")
45050
+ children: r("dataEditor.uploader.uploadFile.orDragAndDrop")
45041
45051
  })]
45042
45052
  }), /* @__PURE__ */ (0, E.jsx)(W, {
45043
45053
  as: "span",
45044
45054
  size: "xs",
45045
- children: e.map((e) => e.toUpperCase()).join(", ")
45055
+ children: n.map((e) => e.toUpperCase()).join(", ")
45046
45056
  })]
45047
45057
  }),
45048
45058
  t.length > 0 && /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(Zs, {}), /* @__PURE__ */ (0, E.jsx)("div", {
45049
45059
  className: "updog__source-picker__sources-list",
45050
45060
  children: t.map((e) => /* @__PURE__ */ (0, E.jsx)(mz, {
45051
45061
  source: e,
45052
- loading: r === e.id,
45053
- disabled: !!r,
45054
- onSelect: a
45062
+ loading: i === e.id,
45063
+ disabled: !!i,
45064
+ onSelect: o
45055
45065
  }, e.id))
45056
45066
  })] }),
45057
- i && /* @__PURE__ */ (0, E.jsx)(W, {
45067
+ a && /* @__PURE__ */ (0, E.jsx)(W, {
45058
45068
  size: "sm",
45059
45069
  className: "updog__source-picker__error",
45060
- children: i
45070
+ children: a
45061
45071
  })
45062
45072
  ]
45063
45073
  });
45064
45074
  }, gz = () => {
45065
- let { columns: e, importFormats: t, sampleData: n } = Bd(), { t: r } = k(), { parsedCsv: i, xlsxFile: a, handleFileRemoved: o, parseFile: s } = fB(), c = [
45075
+ let { columns: e, importFormats: t, sampleData: n } = Bd(), r = t === !1 ? [] : t, { t: i } = k(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c } = fB(), l = [
45066
45076
  {
45067
45077
  id: "csv",
45068
45078
  format: "csv",
45069
- text: r("dataEditor.footer.csvFormat")
45079
+ text: i("dataEditor.footer.csvFormat")
45070
45080
  },
45071
45081
  {
45072
45082
  id: "tsv",
45073
45083
  format: "tsv",
45074
- text: r("dataEditor.footer.tsvFormat")
45084
+ text: i("dataEditor.footer.tsvFormat")
45075
45085
  },
45076
45086
  {
45077
45087
  id: "xlsx",
45078
45088
  format: "xlsx",
45079
- text: r("dataEditor.footer.excelFormat")
45089
+ text: i("dataEditor.footer.excelFormat")
45080
45090
  },
45081
45091
  {
45082
45092
  id: "json",
45083
45093
  format: "json",
45084
- text: r("dataEditor.footer.jsonFormat")
45094
+ text: i("dataEditor.footer.jsonFormat")
45085
45095
  },
45086
45096
  {
45087
45097
  id: "xml",
45088
45098
  format: "xml",
45089
- text: r("dataEditor.footer.xmlFormat")
45099
+ text: i("dataEditor.footer.xmlFormat")
45090
45100
  }
45091
- ].filter((e) => t.includes(e.format)), l = {
45101
+ ].filter((e) => r.includes(e.format)), u = {
45092
45102
  csv: "CSV",
45093
45103
  tsv: "TSV",
45094
45104
  xlsx: "Excel",
45095
45105
  json: "JSON",
45096
45106
  xml: "XML"
45097
- }, u = (() => {
45098
- let e = t.map((e) => l[e]);
45107
+ }, d = (() => {
45108
+ let e = r.map((e) => u[e]);
45099
45109
  if (e.length === 0) return "";
45100
- if (e.length === 1) return r("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
45101
- let n = e[e.length - 1];
45102
- return r("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${n}` });
45103
- })(), d = (0, _.useCallback)((t) => {
45110
+ if (e.length === 1) return i("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
45111
+ let t = e[e.length - 1];
45112
+ return i("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${t}` });
45113
+ })(), f = (0, _.useCallback)((t) => {
45104
45114
  jv(e, t, n);
45105
- }, [e, n]), f = {
45115
+ }, [e, n]), p = {
45106
45116
  csv: { "text/csv": [".csv"] },
45107
45117
  tsv: { "text/tab-separated-values": [".tsv"] },
45108
45118
  xlsx: { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"] },
45109
45119
  json: { "application/json": [".json"] },
45110
45120
  xml: { "application/xml": [".xml"] }
45111
- }, { getRootProps: p, getInputProps: m, isDragActive: h } = uz({
45112
- accept: t.reduce((e, t) => ({
45121
+ }, { getRootProps: m, getInputProps: h, isDragActive: g } = uz({
45122
+ accept: r.reduce((e, t) => ({
45113
45123
  ...e,
45114
- ...f[t]
45124
+ ...p[t]
45115
45125
  }), {}),
45116
45126
  maxFiles: 1,
45117
- disabled: !!i || !!a,
45127
+ disabled: !!a || !!o,
45118
45128
  onDrop: (e) => {
45119
- e.length > 0 && s(e[0]);
45129
+ e.length > 0 && c(e[0]);
45120
45130
  }
45121
- }), g = !!i || !!a, v = i?.fileName ?? a?.name, y = (e) => {
45122
- e.stopPropagation(), o();
45131
+ }), v = !!a || !!o, y = a?.fileName ?? o?.name, b = (e) => {
45132
+ e.stopPropagation(), s();
45123
45133
  };
45124
45134
  return /* @__PURE__ */ (0, E.jsxs)(Ud, { children: [/* @__PURE__ */ (0, E.jsxs)(Vd, { children: [/* @__PURE__ */ (0, E.jsxs)("div", {
45125
45135
  className: "updog__step-select-files__aside-content",
45126
45136
  children: [/* @__PURE__ */ (0, E.jsx)(W, {
45127
45137
  weight: "bold",
45128
- children: r("dataEditor.uploader.uploadFile.title")
45138
+ children: i("dataEditor.uploader.uploadFile.title")
45129
45139
  }), /* @__PURE__ */ (0, E.jsx)(W, {
45130
45140
  className: "updog__step-select-files__text",
45131
- children: u
45141
+ children: d
45132
45142
  })]
45133
45143
  }), /* @__PURE__ */ (0, E.jsx)("footer", {
45134
45144
  className: "updog__step-select-files__footer",
45135
45145
  children: /* @__PURE__ */ (0, E.jsx)(rc, {
45136
- options: c,
45137
- onSelect: d,
45146
+ options: l,
45147
+ onSelect: f,
45138
45148
  placement: "top-start",
45139
45149
  matchTriggerWidth: !0,
45140
45150
  children: /* @__PURE__ */ (0, E.jsx)(tt, {
@@ -45142,19 +45152,19 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
45142
45152
  color: "neutral",
45143
45153
  className: "updog__step-select-files__download-btn",
45144
45154
  startIcon: /* @__PURE__ */ (0, E.jsx)(pe, {}),
45145
- children: r("dataEditor.uploader.uploadFile.downloadExample")
45155
+ children: i("dataEditor.uploader.uploadFile.downloadExample")
45146
45156
  })
45147
45157
  })
45148
45158
  })] }), /* @__PURE__ */ (0, E.jsxs)(Hd, { children: [/* @__PURE__ */ (0, E.jsx)("div", {
45149
45159
  className: "updog__step-select-files__content",
45150
45160
  children: /* @__PURE__ */ (0, E.jsxs)("div", {
45151
- ...p(),
45152
- className: j("updog__step-select-files__dropzone", g && "updog__step-select-files__dropzone--disabled", !g && h && "updog__step-select-files__dropzone--active"),
45161
+ ...m(),
45162
+ className: j("updog__step-select-files__dropzone", v && "updog__step-select-files__dropzone--disabled", !v && g && "updog__step-select-files__dropzone--active"),
45153
45163
  children: [
45154
- /* @__PURE__ */ (0, E.jsx)("input", { ...m() }),
45164
+ /* @__PURE__ */ (0, E.jsx)("input", { ...h() }),
45155
45165
  /* @__PURE__ */ (0, E.jsx)("div", {
45156
45166
  className: "updog__step-select-files__icon-container",
45157
- children: g ? /* @__PURE__ */ (0, E.jsx)(re, {
45167
+ children: v ? /* @__PURE__ */ (0, E.jsx)(re, {
45158
45168
  size: "1rem",
45159
45169
  className: "updog__step-select-files__icon rtl-mirror"
45160
45170
  }) : /* @__PURE__ */ (0, E.jsx)(Ve, {
@@ -45162,19 +45172,19 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
45162
45172
  className: "updog__step-select-files__icon"
45163
45173
  })
45164
45174
  }),
45165
- !g && /* @__PURE__ */ (0, E.jsx)(hz, {}),
45166
- g && /* @__PURE__ */ (0, E.jsxs)("div", {
45175
+ !v && /* @__PURE__ */ (0, E.jsx)(hz, {}),
45176
+ v && /* @__PURE__ */ (0, E.jsxs)("div", {
45167
45177
  className: "updog__step-select-files__info",
45168
45178
  children: [/* @__PURE__ */ (0, E.jsx)(W, {
45169
45179
  as: "span",
45170
45180
  size: "sm",
45171
- children: v
45181
+ children: y
45172
45182
  }), /* @__PURE__ */ (0, E.jsx)(tt, {
45173
45183
  size: "xs",
45174
45184
  variant: "ghost",
45175
45185
  color: "danger",
45176
- onClick: y,
45177
- children: r("dataEditor.common.remove")
45186
+ onClick: b,
45187
+ children: i("dataEditor.common.remove")
45178
45188
  })]
45179
45189
  })
45180
45190
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@updog/data-editor-wc",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Client-side CSV importer and spreadsheet editor SDK 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",