@updog/data-editor-wc 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.
- package/index.d.ts +4 -4
- package/index.js +48 -48
- package/package.json +1 -1
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
|
-
* `
|
|
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, `
|
|
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
|
|
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",
|
|
@@ -45020,7 +45020,7 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
|
|
|
45020
45020
|
title: e.description,
|
|
45021
45021
|
children: e.label
|
|
45022
45022
|
}), hz = () => {
|
|
45023
|
-
let { importFormats: e, remoteSources: t } = Bd(), { t:
|
|
45023
|
+
let { importFormats: e, remoteSources: t } = Bd(), n = e === !1 ? [] : e, { t: r } = k(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = fB();
|
|
45024
45024
|
return /* @__PURE__ */ (0, E.jsxs)("div", {
|
|
45025
45025
|
className: "updog__source-picker",
|
|
45026
45026
|
children: [
|
|
@@ -45033,108 +45033,108 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
|
|
|
45033
45033
|
size: "sm",
|
|
45034
45034
|
weight: "medium",
|
|
45035
45035
|
className: "updog__source-picker__link",
|
|
45036
|
-
children:
|
|
45036
|
+
children: r("dataEditor.uploader.uploadFile.clickToUpload")
|
|
45037
45037
|
}), /* @__PURE__ */ (0, E.jsx)(W, {
|
|
45038
45038
|
as: "span",
|
|
45039
45039
|
size: "sm",
|
|
45040
|
-
children:
|
|
45040
|
+
children: r("dataEditor.uploader.uploadFile.orDragAndDrop")
|
|
45041
45041
|
})]
|
|
45042
45042
|
}), /* @__PURE__ */ (0, E.jsx)(W, {
|
|
45043
45043
|
as: "span",
|
|
45044
45044
|
size: "xs",
|
|
45045
|
-
children:
|
|
45045
|
+
children: n.map((e) => e.toUpperCase()).join(", ")
|
|
45046
45046
|
})]
|
|
45047
45047
|
}),
|
|
45048
45048
|
t.length > 0 && /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(Zs, {}), /* @__PURE__ */ (0, E.jsx)("div", {
|
|
45049
45049
|
className: "updog__source-picker__sources-list",
|
|
45050
45050
|
children: t.map((e) => /* @__PURE__ */ (0, E.jsx)(mz, {
|
|
45051
45051
|
source: e,
|
|
45052
|
-
loading:
|
|
45053
|
-
disabled: !!
|
|
45054
|
-
onSelect:
|
|
45052
|
+
loading: i === e.id,
|
|
45053
|
+
disabled: !!i,
|
|
45054
|
+
onSelect: o
|
|
45055
45055
|
}, e.id))
|
|
45056
45056
|
})] }),
|
|
45057
|
-
|
|
45057
|
+
a && /* @__PURE__ */ (0, E.jsx)(W, {
|
|
45058
45058
|
size: "sm",
|
|
45059
45059
|
className: "updog__source-picker__error",
|
|
45060
|
-
children:
|
|
45060
|
+
children: a
|
|
45061
45061
|
})
|
|
45062
45062
|
]
|
|
45063
45063
|
});
|
|
45064
45064
|
}, gz = () => {
|
|
45065
|
-
let { columns: e, importFormats: t, sampleData: n } = Bd(), { t:
|
|
45065
|
+
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
45066
|
{
|
|
45067
45067
|
id: "csv",
|
|
45068
45068
|
format: "csv",
|
|
45069
|
-
text:
|
|
45069
|
+
text: i("dataEditor.footer.csvFormat")
|
|
45070
45070
|
},
|
|
45071
45071
|
{
|
|
45072
45072
|
id: "tsv",
|
|
45073
45073
|
format: "tsv",
|
|
45074
|
-
text:
|
|
45074
|
+
text: i("dataEditor.footer.tsvFormat")
|
|
45075
45075
|
},
|
|
45076
45076
|
{
|
|
45077
45077
|
id: "xlsx",
|
|
45078
45078
|
format: "xlsx",
|
|
45079
|
-
text:
|
|
45079
|
+
text: i("dataEditor.footer.excelFormat")
|
|
45080
45080
|
},
|
|
45081
45081
|
{
|
|
45082
45082
|
id: "json",
|
|
45083
45083
|
format: "json",
|
|
45084
|
-
text:
|
|
45084
|
+
text: i("dataEditor.footer.jsonFormat")
|
|
45085
45085
|
},
|
|
45086
45086
|
{
|
|
45087
45087
|
id: "xml",
|
|
45088
45088
|
format: "xml",
|
|
45089
|
-
text:
|
|
45089
|
+
text: i("dataEditor.footer.xmlFormat")
|
|
45090
45090
|
}
|
|
45091
|
-
].filter((e) =>
|
|
45091
|
+
].filter((e) => r.includes(e.format)), u = {
|
|
45092
45092
|
csv: "CSV",
|
|
45093
45093
|
tsv: "TSV",
|
|
45094
45094
|
xlsx: "Excel",
|
|
45095
45095
|
json: "JSON",
|
|
45096
45096
|
xml: "XML"
|
|
45097
|
-
},
|
|
45098
|
-
let e =
|
|
45097
|
+
}, d = (() => {
|
|
45098
|
+
let e = r.map((e) => u[e]);
|
|
45099
45099
|
if (e.length === 0) return "";
|
|
45100
|
-
if (e.length === 1) return
|
|
45101
|
-
let
|
|
45102
|
-
return
|
|
45103
|
-
})(),
|
|
45100
|
+
if (e.length === 1) return i("dataEditor.uploader.uploadFile.textDynamic", { formats: e[0] });
|
|
45101
|
+
let t = e[e.length - 1];
|
|
45102
|
+
return i("dataEditor.uploader.uploadFile.textDynamic", { formats: `${e.slice(0, -1).join(", ")} or ${t}` });
|
|
45103
|
+
})(), f = (0, _.useCallback)((t) => {
|
|
45104
45104
|
jv(e, t, n);
|
|
45105
|
-
}, [e, n]),
|
|
45105
|
+
}, [e, n]), p = {
|
|
45106
45106
|
csv: { "text/csv": [".csv"] },
|
|
45107
45107
|
tsv: { "text/tab-separated-values": [".tsv"] },
|
|
45108
45108
|
xlsx: { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"] },
|
|
45109
45109
|
json: { "application/json": [".json"] },
|
|
45110
45110
|
xml: { "application/xml": [".xml"] }
|
|
45111
|
-
}, { getRootProps:
|
|
45112
|
-
accept:
|
|
45111
|
+
}, { getRootProps: m, getInputProps: h, isDragActive: g } = uz({
|
|
45112
|
+
accept: r.reduce((e, t) => ({
|
|
45113
45113
|
...e,
|
|
45114
|
-
...
|
|
45114
|
+
...p[t]
|
|
45115
45115
|
}), {}),
|
|
45116
45116
|
maxFiles: 1,
|
|
45117
|
-
disabled: !!
|
|
45117
|
+
disabled: !!a || !!o,
|
|
45118
45118
|
onDrop: (e) => {
|
|
45119
|
-
e.length > 0 &&
|
|
45119
|
+
e.length > 0 && c(e[0]);
|
|
45120
45120
|
}
|
|
45121
|
-
}),
|
|
45122
|
-
e.stopPropagation(),
|
|
45121
|
+
}), v = !!a || !!o, y = a?.fileName ?? o?.name, b = (e) => {
|
|
45122
|
+
e.stopPropagation(), s();
|
|
45123
45123
|
};
|
|
45124
45124
|
return /* @__PURE__ */ (0, E.jsxs)(Ud, { children: [/* @__PURE__ */ (0, E.jsxs)(Vd, { children: [/* @__PURE__ */ (0, E.jsxs)("div", {
|
|
45125
45125
|
className: "updog__step-select-files__aside-content",
|
|
45126
45126
|
children: [/* @__PURE__ */ (0, E.jsx)(W, {
|
|
45127
45127
|
weight: "bold",
|
|
45128
|
-
children:
|
|
45128
|
+
children: i("dataEditor.uploader.uploadFile.title")
|
|
45129
45129
|
}), /* @__PURE__ */ (0, E.jsx)(W, {
|
|
45130
45130
|
className: "updog__step-select-files__text",
|
|
45131
|
-
children:
|
|
45131
|
+
children: d
|
|
45132
45132
|
})]
|
|
45133
45133
|
}), /* @__PURE__ */ (0, E.jsx)("footer", {
|
|
45134
45134
|
className: "updog__step-select-files__footer",
|
|
45135
45135
|
children: /* @__PURE__ */ (0, E.jsx)(rc, {
|
|
45136
|
-
options:
|
|
45137
|
-
onSelect:
|
|
45136
|
+
options: l,
|
|
45137
|
+
onSelect: f,
|
|
45138
45138
|
placement: "top-start",
|
|
45139
45139
|
matchTriggerWidth: !0,
|
|
45140
45140
|
children: /* @__PURE__ */ (0, E.jsx)(tt, {
|
|
@@ -45142,19 +45142,19 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
|
|
|
45142
45142
|
color: "neutral",
|
|
45143
45143
|
className: "updog__step-select-files__download-btn",
|
|
45144
45144
|
startIcon: /* @__PURE__ */ (0, E.jsx)(pe, {}),
|
|
45145
|
-
children:
|
|
45145
|
+
children: i("dataEditor.uploader.uploadFile.downloadExample")
|
|
45146
45146
|
})
|
|
45147
45147
|
})
|
|
45148
45148
|
})] }), /* @__PURE__ */ (0, E.jsxs)(Hd, { children: [/* @__PURE__ */ (0, E.jsx)("div", {
|
|
45149
45149
|
className: "updog__step-select-files__content",
|
|
45150
45150
|
children: /* @__PURE__ */ (0, E.jsxs)("div", {
|
|
45151
|
-
...
|
|
45152
|
-
className: j("updog__step-select-files__dropzone",
|
|
45151
|
+
...m(),
|
|
45152
|
+
className: j("updog__step-select-files__dropzone", v && "updog__step-select-files__dropzone--disabled", !v && g && "updog__step-select-files__dropzone--active"),
|
|
45153
45153
|
children: [
|
|
45154
|
-
/* @__PURE__ */ (0, E.jsx)("input", { ...
|
|
45154
|
+
/* @__PURE__ */ (0, E.jsx)("input", { ...h() }),
|
|
45155
45155
|
/* @__PURE__ */ (0, E.jsx)("div", {
|
|
45156
45156
|
className: "updog__step-select-files__icon-container",
|
|
45157
|
-
children:
|
|
45157
|
+
children: v ? /* @__PURE__ */ (0, E.jsx)(re, {
|
|
45158
45158
|
size: "1rem",
|
|
45159
45159
|
className: "updog__step-select-files__icon rtl-mirror"
|
|
45160
45160
|
}) : /* @__PURE__ */ (0, E.jsx)(Ve, {
|
|
@@ -45162,19 +45162,19 @@ var pz = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */
|
|
|
45162
45162
|
className: "updog__step-select-files__icon"
|
|
45163
45163
|
})
|
|
45164
45164
|
}),
|
|
45165
|
-
!
|
|
45166
|
-
|
|
45165
|
+
!v && /* @__PURE__ */ (0, E.jsx)(hz, {}),
|
|
45166
|
+
v && /* @__PURE__ */ (0, E.jsxs)("div", {
|
|
45167
45167
|
className: "updog__step-select-files__info",
|
|
45168
45168
|
children: [/* @__PURE__ */ (0, E.jsx)(W, {
|
|
45169
45169
|
as: "span",
|
|
45170
45170
|
size: "sm",
|
|
45171
|
-
children:
|
|
45171
|
+
children: y
|
|
45172
45172
|
}), /* @__PURE__ */ (0, E.jsx)(tt, {
|
|
45173
45173
|
size: "xs",
|
|
45174
45174
|
variant: "ghost",
|
|
45175
45175
|
color: "danger",
|
|
45176
|
-
onClick:
|
|
45177
|
-
children:
|
|
45176
|
+
onClick: b,
|
|
45177
|
+
children: i("dataEditor.common.remove")
|
|
45178
45178
|
})]
|
|
45179
45179
|
})
|
|
45180
45180
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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",
|