@updog/data-editor-wc 0.1.46 → 0.1.47
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 +16 -0
- package/index.js +187 -135
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1031,6 +1031,16 @@ type DataEditorSourceResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
1031
1031
|
* }}
|
|
1032
1032
|
* ```
|
|
1033
1033
|
*/
|
|
1034
|
+
/** A user-confirmed import mapping: `source` (imported) → `target` (canonical). */
|
|
1035
|
+
type LearnedSynonym = {
|
|
1036
|
+
source: string;
|
|
1037
|
+
target: string;
|
|
1038
|
+
};
|
|
1039
|
+
/** User-confirmed import mappings, split by where they were matched. */
|
|
1040
|
+
type LearnedSynonyms = {
|
|
1041
|
+
columns: LearnedSynonym[];
|
|
1042
|
+
values: LearnedSynonym[];
|
|
1043
|
+
};
|
|
1034
1044
|
type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
1035
1045
|
sources: DataEditorSourceResult<TRow>[];
|
|
1036
1046
|
counts: {
|
|
@@ -1039,6 +1049,12 @@ type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
1039
1049
|
deleted: number;
|
|
1040
1050
|
invalid: number;
|
|
1041
1051
|
};
|
|
1052
|
+
/**
|
|
1053
|
+
* Import mappings the user confirmed that weren't already known, split into
|
|
1054
|
+
* `columns` and `values`. Persist and feed back through `synonyms` so repeat
|
|
1055
|
+
* imports auto-match. Each list is `[]` when nothing new was learned.
|
|
1056
|
+
*/
|
|
1057
|
+
learnedSynonyms: LearnedSynonyms;
|
|
1042
1058
|
};
|
|
1043
1059
|
/**
|
|
1044
1060
|
* Describes the change state of a single row within a chunk, used to seed
|
package/index.js
CHANGED
|
@@ -27618,7 +27618,10 @@ var dm = (e) => {
|
|
|
27618
27618
|
t && this.serverCounts?.setCounts(t), this.snapshotManager.markCountsDirty(), this.notify();
|
|
27619
27619
|
}
|
|
27620
27620
|
clear() {
|
|
27621
|
-
this.rowStore.clear(), this.sourceManager.clear(), this.filterEngine.clear(), this.validationStore.clear(), this.dirtyTracker.clear(), this.snapshotManager.clear(), this._isLoading = !0, this._editedCells.clear(), this.server?.clear(), this.history.clear(), this.editParamsHistory.clear(), this.
|
|
27621
|
+
this.rowStore.clear(), this.sourceManager.clear(), this.filterEngine.clear(), this.validationStore.clear(), this.dirtyTracker.clear(), this.snapshotManager.clear(), this._isLoading = !0, this._editedCells.clear(), this.server?.clear(), this.history.clear(), this.editParamsHistory.clear(), this.learnedSynonyms = {
|
|
27622
|
+
columns: [],
|
|
27623
|
+
values: []
|
|
27624
|
+
}, this.learnedSynonymKeys.columns.clear(), this.learnedSynonymKeys.values.clear(), this.notify();
|
|
27622
27625
|
}
|
|
27623
27626
|
destroy() {
|
|
27624
27627
|
this.filterEngine.destroy(), this.server?.destroy(), this.transformWorker?.terminate(), this.transformWorker = null, this.clear(), this.serverCounts?.clear(), this.clearViewportRange(), this.snapshotManager.clearListeners();
|
|
@@ -27853,6 +27856,20 @@ var dm = (e) => {
|
|
|
27853
27856
|
}
|
|
27854
27857
|
return e;
|
|
27855
27858
|
}
|
|
27859
|
+
learnedSynonyms = {
|
|
27860
|
+
columns: [],
|
|
27861
|
+
values: []
|
|
27862
|
+
};
|
|
27863
|
+
learnedSynonymKeys = {
|
|
27864
|
+
columns: /* @__PURE__ */ new Set(),
|
|
27865
|
+
values: /* @__PURE__ */ new Set()
|
|
27866
|
+
};
|
|
27867
|
+
recordLearnedSynonyms(e) {
|
|
27868
|
+
for (let t of ["columns", "values"]) for (let n of e[t]) {
|
|
27869
|
+
let e = `${n.source} ${n.target}`;
|
|
27870
|
+
this.learnedSynonymKeys[t].has(e) || (this.learnedSynonymKeys[t].add(e), this.learnedSynonyms[t].push(n));
|
|
27871
|
+
}
|
|
27872
|
+
}
|
|
27856
27873
|
getResultBySource() {
|
|
27857
27874
|
let e = /* @__PURE__ */ new Map();
|
|
27858
27875
|
for (let t of this.sourceManager.values()) e.set(t.id, {
|
|
@@ -27895,7 +27912,8 @@ var dm = (e) => {
|
|
|
27895
27912
|
}
|
|
27896
27913
|
return {
|
|
27897
27914
|
sources: Array.from(e.values()),
|
|
27898
|
-
counts: t
|
|
27915
|
+
counts: t,
|
|
27916
|
+
learnedSynonyms: this.learnedSynonyms
|
|
27899
27917
|
};
|
|
27900
27918
|
}
|
|
27901
27919
|
isRowVisible(e) {
|
|
@@ -45571,7 +45589,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
45571
45589
|
return this.state.hasError ? /* @__PURE__ */ (0, O.jsx)(vj, { error: yj }) : this.props.children;
|
|
45572
45590
|
}
|
|
45573
45591
|
}, xj = ({ leftSlot: e }) => {
|
|
45574
|
-
let { variant: t, setShowUploader: n } = $m(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } =
|
|
45592
|
+
let { variant: t, setShowUploader: n } = $m(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = zM(), v = i && t === "editor", b = (0, y.useCallback)(() => {
|
|
45575
45593
|
n(!1);
|
|
45576
45594
|
}, [n]), x = p[m]?.id === "sheet-selection", S = (0, y.useCallback)(() => {
|
|
45577
45595
|
a ? c() : x ? g() : o();
|
|
@@ -46399,7 +46417,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46399
46417
|
]
|
|
46400
46418
|
});
|
|
46401
46419
|
}), Wj = () => {
|
|
46402
|
-
let { columns: e, enableCreateColumn: t, synonyms: n } = $m(), { t: r } = j(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } =
|
|
46420
|
+
let { columns: e, enableCreateColumn: t, synonyms: n } = $m(), { t: r } = j(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = zM(), [l, u] = (0, y.useState)(null), d = (0, y.useRef)(null), f = (0, y.useCallback)((e, t) => {
|
|
46403
46421
|
if (t === "action:create") {
|
|
46404
46422
|
d.current = e, u({ title: e });
|
|
46405
46423
|
return;
|
|
@@ -46512,7 +46530,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46512
46530
|
]
|
|
46513
46531
|
});
|
|
46514
46532
|
}, Gj = () => {
|
|
46515
|
-
let { parsedCsv: e } =
|
|
46533
|
+
let { parsedCsv: e } = zM();
|
|
46516
46534
|
return e ? /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(rh, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
46517
46535
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
46518
46536
|
children: /* @__PURE__ */ (0, O.jsx)(Wj, {})
|
|
@@ -46531,7 +46549,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46531
46549
|
})
|
|
46532
46550
|
});
|
|
46533
46551
|
}, qj = () => {
|
|
46534
|
-
let { columns: e } = $m(), { t } = j(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, pendingOptions: s, addPendingOption: c } =
|
|
46552
|
+
let { columns: e } = $m(), { t } = j(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, pendingOptions: s, addPendingOption: c } = zM(), [l, u] = (0, y.useState)({}), [d, f] = (0, y.useState)({}), [p, m] = (0, y.useState)(null), h = (0, y.useRef)(!1), g = (0, y.useCallback)((e) => {
|
|
46535
46553
|
f((t) => ({
|
|
46536
46554
|
...t,
|
|
46537
46555
|
[e]: !t[e]
|
|
@@ -46767,7 +46785,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46767
46785
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
46768
46786
|
children: /* @__PURE__ */ (0, O.jsx)(qj, {})
|
|
46769
46787
|
}), /* @__PURE__ */ (0, O.jsx)(xj, {})] }) }), Yj = 20, Xj = () => {
|
|
46770
|
-
let { columns: e, store: t } = $m(), { t: n } = j(), { primaryKey: r, onPrimaryKeyChange: i, parsedCsv: a, columnMapping: o } =
|
|
46788
|
+
let { columns: e, store: t } = $m(), { t: n } = j(), { primaryKey: r, onPrimaryKeyChange: i, parsedCsv: a, columnMapping: o } = zM(), s = t.isClient(), c = (0, y.useCallback)(() => i(null), [i]), l = e.filter((e) => e.unique), u = (0, y.useMemo)(() => {
|
|
46771
46789
|
let e = {};
|
|
46772
46790
|
for (let [t, n] of Object.entries(o)) n && (e[n] = t);
|
|
46773
46791
|
return e;
|
|
@@ -46842,7 +46860,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46842
46860
|
title: e.description,
|
|
46843
46861
|
children: e.label
|
|
46844
46862
|
}), eM = () => {
|
|
46845
|
-
let { importFormats: e, remoteSources: t } = $m(), n = e === !1 ? [] : e, { t: r } = j(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } =
|
|
46863
|
+
let { importFormats: e, remoteSources: t } = $m(), n = e === !1 ? [] : e, { t: r } = j(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = zM();
|
|
46846
46864
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
46847
46865
|
className: "updog__source-picker",
|
|
46848
46866
|
children: [
|
|
@@ -46897,7 +46915,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46897
46915
|
})]
|
|
46898
46916
|
});
|
|
46899
46917
|
}, nM = () => {
|
|
46900
|
-
let { columns: e, importFormats: t, sampleData: n } = $m(), r = t === !1 ? [] : t, { t: i } = j(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c, isParsing: l, remoteSourceLoading: u } =
|
|
46918
|
+
let { columns: e, importFormats: t, sampleData: n } = $m(), r = t === !1 ? [] : t, { t: i } = j(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c, isParsing: l, remoteSourceLoading: u } = zM(), d = [
|
|
46901
46919
|
{
|
|
46902
46920
|
id: "csv",
|
|
46903
46921
|
format: "csv",
|
|
@@ -46987,7 +47005,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46987
47005
|
]
|
|
46988
47006
|
}) });
|
|
46989
47007
|
}, rM = ({ preview: e }) => {
|
|
46990
|
-
let { selectedSheet: t, setSelectedSheet: n } =
|
|
47008
|
+
let { selectedSheet: t, setSelectedSheet: n } = zM(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
|
|
46991
47009
|
let { headers: t, rows: n } = e;
|
|
46992
47010
|
return n.map((e) => t.map((t) => e[t] ?? ""));
|
|
46993
47011
|
}, [e]);
|
|
@@ -47025,7 +47043,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
47025
47043
|
})
|
|
47026
47044
|
});
|
|
47027
47045
|
}, iM = () => {
|
|
47028
|
-
let { sheetPreviews: e } =
|
|
47046
|
+
let { sheetPreviews: e } = zM();
|
|
47029
47047
|
return /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(rh, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47030
47048
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
47031
47049
|
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -47133,16 +47151,47 @@ function vM(e) {
|
|
|
47133
47151
|
rawCells: i
|
|
47134
47152
|
};
|
|
47135
47153
|
}
|
|
47136
|
-
|
|
47154
|
+
//#endregion
|
|
47155
|
+
//#region src/components/DataUploader/utils/learnedSynonyms.ts
|
|
47156
|
+
var yM = (e) => {
|
|
47157
|
+
let t = /* @__PURE__ */ new Map();
|
|
47158
|
+
for (let [n, r] of Object.entries(e)) {
|
|
47159
|
+
let e = Tj(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
47160
|
+
for (let e of r) i.add(Tj(e));
|
|
47161
|
+
t.set(e, i);
|
|
47162
|
+
}
|
|
47163
|
+
return t;
|
|
47164
|
+
}, bM = (e, t, n, r) => {
|
|
47165
|
+
let i = yM(r), a = (e, t) => i.get(Tj(e))?.has(Tj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
|
|
47166
|
+
if (Tj(n) === Tj(r) || a(r, n)) return;
|
|
47167
|
+
let i = `${n} ${r}`;
|
|
47168
|
+
t.has(i) || (t.add(i), e.push({
|
|
47169
|
+
source: n,
|
|
47170
|
+
target: r
|
|
47171
|
+
}));
|
|
47172
|
+
}, c = {
|
|
47173
|
+
columns: [],
|
|
47174
|
+
values: []
|
|
47175
|
+
}, l = s(c.columns, /* @__PURE__ */ new Set());
|
|
47176
|
+
for (let [t, n] of Object.entries(e)) {
|
|
47177
|
+
if (!n) continue;
|
|
47178
|
+
let e = o.get(n);
|
|
47179
|
+
e && l(t, e.title);
|
|
47180
|
+
}
|
|
47181
|
+
let u = s(c.values, /* @__PURE__ */ new Set());
|
|
47182
|
+
for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
|
|
47183
|
+
return c;
|
|
47184
|
+
};
|
|
47185
|
+
function xM(e, t, n) {
|
|
47137
47186
|
let r = e.length, i = t;
|
|
47138
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
47187
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? SM(i, i - r) : SM(r - 1, i - 1)) > 1e3 ? [] : r < i ? CM(e, i) : wM(e, i, n);
|
|
47139
47188
|
}
|
|
47140
|
-
function
|
|
47189
|
+
function SM(e, t) {
|
|
47141
47190
|
let n = Math.min(t, e - t), r = 1;
|
|
47142
47191
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
47143
47192
|
return r;
|
|
47144
47193
|
}
|
|
47145
|
-
function
|
|
47194
|
+
function CM(e, t) {
|
|
47146
47195
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
47147
47196
|
if (i.length === n) {
|
|
47148
47197
|
let a = Array(t).fill("");
|
|
@@ -47154,7 +47203,7 @@ function xM(e, t) {
|
|
|
47154
47203
|
};
|
|
47155
47204
|
return a(0), r;
|
|
47156
47205
|
}
|
|
47157
|
-
function
|
|
47206
|
+
function wM(e, t, n) {
|
|
47158
47207
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
47159
47208
|
if (a.length === t - 1) {
|
|
47160
47209
|
let o = [
|
|
@@ -47172,27 +47221,27 @@ function SM(e, t, n) {
|
|
|
47172
47221
|
}
|
|
47173
47222
|
//#endregion
|
|
47174
47223
|
//#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
|
|
47175
|
-
var
|
|
47176
|
-
function
|
|
47224
|
+
var TM = {};
|
|
47225
|
+
function EM(e, t) {
|
|
47177
47226
|
for (let n of t.validators ?? []) if (n.type !== "expression") {
|
|
47178
47227
|
if (n.type === "function") {
|
|
47179
|
-
if (n.fn(e,
|
|
47228
|
+
if (n.fn(e, TM) != null) return !1;
|
|
47180
47229
|
continue;
|
|
47181
47230
|
}
|
|
47182
|
-
if (Rm(n, e,
|
|
47231
|
+
if (Rm(n, e, TM) != null) return !1;
|
|
47183
47232
|
}
|
|
47184
47233
|
return !0;
|
|
47185
47234
|
}
|
|
47186
|
-
function
|
|
47187
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
47235
|
+
function DM(e, t) {
|
|
47236
|
+
for (let n = 0; n < t.length; n++) if (!EM(e.cells[n] ?? "", t[n])) return !1;
|
|
47188
47237
|
return !0;
|
|
47189
47238
|
}
|
|
47190
|
-
function
|
|
47191
|
-
return e.filter((e) =>
|
|
47239
|
+
function OM(e, t) {
|
|
47240
|
+
return e.filter((e) => DM(e, t));
|
|
47192
47241
|
}
|
|
47193
47242
|
//#endregion
|
|
47194
47243
|
//#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
|
|
47195
|
-
function
|
|
47244
|
+
function kM(e) {
|
|
47196
47245
|
if (e.length <= 1) return [];
|
|
47197
47246
|
let t = e[0].cells.length, n = [], r = -1;
|
|
47198
47247
|
for (let i = 0; i < t; i++) {
|
|
@@ -47209,25 +47258,25 @@ function DM(e) {
|
|
|
47209
47258
|
}
|
|
47210
47259
|
//#endregion
|
|
47211
47260
|
//#region src/components/DataUploader/utils/raggedRows/alignRow.ts
|
|
47212
|
-
function
|
|
47213
|
-
let r =
|
|
47261
|
+
function AM(e, t, n) {
|
|
47262
|
+
let r = xM(e, t.length, n), i = OM(r, t);
|
|
47214
47263
|
return i.length === 1 ? {
|
|
47215
47264
|
kind: "confident",
|
|
47216
47265
|
alignment: i[0]
|
|
47217
47266
|
} : i.length > 1 ? {
|
|
47218
47267
|
kind: "ambiguous",
|
|
47219
47268
|
candidates: i,
|
|
47220
|
-
disputeSpans:
|
|
47269
|
+
disputeSpans: kM(i)
|
|
47221
47270
|
} : {
|
|
47222
47271
|
kind: "invalid",
|
|
47223
47272
|
candidates: r,
|
|
47224
|
-
disputeSpans:
|
|
47273
|
+
disputeSpans: kM(r)
|
|
47225
47274
|
};
|
|
47226
47275
|
}
|
|
47227
47276
|
//#endregion
|
|
47228
47277
|
//#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
|
|
47229
|
-
function
|
|
47230
|
-
let r =
|
|
47278
|
+
function jM(e, t, n) {
|
|
47279
|
+
let r = AM(e, t, n);
|
|
47231
47280
|
if (r.kind === "confident") return {
|
|
47232
47281
|
cells: r.alignment.cells,
|
|
47233
47282
|
conflictColumns: []
|
|
@@ -47246,13 +47295,13 @@ function kM(e, t, n) {
|
|
|
47246
47295
|
}
|
|
47247
47296
|
//#endregion
|
|
47248
47297
|
//#region src/components/DataUploader/context/useViewModel.tsx
|
|
47249
|
-
var
|
|
47298
|
+
var MM = 5e3, NM = 15, PM = 20, FM = new Set([
|
|
47250
47299
|
"xlsx",
|
|
47251
47300
|
"xls",
|
|
47252
47301
|
"xlsb",
|
|
47253
47302
|
"ods"
|
|
47254
47303
|
]);
|
|
47255
|
-
function
|
|
47304
|
+
function IM() {
|
|
47256
47305
|
let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = $m(), { t: f } = j(), [p, m] = (0, y.useState)(0), [h, g] = (0, y.useState)(0), [_, v] = (0, y.useState)(null), [b, x] = (0, y.useState)({}), S = n.filter((e) => e.unique), [C, w] = (0, y.useState)(() => r), [T, E] = (0, y.useState)(!1), [D, k] = (0, y.useState)(!1), [A, M] = (0, y.useState)(null), [N, P] = (0, y.useState)([]), [F, I] = (0, y.useState)(null), [L, R] = (0, y.useState)([]), [ee, z] = (0, y.useState)({}), [B, V] = (0, y.useState)([]), [H, te] = (0, y.useState)({}), ne = (0, y.useRef)(null), [re, ie] = (0, y.useState)(0), ae = (0, y.useCallback)((e) => {
|
|
47257
47306
|
D || w(e);
|
|
47258
47307
|
}, [D]), oe = (0, y.useRef)(null);
|
|
@@ -47410,7 +47459,7 @@ function PM() {
|
|
|
47410
47459
|
return {
|
|
47411
47460
|
name: e.name,
|
|
47412
47461
|
headers: t,
|
|
47413
|
-
rows: n.slice(0,
|
|
47462
|
+
rows: n.slice(0, NM),
|
|
47414
47463
|
totalRows: e.totalRows - 1
|
|
47415
47464
|
};
|
|
47416
47465
|
});
|
|
@@ -47444,7 +47493,7 @@ function PM() {
|
|
|
47444
47493
|
]), Ce = (0, y.useCallback)((e) => {
|
|
47445
47494
|
E(!0), ne.current = e;
|
|
47446
47495
|
let t = e.name.split(".").pop()?.toLowerCase();
|
|
47447
|
-
t &&
|
|
47496
|
+
t && FM.has(t) ? Se(e) : t === "json" ? be(e) : t === "xml" ? xe(e) : ye(e);
|
|
47448
47497
|
}, [
|
|
47449
47498
|
ye,
|
|
47450
47499
|
be,
|
|
@@ -47510,6 +47559,7 @@ function PM() {
|
|
|
47510
47559
|
Me({});
|
|
47511
47560
|
return;
|
|
47512
47561
|
}
|
|
47562
|
+
if (D) return;
|
|
47513
47563
|
let e = {};
|
|
47514
47564
|
for (let [t, r] of Object.entries(b)) {
|
|
47515
47565
|
if (!r) continue;
|
|
@@ -47538,7 +47588,8 @@ function PM() {
|
|
|
47538
47588
|
b,
|
|
47539
47589
|
n,
|
|
47540
47590
|
c,
|
|
47541
|
-
l
|
|
47591
|
+
l,
|
|
47592
|
+
D
|
|
47542
47593
|
]);
|
|
47543
47594
|
let Pe = (0, y.useMemo)(() => {
|
|
47544
47595
|
let e = {};
|
|
@@ -47607,7 +47658,7 @@ function PM() {
|
|
|
47607
47658
|
if (!_ || !d?.onRowsImport) return;
|
|
47608
47659
|
let t = _;
|
|
47609
47660
|
v(null);
|
|
47610
|
-
let r = crypto.randomUUID(), i = Re(), a = new AbortController(), o = d.importChunkSize ??
|
|
47661
|
+
let r = crypto.randomUUID(), i = Re(), a = new AbortController(), o = d.importChunkSize ?? MM, s = aM(b, n, new Set(B.map((e) => e.id))), c = {
|
|
47611
47662
|
numberFormat: i.numberFormat,
|
|
47612
47663
|
dateFormat: i.dateFormat,
|
|
47613
47664
|
monthTable: ip(f),
|
|
@@ -47652,49 +47703,49 @@ function PM() {
|
|
|
47652
47703
|
B.length > 0 && u(B);
|
|
47653
47704
|
for (let [t, n] of Object.entries(H)) e.addColumnOptions(t, n);
|
|
47654
47705
|
let o = e.registerSource({ name: i.fileName });
|
|
47655
|
-
e.setSourceLoading(o, !0);
|
|
47706
|
+
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(bM(b, Pe, [...n, ...B], Cj(Sj, l)));
|
|
47656
47707
|
let s = aM(b, n, a), c = {
|
|
47657
47708
|
numberFormat: tp(i.rows, oM(s)),
|
|
47658
47709
|
dateFormat: op(i.rows, Le(a)),
|
|
47659
47710
|
monthTable: ip(f),
|
|
47660
47711
|
valueMapping: Pe
|
|
47661
|
-
},
|
|
47712
|
+
}, d = i.rows, p = i.rawCells ?? [], m = i.delimiter ?? ",", h = i.headers, g = h.map((e) => {
|
|
47662
47713
|
let t = b[e];
|
|
47663
47714
|
return (t ? n.find((e) => e.id === t) : void 0) ?? {
|
|
47664
47715
|
id: e,
|
|
47665
47716
|
title: e
|
|
47666
47717
|
};
|
|
47667
|
-
}),
|
|
47668
|
-
let n = Math.min(
|
|
47669
|
-
for (let e =
|
|
47670
|
-
let t =
|
|
47718
|
+
}), _ = 0, v = () => {
|
|
47719
|
+
let n = Math.min(_ + MM, d.length), i = [], a = [];
|
|
47720
|
+
for (let e = _; e < n; e++) {
|
|
47721
|
+
let t = d[e], n = p[e];
|
|
47671
47722
|
if (n) {
|
|
47672
|
-
let { cells: r, conflictColumns: i } =
|
|
47723
|
+
let { cells: r, conflictColumns: i } = jM(n, g, m);
|
|
47673
47724
|
if (r.length) {
|
|
47674
47725
|
let e = {};
|
|
47675
|
-
for (let t = 0; t <
|
|
47726
|
+
for (let t = 0; t < h.length; t++) e[h[t]] = r[t] ?? "";
|
|
47676
47727
|
t = e;
|
|
47677
47728
|
}
|
|
47678
47729
|
if (i.length) {
|
|
47679
47730
|
let t = [];
|
|
47680
47731
|
for (let e of i) {
|
|
47681
|
-
let n = b[
|
|
47732
|
+
let n = b[h[e]];
|
|
47682
47733
|
n && t.push(n);
|
|
47683
47734
|
}
|
|
47684
47735
|
t.length && a.push({
|
|
47685
|
-
localIndex: e -
|
|
47736
|
+
localIndex: e - _,
|
|
47686
47737
|
columnIds: t
|
|
47687
47738
|
});
|
|
47688
47739
|
}
|
|
47689
47740
|
}
|
|
47690
47741
|
i.push(sM(t, s, c));
|
|
47691
47742
|
}
|
|
47692
|
-
let { rows:
|
|
47693
|
-
for (let e =
|
|
47694
|
-
|
|
47695
|
-
t.validateRows(
|
|
47743
|
+
let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: C ?? void 0 });
|
|
47744
|
+
for (let e = _; e < n; e++) e < PM || (d[e] = null, e < p.length && (p[e] = null));
|
|
47745
|
+
_ = n, setTimeout(() => {
|
|
47746
|
+
t.validateRows(l, u);
|
|
47696
47747
|
for (let { localIndex: t, columnIds: n } of a) {
|
|
47697
|
-
let r =
|
|
47748
|
+
let r = u[t];
|
|
47698
47749
|
for (let t of n) {
|
|
47699
47750
|
let n = e.getCellValidation(r, t) ?? [];
|
|
47700
47751
|
e.setCellValidation(r, t, [...n, {
|
|
@@ -47704,11 +47755,11 @@ function PM() {
|
|
|
47704
47755
|
}
|
|
47705
47756
|
}
|
|
47706
47757
|
a.length > 0 && e.notify();
|
|
47707
|
-
}, 0),
|
|
47758
|
+
}, 0), _ < d.length ? setTimeout(v, 0) : e.finalizeSource(o).then(() => {
|
|
47708
47759
|
t.validateUniqueness(), r();
|
|
47709
47760
|
});
|
|
47710
47761
|
};
|
|
47711
|
-
|
|
47762
|
+
v();
|
|
47712
47763
|
}, 0);
|
|
47713
47764
|
}), [
|
|
47714
47765
|
_,
|
|
@@ -47721,6 +47772,7 @@ function PM() {
|
|
|
47721
47772
|
n,
|
|
47722
47773
|
u,
|
|
47723
47774
|
Pe,
|
|
47775
|
+
l,
|
|
47724
47776
|
Le,
|
|
47725
47777
|
f
|
|
47726
47778
|
]);
|
|
@@ -47786,20 +47838,20 @@ function PM() {
|
|
|
47786
47838
|
}
|
|
47787
47839
|
//#endregion
|
|
47788
47840
|
//#region src/components/DataUploader/context/index.tsx
|
|
47789
|
-
var
|
|
47790
|
-
function
|
|
47791
|
-
let t =
|
|
47792
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
47841
|
+
var LM = (0, y.createContext)(null);
|
|
47842
|
+
function RM({ children: e }) {
|
|
47843
|
+
let t = IM();
|
|
47844
|
+
return /* @__PURE__ */ (0, O.jsx)(LM.Provider, {
|
|
47793
47845
|
value: t,
|
|
47794
47846
|
children: e
|
|
47795
47847
|
});
|
|
47796
47848
|
}
|
|
47797
|
-
var
|
|
47798
|
-
let e = (0, y.useContext)(
|
|
47849
|
+
var zM = () => {
|
|
47850
|
+
let e = (0, y.useContext)(LM);
|
|
47799
47851
|
if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
|
|
47800
47852
|
return e;
|
|
47801
|
-
},
|
|
47802
|
-
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } =
|
|
47853
|
+
}, BM = () => {
|
|
47854
|
+
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = zM();
|
|
47803
47855
|
return /* @__PURE__ */ (0, O.jsx)(Rc, {
|
|
47804
47856
|
steps: e,
|
|
47805
47857
|
activeStepIndex: t,
|
|
@@ -47807,79 +47859,79 @@ var LM = () => {
|
|
|
47807
47859
|
onStepChange: r,
|
|
47808
47860
|
isProgressive: !0
|
|
47809
47861
|
});
|
|
47810
|
-
},
|
|
47862
|
+
}, VM = () => /* @__PURE__ */ (0, O.jsx)(RM, { children: /* @__PURE__ */ (0, O.jsx)(BM, {}) }), HM = {
|
|
47811
47863
|
kty: "EC",
|
|
47812
47864
|
crv: "P-256",
|
|
47813
47865
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
47814
47866
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
47815
|
-
},
|
|
47867
|
+
}, UM = "updog_license_grant", WM = new Set([
|
|
47816
47868
|
"updog.tech",
|
|
47817
47869
|
"landing.updog.tech",
|
|
47818
47870
|
"demo.updog.tech"
|
|
47819
47871
|
]);
|
|
47820
|
-
function
|
|
47821
|
-
return
|
|
47872
|
+
function GM() {
|
|
47873
|
+
return WM.has(window.location.hostname);
|
|
47822
47874
|
}
|
|
47823
|
-
function
|
|
47875
|
+
function KM() {
|
|
47824
47876
|
return !1;
|
|
47825
47877
|
}
|
|
47826
|
-
function
|
|
47878
|
+
function qM() {
|
|
47827
47879
|
return "https://api.updog.tech";
|
|
47828
47880
|
}
|
|
47829
|
-
function
|
|
47881
|
+
function JM(e) {
|
|
47830
47882
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
47831
47883
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
47832
47884
|
return i;
|
|
47833
47885
|
}
|
|
47834
|
-
async function
|
|
47886
|
+
async function YM(e) {
|
|
47835
47887
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
47836
47888
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
47837
47889
|
}
|
|
47838
|
-
var
|
|
47839
|
-
async function
|
|
47840
|
-
return
|
|
47890
|
+
var XM = null;
|
|
47891
|
+
async function ZM() {
|
|
47892
|
+
return XM || (XM = await crypto.subtle.importKey("jwk", HM, {
|
|
47841
47893
|
name: "ECDSA",
|
|
47842
47894
|
namedCurve: "P-256"
|
|
47843
|
-
}, !1, ["verify"]),
|
|
47895
|
+
}, !1, ["verify"]), XM);
|
|
47844
47896
|
}
|
|
47845
|
-
function
|
|
47897
|
+
function QM() {
|
|
47846
47898
|
try {
|
|
47847
|
-
return localStorage.getItem(
|
|
47899
|
+
return localStorage.getItem(UM);
|
|
47848
47900
|
} catch {
|
|
47849
47901
|
return null;
|
|
47850
47902
|
}
|
|
47851
47903
|
}
|
|
47852
|
-
function
|
|
47904
|
+
function $M(e) {
|
|
47853
47905
|
try {
|
|
47854
|
-
localStorage.setItem(
|
|
47906
|
+
localStorage.setItem(UM, e);
|
|
47855
47907
|
} catch {}
|
|
47856
47908
|
}
|
|
47857
|
-
function
|
|
47909
|
+
function eN() {
|
|
47858
47910
|
try {
|
|
47859
|
-
localStorage.removeItem(
|
|
47911
|
+
localStorage.removeItem(UM);
|
|
47860
47912
|
} catch {}
|
|
47861
47913
|
}
|
|
47862
|
-
async function
|
|
47914
|
+
async function tN(e, t, n) {
|
|
47863
47915
|
let r = e.indexOf(".");
|
|
47864
47916
|
if (r === -1) return !1;
|
|
47865
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
47917
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = JM(i), s = JM(a), c = await ZM();
|
|
47866
47918
|
if (!await crypto.subtle.verify({
|
|
47867
47919
|
name: "ECDSA",
|
|
47868
47920
|
hash: "SHA-256"
|
|
47869
47921
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
47870
47922
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
47871
47923
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
47872
|
-
let u = await
|
|
47924
|
+
let u = await YM(t);
|
|
47873
47925
|
return !(l.key !== u || l.domain !== n);
|
|
47874
47926
|
}
|
|
47875
|
-
async function
|
|
47876
|
-
let t =
|
|
47927
|
+
async function nN(e) {
|
|
47928
|
+
let t = QM();
|
|
47877
47929
|
if (!t) return {
|
|
47878
47930
|
valid: !1,
|
|
47879
47931
|
errorCode: "license.invalid"
|
|
47880
47932
|
};
|
|
47881
47933
|
try {
|
|
47882
|
-
if (await
|
|
47934
|
+
if (await tN(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
47883
47935
|
valid: !0,
|
|
47884
47936
|
errorCode: null
|
|
47885
47937
|
};
|
|
@@ -47889,23 +47941,23 @@ async function eN(e) {
|
|
|
47889
47941
|
errorCode: "license.invalid"
|
|
47890
47942
|
};
|
|
47891
47943
|
}
|
|
47892
|
-
async function
|
|
47893
|
-
if (
|
|
47944
|
+
async function rN(e, t = !0) {
|
|
47945
|
+
if (GM() || KM()) return {
|
|
47894
47946
|
valid: !0,
|
|
47895
47947
|
errorCode: null
|
|
47896
47948
|
};
|
|
47897
|
-
let n =
|
|
47949
|
+
let n = qM();
|
|
47898
47950
|
try {
|
|
47899
47951
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
47900
47952
|
if (r.ok) {
|
|
47901
47953
|
let e = await r.json();
|
|
47902
|
-
return t && e.grant &&
|
|
47954
|
+
return t && e.grant && $M(e.grant), {
|
|
47903
47955
|
valid: !0,
|
|
47904
47956
|
errorCode: null
|
|
47905
47957
|
};
|
|
47906
47958
|
}
|
|
47907
47959
|
if (r.status >= 400 && r.status < 500) {
|
|
47908
|
-
t &&
|
|
47960
|
+
t && eN();
|
|
47909
47961
|
try {
|
|
47910
47962
|
return await r.json();
|
|
47911
47963
|
} catch {
|
|
@@ -47917,7 +47969,7 @@ async function tN(e, t = !0) {
|
|
|
47917
47969
|
}
|
|
47918
47970
|
throw Error(`Server error: ${r.status}`);
|
|
47919
47971
|
} catch {
|
|
47920
|
-
return t ?
|
|
47972
|
+
return t ? nN(e) : {
|
|
47921
47973
|
valid: !1,
|
|
47922
47974
|
errorCode: "license.invalid"
|
|
47923
47975
|
};
|
|
@@ -47925,7 +47977,7 @@ async function tN(e, t = !0) {
|
|
|
47925
47977
|
}
|
|
47926
47978
|
//#endregion
|
|
47927
47979
|
//#region src/hooks/useLicenseValidation.ts
|
|
47928
|
-
function
|
|
47980
|
+
function iN(e, t, n = !0) {
|
|
47929
47981
|
let [r, i] = (0, y.useState)({
|
|
47930
47982
|
isValidating: t,
|
|
47931
47983
|
isValid: !1,
|
|
@@ -47945,7 +47997,7 @@ function nN(e, t, n = !0) {
|
|
|
47945
47997
|
isValidating: !0,
|
|
47946
47998
|
isValid: !1,
|
|
47947
47999
|
errorCode: null
|
|
47948
|
-
}),
|
|
48000
|
+
}), rN(e, n).then((e) => {
|
|
47949
48001
|
r || i({
|
|
47950
48002
|
isValidating: !1,
|
|
47951
48003
|
isValid: e.valid,
|
|
@@ -47968,7 +48020,7 @@ function nN(e, t, n = !0) {
|
|
|
47968
48020
|
}
|
|
47969
48021
|
//#endregion
|
|
47970
48022
|
//#region src/server/auth/AuthState.ts
|
|
47971
|
-
var
|
|
48023
|
+
var aN = class {
|
|
47972
48024
|
token = null;
|
|
47973
48025
|
get() {
|
|
47974
48026
|
return this.token;
|
|
@@ -47979,13 +48031,13 @@ var rN = class {
|
|
|
47979
48031
|
clear() {
|
|
47980
48032
|
this.token = null;
|
|
47981
48033
|
}
|
|
47982
|
-
},
|
|
48034
|
+
}, oN = class extends Error {
|
|
47983
48035
|
status;
|
|
47984
48036
|
code;
|
|
47985
48037
|
constructor(e) {
|
|
47986
48038
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
47987
48039
|
}
|
|
47988
|
-
},
|
|
48040
|
+
}, sN = class {
|
|
47989
48041
|
baseUrl;
|
|
47990
48042
|
apiKey;
|
|
47991
48043
|
auth;
|
|
@@ -48015,7 +48067,7 @@ var rN = class {
|
|
|
48015
48067
|
signal: r?.signal
|
|
48016
48068
|
});
|
|
48017
48069
|
} catch (e) {
|
|
48018
|
-
this.notify(new
|
|
48070
|
+
this.notify(new oN({
|
|
48019
48071
|
status: 0,
|
|
48020
48072
|
code: "network",
|
|
48021
48073
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -48026,7 +48078,7 @@ var rN = class {
|
|
|
48026
48078
|
try {
|
|
48027
48079
|
e = await s.json();
|
|
48028
48080
|
} catch {}
|
|
48029
|
-
this.notify(new
|
|
48081
|
+
this.notify(new oN({
|
|
48030
48082
|
status: s.status,
|
|
48031
48083
|
code: e.error ?? `http_${s.status}`,
|
|
48032
48084
|
message: e.message ?? s.statusText
|
|
@@ -48037,23 +48089,23 @@ var rN = class {
|
|
|
48037
48089
|
};
|
|
48038
48090
|
//#endregion
|
|
48039
48091
|
//#region src/server/endpoints/workspaces.ts
|
|
48040
|
-
async function
|
|
48092
|
+
async function cN(e, t) {
|
|
48041
48093
|
return e.post("/workspaces", {
|
|
48042
48094
|
primaryKey: t.primaryKey,
|
|
48043
48095
|
columns: t.columns
|
|
48044
48096
|
}, { signal: t.signal });
|
|
48045
48097
|
}
|
|
48046
|
-
async function
|
|
48098
|
+
async function lN(e) {
|
|
48047
48099
|
try {
|
|
48048
48100
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
48049
48101
|
} catch (e) {
|
|
48050
|
-
if (e instanceof
|
|
48102
|
+
if (e instanceof oN && e.status === 404) return;
|
|
48051
48103
|
throw e;
|
|
48052
48104
|
}
|
|
48053
48105
|
}
|
|
48054
48106
|
//#endregion
|
|
48055
48107
|
//#region src/server/endpoints/query.ts
|
|
48056
|
-
async function
|
|
48108
|
+
async function uN(e, t) {
|
|
48057
48109
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
48058
48110
|
page: {
|
|
48059
48111
|
limit: t.limit,
|
|
@@ -48071,12 +48123,12 @@ async function cN(e, t) {
|
|
|
48071
48123
|
}
|
|
48072
48124
|
//#endregion
|
|
48073
48125
|
//#region src/server/ScaleClient.ts
|
|
48074
|
-
var
|
|
48126
|
+
var dN = class {
|
|
48075
48127
|
disposed = !1;
|
|
48076
48128
|
constructor(e) {
|
|
48077
48129
|
this.deps = e;
|
|
48078
48130
|
}
|
|
48079
|
-
onQuery = (e) =>
|
|
48131
|
+
onQuery = (e) => uN(this.deps, e);
|
|
48080
48132
|
onEdit = async (e) => ({
|
|
48081
48133
|
rejected: !0,
|
|
48082
48134
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -48093,7 +48145,7 @@ var lN = class {
|
|
|
48093
48145
|
pageSize = void 0;
|
|
48094
48146
|
scrollSensitivity = void 0;
|
|
48095
48147
|
dispose = async () => {
|
|
48096
|
-
this.disposed || (this.disposed = !0, await
|
|
48148
|
+
this.disposed || (this.disposed = !0, await lN({
|
|
48097
48149
|
http: this.deps.http,
|
|
48098
48150
|
workspaceId: this.deps.workspaceId
|
|
48099
48151
|
}));
|
|
@@ -48101,25 +48153,25 @@ var lN = class {
|
|
|
48101
48153
|
};
|
|
48102
48154
|
//#endregion
|
|
48103
48155
|
//#region src/server/createScaleClient.ts
|
|
48104
|
-
async function
|
|
48105
|
-
let t = new
|
|
48156
|
+
async function fN(e) {
|
|
48157
|
+
let t = new aN(), n = new sN({
|
|
48106
48158
|
baseUrl: e.url,
|
|
48107
48159
|
apiKey: e.apiKey,
|
|
48108
48160
|
auth: t,
|
|
48109
48161
|
onDegraded: e.onDegraded
|
|
48110
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
48162
|
+
}), { workspaceId: r, accessToken: i } = await cN(n, {
|
|
48111
48163
|
primaryKey: e.primaryKey,
|
|
48112
48164
|
columns: e.columns,
|
|
48113
48165
|
signal: e.signal
|
|
48114
48166
|
});
|
|
48115
|
-
return t.set(i), new
|
|
48167
|
+
return t.set(i), new dN({
|
|
48116
48168
|
workspaceId: r,
|
|
48117
48169
|
http: n
|
|
48118
48170
|
});
|
|
48119
48171
|
}
|
|
48120
48172
|
//#endregion
|
|
48121
48173
|
//#region src/server/errors.ts
|
|
48122
|
-
function
|
|
48174
|
+
function pN(e, t, n) {
|
|
48123
48175
|
return {
|
|
48124
48176
|
code: e,
|
|
48125
48177
|
message: t,
|
|
@@ -48129,7 +48181,7 @@ function dN(e, t, n) {
|
|
|
48129
48181
|
}
|
|
48130
48182
|
//#endregion
|
|
48131
48183
|
//#region src/hooks/useScaleClient.ts
|
|
48132
|
-
function
|
|
48184
|
+
function mN(e) {
|
|
48133
48185
|
let [t, n] = (0, y.useState)({ status: "idle" }), r = (0, y.useRef)(e.columns), i = (0, y.useRef)(e.primaryKey);
|
|
48134
48186
|
return (0, y.useEffect)(() => {
|
|
48135
48187
|
if (!e.enabled) {
|
|
@@ -48138,7 +48190,7 @@ function fN(e) {
|
|
|
48138
48190
|
}
|
|
48139
48191
|
n({ status: "bootstrapping" });
|
|
48140
48192
|
let t = new AbortController(), a = null;
|
|
48141
|
-
return
|
|
48193
|
+
return fN({
|
|
48142
48194
|
url: e.url,
|
|
48143
48195
|
apiKey: e.apiKey,
|
|
48144
48196
|
primaryKey: i.current,
|
|
@@ -48147,7 +48199,7 @@ function fN(e) {
|
|
|
48147
48199
|
onDegraded: (e) => {
|
|
48148
48200
|
t.signal.aborted || n({
|
|
48149
48201
|
status: "failed",
|
|
48150
|
-
error:
|
|
48202
|
+
error: gN(e)
|
|
48151
48203
|
});
|
|
48152
48204
|
}
|
|
48153
48205
|
}).then((e) => {
|
|
@@ -48162,7 +48214,7 @@ function fN(e) {
|
|
|
48162
48214
|
}).catch((e) => {
|
|
48163
48215
|
t.signal.aborted || n({
|
|
48164
48216
|
status: "failed",
|
|
48165
|
-
error:
|
|
48217
|
+
error: hN(e)
|
|
48166
48218
|
});
|
|
48167
48219
|
}), () => {
|
|
48168
48220
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -48173,30 +48225,30 @@ function fN(e) {
|
|
|
48173
48225
|
e.apiKey
|
|
48174
48226
|
]), t;
|
|
48175
48227
|
}
|
|
48176
|
-
function
|
|
48177
|
-
return e instanceof
|
|
48228
|
+
function hN(e) {
|
|
48229
|
+
return e instanceof oN ? e.status === 401 ? pN(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? pN("scale.unreachable", e.message, e) : e.status >= 500 ? pN("scale.server_error", e.message, e) : pN("scale.bootstrap_failed", e.message, e) : pN("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
48178
48230
|
}
|
|
48179
|
-
function
|
|
48180
|
-
return e.status === 0 ?
|
|
48231
|
+
function gN(e) {
|
|
48232
|
+
return e.status === 0 ? pN("scale.unreachable", e.message, e) : e.status === 404 ? pN("scale.workspace_lost", e.message, e) : pN("scale.server_error", e.message, e);
|
|
48181
48233
|
}
|
|
48182
48234
|
//#endregion
|
|
48183
48235
|
//#region src/index.tsx
|
|
48184
|
-
function
|
|
48236
|
+
function _N(e) {
|
|
48185
48237
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
48186
48238
|
}
|
|
48187
|
-
function
|
|
48239
|
+
function vN(e) {
|
|
48188
48240
|
let t = (0, y.useMemo)(() => new $u(e.onError), [e.onError]);
|
|
48189
48241
|
return /* @__PURE__ */ (0, O.jsx)(bj, {
|
|
48190
48242
|
errorHandler: t,
|
|
48191
48243
|
children: /* @__PURE__ */ (0, O.jsx)(Qm, {
|
|
48192
48244
|
...e,
|
|
48193
48245
|
errorHandler: t,
|
|
48194
|
-
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(
|
|
48246
|
+
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(VM, {}) : /* @__PURE__ */ (0, O.jsx)(gj, {})
|
|
48195
48247
|
})
|
|
48196
48248
|
});
|
|
48197
48249
|
}
|
|
48198
|
-
function
|
|
48199
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a =
|
|
48250
|
+
function yN(e) {
|
|
48251
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = _N(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = iN(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = mN({
|
|
48200
48252
|
enabled: !s && c && u,
|
|
48201
48253
|
url: e.__server?.url ?? "",
|
|
48202
48254
|
apiKey: e.apiKey,
|
|
@@ -48251,7 +48303,7 @@ function _N(e) {
|
|
|
48251
48303
|
code: e,
|
|
48252
48304
|
message: "License validation failed",
|
|
48253
48305
|
source: "license"
|
|
48254
|
-
} }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(vj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(
|
|
48306
|
+
} }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(vj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(vN, { ...C }) : T(l ?? "license.invalid");
|
|
48255
48307
|
return t === "inline" ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
48256
48308
|
className: "updog__data-editor updog__data-editor-inline",
|
|
48257
48309
|
dir: i,
|
|
@@ -48271,18 +48323,18 @@ function _N(e) {
|
|
|
48271
48323
|
submitText: n("dataEditor.confirmClose.action")
|
|
48272
48324
|
})] });
|
|
48273
48325
|
}
|
|
48274
|
-
function
|
|
48326
|
+
function bN(e) {
|
|
48275
48327
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
48276
48328
|
return /* @__PURE__ */ (0, O.jsx)(A, {
|
|
48277
48329
|
translations: t,
|
|
48278
48330
|
rtl: n,
|
|
48279
48331
|
locale: r,
|
|
48280
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
48332
|
+
children: /* @__PURE__ */ (0, O.jsx)(yN, { ...a })
|
|
48281
48333
|
});
|
|
48282
48334
|
}
|
|
48283
48335
|
//#endregion
|
|
48284
48336
|
//#region src/wc.ts
|
|
48285
|
-
var
|
|
48337
|
+
var xN = {
|
|
48286
48338
|
"api-key": {
|
|
48287
48339
|
prop: "apiKey",
|
|
48288
48340
|
type: "string"
|
|
@@ -48315,12 +48367,12 @@ var yN = {
|
|
|
48315
48367
|
prop: "mode",
|
|
48316
48368
|
type: "string"
|
|
48317
48369
|
}
|
|
48318
|
-
},
|
|
48370
|
+
}, SN = class extends HTMLElement {
|
|
48319
48371
|
_root = null;
|
|
48320
48372
|
_props = {};
|
|
48321
48373
|
_renderScheduled = !1;
|
|
48322
48374
|
static get observedAttributes() {
|
|
48323
|
-
return Object.keys(
|
|
48375
|
+
return Object.keys(xN);
|
|
48324
48376
|
}
|
|
48325
48377
|
connectedCallback() {
|
|
48326
48378
|
this._root = (0, v.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
|
|
@@ -48331,7 +48383,7 @@ var yN = {
|
|
|
48331
48383
|
this._root?.unmount(), this._root = null;
|
|
48332
48384
|
}
|
|
48333
48385
|
attributeChangedCallback(e, t, n) {
|
|
48334
|
-
let r =
|
|
48386
|
+
let r = xN[e];
|
|
48335
48387
|
r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
|
|
48336
48388
|
this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
|
|
48337
48389
|
}), this._scheduleRender());
|
|
@@ -48348,11 +48400,11 @@ var yN = {
|
|
|
48348
48400
|
}
|
|
48349
48401
|
_scheduleRender() {
|
|
48350
48402
|
this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
|
|
48351
|
-
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(
|
|
48403
|
+
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(bN, this._props));
|
|
48352
48404
|
}));
|
|
48353
48405
|
}
|
|
48354
48406
|
};
|
|
48355
|
-
for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(
|
|
48407
|
+
for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(SN.prototype, e, {
|
|
48356
48408
|
get() {
|
|
48357
48409
|
return this._props[e];
|
|
48358
48410
|
},
|
|
@@ -48362,7 +48414,7 @@ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.
|
|
|
48362
48414
|
enumerable: !0,
|
|
48363
48415
|
configurable: !0
|
|
48364
48416
|
});
|
|
48365
|
-
Object.defineProperty(
|
|
48417
|
+
Object.defineProperty(SN.prototype, "open", {
|
|
48366
48418
|
get() {
|
|
48367
48419
|
return this.hasAttribute("open");
|
|
48368
48420
|
},
|
|
@@ -48371,5 +48423,5 @@ Object.defineProperty(bN.prototype, "open", {
|
|
|
48371
48423
|
},
|
|
48372
48424
|
enumerable: !0,
|
|
48373
48425
|
configurable: !0
|
|
48374
|
-
}), customElements.define("updog-editor",
|
|
48426
|
+
}), customElements.define("updog-editor", SN);
|
|
48375
48427
|
//#endregion
|
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.47",
|
|
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",
|