@updog/data-editor-wc 0.1.52 → 0.1.54
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.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +357 -335
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8435,11 +8435,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
8435
8435
|
},
|
|
8436
8436
|
headerSelection: { noHeaderLabel: "My data has no header row" },
|
|
8437
8437
|
matchColumns: {
|
|
8438
|
+
allMatched: "All columns are matched",
|
|
8438
8439
|
banner: "Some columns could not be automatically matched",
|
|
8439
8440
|
importedColumns: "Imported columns",
|
|
8440
8441
|
matchedCount: "{{matched}}/{{total}} matched",
|
|
8441
8442
|
targetColumns: "Target columns",
|
|
8442
8443
|
selectColumnPlaceholder: "Select column",
|
|
8444
|
+
showMatched: "Show matched",
|
|
8443
8445
|
syntheticColumn: "C{{index}}",
|
|
8444
8446
|
syntheticColumnValue: "C{{index}}: {{value}}",
|
|
8445
8447
|
bestMatch: "Best match",
|
|
@@ -45815,7 +45817,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
45815
45817
|
return this.state.hasError ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: Oj }) : this.props.children;
|
|
45816
45818
|
}
|
|
45817
45819
|
}, Aj = ({ leftSlot: e }) => {
|
|
45818
|
-
let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } =
|
|
45820
|
+
let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = ZN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
|
|
45819
45821
|
n(!1);
|
|
45820
45822
|
}, [n]), x = p[m]?.id === "sheet-selection", S = (0, y.useCallback)(() => {
|
|
45821
45823
|
a ? c() : x ? g() : o();
|
|
@@ -46584,27 +46586,27 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
46584
46586
|
}
|
|
46585
46587
|
return i;
|
|
46586
46588
|
}, Qj = () => {
|
|
46587
|
-
let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } =
|
|
46589
|
+
let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = ZN(), [l, u] = (0, y.useState)(null), [d, f] = (0, y.useState)(!0), p = (0, y.useRef)(null), m = (0, y.useMemo)(() => Zj(i, e, n), [
|
|
46588
46590
|
i,
|
|
46589
46591
|
e,
|
|
46590
46592
|
n
|
|
46591
|
-
]),
|
|
46593
|
+
]), h = (0, y.useCallback)((e, t) => {
|
|
46592
46594
|
if (t === "action:create") {
|
|
46593
|
-
|
|
46595
|
+
p.current = e, u({ title: e });
|
|
46594
46596
|
return;
|
|
46595
46597
|
}
|
|
46596
46598
|
o(e, t);
|
|
46597
|
-
}, [o]),
|
|
46598
|
-
if (
|
|
46599
|
+
}, [o]), g = (0, y.useCallback)((e) => {
|
|
46600
|
+
if (p.current === null) return;
|
|
46599
46601
|
let t = Math.random().toString(36).slice(2, 7), n = `${ad}${e.title}-${t}`;
|
|
46600
46602
|
c((t) => [...t, {
|
|
46601
46603
|
...e,
|
|
46602
46604
|
id: n,
|
|
46603
46605
|
size: 150
|
|
46604
|
-
}]), o(
|
|
46605
|
-
}, [o, c]),
|
|
46606
|
-
|
|
46607
|
-
}, []),
|
|
46606
|
+
}]), o(p.current, n), p.current = null, u(null);
|
|
46607
|
+
}, [o, c]), _ = (0, y.useCallback)(() => {
|
|
46608
|
+
p.current = null, u(null);
|
|
46609
|
+
}, []), v = (0, y.useMemo)(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), b = (0, y.useMemo)(() => {
|
|
46608
46610
|
let n = {
|
|
46609
46611
|
text: r("dataEditor.uploader.matchColumns.bestMatch"),
|
|
46610
46612
|
color: "green"
|
|
@@ -46613,7 +46615,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
46613
46615
|
color: "blue"
|
|
46614
46616
|
}, o = r("dataEditor.uploader.matchColumns.createColumn");
|
|
46615
46617
|
return Object.fromEntries(i.map((r) => {
|
|
46616
|
-
let i =
|
|
46618
|
+
let i = m[r], c = e.map((e) => ({
|
|
46617
46619
|
id: e.id,
|
|
46618
46620
|
text: e.title,
|
|
46619
46621
|
...e.id === i && { tag: n }
|
|
@@ -46638,28 +46640,30 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
46638
46640
|
s,
|
|
46639
46641
|
r,
|
|
46640
46642
|
t,
|
|
46641
|
-
|
|
46642
|
-
]),
|
|
46643
|
+
m
|
|
46644
|
+
]), x = (0, y.useMemo)(() => i.filter((e) => a[e]).length, [i, a]);
|
|
46643
46645
|
return {
|
|
46644
46646
|
headers: i,
|
|
46645
|
-
|
|
46646
|
-
|
|
46647
|
+
showMatched: d,
|
|
46648
|
+
setShowMatched: f,
|
|
46649
|
+
matchedCount: x,
|
|
46650
|
+
allMatched: x === i.length,
|
|
46647
46651
|
placeholder: r("dataEditor.uploader.matchColumns.selectColumnPlaceholder"),
|
|
46648
|
-
existingNames:
|
|
46652
|
+
existingNames: v,
|
|
46649
46653
|
createModalValues: l,
|
|
46650
46654
|
getRowData: (0, y.useCallback)((e) => ({
|
|
46651
46655
|
mappedValue: a[e],
|
|
46652
|
-
options:
|
|
46653
|
-
autoMatchId:
|
|
46656
|
+
options: b[e],
|
|
46657
|
+
autoMatchId: m[e]
|
|
46654
46658
|
}), [
|
|
46655
46659
|
a,
|
|
46656
|
-
|
|
46657
|
-
|
|
46660
|
+
b,
|
|
46661
|
+
m
|
|
46658
46662
|
]),
|
|
46659
|
-
onSelectChange:
|
|
46663
|
+
onSelectChange: h,
|
|
46660
46664
|
onClear: o,
|
|
46661
|
-
submitCreate:
|
|
46662
|
-
closeCreate:
|
|
46665
|
+
submitCreate: g,
|
|
46666
|
+
closeCreate: _
|
|
46663
46667
|
};
|
|
46664
46668
|
}, $j = (0, y.createContext)(null);
|
|
46665
46669
|
function eM({ children: e }) {
|
|
@@ -46674,7 +46678,7 @@ var tM = () => {
|
|
|
46674
46678
|
if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
|
|
46675
46679
|
return e;
|
|
46676
46680
|
}, nM = () => {
|
|
46677
|
-
let { t: e } = j(), { matchedCount: t, allMatched: n, headers: r } = tM(),
|
|
46681
|
+
let { t: e } = j(), { matchedCount: t, allMatched: n, headers: r, showMatched: i, setShowMatched: a } = tM(), o = n ? "green" : "yellow", s = (0, y.useCallback)((e) => a(e), [a]);
|
|
46678
46682
|
return /* @__PURE__ */ (0, O.jsx)("header", {
|
|
46679
46683
|
className: "updog__column-matching__header",
|
|
46680
46684
|
children: /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
@@ -46688,7 +46692,7 @@ var tM = () => {
|
|
|
46688
46692
|
weight: "medium",
|
|
46689
46693
|
children: e("dataEditor.uploader.matchColumns.importedColumns")
|
|
46690
46694
|
}), /* @__PURE__ */ (0, O.jsx)(sc, {
|
|
46691
|
-
color:
|
|
46695
|
+
color: o,
|
|
46692
46696
|
text: e("dataEditor.uploader.matchColumns.matchedCount", {
|
|
46693
46697
|
matched: t,
|
|
46694
46698
|
total: r.length
|
|
@@ -46696,12 +46700,21 @@ var tM = () => {
|
|
|
46696
46700
|
})]
|
|
46697
46701
|
}),
|
|
46698
46702
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__header-spacer" }),
|
|
46699
|
-
/* @__PURE__ */ (0, O.
|
|
46700
|
-
|
|
46701
|
-
|
|
46702
|
-
|
|
46703
|
-
|
|
46704
|
-
|
|
46703
|
+
/* @__PURE__ */ (0, O.jsxs)("div", {
|
|
46704
|
+
className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
|
|
46705
|
+
children: [/* @__PURE__ */ (0, O.jsx)(W, {
|
|
46706
|
+
as: "div",
|
|
46707
|
+
size: "sm",
|
|
46708
|
+
weight: "medium",
|
|
46709
|
+
children: e("dataEditor.uploader.matchColumns.targetColumns")
|
|
46710
|
+
}), /* @__PURE__ */ (0, O.jsx)(jt, {
|
|
46711
|
+
checked: i,
|
|
46712
|
+
onChange: s,
|
|
46713
|
+
checkboxPosition: "end",
|
|
46714
|
+
label: e("dataEditor.uploader.matchColumns.showMatched"),
|
|
46715
|
+
size: "sm",
|
|
46716
|
+
className: "updog__column-matching__show-matched"
|
|
46717
|
+
})]
|
|
46705
46718
|
}),
|
|
46706
46719
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__column-matching__action" })
|
|
46707
46720
|
]
|
|
@@ -46767,24 +46780,34 @@ var tM = () => {
|
|
|
46767
46780
|
]
|
|
46768
46781
|
});
|
|
46769
46782
|
}), iM = () => {
|
|
46770
|
-
let { headers: e,
|
|
46771
|
-
|
|
46783
|
+
let { headers: e, showMatched: t, placeholder: n, getRowData: r, onSelectChange: i, onClear: a } = tM(), { t: o } = j(), s = e.map((e) => ({
|
|
46784
|
+
csvHeader: e,
|
|
46785
|
+
...r(e)
|
|
46786
|
+
})).filter((e) => t || !e.mappedValue);
|
|
46787
|
+
return s.length === 0 ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
46772
46788
|
className: "updog__column-matching__content",
|
|
46773
46789
|
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
46774
|
-
className: "updog__column-
|
|
46775
|
-
children:
|
|
46776
|
-
|
|
46777
|
-
|
|
46778
|
-
|
|
46779
|
-
mappedValue: a,
|
|
46780
|
-
options: o,
|
|
46781
|
-
autoMatchId: s,
|
|
46782
|
-
placeholder: t,
|
|
46783
|
-
onSelectChange: r,
|
|
46784
|
-
onClear: i
|
|
46785
|
-
}, e);
|
|
46790
|
+
className: "updog__column-matching__empty",
|
|
46791
|
+
children: /* @__PURE__ */ (0, O.jsx)(W, {
|
|
46792
|
+
size: "sm",
|
|
46793
|
+
color: "secondary",
|
|
46794
|
+
children: o("dataEditor.uploader.matchColumns.allMatched")
|
|
46786
46795
|
})
|
|
46787
46796
|
})
|
|
46797
|
+
}) : /* @__PURE__ */ (0, O.jsx)("div", {
|
|
46798
|
+
className: "updog__column-matching__content",
|
|
46799
|
+
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
46800
|
+
className: "updog__column-matching__content-inner",
|
|
46801
|
+
children: s.map(({ csvHeader: e, mappedValue: t, options: r, autoMatchId: o }) => /* @__PURE__ */ (0, O.jsx)(rM, {
|
|
46802
|
+
csvHeader: e,
|
|
46803
|
+
mappedValue: t,
|
|
46804
|
+
options: r,
|
|
46805
|
+
autoMatchId: o,
|
|
46806
|
+
placeholder: n,
|
|
46807
|
+
onSelectChange: i,
|
|
46808
|
+
onClear: a
|
|
46809
|
+
}, e))
|
|
46810
|
+
})
|
|
46788
46811
|
});
|
|
46789
46812
|
}, aM = () => {
|
|
46790
46813
|
let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = tM();
|
|
@@ -46803,99 +46826,93 @@ var tM = () => {
|
|
|
46803
46826
|
/* @__PURE__ */ (0, O.jsx)(aM, {})
|
|
46804
46827
|
]
|
|
46805
46828
|
}), sM = () => {
|
|
46806
|
-
let { parsedCsv: e } =
|
|
46829
|
+
let { parsedCsv: e } = ZN();
|
|
46807
46830
|
return e ? /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
46808
46831
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
46809
46832
|
children: /* @__PURE__ */ (0, O.jsx)(eM, { children: /* @__PURE__ */ (0, O.jsx)(oM, {}) })
|
|
46810
46833
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }) : null;
|
|
46811
|
-
}, cM = new Set([
|
|
46834
|
+
}, cM = .5, lM = new Set([
|
|
46812
46835
|
"true",
|
|
46813
46836
|
"false",
|
|
46814
46837
|
"yes",
|
|
46815
46838
|
"no"
|
|
46816
|
-
]),
|
|
46839
|
+
]), uM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, dM = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, fM = new Set([
|
|
46817
46840
|
"number",
|
|
46818
46841
|
"date",
|
|
46819
46842
|
"bool"
|
|
46820
46843
|
]);
|
|
46821
|
-
function
|
|
46844
|
+
function pM(e) {
|
|
46822
46845
|
if (e == null) return "empty";
|
|
46823
46846
|
let t = String(e).trim();
|
|
46824
|
-
return t.length === 0 ? "empty" :
|
|
46847
|
+
return t.length === 0 ? "empty" : lM.has(t.toLowerCase()) ? "bool" : uM.test(t) ? "date" : dM.test(t) ? "number" : "text";
|
|
46825
46848
|
}
|
|
46826
|
-
function
|
|
46849
|
+
function mM(e) {
|
|
46827
46850
|
return e.filter((e) => e != null && String(e).trim().length > 0).length;
|
|
46828
46851
|
}
|
|
46829
|
-
function
|
|
46852
|
+
function hM(e) {
|
|
46853
|
+
let t = 0;
|
|
46854
|
+
for (let n of e) t = Math.max(t, n.length);
|
|
46855
|
+
return t;
|
|
46856
|
+
}
|
|
46857
|
+
function gM(e) {
|
|
46830
46858
|
let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
46831
46859
|
for (let i of e) {
|
|
46832
|
-
let e =
|
|
46860
|
+
let e = i.length;
|
|
46833
46861
|
if (e === 0) continue;
|
|
46834
46862
|
let a = (t.get(e) ?? 0) + 1;
|
|
46835
46863
|
t.set(e, a), a > n && (n = a, r = e);
|
|
46836
46864
|
}
|
|
46837
46865
|
return r;
|
|
46838
46866
|
}
|
|
46839
|
-
function
|
|
46840
|
-
let t = 0;
|
|
46841
|
-
for (let n of e) t = Math.max(t, n.length);
|
|
46842
|
-
return t;
|
|
46843
|
-
}
|
|
46844
|
-
function gM(e, t, n) {
|
|
46867
|
+
function _M(e, t, n) {
|
|
46845
46868
|
if (t <= 0) return 0;
|
|
46846
|
-
let r =
|
|
46847
|
-
for (let a = 0; a < e.length; a++) if (pM(e[a]) === t) {
|
|
46848
|
-
if (r < 0 && (r = a), i++, i >= n) return r;
|
|
46849
|
-
} else r = -1, i = 0;
|
|
46850
|
-
for (let n = 0; n < e.length; n++) if (pM(e[n]) === t) return n;
|
|
46869
|
+
for (let r = 0; r < e.length; r++) if (mM(e[r]) / t >= n) return r;
|
|
46851
46870
|
return 0;
|
|
46852
46871
|
}
|
|
46853
|
-
function
|
|
46872
|
+
function vM(e, t, n, r) {
|
|
46854
46873
|
let i = /* @__PURE__ */ new Map();
|
|
46855
46874
|
for (let a = t; a < n; a++) {
|
|
46856
|
-
let t =
|
|
46875
|
+
let t = pM(e[a]?.[r]);
|
|
46857
46876
|
t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
|
|
46858
46877
|
}
|
|
46859
46878
|
let a = "empty", o = 0;
|
|
46860
46879
|
for (let [e, t] of i) t > o && (o = t, a = e);
|
|
46861
46880
|
return a;
|
|
46862
46881
|
}
|
|
46863
|
-
function
|
|
46882
|
+
function yM(e, t, n, r) {
|
|
46864
46883
|
let i = 0, a = 0;
|
|
46865
46884
|
for (let o = 0; o < r; o++) {
|
|
46866
|
-
let r =
|
|
46867
|
-
r !== "empty" && (a++,
|
|
46885
|
+
let r = vM(e, t + 1, n, o);
|
|
46886
|
+
r !== "empty" && (a++, pM(e[t]?.[o]) === "text" && fM.has(r) && i++);
|
|
46868
46887
|
}
|
|
46869
46888
|
return a === 0 ? 0 : i / a;
|
|
46870
46889
|
}
|
|
46871
|
-
function
|
|
46890
|
+
function bM(e, t, n, r) {
|
|
46872
46891
|
let i = 0, a = 0;
|
|
46873
46892
|
for (let o = 0; o < r; o++) {
|
|
46874
|
-
let r =
|
|
46893
|
+
let r = vM(e, t, n, o);
|
|
46875
46894
|
if (r !== "empty") for (let s = t; s < n; s++) {
|
|
46876
|
-
let t =
|
|
46895
|
+
let t = pM(e[s]?.[o]);
|
|
46877
46896
|
t !== "empty" && (a++, t === r && i++);
|
|
46878
46897
|
}
|
|
46879
46898
|
}
|
|
46880
46899
|
return a === 0 ? 0 : i / a;
|
|
46881
46900
|
}
|
|
46882
|
-
function
|
|
46883
|
-
let t = e.map(
|
|
46901
|
+
function xM(e) {
|
|
46902
|
+
let t = e.map(pM).filter((e) => e !== "empty");
|
|
46884
46903
|
return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
|
|
46885
46904
|
}
|
|
46886
|
-
function
|
|
46887
|
-
|
|
46888
|
-
let n = pM(e);
|
|
46889
|
-
return Math.max(0, 1 - Math.abs(n - t) / t);
|
|
46905
|
+
function SM(e, t) {
|
|
46906
|
+
return t <= 0 ? 0 : Math.min(1, mM(e) / t);
|
|
46890
46907
|
}
|
|
46891
|
-
function
|
|
46908
|
+
function CM(e) {
|
|
46892
46909
|
let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
|
|
46893
46910
|
return t.length === 0 ? 0 : new Set(t).size / t.length;
|
|
46894
46911
|
}
|
|
46895
|
-
function
|
|
46896
|
-
return .45 *
|
|
46912
|
+
function wM(e, t, n, r, i) {
|
|
46913
|
+
return .45 * yM(e, t, n, r) + .25 * bM(e, t + 1, n, r) + .15 * xM(e[t] ?? []) + .1 * SM(e[t] ?? [], i) + .05 * CM(e[t] ?? []);
|
|
46897
46914
|
}
|
|
46898
|
-
function
|
|
46915
|
+
function TM(e, t = 100) {
|
|
46899
46916
|
if (e.length === 0) return {
|
|
46900
46917
|
headerRowIndex: 0,
|
|
46901
46918
|
dataStartIndex: 0,
|
|
@@ -46903,7 +46920,7 @@ function wM(e, t = 100) {
|
|
|
46903
46920
|
mode: "header",
|
|
46904
46921
|
review: { kind: "none" }
|
|
46905
46922
|
};
|
|
46906
|
-
let n = Math.min(t, e.length), r = e.slice(0, n), i = hM(r), a =
|
|
46923
|
+
let n = Math.min(t, e.length), r = e.slice(0, n), i = hM(r), a = gM(r), o = _M(r, a, cM), s = e[o] ?? [], c = yM(e, o, n, i), l = bM(e, o + 1, n, i), u = mM(s) > 0 && xM(s) === 0, d = Math.round(Math.max(0, wM(e, o, n, i, a)) * 100) / 100;
|
|
46907
46924
|
if (u && c <= .15 && l >= .7) return {
|
|
46908
46925
|
headerRowIndex: -1,
|
|
46909
46926
|
dataStartIndex: o,
|
|
@@ -46923,7 +46940,7 @@ function wM(e, t = 100) {
|
|
|
46923
46940
|
review: f
|
|
46924
46941
|
};
|
|
46925
46942
|
}
|
|
46926
|
-
function
|
|
46943
|
+
function EM(e) {
|
|
46927
46944
|
let t = /* @__PURE__ */ new Set();
|
|
46928
46945
|
return e.map((e) => {
|
|
46929
46946
|
let n = e, r = 2;
|
|
@@ -46933,7 +46950,7 @@ function TM(e) {
|
|
|
46933
46950
|
}
|
|
46934
46951
|
//#endregion
|
|
46935
46952
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
|
|
46936
|
-
function
|
|
46953
|
+
function DM(e, t, n, r) {
|
|
46937
46954
|
return (0, y.useMemo)(() => ({
|
|
46938
46955
|
sample: e,
|
|
46939
46956
|
selectedRow: t,
|
|
@@ -46948,20 +46965,20 @@ function EM(e, t, n, r) {
|
|
|
46948
46965
|
}
|
|
46949
46966
|
//#endregion
|
|
46950
46967
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
|
|
46951
|
-
var
|
|
46952
|
-
function
|
|
46953
|
-
let a =
|
|
46954
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
46968
|
+
var OM = (0, y.createContext)(null);
|
|
46969
|
+
function kM({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
|
|
46970
|
+
let a = DM(e, t, n, r);
|
|
46971
|
+
return /* @__PURE__ */ (0, O.jsx)(OM.Provider, {
|
|
46955
46972
|
value: a,
|
|
46956
46973
|
children: i
|
|
46957
46974
|
});
|
|
46958
46975
|
}
|
|
46959
|
-
var
|
|
46960
|
-
let e = (0, y.useContext)(
|
|
46976
|
+
var AM = () => {
|
|
46977
|
+
let e = (0, y.useContext)(OM);
|
|
46961
46978
|
if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
|
|
46962
46979
|
return e;
|
|
46963
|
-
},
|
|
46964
|
-
let { sample: e, selectedRow: t, selectRow: n, noHeader: r } =
|
|
46980
|
+
}, jM = () => {
|
|
46981
|
+
let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = AM(), { headers: i } = ZN(), { headers: a, rows: o } = (0, y.useMemo)(() => {
|
|
46965
46982
|
let t = i.length;
|
|
46966
46983
|
return {
|
|
46967
46984
|
headers: i.map((e) => r ? e : ""),
|
|
@@ -46981,13 +46998,13 @@ var kM = () => {
|
|
|
46981
46998
|
selectedRow: r ? void 0 : t,
|
|
46982
46999
|
onSelectRow: r ? void 0 : n
|
|
46983
47000
|
});
|
|
46984
|
-
},
|
|
46985
|
-
let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } =
|
|
47001
|
+
}, MM = () => {
|
|
47002
|
+
let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = ZN(), i = (0, y.useCallback)((e) => {
|
|
46986
47003
|
r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
|
|
46987
47004
|
}, [r, t]);
|
|
46988
47005
|
if (!t) return null;
|
|
46989
47006
|
let a = t.rawRows.slice(0, 50), o = n < 0;
|
|
46990
|
-
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(
|
|
47007
|
+
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(kM, {
|
|
46991
47008
|
sample: a,
|
|
46992
47009
|
selectedRow: o ? void 0 : n,
|
|
46993
47010
|
selectRow: r,
|
|
@@ -47001,10 +47018,10 @@ var kM = () => {
|
|
|
47001
47018
|
onChange: i,
|
|
47002
47019
|
label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
|
|
47003
47020
|
})
|
|
47004
|
-
}), /* @__PURE__ */ (0, O.jsx)(
|
|
47021
|
+
}), /* @__PURE__ */ (0, O.jsx)(jM, {})]
|
|
47005
47022
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})]
|
|
47006
47023
|
}) }) });
|
|
47007
|
-
},
|
|
47024
|
+
}, NM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
|
|
47008
47025
|
let { t: a } = j();
|
|
47009
47026
|
return /* @__PURE__ */ (0, O.jsx)(vs, {
|
|
47010
47027
|
open: e,
|
|
@@ -47017,13 +47034,13 @@ var kM = () => {
|
|
|
47017
47034
|
onSubmit: i
|
|
47018
47035
|
})
|
|
47019
47036
|
});
|
|
47020
|
-
},
|
|
47037
|
+
}, PM = [
|
|
47021
47038
|
",",
|
|
47022
47039
|
";",
|
|
47023
47040
|
"|",
|
|
47024
47041
|
"\n",
|
|
47025
47042
|
" "
|
|
47026
|
-
],
|
|
47043
|
+
], FM = (e, t, n) => {
|
|
47027
47044
|
let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
|
|
47028
47045
|
if (e.trim() === "") return [];
|
|
47029
47046
|
if (i(e)) return [e.trim()];
|
|
@@ -47035,31 +47052,31 @@ var kM = () => {
|
|
|
47035
47052
|
a.push(e);
|
|
47036
47053
|
continue;
|
|
47037
47054
|
}
|
|
47038
|
-
a.push(...
|
|
47055
|
+
a.push(...IM(e, t, i));
|
|
47039
47056
|
}
|
|
47040
47057
|
}
|
|
47041
47058
|
return a;
|
|
47042
|
-
},
|
|
47043
|
-
for (let r of
|
|
47059
|
+
}, IM = (e, t, n) => {
|
|
47060
|
+
for (let r of PM) {
|
|
47044
47061
|
if (r === t || !e.includes(r)) continue;
|
|
47045
47062
|
let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
|
|
47046
47063
|
if (i.length >= 2 && i.every(n)) return i;
|
|
47047
47064
|
}
|
|
47048
47065
|
return [e];
|
|
47049
|
-
},
|
|
47066
|
+
}, LM = (e, t, n) => {
|
|
47050
47067
|
let r = /* @__PURE__ */ new Set();
|
|
47051
|
-
for (let i of e) if (i !== "") if (n) for (let e of
|
|
47068
|
+
for (let i of e) if (i !== "") if (n) for (let e of FM(i, n, t)) r.add(e);
|
|
47052
47069
|
else r.add(i);
|
|
47053
47070
|
return [...r];
|
|
47054
|
-
},
|
|
47071
|
+
}, RM = (e) => !e.some((e) => e != null && String(e).trim() !== ""), zM = (e, t) => {
|
|
47055
47072
|
let n = 0;
|
|
47056
47073
|
for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
|
|
47057
47074
|
return n;
|
|
47058
|
-
},
|
|
47059
|
-
let r = Math.min(e.length, t +
|
|
47075
|
+
}, BM = 50, VM = (e, t, n) => {
|
|
47076
|
+
let r = Math.min(e.length, t + BM);
|
|
47060
47077
|
for (let i = t; i < r; i++) {
|
|
47061
47078
|
let t = e[i];
|
|
47062
|
-
if (!t ||
|
|
47079
|
+
if (!t || RM(t)) continue;
|
|
47063
47080
|
let r = !0;
|
|
47064
47081
|
for (let e = 0; e < n; e++) {
|
|
47065
47082
|
let n = t[e];
|
|
@@ -47073,60 +47090,64 @@ var kM = () => {
|
|
|
47073
47090
|
return Array.from({ length: n }, (n, i) => {
|
|
47074
47091
|
for (let n = t; n < r; n++) {
|
|
47075
47092
|
let t = e[n];
|
|
47076
|
-
if (!t ||
|
|
47093
|
+
if (!t || RM(t)) continue;
|
|
47077
47094
|
let r = t[i], a = r == null ? "" : String(r).trim();
|
|
47078
47095
|
if (a !== "") return a;
|
|
47079
47096
|
}
|
|
47080
47097
|
return "";
|
|
47081
47098
|
});
|
|
47082
|
-
},
|
|
47099
|
+
}, HM = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, UM = (e, t, n, r) => {
|
|
47083
47100
|
if (t < 0) {
|
|
47084
|
-
let t =
|
|
47101
|
+
let t = zM(e, n), i = VM(e, n, t);
|
|
47085
47102
|
return Array.from({ length: t }, (e, t) => r(t, i[t]));
|
|
47086
47103
|
}
|
|
47087
|
-
|
|
47088
|
-
},
|
|
47104
|
+
let i = e[t] ?? [], a = Math.max(i.length, zM(e, n)), o = VM(e, n, a);
|
|
47105
|
+
return EM(Array.from({ length: a }, (e, t) => {
|
|
47106
|
+
let n = String(i[t] ?? "").trim();
|
|
47107
|
+
return n === "" ? r(t, o[t]) : n;
|
|
47108
|
+
}));
|
|
47109
|
+
}, WM = () => ({
|
|
47089
47110
|
headerRowIndex: 0,
|
|
47090
47111
|
dataStartIndex: 1,
|
|
47091
47112
|
confidence: 1,
|
|
47092
47113
|
mode: "header",
|
|
47093
47114
|
review: { kind: "none" }
|
|
47094
|
-
}),
|
|
47115
|
+
}), GM = (e, t) => {
|
|
47095
47116
|
let n = [e];
|
|
47096
47117
|
for (let r of t) n.push(e.map((e) => r[e] ?? ""));
|
|
47097
47118
|
return n;
|
|
47098
|
-
},
|
|
47119
|
+
}, KM = (e) => {
|
|
47099
47120
|
let t = /* @__PURE__ */ new Map();
|
|
47100
47121
|
for (let n = 0; n < e.length; n++) t.set(e[n], n);
|
|
47101
47122
|
return t;
|
|
47102
|
-
},
|
|
47123
|
+
}, qM = (e, t, n) => {
|
|
47103
47124
|
let r = [];
|
|
47104
47125
|
for (let i = t; i < e.length; i++) {
|
|
47105
47126
|
let t = e[i];
|
|
47106
|
-
if (
|
|
47127
|
+
if (RM(t)) continue;
|
|
47107
47128
|
let a = t[n], o = a == null ? "" : String(a);
|
|
47108
47129
|
o !== "" && r.push(o);
|
|
47109
47130
|
}
|
|
47110
47131
|
return r;
|
|
47111
|
-
},
|
|
47132
|
+
}, JM = (e, t) => {
|
|
47112
47133
|
let n = {};
|
|
47113
47134
|
for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
|
|
47114
47135
|
return n;
|
|
47115
|
-
},
|
|
47136
|
+
}, YM = (e, t, n, r) => {
|
|
47116
47137
|
let i = [];
|
|
47117
|
-
for (let a = n; a < e.length && i.length < r; a++)
|
|
47138
|
+
for (let a = n; a < e.length && i.length < r; a++) RM(e[a]) || i.push(JM(e[a], t));
|
|
47118
47139
|
return i;
|
|
47119
|
-
},
|
|
47120
|
-
let { columns: e } = th(), { t } = j(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: f, addPendingOption: p } =
|
|
47140
|
+
}, XM = () => {
|
|
47141
|
+
let { columns: e } = th(), { t } = j(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: f, addPendingOption: p } = ZN(), [m, h] = (0, y.useState)({}), [g, _] = (0, y.useState)({}), [v, b] = (0, y.useState)(null), x = (0, y.useRef)(!1), S = (0, y.useMemo)(() => {
|
|
47121
47142
|
if (!n) return [];
|
|
47122
|
-
let t = [], s =
|
|
47143
|
+
let t = [], s = KM(r);
|
|
47123
47144
|
for (let [r, c] of Object.entries(a)) {
|
|
47124
47145
|
if (!c) continue;
|
|
47125
47146
|
let a = e.find((e) => e.id === c);
|
|
47126
47147
|
if (!a?.editor) continue;
|
|
47127
47148
|
let u = a.editor.type;
|
|
47128
47149
|
if (u !== "select" && u !== "multiselect") continue;
|
|
47129
|
-
let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g =
|
|
47150
|
+
let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = LM(h === void 0 ? [] : qM(n.rawRows, i, h), d, m).map((e) => ({
|
|
47130
47151
|
imported: e,
|
|
47131
47152
|
mapped: f[e]
|
|
47132
47153
|
}));
|
|
@@ -47249,20 +47270,20 @@ var kM = () => {
|
|
|
47249
47270
|
submitCreate: F,
|
|
47250
47271
|
closeCreate: I
|
|
47251
47272
|
};
|
|
47252
|
-
},
|
|
47253
|
-
function
|
|
47254
|
-
let t =
|
|
47255
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
47273
|
+
}, ZM = (0, y.createContext)(null);
|
|
47274
|
+
function QM({ children: e }) {
|
|
47275
|
+
let t = XM();
|
|
47276
|
+
return /* @__PURE__ */ (0, O.jsx)(ZM.Provider, {
|
|
47256
47277
|
value: t,
|
|
47257
47278
|
children: e
|
|
47258
47279
|
});
|
|
47259
47280
|
}
|
|
47260
|
-
var
|
|
47261
|
-
let e = (0, y.useContext)(
|
|
47281
|
+
var $M = () => {
|
|
47282
|
+
let e = (0, y.useContext)(ZM);
|
|
47262
47283
|
if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
|
|
47263
47284
|
return e;
|
|
47264
|
-
},
|
|
47265
|
-
let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } =
|
|
47285
|
+
}, eN = ({ section: e }) => {
|
|
47286
|
+
let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = $M(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = (0, y.useCallback)((t) => i(e.columnId, t), [i, e.columnId]), l = (0, y.useCallback)(() => a(e.columnId), [a, e.columnId]);
|
|
47266
47287
|
return /* @__PURE__ */ (0, O.jsxs)("header", {
|
|
47267
47288
|
className: "updog__value-matching__section-header",
|
|
47268
47289
|
children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -47287,7 +47308,8 @@ var QM = () => {
|
|
|
47287
47308
|
onChange: c,
|
|
47288
47309
|
checkboxPosition: "end",
|
|
47289
47310
|
label: t("dataEditor.uploader.matchValues.showMatched"),
|
|
47290
|
-
size: "sm"
|
|
47311
|
+
size: "sm",
|
|
47312
|
+
className: "updog__value-matching__show-matched"
|
|
47291
47313
|
})]
|
|
47292
47314
|
})
|
|
47293
47315
|
}), /* @__PURE__ */ (0, O.jsx)(Hs, {
|
|
@@ -47306,14 +47328,14 @@ var QM = () => {
|
|
|
47306
47328
|
})
|
|
47307
47329
|
})]
|
|
47308
47330
|
});
|
|
47309
|
-
},
|
|
47331
|
+
}, tN = {
|
|
47310
47332
|
",": ",",
|
|
47311
47333
|
";": ";",
|
|
47312
47334
|
"|": "|",
|
|
47313
47335
|
"\n": "\\n",
|
|
47314
47336
|
" ": "\\t"
|
|
47315
|
-
},
|
|
47316
|
-
let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } =
|
|
47337
|
+
}, nN = (e) => e === null ? "" : tN[e] ?? e, rN = ({ section: e }) => {
|
|
47338
|
+
let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } = $M(), i = (0, y.useRef)(e.delimiter), a = nN(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = gc(o, 300), l = (0, y.useRef)(a);
|
|
47317
47339
|
(0, y.useEffect)(() => {
|
|
47318
47340
|
s(a), l.current = a;
|
|
47319
47341
|
}, [a]), (0, y.useEffect)(() => {
|
|
@@ -47356,8 +47378,8 @@ var QM = () => {
|
|
|
47356
47378
|
})
|
|
47357
47379
|
]
|
|
47358
47380
|
});
|
|
47359
|
-
},
|
|
47360
|
-
let { t: n } = j(), { getSelectOptions: r, selectValue: i } =
|
|
47381
|
+
}, iN = ({ section: e, val: t }) => {
|
|
47382
|
+
let { t: n } = j(), { getSelectOptions: r, selectValue: i } = $M(), a = t.mapped === void 0, o = (0, y.useCallback)((n) => i(e.columnId, t.imported, n), [
|
|
47361
47383
|
i,
|
|
47362
47384
|
e.columnId,
|
|
47363
47385
|
t.imported
|
|
@@ -47409,8 +47431,8 @@ var QM = () => {
|
|
|
47409
47431
|
})
|
|
47410
47432
|
]
|
|
47411
47433
|
});
|
|
47412
|
-
},
|
|
47413
|
-
let { t } = j(), { getVisibleValues: n } =
|
|
47434
|
+
}, aN = ({ section: e }) => {
|
|
47435
|
+
let { t } = j(), { getVisibleValues: n } = $M(), r = n(e);
|
|
47414
47436
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47415
47437
|
className: "updog__value-matching__table",
|
|
47416
47438
|
children: [r.length === 0 ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -47430,7 +47452,7 @@ var QM = () => {
|
|
|
47430
47452
|
size: "sm",
|
|
47431
47453
|
weight: "medium",
|
|
47432
47454
|
children: t("dataEditor.uploader.matchValues.importedValues")
|
|
47433
|
-
}), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(
|
|
47455
|
+
}), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(rN, { section: e })]
|
|
47434
47456
|
}),
|
|
47435
47457
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__arrow-spacer" }),
|
|
47436
47458
|
/* @__PURE__ */ (0, O.jsx)(W, {
|
|
@@ -47442,25 +47464,25 @@ var QM = () => {
|
|
|
47442
47464
|
}),
|
|
47443
47465
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__action" })
|
|
47444
47466
|
]
|
|
47445
|
-
}), r.map((t) => /* @__PURE__ */ (0, O.jsx)(
|
|
47467
|
+
}), r.map((t) => /* @__PURE__ */ (0, O.jsx)(iN, {
|
|
47446
47468
|
section: e,
|
|
47447
47469
|
val: t
|
|
47448
47470
|
}, t.imported))]
|
|
47449
47471
|
});
|
|
47450
|
-
},
|
|
47451
|
-
let { isCollapsed: t } =
|
|
47472
|
+
}, oN = ({ section: e }) => {
|
|
47473
|
+
let { isCollapsed: t } = $M(), n = !t(e.columnId);
|
|
47452
47474
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47453
47475
|
className: "updog__value-matching__section",
|
|
47454
|
-
children: [/* @__PURE__ */ (0, O.jsx)(
|
|
47476
|
+
children: [/* @__PURE__ */ (0, O.jsx)(eN, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47455
47477
|
className: N("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
|
|
47456
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
47478
|
+
children: /* @__PURE__ */ (0, O.jsx)(aN, { section: e })
|
|
47457
47479
|
})]
|
|
47458
47480
|
});
|
|
47459
|
-
},
|
|
47460
|
-
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } =
|
|
47481
|
+
}, sN = () => {
|
|
47482
|
+
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = $M();
|
|
47461
47483
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47462
47484
|
className: "updog__value-matching",
|
|
47463
|
-
children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47485
|
+
children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(oN, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(NM, {
|
|
47464
47486
|
open: !0,
|
|
47465
47487
|
existingOptions: n,
|
|
47466
47488
|
initialName: r,
|
|
@@ -47468,15 +47490,15 @@ var QM = () => {
|
|
|
47468
47490
|
onSubmit: i
|
|
47469
47491
|
})]
|
|
47470
47492
|
});
|
|
47471
|
-
},
|
|
47493
|
+
}, cN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47472
47494
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
47473
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
47474
|
-
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }),
|
|
47475
|
-
let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } =
|
|
47495
|
+
children: /* @__PURE__ */ (0, O.jsx)(QM, { children: /* @__PURE__ */ (0, O.jsx)(sN, {}) })
|
|
47496
|
+
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), lN = 20, uN = () => {
|
|
47497
|
+
let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = ZN(), l = e.isClient(), u = (0, y.useCallback)(() => r(null), [r]), d = (0, y.useMemo)(() => {
|
|
47476
47498
|
let e = {};
|
|
47477
47499
|
for (let [t, n] of Object.entries(s)) n && (e[n] = t);
|
|
47478
47500
|
return e;
|
|
47479
|
-
}, [s]), f = (0, y.useMemo)(() => i ?
|
|
47501
|
+
}, [s]), f = (0, y.useMemo)(() => i ? YM(i.rawRows, a, o, lN) : [], [
|
|
47480
47502
|
i,
|
|
47481
47503
|
a,
|
|
47482
47504
|
o
|
|
@@ -47528,8 +47550,8 @@ var QM = () => {
|
|
|
47528
47550
|
}, e.id);
|
|
47529
47551
|
})]
|
|
47530
47552
|
});
|
|
47531
|
-
},
|
|
47532
|
-
let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = th(), i = t === !1 ? [] : t, { t: a } = j(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: f, handleRemoteSourceSelect: p } =
|
|
47553
|
+
}, dN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(uN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), fN = () => {
|
|
47554
|
+
let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = th(), i = t === !1 ? [] : t, { t: a } = j(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: f, handleRemoteSourceSelect: p } = ZN(), m = [
|
|
47533
47555
|
{
|
|
47534
47556
|
id: "csv",
|
|
47535
47557
|
format: "csv",
|
|
@@ -47587,20 +47609,20 @@ var QM = () => {
|
|
|
47587
47609
|
}, [c]),
|
|
47588
47610
|
handleRemoteSourceSelect: p
|
|
47589
47611
|
};
|
|
47590
|
-
},
|
|
47591
|
-
function
|
|
47592
|
-
let t =
|
|
47593
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
47612
|
+
}, pN = (0, y.createContext)(null);
|
|
47613
|
+
function mN({ children: e }) {
|
|
47614
|
+
let t = fN();
|
|
47615
|
+
return /* @__PURE__ */ (0, O.jsx)(pN.Provider, {
|
|
47594
47616
|
value: t,
|
|
47595
47617
|
children: e
|
|
47596
47618
|
});
|
|
47597
47619
|
}
|
|
47598
|
-
var
|
|
47599
|
-
let e = (0, y.useContext)(
|
|
47620
|
+
var hN = () => {
|
|
47621
|
+
let e = (0, y.useContext)(pN);
|
|
47600
47622
|
if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
|
|
47601
47623
|
return e;
|
|
47602
|
-
},
|
|
47603
|
-
let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } =
|
|
47624
|
+
}, gN = () => {
|
|
47625
|
+
let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } = hN();
|
|
47604
47626
|
return /* @__PURE__ */ (0, O.jsx)(fc, {
|
|
47605
47627
|
options: t,
|
|
47606
47628
|
onSelect: n,
|
|
@@ -47612,7 +47634,7 @@ var mN = () => {
|
|
|
47612
47634
|
children: e("dataEditor.uploader.uploadFile.downloadExample")
|
|
47613
47635
|
})
|
|
47614
47636
|
});
|
|
47615
|
-
},
|
|
47637
|
+
}, _N = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
|
|
47616
47638
|
className: "updog__remote-source-btn__icon",
|
|
47617
47639
|
dangerouslySetInnerHTML: { __html: e.icon }
|
|
47618
47640
|
}) : /* @__PURE__ */ (0, O.jsx)("span", {
|
|
@@ -47621,7 +47643,7 @@ var mN = () => {
|
|
|
47621
47643
|
src: e.icon,
|
|
47622
47644
|
alt: e.label
|
|
47623
47645
|
})
|
|
47624
|
-
}),
|
|
47646
|
+
}), vN = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
47625
47647
|
variant: "filled",
|
|
47626
47648
|
color: "neutral",
|
|
47627
47649
|
size: "sm",
|
|
@@ -47631,11 +47653,11 @@ var mN = () => {
|
|
|
47631
47653
|
disabled: !t && n,
|
|
47632
47654
|
loading: t,
|
|
47633
47655
|
spinnerPosition: "start",
|
|
47634
|
-
startIcon: /* @__PURE__ */ (0, O.jsx)(
|
|
47656
|
+
startIcon: /* @__PURE__ */ (0, O.jsx)(_N, { source: e }),
|
|
47635
47657
|
title: e.description,
|
|
47636
47658
|
children: e.label
|
|
47637
|
-
}),
|
|
47638
|
-
let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } =
|
|
47659
|
+
}), yN = () => {
|
|
47660
|
+
let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = hN(), o = n.length > 0;
|
|
47639
47661
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47640
47662
|
className: "updog__source-picker",
|
|
47641
47663
|
children: [
|
|
@@ -47662,7 +47684,7 @@ var mN = () => {
|
|
|
47662
47684
|
}),
|
|
47663
47685
|
o && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(ac, {}), /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47664
47686
|
className: "updog__source-picker__sources-list",
|
|
47665
|
-
children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47687
|
+
children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(vN, {
|
|
47666
47688
|
source: e,
|
|
47667
47689
|
loading: r === e.id,
|
|
47668
47690
|
disabled: !!r,
|
|
@@ -47676,7 +47698,7 @@ var mN = () => {
|
|
|
47676
47698
|
})
|
|
47677
47699
|
]
|
|
47678
47700
|
});
|
|
47679
|
-
},
|
|
47701
|
+
}, bN = () => {
|
|
47680
47702
|
let { t: e } = j();
|
|
47681
47703
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47682
47704
|
className: "updog__uploading-state",
|
|
@@ -47689,12 +47711,12 @@ var mN = () => {
|
|
|
47689
47711
|
children: e("dataEditor.uploader.uploadFile.uploading")
|
|
47690
47712
|
})]
|
|
47691
47713
|
});
|
|
47692
|
-
},
|
|
47693
|
-
let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } =
|
|
47714
|
+
}, xN = () => {
|
|
47715
|
+
let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = hN();
|
|
47694
47716
|
return /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47695
47717
|
className: N("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
|
|
47696
47718
|
onClick: t ? void 0 : a,
|
|
47697
|
-
children: n ? /* @__PURE__ */ (0, O.jsx)(
|
|
47719
|
+
children: n ? /* @__PURE__ */ (0, O.jsx)(bN, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
|
|
47698
47720
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47699
47721
|
className: "updog__step-select-files__icon-container",
|
|
47700
47722
|
children: r ? /* @__PURE__ */ (0, O.jsx)(oe, {
|
|
@@ -47705,7 +47727,7 @@ var mN = () => {
|
|
|
47705
47727
|
className: "updog__step-select-files__icon"
|
|
47706
47728
|
})
|
|
47707
47729
|
}),
|
|
47708
|
-
!r && /* @__PURE__ */ (0, O.jsx)(
|
|
47730
|
+
!r && /* @__PURE__ */ (0, O.jsx)(yN, {}),
|
|
47709
47731
|
r && /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47710
47732
|
className: "updog__step-select-files__info",
|
|
47711
47733
|
children: [/* @__PURE__ */ (0, O.jsx)(W, {
|
|
@@ -47722,19 +47744,19 @@ var mN = () => {
|
|
|
47722
47744
|
})
|
|
47723
47745
|
] })
|
|
47724
47746
|
});
|
|
47725
|
-
},
|
|
47726
|
-
let { getRootProps: e, getInputProps: t, isDragActive: n } =
|
|
47747
|
+
}, SN = () => {
|
|
47748
|
+
let { getRootProps: e, getInputProps: t, isDragActive: n } = hN();
|
|
47727
47749
|
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47728
47750
|
className: "updog__step-select-files__dropzone",
|
|
47729
47751
|
...e(),
|
|
47730
47752
|
children: [
|
|
47731
47753
|
/* @__PURE__ */ (0, O.jsx)("input", { ...t() }),
|
|
47732
|
-
/* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(
|
|
47754
|
+
/* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(xN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(gN, {}) })] }),
|
|
47733
47755
|
n && /* @__PURE__ */ (0, O.jsx)(oh, {})
|
|
47734
47756
|
]
|
|
47735
47757
|
}) });
|
|
47736
|
-
},
|
|
47737
|
-
let { selectedSheet: t, setSelectedSheet: n } =
|
|
47758
|
+
}, CN = () => /* @__PURE__ */ (0, O.jsx)(mN, { children: /* @__PURE__ */ (0, O.jsx)(SN, {}) }), wN = ({ preview: e }) => {
|
|
47759
|
+
let { selectedSheet: t, setSelectedSheet: n } = ZN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
|
|
47738
47760
|
let { headers: t, rows: n } = e;
|
|
47739
47761
|
return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
|
|
47740
47762
|
}, [e]);
|
|
@@ -47770,16 +47792,16 @@ var mN = () => {
|
|
|
47770
47792
|
})]
|
|
47771
47793
|
})
|
|
47772
47794
|
});
|
|
47773
|
-
},
|
|
47774
|
-
let { sheetPreviews: e } =
|
|
47795
|
+
}, TN = () => {
|
|
47796
|
+
let { sheetPreviews: e } = ZN();
|
|
47775
47797
|
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47776
47798
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
47777
47799
|
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47778
47800
|
className: "updog__sheet-preview-grid",
|
|
47779
|
-
children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47801
|
+
children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(wN, { preview: e }, e.name))
|
|
47780
47802
|
})
|
|
47781
47803
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) });
|
|
47782
|
-
},
|
|
47804
|
+
}, EN = (e, t, n) => {
|
|
47783
47805
|
let r = new Map(t.map((e) => [e.id, e])), i = [];
|
|
47784
47806
|
for (let [t, a] of Object.entries(e)) a && i.push({
|
|
47785
47807
|
csvHeader: t,
|
|
@@ -47787,11 +47809,11 @@ var mN = () => {
|
|
|
47787
47809
|
column: n.has(a) ? void 0 : r.get(a)
|
|
47788
47810
|
});
|
|
47789
47811
|
return i;
|
|
47790
|
-
},
|
|
47812
|
+
}, DN = (e) => {
|
|
47791
47813
|
let t = [];
|
|
47792
47814
|
for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
|
|
47793
47815
|
return t;
|
|
47794
|
-
},
|
|
47816
|
+
}, ON = (e, t, n) => {
|
|
47795
47817
|
let r = {};
|
|
47796
47818
|
for (let { csvHeader: i, columnId: a, column: o } of t) {
|
|
47797
47819
|
let t = e[i] ?? "";
|
|
@@ -47806,7 +47828,7 @@ var mN = () => {
|
|
|
47806
47828
|
continue;
|
|
47807
47829
|
}
|
|
47808
47830
|
if (s === "multiselect") {
|
|
47809
|
-
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ?
|
|
47831
|
+
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? FM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
|
|
47810
47832
|
for (let e of s) {
|
|
47811
47833
|
let t = n.valueMapping[a]?.[e.trim()];
|
|
47812
47834
|
t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
|
|
@@ -47818,16 +47840,16 @@ var mN = () => {
|
|
|
47818
47840
|
r[a] = o.transformer ? o.transformer(c) : c;
|
|
47819
47841
|
}
|
|
47820
47842
|
return r;
|
|
47821
|
-
},
|
|
47843
|
+
}, kN = 200, AN = (e, t, n) => {
|
|
47822
47844
|
if (n) return n;
|
|
47823
47845
|
let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
|
|
47824
47846
|
for (let t of e) {
|
|
47825
47847
|
let e = t.trim();
|
|
47826
|
-
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >=
|
|
47848
|
+
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= kN)) break;
|
|
47827
47849
|
}
|
|
47828
47850
|
if (o.length === 0) return null;
|
|
47829
47851
|
let s = null, c = 0, l = 0;
|
|
47830
|
-
for (let e of
|
|
47852
|
+
for (let e of PM) {
|
|
47831
47853
|
let n = 0, r = 0;
|
|
47832
47854
|
for (let a of o) {
|
|
47833
47855
|
if (i(a) || !a.includes(e)) continue;
|
|
@@ -47840,7 +47862,7 @@ var mN = () => {
|
|
|
47840
47862
|
(n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
|
|
47841
47863
|
}
|
|
47842
47864
|
return c > 0 ? s : null;
|
|
47843
|
-
},
|
|
47865
|
+
}, jN = (e) => {
|
|
47844
47866
|
let t = /* @__PURE__ */ new Map();
|
|
47845
47867
|
for (let [n, r] of Object.entries(e)) {
|
|
47846
47868
|
let e = Pj(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
@@ -47848,8 +47870,8 @@ var mN = () => {
|
|
|
47848
47870
|
t.set(e, i);
|
|
47849
47871
|
}
|
|
47850
47872
|
return t;
|
|
47851
|
-
},
|
|
47852
|
-
let i =
|
|
47873
|
+
}, MN = (e, t, n, r) => {
|
|
47874
|
+
let i = jN(r), a = (e, t) => i.get(Pj(e))?.has(Pj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
|
|
47853
47875
|
if (Pj(n) === Pj(r) || a(r, n)) return;
|
|
47854
47876
|
let i = `${n} ${r}`;
|
|
47855
47877
|
t.has(i) || (t.add(i), e.push({
|
|
@@ -47869,16 +47891,16 @@ var mN = () => {
|
|
|
47869
47891
|
for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
|
|
47870
47892
|
return c;
|
|
47871
47893
|
};
|
|
47872
|
-
function
|
|
47894
|
+
function NN(e, t, n) {
|
|
47873
47895
|
let r = e.length, i = t;
|
|
47874
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
47896
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? PN(i, i - r) : PN(r - 1, i - 1)) > 1e3 ? [] : r < i ? FN(e, i) : IN(e, i, n);
|
|
47875
47897
|
}
|
|
47876
|
-
function
|
|
47898
|
+
function PN(e, t) {
|
|
47877
47899
|
let n = Math.min(t, e - t), r = 1;
|
|
47878
47900
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
47879
47901
|
return r;
|
|
47880
47902
|
}
|
|
47881
|
-
function
|
|
47903
|
+
function FN(e, t) {
|
|
47882
47904
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
47883
47905
|
if (i.length === n) {
|
|
47884
47906
|
let a = Array(t).fill("");
|
|
@@ -47890,7 +47912,7 @@ function PN(e, t) {
|
|
|
47890
47912
|
};
|
|
47891
47913
|
return a(0), r;
|
|
47892
47914
|
}
|
|
47893
|
-
function
|
|
47915
|
+
function IN(e, t, n) {
|
|
47894
47916
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
47895
47917
|
if (a.length === t - 1) {
|
|
47896
47918
|
let o = [
|
|
@@ -47908,27 +47930,27 @@ function FN(e, t, n) {
|
|
|
47908
47930
|
}
|
|
47909
47931
|
//#endregion
|
|
47910
47932
|
//#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
|
|
47911
|
-
var
|
|
47912
|
-
function
|
|
47933
|
+
var LN = {};
|
|
47934
|
+
function RN(e, t) {
|
|
47913
47935
|
for (let n of t.validators ?? []) if (n.type !== "expression") {
|
|
47914
47936
|
if (n.type === "function") {
|
|
47915
|
-
if (n.fn(e,
|
|
47937
|
+
if (n.fn(e, LN) != null) return !1;
|
|
47916
47938
|
continue;
|
|
47917
47939
|
}
|
|
47918
|
-
if (Bm(n, e,
|
|
47940
|
+
if (Bm(n, e, LN) != null) return !1;
|
|
47919
47941
|
}
|
|
47920
47942
|
return !0;
|
|
47921
47943
|
}
|
|
47922
|
-
function
|
|
47923
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
47944
|
+
function zN(e, t) {
|
|
47945
|
+
for (let n = 0; n < t.length; n++) if (!RN(e.cells[n] ?? "", t[n])) return !1;
|
|
47924
47946
|
return !0;
|
|
47925
47947
|
}
|
|
47926
|
-
function
|
|
47927
|
-
return e.filter((e) =>
|
|
47948
|
+
function BN(e, t) {
|
|
47949
|
+
return e.filter((e) => zN(e, t));
|
|
47928
47950
|
}
|
|
47929
47951
|
//#endregion
|
|
47930
47952
|
//#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
|
|
47931
|
-
function
|
|
47953
|
+
function VN(e) {
|
|
47932
47954
|
if (e.length <= 1) return [];
|
|
47933
47955
|
let t = e[0].cells.length, n = [], r = -1;
|
|
47934
47956
|
for (let i = 0; i < t; i++) {
|
|
@@ -47945,25 +47967,25 @@ function BN(e) {
|
|
|
47945
47967
|
}
|
|
47946
47968
|
//#endregion
|
|
47947
47969
|
//#region src/components/DataUploader/utils/raggedRows/alignRow.ts
|
|
47948
|
-
function
|
|
47949
|
-
let r =
|
|
47970
|
+
function HN(e, t, n) {
|
|
47971
|
+
let r = NN(e, t.length, n), i = BN(r, t);
|
|
47950
47972
|
return i.length === 1 ? {
|
|
47951
47973
|
kind: "confident",
|
|
47952
47974
|
alignment: i[0]
|
|
47953
47975
|
} : i.length > 1 ? {
|
|
47954
47976
|
kind: "ambiguous",
|
|
47955
47977
|
candidates: i,
|
|
47956
|
-
disputeSpans:
|
|
47978
|
+
disputeSpans: VN(i)
|
|
47957
47979
|
} : {
|
|
47958
47980
|
kind: "invalid",
|
|
47959
47981
|
candidates: r,
|
|
47960
|
-
disputeSpans:
|
|
47982
|
+
disputeSpans: VN(r)
|
|
47961
47983
|
};
|
|
47962
47984
|
}
|
|
47963
47985
|
//#endregion
|
|
47964
47986
|
//#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
|
|
47965
|
-
function
|
|
47966
|
-
let r =
|
|
47987
|
+
function UN(e, t, n) {
|
|
47988
|
+
let r = HN(e, t, n);
|
|
47967
47989
|
if (r.kind === "confident") return {
|
|
47968
47990
|
cells: r.alignment.cells,
|
|
47969
47991
|
conflictColumns: []
|
|
@@ -47982,20 +48004,20 @@ function HN(e, t, n) {
|
|
|
47982
48004
|
}
|
|
47983
48005
|
//#endregion
|
|
47984
48006
|
//#region src/components/DataUploader/context/useViewModel.tsx
|
|
47985
|
-
var
|
|
48007
|
+
var WN = 5e3, GN = 15, KN = 20, qN = new Set([
|
|
47986
48008
|
"xlsx",
|
|
47987
48009
|
"xls",
|
|
47988
48010
|
"xlsb",
|
|
47989
48011
|
"ods"
|
|
47990
48012
|
]);
|
|
47991
|
-
function
|
|
48013
|
+
function JN() {
|
|
47992
48014
|
let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = th(), { t: f } = j(), [p, m] = (0, y.useState)(0), [h, g] = (0, y.useState)(0), [_, v] = (0, y.useState)(null), [b, x] = (0, y.useState)({}), S = (0, y.useMemo)(() => {
|
|
47993
48015
|
let e = new Set(Object.values(b).filter(Boolean));
|
|
47994
48016
|
return n.filter((t) => t.unique && e.has(t.id));
|
|
47995
48017
|
}, [b, n]), [C, w] = (0, y.useState)(() => r), [T, E] = (0, y.useState)(!1), [D, k] = (0, y.useState)(!1), [A, M] = (0, y.useState)(null), [N, P] = (0, y.useState)([]), [F, I] = (0, y.useState)(null), [L, R] = (0, y.useState)([]), [ee, z] = (0, y.useState)({}), [B, V] = (0, y.useState)([]), [H, te] = (0, y.useState)({}), ne = (0, y.useRef)(null), [re, ie] = (0, y.useState)(-1), ae = (0, y.useCallback)((e, t) => t ? f("dataEditor.uploader.matchColumns.syntheticColumnValue", {
|
|
47996
48018
|
index: e + 1,
|
|
47997
48019
|
value: t
|
|
47998
|
-
}) : f("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [f]), oe = (0, y.useMemo)(() => _ ?
|
|
48020
|
+
}) : f("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [f]), oe = (0, y.useMemo)(() => _ ? HM(_.detection, re) : 0, [_, re]), U = (0, y.useMemo)(() => _ ? UM(_.rawRows, re, oe, ae) : [], [
|
|
47999
48021
|
_,
|
|
48000
48022
|
re,
|
|
48001
48023
|
oe,
|
|
@@ -48013,16 +48035,16 @@ function qN() {
|
|
|
48013
48035
|
let e = [{
|
|
48014
48036
|
id: "select-files",
|
|
48015
48037
|
title: f("dataEditor.uploader.steps.selectFiles"),
|
|
48016
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48038
|
+
content: /* @__PURE__ */ (0, O.jsx)(CN, {})
|
|
48017
48039
|
}];
|
|
48018
48040
|
return N.length > 1 && e.push({
|
|
48019
48041
|
id: "sheet-selection",
|
|
48020
48042
|
title: f("dataEditor.uploader.steps.sheetSelection"),
|
|
48021
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48043
|
+
content: /* @__PURE__ */ (0, O.jsx)(TN, {})
|
|
48022
48044
|
}), _ && _.detection.review.kind !== "none" && e.push({
|
|
48023
48045
|
id: "header-selection",
|
|
48024
48046
|
title: f("dataEditor.uploader.steps.headerSelection"),
|
|
48025
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48047
|
+
content: /* @__PURE__ */ (0, O.jsx)(MM, {})
|
|
48026
48048
|
}), e.push({
|
|
48027
48049
|
id: "column-matching",
|
|
48028
48050
|
title: f("dataEditor.uploader.steps.matchColumns"),
|
|
@@ -48030,11 +48052,11 @@ function qN() {
|
|
|
48030
48052
|
}), ue && e.push({
|
|
48031
48053
|
id: "match-values",
|
|
48032
48054
|
title: f("dataEditor.uploader.steps.matchValues"),
|
|
48033
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48055
|
+
content: /* @__PURE__ */ (0, O.jsx)(cN, {})
|
|
48034
48056
|
}), S.length > 0 && de && e.push({
|
|
48035
48057
|
id: "primary-key",
|
|
48036
48058
|
title: f("dataEditor.uploader.steps.primaryKey"),
|
|
48037
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48059
|
+
content: /* @__PURE__ */ (0, O.jsx)(dN, {})
|
|
48038
48060
|
}), e;
|
|
48039
48061
|
}, [
|
|
48040
48062
|
S.length,
|
|
@@ -48078,7 +48100,7 @@ function qN() {
|
|
|
48078
48100
|
sheetName: F
|
|
48079
48101
|
}).then((e) => {
|
|
48080
48102
|
if (e.kind !== "rows") return;
|
|
48081
|
-
let t =
|
|
48103
|
+
let t = TM(e.rows);
|
|
48082
48104
|
ie(t.headerRowIndex), ve({
|
|
48083
48105
|
fileName: A.name,
|
|
48084
48106
|
rawRows: e.rows,
|
|
@@ -48102,7 +48124,7 @@ function qN() {
|
|
|
48102
48124
|
E(!1);
|
|
48103
48125
|
return;
|
|
48104
48126
|
}
|
|
48105
|
-
let n =
|
|
48127
|
+
let n = TM(e.rows);
|
|
48106
48128
|
if (ie(n.headerRowIndex), ve({
|
|
48107
48129
|
fileName: t.name,
|
|
48108
48130
|
rawRows: e.rows,
|
|
@@ -48136,8 +48158,8 @@ function qN() {
|
|
|
48136
48158
|
if (e.kind !== "records") return;
|
|
48137
48159
|
ie(0), ve({
|
|
48138
48160
|
fileName: t.name,
|
|
48139
|
-
rawRows:
|
|
48140
|
-
detection:
|
|
48161
|
+
rawRows: GM(e.headers, e.rows),
|
|
48162
|
+
detection: WM()
|
|
48141
48163
|
});
|
|
48142
48164
|
} catch (t) {
|
|
48143
48165
|
E(!1), e.errorHandler.handleError({
|
|
@@ -48158,8 +48180,8 @@ function qN() {
|
|
|
48158
48180
|
if (e.kind !== "records") return;
|
|
48159
48181
|
ie(0), ve({
|
|
48160
48182
|
fileName: t.name,
|
|
48161
|
-
rawRows:
|
|
48162
|
-
detection:
|
|
48183
|
+
rawRows: GM(e.headers, e.rows),
|
|
48184
|
+
detection: WM()
|
|
48163
48185
|
});
|
|
48164
48186
|
} catch (t) {
|
|
48165
48187
|
E(!1), e.errorHandler.handleError({
|
|
@@ -48178,11 +48200,11 @@ function qN() {
|
|
|
48178
48200
|
le.parse(t, { format: "xlsx" }).then((e) => {
|
|
48179
48201
|
if (e.kind === "sheets") {
|
|
48180
48202
|
let n = e.sheets.map((e) => {
|
|
48181
|
-
let t =
|
|
48203
|
+
let t = TM(e.rows), n = HM(t, t.headerRowIndex), r = UM(e.rows, t.headerRowIndex, n, ae);
|
|
48182
48204
|
return {
|
|
48183
48205
|
name: e.name,
|
|
48184
48206
|
headers: r,
|
|
48185
|
-
rows:
|
|
48207
|
+
rows: YM(e.rows, r, n, GN),
|
|
48186
48208
|
totalRows: e.totalRows - 1
|
|
48187
48209
|
};
|
|
48188
48210
|
});
|
|
@@ -48190,7 +48212,7 @@ function qN() {
|
|
|
48190
48212
|
return;
|
|
48191
48213
|
}
|
|
48192
48214
|
if (e.kind !== "rows") return;
|
|
48193
|
-
let n =
|
|
48215
|
+
let n = TM(e.rows);
|
|
48194
48216
|
ie(n.headerRowIndex), ve({
|
|
48195
48217
|
fileName: t.name,
|
|
48196
48218
|
rawRows: e.rows,
|
|
@@ -48215,7 +48237,7 @@ function qN() {
|
|
|
48215
48237
|
]), De = (0, y.useCallback)((e) => {
|
|
48216
48238
|
E(!0), ne.current = e;
|
|
48217
48239
|
let t = e.name.split(".").pop()?.toLowerCase();
|
|
48218
|
-
t &&
|
|
48240
|
+
t && qN.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
|
|
48219
48241
|
}, [
|
|
48220
48242
|
Ce,
|
|
48221
48243
|
we,
|
|
@@ -48252,8 +48274,8 @@ function qN() {
|
|
|
48252
48274
|
});
|
|
48253
48275
|
ie(0), ve({
|
|
48254
48276
|
fileName: e.label,
|
|
48255
|
-
rawRows:
|
|
48256
|
-
detection:
|
|
48277
|
+
rawRows: GM(n, r),
|
|
48278
|
+
detection: WM()
|
|
48257
48279
|
});
|
|
48258
48280
|
}
|
|
48259
48281
|
} catch (e) {
|
|
@@ -48281,7 +48303,7 @@ function qN() {
|
|
|
48281
48303
|
return;
|
|
48282
48304
|
}
|
|
48283
48305
|
if (D) return;
|
|
48284
|
-
let e = {}, t = {}, r =
|
|
48306
|
+
let e = {}, t = {}, r = KM(U);
|
|
48285
48307
|
for (let [i, a] of Object.entries(b)) {
|
|
48286
48308
|
if (!a) continue;
|
|
48287
48309
|
let o = n.find((e) => e.id === a);
|
|
@@ -48290,9 +48312,9 @@ function qN() {
|
|
|
48290
48312
|
if (s !== "select" && s !== "multiselect") continue;
|
|
48291
48313
|
let c = o.editor.options, l = r.get(i);
|
|
48292
48314
|
if (l === void 0) continue;
|
|
48293
|
-
let u =
|
|
48315
|
+
let u = qM(_.rawRows, oe, l);
|
|
48294
48316
|
if (s === "multiselect") {
|
|
48295
|
-
let n = o.editor.delimiter, r =
|
|
48317
|
+
let n = o.editor.delimiter, r = AN(u, c, n);
|
|
48296
48318
|
t[a] = r;
|
|
48297
48319
|
let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
|
|
48298
48320
|
for (let e of u) {
|
|
@@ -48355,10 +48377,10 @@ function qN() {
|
|
|
48355
48377
|
if (!t) return;
|
|
48356
48378
|
let r = n.find((t) => t.id === e);
|
|
48357
48379
|
if (r?.editor?.type !== "multiselect") return;
|
|
48358
|
-
let i =
|
|
48380
|
+
let i = KM(U).get(t);
|
|
48359
48381
|
if (i === void 0) return;
|
|
48360
|
-
let a =
|
|
48361
|
-
He(e,
|
|
48382
|
+
let a = qM(_.rawRows, oe, i), o = r.editor.delimiter;
|
|
48383
|
+
He(e, AN(a, r.editor.options, o));
|
|
48362
48384
|
}, [
|
|
48363
48385
|
_,
|
|
48364
48386
|
b,
|
|
@@ -48379,7 +48401,7 @@ function qN() {
|
|
|
48379
48401
|
for (let [r, i] of Object.entries(b)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
|
|
48380
48402
|
return t;
|
|
48381
48403
|
}, [b, n]), Ke = (0, y.useCallback)(() => {
|
|
48382
|
-
let e = new Set(B.map((e) => e.id)), t =
|
|
48404
|
+
let e = new Set(B.map((e) => e.id)), t = EN(b, n, e), i = _ ? YM(_.rawRows, U, oe, 1e3) : [], a = rp(i, DN(t)), o = cp(i, Ge(e));
|
|
48383
48405
|
return {
|
|
48384
48406
|
columnMapping: b,
|
|
48385
48407
|
valueMapping: Be,
|
|
@@ -48420,7 +48442,7 @@ function qN() {
|
|
|
48420
48442
|
if (!_ || !d?.onRowsImport) return;
|
|
48421
48443
|
let t = _;
|
|
48422
48444
|
v(null);
|
|
48423
|
-
let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ??
|
|
48445
|
+
let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ?? WN, s = EN(b, n, new Set(B.map((e) => e.id))), c = {
|
|
48424
48446
|
numberFormat: i.numberFormat,
|
|
48425
48447
|
dateFormat: i.dateFormat,
|
|
48426
48448
|
monthTable: op(f),
|
|
@@ -48429,14 +48451,14 @@ function qN() {
|
|
|
48429
48451
|
}, l = U, u = t.rawRows, p = [];
|
|
48430
48452
|
for (let e = oe; e < u.length; e++) {
|
|
48431
48453
|
let t = u[e];
|
|
48432
|
-
t && !
|
|
48454
|
+
t && !RM(t) && p.push(e);
|
|
48433
48455
|
}
|
|
48434
48456
|
let m = 0;
|
|
48435
48457
|
for (; m < p.length;) {
|
|
48436
48458
|
let e = Math.min(m + o, p.length), n = [];
|
|
48437
48459
|
for (let t = m; t < e; t++) {
|
|
48438
|
-
let e =
|
|
48439
|
-
n.push(
|
|
48460
|
+
let e = JM(u[p[t]] ?? [], l);
|
|
48461
|
+
n.push(ON(e, s, c));
|
|
48440
48462
|
}
|
|
48441
48463
|
let f = e >= p.length, h = Math.floor(m / o);
|
|
48442
48464
|
await d.onRowsImport({
|
|
@@ -48477,14 +48499,14 @@ function qN() {
|
|
|
48477
48499
|
B.length > 0 && u(B);
|
|
48478
48500
|
for (let [t, n] of Object.entries(H)) e.addColumnOptions(t, n);
|
|
48479
48501
|
let o = e.registerSource({ name: i.fileName });
|
|
48480
|
-
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(
|
|
48502
|
+
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(MN(b, Be, [...n, ...B], Mj(jj, l)));
|
|
48481
48503
|
let s = U, c = i.delimiter ?? ",", d = i.rawRows, p = [];
|
|
48482
48504
|
for (let e = oe; e < d.length; e++) {
|
|
48483
48505
|
let t = d[e];
|
|
48484
|
-
t && !
|
|
48506
|
+
t && !RM(t) && p.push(e);
|
|
48485
48507
|
}
|
|
48486
|
-
let m =
|
|
48487
|
-
numberFormat: rp(m,
|
|
48508
|
+
let m = YM(i.rawRows, s, oe, 1e3), h = EN(b, n, a), g = {
|
|
48509
|
+
numberFormat: rp(m, DN(h)),
|
|
48488
48510
|
dateFormat: cp(m, Ge(a)),
|
|
48489
48511
|
monthTable: op(f),
|
|
48490
48512
|
valueMapping: Be,
|
|
@@ -48496,11 +48518,11 @@ function qN() {
|
|
|
48496
48518
|
title: e
|
|
48497
48519
|
};
|
|
48498
48520
|
}), v = 0, y = () => {
|
|
48499
|
-
let n = Math.min(v +
|
|
48521
|
+
let n = Math.min(v + WN, p.length), i = [], a = [];
|
|
48500
48522
|
for (let e = v; e < n; e++) {
|
|
48501
|
-
let t = d[p[e]] ?? [], n =
|
|
48523
|
+
let t = d[p[e]] ?? [], n = JM(t, s);
|
|
48502
48524
|
if (t.length !== s.length) {
|
|
48503
|
-
let { cells: r, conflictColumns: i } =
|
|
48525
|
+
let { cells: r, conflictColumns: i } = UN(t.map((e) => String(e ?? "")), _, c);
|
|
48504
48526
|
if (r.length) {
|
|
48505
48527
|
let e = {};
|
|
48506
48528
|
for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
|
|
@@ -48518,10 +48540,10 @@ function qN() {
|
|
|
48518
48540
|
});
|
|
48519
48541
|
}
|
|
48520
48542
|
}
|
|
48521
|
-
i.push(
|
|
48543
|
+
i.push(ON(n, h, g));
|
|
48522
48544
|
}
|
|
48523
48545
|
let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: C ?? void 0 });
|
|
48524
|
-
for (let e = v; e < n; e++) e <
|
|
48546
|
+
for (let e = v; e < n; e++) e < KN || (d[p[e]] = void 0);
|
|
48525
48547
|
v = n, setTimeout(() => {
|
|
48526
48548
|
t.validateRows(l, u);
|
|
48527
48549
|
for (let { localIndex: t, columnIds: n } of a) {
|
|
@@ -48629,20 +48651,20 @@ function qN() {
|
|
|
48629
48651
|
}
|
|
48630
48652
|
//#endregion
|
|
48631
48653
|
//#region src/components/DataUploader/context/index.tsx
|
|
48632
|
-
var
|
|
48633
|
-
function
|
|
48634
|
-
let t =
|
|
48635
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
48654
|
+
var YN = (0, y.createContext)(null);
|
|
48655
|
+
function XN({ children: e }) {
|
|
48656
|
+
let t = JN();
|
|
48657
|
+
return /* @__PURE__ */ (0, O.jsx)(YN.Provider, {
|
|
48636
48658
|
value: t,
|
|
48637
48659
|
children: e
|
|
48638
48660
|
});
|
|
48639
48661
|
}
|
|
48640
|
-
var
|
|
48641
|
-
let e = (0, y.useContext)(
|
|
48662
|
+
var ZN = () => {
|
|
48663
|
+
let e = (0, y.useContext)(YN);
|
|
48642
48664
|
if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
|
|
48643
48665
|
return e;
|
|
48644
|
-
},
|
|
48645
|
-
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } =
|
|
48666
|
+
}, QN = () => {
|
|
48667
|
+
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = ZN();
|
|
48646
48668
|
return /* @__PURE__ */ (0, O.jsx)(zc, {
|
|
48647
48669
|
steps: e,
|
|
48648
48670
|
activeStepIndex: t,
|
|
@@ -48650,79 +48672,79 @@ var XN = () => {
|
|
|
48650
48672
|
onStepChange: r,
|
|
48651
48673
|
isProgressive: !0
|
|
48652
48674
|
});
|
|
48653
|
-
},
|
|
48675
|
+
}, $N = () => /* @__PURE__ */ (0, O.jsx)(XN, { children: /* @__PURE__ */ (0, O.jsx)(QN, {}) }), eP = {
|
|
48654
48676
|
kty: "EC",
|
|
48655
48677
|
crv: "P-256",
|
|
48656
48678
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
48657
48679
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
48658
|
-
},
|
|
48680
|
+
}, tP = "updog_license_grant", nP = new Set([
|
|
48659
48681
|
"updog.tech",
|
|
48660
48682
|
"landing.updog.tech",
|
|
48661
48683
|
"demo.updog.tech"
|
|
48662
48684
|
]);
|
|
48663
|
-
function nP() {
|
|
48664
|
-
return tP.has(window.location.hostname);
|
|
48665
|
-
}
|
|
48666
48685
|
function rP() {
|
|
48667
|
-
return
|
|
48686
|
+
return nP.has(window.location.hostname);
|
|
48668
48687
|
}
|
|
48669
48688
|
function iP() {
|
|
48689
|
+
return !1;
|
|
48690
|
+
}
|
|
48691
|
+
function aP() {
|
|
48670
48692
|
return "https://api.updog.tech";
|
|
48671
48693
|
}
|
|
48672
|
-
function
|
|
48694
|
+
function oP(e) {
|
|
48673
48695
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
48674
48696
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
48675
48697
|
return i;
|
|
48676
48698
|
}
|
|
48677
|
-
async function
|
|
48699
|
+
async function sP(e) {
|
|
48678
48700
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
48679
48701
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
48680
48702
|
}
|
|
48681
|
-
var
|
|
48682
|
-
async function
|
|
48683
|
-
return
|
|
48703
|
+
var cP = null;
|
|
48704
|
+
async function lP() {
|
|
48705
|
+
return cP || (cP = await crypto.subtle.importKey("jwk", eP, {
|
|
48684
48706
|
name: "ECDSA",
|
|
48685
48707
|
namedCurve: "P-256"
|
|
48686
|
-
}, !1, ["verify"]),
|
|
48708
|
+
}, !1, ["verify"]), cP);
|
|
48687
48709
|
}
|
|
48688
|
-
function
|
|
48710
|
+
function uP() {
|
|
48689
48711
|
try {
|
|
48690
|
-
return localStorage.getItem(
|
|
48712
|
+
return localStorage.getItem(tP);
|
|
48691
48713
|
} catch {
|
|
48692
48714
|
return null;
|
|
48693
48715
|
}
|
|
48694
48716
|
}
|
|
48695
|
-
function
|
|
48717
|
+
function dP(e) {
|
|
48696
48718
|
try {
|
|
48697
|
-
localStorage.setItem(
|
|
48719
|
+
localStorage.setItem(tP, e);
|
|
48698
48720
|
} catch {}
|
|
48699
48721
|
}
|
|
48700
|
-
function
|
|
48722
|
+
function fP() {
|
|
48701
48723
|
try {
|
|
48702
|
-
localStorage.removeItem(
|
|
48724
|
+
localStorage.removeItem(tP);
|
|
48703
48725
|
} catch {}
|
|
48704
48726
|
}
|
|
48705
|
-
async function
|
|
48727
|
+
async function pP(e, t, n) {
|
|
48706
48728
|
let r = e.indexOf(".");
|
|
48707
48729
|
if (r === -1) return !1;
|
|
48708
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
48730
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = oP(i), s = oP(a), c = await lP();
|
|
48709
48731
|
if (!await crypto.subtle.verify({
|
|
48710
48732
|
name: "ECDSA",
|
|
48711
48733
|
hash: "SHA-256"
|
|
48712
48734
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
48713
48735
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
48714
48736
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
48715
|
-
let u = await
|
|
48737
|
+
let u = await sP(t);
|
|
48716
48738
|
return !(l.key !== u || l.domain !== n);
|
|
48717
48739
|
}
|
|
48718
|
-
async function
|
|
48719
|
-
let t =
|
|
48740
|
+
async function mP(e) {
|
|
48741
|
+
let t = uP();
|
|
48720
48742
|
if (!t) return {
|
|
48721
48743
|
valid: !1,
|
|
48722
48744
|
errorCode: "license.invalid"
|
|
48723
48745
|
};
|
|
48724
48746
|
try {
|
|
48725
|
-
if (await
|
|
48747
|
+
if (await pP(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
48726
48748
|
valid: !0,
|
|
48727
48749
|
errorCode: null
|
|
48728
48750
|
};
|
|
@@ -48732,23 +48754,23 @@ async function pP(e) {
|
|
|
48732
48754
|
errorCode: "license.invalid"
|
|
48733
48755
|
};
|
|
48734
48756
|
}
|
|
48735
|
-
async function
|
|
48736
|
-
if (
|
|
48757
|
+
async function hP(e, t = !0) {
|
|
48758
|
+
if (rP() || iP()) return {
|
|
48737
48759
|
valid: !0,
|
|
48738
48760
|
errorCode: null
|
|
48739
48761
|
};
|
|
48740
|
-
let n =
|
|
48762
|
+
let n = aP();
|
|
48741
48763
|
try {
|
|
48742
48764
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
48743
48765
|
if (r.ok) {
|
|
48744
48766
|
let e = await r.json();
|
|
48745
|
-
return t && e.grant &&
|
|
48767
|
+
return t && e.grant && dP(e.grant), {
|
|
48746
48768
|
valid: !0,
|
|
48747
48769
|
errorCode: null
|
|
48748
48770
|
};
|
|
48749
48771
|
}
|
|
48750
48772
|
if (r.status >= 400 && r.status < 500) {
|
|
48751
|
-
t &&
|
|
48773
|
+
t && fP();
|
|
48752
48774
|
try {
|
|
48753
48775
|
return await r.json();
|
|
48754
48776
|
} catch {
|
|
@@ -48760,7 +48782,7 @@ async function mP(e, t = !0) {
|
|
|
48760
48782
|
}
|
|
48761
48783
|
throw Error(`Server error: ${r.status}`);
|
|
48762
48784
|
} catch {
|
|
48763
|
-
return t ?
|
|
48785
|
+
return t ? mP(e) : {
|
|
48764
48786
|
valid: !1,
|
|
48765
48787
|
errorCode: "license.invalid"
|
|
48766
48788
|
};
|
|
@@ -48768,7 +48790,7 @@ async function mP(e, t = !0) {
|
|
|
48768
48790
|
}
|
|
48769
48791
|
//#endregion
|
|
48770
48792
|
//#region src/hooks/useLicenseValidation.ts
|
|
48771
|
-
function
|
|
48793
|
+
function gP(e, t, n = !0) {
|
|
48772
48794
|
let [r, i] = (0, y.useState)({
|
|
48773
48795
|
isValidating: t,
|
|
48774
48796
|
isValid: !1,
|
|
@@ -48788,7 +48810,7 @@ function hP(e, t, n = !0) {
|
|
|
48788
48810
|
isValidating: !0,
|
|
48789
48811
|
isValid: !1,
|
|
48790
48812
|
errorCode: null
|
|
48791
|
-
}),
|
|
48813
|
+
}), hP(e, n).then((e) => {
|
|
48792
48814
|
r || i({
|
|
48793
48815
|
isValidating: !1,
|
|
48794
48816
|
isValid: e.valid,
|
|
@@ -48811,7 +48833,7 @@ function hP(e, t, n = !0) {
|
|
|
48811
48833
|
}
|
|
48812
48834
|
//#endregion
|
|
48813
48835
|
//#region src/server/auth/AuthState.ts
|
|
48814
|
-
var
|
|
48836
|
+
var _P = class {
|
|
48815
48837
|
token = null;
|
|
48816
48838
|
get() {
|
|
48817
48839
|
return this.token;
|
|
@@ -48822,13 +48844,13 @@ var gP = class {
|
|
|
48822
48844
|
clear() {
|
|
48823
48845
|
this.token = null;
|
|
48824
48846
|
}
|
|
48825
|
-
},
|
|
48847
|
+
}, vP = class extends Error {
|
|
48826
48848
|
status;
|
|
48827
48849
|
code;
|
|
48828
48850
|
constructor(e) {
|
|
48829
48851
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
48830
48852
|
}
|
|
48831
|
-
},
|
|
48853
|
+
}, yP = class {
|
|
48832
48854
|
baseUrl;
|
|
48833
48855
|
apiKey;
|
|
48834
48856
|
auth;
|
|
@@ -48858,7 +48880,7 @@ var gP = class {
|
|
|
48858
48880
|
signal: r?.signal
|
|
48859
48881
|
});
|
|
48860
48882
|
} catch (e) {
|
|
48861
|
-
this.notify(new
|
|
48883
|
+
this.notify(new vP({
|
|
48862
48884
|
status: 0,
|
|
48863
48885
|
code: "network",
|
|
48864
48886
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -48869,7 +48891,7 @@ var gP = class {
|
|
|
48869
48891
|
try {
|
|
48870
48892
|
e = await s.json();
|
|
48871
48893
|
} catch {}
|
|
48872
|
-
this.notify(new
|
|
48894
|
+
this.notify(new vP({
|
|
48873
48895
|
status: s.status,
|
|
48874
48896
|
code: e.error ?? `http_${s.status}`,
|
|
48875
48897
|
message: e.message ?? s.statusText
|
|
@@ -48880,23 +48902,23 @@ var gP = class {
|
|
|
48880
48902
|
};
|
|
48881
48903
|
//#endregion
|
|
48882
48904
|
//#region src/server/endpoints/workspaces.ts
|
|
48883
|
-
async function
|
|
48905
|
+
async function bP(e, t) {
|
|
48884
48906
|
return e.post("/workspaces", {
|
|
48885
48907
|
primaryKey: t.primaryKey,
|
|
48886
48908
|
columns: t.columns
|
|
48887
48909
|
}, { signal: t.signal });
|
|
48888
48910
|
}
|
|
48889
|
-
async function
|
|
48911
|
+
async function xP(e) {
|
|
48890
48912
|
try {
|
|
48891
48913
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
48892
48914
|
} catch (e) {
|
|
48893
|
-
if (e instanceof
|
|
48915
|
+
if (e instanceof vP && e.status === 404) return;
|
|
48894
48916
|
throw e;
|
|
48895
48917
|
}
|
|
48896
48918
|
}
|
|
48897
48919
|
//#endregion
|
|
48898
48920
|
//#region src/server/endpoints/query.ts
|
|
48899
|
-
async function
|
|
48921
|
+
async function SP(e, t) {
|
|
48900
48922
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
48901
48923
|
page: {
|
|
48902
48924
|
limit: t.limit,
|
|
@@ -48914,12 +48936,12 @@ async function xP(e, t) {
|
|
|
48914
48936
|
}
|
|
48915
48937
|
//#endregion
|
|
48916
48938
|
//#region src/server/ScaleClient.ts
|
|
48917
|
-
var
|
|
48939
|
+
var CP = class {
|
|
48918
48940
|
disposed = !1;
|
|
48919
48941
|
constructor(e) {
|
|
48920
48942
|
this.deps = e;
|
|
48921
48943
|
}
|
|
48922
|
-
onQuery = (e) =>
|
|
48944
|
+
onQuery = (e) => SP(this.deps, e);
|
|
48923
48945
|
onEdit = async (e) => ({
|
|
48924
48946
|
rejected: !0,
|
|
48925
48947
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -48936,7 +48958,7 @@ var SP = class {
|
|
|
48936
48958
|
pageSize = void 0;
|
|
48937
48959
|
scrollSensitivity = void 0;
|
|
48938
48960
|
dispose = async () => {
|
|
48939
|
-
this.disposed || (this.disposed = !0, await
|
|
48961
|
+
this.disposed || (this.disposed = !0, await xP({
|
|
48940
48962
|
http: this.deps.http,
|
|
48941
48963
|
workspaceId: this.deps.workspaceId
|
|
48942
48964
|
}));
|
|
@@ -48944,25 +48966,25 @@ var SP = class {
|
|
|
48944
48966
|
};
|
|
48945
48967
|
//#endregion
|
|
48946
48968
|
//#region src/server/createScaleClient.ts
|
|
48947
|
-
async function
|
|
48948
|
-
let t = new
|
|
48969
|
+
async function wP(e) {
|
|
48970
|
+
let t = new _P(), n = new yP({
|
|
48949
48971
|
baseUrl: e.url,
|
|
48950
48972
|
apiKey: e.apiKey,
|
|
48951
48973
|
auth: t,
|
|
48952
48974
|
onDegraded: e.onDegraded
|
|
48953
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
48975
|
+
}), { workspaceId: r, accessToken: i } = await bP(n, {
|
|
48954
48976
|
primaryKey: e.primaryKey,
|
|
48955
48977
|
columns: e.columns,
|
|
48956
48978
|
signal: e.signal
|
|
48957
48979
|
});
|
|
48958
|
-
return t.set(i), new
|
|
48980
|
+
return t.set(i), new CP({
|
|
48959
48981
|
workspaceId: r,
|
|
48960
48982
|
http: n
|
|
48961
48983
|
});
|
|
48962
48984
|
}
|
|
48963
48985
|
//#endregion
|
|
48964
48986
|
//#region src/server/errors.ts
|
|
48965
|
-
function
|
|
48987
|
+
function TP(e, t, n) {
|
|
48966
48988
|
return {
|
|
48967
48989
|
code: e,
|
|
48968
48990
|
message: t,
|
|
@@ -48972,7 +48994,7 @@ function wP(e, t, n) {
|
|
|
48972
48994
|
}
|
|
48973
48995
|
//#endregion
|
|
48974
48996
|
//#region src/hooks/useScaleClient.ts
|
|
48975
|
-
function
|
|
48997
|
+
function EP(e) {
|
|
48976
48998
|
let [t, n] = (0, y.useState)({ status: "idle" }), r = (0, y.useRef)(e.columns), i = (0, y.useRef)(e.primaryKey);
|
|
48977
48999
|
return (0, y.useEffect)(() => {
|
|
48978
49000
|
if (!e.enabled) {
|
|
@@ -48981,7 +49003,7 @@ function TP(e) {
|
|
|
48981
49003
|
}
|
|
48982
49004
|
n({ status: "bootstrapping" });
|
|
48983
49005
|
let t = new AbortController(), a = null;
|
|
48984
|
-
return
|
|
49006
|
+
return wP({
|
|
48985
49007
|
url: e.url,
|
|
48986
49008
|
apiKey: e.apiKey,
|
|
48987
49009
|
primaryKey: i.current,
|
|
@@ -48990,7 +49012,7 @@ function TP(e) {
|
|
|
48990
49012
|
onDegraded: (e) => {
|
|
48991
49013
|
t.signal.aborted || n({
|
|
48992
49014
|
status: "failed",
|
|
48993
|
-
error:
|
|
49015
|
+
error: OP(e)
|
|
48994
49016
|
});
|
|
48995
49017
|
}
|
|
48996
49018
|
}).then((e) => {
|
|
@@ -49005,7 +49027,7 @@ function TP(e) {
|
|
|
49005
49027
|
}).catch((e) => {
|
|
49006
49028
|
t.signal.aborted || n({
|
|
49007
49029
|
status: "failed",
|
|
49008
|
-
error:
|
|
49030
|
+
error: DP(e)
|
|
49009
49031
|
});
|
|
49010
49032
|
}), () => {
|
|
49011
49033
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -49016,30 +49038,30 @@ function TP(e) {
|
|
|
49016
49038
|
e.apiKey
|
|
49017
49039
|
]), t;
|
|
49018
49040
|
}
|
|
49019
|
-
function EP(e) {
|
|
49020
|
-
return e instanceof _P ? e.status === 401 ? wP(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? wP("scale.unreachable", e.message, e) : e.status >= 500 ? wP("scale.server_error", e.message, e) : wP("scale.bootstrap_failed", e.message, e) : wP("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
49021
|
-
}
|
|
49022
49041
|
function DP(e) {
|
|
49023
|
-
return e.status === 0 ?
|
|
49042
|
+
return e instanceof vP ? e.status === 401 ? TP(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? TP("scale.unreachable", e.message, e) : e.status >= 500 ? TP("scale.server_error", e.message, e) : TP("scale.bootstrap_failed", e.message, e) : TP("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
49043
|
+
}
|
|
49044
|
+
function OP(e) {
|
|
49045
|
+
return e.status === 0 ? TP("scale.unreachable", e.message, e) : e.status === 404 ? TP("scale.workspace_lost", e.message, e) : TP("scale.server_error", e.message, e);
|
|
49024
49046
|
}
|
|
49025
49047
|
//#endregion
|
|
49026
49048
|
//#region src/index.tsx
|
|
49027
|
-
function
|
|
49049
|
+
function kP(e) {
|
|
49028
49050
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
49029
49051
|
}
|
|
49030
|
-
function
|
|
49052
|
+
function AP(e) {
|
|
49031
49053
|
let t = (0, y.useMemo)(() => new ed(e.onError), [e.onError]);
|
|
49032
49054
|
return /* @__PURE__ */ (0, O.jsx)(kj, {
|
|
49033
49055
|
errorHandler: t,
|
|
49034
49056
|
children: /* @__PURE__ */ (0, O.jsx)(eh, {
|
|
49035
49057
|
...e,
|
|
49036
49058
|
errorHandler: t,
|
|
49037
|
-
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(
|
|
49059
|
+
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)($N, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
|
|
49038
49060
|
})
|
|
49039
49061
|
});
|
|
49040
49062
|
}
|
|
49041
|
-
function
|
|
49042
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a =
|
|
49063
|
+
function jP(e) {
|
|
49064
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = kP(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = gP(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = EP({
|
|
49043
49065
|
enabled: !s && c && u,
|
|
49044
49066
|
url: e.__server?.url ?? "",
|
|
49045
49067
|
apiKey: e.apiKey,
|
|
@@ -49094,7 +49116,7 @@ function AP(e) {
|
|
|
49094
49116
|
code: e,
|
|
49095
49117
|
message: "License validation failed",
|
|
49096
49118
|
source: "license"
|
|
49097
|
-
} }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(
|
|
49119
|
+
} }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(AP, { ...C }) : T(l ?? "license.invalid");
|
|
49098
49120
|
return t === "inline" ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
49099
49121
|
className: "updog__data-editor updog__data-editor-inline",
|
|
49100
49122
|
dir: i,
|
|
@@ -49114,18 +49136,18 @@ function AP(e) {
|
|
|
49114
49136
|
submitText: n("dataEditor.confirmClose.action")
|
|
49115
49137
|
})] });
|
|
49116
49138
|
}
|
|
49117
|
-
function
|
|
49139
|
+
function MP(e) {
|
|
49118
49140
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
49119
49141
|
return /* @__PURE__ */ (0, O.jsx)(A, {
|
|
49120
49142
|
translations: t,
|
|
49121
49143
|
rtl: n,
|
|
49122
49144
|
locale: r,
|
|
49123
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
49145
|
+
children: /* @__PURE__ */ (0, O.jsx)(jP, { ...a })
|
|
49124
49146
|
});
|
|
49125
49147
|
}
|
|
49126
49148
|
//#endregion
|
|
49127
49149
|
//#region src/wc.ts
|
|
49128
|
-
var
|
|
49150
|
+
var NP = {
|
|
49129
49151
|
"api-key": {
|
|
49130
49152
|
prop: "apiKey",
|
|
49131
49153
|
type: "string"
|
|
@@ -49158,12 +49180,12 @@ var MP = {
|
|
|
49158
49180
|
prop: "mode",
|
|
49159
49181
|
type: "string"
|
|
49160
49182
|
}
|
|
49161
|
-
},
|
|
49183
|
+
}, PP = class extends HTMLElement {
|
|
49162
49184
|
_root = null;
|
|
49163
49185
|
_props = {};
|
|
49164
49186
|
_renderScheduled = !1;
|
|
49165
49187
|
static get observedAttributes() {
|
|
49166
|
-
return Object.keys(
|
|
49188
|
+
return Object.keys(NP);
|
|
49167
49189
|
}
|
|
49168
49190
|
connectedCallback() {
|
|
49169
49191
|
this._root = (0, v.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
|
|
@@ -49174,7 +49196,7 @@ var MP = {
|
|
|
49174
49196
|
this._root?.unmount(), this._root = null;
|
|
49175
49197
|
}
|
|
49176
49198
|
attributeChangedCallback(e, t, n) {
|
|
49177
|
-
let r =
|
|
49199
|
+
let r = NP[e];
|
|
49178
49200
|
r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
|
|
49179
49201
|
this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
|
|
49180
49202
|
}), this._scheduleRender());
|
|
@@ -49191,11 +49213,11 @@ var MP = {
|
|
|
49191
49213
|
}
|
|
49192
49214
|
_scheduleRender() {
|
|
49193
49215
|
this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
|
|
49194
|
-
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(
|
|
49216
|
+
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(MP, this._props));
|
|
49195
49217
|
}));
|
|
49196
49218
|
}
|
|
49197
49219
|
};
|
|
49198
|
-
for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(
|
|
49220
|
+
for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(PP.prototype, e, {
|
|
49199
49221
|
get() {
|
|
49200
49222
|
return this._props[e];
|
|
49201
49223
|
},
|
|
@@ -49205,7 +49227,7 @@ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.
|
|
|
49205
49227
|
enumerable: !0,
|
|
49206
49228
|
configurable: !0
|
|
49207
49229
|
});
|
|
49208
|
-
Object.defineProperty(
|
|
49230
|
+
Object.defineProperty(PP.prototype, "open", {
|
|
49209
49231
|
get() {
|
|
49210
49232
|
return this.hasAttribute("open");
|
|
49211
49233
|
},
|
|
@@ -49214,5 +49236,5 @@ Object.defineProperty(NP.prototype, "open", {
|
|
|
49214
49236
|
},
|
|
49215
49237
|
enumerable: !0,
|
|
49216
49238
|
configurable: !0
|
|
49217
|
-
}), customElements.define("updog-editor",
|
|
49239
|
+
}), customElements.define("updog-editor", PP);
|
|
49218
49240
|
//#endregion
|