@updog/data-editor 0.1.48 → 0.1.49
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 +539 -443
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -12468,7 +12468,7 @@ var Td = ({ children: e, anchor: t, items: n, onSelect: r, onOpenChange: i }) =>
|
|
|
12468
12468
|
}, t))
|
|
12469
12469
|
}), Dd = ({ ref: e, dir: t, style: n, originalItems: r, currentItems: i, empty: a }) => /* @__PURE__ */ w("div", {
|
|
12470
12470
|
ref: e,
|
|
12471
|
-
className: "updog-grid-tooltip updog-grid-tooltip--dirty updog-grid-tooltip--multiselect",
|
|
12471
|
+
className: T("updog-grid-tooltip updog-grid-tooltip--dirty updog-grid-tooltip--multiselect", r.length === 1 && i.length === 1 && "updog-grid-tooltip--multiselect-single"),
|
|
12472
12472
|
dir: t,
|
|
12473
12473
|
style: n,
|
|
12474
12474
|
children: [
|
|
@@ -20892,7 +20892,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
20892
20892
|
return this.state.hasError ? /* @__PURE__ */ C(_v, { error: vv }) : this.props.children;
|
|
20893
20893
|
}
|
|
20894
20894
|
}, bv = ({ leftSlot: e }) => {
|
|
20895
|
-
let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } =
|
|
20895
|
+
let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = hb(), y = i && t === "editor", b = f(() => {
|
|
20896
20896
|
n(!1);
|
|
20897
20897
|
}, [n]), x = m[h]?.id === "sheet-selection", S = f(() => {
|
|
20898
20898
|
a ? c() : x ? _() : o();
|
|
@@ -21660,73 +21660,16 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21660
21660
|
i[e] = n, n && a.add(n);
|
|
21661
21661
|
}
|
|
21662
21662
|
return i;
|
|
21663
|
-
}, Hv =
|
|
21664
|
-
let { t:
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
o(e, void 0);
|
|
21668
|
-
}, [e, o]);
|
|
21669
|
-
return /* @__PURE__ */ w("div", {
|
|
21670
|
-
className: "updog__column-matching__row",
|
|
21671
|
-
children: [
|
|
21672
|
-
/* @__PURE__ */ C("div", {
|
|
21673
|
-
className: "updog__column-matching__column",
|
|
21674
|
-
children: /* @__PURE__ */ C("div", {
|
|
21675
|
-
className: "updog__column-matching__csv-header",
|
|
21676
|
-
children: /* @__PURE__ */ C(wa, { children: e })
|
|
21677
|
-
})
|
|
21678
|
-
}),
|
|
21679
|
-
/* @__PURE__ */ C("div", {
|
|
21680
|
-
className: "updog__column-matching__arrow-container",
|
|
21681
|
-
children: /* @__PURE__ */ C(A, {
|
|
21682
|
-
size: "1.25rem",
|
|
21683
|
-
className: E("updog__column-matching__arrow", "rtl-mirror", t ? "updog__column-matching__arrow--matched" : "updog__column-matching__arrow--unmatched")
|
|
21684
|
-
})
|
|
21685
|
-
}),
|
|
21686
|
-
/* @__PURE__ */ C("div", {
|
|
21687
|
-
className: "updog__column-matching__column",
|
|
21688
|
-
children: /* @__PURE__ */ C(eo, {
|
|
21689
|
-
options: n,
|
|
21690
|
-
value: t,
|
|
21691
|
-
onChange: c,
|
|
21692
|
-
onClear: l,
|
|
21693
|
-
placeholder: i
|
|
21694
|
-
})
|
|
21695
|
-
}),
|
|
21696
|
-
/* @__PURE__ */ w("div", {
|
|
21697
|
-
className: "updog__column-matching__action",
|
|
21698
|
-
children: [t?.startsWith("__dynamic__:") && r && /* @__PURE__ */ C(da, {
|
|
21699
|
-
content: /* @__PURE__ */ C(q, {
|
|
21700
|
-
size: "sm",
|
|
21701
|
-
children: s("dataEditor.uploader.matchColumns.createColumnWarning")
|
|
21702
|
-
}),
|
|
21703
|
-
placement: "bottom-end",
|
|
21704
|
-
children: /* @__PURE__ */ C(D, {
|
|
21705
|
-
size: "1.25rem",
|
|
21706
|
-
className: "updog__column-matching__action-icon"
|
|
21707
|
-
})
|
|
21708
|
-
}), !t && /* @__PURE__ */ C(da, {
|
|
21709
|
-
content: /* @__PURE__ */ C(q, {
|
|
21710
|
-
size: "sm",
|
|
21711
|
-
children: s("dataEditor.uploader.matchColumns.unmatchedWarning")
|
|
21712
|
-
}),
|
|
21713
|
-
placement: "bottom-end",
|
|
21714
|
-
children: /* @__PURE__ */ C(pe, {
|
|
21715
|
-
size: "1.25rem",
|
|
21716
|
-
className: "updog__column-matching__info-icon"
|
|
21717
|
-
})
|
|
21718
|
-
})]
|
|
21719
|
-
})
|
|
21720
|
-
]
|
|
21721
|
-
});
|
|
21722
|
-
}), Uv = () => {
|
|
21723
|
-
let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = tb(), [l, u] = b(null), d = y(null), p = f((e, t) => {
|
|
21663
|
+
}, Hv = () => {
|
|
21664
|
+
let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { parsedCsv: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = hb(), [l, u] = b(null), d = y(null), p = i?.headers ?? [], m = y(null);
|
|
21665
|
+
m.current === null && (m.current = Vv(p, e, n));
|
|
21666
|
+
let h = f((e, t) => {
|
|
21724
21667
|
if (t === "action:create") {
|
|
21725
21668
|
d.current = e, u({ title: e });
|
|
21726
21669
|
return;
|
|
21727
21670
|
}
|
|
21728
21671
|
o(e, t);
|
|
21729
|
-
}, [o]),
|
|
21672
|
+
}, [o]), g = f((e) => {
|
|
21730
21673
|
if (d.current === null) return;
|
|
21731
21674
|
let t = Math.random().toString(36).slice(2, 7), n = `${Go}${e.title}-${t}`;
|
|
21732
21675
|
c((t) => [...t, {
|
|
@@ -21734,11 +21677,9 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21734
21677
|
id: n,
|
|
21735
21678
|
size: 150
|
|
21736
21679
|
}]), o(d.current, n), d.current = null, u(null);
|
|
21737
|
-
}, [o, c]),
|
|
21680
|
+
}, [o, c]), _ = f(() => {
|
|
21738
21681
|
d.current = null, u(null);
|
|
21739
|
-
}, []),
|
|
21740
|
-
x.current === null && (x.current = Vv(_, e, n));
|
|
21741
|
-
let S = v(() => {
|
|
21682
|
+
}, []), x = v(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), S = v(() => {
|
|
21742
21683
|
let n = {
|
|
21743
21684
|
text: r("dataEditor.uploader.matchColumns.bestMatch"),
|
|
21744
21685
|
color: "green"
|
|
@@ -21746,8 +21687,8 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21746
21687
|
text: r("dataEditor.uploader.matchColumns.newColumnTag"),
|
|
21747
21688
|
color: "blue"
|
|
21748
21689
|
}, a = r("dataEditor.uploader.matchColumns.createColumn");
|
|
21749
|
-
return Object.fromEntries(
|
|
21750
|
-
let o =
|
|
21690
|
+
return Object.fromEntries(p.map((r) => {
|
|
21691
|
+
let o = m.current?.[r], c = e.map((e) => ({
|
|
21751
21692
|
id: e.id,
|
|
21752
21693
|
text: e.title,
|
|
21753
21694
|
...e.id === o && { tag: n }
|
|
@@ -21767,78 +21708,177 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21767
21708
|
}), [r, c];
|
|
21768
21709
|
}));
|
|
21769
21710
|
}, [
|
|
21770
|
-
|
|
21711
|
+
p,
|
|
21771
21712
|
e,
|
|
21772
21713
|
s,
|
|
21773
21714
|
r,
|
|
21774
21715
|
t
|
|
21775
|
-
]),
|
|
21716
|
+
]), w = v(() => p.filter((e) => a[e]).length, [p, a]);
|
|
21717
|
+
return {
|
|
21718
|
+
headers: p,
|
|
21719
|
+
matchedCount: w,
|
|
21720
|
+
allMatched: w === p.length,
|
|
21721
|
+
placeholder: r("dataEditor.uploader.matchColumns.selectColumnPlaceholder"),
|
|
21722
|
+
existingNames: x,
|
|
21723
|
+
createModalValues: l,
|
|
21724
|
+
getRowData: f((e) => ({
|
|
21725
|
+
mappedValue: a[e],
|
|
21726
|
+
options: S[e],
|
|
21727
|
+
autoMatchId: m.current?.[e]
|
|
21728
|
+
}), [a, S]),
|
|
21729
|
+
onSelectChange: h,
|
|
21730
|
+
onClear: o,
|
|
21731
|
+
submitCreate: g,
|
|
21732
|
+
closeCreate: _
|
|
21733
|
+
};
|
|
21734
|
+
}, Uv = s(null);
|
|
21735
|
+
function Wv({ children: e }) {
|
|
21736
|
+
let t = Hv();
|
|
21737
|
+
return /* @__PURE__ */ C(Uv.Provider, {
|
|
21738
|
+
value: t,
|
|
21739
|
+
children: e
|
|
21740
|
+
});
|
|
21741
|
+
}
|
|
21742
|
+
var Gv = () => {
|
|
21743
|
+
let e = p(Uv);
|
|
21744
|
+
if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
|
|
21745
|
+
return e;
|
|
21746
|
+
}, Kv = () => {
|
|
21747
|
+
let { t: e } = K(), { matchedCount: t, allMatched: n, headers: r } = Gv(), i = n ? "green" : "yellow";
|
|
21748
|
+
return /* @__PURE__ */ C("header", {
|
|
21749
|
+
className: "updog__column-matching__header",
|
|
21750
|
+
children: /* @__PURE__ */ w("div", {
|
|
21751
|
+
className: "updog__column-matching__header-content",
|
|
21752
|
+
children: [
|
|
21753
|
+
/* @__PURE__ */ w("div", {
|
|
21754
|
+
className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
|
|
21755
|
+
children: [/* @__PURE__ */ C(q, {
|
|
21756
|
+
as: "div",
|
|
21757
|
+
size: "sm",
|
|
21758
|
+
weight: "medium",
|
|
21759
|
+
children: e("dataEditor.uploader.matchColumns.importedColumns")
|
|
21760
|
+
}), /* @__PURE__ */ C(Aa, {
|
|
21761
|
+
color: i,
|
|
21762
|
+
text: e("dataEditor.uploader.matchColumns.matchedCount", {
|
|
21763
|
+
matched: t,
|
|
21764
|
+
total: r.length
|
|
21765
|
+
})
|
|
21766
|
+
})]
|
|
21767
|
+
}),
|
|
21768
|
+
/* @__PURE__ */ C("div", { className: "updog__column-matching__header-spacer" }),
|
|
21769
|
+
/* @__PURE__ */ C(q, {
|
|
21770
|
+
as: "div",
|
|
21771
|
+
size: "sm",
|
|
21772
|
+
weight: "medium",
|
|
21773
|
+
className: "updog__column-matching__header-column",
|
|
21774
|
+
children: e("dataEditor.uploader.matchColumns.targetColumns")
|
|
21775
|
+
}),
|
|
21776
|
+
/* @__PURE__ */ C("div", { className: "updog__column-matching__action" })
|
|
21777
|
+
]
|
|
21778
|
+
})
|
|
21779
|
+
});
|
|
21780
|
+
}, qv = d(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, onSelectChange: a, onClear: o }) => {
|
|
21781
|
+
let { t: s } = K(), c = !t, l = t?.startsWith("__dynamic__:") && !!r, u = f((t) => {
|
|
21782
|
+
a(e, t);
|
|
21783
|
+
}, [e, a]), d = f(() => {
|
|
21784
|
+
o(e, void 0);
|
|
21785
|
+
}, [e, o]);
|
|
21776
21786
|
return /* @__PURE__ */ w("div", {
|
|
21777
|
-
className: "updog__column-
|
|
21787
|
+
className: "updog__column-matching__row",
|
|
21778
21788
|
children: [
|
|
21779
|
-
/* @__PURE__ */ C("
|
|
21780
|
-
className: "updog__column-
|
|
21781
|
-
children: /* @__PURE__ */
|
|
21782
|
-
className: "updog__column-
|
|
21783
|
-
children:
|
|
21784
|
-
/* @__PURE__ */ w("div", {
|
|
21785
|
-
className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
|
|
21786
|
-
children: [/* @__PURE__ */ C(q, {
|
|
21787
|
-
as: "div",
|
|
21788
|
-
size: "sm",
|
|
21789
|
-
weight: "medium",
|
|
21790
|
-
children: r("dataEditor.uploader.matchColumns.importedColumns")
|
|
21791
|
-
}), /* @__PURE__ */ C(Aa, {
|
|
21792
|
-
color: E ? "green" : "yellow",
|
|
21793
|
-
text: r("dataEditor.uploader.matchColumns.matchedCount", {
|
|
21794
|
-
matched: T,
|
|
21795
|
-
total: _.length
|
|
21796
|
-
})
|
|
21797
|
-
})]
|
|
21798
|
-
}),
|
|
21799
|
-
/* @__PURE__ */ C("div", { className: "updog__column-matching__header-spacer" }),
|
|
21800
|
-
/* @__PURE__ */ C(q, {
|
|
21801
|
-
as: "div",
|
|
21802
|
-
size: "sm",
|
|
21803
|
-
weight: "medium",
|
|
21804
|
-
className: "updog__column-matching__header-column",
|
|
21805
|
-
children: r("dataEditor.uploader.matchColumns.targetColumns")
|
|
21806
|
-
}),
|
|
21807
|
-
/* @__PURE__ */ C("div", { className: "updog__column-matching__action" })
|
|
21808
|
-
]
|
|
21789
|
+
/* @__PURE__ */ C("div", {
|
|
21790
|
+
className: "updog__column-matching__column",
|
|
21791
|
+
children: /* @__PURE__ */ C("div", {
|
|
21792
|
+
className: "updog__column-matching__csv-header",
|
|
21793
|
+
children: /* @__PURE__ */ C(wa, { children: e })
|
|
21809
21794
|
})
|
|
21810
21795
|
}),
|
|
21811
21796
|
/* @__PURE__ */ C("div", {
|
|
21812
|
-
className: "updog__column-
|
|
21813
|
-
children: /* @__PURE__ */ C(
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21797
|
+
className: "updog__column-matching__arrow-container",
|
|
21798
|
+
children: /* @__PURE__ */ C(A, {
|
|
21799
|
+
size: "1.25rem",
|
|
21800
|
+
className: E("updog__column-matching__arrow", "rtl-mirror", c ? "updog__column-matching__arrow--unmatched" : "updog__column-matching__arrow--matched")
|
|
21801
|
+
})
|
|
21802
|
+
}),
|
|
21803
|
+
/* @__PURE__ */ C("div", {
|
|
21804
|
+
className: "updog__column-matching__column",
|
|
21805
|
+
children: /* @__PURE__ */ C(eo, {
|
|
21806
|
+
options: n,
|
|
21807
|
+
value: t,
|
|
21808
|
+
onChange: u,
|
|
21809
|
+
onClear: d,
|
|
21810
|
+
placeholder: i
|
|
21824
21811
|
})
|
|
21825
21812
|
}),
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21813
|
+
/* @__PURE__ */ w("div", {
|
|
21814
|
+
className: "updog__column-matching__action",
|
|
21815
|
+
children: [l && /* @__PURE__ */ C(da, {
|
|
21816
|
+
content: /* @__PURE__ */ C(q, {
|
|
21817
|
+
size: "sm",
|
|
21818
|
+
children: s("dataEditor.uploader.matchColumns.createColumnWarning")
|
|
21819
|
+
}),
|
|
21820
|
+
placement: "bottom-end",
|
|
21821
|
+
children: /* @__PURE__ */ C(D, {
|
|
21822
|
+
size: "1.25rem",
|
|
21823
|
+
className: "updog__column-matching__action-icon"
|
|
21824
|
+
})
|
|
21825
|
+
}), c && /* @__PURE__ */ C(da, {
|
|
21826
|
+
content: /* @__PURE__ */ C(q, {
|
|
21827
|
+
size: "sm",
|
|
21828
|
+
children: s("dataEditor.uploader.matchColumns.unmatchedWarning")
|
|
21829
|
+
}),
|
|
21830
|
+
placement: "bottom-end",
|
|
21831
|
+
children: /* @__PURE__ */ C(pe, {
|
|
21832
|
+
size: "1.25rem",
|
|
21833
|
+
className: "updog__column-matching__info-icon"
|
|
21834
|
+
})
|
|
21835
|
+
})]
|
|
21832
21836
|
})
|
|
21833
21837
|
]
|
|
21834
21838
|
});
|
|
21835
|
-
},
|
|
21836
|
-
let {
|
|
21839
|
+
}), Jv = () => {
|
|
21840
|
+
let { headers: e, placeholder: t, getRowData: n, onSelectChange: r, onClear: i } = Gv();
|
|
21841
|
+
return /* @__PURE__ */ C("div", {
|
|
21842
|
+
className: "updog__column-matching__content",
|
|
21843
|
+
children: /* @__PURE__ */ C("div", {
|
|
21844
|
+
className: "updog__column-matching__content-inner",
|
|
21845
|
+
children: e.map((e) => {
|
|
21846
|
+
let { mappedValue: a, options: o, autoMatchId: s } = n(e);
|
|
21847
|
+
return /* @__PURE__ */ C(qv, {
|
|
21848
|
+
csvHeader: e,
|
|
21849
|
+
mappedValue: a,
|
|
21850
|
+
options: o,
|
|
21851
|
+
autoMatchId: s,
|
|
21852
|
+
placeholder: t,
|
|
21853
|
+
onSelectChange: r,
|
|
21854
|
+
onClear: i
|
|
21855
|
+
}, e);
|
|
21856
|
+
})
|
|
21857
|
+
})
|
|
21858
|
+
});
|
|
21859
|
+
}, Yv = () => {
|
|
21860
|
+
let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = Gv();
|
|
21861
|
+
return e ? /* @__PURE__ */ C(fu, {
|
|
21862
|
+
open: !0,
|
|
21863
|
+
onClose: r,
|
|
21864
|
+
initialValues: e,
|
|
21865
|
+
existingNames: t,
|
|
21866
|
+
onSubmit: n
|
|
21867
|
+
}) : null;
|
|
21868
|
+
}, Xv = () => /* @__PURE__ */ w("div", {
|
|
21869
|
+
className: "updog__column-matching",
|
|
21870
|
+
children: [
|
|
21871
|
+
/* @__PURE__ */ C(Kv, {}),
|
|
21872
|
+
/* @__PURE__ */ C(Jv, {}),
|
|
21873
|
+
/* @__PURE__ */ C(Yv, {})
|
|
21874
|
+
]
|
|
21875
|
+
}), Zv = () => {
|
|
21876
|
+
let { parsedCsv: e } = hb();
|
|
21837
21877
|
return e ? /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
|
|
21838
21878
|
className: "updog__step-column-matching__content updog__scrollbar",
|
|
21839
|
-
children: /* @__PURE__ */ C(
|
|
21879
|
+
children: /* @__PURE__ */ C(Wv, { children: /* @__PURE__ */ C(Xv, {}) })
|
|
21840
21880
|
}), /* @__PURE__ */ C(bv, {})] }) }) : null;
|
|
21841
|
-
},
|
|
21881
|
+
}, Qv = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
|
|
21842
21882
|
let { t: a } = K();
|
|
21843
21883
|
return /* @__PURE__ */ C(Vi, {
|
|
21844
21884
|
open: e,
|
|
@@ -21851,13 +21891,13 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21851
21891
|
onSubmit: i
|
|
21852
21892
|
})
|
|
21853
21893
|
});
|
|
21854
|
-
},
|
|
21894
|
+
}, $v = [
|
|
21855
21895
|
",",
|
|
21856
21896
|
";",
|
|
21857
21897
|
"|",
|
|
21858
21898
|
"\n",
|
|
21859
21899
|
" "
|
|
21860
|
-
],
|
|
21900
|
+
], ey = (e, t, n) => {
|
|
21861
21901
|
let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
|
|
21862
21902
|
if (e.trim() === "") return [];
|
|
21863
21903
|
if (i(e)) return [e.trim()];
|
|
@@ -21869,27 +21909,27 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21869
21909
|
a.push(e);
|
|
21870
21910
|
continue;
|
|
21871
21911
|
}
|
|
21872
|
-
a.push(...
|
|
21912
|
+
a.push(...ty(e, t, i));
|
|
21873
21913
|
}
|
|
21874
21914
|
}
|
|
21875
21915
|
return a;
|
|
21876
|
-
},
|
|
21877
|
-
for (let r of
|
|
21916
|
+
}, ty = (e, t, n) => {
|
|
21917
|
+
for (let r of $v) {
|
|
21878
21918
|
if (r === t || !e.includes(r)) continue;
|
|
21879
21919
|
let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
|
|
21880
21920
|
if (i.length >= 2 && i.every(n)) return i;
|
|
21881
21921
|
}
|
|
21882
21922
|
return [e];
|
|
21883
|
-
},
|
|
21923
|
+
}, ny = (e, t, n, r) => {
|
|
21884
21924
|
let i = /* @__PURE__ */ new Set();
|
|
21885
21925
|
for (let a of e) {
|
|
21886
21926
|
let e = a[t];
|
|
21887
|
-
if (!(e === void 0 || e === "")) if (r) for (let t of
|
|
21927
|
+
if (!(e === void 0 || e === "")) if (r) for (let t of ey(e, r, n)) i.add(t);
|
|
21888
21928
|
else i.add(e);
|
|
21889
21929
|
}
|
|
21890
21930
|
return [...i];
|
|
21891
|
-
},
|
|
21892
|
-
let { columns: e } = X(), { t } = K(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, multiselectDelimiters: s, setMultiselectDelimiter: c, reapplyMultiselectDelimiter: l, pendingOptions: u, addPendingOption: d } =
|
|
21931
|
+
}, ry = () => {
|
|
21932
|
+
let { columns: e } = X(), { t } = K(), { parsedCsv: n, columnMapping: r, valueMapping: i, autoValueMapping: a, updateValueMapping: o, multiselectDelimiters: s, setMultiselectDelimiter: c, reapplyMultiselectDelimiter: l, pendingOptions: u, addPendingOption: d } = hb(), [p, h] = b({}), [g, _] = b({}), [x, S] = b(null), w = y(!1), T = v(() => {
|
|
21893
21933
|
if (!n) return [];
|
|
21894
21934
|
let t = [];
|
|
21895
21935
|
for (let [a, o] of Object.entries(r)) {
|
|
@@ -21898,7 +21938,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
21898
21938
|
if (!r?.editor) continue;
|
|
21899
21939
|
let c = r.editor.type;
|
|
21900
21940
|
if (c !== "select" && c !== "multiselect") continue;
|
|
21901
|
-
let l = r.editor.options, u = i[o] ?? {}, d = c === "multiselect", f = d ? s[o] ?? null : null, p =
|
|
21941
|
+
let l = r.editor.options, u = i[o] ?? {}, d = c === "multiselect", f = d ? s[o] ?? null : null, p = ny(n.rows, a, l, f).map((e) => ({
|
|
21902
21942
|
imported: e,
|
|
21903
21943
|
mapped: u[e]
|
|
21904
21944
|
}));
|
|
@@ -22019,20 +22059,20 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
|
|
|
22019
22059
|
submitCreate: I,
|
|
22020
22060
|
closeCreate: L
|
|
22021
22061
|
};
|
|
22022
|
-
},
|
|
22023
|
-
function
|
|
22024
|
-
let t =
|
|
22025
|
-
return /* @__PURE__ */ C(
|
|
22062
|
+
}, iy = s(null);
|
|
22063
|
+
function ay({ children: e }) {
|
|
22064
|
+
let t = ry();
|
|
22065
|
+
return /* @__PURE__ */ C(iy.Provider, {
|
|
22026
22066
|
value: t,
|
|
22027
22067
|
children: e
|
|
22028
22068
|
});
|
|
22029
22069
|
}
|
|
22030
|
-
var
|
|
22031
|
-
let e = p(
|
|
22070
|
+
var oy = () => {
|
|
22071
|
+
let e = p(iy);
|
|
22032
22072
|
if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
|
|
22033
22073
|
return e;
|
|
22034
|
-
},
|
|
22035
|
-
let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } =
|
|
22074
|
+
}, sy = ({ section: e }) => {
|
|
22075
|
+
let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = oy(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = f((t) => i(e.columnId, t), [i, e.columnId]), l = f(() => a(e.columnId), [a, e.columnId]);
|
|
22036
22076
|
return /* @__PURE__ */ w("header", {
|
|
22037
22077
|
className: "updog__value-matching__section-header",
|
|
22038
22078
|
children: [/* @__PURE__ */ C("div", {
|
|
@@ -22076,14 +22116,14 @@ var $v = () => {
|
|
|
22076
22116
|
})
|
|
22077
22117
|
})]
|
|
22078
22118
|
});
|
|
22079
|
-
},
|
|
22119
|
+
}, cy = {
|
|
22080
22120
|
",": ",",
|
|
22081
22121
|
";": ";",
|
|
22082
22122
|
"|": "|",
|
|
22083
22123
|
"\n": "\\n",
|
|
22084
22124
|
" ": "\\t"
|
|
22085
|
-
},
|
|
22086
|
-
let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } =
|
|
22125
|
+
}, ly = (e) => e === null ? "" : cy[e] ?? e, uy = ({ section: e }) => {
|
|
22126
|
+
let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } = oy(), i = y(e.delimiter), a = ly(e.delimiter), [o, s] = b(a), { debouncedValue: c } = za(o, 300), l = y(a);
|
|
22087
22127
|
m(() => {
|
|
22088
22128
|
s(a), l.current = a;
|
|
22089
22129
|
}, [a]), m(() => {
|
|
@@ -22126,8 +22166,8 @@ var $v = () => {
|
|
|
22126
22166
|
})
|
|
22127
22167
|
]
|
|
22128
22168
|
});
|
|
22129
|
-
},
|
|
22130
|
-
let { t: n } = K(), { getSelectOptions: r, selectValue: i } =
|
|
22169
|
+
}, dy = ({ section: e, val: t }) => {
|
|
22170
|
+
let { t: n } = K(), { getSelectOptions: r, selectValue: i } = oy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
|
|
22131
22171
|
i,
|
|
22132
22172
|
e.columnId,
|
|
22133
22173
|
t.imported
|
|
@@ -22179,8 +22219,8 @@ var $v = () => {
|
|
|
22179
22219
|
})
|
|
22180
22220
|
]
|
|
22181
22221
|
});
|
|
22182
|
-
},
|
|
22183
|
-
let { t } = K(), { getVisibleValues: n } =
|
|
22222
|
+
}, fy = ({ section: e }) => {
|
|
22223
|
+
let { t } = K(), { getVisibleValues: n } = oy(), r = n(e);
|
|
22184
22224
|
return /* @__PURE__ */ w("div", {
|
|
22185
22225
|
className: "updog__value-matching__table",
|
|
22186
22226
|
children: [r.length === 0 ? /* @__PURE__ */ C("div", {
|
|
@@ -22200,7 +22240,7 @@ var $v = () => {
|
|
|
22200
22240
|
size: "sm",
|
|
22201
22241
|
weight: "medium",
|
|
22202
22242
|
children: t("dataEditor.uploader.matchValues.importedValues")
|
|
22203
|
-
}), e.isMultiselect && /* @__PURE__ */ C(
|
|
22243
|
+
}), e.isMultiselect && /* @__PURE__ */ C(uy, { section: e })]
|
|
22204
22244
|
}),
|
|
22205
22245
|
/* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
|
|
22206
22246
|
/* @__PURE__ */ C(q, {
|
|
@@ -22212,25 +22252,25 @@ var $v = () => {
|
|
|
22212
22252
|
}),
|
|
22213
22253
|
/* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
|
|
22214
22254
|
]
|
|
22215
|
-
}), r.map((t) => /* @__PURE__ */ C(
|
|
22255
|
+
}), r.map((t) => /* @__PURE__ */ C(dy, {
|
|
22216
22256
|
section: e,
|
|
22217
22257
|
val: t
|
|
22218
22258
|
}, t.imported))]
|
|
22219
22259
|
});
|
|
22220
|
-
},
|
|
22221
|
-
let { isCollapsed: t } =
|
|
22260
|
+
}, py = ({ section: e }) => {
|
|
22261
|
+
let { isCollapsed: t } = oy(), n = !t(e.columnId);
|
|
22222
22262
|
return /* @__PURE__ */ w("div", {
|
|
22223
22263
|
className: "updog__value-matching__section",
|
|
22224
|
-
children: [/* @__PURE__ */ C(
|
|
22264
|
+
children: [/* @__PURE__ */ C(sy, { section: e }), /* @__PURE__ */ C("div", {
|
|
22225
22265
|
className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
|
|
22226
|
-
children: /* @__PURE__ */ C(
|
|
22266
|
+
children: /* @__PURE__ */ C(fy, { section: e })
|
|
22227
22267
|
})]
|
|
22228
22268
|
});
|
|
22229
|
-
},
|
|
22230
|
-
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } =
|
|
22269
|
+
}, my = () => {
|
|
22270
|
+
let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = oy();
|
|
22231
22271
|
return /* @__PURE__ */ w("div", {
|
|
22232
22272
|
className: "updog__value-matching",
|
|
22233
|
-
children: [e.map((e) => /* @__PURE__ */ C(
|
|
22273
|
+
children: [e.map((e) => /* @__PURE__ */ C(py, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Qv, {
|
|
22234
22274
|
open: !0,
|
|
22235
22275
|
existingOptions: n,
|
|
22236
22276
|
initialName: r,
|
|
@@ -22238,43 +22278,43 @@ var $v = () => {
|
|
|
22238
22278
|
onSubmit: i
|
|
22239
22279
|
})]
|
|
22240
22280
|
});
|
|
22241
|
-
},
|
|
22281
|
+
}, hy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
|
|
22242
22282
|
className: "updog__step-match-values__content updog__scrollbar",
|
|
22243
|
-
children: /* @__PURE__ */ C(
|
|
22244
|
-
}), /* @__PURE__ */ C(bv, {})] }) }),
|
|
22245
|
-
let {
|
|
22283
|
+
children: /* @__PURE__ */ C(ay, { children: /* @__PURE__ */ C(my, {}) })
|
|
22284
|
+
}), /* @__PURE__ */ C(bv, {})] }) }), gy = 20, _y = () => {
|
|
22285
|
+
let { store: e } = X(), { t } = K(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, columnMapping: a, primaryKeyColumns: o } = hb(), s = e.isClient(), c = f(() => r(null), [r]), l = v(() => {
|
|
22246
22286
|
let e = {};
|
|
22247
|
-
for (let [t, n] of Object.entries(
|
|
22287
|
+
for (let [t, n] of Object.entries(a)) n && (e[n] = t);
|
|
22248
22288
|
return e;
|
|
22249
|
-
}, [
|
|
22289
|
+
}, [a]), u = i?.rows.slice(0, gy) ?? [];
|
|
22250
22290
|
return /* @__PURE__ */ w("div", {
|
|
22251
22291
|
className: "updog__primary-key-selection updog__scrollbar",
|
|
22252
22292
|
children: [s && /* @__PURE__ */ w(Ra, {
|
|
22253
22293
|
name: "primaryKey",
|
|
22254
22294
|
value: "",
|
|
22255
|
-
checked:
|
|
22295
|
+
checked: n === null,
|
|
22256
22296
|
onChange: c,
|
|
22257
22297
|
radioPosition: "end",
|
|
22258
|
-
className: E("updog__primary-key-selection__card",
|
|
22298
|
+
className: E("updog__primary-key-selection__card", n === null && "updog__primary-key-selection__card--selected"),
|
|
22259
22299
|
children: [/* @__PURE__ */ C(q, {
|
|
22260
22300
|
size: "sm",
|
|
22261
22301
|
weight: "medium",
|
|
22262
22302
|
className: "updog__primary-key-selection__title",
|
|
22263
|
-
children:
|
|
22303
|
+
children: t("dataEditor.uploader.primaryKey.none")
|
|
22264
22304
|
}), /* @__PURE__ */ C(q, {
|
|
22265
22305
|
size: "sm",
|
|
22266
22306
|
className: "updog__primary-key-selection__value-text updog__primary-key-selection__value-none",
|
|
22267
|
-
children:
|
|
22307
|
+
children: t("dataEditor.uploader.primaryKey.noneHint")
|
|
22268
22308
|
})]
|
|
22269
|
-
}),
|
|
22270
|
-
let t =
|
|
22309
|
+
}), o.map((e) => {
|
|
22310
|
+
let t = l[e.id], i = t ? u.map((e) => e[t] ?? "") : [];
|
|
22271
22311
|
return /* @__PURE__ */ w(Ra, {
|
|
22272
22312
|
name: "primaryKey",
|
|
22273
22313
|
value: e.id,
|
|
22274
|
-
checked:
|
|
22275
|
-
onChange:
|
|
22314
|
+
checked: n === e.id,
|
|
22315
|
+
onChange: r,
|
|
22276
22316
|
radioPosition: "end",
|
|
22277
|
-
className: E("updog__primary-key-selection__card",
|
|
22317
|
+
className: E("updog__primary-key-selection__card", n === e.id && "updog__primary-key-selection__card--selected"),
|
|
22278
22318
|
children: [/* @__PURE__ */ C(q, {
|
|
22279
22319
|
size: "sm",
|
|
22280
22320
|
weight: "medium",
|
|
@@ -22282,7 +22322,7 @@ var $v = () => {
|
|
|
22282
22322
|
children: e.title
|
|
22283
22323
|
}), /* @__PURE__ */ C("div", {
|
|
22284
22324
|
className: "updog__primary-key-selection__values",
|
|
22285
|
-
children:
|
|
22325
|
+
children: i.map((e, t) => /* @__PURE__ */ C("div", {
|
|
22286
22326
|
className: "updog__primary-key-selection__value-row",
|
|
22287
22327
|
children: /* @__PURE__ */ C(q, {
|
|
22288
22328
|
size: "sm",
|
|
@@ -22294,7 +22334,91 @@ var $v = () => {
|
|
|
22294
22334
|
}, e.id);
|
|
22295
22335
|
})]
|
|
22296
22336
|
});
|
|
22297
|
-
},
|
|
22337
|
+
}, vy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(_y, {}), /* @__PURE__ */ C(bv, {})] }) }), yy = () => {
|
|
22338
|
+
let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = X(), i = t === !1 ? [] : t, { t: a } = K(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: p, handleRemoteSourceSelect: m } = hb(), h = [
|
|
22339
|
+
{
|
|
22340
|
+
id: "csv",
|
|
22341
|
+
format: "csv",
|
|
22342
|
+
text: a("dataEditor.footer.csvFormat")
|
|
22343
|
+
},
|
|
22344
|
+
{
|
|
22345
|
+
id: "tsv",
|
|
22346
|
+
format: "tsv",
|
|
22347
|
+
text: a("dataEditor.footer.tsvFormat")
|
|
22348
|
+
},
|
|
22349
|
+
{
|
|
22350
|
+
id: "xlsx",
|
|
22351
|
+
format: "xlsx",
|
|
22352
|
+
text: a("dataEditor.footer.excelFormat")
|
|
22353
|
+
},
|
|
22354
|
+
{
|
|
22355
|
+
id: "json",
|
|
22356
|
+
format: "json",
|
|
22357
|
+
text: a("dataEditor.footer.jsonFormat")
|
|
22358
|
+
},
|
|
22359
|
+
{
|
|
22360
|
+
id: "xml",
|
|
22361
|
+
format: "xml",
|
|
22362
|
+
text: a("dataEditor.footer.xmlFormat")
|
|
22363
|
+
}
|
|
22364
|
+
].filter((e) => i.includes(e.format)), g = f((t) => {
|
|
22365
|
+
ou(e, t, r);
|
|
22366
|
+
}, [e, r]), _ = Kl(i), v = !!o || !!s, y = v || u || !!d, b = o?.fileName ?? s?.name, { getRootProps: x, getInputProps: S, isDragActive: C, open: w } = pt({
|
|
22367
|
+
accept: _,
|
|
22368
|
+
maxFiles: 1,
|
|
22369
|
+
noClick: !0,
|
|
22370
|
+
disabled: y,
|
|
22371
|
+
onDrop: f((e) => {
|
|
22372
|
+
let t = e[0];
|
|
22373
|
+
t && l(t);
|
|
22374
|
+
}, [l])
|
|
22375
|
+
});
|
|
22376
|
+
return {
|
|
22377
|
+
getRootProps: x,
|
|
22378
|
+
getInputProps: S,
|
|
22379
|
+
isDragActive: C,
|
|
22380
|
+
open: w,
|
|
22381
|
+
isParsing: u,
|
|
22382
|
+
hasFile: v,
|
|
22383
|
+
isBlocked: y,
|
|
22384
|
+
fileName: b,
|
|
22385
|
+
importFormats: i,
|
|
22386
|
+
remoteSources: n,
|
|
22387
|
+
remoteSourceLoading: d,
|
|
22388
|
+
remoteSourceError: p,
|
|
22389
|
+
exampleMenuOptions: h,
|
|
22390
|
+
onExampleDownload: g,
|
|
22391
|
+
onRemoveClick: f((e) => {
|
|
22392
|
+
e.stopPropagation(), c();
|
|
22393
|
+
}, [c]),
|
|
22394
|
+
handleRemoteSourceSelect: m
|
|
22395
|
+
};
|
|
22396
|
+
}, by = s(null);
|
|
22397
|
+
function xy({ children: e }) {
|
|
22398
|
+
let t = yy();
|
|
22399
|
+
return /* @__PURE__ */ C(by.Provider, {
|
|
22400
|
+
value: t,
|
|
22401
|
+
children: e
|
|
22402
|
+
});
|
|
22403
|
+
}
|
|
22404
|
+
var Sy = () => {
|
|
22405
|
+
let e = p(by);
|
|
22406
|
+
if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
|
|
22407
|
+
return e;
|
|
22408
|
+
}, Cy = () => {
|
|
22409
|
+
let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = Sy();
|
|
22410
|
+
return /* @__PURE__ */ C(Fa, {
|
|
22411
|
+
options: t,
|
|
22412
|
+
onSelect: n,
|
|
22413
|
+
placement: "top-start",
|
|
22414
|
+
children: /* @__PURE__ */ C(J, {
|
|
22415
|
+
variant: "outlined",
|
|
22416
|
+
color: "neutral",
|
|
22417
|
+
startIcon: /* @__PURE__ */ C(oe, {}),
|
|
22418
|
+
children: e("dataEditor.uploader.uploadFile.downloadExample")
|
|
22419
|
+
})
|
|
22420
|
+
});
|
|
22421
|
+
}, wy = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
|
|
22298
22422
|
className: "updog__remote-source-btn__icon",
|
|
22299
22423
|
dangerouslySetInnerHTML: { __html: e.icon }
|
|
22300
22424
|
}) : /* @__PURE__ */ C("span", {
|
|
@@ -22303,7 +22427,7 @@ var $v = () => {
|
|
|
22303
22427
|
src: e.icon,
|
|
22304
22428
|
alt: e.label
|
|
22305
22429
|
})
|
|
22306
|
-
}),
|
|
22430
|
+
}), Ty = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
|
|
22307
22431
|
variant: "filled",
|
|
22308
22432
|
color: "neutral",
|
|
22309
22433
|
size: "sm",
|
|
@@ -22313,11 +22437,11 @@ var $v = () => {
|
|
|
22313
22437
|
disabled: !t && n,
|
|
22314
22438
|
loading: t,
|
|
22315
22439
|
spinnerPosition: "start",
|
|
22316
|
-
startIcon: /* @__PURE__ */ C(
|
|
22440
|
+
startIcon: /* @__PURE__ */ C(wy, { source: e }),
|
|
22317
22441
|
title: e.description,
|
|
22318
22442
|
children: e.label
|
|
22319
|
-
}),
|
|
22320
|
-
let {
|
|
22443
|
+
}), Ey = () => {
|
|
22444
|
+
let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = Sy(), o = n.length > 0;
|
|
22321
22445
|
return /* @__PURE__ */ w("div", {
|
|
22322
22446
|
className: "updog__source-picker",
|
|
22323
22447
|
children: [
|
|
@@ -22330,35 +22454,35 @@ var $v = () => {
|
|
|
22330
22454
|
size: "sm",
|
|
22331
22455
|
weight: "medium",
|
|
22332
22456
|
className: "updog__source-picker__link",
|
|
22333
|
-
children:
|
|
22457
|
+
children: e("dataEditor.uploader.uploadFile.clickToUpload")
|
|
22334
22458
|
}), /* @__PURE__ */ C(q, {
|
|
22335
22459
|
as: "span",
|
|
22336
22460
|
size: "sm",
|
|
22337
|
-
children:
|
|
22461
|
+
children: e("dataEditor.uploader.uploadFile.orDragAndDrop")
|
|
22338
22462
|
})]
|
|
22339
22463
|
}), /* @__PURE__ */ C(q, {
|
|
22340
22464
|
as: "span",
|
|
22341
22465
|
size: "xs",
|
|
22342
|
-
children:
|
|
22466
|
+
children: t.map((e) => e.toUpperCase()).join(", ")
|
|
22343
22467
|
})]
|
|
22344
22468
|
}),
|
|
22345
|
-
|
|
22469
|
+
o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Oa, {}), /* @__PURE__ */ C("div", {
|
|
22346
22470
|
className: "updog__source-picker__sources-list",
|
|
22347
|
-
children:
|
|
22471
|
+
children: n.map((e) => /* @__PURE__ */ C(Ty, {
|
|
22348
22472
|
source: e,
|
|
22349
|
-
loading:
|
|
22350
|
-
disabled: !!
|
|
22351
|
-
onSelect:
|
|
22473
|
+
loading: r === e.id,
|
|
22474
|
+
disabled: !!r,
|
|
22475
|
+
onSelect: a
|
|
22352
22476
|
}, e.id))
|
|
22353
22477
|
})] }),
|
|
22354
|
-
|
|
22478
|
+
i && /* @__PURE__ */ C(q, {
|
|
22355
22479
|
size: "sm",
|
|
22356
22480
|
className: "updog__source-picker__error",
|
|
22357
|
-
children:
|
|
22481
|
+
children: i
|
|
22358
22482
|
})
|
|
22359
22483
|
]
|
|
22360
22484
|
});
|
|
22361
|
-
},
|
|
22485
|
+
}, Dy = () => {
|
|
22362
22486
|
let { t: e } = K();
|
|
22363
22487
|
return /* @__PURE__ */ w("div", {
|
|
22364
22488
|
className: "updog__uploading-state",
|
|
@@ -22371,98 +22495,52 @@ var $v = () => {
|
|
|
22371
22495
|
children: e("dataEditor.uploader.uploadFile.uploading")
|
|
22372
22496
|
})]
|
|
22373
22497
|
});
|
|
22374
|
-
},
|
|
22375
|
-
let {
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
let t = e[0];
|
|
22410
|
-
t && c(t);
|
|
22411
|
-
}, [c])
|
|
22412
|
-
}), T = f((e) => {
|
|
22413
|
-
e.stopPropagation(), s();
|
|
22414
|
-
}, [s]);
|
|
22498
|
+
}, Oy = () => {
|
|
22499
|
+
let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = Sy();
|
|
22500
|
+
return /* @__PURE__ */ C("div", {
|
|
22501
|
+
className: E("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
|
|
22502
|
+
onClick: t ? void 0 : a,
|
|
22503
|
+
children: n ? /* @__PURE__ */ C(Dy, {}) : /* @__PURE__ */ w(S, { children: [
|
|
22504
|
+
/* @__PURE__ */ C("div", {
|
|
22505
|
+
className: "updog__step-select-files__icon-container",
|
|
22506
|
+
children: r ? /* @__PURE__ */ C(I, {
|
|
22507
|
+
size: "1rem",
|
|
22508
|
+
className: "updog__step-select-files__icon rtl-mirror"
|
|
22509
|
+
}) : /* @__PURE__ */ C(Re, {
|
|
22510
|
+
size: "1rem",
|
|
22511
|
+
className: "updog__step-select-files__icon"
|
|
22512
|
+
})
|
|
22513
|
+
}),
|
|
22514
|
+
!r && /* @__PURE__ */ C(Ey, {}),
|
|
22515
|
+
r && /* @__PURE__ */ w("div", {
|
|
22516
|
+
className: "updog__step-select-files__info",
|
|
22517
|
+
children: [/* @__PURE__ */ C(q, {
|
|
22518
|
+
as: "span",
|
|
22519
|
+
size: "sm",
|
|
22520
|
+
children: i
|
|
22521
|
+
}), /* @__PURE__ */ C(J, {
|
|
22522
|
+
size: "xs",
|
|
22523
|
+
variant: "ghost",
|
|
22524
|
+
color: "danger",
|
|
22525
|
+
onClick: o,
|
|
22526
|
+
children: e("dataEditor.common.remove")
|
|
22527
|
+
})]
|
|
22528
|
+
})
|
|
22529
|
+
] })
|
|
22530
|
+
});
|
|
22531
|
+
}, ky = () => {
|
|
22532
|
+
let { getRootProps: e, getInputProps: t, isDragActive: n } = Sy();
|
|
22415
22533
|
return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w("div", {
|
|
22416
22534
|
className: "updog__step-select-files__dropzone",
|
|
22417
|
-
...
|
|
22535
|
+
...e(),
|
|
22418
22536
|
children: [
|
|
22419
|
-
/* @__PURE__ */ C("input", { ...
|
|
22420
|
-
/* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(
|
|
22421
|
-
|
|
22422
|
-
onClick: g ? void 0 : x,
|
|
22423
|
-
children: l ? /* @__PURE__ */ C(hy, {}) : /* @__PURE__ */ w(S, { children: [
|
|
22424
|
-
/* @__PURE__ */ C("div", {
|
|
22425
|
-
className: "updog__step-select-files__icon-container",
|
|
22426
|
-
children: h ? /* @__PURE__ */ C(I, {
|
|
22427
|
-
size: "1rem",
|
|
22428
|
-
className: "updog__step-select-files__icon rtl-mirror"
|
|
22429
|
-
}) : /* @__PURE__ */ C(Re, {
|
|
22430
|
-
size: "1rem",
|
|
22431
|
-
className: "updog__step-select-files__icon"
|
|
22432
|
-
})
|
|
22433
|
-
}),
|
|
22434
|
-
!h && /* @__PURE__ */ C(my, {}),
|
|
22435
|
-
h && /* @__PURE__ */ w("div", {
|
|
22436
|
-
className: "updog__step-select-files__info",
|
|
22437
|
-
children: [/* @__PURE__ */ C(q, {
|
|
22438
|
-
as: "span",
|
|
22439
|
-
size: "sm",
|
|
22440
|
-
children: _
|
|
22441
|
-
}), /* @__PURE__ */ C(J, {
|
|
22442
|
-
size: "xs",
|
|
22443
|
-
variant: "ghost",
|
|
22444
|
-
color: "danger",
|
|
22445
|
-
onClick: T,
|
|
22446
|
-
children: i("dataEditor.common.remove")
|
|
22447
|
-
})]
|
|
22448
|
-
})
|
|
22449
|
-
] })
|
|
22450
|
-
}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(Fa, {
|
|
22451
|
-
options: d,
|
|
22452
|
-
onSelect: p,
|
|
22453
|
-
placement: "top-start",
|
|
22454
|
-
children: /* @__PURE__ */ C(J, {
|
|
22455
|
-
variant: "outlined",
|
|
22456
|
-
color: "neutral",
|
|
22457
|
-
startIcon: /* @__PURE__ */ C(oe, {}),
|
|
22458
|
-
children: i("dataEditor.uploader.uploadFile.downloadExample")
|
|
22459
|
-
})
|
|
22460
|
-
}) })] }),
|
|
22461
|
-
b && /* @__PURE__ */ C(Yl, {})
|
|
22537
|
+
/* @__PURE__ */ C("input", { ...t() }),
|
|
22538
|
+
/* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(Oy, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(Cy, {}) })] }),
|
|
22539
|
+
n && /* @__PURE__ */ C(Yl, {})
|
|
22462
22540
|
]
|
|
22463
22541
|
}) });
|
|
22464
|
-
},
|
|
22465
|
-
let { selectedSheet: t, setSelectedSheet: n } =
|
|
22542
|
+
}, Ay = () => /* @__PURE__ */ C(xy, { children: /* @__PURE__ */ C(ky, {}) }), jy = ({ preview: e }) => {
|
|
22543
|
+
let { selectedSheet: t, setSelectedSheet: n } = hb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
|
|
22466
22544
|
let { headers: t, rows: n } = e;
|
|
22467
22545
|
return n.map((e) => t.map((t) => e[t] ?? ""));
|
|
22468
22546
|
}, [e]);
|
|
@@ -22499,16 +22577,16 @@ var $v = () => {
|
|
|
22499
22577
|
})]
|
|
22500
22578
|
})
|
|
22501
22579
|
});
|
|
22502
|
-
},
|
|
22503
|
-
let { sheetPreviews: e } =
|
|
22580
|
+
}, My = () => {
|
|
22581
|
+
let { sheetPreviews: e } = hb();
|
|
22504
22582
|
return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
|
|
22505
22583
|
className: "updog__sheet-preview-wrapper updog__scrollbar",
|
|
22506
22584
|
children: /* @__PURE__ */ C("div", {
|
|
22507
22585
|
className: "updog__sheet-preview-grid",
|
|
22508
|
-
children: e.map((e) => /* @__PURE__ */ C(
|
|
22586
|
+
children: e.map((e) => /* @__PURE__ */ C(jy, { preview: e }, e.name))
|
|
22509
22587
|
})
|
|
22510
22588
|
}), /* @__PURE__ */ C(bv, {})] }) });
|
|
22511
|
-
},
|
|
22589
|
+
}, Ny = (e, t, n) => {
|
|
22512
22590
|
let r = new Map(t.map((e) => [e.id, e])), i = [];
|
|
22513
22591
|
for (let [t, a] of Object.entries(e)) a && i.push({
|
|
22514
22592
|
csvHeader: t,
|
|
@@ -22516,11 +22594,11 @@ var $v = () => {
|
|
|
22516
22594
|
column: n.has(a) ? void 0 : r.get(a)
|
|
22517
22595
|
});
|
|
22518
22596
|
return i;
|
|
22519
|
-
},
|
|
22597
|
+
}, Py = (e) => {
|
|
22520
22598
|
let t = [];
|
|
22521
22599
|
for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
|
|
22522
22600
|
return t;
|
|
22523
|
-
},
|
|
22601
|
+
}, Fy = (e, t, n) => {
|
|
22524
22602
|
let r = {};
|
|
22525
22603
|
for (let { csvHeader: i, columnId: a, column: o } of t) {
|
|
22526
22604
|
let t = e[i] ?? "";
|
|
@@ -22535,7 +22613,7 @@ var $v = () => {
|
|
|
22535
22613
|
continue;
|
|
22536
22614
|
}
|
|
22537
22615
|
if (s === "multiselect") {
|
|
22538
|
-
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ?
|
|
22616
|
+
let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? ey(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
|
|
22539
22617
|
for (let e of s) {
|
|
22540
22618
|
let t = n.valueMapping[a]?.[e.trim()];
|
|
22541
22619
|
t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
|
|
@@ -22547,35 +22625,35 @@ var $v = () => {
|
|
|
22547
22625
|
r[a] = o.transformer ? o.transformer(c) : c;
|
|
22548
22626
|
}
|
|
22549
22627
|
return r;
|
|
22550
|
-
},
|
|
22628
|
+
}, Iy = /^-?\d+([.,]\d+)?%?$/, Ly = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, Ry = new Set([
|
|
22551
22629
|
"true",
|
|
22552
22630
|
"false",
|
|
22553
22631
|
"yes",
|
|
22554
22632
|
"no"
|
|
22555
|
-
]),
|
|
22556
|
-
function
|
|
22557
|
-
return !!(
|
|
22633
|
+
]), zy = 50;
|
|
22634
|
+
function By(e) {
|
|
22635
|
+
return !!(Iy.test(e) || Ly.test(e) || Ry.has(e.toLowerCase()));
|
|
22558
22636
|
}
|
|
22559
|
-
function
|
|
22637
|
+
function Vy(e) {
|
|
22560
22638
|
return e.filter((e) => e != null && String(e).trim().length > 0).length;
|
|
22561
22639
|
}
|
|
22562
|
-
function
|
|
22640
|
+
function Hy(e) {
|
|
22563
22641
|
let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
22564
22642
|
for (let i of e) {
|
|
22565
|
-
let e =
|
|
22643
|
+
let e = Vy(i);
|
|
22566
22644
|
if (e === 0) continue;
|
|
22567
22645
|
let a = (t.get(e) ?? 0) + 1;
|
|
22568
22646
|
t.set(e, a), a > n && (n = a, r = e);
|
|
22569
22647
|
}
|
|
22570
22648
|
return r;
|
|
22571
22649
|
}
|
|
22572
|
-
function
|
|
22650
|
+
function Uy(e, t) {
|
|
22573
22651
|
let n = e.map((e) => String(e ?? "").trim()), r = n.filter((e) => e.length > 0);
|
|
22574
22652
|
if (r.length === 0) return 0;
|
|
22575
|
-
let i = r.filter((e) =>
|
|
22653
|
+
let i = r.filter((e) => By(e)).length === 0 ? 1 : 0, a = r.length / Math.max(n.length, 1), o = new Set(r.map((e) => e.toLowerCase())).size / r.length, s = r.filter((e) => e.length <= zy).length / r.length, c = t > 0 ? 1 - Math.abs(r.length - t) / t : 0;
|
|
22576
22654
|
return .3 * i + .25 * a + .2 * o + .15 * s + .1 * Math.max(0, c);
|
|
22577
22655
|
}
|
|
22578
|
-
function
|
|
22656
|
+
function Wy(e, t = 100) {
|
|
22579
22657
|
if (e.length === 0) return {
|
|
22580
22658
|
headerRowIndex: 0,
|
|
22581
22659
|
confidence: 0
|
|
@@ -22584,17 +22662,17 @@ function Ay(e, t = 100) {
|
|
|
22584
22662
|
headerRowIndex: 0,
|
|
22585
22663
|
confidence: 1
|
|
22586
22664
|
};
|
|
22587
|
-
let n = Math.min(t, e.length), r =
|
|
22665
|
+
let n = Math.min(t, e.length), r = Hy(e.slice(0, n)), i = 0, a = -1;
|
|
22588
22666
|
for (let t = 0; t < n; t++) {
|
|
22589
|
-
let n =
|
|
22590
|
-
if (n > a && (a = n, i = t), t === 0 && n > .85 &&
|
|
22667
|
+
let n = Uy(e[t], r);
|
|
22668
|
+
if (n > a && (a = n, i = t), t === 0 && n > .85 && Vy(e[0]) === r) break;
|
|
22591
22669
|
}
|
|
22592
22670
|
return {
|
|
22593
22671
|
headerRowIndex: i,
|
|
22594
22672
|
confidence: Math.round(a * 100) / 100
|
|
22595
22673
|
};
|
|
22596
22674
|
}
|
|
22597
|
-
function
|
|
22675
|
+
function Gy(e) {
|
|
22598
22676
|
let t = /* @__PURE__ */ new Set();
|
|
22599
22677
|
return e.map((e) => {
|
|
22600
22678
|
let n = e, r = 2;
|
|
@@ -22602,8 +22680,8 @@ function jy(e) {
|
|
|
22602
22680
|
return t.add(n), n;
|
|
22603
22681
|
});
|
|
22604
22682
|
}
|
|
22605
|
-
function
|
|
22606
|
-
let { headerRowIndex: t } =
|
|
22683
|
+
function Ky(e) {
|
|
22684
|
+
let { headerRowIndex: t } = Wy(e), n = Gy((e[t] ?? []).map((e) => String(e ?? "").trim())), r = [], i = [];
|
|
22607
22685
|
for (let a of e.slice(t + 1)) {
|
|
22608
22686
|
if (!a.some((e) => e != null && String(e).trim() !== "")) continue;
|
|
22609
22687
|
let e = {};
|
|
@@ -22619,16 +22697,16 @@ function My(e) {
|
|
|
22619
22697
|
}
|
|
22620
22698
|
//#endregion
|
|
22621
22699
|
//#region src/components/DataUploader/utils/detectMultiValueDelimiter.ts
|
|
22622
|
-
var
|
|
22700
|
+
var qy = 200, Jy = (e, t, n) => {
|
|
22623
22701
|
if (n) return n;
|
|
22624
22702
|
let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
|
|
22625
22703
|
for (let t of e) {
|
|
22626
22704
|
let e = t.trim();
|
|
22627
|
-
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >=
|
|
22705
|
+
if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= qy)) break;
|
|
22628
22706
|
}
|
|
22629
22707
|
if (o.length === 0) return null;
|
|
22630
22708
|
let s = null, c = 0, l = 0;
|
|
22631
|
-
for (let e of
|
|
22709
|
+
for (let e of $v) {
|
|
22632
22710
|
let n = 0, r = 0;
|
|
22633
22711
|
for (let a of o) {
|
|
22634
22712
|
if (i(a) || !a.includes(e)) continue;
|
|
@@ -22641,7 +22719,7 @@ var Ny = 200, Py = (e, t, n) => {
|
|
|
22641
22719
|
(n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
|
|
22642
22720
|
}
|
|
22643
22721
|
return c > 0 ? s : null;
|
|
22644
|
-
},
|
|
22722
|
+
}, Yy = (e) => {
|
|
22645
22723
|
let t = /* @__PURE__ */ new Map();
|
|
22646
22724
|
for (let [n, r] of Object.entries(e)) {
|
|
22647
22725
|
let e = wv(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
@@ -22649,8 +22727,8 @@ var Ny = 200, Py = (e, t, n) => {
|
|
|
22649
22727
|
t.set(e, i);
|
|
22650
22728
|
}
|
|
22651
22729
|
return t;
|
|
22652
|
-
},
|
|
22653
|
-
let i =
|
|
22730
|
+
}, Xy = (e, t, n, r) => {
|
|
22731
|
+
let i = Yy(r), a = (e, t) => i.get(wv(e))?.has(wv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
|
|
22654
22732
|
if (wv(n) === wv(r) || a(r, n)) return;
|
|
22655
22733
|
let i = `${n} ${r}`;
|
|
22656
22734
|
t.has(i) || (t.add(i), e.push({
|
|
@@ -22670,16 +22748,16 @@ var Ny = 200, Py = (e, t, n) => {
|
|
|
22670
22748
|
for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
|
|
22671
22749
|
return c;
|
|
22672
22750
|
};
|
|
22673
|
-
function
|
|
22751
|
+
function Zy(e, t, n) {
|
|
22674
22752
|
let r = e.length, i = t;
|
|
22675
|
-
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ?
|
|
22753
|
+
return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Qy(i, i - r) : Qy(r - 1, i - 1)) > 1e3 ? [] : r < i ? $y(e, i) : eb(e, i, n);
|
|
22676
22754
|
}
|
|
22677
|
-
function
|
|
22755
|
+
function Qy(e, t) {
|
|
22678
22756
|
let n = Math.min(t, e - t), r = 1;
|
|
22679
22757
|
for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
|
|
22680
22758
|
return r;
|
|
22681
22759
|
}
|
|
22682
|
-
function
|
|
22760
|
+
function $y(e, t) {
|
|
22683
22761
|
let n = e.length, r = [], i = [], a = (o) => {
|
|
22684
22762
|
if (i.length === n) {
|
|
22685
22763
|
let a = Array(t).fill("");
|
|
@@ -22691,7 +22769,7 @@ function zy(e, t) {
|
|
|
22691
22769
|
};
|
|
22692
22770
|
return a(0), r;
|
|
22693
22771
|
}
|
|
22694
|
-
function
|
|
22772
|
+
function eb(e, t, n) {
|
|
22695
22773
|
let r = e.length, i = [], a = [], o = (s) => {
|
|
22696
22774
|
if (a.length === t - 1) {
|
|
22697
22775
|
let o = [
|
|
@@ -22709,27 +22787,27 @@ function By(e, t, n) {
|
|
|
22709
22787
|
}
|
|
22710
22788
|
//#endregion
|
|
22711
22789
|
//#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
|
|
22712
|
-
var
|
|
22713
|
-
function
|
|
22790
|
+
var tb = {};
|
|
22791
|
+
function nb(e, t) {
|
|
22714
22792
|
for (let n of t.validators ?? []) if (n.type !== "expression") {
|
|
22715
22793
|
if (n.type === "function") {
|
|
22716
|
-
if (n.fn(e,
|
|
22794
|
+
if (n.fn(e, tb) != null) return !1;
|
|
22717
22795
|
continue;
|
|
22718
22796
|
}
|
|
22719
|
-
if (Al(n, e,
|
|
22797
|
+
if (Al(n, e, tb) != null) return !1;
|
|
22720
22798
|
}
|
|
22721
22799
|
return !0;
|
|
22722
22800
|
}
|
|
22723
|
-
function
|
|
22724
|
-
for (let n = 0; n < t.length; n++) if (!
|
|
22801
|
+
function rb(e, t) {
|
|
22802
|
+
for (let n = 0; n < t.length; n++) if (!nb(e.cells[n] ?? "", t[n])) return !1;
|
|
22725
22803
|
return !0;
|
|
22726
22804
|
}
|
|
22727
|
-
function
|
|
22728
|
-
return e.filter((e) =>
|
|
22805
|
+
function ib(e, t) {
|
|
22806
|
+
return e.filter((e) => rb(e, t));
|
|
22729
22807
|
}
|
|
22730
22808
|
//#endregion
|
|
22731
22809
|
//#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
|
|
22732
|
-
function
|
|
22810
|
+
function ab(e) {
|
|
22733
22811
|
if (e.length <= 1) return [];
|
|
22734
22812
|
let t = e[0].cells.length, n = [], r = -1;
|
|
22735
22813
|
for (let i = 0; i < t; i++) {
|
|
@@ -22746,25 +22824,25 @@ function Gy(e) {
|
|
|
22746
22824
|
}
|
|
22747
22825
|
//#endregion
|
|
22748
22826
|
//#region src/components/DataUploader/utils/raggedRows/alignRow.ts
|
|
22749
|
-
function
|
|
22750
|
-
let r =
|
|
22827
|
+
function ob(e, t, n) {
|
|
22828
|
+
let r = Zy(e, t.length, n), i = ib(r, t);
|
|
22751
22829
|
return i.length === 1 ? {
|
|
22752
22830
|
kind: "confident",
|
|
22753
22831
|
alignment: i[0]
|
|
22754
22832
|
} : i.length > 1 ? {
|
|
22755
22833
|
kind: "ambiguous",
|
|
22756
22834
|
candidates: i,
|
|
22757
|
-
disputeSpans:
|
|
22835
|
+
disputeSpans: ab(i)
|
|
22758
22836
|
} : {
|
|
22759
22837
|
kind: "invalid",
|
|
22760
22838
|
candidates: r,
|
|
22761
|
-
disputeSpans:
|
|
22839
|
+
disputeSpans: ab(r)
|
|
22762
22840
|
};
|
|
22763
22841
|
}
|
|
22764
22842
|
//#endregion
|
|
22765
22843
|
//#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
|
|
22766
|
-
function
|
|
22767
|
-
let r =
|
|
22844
|
+
function sb(e, t, n) {
|
|
22845
|
+
let r = ob(e, t, n);
|
|
22768
22846
|
if (r.kind === "confident") return {
|
|
22769
22847
|
cells: r.alignment.cells,
|
|
22770
22848
|
conflictColumns: []
|
|
@@ -22783,14 +22861,17 @@ function qy(e, t, n) {
|
|
|
22783
22861
|
}
|
|
22784
22862
|
//#endregion
|
|
22785
22863
|
//#region src/components/DataUploader/context/useViewModel.tsx
|
|
22786
|
-
var
|
|
22864
|
+
var cb = 5e3, lb = 15, ub = 20, db = new Set([
|
|
22787
22865
|
"xlsx",
|
|
22788
22866
|
"xls",
|
|
22789
22867
|
"xlsb",
|
|
22790
22868
|
"ods"
|
|
22791
22869
|
]);
|
|
22792
|
-
function
|
|
22793
|
-
let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = X(), { t: p } = K(), [h, g] = b(0), [_, x] = b(0), [S, w] = b(null), [T, E] = b({}), D =
|
|
22870
|
+
function fb() {
|
|
22871
|
+
let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = X(), { t: p } = K(), [h, g] = b(0), [_, x] = b(0), [S, w] = b(null), [T, E] = b({}), D = v(() => {
|
|
22872
|
+
let e = new Set(Object.values(T).filter(Boolean));
|
|
22873
|
+
return n.filter((t) => t.unique && e.has(t.id));
|
|
22874
|
+
}, [T, n]), [O, k] = b(() => r), [A, j] = b(!1), [M, N] = b(!1), [P, F] = b(null), [I, L] = b([]), [R, z] = b(null), [B, V] = b([]), [ee, te] = b({}), [H, ne] = b([]), [re, ie] = b({}), ae = y(null), [oe, se] = b(0), ce = f((e) => {
|
|
22794
22875
|
M || k(e);
|
|
22795
22876
|
}, [M]), le = y(null);
|
|
22796
22877
|
le.current ||= new $l();
|
|
@@ -22803,24 +22884,24 @@ function Qy() {
|
|
|
22803
22884
|
let e = [{
|
|
22804
22885
|
id: "select-files",
|
|
22805
22886
|
title: p("dataEditor.uploader.steps.selectFiles"),
|
|
22806
|
-
content: /* @__PURE__ */ C(
|
|
22887
|
+
content: /* @__PURE__ */ C(Ay, {})
|
|
22807
22888
|
}];
|
|
22808
22889
|
return I.length > 1 && e.push({
|
|
22809
22890
|
id: "sheet-selection",
|
|
22810
22891
|
title: p("dataEditor.uploader.steps.sheetSelection"),
|
|
22811
|
-
content: /* @__PURE__ */ C(
|
|
22892
|
+
content: /* @__PURE__ */ C(My, {})
|
|
22812
22893
|
}), e.push({
|
|
22813
22894
|
id: "column-matching",
|
|
22814
22895
|
title: p("dataEditor.uploader.steps.matchColumns"),
|
|
22815
|
-
content: /* @__PURE__ */ C(
|
|
22896
|
+
content: /* @__PURE__ */ C(Zv, {})
|
|
22816
22897
|
}), de && e.push({
|
|
22817
22898
|
id: "match-values",
|
|
22818
22899
|
title: p("dataEditor.uploader.steps.matchValues"),
|
|
22819
|
-
content: /* @__PURE__ */ C(
|
|
22900
|
+
content: /* @__PURE__ */ C(hy, {})
|
|
22820
22901
|
}), D.length > 0 && fe && e.push({
|
|
22821
22902
|
id: "primary-key",
|
|
22822
22903
|
title: p("dataEditor.uploader.steps.primaryKey"),
|
|
22823
|
-
content: /* @__PURE__ */ C(
|
|
22904
|
+
content: /* @__PURE__ */ C(vy, {})
|
|
22824
22905
|
}), e;
|
|
22825
22906
|
}, [
|
|
22826
22907
|
D.length,
|
|
@@ -22853,7 +22934,7 @@ function Qy() {
|
|
|
22853
22934
|
sheetName: R
|
|
22854
22935
|
}).then((e) => {
|
|
22855
22936
|
if (e.kind !== "rows") return;
|
|
22856
|
-
let t =
|
|
22937
|
+
let t = Ky(e.rows);
|
|
22857
22938
|
se(t.headerRowIndex), ye({
|
|
22858
22939
|
fileName: P.name,
|
|
22859
22940
|
headers: t.headers,
|
|
@@ -22871,27 +22952,41 @@ function Qy() {
|
|
|
22871
22952
|
ue,
|
|
22872
22953
|
ye,
|
|
22873
22954
|
he
|
|
22874
|
-
]), Ce = f(async (
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22955
|
+
]), Ce = f(async (t) => {
|
|
22956
|
+
try {
|
|
22957
|
+
let e = await ue.parse(t, { format: "csv" });
|
|
22958
|
+
if (e.kind !== "rows") {
|
|
22959
|
+
j(!1);
|
|
22960
|
+
return;
|
|
22961
|
+
}
|
|
22962
|
+
let n = Ky(e.rows);
|
|
22963
|
+
if (se(n.headerRowIndex), ye({
|
|
22964
|
+
fileName: t.name,
|
|
22965
|
+
headers: n.headers,
|
|
22966
|
+
rows: n.rows,
|
|
22967
|
+
isParsing: !1,
|
|
22968
|
+
rawCells: n.rawCells,
|
|
22969
|
+
delimiter: e.delimiter
|
|
22970
|
+
}), e.errors.length > 0) {
|
|
22971
|
+
let t = e.errors.slice(0, 3).map((e) => e.row == null ? "?" : String(e.row + 1)).join(", ");
|
|
22972
|
+
js.info(p("dataEditor.uploader.uploadFile.csvWarning", {
|
|
22973
|
+
count: e.errors.length,
|
|
22974
|
+
rows: t
|
|
22975
|
+
}));
|
|
22976
|
+
}
|
|
22977
|
+
} catch (t) {
|
|
22978
|
+
j(!1), e.errorHandler.handleError({
|
|
22979
|
+
code: "PARSE_ERROR",
|
|
22980
|
+
message: "Failed to parse CSV file",
|
|
22981
|
+
source: "csv-parser",
|
|
22982
|
+
originalError: t
|
|
22983
|
+
});
|
|
22891
22984
|
}
|
|
22892
22985
|
}, [
|
|
22893
22986
|
ue,
|
|
22894
22987
|
ye,
|
|
22988
|
+
j,
|
|
22989
|
+
e,
|
|
22895
22990
|
p
|
|
22896
22991
|
]), we = f(async (t) => {
|
|
22897
22992
|
try {
|
|
@@ -22943,11 +23038,11 @@ function Qy() {
|
|
|
22943
23038
|
ue.parse(t, { format: "xlsx" }).then((e) => {
|
|
22944
23039
|
if (e.kind === "sheets") {
|
|
22945
23040
|
let n = e.sheets.map((e) => {
|
|
22946
|
-
let { headers: t, rows: n } =
|
|
23041
|
+
let { headers: t, rows: n } = Ky(e.rows);
|
|
22947
23042
|
return {
|
|
22948
23043
|
name: e.name,
|
|
22949
23044
|
headers: t,
|
|
22950
|
-
rows: n.slice(0,
|
|
23045
|
+
rows: n.slice(0, lb),
|
|
22951
23046
|
totalRows: e.totalRows - 1
|
|
22952
23047
|
};
|
|
22953
23048
|
});
|
|
@@ -22955,7 +23050,7 @@ function Qy() {
|
|
|
22955
23050
|
return;
|
|
22956
23051
|
}
|
|
22957
23052
|
if (e.kind !== "rows") return;
|
|
22958
|
-
let n =
|
|
23053
|
+
let n = Ky(e.rows);
|
|
22959
23054
|
se(n.headerRowIndex), ye({
|
|
22960
23055
|
fileName: t.name,
|
|
22961
23056
|
headers: n.headers,
|
|
@@ -22981,7 +23076,7 @@ function Qy() {
|
|
|
22981
23076
|
]), De = f((e) => {
|
|
22982
23077
|
j(!0), ae.current = e;
|
|
22983
23078
|
let t = e.name.split(".").pop()?.toLowerCase();
|
|
22984
|
-
t &&
|
|
23079
|
+
t && db.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
|
|
22985
23080
|
}, [
|
|
22986
23081
|
Ce,
|
|
22987
23082
|
we,
|
|
@@ -23061,7 +23156,7 @@ function Qy() {
|
|
|
23061
23156
|
t === void 0 || t === "" || c.push(t);
|
|
23062
23157
|
}
|
|
23063
23158
|
if (o === "multiselect") {
|
|
23064
|
-
let n = a.editor.delimiter, r =
|
|
23159
|
+
let n = a.editor.delimiter, r = Jy(c, s, n);
|
|
23065
23160
|
t[i] = r;
|
|
23066
23161
|
let o = new Set(s.map((e) => e.trim().toLowerCase())), l = /* @__PURE__ */ new Set();
|
|
23067
23162
|
for (let e of c) {
|
|
@@ -23128,7 +23223,7 @@ function Qy() {
|
|
|
23128
23223
|
n !== void 0 && n !== "" && i.push(n);
|
|
23129
23224
|
}
|
|
23130
23225
|
let a = r.editor.delimiter;
|
|
23131
|
-
He(e,
|
|
23226
|
+
He(e, Jy(i, r.editor.options, a));
|
|
23132
23227
|
}, [
|
|
23133
23228
|
S,
|
|
23134
23229
|
T,
|
|
@@ -23147,7 +23242,7 @@ function Qy() {
|
|
|
23147
23242
|
for (let [r, i] of Object.entries(T)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
|
|
23148
23243
|
return t;
|
|
23149
23244
|
}, [T, n]), Ke = f(() => {
|
|
23150
|
-
let e = new Set(H.map((e) => e.id)), t =
|
|
23245
|
+
let e = new Set(H.map((e) => e.id)), t = Ny(T, n, e), i = tc(S?.rows ?? [], Py(t)), a = Ge(e), o = oc(S?.rows ?? [], a);
|
|
23151
23246
|
return {
|
|
23152
23247
|
columnMapping: T,
|
|
23153
23248
|
valueMapping: Be,
|
|
@@ -23186,7 +23281,7 @@ function Qy() {
|
|
|
23186
23281
|
if (!S || !d?.onRowsImport) return;
|
|
23187
23282
|
let t = S;
|
|
23188
23283
|
w(null);
|
|
23189
|
-
let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ??
|
|
23284
|
+
let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ?? cb, s = Ny(T, n, new Set(H.map((e) => e.id))), c = {
|
|
23190
23285
|
numberFormat: i.numberFormat,
|
|
23191
23286
|
dateFormat: i.dateFormat,
|
|
23192
23287
|
monthTable: ic(p),
|
|
@@ -23195,7 +23290,7 @@ function Qy() {
|
|
|
23195
23290
|
}, l = t.rows, u = 0;
|
|
23196
23291
|
for (; u < l.length;) {
|
|
23197
23292
|
let e = Math.min(u + o, l.length), n = [];
|
|
23198
|
-
for (let t = u; t < e; t++) n.push(
|
|
23293
|
+
for (let t = u; t < e; t++) n.push(Fy(l[t], s, c));
|
|
23199
23294
|
let f = e >= l.length, p = Math.floor(u / o);
|
|
23200
23295
|
await d.onRowsImport({
|
|
23201
23296
|
importId: r,
|
|
@@ -23233,9 +23328,9 @@ function Qy() {
|
|
|
23233
23328
|
H.length > 0 && u(H);
|
|
23234
23329
|
for (let [t, n] of Object.entries(re)) e.addColumnOptions(t, n);
|
|
23235
23330
|
let o = e.registerSource({ name: i.fileName });
|
|
23236
|
-
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(
|
|
23237
|
-
let s =
|
|
23238
|
-
numberFormat: tc(i.rows,
|
|
23331
|
+
e.setSourceLoading(o, !0), e.recordLearnedSynonyms(Xy(T, Be, [...n, ...H], Sv(xv, l)));
|
|
23332
|
+
let s = Ny(T, n, a), c = {
|
|
23333
|
+
numberFormat: tc(i.rows, Py(s)),
|
|
23239
23334
|
dateFormat: oc(i.rows, Ge(a)),
|
|
23240
23335
|
monthTable: ic(p),
|
|
23241
23336
|
valueMapping: Be,
|
|
@@ -23247,11 +23342,11 @@ function Qy() {
|
|
|
23247
23342
|
title: e
|
|
23248
23343
|
};
|
|
23249
23344
|
}), _ = 0, v = () => {
|
|
23250
|
-
let n = Math.min(_ +
|
|
23345
|
+
let n = Math.min(_ + cb, d.length), i = [], a = [];
|
|
23251
23346
|
for (let e = _; e < n; e++) {
|
|
23252
23347
|
let t = d[e], n = f[e];
|
|
23253
23348
|
if (n) {
|
|
23254
|
-
let { cells: r, conflictColumns: i } =
|
|
23349
|
+
let { cells: r, conflictColumns: i } = sb(n, g, m);
|
|
23255
23350
|
if (r.length) {
|
|
23256
23351
|
let e = {};
|
|
23257
23352
|
for (let t = 0; t < h.length; t++) e[h[t]] = r[t] ?? "";
|
|
@@ -23269,10 +23364,10 @@ function Qy() {
|
|
|
23269
23364
|
});
|
|
23270
23365
|
}
|
|
23271
23366
|
}
|
|
23272
|
-
i.push(
|
|
23367
|
+
i.push(Fy(t, s, c));
|
|
23273
23368
|
}
|
|
23274
23369
|
let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: O ?? void 0 });
|
|
23275
|
-
for (let e = _; e < n; e++) e <
|
|
23370
|
+
for (let e = _; e < n; e++) e < ub || (d[e] = null, e < f.length && (f[e] = null));
|
|
23276
23371
|
_ = n, setTimeout(() => {
|
|
23277
23372
|
t.validateRows(l, u);
|
|
23278
23373
|
for (let { localIndex: t, columnIds: n } of a) {
|
|
@@ -23339,6 +23434,7 @@ function Qy() {
|
|
|
23339
23434
|
sheetPreviews: B,
|
|
23340
23435
|
primaryKey: O,
|
|
23341
23436
|
onPrimaryKeyChange: ce,
|
|
23437
|
+
primaryKeyColumns: D,
|
|
23342
23438
|
pendingColumns: H,
|
|
23343
23439
|
setPendingColumns: ne,
|
|
23344
23440
|
isParsing: A,
|
|
@@ -23373,20 +23469,20 @@ function Qy() {
|
|
|
23373
23469
|
}
|
|
23374
23470
|
//#endregion
|
|
23375
23471
|
//#region src/components/DataUploader/context/index.tsx
|
|
23376
|
-
var
|
|
23377
|
-
function
|
|
23378
|
-
let t =
|
|
23379
|
-
return /* @__PURE__ */ C(
|
|
23472
|
+
var pb = s(null);
|
|
23473
|
+
function mb({ children: e }) {
|
|
23474
|
+
let t = fb();
|
|
23475
|
+
return /* @__PURE__ */ C(pb.Provider, {
|
|
23380
23476
|
value: t,
|
|
23381
23477
|
children: e
|
|
23382
23478
|
});
|
|
23383
23479
|
}
|
|
23384
|
-
var
|
|
23385
|
-
let e = p(
|
|
23480
|
+
var hb = () => {
|
|
23481
|
+
let e = p(pb);
|
|
23386
23482
|
if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
|
|
23387
23483
|
return e;
|
|
23388
|
-
},
|
|
23389
|
-
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } =
|
|
23484
|
+
}, gb = () => {
|
|
23485
|
+
let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = hb();
|
|
23390
23486
|
return /* @__PURE__ */ C(co, {
|
|
23391
23487
|
steps: e,
|
|
23392
23488
|
activeStepIndex: t,
|
|
@@ -23394,79 +23490,79 @@ var tb = () => {
|
|
|
23394
23490
|
onStepChange: r,
|
|
23395
23491
|
isProgressive: !0
|
|
23396
23492
|
});
|
|
23397
|
-
},
|
|
23493
|
+
}, _b = () => /* @__PURE__ */ C(mb, { children: /* @__PURE__ */ C(gb, {}) }), vb = {
|
|
23398
23494
|
kty: "EC",
|
|
23399
23495
|
crv: "P-256",
|
|
23400
23496
|
x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
|
|
23401
23497
|
y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
|
|
23402
|
-
},
|
|
23498
|
+
}, yb = "updog_license_grant", bb = new Set([
|
|
23403
23499
|
"updog.tech",
|
|
23404
23500
|
"landing.updog.tech",
|
|
23405
23501
|
"demo.updog.tech"
|
|
23406
23502
|
]);
|
|
23407
|
-
function
|
|
23408
|
-
return
|
|
23503
|
+
function xb() {
|
|
23504
|
+
return bb.has(window.location.hostname);
|
|
23409
23505
|
}
|
|
23410
|
-
function
|
|
23506
|
+
function Sb() {
|
|
23411
23507
|
return !1;
|
|
23412
23508
|
}
|
|
23413
|
-
function
|
|
23509
|
+
function Cb() {
|
|
23414
23510
|
return "https://api.updog.tech";
|
|
23415
23511
|
}
|
|
23416
|
-
function
|
|
23512
|
+
function wb(e) {
|
|
23417
23513
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
|
|
23418
23514
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
23419
23515
|
return i;
|
|
23420
23516
|
}
|
|
23421
|
-
async function
|
|
23517
|
+
async function Tb(e) {
|
|
23422
23518
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
|
|
23423
23519
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
23424
23520
|
}
|
|
23425
|
-
var
|
|
23426
|
-
async function
|
|
23427
|
-
return
|
|
23521
|
+
var Eb = null;
|
|
23522
|
+
async function Db() {
|
|
23523
|
+
return Eb || (Eb = await crypto.subtle.importKey("jwk", vb, {
|
|
23428
23524
|
name: "ECDSA",
|
|
23429
23525
|
namedCurve: "P-256"
|
|
23430
|
-
}, !1, ["verify"]),
|
|
23526
|
+
}, !1, ["verify"]), Eb);
|
|
23431
23527
|
}
|
|
23432
|
-
function
|
|
23528
|
+
function Ob() {
|
|
23433
23529
|
try {
|
|
23434
|
-
return localStorage.getItem(
|
|
23530
|
+
return localStorage.getItem(yb);
|
|
23435
23531
|
} catch {
|
|
23436
23532
|
return null;
|
|
23437
23533
|
}
|
|
23438
23534
|
}
|
|
23439
|
-
function
|
|
23535
|
+
function kb(e) {
|
|
23440
23536
|
try {
|
|
23441
|
-
localStorage.setItem(
|
|
23537
|
+
localStorage.setItem(yb, e);
|
|
23442
23538
|
} catch {}
|
|
23443
23539
|
}
|
|
23444
|
-
function
|
|
23540
|
+
function Ab() {
|
|
23445
23541
|
try {
|
|
23446
|
-
localStorage.removeItem(
|
|
23542
|
+
localStorage.removeItem(yb);
|
|
23447
23543
|
} catch {}
|
|
23448
23544
|
}
|
|
23449
|
-
async function
|
|
23545
|
+
async function jb(e, t, n) {
|
|
23450
23546
|
let r = e.indexOf(".");
|
|
23451
23547
|
if (r === -1) return !1;
|
|
23452
|
-
let i = e.slice(0, r), a = e.slice(r + 1), o =
|
|
23548
|
+
let i = e.slice(0, r), a = e.slice(r + 1), o = wb(i), s = wb(a), c = await Db();
|
|
23453
23549
|
if (!await crypto.subtle.verify({
|
|
23454
23550
|
name: "ECDSA",
|
|
23455
23551
|
hash: "SHA-256"
|
|
23456
23552
|
}, c, new Uint8Array(s), new Uint8Array(o))) return !1;
|
|
23457
23553
|
let l = JSON.parse(new TextDecoder().decode(o));
|
|
23458
23554
|
if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
|
|
23459
|
-
let u = await
|
|
23555
|
+
let u = await Tb(t);
|
|
23460
23556
|
return !(l.key !== u || l.domain !== n);
|
|
23461
23557
|
}
|
|
23462
|
-
async function
|
|
23463
|
-
let t =
|
|
23558
|
+
async function Mb(e) {
|
|
23559
|
+
let t = Ob();
|
|
23464
23560
|
if (!t) return {
|
|
23465
23561
|
valid: !1,
|
|
23466
23562
|
errorCode: "license.invalid"
|
|
23467
23563
|
};
|
|
23468
23564
|
try {
|
|
23469
|
-
if (await
|
|
23565
|
+
if (await jb(t, e, window.location.hostname.toLowerCase().trim())) return {
|
|
23470
23566
|
valid: !0,
|
|
23471
23567
|
errorCode: null
|
|
23472
23568
|
};
|
|
@@ -23476,23 +23572,23 @@ async function vb(e) {
|
|
|
23476
23572
|
errorCode: "license.invalid"
|
|
23477
23573
|
};
|
|
23478
23574
|
}
|
|
23479
|
-
async function
|
|
23480
|
-
if (
|
|
23575
|
+
async function Nb(e, t = !0) {
|
|
23576
|
+
if (xb() || Sb()) return {
|
|
23481
23577
|
valid: !0,
|
|
23482
23578
|
errorCode: null
|
|
23483
23579
|
};
|
|
23484
|
-
let n =
|
|
23580
|
+
let n = Cb();
|
|
23485
23581
|
try {
|
|
23486
23582
|
let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
|
|
23487
23583
|
if (r.ok) {
|
|
23488
23584
|
let e = await r.json();
|
|
23489
|
-
return t && e.grant &&
|
|
23585
|
+
return t && e.grant && kb(e.grant), {
|
|
23490
23586
|
valid: !0,
|
|
23491
23587
|
errorCode: null
|
|
23492
23588
|
};
|
|
23493
23589
|
}
|
|
23494
23590
|
if (r.status >= 400 && r.status < 500) {
|
|
23495
|
-
t &&
|
|
23591
|
+
t && Ab();
|
|
23496
23592
|
try {
|
|
23497
23593
|
return await r.json();
|
|
23498
23594
|
} catch {
|
|
@@ -23504,7 +23600,7 @@ async function yb(e, t = !0) {
|
|
|
23504
23600
|
}
|
|
23505
23601
|
throw Error(`Server error: ${r.status}`);
|
|
23506
23602
|
} catch {
|
|
23507
|
-
return t ?
|
|
23603
|
+
return t ? Mb(e) : {
|
|
23508
23604
|
valid: !1,
|
|
23509
23605
|
errorCode: "license.invalid"
|
|
23510
23606
|
};
|
|
@@ -23512,7 +23608,7 @@ async function yb(e, t = !0) {
|
|
|
23512
23608
|
}
|
|
23513
23609
|
//#endregion
|
|
23514
23610
|
//#region src/hooks/useLicenseValidation.ts
|
|
23515
|
-
function
|
|
23611
|
+
function Pb(e, t, n = !0) {
|
|
23516
23612
|
let [r, i] = b({
|
|
23517
23613
|
isValidating: t,
|
|
23518
23614
|
isValid: !1,
|
|
@@ -23532,7 +23628,7 @@ function bb(e, t, n = !0) {
|
|
|
23532
23628
|
isValidating: !0,
|
|
23533
23629
|
isValid: !1,
|
|
23534
23630
|
errorCode: null
|
|
23535
|
-
}),
|
|
23631
|
+
}), Nb(e, n).then((e) => {
|
|
23536
23632
|
r || i({
|
|
23537
23633
|
isValidating: !1,
|
|
23538
23634
|
isValid: e.valid,
|
|
@@ -23555,7 +23651,7 @@ function bb(e, t, n = !0) {
|
|
|
23555
23651
|
}
|
|
23556
23652
|
//#endregion
|
|
23557
23653
|
//#region src/server/auth/AuthState.ts
|
|
23558
|
-
var
|
|
23654
|
+
var Fb = class {
|
|
23559
23655
|
token = null;
|
|
23560
23656
|
get() {
|
|
23561
23657
|
return this.token;
|
|
@@ -23566,13 +23662,13 @@ var xb = class {
|
|
|
23566
23662
|
clear() {
|
|
23567
23663
|
this.token = null;
|
|
23568
23664
|
}
|
|
23569
|
-
},
|
|
23665
|
+
}, Ib = class extends Error {
|
|
23570
23666
|
status;
|
|
23571
23667
|
code;
|
|
23572
23668
|
constructor(e) {
|
|
23573
23669
|
super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
|
|
23574
23670
|
}
|
|
23575
|
-
},
|
|
23671
|
+
}, Lb = class {
|
|
23576
23672
|
baseUrl;
|
|
23577
23673
|
apiKey;
|
|
23578
23674
|
auth;
|
|
@@ -23602,7 +23698,7 @@ var xb = class {
|
|
|
23602
23698
|
signal: r?.signal
|
|
23603
23699
|
});
|
|
23604
23700
|
} catch (e) {
|
|
23605
|
-
this.notify(new
|
|
23701
|
+
this.notify(new Ib({
|
|
23606
23702
|
status: 0,
|
|
23607
23703
|
code: "network",
|
|
23608
23704
|
message: e instanceof Error ? e.message : String(e)
|
|
@@ -23613,7 +23709,7 @@ var xb = class {
|
|
|
23613
23709
|
try {
|
|
23614
23710
|
e = await s.json();
|
|
23615
23711
|
} catch {}
|
|
23616
|
-
this.notify(new
|
|
23712
|
+
this.notify(new Ib({
|
|
23617
23713
|
status: s.status,
|
|
23618
23714
|
code: e.error ?? `http_${s.status}`,
|
|
23619
23715
|
message: e.message ?? s.statusText
|
|
@@ -23624,23 +23720,23 @@ var xb = class {
|
|
|
23624
23720
|
};
|
|
23625
23721
|
//#endregion
|
|
23626
23722
|
//#region src/server/endpoints/workspaces.ts
|
|
23627
|
-
async function
|
|
23723
|
+
async function Rb(e, t) {
|
|
23628
23724
|
return e.post("/workspaces", {
|
|
23629
23725
|
primaryKey: t.primaryKey,
|
|
23630
23726
|
columns: t.columns
|
|
23631
23727
|
}, { signal: t.signal });
|
|
23632
23728
|
}
|
|
23633
|
-
async function
|
|
23729
|
+
async function zb(e) {
|
|
23634
23730
|
try {
|
|
23635
23731
|
await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
|
|
23636
23732
|
} catch (e) {
|
|
23637
|
-
if (e instanceof
|
|
23733
|
+
if (e instanceof Ib && e.status === 404) return;
|
|
23638
23734
|
throw e;
|
|
23639
23735
|
}
|
|
23640
23736
|
}
|
|
23641
23737
|
//#endregion
|
|
23642
23738
|
//#region src/server/endpoints/query.ts
|
|
23643
|
-
async function
|
|
23739
|
+
async function Bb(e, t) {
|
|
23644
23740
|
let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
|
|
23645
23741
|
page: {
|
|
23646
23742
|
limit: t.limit,
|
|
@@ -23658,12 +23754,12 @@ async function Eb(e, t) {
|
|
|
23658
23754
|
}
|
|
23659
23755
|
//#endregion
|
|
23660
23756
|
//#region src/server/ScaleClient.ts
|
|
23661
|
-
var
|
|
23757
|
+
var Vb = class {
|
|
23662
23758
|
disposed = !1;
|
|
23663
23759
|
constructor(e) {
|
|
23664
23760
|
this.deps = e;
|
|
23665
23761
|
}
|
|
23666
|
-
onQuery = (e) =>
|
|
23762
|
+
onQuery = (e) => Bb(this.deps, e);
|
|
23667
23763
|
onEdit = async (e) => ({
|
|
23668
23764
|
rejected: !0,
|
|
23669
23765
|
reason: "Edits are not yet supported in server mode (v0)."
|
|
@@ -23680,7 +23776,7 @@ var Db = class {
|
|
|
23680
23776
|
pageSize = void 0;
|
|
23681
23777
|
scrollSensitivity = void 0;
|
|
23682
23778
|
dispose = async () => {
|
|
23683
|
-
this.disposed || (this.disposed = !0, await
|
|
23779
|
+
this.disposed || (this.disposed = !0, await zb({
|
|
23684
23780
|
http: this.deps.http,
|
|
23685
23781
|
workspaceId: this.deps.workspaceId
|
|
23686
23782
|
}));
|
|
@@ -23688,25 +23784,25 @@ var Db = class {
|
|
|
23688
23784
|
};
|
|
23689
23785
|
//#endregion
|
|
23690
23786
|
//#region src/server/createScaleClient.ts
|
|
23691
|
-
async function
|
|
23692
|
-
let t = new
|
|
23787
|
+
async function Hb(e) {
|
|
23788
|
+
let t = new Fb(), n = new Lb({
|
|
23693
23789
|
baseUrl: e.url,
|
|
23694
23790
|
apiKey: e.apiKey,
|
|
23695
23791
|
auth: t,
|
|
23696
23792
|
onDegraded: e.onDegraded
|
|
23697
|
-
}), { workspaceId: r, accessToken: i } = await
|
|
23793
|
+
}), { workspaceId: r, accessToken: i } = await Rb(n, {
|
|
23698
23794
|
primaryKey: e.primaryKey,
|
|
23699
23795
|
columns: e.columns,
|
|
23700
23796
|
signal: e.signal
|
|
23701
23797
|
});
|
|
23702
|
-
return t.set(i), new
|
|
23798
|
+
return t.set(i), new Vb({
|
|
23703
23799
|
workspaceId: r,
|
|
23704
23800
|
http: n
|
|
23705
23801
|
});
|
|
23706
23802
|
}
|
|
23707
23803
|
//#endregion
|
|
23708
23804
|
//#region src/server/errors.ts
|
|
23709
|
-
function
|
|
23805
|
+
function Ub(e, t, n) {
|
|
23710
23806
|
return {
|
|
23711
23807
|
code: e,
|
|
23712
23808
|
message: t,
|
|
@@ -23716,7 +23812,7 @@ function kb(e, t, n) {
|
|
|
23716
23812
|
}
|
|
23717
23813
|
//#endregion
|
|
23718
23814
|
//#region src/hooks/useScaleClient.ts
|
|
23719
|
-
function
|
|
23815
|
+
function Wb(e) {
|
|
23720
23816
|
let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
|
|
23721
23817
|
return m(() => {
|
|
23722
23818
|
if (!e.enabled) {
|
|
@@ -23725,7 +23821,7 @@ function Ab(e) {
|
|
|
23725
23821
|
}
|
|
23726
23822
|
n({ status: "bootstrapping" });
|
|
23727
23823
|
let t = new AbortController(), a = null;
|
|
23728
|
-
return
|
|
23824
|
+
return Hb({
|
|
23729
23825
|
url: e.url,
|
|
23730
23826
|
apiKey: e.apiKey,
|
|
23731
23827
|
primaryKey: i.current,
|
|
@@ -23734,7 +23830,7 @@ function Ab(e) {
|
|
|
23734
23830
|
onDegraded: (e) => {
|
|
23735
23831
|
t.signal.aborted || n({
|
|
23736
23832
|
status: "failed",
|
|
23737
|
-
error:
|
|
23833
|
+
error: Kb(e)
|
|
23738
23834
|
});
|
|
23739
23835
|
}
|
|
23740
23836
|
}).then((e) => {
|
|
@@ -23749,7 +23845,7 @@ function Ab(e) {
|
|
|
23749
23845
|
}).catch((e) => {
|
|
23750
23846
|
t.signal.aborted || n({
|
|
23751
23847
|
status: "failed",
|
|
23752
|
-
error:
|
|
23848
|
+
error: Gb(e)
|
|
23753
23849
|
});
|
|
23754
23850
|
}), () => {
|
|
23755
23851
|
t.abort(), a?.dispose().catch(() => {});
|
|
@@ -23760,30 +23856,30 @@ function Ab(e) {
|
|
|
23760
23856
|
e.apiKey
|
|
23761
23857
|
]), t;
|
|
23762
23858
|
}
|
|
23763
|
-
function
|
|
23764
|
-
return e instanceof
|
|
23859
|
+
function Gb(e) {
|
|
23860
|
+
return e instanceof Ib ? e.status === 401 ? Ub(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? Ub("scale.unreachable", e.message, e) : e.status >= 500 ? Ub("scale.server_error", e.message, e) : Ub("scale.bootstrap_failed", e.message, e) : Ub("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
|
|
23765
23861
|
}
|
|
23766
|
-
function
|
|
23767
|
-
return e.status === 0 ?
|
|
23862
|
+
function Kb(e) {
|
|
23863
|
+
return e.status === 0 ? Ub("scale.unreachable", e.message, e) : e.status === 404 ? Ub("scale.workspace_lost", e.message, e) : Ub("scale.server_error", e.message, e);
|
|
23768
23864
|
}
|
|
23769
23865
|
//#endregion
|
|
23770
23866
|
//#region src/index.tsx
|
|
23771
|
-
function
|
|
23867
|
+
function qb(e) {
|
|
23772
23868
|
return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
|
|
23773
23869
|
}
|
|
23774
|
-
function
|
|
23870
|
+
function Jb(e) {
|
|
23775
23871
|
let t = v(() => new Bo(e.onError), [e.onError]);
|
|
23776
23872
|
return /* @__PURE__ */ C(yv, {
|
|
23777
23873
|
errorHandler: t,
|
|
23778
23874
|
children: /* @__PURE__ */ C(Wl, {
|
|
23779
23875
|
...e,
|
|
23780
23876
|
errorHandler: t,
|
|
23781
|
-
children: e.showUploader ? /* @__PURE__ */ C(
|
|
23877
|
+
children: e.showUploader ? /* @__PURE__ */ C(_b, {}) : /* @__PURE__ */ C(hv, {})
|
|
23782
23878
|
})
|
|
23783
23879
|
});
|
|
23784
23880
|
}
|
|
23785
|
-
function
|
|
23786
|
-
let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a =
|
|
23881
|
+
function Yb(e) {
|
|
23882
|
+
let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = qb(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = Pb(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = Wb({
|
|
23787
23883
|
enabled: !s && c && u,
|
|
23788
23884
|
url: e.__server?.url ?? "",
|
|
23789
23885
|
apiKey: e.apiKey,
|
|
@@ -23838,7 +23934,7 @@ function Fb(e) {
|
|
|
23838
23934
|
code: e,
|
|
23839
23935
|
message: "License validation failed",
|
|
23840
23936
|
source: "license"
|
|
23841
|
-
} }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(
|
|
23937
|
+
} }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(Jb, { ...k }) : j(l ?? "license.invalid");
|
|
23842
23938
|
return t === "inline" ? /* @__PURE__ */ C("div", {
|
|
23843
23939
|
className: "updog__data-editor updog__data-editor-inline",
|
|
23844
23940
|
dir: i,
|
|
@@ -23858,14 +23954,14 @@ function Fb(e) {
|
|
|
23858
23954
|
submitText: n("dataEditor.confirmClose.action")
|
|
23859
23955
|
})] });
|
|
23860
23956
|
}
|
|
23861
|
-
function
|
|
23957
|
+
function Xb(e) {
|
|
23862
23958
|
let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
|
|
23863
23959
|
return /* @__PURE__ */ C(Zr, {
|
|
23864
23960
|
translations: t,
|
|
23865
23961
|
rtl: n,
|
|
23866
23962
|
locale: r,
|
|
23867
|
-
children: /* @__PURE__ */ C(
|
|
23963
|
+
children: /* @__PURE__ */ C(Yb, { ...a })
|
|
23868
23964
|
});
|
|
23869
23965
|
}
|
|
23870
23966
|
//#endregion
|
|
23871
|
-
export {
|
|
23967
|
+
export { Xb as DataEditor, ou as downloadExampleFile, su as exportDataEditor };
|