@ishibashi0112/spreadsheet-grid-core 0.42.0 → 0.44.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/imeInputController.cjs +1 -0
- package/dist/controllers/imeInputController.d.ts +25 -0
- package/dist/controllers/imeInputController.js +93 -0
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +41 -41
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +2 -2
- package/dist/controllers/pointerInteractionsController.js +18 -17
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.d.ts +5 -1
- package/dist/engine/createGridEngine.js +44 -40
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.js +199 -183
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +23 -1
- package/dist/engine/notifiers.js +48 -4
- package/dist/logic/cellNote.cjs +1 -0
- package/dist/logic/cellNote.d.ts +2 -0
- package/dist/logic/cellNote.js +4 -0
- package/dist/logic/cellRef.cjs +1 -0
- package/dist/logic/cellRef.d.ts +3 -0
- package/dist/logic/cellRef.js +22 -0
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +2 -0
- package/dist/logic/domGuards.js +2 -2
- package/dist/logic/imeInput.cjs +1 -0
- package/dist/logic/imeInput.d.ts +8 -0
- package/dist/logic/imeInput.js +16 -0
- package/dist/model/gridTypes.core.d.ts +84 -0
- package/dist/model/gridTypes.unbound.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-ime-input--composing`,t=(e,t,n)=>{let r=e.querySelectorAll(`.ssg-body-row[data-row-index="${t.row}"]`);for(let e of Array.from(r)){let t=e.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(t))if(e.getAttribute(`data-ssg-col-key`)===n)return e}return null},n=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,r=()=>{let r=null,i=null,a=null,o=null,s=!1,c=null,l=!1,u=!1,d=!1,f=null,p=()=>r?.gridRootRef.current??null,m=()=>{i&&i.ownerDocument.activeElement!==i&&i.focus({preventScroll:!0})},h=(e,n)=>{let a=p(),o=r?.resolveCell(e)??null;if(!i||!a||!o)return!1;let s=t(a,e,o.colKey);if(!s)return!1;let c=a.getBoundingClientRect(),l=s.getBoundingClientRect();return i.style.left=`${l.left-c.left-a.clientLeft}px`,i.style.top=`${l.top-c.top-a.clientTop}px`,i.style.width=`${l.width}px`,i.style.height=`${l.height}px`,i.style.textAlign=n&&o.align?o.align:``,!0},g=()=>{i&&(i.classList.remove(e),i.value=``,i.style.textAlign=``)},_=e=>{r===null||!r.enabled||r.editing||u||e.target===a&&m()},v=()=>{if(r===null||!r.enabled||r.editing||r.activeCell===null){c=null;return}let t=r.activeCell,n=r.canStartEdit(t);c={cell:t,allowed:n},d=!1,n&&(h(t,!0),f=t,i?.classList.add(e))},y=e=>{let t=c;c=null;let n=d;if(d=!1,!i||t===null||!t.allowed||n){g();return}let a=i.value||e.data||``;queueMicrotask(()=>{let e=i;if(r===null||!r.enabled||!e||a===``||e.ownerDocument.activeElement!==e||!r.canStartEdit(t.cell)){g();return}l=!0,r.startEdit(t.cell,a),requestAnimationFrame(()=>{l&&r!==null&&!r.editing&&(l=!1,g())})})},b=()=>{c===null&&!l&&i&&(i.value=``)},x=e=>{if(e.target!==i||e.key!==`Tab`||e.defaultPrevented||e.isComposing)return;let t=p();if(t){u=!0;try{t.focus({preventScroll:!0})}finally{u=!1}}},S=()=>{c!==null&&(d=!0)},C=e=>{a!==e&&(a?.removeEventListener(`focus`,_),a=e,a?.addEventListener(`focus`,_))},w=e=>{typeof document>`u`||s===e||(s=e,e?(document.addEventListener(`keydown`,x),document.addEventListener(`pointerdown`,S,!0)):(document.removeEventListener(`keydown`,x),document.removeEventListener(`pointerdown`,S,!0)))},T=e=>{o!==e&&(o&&(o.removeEventListener(`compositionstart`,v),o.removeEventListener(`compositionend`,y),o.removeEventListener(`input`,b)),o=e,o&&(o.addEventListener(`compositionstart`,v),o.addEventListener(`compositionend`,y),o.addEventListener(`input`,b)))};return{update:e=>{r=e;let t=e.gridRootRef.current;if(C(e.enabled?t:null),T(e.enabled?i:null),w(e.enabled),!e.enabled){c=null,l=!1,g(),i&&t&&i.ownerDocument.activeElement===i&&t.focus({preventScroll:!0});return}l&&e.editing&&(l=!1,g()),!(c!==null||l)&&(e.activeCell!==null&&!n(f,e.activeCell)&&h(e.activeCell,!1)&&(f=e.activeCell),!e.editing&&t&&t.ownerDocument.activeElement===t&&m())},attach:e=>{i!==e&&(i=e,T(r?.enabled?i:null),i&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(i.inputMode=`none`),f=null))},dispose:()=>{T(null),C(null),w(!1),c=null,l=!1,r=null}}};exports.IME_INPUT_COMPOSING_CLASS=e,exports.createImeInputController=r;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CellCoord } from '../model/gridTypes.unbound.js';
|
|
2
|
+
type ReadonlyRef<V> = {
|
|
3
|
+
readonly current: V;
|
|
4
|
+
};
|
|
5
|
+
export declare const IME_INPUT_COMPOSING_CLASS = "ssg-ime-input--composing";
|
|
6
|
+
export type ImeInputCellInfo = {
|
|
7
|
+
colKey: string;
|
|
8
|
+
align?: 'left' | 'center' | 'right';
|
|
9
|
+
};
|
|
10
|
+
export type ImeInputControllerArgs = {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
gridRootRef: ReadonlyRef<HTMLElement | null>;
|
|
13
|
+
editing: boolean;
|
|
14
|
+
activeCell: CellCoord | null;
|
|
15
|
+
resolveCell: (cell: CellCoord) => ImeInputCellInfo | null;
|
|
16
|
+
canStartEdit: (cell: CellCoord) => boolean;
|
|
17
|
+
startEdit: (cell: CellCoord, text: string) => void;
|
|
18
|
+
};
|
|
19
|
+
export type ImeInputController = {
|
|
20
|
+
update: (args: ImeInputControllerArgs) => void;
|
|
21
|
+
attach: (input: HTMLInputElement | null) => void;
|
|
22
|
+
dispose: () => void;
|
|
23
|
+
};
|
|
24
|
+
export declare const createImeInputController: () => ImeInputController;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/controllers/imeInputController.ts
|
|
2
|
+
var e = "ssg-ime-input--composing", t = (e, t, n) => {
|
|
3
|
+
let r = e.querySelectorAll(`.ssg-body-row[data-row-index="${t.row}"]`);
|
|
4
|
+
for (let e of Array.from(r)) {
|
|
5
|
+
let t = e.querySelectorAll(".ssg-body-cell");
|
|
6
|
+
for (let e of Array.from(t)) if (e.getAttribute("data-ssg-col-key") === n) return e;
|
|
7
|
+
}
|
|
8
|
+
return null;
|
|
9
|
+
}, n = (e, t) => e === t || e !== null && t !== null && e.row === t.row && e.col === t.col, r = () => {
|
|
10
|
+
let r = null, i = null, a = null, o = null, s = !1, c = null, l = !1, u = !1, d = !1, f = null, p = () => r?.gridRootRef.current ?? null, m = () => {
|
|
11
|
+
i && i.ownerDocument.activeElement !== i && i.focus({ preventScroll: !0 });
|
|
12
|
+
}, h = (e, n) => {
|
|
13
|
+
let a = p(), o = r?.resolveCell(e) ?? null;
|
|
14
|
+
if (!i || !a || !o) return !1;
|
|
15
|
+
let s = t(a, e, o.colKey);
|
|
16
|
+
if (!s) return !1;
|
|
17
|
+
let c = a.getBoundingClientRect(), l = s.getBoundingClientRect();
|
|
18
|
+
return i.style.left = `${l.left - c.left - a.clientLeft}px`, i.style.top = `${l.top - c.top - a.clientTop}px`, i.style.width = `${l.width}px`, i.style.height = `${l.height}px`, i.style.textAlign = n && o.align ? o.align : "", !0;
|
|
19
|
+
}, g = () => {
|
|
20
|
+
i && (i.classList.remove(e), i.value = "", i.style.textAlign = "");
|
|
21
|
+
}, _ = (e) => {
|
|
22
|
+
r === null || !r.enabled || r.editing || u || e.target === a && m();
|
|
23
|
+
}, v = () => {
|
|
24
|
+
if (r === null || !r.enabled || r.editing || r.activeCell === null) {
|
|
25
|
+
c = null;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let t = r.activeCell, n = r.canStartEdit(t);
|
|
29
|
+
c = {
|
|
30
|
+
cell: t,
|
|
31
|
+
allowed: n
|
|
32
|
+
}, d = !1, n && (h(t, !0), f = t, i?.classList.add(e));
|
|
33
|
+
}, y = (e) => {
|
|
34
|
+
let t = c;
|
|
35
|
+
c = null;
|
|
36
|
+
let n = d;
|
|
37
|
+
if (d = !1, !i || t === null || !t.allowed || n) {
|
|
38
|
+
g();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let a = i.value || e.data || "";
|
|
42
|
+
queueMicrotask(() => {
|
|
43
|
+
let e = i;
|
|
44
|
+
if (r === null || !r.enabled || !e || a === "" || e.ownerDocument.activeElement !== e || !r.canStartEdit(t.cell)) {
|
|
45
|
+
g();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
l = !0, r.startEdit(t.cell, a), requestAnimationFrame(() => {
|
|
49
|
+
l && r !== null && !r.editing && (l = !1, g());
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}, b = () => {
|
|
53
|
+
c === null && !l && i && (i.value = "");
|
|
54
|
+
}, x = (e) => {
|
|
55
|
+
if (e.target !== i || e.key !== "Tab" || e.defaultPrevented || e.isComposing) return;
|
|
56
|
+
let t = p();
|
|
57
|
+
if (t) {
|
|
58
|
+
u = !0;
|
|
59
|
+
try {
|
|
60
|
+
t.focus({ preventScroll: !0 });
|
|
61
|
+
} finally {
|
|
62
|
+
u = !1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, S = () => {
|
|
66
|
+
c !== null && (d = !0);
|
|
67
|
+
}, C = (e) => {
|
|
68
|
+
a !== e && (a?.removeEventListener("focus", _), a = e, a?.addEventListener("focus", _));
|
|
69
|
+
}, w = (e) => {
|
|
70
|
+
typeof document > "u" || s === e || (s = e, e ? (document.addEventListener("keydown", x), document.addEventListener("pointerdown", S, !0)) : (document.removeEventListener("keydown", x), document.removeEventListener("pointerdown", S, !0)));
|
|
71
|
+
}, T = (e) => {
|
|
72
|
+
o !== e && (o && (o.removeEventListener("compositionstart", v), o.removeEventListener("compositionend", y), o.removeEventListener("input", b)), o = e, o && (o.addEventListener("compositionstart", v), o.addEventListener("compositionend", y), o.addEventListener("input", b)));
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
update: (e) => {
|
|
76
|
+
r = e;
|
|
77
|
+
let t = e.gridRootRef.current;
|
|
78
|
+
if (C(e.enabled ? t : null), T(e.enabled ? i : null), w(e.enabled), !e.enabled) {
|
|
79
|
+
c = null, l = !1, g(), i && t && i.ownerDocument.activeElement === i && t.focus({ preventScroll: !0 });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
l && e.editing && (l = !1, g()), !(c !== null || l) && (e.activeCell !== null && !n(f, e.activeCell) && h(e.activeCell, !1) && (f = e.activeCell), !e.editing && t && t.ownerDocument.activeElement === t && m());
|
|
83
|
+
},
|
|
84
|
+
attach: (e) => {
|
|
85
|
+
i !== e && (i = e, T(r?.enabled ? i : null), i && (typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches && (i.inputMode = "none"), f = null));
|
|
86
|
+
},
|
|
87
|
+
dispose: () => {
|
|
88
|
+
T(null), C(null), w(!1), c = null, l = !1, r = null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
export { e as IME_INPUT_COMPOSING_CLASS, r as createImeInputController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../model/gridActions.cjs"),n=require("../logic/geometry.cjs"),r=require("../logic/domGuards.cjs");var i=()=>{let i=null,a=e=>{i=e},o=(e,r,a)=>{if(i===null)return;let{uiState:o,rowModel:s,visibleColumns:c,dispatch:l}=i,u=s.getRowCount();if(u===0||c.length===0)return;let d=o.activeCell??{row:0,col:0},f=n.clamp(d.row+e,0,u-1);if(e!==0&&s.getLabelRow){let t=e>0?1:-1,n=f;for(;n>=0&&n<u&&s.getLabelRow(n);)n+=t;f=n>=0&&n<u?n:d.row}let p={row:f,col:n.clamp(d.col+r,0,c.length-1)};if(a){let e=o.selection?.type===`cell`?o.selection.range.start:d;l(t.gridActions.startSelection(e)),l(t.gridActions.updateSelection(p)),l(t.gridActions.endSelection()),l(t.gridActions.activateCell(p));return}l(t.gridActions.startSelection(p)),l(t.gridActions.endSelection()),l(t.gridActions.activateCell(p))};return{update:a,handleKeyDown:async n=>{if(i===null)return;let{uiState:a,rowModel:s,visibleColumns:c,readOnly:l,canEditCell:u,setEditorInitialValue:d,dispatch:f,handleCopy:p,handleCellDoubleClick:m,isWholeGridSelected:h,selectEntireGrid:g,onUndo:_,onRedo:v,onClearSelection:y,enableClearOnDelete:b,onToggleCheckboxCell:x,onToggleGroup:S}=i;if(!r.shouldIgnoreGridKeydown(n.target)&&!a.editingCell){if((n.ctrlKey||n.metaKey)&&n.key.toLowerCase()===`c`){n.preventDefault(),await p();return}if((n.ctrlKey||n.metaKey)&&n.key.toLowerCase()===`a`){if(n.preventDefault(),h){f(t.gridActions.clearSelection()),f(t.gridActions.activateCell(null));return}g();return}if((n.ctrlKey||n.metaKey)&&!n.isComposing){if(n.key.toLowerCase()===`z`){n.preventDefault(),n.shiftKey?v():_();return}if(n.key.toLowerCase()===`y`&&!n.shiftKey){n.preventDefault(),v();return}}if(n.key===`ArrowUp`){n.preventDefault(),o(-1,0,n.shiftKey);return}if(n.key===`ArrowDown`){n.preventDefault(),o(1,0,n.shiftKey);return}if(n.key===`ArrowLeft`){n.preventDefault(),o(0,-1,n.shiftKey);return}if(n.key===`ArrowRight`){n.preventDefault(),o(0,1,n.shiftKey);return}if(n.key===`Tab`){let e=a.activeCell?.col??0;if(n.shiftKey?e<=0:e>=i.visibleColumns.length-1)return;n.preventDefault(),o(0,n.shiftKey?-1:1,!1);return}if(n.key===`Escape`){n.preventDefault(),f(t.gridActions.clearSelection());return}if((n.key===`Delete`||n.key===`Backspace`)&&b){n.preventDefault(),y();return}if((n.key===`Enter`||n.key===` `)&&a.activeCell){let e=s.getGroupRow?.(a.activeCell.row);if(e){n.preventDefault(),S(e.groupKey);return}}if(n.key===`Enter`||n.key===`F2`){n.preventDefault(),a.activeCell&&m(a.activeCell);return}if(r.isPrintableKey(n)&&a.activeCell){let r=s.getRow(a.activeCell.row),i=c[a.activeCell.col];if(!r||!i||!e.isCellEditable({readOnly:l,canEditCell:u},a.activeCell.row,a.activeCell.col,r,i))return;if(i.editor?.type===`checkbox`){n.preventDefault(),n.key===` `&&x(a.activeCell);return}n.preventDefault(),d(n.key),f(t.gridActions.startEdit(a.activeCell))}}}}};exports.createKeyboardController=i;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../model/gridActions.cjs"),n=require("../logic/geometry.cjs"),r=require("../logic/domGuards.cjs");var i=()=>{let i=null,a=e=>{i=e},o=(e,r,a)=>{if(i===null)return;let{uiState:o,rowModel:s,visibleColumns:c,dispatch:l}=i,u=s.getRowCount();if(u===0||c.length===0)return;let d=o.activeCell??{row:0,col:0},f=n.clamp(d.row+e,0,u-1);if(e!==0&&s.getLabelRow){let t=e>0?1:-1,n=f;for(;n>=0&&n<u&&s.getLabelRow(n);)n+=t;f=n>=0&&n<u?n:d.row}let p={row:f,col:n.clamp(d.col+r,0,c.length-1)};if(a){let e=o.selection?.type===`cell`?o.selection.range.start:d;l(t.gridActions.startSelection(e)),l(t.gridActions.updateSelection(p)),l(t.gridActions.endSelection()),l(t.gridActions.activateCell(p));return}l(t.gridActions.startSelection(p)),l(t.gridActions.endSelection()),l(t.gridActions.activateCell(p))};return{update:a,handleKeyDown:async n=>{if(i===null)return;let{uiState:a,rowModel:s,visibleColumns:c,readOnly:l,canEditCell:u,setEditorInitialValue:d,dispatch:f,handleCopy:p,handleCellDoubleClick:m,isWholeGridSelected:h,selectEntireGrid:g,onUndo:_,onRedo:v,onClearSelection:y,enableClearOnDelete:b,onToggleCheckboxCell:x,onToggleGroup:S}=i;if(!r.shouldIgnoreGridKeydown(n.target)&&!a.editingCell&&!(n.isComposing&&r.isImeInputTarget(n.target))){if((n.ctrlKey||n.metaKey)&&n.key.toLowerCase()===`c`){n.preventDefault(),await p();return}if((n.ctrlKey||n.metaKey)&&n.key.toLowerCase()===`a`){if(n.preventDefault(),h){f(t.gridActions.clearSelection()),f(t.gridActions.activateCell(null));return}g();return}if((n.ctrlKey||n.metaKey)&&!n.isComposing){if(n.key.toLowerCase()===`z`){n.preventDefault(),n.shiftKey?v():_();return}if(n.key.toLowerCase()===`y`&&!n.shiftKey){n.preventDefault(),v();return}}if(n.key===`ArrowUp`){n.preventDefault(),o(-1,0,n.shiftKey);return}if(n.key===`ArrowDown`){n.preventDefault(),o(1,0,n.shiftKey);return}if(n.key===`ArrowLeft`){n.preventDefault(),o(0,-1,n.shiftKey);return}if(n.key===`ArrowRight`){n.preventDefault(),o(0,1,n.shiftKey);return}if(n.key===`Tab`){let e=a.activeCell?.col??0;if(n.shiftKey?e<=0:e>=i.visibleColumns.length-1)return;n.preventDefault(),o(0,n.shiftKey?-1:1,!1);return}if(n.key===`Escape`){n.preventDefault(),f(t.gridActions.clearSelection());return}if((n.key===`Delete`||n.key===`Backspace`)&&b){n.preventDefault(),y();return}if((n.key===`Enter`||n.key===` `)&&a.activeCell){let e=s.getGroupRow?.(a.activeCell.row);if(e){n.preventDefault(),S(e.groupKey);return}}if(n.key===`Enter`||n.key===`F2`){n.preventDefault(),a.activeCell&&m(a.activeCell);return}if(r.isPrintableKey(n)&&a.activeCell){let r=s.getRow(a.activeCell.row),i=c[a.activeCell.col];if(!r||!i||!e.isCellEditable({readOnly:l,canEditCell:u},a.activeCell.row,a.activeCell.col,r,i))return;if(i.editor?.type===`checkbox`){n.preventDefault(),n.key===` `&&x(a.activeCell);return}n.preventDefault(),d(n.key),f(t.gridActions.startEdit(a.activeCell))}}}}};exports.createKeyboardController=i;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { isCellEditable as e } from "../utils/permissions.js";
|
|
2
2
|
import { gridActions as t } from "../model/gridActions.js";
|
|
3
3
|
import { clamp as n } from "../logic/geometry.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isImeInputTarget as r, isPrintableKey as i, shouldIgnoreGridKeydown as a } from "../logic/domGuards.js";
|
|
5
5
|
//#region src/controllers/keyboardController.ts
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
if (
|
|
11
|
-
let { uiState:
|
|
6
|
+
var o = () => {
|
|
7
|
+
let o = null, s = (e) => {
|
|
8
|
+
o = e;
|
|
9
|
+
}, c = (e, r, i) => {
|
|
10
|
+
if (o === null) return;
|
|
11
|
+
let { uiState: a, rowModel: s, visibleColumns: c, dispatch: l } = o, u = s.getRowCount();
|
|
12
12
|
if (u === 0 || c.length === 0) return;
|
|
13
|
-
let d =
|
|
13
|
+
let d = a.activeCell ?? {
|
|
14
14
|
row: 0,
|
|
15
15
|
col: 0
|
|
16
16
|
}, f = n(d.row + e, 0, u - 1);
|
|
@@ -24,96 +24,96 @@ var a = () => {
|
|
|
24
24
|
col: n(d.col + r, 0, c.length - 1)
|
|
25
25
|
};
|
|
26
26
|
if (i) {
|
|
27
|
-
let e =
|
|
27
|
+
let e = a.selection?.type === "cell" ? a.selection.range.start : d;
|
|
28
28
|
l(t.startSelection(e)), l(t.updateSelection(p)), l(t.endSelection()), l(t.activateCell(p));
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
l(t.startSelection(p)), l(t.endSelection()), l(t.activateCell(p));
|
|
32
32
|
};
|
|
33
33
|
return {
|
|
34
|
-
update:
|
|
34
|
+
update: s,
|
|
35
35
|
handleKeyDown: async (n) => {
|
|
36
|
-
if (
|
|
37
|
-
let { uiState:
|
|
38
|
-
if (!
|
|
36
|
+
if (o === null) return;
|
|
37
|
+
let { uiState: s, rowModel: l, visibleColumns: u, readOnly: d, canEditCell: f, setEditorInitialValue: p, dispatch: m, handleCopy: h, handleCellDoubleClick: g, isWholeGridSelected: _, selectEntireGrid: v, onUndo: y, onRedo: b, onClearSelection: x, enableClearOnDelete: S, onToggleCheckboxCell: C, onToggleGroup: w } = o;
|
|
38
|
+
if (!a(n.target) && !s.editingCell && !(n.isComposing && r(n.target))) {
|
|
39
39
|
if ((n.ctrlKey || n.metaKey) && n.key.toLowerCase() === "c") {
|
|
40
|
-
n.preventDefault(), await
|
|
40
|
+
n.preventDefault(), await h();
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
if ((n.ctrlKey || n.metaKey) && n.key.toLowerCase() === "a") {
|
|
44
|
-
if (n.preventDefault(),
|
|
45
|
-
|
|
44
|
+
if (n.preventDefault(), _) {
|
|
45
|
+
m(t.clearSelection()), m(t.activateCell(null));
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
v();
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if ((n.ctrlKey || n.metaKey) && !n.isComposing) {
|
|
52
52
|
if (n.key.toLowerCase() === "z") {
|
|
53
|
-
n.preventDefault(), n.shiftKey ?
|
|
53
|
+
n.preventDefault(), n.shiftKey ? b() : y();
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
if (n.key.toLowerCase() === "y" && !n.shiftKey) {
|
|
57
|
-
n.preventDefault(),
|
|
57
|
+
n.preventDefault(), b();
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
if (n.key === "ArrowUp") {
|
|
62
|
-
n.preventDefault(),
|
|
62
|
+
n.preventDefault(), c(-1, 0, n.shiftKey);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (n.key === "ArrowDown") {
|
|
66
|
-
n.preventDefault(),
|
|
66
|
+
n.preventDefault(), c(1, 0, n.shiftKey);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
if (n.key === "ArrowLeft") {
|
|
70
|
-
n.preventDefault(),
|
|
70
|
+
n.preventDefault(), c(0, -1, n.shiftKey);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
if (n.key === "ArrowRight") {
|
|
74
|
-
n.preventDefault(),
|
|
74
|
+
n.preventDefault(), c(0, 1, n.shiftKey);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
if (n.key === "Tab") {
|
|
78
|
-
let e =
|
|
79
|
-
if (n.shiftKey ? e <= 0 : e >=
|
|
80
|
-
n.preventDefault(),
|
|
78
|
+
let e = s.activeCell?.col ?? 0;
|
|
79
|
+
if (n.shiftKey ? e <= 0 : e >= o.visibleColumns.length - 1) return;
|
|
80
|
+
n.preventDefault(), c(0, n.shiftKey ? -1 : 1, !1);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
if (n.key === "Escape") {
|
|
84
|
-
n.preventDefault(),
|
|
84
|
+
n.preventDefault(), m(t.clearSelection());
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
if ((n.key === "Delete" || n.key === "Backspace") &&
|
|
88
|
-
n.preventDefault(),
|
|
87
|
+
if ((n.key === "Delete" || n.key === "Backspace") && S) {
|
|
88
|
+
n.preventDefault(), x();
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
-
if ((n.key === "Enter" || n.key === " ") &&
|
|
92
|
-
let e =
|
|
91
|
+
if ((n.key === "Enter" || n.key === " ") && s.activeCell) {
|
|
92
|
+
let e = l.getGroupRow?.(s.activeCell.row);
|
|
93
93
|
if (e) {
|
|
94
|
-
n.preventDefault(),
|
|
94
|
+
n.preventDefault(), w(e.groupKey);
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
if (n.key === "Enter" || n.key === "F2") {
|
|
99
|
-
n.preventDefault(),
|
|
99
|
+
n.preventDefault(), s.activeCell && g(s.activeCell);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
let r =
|
|
102
|
+
if (i(n) && s.activeCell) {
|
|
103
|
+
let r = l.getRow(s.activeCell.row), i = u[s.activeCell.col];
|
|
104
104
|
if (!r || !i || !e({
|
|
105
|
-
readOnly:
|
|
106
|
-
canEditCell:
|
|
107
|
-
},
|
|
105
|
+
readOnly: d,
|
|
106
|
+
canEditCell: f
|
|
107
|
+
}, s.activeCell.row, s.activeCell.col, r, i)) return;
|
|
108
108
|
if (i.editor?.type === "checkbox") {
|
|
109
|
-
n.preventDefault(), n.key === " " &&
|
|
109
|
+
n.preventDefault(), n.key === " " && C(s.activeCell);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
n.preventDefault(),
|
|
112
|
+
n.preventDefault(), p(n.key), m(t.startEdit(s.activeCell));
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
};
|
|
118
118
|
//#endregion
|
|
119
|
-
export {
|
|
119
|
+
export { o as createKeyboardController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/sorting.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/autoScrollGeometry.cjs"),a=require("../logic/verticalGeometry.cjs");var o=10,s=300,c=()=>{let o=null,s=!1,c=!1,l=null,u=null,d=`mouse`,f=null,p=null,m=!1,h=!1,g=()=>o?.uiState.dragState??null,_=(e,t)=>{if(o===null)return null;let{bodyScrollRef:n,scrollContainerRef:i,leftPaneScrollRef:s,rightPaneScrollRef:c,filteredRowsLength:l,visibleColumnsLength:u,paneLayout:d,leftLeadingWidth:f,centerLeadingWidth:p,rightLeadingWidth:m,headerHeight:h,rowMetrics:g,verticalScaleFactor:_}=o,v=n.current;if(!v||l===0||u===0)return null;let y=v.getBoundingClientRect(),b=a.clientYToRowIndex(v.scrollTop+t-y.top-h,i.current?.scrollTop??0,_,g),x=null,S=s.current;if(x===null&&S&&d.left.entries.length>0){let t=S.getBoundingClientRect();if(e<t.right){let n=e-t.left-f;x=r.findLogicalIndexFromPaneOffset(d.left,n)}}let C=c.current;if(x===null&&C&&d.right.entries.length>0){let t=C.getBoundingClientRect();if(e>=t.left){let n=e-t.left-m;x=r.findLogicalIndexFromPaneOffset(d.right,n)}}if(x===null&&d.center.entries.length>0){let t=v.scrollLeft+e-y.left-p;x=r.findLogicalIndexFromPaneOffset(d.center,Math.max(t,0))}return x===null?null:{row:b,col:r.clamp(x,0,u-1)}},v=(e,t)=>{let r=g();if(o===null||!r||r.type!==`selection`)return;let i=_(e,t);if(i){if(r.selectionKind===`cell`){o.dispatch(n.gridActions.updateSelection(i));return}if(r.selectionKind===`row`){o.dispatch(n.gridActions.updateRowSelection(i.row));return}r.selectionKind===`col`&&o.dispatch(n.gridActions.updateColumnSelection(i.col))}},y=(e,t)=>{if(o===null)return;let{gridRootRef:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/sorting.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/autoScrollGeometry.cjs"),a=require("../logic/verticalGeometry.cjs");var o=10,s=300,c=()=>{let o=null,s=!1,c=!1,l=null,u=null,d=`mouse`,f=null,p=null,m=!1,h=!1,g=()=>o?.uiState.dragState??null,_=(e,t)=>{if(o===null)return null;let{bodyScrollRef:n,scrollContainerRef:i,leftPaneScrollRef:s,rightPaneScrollRef:c,filteredRowsLength:l,visibleColumnsLength:u,paneLayout:d,leftLeadingWidth:f,centerLeadingWidth:p,rightLeadingWidth:m,headerHeight:h,rowMetrics:g,verticalScaleFactor:_}=o,v=n.current;if(!v||l===0||u===0)return null;let y=v.getBoundingClientRect(),b=a.clientYToRowIndex(v.scrollTop+t-y.top-h,i.current?.scrollTop??0,_,g),x=null,S=s.current;if(x===null&&S&&d.left.entries.length>0){let t=S.getBoundingClientRect();if(e<t.right){let n=e-t.left-f;x=r.findLogicalIndexFromPaneOffset(d.left,n)}}let C=c.current;if(x===null&&C&&d.right.entries.length>0){let t=C.getBoundingClientRect();if(e>=t.left){let n=e-t.left-m;x=r.findLogicalIndexFromPaneOffset(d.right,n)}}if(x===null&&d.center.entries.length>0){let t=v.scrollLeft+e-y.left-p;x=r.findLogicalIndexFromPaneOffset(d.center,Math.max(t,0))}return x===null?null:{row:b,col:r.clamp(x,0,u-1)}},v=(e,t)=>{let r=g();if(o===null||!r||r.type!==`selection`)return;let i=_(e,t);if(i){if(r.selectionKind===`cell`){o.dispatch(n.gridActions.updateSelection(i));return}if(r.selectionKind===`row`){o.dispatch(n.gridActions.updateRowSelection(i.row));return}r.selectionKind===`col`&&o.dispatch(n.gridActions.updateColumnSelection(i.col))}},y=(e,t)=>{let r=t.timeStamp;if(o===null)return;let{gridRootRef:i,dispatch:a,enableRangeSelection:s,enableRowSelection:c,onGutterRowSelect:l,onCellDoubleClickRef:d}=o;i.current?.focus({preventScroll:!0});let{target:f}=e;if(f.kind===`cell`){let e=u;if(e&&e.cell.row===f.cell.row&&e.cell.col===f.cell.col&&r-e.time<300){u=null,d.current(f.cell,t);return}u={cell:f.cell,time:r},a(n.gridActions.activateCell(f.cell)),s&&(a(n.gridActions.startSelection(f.cell)),a(n.gridActions.endSelection()));return}if(u=null,f.kind===`row`){if(c){l(f.rowIndex,{shiftKey:!1});return}a(n.gridActions.startRowSelection(f.rowIndex)),a(n.gridActions.endSelection());return}a(n.gridActions.startColumnSelection(f.colIndex)),a(n.gridActions.endSelection())},b=()=>{o!==null&&(c=!1,o.dispatch(n.gridActions.endSelection()),o.dispatch(n.gridActions.endColumnResize()))},x=e=>{o!==null&&(o.pointerClientRef.current={x:e.clientX,y:e.clientY},g()?.type===`columnResize`&&o.dispatch(n.gridActions.updateColumnResize(e.clientX)))},S=e=>{let t=l;t&&(l=null,e.pointerId===t.pointerId&&Math.abs(e.clientX-t.x)<10&&Math.abs(e.clientY-t.y)<10&&y(t,e)),b()},C=()=>{l=null,b()},w=()=>{s||(s=!0,window.addEventListener(`pointermove`,x),window.addEventListener(`pointerup`,S),window.addEventListener(`pointercancel`,C))},T=()=>{s&&(s=!1,window.removeEventListener(`pointermove`,x),window.removeEventListener(`pointerup`,S),window.removeEventListener(`pointercancel`,C))},E=()=>{h=!1,o!==null&&o.autoScrollFrameRef.current!==null&&(cancelAnimationFrame(o.autoScrollFrameRef.current),o.autoScrollFrameRef.current=null)},D=()=>{if(o===null||!h)return;let{scrollContainerRef:e,pointerClientRef:t,autoScrollFrameRef:n}=o,r=e.current,a=t.current;if(!r||!a){n.current=requestAnimationFrame(D);return}if(!m){let e=p;if(e&&!i.hasPointerLeftActivationRadius(e,a,6)){n.current=requestAnimationFrame(D);return}m=!0}let s=r.getBoundingClientRect(),c=i.resolveScrollContentBox({rectLeft:s.left,rectTop:s.top,clientLeft:r.clientLeft,clientTop:r.clientTop,clientWidth:r.clientWidth,clientHeight:r.clientHeight}),l=g(),u=l?.type===`selection`&&l.selectionKind===`col`,d=l?.type===`selection`&&l.selectionKind===`row`,f=u?0:i.resolveAutoScrollAxisDirection(a.y,c.top,c.bottom,24),_=d?0:i.resolveAutoScrollAxisDirection(a.x,c.left,c.right,24),y=i.computeNextScrollPosition(r.scrollTop,f,18,r.scrollHeight-r.clientHeight),b=i.computeNextScrollPosition(r.scrollLeft,_,18,r.scrollWidth-r.clientWidth);(y!==r.scrollTop||b!==r.scrollLeft)&&(r.scrollTo({top:y,left:b,behavior:`auto`}),v(a.x,a.y)),n.current=requestAnimationFrame(D)},O=()=>{let e=g()?.type===`selection`;e&&!h?(h=!0,o!==null&&(o.autoScrollFrameRef.current=requestAnimationFrame(D))):!e&&h&&E()},k=()=>{if(f!==null)return;let e=()=>{if(!c||o===null){f=null;return}let{scrollContainerRef:t,pointerClientRef:n,onGutterRowSelectDrag:r}=o,a=t.current,s=n.current;if(!a||!s){f=requestAnimationFrame(e);return}if(!m){let t=p;if(t&&!i.hasPointerLeftActivationRadius(t,s,6)){f=requestAnimationFrame(e);return}m=!0}let l=a.getBoundingClientRect(),u=i.resolveScrollContentBox({rectLeft:l.left,rectTop:l.top,clientLeft:a.clientLeft,clientTop:a.clientTop,clientWidth:a.clientWidth,clientHeight:a.clientHeight}),d=i.resolveAutoScrollAxisDirection(s.y,u.top,u.bottom,24),h=i.computeNextScrollPosition(a.scrollTop,d,18,a.scrollHeight-a.clientHeight);if(h!==a.scrollTop){a.scrollTo({top:h,left:a.scrollLeft,behavior:`auto`});let e=_(s.x,s.y);e&&r(e.row)}f=requestAnimationFrame(e)};f=requestAnimationFrame(e)},A=(e,t)=>(e.preventDefault(),o===null||e.button!==0?!1:(d=e.pointerType,e.pointerType===`touch`?(l={pointerId:e.pointerId,x:e.clientX,y:e.clientY,target:t},!1):(o.gridRootRef.current?.focus({preventScroll:!0}),o.pointerClientRef.current={x:e.clientX,y:e.clientY},p={x:e.clientX,y:e.clientY},m=!1,!0)));return{update:e=>{o=e,w(),O()},updateSelectionFromPointer:v,handleCellPointerDown:(e,t)=>{!A(t,{kind:`cell`,cell:e})||o===null||(o.dispatch(n.gridActions.activateCell(e)),o.enableRangeSelection&&o.dispatch(n.gridActions.startSelection(e)))},handleCellDoubleClick:(e,t)=>{d===`touch`||o===null||o.onCellDoubleClickRef.current(e,t)},handleCellPointerEnter:(e,t)=>{if(o===null||(o.enableRowHover&&o.setHoveredRowIndex(e.row),!o.enableRangeSelection))return;let r=g();r?.type!==`selection`||r.selectionKind!==`cell`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateSelection(e)))},handleNativeDragStart:e=>{e.preventDefault()},handleRowHeaderPointerDown:(e,t)=>{if(!(!A(t,{kind:`row`,rowIndex:e})||o===null)){if(o.enableRowSelection){c=!0,o.onGutterRowSelect(e,{shiftKey:t.shiftKey}),k();return}o.dispatch(n.gridActions.startRowSelection(e))}},handleRowHeaderPointerEnter:(e,t)=>{if(o===null)return;if(o.enableRowHover&&o.setHoveredRowIndex(e),c){o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.onGutterRowSelectDrag(e);return}let r=g();r?.type!==`selection`||r.selectionKind!==`row`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateRowSelection(e)))},handleColumnHeaderPointerDown:(r,i)=>{if(!(!A(i,{kind:`col`,colIndex:r})||o===null)){if(i.shiftKey&&o.enableSorting){let i=o.orderedColumns[r];if(i&&!t.isSyntheticColumnKey(i.key)){let t=o.uiState.sort,r=t.find(e=>e.columnKey===i.key)?.direction?`desc`:`asc`,a=e.nextSortEntries(t,i.key,r,!0);o.dispatch(a.length===0?n.gridActions.clearSort():n.gridActions.setSort(a))}return}o.dispatch(n.gridActions.startColumnSelection(r))}},handleColumnHeaderPointerEnter:(e,t)=>{if(o===null)return;o.setHoveredRowIndex(null),o.enableColumnHeaderHover&&o.setHoveredColumnIndex(e);let r=g();r?.type!==`selection`||r.selectionKind!==`col`||(o.pointerClientRef.current={x:t.clientX,y:t.clientY},o.dispatch(n.gridActions.updateColumnSelection(e)))},dispose:()=>{T(),E(),f!==null&&(cancelAnimationFrame(f),f=null)}}};exports.TOUCH_DOUBLE_TAP_MS=s,exports.TOUCH_TAP_SLOP_PX=o,exports.createPointerInteractionsController=c;
|
|
@@ -53,13 +53,13 @@ export type PointerInteractionsArgs<T> = {
|
|
|
53
53
|
shiftKey: boolean;
|
|
54
54
|
}) => void;
|
|
55
55
|
onGutterRowSelectDrag: (viewIndex: number) => void;
|
|
56
|
-
onCellDoubleClickRef: ReadonlyRef<(cell: CellCoord) => void>;
|
|
56
|
+
onCellDoubleClickRef: ReadonlyRef<(cell: CellCoord, event: MouseEvent) => void>;
|
|
57
57
|
};
|
|
58
58
|
export type PointerInteractionsController<T> = {
|
|
59
59
|
update: (args: PointerInteractionsArgs<T>) => void;
|
|
60
60
|
updateSelectionFromPointer: (clientX: number, clientY: number) => void;
|
|
61
61
|
handleCellPointerDown: (cell: CellCoord, event: GridPointerEventLike) => void;
|
|
62
|
-
handleCellDoubleClick: (cell: CellCoord) => void;
|
|
62
|
+
handleCellDoubleClick: (cell: CellCoord, event: MouseEvent) => void;
|
|
63
63
|
handleCellPointerEnter: (cell: CellCoord, event: GridPointerEventLike) => void;
|
|
64
64
|
handleNativeDragStart: (event: {
|
|
65
65
|
preventDefault: () => void;
|
|
@@ -50,31 +50,32 @@ var u = 10, d = 300, f = () => {
|
|
|
50
50
|
r.selectionKind === "col" && u.dispatch(n.updateColumnSelection(i.col));
|
|
51
51
|
}
|
|
52
52
|
}, C = (e, t) => {
|
|
53
|
+
let r = t.timeStamp;
|
|
53
54
|
if (u === null) return;
|
|
54
|
-
let { gridRootRef:
|
|
55
|
-
|
|
56
|
-
let { target:
|
|
57
|
-
if (
|
|
55
|
+
let { gridRootRef: i, dispatch: a, enableRangeSelection: o, enableRowSelection: s, onGutterRowSelect: c, onCellDoubleClickRef: l } = u;
|
|
56
|
+
i.current?.focus({ preventScroll: !0 });
|
|
57
|
+
let { target: d } = e;
|
|
58
|
+
if (d.kind === "cell") {
|
|
58
59
|
let e = m;
|
|
59
|
-
if (e && e.cell.row ===
|
|
60
|
-
m = null,
|
|
60
|
+
if (e && e.cell.row === d.cell.row && e.cell.col === d.cell.col && r - e.time < 300) {
|
|
61
|
+
m = null, l.current(d.cell, t);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
m = {
|
|
64
|
-
cell:
|
|
65
|
-
time:
|
|
66
|
-
},
|
|
65
|
+
cell: d.cell,
|
|
66
|
+
time: r
|
|
67
|
+
}, a(n.activateCell(d.cell)), o && (a(n.startSelection(d.cell)), a(n.endSelection()));
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
|
-
if (m = null,
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
if (m = null, d.kind === "row") {
|
|
71
|
+
if (s) {
|
|
72
|
+
c(d.rowIndex, { shiftKey: !1 });
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
a(n.startRowSelection(d.rowIndex)), a(n.endSelection());
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
a(n.startColumnSelection(d.colIndex)), a(n.endSelection());
|
|
78
79
|
}, w = () => {
|
|
79
80
|
u !== null && (f = !1, u.dispatch(n.endSelection()), u.dispatch(n.endColumnResize()));
|
|
80
81
|
}, T = (e) => {
|
|
@@ -84,7 +85,7 @@ var u = 10, d = 300, f = () => {
|
|
|
84
85
|
}, b()?.type === "columnResize" && u.dispatch(n.updateColumnResize(e.clientX)));
|
|
85
86
|
}, E = (e) => {
|
|
86
87
|
let t = p;
|
|
87
|
-
t && (p = null, e.pointerId === t.pointerId && Math.abs(e.clientX - t.x) < 10 && Math.abs(e.clientY - t.y) < 10 && C(t, e
|
|
88
|
+
t && (p = null, e.pointerId === t.pointerId && Math.abs(e.clientX - t.x) < 10 && Math.abs(e.clientY - t.y) < 10 && C(t, e)), w();
|
|
88
89
|
}, D = () => {
|
|
89
90
|
p = null, w();
|
|
90
91
|
}, O = () => {
|
|
@@ -187,8 +188,8 @@ var u = 10, d = 300, f = () => {
|
|
|
187
188
|
cell: e
|
|
188
189
|
}) || u === null || (u.dispatch(n.activateCell(e)), u.enableRangeSelection && u.dispatch(n.startSelection(e)));
|
|
189
190
|
},
|
|
190
|
-
handleCellDoubleClick: (e) => {
|
|
191
|
-
h === "touch" || u === null || u.onCellDoubleClickRef.current(e);
|
|
191
|
+
handleCellDoubleClick: (e, t) => {
|
|
192
|
+
h === "touch" || u === null || u.onCellDoubleClickRef.current(e, t);
|
|
192
193
|
},
|
|
193
194
|
handleCellPointerEnter: (e, t) => {
|
|
194
195
|
if (u === null || (u.enableRowHover && u.setHoveredRowIndex(e.row), !u.enableRangeSelection)) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../controllers/autoHeightMeasurer.cjs"),n=require("../controllers/columnAutosizeRunner.cjs"),r=require("../controllers/debouncedValueStore.cjs"),i=require("../controllers/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../controllers/autoHeightMeasurer.cjs"),n=require("../controllers/columnAutosizeRunner.cjs"),r=require("../controllers/debouncedValueStore.cjs"),i=require("../controllers/imeInputController.cjs"),a=require("../controllers/scrollSyncController.cjs"),o=require("./columnCommands.cjs"),s=require("./columnLayout.cjs"),c=require("../model/gridReducer.cjs"),l=require("../model/gridStore.cjs"),u=require("./rowPipeline.cjs"),d=require("./verticalLayout.cjs"),f=require("./filterPopoverCommands.cjs"),p=require("./rowSelectionCommands.cjs"),m=require("./gridApi.cjs"),h=require("./notifiers.cjs");var g=300,_=g=>{let _=s.createColumnResolver(),v=s.createPaneLayoutResolver(),y=u.createRowPipelineResolver(),b=d.createVerticalLayoutResolver(),x=f.createFilterPopoverDerivedResolver(),S=l.createGridStore(c.createInitialGridUiState()),C=S.getState(),w=r.createDebouncedValueStore(y.resolveServerSideQuery({isServerSide:g.serverSide.isServerSide,globalFilterEnabled:g.serverSide.enableGlobalFilter,globalText:C.filters.globalText,columnFilterEnabled:g.serverSide.enableColumnFilter,columnFilters:C.filters.columnFilters,sortingEnabled:g.serverSide.enableSorting,sort:C.sort}),300),T=t.createAutoHeightMeasurer(),E=a.createScrollSyncController(),D=n.createAutoSizeOnDataTrigger(),O=i.createImeInputController();return{store:S,resolveColumns:_,resolvePaneLayout:v,rowPipeline:y,resolveVerticalLayout:b,resolveFilterPopoverDerived:x,columnCommands:o.createColumnCommands(),filterPopoverCommands:f.createFilterPopoverCommands(),rowSelectionCommands:p.createRowSelectionCommands(),gridApi:m.createGridApi(),hoverRowNotifier:h.createHoverRowNotifier(),detailKeysNotifier:h.createDetailKeysNotifier(),stateChangeNotifier:h.createStateChangeNotifier(),cellEventNotifier:h.createCellEventNotifier(),activeCellNotifier:h.createActiveCellNotifier(),autoHeightMeasurer:T,scrollSync:E,serverSideQueryStore:w,autoSizeOnData:D,imeInput:O,detailIndexCache:e.createDetailIndexCacheHolder(),dispose:()=>{T.dispose(),E.dispose(),w.dispose(),O.dispose()}}};exports.SERVER_SIDE_QUERY_DEBOUNCE_MS=g,exports.createGridEngine=_;
|
|
@@ -4,6 +4,7 @@ import { type AutoHeightMeasurer } from '../controllers/autoHeightMeasurer.js';
|
|
|
4
4
|
import { type ScrollSyncController } from '../controllers/scrollSyncController.js';
|
|
5
5
|
import { type DebouncedValueStore } from '../controllers/debouncedValueStore.js';
|
|
6
6
|
import { type AutoSizeOnDataTrigger } from '../controllers/columnAutosizeRunner.js';
|
|
7
|
+
import { type ImeInputController } from '../controllers/imeInputController.js';
|
|
7
8
|
import { type ColumnResolution, type ColumnResolutionInputs, type PaneLayoutInputs, type PaneLayoutResolution } from './columnLayout.js';
|
|
8
9
|
import { type RowPipelineResolver, type ServerSideQueryResolution } from './rowPipeline.js';
|
|
9
10
|
import { type VerticalLayoutInputs, type VerticalLayoutResolution } from './verticalLayout.js';
|
|
@@ -11,7 +12,7 @@ import { type ColumnCommands } from './columnCommands.js';
|
|
|
11
12
|
import { type FilterPopoverCommands, type FilterPopoverDerived, type FilterPopoverDerivedInputs } from './filterPopoverCommands.js';
|
|
12
13
|
import { type RowSelectionCommands } from './rowSelectionCommands.js';
|
|
13
14
|
import { type GridApi } from './gridApi.js';
|
|
14
|
-
import { type DetailKeysNotifier, type HoverRowNotifier, type StateChangeNotifier } from './notifiers.js';
|
|
15
|
+
import { type ActiveCellNotifier, type CellEventNotifier, type DetailKeysNotifier, type HoverRowNotifier, type StateChangeNotifier } from './notifiers.js';
|
|
15
16
|
export declare const SERVER_SIDE_QUERY_DEBOUNCE_MS = 300;
|
|
16
17
|
export type GridEngineInit<T> = {
|
|
17
18
|
columnInputs: ColumnResolutionInputs<T>;
|
|
@@ -36,10 +37,13 @@ export type GridEngine<T> = {
|
|
|
36
37
|
hoverRowNotifier: HoverRowNotifier;
|
|
37
38
|
detailKeysNotifier: DetailKeysNotifier;
|
|
38
39
|
stateChangeNotifier: StateChangeNotifier<T>;
|
|
40
|
+
cellEventNotifier: CellEventNotifier<T>;
|
|
41
|
+
activeCellNotifier: ActiveCellNotifier<T>;
|
|
39
42
|
autoHeightMeasurer: AutoHeightMeasurer<T>;
|
|
40
43
|
scrollSync: ScrollSyncController;
|
|
41
44
|
serverSideQueryStore: DebouncedValueStore<ServerSideQueryResolution>;
|
|
42
45
|
autoSizeOnData: AutoSizeOnDataTrigger<T>;
|
|
46
|
+
imeInput: ImeInputController;
|
|
43
47
|
detailIndexCache: DetailIndexCacheHolder;
|
|
44
48
|
dispose: () => void;
|
|
45
49
|
};
|
|
@@ -2,51 +2,55 @@ import { createDetailIndexCacheHolder as e } from "../logic/detailRow.js";
|
|
|
2
2
|
import { createAutoHeightMeasurer as t } from "../controllers/autoHeightMeasurer.js";
|
|
3
3
|
import { createAutoSizeOnDataTrigger as n } from "../controllers/columnAutosizeRunner.js";
|
|
4
4
|
import { createDebouncedValueStore as r } from "../controllers/debouncedValueStore.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
5
|
+
import { createImeInputController as i } from "../controllers/imeInputController.js";
|
|
6
|
+
import { createScrollSyncController as a } from "../controllers/scrollSyncController.js";
|
|
7
|
+
import { createColumnCommands as o } from "./columnCommands.js";
|
|
8
|
+
import { createColumnResolver as s, createPaneLayoutResolver as c } from "./columnLayout.js";
|
|
9
|
+
import { createInitialGridUiState as l } from "../model/gridReducer.js";
|
|
10
|
+
import { createGridStore as u } from "../model/gridStore.js";
|
|
11
|
+
import { createRowPipelineResolver as d } from "./rowPipeline.js";
|
|
12
|
+
import { createVerticalLayoutResolver as f } from "./verticalLayout.js";
|
|
13
|
+
import { createFilterPopoverCommands as p, createFilterPopoverDerivedResolver as m } from "./filterPopoverCommands.js";
|
|
14
|
+
import { createRowSelectionCommands as h } from "./rowSelectionCommands.js";
|
|
15
|
+
import { createGridApi as g } from "./gridApi.js";
|
|
16
|
+
import { createActiveCellNotifier as _, createCellEventNotifier as v, createDetailKeysNotifier as y, createHoverRowNotifier as b, createStateChangeNotifier as x } from "./notifiers.js";
|
|
16
17
|
//#region src/engine/createGridEngine.ts
|
|
17
|
-
var
|
|
18
|
-
let
|
|
19
|
-
isServerSide:
|
|
20
|
-
globalFilterEnabled:
|
|
21
|
-
globalText:
|
|
22
|
-
columnFilterEnabled:
|
|
23
|
-
columnFilters:
|
|
24
|
-
sortingEnabled:
|
|
25
|
-
sort:
|
|
26
|
-
}), 300),
|
|
18
|
+
var S = 300, C = (S) => {
|
|
19
|
+
let C = s(), w = c(), T = d(), E = f(), D = m(), O = u(l()), k = O.getState(), A = r(T.resolveServerSideQuery({
|
|
20
|
+
isServerSide: S.serverSide.isServerSide,
|
|
21
|
+
globalFilterEnabled: S.serverSide.enableGlobalFilter,
|
|
22
|
+
globalText: k.filters.globalText,
|
|
23
|
+
columnFilterEnabled: S.serverSide.enableColumnFilter,
|
|
24
|
+
columnFilters: k.filters.columnFilters,
|
|
25
|
+
sortingEnabled: S.serverSide.enableSorting,
|
|
26
|
+
sort: k.sort
|
|
27
|
+
}), 300), j = t(), M = a(), N = n(), P = i();
|
|
27
28
|
return {
|
|
28
|
-
store:
|
|
29
|
-
resolveColumns:
|
|
30
|
-
resolvePaneLayout:
|
|
31
|
-
rowPipeline:
|
|
32
|
-
resolveVerticalLayout:
|
|
33
|
-
resolveFilterPopoverDerived:
|
|
34
|
-
columnCommands:
|
|
35
|
-
filterPopoverCommands:
|
|
36
|
-
rowSelectionCommands:
|
|
37
|
-
gridApi:
|
|
38
|
-
hoverRowNotifier:
|
|
39
|
-
detailKeysNotifier:
|
|
40
|
-
stateChangeNotifier:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
store: O,
|
|
30
|
+
resolveColumns: C,
|
|
31
|
+
resolvePaneLayout: w,
|
|
32
|
+
rowPipeline: T,
|
|
33
|
+
resolveVerticalLayout: E,
|
|
34
|
+
resolveFilterPopoverDerived: D,
|
|
35
|
+
columnCommands: o(),
|
|
36
|
+
filterPopoverCommands: p(),
|
|
37
|
+
rowSelectionCommands: h(),
|
|
38
|
+
gridApi: g(),
|
|
39
|
+
hoverRowNotifier: b(),
|
|
40
|
+
detailKeysNotifier: y(),
|
|
41
|
+
stateChangeNotifier: x(),
|
|
42
|
+
cellEventNotifier: v(),
|
|
43
|
+
activeCellNotifier: _(),
|
|
44
|
+
autoHeightMeasurer: j,
|
|
45
|
+
scrollSync: M,
|
|
46
|
+
serverSideQueryStore: A,
|
|
47
|
+
autoSizeOnData: N,
|
|
48
|
+
imeInput: P,
|
|
45
49
|
detailIndexCache: e(),
|
|
46
50
|
dispose: () => {
|
|
47
|
-
|
|
51
|
+
j.dispose(), M.dispose(), A.dispose(), P.dispose();
|
|
48
52
|
}
|
|
49
53
|
};
|
|
50
54
|
};
|
|
51
55
|
//#endregion
|
|
52
|
-
export {
|
|
56
|
+
export { S as SERVER_SIDE_QUERY_DEBOUNCE_MS, C as createGridEngine };
|