@updog/data-editor 0.1.72 → 0.1.74
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 +2 -0
- package/index.js +91 -46
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -168,6 +168,8 @@ declare var export_default = {
|
|
|
168
168
|
filteredRows_other: "{{filtered}} of {{total}} rows",
|
|
169
169
|
},
|
|
170
170
|
toast: {
|
|
171
|
+
clipboardWriteFailed:
|
|
172
|
+
"The browser blocked the copy to the clipboard. You can paste inside this table.",
|
|
171
173
|
dismiss: "Dismiss",
|
|
172
174
|
rowMayNotBeVisible:
|
|
173
175
|
"Row has been added but may not be visible due to active filters or sorting",
|
package/index.js
CHANGED
|
@@ -157,6 +157,7 @@ var Hr = {
|
|
|
157
157
|
filteredRows_other: "{{filtered}} of {{total}} rows"
|
|
158
158
|
},
|
|
159
159
|
toast: {
|
|
160
|
+
clipboardWriteFailed: "The browser blocked the copy to the clipboard. You can paste inside this table.",
|
|
160
161
|
dismiss: "Dismiss",
|
|
161
162
|
rowMayNotBeVisible: "Row has been added but may not be visible due to active filters or sorting"
|
|
162
163
|
},
|
|
@@ -1194,34 +1195,38 @@ var Ci = () => {
|
|
|
1194
1195
|
})]
|
|
1195
1196
|
});
|
|
1196
1197
|
}, Mi = (e) => {
|
|
1197
|
-
let { checked: t, onChange: n, label: r, description: i, accessory: a, checkboxPosition: o = "start", disabled: s = !1, className: c, id: l, style: u, isCard: d = !1, indeterminate: f = !1, size: p = "md", onClick:
|
|
1198
|
+
let { checked: t, onChange: n, label: r, description: i, accessory: a, checkboxPosition: o = "start", disabled: s = !1, className: c, id: l, style: u, isCard: d = !1, indeterminate: f = !1, size: p = "md", onClick: g, renderCheckbox: _, children: v, ...b } = e, x = h(), S = l || x, T = y(null);
|
|
1199
|
+
m(() => {
|
|
1200
|
+
T.current && (T.current.indeterminate = f);
|
|
1201
|
+
}, [f]);
|
|
1202
|
+
let E = p === "sm" ? 14 : 16, D = [
|
|
1198
1203
|
"updog-checkbox",
|
|
1199
1204
|
o === "end" && "updog-checkbox--reverse",
|
|
1200
1205
|
i && "updog-checkbox--with-description",
|
|
1201
1206
|
s && "updog-checkbox--disabled",
|
|
1202
1207
|
d && "updog-checkbox--card",
|
|
1203
1208
|
c
|
|
1204
|
-
].filter(Boolean).join(" "),
|
|
1209
|
+
].filter(Boolean).join(" "), O = [
|
|
1205
1210
|
"updog-checkbox__box",
|
|
1206
1211
|
`updog-checkbox__box--${p}`,
|
|
1207
1212
|
t && "updog-checkbox__box--checked",
|
|
1208
1213
|
f && "updog-checkbox__box--indeterminate"
|
|
1209
|
-
].filter(Boolean).join(" "),
|
|
1214
|
+
].filter(Boolean).join(" "), k = (e) => {
|
|
1210
1215
|
n(e.target.checked, e);
|
|
1211
|
-
},
|
|
1212
|
-
|
|
1213
|
-
},
|
|
1214
|
-
if (
|
|
1216
|
+
}, A = (e) => {
|
|
1217
|
+
g && g(e);
|
|
1218
|
+
}, j = i ? `${S}__desc` : void 0, M = a ? `${S}-accessory` : void 0, N;
|
|
1219
|
+
if (v) N = /* @__PURE__ */ C("div", {
|
|
1215
1220
|
className: "updog-checkbox__children",
|
|
1216
|
-
children:
|
|
1221
|
+
children: v
|
|
1217
1222
|
});
|
|
1218
|
-
else if (
|
|
1223
|
+
else if (_) {
|
|
1219
1224
|
let { renderCheckbox: t, ...n } = e;
|
|
1220
|
-
|
|
1225
|
+
N = _({
|
|
1221
1226
|
...n,
|
|
1222
|
-
checkboxId:
|
|
1227
|
+
checkboxId: S
|
|
1223
1228
|
});
|
|
1224
|
-
} else
|
|
1229
|
+
} else N = (r || i) && /* @__PURE__ */ w("div", {
|
|
1225
1230
|
className: "updog-checkbox__content",
|
|
1226
1231
|
children: [r && /* @__PURE__ */ w("div", {
|
|
1227
1232
|
className: "updog-checkbox__label-wrapper",
|
|
@@ -1229,44 +1234,45 @@ var Ci = () => {
|
|
|
1229
1234
|
className: "updog-checkbox__label updog-text--sm",
|
|
1230
1235
|
children: r
|
|
1231
1236
|
}), a && /* @__PURE__ */ C("div", {
|
|
1232
|
-
id:
|
|
1237
|
+
id: M,
|
|
1233
1238
|
className: "updog-checkbox__accessory",
|
|
1234
1239
|
children: a
|
|
1235
1240
|
})]
|
|
1236
1241
|
}), i && /* @__PURE__ */ C("div", {
|
|
1237
1242
|
className: "updog-checkbox__description updog-text--sm",
|
|
1238
|
-
id:
|
|
1243
|
+
id: j,
|
|
1239
1244
|
children: i
|
|
1240
1245
|
})]
|
|
1241
1246
|
});
|
|
1242
1247
|
return /* @__PURE__ */ w("label", {
|
|
1243
|
-
className:
|
|
1244
|
-
htmlFor:
|
|
1248
|
+
className: D,
|
|
1249
|
+
htmlFor: S,
|
|
1245
1250
|
"data-iscard": d,
|
|
1246
1251
|
style: u,
|
|
1247
|
-
onClick:
|
|
1252
|
+
onClick: A,
|
|
1248
1253
|
children: [
|
|
1249
1254
|
/* @__PURE__ */ C("input", {
|
|
1250
|
-
...
|
|
1251
|
-
|
|
1255
|
+
...b,
|
|
1256
|
+
ref: T,
|
|
1257
|
+
id: S,
|
|
1252
1258
|
type: "checkbox",
|
|
1253
1259
|
className: "updog-checkbox__input",
|
|
1254
1260
|
tabIndex: s ? -1 : 0,
|
|
1255
1261
|
checked: t,
|
|
1256
|
-
onChange:
|
|
1262
|
+
onChange: k,
|
|
1257
1263
|
disabled: s,
|
|
1258
|
-
"aria-label": !r && typeof
|
|
1259
|
-
"aria-describedby":
|
|
1264
|
+
"aria-label": !r && typeof b["aria-label"] == "string" ? b["aria-label"] : void 0,
|
|
1265
|
+
"aria-describedby": v ? void 0 : [j, M].filter(Boolean).join(" ") || void 0
|
|
1260
1266
|
}),
|
|
1261
|
-
!
|
|
1262
|
-
className:
|
|
1267
|
+
!_ && /* @__PURE__ */ C("div", {
|
|
1268
|
+
className: O,
|
|
1263
1269
|
style: { outlineOffset: 1 },
|
|
1264
1270
|
children: /* @__PURE__ */ C("div", {
|
|
1265
1271
|
className: "updog-checkbox__icon",
|
|
1266
|
-
children: C(f ? ve : F, { size:
|
|
1272
|
+
children: C(f ? ve : F, { size: E })
|
|
1267
1273
|
})
|
|
1268
1274
|
}),
|
|
1269
|
-
|
|
1275
|
+
N
|
|
1270
1276
|
]
|
|
1271
1277
|
});
|
|
1272
1278
|
}, Ni = ({ disabled: e, checkboxPosition: t = "start", color: n = "layer2", className: r, ...i }) => {
|
|
@@ -12816,14 +12822,14 @@ var xf = class {
|
|
|
12816
12822
|
return;
|
|
12817
12823
|
}
|
|
12818
12824
|
let s = uf(e);
|
|
12819
|
-
t.fillStyle = n.cellBgIdle, Pd(t, 0, 0, a, o), this.paintBodyPane(s, s.panes.scrollable), this.selectionPainter.paintSelectionOutlines(s, null), this.selectionPainter.paintFocusBorder(s, null), this.
|
|
12825
|
+
t.fillStyle = n.cellBgIdle, Pd(t, 0, 0, a, o), this.paintBodyPane(s, s.panes.scrollable), this.selectionPainter.paintSelectionOutlines(s, null), this.selectionPainter.paintFocusBorder(s, null), this.overlayPainter.paintClipboardOverlay(s), this.overlayPainter.paintFillOverlay(s), this.lastFillHandleRect = this.selectionPainter.paintFillHandle(s, null);
|
|
12820
12826
|
let c = s.panes.pinned;
|
|
12821
12827
|
if (c?.clip) {
|
|
12822
12828
|
t.fillStyle = n.cellBgIdle, Pd(t, c.clip.x, c.clip.y, c.clip.w, c.clip.h), t.save(), t.beginPath(), t.rect(c.clip.x, c.clip.y, c.clip.w, c.clip.h), t.clip(), this.paintBodyPane(s, c), t.restore(), t.save(), t.beginPath();
|
|
12823
12829
|
let e = Math.min(s.totalRows * 34, o - 36);
|
|
12824
|
-
t.rect(c.clip.x, 36, c.clip.w, e), t.clip(), this.selectionPainter.paintSelectionOutlines(s, c), this.selectionPainter.paintFocusBorder(s, c);
|
|
12830
|
+
t.rect(c.clip.x, 36, c.clip.w, e), t.clip(), this.selectionPainter.paintSelectionOutlines(s, c), this.selectionPainter.paintFocusBorder(s, c), this.overlayPainter.paintClipboardOverlay(s);
|
|
12825
12831
|
let r = this.selectionPainter.paintFillHandle(s, c);
|
|
12826
|
-
r && (this.lastFillHandleRect = r),
|
|
12832
|
+
r && (this.lastFillHandleRect = r), t.restore();
|
|
12827
12833
|
}
|
|
12828
12834
|
this.markerPainter.paint(s), this.headerPainter.paintHeaderRow(s), this.headerPainter.paintCornerCell(s), s.resizeGuideX >= 0 && this.overlayPainter.paintResizeGuide(s), this.hasSkeletons = s.hasSkeletons, this.hasPendingCells = s.hasPendingCells;
|
|
12829
12835
|
}
|
|
@@ -18990,12 +18996,17 @@ function uv(e, t, n) {
|
|
|
18990
18996
|
}
|
|
18991
18997
|
o.push(r.map((e) => String(t[e.id] ?? "")).join(" "));
|
|
18992
18998
|
}
|
|
18993
|
-
|
|
18999
|
+
let s = o.join("\n");
|
|
19000
|
+
return {
|
|
19001
|
+
text: s,
|
|
19002
|
+
written: navigator.clipboard.writeText(s).then(() => !0).catch(() => !1)
|
|
19003
|
+
};
|
|
18994
19004
|
}
|
|
18995
19005
|
//#endregion
|
|
18996
19006
|
//#region src/components/DataEditor/DataEditorGrid/controller/ClipboardManager.ts
|
|
18997
19007
|
var dv = {
|
|
18998
19008
|
clipboard: null,
|
|
19009
|
+
marqueeVisible: !1,
|
|
18999
19010
|
version: 0
|
|
19000
19011
|
}, fv = class {
|
|
19001
19012
|
_store;
|
|
@@ -19012,6 +19023,9 @@ var dv = {
|
|
|
19012
19023
|
_clipboardMaxRow = -1;
|
|
19013
19024
|
_sourceMinRowIndex = -1;
|
|
19014
19025
|
_sourceMaxRowIndex = -1;
|
|
19026
|
+
_marqueeVisible = !1;
|
|
19027
|
+
_osText = null;
|
|
19028
|
+
_osWrite = null;
|
|
19015
19029
|
_sortState = null;
|
|
19016
19030
|
_t = (e) => e;
|
|
19017
19031
|
_version = 0;
|
|
@@ -19039,7 +19053,7 @@ var dv = {
|
|
|
19039
19053
|
operation: "copy",
|
|
19040
19054
|
columnIds: e.columnIds,
|
|
19041
19055
|
rowIds: e.rowIds
|
|
19042
|
-
}, this.precomputeLookup(), this.notify(),
|
|
19056
|
+
}, this._marqueeVisible = !0, this.precomputeLookup(), this.notify(), this.writeToOs(this._clipboard));
|
|
19043
19057
|
}
|
|
19044
19058
|
cut() {
|
|
19045
19059
|
let e = this.buildClipboardFromSnapshot();
|
|
@@ -19047,10 +19061,11 @@ var dv = {
|
|
|
19047
19061
|
operation: "cut",
|
|
19048
19062
|
columnIds: e.columnIds,
|
|
19049
19063
|
rowIds: e.rowIds
|
|
19050
|
-
}, this.precomputeLookup(), this.notify(),
|
|
19064
|
+
}, this._marqueeVisible = !0, this.precomputeLookup(), this.notify(), this.writeToOs(this._clipboard));
|
|
19051
19065
|
}
|
|
19052
19066
|
async paste() {
|
|
19053
|
-
|
|
19067
|
+
let e = await this.readOsClipboard();
|
|
19068
|
+
if (this._clipboard && (!e.ok || e.ours)) {
|
|
19054
19069
|
let e = this.resolveTargetFromSnapshot();
|
|
19055
19070
|
if (!e) return;
|
|
19056
19071
|
let t = this._clipboard, n = this._store, r = dl(t.columnIds, e.columnIds, t.rowIds ?? null, e.rowIds, this._columns, (e) => n.getRowId(e), n.getSnapshot().filteredCount, t.operation === "cut"), i = await n.pasteInternal(r, e.rowIds, {
|
|
@@ -19060,27 +19075,28 @@ var dv = {
|
|
|
19060
19075
|
i && (this.syncInternalPasteToServer(i, t, e), this._sortState && Fs.info(this._t("dataEditor.toast.rowMayNotBeVisible")), this.clear());
|
|
19061
19076
|
return;
|
|
19062
19077
|
}
|
|
19063
|
-
|
|
19064
|
-
try {
|
|
19065
|
-
e = await navigator.clipboard.readText();
|
|
19066
|
-
} catch (e) {
|
|
19078
|
+
if (!e.ok) {
|
|
19067
19079
|
this._store.errorHandler.handleError({
|
|
19068
19080
|
code: "OPERATION_ERROR",
|
|
19069
19081
|
message: "Failed to read clipboard",
|
|
19070
19082
|
source: "clipboard-manager",
|
|
19071
|
-
originalError: e
|
|
19083
|
+
originalError: e.error
|
|
19072
19084
|
});
|
|
19073
19085
|
return;
|
|
19074
19086
|
}
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
r
|
|
19087
|
+
let t = e.text;
|
|
19088
|
+
if (!t) return;
|
|
19089
|
+
let { row: n, col: r } = this.resolveAnchor(), i = await this._store.pasteFromText(t, n, r, this._validator);
|
|
19090
|
+
i && this.syncExternalPasteToServer(i, n, r, t);
|
|
19078
19091
|
}
|
|
19079
19092
|
clear() {
|
|
19080
|
-
this._clipboard && (this._clipboard = null, this._clipboardColIndices = null, this._clipboardRowSet = null, this._clipboardIsWholeColumn = !1, this._clipboardMinCol = -1, this._clipboardMaxCol = -1, this._clipboardMinRow = -1, this._clipboardMaxRow = -1, this._sourceMinRowIndex = -1, this._sourceMaxRowIndex = -1, this.notify());
|
|
19093
|
+
this._clipboard && (this._clipboard = null, this._clipboardColIndices = null, this._clipboardRowSet = null, this._clipboardIsWholeColumn = !1, this._clipboardMinCol = -1, this._clipboardMaxCol = -1, this._clipboardMinRow = -1, this._clipboardMaxRow = -1, this._sourceMinRowIndex = -1, this._sourceMaxRowIndex = -1, this._marqueeVisible = !1, this._osText = null, this._osWrite = null, this.notify());
|
|
19094
|
+
}
|
|
19095
|
+
hideMarquee() {
|
|
19096
|
+
this._marqueeVisible && (this._marqueeVisible = !1, this.notify());
|
|
19081
19097
|
}
|
|
19082
19098
|
isCellInClipboard(e, t) {
|
|
19083
|
-
if (!this._clipboard || !this._clipboardColIndices || !this._clipboardColIndices.has(e)) return !1;
|
|
19099
|
+
if (!this._marqueeVisible || !this._clipboard || !this._clipboardColIndices || !this._clipboardColIndices.has(e)) return !1;
|
|
19084
19100
|
if (this._clipboardIsWholeColumn) return !0;
|
|
19085
19101
|
if (!this._clipboardRowSet) return !1;
|
|
19086
19102
|
let n = this._store.getRowId(t);
|
|
@@ -19090,7 +19106,7 @@ var dv = {
|
|
|
19090
19106
|
return this._clipboard?.operation ?? null;
|
|
19091
19107
|
}
|
|
19092
19108
|
getClipboardBounds() {
|
|
19093
|
-
if (!this._clipboard) return null;
|
|
19109
|
+
if (!this._clipboard || !this._marqueeVisible) return null;
|
|
19094
19110
|
let e = this._clipboardIsWholeColumn ? this._store.getSnapshot().filteredCount - 1 : this._clipboardMaxRow;
|
|
19095
19111
|
return {
|
|
19096
19112
|
minCol: this._clipboardMinCol,
|
|
@@ -19099,6 +19115,32 @@ var dv = {
|
|
|
19099
19115
|
maxRow: e
|
|
19100
19116
|
};
|
|
19101
19117
|
}
|
|
19118
|
+
writeToOs(e) {
|
|
19119
|
+
let t = uv(e, this._columns, this._store);
|
|
19120
|
+
this._osText = t.text, this._osWrite = t.written, t.written.then((e) => {
|
|
19121
|
+
e || (this._store.errorHandler.handleError({
|
|
19122
|
+
code: "OPERATION_ERROR",
|
|
19123
|
+
message: "Failed to write clipboard",
|
|
19124
|
+
source: "clipboard-manager"
|
|
19125
|
+
}), Fs.error(this._t("dataEditor.toast.clipboardWriteFailed")));
|
|
19126
|
+
});
|
|
19127
|
+
}
|
|
19128
|
+
async readOsClipboard() {
|
|
19129
|
+
let e = this._osWrite ? await this._osWrite : !0;
|
|
19130
|
+
try {
|
|
19131
|
+
let t = await navigator.clipboard.readText();
|
|
19132
|
+
return {
|
|
19133
|
+
ok: !0,
|
|
19134
|
+
text: t,
|
|
19135
|
+
ours: !e || t === this._osText
|
|
19136
|
+
};
|
|
19137
|
+
} catch (e) {
|
|
19138
|
+
return {
|
|
19139
|
+
ok: !1,
|
|
19140
|
+
error: e
|
|
19141
|
+
};
|
|
19142
|
+
}
|
|
19143
|
+
}
|
|
19102
19144
|
buildClipboardFromSnapshot() {
|
|
19103
19145
|
let e = yd(this._selection.getSelection(), this.resolveContext());
|
|
19104
19146
|
return e === null ? null : {
|
|
@@ -19201,6 +19243,7 @@ var dv = {
|
|
|
19201
19243
|
notify() {
|
|
19202
19244
|
this._version++, this._snapshot = {
|
|
19203
19245
|
clipboard: this._clipboard,
|
|
19246
|
+
marqueeVisible: this._marqueeVisible,
|
|
19204
19247
|
version: this._version
|
|
19205
19248
|
};
|
|
19206
19249
|
for (let e of this._listeners) e();
|
|
@@ -19588,8 +19631,8 @@ var Tv = class {
|
|
|
19588
19631
|
return;
|
|
19589
19632
|
}
|
|
19590
19633
|
if (e.key === "Escape") {
|
|
19591
|
-
if (this._clipboard.getSnapshot().
|
|
19592
|
-
this._clipboard.
|
|
19634
|
+
if (this._clipboard.getSnapshot().marqueeVisible) {
|
|
19635
|
+
this._clipboard.hideMarquee();
|
|
19593
19636
|
return;
|
|
19594
19637
|
}
|
|
19595
19638
|
this._selection.clear();
|
|
@@ -20402,6 +20445,8 @@ var Lv = {
|
|
|
20402
20445
|
}, [j]), m(() => {
|
|
20403
20446
|
H.clipboard.setSortState(E);
|
|
20404
20447
|
}, [H, E]), m(() => {
|
|
20448
|
+
H.clipboard.hideMarquee();
|
|
20449
|
+
}, [H, j]), m(() => {
|
|
20405
20450
|
H.clipboard.setTranslate(N);
|
|
20406
20451
|
}, [H, N]), m(() => {
|
|
20407
20452
|
H.setBounds(g, ae.columns.length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
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",
|