@updog/data-editor-wc 0.1.90 → 0.1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +7 -0
- package/index.js +99 -91
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -522,6 +522,8 @@ declare var export_default = {
|
|
|
522
522
|
showSampleValues: "Show example values from {{column}}",
|
|
523
523
|
unmatchedWarning:
|
|
524
524
|
"Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing.",
|
|
525
|
+
unmatchedWarningWithRowHook:
|
|
526
|
+
"The import can read this column without a match. If you match it, the import may still change the values.",
|
|
525
527
|
},
|
|
526
528
|
sheetPreview: {
|
|
527
529
|
cancel: "Cancel processing",
|
|
@@ -859,6 +861,11 @@ type DataEditorColumn = {
|
|
|
859
861
|
editor?: CellEditor;
|
|
860
862
|
/** Adds a filter control for this column in the sidebar Filters panel. */
|
|
861
863
|
filter?: ColumnFilter;
|
|
864
|
+
/**
|
|
865
|
+
* Whether this column is offered as a target on the column-matching step.
|
|
866
|
+
* Set false for fields your `onRowImport` callback fills. @default true
|
|
867
|
+
*/
|
|
868
|
+
mappable?: boolean;
|
|
862
869
|
/**
|
|
863
870
|
* Whether this column can be pinned to the left (right in RTL) via the
|
|
864
871
|
* header context menu. @default true
|
package/index.js
CHANGED
|
@@ -8500,7 +8500,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
8500
8500
|
sampleValues: "Example values",
|
|
8501
8501
|
sampleValuesEmpty: "No values in this column",
|
|
8502
8502
|
showSampleValues: "Show example values from {{column}}",
|
|
8503
|
-
unmatchedWarning: "Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing."
|
|
8503
|
+
unmatchedWarning: "Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing.",
|
|
8504
|
+
unmatchedWarningWithRowHook: "The import can read this column without a match. If you match it, the import may still change the values."
|
|
8504
8505
|
},
|
|
8505
8506
|
sheetPreview: {
|
|
8506
8507
|
cancel: "Cancel processing",
|
|
@@ -30130,7 +30131,9 @@ var Ry = (e, t, n) => {
|
|
|
30130
30131
|
if (!e) return "";
|
|
30131
30132
|
if (t.length === 0) return "[updog] primaryKey is empty, so imported rows are appended instead of merged.";
|
|
30132
30133
|
let r = Od(t, n.map((e) => e.id));
|
|
30133
|
-
|
|
30134
|
+
if (r.length > 0) return `[updog] primaryKey names ${r.map((e) => `"${e}"`).join(", ")}, which no column declares. Imported rows are appended instead of merged.`;
|
|
30135
|
+
let i = t.filter((e) => n.some((t) => t.id === e && t.mappable === !1));
|
|
30136
|
+
return i.length === 0 ? "" : `[updog] primaryKey names ${i.map((e) => `"${e}"`).join(", ")}, which is not mappable (mappable: false). It never receives a match, so imported rows are appended instead of merged.`;
|
|
30134
30137
|
};
|
|
30135
30138
|
function zy({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: m, headerHeight: h, readonly: g, enableCreateColumn: _, onColumnMatch: v, onValueMatch: b, onRowImport: x, context: S, synonyms: C, sampleData: w, chat: T, remoteSources: E, customFormats: D, onUnstructuredFile: O, onError: k, errorHandler: A }) {
|
|
30136
30139
|
let j = ky(A ?? new xd(k)), { t: M, locale: N } = W();
|
|
@@ -50509,7 +50512,10 @@ var IH = (e, t) => {
|
|
|
50509
50512
|
seqByWorkbook = /* @__PURE__ */ new Map();
|
|
50510
50513
|
_state = dU;
|
|
50511
50514
|
constructor(e, t) {
|
|
50512
|
-
this.deps =
|
|
50515
|
+
this.deps = {
|
|
50516
|
+
...e,
|
|
50517
|
+
columns: e.columns.filter((e) => e.mappable !== !1)
|
|
50518
|
+
}, this.notify = t;
|
|
50513
50519
|
}
|
|
50514
50520
|
get state() {
|
|
50515
50521
|
return this._state;
|
|
@@ -52759,95 +52765,96 @@ var GW = (e) => {
|
|
|
52759
52765
|
allMatched: n === e.headers.length
|
|
52760
52766
|
};
|
|
52761
52767
|
}, xG = {}, SG = {}, CG = [], wG = () => {
|
|
52762
|
-
let { columns: e, enableCreateColumn: t } = Hy(), { t:
|
|
52763
|
-
|
|
52764
|
-
}, [
|
|
52765
|
-
|
|
52766
|
-
}, [
|
|
52767
|
-
|
|
52768
|
+
let { columns: e, enableCreateColumn: t, onRowImport: n } = Hy(), r = (0, y.useMemo)(() => e.filter((e) => e.mappable !== !1), [e]), { t: i } = W(), a = fV(), o = CV(a, SV), s = CV(a, mV), c = o ? s.find((e) => e.id === o.workbookId) ?? null : null, { byWorkbook: l, pendingColumns: u, autoMatched: d, isMatching: f } = CV(a, hV), p = c ? l[c.id] ?? xG : xG, m = c?.id ?? null, h = (0, y.useCallback)((e, t) => {
|
|
52769
|
+
m !== null && a.updateColumnMapping(m, e, t);
|
|
52770
|
+
}, [a, m]), g = (0, y.useCallback)((e) => {
|
|
52771
|
+
a.setPendingColumns(e);
|
|
52772
|
+
}, [a]), _ = (0, y.useMemo)(() => c ? bG(c, p) : null, [c, p]), v = (o?.total ?? 0) > 1, b = _?.headers ?? CG, [x, S] = (0, y.useState)(null), { value: C, setTrue: w, setFalse: T } = Ql(!1), [E, D] = (0, y.useState)({}), O = (0, y.useRef)(null), k = (0, y.useCallback)((e) => E[e] ?? !0, [E]), A = (0, y.useCallback)((e, t) => {
|
|
52773
|
+
D((n) => ({
|
|
52768
52774
|
...n,
|
|
52769
52775
|
[e]: t
|
|
52770
52776
|
}));
|
|
52771
|
-
}, []),
|
|
52777
|
+
}, []), j = (0, y.useCallback)((e, t) => {
|
|
52772
52778
|
if (t === "action:create") {
|
|
52773
|
-
|
|
52779
|
+
O.current = e, S({ title: e }), w();
|
|
52774
52780
|
return;
|
|
52775
52781
|
}
|
|
52776
|
-
|
|
52777
|
-
}, [
|
|
52778
|
-
if (
|
|
52782
|
+
h(e, t);
|
|
52783
|
+
}, [h, w]), M = (0, y.useCallback)((e) => {
|
|
52784
|
+
if (O.current === null) return;
|
|
52779
52785
|
let t = crypto.randomUUID(), n = `${vd}${e.title}-${t}`;
|
|
52780
|
-
|
|
52786
|
+
g((t) => [...t, {
|
|
52781
52787
|
...e,
|
|
52782
52788
|
id: n,
|
|
52783
52789
|
size: 150
|
|
52784
|
-
}]),
|
|
52790
|
+
}]), h(O.current, n), O.current = null, T();
|
|
52785
52791
|
}, [
|
|
52786
|
-
|
|
52787
|
-
|
|
52788
|
-
|
|
52789
|
-
]),
|
|
52790
|
-
|
|
52791
|
-
}, [
|
|
52792
|
-
let
|
|
52793
|
-
text:
|
|
52792
|
+
h,
|
|
52793
|
+
g,
|
|
52794
|
+
T
|
|
52795
|
+
]), N = (0, y.useCallback)(() => {
|
|
52796
|
+
O.current = null, T();
|
|
52797
|
+
}, [T]), P = (0, y.useMemo)(() => [...e.map((e) => e.title), ...u.map((e) => e.title)], [e, u]), F = m ? d[m] ?? SG : SG, I = (0, y.useMemo)(() => {
|
|
52798
|
+
let e = {
|
|
52799
|
+
text: i("dataEditor.uploader.matchColumns.bestMatch"),
|
|
52794
52800
|
color: "green"
|
|
52795
|
-
},
|
|
52796
|
-
text:
|
|
52801
|
+
}, n = {
|
|
52802
|
+
text: i("dataEditor.uploader.matchColumns.newColumnTag"),
|
|
52797
52803
|
color: "blue"
|
|
52798
|
-
}, a =
|
|
52799
|
-
return Object.fromEntries(
|
|
52800
|
-
let o =
|
|
52801
|
-
id:
|
|
52802
|
-
text:
|
|
52803
|
-
...
|
|
52804
|
+
}, a = i("dataEditor.uploader.matchColumns.createColumn");
|
|
52805
|
+
return Object.fromEntries(b.map((i) => {
|
|
52806
|
+
let o = F[i], s = r.map((t) => ({
|
|
52807
|
+
id: t.id,
|
|
52808
|
+
text: t.title,
|
|
52809
|
+
...t.id === o && { tag: e }
|
|
52804
52810
|
}));
|
|
52805
|
-
for (let e of
|
|
52811
|
+
for (let e of u) s.push({
|
|
52806
52812
|
id: e.id,
|
|
52807
52813
|
text: e.title,
|
|
52808
|
-
tag:
|
|
52814
|
+
tag: n
|
|
52809
52815
|
});
|
|
52810
52816
|
return t && s.push({
|
|
52811
|
-
id: `${
|
|
52817
|
+
id: `${i}_d`,
|
|
52812
52818
|
type: "divider"
|
|
52813
52819
|
}, {
|
|
52814
52820
|
id: aH,
|
|
52815
52821
|
text: a,
|
|
52816
52822
|
icon: /* @__PURE__ */ (0, B.jsx)(He, { size: "1rem" })
|
|
52817
|
-
}), [
|
|
52823
|
+
}), [i, s];
|
|
52818
52824
|
}));
|
|
52819
52825
|
}, [
|
|
52820
|
-
|
|
52821
|
-
|
|
52822
|
-
|
|
52823
|
-
|
|
52826
|
+
b,
|
|
52827
|
+
r,
|
|
52828
|
+
u,
|
|
52829
|
+
i,
|
|
52824
52830
|
t,
|
|
52825
|
-
|
|
52826
|
-
]),
|
|
52827
|
-
mappedValue:
|
|
52828
|
-
options:
|
|
52829
|
-
autoMatchId:
|
|
52831
|
+
F
|
|
52832
|
+
]), L = i("dataEditor.uploader.matchColumns.selectColumnPlaceholder"), R = (0, y.useCallback)((e, t) => c ? JH(c, e, t) : [], [c]), z = (0, y.useCallback)((e) => ({
|
|
52833
|
+
mappedValue: p[e],
|
|
52834
|
+
options: I[e],
|
|
52835
|
+
autoMatchId: F[e]
|
|
52830
52836
|
}), [
|
|
52831
|
-
|
|
52832
|
-
|
|
52833
|
-
|
|
52837
|
+
p,
|
|
52838
|
+
I,
|
|
52839
|
+
F
|
|
52834
52840
|
]);
|
|
52835
52841
|
return {
|
|
52836
|
-
view:
|
|
52837
|
-
isMultiWorkbook:
|
|
52838
|
-
|
|
52839
|
-
|
|
52840
|
-
|
|
52841
|
-
|
|
52842
|
-
|
|
52843
|
-
|
|
52844
|
-
|
|
52845
|
-
|
|
52846
|
-
|
|
52847
|
-
|
|
52848
|
-
|
|
52849
|
-
|
|
52850
|
-
|
|
52842
|
+
view: _,
|
|
52843
|
+
isMultiWorkbook: v,
|
|
52844
|
+
hasRowHook: !!n,
|
|
52845
|
+
isMatching: m ? f[m] ?? !1 : !1,
|
|
52846
|
+
isShowMatched: k,
|
|
52847
|
+
setShowMatched: A,
|
|
52848
|
+
placeholder: L,
|
|
52849
|
+
existingNames: P,
|
|
52850
|
+
createModalValues: x,
|
|
52851
|
+
createModalOpen: C,
|
|
52852
|
+
getRowData: z,
|
|
52853
|
+
getSampleValues: R,
|
|
52854
|
+
onSelectChange: j,
|
|
52855
|
+
onClear: h,
|
|
52856
|
+
submitCreate: M,
|
|
52857
|
+
closeCreate: N
|
|
52851
52858
|
};
|
|
52852
52859
|
}, TG = (0, y.createContext)(null);
|
|
52853
52860
|
function EG({ children: e }) {
|
|
@@ -53002,28 +53009,28 @@ var DG = () => {
|
|
|
53002
53009
|
})]
|
|
53003
53010
|
})
|
|
53004
53011
|
});
|
|
53005
|
-
}, NG = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a,
|
|
53006
|
-
let { t:
|
|
53007
|
-
|
|
53008
|
-
}, [e,
|
|
53009
|
-
|
|
53010
|
-
}, [e,
|
|
53012
|
+
}, NG = (0, y.memo)(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, hasRowHook: o, getSampleValues: s, onSelectChange: c, onClear: l }) => {
|
|
53013
|
+
let { t: u } = W(), d = (0, y.useId)(), f = !t, p = t?.startsWith("__dynamic__:") && !!r && !a, m = f && !a, h = (0, y.useCallback)((t) => {
|
|
53014
|
+
c(e, t);
|
|
53015
|
+
}, [e, c]), g = (0, y.useCallback)(() => {
|
|
53016
|
+
l(e, void 0);
|
|
53017
|
+
}, [e, l]);
|
|
53011
53018
|
return /* @__PURE__ */ (0, B.jsxs)("div", {
|
|
53012
53019
|
className: "updog__column-matching__row",
|
|
53013
53020
|
children: [
|
|
53014
53021
|
/* @__PURE__ */ (0, B.jsx)("div", {
|
|
53015
53022
|
className: "updog__column-matching__column",
|
|
53016
53023
|
children: /* @__PURE__ */ (0, B.jsx)(MG, {
|
|
53017
|
-
labelId:
|
|
53024
|
+
labelId: d,
|
|
53018
53025
|
csvHeader: e,
|
|
53019
|
-
getSampleValues:
|
|
53026
|
+
getSampleValues: s
|
|
53020
53027
|
})
|
|
53021
53028
|
}),
|
|
53022
53029
|
/* @__PURE__ */ (0, B.jsx)("div", {
|
|
53023
53030
|
className: "updog__column-matching__arrow-container",
|
|
53024
53031
|
children: /* @__PURE__ */ (0, B.jsx)(fe, {
|
|
53025
53032
|
size: "1.25rem",
|
|
53026
|
-
className: G("updog__column-matching__arrow", "rtl-mirror",
|
|
53033
|
+
className: G("updog__column-matching__arrow", "rtl-mirror", f || a ? "updog__column-matching__arrow--unmatched" : "updog__column-matching__arrow--matched")
|
|
53027
53034
|
})
|
|
53028
53035
|
}),
|
|
53029
53036
|
/* @__PURE__ */ (0, B.jsx)("div", {
|
|
@@ -53032,30 +53039,30 @@ var DG = () => {
|
|
|
53032
53039
|
width: "100%",
|
|
53033
53040
|
height: "2.5rem"
|
|
53034
53041
|
}) : /* @__PURE__ */ (0, B.jsx)(xl, {
|
|
53035
|
-
ariaLabelledby:
|
|
53042
|
+
ariaLabelledby: d,
|
|
53036
53043
|
options: n,
|
|
53037
53044
|
value: t,
|
|
53038
|
-
onChange:
|
|
53039
|
-
onClear:
|
|
53045
|
+
onChange: h,
|
|
53046
|
+
onClear: g,
|
|
53040
53047
|
placeholder: i
|
|
53041
53048
|
})
|
|
53042
53049
|
}),
|
|
53043
53050
|
/* @__PURE__ */ (0, B.jsxs)("div", {
|
|
53044
53051
|
className: "updog__column-matching__action",
|
|
53045
|
-
children: [
|
|
53052
|
+
children: [p && /* @__PURE__ */ (0, B.jsx)(Js, {
|
|
53046
53053
|
content: /* @__PURE__ */ (0, B.jsx)(q, {
|
|
53047
53054
|
size: "sm",
|
|
53048
|
-
children:
|
|
53055
|
+
children: u("dataEditor.uploader.matchColumns.createColumnWarning")
|
|
53049
53056
|
}),
|
|
53050
53057
|
placement: "bottom-end",
|
|
53051
53058
|
children: /* @__PURE__ */ (0, B.jsx)(et, {
|
|
53052
53059
|
size: "1.25rem",
|
|
53053
53060
|
className: "updog__column-matching__action-icon"
|
|
53054
53061
|
})
|
|
53055
|
-
}),
|
|
53062
|
+
}), m && /* @__PURE__ */ (0, B.jsx)(Js, {
|
|
53056
53063
|
content: /* @__PURE__ */ (0, B.jsx)(q, {
|
|
53057
53064
|
size: "sm",
|
|
53058
|
-
children:
|
|
53065
|
+
children: u(o ? "dataEditor.uploader.matchColumns.unmatchedWarningWithRowHook" : "dataEditor.uploader.matchColumns.unmatchedWarning")
|
|
53059
53066
|
}),
|
|
53060
53067
|
placement: "bottom-end",
|
|
53061
53068
|
children: /* @__PURE__ */ (0, B.jsx)(Me, {
|
|
@@ -53067,34 +53074,35 @@ var DG = () => {
|
|
|
53067
53074
|
]
|
|
53068
53075
|
});
|
|
53069
53076
|
}), PG = ({ view: e }) => {
|
|
53070
|
-
let { isMatching: t, isShowMatched: n,
|
|
53077
|
+
let { isMatching: t, isShowMatched: n, hasRowHook: r, placeholder: i, getRowData: a, getSampleValues: o, onSelectChange: s, onClear: c } = DG(), { t: l } = W(), u = n(e.workbookId), d = e.headers.map((e) => ({
|
|
53071
53078
|
csvHeader: e,
|
|
53072
|
-
...
|
|
53073
|
-
})).filter((e) =>
|
|
53074
|
-
return
|
|
53079
|
+
...a(e)
|
|
53080
|
+
})).filter((e) => u || !e.mappedValue);
|
|
53081
|
+
return d.length === 0 ? /* @__PURE__ */ (0, B.jsx)("div", {
|
|
53075
53082
|
className: "updog__column-matching__content",
|
|
53076
53083
|
children: /* @__PURE__ */ (0, B.jsx)("div", {
|
|
53077
53084
|
className: "updog__column-matching__empty",
|
|
53078
53085
|
children: /* @__PURE__ */ (0, B.jsx)(q, {
|
|
53079
53086
|
size: "sm",
|
|
53080
53087
|
color: "secondary",
|
|
53081
|
-
children:
|
|
53088
|
+
children: l("dataEditor.uploader.matchColumns.allMatched")
|
|
53082
53089
|
})
|
|
53083
53090
|
})
|
|
53084
53091
|
}) : /* @__PURE__ */ (0, B.jsx)("div", {
|
|
53085
53092
|
className: "updog__column-matching__content",
|
|
53086
53093
|
children: /* @__PURE__ */ (0, B.jsx)("div", {
|
|
53087
53094
|
className: "updog__column-matching__content-inner",
|
|
53088
|
-
children:
|
|
53095
|
+
children: d.map(({ csvHeader: e, mappedValue: n, options: a, autoMatchId: l }) => /* @__PURE__ */ (0, B.jsx)(NG, {
|
|
53089
53096
|
csvHeader: e,
|
|
53090
53097
|
mappedValue: n,
|
|
53091
|
-
options:
|
|
53092
|
-
autoMatchId:
|
|
53093
|
-
placeholder:
|
|
53098
|
+
options: a,
|
|
53099
|
+
autoMatchId: l,
|
|
53100
|
+
placeholder: i,
|
|
53094
53101
|
isMatching: t,
|
|
53095
|
-
|
|
53096
|
-
|
|
53097
|
-
|
|
53102
|
+
hasRowHook: r,
|
|
53103
|
+
getSampleValues: o,
|
|
53104
|
+
onSelectChange: s,
|
|
53105
|
+
onClear: c
|
|
53098
53106
|
}, e))
|
|
53099
53107
|
})
|
|
53100
53108
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"description": "Client-side CSV importer and spreadsheet editor as a Web Component. Drop into Vue, Angular, Svelte, or vanilla JS. Import CSV, Excel, JSON; edit 1M+ rows entirely in the browser.",
|
|
5
5
|
"author": "Mikhail Kutateladze <admin@updog.tech>",
|
|
6
6
|
"homepage": "https://updog.tech",
|