@ishibashi0112/spreadsheet-grid-core 0.60.0 → 0.61.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/README.md +2 -2
- package/dist/controllers/changeHighlightController.cjs +1 -1
- package/dist/controllers/changeHighlightController.js +54 -49
- package/dist/controllers/clipboardController.cjs +2 -2
- package/dist/controllers/clipboardController.js +71 -76
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +74 -70
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +90 -84
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.js +71 -71
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +68 -65
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +2 -0
- package/dist/controllers/rowDragController.js +153 -113
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.js +49 -47
- package/dist/controllers/saveStatusController.cjs +1 -1
- package/dist/controllers/saveStatusController.js +54 -47
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +42 -20
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +38 -21
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +2 -1
- package/dist/controllers/viewportSyncController.js +3 -2
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +1 -0
- package/dist/engine/columnLayout.js +12 -11
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +27 -25
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.js +12 -7
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.js +2 -2
- package/dist/logic/conditionalFormat.cjs +1 -1
- package/dist/logic/conditionalFormat.js +2 -2
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +4 -0
- package/dist/logic/domGuards.js +2 -2
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +2 -0
- package/dist/logic/editorValues.js +11 -2
- package/dist/logic/fillSeries.cjs +1 -1
- package/dist/logic/fillSeries.js +43 -36
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +1 -0
- package/dist/logic/find.js +6 -6
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.js +72 -55
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +5 -2
- package/dist/logic/serverSideEdits.cjs +1 -1
- package/dist/logic/serverSideEdits.d.ts +16 -2
- package/dist/logic/serverSideEdits.js +60 -14
- package/dist/model/gridTypes.core.d.ts +8 -5
- package/dist/utils/clipboard.cjs +5 -5
- package/dist/utils/clipboard.d.ts +3 -0
- package/dist/utils/clipboard.js +58 -65
- package/package.json +1 -6
|
@@ -1,137 +1,137 @@
|
|
|
1
1
|
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
2
|
import { runChunked as t } from "../logic/chunkedLoop.js";
|
|
3
3
|
import { isSyntheticColumnKey as n } from "../logic/detailRow.js";
|
|
4
|
-
import { buildFindIndex as r, findRangesInText as i,
|
|
4
|
+
import { buildFindIndex as r, findRangesInText as i, isFindableColumn as a, resolveCurrentAfterRescan as o, resolveFindCellText as s, stepFindIndex as c } from "../logic/find.js";
|
|
5
5
|
//#region src/controllers/findController.ts
|
|
6
|
-
var
|
|
7
|
-
let
|
|
6
|
+
var l = 1e4, u = /* @__PURE__ */ new Map(), d = () => {
|
|
7
|
+
let l = null, d = 0, f = null, p = e({
|
|
8
8
|
open: !1,
|
|
9
9
|
query: "",
|
|
10
10
|
matches: [],
|
|
11
|
-
index:
|
|
11
|
+
index: u,
|
|
12
12
|
currentIndex: null,
|
|
13
13
|
scanning: !1,
|
|
14
14
|
truncated: !1
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
...
|
|
15
|
+
}), m = (e) => {
|
|
16
|
+
p.setSnapshot({
|
|
17
|
+
...p.getSnapshot(),
|
|
18
18
|
...e
|
|
19
19
|
});
|
|
20
|
-
},
|
|
21
|
-
let e =
|
|
20
|
+
}, h = null, g = () => {
|
|
21
|
+
let e = p.getSnapshot(), t = {
|
|
22
22
|
query: e.query,
|
|
23
23
|
matchCount: e.matches.length,
|
|
24
24
|
currentIndex: e.currentIndex,
|
|
25
25
|
open: e.open
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
let e =
|
|
27
|
+
h !== null && h.query === t.query && h.matchCount === t.matchCount && h.currentIndex === t.currentIndex && h.open === t.open || (h = t, l?.onChange?.(t));
|
|
28
|
+
}, _ = () => {
|
|
29
|
+
let e = p.getSnapshot();
|
|
30
30
|
if (e.currentIndex === null) return;
|
|
31
31
|
let t = e.matches[e.currentIndex];
|
|
32
|
-
t &&
|
|
33
|
-
},
|
|
34
|
-
|
|
32
|
+
t && l?.onNavigate(t.rowIndex, t.colIndex);
|
|
33
|
+
}, v = () => {
|
|
34
|
+
d += 1, f = null, m({
|
|
35
35
|
matches: [],
|
|
36
|
-
index:
|
|
36
|
+
index: u,
|
|
37
37
|
currentIndex: null,
|
|
38
38
|
scanning: !1,
|
|
39
39
|
truncated: !1
|
|
40
40
|
});
|
|
41
|
-
},
|
|
42
|
-
let
|
|
43
|
-
if (!
|
|
44
|
-
|
|
41
|
+
}, y = (e) => {
|
|
42
|
+
let c = l, u = p.getSnapshot();
|
|
43
|
+
if (!c || !u.open || u.query.length === 0) {
|
|
44
|
+
v(), g();
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
rowModel:
|
|
51
|
-
columns:
|
|
52
|
-
query:
|
|
53
|
-
caseSensitive:
|
|
47
|
+
d += 1;
|
|
48
|
+
let h = d, { rowModel: y, columns: b, caseSensitive: x } = c, S = u.query;
|
|
49
|
+
f = {
|
|
50
|
+
rowModel: y,
|
|
51
|
+
columns: b,
|
|
52
|
+
query: S,
|
|
53
|
+
caseSensitive: x
|
|
54
54
|
};
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
let t =
|
|
59
|
-
t !== void 0 &&
|
|
60
|
-
if (
|
|
61
|
-
let
|
|
62
|
-
for (let t of i(
|
|
63
|
-
if (
|
|
64
|
-
|
|
55
|
+
let C = u.currentIndex === null ? null : u.matches[u.currentIndex] ?? null, w = [], T = !1, E = y.getRowCount();
|
|
56
|
+
m({ scanning: !0 }), t(E, (e) => {
|
|
57
|
+
if (T) return;
|
|
58
|
+
let t = y.getRow(e);
|
|
59
|
+
t !== void 0 && b.forEach((r, o) => {
|
|
60
|
+
if (T || n(r.key) || !a(r)) return;
|
|
61
|
+
let c = s(r, t);
|
|
62
|
+
for (let t of i(c, S, x)) {
|
|
63
|
+
if (w.length >= 1e4) {
|
|
64
|
+
T = !0;
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
w.push({
|
|
68
68
|
rowIndex: e,
|
|
69
|
-
colIndex:
|
|
69
|
+
colIndex: o,
|
|
70
70
|
columnKey: String(r.key),
|
|
71
71
|
start: t.start,
|
|
72
72
|
length: t.length
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
}, { isCancelled: () =>
|
|
77
|
-
if (!t ||
|
|
78
|
-
let n =
|
|
79
|
-
|
|
80
|
-
matches:
|
|
81
|
-
index: r(
|
|
76
|
+
}, { isCancelled: () => d !== h }).then((t) => {
|
|
77
|
+
if (!t || d !== h) return;
|
|
78
|
+
let n = o(w, C);
|
|
79
|
+
m({
|
|
80
|
+
matches: w,
|
|
81
|
+
index: r(w),
|
|
82
82
|
currentIndex: n,
|
|
83
83
|
scanning: !1,
|
|
84
|
-
truncated:
|
|
85
|
-
}),
|
|
84
|
+
truncated: T
|
|
85
|
+
}), g(), e && _();
|
|
86
86
|
});
|
|
87
|
-
},
|
|
88
|
-
let e =
|
|
89
|
-
return !
|
|
87
|
+
}, b = () => {
|
|
88
|
+
let e = p.getSnapshot();
|
|
89
|
+
return !l || !e.open || e.query.length === 0 ? !1 : f === null || f.rowModel !== l.rowModel || f.columns !== l.columns || f.query !== e.query || f.caseSensitive !== l.caseSensitive;
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
92
|
update: (e) => {
|
|
93
|
-
let t =
|
|
94
|
-
if (
|
|
95
|
-
|
|
93
|
+
let t = l;
|
|
94
|
+
if (l = e, !e.enabled) {
|
|
95
|
+
p.getSnapshot().open && (m({
|
|
96
96
|
open: !1,
|
|
97
97
|
query: ""
|
|
98
|
-
}),
|
|
98
|
+
}), v(), g());
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
t !== e &&
|
|
101
|
+
t !== e && b() && y(!1);
|
|
102
102
|
},
|
|
103
103
|
open: (e) => {
|
|
104
|
-
if (!
|
|
105
|
-
let t =
|
|
106
|
-
|
|
104
|
+
if (!l?.enabled) return;
|
|
105
|
+
let t = p.getSnapshot(), n = e ?? t.query;
|
|
106
|
+
m({
|
|
107
107
|
open: !0,
|
|
108
108
|
query: n
|
|
109
|
-
}), n !== t.query || !t.open ?
|
|
109
|
+
}), n !== t.query || !t.open ? y(!0) : g();
|
|
110
110
|
},
|
|
111
111
|
close: () => {
|
|
112
|
-
|
|
112
|
+
p.getSnapshot().open && (m({
|
|
113
113
|
open: !1,
|
|
114
114
|
query: ""
|
|
115
|
-
}),
|
|
115
|
+
}), v(), g());
|
|
116
116
|
},
|
|
117
117
|
setQuery: (e) => {
|
|
118
|
-
let t =
|
|
119
|
-
!t.open || e === t.query || (
|
|
118
|
+
let t = p.getSnapshot();
|
|
119
|
+
!t.open || e === t.query || (m({ query: e }), y(!0));
|
|
120
120
|
},
|
|
121
121
|
next: () => {
|
|
122
|
-
let e =
|
|
123
|
-
|
|
122
|
+
let e = p.getSnapshot(), t = c(e.currentIndex, e.matches.length, 1);
|
|
123
|
+
m({ currentIndex: t }), g(), _();
|
|
124
124
|
},
|
|
125
125
|
prev: () => {
|
|
126
|
-
let e =
|
|
127
|
-
|
|
126
|
+
let e = p.getSnapshot(), t = c(e.currentIndex, e.matches.length, -1);
|
|
127
|
+
m({ currentIndex: t }), g(), _();
|
|
128
128
|
},
|
|
129
|
-
subscribe:
|
|
130
|
-
getSnapshot:
|
|
129
|
+
subscribe: p.subscribe,
|
|
130
|
+
getSnapshot: p.getSnapshot,
|
|
131
131
|
dispose: () => {
|
|
132
|
-
|
|
132
|
+
d += 1, l = null;
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
//#endregion
|
|
137
|
-
export {
|
|
137
|
+
export { l as MAX_FIND_MATCHES, d as createFindController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/domGuards.cjs");var n=`ssg-ime-input--composing`,r=(t,n,r)=>{let i=t.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(e.isInsideDetailCardOf(t,n))continue;let i=n.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(i))if(e.getAttribute(`data-ssg-col-key`)===r)return e}return null},i=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,a=()=>{let e=null,a=null,o=null,s=null,c=!1,l=null,u=!1,d=!1,f=!1,p=null,m=()=>e?.gridRootRef.current??null,h=()=>{a&&a.ownerDocument.activeElement!==a&&a.focus({preventScroll:!0})},g=(t,n)=>{let i=m(),o=e?.resolveCell(t)??null;if(!a||!i||!o)return!1;let s=r(i,t,o.colKey);if(!s)return!1;let c=i.getBoundingClientRect(),l=s.getBoundingClientRect();return a.style.left=`${l.left-c.left-i.clientLeft}px`,a.style.top=`${l.top-c.top-i.clientTop}px`,a.style.width=`${l.width}px`,a.style.height=`${l.height}px`,a.style.textAlign=n&&o.align?o.align:``,!0},_=()=>{a&&(a.classList.remove(n),a.value=``,a.style.textAlign=``)},v=t=>{e===null||!e.enabled||e.editing||d||t.target===o&&h()},y=()=>{if(e===null||!e.enabled||e.editing||e.activeCell===null){l=null;return}let t=e.activeCell,r=e.canStartEdit(t);l={cell:t,allowed:r},f=!1,r&&(g(t,!0),p=t,a?.classList.add(n))},b=t=>{let n=l;l=null;let r=f;if(f=!1,!a||n===null||!n.allowed||r){_();return}let i=a.value||t.data||``;queueMicrotask(()=>{let t=a;if(e===null||!e.enabled||!t||i===``||t.ownerDocument.activeElement!==t||!e.canStartEdit(n.cell)){_();return}let r=e.resolveEditText?e.resolveEditText(n.cell,i):i;if(r===null||r===``){_();return}u=!0,e.startEdit(n.cell,r),requestAnimationFrame(()=>{u&&e!==null&&!e.editing&&(u=!1,_())})})},x=()=>{l===null&&!u&&a&&(a.value=``)},S=e=>{if(e.target!==a||e.key!==`Tab`||e.defaultPrevented||t.isImeComposingKeyEvent(e))return;let n=m();if(n){d=!0;try{n.focus({preventScroll:!0})}finally{d=!1}}},C=()=>{l!==null&&(f=!0)},w=e=>{o!==e&&(o?.removeEventListener(`focus`,v),o=e,o?.addEventListener(`focus`,v))},T=e=>{typeof document>`u`||c===e||(c=e,e?(document.addEventListener(`keydown`,S),document.addEventListener(`pointerdown`,C,!0)):(document.removeEventListener(`keydown`,S),document.removeEventListener(`pointerdown`,C,!0)))},E=e=>{s!==e&&(s&&(s.removeEventListener(`compositionstart`,y),s.removeEventListener(`compositionend`,b),s.removeEventListener(`input`,x)),s=e,s&&(s.addEventListener(`compositionstart`,y),s.addEventListener(`compositionend`,b),s.addEventListener(`input`,x)))};return{update:t=>{e=t;let n=t.gridRootRef.current;if(w(t.enabled?n:null),E(t.enabled?a:null),T(t.enabled),!t.enabled){l=null,u=!1,_(),a&&n&&a.ownerDocument.activeElement===a&&n.focus({preventScroll:!0});return}u&&t.editing&&(u=!1,_()),!(l!==null||u)&&(t.activeCell!==null&&!i(p,t.activeCell)&&g(t.activeCell,!1)&&(p=t.activeCell),!t.editing&&n&&n.ownerDocument.activeElement===n&&h())},attach:t=>{a!==t&&(a=t,E(e?.enabled?a:null),a&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(a.inputMode=`none`),p=null))},dispose:()=>{E(null),w(null),T(!1),l=null,u=!1,e=null}}};exports.IME_INPUT_COMPOSING_CLASS=n,exports.createImeInputController=a;
|
|
@@ -1,98 +1,101 @@
|
|
|
1
|
+
import { isInsideDetailCardOf as e } from "../logic/detailRow.js";
|
|
2
|
+
import { isImeComposingKeyEvent as t } from "../logic/domGuards.js";
|
|
1
3
|
//#region src/controllers/imeInputController.ts
|
|
2
|
-
var
|
|
3
|
-
let
|
|
4
|
-
for (let
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var n = "ssg-ime-input--composing", r = (t, n, r) => {
|
|
5
|
+
let i = t.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);
|
|
6
|
+
for (let n of Array.from(i)) {
|
|
7
|
+
if (e(t, n)) continue;
|
|
8
|
+
let i = n.querySelectorAll(".ssg-body-cell");
|
|
9
|
+
for (let e of Array.from(i)) if (e.getAttribute("data-ssg-col-key") === r) return e;
|
|
7
10
|
}
|
|
8
11
|
return null;
|
|
9
|
-
},
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
15
|
-
let s =
|
|
12
|
+
}, i = (e, t) => e === t || e !== null && t !== null && e.row === t.row && e.col === t.col, a = () => {
|
|
13
|
+
let e = null, a = null, o = null, s = null, c = !1, l = null, u = !1, d = !1, f = !1, p = null, m = () => e?.gridRootRef.current ?? null, h = () => {
|
|
14
|
+
a && a.ownerDocument.activeElement !== a && a.focus({ preventScroll: !0 });
|
|
15
|
+
}, g = (t, n) => {
|
|
16
|
+
let i = m(), o = e?.resolveCell(t) ?? null;
|
|
17
|
+
if (!a || !i || !o) return !1;
|
|
18
|
+
let s = r(i, t, o.colKey);
|
|
16
19
|
if (!s) return !1;
|
|
17
|
-
let c =
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
if (
|
|
25
|
-
|
|
20
|
+
let c = i.getBoundingClientRect(), l = s.getBoundingClientRect();
|
|
21
|
+
return a.style.left = `${l.left - c.left - i.clientLeft}px`, a.style.top = `${l.top - c.top - i.clientTop}px`, a.style.width = `${l.width}px`, a.style.height = `${l.height}px`, a.style.textAlign = n && o.align ? o.align : "", !0;
|
|
22
|
+
}, _ = () => {
|
|
23
|
+
a && (a.classList.remove(n), a.value = "", a.style.textAlign = "");
|
|
24
|
+
}, v = (t) => {
|
|
25
|
+
e === null || !e.enabled || e.editing || d || t.target === o && h();
|
|
26
|
+
}, y = () => {
|
|
27
|
+
if (e === null || !e.enabled || e.editing || e.activeCell === null) {
|
|
28
|
+
l = null;
|
|
26
29
|
return;
|
|
27
30
|
}
|
|
28
|
-
let t =
|
|
29
|
-
|
|
31
|
+
let t = e.activeCell, r = e.canStartEdit(t);
|
|
32
|
+
l = {
|
|
30
33
|
cell: t,
|
|
31
|
-
allowed:
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
if (
|
|
38
|
-
|
|
34
|
+
allowed: r
|
|
35
|
+
}, f = !1, r && (g(t, !0), p = t, a?.classList.add(n));
|
|
36
|
+
}, b = (t) => {
|
|
37
|
+
let n = l;
|
|
38
|
+
l = null;
|
|
39
|
+
let r = f;
|
|
40
|
+
if (f = !1, !a || n === null || !n.allowed || r) {
|
|
41
|
+
_();
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
|
-
let
|
|
44
|
+
let i = a.value || t.data || "";
|
|
42
45
|
queueMicrotask(() => {
|
|
43
|
-
let
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
+
let t = a;
|
|
47
|
+
if (e === null || !e.enabled || !t || i === "" || t.ownerDocument.activeElement !== t || !e.canStartEdit(n.cell)) {
|
|
48
|
+
_();
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
|
-
let
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
+
let r = e.resolveEditText ? e.resolveEditText(n.cell, i) : i;
|
|
52
|
+
if (r === null || r === "") {
|
|
53
|
+
_();
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
u = !0, e.startEdit(n.cell, r), requestAnimationFrame(() => {
|
|
57
|
+
u && e !== null && !e.editing && (u = !1, _());
|
|
55
58
|
});
|
|
56
59
|
});
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
if (e.target !==
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
|
|
60
|
+
}, x = () => {
|
|
61
|
+
l === null && !u && a && (a.value = "");
|
|
62
|
+
}, S = (e) => {
|
|
63
|
+
if (e.target !== a || e.key !== "Tab" || e.defaultPrevented || t(e)) return;
|
|
64
|
+
let n = m();
|
|
65
|
+
if (n) {
|
|
66
|
+
d = !0;
|
|
64
67
|
try {
|
|
65
|
-
|
|
68
|
+
n.focus({ preventScroll: !0 });
|
|
66
69
|
} finally {
|
|
67
|
-
|
|
70
|
+
d = !1;
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
}, C = (e) => {
|
|
73
|
-
a !== e && (a?.removeEventListener("focus", _), a = e, a?.addEventListener("focus", _));
|
|
73
|
+
}, C = () => {
|
|
74
|
+
l !== null && (f = !0);
|
|
74
75
|
}, w = (e) => {
|
|
75
|
-
|
|
76
|
+
o !== e && (o?.removeEventListener("focus", v), o = e, o?.addEventListener("focus", v));
|
|
76
77
|
}, T = (e) => {
|
|
77
|
-
|
|
78
|
+
typeof document > "u" || c === e || (c = e, e ? (document.addEventListener("keydown", S), document.addEventListener("pointerdown", C, !0)) : (document.removeEventListener("keydown", S), document.removeEventListener("pointerdown", C, !0)));
|
|
79
|
+
}, E = (e) => {
|
|
80
|
+
s !== e && (s && (s.removeEventListener("compositionstart", y), s.removeEventListener("compositionend", b), s.removeEventListener("input", x)), s = e, s && (s.addEventListener("compositionstart", y), s.addEventListener("compositionend", b), s.addEventListener("input", x)));
|
|
78
81
|
};
|
|
79
82
|
return {
|
|
80
|
-
update: (
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
|
|
83
|
+
update: (t) => {
|
|
84
|
+
e = t;
|
|
85
|
+
let n = t.gridRootRef.current;
|
|
86
|
+
if (w(t.enabled ? n : null), E(t.enabled ? a : null), T(t.enabled), !t.enabled) {
|
|
87
|
+
l = null, u = !1, _(), a && n && a.ownerDocument.activeElement === a && n.focus({ preventScroll: !0 });
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
|
-
|
|
90
|
+
u && t.editing && (u = !1, _()), !(l !== null || u) && (t.activeCell !== null && !i(p, t.activeCell) && g(t.activeCell, !1) && (p = t.activeCell), !t.editing && n && n.ownerDocument.activeElement === n && h());
|
|
88
91
|
},
|
|
89
|
-
attach: (
|
|
90
|
-
|
|
92
|
+
attach: (t) => {
|
|
93
|
+
a !== t && (a = t, E(e?.enabled ? a : null), a && (typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches && (a.inputMode = "none"), p = null));
|
|
91
94
|
},
|
|
92
95
|
dispose: () => {
|
|
93
|
-
|
|
96
|
+
E(null), w(null), T(!1), l = null, u = !1, e = null;
|
|
94
97
|
}
|
|
95
98
|
};
|
|
96
99
|
};
|
|
97
100
|
//#endregion
|
|
98
|
-
export {
|
|
101
|
+
export { n as IME_INPUT_COMPOSING_CLASS, a as createImeInputController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,c=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=()=>{let g=null,_=null,v=null,y={x:0,y:0},b=null,x=!1,S=null,C=null,w=null,T=null,E=null,D=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");var i=14,a=12,o=`0.5`,s=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,c=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,l=200,u=`cubic-bezier(0.2, 0.7, 0.3, 1)`,d=`transform 160ms ${u}`,f=`data-ssg-row-dragging`,p=e=>e?.closest(`.ssg-motion-off`)!=null,m=/translateY\((-?[\d.]+)px\)/,h=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},g=()=>{let g=null,_=null,v=null,y={x:0,y:0},b=null,x=!1,S=null,C=null,w=null,T=null,E=null,D=null,O=0,k=()=>g?.motion===`live`,A=null,j=null,M=null,N=()=>[g?.leftIndicatorRef.current??null,g?.centerIndicatorRef.current??null,g?.rightIndicatorRef.current??null],P=()=>{for(let e of N())e&&(e.style.display=`none`)},F=e=>{if(A)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),g?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),g?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),r.applySlotToElement(t,g?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let i=document.createElement(`span`);i.style.cssText=`overflow:hidden;text-overflow:ellipsis`,i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),A=t,j=n,M=null},I=e=>{let t=A;if(!t)return;t.style.transform=`translate(`+(y.x+i)+`px,`+(y.y+a)+`px)`;let n=e?`move`:`out`;if(M===n)return;M=n;let r=j;n===`out`?(t.style.opacity=o,r&&(r.innerHTML=c)):(t.style.opacity=`1`,r&&(r.innerHTML=s))},L=()=>{A&&A.parentNode&&A.parentNode.removeChild(A),A=null,j=null,M=null},R=(e,n)=>{let r=g?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${f}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(f,k()?`live`:``):e.removeAttribute(f))})},z=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e)){let e=m.exec(n.style.transform);e&&t.set(n,{index:Number(n.getAttribute(`data-row-index`)),baseY:parseFloat(e[1])})}return t},B=t=>{let n=D,r=_;if(!n||r===null||g===null)return;let i=g.scrollContainerRef.current;if(!i)return;for(let e of h(i)){if(n.has(e))continue;let t=m.exec(e.style.transform);t&&n.set(e,{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1])})}let a=g.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-O)*g.verticalScaleFactor,s=(b?y.y-b.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{let{index:i,baseY:o}=e;if(!t.isConnected){n.delete(t);return}if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=d,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform})},V=(t,r)=>{if(g===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=g,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,g.footerHeight??0),m=d.getBoundingClientRect(),h=e.resolveRowDropSlot(d.scrollTop+p-m.top-s-u.scrollTop*(1-c),o);return{slot:h,top:s+e.resolveRowDropSlotTop(h,o)-l}},H=()=>{let t=V(y.x,y.y),n=_;if(k()){t&&n!==null&&(v=e.resolveMoveTargetIndex(n,t.slot)===null?null:t.slot),P(),B(v);return}if(I(t),!t||n===null||e.resolveMoveTargetIndex(n,t.slot)===null){v=null,P();return}v=t.slot;for(let e of N())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},U=()=>{if(_===null){w=null;return}let e=g?.scrollContainerRef.current??null;if(e&&(x||(!b||n.hasPointerLeftActivationRadius(b,y,6))&&(x=!0),x)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(y.y,r.top,r.bottom-(g?.footerHeight??0),24),a=n.computeNextScrollPosition(e.scrollTop,i,18,e.scrollHeight-e.clientHeight);a!==e.scrollTop&&e.scrollTo({top:a,behavior:`auto`})}H(),w=requestAnimationFrame(U)},W=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,G=()=>{let e=g?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of h(e))t.set(W(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);return t},K=t=>{w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,P(),L();let n=_,r=v,i=E;R(n,!1),_=null,E=null,v=null,b=null,C=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=t&&n!==null&&a!==null&&g!==null,s=D;D=null;let c=s&&o&&g!==null&&!p(g.scrollContainerRef.current)?G():null;if(s)if(o)s.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];s.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=d,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!o||n===null||a===null||g===null)return;let l=c??(p(g.scrollContainerRef.current)?null:G()),u=l?{tops:l,from:n,to:a,row:i}:null;T=u,g.commitRowMove(n,a),u&&requestAnimationFrame(()=>{T===u&&(T=null)})},q=()=>{let e=T;if(T=null,!e)return;let t=g?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(g?.locateDragRow&&e.row!==null&&g.locateDragRow(e.row,i)!==i)return;let a=e=>e===i?r:r<i&&e>=r&&e<i?e+1:i<r&&e>i&&e<=r?e-1:e,o=[],s=new Map;if(h(t).forEach(e=>{let t=n.get(W(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=m.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)}),o.length!==0){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${l}ms ${u}`,e.style.transform=`translateY(${s.get(e)??0}px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``},280)}},J=(e,t)=>{if(g===null||!g.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),_!==null){if(t.pointerId!==C)return;S?.(),K(!1)}_=e,E=g.getDragRow?.(e)??null,C=t.pointerId,v=null,y={x:t.clientX,y:t.clientY},b={x:t.clientX,y:t.clientY},x=!1,document.body.style.cursor=`grabbing`,k()?(D=z(),O=g.scrollContainerRef.current?.scrollTop??0):F(g.getRowDragLabel(e)),R(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(y={x:e.clientX,y:e.clientY},H())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),window.removeEventListener(`keydown`,c),window.removeEventListener(`blur`,l),S=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),K(!0))}function s(e){e.pointerId===r&&(a(),K(!1))}function c(e){e.key===`Escape`&&(a(),K(!1))}function l(){a(),K(!1)}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),window.addEventListener(`keydown`,c),window.addEventListener(`blur`,l),S=a,H(),w=requestAnimationFrame(U)},Y=e=>{if(_===null||E==null||g?.locateDragRow===void 0)return;let t=g.locateDragRow(E,_);if(D&&D.forEach((e,t)=>{if(!t.isConnected){D?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`));if(n===e.index&&(e.applied===void 0||t.style.transform===e.applied))return;let r=m.exec(t.style.transform);if(!r){D?.delete(t);return}e.index=n,e.baseY=parseFloat(r[1]),e.applied=void 0}),t===null){S?.(),K(!1);return}D&&t!==_&&b!==null&&e!==null&&(b={x:b.x,y:b.y+g.rowMetrics.rowTop(t)-e.rowTop(_)}),t!==_&&(R(null,!1),_=t,R(t,!0)),H()};return{update:e=>{let t=g;g=e,_!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&Y(t.rowMetrics)},onRowDragHandlePointerDown:J,applyReorderSettle:q,dispose:()=>{S?.(),S=null,w!==null&&(cancelAnimationFrame(w),w=null),document.body.style.cursor=``,L(),R(_,!1),_=null,E=null,v=null,D=null,T=null}}};exports.createRowDragController=g;
|
|
@@ -19,6 +19,8 @@ export type RowDragArgs = {
|
|
|
19
19
|
commitRowMove: (fromIndex: number, toIndex: number) => void;
|
|
20
20
|
ghostSlot?: GridResolvedSlot;
|
|
21
21
|
motion?: 'ghost' | 'live';
|
|
22
|
+
getDragRow?: (viewIndex: number) => unknown;
|
|
23
|
+
locateDragRow?: (dragRow: unknown, hint: number) => number | null;
|
|
22
24
|
};
|
|
23
25
|
export type RowDragHandlePointerEvent = {
|
|
24
26
|
button: number;
|