@updog/data-editor 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 +19 -0
- package/index.js +180 -128
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2534,6 +2534,9 @@ declare class DataStore<TRow extends DataEditorRow = DataEditorRow> {
|
|
|
2534
2534
|
};
|
|
2535
2535
|
getValidRows(): TRow[];
|
|
2536
2536
|
getInvalidRows(): TRow[];
|
|
2537
|
+
private learnedSynonyms;
|
|
2538
|
+
private learnedSynonymKeys;
|
|
2539
|
+
recordLearnedSynonyms(delta: LearnedSynonyms): void;
|
|
2537
2540
|
getResultBySource(): DataEditorResult<TRow>;
|
|
2538
2541
|
private isRowVisible;
|
|
2539
2542
|
applyFormula(formulaOrName: string | CellFormula, params: Record<string, unknown>, rects: SelectionRect[], options?: ApplyFormulaOptions): Promise<void>;
|
|
@@ -2702,6 +2705,16 @@ type DataEditorSourceResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
2702
2705
|
* }}
|
|
2703
2706
|
* ```
|
|
2704
2707
|
*/
|
|
2708
|
+
/** A user-confirmed import mapping: `source` (imported) → `target` (canonical). */
|
|
2709
|
+
type LearnedSynonym = {
|
|
2710
|
+
source: string;
|
|
2711
|
+
target: string;
|
|
2712
|
+
};
|
|
2713
|
+
/** User-confirmed import mappings, split by where they were matched. */
|
|
2714
|
+
type LearnedSynonyms = {
|
|
2715
|
+
columns: LearnedSynonym[];
|
|
2716
|
+
values: LearnedSynonym[];
|
|
2717
|
+
};
|
|
2705
2718
|
type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
2706
2719
|
sources: DataEditorSourceResult<TRow>[];
|
|
2707
2720
|
counts: {
|
|
@@ -2710,6 +2723,12 @@ type DataEditorResult<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
2710
2723
|
deleted: number;
|
|
2711
2724
|
invalid: number;
|
|
2712
2725
|
};
|
|
2726
|
+
/**
|
|
2727
|
+
* Import mappings the user confirmed that weren't already known, split into
|
|
2728
|
+
* `columns` and `values`. Persist and feed back through `synonyms` so repeat
|
|
2729
|
+
* imports auto-match. Each list is `[]` when nothing new was learned.
|
|
2730
|
+
*/
|
|
2731
|
+
learnedSynonyms: LearnedSynonyms;
|
|
2713
2732
|
};
|
|
2714
2733
|
/**
|
|
2715
2734
|
* Describes the change state of a single row within a chunk, used to seed
|
package/index.js
CHANGED
|
@@ -8046,7 +8046,10 @@ var tl = (e) => {
|
|
|
8046
8046
|
t && this.serverCounts?.setCounts(t), this.snapshotManager.markCountsDirty(), this.notify();
|
|
8047
8047
|
}
|
|
8048
8048
|
clear() {
|
|
8049
|
-
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.
|
|
8049
|
+
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 = {
|
|
8050
|
+
columns: [],
|
|
8051
|
+
values: []
|
|
8052
|
+
}, this.learnedSynonymKeys.columns.clear(), this.learnedSynonymKeys.values.clear(), this.notify();
|
|
8050
8053
|
}
|
|
8051
8054
|
destroy() {
|
|
8052
8055
|
this.filterEngine.destroy(), this.server?.destroy(), this.transformWorker?.terminate(), this.transformWorker = null, this.clear(), this.serverCounts?.clear(), this.clearViewportRange(), this.snapshotManager.clearListeners();
|
|
@@ -8281,6 +8284,20 @@ var tl = (e) => {
|
|
|
8281
8284
|
}
|
|
8282
8285
|
return e;
|
|
8283
8286
|
}
|
|
8287
|
+
learnedSynonyms = {
|
|
8288
|
+
columns: [],
|
|
8289
|
+
values: []
|
|
8290
|
+
};
|
|
8291
|
+
learnedSynonymKeys = {
|
|
8292
|
+
columns: /* @__PURE__ */ new Set(),
|
|
8293
|
+
values: /* @__PURE__ */ new Set()
|
|
8294
|
+
};
|
|
8295
|
+
recordLearnedSynonyms(e) {
|
|
8296
|
+
for (let t of ["columns", "values"]) for (let n of e[t]) {
|
|
8297
|
+
let e = `${n.source} ${n.target}`;
|
|
8298
|
+
this.learnedSynonymKeys[t].has(e) || (this.learnedSynonymKeys[t].add(e), this.learnedSynonyms[t].push(n));
|
|
8299
|
+
}
|
|
8300
|
+
}
|
|
8284
8301
|
getResultBySource() {
|
|
8285
8302
|
let e = /* @__PURE__ */ new Map();
|
|
8286
8303
|
for (let t of this.sourceManager.values()) e.set(t.id, {
|
|
@@ -8323,7 +8340,8 @@ var tl = (e) => {
|
|
|
8323
8340
|
}
|
|
8324
8341
|
return {
|
|
8325
8342
|
sources: Array.from(e.values()),
|
|
8326
|
-
counts: t
|
|
8343
|
+
counts: t,
|
|
8344
|
+
learnedSynonyms: this.learnedSynonyms
|
|
8327
8345
|
};
|
|
8328
8346
|
}
|
|
8329
8347
|
isRowVisible(e) {
|
|
@@ -20681,7 +20699,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
20681
20699
|
return this.state.hasError ? /* @__PURE__ */ C(cv, { error: lv }) : this.props.children;
|
|
20682
20700
|
}
|
|
20683
20701
|
}, dv = ({ leftSlot: e }) => {
|
|
20684
|
-
let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } =
|
|
20702
|
+
let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = ky(), y = i && t === "editor", b = f(() => {
|
|
20685
20703
|
n(!1);
|
|
20686
20704
|
}, [n]), x = m[h]?.id === "sheet-selection", S = f(() => {
|
|
20687
20705
|
a ? c() : x ? _() : o();
|
|
@@ -21509,7 +21527,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21509
21527
|
]
|
|
21510
21528
|
});
|
|
21511
21529
|
}), Pv = () => {
|
|
21512
|
-
let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } =
|
|
21530
|
+
let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = ky(), [l, u] = b(null), d = y(null), p = f((e, t) => {
|
|
21513
21531
|
if (t === "action:create") {
|
|
21514
21532
|
d.current = e, u({ title: e });
|
|
21515
21533
|
return;
|
|
@@ -21622,7 +21640,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21622
21640
|
]
|
|
21623
21641
|
});
|
|
21624
21642
|
}, Fv = () => {
|
|
21625
|
-
let { parsedCsv: e } =
|
|
21643
|
+
let { parsedCsv: e } = ky();
|
|
21626
21644
|
return e ? /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(Kl, { children: [/* @__PURE__ */ C("div", {
|
|
21627
21645
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
21628
21646
|
children: /* @__PURE__ */ C(Pv, {})
|
|
@@ -21641,7 +21659,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21641
21659
|
})
|
|
21642
21660
|
});
|
|
21643
21661
|
}, Lv = () => {
|
|
21644
|
-
let { columns: e } = X(), { t } = K(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, pendingOptions: s, addPendingOption: c } =
|
|
21662
|
+
let { columns: e } = X(), { t } = K(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, pendingOptions: s, addPendingOption: c } = ky(), [l, u] = b({}), [d, p] = b({}), [h, g] = b(null), _ = y(!1), x = f((e) => {
|
|
21645
21663
|
p((t) => ({
|
|
21646
21664
|
...t,
|
|
21647
21665
|
[e]: !t[e]
|
|
@@ -21877,7 +21895,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21877
21895
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
21878
21896
|
children: /* @__PURE__ */ C(Lv, {})
|
|
21879
21897
|
}), /* @__PURE__ */ C(dv, {})] }) }), zv = 20, Bv = () => {
|
|
21880
|
-
let { columns: e, store: t } = X(), { t: n } = K(), { primaryKey: r, onPrimaryKeyChange: i, parsedCsv: a, columnMapping: o } =
|
|
21898
|
+
let { columns: e, store: t } = X(), { t: n } = K(), { primaryKey: r, onPrimaryKeyChange: i, parsedCsv: a, columnMapping: o } = ky(), s = t.isClient(), c = f(() => i(null), [i]), l = e.filter((e) => e.unique), u = v(() => {
|
|
21881
21899
|
let e = {};
|
|
21882
21900
|
for (let [t, n] of Object.entries(o)) n && (e[n] = t);
|
|
21883
21901
|
return e;
|
|
@@ -21952,7 +21970,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21952
21970
|
title: e.description,
|
|
21953
21971
|
children: e.label
|
|
21954
21972
|
}), Wv = () => {
|
|
21955
|
-
let { importFormats: e, remoteSources: t } = X(), n = e === !1 ? [] : e, { t: r } = K(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } =
|
|
21973
|
+
let { importFormats: e, remoteSources: t } = X(), n = e === !1 ? [] : e, { t: r } = K(), { remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = ky();
|
|
21956
21974
|
return /* @__PURE__ */ w("div", {
|
|
21957
21975
|
className: "updog__source-picker",
|
|
21958
21976
|
children: [
|
|
@@ -22007,7 +22025,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
22007
22025
|
})]
|
|
22008
22026
|
});
|
|
22009
22027
|
}, Kv = () => {
|
|
22010
|
-
let { columns: e, importFormats: t, sampleData: n } = X(), r = t === !1 ? [] : t, { t: i } = K(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c, isParsing: l, remoteSourceLoading: u } =
|
|
22028
|
+
let { columns: e, importFormats: t, sampleData: n } = X(), r = t === !1 ? [] : t, { t: i } = K(), { parsedCsv: a, xlsxFile: o, handleFileRemoved: s, parseFile: c, isParsing: l, remoteSourceLoading: u } = ky(), d = [
|
|
22011
22029
|
{
|
|
22012
22030
|
id: "csv",
|
|
22013
22031
|
format: "csv",
|
|
@@ -22097,7 +22115,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
22097
22115
|
]
|
|
22098
22116
|
}) });
|
|
22099
22117
|
}, qv = ({ preview: e }) => {
|
|
22100
|
-
let { selectedSheet: t, setSelectedSheet: n } =
|
|
22118
|
+
let { selectedSheet: t, setSelectedSheet: n } = ky(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
|
|
22101
22119
|
let { headers: t, rows: n } = e;
|
|
22102
22120
|
return n.map((e) => t.map((t) => e[t] ?? ""));
|
|
22103
22121
|
}, [e]);
|
|
@@ -22135,7 +22153,7 @@ var Z_ = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
22135
22153
|
})
|
|
22136
22154
|
});
|
|
22137
22155
|
}, Jv = () => {
|
|
22138
|
-
let { sheetPreviews: e } =
|
|
22156
|
+
let { sheetPreviews: e } = ky();
|
|
22139
22157
|
return /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(Kl, { children: [/* @__PURE__ */ C("div", {
|
|
22140
22158
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
22141
22159
|
children: /* @__PURE__ */ C("div", {
|
|
@@ -22243,16 +22261,47 @@ function cy(e) {
|
|
|
22243
22261
|
rawCells: i
|
|
22244
22262
|
};
|
|
22245
22263
|
}
|
|
22246
|
-
|
|
22264
|
+
//#endregion
|
|
22265
|
+
//#region src/components/DataUploader/utils/learnedSynonyms.ts
|
|
22266
|
+
var ly = (e) => {
|
|
22267
|
+
let t = /* @__PURE__ */ new Map();
|
|
22268
|
+
for (let [n, r] of Object.entries(e)) {
|
|
22269
|
+
let e = hv(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
22270
|
+
for (let e of r) i.add(hv(e));
|
|
22271
|
+
t.set(e, i);
|
|
22272
|
+
}
|
|
22273
|
+
return t;
|
|
22274
|
+
}, uy = (e, t, n, r) => {
|
|
22275
|
+
let i = ly(r), a = (e, t) => i.get(hv(e))?.has(hv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
|
|
22276
|
+
if (hv(n) === hv(r) || a(r, n)) return;
|
|
22277
|
+
let i = `${n} ${r}`;
|
|
22278
|
+
t.has(i) || (t.add(i), e.push({
|
|
22279
|
+
source: n,
|
|
22280
|
+
target: r
|
|
22281
|
+
}));
|
|
22282
|
+
}, c = {
|
|
22283
|
+
columns: [],
|
|
22284
|
+
values: []
|
|
22285
|
+
}, l = s(c.columns, /* @__PURE__ */ new Set());
|
|
22286
|
+
for (let [t, n] of Object.entries(e)) {
|
|
22287
|
+
if (!n) continue;
|
|
22288
|
+
let e = o.get(n);
|
|
22289
|
+
e && l(t, e.title);
|
|
22290
|
+
}
|
|
22291
|
+
let u = s(c.values, /* @__PURE__ */ new Set());
|
|
22292
|
+
for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
|
|
22293
|
+
return c;
|
|
22294
|
+
};
|
|
22295
|
+
function dy(e, t, n) {
|
|
22247
22296
|
let r = e.length, i = t;
|
|
22248
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
22297
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? fy(i, i - r) : fy(r - 1, i - 1)) > 1e3 ? [] : r < i ? py(e, i) : my(e, i, n);
|
|
22249
22298
|
}
|
|
22250
|
-
function
|
|
22299
|
+
function fy(e, t) {
|
|
22251
22300
|
let n = Math.min(t, e - t), r = 1;
|
|
22252
22301
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
22253
22302
|
return r;
|
|
22254
22303
|
}
|
|
22255
|
-
function
|
|
22304
|
+
function py(e, t) {
|
|
22256
22305
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
22257
22306
|
if (i.length === n) {
|
|
22258
22307
|
let a = Array(t).fill("");
|
|
@@ -22264,7 +22313,7 @@ function dy(e, t) {
|
|
|
22264
22313
|
};
|
|
22265
22314
|
return a(0), r;
|
|
22266
22315
|
}
|
|
22267
|
-
function
|
|
22316
|
+
function my(e, t, n) {
|
|
22268
22317
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
22269
22318
|
if (a.length === t - 1) {
|
|
22270
22319
|
let o = [
|
|
@@ -22282,27 +22331,27 @@ function fy(e, t, n) {
|
|
|
22282
22331
|
}
|
|
22283
22332
|
//#endregion
|
|
22284
22333
|
//#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
|
|
22285
|
-
var
|
|
22286
|
-
function
|
|
22334
|
+
var hy = {};
|
|
22335
|
+
function gy(e, t) {
|
|
22287
22336
|
for (let n of t.validators ?? []) if (n.type !== "expression") {
|
|
22288
22337
|
if (n.type === "function") {
|
|
22289
|
-
if (n.fn(e,
|
|
22338
|
+
if (n.fn(e, hy) != null) return !1;
|
|
22290
22339
|
continue;
|
|
22291
22340
|
}
|
|
22292
|
-
if (Ol(n, e,
|
|
22341
|
+
if (Ol(n, e, hy) != null) return !1;
|
|
22293
22342
|
}
|
|
22294
22343
|
return !0;
|
|
22295
22344
|
}
|
|
22296
|
-
function
|
|
22297
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
22345
|
+
function _y(e, t) {
|
|
22346
|
+
for (let n = 0; n < t.length; n++) if (!gy(e.cells[n] ?? "", t[n])) return !1;
|
|
22298
22347
|
return !0;
|
|
22299
22348
|
}
|
|
22300
|
-
function
|
|
22301
|
-
return e.filter((e) =>
|
|
22349
|
+
function vy(e, t) {
|
|
22350
|
+
return e.filter((e) => _y(e, t));
|
|
22302
22351
|
}
|
|
22303
22352
|
//#endregion
|
|
22304
22353
|
//#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
|
|
22305
|
-
function
|
|
22354
|
+
function yy(e) {
|
|
22306
22355
|
if (e.length <= 1) return [];
|
|
22307
22356
|
let t = e[0].cells.length, n = [], r = -1;
|
|
22308
22357
|
for (let i = 0; i < t; i++) {
|
|
@@ -22319,25 +22368,25 @@ function _y(e) {
|
|
|
22319
22368
|
}
|
|
22320
22369
|
//#endregion
|
|
22321
22370
|
//#region src/components/DataUploader/utils/raggedRows/alignRow.ts
|
|
22322
|
-
function
|
|
22323
|
-
let r =
|
|
22371
|
+
function by(e, t, n) {
|
|
22372
|
+
let r = dy(e, t.length, n), i = vy(r, t);
|
|
22324
22373
|
return i.length === 1 ? {
|
|
22325
22374
|
kind: "confident",
|
|
22326
22375
|
alignment: i[0]
|
|
22327
22376
|
} : i.length > 1 ? {
|
|
22328
22377
|
kind: "ambiguous",
|
|
22329
22378
|
candidates: i,
|
|
22330
|
-
disputeSpans:
|
|
22379
|
+
disputeSpans: yy(i)
|
|
22331
22380
|
} : {
|
|
22332
22381
|
kind: "invalid",
|
|
22333
22382
|
candidates: r,
|
|
22334
|
-
disputeSpans:
|
|
22383
|
+
disputeSpans: yy(r)
|
|
22335
22384
|
};
|
|
22336
22385
|
}
|
|
22337
22386
|
//#endregion
|
|
22338
22387
|
//#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
|
|
22339
|
-
function
|
|
22340
|
-
let r =
|
|
22388
|
+
function xy(e, t, n) {
|
|
22389
|
+
let r = by(e, t, n);
|
|
22341
22390
|
if (r.kind === "confident") return {
|
|
22342
22391
|
cells: r.alignment.cells,
|
|
22343
22392
|
conflictColumns: []
|
|
@@ -22356,13 +22405,13 @@ function yy(e, t, n) {
|
|
|
22356
22405
|
}
|
|
22357
22406
|
//#endregion
|
|
22358
22407
|
//#region src/components/DataUploader/context/useViewModel.tsx
|
|
22359
|
-
var
|
|
22408
|
+
var Sy = 5e3, Cy = 15, wy = 20, Ty = new Set([
|
|
22360
22409
|
"xlsx",
|
|
22361
22410
|
"xls",
|
|
22362
22411
|
"xlsb",
|
|
22363
22412
|
"ods"
|
|
22364
22413
|
]);
|
|
22365
|
-
function
|
|
22414
|
+
function Ey() {
|
|
22366
22415
|
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 } = X(), { t: p } = K(), [h, g] = b(0), [_, x] = b(0), [S, w] = b(null), [T, E] = b({}), D = n.filter((e) => e.unique), [O, k] = b(() => r), [A, j] = b(!1), [M, N] = b(!1), [P, F] = b(null), [I, L] = b([]), [R, z] = b(null), [B, V] = b([]), [ee, te] = b({}), [H, ne] = b([]), [re, ie] = b({}), ae = y(null), [oe, se] = b(0), ce = f((e) => {
|
|
22367
22416
|
M || k(e);
|
|
22368
22417
|
}, [M]), le = y(null);
|
|
@@ -22520,7 +22569,7 @@ function wy() {
|
|
|
22520
22569
|
return {
|
|
22521
22570
|
name: e.name,
|
|
22522
22571
|
headers: t,
|
|
22523
|
-
rows: n.slice(0,
|
|
22572
|
+
rows: n.slice(0, Cy),
|
|
22524
22573
|
totalRows: e.totalRows - 1
|
|
22525
22574
|
};
|
|
22526
22575
|
});
|
|
@@ -22554,7 +22603,7 @@ function wy() {
|
|
|
22554
22603
|
]), De = f((e) => {
|
|
22555
22604
|
j(!0), ae.current = e;
|
|
22556
22605
|
let t = e.name.split(".").pop()?.toLowerCase();
|
|
22557
|
-
t &&
|
|
22606
|
+
t && Ty.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
|
|
22558
22607
|
}, [
|
|
22559
22608
|
Ce,
|
|
22560
22609
|
we,
|
|
@@ -22620,6 +22669,7 @@ function wy() {
|
|
|
22620
22669
|
Ie({});
|
|
22621
22670
|
return;
|
|
22622
22671
|
}
|
|
22672
|
+
if (M) return;
|
|
22623
22673
|
let e = {};
|
|
22624
22674
|
for (let [t, r] of Object.entries(T)) {
|
|
22625
22675
|
if (!r) continue;
|
|
@@ -22648,7 +22698,8 @@ function wy() {
|
|
|
22648
22698
|
T,
|
|
22649
22699
|
n,
|
|
22650
22700
|
c,
|
|
22651
|
-
l
|
|
22701
|
+
l,
|
|
22702
|
+
M
|
|
22652
22703
|
]);
|
|
22653
22704
|
let Re = v(() => {
|
|
22654
22705
|
let e = {};
|
|
@@ -22717,7 +22768,7 @@ function wy() {
|
|
|
22717
22768
|
if (!S || !d?.onRowsImport) return;
|
|
22718
22769
|
let t = S;
|
|
22719
22770
|
w(null);
|
|
22720
|
-
let r = crypto.randomUUID(), i = He(), a = new AbortController(), o = d.importChunkSize ??
|
|
22771
|
+
let r = crypto.randomUUID(), i = He(), a = new AbortController(), o = d.importChunkSize ?? Sy, s = Yv(T, n, new Set(H.map((e) => e.id))), c = {
|
|
22721
22772
|
numberFormat: i.numberFormat,
|
|
22722
22773
|
dateFormat: i.dateFormat,
|
|
22723
22774
|
monthTable: nc(p),
|
|
@@ -22762,49 +22813,49 @@ function wy() {
|
|
|
22762
22813
|
H.length > 0 && u(H);
|
|
22763
22814
|
for (let [t, n] of Object.entries(re)) e.addColumnOptions(t, n);
|
|
22764
22815
|
let o = e.registerSource({ name: i.fileName });
|
|
22765
|
-
e.setSourceLoading(o, !0);
|
|
22816
|
+
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(uy(T, Re, [...n, ...H], pv(fv, l)));
|
|
22766
22817
|
let s = Yv(T, n, a), c = {
|
|
22767
22818
|
numberFormat: $s(i.rows, Xv(s)),
|
|
22768
22819
|
dateFormat: ic(i.rows, Ve(a)),
|
|
22769
22820
|
monthTable: nc(p),
|
|
22770
22821
|
valueMapping: Re
|
|
22771
|
-
},
|
|
22822
|
+
}, d = i.rows, f = i.rawCells ?? [], m = i.delimiter ?? ",", h = i.headers, g = h.map((e) => {
|
|
22772
22823
|
let t = T[e];
|
|
22773
22824
|
return (t ? n.find((e) => e.id === t) : void 0) ?? {
|
|
22774
22825
|
id: e,
|
|
22775
22826
|
title: e
|
|
22776
22827
|
};
|
|
22777
|
-
}),
|
|
22778
|
-
let n = Math.min(
|
|
22779
|
-
for (let e =
|
|
22780
|
-
let t =
|
|
22828
|
+
}), _ = 0, v = () => {
|
|
22829
|
+
let n = Math.min(_ + Sy, d.length), i = [], a = [];
|
|
22830
|
+
for (let e = _; e < n; e++) {
|
|
22831
|
+
let t = d[e], n = f[e];
|
|
22781
22832
|
if (n) {
|
|
22782
|
-
let { cells: r, conflictColumns: i } =
|
|
22833
|
+
let { cells: r, conflictColumns: i } = xy(n, g, m);
|
|
22783
22834
|
if (r.length) {
|
|
22784
22835
|
let e = {};
|
|
22785
|
-
for (let t = 0; t <
|
|
22836
|
+
for (let t = 0; t < h.length; t++) e[h[t]] = r[t] ?? "";
|
|
22786
22837
|
t = e;
|
|
22787
22838
|
}
|
|
22788
22839
|
if (i.length) {
|
|
22789
22840
|
let t = [];
|
|
22790
22841
|
for (let e of i) {
|
|
22791
|
-
let n = T[
|
|
22842
|
+
let n = T[h[e]];
|
|
22792
22843
|
n && t.push(n);
|
|
22793
22844
|
}
|
|
22794
22845
|
t.length && a.push({
|
|
22795
|
-
localIndex: e -
|
|
22846
|
+
localIndex: e - _,
|
|
22796
22847
|
columnIds: t
|
|
22797
22848
|
});
|
|
22798
22849
|
}
|
|
22799
22850
|
}
|
|
22800
22851
|
i.push(Zv(t, s, c));
|
|
22801
22852
|
}
|
|
22802
|
-
let { rows:
|
|
22803
|
-
for (let e =
|
|
22804
|
-
|
|
22805
|
-
t.validateRows(
|
|
22853
|
+
let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: O ?? void 0 });
|
|
22854
|
+
for (let e = _; e < n; e++) e < wy || (d[e] = null, e < f.length && (f[e] = null));
|
|
22855
|
+
_ = n, setTimeout(() => {
|
|
22856
|
+
t.validateRows(l, u);
|
|
22806
22857
|
for (let { localIndex: t, columnIds: n } of a) {
|
|
22807
|
-
let r =
|
|
22858
|
+
let r = u[t];
|
|
22808
22859
|
for (let t of n) {
|
|
22809
22860
|
let n = e.getCellValidation(r, t) ?? [];
|
|
22810
22861
|
e.setCellValidation(r, t, [...n, {
|
|
@@ -22814,11 +22865,11 @@ function wy() {
|
|
|
22814
22865
|
}
|
|
22815
22866
|
}
|
|
22816
22867
|
a.length > 0 && e.notify();
|
|
22817
|
-
}, 0),
|
|
22868
|
+
}, 0), _ < d.length ? setTimeout(v, 0) : e.finalizeSource(o).then(() => {
|
|
22818
22869
|
t.validateUniqueness(), r();
|
|
22819
22870
|
});
|
|
22820
22871
|
};
|
|
22821
|
-
|
|
22872
|
+
v();
|
|
22822
22873
|
}, 0);
|
|
22823
22874
|
}), [
|
|
22824
22875
|
S,
|
|
@@ -22831,6 +22882,7 @@ function wy() {
|
|
|
22831
22882
|
n,
|
|
22832
22883
|
u,
|
|
22833
22884
|
Re,
|
|
22885
|
+
l,
|
|
22834
22886
|
Ve,
|
|
22835
22887
|
p
|
|
22836
22888
|
]);
|
|
@@ -22896,20 +22948,20 @@ function wy() {
|
|
|
22896
22948
|
}
|
|
22897
22949
|
//#endregion
|
|
22898
22950
|
//#region src/components/DataUploader/context/index.tsx
|
|
22899
|
-
var
|
|
22900
|
-
function
|
|
22901
|
-
let t =
|
|
22902
|
-
return /* @__PURE__ */ C(
|
|
22951
|
+
var Dy = s(null);
|
|
22952
|
+
function Oy({ children: e }) {
|
|
22953
|
+
let t = Ey();
|
|
22954
|
+
return /* @__PURE__ */ C(Dy.Provider, {
|
|
22903
22955
|
value: t,
|
|
22904
22956
|
children: e
|
|
22905
22957
|
});
|
|
22906
22958
|
}
|
|
22907
|
-
var
|
|
22908
|
-
let e = p(
|
|
22959
|
+
var ky = () => {
|
|
22960
|
+
let e = p(Dy);
|
|
22909
22961
|
if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
|
|
22910
22962
|
return e;
|
|
22911
|
-
},
|
|
22912
|
-
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } =
|
|
22963
|
+
}, Ay = () => {
|
|
22964
|
+
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = ky();
|
|
22913
22965
|
return /* @__PURE__ */ C(so, {
|
|
22914
22966
|
steps: e,
|
|
22915
22967
|
activeStepIndex: t,
|
|
@@ -22917,79 +22969,79 @@ var Dy = () => {
|
|
|
22917
22969
|
onStepChange: r,
|
|
22918
22970
|
isProgressive: !0
|
|
22919
22971
|
});
|
|
22920
|
-
},
|
|
22972
|
+
}, jy = () => /* @__PURE__ */ C(Oy, { children: /* @__PURE__ */ C(Ay, {}) }), My = {
|
|
22921
22973
|
kty: "EC",
|
|
22922
22974
|
crv: "P-256",
|
|
22923
22975
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
22924
22976
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
22925
|
-
},
|
|
22977
|
+
}, Ny = "updog_license_grant", Py = new Set([
|
|
22926
22978
|
"updog.tech",
|
|
22927
22979
|
"landing.updog.tech",
|
|
22928
22980
|
"demo.updog.tech"
|
|
22929
22981
|
]);
|
|
22930
|
-
function
|
|
22931
|
-
return
|
|
22982
|
+
function Fy() {
|
|
22983
|
+
return Py.has(window.location.hostname);
|
|
22932
22984
|
}
|
|
22933
|
-
function
|
|
22985
|
+
function Iy() {
|
|
22934
22986
|
return !1;
|
|
22935
22987
|
}
|
|
22936
|
-
function
|
|
22988
|
+
function Ly() {
|
|
22937
22989
|
return "https://api.updog.tech";
|
|
22938
22990
|
}
|
|
22939
|
-
function
|
|
22991
|
+
function Ry(e) {
|
|
22940
22992
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
22941
22993
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
22942
22994
|
return i;
|
|
22943
22995
|
}
|
|
22944
|
-
async function
|
|
22996
|
+
async function zy(e) {
|
|
22945
22997
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
22946
22998
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
22947
22999
|
}
|
|
22948
|
-
var
|
|
22949
|
-
async function
|
|
22950
|
-
return
|
|
23000
|
+
var By = null;
|
|
23001
|
+
async function Vy() {
|
|
23002
|
+
return By || (By = await crypto.subtle.importKey("jwk", My, {
|
|
22951
23003
|
name: "ECDSA",
|
|
22952
23004
|
namedCurve: "P-256"
|
|
22953
|
-
}, !1, ["verify"]),
|
|
23005
|
+
}, !1, ["verify"]), By);
|
|
22954
23006
|
}
|
|
22955
|
-
function
|
|
23007
|
+
function Hy() {
|
|
22956
23008
|
try {
|
|
22957
|
-
return localStorage.getItem(
|
|
23009
|
+
return localStorage.getItem(Ny);
|
|
22958
23010
|
} catch {
|
|
22959
23011
|
return null;
|
|
22960
23012
|
}
|
|
22961
23013
|
}
|
|
22962
|
-
function
|
|
23014
|
+
function Uy(e) {
|
|
22963
23015
|
try {
|
|
22964
|
-
localStorage.setItem(
|
|
23016
|
+
localStorage.setItem(Ny, e);
|
|
22965
23017
|
} catch {}
|
|
22966
23018
|
}
|
|
22967
|
-
function
|
|
23019
|
+
function Wy() {
|
|
22968
23020
|
try {
|
|
22969
|
-
localStorage.removeItem(
|
|
23021
|
+
localStorage.removeItem(Ny);
|
|
22970
23022
|
} catch {}
|
|
22971
23023
|
}
|
|
22972
|
-
async function
|
|
23024
|
+
async function Gy(e, t, n) {
|
|
22973
23025
|
let r = e.indexOf(".");
|
|
22974
23026
|
if (r === -1) return !1;
|
|
22975
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
23027
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = Ry(i), s = Ry(a), c = await Vy();
|
|
22976
23028
|
if (!await crypto.subtle.verify({
|
|
22977
23029
|
name: "ECDSA",
|
|
22978
23030
|
hash: "SHA-256"
|
|
22979
23031
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
22980
23032
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
22981
23033
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
22982
|
-
let u = await
|
|
23034
|
+
let u = await zy(t);
|
|
22983
23035
|
return !(l.key !== u || l.domain !== n);
|
|
22984
23036
|
}
|
|
22985
|
-
async function
|
|
22986
|
-
let t =
|
|
23037
|
+
async function Ky(e) {
|
|
23038
|
+
let t = Hy();
|
|
22987
23039
|
if (!t) return {
|
|
22988
23040
|
valid: !1,
|
|
22989
23041
|
errorCode: "license.invalid"
|
|
22990
23042
|
};
|
|
22991
23043
|
try {
|
|
22992
|
-
if (await
|
|
23044
|
+
if (await Gy(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
22993
23045
|
valid: !0,
|
|
22994
23046
|
errorCode: null
|
|
22995
23047
|
};
|
|
@@ -22999,23 +23051,23 @@ async function Wy(e) {
|
|
|
22999
23051
|
errorCode: "license.invalid"
|
|
23000
23052
|
};
|
|
23001
23053
|
}
|
|
23002
|
-
async function
|
|
23003
|
-
if (
|
|
23054
|
+
async function qy(e, t = !0) {
|
|
23055
|
+
if (Fy() || Iy()) return {
|
|
23004
23056
|
valid: !0,
|
|
23005
23057
|
errorCode: null
|
|
23006
23058
|
};
|
|
23007
|
-
let n =
|
|
23059
|
+
let n = Ly();
|
|
23008
23060
|
try {
|
|
23009
23061
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
23010
23062
|
if (r.ok) {
|
|
23011
23063
|
let e = await r.json();
|
|
23012
|
-
return t && e.grant &&
|
|
23064
|
+
return t && e.grant && Uy(e.grant), {
|
|
23013
23065
|
valid: !0,
|
|
23014
23066
|
errorCode: null
|
|
23015
23067
|
};
|
|
23016
23068
|
}
|
|
23017
23069
|
if (r.status >= 400 && r.status < 500) {
|
|
23018
|
-
t &&
|
|
23070
|
+
t && Wy();
|
|
23019
23071
|
try {
|
|
23020
23072
|
return await r.json();
|
|
23021
23073
|
} catch {
|
|
@@ -23027,7 +23079,7 @@ async function Gy(e, t = !0) {
|
|
|
23027
23079
|
}
|
|
23028
23080
|
throw Error(`Server error: ${r.status}`);
|
|
23029
23081
|
} catch {
|
|
23030
|
-
return t ?
|
|
23082
|
+
return t ? Ky(e) : {
|
|
23031
23083
|
valid: !1,
|
|
23032
23084
|
errorCode: "license.invalid"
|
|
23033
23085
|
};
|
|
@@ -23035,7 +23087,7 @@ async function Gy(e, t = !0) {
|
|
|
23035
23087
|
}
|
|
23036
23088
|
//#endregion
|
|
23037
23089
|
//#region src/hooks/useLicenseValidation.ts
|
|
23038
|
-
function
|
|
23090
|
+
function Jy(e, t, n = !0) {
|
|
23039
23091
|
let [r, i] = b({
|
|
23040
23092
|
isValidating: t,
|
|
23041
23093
|
isValid: !1,
|
|
@@ -23055,7 +23107,7 @@ function Ky(e, t, n = !0) {
|
|
|
23055
23107
|
isValidating: !0,
|
|
23056
23108
|
isValid: !1,
|
|
23057
23109
|
errorCode: null
|
|
23058
|
-
}),
|
|
23110
|
+
}), qy(e, n).then((e) => {
|
|
23059
23111
|
r || i({
|
|
23060
23112
|
isValidating: !1,
|
|
23061
23113
|
isValid: e.valid,
|
|
@@ -23078,7 +23130,7 @@ function Ky(e, t, n = !0) {
|
|
|
23078
23130
|
}
|
|
23079
23131
|
//#endregion
|
|
23080
23132
|
//#region src/server/auth/AuthState.ts
|
|
23081
|
-
var
|
|
23133
|
+
var Yy = class {
|
|
23082
23134
|
token = null;
|
|
23083
23135
|
get() {
|
|
23084
23136
|
return this.token;
|
|
@@ -23089,13 +23141,13 @@ var qy = class {
|
|
|
23089
23141
|
clear() {
|
|
23090
23142
|
this.token = null;
|
|
23091
23143
|
}
|
|
23092
|
-
},
|
|
23144
|
+
}, Xy = class extends Error {
|
|
23093
23145
|
status;
|
|
23094
23146
|
code;
|
|
23095
23147
|
constructor(e) {
|
|
23096
23148
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
23097
23149
|
}
|
|
23098
|
-
},
|
|
23150
|
+
}, Zy = class {
|
|
23099
23151
|
baseUrl;
|
|
23100
23152
|
apiKey;
|
|
23101
23153
|
auth;
|
|
@@ -23125,7 +23177,7 @@ var qy = class {
|
|
|
23125
23177
|
signal: r?.signal
|
|
23126
23178
|
});
|
|
23127
23179
|
} catch (e) {
|
|
23128
|
-
this.notify(new
|
|
23180
|
+
this.notify(new Xy({
|
|
23129
23181
|
status: 0,
|
|
23130
23182
|
code: "network",
|
|
23131
23183
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -23136,7 +23188,7 @@ var qy = class {
|
|
|
23136
23188
|
try {
|
|
23137
23189
|
e = await s.json();
|
|
23138
23190
|
} catch {}
|
|
23139
|
-
this.notify(new
|
|
23191
|
+
this.notify(new Xy({
|
|
23140
23192
|
status: s.status,
|
|
23141
23193
|
code: e.error ?? `http_${s.status}`,
|
|
23142
23194
|
message: e.message ?? s.statusText
|
|
@@ -23147,23 +23199,23 @@ var qy = class {
|
|
|
23147
23199
|
};
|
|
23148
23200
|
//#endregion
|
|
23149
23201
|
//#region src/server/endpoints/workspaces.ts
|
|
23150
|
-
async function
|
|
23202
|
+
async function Qy(e, t) {
|
|
23151
23203
|
return e.post("/workspaces", {
|
|
23152
23204
|
primaryKey: t.primaryKey,
|
|
23153
23205
|
columns: t.columns
|
|
23154
23206
|
}, { signal: t.signal });
|
|
23155
23207
|
}
|
|
23156
|
-
async function
|
|
23208
|
+
async function $y(e) {
|
|
23157
23209
|
try {
|
|
23158
23210
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
23159
23211
|
} catch (e) {
|
|
23160
|
-
if (e instanceof
|
|
23212
|
+
if (e instanceof Xy && e.status === 404) return;
|
|
23161
23213
|
throw e;
|
|
23162
23214
|
}
|
|
23163
23215
|
}
|
|
23164
23216
|
//#endregion
|
|
23165
23217
|
//#region src/server/endpoints/query.ts
|
|
23166
|
-
async function
|
|
23218
|
+
async function eb(e, t) {
|
|
23167
23219
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
23168
23220
|
page: {
|
|
23169
23221
|
limit: t.limit,
|
|
@@ -23181,12 +23233,12 @@ async function Qy(e, t) {
|
|
|
23181
23233
|
}
|
|
23182
23234
|
//#endregion
|
|
23183
23235
|
//#region src/server/ScaleClient.ts
|
|
23184
|
-
var
|
|
23236
|
+
var tb = class {
|
|
23185
23237
|
disposed = !1;
|
|
23186
23238
|
constructor(e) {
|
|
23187
23239
|
this.deps = e;
|
|
23188
23240
|
}
|
|
23189
|
-
onQuery = (e) =>
|
|
23241
|
+
onQuery = (e) => eb(this.deps, e);
|
|
23190
23242
|
onEdit = async (e) => ({
|
|
23191
23243
|
rejected: !0,
|
|
23192
23244
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -23203,7 +23255,7 @@ var $y = class {
|
|
|
23203
23255
|
pageSize = void 0;
|
|
23204
23256
|
scrollSensitivity = void 0;
|
|
23205
23257
|
dispose = async () => {
|
|
23206
|
-
this.disposed || (this.disposed = !0, await
|
|
23258
|
+
this.disposed || (this.disposed = !0, await $y({
|
|
23207
23259
|
http: this.deps.http,
|
|
23208
23260
|
workspaceId: this.deps.workspaceId
|
|
23209
23261
|
}));
|
|
@@ -23211,25 +23263,25 @@ var $y = class {
|
|
|
23211
23263
|
};
|
|
23212
23264
|
//#endregion
|
|
23213
23265
|
//#region src/server/createScaleClient.ts
|
|
23214
|
-
async function
|
|
23215
|
-
let t = new
|
|
23266
|
+
async function nb(e) {
|
|
23267
|
+
let t = new Yy(), n = new Zy({
|
|
23216
23268
|
baseUrl: e.url,
|
|
23217
23269
|
apiKey: e.apiKey,
|
|
23218
23270
|
auth: t,
|
|
23219
23271
|
onDegraded: e.onDegraded
|
|
23220
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
23272
|
+
}), { workspaceId: r, accessToken: i } = await Qy(n, {
|
|
23221
23273
|
primaryKey: e.primaryKey,
|
|
23222
23274
|
columns: e.columns,
|
|
23223
23275
|
signal: e.signal
|
|
23224
23276
|
});
|
|
23225
|
-
return t.set(i), new
|
|
23277
|
+
return t.set(i), new tb({
|
|
23226
23278
|
workspaceId: r,
|
|
23227
23279
|
http: n
|
|
23228
23280
|
});
|
|
23229
23281
|
}
|
|
23230
23282
|
//#endregion
|
|
23231
23283
|
//#region src/server/errors.ts
|
|
23232
|
-
function
|
|
23284
|
+
function rb(e, t, n) {
|
|
23233
23285
|
return {
|
|
23234
23286
|
code: e,
|
|
23235
23287
|
message: t,
|
|
@@ -23239,7 +23291,7 @@ function tb(e, t, n) {
|
|
|
23239
23291
|
}
|
|
23240
23292
|
//#endregion
|
|
23241
23293
|
//#region src/hooks/useScaleClient.ts
|
|
23242
|
-
function
|
|
23294
|
+
function ib(e) {
|
|
23243
23295
|
let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
|
|
23244
23296
|
return m(() => {
|
|
23245
23297
|
if (!e.enabled) {
|
|
@@ -23248,7 +23300,7 @@ function nb(e) {
|
|
|
23248
23300
|
}
|
|
23249
23301
|
n({ status: "bootstrapping" });
|
|
23250
23302
|
let t = new AbortController(), a = null;
|
|
23251
|
-
return
|
|
23303
|
+
return nb({
|
|
23252
23304
|
url: e.url,
|
|
23253
23305
|
apiKey: e.apiKey,
|
|
23254
23306
|
primaryKey: i.current,
|
|
@@ -23257,7 +23309,7 @@ function nb(e) {
|
|
|
23257
23309
|
onDegraded: (e) => {
|
|
23258
23310
|
t.signal.aborted || n({
|
|
23259
23311
|
status: "failed",
|
|
23260
|
-
error:
|
|
23312
|
+
error: ob(e)
|
|
23261
23313
|
});
|
|
23262
23314
|
}
|
|
23263
23315
|
}).then((e) => {
|
|
@@ -23272,7 +23324,7 @@ function nb(e) {
|
|
|
23272
23324
|
}).catch((e) => {
|
|
23273
23325
|
t.signal.aborted || n({
|
|
23274
23326
|
status: "failed",
|
|
23275
|
-
error:
|
|
23327
|
+
error: ab(e)
|
|
23276
23328
|
});
|
|
23277
23329
|
}), () => {
|
|
23278
23330
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -23283,30 +23335,30 @@ function nb(e) {
|
|
|
23283
23335
|
e.apiKey
|
|
23284
23336
|
]), t;
|
|
23285
23337
|
}
|
|
23286
|
-
function
|
|
23287
|
-
return e instanceof
|
|
23338
|
+
function ab(e) {
|
|
23339
|
+
return e instanceof Xy ? e.status === 401 ? rb(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? rb("scale.unreachable", e.message, e) : e.status >= 500 ? rb("scale.server_error", e.message, e) : rb("scale.bootstrap_failed", e.message, e) : rb("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
23288
23340
|
}
|
|
23289
|
-
function
|
|
23290
|
-
return e.status === 0 ?
|
|
23341
|
+
function ob(e) {
|
|
23342
|
+
return e.status === 0 ? rb("scale.unreachable", e.message, e) : e.status === 404 ? rb("scale.workspace_lost", e.message, e) : rb("scale.server_error", e.message, e);
|
|
23291
23343
|
}
|
|
23292
23344
|
//#endregion
|
|
23293
23345
|
//#region src/index.tsx
|
|
23294
|
-
function
|
|
23346
|
+
function sb(e) {
|
|
23295
23347
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
23296
23348
|
}
|
|
23297
|
-
function
|
|
23349
|
+
function cb(e) {
|
|
23298
23350
|
let t = v(() => new zo(e.onError), [e.onError]);
|
|
23299
23351
|
return /* @__PURE__ */ C(uv, {
|
|
23300
23352
|
errorHandler: t,
|
|
23301
23353
|
children: /* @__PURE__ */ C(Hl, {
|
|
23302
23354
|
...e,
|
|
23303
23355
|
errorHandler: t,
|
|
23304
|
-
children: e.showUploader ? /* @__PURE__ */ C(
|
|
23356
|
+
children: e.showUploader ? /* @__PURE__ */ C(jy, {}) : /* @__PURE__ */ C(ov, {})
|
|
23305
23357
|
})
|
|
23306
23358
|
});
|
|
23307
23359
|
}
|
|
23308
|
-
function
|
|
23309
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a =
|
|
23360
|
+
function lb(e) {
|
|
23361
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = sb(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = Jy(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = ib({
|
|
23310
23362
|
enabled: !s && c && u,
|
|
23311
23363
|
url: e.__server?.url ?? "",
|
|
23312
23364
|
apiKey: e.apiKey,
|
|
@@ -23361,7 +23413,7 @@ function sb(e) {
|
|
|
23361
23413
|
code: e,
|
|
23362
23414
|
message: "License validation failed",
|
|
23363
23415
|
source: "license"
|
|
23364
|
-
} }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(cv, { error: d.error }) : /* @__PURE__ */ C(
|
|
23416
|
+
} }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(cv, { error: d.error }) : /* @__PURE__ */ C(cb, { ...k }) : j(l ?? "license.invalid");
|
|
23365
23417
|
return t === "inline" ? /* @__PURE__ */ C("div", {
|
|
23366
23418
|
className: "updog__data-editor updog__data-editor-inline",
|
|
23367
23419
|
dir: i,
|
|
@@ -23381,14 +23433,14 @@ function sb(e) {
|
|
|
23381
23433
|
submitText: n("dataEditor.confirmClose.action")
|
|
23382
23434
|
})] });
|
|
23383
23435
|
}
|
|
23384
|
-
function
|
|
23436
|
+
function ub(e) {
|
|
23385
23437
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
23386
23438
|
return /* @__PURE__ */ C(Xr, {
|
|
23387
23439
|
translations: t,
|
|
23388
23440
|
rtl: n,
|
|
23389
23441
|
locale: r,
|
|
23390
|
-
children: /* @__PURE__ */ C(
|
|
23442
|
+
children: /* @__PURE__ */ C(lb, { ...a })
|
|
23391
23443
|
});
|
|
23392
23444
|
}
|
|
23393
23445
|
//#endregion
|
|
23394
|
-
export {
|
|
23446
|
+
export { ub as DataEditor, iu as downloadExampleFile, au as exportDataEditor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "Client-side CSV importer and spreadsheet editor 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",
|