@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.1.0
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/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +3 -0
- package/dist/controllers/clipboardController.js +69 -50
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
- package/dist/controllers/columnAutosizeRunner.js +10 -9
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +169 -168
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +71 -69
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.d.ts +4 -1
- package/dist/controllers/contextMenuController.js +55 -38
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +135 -135
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +6 -0
- package/dist/controllers/historyController.js +79 -37
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +4 -0
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +142 -142
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +9 -4
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +145 -144
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +26 -14
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +74 -72
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +3 -1
- package/dist/controllers/viewportSyncController.js +66 -28
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +16 -9
- package/dist/engine/gridApi.cjs +2 -2
- package/dist/engine/gridApi.d.ts +6 -2
- package/dist/engine/gridApi.js +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -6
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +3 -0
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +2 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +3 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -1
- package/dist/logic/exportData.js +40 -36
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.d.ts +2 -1
- package/dist/logic/filtering.js +16 -3
- package/dist/logic/groupExport.cjs +1 -1
- package/dist/logic/groupExport.js +28 -27
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +1 -0
- package/dist/logic/grouping.js +52 -41
- package/dist/logic/historyRebase.cjs +1 -0
- package/dist/logic/historyRebase.d.ts +5 -0
- package/dist/logic/historyRebase.js +36 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +4 -0
- package/dist/logic/localeTextFeatures.js +8 -5
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +1 -0
- package/dist/logic/selectLabels.cjs +1 -0
- package/dist/logic/selectLabels.d.ts +3 -0
- package/dist/logic/selectLabels.js +41 -0
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/model/gridTypes.core.d.ts +174 -18
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.d.ts +14 -2
- package/dist/utils/clipboard.js +101 -49
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/package.json +1 -1
package/dist/utils/clipboard.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getCellValue as e, setCellValue as t } from "./permissions.js";
|
|
2
2
|
import { isSyntheticColumnKey as n } from "../logic/detailRow.js";
|
|
3
3
|
import { normalizeCellRange as r, normalizeColumnRange as i, normalizeRowRange as a } from "../model/gridSelectors.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { formatCellClipboardText as o } from "../logic/selectLabels.js";
|
|
5
|
+
import { resolveCellParser as s } from "../logic/editorValues.js";
|
|
6
|
+
import { decideCellWrite as c } from "../logic/validation.js";
|
|
6
7
|
//#region src/utils/clipboard.ts
|
|
7
|
-
var
|
|
8
|
+
var l = (e) => {
|
|
8
9
|
let t = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
9
10
|
if (!t) return [];
|
|
10
11
|
let n = [], r = [], i = "", a = 0, o = t.length, s = -1, c = 0;
|
|
@@ -42,82 +43,133 @@ var c = (e) => {
|
|
|
42
43
|
i += e, a += 1;
|
|
43
44
|
}
|
|
44
45
|
return i === "" && r.length === 0 && t.endsWith("\n") || (r.push(i), n.push(r)), n;
|
|
45
|
-
},
|
|
46
|
+
}, u = (e) => /[\t\n\r"]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, d = (e) => e.map(u).join(" "), f = (e) => {
|
|
46
47
|
let t = e[e.length - 1], n = e.join("\n");
|
|
47
48
|
return t !== void 0 && /^\t*$/.test(t) ? `${n}\n` : n;
|
|
48
|
-
},
|
|
49
|
+
}, p = (e) => e !== void 0 && !n(e.key), m = (e, t, n) => {
|
|
49
50
|
let r = [];
|
|
50
51
|
for (let i = t; r.length < n; i += 1) {
|
|
51
52
|
let t = e[i];
|
|
52
|
-
(t === void 0 ||
|
|
53
|
+
(t === void 0 || p(t)) && r.push(i);
|
|
53
54
|
}
|
|
54
55
|
return r;
|
|
55
|
-
},
|
|
56
|
-
let r = e(t, n);
|
|
57
|
-
return n.formatClipboardValue ? n.formatClipboardValue(r, t) : String(r ?? "");
|
|
58
|
-
}, h = (e) => e.filter(f), g = (e, t, n, o, s) => {
|
|
56
|
+
}, h = (t, n) => o(n, e(t, n), t), g = (e) => e.filter(p), _ = (e, t, n, o, s) => {
|
|
59
57
|
if (!o) return "";
|
|
60
58
|
let c = [];
|
|
61
59
|
if (o.type === "cell") {
|
|
62
|
-
let t = r(o.range), i = n.slice(t.start.col, t.end.col + 1).filter(
|
|
60
|
+
let t = r(o.range), i = n.slice(t.start.col, t.end.col + 1).filter(p);
|
|
63
61
|
if (i.length === 0) return "";
|
|
64
62
|
for (let n = t.start.row; n <= t.end.row; n += 1) {
|
|
65
63
|
let t = e(n);
|
|
66
|
-
t && (s && !s(t, n) || c.push(
|
|
64
|
+
t && (s && !s(t, n) || c.push(d(i.map((e) => h(t, e)))));
|
|
67
65
|
}
|
|
68
|
-
return
|
|
66
|
+
return f(c);
|
|
69
67
|
}
|
|
70
68
|
if (o.type === "row") {
|
|
71
|
-
let t = a(o.startRow, o.endRow), r = n.filter(
|
|
69
|
+
let t = a(o.startRow, o.endRow), r = n.filter(p);
|
|
72
70
|
if (r.length === 0) return "";
|
|
73
71
|
for (let n = t.startRow; n <= t.endRow; n += 1) {
|
|
74
72
|
let t = e(n);
|
|
75
|
-
t && (s && !s(t, n) || c.push(
|
|
73
|
+
t && (s && !s(t, n) || c.push(d(r.map((e) => h(t, e)))));
|
|
76
74
|
}
|
|
77
|
-
return
|
|
75
|
+
return f(c);
|
|
78
76
|
}
|
|
79
|
-
let l = i(o.startCol, o.endCol),
|
|
80
|
-
if (
|
|
77
|
+
let l = i(o.startCol, o.endCol), u = n.slice(l.startCol, l.endCol + 1).filter(p);
|
|
78
|
+
if (u.length === 0) return "";
|
|
81
79
|
for (let n = 0; n < t; n += 1) {
|
|
82
80
|
let t = e(n);
|
|
83
|
-
t && (s && !s(t, n) || c.push(u
|
|
81
|
+
t && (s && !s(t, n) || c.push(d(u.map((e) => h(t, e)))));
|
|
84
82
|
}
|
|
85
|
-
return
|
|
86
|
-
},
|
|
83
|
+
return f(c);
|
|
84
|
+
}, v = (e, n, r, i, a, o, l, u, d) => {
|
|
87
85
|
if (i.length === 0) return e;
|
|
88
|
-
let
|
|
86
|
+
let f = [...e], p = m(r, o, i.reduce((e, t) => Math.max(e, t.length), 0));
|
|
89
87
|
for (let e = 0; e < i.length; e += 1) {
|
|
90
|
-
let
|
|
91
|
-
if (
|
|
92
|
-
let
|
|
93
|
-
if (!
|
|
94
|
-
let
|
|
88
|
+
let o = a + e, m = n(o);
|
|
89
|
+
if (m === void 0) continue;
|
|
90
|
+
let h = f[m];
|
|
91
|
+
if (!h) continue;
|
|
92
|
+
let g = h, _ = !1;
|
|
95
93
|
for (let n = 0; n < i[e].length; n += 1) {
|
|
96
|
-
let a =
|
|
97
|
-
if (!
|
|
98
|
-
let
|
|
99
|
-
|
|
94
|
+
let a = p[n], f = r[a];
|
|
95
|
+
if (!f) continue;
|
|
96
|
+
let v = i[e][n];
|
|
97
|
+
if (!l(m, a, h, f, o)) {
|
|
98
|
+
u?.({
|
|
99
|
+
rowIndex: o,
|
|
100
|
+
sourceRowIndex: m,
|
|
101
|
+
colIndex: a,
|
|
102
|
+
row: h,
|
|
103
|
+
column: f,
|
|
104
|
+
text: v,
|
|
105
|
+
reason: "readOnly"
|
|
106
|
+
});
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
let y = s(f)(v, h), b = c(f, h, y, d);
|
|
110
|
+
if (b.action === "reject") {
|
|
111
|
+
u?.({
|
|
112
|
+
rowIndex: o,
|
|
113
|
+
sourceRowIndex: m,
|
|
114
|
+
colIndex: a,
|
|
115
|
+
row: h,
|
|
116
|
+
column: f,
|
|
117
|
+
text: v,
|
|
118
|
+
reason: "invalid",
|
|
119
|
+
value: y,
|
|
120
|
+
message: b.message
|
|
121
|
+
});
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
g = t(g, f, y), _ = !0;
|
|
100
125
|
}
|
|
101
|
-
|
|
126
|
+
_ && (f[m] = g);
|
|
102
127
|
}
|
|
103
|
-
return
|
|
104
|
-
},
|
|
105
|
-
let
|
|
128
|
+
return f;
|
|
129
|
+
}, y = (e, t, n, r, i, a, o, l) => {
|
|
130
|
+
let u = [], d = m(t, i, n.reduce((e, t) => Math.max(e, t.length), 0));
|
|
106
131
|
for (let i = 0; i < n.length; i += 1) {
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
109
|
-
let r =
|
|
110
|
-
if (!
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
let f = r + i, p = e(f);
|
|
133
|
+
if (p) for (let e = 0; e < n[i].length; e += 1) {
|
|
134
|
+
let r = d[e], m = t[r];
|
|
135
|
+
if (!m) continue;
|
|
136
|
+
let h = n[i][e];
|
|
137
|
+
if (!a(f, r, p, m)) {
|
|
138
|
+
o?.({
|
|
139
|
+
rowIndex: f,
|
|
140
|
+
sourceRowIndex: void 0,
|
|
141
|
+
colIndex: r,
|
|
142
|
+
row: p,
|
|
143
|
+
column: m,
|
|
144
|
+
text: h,
|
|
145
|
+
reason: "readOnly"
|
|
146
|
+
});
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
let g = s(m)(h, p), _ = c(m, p, g, l);
|
|
150
|
+
if (_.action === "reject") {
|
|
151
|
+
o?.({
|
|
152
|
+
rowIndex: f,
|
|
153
|
+
sourceRowIndex: void 0,
|
|
154
|
+
colIndex: r,
|
|
155
|
+
row: p,
|
|
156
|
+
column: m,
|
|
157
|
+
text: h,
|
|
158
|
+
reason: "invalid",
|
|
159
|
+
value: g,
|
|
160
|
+
message: _.message
|
|
161
|
+
});
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
u.push({
|
|
165
|
+
viewIndex: f,
|
|
166
|
+
column: m,
|
|
167
|
+
value: g
|
|
116
168
|
});
|
|
117
169
|
}
|
|
118
170
|
}
|
|
119
|
-
return
|
|
120
|
-
},
|
|
171
|
+
return u;
|
|
172
|
+
}, b = (e) => {
|
|
121
173
|
let { body: t, activeElement: n } = document;
|
|
122
174
|
if (!t) return !1;
|
|
123
175
|
let r = document.createElement("textarea");
|
|
@@ -131,11 +183,11 @@ var c = (e) => {
|
|
|
131
183
|
t.removeChild(r), n instanceof HTMLElement && n.focus();
|
|
132
184
|
}
|
|
133
185
|
return i;
|
|
134
|
-
},
|
|
186
|
+
}, x = async (e) => {
|
|
135
187
|
if (navigator.clipboard?.writeText) try {
|
|
136
188
|
return await navigator.clipboard.writeText(e), !0;
|
|
137
189
|
} catch {}
|
|
138
|
-
return
|
|
190
|
+
return b(e) ? !0 : (console.warn("[SpreadsheetGrid] クリップボードへのコピーに失敗しました(navigator.clipboard が利用できず、execCommand フォールバックも失敗)。\n[SpreadsheetGrid] Failed to copy to the clipboard (navigator.clipboard is unavailable and the execCommand fallback failed)."), !1);
|
|
139
191
|
};
|
|
140
192
|
//#endregion
|
|
141
|
-
export {
|
|
193
|
+
export { v as applyClipboardMatrixToRows, y as buildClipboardCellEdits, b as copyTextViaExecCommand, u as escapeTsvField, g as filterClipboardColumns, h as formatClipboardCell, f as joinTsvLines, d as joinTsvRow, l as parseClipboardText, m as resolvePasteColumnIndexes, _ as serializeSelectionToTsv, x as writeTextToClipboard };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`dialog, [popover], [aria-modal="true"], [role="dialog"], [role="alertdialog"]`,t=`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover, .ssg-popover`,n=e=>typeof e==`object`&&!!e&&e.nodeType===1,r=e=>(e?.ownerDocument??(typeof document>`u`?null:document))?.body??null,i=/transform|translate|scale|rotate|perspective|filter/,a=/paint|layout|strict|content/,o=e=>{let t=e.ownerDocument.defaultView;if(!t||typeof t.getComputedStyle!=`function`)return!1;let n=t.getComputedStyle(e);if(!((n.overflowX||`visible`)!==`visible`||(n.overflowY||`visible`)!==`visible`))return!1;let r=e=>!e||e===`none`;return!r(n.transform)||!r(n.getPropertyValue(`translate`))||!r(n.getPropertyValue(`scale`))||!r(n.getPropertyValue(`rotate`))||!r(n.filter)||!r(n.perspective)||!r(n.getPropertyValue(`backdrop-filter`))||i.test(n.willChange||``)||a.test(n.contain||``)||(n.getPropertyValue(`container-type`)||`normal`)!==`normal`},s=e=>{if(e.matches(`dialog, [popover]`)||!o(e))return e;let t=e.ownerDocument,n=t.defaultView;for(let r=e.parentElement;r!==null&&r!==t.body&&r!==t.documentElement;r=r.parentElement){if(r.matches(`dialog, [popover]`))return e;if(n?.getComputedStyle(r).position===`fixed`)return o(r)?e:r}return e};function c(t){let r=t.parentElement?.closest(e);return n(r)?s(r):null}function l(e,t){let i=r(e);return n(t)?t:e?typeof t==`function`?t(e)??i:t===`body`?i:c(e)??i:i}var u=new WeakMap;function d(e,t){let n=e.filter(e=>e!=null);for(let e of n)u.set(e,t);return()=>{for(let e of n)u.get(e)===t&&u.delete(e)}}function f(e){for(let n=e??null;n!==null;n=n.parentElement){if(n.matches(t))return n.parentElement??r(n);let e=u.get(n);if(e)return e()??r(n)}return e?c(e)??r(e):r(null)}function p(e){let t=e?.parentElement;if(!e||!t)return;let n=e.ownerDocument,r=0,i=0;if(t!==n.body&&t!==n.documentElement){let e=n.createElement(`div`);e.style.cssText=`position:fixed;left:0;top:0;width:0;height:0;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none`,t.appendChild(e);let a=e.getBoundingClientRect();e.remove(),r=Number.isFinite(a.left)?a.left:0,i=Number.isFinite(a.top)?a.top:0}let a=r===0&&i===0?``:`${-r}px ${-i}px`;e.style.getPropertyValue(`translate`)!==a&&(a===``?e.style.removeProperty(`translate`):e.style.setProperty(`translate`,a))}function m(e,t){let n=t??e.ownerDocument.body;e.parentElement!==n&&n.appendChild(e),p(e)}exports.appendToPopupContainer=m,exports.findPopupHost=c,exports.getPopupContainerFor=f,exports.registerPopupContainer=d,exports.resolvePopupContainer=l,exports.syncPopupOrigin=p;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GridPopupContainer } from '../model/gridTypes.core.js';
|
|
2
|
+
export type { GridPopupContainer };
|
|
3
|
+
export declare function findPopupHost(element: Element): HTMLElement | null;
|
|
4
|
+
export declare function resolvePopupContainer(gridElement: HTMLElement | null | undefined, option: GridPopupContainer | undefined): HTMLElement | null;
|
|
5
|
+
export declare function registerPopupContainer(elements: readonly (Element | null | undefined)[], get: () => HTMLElement | null): () => void;
|
|
6
|
+
export declare function getPopupContainerFor(element: Element | null | undefined): HTMLElement | null;
|
|
7
|
+
export declare function syncPopupOrigin(popup: HTMLElement | null | undefined): void;
|
|
8
|
+
export declare function appendToPopupContainer(popup: HTMLElement, container: HTMLElement | null): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/utils/popupContainer.ts
|
|
2
|
+
var e = (e) => typeof e == "object" && !!e && e.nodeType === 1, t = (e) => (e?.ownerDocument ?? (typeof document > "u" ? null : document))?.body ?? null, n = /transform|translate|scale|rotate|perspective|filter/, r = /paint|layout|strict|content/, i = (e) => {
|
|
3
|
+
let t = e.ownerDocument.defaultView;
|
|
4
|
+
if (!t || typeof t.getComputedStyle != "function") return !1;
|
|
5
|
+
let i = t.getComputedStyle(e);
|
|
6
|
+
if (!((i.overflowX || "visible") !== "visible" || (i.overflowY || "visible") !== "visible")) return !1;
|
|
7
|
+
let a = (e) => !e || e === "none";
|
|
8
|
+
return !a(i.transform) || !a(i.getPropertyValue("translate")) || !a(i.getPropertyValue("scale")) || !a(i.getPropertyValue("rotate")) || !a(i.filter) || !a(i.perspective) || !a(i.getPropertyValue("backdrop-filter")) || n.test(i.willChange || "") || r.test(i.contain || "") || (i.getPropertyValue("container-type") || "normal") !== "normal";
|
|
9
|
+
}, a = (e) => {
|
|
10
|
+
if (e.matches("dialog, [popover]") || !i(e)) return e;
|
|
11
|
+
let t = e.ownerDocument, n = t.defaultView;
|
|
12
|
+
for (let r = e.parentElement; r !== null && r !== t.body && r !== t.documentElement; r = r.parentElement) {
|
|
13
|
+
if (r.matches("dialog, [popover]")) return e;
|
|
14
|
+
if (n?.getComputedStyle(r).position === "fixed") return i(r) ? e : r;
|
|
15
|
+
}
|
|
16
|
+
return e;
|
|
17
|
+
};
|
|
18
|
+
function o(t) {
|
|
19
|
+
let n = t.parentElement?.closest("dialog, [popover], [aria-modal=\"true\"], [role=\"dialog\"], [role=\"alertdialog\"]");
|
|
20
|
+
return e(n) ? a(n) : null;
|
|
21
|
+
}
|
|
22
|
+
function s(n, r) {
|
|
23
|
+
let i = t(n);
|
|
24
|
+
return e(r) ? r : n ? typeof r == "function" ? r(n) ?? i : r === "body" ? i : o(n) ?? i : i;
|
|
25
|
+
}
|
|
26
|
+
var c = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
function l(e, t) {
|
|
28
|
+
let n = e.filter((e) => e != null);
|
|
29
|
+
for (let e of n) c.set(e, t);
|
|
30
|
+
return () => {
|
|
31
|
+
for (let e of n) c.get(e) === t && c.delete(e);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function u(e) {
|
|
35
|
+
for (let n = e ?? null; n !== null; n = n.parentElement) {
|
|
36
|
+
if (n.matches(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover, .ssg-popover")) return n.parentElement ?? t(n);
|
|
37
|
+
let e = c.get(n);
|
|
38
|
+
if (e) return e() ?? t(n);
|
|
39
|
+
}
|
|
40
|
+
return e ? o(e) ?? t(e) : t(null);
|
|
41
|
+
}
|
|
42
|
+
function d(e) {
|
|
43
|
+
let t = e?.parentElement;
|
|
44
|
+
if (!e || !t) return;
|
|
45
|
+
let n = e.ownerDocument, r = 0, i = 0;
|
|
46
|
+
if (t !== n.body && t !== n.documentElement) {
|
|
47
|
+
let e = n.createElement("div");
|
|
48
|
+
e.style.cssText = "position:fixed;left:0;top:0;width:0;height:0;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none", t.appendChild(e);
|
|
49
|
+
let a = e.getBoundingClientRect();
|
|
50
|
+
e.remove(), r = Number.isFinite(a.left) ? a.left : 0, i = Number.isFinite(a.top) ? a.top : 0;
|
|
51
|
+
}
|
|
52
|
+
let a = r === 0 && i === 0 ? "" : `${-r}px ${-i}px`;
|
|
53
|
+
e.style.getPropertyValue("translate") !== a && (a === "" ? e.style.removeProperty("translate") : e.style.setProperty("translate", a));
|
|
54
|
+
}
|
|
55
|
+
function f(e, t) {
|
|
56
|
+
let n = t ?? e.ownerDocument.body;
|
|
57
|
+
e.parentElement !== n && n.appendChild(e), d(e);
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { f as appendToPopupContainer, o as findPopupHost, u as getPopupContainerFor, l as registerPopupContainer, s as resolvePopupContainer, d as syncPopupOrigin };
|
package/package.json
CHANGED