@updog/data-editor-wc 0.1.51 → 0.1.53
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.js +326 -330
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -33316,7 +33316,7 @@ function $_(e, t, n) {
|
|
|
33316
33316
|
//#endregion
|
|
33317
33317
|
//#region src/components/PreviewTable/index.tsx
|
|
33318
33318
|
var ev = 15, tv = { width: 1 }, nv = { height: 1 }, rv = ({ headers: e, rows: t, lockedColumns: n, displayRows: r = ev, blur: i = !0, scrollbars: a = !0, selectedRow: o, onSelectRow: s, className: c }) => {
|
|
33319
|
-
let l = e.length, u = Array.from({ length: r }, (e, n) => t[n]), d = a === !0, f = a === !0 || a === "empty", p = (0, y.useRef)(null), m = (0, y.useRef)(null), h = (0, y.useRef)(null), g = (0, y.useRef)(null), _ = (0, y.useRef)(null), v = (0, y.useRef)(null), [b, x] = (0, y.useState)(!1), [S, C] = (0, y.useState)(!1);
|
|
33319
|
+
let l = e ? e.length : Math.max(0, ...t.map((e) => e?.length ?? 0)), u = Array.from({ length: r }, (e, n) => t[n]), d = a === !0, f = a === !0 || a === "empty", p = (0, y.useRef)(null), m = (0, y.useRef)(null), h = (0, y.useRef)(null), g = (0, y.useRef)(null), _ = (0, y.useRef)(null), v = (0, y.useRef)(null), [b, x] = (0, y.useState)(!1), [S, C] = (0, y.useState)(!1);
|
|
33320
33320
|
(0, y.useEffect)(() => {
|
|
33321
33321
|
if (!d) return;
|
|
33322
33322
|
let e = p.current, t = h.current, n = g.current, r = _.current, i = v.current;
|
|
@@ -33356,38 +33356,34 @@ var ev = 15, tv = { width: 1 }, nv = { height: 1 }, rv = ({ headers: e, rows: t,
|
|
|
33356
33356
|
className: "updog__preview-table__grid",
|
|
33357
33357
|
style: E,
|
|
33358
33358
|
ref: m,
|
|
33359
|
-
children: [
|
|
33360
|
-
|
|
33361
|
-
|
|
33362
|
-
className:
|
|
33363
|
-
children:
|
|
33364
|
-
|
|
33365
|
-
|
|
33366
|
-
|
|
33367
|
-
|
|
33368
|
-
|
|
33369
|
-
|
|
33370
|
-
|
|
33371
|
-
|
|
33372
|
-
|
|
33373
|
-
|
|
33374
|
-
|
|
33375
|
-
|
|
33376
|
-
|
|
33377
|
-
|
|
33378
|
-
|
|
33379
|
-
|
|
33380
|
-
|
|
33381
|
-
|
|
33382
|
-
|
|
33383
|
-
|
|
33384
|
-
|
|
33385
|
-
|
|
33386
|
-
|
|
33387
|
-
}, n))]
|
|
33388
|
-
}, n);
|
|
33389
|
-
})
|
|
33390
|
-
]
|
|
33359
|
+
children: [e !== void 0 && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__preview-table-marker" }), l === 0 ? /* @__PURE__ */ (0, O.jsx)("div", { className: N("updog__preview-table-th", "updog__preview-table-cell--last-col") }) : e.map((e, t) => /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
33360
|
+
className: N("updog__preview-table-th", t === l - 1 && "updog__preview-table-cell--last-col"),
|
|
33361
|
+
children: [/* @__PURE__ */ (0, O.jsx)("span", {
|
|
33362
|
+
className: "updog__preview-table-th__label",
|
|
33363
|
+
children: e
|
|
33364
|
+
}), n?.[t] && /* @__PURE__ */ (0, O.jsx)(we, {
|
|
33365
|
+
size: "0.875rem",
|
|
33366
|
+
className: "updog__preview-table-th__lock-icon"
|
|
33367
|
+
})]
|
|
33368
|
+
}, t))] }), u.map((e, t) => {
|
|
33369
|
+
let n = t === r - 1, i = !!s && e !== void 0, a = o === t;
|
|
33370
|
+
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
33371
|
+
className: N("updog__preview-table-row", i && "updog__preview-table-row--interactive", a && "updog__preview-table-row--selected"),
|
|
33372
|
+
"data-row-index": t,
|
|
33373
|
+
role: i ? "row" : void 0,
|
|
33374
|
+
tabIndex: i ? 0 : void 0,
|
|
33375
|
+
"aria-selected": i ? a : void 0,
|
|
33376
|
+
onClick: i ? w : void 0,
|
|
33377
|
+
onKeyDown: i ? T : void 0,
|
|
33378
|
+
children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
33379
|
+
className: N("updog__preview-table-marker", n && "updog__preview-table-cell--last-row"),
|
|
33380
|
+
children: t + 1
|
|
33381
|
+
}), l === 0 ? /* @__PURE__ */ (0, O.jsx)("div", { className: N("updog__preview-table-td", "updog__preview-table-cell--last-col", n && "updog__preview-table-cell--last-row") }) : Array.from({ length: l }, (t, r) => /* @__PURE__ */ (0, O.jsx)("div", {
|
|
33382
|
+
className: N("updog__preview-table-td", r === l - 1 && "updog__preview-table-cell--last-col", n && "updog__preview-table-cell--last-row"),
|
|
33383
|
+
children: e?.[r] ?? ""
|
|
33384
|
+
}, r))]
|
|
33385
|
+
}, t);
|
|
33386
|
+
})]
|
|
33391
33387
|
})
|
|
33392
33388
|
})
|
|
33393
33389
|
}),
|
|
@@ -45819,7 +45815,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
45819
45815
|
return this.state.hasError ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: Oj }) : this.props.children;
|
|
45820
45816
|
}
|
|
45821
45817
|
}, Aj = ({ leftSlot: e }) => {
|
|
45822
|
-
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: _ } =
|
|
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: _ } = ZN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
|
|
45823
45819
|
n(!1);
|
|
45824
45820
|
}, [n]), x = p[m]?.id === "sheet-selection", S = (0, y.useCallback)(() => {
|
|
45825
45821
|
a ? c() : x ? g() : o();
|
|
@@ -46588,7 +46584,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
|
46588
46584
|
}
|
|
46589
46585
|
return i;
|
|
46590
46586
|
}, Qj = () => {
|
|
46591
|
-
let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } =
|
|
46587
|
+
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 = (0, y.useRef)(null), f = (0, y.useMemo)(() => Zj(i, e, n), [
|
|
46592
46588
|
i,
|
|
46593
46589
|
e,
|
|
46594
46590
|
n
|
|
@@ -46807,99 +46803,93 @@ var tM = () => {
|
|
|
46807
46803
|
/* @__PURE__ */ (0, O.jsx)(aM, {})
|
|
46808
46804
|
]
|
|
46809
46805
|
}), sM = () => {
|
|
46810
|
-
let { parsedCsv: e } =
|
|
46806
|
+
let { parsedCsv: e } = ZN();
|
|
46811
46807
|
return e ? /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
46812
46808
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
46813
46809
|
children: /* @__PURE__ */ (0, O.jsx)(eM, { children: /* @__PURE__ */ (0, O.jsx)(oM, {}) })
|
|
46814
46810
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }) : null;
|
|
46815
|
-
}, cM = new Set([
|
|
46811
|
+
}, cM = .5, lM = new Set([
|
|
46816
46812
|
"true",
|
|
46817
46813
|
"false",
|
|
46818
46814
|
"yes",
|
|
46819
46815
|
"no"
|
|
46820
|
-
]),
|
|
46816
|
+
]), uM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, dM = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, fM = new Set([
|
|
46821
46817
|
"number",
|
|
46822
46818
|
"date",
|
|
46823
46819
|
"bool"
|
|
46824
46820
|
]);
|
|
46825
|
-
function
|
|
46821
|
+
function pM(e) {
|
|
46826
46822
|
if (e == null) return "empty";
|
|
46827
46823
|
let t = String(e).trim();
|
|
46828
|
-
return t.length === 0 ? "empty" :
|
|
46824
|
+
return t.length === 0 ? "empty" : lM.has(t.toLowerCase()) ? "bool" : uM.test(t) ? "date" : dM.test(t) ? "number" : "text";
|
|
46829
46825
|
}
|
|
46830
|
-
function
|
|
46826
|
+
function mM(e) {
|
|
46831
46827
|
return e.filter((e) => e != null && String(e).trim().length > 0).length;
|
|
46832
46828
|
}
|
|
46833
|
-
function
|
|
46829
|
+
function hM(e) {
|
|
46830
|
+
let t = 0;
|
|
46831
|
+
for (let n of e) t = Math.max(t, n.length);
|
|
46832
|
+
return t;
|
|
46833
|
+
}
|
|
46834
|
+
function gM(e) {
|
|
46834
46835
|
let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
46835
46836
|
for (let i of e) {
|
|
46836
|
-
let e =
|
|
46837
|
+
let e = i.length;
|
|
46837
46838
|
if (e === 0) continue;
|
|
46838
46839
|
let a = (t.get(e) ?? 0) + 1;
|
|
46839
46840
|
t.set(e, a), a > n && (n = a, r = e);
|
|
46840
46841
|
}
|
|
46841
46842
|
return r;
|
|
46842
46843
|
}
|
|
46843
|
-
function
|
|
46844
|
-
let t = 0;
|
|
46845
|
-
for (let n of e) t = Math.max(t, n.length);
|
|
46846
|
-
return t;
|
|
46847
|
-
}
|
|
46848
|
-
function gM(e, t, n) {
|
|
46844
|
+
function _M(e, t, n) {
|
|
46849
46845
|
if (t <= 0) return 0;
|
|
46850
|
-
let r =
|
|
46851
|
-
for (let a = 0; a < e.length; a++) if (pM(e[a]) === t) {
|
|
46852
|
-
if (r < 0 && (r = a), i++, i >= n) return r;
|
|
46853
|
-
} else r = -1, i = 0;
|
|
46854
|
-
for (let n = 0; n < e.length; n++) if (pM(e[n]) === t) return n;
|
|
46846
|
+
for (let r = 0; r < e.length; r++) if (mM(e[r]) / t >= n) return r;
|
|
46855
46847
|
return 0;
|
|
46856
46848
|
}
|
|
46857
|
-
function
|
|
46849
|
+
function vM(e, t, n, r) {
|
|
46858
46850
|
let i = /* @__PURE__ */ new Map();
|
|
46859
46851
|
for (let a = t; a < n; a++) {
|
|
46860
|
-
let t =
|
|
46852
|
+
let t = pM(e[a]?.[r]);
|
|
46861
46853
|
t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
|
|
46862
46854
|
}
|
|
46863
46855
|
let a = "empty", o = 0;
|
|
46864
46856
|
for (let [e, t] of i) t > o && (o = t, a = e);
|
|
46865
46857
|
return a;
|
|
46866
46858
|
}
|
|
46867
|
-
function
|
|
46859
|
+
function yM(e, t, n, r) {
|
|
46868
46860
|
let i = 0, a = 0;
|
|
46869
46861
|
for (let o = 0; o < r; o++) {
|
|
46870
|
-
let r =
|
|
46871
|
-
r !== "empty" && (a++,
|
|
46862
|
+
let r = vM(e, t + 1, n, o);
|
|
46863
|
+
r !== "empty" && (a++, pM(e[t]?.[o]) === "text" && fM.has(r) && i++);
|
|
46872
46864
|
}
|
|
46873
46865
|
return a === 0 ? 0 : i / a;
|
|
46874
46866
|
}
|
|
46875
|
-
function
|
|
46867
|
+
function bM(e, t, n, r) {
|
|
46876
46868
|
let i = 0, a = 0;
|
|
46877
46869
|
for (let o = 0; o < r; o++) {
|
|
46878
|
-
let r =
|
|
46870
|
+
let r = vM(e, t, n, o);
|
|
46879
46871
|
if (r !== "empty") for (let s = t; s < n; s++) {
|
|
46880
|
-
let t =
|
|
46872
|
+
let t = pM(e[s]?.[o]);
|
|
46881
46873
|
t !== "empty" && (a++, t === r && i++);
|
|
46882
46874
|
}
|
|
46883
46875
|
}
|
|
46884
46876
|
return a === 0 ? 0 : i / a;
|
|
46885
46877
|
}
|
|
46886
|
-
function
|
|
46887
|
-
let t = e.map(
|
|
46878
|
+
function xM(e) {
|
|
46879
|
+
let t = e.map(pM).filter((e) => e !== "empty");
|
|
46888
46880
|
return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
|
|
46889
46881
|
}
|
|
46890
|
-
function
|
|
46891
|
-
|
|
46892
|
-
let n = pM(e);
|
|
46893
|
-
return Math.max(0, 1 - Math.abs(n - t) / t);
|
|
46882
|
+
function SM(e, t) {
|
|
46883
|
+
return t <= 0 ? 0 : Math.min(1, mM(e) / t);
|
|
46894
46884
|
}
|
|
46895
|
-
function
|
|
46885
|
+
function CM(e) {
|
|
46896
46886
|
let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
|
|
46897
46887
|
return t.length === 0 ? 0 : new Set(t).size / t.length;
|
|
46898
46888
|
}
|
|
46899
|
-
function
|
|
46900
|
-
return .45 *
|
|
46889
|
+
function wM(e, t, n, r, i) {
|
|
46890
|
+
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] ?? []);
|
|
46901
46891
|
}
|
|
46902
|
-
function
|
|
46892
|
+
function TM(e, t = 100) {
|
|
46903
46893
|
if (e.length === 0) return {
|
|
46904
46894
|
headerRowIndex: 0,
|
|
46905
46895
|
dataStartIndex: 0,
|
|
@@ -46907,7 +46897,7 @@ function wM(e, t = 100) {
|
|
|
46907
46897
|
mode: "header",
|
|
46908
46898
|
review: { kind: "none" }
|
|
46909
46899
|
};
|
|
46910
|
-
let n = Math.min(t, e.length), r = e.slice(0, n), i = hM(r), a =
|
|
46900
|
+
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;
|
|
46911
46901
|
if (u && c <= .15 && l >= .7) return {
|
|
46912
46902
|
headerRowIndex: -1,
|
|
46913
46903
|
dataStartIndex: o,
|
|
@@ -46927,7 +46917,7 @@ function wM(e, t = 100) {
|
|
|
46927
46917
|
review: f
|
|
46928
46918
|
};
|
|
46929
46919
|
}
|
|
46930
|
-
function
|
|
46920
|
+
function EM(e) {
|
|
46931
46921
|
let t = /* @__PURE__ */ new Set();
|
|
46932
46922
|
return e.map((e) => {
|
|
46933
46923
|
let n = e, r = 2;
|
|
@@ -46937,7 +46927,7 @@ function TM(e) {
|
|
|
46937
46927
|
}
|
|
46938
46928
|
//#endregion
|
|
46939
46929
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
|
|
46940
|
-
function
|
|
46930
|
+
function DM(e, t, n, r) {
|
|
46941
46931
|
return (0, y.useMemo)(() => ({
|
|
46942
46932
|
sample: e,
|
|
46943
46933
|
selectedRow: t,
|
|
@@ -46952,20 +46942,20 @@ function EM(e, t, n, r) {
|
|
|
46952
46942
|
}
|
|
46953
46943
|
//#endregion
|
|
46954
46944
|
//#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
|
|
46955
|
-
var
|
|
46956
|
-
function
|
|
46957
|
-
let a =
|
|
46958
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
46945
|
+
var OM = (0, y.createContext)(null);
|
|
46946
|
+
function kM({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
|
|
46947
|
+
let a = DM(e, t, n, r);
|
|
46948
|
+
return /* @__PURE__ */ (0, O.jsx)(OM.Provider, {
|
|
46959
46949
|
value: a,
|
|
46960
46950
|
children: i
|
|
46961
46951
|
});
|
|
46962
46952
|
}
|
|
46963
|
-
var
|
|
46964
|
-
let e = (0, y.useContext)(
|
|
46953
|
+
var AM = () => {
|
|
46954
|
+
let e = (0, y.useContext)(OM);
|
|
46965
46955
|
if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
|
|
46966
46956
|
return e;
|
|
46967
|
-
},
|
|
46968
|
-
let { sample: e, selectedRow: t, selectRow: n, noHeader: r } =
|
|
46957
|
+
}, jM = () => {
|
|
46958
|
+
let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = AM(), { headers: i } = ZN(), { headers: a, rows: o } = (0, y.useMemo)(() => {
|
|
46969
46959
|
let t = i.length;
|
|
46970
46960
|
return {
|
|
46971
46961
|
headers: i.map((e) => r ? e : ""),
|
|
@@ -46985,27 +46975,30 @@ var kM = () => {
|
|
|
46985
46975
|
selectedRow: r ? void 0 : t,
|
|
46986
46976
|
onSelectRow: r ? void 0 : n
|
|
46987
46977
|
});
|
|
46988
|
-
},
|
|
46989
|
-
let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } =
|
|
46978
|
+
}, MM = () => {
|
|
46979
|
+
let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = ZN(), i = (0, y.useCallback)((e) => {
|
|
46990
46980
|
r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
|
|
46991
46981
|
}, [r, t]);
|
|
46992
46982
|
if (!t) return null;
|
|
46993
46983
|
let a = t.rawRows.slice(0, 50), o = n < 0;
|
|
46994
|
-
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(
|
|
46984
|
+
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(kM, {
|
|
46995
46985
|
sample: a,
|
|
46996
46986
|
selectedRow: o ? void 0 : n,
|
|
46997
46987
|
selectRow: r,
|
|
46998
46988
|
noHeader: o,
|
|
46999
46989
|
children: [/* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47000
46990
|
className: "updog__step-header-selection__content updog__scrollbar",
|
|
47001
|
-
children: [/* @__PURE__ */ (0, O.jsx)(
|
|
47002
|
-
|
|
47003
|
-
|
|
47004
|
-
|
|
47005
|
-
|
|
46991
|
+
children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
46992
|
+
className: "updog__step-header-selection__noHeadersWrapper",
|
|
46993
|
+
children: /* @__PURE__ */ (0, O.jsx)(jt, {
|
|
46994
|
+
checked: o,
|
|
46995
|
+
onChange: i,
|
|
46996
|
+
label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
|
|
46997
|
+
})
|
|
46998
|
+
}), /* @__PURE__ */ (0, O.jsx)(jM, {})]
|
|
47006
46999
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})]
|
|
47007
47000
|
}) }) });
|
|
47008
|
-
},
|
|
47001
|
+
}, NM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
|
|
47009
47002
|
let { t: a } = j();
|
|
47010
47003
|
return /* @__PURE__ */ (0, O.jsx)(vs, {
|
|
47011
47004
|
open: e,
|
|
@@ -47018,13 +47011,13 @@ var kM = () => {
|
|
|
47018
47011
|
onSubmit: i
|
|
47019
47012
|
})
|
|
47020
47013
|
});
|
|
47021
|
-
},
|
|
47014
|
+
}, PM = [
|
|
47022
47015
|
",",
|
|
47023
47016
|
";",
|
|
47024
47017
|
"|",
|
|
47025
47018
|
"\n",
|
|
47026
47019
|
" "
|
|
47027
|
-
],
|
|
47020
|
+
], FM = (e, t, n) => {
|
|
47028
47021
|
let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
|
|
47029
47022
|
if (e.trim() === "") return [];
|
|
47030
47023
|
if (i(e)) return [e.trim()];
|
|
@@ -47036,31 +47029,31 @@ var kM = () => {
|
|
|
47036
47029
|
a.push(e);
|
|
47037
47030
|
continue;
|
|
47038
47031
|
}
|
|
47039
|
-
a.push(...
|
|
47032
|
+
a.push(...IM(e, t, i));
|
|
47040
47033
|
}
|
|
47041
47034
|
}
|
|
47042
47035
|
return a;
|
|
47043
|
-
},
|
|
47044
|
-
for (let r of
|
|
47036
|
+
}, IM = (e, t, n) => {
|
|
47037
|
+
for (let r of PM) {
|
|
47045
47038
|
if (r === t || !e.includes(r)) continue;
|
|
47046
47039
|
let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
|
|
47047
47040
|
if (i.length >= 2 && i.every(n)) return i;
|
|
47048
47041
|
}
|
|
47049
47042
|
return [e];
|
|
47050
|
-
},
|
|
47043
|
+
}, LM = (e, t, n) => {
|
|
47051
47044
|
let r = /* @__PURE__ */ new Set();
|
|
47052
|
-
for (let i of e) if (i !== "") if (n) for (let e of
|
|
47045
|
+
for (let i of e) if (i !== "") if (n) for (let e of FM(i, n, t)) r.add(e);
|
|
47053
47046
|
else r.add(i);
|
|
47054
47047
|
return [...r];
|
|
47055
|
-
},
|
|
47048
|
+
}, RM = (e) => !e.some((e) => e != null && String(e).trim() !== ""), zM = (e, t) => {
|
|
47056
47049
|
let n = 0;
|
|
47057
47050
|
for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
|
|
47058
47051
|
return n;
|
|
47059
|
-
},
|
|
47060
|
-
let r = Math.min(e.length, t +
|
|
47052
|
+
}, BM = 50, VM = (e, t, n) => {
|
|
47053
|
+
let r = Math.min(e.length, t + BM);
|
|
47061
47054
|
for (let i = t; i < r; i++) {
|
|
47062
47055
|
let t = e[i];
|
|
47063
|
-
if (!t ||
|
|
47056
|
+
if (!t || RM(t)) continue;
|
|
47064
47057
|
let r = !0;
|
|
47065
47058
|
for (let e = 0; e < n; e++) {
|
|
47066
47059
|
let n = t[e];
|
|
@@ -47074,60 +47067,64 @@ var kM = () => {
|
|
|
47074
47067
|
return Array.from({ length: n }, (n, i) => {
|
|
47075
47068
|
for (let n = t; n < r; n++) {
|
|
47076
47069
|
let t = e[n];
|
|
47077
|
-
if (!t ||
|
|
47070
|
+
if (!t || RM(t)) continue;
|
|
47078
47071
|
let r = t[i], a = r == null ? "" : String(r).trim();
|
|
47079
47072
|
if (a !== "") return a;
|
|
47080
47073
|
}
|
|
47081
47074
|
return "";
|
|
47082
47075
|
});
|
|
47083
|
-
},
|
|
47076
|
+
}, HM = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, UM = (e, t, n, r) => {
|
|
47084
47077
|
if (t < 0) {
|
|
47085
|
-
let t =
|
|
47078
|
+
let t = zM(e, n), i = VM(e, n, t);
|
|
47086
47079
|
return Array.from({ length: t }, (e, t) => r(t, i[t]));
|
|
47087
47080
|
}
|
|
47088
|
-
|
|
47089
|
-
},
|
|
47081
|
+
let i = e[t] ?? [], a = Math.max(i.length, zM(e, n)), o = VM(e, n, a);
|
|
47082
|
+
return EM(Array.from({ length: a }, (e, t) => {
|
|
47083
|
+
let n = String(i[t] ?? "").trim();
|
|
47084
|
+
return n === "" ? r(t, o[t]) : n;
|
|
47085
|
+
}));
|
|
47086
|
+
}, WM = () => ({
|
|
47090
47087
|
headerRowIndex: 0,
|
|
47091
47088
|
dataStartIndex: 1,
|
|
47092
47089
|
confidence: 1,
|
|
47093
47090
|
mode: "header",
|
|
47094
47091
|
review: { kind: "none" }
|
|
47095
|
-
}),
|
|
47092
|
+
}), GM = (e, t) => {
|
|
47096
47093
|
let n = [e];
|
|
47097
47094
|
for (let r of t) n.push(e.map((e) => r[e] ?? ""));
|
|
47098
47095
|
return n;
|
|
47099
|
-
},
|
|
47096
|
+
}, KM = (e) => {
|
|
47100
47097
|
let t = /* @__PURE__ */ new Map();
|
|
47101
47098
|
for (let n = 0; n < e.length; n++) t.set(e[n], n);
|
|
47102
47099
|
return t;
|
|
47103
|
-
},
|
|
47100
|
+
}, qM = (e, t, n) => {
|
|
47104
47101
|
let r = [];
|
|
47105
47102
|
for (let i = t; i < e.length; i++) {
|
|
47106
47103
|
let t = e[i];
|
|
47107
|
-
if (
|
|
47104
|
+
if (RM(t)) continue;
|
|
47108
47105
|
let a = t[n], o = a == null ? "" : String(a);
|
|
47109
47106
|
o !== "" && r.push(o);
|
|
47110
47107
|
}
|
|
47111
47108
|
return r;
|
|
47112
|
-
},
|
|
47109
|
+
}, JM = (e, t) => {
|
|
47113
47110
|
let n = {};
|
|
47114
47111
|
for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
|
|
47115
47112
|
return n;
|
|
47116
|
-
},
|
|
47113
|
+
}, YM = (e, t, n, r) => {
|
|
47117
47114
|
let i = [];
|
|
47118
|
-
for (let a = n; a < e.length && i.length < r; a++)
|
|
47115
|
+
for (let a = n; a < e.length && i.length < r; a++) RM(e[a]) || i.push(JM(e[a], t));
|
|
47119
47116
|
return i;
|
|
47120
|
-
},
|
|
47121
|
-
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 } =
|
|
47117
|
+
}, XM = () => {
|
|
47118
|
+
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)(() => {
|
|
47122
47119
|
if (!n) return [];
|
|
47123
|
-
let t = [], s =
|
|
47120
|
+
let t = [], s = KM(r);
|
|
47124
47121
|
for (let [r, c] of Object.entries(a)) {
|
|
47125
47122
|
if (!c) continue;
|
|
47126
47123
|
let a = e.find((e) => e.id === c);
|
|
47127
47124
|
if (!a?.editor) continue;
|
|
47128
47125
|
let u = a.editor.type;
|
|
47129
47126
|
if (u !== "select" && u !== "multiselect") continue;
|
|
47130
|
-
let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g =
|
|
47127
|
+
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) => ({
|
|
47131
47128
|
imported: e,
|
|
47132
47129
|
mapped: f[e]
|
|
47133
47130
|
}));
|
|
@@ -47250,20 +47247,20 @@ var kM = () => {
|
|
|
47250
47247
|
submitCreate: F,
|
|
47251
47248
|
closeCreate: I
|
|
47252
47249
|
};
|
|
47253
|
-
},
|
|
47254
|
-
function
|
|
47255
|
-
let t =
|
|
47256
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
47250
|
+
}, ZM = (0, y.createContext)(null);
|
|
47251
|
+
function QM({ children: e }) {
|
|
47252
|
+
let t = XM();
|
|
47253
|
+
return /* @__PURE__ */ (0, O.jsx)(ZM.Provider, {
|
|
47257
47254
|
value: t,
|
|
47258
47255
|
children: e
|
|
47259
47256
|
});
|
|
47260
47257
|
}
|
|
47261
|
-
var
|
|
47262
|
-
let e = (0, y.useContext)(
|
|
47258
|
+
var $M = () => {
|
|
47259
|
+
let e = (0, y.useContext)(ZM);
|
|
47263
47260
|
if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
|
|
47264
47261
|
return e;
|
|
47265
|
-
},
|
|
47266
|
-
let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } =
|
|
47262
|
+
}, eN = ({ section: e }) => {
|
|
47263
|
+
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]);
|
|
47267
47264
|
return /* @__PURE__ */ (0, O.jsxs)("header", {
|
|
47268
47265
|
className: "updog__value-matching__section-header",
|
|
47269
47266
|
children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -47307,14 +47304,14 @@ var QM = () => {
|
|
|
47307
47304
|
})
|
|
47308
47305
|
})]
|
|
47309
47306
|
});
|
|
47310
|
-
},
|
|
47307
|
+
}, tN = {
|
|
47311
47308
|
",": ",",
|
|
47312
47309
|
";": ";",
|
|
47313
47310
|
"|": "|",
|
|
47314
47311
|
"\n": "\\n",
|
|
47315
47312
|
" ": "\\t"
|
|
47316
|
-
},
|
|
47317
|
-
let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } =
|
|
47313
|
+
}, nN = (e) => e === null ? "" : tN[e] ?? e, rN = ({ section: e }) => {
|
|
47314
|
+
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);
|
|
47318
47315
|
(0, y.useEffect)(() => {
|
|
47319
47316
|
s(a), l.current = a;
|
|
47320
47317
|
}, [a]), (0, y.useEffect)(() => {
|
|
@@ -47357,8 +47354,8 @@ var QM = () => {
|
|
|
47357
47354
|
})
|
|
47358
47355
|
]
|
|
47359
47356
|
});
|
|
47360
|
-
},
|
|
47361
|
-
let { t: n } = j(), { getSelectOptions: r, selectValue: i } =
|
|
47357
|
+
}, iN = ({ section: e, val: t }) => {
|
|
47358
|
+
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), [
|
|
47362
47359
|
i,
|
|
47363
47360
|
e.columnId,
|
|
47364
47361
|
t.imported
|
|
@@ -47410,8 +47407,8 @@ var QM = () => {
|
|
|
47410
47407
|
})
|
|
47411
47408
|
]
|
|
47412
47409
|
});
|
|
47413
|
-
},
|
|
47414
|
-
let { t } = j(), { getVisibleValues: n } =
|
|
47410
|
+
}, aN = ({ section: e }) => {
|
|
47411
|
+
let { t } = j(), { getVisibleValues: n } = $M(), r = n(e);
|
|
47415
47412
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47416
47413
|
className: "updog__value-matching__table",
|
|
47417
47414
|
children: [r.length === 0 ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -47431,7 +47428,7 @@ var QM = () => {
|
|
|
47431
47428
|
size: "sm",
|
|
47432
47429
|
weight: "medium",
|
|
47433
47430
|
children: t("dataEditor.uploader.matchValues.importedValues")
|
|
47434
|
-
}), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(
|
|
47431
|
+
}), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(rN, { section: e })]
|
|
47435
47432
|
}),
|
|
47436
47433
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__arrow-spacer" }),
|
|
47437
47434
|
/* @__PURE__ */ (0, O.jsx)(W, {
|
|
@@ -47443,25 +47440,25 @@ var QM = () => {
|
|
|
47443
47440
|
}),
|
|
47444
47441
|
/* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__action" })
|
|
47445
47442
|
]
|
|
47446
|
-
}), r.map((t) => /* @__PURE__ */ (0, O.jsx)(
|
|
47443
|
+
}), r.map((t) => /* @__PURE__ */ (0, O.jsx)(iN, {
|
|
47447
47444
|
section: e,
|
|
47448
47445
|
val: t
|
|
47449
47446
|
}, t.imported))]
|
|
47450
47447
|
});
|
|
47451
|
-
},
|
|
47452
|
-
let { isCollapsed: t } =
|
|
47448
|
+
}, oN = ({ section: e }) => {
|
|
47449
|
+
let { isCollapsed: t } = $M(), n = !t(e.columnId);
|
|
47453
47450
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47454
47451
|
className: "updog__value-matching__section",
|
|
47455
|
-
children: [/* @__PURE__ */ (0, O.jsx)(
|
|
47452
|
+
children: [/* @__PURE__ */ (0, O.jsx)(eN, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47456
47453
|
className: N("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
|
|
47457
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
47454
|
+
children: /* @__PURE__ */ (0, O.jsx)(aN, { section: e })
|
|
47458
47455
|
})]
|
|
47459
47456
|
});
|
|
47460
|
-
},
|
|
47461
|
-
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } =
|
|
47457
|
+
}, sN = () => {
|
|
47458
|
+
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = $M();
|
|
47462
47459
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47463
47460
|
className: "updog__value-matching",
|
|
47464
|
-
children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47461
|
+
children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(oN, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(NM, {
|
|
47465
47462
|
open: !0,
|
|
47466
47463
|
existingOptions: n,
|
|
47467
47464
|
initialName: r,
|
|
@@ -47469,15 +47466,15 @@ var QM = () => {
|
|
|
47469
47466
|
onSubmit: i
|
|
47470
47467
|
})]
|
|
47471
47468
|
});
|
|
47472
|
-
},
|
|
47469
|
+
}, cN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47473
47470
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
47474
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
47475
|
-
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }),
|
|
47476
|
-
let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } =
|
|
47471
|
+
children: /* @__PURE__ */ (0, O.jsx)(QM, { children: /* @__PURE__ */ (0, O.jsx)(sN, {}) })
|
|
47472
|
+
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), lN = 20, uN = () => {
|
|
47473
|
+
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)(() => {
|
|
47477
47474
|
let e = {};
|
|
47478
47475
|
for (let [t, n] of Object.entries(s)) n && (e[n] = t);
|
|
47479
47476
|
return e;
|
|
47480
|
-
}, [s]), f = (0, y.useMemo)(() => i ?
|
|
47477
|
+
}, [s]), f = (0, y.useMemo)(() => i ? YM(i.rawRows, a, o, lN) : [], [
|
|
47481
47478
|
i,
|
|
47482
47479
|
a,
|
|
47483
47480
|
o
|
|
@@ -47529,8 +47526,8 @@ var QM = () => {
|
|
|
47529
47526
|
}, e.id);
|
|
47530
47527
|
})]
|
|
47531
47528
|
});
|
|
47532
|
-
},
|
|
47533
|
-
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 } =
|
|
47529
|
+
}, dN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(uN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), fN = () => {
|
|
47530
|
+
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 = [
|
|
47534
47531
|
{
|
|
47535
47532
|
id: "csv",
|
|
47536
47533
|
format: "csv",
|
|
@@ -47588,20 +47585,20 @@ var QM = () => {
|
|
|
47588
47585
|
}, [c]),
|
|
47589
47586
|
handleRemoteSourceSelect: p
|
|
47590
47587
|
};
|
|
47591
|
-
},
|
|
47592
|
-
function
|
|
47593
|
-
let t =
|
|
47594
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
47588
|
+
}, pN = (0, y.createContext)(null);
|
|
47589
|
+
function mN({ children: e }) {
|
|
47590
|
+
let t = fN();
|
|
47591
|
+
return /* @__PURE__ */ (0, O.jsx)(pN.Provider, {
|
|
47595
47592
|
value: t,
|
|
47596
47593
|
children: e
|
|
47597
47594
|
});
|
|
47598
47595
|
}
|
|
47599
|
-
var
|
|
47600
|
-
let e = (0, y.useContext)(
|
|
47596
|
+
var hN = () => {
|
|
47597
|
+
let e = (0, y.useContext)(pN);
|
|
47601
47598
|
if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
|
|
47602
47599
|
return e;
|
|
47603
|
-
},
|
|
47604
|
-
let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } =
|
|
47600
|
+
}, gN = () => {
|
|
47601
|
+
let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } = hN();
|
|
47605
47602
|
return /* @__PURE__ */ (0, O.jsx)(fc, {
|
|
47606
47603
|
options: t,
|
|
47607
47604
|
onSelect: n,
|
|
@@ -47613,7 +47610,7 @@ var mN = () => {
|
|
|
47613
47610
|
children: e("dataEditor.uploader.uploadFile.downloadExample")
|
|
47614
47611
|
})
|
|
47615
47612
|
});
|
|
47616
|
-
},
|
|
47613
|
+
}, _N = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
|
|
47617
47614
|
className: "updog__remote-source-btn__icon",
|
|
47618
47615
|
dangerouslySetInnerHTML: { __html: e.icon }
|
|
47619
47616
|
}) : /* @__PURE__ */ (0, O.jsx)("span", {
|
|
@@ -47622,7 +47619,7 @@ var mN = () => {
|
|
|
47622
47619
|
src: e.icon,
|
|
47623
47620
|
alt: e.label
|
|
47624
47621
|
})
|
|
47625
|
-
}),
|
|
47622
|
+
}), vN = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
|
|
47626
47623
|
variant: "filled",
|
|
47627
47624
|
color: "neutral",
|
|
47628
47625
|
size: "sm",
|
|
@@ -47632,11 +47629,11 @@ var mN = () => {
|
|
|
47632
47629
|
disabled: !t && n,
|
|
47633
47630
|
loading: t,
|
|
47634
47631
|
spinnerPosition: "start",
|
|
47635
|
-
startIcon: /* @__PURE__ */ (0, O.jsx)(
|
|
47632
|
+
startIcon: /* @__PURE__ */ (0, O.jsx)(_N, { source: e }),
|
|
47636
47633
|
title: e.description,
|
|
47637
47634
|
children: e.label
|
|
47638
|
-
}),
|
|
47639
|
-
let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } =
|
|
47635
|
+
}), yN = () => {
|
|
47636
|
+
let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = hN(), o = n.length > 0;
|
|
47640
47637
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47641
47638
|
className: "updog__source-picker",
|
|
47642
47639
|
children: [
|
|
@@ -47663,7 +47660,7 @@ var mN = () => {
|
|
|
47663
47660
|
}),
|
|
47664
47661
|
o && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(ac, {}), /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47665
47662
|
className: "updog__source-picker__sources-list",
|
|
47666
|
-
children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47663
|
+
children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(vN, {
|
|
47667
47664
|
source: e,
|
|
47668
47665
|
loading: r === e.id,
|
|
47669
47666
|
disabled: !!r,
|
|
@@ -47677,7 +47674,7 @@ var mN = () => {
|
|
|
47677
47674
|
})
|
|
47678
47675
|
]
|
|
47679
47676
|
});
|
|
47680
|
-
},
|
|
47677
|
+
}, bN = () => {
|
|
47681
47678
|
let { t: e } = j();
|
|
47682
47679
|
return /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47683
47680
|
className: "updog__uploading-state",
|
|
@@ -47690,12 +47687,12 @@ var mN = () => {
|
|
|
47690
47687
|
children: e("dataEditor.uploader.uploadFile.uploading")
|
|
47691
47688
|
})]
|
|
47692
47689
|
});
|
|
47693
|
-
},
|
|
47694
|
-
let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } =
|
|
47690
|
+
}, xN = () => {
|
|
47691
|
+
let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = hN();
|
|
47695
47692
|
return /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47696
47693
|
className: N("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
|
|
47697
47694
|
onClick: t ? void 0 : a,
|
|
47698
|
-
children: n ? /* @__PURE__ */ (0, O.jsx)(
|
|
47695
|
+
children: n ? /* @__PURE__ */ (0, O.jsx)(bN, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
|
|
47699
47696
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47700
47697
|
className: "updog__step-select-files__icon-container",
|
|
47701
47698
|
children: r ? /* @__PURE__ */ (0, O.jsx)(oe, {
|
|
@@ -47706,7 +47703,7 @@ var mN = () => {
|
|
|
47706
47703
|
className: "updog__step-select-files__icon"
|
|
47707
47704
|
})
|
|
47708
47705
|
}),
|
|
47709
|
-
!r && /* @__PURE__ */ (0, O.jsx)(
|
|
47706
|
+
!r && /* @__PURE__ */ (0, O.jsx)(yN, {}),
|
|
47710
47707
|
r && /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47711
47708
|
className: "updog__step-select-files__info",
|
|
47712
47709
|
children: [/* @__PURE__ */ (0, O.jsx)(W, {
|
|
@@ -47723,21 +47720,21 @@ var mN = () => {
|
|
|
47723
47720
|
})
|
|
47724
47721
|
] })
|
|
47725
47722
|
});
|
|
47726
|
-
},
|
|
47727
|
-
let { getRootProps: e, getInputProps: t, isDragActive: n } =
|
|
47723
|
+
}, SN = () => {
|
|
47724
|
+
let { getRootProps: e, getInputProps: t, isDragActive: n } = hN();
|
|
47728
47725
|
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
47729
47726
|
className: "updog__step-select-files__dropzone",
|
|
47730
47727
|
...e(),
|
|
47731
47728
|
children: [
|
|
47732
47729
|
/* @__PURE__ */ (0, O.jsx)("input", { ...t() }),
|
|
47733
|
-
/* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(
|
|
47730
|
+
/* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(xN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(gN, {}) })] }),
|
|
47734
47731
|
n && /* @__PURE__ */ (0, O.jsx)(oh, {})
|
|
47735
47732
|
]
|
|
47736
47733
|
}) });
|
|
47737
|
-
},
|
|
47738
|
-
let { selectedSheet: t, setSelectedSheet: n } =
|
|
47734
|
+
}, CN = () => /* @__PURE__ */ (0, O.jsx)(mN, { children: /* @__PURE__ */ (0, O.jsx)(SN, {}) }), wN = ({ preview: e }) => {
|
|
47735
|
+
let { selectedSheet: t, setSelectedSheet: n } = ZN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
|
|
47739
47736
|
let { headers: t, rows: n } = e;
|
|
47740
|
-
return n.map((e) => t.map((t) => e[t] ?? ""));
|
|
47737
|
+
return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
|
|
47741
47738
|
}, [e]);
|
|
47742
47739
|
return /* @__PURE__ */ (0, O.jsx)(hc, {
|
|
47743
47740
|
name: "sheetSelection",
|
|
@@ -47765,23 +47762,22 @@ var mN = () => {
|
|
|
47765
47762
|
className: "updog__sheet-preview-emptyText",
|
|
47766
47763
|
children: r("dataEditor.uploader.sheetSelection.emptySheet")
|
|
47767
47764
|
}) : /* @__PURE__ */ (0, O.jsx)(rv, {
|
|
47768
|
-
headers: e.headers,
|
|
47769
47765
|
rows: o,
|
|
47770
47766
|
scrollbars: !1
|
|
47771
47767
|
})
|
|
47772
47768
|
})]
|
|
47773
47769
|
})
|
|
47774
47770
|
});
|
|
47775
|
-
},
|
|
47776
|
-
let { sheetPreviews: e } =
|
|
47771
|
+
}, TN = () => {
|
|
47772
|
+
let { sheetPreviews: e } = ZN();
|
|
47777
47773
|
return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
|
|
47778
47774
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
47779
47775
|
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
47780
47776
|
className: "updog__sheet-preview-grid",
|
|
47781
|
-
children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(
|
|
47777
|
+
children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(wN, { preview: e }, e.name))
|
|
47782
47778
|
})
|
|
47783
47779
|
}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) });
|
|
47784
|
-
},
|
|
47780
|
+
}, EN = (e, t, n) => {
|
|
47785
47781
|
let r = new Map(t.map((e) => [e.id, e])), i = [];
|
|
47786
47782
|
for (let [t, a] of Object.entries(e)) a && i.push({
|
|
47787
47783
|
csvHeader: t,
|
|
@@ -47789,11 +47785,11 @@ var mN = () => {
|
|
|
47789
47785
|
column: n.has(a) ? void 0 : r.get(a)
|
|
47790
47786
|
});
|
|
47791
47787
|
return i;
|
|
47792
|
-
},
|
|
47788
|
+
}, DN = (e) => {
|
|
47793
47789
|
let t = [];
|
|
47794
47790
|
for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
|
|
47795
47791
|
return t;
|
|
47796
|
-
},
|
|
47792
|
+
}, ON = (e, t, n) => {
|
|
47797
47793
|
let r = {};
|
|
47798
47794
|
for (let { csvHeader: i, columnId: a, column: o } of t) {
|
|
47799
47795
|
let t = e[i] ?? "";
|
|
@@ -47808,7 +47804,7 @@ var mN = () => {
|
|
|
47808
47804
|
continue;
|
|
47809
47805
|
}
|
|
47810
47806
|
if (s === "multiselect") {
|
|
47811
|
-
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ?
|
|
47807
|
+
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? FM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
|
|
47812
47808
|
for (let e of s) {
|
|
47813
47809
|
let t = n.valueMapping[a]?.[e.trim()];
|
|
47814
47810
|
t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
|
|
@@ -47820,16 +47816,16 @@ var mN = () => {
|
|
|
47820
47816
|
r[a] = o.transformer ? o.transformer(c) : c;
|
|
47821
47817
|
}
|
|
47822
47818
|
return r;
|
|
47823
|
-
},
|
|
47819
|
+
}, kN = 200, AN = (e, t, n) => {
|
|
47824
47820
|
if (n) return n;
|
|
47825
47821
|
let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
|
|
47826
47822
|
for (let t of e) {
|
|
47827
47823
|
let e = t.trim();
|
|
47828
|
-
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >=
|
|
47824
|
+
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= kN)) break;
|
|
47829
47825
|
}
|
|
47830
47826
|
if (o.length === 0) return null;
|
|
47831
47827
|
let s = null, c = 0, l = 0;
|
|
47832
|
-
for (let e of
|
|
47828
|
+
for (let e of PM) {
|
|
47833
47829
|
let n = 0, r = 0;
|
|
47834
47830
|
for (let a of o) {
|
|
47835
47831
|
if (i(a) || !a.includes(e)) continue;
|
|
@@ -47842,7 +47838,7 @@ var mN = () => {
|
|
|
47842
47838
|
(n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
|
|
47843
47839
|
}
|
|
47844
47840
|
return c > 0 ? s : null;
|
|
47845
|
-
},
|
|
47841
|
+
}, jN = (e) => {
|
|
47846
47842
|
let t = /* @__PURE__ */ new Map();
|
|
47847
47843
|
for (let [n, r] of Object.entries(e)) {
|
|
47848
47844
|
let e = Pj(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
@@ -47850,8 +47846,8 @@ var mN = () => {
|
|
|
47850
47846
|
t.set(e, i);
|
|
47851
47847
|
}
|
|
47852
47848
|
return t;
|
|
47853
|
-
},
|
|
47854
|
-
let i =
|
|
47849
|
+
}, MN = (e, t, n, r) => {
|
|
47850
|
+
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) => {
|
|
47855
47851
|
if (Pj(n) === Pj(r) || a(r, n)) return;
|
|
47856
47852
|
let i = `${n} ${r}`;
|
|
47857
47853
|
t.has(i) || (t.add(i), e.push({
|
|
@@ -47871,16 +47867,16 @@ var mN = () => {
|
|
|
47871
47867
|
for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
|
|
47872
47868
|
return c;
|
|
47873
47869
|
};
|
|
47874
|
-
function
|
|
47870
|
+
function NN(e, t, n) {
|
|
47875
47871
|
let r = e.length, i = t;
|
|
47876
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
47872
|
+
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);
|
|
47877
47873
|
}
|
|
47878
|
-
function
|
|
47874
|
+
function PN(e, t) {
|
|
47879
47875
|
let n = Math.min(t, e - t), r = 1;
|
|
47880
47876
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
47881
47877
|
return r;
|
|
47882
47878
|
}
|
|
47883
|
-
function
|
|
47879
|
+
function FN(e, t) {
|
|
47884
47880
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
47885
47881
|
if (i.length === n) {
|
|
47886
47882
|
let a = Array(t).fill("");
|
|
@@ -47892,7 +47888,7 @@ function PN(e, t) {
|
|
|
47892
47888
|
};
|
|
47893
47889
|
return a(0), r;
|
|
47894
47890
|
}
|
|
47895
|
-
function
|
|
47891
|
+
function IN(e, t, n) {
|
|
47896
47892
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
47897
47893
|
if (a.length === t - 1) {
|
|
47898
47894
|
let o = [
|
|
@@ -47910,27 +47906,27 @@ function FN(e, t, n) {
|
|
|
47910
47906
|
}
|
|
47911
47907
|
//#endregion
|
|
47912
47908
|
//#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
|
|
47913
|
-
var
|
|
47914
|
-
function
|
|
47909
|
+
var LN = {};
|
|
47910
|
+
function RN(e, t) {
|
|
47915
47911
|
for (let n of t.validators ?? []) if (n.type !== "expression") {
|
|
47916
47912
|
if (n.type === "function") {
|
|
47917
|
-
if (n.fn(e,
|
|
47913
|
+
if (n.fn(e, LN) != null) return !1;
|
|
47918
47914
|
continue;
|
|
47919
47915
|
}
|
|
47920
|
-
if (Bm(n, e,
|
|
47916
|
+
if (Bm(n, e, LN) != null) return !1;
|
|
47921
47917
|
}
|
|
47922
47918
|
return !0;
|
|
47923
47919
|
}
|
|
47924
|
-
function
|
|
47925
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
47920
|
+
function zN(e, t) {
|
|
47921
|
+
for (let n = 0; n < t.length; n++) if (!RN(e.cells[n] ?? "", t[n])) return !1;
|
|
47926
47922
|
return !0;
|
|
47927
47923
|
}
|
|
47928
|
-
function
|
|
47929
|
-
return e.filter((e) =>
|
|
47924
|
+
function BN(e, t) {
|
|
47925
|
+
return e.filter((e) => zN(e, t));
|
|
47930
47926
|
}
|
|
47931
47927
|
//#endregion
|
|
47932
47928
|
//#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
|
|
47933
|
-
function
|
|
47929
|
+
function VN(e) {
|
|
47934
47930
|
if (e.length <= 1) return [];
|
|
47935
47931
|
let t = e[0].cells.length, n = [], r = -1;
|
|
47936
47932
|
for (let i = 0; i < t; i++) {
|
|
@@ -47947,25 +47943,25 @@ function BN(e) {
|
|
|
47947
47943
|
}
|
|
47948
47944
|
//#endregion
|
|
47949
47945
|
//#region src/components/DataUploader/utils/raggedRows/alignRow.ts
|
|
47950
|
-
function
|
|
47951
|
-
let r =
|
|
47946
|
+
function HN(e, t, n) {
|
|
47947
|
+
let r = NN(e, t.length, n), i = BN(r, t);
|
|
47952
47948
|
return i.length === 1 ? {
|
|
47953
47949
|
kind: "confident",
|
|
47954
47950
|
alignment: i[0]
|
|
47955
47951
|
} : i.length > 1 ? {
|
|
47956
47952
|
kind: "ambiguous",
|
|
47957
47953
|
candidates: i,
|
|
47958
|
-
disputeSpans:
|
|
47954
|
+
disputeSpans: VN(i)
|
|
47959
47955
|
} : {
|
|
47960
47956
|
kind: "invalid",
|
|
47961
47957
|
candidates: r,
|
|
47962
|
-
disputeSpans:
|
|
47958
|
+
disputeSpans: VN(r)
|
|
47963
47959
|
};
|
|
47964
47960
|
}
|
|
47965
47961
|
//#endregion
|
|
47966
47962
|
//#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
|
|
47967
|
-
function
|
|
47968
|
-
let r =
|
|
47963
|
+
function UN(e, t, n) {
|
|
47964
|
+
let r = HN(e, t, n);
|
|
47969
47965
|
if (r.kind === "confident") return {
|
|
47970
47966
|
cells: r.alignment.cells,
|
|
47971
47967
|
conflictColumns: []
|
|
@@ -47984,20 +47980,20 @@ function HN(e, t, n) {
|
|
|
47984
47980
|
}
|
|
47985
47981
|
//#endregion
|
|
47986
47982
|
//#region src/components/DataUploader/context/useViewModel.tsx
|
|
47987
|
-
var
|
|
47983
|
+
var WN = 5e3, GN = 15, KN = 20, qN = new Set([
|
|
47988
47984
|
"xlsx",
|
|
47989
47985
|
"xls",
|
|
47990
47986
|
"xlsb",
|
|
47991
47987
|
"ods"
|
|
47992
47988
|
]);
|
|
47993
|
-
function
|
|
47989
|
+
function JN() {
|
|
47994
47990
|
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)(() => {
|
|
47995
47991
|
let e = new Set(Object.values(b).filter(Boolean));
|
|
47996
47992
|
return n.filter((t) => t.unique && e.has(t.id));
|
|
47997
47993
|
}, [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", {
|
|
47998
47994
|
index: e + 1,
|
|
47999
47995
|
value: t
|
|
48000
|
-
}) : f("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [f]), oe = (0, y.useMemo)(() => _ ?
|
|
47996
|
+
}) : 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) : [], [
|
|
48001
47997
|
_,
|
|
48002
47998
|
re,
|
|
48003
47999
|
oe,
|
|
@@ -48015,16 +48011,16 @@ function qN() {
|
|
|
48015
48011
|
let e = [{
|
|
48016
48012
|
id: "select-files",
|
|
48017
48013
|
title: f("dataEditor.uploader.steps.selectFiles"),
|
|
48018
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48014
|
+
content: /* @__PURE__ */ (0, O.jsx)(CN, {})
|
|
48019
48015
|
}];
|
|
48020
48016
|
return N.length > 1 && e.push({
|
|
48021
48017
|
id: "sheet-selection",
|
|
48022
48018
|
title: f("dataEditor.uploader.steps.sheetSelection"),
|
|
48023
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48019
|
+
content: /* @__PURE__ */ (0, O.jsx)(TN, {})
|
|
48024
48020
|
}), _ && _.detection.review.kind !== "none" && e.push({
|
|
48025
48021
|
id: "header-selection",
|
|
48026
48022
|
title: f("dataEditor.uploader.steps.headerSelection"),
|
|
48027
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48023
|
+
content: /* @__PURE__ */ (0, O.jsx)(MM, {})
|
|
48028
48024
|
}), e.push({
|
|
48029
48025
|
id: "column-matching",
|
|
48030
48026
|
title: f("dataEditor.uploader.steps.matchColumns"),
|
|
@@ -48032,11 +48028,11 @@ function qN() {
|
|
|
48032
48028
|
}), ue && e.push({
|
|
48033
48029
|
id: "match-values",
|
|
48034
48030
|
title: f("dataEditor.uploader.steps.matchValues"),
|
|
48035
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48031
|
+
content: /* @__PURE__ */ (0, O.jsx)(cN, {})
|
|
48036
48032
|
}), S.length > 0 && de && e.push({
|
|
48037
48033
|
id: "primary-key",
|
|
48038
48034
|
title: f("dataEditor.uploader.steps.primaryKey"),
|
|
48039
|
-
content: /* @__PURE__ */ (0, O.jsx)(
|
|
48035
|
+
content: /* @__PURE__ */ (0, O.jsx)(dN, {})
|
|
48040
48036
|
}), e;
|
|
48041
48037
|
}, [
|
|
48042
48038
|
S.length,
|
|
@@ -48080,7 +48076,7 @@ function qN() {
|
|
|
48080
48076
|
sheetName: F
|
|
48081
48077
|
}).then((e) => {
|
|
48082
48078
|
if (e.kind !== "rows") return;
|
|
48083
|
-
let t =
|
|
48079
|
+
let t = TM(e.rows);
|
|
48084
48080
|
ie(t.headerRowIndex), ve({
|
|
48085
48081
|
fileName: A.name,
|
|
48086
48082
|
rawRows: e.rows,
|
|
@@ -48104,7 +48100,7 @@ function qN() {
|
|
|
48104
48100
|
E(!1);
|
|
48105
48101
|
return;
|
|
48106
48102
|
}
|
|
48107
|
-
let n =
|
|
48103
|
+
let n = TM(e.rows);
|
|
48108
48104
|
if (ie(n.headerRowIndex), ve({
|
|
48109
48105
|
fileName: t.name,
|
|
48110
48106
|
rawRows: e.rows,
|
|
@@ -48138,8 +48134,8 @@ function qN() {
|
|
|
48138
48134
|
if (e.kind !== "records") return;
|
|
48139
48135
|
ie(0), ve({
|
|
48140
48136
|
fileName: t.name,
|
|
48141
|
-
rawRows:
|
|
48142
|
-
detection:
|
|
48137
|
+
rawRows: GM(e.headers, e.rows),
|
|
48138
|
+
detection: WM()
|
|
48143
48139
|
});
|
|
48144
48140
|
} catch (t) {
|
|
48145
48141
|
E(!1), e.errorHandler.handleError({
|
|
@@ -48160,8 +48156,8 @@ function qN() {
|
|
|
48160
48156
|
if (e.kind !== "records") return;
|
|
48161
48157
|
ie(0), ve({
|
|
48162
48158
|
fileName: t.name,
|
|
48163
|
-
rawRows:
|
|
48164
|
-
detection:
|
|
48159
|
+
rawRows: GM(e.headers, e.rows),
|
|
48160
|
+
detection: WM()
|
|
48165
48161
|
});
|
|
48166
48162
|
} catch (t) {
|
|
48167
48163
|
E(!1), e.errorHandler.handleError({
|
|
@@ -48180,11 +48176,11 @@ function qN() {
|
|
|
48180
48176
|
le.parse(t, { format: "xlsx" }).then((e) => {
|
|
48181
48177
|
if (e.kind === "sheets") {
|
|
48182
48178
|
let n = e.sheets.map((e) => {
|
|
48183
|
-
let t =
|
|
48179
|
+
let t = TM(e.rows), n = HM(t, t.headerRowIndex), r = UM(e.rows, t.headerRowIndex, n, ae);
|
|
48184
48180
|
return {
|
|
48185
48181
|
name: e.name,
|
|
48186
48182
|
headers: r,
|
|
48187
|
-
rows:
|
|
48183
|
+
rows: YM(e.rows, r, n, GN),
|
|
48188
48184
|
totalRows: e.totalRows - 1
|
|
48189
48185
|
};
|
|
48190
48186
|
});
|
|
@@ -48192,7 +48188,7 @@ function qN() {
|
|
|
48192
48188
|
return;
|
|
48193
48189
|
}
|
|
48194
48190
|
if (e.kind !== "rows") return;
|
|
48195
|
-
let n =
|
|
48191
|
+
let n = TM(e.rows);
|
|
48196
48192
|
ie(n.headerRowIndex), ve({
|
|
48197
48193
|
fileName: t.name,
|
|
48198
48194
|
rawRows: e.rows,
|
|
@@ -48217,7 +48213,7 @@ function qN() {
|
|
|
48217
48213
|
]), De = (0, y.useCallback)((e) => {
|
|
48218
48214
|
E(!0), ne.current = e;
|
|
48219
48215
|
let t = e.name.split(".").pop()?.toLowerCase();
|
|
48220
|
-
t &&
|
|
48216
|
+
t && qN.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
|
|
48221
48217
|
}, [
|
|
48222
48218
|
Ce,
|
|
48223
48219
|
we,
|
|
@@ -48254,8 +48250,8 @@ function qN() {
|
|
|
48254
48250
|
});
|
|
48255
48251
|
ie(0), ve({
|
|
48256
48252
|
fileName: e.label,
|
|
48257
|
-
rawRows:
|
|
48258
|
-
detection:
|
|
48253
|
+
rawRows: GM(n, r),
|
|
48254
|
+
detection: WM()
|
|
48259
48255
|
});
|
|
48260
48256
|
}
|
|
48261
48257
|
} catch (e) {
|
|
@@ -48283,7 +48279,7 @@ function qN() {
|
|
|
48283
48279
|
return;
|
|
48284
48280
|
}
|
|
48285
48281
|
if (D) return;
|
|
48286
|
-
let e = {}, t = {}, r =
|
|
48282
|
+
let e = {}, t = {}, r = KM(U);
|
|
48287
48283
|
for (let [i, a] of Object.entries(b)) {
|
|
48288
48284
|
if (!a) continue;
|
|
48289
48285
|
let o = n.find((e) => e.id === a);
|
|
@@ -48292,9 +48288,9 @@ function qN() {
|
|
|
48292
48288
|
if (s !== "select" && s !== "multiselect") continue;
|
|
48293
48289
|
let c = o.editor.options, l = r.get(i);
|
|
48294
48290
|
if (l === void 0) continue;
|
|
48295
|
-
let u =
|
|
48291
|
+
let u = qM(_.rawRows, oe, l);
|
|
48296
48292
|
if (s === "multiselect") {
|
|
48297
|
-
let n = o.editor.delimiter, r =
|
|
48293
|
+
let n = o.editor.delimiter, r = AN(u, c, n);
|
|
48298
48294
|
t[a] = r;
|
|
48299
48295
|
let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
|
|
48300
48296
|
for (let e of u) {
|
|
@@ -48357,10 +48353,10 @@ function qN() {
|
|
|
48357
48353
|
if (!t) return;
|
|
48358
48354
|
let r = n.find((t) => t.id === e);
|
|
48359
48355
|
if (r?.editor?.type !== "multiselect") return;
|
|
48360
|
-
let i =
|
|
48356
|
+
let i = KM(U).get(t);
|
|
48361
48357
|
if (i === void 0) return;
|
|
48362
|
-
let a =
|
|
48363
|
-
He(e,
|
|
48358
|
+
let a = qM(_.rawRows, oe, i), o = r.editor.delimiter;
|
|
48359
|
+
He(e, AN(a, r.editor.options, o));
|
|
48364
48360
|
}, [
|
|
48365
48361
|
_,
|
|
48366
48362
|
b,
|
|
@@ -48381,7 +48377,7 @@ function qN() {
|
|
|
48381
48377
|
for (let [r, i] of Object.entries(b)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
|
|
48382
48378
|
return t;
|
|
48383
48379
|
}, [b, n]), Ke = (0, y.useCallback)(() => {
|
|
48384
|
-
let e = new Set(B.map((e) => e.id)), t =
|
|
48380
|
+
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));
|
|
48385
48381
|
return {
|
|
48386
48382
|
columnMapping: b,
|
|
48387
48383
|
valueMapping: Be,
|
|
@@ -48422,7 +48418,7 @@ function qN() {
|
|
|
48422
48418
|
if (!_ || !d?.onRowsImport) return;
|
|
48423
48419
|
let t = _;
|
|
48424
48420
|
v(null);
|
|
48425
|
-
let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ??
|
|
48421
|
+
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 = {
|
|
48426
48422
|
numberFormat: i.numberFormat,
|
|
48427
48423
|
dateFormat: i.dateFormat,
|
|
48428
48424
|
monthTable: op(f),
|
|
@@ -48431,14 +48427,14 @@ function qN() {
|
|
|
48431
48427
|
}, l = U, u = t.rawRows, p = [];
|
|
48432
48428
|
for (let e = oe; e < u.length; e++) {
|
|
48433
48429
|
let t = u[e];
|
|
48434
|
-
t && !
|
|
48430
|
+
t && !RM(t) && p.push(e);
|
|
48435
48431
|
}
|
|
48436
48432
|
let m = 0;
|
|
48437
48433
|
for (; m < p.length;) {
|
|
48438
48434
|
let e = Math.min(m + o, p.length), n = [];
|
|
48439
48435
|
for (let t = m; t < e; t++) {
|
|
48440
|
-
let e =
|
|
48441
|
-
n.push(
|
|
48436
|
+
let e = JM(u[p[t]] ?? [], l);
|
|
48437
|
+
n.push(ON(e, s, c));
|
|
48442
48438
|
}
|
|
48443
48439
|
let f = e >= p.length, h = Math.floor(m / o);
|
|
48444
48440
|
await d.onRowsImport({
|
|
@@ -48479,14 +48475,14 @@ function qN() {
|
|
|
48479
48475
|
B.length > 0 && u(B);
|
|
48480
48476
|
for (let [t, n] of Object.entries(H)) e.addColumnOptions(t, n);
|
|
48481
48477
|
let o = e.registerSource({ name: i.fileName });
|
|
48482
|
-
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(
|
|
48478
|
+
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(MN(b, Be, [...n, ...B], Mj(jj, l)));
|
|
48483
48479
|
let s = U, c = i.delimiter ?? ",", d = i.rawRows, p = [];
|
|
48484
48480
|
for (let e = oe; e < d.length; e++) {
|
|
48485
48481
|
let t = d[e];
|
|
48486
|
-
t && !
|
|
48482
|
+
t && !RM(t) && p.push(e);
|
|
48487
48483
|
}
|
|
48488
|
-
let m =
|
|
48489
|
-
numberFormat: rp(m,
|
|
48484
|
+
let m = YM(i.rawRows, s, oe, 1e3), h = EN(b, n, a), g = {
|
|
48485
|
+
numberFormat: rp(m, DN(h)),
|
|
48490
48486
|
dateFormat: cp(m, Ge(a)),
|
|
48491
48487
|
monthTable: op(f),
|
|
48492
48488
|
valueMapping: Be,
|
|
@@ -48498,11 +48494,11 @@ function qN() {
|
|
|
48498
48494
|
title: e
|
|
48499
48495
|
};
|
|
48500
48496
|
}), v = 0, y = () => {
|
|
48501
|
-
let n = Math.min(v +
|
|
48497
|
+
let n = Math.min(v + WN, p.length), i = [], a = [];
|
|
48502
48498
|
for (let e = v; e < n; e++) {
|
|
48503
|
-
let t = d[p[e]] ?? [], n =
|
|
48499
|
+
let t = d[p[e]] ?? [], n = JM(t, s);
|
|
48504
48500
|
if (t.length !== s.length) {
|
|
48505
|
-
let { cells: r, conflictColumns: i } =
|
|
48501
|
+
let { cells: r, conflictColumns: i } = UN(t.map((e) => String(e ?? "")), _, c);
|
|
48506
48502
|
if (r.length) {
|
|
48507
48503
|
let e = {};
|
|
48508
48504
|
for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
|
|
@@ -48520,10 +48516,10 @@ function qN() {
|
|
|
48520
48516
|
});
|
|
48521
48517
|
}
|
|
48522
48518
|
}
|
|
48523
|
-
i.push(
|
|
48519
|
+
i.push(ON(n, h, g));
|
|
48524
48520
|
}
|
|
48525
48521
|
let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: C ?? void 0 });
|
|
48526
|
-
for (let e = v; e < n; e++) e <
|
|
48522
|
+
for (let e = v; e < n; e++) e < KN || (d[p[e]] = void 0);
|
|
48527
48523
|
v = n, setTimeout(() => {
|
|
48528
48524
|
t.validateRows(l, u);
|
|
48529
48525
|
for (let { localIndex: t, columnIds: n } of a) {
|
|
@@ -48631,20 +48627,20 @@ function qN() {
|
|
|
48631
48627
|
}
|
|
48632
48628
|
//#endregion
|
|
48633
48629
|
//#region src/components/DataUploader/context/index.tsx
|
|
48634
|
-
var
|
|
48635
|
-
function
|
|
48636
|
-
let t =
|
|
48637
|
-
return /* @__PURE__ */ (0, O.jsx)(
|
|
48630
|
+
var YN = (0, y.createContext)(null);
|
|
48631
|
+
function XN({ children: e }) {
|
|
48632
|
+
let t = JN();
|
|
48633
|
+
return /* @__PURE__ */ (0, O.jsx)(YN.Provider, {
|
|
48638
48634
|
value: t,
|
|
48639
48635
|
children: e
|
|
48640
48636
|
});
|
|
48641
48637
|
}
|
|
48642
|
-
var
|
|
48643
|
-
let e = (0, y.useContext)(
|
|
48638
|
+
var ZN = () => {
|
|
48639
|
+
let e = (0, y.useContext)(YN);
|
|
48644
48640
|
if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
|
|
48645
48641
|
return e;
|
|
48646
|
-
},
|
|
48647
|
-
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } =
|
|
48642
|
+
}, QN = () => {
|
|
48643
|
+
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = ZN();
|
|
48648
48644
|
return /* @__PURE__ */ (0, O.jsx)(zc, {
|
|
48649
48645
|
steps: e,
|
|
48650
48646
|
activeStepIndex: t,
|
|
@@ -48652,79 +48648,79 @@ var XN = () => {
|
|
|
48652
48648
|
onStepChange: r,
|
|
48653
48649
|
isProgressive: !0
|
|
48654
48650
|
});
|
|
48655
|
-
},
|
|
48651
|
+
}, $N = () => /* @__PURE__ */ (0, O.jsx)(XN, { children: /* @__PURE__ */ (0, O.jsx)(QN, {}) }), eP = {
|
|
48656
48652
|
kty: "EC",
|
|
48657
48653
|
crv: "P-256",
|
|
48658
48654
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
48659
48655
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
48660
|
-
},
|
|
48656
|
+
}, tP = "updog_license_grant", nP = new Set([
|
|
48661
48657
|
"updog.tech",
|
|
48662
48658
|
"landing.updog.tech",
|
|
48663
48659
|
"demo.updog.tech"
|
|
48664
48660
|
]);
|
|
48665
|
-
function nP() {
|
|
48666
|
-
return tP.has(window.location.hostname);
|
|
48667
|
-
}
|
|
48668
48661
|
function rP() {
|
|
48669
|
-
return
|
|
48662
|
+
return nP.has(window.location.hostname);
|
|
48670
48663
|
}
|
|
48671
48664
|
function iP() {
|
|
48665
|
+
return !1;
|
|
48666
|
+
}
|
|
48667
|
+
function aP() {
|
|
48672
48668
|
return "https://api.updog.tech";
|
|
48673
48669
|
}
|
|
48674
|
-
function
|
|
48670
|
+
function oP(e) {
|
|
48675
48671
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
48676
48672
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
48677
48673
|
return i;
|
|
48678
48674
|
}
|
|
48679
|
-
async function
|
|
48675
|
+
async function sP(e) {
|
|
48680
48676
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
48681
48677
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
48682
48678
|
}
|
|
48683
|
-
var
|
|
48684
|
-
async function
|
|
48685
|
-
return
|
|
48679
|
+
var cP = null;
|
|
48680
|
+
async function lP() {
|
|
48681
|
+
return cP || (cP = await crypto.subtle.importKey("jwk", eP, {
|
|
48686
48682
|
name: "ECDSA",
|
|
48687
48683
|
namedCurve: "P-256"
|
|
48688
|
-
}, !1, ["verify"]),
|
|
48684
|
+
}, !1, ["verify"]), cP);
|
|
48689
48685
|
}
|
|
48690
|
-
function
|
|
48686
|
+
function uP() {
|
|
48691
48687
|
try {
|
|
48692
|
-
return localStorage.getItem(
|
|
48688
|
+
return localStorage.getItem(tP);
|
|
48693
48689
|
} catch {
|
|
48694
48690
|
return null;
|
|
48695
48691
|
}
|
|
48696
48692
|
}
|
|
48697
|
-
function
|
|
48693
|
+
function dP(e) {
|
|
48698
48694
|
try {
|
|
48699
|
-
localStorage.setItem(
|
|
48695
|
+
localStorage.setItem(tP, e);
|
|
48700
48696
|
} catch {}
|
|
48701
48697
|
}
|
|
48702
|
-
function
|
|
48698
|
+
function fP() {
|
|
48703
48699
|
try {
|
|
48704
|
-
localStorage.removeItem(
|
|
48700
|
+
localStorage.removeItem(tP);
|
|
48705
48701
|
} catch {}
|
|
48706
48702
|
}
|
|
48707
|
-
async function
|
|
48703
|
+
async function pP(e, t, n) {
|
|
48708
48704
|
let r = e.indexOf(".");
|
|
48709
48705
|
if (r === -1) return !1;
|
|
48710
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
48706
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = oP(i), s = oP(a), c = await lP();
|
|
48711
48707
|
if (!await crypto.subtle.verify({
|
|
48712
48708
|
name: "ECDSA",
|
|
48713
48709
|
hash: "SHA-256"
|
|
48714
48710
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
48715
48711
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
48716
48712
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
48717
|
-
let u = await
|
|
48713
|
+
let u = await sP(t);
|
|
48718
48714
|
return !(l.key !== u || l.domain !== n);
|
|
48719
48715
|
}
|
|
48720
|
-
async function
|
|
48721
|
-
let t =
|
|
48716
|
+
async function mP(e) {
|
|
48717
|
+
let t = uP();
|
|
48722
48718
|
if (!t) return {
|
|
48723
48719
|
valid: !1,
|
|
48724
48720
|
errorCode: "license.invalid"
|
|
48725
48721
|
};
|
|
48726
48722
|
try {
|
|
48727
|
-
if (await
|
|
48723
|
+
if (await pP(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
48728
48724
|
valid: !0,
|
|
48729
48725
|
errorCode: null
|
|
48730
48726
|
};
|
|
@@ -48734,23 +48730,23 @@ async function pP(e) {
|
|
|
48734
48730
|
errorCode: "license.invalid"
|
|
48735
48731
|
};
|
|
48736
48732
|
}
|
|
48737
|
-
async function
|
|
48738
|
-
if (
|
|
48733
|
+
async function hP(e, t = !0) {
|
|
48734
|
+
if (rP() || iP()) return {
|
|
48739
48735
|
valid: !0,
|
|
48740
48736
|
errorCode: null
|
|
48741
48737
|
};
|
|
48742
|
-
let n =
|
|
48738
|
+
let n = aP();
|
|
48743
48739
|
try {
|
|
48744
48740
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
48745
48741
|
if (r.ok) {
|
|
48746
48742
|
let e = await r.json();
|
|
48747
|
-
return t && e.grant &&
|
|
48743
|
+
return t && e.grant && dP(e.grant), {
|
|
48748
48744
|
valid: !0,
|
|
48749
48745
|
errorCode: null
|
|
48750
48746
|
};
|
|
48751
48747
|
}
|
|
48752
48748
|
if (r.status >= 400 && r.status < 500) {
|
|
48753
|
-
t &&
|
|
48749
|
+
t && fP();
|
|
48754
48750
|
try {
|
|
48755
48751
|
return await r.json();
|
|
48756
48752
|
} catch {
|
|
@@ -48762,7 +48758,7 @@ async function mP(e, t = !0) {
|
|
|
48762
48758
|
}
|
|
48763
48759
|
throw Error(`Server error: ${r.status}`);
|
|
48764
48760
|
} catch {
|
|
48765
|
-
return t ?
|
|
48761
|
+
return t ? mP(e) : {
|
|
48766
48762
|
valid: !1,
|
|
48767
48763
|
errorCode: "license.invalid"
|
|
48768
48764
|
};
|
|
@@ -48770,7 +48766,7 @@ async function mP(e, t = !0) {
|
|
|
48770
48766
|
}
|
|
48771
48767
|
//#endregion
|
|
48772
48768
|
//#region src/hooks/useLicenseValidation.ts
|
|
48773
|
-
function
|
|
48769
|
+
function gP(e, t, n = !0) {
|
|
48774
48770
|
let [r, i] = (0, y.useState)({
|
|
48775
48771
|
isValidating: t,
|
|
48776
48772
|
isValid: !1,
|
|
@@ -48790,7 +48786,7 @@ function hP(e, t, n = !0) {
|
|
|
48790
48786
|
isValidating: !0,
|
|
48791
48787
|
isValid: !1,
|
|
48792
48788
|
errorCode: null
|
|
48793
|
-
}),
|
|
48789
|
+
}), hP(e, n).then((e) => {
|
|
48794
48790
|
r || i({
|
|
48795
48791
|
isValidating: !1,
|
|
48796
48792
|
isValid: e.valid,
|
|
@@ -48813,7 +48809,7 @@ function hP(e, t, n = !0) {
|
|
|
48813
48809
|
}
|
|
48814
48810
|
//#endregion
|
|
48815
48811
|
//#region src/server/auth/AuthState.ts
|
|
48816
|
-
var
|
|
48812
|
+
var _P = class {
|
|
48817
48813
|
token = null;
|
|
48818
48814
|
get() {
|
|
48819
48815
|
return this.token;
|
|
@@ -48824,13 +48820,13 @@ var gP = class {
|
|
|
48824
48820
|
clear() {
|
|
48825
48821
|
this.token = null;
|
|
48826
48822
|
}
|
|
48827
|
-
},
|
|
48823
|
+
}, vP = class extends Error {
|
|
48828
48824
|
status;
|
|
48829
48825
|
code;
|
|
48830
48826
|
constructor(e) {
|
|
48831
48827
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
48832
48828
|
}
|
|
48833
|
-
},
|
|
48829
|
+
}, yP = class {
|
|
48834
48830
|
baseUrl;
|
|
48835
48831
|
apiKey;
|
|
48836
48832
|
auth;
|
|
@@ -48860,7 +48856,7 @@ var gP = class {
|
|
|
48860
48856
|
signal: r?.signal
|
|
48861
48857
|
});
|
|
48862
48858
|
} catch (e) {
|
|
48863
|
-
this.notify(new
|
|
48859
|
+
this.notify(new vP({
|
|
48864
48860
|
status: 0,
|
|
48865
48861
|
code: "network",
|
|
48866
48862
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -48871,7 +48867,7 @@ var gP = class {
|
|
|
48871
48867
|
try {
|
|
48872
48868
|
e = await s.json();
|
|
48873
48869
|
} catch {}
|
|
48874
|
-
this.notify(new
|
|
48870
|
+
this.notify(new vP({
|
|
48875
48871
|
status: s.status,
|
|
48876
48872
|
code: e.error ?? `http_${s.status}`,
|
|
48877
48873
|
message: e.message ?? s.statusText
|
|
@@ -48882,23 +48878,23 @@ var gP = class {
|
|
|
48882
48878
|
};
|
|
48883
48879
|
//#endregion
|
|
48884
48880
|
//#region src/server/endpoints/workspaces.ts
|
|
48885
|
-
async function
|
|
48881
|
+
async function bP(e, t) {
|
|
48886
48882
|
return e.post("/workspaces", {
|
|
48887
48883
|
primaryKey: t.primaryKey,
|
|
48888
48884
|
columns: t.columns
|
|
48889
48885
|
}, { signal: t.signal });
|
|
48890
48886
|
}
|
|
48891
|
-
async function
|
|
48887
|
+
async function xP(e) {
|
|
48892
48888
|
try {
|
|
48893
48889
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
48894
48890
|
} catch (e) {
|
|
48895
|
-
if (e instanceof
|
|
48891
|
+
if (e instanceof vP && e.status === 404) return;
|
|
48896
48892
|
throw e;
|
|
48897
48893
|
}
|
|
48898
48894
|
}
|
|
48899
48895
|
//#endregion
|
|
48900
48896
|
//#region src/server/endpoints/query.ts
|
|
48901
|
-
async function
|
|
48897
|
+
async function SP(e, t) {
|
|
48902
48898
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
48903
48899
|
page: {
|
|
48904
48900
|
limit: t.limit,
|
|
@@ -48916,12 +48912,12 @@ async function xP(e, t) {
|
|
|
48916
48912
|
}
|
|
48917
48913
|
//#endregion
|
|
48918
48914
|
//#region src/server/ScaleClient.ts
|
|
48919
|
-
var
|
|
48915
|
+
var CP = class {
|
|
48920
48916
|
disposed = !1;
|
|
48921
48917
|
constructor(e) {
|
|
48922
48918
|
this.deps = e;
|
|
48923
48919
|
}
|
|
48924
|
-
onQuery = (e) =>
|
|
48920
|
+
onQuery = (e) => SP(this.deps, e);
|
|
48925
48921
|
onEdit = async (e) => ({
|
|
48926
48922
|
rejected: !0,
|
|
48927
48923
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -48938,7 +48934,7 @@ var SP = class {
|
|
|
48938
48934
|
pageSize = void 0;
|
|
48939
48935
|
scrollSensitivity = void 0;
|
|
48940
48936
|
dispose = async () => {
|
|
48941
|
-
this.disposed || (this.disposed = !0, await
|
|
48937
|
+
this.disposed || (this.disposed = !0, await xP({
|
|
48942
48938
|
http: this.deps.http,
|
|
48943
48939
|
workspaceId: this.deps.workspaceId
|
|
48944
48940
|
}));
|
|
@@ -48946,25 +48942,25 @@ var SP = class {
|
|
|
48946
48942
|
};
|
|
48947
48943
|
//#endregion
|
|
48948
48944
|
//#region src/server/createScaleClient.ts
|
|
48949
|
-
async function
|
|
48950
|
-
let t = new
|
|
48945
|
+
async function wP(e) {
|
|
48946
|
+
let t = new _P(), n = new yP({
|
|
48951
48947
|
baseUrl: e.url,
|
|
48952
48948
|
apiKey: e.apiKey,
|
|
48953
48949
|
auth: t,
|
|
48954
48950
|
onDegraded: e.onDegraded
|
|
48955
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
48951
|
+
}), { workspaceId: r, accessToken: i } = await bP(n, {
|
|
48956
48952
|
primaryKey: e.primaryKey,
|
|
48957
48953
|
columns: e.columns,
|
|
48958
48954
|
signal: e.signal
|
|
48959
48955
|
});
|
|
48960
|
-
return t.set(i), new
|
|
48956
|
+
return t.set(i), new CP({
|
|
48961
48957
|
workspaceId: r,
|
|
48962
48958
|
http: n
|
|
48963
48959
|
});
|
|
48964
48960
|
}
|
|
48965
48961
|
//#endregion
|
|
48966
48962
|
//#region src/server/errors.ts
|
|
48967
|
-
function
|
|
48963
|
+
function TP(e, t, n) {
|
|
48968
48964
|
return {
|
|
48969
48965
|
code: e,
|
|
48970
48966
|
message: t,
|
|
@@ -48974,7 +48970,7 @@ function wP(e, t, n) {
|
|
|
48974
48970
|
}
|
|
48975
48971
|
//#endregion
|
|
48976
48972
|
//#region src/hooks/useScaleClient.ts
|
|
48977
|
-
function
|
|
48973
|
+
function EP(e) {
|
|
48978
48974
|
let [t, n] = (0, y.useState)({ status: "idle" }), r = (0, y.useRef)(e.columns), i = (0, y.useRef)(e.primaryKey);
|
|
48979
48975
|
return (0, y.useEffect)(() => {
|
|
48980
48976
|
if (!e.enabled) {
|
|
@@ -48983,7 +48979,7 @@ function TP(e) {
|
|
|
48983
48979
|
}
|
|
48984
48980
|
n({ status: "bootstrapping" });
|
|
48985
48981
|
let t = new AbortController(), a = null;
|
|
48986
|
-
return
|
|
48982
|
+
return wP({
|
|
48987
48983
|
url: e.url,
|
|
48988
48984
|
apiKey: e.apiKey,
|
|
48989
48985
|
primaryKey: i.current,
|
|
@@ -48992,7 +48988,7 @@ function TP(e) {
|
|
|
48992
48988
|
onDegraded: (e) => {
|
|
48993
48989
|
t.signal.aborted || n({
|
|
48994
48990
|
status: "failed",
|
|
48995
|
-
error:
|
|
48991
|
+
error: OP(e)
|
|
48996
48992
|
});
|
|
48997
48993
|
}
|
|
48998
48994
|
}).then((e) => {
|
|
@@ -49007,7 +49003,7 @@ function TP(e) {
|
|
|
49007
49003
|
}).catch((e) => {
|
|
49008
49004
|
t.signal.aborted || n({
|
|
49009
49005
|
status: "failed",
|
|
49010
|
-
error:
|
|
49006
|
+
error: DP(e)
|
|
49011
49007
|
});
|
|
49012
49008
|
}), () => {
|
|
49013
49009
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -49018,30 +49014,30 @@ function TP(e) {
|
|
|
49018
49014
|
e.apiKey
|
|
49019
49015
|
]), t;
|
|
49020
49016
|
}
|
|
49021
|
-
function EP(e) {
|
|
49022
|
-
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);
|
|
49023
|
-
}
|
|
49024
49017
|
function DP(e) {
|
|
49025
|
-
return e.status === 0 ?
|
|
49018
|
+
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);
|
|
49019
|
+
}
|
|
49020
|
+
function OP(e) {
|
|
49021
|
+
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);
|
|
49026
49022
|
}
|
|
49027
49023
|
//#endregion
|
|
49028
49024
|
//#region src/index.tsx
|
|
49029
|
-
function
|
|
49025
|
+
function kP(e) {
|
|
49030
49026
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
49031
49027
|
}
|
|
49032
|
-
function
|
|
49028
|
+
function AP(e) {
|
|
49033
49029
|
let t = (0, y.useMemo)(() => new ed(e.onError), [e.onError]);
|
|
49034
49030
|
return /* @__PURE__ */ (0, O.jsx)(kj, {
|
|
49035
49031
|
errorHandler: t,
|
|
49036
49032
|
children: /* @__PURE__ */ (0, O.jsx)(eh, {
|
|
49037
49033
|
...e,
|
|
49038
49034
|
errorHandler: t,
|
|
49039
|
-
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(
|
|
49035
|
+
children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)($N, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
|
|
49040
49036
|
})
|
|
49041
49037
|
});
|
|
49042
49038
|
}
|
|
49043
|
-
function
|
|
49044
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a =
|
|
49039
|
+
function jP(e) {
|
|
49040
|
+
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({
|
|
49045
49041
|
enabled: !s && c && u,
|
|
49046
49042
|
url: e.__server?.url ?? "",
|
|
49047
49043
|
apiKey: e.apiKey,
|
|
@@ -49096,7 +49092,7 @@ function AP(e) {
|
|
|
49096
49092
|
code: e,
|
|
49097
49093
|
message: "License validation failed",
|
|
49098
49094
|
source: "license"
|
|
49099
|
-
} }), 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)(
|
|
49095
|
+
} }), 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");
|
|
49100
49096
|
return t === "inline" ? /* @__PURE__ */ (0, O.jsx)("div", {
|
|
49101
49097
|
className: "updog__data-editor updog__data-editor-inline",
|
|
49102
49098
|
dir: i,
|
|
@@ -49116,18 +49112,18 @@ function AP(e) {
|
|
|
49116
49112
|
submitText: n("dataEditor.confirmClose.action")
|
|
49117
49113
|
})] });
|
|
49118
49114
|
}
|
|
49119
|
-
function
|
|
49115
|
+
function MP(e) {
|
|
49120
49116
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
49121
49117
|
return /* @__PURE__ */ (0, O.jsx)(A, {
|
|
49122
49118
|
translations: t,
|
|
49123
49119
|
rtl: n,
|
|
49124
49120
|
locale: r,
|
|
49125
|
-
children: /* @__PURE__ */ (0, O.jsx)(
|
|
49121
|
+
children: /* @__PURE__ */ (0, O.jsx)(jP, { ...a })
|
|
49126
49122
|
});
|
|
49127
49123
|
}
|
|
49128
49124
|
//#endregion
|
|
49129
49125
|
//#region src/wc.ts
|
|
49130
|
-
var
|
|
49126
|
+
var NP = {
|
|
49131
49127
|
"api-key": {
|
|
49132
49128
|
prop: "apiKey",
|
|
49133
49129
|
type: "string"
|
|
@@ -49160,12 +49156,12 @@ var MP = {
|
|
|
49160
49156
|
prop: "mode",
|
|
49161
49157
|
type: "string"
|
|
49162
49158
|
}
|
|
49163
|
-
},
|
|
49159
|
+
}, PP = class extends HTMLElement {
|
|
49164
49160
|
_root = null;
|
|
49165
49161
|
_props = {};
|
|
49166
49162
|
_renderScheduled = !1;
|
|
49167
49163
|
static get observedAttributes() {
|
|
49168
|
-
return Object.keys(
|
|
49164
|
+
return Object.keys(NP);
|
|
49169
49165
|
}
|
|
49170
49166
|
connectedCallback() {
|
|
49171
49167
|
this._root = (0, v.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
|
|
@@ -49176,7 +49172,7 @@ var MP = {
|
|
|
49176
49172
|
this._root?.unmount(), this._root = null;
|
|
49177
49173
|
}
|
|
49178
49174
|
attributeChangedCallback(e, t, n) {
|
|
49179
|
-
let r =
|
|
49175
|
+
let r = NP[e];
|
|
49180
49176
|
r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
|
|
49181
49177
|
this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
|
|
49182
49178
|
}), this._scheduleRender());
|
|
@@ -49193,11 +49189,11 @@ var MP = {
|
|
|
49193
49189
|
}
|
|
49194
49190
|
_scheduleRender() {
|
|
49195
49191
|
this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
|
|
49196
|
-
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(
|
|
49192
|
+
this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(MP, this._props));
|
|
49197
49193
|
}));
|
|
49198
49194
|
}
|
|
49199
49195
|
};
|
|
49200
|
-
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(
|
|
49196
|
+
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, {
|
|
49201
49197
|
get() {
|
|
49202
49198
|
return this._props[e];
|
|
49203
49199
|
},
|
|
@@ -49207,7 +49203,7 @@ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.
|
|
|
49207
49203
|
enumerable: !0,
|
|
49208
49204
|
configurable: !0
|
|
49209
49205
|
});
|
|
49210
|
-
Object.defineProperty(
|
|
49206
|
+
Object.defineProperty(PP.prototype, "open", {
|
|
49211
49207
|
get() {
|
|
49212
49208
|
return this.hasAttribute("open");
|
|
49213
49209
|
},
|
|
@@ -49216,5 +49212,5 @@ Object.defineProperty(NP.prototype, "open", {
|
|
|
49216
49212
|
},
|
|
49217
49213
|
enumerable: !0,
|
|
49218
49214
|
configurable: !0
|
|
49219
|
-
}), customElements.define("updog-editor",
|
|
49215
|
+
}), customElements.define("updog-editor", PP);
|
|
49220
49216
|
//#endregion
|