@updog/data-editor-wc 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 +82 -37
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -166,6 +166,8 @@ declare var export_default = {
|
|
|
166
166
|
filteredRows_other: "{{filtered}} of {{total}} rows",
|
|
167
167
|
},
|
|
168
168
|
toast: {
|
|
169
|
+
clipboardWriteFailed:
|
|
170
|
+
"The browser blocked the copy to the clipboard. You can paste inside this table.",
|
|
169
171
|
dismiss: "Dismiss",
|
|
170
172
|
rowMayNotBeVisible:
|
|
171
173
|
"Row has been added but may not be visible due to active filters or sorting",
|
package/index.js
CHANGED
|
@@ -8157,6 +8157,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
8157
8157
|
filteredRows_other: "{{filtered}} of {{total}} rows"
|
|
8158
8158
|
},
|
|
8159
8159
|
toast: {
|
|
8160
|
+
clipboardWriteFailed: "The browser blocked the copy to the clipboard. You can paste inside this table.",
|
|
8160
8161
|
dismiss: "Dismiss",
|
|
8161
8162
|
rowMayNotBeVisible: "Row has been added but may not be visible due to active filters or sorting"
|
|
8162
8163
|
},
|
|
@@ -9945,34 +9946,38 @@ var Ct = () => {
|
|
|
9945
9946
|
})]
|
|
9946
9947
|
});
|
|
9947
9948
|
}, Mt = (e) => {
|
|
9948
|
-
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: m, renderCheckbox: h, children: g, ..._ } = e, v = (0, y.useId)(), b = l || v, x =
|
|
9949
|
+
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: m, renderCheckbox: h, children: g, ..._ } = e, v = (0, y.useId)(), b = l || v, x = (0, y.useRef)(null);
|
|
9950
|
+
(0, y.useEffect)(() => {
|
|
9951
|
+
x.current && (x.current.indeterminate = f);
|
|
9952
|
+
}, [f]);
|
|
9953
|
+
let S = p === "sm" ? 14 : 16, C = [
|
|
9949
9954
|
"updog-checkbox",
|
|
9950
9955
|
o === "end" && "updog-checkbox--reverse",
|
|
9951
9956
|
i && "updog-checkbox--with-description",
|
|
9952
9957
|
s && "updog-checkbox--disabled",
|
|
9953
9958
|
d && "updog-checkbox--card",
|
|
9954
9959
|
c
|
|
9955
|
-
].filter(Boolean).join(" "),
|
|
9960
|
+
].filter(Boolean).join(" "), w = [
|
|
9956
9961
|
"updog-checkbox__box",
|
|
9957
9962
|
`updog-checkbox__box--${p}`,
|
|
9958
9963
|
t && "updog-checkbox__box--checked",
|
|
9959
9964
|
f && "updog-checkbox__box--indeterminate"
|
|
9960
|
-
].filter(Boolean).join(" "),
|
|
9965
|
+
].filter(Boolean).join(" "), T = (e) => {
|
|
9961
9966
|
n(e.target.checked, e);
|
|
9962
|
-
},
|
|
9967
|
+
}, E = (e) => {
|
|
9963
9968
|
m && m(e);
|
|
9964
|
-
},
|
|
9965
|
-
if (g)
|
|
9969
|
+
}, D = i ? `${b}__desc` : void 0, k = a ? `${b}-accessory` : void 0, A;
|
|
9970
|
+
if (g) A = /* @__PURE__ */ (0, O.jsx)("div", {
|
|
9966
9971
|
className: "updog-checkbox__children",
|
|
9967
9972
|
children: g
|
|
9968
9973
|
});
|
|
9969
9974
|
else if (h) {
|
|
9970
9975
|
let { renderCheckbox: t, ...n } = e;
|
|
9971
|
-
|
|
9976
|
+
A = h({
|
|
9972
9977
|
...n,
|
|
9973
9978
|
checkboxId: b
|
|
9974
9979
|
});
|
|
9975
|
-
} else
|
|
9980
|
+
} else A = (r || i) && /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
9976
9981
|
className: "updog-checkbox__content",
|
|
9977
9982
|
children: [r && /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
9978
9983
|
className: "updog-checkbox__label-wrapper",
|
|
@@ -9980,44 +9985,45 @@ var Ct = () => {
|
|
|
9980
9985
|
className: "updog-checkbox__label updog-text--sm",
|
|
9981
9986
|
children: r
|
|
9982
9987
|
}), a && /* @__PURE__ */ (0, O.jsx)("div", {
|
|
9983
|
-
id:
|
|
9988
|
+
id: k,
|
|
9984
9989
|
className: "updog-checkbox__accessory",
|
|
9985
9990
|
children: a
|
|
9986
9991
|
})]
|
|
9987
9992
|
}), i && /* @__PURE__ */ (0, O.jsx)("div", {
|
|
9988
9993
|
className: "updog-checkbox__description updog-text--sm",
|
|
9989
|
-
id:
|
|
9994
|
+
id: D,
|
|
9990
9995
|
children: i
|
|
9991
9996
|
})]
|
|
9992
9997
|
});
|
|
9993
9998
|
return /* @__PURE__ */ (0, O.jsxs)("label", {
|
|
9994
|
-
className:
|
|
9999
|
+
className: C,
|
|
9995
10000
|
htmlFor: b,
|
|
9996
10001
|
"data-iscard": d,
|
|
9997
10002
|
style: u,
|
|
9998
|
-
onClick:
|
|
10003
|
+
onClick: E,
|
|
9999
10004
|
children: [
|
|
10000
10005
|
/* @__PURE__ */ (0, O.jsx)("input", {
|
|
10001
10006
|
..._,
|
|
10007
|
+
ref: x,
|
|
10002
10008
|
id: b,
|
|
10003
10009
|
type: "checkbox",
|
|
10004
10010
|
className: "updog-checkbox__input",
|
|
10005
10011
|
tabIndex: s ? -1 : 0,
|
|
10006
10012
|
checked: t,
|
|
10007
|
-
onChange:
|
|
10013
|
+
onChange: T,
|
|
10008
10014
|
disabled: s,
|
|
10009
10015
|
"aria-label": !r && typeof _["aria-label"] == "string" ? _["aria-label"] : void 0,
|
|
10010
|
-
"aria-describedby": g ? void 0 : [
|
|
10016
|
+
"aria-describedby": g ? void 0 : [D, k].filter(Boolean).join(" ") || void 0
|
|
10011
10017
|
}),
|
|
10012
10018
|
!h && /* @__PURE__ */ (0, O.jsx)("div", {
|
|
10013
|
-
className:
|
|
10019
|
+
className: w,
|
|
10014
10020
|
style: { outlineOffset: 1 },
|
|
10015
10021
|
children: /* @__PURE__ */ (0, O.jsx)("div", {
|
|
10016
10022
|
className: "updog-checkbox__icon",
|
|
10017
|
-
children: f ? /* @__PURE__ */ (0, O.jsx)(De, { size:
|
|
10023
|
+
children: f ? /* @__PURE__ */ (0, O.jsx)(De, { size: S }) : /* @__PURE__ */ (0, O.jsx)(oe, { size: S })
|
|
10018
10024
|
})
|
|
10019
10025
|
}),
|
|
10020
|
-
|
|
10026
|
+
A
|
|
10021
10027
|
]
|
|
10022
10028
|
});
|
|
10023
10029
|
}, Nt = ({ disabled: e, checkboxPosition: t = "start", color: n = "layer2", className: r, ...i }) => {
|
|
@@ -33036,14 +33042,14 @@ var pv = class {
|
|
|
33036
33042
|
return;
|
|
33037
33043
|
}
|
|
33038
33044
|
let s = nv(e);
|
|
33039
|
-
t.fillStyle = n.cellBgIdle, D_(t, 0, 0, a, o), this.paintBodyPane(s, s.panes.scrollable), this.selectionPainter.paintSelectionOutlines(s, null), this.selectionPainter.paintFocusBorder(s, null), this.
|
|
33045
|
+
t.fillStyle = n.cellBgIdle, D_(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);
|
|
33040
33046
|
let c = s.panes.pinned;
|
|
33041
33047
|
if (c?.clip) {
|
|
33042
33048
|
t.fillStyle = n.cellBgIdle, D_(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();
|
|
33043
33049
|
let e = Math.min(s.totalRows * 34, o - 36);
|
|
33044
|
-
t.rect(c.clip.x, 36, c.clip.w, e), t.clip(), this.selectionPainter.paintSelectionOutlines(s, c), this.selectionPainter.paintFocusBorder(s, c);
|
|
33050
|
+
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);
|
|
33045
33051
|
let r = this.selectionPainter.paintFillHandle(s, c);
|
|
33046
|
-
r && (this.lastFillHandleRect = r),
|
|
33052
|
+
r && (this.lastFillHandleRect = r), t.restore();
|
|
33047
33053
|
}
|
|
33048
33054
|
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;
|
|
33049
33055
|
}
|
|
@@ -43918,12 +43924,17 @@ function Tj(e, t, n) {
|
|
|
43918
43924
|
}
|
|
43919
43925
|
o.push(r.map((e) => String(t[e.id] ?? "")).join(" "));
|
|
43920
43926
|
}
|
|
43921
|
-
|
|
43927
|
+
let s = o.join("\n");
|
|
43928
|
+
return {
|
|
43929
|
+
text: s,
|
|
43930
|
+
written: navigator.clipboard.writeText(s).then(() => !0).catch(() => !1)
|
|
43931
|
+
};
|
|
43922
43932
|
}
|
|
43923
43933
|
//#endregion
|
|
43924
43934
|
//#region src/components/DataEditor/DataEditorGrid/controller/ClipboardManager.ts
|
|
43925
43935
|
var Ej = {
|
|
43926
43936
|
clipboard: null,
|
|
43937
|
+
marqueeVisible: !1,
|
|
43927
43938
|
version: 0
|
|
43928
43939
|
}, Dj = class {
|
|
43929
43940
|
_store;
|
|
@@ -43940,6 +43951,9 @@ var Ej = {
|
|
|
43940
43951
|
_clipboardMaxRow = -1;
|
|
43941
43952
|
_sourceMinRowIndex = -1;
|
|
43942
43953
|
_sourceMaxRowIndex = -1;
|
|
43954
|
+
_marqueeVisible = !1;
|
|
43955
|
+
_osText = null;
|
|
43956
|
+
_osWrite = null;
|
|
43943
43957
|
_sortState = null;
|
|
43944
43958
|
_t = (e) => e;
|
|
43945
43959
|
_version = 0;
|
|
@@ -43967,7 +43981,7 @@ var Ej = {
|
|
|
43967
43981
|
operation: "copy",
|
|
43968
43982
|
columnIds: e.columnIds,
|
|
43969
43983
|
rowIds: e.rowIds
|
|
43970
|
-
}, this.precomputeLookup(), this.notify(),
|
|
43984
|
+
}, this._marqueeVisible = !0, this.precomputeLookup(), this.notify(), this.writeToOs(this._clipboard));
|
|
43971
43985
|
}
|
|
43972
43986
|
cut() {
|
|
43973
43987
|
let e = this.buildClipboardFromSnapshot();
|
|
@@ -43975,10 +43989,11 @@ var Ej = {
|
|
|
43975
43989
|
operation: "cut",
|
|
43976
43990
|
columnIds: e.columnIds,
|
|
43977
43991
|
rowIds: e.rowIds
|
|
43978
|
-
}, this.precomputeLookup(), this.notify(),
|
|
43992
|
+
}, this._marqueeVisible = !0, this.precomputeLookup(), this.notify(), this.writeToOs(this._clipboard));
|
|
43979
43993
|
}
|
|
43980
43994
|
async paste() {
|
|
43981
|
-
|
|
43995
|
+
let e = await this.readOsClipboard();
|
|
43996
|
+
if (this._clipboard && (!e.ok || e.ours)) {
|
|
43982
43997
|
let e = this.resolveTargetFromSnapshot();
|
|
43983
43998
|
if (!e) return;
|
|
43984
43999
|
let t = this._clipboard, n = this._store, r = Dm(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, {
|
|
@@ -43988,27 +44003,28 @@ var Ej = {
|
|
|
43988
44003
|
i && (this.syncInternalPasteToServer(i, t, e), this._sortState && Xd.info(this._t("dataEditor.toast.rowMayNotBeVisible")), this.clear());
|
|
43989
44004
|
return;
|
|
43990
44005
|
}
|
|
43991
|
-
|
|
43992
|
-
try {
|
|
43993
|
-
e = await navigator.clipboard.readText();
|
|
43994
|
-
} catch (e) {
|
|
44006
|
+
if (!e.ok) {
|
|
43995
44007
|
this._store.errorHandler.handleError({
|
|
43996
44008
|
code: "OPERATION_ERROR",
|
|
43997
44009
|
message: "Failed to read clipboard",
|
|
43998
44010
|
source: "clipboard-manager",
|
|
43999
|
-
originalError: e
|
|
44011
|
+
originalError: e.error
|
|
44000
44012
|
});
|
|
44001
44013
|
return;
|
|
44002
44014
|
}
|
|
44003
|
-
|
|
44004
|
-
|
|
44005
|
-
r
|
|
44015
|
+
let t = e.text;
|
|
44016
|
+
if (!t) return;
|
|
44017
|
+
let { row: n, col: r } = this.resolveAnchor(), i = await this._store.pasteFromText(t, n, r, this._validator);
|
|
44018
|
+
i && this.syncExternalPasteToServer(i, n, r, t);
|
|
44006
44019
|
}
|
|
44007
44020
|
clear() {
|
|
44008
|
-
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());
|
|
44021
|
+
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());
|
|
44022
|
+
}
|
|
44023
|
+
hideMarquee() {
|
|
44024
|
+
this._marqueeVisible && (this._marqueeVisible = !1, this.notify());
|
|
44009
44025
|
}
|
|
44010
44026
|
isCellInClipboard(e, t) {
|
|
44011
|
-
if (!this._clipboard || !this._clipboardColIndices || !this._clipboardColIndices.has(e)) return !1;
|
|
44027
|
+
if (!this._marqueeVisible || !this._clipboard || !this._clipboardColIndices || !this._clipboardColIndices.has(e)) return !1;
|
|
44012
44028
|
if (this._clipboardIsWholeColumn) return !0;
|
|
44013
44029
|
if (!this._clipboardRowSet) return !1;
|
|
44014
44030
|
let n = this._store.getRowId(t);
|
|
@@ -44018,7 +44034,7 @@ var Ej = {
|
|
|
44018
44034
|
return this._clipboard?.operation ?? null;
|
|
44019
44035
|
}
|
|
44020
44036
|
getClipboardBounds() {
|
|
44021
|
-
if (!this._clipboard) return null;
|
|
44037
|
+
if (!this._clipboard || !this._marqueeVisible) return null;
|
|
44022
44038
|
let e = this._clipboardIsWholeColumn ? this._store.getSnapshot().filteredCount - 1 : this._clipboardMaxRow;
|
|
44023
44039
|
return {
|
|
44024
44040
|
minCol: this._clipboardMinCol,
|
|
@@ -44027,6 +44043,32 @@ var Ej = {
|
|
|
44027
44043
|
maxRow: e
|
|
44028
44044
|
};
|
|
44029
44045
|
}
|
|
44046
|
+
writeToOs(e) {
|
|
44047
|
+
let t = Tj(e, this._columns, this._store);
|
|
44048
|
+
this._osText = t.text, this._osWrite = t.written, t.written.then((e) => {
|
|
44049
|
+
e || (this._store.errorHandler.handleError({
|
|
44050
|
+
code: "OPERATION_ERROR",
|
|
44051
|
+
message: "Failed to write clipboard",
|
|
44052
|
+
source: "clipboard-manager"
|
|
44053
|
+
}), Xd.error(this._t("dataEditor.toast.clipboardWriteFailed")));
|
|
44054
|
+
});
|
|
44055
|
+
}
|
|
44056
|
+
async readOsClipboard() {
|
|
44057
|
+
let e = this._osWrite ? await this._osWrite : !0;
|
|
44058
|
+
try {
|
|
44059
|
+
let t = await navigator.clipboard.readText();
|
|
44060
|
+
return {
|
|
44061
|
+
ok: !0,
|
|
44062
|
+
text: t,
|
|
44063
|
+
ours: !e || t === this._osText
|
|
44064
|
+
};
|
|
44065
|
+
} catch (e) {
|
|
44066
|
+
return {
|
|
44067
|
+
ok: !1,
|
|
44068
|
+
error: e
|
|
44069
|
+
};
|
|
44070
|
+
}
|
|
44071
|
+
}
|
|
44030
44072
|
buildClipboardFromSnapshot() {
|
|
44031
44073
|
let e = f_(this._selection.getSelection(), this.resolveContext());
|
|
44032
44074
|
return e === null ? null : {
|
|
@@ -44129,6 +44171,7 @@ var Ej = {
|
|
|
44129
44171
|
notify() {
|
|
44130
44172
|
this._version++, this._snapshot = {
|
|
44131
44173
|
clipboard: this._clipboard,
|
|
44174
|
+
marqueeVisible: this._marqueeVisible,
|
|
44132
44175
|
version: this._version
|
|
44133
44176
|
};
|
|
44134
44177
|
for (let e of this._listeners) e();
|
|
@@ -44516,8 +44559,8 @@ var Bj = class {
|
|
|
44516
44559
|
return;
|
|
44517
44560
|
}
|
|
44518
44561
|
if (e.key === "Escape") {
|
|
44519
|
-
if (this._clipboard.getSnapshot().
|
|
44520
|
-
this._clipboard.
|
|
44562
|
+
if (this._clipboard.getSnapshot().marqueeVisible) {
|
|
44563
|
+
this._clipboard.hideMarquee();
|
|
44521
44564
|
return;
|
|
44522
44565
|
}
|
|
44523
44566
|
this._selection.clear();
|
|
@@ -45330,6 +45373,8 @@ var Qj = {
|
|
|
45330
45373
|
}, [b]), (0, y.useEffect)(() => {
|
|
45331
45374
|
R.clipboard.setSortState(m);
|
|
45332
45375
|
}, [R, m]), (0, y.useEffect)(() => {
|
|
45376
|
+
R.clipboard.hideMarquee();
|
|
45377
|
+
}, [R, b]), (0, y.useEffect)(() => {
|
|
45333
45378
|
R.clipboard.setTranslate(S);
|
|
45334
45379
|
}, [R, S]), (0, y.useEffect)(() => {
|
|
45335
45380
|
R.setBounds(p, B.columns.length);
|
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.74",
|
|
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",
|