@updog/data-editor 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
|
@@ -524,6 +524,8 @@ declare var export_default = {
|
|
|
524
524
|
showSampleValues: "Show example values from {{column}}",
|
|
525
525
|
unmatchedWarning:
|
|
526
526
|
"Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing.",
|
|
527
|
+
unmatchedWarningWithRowHook:
|
|
528
|
+
"The import can read this column without a match. If you match it, the import may still change the values.",
|
|
527
529
|
},
|
|
528
530
|
sheetPreview: {
|
|
529
531
|
cancel: "Cancel processing",
|
|
@@ -953,6 +955,11 @@ type DataEditorColumn = {
|
|
|
953
955
|
editor?: CellEditor;
|
|
954
956
|
/** Adds a filter control for this column in the sidebar Filters panel. */
|
|
955
957
|
filter?: ColumnFilter;
|
|
958
|
+
/**
|
|
959
|
+
* Whether this column is offered as a target on the column-matching step.
|
|
960
|
+
* Set false for fields your `onRowImport` callback fills. @default true
|
|
961
|
+
*/
|
|
962
|
+
mappable?: boolean;
|
|
956
963
|
/**
|
|
957
964
|
* Whether this column can be pinned to the left (right in RTL) via the
|
|
958
965
|
* header context menu. @default true
|
package/index.js
CHANGED
|
@@ -494,7 +494,8 @@ var vi = {
|
|
|
494
494
|
sampleValues: "Example values",
|
|
495
495
|
sampleValuesEmpty: "No values in this column",
|
|
496
496
|
showSampleValues: "Show example values from {{column}}",
|
|
497
|
-
unmatchedWarning: "Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing."
|
|
497
|
+
unmatchedWarning: "Unmatched columns won't be imported. Match this column to keep the data. You can transform columns after importing.",
|
|
498
|
+
unmatchedWarningWithRowHook: "The import can read this column without a match. If you match it, the import may still change the values."
|
|
498
499
|
},
|
|
499
500
|
sheetPreview: {
|
|
500
501
|
cancel: "Cancel processing",
|
|
@@ -11466,7 +11467,9 @@ var Dh = (e, t, n) => {
|
|
|
11466
11467
|
if (!e) return "";
|
|
11467
11468
|
if (t.length === 0) return "[updog] primaryKey is empty, so imported rows are appended instead of merged.";
|
|
11468
11469
|
let r = gc(t, n.map((e) => e.id));
|
|
11469
|
-
|
|
11470
|
+
if (r.length > 0) return `[updog] primaryKey names ${r.map((e) => `"${e}"`).join(", ")}, which no column declares. Imported rows are appended instead of merged.`;
|
|
11471
|
+
let i = t.filter((e) => n.some((t) => t.id === e && t.mappable === !1));
|
|
11472
|
+
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.`;
|
|
11470
11473
|
};
|
|
11471
11474
|
function Oh({ columns: e, primaryKey: t, loadData: n, onComplete: r, variant: i, showUploader: a, setShowUploader: o, storeRef: s, enableDeleteRow: c, enableAddRow: l, enableAddSource: u, blockSubmitOnError: d, importFormats: f, exportFormats: p, rowHeight: h, headerHeight: _, readonly: v, enableCreateColumn: y, onColumnMatch: b, onValueMatch: x, onRowImport: w, context: T, synonyms: E, sampleData: D, chat: O, remoteSources: k, customFormats: A, onUnstructuredFile: j, onError: M, errorHandler: N }) {
|
|
11472
11475
|
let P = vh(N ?? new lc(M)), { t: F, locale: I } = q();
|
|
@@ -24573,7 +24576,10 @@ var ED = (e, t) => {
|
|
|
24573
24576
|
seqByWorkbook = /* @__PURE__ */ new Map();
|
|
24574
24577
|
_state = tO;
|
|
24575
24578
|
constructor(e, t) {
|
|
24576
|
-
this.deps =
|
|
24579
|
+
this.deps = {
|
|
24580
|
+
...e,
|
|
24581
|
+
columns: e.columns.filter((e) => e.mappable !== !1)
|
|
24582
|
+
}, this.notify = t;
|
|
24577
24583
|
}
|
|
24578
24584
|
get state() {
|
|
24579
24585
|
return this._state;
|
|
@@ -26822,95 +26828,96 @@ var Fk = (t) => {
|
|
|
26822
26828
|
allMatched: n === e.headers.length
|
|
26823
26829
|
};
|
|
26824
26830
|
}, dA = {}, fA = {}, pA = [], mA = () => {
|
|
26825
|
-
let { columns: e, enableCreateColumn: t } = Q(), { t:
|
|
26826
|
-
|
|
26827
|
-
}, [
|
|
26828
|
-
|
|
26829
|
-
}, [
|
|
26830
|
-
|
|
26831
|
+
let { columns: e, enableCreateColumn: t, onRowImport: n } = Q(), r = b(() => e.filter((e) => e.mappable !== !1), [e]), { t: i } = q(), a = nE(), o = pE(a, fE), s = pE(a, iE), c = o ? s.find((e) => e.id === o.workbookId) ?? null : null, { byWorkbook: l, pendingColumns: u, autoMatched: d, isMatching: f } = pE(a, aE), p = c ? l[c.id] ?? dA : dA, h = c?.id ?? null, g = m((e, t) => {
|
|
26832
|
+
h !== null && a.updateColumnMapping(h, e, t);
|
|
26833
|
+
}, [a, h]), _ = m((e) => {
|
|
26834
|
+
a.setPendingColumns(e);
|
|
26835
|
+
}, [a]), v = b(() => c ? uA(c, p) : null, [c, p]), y = (o?.total ?? 0) > 1, C = v?.headers ?? pA, [w, E] = S(null), { value: D, setTrue: O, setFalse: k } = nc(!1), [A, j] = S({}), M = x(null), N = m((e) => A[e] ?? !0, [A]), P = m((e, t) => {
|
|
26836
|
+
j((n) => ({
|
|
26831
26837
|
...n,
|
|
26832
26838
|
[e]: t
|
|
26833
26839
|
}));
|
|
26834
|
-
}, []),
|
|
26840
|
+
}, []), F = m((e, t) => {
|
|
26835
26841
|
if (t === "action:create") {
|
|
26836
|
-
|
|
26842
|
+
M.current = e, E({ title: e }), O();
|
|
26837
26843
|
return;
|
|
26838
26844
|
}
|
|
26839
|
-
|
|
26840
|
-
}, [
|
|
26841
|
-
if (
|
|
26845
|
+
g(e, t);
|
|
26846
|
+
}, [g, O]), I = m((e) => {
|
|
26847
|
+
if (M.current === null) return;
|
|
26842
26848
|
let t = crypto.randomUUID(), n = `${oc}${e.title}-${t}`;
|
|
26843
|
-
|
|
26849
|
+
_((t) => [...t, {
|
|
26844
26850
|
...e,
|
|
26845
26851
|
id: n,
|
|
26846
26852
|
size: 150
|
|
26847
|
-
}]),
|
|
26853
|
+
}]), g(M.current, n), M.current = null, k();
|
|
26848
26854
|
}, [
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
]),
|
|
26853
|
-
|
|
26854
|
-
}, [
|
|
26855
|
-
let
|
|
26856
|
-
text:
|
|
26855
|
+
g,
|
|
26856
|
+
_,
|
|
26857
|
+
k
|
|
26858
|
+
]), L = m(() => {
|
|
26859
|
+
M.current = null, k();
|
|
26860
|
+
}, [k]), R = b(() => [...e.map((e) => e.title), ...u.map((e) => e.title)], [e, u]), z = h ? d[h] ?? fA : fA, B = b(() => {
|
|
26861
|
+
let e = {
|
|
26862
|
+
text: i("dataEditor.uploader.matchColumns.bestMatch"),
|
|
26857
26863
|
color: "green"
|
|
26858
|
-
},
|
|
26859
|
-
text:
|
|
26864
|
+
}, n = {
|
|
26865
|
+
text: i("dataEditor.uploader.matchColumns.newColumnTag"),
|
|
26860
26866
|
color: "blue"
|
|
26861
|
-
}, a =
|
|
26862
|
-
return Object.fromEntries(
|
|
26863
|
-
let o =
|
|
26864
|
-
id:
|
|
26865
|
-
text:
|
|
26866
|
-
...
|
|
26867
|
+
}, a = i("dataEditor.uploader.matchColumns.createColumn");
|
|
26868
|
+
return Object.fromEntries(C.map((i) => {
|
|
26869
|
+
let o = z[i], s = r.map((t) => ({
|
|
26870
|
+
id: t.id,
|
|
26871
|
+
text: t.title,
|
|
26872
|
+
...t.id === o && { tag: e }
|
|
26867
26873
|
}));
|
|
26868
|
-
for (let e of
|
|
26874
|
+
for (let e of u) s.push({
|
|
26869
26875
|
id: e.id,
|
|
26870
26876
|
text: e.title,
|
|
26871
|
-
tag:
|
|
26877
|
+
tag: n
|
|
26872
26878
|
});
|
|
26873
26879
|
return t && s.push({
|
|
26874
|
-
id: `${
|
|
26880
|
+
id: `${i}_d`,
|
|
26875
26881
|
type: "divider"
|
|
26876
26882
|
}, {
|
|
26877
26883
|
id: YE,
|
|
26878
26884
|
text: a,
|
|
26879
26885
|
icon: /* @__PURE__ */ T(Te, { size: "1rem" })
|
|
26880
|
-
}), [
|
|
26886
|
+
}), [i, s];
|
|
26881
26887
|
}));
|
|
26882
26888
|
}, [
|
|
26883
|
-
|
|
26884
|
-
|
|
26885
|
-
|
|
26886
|
-
|
|
26889
|
+
C,
|
|
26890
|
+
r,
|
|
26891
|
+
u,
|
|
26892
|
+
i,
|
|
26887
26893
|
t,
|
|
26888
|
-
|
|
26889
|
-
]),
|
|
26890
|
-
mappedValue:
|
|
26891
|
-
options:
|
|
26892
|
-
autoMatchId:
|
|
26894
|
+
z
|
|
26895
|
+
]), V = i("dataEditor.uploader.matchColumns.selectColumnPlaceholder"), ee = m((e, t) => c ? RD(c, e, t) : [], [c]), te = m((e) => ({
|
|
26896
|
+
mappedValue: p[e],
|
|
26897
|
+
options: B[e],
|
|
26898
|
+
autoMatchId: z[e]
|
|
26893
26899
|
}), [
|
|
26894
|
-
|
|
26895
|
-
|
|
26896
|
-
|
|
26900
|
+
p,
|
|
26901
|
+
B,
|
|
26902
|
+
z
|
|
26897
26903
|
]);
|
|
26898
26904
|
return {
|
|
26899
|
-
view:
|
|
26900
|
-
isMultiWorkbook:
|
|
26901
|
-
|
|
26902
|
-
|
|
26903
|
-
|
|
26904
|
-
|
|
26905
|
-
|
|
26906
|
-
|
|
26907
|
-
|
|
26908
|
-
|
|
26909
|
-
|
|
26910
|
-
|
|
26911
|
-
|
|
26912
|
-
|
|
26913
|
-
|
|
26905
|
+
view: v,
|
|
26906
|
+
isMultiWorkbook: y,
|
|
26907
|
+
hasRowHook: !!n,
|
|
26908
|
+
isMatching: h ? f[h] ?? !1 : !1,
|
|
26909
|
+
isShowMatched: N,
|
|
26910
|
+
setShowMatched: P,
|
|
26911
|
+
placeholder: V,
|
|
26912
|
+
existingNames: R,
|
|
26913
|
+
createModalValues: w,
|
|
26914
|
+
createModalOpen: D,
|
|
26915
|
+
getRowData: te,
|
|
26916
|
+
getSampleValues: ee,
|
|
26917
|
+
onSelectChange: F,
|
|
26918
|
+
onClear: g,
|
|
26919
|
+
submitCreate: I,
|
|
26920
|
+
closeCreate: L
|
|
26914
26921
|
};
|
|
26915
26922
|
}, hA = l(null);
|
|
26916
26923
|
function gA({ children: e }) {
|
|
@@ -27065,28 +27072,28 @@ var _A = () => {
|
|
|
27065
27072
|
})]
|
|
27066
27073
|
})
|
|
27067
27074
|
});
|
|
27068
|
-
}, CA = f(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a,
|
|
27069
|
-
let { t:
|
|
27070
|
-
|
|
27071
|
-
}, [e,
|
|
27072
|
-
|
|
27073
|
-
}, [e,
|
|
27075
|
+
}, CA = f(({ csvHeader: e, mappedValue: t, options: n, autoMatchId: r, placeholder: i, isMatching: a, hasRowHook: o, getSampleValues: s, onSelectChange: c, onClear: l }) => {
|
|
27076
|
+
let { t: u } = q(), d = _(), f = !t, p = t?.startsWith("__dynamic__:") && !!r && !a, h = f && !a, g = m((t) => {
|
|
27077
|
+
c(e, t);
|
|
27078
|
+
}, [e, c]), v = m(() => {
|
|
27079
|
+
l(e, void 0);
|
|
27080
|
+
}, [e, l]);
|
|
27074
27081
|
return /* @__PURE__ */ E("div", {
|
|
27075
27082
|
className: "updog__column-matching__row",
|
|
27076
27083
|
children: [
|
|
27077
27084
|
/* @__PURE__ */ T("div", {
|
|
27078
27085
|
className: "updog__column-matching__column",
|
|
27079
27086
|
children: /* @__PURE__ */ T(SA, {
|
|
27080
|
-
labelId:
|
|
27087
|
+
labelId: d,
|
|
27081
27088
|
csvHeader: e,
|
|
27082
|
-
getSampleValues:
|
|
27089
|
+
getSampleValues: s
|
|
27083
27090
|
})
|
|
27084
27091
|
}),
|
|
27085
27092
|
/* @__PURE__ */ T("div", {
|
|
27086
27093
|
className: "updog__column-matching__arrow-container",
|
|
27087
27094
|
children: /* @__PURE__ */ T(M, {
|
|
27088
27095
|
size: "1.25rem",
|
|
27089
|
-
className: O("updog__column-matching__arrow", "rtl-mirror",
|
|
27096
|
+
className: O("updog__column-matching__arrow", "rtl-mirror", f || a ? "updog__column-matching__arrow--unmatched" : "updog__column-matching__arrow--matched")
|
|
27090
27097
|
})
|
|
27091
27098
|
}),
|
|
27092
27099
|
/* @__PURE__ */ T("div", {
|
|
@@ -27095,30 +27102,30 @@ var _A = () => {
|
|
|
27095
27102
|
width: "100%",
|
|
27096
27103
|
height: "2.5rem"
|
|
27097
27104
|
}) : /* @__PURE__ */ T(Ts, {
|
|
27098
|
-
ariaLabelledby:
|
|
27105
|
+
ariaLabelledby: d,
|
|
27099
27106
|
options: n,
|
|
27100
27107
|
value: t,
|
|
27101
|
-
onChange:
|
|
27102
|
-
onClear:
|
|
27108
|
+
onChange: g,
|
|
27109
|
+
onClear: v,
|
|
27103
27110
|
placeholder: i
|
|
27104
27111
|
})
|
|
27105
27112
|
}),
|
|
27106
27113
|
/* @__PURE__ */ E("div", {
|
|
27107
27114
|
className: "updog__column-matching__action",
|
|
27108
|
-
children: [
|
|
27115
|
+
children: [p && /* @__PURE__ */ T(Za, {
|
|
27109
27116
|
content: /* @__PURE__ */ T(J, {
|
|
27110
27117
|
size: "sm",
|
|
27111
|
-
children:
|
|
27118
|
+
children: u("dataEditor.uploader.matchColumns.createColumnWarning")
|
|
27112
27119
|
}),
|
|
27113
27120
|
placement: "bottom-end",
|
|
27114
27121
|
children: /* @__PURE__ */ T(k, {
|
|
27115
27122
|
size: "1.25rem",
|
|
27116
27123
|
className: "updog__column-matching__action-icon"
|
|
27117
27124
|
})
|
|
27118
|
-
}),
|
|
27125
|
+
}), h && /* @__PURE__ */ T(Za, {
|
|
27119
27126
|
content: /* @__PURE__ */ T(J, {
|
|
27120
27127
|
size: "sm",
|
|
27121
|
-
children:
|
|
27128
|
+
children: u(o ? "dataEditor.uploader.matchColumns.unmatchedWarningWithRowHook" : "dataEditor.uploader.matchColumns.unmatchedWarning")
|
|
27122
27129
|
}),
|
|
27123
27130
|
placement: "bottom-end",
|
|
27124
27131
|
children: /* @__PURE__ */ T(he, {
|
|
@@ -27130,34 +27137,35 @@ var _A = () => {
|
|
|
27130
27137
|
]
|
|
27131
27138
|
});
|
|
27132
27139
|
}), wA = ({ view: e }) => {
|
|
27133
|
-
let { isMatching: t, isShowMatched: n,
|
|
27140
|
+
let { isMatching: t, isShowMatched: n, hasRowHook: r, placeholder: i, getRowData: a, getSampleValues: o, onSelectChange: s, onClear: c } = _A(), { t: l } = q(), u = n(e.workbookId), d = e.headers.map((e) => ({
|
|
27134
27141
|
csvHeader: e,
|
|
27135
|
-
...
|
|
27136
|
-
})).filter((e) =>
|
|
27137
|
-
return
|
|
27142
|
+
...a(e)
|
|
27143
|
+
})).filter((e) => u || !e.mappedValue);
|
|
27144
|
+
return d.length === 0 ? /* @__PURE__ */ T("div", {
|
|
27138
27145
|
className: "updog__column-matching__content",
|
|
27139
27146
|
children: /* @__PURE__ */ T("div", {
|
|
27140
27147
|
className: "updog__column-matching__empty",
|
|
27141
27148
|
children: /* @__PURE__ */ T(J, {
|
|
27142
27149
|
size: "sm",
|
|
27143
27150
|
color: "secondary",
|
|
27144
|
-
children:
|
|
27151
|
+
children: l("dataEditor.uploader.matchColumns.allMatched")
|
|
27145
27152
|
})
|
|
27146
27153
|
})
|
|
27147
27154
|
}) : /* @__PURE__ */ T("div", {
|
|
27148
27155
|
className: "updog__column-matching__content",
|
|
27149
27156
|
children: /* @__PURE__ */ T("div", {
|
|
27150
27157
|
className: "updog__column-matching__content-inner",
|
|
27151
|
-
children:
|
|
27158
|
+
children: d.map(({ csvHeader: e, mappedValue: n, options: a, autoMatchId: l }) => /* @__PURE__ */ T(CA, {
|
|
27152
27159
|
csvHeader: e,
|
|
27153
27160
|
mappedValue: n,
|
|
27154
|
-
options:
|
|
27155
|
-
autoMatchId:
|
|
27156
|
-
placeholder:
|
|
27161
|
+
options: a,
|
|
27162
|
+
autoMatchId: l,
|
|
27163
|
+
placeholder: i,
|
|
27157
27164
|
isMatching: t,
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27165
|
+
hasRowHook: r,
|
|
27166
|
+
getSampleValues: o,
|
|
27167
|
+
onSelectChange: s,
|
|
27168
|
+
onClear: c
|
|
27161
27169
|
}, e))
|
|
27162
27170
|
})
|
|
27163
27171
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.91",
|
|
4
4
|
"description": "Client-side CSV importer and spreadsheet editor for React. Import CSV, Excel, JSON, TSV, and XML, match columns, validate, and edit 1M+ rows entirely in the browser.",
|
|
5
5
|
"author": "Mikhail Kutateladze <admin@updog.tech>",
|
|
6
6
|
"homepage": "https://updog.tech",
|