@updog/data-editor 0.1.88 → 0.1.89
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 +78 -2
- package/index.js +598 -540
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9486,6 +9486,9 @@ var sh = class {
|
|
|
9486
9486
|
message: hp(t)
|
|
9487
9487
|
});
|
|
9488
9488
|
}
|
|
9489
|
+
readFieldValue(e, t) {
|
|
9490
|
+
return this.fieldReader(e)(t);
|
|
9491
|
+
}
|
|
9489
9492
|
fieldReader(e) {
|
|
9490
9493
|
let t = this._effectiveColumns.find((t) => t.id === e);
|
|
9491
9494
|
return t ? Z(t).reader(null, t, this.getFormatContext()) : (e) => e;
|
|
@@ -11448,29 +11451,29 @@ var Eh = (e, t, n) => {
|
|
|
11448
11451
|
let r = gc(t, n.map((e) => e.id));
|
|
11449
11452
|
return r.length === 0 ? "" : `[updog] primaryKey names ${r.map((e) => `"${e}"`).join(", ")}, which no column declares. Imported rows are appended instead of merged.`;
|
|
11450
11453
|
};
|
|
11451
|
-
function Dh({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: h, headerHeight: _, readonly: v, enableCreateColumn: y, onColumnMatch: b, onValueMatch: x,
|
|
11452
|
-
let
|
|
11453
|
-
|
|
11454
|
-
t:
|
|
11455
|
-
locale:
|
|
11454
|
+
function Dh({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: h, headerHeight: _, readonly: v, enableCreateColumn: y, onColumnMatch: b, onValueMatch: x, onRowImport: w, context: T, synonyms: E, sampleData: D, chat: O, remoteSources: k, customFormats: A, onUnstructuredFile: j, onError: M, errorHandler: N }) {
|
|
11455
|
+
let P = _h(N ?? new lc(M)), { t: F, locale: I } = q();
|
|
11456
|
+
P.setSchemaColumns(e), P.setI18n({
|
|
11457
|
+
t: F,
|
|
11458
|
+
locale: I
|
|
11456
11459
|
});
|
|
11457
|
-
let { addDynamicColumns:
|
|
11458
|
-
|
|
11459
|
-
}, [
|
|
11460
|
-
bh(
|
|
11461
|
-
let { portalRef:
|
|
11462
|
-
|
|
11463
|
-
}, [
|
|
11464
|
-
|
|
11460
|
+
let { addDynamicColumns: L, removeDynamicColumn: R, updateColumn: z } = xh(P), B = m((e) => {
|
|
11461
|
+
P.setDynamicColumns(e);
|
|
11462
|
+
}, [P]), V = C(P.subscribe, P.getEffectiveColumns), { navigateToCell: ee, navigateToCellRef: te, resetScrollRef: ne, scrollToGridTop: re } = Sh(P), { validator: H, validatorRef: ie, findReplace: ae } = Th(P, V), { search: oe, setSearch: se, matchCase: ce, setMatchCase: le, matchEntireCell: ue, setMatchEntireCell: de, searchMode: fe, setSearchMode: pe, filterColumns: me, setFilterColumns: he, filtersResetKey: ge, resetFilters: _e } = wh(P, ae, ee, re);
|
|
11463
|
+
bh(P, ie, n);
|
|
11464
|
+
let { portalRef: ve } = Ch(), ye = m((e, t) => {
|
|
11465
|
+
P.setViewportRange(e, t);
|
|
11466
|
+
}, [P]), [be, xe] = S(null), [Se, Ce] = S([]), we = m((e) => {
|
|
11467
|
+
Ce(e), o(!0);
|
|
11465
11468
|
}, [o]);
|
|
11466
|
-
g(() => (s && (s.current =
|
|
11469
|
+
g(() => (s && (s.current = P), () => {
|
|
11467
11470
|
s && (s.current = null);
|
|
11468
|
-
}), [
|
|
11469
|
-
let
|
|
11471
|
+
}), [P, s]);
|
|
11472
|
+
let Te = fc(t), Ee = Eh(t != null, Te, e);
|
|
11470
11473
|
return g(() => {
|
|
11471
|
-
|
|
11472
|
-
}, [
|
|
11473
|
-
columns:
|
|
11474
|
+
Ee !== "" && console.warn(Ee);
|
|
11475
|
+
}, [Ee]), {
|
|
11476
|
+
columns: V,
|
|
11474
11477
|
primaryKey: t,
|
|
11475
11478
|
enableDeleteRow: c ?? !1,
|
|
11476
11479
|
enableAddRow: l ?? !0,
|
|
@@ -11480,53 +11483,55 @@ function Dh({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i,
|
|
|
11480
11483
|
exportFormats: p ?? rc,
|
|
11481
11484
|
rowHeight: h ?? 34,
|
|
11482
11485
|
headerHeight: _ ?? 36,
|
|
11483
|
-
store:
|
|
11484
|
-
validator:
|
|
11485
|
-
findReplace:
|
|
11486
|
+
store: P,
|
|
11487
|
+
validator: H,
|
|
11488
|
+
findReplace: ae,
|
|
11486
11489
|
onComplete: r,
|
|
11487
11490
|
showUploader: a,
|
|
11488
11491
|
setShowUploader: o,
|
|
11489
|
-
pendingImportFiles:
|
|
11490
|
-
setPendingImportFiles:
|
|
11491
|
-
openUploaderWithFiles:
|
|
11492
|
+
pendingImportFiles: Se,
|
|
11493
|
+
setPendingImportFiles: Ce,
|
|
11494
|
+
openUploaderWithFiles: we,
|
|
11492
11495
|
variant: i ?? "editor",
|
|
11493
11496
|
isViewer: i === "viewer",
|
|
11494
|
-
search:
|
|
11495
|
-
setSearch:
|
|
11496
|
-
matchCase:
|
|
11497
|
-
setMatchCase:
|
|
11498
|
-
matchEntireCell:
|
|
11499
|
-
setMatchEntireCell:
|
|
11500
|
-
searchMode:
|
|
11501
|
-
setSearchMode:
|
|
11502
|
-
filterColumns:
|
|
11503
|
-
setFilterColumns:
|
|
11504
|
-
navigateToCell:
|
|
11505
|
-
navigateToCellRef:
|
|
11506
|
-
resetScrollRef:
|
|
11507
|
-
scrollToGridTop:
|
|
11508
|
-
portalRef:
|
|
11497
|
+
search: oe,
|
|
11498
|
+
setSearch: se,
|
|
11499
|
+
matchCase: ce,
|
|
11500
|
+
setMatchCase: le,
|
|
11501
|
+
matchEntireCell: ue,
|
|
11502
|
+
setMatchEntireCell: de,
|
|
11503
|
+
searchMode: fe,
|
|
11504
|
+
setSearchMode: pe,
|
|
11505
|
+
filterColumns: me,
|
|
11506
|
+
setFilterColumns: he,
|
|
11507
|
+
navigateToCell: ee,
|
|
11508
|
+
navigateToCellRef: te,
|
|
11509
|
+
resetScrollRef: ne,
|
|
11510
|
+
scrollToGridTop: re,
|
|
11511
|
+
portalRef: ve,
|
|
11509
11512
|
readonly: i === "viewer" ? !0 : v ?? !1,
|
|
11510
|
-
filtersResetKey:
|
|
11511
|
-
resetFilters:
|
|
11513
|
+
filtersResetKey: ge,
|
|
11514
|
+
resetFilters: _e,
|
|
11512
11515
|
originalColumns: e,
|
|
11513
|
-
dynamicColumns:
|
|
11514
|
-
setDynamicColumns:
|
|
11515
|
-
addDynamicColumns:
|
|
11516
|
-
removeDynamicColumn:
|
|
11517
|
-
updateColumn:
|
|
11518
|
-
gridClipboard:
|
|
11519
|
-
setGridClipboard:
|
|
11516
|
+
dynamicColumns: P.getDynamicColumns(),
|
|
11517
|
+
setDynamicColumns: B,
|
|
11518
|
+
addDynamicColumns: L,
|
|
11519
|
+
removeDynamicColumn: R,
|
|
11520
|
+
updateColumn: z,
|
|
11521
|
+
gridClipboard: be,
|
|
11522
|
+
setGridClipboard: xe,
|
|
11520
11523
|
enableCreateColumn: y ?? !0,
|
|
11521
11524
|
onColumnMatch: b,
|
|
11522
11525
|
onValueMatch: x,
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11526
|
+
onRowImport: w,
|
|
11527
|
+
context: T,
|
|
11528
|
+
synonyms: E,
|
|
11529
|
+
sampleData: D,
|
|
11530
|
+
onVisibleRangeChange: ye,
|
|
11531
|
+
chat: O,
|
|
11532
|
+
remoteSources: k ?? [],
|
|
11533
|
+
customFormats: f === !1 ? [] : A ?? [],
|
|
11534
|
+
onUnstructuredFile: f === !1 ? void 0 : j
|
|
11530
11535
|
};
|
|
11531
11536
|
}
|
|
11532
11537
|
//#endregion
|
|
@@ -24907,37 +24912,34 @@ var TD = (e, t) => {
|
|
|
24907
24912
|
column: n.has(a) ? void 0 : r.get(a)
|
|
24908
24913
|
});
|
|
24909
24914
|
return i;
|
|
24910
|
-
}, _O = (e, t, n, r) => {
|
|
24915
|
+
}, _O = Symbol("keep-cell"), vO = (e, t, n, r, i) => {
|
|
24916
|
+
if (!e) return n;
|
|
24917
|
+
let a = Z(e);
|
|
24918
|
+
if (a.options(e) !== null && a.storage === "string") {
|
|
24919
|
+
let r = typeof n == "string" ? n : String(n ?? ""), o = i.valueMapping[t]?.[r];
|
|
24920
|
+
return o === void 0 ? a.matchImported ? r : _O : e.transformer ? Wf(e.transformer, o) : o;
|
|
24921
|
+
}
|
|
24922
|
+
if (a.storage === "string[]") {
|
|
24923
|
+
let r = typeof n == "string" ? n : String(n ?? ""), o = i.multiselectDelimiters[t], s = a.options(e) ?? [], c = o ? kc(r, o, s, hO(e)) : r === "" ? [] : [r], l = [], u = /* @__PURE__ */ new Set();
|
|
24924
|
+
for (let e of c) {
|
|
24925
|
+
let n = e.trim(), r = i.valueMapping[t]?.[n] ?? (a.matchImported ? n : void 0);
|
|
24926
|
+
r !== void 0 && !u.has(r) && (u.add(r), l.push(r));
|
|
24927
|
+
}
|
|
24928
|
+
return e.transformer ? Wf(e.transformer, l) : l;
|
|
24929
|
+
}
|
|
24930
|
+
let o = r(n);
|
|
24931
|
+
return e.transformer ? Wf(e.transformer, o) : o;
|
|
24932
|
+
}, yO = (e, t, n, r) => {
|
|
24911
24933
|
let i = r();
|
|
24912
24934
|
for (let { csvHeader: r, columnId: a, column: o } of t) {
|
|
24913
|
-
let t = e[r] ?? "";
|
|
24914
|
-
|
|
24915
|
-
i[a] = t;
|
|
24916
|
-
continue;
|
|
24917
|
-
}
|
|
24918
|
-
let s = Z(o);
|
|
24919
|
-
if (s.options(o) !== null && s.storage === "string") {
|
|
24920
|
-
let e = n.valueMapping[a]?.[t];
|
|
24921
|
-
e === void 0 ? s.matchImported && (i[a] = t) : i[a] = o.transformer ? Wf(o.transformer, e) : e;
|
|
24922
|
-
continue;
|
|
24923
|
-
}
|
|
24924
|
-
if (s.storage === "string[]") {
|
|
24925
|
-
let e = n.multiselectDelimiters[a], r = s.options(o) ?? [], c = e ? kc(t, e, r, hO(o)) : t === "" ? [] : [t], l = [], u = /* @__PURE__ */ new Set();
|
|
24926
|
-
for (let e of c) {
|
|
24927
|
-
let t = e.trim(), r = n.valueMapping[a]?.[t] ?? (s.matchImported ? t : void 0);
|
|
24928
|
-
r !== void 0 && !u.has(r) && (u.add(r), l.push(r));
|
|
24929
|
-
}
|
|
24930
|
-
i[a] = o.transformer ? Wf(o.transformer, l) : l;
|
|
24931
|
-
continue;
|
|
24932
|
-
}
|
|
24933
|
-
let c = n.read(r)(t);
|
|
24934
|
-
i[a] = o.transformer ? Wf(o.transformer, c) : c;
|
|
24935
|
+
let t = vO(o, a, e[r] ?? "", (e) => n.read(r)(e), n);
|
|
24936
|
+
t !== _O && (i[a] = t);
|
|
24935
24937
|
}
|
|
24936
24938
|
return i;
|
|
24937
24939
|
};
|
|
24938
24940
|
//#endregion
|
|
24939
24941
|
//#region src/components/DataUploader/core/importing/raggedRows/computeDisputeSpans.ts
|
|
24940
|
-
function
|
|
24942
|
+
function bO(e) {
|
|
24941
24943
|
if (e.length <= 1) return [];
|
|
24942
24944
|
let t = e[0].cells.length, n = [], r = -1;
|
|
24943
24945
|
for (let i = 0; i < t; i++) {
|
|
@@ -24952,16 +24954,16 @@ function vO(e) {
|
|
|
24952
24954
|
end: t - 1
|
|
24953
24955
|
}), n;
|
|
24954
24956
|
}
|
|
24955
|
-
function
|
|
24957
|
+
function xO(e, t, n) {
|
|
24956
24958
|
let r = e.length, i = t;
|
|
24957
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
24959
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? SO(i, i - r) : SO(r - 1, i - 1)) > 1e3 ? [] : r < i ? CO(e, i) : wO(e, i, n);
|
|
24958
24960
|
}
|
|
24959
|
-
function
|
|
24961
|
+
function SO(e, t) {
|
|
24960
24962
|
let n = Math.min(t, e - t), r = 1;
|
|
24961
24963
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
24962
24964
|
return r;
|
|
24963
24965
|
}
|
|
24964
|
-
function
|
|
24966
|
+
function CO(e, t) {
|
|
24965
24967
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
24966
24968
|
if (i.length === n) {
|
|
24967
24969
|
let a = Array(t).fill("");
|
|
@@ -24973,7 +24975,7 @@ function xO(e, t) {
|
|
|
24973
24975
|
};
|
|
24974
24976
|
return a(0), r;
|
|
24975
24977
|
}
|
|
24976
|
-
function
|
|
24978
|
+
function wO(e, t, n) {
|
|
24977
24979
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
24978
24980
|
if (a.length === t - 1) {
|
|
24979
24981
|
let o = [
|
|
@@ -24991,45 +24993,45 @@ function SO(e, t, n) {
|
|
|
24991
24993
|
}
|
|
24992
24994
|
//#endregion
|
|
24993
24995
|
//#region src/components/DataUploader/core/importing/raggedRows/pruneByValidators.ts
|
|
24994
|
-
var
|
|
24995
|
-
function
|
|
24996
|
+
var TO = {};
|
|
24997
|
+
function EO(e, t) {
|
|
24996
24998
|
for (let n of t.validators ?? []) if (!nm(n) && n.type !== "asyncFunction") {
|
|
24997
24999
|
if (n.type === "function") {
|
|
24998
|
-
if (n.fn(e,
|
|
25000
|
+
if (n.fn(e, TO) != null) return !1;
|
|
24999
25001
|
continue;
|
|
25000
25002
|
}
|
|
25001
|
-
if (oh(n, e,
|
|
25003
|
+
if (oh(n, e, TO) != null) return !1;
|
|
25002
25004
|
}
|
|
25003
25005
|
return !0;
|
|
25004
25006
|
}
|
|
25005
|
-
function
|
|
25006
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
25007
|
+
function DO(e, t) {
|
|
25008
|
+
for (let n = 0; n < t.length; n++) if (!EO(e.cells[n] ?? "", t[n])) return !1;
|
|
25007
25009
|
return !0;
|
|
25008
25010
|
}
|
|
25009
|
-
function
|
|
25010
|
-
return e.filter((e) =>
|
|
25011
|
+
function OO(e, t) {
|
|
25012
|
+
return e.filter((e) => DO(e, t));
|
|
25011
25013
|
}
|
|
25012
25014
|
//#endregion
|
|
25013
25015
|
//#region src/components/DataUploader/core/importing/raggedRows/alignRow.ts
|
|
25014
|
-
function
|
|
25015
|
-
let r =
|
|
25016
|
+
function kO(e, t, n) {
|
|
25017
|
+
let r = xO(e, t.length, n), i = OO(r, t);
|
|
25016
25018
|
return i.length === 1 ? {
|
|
25017
25019
|
kind: "confident",
|
|
25018
25020
|
alignment: i[0]
|
|
25019
25021
|
} : i.length > 1 ? {
|
|
25020
25022
|
kind: "ambiguous",
|
|
25021
25023
|
candidates: i,
|
|
25022
|
-
disputeSpans:
|
|
25024
|
+
disputeSpans: bO(i)
|
|
25023
25025
|
} : {
|
|
25024
25026
|
kind: "invalid",
|
|
25025
25027
|
candidates: r,
|
|
25026
|
-
disputeSpans:
|
|
25028
|
+
disputeSpans: bO(r)
|
|
25027
25029
|
};
|
|
25028
25030
|
}
|
|
25029
25031
|
//#endregion
|
|
25030
25032
|
//#region src/components/DataUploader/core/importing/raggedRows/resolveRaggedRow.ts
|
|
25031
|
-
function
|
|
25032
|
-
let r =
|
|
25033
|
+
function AO(e, t, n) {
|
|
25034
|
+
let r = kO(e, t, n);
|
|
25033
25035
|
if (r.kind === "confident") return {
|
|
25034
25036
|
cells: r.alignment.cells,
|
|
25035
25037
|
conflictColumns: []
|
|
@@ -25048,7 +25050,7 @@ function OO(e, t, n) {
|
|
|
25048
25050
|
}
|
|
25049
25051
|
//#endregion
|
|
25050
25052
|
//#region src/components/DataUploader/core/importing/scheduler.ts
|
|
25051
|
-
var
|
|
25053
|
+
var jO = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
|
|
25052
25054
|
let { port1: t, port2: n } = new MessageChannel();
|
|
25053
25055
|
t.onmessage = () => {
|
|
25054
25056
|
t.close(), e();
|
|
@@ -25056,32 +25058,33 @@ var kO = () => typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)
|
|
|
25056
25058
|
});
|
|
25057
25059
|
//#endregion
|
|
25058
25060
|
//#region src/components/DataUploader/core/importing/runChunked.ts
|
|
25059
|
-
async function
|
|
25061
|
+
async function MO(e, t) {
|
|
25060
25062
|
let { rawRows: n, dataStartIndex: r, chunkSize: i, signal: a } = e, o = [];
|
|
25061
25063
|
for (let e = r; e < n.length; e++) {
|
|
25062
25064
|
let t = n[e];
|
|
25063
25065
|
t && !iD(t) && o.push(e);
|
|
25064
25066
|
}
|
|
25065
|
-
let s =
|
|
25066
|
-
for (;
|
|
25067
|
+
let s = Math.ceil(o.length / i), c = 0, l = 0;
|
|
25068
|
+
for (; c < o.length;) {
|
|
25067
25069
|
if (a.aborted) return "cancelled";
|
|
25068
|
-
let e = Math.min(
|
|
25069
|
-
for (let t =
|
|
25070
|
+
let e = Math.min(c + i, o.length), r = [];
|
|
25071
|
+
for (let t = c; t < e; t++) {
|
|
25070
25072
|
let e = n[o[t]];
|
|
25071
25073
|
e && r.push(e);
|
|
25072
25074
|
}
|
|
25073
25075
|
await t(r, {
|
|
25074
|
-
chunkIndex:
|
|
25076
|
+
chunkIndex: l,
|
|
25077
|
+
chunkCount: s,
|
|
25075
25078
|
isLastChunk: e >= o.length
|
|
25076
25079
|
});
|
|
25077
|
-
for (let t =
|
|
25078
|
-
|
|
25080
|
+
for (let t = c; t < e; t++) n[o[t]] = void 0;
|
|
25081
|
+
c = e, l++, c < o.length && await jO();
|
|
25079
25082
|
}
|
|
25080
25083
|
return "completed";
|
|
25081
25084
|
}
|
|
25082
25085
|
//#endregion
|
|
25083
25086
|
//#region src/components/DataUploader/core/importing/runImport.ts
|
|
25084
|
-
var
|
|
25087
|
+
var NO = 5e3, PO = async (e) => {
|
|
25085
25088
|
let t = e.rawRows;
|
|
25086
25089
|
if (!t) return {
|
|
25087
25090
|
outcome: "completed",
|
|
@@ -25106,49 +25109,122 @@ var jO = 5e3, MO = async (e) => {
|
|
|
25106
25109
|
read: u.reader,
|
|
25107
25110
|
valueMapping: e.valueMapping,
|
|
25108
25111
|
multiselectDelimiters: e.multiselectDelimiters
|
|
25109
|
-
}, f =
|
|
25112
|
+
}, f = e.onRowImport, p = e.hookRunState ?? { rowImportHookDisabled: !1 }, m = /* @__PURE__ */ new Map();
|
|
25113
|
+
for (let t of [...e.columns, ...e.pendingColumns]) m.set(t.id, t);
|
|
25114
|
+
let h = /* @__PURE__ */ new Map();
|
|
25115
|
+
for (let e of s) h.set(e.columnId, e.csvHeader);
|
|
25116
|
+
let g = /* @__PURE__ */ new Map(), _ = (t) => {
|
|
25117
|
+
let n = g.get(t);
|
|
25118
|
+
if (!n) {
|
|
25119
|
+
let r = h.get(t);
|
|
25120
|
+
n = r === void 0 ? (n) => e.store.readFieldValue(t, n) : (e) => d.read(r)(e), g.set(t, n);
|
|
25121
|
+
}
|
|
25122
|
+
return n;
|
|
25123
|
+
}, v = (e, t) => vO(n.has(e) ? void 0 : m.get(e), e, t, _(e), d), y = (e, t) => {
|
|
25124
|
+
let n = { ...e };
|
|
25125
|
+
for (let r of c.keys) {
|
|
25126
|
+
let i = t[r];
|
|
25127
|
+
if (Object.is(i, e[r])) continue;
|
|
25128
|
+
let a = v(r, i);
|
|
25129
|
+
n[r] = a === _O ? "" : a;
|
|
25130
|
+
}
|
|
25131
|
+
return n;
|
|
25132
|
+
}, b = (e) => {
|
|
25133
|
+
let t = c.make();
|
|
25134
|
+
for (let n of c.keys) {
|
|
25135
|
+
if (!(n in e)) continue;
|
|
25136
|
+
let r = v(n, e[n]);
|
|
25137
|
+
r !== _O && (t[n] = r);
|
|
25138
|
+
}
|
|
25139
|
+
return t;
|
|
25140
|
+
}, x = i.map((t) => {
|
|
25110
25141
|
let n = e.columnMapping[t];
|
|
25111
25142
|
return (n ? e.columns.find((e) => e.id === n) : void 0) ?? {
|
|
25112
25143
|
id: t,
|
|
25113
25144
|
title: t
|
|
25114
25145
|
};
|
|
25115
|
-
}),
|
|
25146
|
+
}), S = 0, C = 0, w = await MO({
|
|
25116
25147
|
rawRows: t,
|
|
25117
25148
|
dataStartIndex: e.workbook.dataStartIndex,
|
|
25118
|
-
chunkSize:
|
|
25149
|
+
chunkSize: NO,
|
|
25119
25150
|
signal: e.signal
|
|
25120
|
-
}, async (t) => {
|
|
25121
|
-
let
|
|
25122
|
-
for (let
|
|
25123
|
-
let
|
|
25124
|
-
if (
|
|
25125
|
-
let { cells: t, conflictColumns:
|
|
25151
|
+
}, async (t, n) => {
|
|
25152
|
+
let o = [], l = f && !p.rowImportHookDisabled ? [] : null, u = [];
|
|
25153
|
+
for (let n = 0; n < t.length; n++) {
|
|
25154
|
+
let r = t[n], f = FD(r, i);
|
|
25155
|
+
if (r.length !== i.length) {
|
|
25156
|
+
let { cells: t, conflictColumns: o } = AO(r.map((e) => String(e ?? "")), x, a);
|
|
25126
25157
|
if (t.length) {
|
|
25127
25158
|
let e = {};
|
|
25128
25159
|
for (let n = 0; n < i.length; n++) e[i[n]] = t[n] ?? "";
|
|
25129
|
-
|
|
25160
|
+
f = e;
|
|
25130
25161
|
}
|
|
25131
|
-
if (
|
|
25162
|
+
if (o.length) {
|
|
25132
25163
|
let t = [];
|
|
25133
|
-
for (let
|
|
25134
|
-
let
|
|
25135
|
-
|
|
25164
|
+
for (let n of o) {
|
|
25165
|
+
let r = e.columnMapping[i[n]];
|
|
25166
|
+
r && t.push(r);
|
|
25136
25167
|
}
|
|
25137
|
-
t.length &&
|
|
25138
|
-
localIndex:
|
|
25168
|
+
t.length && u.push({
|
|
25169
|
+
localIndex: n,
|
|
25139
25170
|
columnIds: t
|
|
25140
25171
|
});
|
|
25141
25172
|
}
|
|
25142
25173
|
}
|
|
25143
|
-
|
|
25174
|
+
l && l.push(f), o.push(yO(f, s, d, c.make));
|
|
25175
|
+
}
|
|
25176
|
+
let m = o, h = null;
|
|
25177
|
+
if (f && l && !p.rowImportHookDisabled) try {
|
|
25178
|
+
let t = o.map((e, t) => ({
|
|
25179
|
+
row: { ...e },
|
|
25180
|
+
raw: l[t]
|
|
25181
|
+
})), r = {
|
|
25182
|
+
chunkIndex: n.chunkIndex,
|
|
25183
|
+
chunkCount: n.chunkCount,
|
|
25184
|
+
isLastChunk: n.isLastChunk,
|
|
25185
|
+
workbook: {
|
|
25186
|
+
name: zD(e.workbook),
|
|
25187
|
+
...e.workbook.origin.kind === "sheet" ? { sheetName: e.workbook.origin.sheetName } : {},
|
|
25188
|
+
headers: i
|
|
25189
|
+
},
|
|
25190
|
+
mapping: e.columnMapping,
|
|
25191
|
+
context: e.hookContext
|
|
25192
|
+
}, a = await HD(Promise.resolve(f(t, r)), VD);
|
|
25193
|
+
if (a !== void 0) {
|
|
25194
|
+
if (!Array.isArray(a) || a.length < o.length) throw Error(`onRowImport broke its contract: got ${Array.isArray(a) ? `${a.length} rows` : typeof a} for a chunk of ${o.length} rows`);
|
|
25195
|
+
let e = [], t = Array(o.length).fill(null);
|
|
25196
|
+
for (let n = 0; n < o.length; n++) {
|
|
25197
|
+
let r = a[n];
|
|
25198
|
+
r !== null && (t[n] = e.length, e.push(y(o[n], r)));
|
|
25199
|
+
}
|
|
25200
|
+
for (let t = o.length; t < a.length; t++) {
|
|
25201
|
+
let n = a[t];
|
|
25202
|
+
n !== null && e.push(b(n));
|
|
25203
|
+
}
|
|
25204
|
+
m = e, h = t;
|
|
25205
|
+
}
|
|
25206
|
+
} catch (t) {
|
|
25207
|
+
p.rowImportHookDisabled = !0, m = o, h = null, e.store.errorHandler.handleError({
|
|
25208
|
+
code: "HOOK_ERROR",
|
|
25209
|
+
source: "onRowImport",
|
|
25210
|
+
message: t instanceof Error ? t.message : String(t),
|
|
25211
|
+
originalError: t
|
|
25212
|
+
});
|
|
25144
25213
|
}
|
|
25145
|
-
let { rows:
|
|
25214
|
+
let { rows: g, rowIds: _, addedCount: v } = e.store.upsertRows(r, m, {
|
|
25146
25215
|
anchorKey: e.primaryKey ?? void 0,
|
|
25147
25216
|
skipRowValidation: !0
|
|
25148
25217
|
});
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
let
|
|
25218
|
+
S += m.length, C += v, await jO(), e.validator.validateRows(g, _);
|
|
25219
|
+
let w = h, T = w ? u.flatMap(({ localIndex: e, columnIds: t }) => {
|
|
25220
|
+
let n = w[e];
|
|
25221
|
+
return n === null ? [] : [{
|
|
25222
|
+
localIndex: n,
|
|
25223
|
+
columnIds: t
|
|
25224
|
+
}];
|
|
25225
|
+
}) : u;
|
|
25226
|
+
for (let { localIndex: t, columnIds: n } of T) {
|
|
25227
|
+
let r = _[t];
|
|
25152
25228
|
for (let t of n) {
|
|
25153
25229
|
let n = e.store.getCellValidation(r, t) ?? [];
|
|
25154
25230
|
e.store.setCellValidation(r, t, [...n, {
|
|
@@ -25157,9 +25233,9 @@ var jO = 5e3, MO = async (e) => {
|
|
|
25157
25233
|
}]);
|
|
25158
25234
|
}
|
|
25159
25235
|
}
|
|
25160
|
-
|
|
25236
|
+
T.length > 0 && e.store.notify();
|
|
25161
25237
|
});
|
|
25162
|
-
|
|
25238
|
+
w === "completed" && e.store.recordLearnedSynonyms(pO({
|
|
25163
25239
|
columnMapping: e.columnMapping,
|
|
25164
25240
|
baselineColumnMapping: e.baselineColumnMapping,
|
|
25165
25241
|
valueMapping: e.valueMapping,
|
|
@@ -25168,38 +25244,38 @@ var jO = 5e3, MO = async (e) => {
|
|
|
25168
25244
|
knownColumnSynonyms: CE(yE, e.extraSynonyms.columns),
|
|
25169
25245
|
knownValueSynonyms: CE(yE, e.extraSynonyms.values)
|
|
25170
25246
|
}));
|
|
25171
|
-
let
|
|
25247
|
+
let T = w === "completed" && S > 0 && C === 0;
|
|
25172
25248
|
return await e.store.finalizeSource(r), e.validator.validateUniqueness(), {
|
|
25173
|
-
outcome:
|
|
25174
|
-
collapsed:
|
|
25249
|
+
outcome: w,
|
|
25250
|
+
collapsed: T,
|
|
25175
25251
|
ambiguous: u.ambiguous
|
|
25176
25252
|
};
|
|
25177
25253
|
};
|
|
25178
|
-
async function
|
|
25179
|
-
return
|
|
25254
|
+
async function FO(e) {
|
|
25255
|
+
return PO(e);
|
|
25180
25256
|
}
|
|
25181
25257
|
//#endregion
|
|
25182
25258
|
//#region src/components/DataUploader/core/parser/headerView.ts
|
|
25183
|
-
var
|
|
25259
|
+
var IO = (e, t, n, r) => {
|
|
25184
25260
|
let i = OD(t, n);
|
|
25185
25261
|
return {
|
|
25186
25262
|
dataStartIndex: i,
|
|
25187
25263
|
headers: kD(e, n, i, r)
|
|
25188
25264
|
};
|
|
25189
|
-
},
|
|
25265
|
+
}, LO = (e, t) => {
|
|
25190
25266
|
let n = e.toLowerCase();
|
|
25191
25267
|
return t.some((e) => e.startsWith(".") && n.endsWith(e.toLowerCase()));
|
|
25192
|
-
},
|
|
25268
|
+
}, RO = (e, t) => {
|
|
25193
25269
|
if (!e || !t) return !1;
|
|
25194
25270
|
let n = e.toLowerCase(), r = n.replace(/\/.*$/, "");
|
|
25195
25271
|
return t.some((e) => {
|
|
25196
25272
|
let t = e.trim().toLowerCase();
|
|
25197
25273
|
return t.endsWith("/*") ? r === t.replace(/\/.*$/, "") : n === t;
|
|
25198
25274
|
});
|
|
25199
|
-
},
|
|
25200
|
-
for (let n of t) if (
|
|
25275
|
+
}, zO = (e, t) => {
|
|
25276
|
+
for (let n of t) if (LO(e.name, n.extensions) || RO(e.type, n.mimeTypes)) return n;
|
|
25201
25277
|
return null;
|
|
25202
|
-
},
|
|
25278
|
+
}, BO = class {
|
|
25203
25279
|
tokens = /* @__PURE__ */ new Map();
|
|
25204
25280
|
issue(e) {
|
|
25205
25281
|
this.abort(e);
|
|
@@ -25216,15 +25292,15 @@ var PO = (e, t, n, r) => {
|
|
|
25216
25292
|
release(e) {
|
|
25217
25293
|
this.tokens.delete(e);
|
|
25218
25294
|
}
|
|
25219
|
-
},
|
|
25220
|
-
let { headers: i, dataStartIndex: a } =
|
|
25295
|
+
}, VO = (e) => e.kind === "remote" ? `remote:${e.sourceId}` : `file:${e.file.name}:${e.file.size}:${e.file.lastModified}`, HO = (e, t, n, r) => {
|
|
25296
|
+
let { headers: i, dataStartIndex: a } = IO(t.rawRows, t.detection, n, r);
|
|
25221
25297
|
return {
|
|
25222
25298
|
name: e,
|
|
25223
25299
|
headers: i,
|
|
25224
25300
|
rows: ID(t.rawRows, i, a, 15),
|
|
25225
25301
|
totalRows: aD(t.rawRows, a)
|
|
25226
25302
|
};
|
|
25227
|
-
},
|
|
25303
|
+
}, UO = .02, WO = .5, GO = 2, KO = 2, qO = 3, JO = .6, YO = .25, XO = 3, ZO = .2, QO = 1 / 3, $O = 3, ek = (e) => {
|
|
25228
25304
|
let t = [];
|
|
25229
25305
|
for (let n of e) {
|
|
25230
25306
|
if (n == null) continue;
|
|
@@ -25232,18 +25308,18 @@ var PO = (e, t, n, r) => {
|
|
|
25232
25308
|
e !== "" && t.push(e);
|
|
25233
25309
|
}
|
|
25234
25310
|
return t;
|
|
25235
|
-
},
|
|
25311
|
+
}, tk = (e) => e.filter((e) => !iD(e)), nk = (e) => {
|
|
25236
25312
|
let { span: t } = cD(e);
|
|
25237
25313
|
if (t < 2) return 0;
|
|
25238
|
-
let n =
|
|
25314
|
+
let n = tk(e);
|
|
25239
25315
|
if (n.length === 0) return 0;
|
|
25240
25316
|
let r = 0;
|
|
25241
25317
|
for (let e of n) uD(e, t) && r++;
|
|
25242
25318
|
return r / n.length;
|
|
25243
|
-
},
|
|
25319
|
+
}, rk = (e) => {
|
|
25244
25320
|
let t = cD(e);
|
|
25245
25321
|
if (t.span === 0) return 0;
|
|
25246
|
-
let n =
|
|
25322
|
+
let n = tk(e);
|
|
25247
25323
|
if (n.length === 0) return 0;
|
|
25248
25324
|
let r = 0;
|
|
25249
25325
|
for (let e of n) {
|
|
@@ -25251,10 +25327,10 @@ var PO = (e, t, n, r) => {
|
|
|
25251
25327
|
r += Math.min(1, a);
|
|
25252
25328
|
}
|
|
25253
25329
|
return r / n.length;
|
|
25254
|
-
},
|
|
25330
|
+
}, ik = (e) => {
|
|
25255
25331
|
let t = cD(e);
|
|
25256
25332
|
if (t.span < 5) return 0;
|
|
25257
|
-
let n =
|
|
25333
|
+
let n = tk(e).filter((e) => !uD(e, t.span));
|
|
25258
25334
|
if (n.length < 3) return 0;
|
|
25259
25335
|
let r = [], i = [];
|
|
25260
25336
|
for (let e = t.first; e <= t.last; e++) {
|
|
@@ -25267,8 +25343,8 @@ var PO = (e, t, n, r) => {
|
|
|
25267
25343
|
}
|
|
25268
25344
|
let a = n[0], o = (e, t) => {
|
|
25269
25345
|
let n = e;
|
|
25270
|
-
for (; n >= 0 && n < r.length && r[n] >=
|
|
25271
|
-
if (Math.abs(n - e) <
|
|
25346
|
+
for (; n >= 0 && n < r.length && r[n] >= WO;) n += t;
|
|
25347
|
+
if (Math.abs(n - e) < GO) return null;
|
|
25272
25348
|
let [a, o] = t === 1 ? [e, n - 1] : [n + 1, e], s = -1;
|
|
25273
25349
|
for (let e = a; e <= o; e++) s = Math.max(s, i[e]);
|
|
25274
25350
|
return {
|
|
@@ -25278,34 +25354,34 @@ var PO = (e, t, n, r) => {
|
|
|
25278
25354
|
};
|
|
25279
25355
|
}, s = 0, c = 0;
|
|
25280
25356
|
for (; c < r.length;) {
|
|
25281
|
-
if (r[c] >
|
|
25357
|
+
if (r[c] > UO) {
|
|
25282
25358
|
c++;
|
|
25283
25359
|
continue;
|
|
25284
25360
|
}
|
|
25285
25361
|
let e = c;
|
|
25286
|
-
for (; e < r.length && r[e] <=
|
|
25362
|
+
for (; e < r.length && r[e] <= UO;) e++;
|
|
25287
25363
|
let n = o(c - 1, -1), i = o(e, 1);
|
|
25288
25364
|
if (n && i) {
|
|
25289
25365
|
let r = Array.from({ length: e - c }, (e, n) => a[t.first + c + n]).some((e) => e != null && String(e).trim() !== ""), o = r ? .3 : .5;
|
|
25290
|
-
!r && Math.abs(n.lastRow - i.lastRow) >=
|
|
25366
|
+
!r && Math.abs(n.lastRow - i.lastRow) >= KO && (o = 1), s = Math.max(s, o);
|
|
25291
25367
|
}
|
|
25292
25368
|
c = e;
|
|
25293
25369
|
}
|
|
25294
25370
|
return s;
|
|
25295
|
-
},
|
|
25371
|
+
}, ak = (e) => {
|
|
25296
25372
|
if (cD(e).span === 0) return 0;
|
|
25297
|
-
let t =
|
|
25298
|
-
if (t.length <
|
|
25373
|
+
let t = tk(e);
|
|
25374
|
+
if (t.length < qO) return 0;
|
|
25299
25375
|
let n = t.map((e) => {
|
|
25300
25376
|
let { first: t, last: n, width: r } = sD(e);
|
|
25301
25377
|
return {
|
|
25302
25378
|
first: t,
|
|
25303
25379
|
last: n,
|
|
25304
|
-
density:
|
|
25380
|
+
density: ek(e).length / r
|
|
25305
25381
|
};
|
|
25306
25382
|
}), r = (e, t) => {
|
|
25307
25383
|
let n = Math.max(e.first, t.first), r = Math.min(e.last, t.last);
|
|
25308
|
-
return Math.max(0, r - n + 1) / Math.max(e.last - e.first + 1, t.last - t.first + 1) >=
|
|
25384
|
+
return Math.max(0, r - n + 1) / Math.max(e.last - e.first + 1, t.last - t.first + 1) >= JO && Math.abs(e.density - t.density) <= YO;
|
|
25309
25385
|
}, i = [];
|
|
25310
25386
|
for (let e of n) {
|
|
25311
25387
|
let t = i[i.length - 1];
|
|
@@ -25314,68 +25390,68 @@ var PO = (e, t, n, r) => {
|
|
|
25314
25390
|
length: 1
|
|
25315
25391
|
});
|
|
25316
25392
|
}
|
|
25317
|
-
let a = i.findIndex((e) => e.length >=
|
|
25393
|
+
let a = i.findIndex((e) => e.length >= qO);
|
|
25318
25394
|
if (a === -1) return 0;
|
|
25319
25395
|
let o = a;
|
|
25320
|
-
for (let e = i.length - 1; e >= 0; e--) if (i[e].length >=
|
|
25396
|
+
for (let e = i.length - 1; e >= 0; e--) if (i[e].length >= qO) {
|
|
25321
25397
|
o = e;
|
|
25322
25398
|
break;
|
|
25323
25399
|
}
|
|
25324
25400
|
let s = 0, c = 0;
|
|
25325
|
-
for (let e = a; e <= o; e++) i[e].length >=
|
|
25401
|
+
for (let e = a; e <= o; e++) i[e].length >= qO ? s++ : c++;
|
|
25326
25402
|
let l = s - 1 + c;
|
|
25327
|
-
return Math.min(1, Math.max(0, l) /
|
|
25328
|
-
},
|
|
25403
|
+
return Math.min(1, Math.max(0, l) / XO);
|
|
25404
|
+
}, ok = (e, t) => {
|
|
25329
25405
|
if (t <= 0) return 0;
|
|
25330
25406
|
let n = 0;
|
|
25331
25407
|
for (let t of e) n += Math.max(0, t.endRow - t.startRow);
|
|
25332
25408
|
return Math.min(1, n / t);
|
|
25333
|
-
},
|
|
25409
|
+
}, sk = (e) => {
|
|
25334
25410
|
let t = -1, n = -1;
|
|
25335
25411
|
for (let r = 0; r < e.length; r++) iD(e[r]) || (t === -1 && (t = r), n = r);
|
|
25336
25412
|
if (t === -1 || n <= t) return 0;
|
|
25337
25413
|
let r = 0;
|
|
25338
25414
|
for (let i = t; i <= n; i++) iD(e[i]) && r++;
|
|
25339
25415
|
return r / (n - t + 1);
|
|
25340
|
-
},
|
|
25416
|
+
}, ck = (e) => {
|
|
25341
25417
|
let t = cD(e);
|
|
25342
|
-
if (t.span <
|
|
25343
|
-
let n =
|
|
25418
|
+
if (t.span < $O) return 0;
|
|
25419
|
+
let n = tk(e);
|
|
25344
25420
|
if (n.length === 0) return 0;
|
|
25345
|
-
let r = Math.max(1, Math.round(n.length *
|
|
25346
|
-
for (let e of i)
|
|
25421
|
+
let r = Math.max(1, Math.round(n.length * ZO)), i = n.slice(n.length - r), a = 0;
|
|
25422
|
+
for (let e of i) ek(e).length / t.span <= QO && a++;
|
|
25347
25423
|
return a / i.length;
|
|
25348
|
-
},
|
|
25424
|
+
}, lk = 30, uk = 10, dk = (e) => {
|
|
25349
25425
|
let t = 0;
|
|
25350
25426
|
for (let n of e) t = Math.max(t, n.length);
|
|
25351
25427
|
return t;
|
|
25352
|
-
},
|
|
25353
|
-
let n =
|
|
25428
|
+
}, fk = (e, t) => {
|
|
25429
|
+
let n = dk(e);
|
|
25354
25430
|
if (n === 0) return 0;
|
|
25355
25431
|
let r = 0;
|
|
25356
25432
|
for (let i = Math.max(0, t); i < e.length; i++) {
|
|
25357
25433
|
let t = e[i];
|
|
25358
25434
|
if (!t || iD(t)) continue;
|
|
25359
|
-
let a = Math.min(e.length, i + 1 +
|
|
25435
|
+
let a = Math.min(e.length, i + 1 + lk);
|
|
25360
25436
|
if (a - i < 2) break;
|
|
25361
25437
|
let o = fD(e, i, a, n);
|
|
25362
25438
|
o > r && (r = o);
|
|
25363
25439
|
}
|
|
25364
25440
|
return r;
|
|
25365
|
-
},
|
|
25441
|
+
}, pk = (e, t) => {
|
|
25366
25442
|
let n = [];
|
|
25367
25443
|
for (let r = Math.max(0, t); r < e.length; r++) {
|
|
25368
25444
|
let t = e[r];
|
|
25369
25445
|
t && !iD(t) && n.push(t);
|
|
25370
25446
|
}
|
|
25371
25447
|
if (n.length < 6) return 0;
|
|
25372
|
-
let r = Math.floor(n.length / 2), i =
|
|
25448
|
+
let r = Math.floor(n.length / 2), i = dk(n), a = 0, o = 0;
|
|
25373
25449
|
for (let e = 0; e < i; e++) {
|
|
25374
25450
|
let t = dD(n, 0, r, e), i = dD(n, r, n.length, e);
|
|
25375
25451
|
t !== "empty" && i !== "empty" && (o++, t !== i && a++);
|
|
25376
25452
|
}
|
|
25377
25453
|
return o === 0 ? 0 : a / o;
|
|
25378
|
-
},
|
|
25454
|
+
}, mk = (e) => e <= 0 ? 0 : Math.min(1, e / uk), hk = (e, t) => {
|
|
25379
25455
|
let n = 0, r = 0;
|
|
25380
25456
|
for (let i = Math.max(0, t); i < e.length; i++) {
|
|
25381
25457
|
let t = e[i];
|
|
@@ -25386,7 +25462,7 @@ var PO = (e, t, n, r) => {
|
|
|
25386
25462
|
}
|
|
25387
25463
|
}
|
|
25388
25464
|
return n === 0 ? 0 : r / n;
|
|
25389
|
-
},
|
|
25465
|
+
}, gk = {
|
|
25390
25466
|
banner: {
|
|
25391
25467
|
weight: .85,
|
|
25392
25468
|
tau: .05,
|
|
@@ -25442,64 +25518,64 @@ var PO = (e, t, n, r) => {
|
|
|
25442
25518
|
tau: .3,
|
|
25443
25519
|
tier: "semantics"
|
|
25444
25520
|
}
|
|
25445
|
-
},
|
|
25521
|
+
}, _k = .65, vk = 300, yk = 50, bk = 100, xk = [
|
|
25446
25522
|
.25,
|
|
25447
25523
|
.5,
|
|
25448
25524
|
.75
|
|
25449
|
-
],
|
|
25525
|
+
], Sk = (e, t) => e <= t ? 0 : (e - t) / (1 - t), Ck = (e) => {
|
|
25450
25526
|
let t = 1;
|
|
25451
25527
|
for (let { weight: n, evidence: r } of e) t *= 1 - n * Math.min(1, Math.max(0, r));
|
|
25452
25528
|
return 1 - t;
|
|
25453
|
-
},
|
|
25529
|
+
}, wk = (e) => {
|
|
25454
25530
|
if (e.length <= 1e3) return e.length ? [e] : [];
|
|
25455
|
-
let t = [[0,
|
|
25456
|
-
for (let n of
|
|
25531
|
+
let t = [[0, vk]];
|
|
25532
|
+
for (let n of xk) {
|
|
25457
25533
|
let r = Math.floor(e.length * n);
|
|
25458
|
-
t.push([r, r +
|
|
25534
|
+
t.push([r, r + yk]);
|
|
25459
25535
|
}
|
|
25460
|
-
t.push([e.length -
|
|
25536
|
+
t.push([e.length - bk, e.length]);
|
|
25461
25537
|
let n = [], r = 0;
|
|
25462
25538
|
for (let [i, a] of t) {
|
|
25463
25539
|
let t = Math.max(i, r), o = Math.min(a, e.length);
|
|
25464
25540
|
o <= t || (n.push(e.slice(t, o)), r = o);
|
|
25465
25541
|
}
|
|
25466
25542
|
return n;
|
|
25467
|
-
},
|
|
25468
|
-
let r =
|
|
25543
|
+
}, Tk = (e, t, n) => {
|
|
25544
|
+
let r = wk(e);
|
|
25469
25545
|
if (r.length === 0) return {
|
|
25470
25546
|
score: 0,
|
|
25471
25547
|
geometryScore: 0,
|
|
25472
|
-
signals:
|
|
25548
|
+
signals: Dk()
|
|
25473
25549
|
};
|
|
25474
|
-
let i = r.flat(), a = r[0], o = r[r.length - 1], s = r.length === 1, c = s ? n.dataStartIndex :
|
|
25475
|
-
banner:
|
|
25476
|
-
alignmentChurn:
|
|
25477
|
-
columnIslands:
|
|
25478
|
-
layoutChurn: Math.max(...r.map((e) =>
|
|
25479
|
-
verticalMerges:
|
|
25480
|
-
gaps:
|
|
25481
|
-
tailSparse:
|
|
25482
|
-
headerLikeRow:
|
|
25483
|
-
typeChurn:
|
|
25484
|
-
preamble:
|
|
25485
|
-
multiline:
|
|
25550
|
+
let i = r.flat(), a = r[0], o = r[r.length - 1], s = r.length === 1, c = s ? n.dataStartIndex : Ek(a) + 1, l = {
|
|
25551
|
+
banner: nk(i),
|
|
25552
|
+
alignmentChurn: rk(i),
|
|
25553
|
+
columnIslands: ik(i),
|
|
25554
|
+
layoutChurn: Math.max(...r.map((e) => ak(e))),
|
|
25555
|
+
verticalMerges: ok(t, e.length),
|
|
25556
|
+
gaps: sk(i),
|
|
25557
|
+
tailSparse: ck(o),
|
|
25558
|
+
headerLikeRow: fk(i, c),
|
|
25559
|
+
typeChurn: pk(i, c),
|
|
25560
|
+
preamble: mk(s ? n.headerRowIndex : Ek(a)),
|
|
25561
|
+
multiline: hk(i, c)
|
|
25486
25562
|
}, u = [], d = [];
|
|
25487
|
-
for (let e of Object.keys(
|
|
25488
|
-
let { weight: t, tau: n, tier: r } =
|
|
25563
|
+
for (let e of Object.keys(gk)) {
|
|
25564
|
+
let { weight: t, tau: n, tier: r } = gk[e], i = {
|
|
25489
25565
|
weight: t,
|
|
25490
|
-
evidence:
|
|
25566
|
+
evidence: Sk(l[e], n)
|
|
25491
25567
|
};
|
|
25492
25568
|
u.push(i), r === "geometry" && d.push(i);
|
|
25493
25569
|
}
|
|
25494
25570
|
return {
|
|
25495
|
-
score:
|
|
25496
|
-
geometryScore:
|
|
25571
|
+
score: Ck(u),
|
|
25572
|
+
geometryScore: Ck(d),
|
|
25497
25573
|
signals: l
|
|
25498
25574
|
};
|
|
25499
|
-
},
|
|
25575
|
+
}, Ek = (e) => {
|
|
25500
25576
|
for (let t = 0; t < e.length; t++) if (e[t]?.some((e) => e != null && String(e).trim() !== "")) return t;
|
|
25501
25577
|
return 0;
|
|
25502
|
-
},
|
|
25578
|
+
}, Dk = () => ({
|
|
25503
25579
|
banner: 0,
|
|
25504
25580
|
alignmentChurn: 0,
|
|
25505
25581
|
columnIslands: 0,
|
|
@@ -25511,7 +25587,7 @@ var PO = (e, t, n, r) => {
|
|
|
25511
25587
|
typeChurn: 0,
|
|
25512
25588
|
preamble: 0,
|
|
25513
25589
|
multiline: 0
|
|
25514
|
-
}),
|
|
25590
|
+
}), Ok = (e, t, n) => Tk(e, t, n).score > _k, kk = (e, t, n) => {
|
|
25515
25591
|
let r = CD(e.rows), i = OD(r, r.headerRowIndex), a = kD(e.rows, r.headerRowIndex, i, t);
|
|
25516
25592
|
return {
|
|
25517
25593
|
preview: {
|
|
@@ -25520,9 +25596,9 @@ var PO = (e, t, n, r) => {
|
|
|
25520
25596
|
rows: ID(e.rows, a, i, 15),
|
|
25521
25597
|
totalRows: e.totalRows - 1
|
|
25522
25598
|
},
|
|
25523
|
-
unstructured: n ?
|
|
25599
|
+
unstructured: n ? Ok(e.rows, [], r) : !1
|
|
25524
25600
|
};
|
|
25525
|
-
},
|
|
25601
|
+
}, Ak = (e, t, n, r, i) => {
|
|
25526
25602
|
let a = CD(e);
|
|
25527
25603
|
return {
|
|
25528
25604
|
kind: "parsed",
|
|
@@ -25533,10 +25609,10 @@ var PO = (e, t, n, r) => {
|
|
|
25533
25609
|
},
|
|
25534
25610
|
headerRowIndex: a.headerRowIndex,
|
|
25535
25611
|
csvErrors: n,
|
|
25536
|
-
unstructured: i ?
|
|
25612
|
+
unstructured: i ? Ok(e, r, a) : !1
|
|
25537
25613
|
};
|
|
25538
25614
|
};
|
|
25539
|
-
async function
|
|
25615
|
+
async function jk(e, t, r, i, a = {}) {
|
|
25540
25616
|
let o = a.score ?? !1;
|
|
25541
25617
|
try {
|
|
25542
25618
|
if (r === "csv") {
|
|
@@ -25544,7 +25620,7 @@ async function kk(e, t, r, i, a = {}) {
|
|
|
25544
25620
|
format: "csv",
|
|
25545
25621
|
signal: a.signal
|
|
25546
25622
|
});
|
|
25547
|
-
return n.kind === "rows" ?
|
|
25623
|
+
return n.kind === "rows" ? Ak(n.rows, n.delimiter, n.errors, n.merges ?? [], o) : { kind: "unexpected" };
|
|
25548
25624
|
}
|
|
25549
25625
|
if (r === "json" || r === "xml") {
|
|
25550
25626
|
let n = await e.parse(t, {
|
|
@@ -25568,14 +25644,14 @@ async function kk(e, t, r, i, a = {}) {
|
|
|
25568
25644
|
signal: a.signal
|
|
25569
25645
|
});
|
|
25570
25646
|
if (!a.sheetName && n.kind === "sheets") {
|
|
25571
|
-
let e = n.sheets.map((e) =>
|
|
25647
|
+
let e = n.sheets.map((e) => kk(e, i, o));
|
|
25572
25648
|
return {
|
|
25573
25649
|
kind: "sheets",
|
|
25574
25650
|
previews: e.map((e) => e.preview),
|
|
25575
25651
|
unstructured: e.some((e) => e.unstructured)
|
|
25576
25652
|
};
|
|
25577
25653
|
}
|
|
25578
|
-
return n.kind === "rows" ?
|
|
25654
|
+
return n.kind === "rows" ? Ak(n.rows, ",", [], n.merges ?? [], o) : { kind: "unexpected" };
|
|
25579
25655
|
} catch (e) {
|
|
25580
25656
|
return {
|
|
25581
25657
|
kind: "error",
|
|
@@ -25586,7 +25662,7 @@ async function kk(e, t, r, i, a = {}) {
|
|
|
25586
25662
|
}
|
|
25587
25663
|
//#endregion
|
|
25588
25664
|
//#region src/components/DataUploader/core/parser/recordsToGrid.ts
|
|
25589
|
-
var
|
|
25665
|
+
var Mk = (t) => {
|
|
25590
25666
|
if (t.length === 0) return null;
|
|
25591
25667
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
25592
25668
|
for (let e of t) for (let t of Object.keys(e)) n.has(t) || (n.add(t), r.push(t));
|
|
@@ -25601,23 +25677,23 @@ var Ak = (t) => {
|
|
|
25601
25677
|
})),
|
|
25602
25678
|
detection: AD()
|
|
25603
25679
|
};
|
|
25604
|
-
},
|
|
25680
|
+
}, Nk = /* @__PURE__ */ new Set([
|
|
25605
25681
|
"xlsx",
|
|
25606
25682
|
"xls",
|
|
25607
25683
|
"xlsb",
|
|
25608
25684
|
"ods"
|
|
25609
|
-
]),
|
|
25685
|
+
]), Pk = (e) => {
|
|
25610
25686
|
let t = e.split(".").pop()?.toLowerCase();
|
|
25611
|
-
return t &&
|
|
25612
|
-
},
|
|
25687
|
+
return t && Nk.has(t) ? "xlsx" : t === "json" ? "json" : t === "xml" ? "xml" : "csv";
|
|
25688
|
+
}, Fk = 20, Ik = {
|
|
25613
25689
|
workbooks: [],
|
|
25614
25690
|
parsing: null,
|
|
25615
25691
|
stagedItems: [],
|
|
25616
25692
|
unionHeaders: []
|
|
25617
|
-
},
|
|
25693
|
+
}, Lk = (e) => {
|
|
25618
25694
|
let t = e[0];
|
|
25619
25695
|
return typeof t?.name == "string" && Array.isArray(t.rows);
|
|
25620
|
-
},
|
|
25696
|
+
}, Rk = (e) => e.source.kind === "remote" ? {
|
|
25621
25697
|
kind: "remote",
|
|
25622
25698
|
sourceId: e.source.sourceId
|
|
25623
25699
|
} : e.materialize.kind === "sheet" ? {
|
|
@@ -25631,18 +25707,18 @@ var Ak = (t) => {
|
|
|
25631
25707
|
} : {
|
|
25632
25708
|
kind: "file",
|
|
25633
25709
|
file: e.source.file
|
|
25634
|
-
},
|
|
25710
|
+
}, zk = class {
|
|
25635
25711
|
client;
|
|
25636
25712
|
synthesize;
|
|
25637
25713
|
customFormats;
|
|
25638
25714
|
onUnstructuredFile;
|
|
25639
|
-
tokens = new
|
|
25715
|
+
tokens = new BO();
|
|
25640
25716
|
workbookSeq = 0;
|
|
25641
25717
|
stagedSeq = 0;
|
|
25642
25718
|
queue = [];
|
|
25643
25719
|
pumping = !1;
|
|
25644
25720
|
escalated = /* @__PURE__ */ new Set();
|
|
25645
|
-
_state =
|
|
25721
|
+
_state = Ik;
|
|
25646
25722
|
constructor(e, t, n = [], r) {
|
|
25647
25723
|
this.client = e, this.synthesize = t, this.customFormats = n, this.onUnstructuredFile = r;
|
|
25648
25724
|
}
|
|
@@ -25660,29 +25736,29 @@ var Ak = (t) => {
|
|
|
25660
25736
|
kind: "file",
|
|
25661
25737
|
file: e
|
|
25662
25738
|
};
|
|
25663
|
-
this.escalated.delete(
|
|
25664
|
-
let n =
|
|
25739
|
+
this.escalated.delete(VO(t));
|
|
25740
|
+
let n = zO(e, this.customFormats);
|
|
25665
25741
|
return n ? this.runCustomFormat(e, n, t) : this.enqueue(e, t, e.name);
|
|
25666
25742
|
}
|
|
25667
25743
|
stageGrid(e, t, n, r) {
|
|
25668
|
-
let i = this.readyItem(t, n,
|
|
25744
|
+
let i = this.readyItem(t, n, HO(n, e, r, this.synthesize), {
|
|
25669
25745
|
kind: "grid",
|
|
25670
25746
|
grid: e,
|
|
25671
25747
|
headerRowIndex: r
|
|
25672
25748
|
});
|
|
25673
25749
|
this.patch({
|
|
25674
|
-
stagedItems: [...this.itemsWithoutSource(
|
|
25750
|
+
stagedItems: [...this.itemsWithoutSource(VO(t)), i],
|
|
25675
25751
|
parsing: null
|
|
25676
25752
|
});
|
|
25677
25753
|
}
|
|
25678
25754
|
stageGrids(e, t) {
|
|
25679
|
-
let n = e.map((e) => this.readyItem(t, e.name,
|
|
25755
|
+
let n = e.map((e) => this.readyItem(t, e.name, HO(e.name, e.grid, e.headerRowIndex, this.synthesize), {
|
|
25680
25756
|
kind: "custom",
|
|
25681
25757
|
grid: e.grid,
|
|
25682
25758
|
headerRowIndex: e.headerRowIndex,
|
|
25683
25759
|
tableName: e.name
|
|
25684
25760
|
}));
|
|
25685
|
-
this.patch({ stagedItems: [...this.itemsWithoutSource(
|
|
25761
|
+
this.patch({ stagedItems: [...this.itemsWithoutSource(VO(t)), ...n] });
|
|
25686
25762
|
}
|
|
25687
25763
|
toggleItem(e) {
|
|
25688
25764
|
this.patch({ stagedItems: this._state.stagedItems.map((t) => t.id === e && t.status === "ready" ? {
|
|
@@ -25696,19 +25772,19 @@ var Ak = (t) => {
|
|
|
25696
25772
|
ok: !1,
|
|
25697
25773
|
attempt: null
|
|
25698
25774
|
};
|
|
25699
|
-
let t = e.map((e) =>
|
|
25775
|
+
let t = e.map((e) => Rk(e)), n = this._state.workbooks.filter((e) => t.some((t) => BD(e.origin, t)));
|
|
25700
25776
|
n.length !== this._state.workbooks.length && this.setWorkbooks(n);
|
|
25701
25777
|
for (let t of e) {
|
|
25702
|
-
let e =
|
|
25778
|
+
let e = Rk(t);
|
|
25703
25779
|
if (this._state.workbooks.some((t) => BD(t.origin, e))) continue;
|
|
25704
25780
|
if (t.materialize.kind === "grid" || t.materialize.kind === "custom") {
|
|
25705
25781
|
this.addWorkbook(t.materialize.grid, e, t.name, t.materialize.headerRowIndex);
|
|
25706
25782
|
continue;
|
|
25707
25783
|
}
|
|
25708
25784
|
if (t.source.kind !== "file") continue;
|
|
25709
|
-
let { file: n } = t.source, r =
|
|
25785
|
+
let { file: n } = t.source, r = VO(t.source), i = this.tokens.issue(r);
|
|
25710
25786
|
this.patch({ parsing: { file: n } });
|
|
25711
|
-
let a = await
|
|
25787
|
+
let a = await jk(this.client, n, "xlsx", this.synthesize, {
|
|
25712
25788
|
sheetName: t.materialize.sheetName,
|
|
25713
25789
|
signal: i
|
|
25714
25790
|
});
|
|
@@ -25732,7 +25808,7 @@ var Ak = (t) => {
|
|
|
25732
25808
|
}
|
|
25733
25809
|
removeWorkbook(e) {
|
|
25734
25810
|
let t = this._state.workbooks.find((t) => t.id === e);
|
|
25735
|
-
t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !BD(
|
|
25811
|
+
t && this.setWorkbooks(this._state.workbooks.filter((t) => t.id !== e), { stagedItems: this._state.stagedItems.filter((e) => e.status === "pending" || !BD(Rk(e), t.origin)) });
|
|
25736
25812
|
}
|
|
25737
25813
|
cancel(e) {
|
|
25738
25814
|
if (e.kind === "all") {
|
|
@@ -25744,16 +25820,16 @@ var Ak = (t) => {
|
|
|
25744
25820
|
}
|
|
25745
25821
|
let t = this._state.stagedItems.find((t) => t.id === e.id);
|
|
25746
25822
|
if (t?.status !== "pending") return;
|
|
25747
|
-
let n =
|
|
25823
|
+
let n = VO(t.source);
|
|
25748
25824
|
this.tokens.abort(n), this.dropQueued(n);
|
|
25749
25825
|
let { parsing: r } = this._state;
|
|
25750
|
-
r &&
|
|
25826
|
+
r && VO({
|
|
25751
25827
|
kind: "file",
|
|
25752
25828
|
file: r.file
|
|
25753
25829
|
}) === n && this.patch({ parsing: null }), this.patch({ stagedItems: this._state.stagedItems.filter((t) => t.id !== e.id) });
|
|
25754
25830
|
}
|
|
25755
25831
|
reset() {
|
|
25756
|
-
this.tokens.abortAll(), this.flushQueue(), this.escalated.clear(), this._state =
|
|
25832
|
+
this.tokens.abortAll(), this.flushQueue(), this.escalated.clear(), this._state = Ik;
|
|
25757
25833
|
}
|
|
25758
25834
|
clearWorkbooks() {
|
|
25759
25835
|
this.setWorkbooks([]);
|
|
@@ -25761,7 +25837,7 @@ var Ak = (t) => {
|
|
|
25761
25837
|
takeRawRows(e) {
|
|
25762
25838
|
let t = this._state.workbooks.find((t) => t.id === e);
|
|
25763
25839
|
if (!t) return null;
|
|
25764
|
-
let n = t.rawRows, r = Math.max(
|
|
25840
|
+
let n = t.rawRows, r = Math.max(Fk, t.dataStartIndex + 1);
|
|
25765
25841
|
return this.setWorkbooks(this._state.workbooks.map((t) => t.id === e ? {
|
|
25766
25842
|
...t,
|
|
25767
25843
|
rawRows: n.slice(0, r)
|
|
@@ -25783,7 +25859,7 @@ var Ak = (t) => {
|
|
|
25783
25859
|
}) : n));
|
|
25784
25860
|
}
|
|
25785
25861
|
enqueue(e, t, n) {
|
|
25786
|
-
let r =
|
|
25862
|
+
let r = VO(t);
|
|
25787
25863
|
this.dropQueued(r);
|
|
25788
25864
|
let i = this.tokens.issue(r), a = {
|
|
25789
25865
|
id: `st-${++this.stagedSeq}`,
|
|
@@ -25803,7 +25879,7 @@ var Ak = (t) => {
|
|
|
25803
25879
|
});
|
|
25804
25880
|
}
|
|
25805
25881
|
async runCustomFormat(e, t, n) {
|
|
25806
|
-
let r =
|
|
25882
|
+
let r = VO(n);
|
|
25807
25883
|
this.dropQueued(r);
|
|
25808
25884
|
let i = this.tokens.issue(r), a = {
|
|
25809
25885
|
id: `st-${++this.stagedSeq}`,
|
|
@@ -25851,12 +25927,12 @@ var Ak = (t) => {
|
|
|
25851
25927
|
return i.length === 0 ? null : (this.stageGrids(i, t.source), this.patch({ parsing: null }), { kind: "staged" });
|
|
25852
25928
|
}
|
|
25853
25929
|
toStageEntries(e, t) {
|
|
25854
|
-
let n =
|
|
25930
|
+
let n = Lk(e) ? e : [{
|
|
25855
25931
|
name: t,
|
|
25856
25932
|
rows: e
|
|
25857
25933
|
}], r = [];
|
|
25858
25934
|
for (let e of n) {
|
|
25859
|
-
let n =
|
|
25935
|
+
let n = Mk(e.rows);
|
|
25860
25936
|
n && r.push({
|
|
25861
25937
|
grid: n,
|
|
25862
25938
|
name: e.name || t,
|
|
@@ -25877,7 +25953,7 @@ var Ak = (t) => {
|
|
|
25877
25953
|
continue;
|
|
25878
25954
|
}
|
|
25879
25955
|
this.patch({ parsing: { file: e.source.file } });
|
|
25880
|
-
let t =
|
|
25956
|
+
let t = Pk(e.file.name), n = await jk(this.client, e.file, t, this.synthesize, {
|
|
25881
25957
|
signal: e.signal,
|
|
25882
25958
|
score: !!this.onUnstructuredFile && !this.escalated.has(e.key)
|
|
25883
25959
|
});
|
|
@@ -25918,7 +25994,7 @@ var Ak = (t) => {
|
|
|
25918
25994
|
this.queue = this.queue.filter((e) => !t.includes(e));
|
|
25919
25995
|
}
|
|
25920
25996
|
itemsWithoutSource(e) {
|
|
25921
|
-
return this._state.stagedItems.filter((t) =>
|
|
25997
|
+
return this._state.stagedItems.filter((t) => VO(t.source) !== e);
|
|
25922
25998
|
}
|
|
25923
25999
|
readyItem(e, t, n, r) {
|
|
25924
26000
|
return {
|
|
@@ -25932,10 +26008,10 @@ var Ak = (t) => {
|
|
|
25932
26008
|
};
|
|
25933
26009
|
}
|
|
25934
26010
|
applyOutcome(e, t, n) {
|
|
25935
|
-
let r = this.itemsWithoutSource(
|
|
26011
|
+
let r = this.itemsWithoutSource(VO(t));
|
|
25936
26012
|
switch (e.kind) {
|
|
25937
26013
|
case "parsed": {
|
|
25938
|
-
let i = this.readyItem(t, n,
|
|
26014
|
+
let i = this.readyItem(t, n, HO(n, e.grid, e.headerRowIndex, this.synthesize), {
|
|
25939
26015
|
kind: "grid",
|
|
25940
26016
|
grid: e.grid,
|
|
25941
26017
|
headerRowIndex: e.headerRowIndex
|
|
@@ -25980,7 +26056,7 @@ var Ak = (t) => {
|
|
|
25980
26056
|
return this.setWorkbooks(o, { parsing: null }), i;
|
|
25981
26057
|
}
|
|
25982
26058
|
reproject(e) {
|
|
25983
|
-
let { headers: t, dataStartIndex: n } =
|
|
26059
|
+
let { headers: t, dataStartIndex: n } = IO(e.rawRows, e.detection, e.headerRowIndex, this.synthesize);
|
|
25984
26060
|
return {
|
|
25985
26061
|
...e,
|
|
25986
26062
|
headers: t,
|
|
@@ -26002,7 +26078,7 @@ var Ak = (t) => {
|
|
|
26002
26078
|
...e
|
|
26003
26079
|
};
|
|
26004
26080
|
}
|
|
26005
|
-
},
|
|
26081
|
+
}, Bk = class {
|
|
26006
26082
|
columns;
|
|
26007
26083
|
declaredKey;
|
|
26008
26084
|
_state;
|
|
@@ -26030,11 +26106,11 @@ var Ak = (t) => {
|
|
|
26030
26106
|
composite: i
|
|
26031
26107
|
});
|
|
26032
26108
|
}
|
|
26033
|
-
},
|
|
26109
|
+
}, Vk = {
|
|
26034
26110
|
loadingId: null,
|
|
26035
26111
|
error: null
|
|
26036
|
-
},
|
|
26037
|
-
_state =
|
|
26112
|
+
}, Hk = class {
|
|
26113
|
+
_state = Vk;
|
|
26038
26114
|
get state() {
|
|
26039
26115
|
return this._state;
|
|
26040
26116
|
}
|
|
@@ -26056,37 +26132,37 @@ var Ak = (t) => {
|
|
|
26056
26132
|
loadingId: null
|
|
26057
26133
|
};
|
|
26058
26134
|
}
|
|
26059
|
-
},
|
|
26135
|
+
}, Uk = (e, t, n) => {
|
|
26060
26136
|
let r = /* @__PURE__ */ new Set();
|
|
26061
26137
|
for (let i of e) if (i !== "") if (n) for (let e of kc(i, n, t, mO)) r.add(e);
|
|
26062
26138
|
else r.add(i);
|
|
26063
26139
|
return [...r];
|
|
26064
|
-
},
|
|
26140
|
+
}, Wk = (e, t) => {
|
|
26065
26141
|
let n = /* @__PURE__ */ new Map();
|
|
26066
26142
|
for (let [r, i] of Object.entries(e)) {
|
|
26067
26143
|
let e = t.find((e) => e.id === r);
|
|
26068
26144
|
!e || Z(e).options(e) === null || n.set(r, i);
|
|
26069
26145
|
}
|
|
26070
26146
|
return n;
|
|
26071
|
-
},
|
|
26147
|
+
}, Gk = (e, t) => {
|
|
26072
26148
|
let n = Z(t), r = n.options(t);
|
|
26073
26149
|
if (r === null) return null;
|
|
26074
26150
|
if (n.storage === "string[]") {
|
|
26075
26151
|
let i = vp(e, r, n.delimiter(t), hO(t));
|
|
26076
26152
|
return {
|
|
26077
|
-
importedValues:
|
|
26153
|
+
importedValues: Uk(e, r, i),
|
|
26078
26154
|
options: r,
|
|
26079
26155
|
delimiter: i,
|
|
26080
26156
|
isMultiselect: !0
|
|
26081
26157
|
};
|
|
26082
26158
|
}
|
|
26083
26159
|
return {
|
|
26084
|
-
importedValues:
|
|
26160
|
+
importedValues: Uk(e, r, null),
|
|
26085
26161
|
options: r,
|
|
26086
26162
|
delimiter: null,
|
|
26087
26163
|
isMultiselect: !1
|
|
26088
26164
|
};
|
|
26089
|
-
},
|
|
26165
|
+
}, Kk = (e, t) => {
|
|
26090
26166
|
let n = /* @__PURE__ */ new Set();
|
|
26091
26167
|
for (let r of t) {
|
|
26092
26168
|
let t = e.find((e) => e.id === r.workbookId);
|
|
@@ -26095,12 +26171,12 @@ var Ak = (t) => {
|
|
|
26095
26171
|
if (i !== void 0) for (let e of PD(t.rawRows, t.dataStartIndex, i)) n.add(e);
|
|
26096
26172
|
}
|
|
26097
26173
|
return [...n];
|
|
26098
|
-
},
|
|
26174
|
+
}, qk = (e, t, n) => {
|
|
26099
26175
|
let r = {}, i = {}, a = {};
|
|
26100
|
-
for (let [o, s] of
|
|
26176
|
+
for (let [o, s] of Wk(t, n)) {
|
|
26101
26177
|
let t = n.find((e) => e.id === o);
|
|
26102
26178
|
if (!t) continue;
|
|
26103
|
-
let c =
|
|
26179
|
+
let c = Kk(e, s), l = Gk(c, t);
|
|
26104
26180
|
l && (a[o] = c, l.isMultiselect && (i[o] = l.delimiter), r[o] = {
|
|
26105
26181
|
importedValues: l.importedValues,
|
|
26106
26182
|
options: l.options
|
|
@@ -26111,27 +26187,27 @@ var Ak = (t) => {
|
|
|
26111
26187
|
delimiters: i,
|
|
26112
26188
|
rawCellsByColumn: a
|
|
26113
26189
|
};
|
|
26114
|
-
},
|
|
26190
|
+
}, Jk = (e, t) => {
|
|
26115
26191
|
let n = {};
|
|
26116
26192
|
for (let [r, i] of Object.entries(e)) n[r] = {
|
|
26117
26193
|
...i,
|
|
26118
26194
|
...t[r]
|
|
26119
26195
|
};
|
|
26120
26196
|
return n;
|
|
26121
|
-
},
|
|
26197
|
+
}, Yk = (e, t, n, r) => ({
|
|
26122
26198
|
...e,
|
|
26123
26199
|
[t]: {
|
|
26124
26200
|
...e[t],
|
|
26125
26201
|
[n]: r
|
|
26126
26202
|
}
|
|
26127
|
-
}),
|
|
26203
|
+
}), Xk = (e, t, n) => Zk(e, t, [n]), Zk = (e, t, n) => {
|
|
26128
26204
|
let r = e[t] ?? [], i = new Set(r), a = [];
|
|
26129
26205
|
for (let e of n) i.has(e) || (i.add(e), a.push(e));
|
|
26130
26206
|
return a.length === 0 ? e : {
|
|
26131
26207
|
...e,
|
|
26132
26208
|
[t]: [...r, ...a]
|
|
26133
26209
|
};
|
|
26134
|
-
},
|
|
26210
|
+
}, Qk = (e, t, n, r) => {
|
|
26135
26211
|
let i = t[r];
|
|
26136
26212
|
if (!i || i.length === 0) return null;
|
|
26137
26213
|
let a = n.find((e) => e.id === r);
|
|
@@ -26146,7 +26222,7 @@ var Ak = (t) => {
|
|
|
26146
26222
|
if (!s) return null;
|
|
26147
26223
|
let c = Z(a);
|
|
26148
26224
|
return { delimiter: vp(o, c.options(a) ?? [], c.delimiter(a), hO(a)) };
|
|
26149
|
-
},
|
|
26225
|
+
}, $k = new Intl.Collator(), eA = {
|
|
26150
26226
|
merged: {},
|
|
26151
26227
|
computed: {},
|
|
26152
26228
|
multiselectDelimiters: {},
|
|
@@ -26154,7 +26230,7 @@ var Ak = (t) => {
|
|
|
26154
26230
|
importedValues: {},
|
|
26155
26231
|
verdicts: {},
|
|
26156
26232
|
isMatching: !1
|
|
26157
|
-
},
|
|
26233
|
+
}, tA = (e, t) => {
|
|
26158
26234
|
let n = [], r = [];
|
|
26159
26235
|
for (let [r, i] of t) {
|
|
26160
26236
|
let t = e.get(r);
|
|
@@ -26165,7 +26241,7 @@ var Ak = (t) => {
|
|
|
26165
26241
|
changed: n,
|
|
26166
26242
|
removed: r
|
|
26167
26243
|
};
|
|
26168
|
-
},
|
|
26244
|
+
}, nA = class {
|
|
26169
26245
|
deps;
|
|
26170
26246
|
notify;
|
|
26171
26247
|
seq = 0;
|
|
@@ -26175,7 +26251,7 @@ var Ak = (t) => {
|
|
|
26175
26251
|
lastInputs = null;
|
|
26176
26252
|
cellCache = /* @__PURE__ */ new Map();
|
|
26177
26253
|
hookOutput = null;
|
|
26178
|
-
_state =
|
|
26254
|
+
_state = eA;
|
|
26179
26255
|
constructor(e, t) {
|
|
26180
26256
|
this.deps = e, this.notify = t;
|
|
26181
26257
|
}
|
|
@@ -26193,12 +26269,12 @@ var Ak = (t) => {
|
|
|
26193
26269
|
});
|
|
26194
26270
|
return;
|
|
26195
26271
|
}
|
|
26196
|
-
let n =
|
|
26272
|
+
let n = Wk(e.headersByColumn, this.deps.columns), r = this.lastInputs;
|
|
26197
26273
|
if (this.lastInputs = {
|
|
26198
26274
|
workbooks: t,
|
|
26199
26275
|
associations: n
|
|
26200
26276
|
}, r !== null && r.workbooks === t) {
|
|
26201
|
-
let e =
|
|
26277
|
+
let e = tA(r.associations, n);
|
|
26202
26278
|
if (e.changed.length === 0 && e.removed.length === 0) return;
|
|
26203
26279
|
this.recomputeChanged(t, e);
|
|
26204
26280
|
return;
|
|
@@ -26206,14 +26282,14 @@ var Ak = (t) => {
|
|
|
26206
26282
|
this.cellCache.clear(), this.fullRecompute(t, e.headersByColumn);
|
|
26207
26283
|
}
|
|
26208
26284
|
fullRecompute(e, t) {
|
|
26209
|
-
let { selectData: n, delimiters: r, rawCellsByColumn: i } =
|
|
26285
|
+
let { selectData: n, delimiters: r, rawCellsByColumn: i } = qk(e, t, this.deps.columns);
|
|
26210
26286
|
this.rawCellsByColumn = i, this.lastSelectData = n;
|
|
26211
26287
|
for (let [e, t] of this.lastInputs?.associations ?? []) {
|
|
26212
26288
|
let n = i[e];
|
|
26213
26289
|
n && this.cellCache.set($D(t), n);
|
|
26214
26290
|
}
|
|
26215
26291
|
let a = {};
|
|
26216
|
-
for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort(
|
|
26292
|
+
for (let [e, t] of Object.entries(n)) a[e] = [...t.importedValues].sort($k.compare);
|
|
26217
26293
|
this.patch({
|
|
26218
26294
|
multiselectDelimiters: r,
|
|
26219
26295
|
importedValues: a,
|
|
@@ -26227,13 +26303,13 @@ var Ak = (t) => {
|
|
|
26227
26303
|
let t = this.deps.columns.find((e) => e.id === c);
|
|
26228
26304
|
if (!t) continue;
|
|
26229
26305
|
let u = $D(l), d = this.cellCache.get(u);
|
|
26230
|
-
d || (d =
|
|
26231
|
-
let f =
|
|
26306
|
+
d || (d = Kk(e, l), this.cellCache.set(u, d));
|
|
26307
|
+
let f = Gk(d, t);
|
|
26232
26308
|
if (!f) continue;
|
|
26233
26309
|
r[c] = d, n[c] = {
|
|
26234
26310
|
importedValues: f.importedValues,
|
|
26235
26311
|
options: f.options
|
|
26236
|
-
}, f.isMultiselect && (i[c] = f.delimiter), a[c] = [...f.importedValues].sort(
|
|
26312
|
+
}, f.isMultiselect && (i[c] = f.delimiter), a[c] = [...f.importedValues].sort($k.compare);
|
|
26237
26313
|
let p = this.computeMatches({ [c]: n[c] });
|
|
26238
26314
|
o[c] = p.computed[c], p.verdicts[c] ? s[c] = p.verdicts[c] : delete s[c];
|
|
26239
26315
|
}
|
|
@@ -26294,7 +26370,7 @@ var Ak = (t) => {
|
|
|
26294
26370
|
this.hookOutput = null, this.cancelHook();
|
|
26295
26371
|
}
|
|
26296
26372
|
updateValueMapping(e, t, n) {
|
|
26297
|
-
this.manual =
|
|
26373
|
+
this.manual = Yk(this.manual, e, t, n), this.patch({});
|
|
26298
26374
|
}
|
|
26299
26375
|
applyValueMappingBatch(e, t) {
|
|
26300
26376
|
if (t.length === 0) return;
|
|
@@ -26311,7 +26387,7 @@ var Ak = (t) => {
|
|
|
26311
26387
|
[e]: t
|
|
26312
26388
|
} }, r = this.rawCellsByColumn[e];
|
|
26313
26389
|
if (r) {
|
|
26314
|
-
let i = this.deps.columns.find((t) => t.id === e), a = i ? Z(i).options(i) ?? [] : [], o =
|
|
26390
|
+
let i = this.deps.columns.find((t) => t.id === e), a = i ? Z(i).options(i) ?? [] : [], o = Uk(r, a, t), s = {
|
|
26315
26391
|
importedValues: o,
|
|
26316
26392
|
options: a
|
|
26317
26393
|
};
|
|
@@ -26320,7 +26396,7 @@ var Ak = (t) => {
|
|
|
26320
26396
|
[e]: s
|
|
26321
26397
|
}, n.importedValues = {
|
|
26322
26398
|
...this._state.importedValues,
|
|
26323
|
-
[e]: [...o].sort(
|
|
26399
|
+
[e]: [...o].sort($k.compare)
|
|
26324
26400
|
};
|
|
26325
26401
|
let c = this.computeMatches({ [e]: s });
|
|
26326
26402
|
n.computed = {
|
|
@@ -26333,14 +26409,14 @@ var Ak = (t) => {
|
|
|
26333
26409
|
this.patch(n);
|
|
26334
26410
|
}
|
|
26335
26411
|
addPendingOption(e, t) {
|
|
26336
|
-
let n =
|
|
26412
|
+
let n = Xk(this._state.pendingOptions, e, t);
|
|
26337
26413
|
n !== this._state.pendingOptions && (this._state = {
|
|
26338
26414
|
...this._state,
|
|
26339
26415
|
pendingOptions: n
|
|
26340
26416
|
});
|
|
26341
26417
|
}
|
|
26342
26418
|
addPendingOptions(e, t) {
|
|
26343
|
-
let n =
|
|
26419
|
+
let n = Zk(this._state.pendingOptions, e, t);
|
|
26344
26420
|
n !== this._state.pendingOptions && (this._state = {
|
|
26345
26421
|
...this._state,
|
|
26346
26422
|
pendingOptions: n
|
|
@@ -26356,10 +26432,10 @@ var Ak = (t) => {
|
|
|
26356
26432
|
};
|
|
26357
26433
|
this._state = {
|
|
26358
26434
|
...t,
|
|
26359
|
-
merged:
|
|
26435
|
+
merged: Jk(t.computed, this.manual)
|
|
26360
26436
|
};
|
|
26361
26437
|
}
|
|
26362
|
-
},
|
|
26438
|
+
}, rA = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), iA = (e, t) => e === t ? !0 : e === null || t === null ? !1 : e.workbookId === t.workbookId && e.position === t.position && e.total === t.total, aA = class {
|
|
26363
26439
|
snapshots = new oO();
|
|
26364
26440
|
deps;
|
|
26365
26441
|
parser;
|
|
@@ -26367,7 +26443,7 @@ var Ak = (t) => {
|
|
|
26367
26443
|
valueMapping;
|
|
26368
26444
|
primaryKey;
|
|
26369
26445
|
importRunner;
|
|
26370
|
-
remoteSource = new
|
|
26446
|
+
remoteSource = new Hk();
|
|
26371
26447
|
navigator = new dO();
|
|
26372
26448
|
hookGate;
|
|
26373
26449
|
lastNavInputs = null;
|
|
@@ -26377,17 +26453,17 @@ var Ak = (t) => {
|
|
|
26377
26453
|
lastNavigation = null;
|
|
26378
26454
|
importAbort = null;
|
|
26379
26455
|
constructor(e) {
|
|
26380
|
-
this.deps = e, this.parser = new
|
|
26456
|
+
this.deps = e, this.parser = new zk(e.createParseClient(), e.synthesizeHeader, e.customFormats, e.onUnstructuredFile), this.columnMapping = new nO({
|
|
26381
26457
|
columns: e.columns,
|
|
26382
26458
|
onColumnMatch: e.onColumnMatch,
|
|
26383
26459
|
extraSynonyms: e.extraSynonyms.columns
|
|
26384
26460
|
}, () => {
|
|
26385
26461
|
this.primaryKey.refreshEligible(this.columnMapping.state.mappedColumnIds), this.refreshValueMatch(), this.commit();
|
|
26386
|
-
}), this.valueMapping = new
|
|
26462
|
+
}), this.valueMapping = new nA({
|
|
26387
26463
|
columns: e.columns,
|
|
26388
26464
|
onValueMatch: e.onValueMatch,
|
|
26389
26465
|
extraSynonyms: e.extraSynonyms.values
|
|
26390
|
-
}, () => this.commit()), this.primaryKey = new
|
|
26466
|
+
}, () => this.commit()), this.primaryKey = new Bk(e.columns, e.defaultPrimaryKey), this.importRunner = new fO(() => this.commit()), this.hookGate = new sO({
|
|
26391
26467
|
"column-matching": !!e.onColumnMatch,
|
|
26392
26468
|
"match-values": !!e.onValueMatch
|
|
26393
26469
|
}), this.commit();
|
|
@@ -26460,7 +26536,7 @@ var Ak = (t) => {
|
|
|
26460
26536
|
this.valueMapping.setDelimiter(e, t), this.commit();
|
|
26461
26537
|
}
|
|
26462
26538
|
reapplyMultiselectDelimiter(e) {
|
|
26463
|
-
let t =
|
|
26539
|
+
let t = Qk(this.parser.state.workbooks, this.columnMapping.state.headersByColumn, this.deps.columns, e);
|
|
26464
26540
|
t && this.valueMapping.setDelimiter(e, t.delimiter), this.commit();
|
|
26465
26541
|
}
|
|
26466
26542
|
addPendingOption(e, t) {
|
|
@@ -26484,7 +26560,7 @@ var Ak = (t) => {
|
|
|
26484
26560
|
let t = await e.fetch();
|
|
26485
26561
|
if (t instanceof File) return this.parseFile(t);
|
|
26486
26562
|
if (Array.isArray(t)) {
|
|
26487
|
-
let n =
|
|
26563
|
+
let n = Mk(t);
|
|
26488
26564
|
if (!n) return this.remoteSource.fail({ kind: "empty" }), null;
|
|
26489
26565
|
this.parser.stageGrid(n, {
|
|
26490
26566
|
kind: "remote",
|
|
@@ -26518,11 +26594,11 @@ var Ak = (t) => {
|
|
|
26518
26594
|
rawRows: this.parser.takeRawRows(e.id)
|
|
26519
26595
|
}));
|
|
26520
26596
|
this.commit();
|
|
26521
|
-
let a = 0, o = [];
|
|
26597
|
+
let a = 0, o = [], s = { rowImportHookDisabled: !1 };
|
|
26522
26598
|
try {
|
|
26523
26599
|
let t = await this.importRunner.run(() => bc(this.deps.store, "importing", Infinity, async () => {
|
|
26524
26600
|
for (; a < i.length; a++) {
|
|
26525
|
-
let { workbook: t, rawRows: r } = i[a],
|
|
26601
|
+
let { workbook: t, rawRows: r } = i[a], c = await FO({
|
|
26526
26602
|
workbook: t,
|
|
26527
26603
|
rawRows: r,
|
|
26528
26604
|
signal: n.signal,
|
|
@@ -26539,10 +26615,13 @@ var Ak = (t) => {
|
|
|
26539
26615
|
primaryKey: this.primaryKey.state.selected,
|
|
26540
26616
|
extraSynonyms: this.deps.extraSynonyms,
|
|
26541
26617
|
addDynamicColumns: this.deps.addDynamicColumns,
|
|
26542
|
-
structuralMismatchMessage: e.structuralMismatchMessage
|
|
26618
|
+
structuralMismatchMessage: e.structuralMismatchMessage,
|
|
26619
|
+
onRowImport: this.deps.onRowImport,
|
|
26620
|
+
hookContext: this.deps.context,
|
|
26621
|
+
hookRunState: s
|
|
26543
26622
|
});
|
|
26544
|
-
if (
|
|
26545
|
-
|
|
26623
|
+
if (c.outcome === "cancelled") return "cancelled";
|
|
26624
|
+
c.collapsed && o.push(zD(t)), this.importRunner.markImported(t.id);
|
|
26546
26625
|
}
|
|
26547
26626
|
return "completed";
|
|
26548
26627
|
}));
|
|
@@ -26622,7 +26701,7 @@ var Ak = (t) => {
|
|
|
26622
26701
|
if (!this.lastNavInputs || this.lastNavInputs.parser !== a.parser || this.lastNavInputs.mapping !== a.mapping || this.lastNavInputs.eligible !== a.eligible || this.lastNavInputs.composite !== a.composite) {
|
|
26623
26702
|
let n = new Set(t), o = this.deps.columns.some((e) => Z(e).options(e) !== null && n.has(e.id)), s = [];
|
|
26624
26703
|
for (let t of e.workbooks) (t.detection.review.kind !== "none" || this.manualHeaderReviewIds.has(t.id)) && s.push(t.id);
|
|
26625
|
-
|
|
26704
|
+
rA(s, this.lastHeaderReviewIds) || (this.lastHeaderReviewIds = s), this.lastStepIds = iO({
|
|
26626
26705
|
headerReviewCount: this.lastHeaderReviewIds.length,
|
|
26627
26706
|
columnMatchingCount: e.workbooks.length,
|
|
26628
26707
|
hasSelectColumns: o,
|
|
@@ -26640,7 +26719,7 @@ var Ak = (t) => {
|
|
|
26640
26719
|
headerReview: uO(this.lastStepIds, o, this.lastHeaderReviewIds),
|
|
26641
26720
|
columnMatching: cO(this.lastStepIds, o, e.workbooks.map((e) => e.id))
|
|
26642
26721
|
}, l = this.lastNavigation;
|
|
26643
|
-
return l && l.stepIds === c.stepIds && l.activeStepIndex === c.activeStepIndex && l.currentStepIndex === c.currentStepIndex && l.isFirstStep === c.isFirstStep && l.isLastStep === c.isLastStep &&
|
|
26722
|
+
return l && l.stepIds === c.stepIds && l.activeStepIndex === c.activeStepIndex && l.currentStepIndex === c.currentStepIndex && l.isFirstStep === c.isFirstStep && l.isLastStep === c.isLastStep && iA(l.headerReview, c.headerReview) && lO(l.columnMatching, c.columnMatching) ? l : (this.lastNavigation = c, c);
|
|
26644
26723
|
}
|
|
26645
26724
|
commit() {
|
|
26646
26725
|
this.snapshots.commit({
|
|
@@ -26653,7 +26732,7 @@ var Ak = (t) => {
|
|
|
26653
26732
|
remoteSource: this.remoteSource.state
|
|
26654
26733
|
});
|
|
26655
26734
|
}
|
|
26656
|
-
},
|
|
26735
|
+
}, oA = (e, t) => {
|
|
26657
26736
|
let n = /* @__PURE__ */ new Map();
|
|
26658
26737
|
for (let e of t) {
|
|
26659
26738
|
let t = e.toLowerCase();
|
|
@@ -26679,7 +26758,7 @@ var Ak = (t) => {
|
|
|
26679
26758
|
createdOptions: r,
|
|
26680
26759
|
updates: i
|
|
26681
26760
|
};
|
|
26682
|
-
},
|
|
26761
|
+
}, sA = (e, t) => {
|
|
26683
26762
|
let n = 0;
|
|
26684
26763
|
for (let r of e.headers) t[r] && n++;
|
|
26685
26764
|
return {
|
|
@@ -26690,12 +26769,12 @@ var Ak = (t) => {
|
|
|
26690
26769
|
matchedCount: n,
|
|
26691
26770
|
allMatched: n === e.headers.length
|
|
26692
26771
|
};
|
|
26693
|
-
},
|
|
26694
|
-
let { columns: e, enableCreateColumn: t } = Q(), { t: n } = q(), r = tE(), i = fE(r, dE), a = fE(r, rE), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = fE(r, iE), d = o ? s[o.id] ??
|
|
26772
|
+
}, cA = {}, lA = {}, uA = [], dA = () => {
|
|
26773
|
+
let { columns: e, enableCreateColumn: t } = Q(), { t: n } = q(), r = tE(), i = fE(r, dE), a = fE(r, rE), o = i ? a.find((e) => e.id === i.workbookId) ?? null : null, { byWorkbook: s, pendingColumns: c, autoMatched: l, isMatching: u } = fE(r, iE), d = o ? s[o.id] ?? cA : cA, f = o?.id ?? null, p = m((e, t) => {
|
|
26695
26774
|
f !== null && r.updateColumnMapping(f, e, t);
|
|
26696
26775
|
}, [r, f]), h = m((e) => {
|
|
26697
26776
|
r.setPendingColumns(e);
|
|
26698
|
-
}, [r]), g = b(() => o ?
|
|
26777
|
+
}, [r]), g = b(() => o ? sA(o, d) : null, [o, d]), _ = (i?.total ?? 0) > 1, v = g?.headers ?? uA, [y, C] = S(null), { value: w, setTrue: E, setFalse: D } = nc(!1), [O, k] = S({}), A = x(null), j = m((e) => O[e] ?? !0, [O]), M = m((e, t) => {
|
|
26699
26778
|
k((n) => ({
|
|
26700
26779
|
...n,
|
|
26701
26780
|
[e]: t
|
|
@@ -26720,7 +26799,7 @@ var Ak = (t) => {
|
|
|
26720
26799
|
D
|
|
26721
26800
|
]), F = m(() => {
|
|
26722
26801
|
A.current = null, D();
|
|
26723
|
-
}, [D]), I = b(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), L = f ? l[f] ??
|
|
26802
|
+
}, [D]), I = b(() => [...e.map((e) => e.title), ...c.map((e) => e.title)], [e, c]), L = f ? l[f] ?? lA : lA, R = b(() => {
|
|
26724
26803
|
let r = {
|
|
26725
26804
|
text: n("dataEditor.uploader.matchColumns.bestMatch"),
|
|
26726
26805
|
color: "green"
|
|
@@ -26781,19 +26860,19 @@ var Ak = (t) => {
|
|
|
26781
26860
|
submitCreate: P,
|
|
26782
26861
|
closeCreate: F
|
|
26783
26862
|
};
|
|
26784
|
-
},
|
|
26785
|
-
function
|
|
26786
|
-
let t =
|
|
26787
|
-
return /* @__PURE__ */ T(
|
|
26863
|
+
}, fA = l(null);
|
|
26864
|
+
function pA({ children: e }) {
|
|
26865
|
+
let t = dA();
|
|
26866
|
+
return /* @__PURE__ */ T(fA.Provider, {
|
|
26788
26867
|
value: t,
|
|
26789
26868
|
children: e
|
|
26790
26869
|
});
|
|
26791
26870
|
}
|
|
26792
|
-
var
|
|
26793
|
-
let e = h(
|
|
26871
|
+
var mA = () => {
|
|
26872
|
+
let e = h(fA);
|
|
26794
26873
|
if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
|
|
26795
26874
|
return e;
|
|
26796
|
-
},
|
|
26875
|
+
}, hA = ({ name: e, fileName: t, size: n = "sm", as: r = "div", className: i }) => /* @__PURE__ */ E(J, {
|
|
26797
26876
|
as: r,
|
|
26798
26877
|
size: n,
|
|
26799
26878
|
weight: "medium",
|
|
@@ -26813,15 +26892,15 @@ var fA = () => {
|
|
|
26813
26892
|
tooltipProps: { placement: "bottom-start" },
|
|
26814
26893
|
children: e
|
|
26815
26894
|
})]
|
|
26816
|
-
}),
|
|
26817
|
-
let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } =
|
|
26895
|
+
}), gA = ({ view: e }) => {
|
|
26896
|
+
let { t } = q(), { isMatching: n, isMultiWorkbook: r, isShowMatched: i, setShowMatched: a } = mA(), o = e.allMatched ? "green" : "yellow", s = !n, c = m((t) => {
|
|
26818
26897
|
a(e.workbookId, t);
|
|
26819
26898
|
}, [a, e.workbookId]);
|
|
26820
26899
|
return /* @__PURE__ */ T("header", {
|
|
26821
26900
|
className: "updog__column-matching__header",
|
|
26822
26901
|
children: /* @__PURE__ */ E("div", {
|
|
26823
26902
|
className: "updog__column-matching__header-inner",
|
|
26824
|
-
children: [r && /* @__PURE__ */ T(
|
|
26903
|
+
children: [r && /* @__PURE__ */ T(hA, {
|
|
26825
26904
|
name: e.name,
|
|
26826
26905
|
fileName: e.fileName,
|
|
26827
26906
|
className: "updog__column-matching__header-source"
|
|
@@ -26865,7 +26944,7 @@ var fA = () => {
|
|
|
26865
26944
|
})]
|
|
26866
26945
|
})
|
|
26867
26946
|
});
|
|
26868
|
-
},
|
|
26947
|
+
}, _A = u(({ csvHeader: e, limit: t, getSampleValues: n }, r) => {
|
|
26869
26948
|
let { t: i } = q(), a = n(e, t);
|
|
26870
26949
|
return /* @__PURE__ */ T("div", {
|
|
26871
26950
|
ref: r,
|
|
@@ -26889,15 +26968,15 @@ var fA = () => {
|
|
|
26889
26968
|
}, e))
|
|
26890
26969
|
})
|
|
26891
26970
|
});
|
|
26892
|
-
}),
|
|
26971
|
+
}), vA = 5, yA = ({ labelId: e, csvHeader: t, getSampleValues: n }) => {
|
|
26893
26972
|
let { t: r } = q(), [i, a] = S(!1), o = x(null), s = b(() => ({ initialFocus: o }), []);
|
|
26894
26973
|
return /* @__PURE__ */ T(Ds, {
|
|
26895
26974
|
open: i,
|
|
26896
26975
|
onOpenChange: a,
|
|
26897
|
-
content: /* @__PURE__ */ T(
|
|
26976
|
+
content: /* @__PURE__ */ T(_A, {
|
|
26898
26977
|
ref: o,
|
|
26899
26978
|
csvHeader: t,
|
|
26900
|
-
limit:
|
|
26979
|
+
limit: vA,
|
|
26901
26980
|
getSampleValues: n
|
|
26902
26981
|
}),
|
|
26903
26982
|
floatingFocusManager: s,
|
|
@@ -26934,7 +27013,7 @@ var fA = () => {
|
|
|
26934
27013
|
})]
|
|
26935
27014
|
})
|
|
26936
27015
|
});
|
|
26937
|
-
},
|
|
27016
|
+
}, bA = f(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, getSampleValues: o, onSelectChange: s, onClear: c }) => {
|
|
26938
27017
|
let { t: l } = q(), u = _(), d = !t, f = t?.startsWith("__dynamic__:") && !!r && !a, p = d && !a, h = m((t) => {
|
|
26939
27018
|
s(e, t);
|
|
26940
27019
|
}, [e, s]), g = m(() => {
|
|
@@ -26945,7 +27024,7 @@ var fA = () => {
|
|
|
26945
27024
|
children: [
|
|
26946
27025
|
/* @__PURE__ */ T("div", {
|
|
26947
27026
|
className: "updog__column-matching__column",
|
|
26948
|
-
children: /* @__PURE__ */ T(
|
|
27027
|
+
children: /* @__PURE__ */ T(yA, {
|
|
26949
27028
|
labelId: u,
|
|
26950
27029
|
csvHeader: e,
|
|
26951
27030
|
getSampleValues: o
|
|
@@ -26998,8 +27077,8 @@ var fA = () => {
|
|
|
26998
27077
|
})
|
|
26999
27078
|
]
|
|
27000
27079
|
});
|
|
27001
|
-
}),
|
|
27002
|
-
let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, getSampleValues: a, onSelectChange: o, onClear: s } =
|
|
27080
|
+
}), xA = ({ view: e }) => {
|
|
27081
|
+
let { isMatching: t, isShowMatched: n, placeholder: r, getRowData: i, getSampleValues: a, onSelectChange: o, onClear: s } = mA(), { t: c } = q(), l = n(e.workbookId), u = e.headers.map((e) => ({
|
|
27003
27082
|
csvHeader: e,
|
|
27004
27083
|
...i(e)
|
|
27005
27084
|
})).filter((e) => l || !e.mappedValue);
|
|
@@ -27017,7 +27096,7 @@ var fA = () => {
|
|
|
27017
27096
|
className: "updog__column-matching__content",
|
|
27018
27097
|
children: /* @__PURE__ */ T("div", {
|
|
27019
27098
|
className: "updog__column-matching__content-inner",
|
|
27020
|
-
children: u.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: c }) => /* @__PURE__ */ T(
|
|
27099
|
+
children: u.map(({ csvHeader: e, mappedValue: n, options: i, autoMatchId: c }) => /* @__PURE__ */ T(bA, {
|
|
27021
27100
|
csvHeader: e,
|
|
27022
27101
|
mappedValue: n,
|
|
27023
27102
|
options: i,
|
|
@@ -27030,8 +27109,8 @@ var fA = () => {
|
|
|
27030
27109
|
}, e))
|
|
27031
27110
|
})
|
|
27032
27111
|
});
|
|
27033
|
-
},
|
|
27034
|
-
let { createModalValues: e, createModalOpen: t, existingNames: n, submitCreate: r, closeCreate: i } =
|
|
27112
|
+
}, SA = () => {
|
|
27113
|
+
let { createModalValues: e, createModalOpen: t, existingNames: n, submitCreate: r, closeCreate: i } = mA();
|
|
27035
27114
|
return /* @__PURE__ */ T(zg, {
|
|
27036
27115
|
open: t,
|
|
27037
27116
|
onClose: i,
|
|
@@ -27039,23 +27118,23 @@ var fA = () => {
|
|
|
27039
27118
|
existingNames: n,
|
|
27040
27119
|
onSubmit: r
|
|
27041
27120
|
});
|
|
27042
|
-
},
|
|
27043
|
-
let { view: e } =
|
|
27121
|
+
}, CA = () => {
|
|
27122
|
+
let { view: e } = mA();
|
|
27044
27123
|
return e ? /* @__PURE__ */ E("div", {
|
|
27045
27124
|
className: "updog__column-matching",
|
|
27046
27125
|
children: [
|
|
27047
|
-
/* @__PURE__ */ T(
|
|
27048
|
-
/* @__PURE__ */ T(
|
|
27049
|
-
/* @__PURE__ */ T(
|
|
27126
|
+
/* @__PURE__ */ T(gA, { view: e }),
|
|
27127
|
+
/* @__PURE__ */ T(xA, { view: e }),
|
|
27128
|
+
/* @__PURE__ */ T(SA, {})
|
|
27050
27129
|
]
|
|
27051
27130
|
}) : null;
|
|
27052
|
-
},
|
|
27131
|
+
}, wA = () => fE(tE(), uE) ? /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ E(Ih, { children: [/* @__PURE__ */ T("div", {
|
|
27053
27132
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
27054
|
-
children: /* @__PURE__ */ T(
|
|
27133
|
+
children: /* @__PURE__ */ T(pA, { children: /* @__PURE__ */ T(CA, {}) })
|
|
27055
27134
|
}), /* @__PURE__ */ T(_E, { leftSlot: /* @__PURE__ */ T(vE, {}) })] }) }) : null;
|
|
27056
27135
|
//#endregion
|
|
27057
27136
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
|
|
27058
|
-
function
|
|
27137
|
+
function TA(e, t, n, r, i) {
|
|
27059
27138
|
return b(() => ({
|
|
27060
27139
|
sample: e,
|
|
27061
27140
|
columnHeaders: t,
|
|
@@ -27072,20 +27151,20 @@ function CA(e, t, n, r, i) {
|
|
|
27072
27151
|
}
|
|
27073
27152
|
//#endregion
|
|
27074
27153
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
|
|
27075
|
-
var
|
|
27076
|
-
function
|
|
27077
|
-
let o =
|
|
27078
|
-
return /* @__PURE__ */ T(
|
|
27154
|
+
var EA = l(null);
|
|
27155
|
+
function DA({ sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i, children: a }) {
|
|
27156
|
+
let o = TA(e, t, n, r, i);
|
|
27157
|
+
return /* @__PURE__ */ T(EA.Provider, {
|
|
27079
27158
|
value: o,
|
|
27080
27159
|
children: a
|
|
27081
27160
|
});
|
|
27082
27161
|
}
|
|
27083
|
-
var
|
|
27084
|
-
let e = h(
|
|
27162
|
+
var OA = () => {
|
|
27163
|
+
let e = h(EA);
|
|
27085
27164
|
if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
|
|
27086
27165
|
return e;
|
|
27087
|
-
},
|
|
27088
|
-
let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } =
|
|
27166
|
+
}, kA = () => {
|
|
27167
|
+
let { sample: e, columnHeaders: t, selectedRow: n, selectRow: r, noHeader: i } = OA(), { headers: a, rows: o } = b(() => {
|
|
27089
27168
|
let n = t.length;
|
|
27090
27169
|
return {
|
|
27091
27170
|
headers: t.map((e) => i ? e : ""),
|
|
@@ -27105,7 +27184,7 @@ var EA = () => {
|
|
|
27105
27184
|
selectedRow: i ? void 0 : n,
|
|
27106
27185
|
onSelectRow: i ? void 0 : r
|
|
27107
27186
|
});
|
|
27108
|
-
},
|
|
27187
|
+
}, AA = () => {
|
|
27109
27188
|
let { t: e } = q(), t = tE(), { headerReview: n } = fE(t, sE), r = fE(t, rE), i = n ? r.find((e) => e.id === n.workbookId) ?? null : null, a = m((e) => {
|
|
27110
27189
|
i && t.setHeaderRowIndex(i.id, e);
|
|
27111
27190
|
}, [t, i]), o = m((e) => {
|
|
@@ -27113,7 +27192,7 @@ var EA = () => {
|
|
|
27113
27192
|
}, [a, i]);
|
|
27114
27193
|
if (!i) return null;
|
|
27115
27194
|
let s = i.rawRows.slice(0, 50), c = i.headerRowIndex < 0, l = c ? void 0 : i.headerRowIndex, u = i.origin.kind === "sheet" ? i.origin.file.name : null;
|
|
27116
|
-
return /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ T(Ih, { children: /* @__PURE__ */ E(
|
|
27195
|
+
return /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ T(Ih, { children: /* @__PURE__ */ E(DA, {
|
|
27117
27196
|
sample: s,
|
|
27118
27197
|
columnHeaders: i.headers,
|
|
27119
27198
|
selectedRow: l,
|
|
@@ -27122,7 +27201,7 @@ var EA = () => {
|
|
|
27122
27201
|
children: [/* @__PURE__ */ E("div", {
|
|
27123
27202
|
className: "updog__step-header-selection__content updog__scrollbar",
|
|
27124
27203
|
children: [
|
|
27125
|
-
/* @__PURE__ */ T(
|
|
27204
|
+
/* @__PURE__ */ T(hA, {
|
|
27126
27205
|
as: "h3",
|
|
27127
27206
|
size: "md",
|
|
27128
27207
|
name: i.name,
|
|
@@ -27137,11 +27216,11 @@ var EA = () => {
|
|
|
27137
27216
|
label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
|
|
27138
27217
|
})
|
|
27139
27218
|
}),
|
|
27140
|
-
/* @__PURE__ */ T(
|
|
27219
|
+
/* @__PURE__ */ T(kA, {})
|
|
27141
27220
|
]
|
|
27142
27221
|
}), /* @__PURE__ */ T(_E, {})]
|
|
27143
27222
|
}) }) });
|
|
27144
|
-
},
|
|
27223
|
+
}, jA = "updog__value-matching__create-divider", MA = ({ options: e, extraOptions: t, enableCustomValue: n, createLabel: r, label: i, tags: a }) => {
|
|
27145
27224
|
let o = new Map(a?.map(({ id: e, tag: t }) => [e, t])), s = e.map((e) => {
|
|
27146
27225
|
let t = o.get(e);
|
|
27147
27226
|
return {
|
|
@@ -27157,14 +27236,14 @@ var EA = () => {
|
|
|
27157
27236
|
text: e
|
|
27158
27237
|
}));
|
|
27159
27238
|
return s.push({
|
|
27160
|
-
id:
|
|
27239
|
+
id: jA,
|
|
27161
27240
|
type: "divider"
|
|
27162
27241
|
}, {
|
|
27163
27242
|
id: sc,
|
|
27164
27243
|
text: r,
|
|
27165
27244
|
icon: /* @__PURE__ */ T(Te, { size: "1rem" })
|
|
27166
27245
|
}), s;
|
|
27167
|
-
},
|
|
27246
|
+
}, NA = (e, t) => {
|
|
27168
27247
|
let n = e.values.filter((e) => t || e.mapped === void 0);
|
|
27169
27248
|
return e.values.length > 500 && n.length > 3 ? {
|
|
27170
27249
|
visible: n.slice(0, 3),
|
|
@@ -27173,13 +27252,13 @@ var EA = () => {
|
|
|
27173
27252
|
visible: n,
|
|
27174
27253
|
overflow: 0
|
|
27175
27254
|
};
|
|
27176
|
-
},
|
|
27255
|
+
}, PA = (e, t) => e === void 0 ? [] : [{
|
|
27177
27256
|
id: e,
|
|
27178
27257
|
tag: t
|
|
27179
|
-
}],
|
|
27258
|
+
}], FA = (e, t) => e?.kind === "ambiguous" ? e.candidates.map((e) => ({
|
|
27180
27259
|
id: e,
|
|
27181
27260
|
tag: t
|
|
27182
|
-
})) : [],
|
|
27261
|
+
})) : [], IA = () => {
|
|
27183
27262
|
let { columns: e } = Q(), { t, locale: n } = q(), r = tE(), i = fE(r, uE), { mappedColumnIds: a } = fE(r, iE), { merged: o, computed: s, multiselectDelimiters: c, pendingOptions: l, importedValues: u, verdicts: d, isMatching: f } = fE(r, aE), p = m((e, t, n) => r.updateValueMapping(e, t, n), [r]), h = m((e, t) => r.setMultiselectDelimiter(e, t), [r]), _ = m((e) => r.reapplyMultiselectDelimiter(e), [r]), v = m((e, t) => r.addPendingOption(e, t), [r]), [y, C] = S({}), [w, T] = S({}), [E, D] = S(null), O = x(!1), k = b(() => {
|
|
27184
27263
|
if (!i) return [];
|
|
27185
27264
|
let r = [];
|
|
@@ -27245,14 +27324,14 @@ var EA = () => {
|
|
|
27245
27324
|
color: "neutral"
|
|
27246
27325
|
}, r = t("dataEditor.uploader.matchValues.createOption"), i = {};
|
|
27247
27326
|
for (let t of k) {
|
|
27248
|
-
let a = l[t.columnId] ?? [], o = {}, { visible: c } =
|
|
27249
|
-
for (let i of c) o[i.imported] =
|
|
27327
|
+
let a = l[t.columnId] ?? [], o = {}, { visible: c } = NA(t, y[t.columnId] ?? !0), u = d[t.columnId];
|
|
27328
|
+
for (let i of c) o[i.imported] = MA({
|
|
27250
27329
|
options: t.options,
|
|
27251
27330
|
extraOptions: a,
|
|
27252
27331
|
enableCustomValue: t.enableCustomValue,
|
|
27253
27332
|
createLabel: r,
|
|
27254
27333
|
label: t.label,
|
|
27255
|
-
tags: u ?
|
|
27334
|
+
tags: u ? FA(u[i.imported], n) : PA(s[t.columnId]?.[i.imported], e)
|
|
27256
27335
|
});
|
|
27257
27336
|
i[t.columnId] = o;
|
|
27258
27337
|
}
|
|
@@ -27264,7 +27343,7 @@ var EA = () => {
|
|
|
27264
27343
|
l,
|
|
27265
27344
|
y,
|
|
27266
27345
|
t
|
|
27267
|
-
]), j = m((e) => y[e] ?? !0, [y]), M = m((e) => w[e] ?? !1, [w]), N = m((e) =>
|
|
27346
|
+
]), j = m((e) => y[e] ?? !0, [y]), M = m((e) => w[e] ?? !1, [w]), N = m((e) => NA(e, y[e.columnId] ?? !0), [y]), P = m((e, t) => A[e]?.[t] ?? [], [A]), F = m((e, t) => {
|
|
27268
27347
|
C((n) => ({
|
|
27269
27348
|
...n,
|
|
27270
27349
|
[e]: t
|
|
@@ -27316,20 +27395,20 @@ var EA = () => {
|
|
|
27316
27395
|
submitCreate: V,
|
|
27317
27396
|
closeCreate: ee
|
|
27318
27397
|
};
|
|
27319
|
-
},
|
|
27320
|
-
function
|
|
27321
|
-
let t =
|
|
27322
|
-
return /* @__PURE__ */ T(
|
|
27398
|
+
}, LA = l(null);
|
|
27399
|
+
function RA({ children: e }) {
|
|
27400
|
+
let t = IA();
|
|
27401
|
+
return /* @__PURE__ */ T(LA.Provider, {
|
|
27323
27402
|
value: t,
|
|
27324
27403
|
children: e
|
|
27325
27404
|
});
|
|
27326
27405
|
}
|
|
27327
|
-
var
|
|
27328
|
-
let e = h(
|
|
27406
|
+
var zA = () => {
|
|
27407
|
+
let e = h(LA);
|
|
27329
27408
|
if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
|
|
27330
27409
|
return e;
|
|
27331
|
-
},
|
|
27332
|
-
let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } =
|
|
27410
|
+
}, BA = ({ section: e, panelId: t }) => {
|
|
27411
|
+
let { t: n } = q(), { isShowMatched: r, isCollapsed: i, setShowMatched: a, toggleCollapsed: o, isMatching: s } = zA(), c = i(e.columnId), l = !s, u = n(c ? "dataEditor.common.expand" : "dataEditor.common.collapse"), d = m((t) => a(e.columnId, t), [a, e.columnId]), f = m(() => o(e.columnId), [o, e.columnId]);
|
|
27333
27412
|
return /* @__PURE__ */ E("header", {
|
|
27334
27413
|
className: "updog__value-matching__section-header",
|
|
27335
27414
|
children: [/* @__PURE__ */ T("div", {
|
|
@@ -27376,14 +27455,14 @@ var LA = () => {
|
|
|
27376
27455
|
})
|
|
27377
27456
|
})]
|
|
27378
27457
|
});
|
|
27379
|
-
},
|
|
27458
|
+
}, VA = {
|
|
27380
27459
|
",": ",",
|
|
27381
27460
|
";": ";",
|
|
27382
27461
|
"|": "|",
|
|
27383
27462
|
"\n": "\\n",
|
|
27384
27463
|
" ": "\\t"
|
|
27385
|
-
},
|
|
27386
|
-
let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } =
|
|
27464
|
+
}, HA = (e) => e === null ? "" : VA[e] ?? e, UA = ({ section: e }) => {
|
|
27465
|
+
let { t } = q(), { changeDelimiter: n, reapplyDelimiter: r } = zA(), i = x(e.delimiter), a = HA(e.delimiter), [o, s] = S(a), { debouncedValue: c } = La(o, 300), l = x(a);
|
|
27387
27466
|
g(() => {
|
|
27388
27467
|
s(a), l.current = a;
|
|
27389
27468
|
}, [a]), g(() => {
|
|
@@ -27426,7 +27505,7 @@ var LA = () => {
|
|
|
27426
27505
|
})
|
|
27427
27506
|
]
|
|
27428
27507
|
});
|
|
27429
|
-
},
|
|
27508
|
+
}, WA = f(({ value: e, options: t, isMatching: n = !1, fluid: r = !1, onSelect: i }) => {
|
|
27430
27509
|
let { t: a } = q(), o = _(), s = e.mapped === void 0, c = s && !n, l = m((t) => {
|
|
27431
27510
|
i(e.imported, t);
|
|
27432
27511
|
}, [i, e.imported]), u = m(() => {
|
|
@@ -27488,28 +27567,28 @@ var LA = () => {
|
|
|
27488
27567
|
})
|
|
27489
27568
|
]
|
|
27490
27569
|
});
|
|
27491
|
-
}),
|
|
27492
|
-
let { getSelectOptions: n, selectValue: r, isMatching: i } =
|
|
27570
|
+
}), GA = ({ section: e, value: t }) => {
|
|
27571
|
+
let { getSelectOptions: n, selectValue: r, isMatching: i } = zA(), a = m((t, n) => {
|
|
27493
27572
|
r(e.columnId, t, n);
|
|
27494
27573
|
}, [r, e.columnId]);
|
|
27495
|
-
return /* @__PURE__ */ T(
|
|
27574
|
+
return /* @__PURE__ */ T(WA, {
|
|
27496
27575
|
value: t,
|
|
27497
27576
|
options: n(e.columnId, t.imported),
|
|
27498
27577
|
isMatching: i,
|
|
27499
27578
|
onSelect: a
|
|
27500
27579
|
});
|
|
27501
|
-
},
|
|
27580
|
+
}, KA = (e, t) => {
|
|
27502
27581
|
let n = new Map(e.map((e) => [e.imported, e.mapped])), r = [];
|
|
27503
27582
|
for (let e of t) n.get(e.imported) !== e.mapped && r.push({
|
|
27504
27583
|
importedValue: e.imported,
|
|
27505
27584
|
mappedValue: e.mapped
|
|
27506
27585
|
});
|
|
27507
27586
|
return r;
|
|
27508
|
-
},
|
|
27587
|
+
}, qA = ({ scrollTop: e, viewportHeight: t, rowHeight: n, count: r, overscan: i }) => ({
|
|
27509
27588
|
start: Math.max(0, Math.floor(e / n) - i),
|
|
27510
27589
|
end: Math.min(r, Math.ceil((e + t) / n) + i)
|
|
27511
|
-
}),
|
|
27512
|
-
let r = x(null), [i, a] = S(
|
|
27590
|
+
}), JA = 3.625, YA = 5, XA = 16, ZA = ({ values: e, options: t, onSelect: n }) => {
|
|
27591
|
+
let r = x(null), [i, a] = S(XA), [o, s] = S({
|
|
27513
27592
|
start: 0,
|
|
27514
27593
|
end: 0
|
|
27515
27594
|
});
|
|
@@ -27520,12 +27599,12 @@ var LA = () => {
|
|
|
27520
27599
|
let c = m(() => {
|
|
27521
27600
|
let t = r.current;
|
|
27522
27601
|
if (!t) return;
|
|
27523
|
-
let n =
|
|
27602
|
+
let n = qA({
|
|
27524
27603
|
scrollTop: t.scrollTop,
|
|
27525
27604
|
viewportHeight: t.clientHeight,
|
|
27526
|
-
rowHeight:
|
|
27605
|
+
rowHeight: JA * i,
|
|
27527
27606
|
count: e.length,
|
|
27528
|
-
overscan:
|
|
27607
|
+
overscan: YA
|
|
27529
27608
|
});
|
|
27530
27609
|
s((e) => e.start === n.start && e.end === n.end ? e : n);
|
|
27531
27610
|
}, [i, e.length]);
|
|
@@ -27545,14 +27624,14 @@ var LA = () => {
|
|
|
27545
27624
|
className: "updog__values-drawer__list updog__scrollbar",
|
|
27546
27625
|
children: /* @__PURE__ */ T("div", {
|
|
27547
27626
|
className: "updog__values-drawer__list-inner",
|
|
27548
|
-
style: { height: `${e.length *
|
|
27627
|
+
style: { height: `${e.length * JA}rem` },
|
|
27549
27628
|
children: l.map((e, r) => /* @__PURE__ */ T("div", {
|
|
27550
27629
|
className: "updog__values-drawer__list-item",
|
|
27551
27630
|
style: {
|
|
27552
|
-
height: `${
|
|
27553
|
-
transform: `translateY(${(o.start + r) *
|
|
27631
|
+
height: `${JA}rem`,
|
|
27632
|
+
transform: `translateY(${(o.start + r) * JA}rem)`
|
|
27554
27633
|
},
|
|
27555
|
-
children: /* @__PURE__ */ T(
|
|
27634
|
+
children: /* @__PURE__ */ T(WA, {
|
|
27556
27635
|
value: e,
|
|
27557
27636
|
options: t,
|
|
27558
27637
|
fluid: !0,
|
|
@@ -27561,7 +27640,7 @@ var LA = () => {
|
|
|
27561
27640
|
}, e.imported))
|
|
27562
27641
|
})
|
|
27563
27642
|
});
|
|
27564
|
-
},
|
|
27643
|
+
}, QA = ({ section: e, onCancel: t, onSave: n }) => {
|
|
27565
27644
|
let { t: r } = q(), [i] = S(e.values), [a, o] = S(i), [s] = S(e.delimiter), [c, l] = S([]), [u, d] = S(null), f = b(() => [
|
|
27566
27645
|
...e.options,
|
|
27567
27646
|
...e.pendingOptions,
|
|
@@ -27570,7 +27649,7 @@ var LA = () => {
|
|
|
27570
27649
|
e.options,
|
|
27571
27650
|
e.pendingOptions,
|
|
27572
27651
|
c
|
|
27573
|
-
]), p = b(() =>
|
|
27652
|
+
]), p = b(() => MA({
|
|
27574
27653
|
options: e.options,
|
|
27575
27654
|
extraOptions: [...e.pendingOptions, ...c],
|
|
27576
27655
|
enableCustomValue: e.enableCustomValue,
|
|
@@ -27599,7 +27678,7 @@ var LA = () => {
|
|
|
27599
27678
|
}, []), v = m((e) => {
|
|
27600
27679
|
u !== null && (l((t) => [...t, e]), h(u, e), d(null));
|
|
27601
27680
|
}, [u, h]), y = m(() => {
|
|
27602
|
-
let e =
|
|
27681
|
+
let e = oA(a, f);
|
|
27603
27682
|
if (e.updates.length === 0) return;
|
|
27604
27683
|
let t = new Map(e.updates.map((e) => [e.importedValue, e.mappedValue]));
|
|
27605
27684
|
l((t) => [...t, ...e.createdOptions]), o((e) => e.map((e) => {
|
|
@@ -27611,7 +27690,7 @@ var LA = () => {
|
|
|
27611
27690
|
}));
|
|
27612
27691
|
}, [a, f]), x = m(() => {
|
|
27613
27692
|
n({
|
|
27614
|
-
updates:
|
|
27693
|
+
updates: KA(i, a),
|
|
27615
27694
|
delimiter: s,
|
|
27616
27695
|
createdOptions: c
|
|
27617
27696
|
});
|
|
@@ -27635,7 +27714,7 @@ var LA = () => {
|
|
|
27635
27714
|
}) }),
|
|
27636
27715
|
/* @__PURE__ */ T(ss, {
|
|
27637
27716
|
className: "updog__values-drawer__body",
|
|
27638
|
-
children: /* @__PURE__ */ T(
|
|
27717
|
+
children: /* @__PURE__ */ T(ZA, {
|
|
27639
27718
|
values: a,
|
|
27640
27719
|
options: p,
|
|
27641
27720
|
onSelect: g
|
|
@@ -27668,8 +27747,8 @@ var LA = () => {
|
|
|
27668
27747
|
onSubmit: v
|
|
27669
27748
|
})
|
|
27670
27749
|
] });
|
|
27671
|
-
},
|
|
27672
|
-
let { applyValueMappingBatch: r } =
|
|
27750
|
+
}, $A = ({ open: e, onDismiss: t, section: n }) => {
|
|
27751
|
+
let { applyValueMappingBatch: r } = zA(), i = m((e) => {
|
|
27673
27752
|
e || t();
|
|
27674
27753
|
}, [t]), a = m((e) => {
|
|
27675
27754
|
r(n.columnId, e.updates, e.createdOptions), t();
|
|
@@ -27683,14 +27762,14 @@ var LA = () => {
|
|
|
27683
27762
|
onOpenChange: i,
|
|
27684
27763
|
className: "updog__values-drawer",
|
|
27685
27764
|
closeOnOutsidePress: !1,
|
|
27686
|
-
children: /* @__PURE__ */ T(
|
|
27765
|
+
children: /* @__PURE__ */ T(QA, {
|
|
27687
27766
|
section: n,
|
|
27688
27767
|
onCancel: t,
|
|
27689
27768
|
onSave: a
|
|
27690
27769
|
})
|
|
27691
27770
|
});
|
|
27692
|
-
},
|
|
27693
|
-
let { t } = q(), { getVisibleValues: n } =
|
|
27771
|
+
}, ej = ({ section: e }) => {
|
|
27772
|
+
let { t } = q(), { getVisibleValues: n } = zA(), { visible: r, overflow: i } = n(e), a = r.length === 0, { value: o, setTrue: s, setFalse: c } = nc(!1);
|
|
27694
27773
|
return /* @__PURE__ */ E("div", {
|
|
27695
27774
|
className: "updog__value-matching__table",
|
|
27696
27775
|
children: [
|
|
@@ -27711,7 +27790,7 @@ var LA = () => {
|
|
|
27711
27790
|
size: "sm",
|
|
27712
27791
|
weight: "medium",
|
|
27713
27792
|
children: t("dataEditor.uploader.matchValues.importedValues")
|
|
27714
|
-
}), e.isMultiselect && /* @__PURE__ */ T(
|
|
27793
|
+
}), e.isMultiselect && /* @__PURE__ */ T(UA, { section: e })]
|
|
27715
27794
|
}),
|
|
27716
27795
|
/* @__PURE__ */ T("div", { className: "updog__value-matching__arrow-spacer" }),
|
|
27717
27796
|
/* @__PURE__ */ T(J, {
|
|
@@ -27724,7 +27803,7 @@ var LA = () => {
|
|
|
27724
27803
|
/* @__PURE__ */ T("div", { className: "updog__value-matching__action" })
|
|
27725
27804
|
]
|
|
27726
27805
|
}),
|
|
27727
|
-
r.map((t) => /* @__PURE__ */ T(
|
|
27806
|
+
r.map((t) => /* @__PURE__ */ T(GA, {
|
|
27728
27807
|
section: e,
|
|
27729
27808
|
value: t
|
|
27730
27809
|
}, t.imported)),
|
|
@@ -27745,7 +27824,7 @@ var LA = () => {
|
|
|
27745
27824
|
onClick: s,
|
|
27746
27825
|
children: t("dataEditor.uploader.matchValues.showAll")
|
|
27747
27826
|
}),
|
|
27748
|
-
/* @__PURE__ */ T(
|
|
27827
|
+
/* @__PURE__ */ T($A, {
|
|
27749
27828
|
open: o,
|
|
27750
27829
|
onDismiss: c,
|
|
27751
27830
|
section: e
|
|
@@ -27754,25 +27833,25 @@ var LA = () => {
|
|
|
27754
27833
|
})
|
|
27755
27834
|
]
|
|
27756
27835
|
});
|
|
27757
|
-
},
|
|
27758
|
-
let { isCollapsed: t } =
|
|
27836
|
+
}, tj = ({ section: e }) => {
|
|
27837
|
+
let { isCollapsed: t } = zA(), n = !t(e.columnId), r = _();
|
|
27759
27838
|
return /* @__PURE__ */ E("div", {
|
|
27760
27839
|
className: "updog__value-matching__section",
|
|
27761
|
-
children: [/* @__PURE__ */ T(
|
|
27840
|
+
children: [/* @__PURE__ */ T(BA, {
|
|
27762
27841
|
section: e,
|
|
27763
27842
|
panelId: r
|
|
27764
27843
|
}), /* @__PURE__ */ T("div", {
|
|
27765
27844
|
id: r,
|
|
27766
27845
|
inert: !n,
|
|
27767
27846
|
className: O("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
|
|
27768
|
-
children: /* @__PURE__ */ T(
|
|
27847
|
+
children: /* @__PURE__ */ T(ej, { section: e })
|
|
27769
27848
|
})]
|
|
27770
27849
|
});
|
|
27771
|
-
},
|
|
27772
|
-
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } =
|
|
27850
|
+
}, nj = () => {
|
|
27851
|
+
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = zA();
|
|
27773
27852
|
return /* @__PURE__ */ E("div", {
|
|
27774
27853
|
className: "updog__value-matching",
|
|
27775
|
-
children: [e.map((e) => /* @__PURE__ */ T(
|
|
27854
|
+
children: [e.map((e) => /* @__PURE__ */ T(tj, { section: e }, e.columnId)), /* @__PURE__ */ T(Lg, {
|
|
27776
27855
|
open: t,
|
|
27777
27856
|
existingOptions: n,
|
|
27778
27857
|
initialName: r,
|
|
@@ -27780,13 +27859,13 @@ var LA = () => {
|
|
|
27780
27859
|
onSubmit: i
|
|
27781
27860
|
})]
|
|
27782
27861
|
});
|
|
27783
|
-
},
|
|
27862
|
+
}, rj = () => /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ E(Ih, { children: [/* @__PURE__ */ T("div", {
|
|
27784
27863
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
27785
|
-
children: /* @__PURE__ */ T(
|
|
27786
|
-
}), /* @__PURE__ */ T(_E, {})] }) }),
|
|
27864
|
+
children: /* @__PURE__ */ T(RA, { children: /* @__PURE__ */ T(nj, {}) })
|
|
27865
|
+
}), /* @__PURE__ */ T(_E, {})] }) }), ij = 20, aj = (e, t) => {
|
|
27787
27866
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
27788
27867
|
let t = n.get(e.id);
|
|
27789
|
-
return t || (t = ID(e.rawRows, e.headers, e.dataStartIndex,
|
|
27868
|
+
return t || (t = ID(e.rawRows, e.headers, e.dataStartIndex, ij), n.set(e.id, t)), t;
|
|
27790
27869
|
}, i = {};
|
|
27791
27870
|
for (let [n, a] of Object.entries(t)) for (let t of a) {
|
|
27792
27871
|
let a = e.find((e) => e.id === t.workbookId);
|
|
@@ -27798,7 +27877,7 @@ var LA = () => {
|
|
|
27798
27877
|
}
|
|
27799
27878
|
}
|
|
27800
27879
|
return i;
|
|
27801
|
-
},
|
|
27880
|
+
}, oj = (e, t, n) => {
|
|
27802
27881
|
let r = e.find((e) => n.every((n) => (t[n] ?? []).some((t) => t.workbookId === e.id)));
|
|
27803
27882
|
if (!r) return [];
|
|
27804
27883
|
let i = [];
|
|
@@ -27807,13 +27886,13 @@ var LA = () => {
|
|
|
27807
27886
|
if (!n) return [];
|
|
27808
27887
|
i.push(n.header);
|
|
27809
27888
|
}
|
|
27810
|
-
let a = ID(r.rawRows, r.headers, r.dataStartIndex,
|
|
27889
|
+
let a = ID(r.rawRows, r.headers, r.dataStartIndex, ij), o = [];
|
|
27811
27890
|
for (let e of a) {
|
|
27812
27891
|
let t = i.map((t) => (e[t] ?? "").trim());
|
|
27813
27892
|
t.some((e) => e === "") || o.push(mc(t));
|
|
27814
27893
|
}
|
|
27815
27894
|
return o;
|
|
27816
|
-
},
|
|
27895
|
+
}, sj = ({ name: e, value: t, title: n, checked: r, onChange: i, autoFocus: a, className: o, children: s }) => {
|
|
27817
27896
|
let c = _(), l = _(), u = m((e) => {
|
|
27818
27897
|
e.target.checked && i(t);
|
|
27819
27898
|
}, [i, t]);
|
|
@@ -27852,15 +27931,15 @@ var LA = () => {
|
|
|
27852
27931
|
children: s
|
|
27853
27932
|
})]
|
|
27854
27933
|
});
|
|
27855
|
-
},
|
|
27856
|
-
let { columns: e } = Q(), { t } = q(), n = tE(), r = fE(n, rE), { headersByColumn: i } = fE(n, iE), { selected: a, eligibleColumns: o, composite: s } = fE(n, oE), c = b(() =>
|
|
27934
|
+
}, cj = () => {
|
|
27935
|
+
let { columns: e } = Q(), { t } = q(), n = tE(), r = fE(n, rE), { headersByColumn: i } = fE(n, iE), { selected: a, eligibleColumns: o, composite: s } = fE(n, oE), c = b(() => aj(r, i), [r, i]), l = b(() => {
|
|
27857
27936
|
let t = [];
|
|
27858
27937
|
if (s) {
|
|
27859
27938
|
let n = s.map((t) => e.find((e) => e.id === t)?.title ?? t);
|
|
27860
27939
|
t.push({
|
|
27861
27940
|
value: mc(s),
|
|
27862
27941
|
title: mc(n),
|
|
27863
|
-
values:
|
|
27942
|
+
values: oj(r, i, s)
|
|
27864
27943
|
});
|
|
27865
27944
|
}
|
|
27866
27945
|
for (let e of o) t.push({
|
|
@@ -27885,7 +27964,7 @@ var LA = () => {
|
|
|
27885
27964
|
}, [l, d]);
|
|
27886
27965
|
return /* @__PURE__ */ E("div", {
|
|
27887
27966
|
className: "updog__primary-key-selection updog__scrollbar",
|
|
27888
|
-
children: [/* @__PURE__ */ T(
|
|
27967
|
+
children: [/* @__PURE__ */ T(sj, {
|
|
27889
27968
|
name: "primaryKey",
|
|
27890
27969
|
value: "",
|
|
27891
27970
|
title: t("dataEditor.uploader.addOrUpdate.addEvery"),
|
|
@@ -27898,7 +27977,7 @@ var LA = () => {
|
|
|
27898
27977
|
className: "updog__primary-key-selection__hint",
|
|
27899
27978
|
children: t("dataEditor.uploader.addOrUpdate.addEveryHint")
|
|
27900
27979
|
})
|
|
27901
|
-
}), l.map((e) => /* @__PURE__ */ T(
|
|
27980
|
+
}), l.map((e) => /* @__PURE__ */ T(sj, {
|
|
27902
27981
|
name: "primaryKey",
|
|
27903
27982
|
value: e.value,
|
|
27904
27983
|
title: t("dataEditor.uploader.addOrUpdate.updateBy", { column: e.title }),
|
|
@@ -27916,10 +27995,10 @@ var LA = () => {
|
|
|
27916
27995
|
}, t))
|
|
27917
27996
|
}, e.value))]
|
|
27918
27997
|
});
|
|
27919
|
-
},
|
|
27998
|
+
}, lj = () => /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ E(Ih, { children: [/* @__PURE__ */ T(cj, {}), /* @__PURE__ */ T(_E, {})] }) });
|
|
27920
27999
|
//#endregion
|
|
27921
28000
|
//#region src/components/DataUploader/hooks/useRemoteSource.ts
|
|
27922
|
-
function
|
|
28001
|
+
function uj(e) {
|
|
27923
28002
|
let { t } = q(), { loadingId: n, error: r } = fE(e, lE), i = mE(), a = m((t) => {
|
|
27924
28003
|
e.loadRemoteSource(t).then(i);
|
|
27925
28004
|
}, [e, i]);
|
|
@@ -27931,8 +28010,8 @@ function cj(e) {
|
|
|
27931
28010
|
}
|
|
27932
28011
|
//#endregion
|
|
27933
28012
|
//#region src/components/DataUploader/components/StepSelectFiles/context/useViewModel.tsx
|
|
27934
|
-
var
|
|
27935
|
-
let { columns: e, importFormats: t, remoteSources: n, customFormats: r, sampleData: i } = Q(), a = t === !1 ? [] : t, { t: o } = q(), s = tE(), { stagedItems: c } = fE(s, nE), { remoteSourceLoading: l, remoteSourceError: u, handleRemoteSourceSelect: d } =
|
|
28013
|
+
var dj = () => {
|
|
28014
|
+
let { columns: e, importFormats: t, remoteSources: n, customFormats: r, sampleData: i } = Q(), a = t === !1 ? [] : t, { t: o } = q(), s = tE(), { stagedItems: c } = fE(s, nE), { remoteSourceLoading: l, remoteSourceError: u, handleRemoteSourceSelect: d } = uj(s), f = hE(s), p = m((e) => {
|
|
27936
28015
|
s.toggleStagedItem(e);
|
|
27937
28016
|
}, [s]), h = m((e) => {
|
|
27938
28017
|
s.cancelStagedItem(e);
|
|
@@ -27993,19 +28072,19 @@ var lj = () => {
|
|
|
27993
28072
|
onExampleDownload: v,
|
|
27994
28073
|
handleRemoteSourceSelect: d
|
|
27995
28074
|
};
|
|
27996
|
-
},
|
|
27997
|
-
function
|
|
27998
|
-
let t =
|
|
27999
|
-
return /* @__PURE__ */ T(
|
|
28075
|
+
}, fj = l(null);
|
|
28076
|
+
function pj({ children: e }) {
|
|
28077
|
+
let t = dj();
|
|
28078
|
+
return /* @__PURE__ */ T(fj.Provider, {
|
|
28000
28079
|
value: t,
|
|
28001
28080
|
children: e
|
|
28002
28081
|
});
|
|
28003
28082
|
}
|
|
28004
|
-
var
|
|
28005
|
-
let e = h(
|
|
28083
|
+
var mj = () => {
|
|
28084
|
+
let e = h(fj);
|
|
28006
28085
|
if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
|
|
28007
28086
|
return e;
|
|
28008
|
-
},
|
|
28087
|
+
}, hj = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ T("span", {
|
|
28009
28088
|
className: "updog__remote-source-btn__icon",
|
|
28010
28089
|
dangerouslySetInnerHTML: { __html: e.icon }
|
|
28011
28090
|
}) : /* @__PURE__ */ T("span", {
|
|
@@ -28014,7 +28093,7 @@ var fj = () => {
|
|
|
28014
28093
|
src: e.icon,
|
|
28015
28094
|
alt: e.label
|
|
28016
28095
|
})
|
|
28017
|
-
}),
|
|
28096
|
+
}), gj = ({ source: e, loading: t, disabled: n, onSelect: r }) => {
|
|
28018
28097
|
let i = m((t) => {
|
|
28019
28098
|
t.stopPropagation(), r(e);
|
|
28020
28099
|
}, [r, e]);
|
|
@@ -28026,12 +28105,12 @@ var fj = () => {
|
|
|
28026
28105
|
disabled: !t && n,
|
|
28027
28106
|
loading: t,
|
|
28028
28107
|
spinnerPosition: "start",
|
|
28029
|
-
startIcon: /* @__PURE__ */ T(
|
|
28108
|
+
startIcon: /* @__PURE__ */ T(hj, { source: e }),
|
|
28030
28109
|
title: e.description,
|
|
28031
28110
|
children: e.label
|
|
28032
28111
|
});
|
|
28033
|
-
},
|
|
28034
|
-
let { t: e } = q(), { importFormats: t, customFormats: n, remoteSources: r, remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } =
|
|
28112
|
+
}, _j = () => {
|
|
28113
|
+
let { t: e } = q(), { importFormats: t, customFormats: n, remoteSources: r, remoteSourceLoading: i, remoteSourceError: a, handleRemoteSourceSelect: o } = mj(), s = r.length > 0;
|
|
28035
28114
|
return /* @__PURE__ */ E("div", {
|
|
28036
28115
|
className: "updog__source-picker",
|
|
28037
28116
|
children: [
|
|
@@ -28058,7 +28137,7 @@ var fj = () => {
|
|
|
28058
28137
|
}),
|
|
28059
28138
|
s && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(ns, {}), /* @__PURE__ */ T("div", {
|
|
28060
28139
|
className: "updog__source-picker__sources-list",
|
|
28061
|
-
children: r.map((e) => /* @__PURE__ */ T(
|
|
28140
|
+
children: r.map((e) => /* @__PURE__ */ T(gj, {
|
|
28062
28141
|
source: e,
|
|
28063
28142
|
loading: i === e.id,
|
|
28064
28143
|
disabled: !!i,
|
|
@@ -28072,18 +28151,18 @@ var fj = () => {
|
|
|
28072
28151
|
})
|
|
28073
28152
|
]
|
|
28074
28153
|
});
|
|
28075
|
-
},
|
|
28154
|
+
}, vj = () => /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("div", {
|
|
28076
28155
|
className: "updog__upload-prompt__icon-container",
|
|
28077
28156
|
children: /* @__PURE__ */ T(Be, {
|
|
28078
28157
|
size: "1rem",
|
|
28079
28158
|
className: "updog__upload-prompt__icon"
|
|
28080
28159
|
})
|
|
28081
|
-
}), /* @__PURE__ */ T(
|
|
28160
|
+
}), /* @__PURE__ */ T(_j, {})] }), yj = ({ onClick: e }) => /* @__PURE__ */ T("div", {
|
|
28082
28161
|
className: "updog__add-files-card",
|
|
28083
28162
|
onClick: e,
|
|
28084
|
-
children: /* @__PURE__ */ T(
|
|
28085
|
-
}),
|
|
28086
|
-
let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } =
|
|
28163
|
+
children: /* @__PURE__ */ T(vj, {})
|
|
28164
|
+
}), bj = () => {
|
|
28165
|
+
let { t: e } = q(), { exampleMenuOptions: t, onExampleDownload: n } = mj();
|
|
28087
28166
|
return /* @__PURE__ */ T(hs, {
|
|
28088
28167
|
options: t,
|
|
28089
28168
|
onSelect: n,
|
|
@@ -28095,8 +28174,8 @@ var fj = () => {
|
|
|
28095
28174
|
children: e("dataEditor.uploader.uploadFile.downloadExample")
|
|
28096
28175
|
})
|
|
28097
28176
|
});
|
|
28098
|
-
},
|
|
28099
|
-
let { t: e } = q(), { reset: t } =
|
|
28177
|
+
}, xj = () => {
|
|
28178
|
+
let { t: e } = q(), { reset: t } = mj();
|
|
28100
28179
|
return /* @__PURE__ */ T(Y, {
|
|
28101
28180
|
variant: "outlined",
|
|
28102
28181
|
color: "neutral",
|
|
@@ -28104,7 +28183,7 @@ var fj = () => {
|
|
|
28104
28183
|
onClick: t,
|
|
28105
28184
|
children: e("dataEditor.uploader.uploadFile.reset")
|
|
28106
28185
|
});
|
|
28107
|
-
},
|
|
28186
|
+
}, Sj = ({ item: e, onToggle: t, onCancel: n }) => {
|
|
28108
28187
|
let { t: r } = q(), i = e.status === "ready", a = e.status === "ready" && e.selected, o = e.status === "ready" ? Math.max(0, e.preview.totalRows) : 0, s = m(() => {
|
|
28109
28188
|
t(e.id);
|
|
28110
28189
|
}, [t, e.id]), c = m((t) => {
|
|
@@ -28169,15 +28248,15 @@ var fj = () => {
|
|
|
28169
28248
|
})]
|
|
28170
28249
|
})
|
|
28171
28250
|
});
|
|
28172
|
-
},
|
|
28173
|
-
let { isBlocked: e, open: t } =
|
|
28251
|
+
}, Cj = () => {
|
|
28252
|
+
let { isBlocked: e, open: t } = mj();
|
|
28174
28253
|
return /* @__PURE__ */ T("div", {
|
|
28175
28254
|
className: O("updog__step-select-files__upload-area", e && "updog__step-select-files__upload-area--disabled"),
|
|
28176
28255
|
onClick: e ? void 0 : t,
|
|
28177
|
-
children: /* @__PURE__ */ T(
|
|
28256
|
+
children: /* @__PURE__ */ T(vj, {})
|
|
28178
28257
|
});
|
|
28179
|
-
},
|
|
28180
|
-
let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o, cancelItem: s } =
|
|
28258
|
+
}, wj = () => {
|
|
28259
|
+
let { t: e } = q(), { getRootProps: t, getInputProps: n, isDragActive: r, open: i, stagedItems: a, toggleItem: o, cancelItem: s } = mj(), c = a.length > 0;
|
|
28181
28260
|
return /* @__PURE__ */ T(Rh, { children: /* @__PURE__ */ E("div", {
|
|
28182
28261
|
className: "updog__step-select-files__dropzone",
|
|
28183
28262
|
...t(),
|
|
@@ -28187,20 +28266,20 @@ var fj = () => {
|
|
|
28187
28266
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
28188
28267
|
children: /* @__PURE__ */ E("div", {
|
|
28189
28268
|
className: "updog__sheet-preview-grid",
|
|
28190
|
-
children: [a.map((e) => /* @__PURE__ */ T(
|
|
28269
|
+
children: [a.map((e) => /* @__PURE__ */ T(Sj, {
|
|
28191
28270
|
item: e,
|
|
28192
28271
|
onToggle: o,
|
|
28193
28272
|
onCancel: s
|
|
28194
|
-
}, e.id)), /* @__PURE__ */ T(
|
|
28273
|
+
}, e.id)), /* @__PURE__ */ T(yj, { onClick: i })]
|
|
28195
28274
|
})
|
|
28196
|
-
}) : /* @__PURE__ */ T(
|
|
28275
|
+
}) : /* @__PURE__ */ T(Cj, {}), /* @__PURE__ */ T(_E, { leftSlot: T(c ? xj : bj, {}) })] }),
|
|
28197
28276
|
r && /* @__PURE__ */ T(Lh, {})
|
|
28198
28277
|
]
|
|
28199
28278
|
}) });
|
|
28200
|
-
},
|
|
28279
|
+
}, Tj = () => /* @__PURE__ */ T(pj, { children: /* @__PURE__ */ T(wj, {}) });
|
|
28201
28280
|
//#endregion
|
|
28202
28281
|
//#region src/components/DataUploader/hooks/useUploadFlow.ts
|
|
28203
|
-
function
|
|
28282
|
+
function Ej(e) {
|
|
28204
28283
|
let t = x(null);
|
|
28205
28284
|
t.current === null && (t.current = e());
|
|
28206
28285
|
let n = t.current;
|
|
@@ -28208,70 +28287,72 @@ function wj(e) {
|
|
|
28208
28287
|
}
|
|
28209
28288
|
//#endregion
|
|
28210
28289
|
//#region src/components/DataUploader/context/index.tsx
|
|
28211
|
-
function
|
|
28212
|
-
let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c,
|
|
28290
|
+
function Dj({ children: e }) {
|
|
28291
|
+
let { store: t, validator: n, columns: r, primaryKey: i, pendingImportFiles: a, setPendingImportFiles: o, onColumnMatch: s, onValueMatch: c, onRowImport: l, context: u, synonyms: d, addDynamicColumns: f, customFormats: p, onUnstructuredFile: h } = Q(), { t: _ } = q(), v = m((e, t) => t ? _("dataEditor.uploader.matchColumns.syntheticColumnValue", {
|
|
28213
28292
|
index: e + 1,
|
|
28214
28293
|
value: t
|
|
28215
|
-
}) :
|
|
28294
|
+
}) : _("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [_]), y = Ej(() => new aA({
|
|
28216
28295
|
store: t,
|
|
28217
28296
|
validator: n,
|
|
28218
28297
|
columns: r,
|
|
28219
28298
|
defaultPrimaryKey: i ? fc(i) : null,
|
|
28220
28299
|
onColumnMatch: s,
|
|
28221
28300
|
onValueMatch: c,
|
|
28222
|
-
|
|
28223
|
-
|
|
28224
|
-
|
|
28225
|
-
|
|
28226
|
-
|
|
28301
|
+
onRowImport: l,
|
|
28302
|
+
context: u,
|
|
28303
|
+
extraSynonyms: SE(d),
|
|
28304
|
+
addDynamicColumns: f,
|
|
28305
|
+
synthesizeHeader: v,
|
|
28306
|
+
customFormats: p ?? [],
|
|
28307
|
+
onUnstructuredFile: h,
|
|
28227
28308
|
hasExistingData: t.getLocalRowCount() > 0,
|
|
28228
28309
|
createParseClient: () => new wg()
|
|
28229
|
-
})),
|
|
28310
|
+
})), b = x(!0);
|
|
28230
28311
|
g(() => {
|
|
28231
|
-
if (
|
|
28232
|
-
|
|
28312
|
+
if (b.current) {
|
|
28313
|
+
b.current = !1;
|
|
28233
28314
|
return;
|
|
28234
28315
|
}
|
|
28235
|
-
|
|
28236
|
-
}, [
|
|
28237
|
-
let
|
|
28316
|
+
y.setSynthesizeHeader(v);
|
|
28317
|
+
}, [y, v]);
|
|
28318
|
+
let S = hE(y);
|
|
28238
28319
|
return g(() => {
|
|
28239
28320
|
if (a.length > 0) {
|
|
28240
|
-
for (let e of a)
|
|
28321
|
+
for (let e of a) S(e);
|
|
28241
28322
|
o([]);
|
|
28242
28323
|
}
|
|
28243
28324
|
}, [
|
|
28244
28325
|
a,
|
|
28245
28326
|
o,
|
|
28246
|
-
|
|
28327
|
+
S
|
|
28247
28328
|
]), /* @__PURE__ */ T(eE.Provider, {
|
|
28248
|
-
value:
|
|
28329
|
+
value: y,
|
|
28249
28330
|
children: e
|
|
28250
28331
|
});
|
|
28251
28332
|
}
|
|
28252
28333
|
//#endregion
|
|
28253
28334
|
//#region src/components/DataUploader/index.tsx
|
|
28254
|
-
var
|
|
28335
|
+
var Oj = () => {
|
|
28255
28336
|
let { stepIds: e, activeStepIndex: t, headerReview: n, columnMatching: r } = fE(tE(), sE), i = QT(), { t: a } = q(), o = b(() => ({
|
|
28256
28337
|
"select-files": {
|
|
28257
28338
|
title: a("dataEditor.uploader.steps.selectFiles"),
|
|
28258
|
-
content: /* @__PURE__ */ T(
|
|
28339
|
+
content: /* @__PURE__ */ T(Tj, {})
|
|
28259
28340
|
},
|
|
28260
28341
|
"header-selection": {
|
|
28261
28342
|
title: a("dataEditor.uploader.steps.headerSelection"),
|
|
28262
|
-
content: /* @__PURE__ */ T(
|
|
28343
|
+
content: /* @__PURE__ */ T(AA, {})
|
|
28263
28344
|
},
|
|
28264
28345
|
"column-matching": {
|
|
28265
28346
|
title: a("dataEditor.uploader.steps.matchColumns"),
|
|
28266
|
-
content: /* @__PURE__ */ T(
|
|
28347
|
+
content: /* @__PURE__ */ T(wA, {})
|
|
28267
28348
|
},
|
|
28268
28349
|
"match-values": {
|
|
28269
28350
|
title: a("dataEditor.uploader.steps.matchValues"),
|
|
28270
|
-
content: /* @__PURE__ */ T(
|
|
28351
|
+
content: /* @__PURE__ */ T(rj, {})
|
|
28271
28352
|
},
|
|
28272
28353
|
"primary-key": {
|
|
28273
28354
|
title: a("dataEditor.uploader.steps.addOrUpdate"),
|
|
28274
|
-
content: /* @__PURE__ */ T(
|
|
28355
|
+
content: /* @__PURE__ */ T(lj, {})
|
|
28275
28356
|
}
|
|
28276
28357
|
}), [a]), s = e[t], c = s ? o[s] : void 0, l = s === "header-selection" && n && n.total > 1 ? a("dataEditor.uploader.steps.headerSelectionOf", {
|
|
28277
28358
|
current: n.position + 1,
|
|
@@ -28289,82 +28370,82 @@ var Ej = () => {
|
|
|
28289
28370
|
children: c?.content
|
|
28290
28371
|
})]
|
|
28291
28372
|
});
|
|
28292
|
-
},
|
|
28373
|
+
}, kj = () => /* @__PURE__ */ T(Dj, { children: /* @__PURE__ */ E("div", {
|
|
28293
28374
|
className: "updog__data-uploader",
|
|
28294
|
-
children: [/* @__PURE__ */ T(
|
|
28295
|
-
}) }),
|
|
28375
|
+
children: [/* @__PURE__ */ T(Oj, {}), /* @__PURE__ */ T(Jh, {})]
|
|
28376
|
+
}) }), Aj = {
|
|
28296
28377
|
kty: "EC",
|
|
28297
28378
|
crv: "P-256",
|
|
28298
28379
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
28299
28380
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
28300
|
-
},
|
|
28381
|
+
}, jj = "updog_license_grant", Mj = /* @__PURE__ */ new Set([
|
|
28301
28382
|
"updog.tech",
|
|
28302
28383
|
"landing.updog.tech",
|
|
28303
28384
|
"demo.updog.tech"
|
|
28304
28385
|
]);
|
|
28305
|
-
function
|
|
28306
|
-
return
|
|
28386
|
+
function Nj() {
|
|
28387
|
+
return Mj.has(window.location.hostname);
|
|
28307
28388
|
}
|
|
28308
|
-
function
|
|
28389
|
+
function Pj() {
|
|
28309
28390
|
return !1;
|
|
28310
28391
|
}
|
|
28311
|
-
function
|
|
28392
|
+
function Fj() {
|
|
28312
28393
|
return "https://api.updog.tech";
|
|
28313
28394
|
}
|
|
28314
|
-
function
|
|
28395
|
+
function Ij(e) {
|
|
28315
28396
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
28316
28397
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
28317
28398
|
return i;
|
|
28318
28399
|
}
|
|
28319
|
-
async function
|
|
28400
|
+
async function Lj(e) {
|
|
28320
28401
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
28321
28402
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
28322
28403
|
}
|
|
28323
|
-
var
|
|
28324
|
-
async function
|
|
28325
|
-
return
|
|
28404
|
+
var Rj = null;
|
|
28405
|
+
async function zj() {
|
|
28406
|
+
return Rj || (Rj = await crypto.subtle.importKey("jwk", Aj, {
|
|
28326
28407
|
name: "ECDSA",
|
|
28327
28408
|
namedCurve: "P-256"
|
|
28328
|
-
}, !1, ["verify"]),
|
|
28409
|
+
}, !1, ["verify"]), Rj);
|
|
28329
28410
|
}
|
|
28330
|
-
function
|
|
28411
|
+
function Bj() {
|
|
28331
28412
|
try {
|
|
28332
|
-
return localStorage.getItem(
|
|
28413
|
+
return localStorage.getItem(jj);
|
|
28333
28414
|
} catch {
|
|
28334
28415
|
return null;
|
|
28335
28416
|
}
|
|
28336
28417
|
}
|
|
28337
|
-
function
|
|
28418
|
+
function Vj(e) {
|
|
28338
28419
|
try {
|
|
28339
|
-
localStorage.setItem(
|
|
28420
|
+
localStorage.setItem(jj, e);
|
|
28340
28421
|
} catch {}
|
|
28341
28422
|
}
|
|
28342
|
-
function
|
|
28423
|
+
function Hj() {
|
|
28343
28424
|
try {
|
|
28344
|
-
localStorage.removeItem(
|
|
28425
|
+
localStorage.removeItem(jj);
|
|
28345
28426
|
} catch {}
|
|
28346
28427
|
}
|
|
28347
|
-
async function
|
|
28428
|
+
async function Uj(e, t, n) {
|
|
28348
28429
|
let r = e.indexOf(".");
|
|
28349
28430
|
if (r === -1) return !1;
|
|
28350
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
28431
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = Ij(i), s = Ij(a), c = await zj();
|
|
28351
28432
|
if (!await crypto.subtle.verify({
|
|
28352
28433
|
name: "ECDSA",
|
|
28353
28434
|
hash: "SHA-256"
|
|
28354
28435
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
28355
28436
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
28356
28437
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
28357
|
-
let u = await
|
|
28438
|
+
let u = await Lj(t);
|
|
28358
28439
|
return l.key === u && l.domain === n;
|
|
28359
28440
|
}
|
|
28360
|
-
async function
|
|
28361
|
-
let t =
|
|
28441
|
+
async function Wj(e) {
|
|
28442
|
+
let t = Bj();
|
|
28362
28443
|
if (!t) return {
|
|
28363
28444
|
valid: !1,
|
|
28364
28445
|
errorCode: "license.invalid"
|
|
28365
28446
|
};
|
|
28366
28447
|
try {
|
|
28367
|
-
if (await
|
|
28448
|
+
if (await Uj(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
28368
28449
|
valid: !0,
|
|
28369
28450
|
errorCode: null
|
|
28370
28451
|
};
|
|
@@ -28374,23 +28455,23 @@ async function Hj(e) {
|
|
|
28374
28455
|
errorCode: "license.invalid"
|
|
28375
28456
|
};
|
|
28376
28457
|
}
|
|
28377
|
-
async function
|
|
28378
|
-
if (
|
|
28458
|
+
async function Gj(e, t = !0) {
|
|
28459
|
+
if (Nj() || Pj()) return {
|
|
28379
28460
|
valid: !0,
|
|
28380
28461
|
errorCode: null
|
|
28381
28462
|
};
|
|
28382
|
-
let n =
|
|
28463
|
+
let n = Fj();
|
|
28383
28464
|
try {
|
|
28384
28465
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
28385
28466
|
if (r.ok) {
|
|
28386
28467
|
let e = await r.json();
|
|
28387
|
-
return t && e.grant &&
|
|
28468
|
+
return t && e.grant && Vj(e.grant), {
|
|
28388
28469
|
valid: !0,
|
|
28389
28470
|
errorCode: null
|
|
28390
28471
|
};
|
|
28391
28472
|
}
|
|
28392
28473
|
if (r.status >= 400 && r.status < 500) {
|
|
28393
|
-
t &&
|
|
28474
|
+
t && Hj();
|
|
28394
28475
|
try {
|
|
28395
28476
|
return await r.json();
|
|
28396
28477
|
} catch {
|
|
@@ -28402,7 +28483,7 @@ async function Uj(e, t = !0) {
|
|
|
28402
28483
|
}
|
|
28403
28484
|
throw Error(`Server error: ${r.status}`);
|
|
28404
28485
|
} catch {
|
|
28405
|
-
return t ?
|
|
28486
|
+
return t ? Wj(e) : {
|
|
28406
28487
|
valid: !1,
|
|
28407
28488
|
errorCode: "license.invalid"
|
|
28408
28489
|
};
|
|
@@ -28410,7 +28491,7 @@ async function Uj(e, t = !0) {
|
|
|
28410
28491
|
}
|
|
28411
28492
|
//#endregion
|
|
28412
28493
|
//#region src/hooks/useLicenseValidation.ts
|
|
28413
|
-
function
|
|
28494
|
+
function Kj(e, t, n = !0) {
|
|
28414
28495
|
let [r, i] = S({
|
|
28415
28496
|
isValidating: t,
|
|
28416
28497
|
isValid: !1,
|
|
@@ -28430,7 +28511,7 @@ function Wj(e, t, n = !0) {
|
|
|
28430
28511
|
isValidating: !0,
|
|
28431
28512
|
isValid: !1,
|
|
28432
28513
|
errorCode: null
|
|
28433
|
-
}),
|
|
28514
|
+
}), Gj(e, n).then((e) => {
|
|
28434
28515
|
r || i({
|
|
28435
28516
|
isValidating: !1,
|
|
28436
28517
|
isValid: e.valid,
|
|
@@ -28453,22 +28534,22 @@ function Wj(e, t, n = !0) {
|
|
|
28453
28534
|
}
|
|
28454
28535
|
//#endregion
|
|
28455
28536
|
//#region src/index.tsx
|
|
28456
|
-
function
|
|
28537
|
+
function qj(e) {
|
|
28457
28538
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
28458
28539
|
}
|
|
28459
|
-
function
|
|
28540
|
+
function Jj(e) {
|
|
28460
28541
|
let t = b(() => new lc(e.onError), [e.onError]);
|
|
28461
28542
|
return /* @__PURE__ */ T(YT, {
|
|
28462
28543
|
errorHandler: t,
|
|
28463
28544
|
children: /* @__PURE__ */ T(kh, {
|
|
28464
28545
|
...e,
|
|
28465
28546
|
errorHandler: t,
|
|
28466
|
-
children: e.showUploader ? /* @__PURE__ */ T(
|
|
28547
|
+
children: e.showUploader ? /* @__PURE__ */ T(kj, {}) : /* @__PURE__ */ T(GT, {})
|
|
28467
28548
|
})
|
|
28468
28549
|
});
|
|
28469
28550
|
}
|
|
28470
|
-
function
|
|
28471
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a =
|
|
28551
|
+
function Yj(e) {
|
|
28552
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = q(), i = r ? "rtl" : "ltr", a = qj(e.localStorage), o = t !== "modal" || e.open, { isValidating: s, isValid: c, errorCode: l } = Kj(e.apiKey, t !== "modal" || o, a.licenseGrant), [u, d] = S(e.variant === "uploader"), f = x(null), { value: p, setTrue: h, setFalse: _ } = nc(!1), v = t === "modal" ? e.onClose : void 0, y = m(() => {
|
|
28472
28553
|
let t = f.current?.getSnapshot();
|
|
28473
28554
|
t && (t.dirtyRowCount > 0 || t.deletedRowCount > 0) && !e.readonly ? h() : v?.();
|
|
28474
28555
|
}, [
|
|
@@ -28484,33 +28565,10 @@ function qj(e) {
|
|
|
28484
28565
|
t
|
|
28485
28566
|
]);
|
|
28486
28567
|
let A = {
|
|
28487
|
-
|
|
28488
|
-
primaryKey: e.primaryKey,
|
|
28489
|
-
loadData: e.loadData,
|
|
28490
|
-
onComplete: e.onComplete,
|
|
28491
|
-
variant: e.variant,
|
|
28568
|
+
...e,
|
|
28492
28569
|
showUploader: u,
|
|
28493
28570
|
setShowUploader: d,
|
|
28494
|
-
storeRef: f
|
|
28495
|
-
enableDeleteRow: e.enableDeleteRow,
|
|
28496
|
-
enableAddRow: e.enableAddRow,
|
|
28497
|
-
enableAddSource: e.enableAddSource,
|
|
28498
|
-
blockSubmitOnError: e.blockSubmitOnError,
|
|
28499
|
-
importFormats: e.importFormats,
|
|
28500
|
-
exportFormats: e.exportFormats,
|
|
28501
|
-
readonly: e.readonly,
|
|
28502
|
-
rowHeight: e.rowHeight,
|
|
28503
|
-
headerHeight: e.headerHeight,
|
|
28504
|
-
enableCreateColumn: e.enableCreateColumn,
|
|
28505
|
-
onColumnMatch: e.onColumnMatch,
|
|
28506
|
-
onValueMatch: e.onValueMatch,
|
|
28507
|
-
synonyms: e.synonyms,
|
|
28508
|
-
sampleData: e.sampleData,
|
|
28509
|
-
chat: e.chat,
|
|
28510
|
-
remoteSources: e.remoteSources,
|
|
28511
|
-
customFormats: e.customFormats,
|
|
28512
|
-
onUnstructuredFile: e.onUnstructuredFile,
|
|
28513
|
-
onError: e.onError
|
|
28571
|
+
storeRef: f
|
|
28514
28572
|
}, j = (e) => /* @__PURE__ */ E("div", {
|
|
28515
28573
|
className: "updog__license-validation__loading",
|
|
28516
28574
|
children: [/* @__PURE__ */ T(Wi, { size: "lg" }), /* @__PURE__ */ T(J, { children: e })]
|
|
@@ -28518,7 +28576,7 @@ function qj(e) {
|
|
|
28518
28576
|
code: e,
|
|
28519
28577
|
message: "License validation failed",
|
|
28520
28578
|
source: "license"
|
|
28521
|
-
} }), N = () => s ? j(n("dataEditor.license.loading")) : c ? /* @__PURE__ */ T(
|
|
28579
|
+
} }), N = () => s ? j(n("dataEditor.license.loading")) : c ? /* @__PURE__ */ T(Jj, { ...A }) : M(l ?? "license.invalid");
|
|
28522
28580
|
return t === "inline" ? /* @__PURE__ */ T("div", {
|
|
28523
28581
|
className: "updog__data-editor updog__data-editor-inline",
|
|
28524
28582
|
dir: i,
|
|
@@ -28541,14 +28599,14 @@ function qj(e) {
|
|
|
28541
28599
|
})
|
|
28542
28600
|
});
|
|
28543
28601
|
}
|
|
28544
|
-
function
|
|
28602
|
+
function Xj(e) {
|
|
28545
28603
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
28546
28604
|
return /* @__PURE__ */ T(Ri, {
|
|
28547
28605
|
translations: t,
|
|
28548
28606
|
rtl: n,
|
|
28549
28607
|
locale: r,
|
|
28550
|
-
children: /* @__PURE__ */ T(
|
|
28608
|
+
children: /* @__PURE__ */ T(Yj, { ...a })
|
|
28551
28609
|
});
|
|
28552
28610
|
}
|
|
28553
28611
|
//#endregion
|
|
28554
|
-
export {
|
|
28612
|
+
export { Xj as DataEditor, jg as downloadExampleFile, Mg as exportDataEditor };
|