@ishibashi0112/spreadsheet-grid-core 1.0.1 → 1.0.2
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/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -2
- package/dist/controllers/clipboardController.js +26 -26
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +2 -1
- package/dist/controllers/columnAutosizeRunner.js +11 -10
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +176 -171
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +1 -1
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +78 -78
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.d.ts +1 -0
- package/dist/controllers/escapeClaimController.js +11 -5
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +141 -140
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +81 -77
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +36 -29
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +112 -116
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.js +10 -5
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.js +128 -127
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.d.ts +1 -0
- package/dist/controllers/rowEnterController.js +47 -42
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +64 -47
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +1 -0
- package/dist/controllers/viewportSyncController.js +29 -8
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.d.ts +2 -0
- package/dist/engine/filterPopoverCommands.js +15 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +17 -17
- package/dist/engine/gridApi.cjs +2 -2
- package/dist/engine/gridApi.d.ts +1 -0
- package/dist/engine/gridApi.js +11 -11
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +1 -0
- package/dist/engine/rowSelectionCommands.js +21 -12
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +7 -4
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +8 -2
- package/dist/logic/columnAutosize.js +102 -87
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +4 -0
- package/dist/logic/detailRow.js +18 -15
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +29 -29
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.js +9 -2
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +4 -3
- package/dist/logic/find.js +27 -13
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.d.ts +7 -7
- package/dist/logic/gridAsk.js +140 -122
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +2 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/gridState.d.ts +2 -2
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +1 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.js +2 -2
- package/dist/logic/localeTextFilters.cjs +1 -1
- package/dist/logic/localeTextFilters.d.ts +1 -0
- package/dist/logic/localeTextFilters.js +1 -0
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.js +2 -2
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +5 -5
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.js +2 -2
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +1 -0
- package/dist/logic/selectEditorState.js +8 -1
- package/dist/logic/valueFormatters.d.ts +5 -5
- package/dist/logic/verticalGeometry.cjs +1 -1
- package/dist/logic/verticalGeometry.d.ts +1 -0
- package/dist/logic/verticalGeometry.js +12 -8
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +2 -1
- package/dist/model/gridActions.js +3 -2
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +145 -62
- package/dist/model/gridTypes.core.d.ts +319 -298
- package/dist/utils/clipboard.cjs +3 -5
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +25 -22
- package/package.json +1 -1
|
@@ -15,75 +15,75 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
|
|
|
15
15
|
...n,
|
|
16
16
|
filterType: t.filterType
|
|
17
17
|
};
|
|
18
|
-
}, w = () => {
|
|
19
|
-
let
|
|
18
|
+
}, w = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, T = () => {
|
|
19
|
+
let T = null, E = e({
|
|
20
20
|
state: null,
|
|
21
21
|
layout: null
|
|
22
|
-
}),
|
|
23
|
-
let t =
|
|
24
|
-
n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight ||
|
|
22
|
+
}), D = { current: null }, O = { current: null }, k = { current: null }, A = null, j = null, M = null, N = null, P = null, F = null, I = null, L = null, R = (e) => {
|
|
23
|
+
let t = E.getSnapshot(), n = t.layout;
|
|
24
|
+
n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight || E.setSnapshot({
|
|
25
25
|
...t,
|
|
26
26
|
layout: e
|
|
27
27
|
});
|
|
28
|
-
},
|
|
29
|
-
let n =
|
|
28
|
+
}, z = () => T === null ? null : C(T.visibleColumns, E.getSnapshot().state), B = (e) => {
|
|
29
|
+
let n = T?.gridRootRef.current ?? null;
|
|
30
30
|
if (!n) return null;
|
|
31
|
-
let r =
|
|
31
|
+
let r = T?.resolveAnchorColumnKey?.(e) ?? e, i = n.querySelectorAll("[data-ssg-col-key]");
|
|
32
32
|
return Array.from(i).find((e) => e.dataset.ssgColKey === r && !t(n, e)) ?? null;
|
|
33
|
-
},
|
|
34
|
-
let e =
|
|
35
|
-
if (!e || !
|
|
36
|
-
|
|
33
|
+
}, V = () => {
|
|
34
|
+
let e = E.getSnapshot().state;
|
|
35
|
+
if (!e || !A) {
|
|
36
|
+
R(null);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (!
|
|
40
|
-
let t =
|
|
39
|
+
if (!A.isConnected) {
|
|
40
|
+
let t = B(e.columnKey);
|
|
41
41
|
if (t === null) return;
|
|
42
|
-
|
|
42
|
+
A = t;
|
|
43
43
|
}
|
|
44
|
-
let t =
|
|
44
|
+
let t = A.getBoundingClientRect(), n = z()?.filterType, r = n === "numberSet" || n === "textSet" || n === "dateSet" ? S : n === "set" ? x : b, { top: i, left: a, maxHeight: o } = h({
|
|
45
45
|
anchorTop: t.top,
|
|
46
46
|
anchorBottom: t.bottom,
|
|
47
47
|
anchorRight: t.right,
|
|
48
48
|
viewportWidth: window.innerWidth,
|
|
49
49
|
viewportHeight: window.innerHeight,
|
|
50
50
|
popupWidth: _,
|
|
51
|
-
popupHeight:
|
|
51
|
+
popupHeight: j ?? r,
|
|
52
52
|
offsetY: y,
|
|
53
53
|
viewportMargin: v
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
R({
|
|
56
56
|
top: i,
|
|
57
57
|
left: a,
|
|
58
58
|
width: _,
|
|
59
59
|
maxHeight: o
|
|
60
60
|
});
|
|
61
|
-
}, V = () => {
|
|
62
|
-
N !== null && (cancelAnimationFrame(N), N = null), P !== null && (cancelAnimationFrame(P), P = null);
|
|
63
61
|
}, H = () => {
|
|
64
|
-
|
|
65
|
-
}, U = (
|
|
66
|
-
|
|
62
|
+
P !== null && (cancelAnimationFrame(P), P = null), F !== null && (cancelAnimationFrame(F), F = null);
|
|
63
|
+
}, U = () => {
|
|
64
|
+
M?.disconnect(), M = null, N = null;
|
|
65
|
+
}, W = (e) => {
|
|
66
|
+
E.setSnapshot({
|
|
67
67
|
state: null,
|
|
68
68
|
layout: null
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
onResize:
|
|
72
|
-
onScroll:
|
|
73
|
-
isInside: (e) => !g(e,
|
|
74
|
-
onOutsidePointerDown: (e) =>
|
|
75
|
-
getGridRoot: () =>
|
|
76
|
-
onGridHidden: () =>
|
|
69
|
+
}), A = null, O.current = null, k.current = null, j = null, K.detach(), U(), H(), I = null, T !== null && e && a(T.gridRootRef);
|
|
70
|
+
}, G = () => W(!0), K = r({
|
|
71
|
+
onResize: V,
|
|
72
|
+
onScroll: V,
|
|
73
|
+
isInside: (e) => !g(e, D.current),
|
|
74
|
+
onOutsidePointerDown: (e) => W(T !== null && i(T.gridRootRef, e)),
|
|
75
|
+
getGridRoot: () => T?.gridRootRef.current ?? null,
|
|
76
|
+
onGridHidden: () => W(!1),
|
|
77
77
|
onKeyDown: (e) => {
|
|
78
|
-
e.key !== "Escape" ||
|
|
78
|
+
e.key !== "Escape" || D.current !== null || (e.preventDefault(), G());
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
81
|
-
if (
|
|
82
|
-
let { gridRootRef: t, resolveColumnFilterType: r, columnFilterValues: i } =
|
|
83
|
-
n(t.current),
|
|
80
|
+
}), q = (e) => {
|
|
81
|
+
if (T === null || !T.enableColumnFilter) return;
|
|
82
|
+
let { gridRootRef: t, resolveColumnFilterType: r, columnFilterValues: i } = T;
|
|
83
|
+
n(t.current), A = B(e.key);
|
|
84
84
|
let a = e.filterType === "auto" && r ? r(e) : e.filterType ?? "text", h = i[e.key], g = a === "number" ? d(c(h) ? h : void 0) : a === "numberSet" ? f(l(h) ? h.condition : void 0) : null, _ = a === "textSet" ? p(u(h) ? h.condition : void 0) : null, v = a === "dateSet" ? m(s(h) ? h.condition : void 0) : null;
|
|
85
|
-
|
|
86
|
-
...
|
|
85
|
+
E.setSnapshot({
|
|
86
|
+
...E.getSnapshot(),
|
|
87
87
|
state: {
|
|
88
88
|
columnKey: e.key,
|
|
89
89
|
filterType: a,
|
|
@@ -92,47 +92,51 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
|
|
|
92
92
|
textDraft: _,
|
|
93
93
|
dateDraft: v
|
|
94
94
|
}
|
|
95
|
-
}),
|
|
96
|
-
},
|
|
97
|
-
let t =
|
|
98
|
-
t.state &&
|
|
95
|
+
}), V(), K.attach();
|
|
96
|
+
}, J = (e) => {
|
|
97
|
+
let t = E.getSnapshot();
|
|
98
|
+
t.state && E.setSnapshot({
|
|
99
99
|
...t,
|
|
100
100
|
state: {
|
|
101
101
|
...t.state,
|
|
102
102
|
...e
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
},
|
|
106
|
-
let e =
|
|
107
|
-
if (!(
|
|
108
|
-
|
|
105
|
+
}, Y = () => {
|
|
106
|
+
let e = D.current;
|
|
107
|
+
if (!(E.getSnapshot().layout !== null && e !== null) || typeof ResizeObserver > "u") {
|
|
108
|
+
U();
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
let e =
|
|
113
|
-
e === null || e ===
|
|
114
|
-
}),
|
|
115
|
-
},
|
|
116
|
-
let { state: e, layout: t } =
|
|
111
|
+
N !== e && (U(), M = new ResizeObserver(() => {
|
|
112
|
+
let e = D.current?.getBoundingClientRect().height ?? null;
|
|
113
|
+
e === null || e === j || (j = e, V());
|
|
114
|
+
}), M.observe(e), N = e);
|
|
115
|
+
}, X = () => {
|
|
116
|
+
let { state: e, layout: t } = E.getSnapshot(), n = z();
|
|
117
117
|
if (!e || !n || !t) {
|
|
118
|
-
|
|
118
|
+
H(), I = null;
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
121
|
+
if (D.current === null) {
|
|
122
|
+
H(), I = null;
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
let r =
|
|
126
|
-
if (!r &&
|
|
127
|
-
|
|
125
|
+
let r = L !== T?.visibleColumns, i = `${e.columnKey}|${e.filterType}|${t.top}|${t.left}|${t.width}`;
|
|
126
|
+
if (!r && I === i) return;
|
|
127
|
+
I = i, L = T?.visibleColumns ?? null, H();
|
|
128
128
|
let a = n.filterType ?? "text";
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
129
|
+
P = requestAnimationFrame(() => {
|
|
130
|
+
P = null, F = requestAnimationFrame(() => {
|
|
131
|
+
if (F = null, a === "select") {
|
|
132
|
+
k.current?.focus();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (w()) {
|
|
136
|
+
D.current?.focus({ preventScroll: !0 });
|
|
133
137
|
return;
|
|
134
138
|
}
|
|
135
|
-
let e =
|
|
139
|
+
let e = O.current;
|
|
136
140
|
if (e && (e.focus(), e.type === "text")) {
|
|
137
141
|
let t = e.value.length;
|
|
138
142
|
e.setSelectionRange(t, t);
|
|
@@ -142,23 +146,23 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
|
|
|
142
146
|
};
|
|
143
147
|
return {
|
|
144
148
|
update: (e) => {
|
|
145
|
-
|
|
149
|
+
T = e, Y(), X();
|
|
146
150
|
},
|
|
147
|
-
subscribe:
|
|
148
|
-
getSnapshot:
|
|
149
|
-
panelRef:
|
|
150
|
-
textInputRef:
|
|
151
|
-
selectRef:
|
|
152
|
-
open:
|
|
153
|
-
close:
|
|
154
|
-
updateDraft: (e) =>
|
|
155
|
-
updateNumberDraft: (e) =>
|
|
156
|
-
updateTextDraft: (e) =>
|
|
157
|
-
updateDateDraft: (e) =>
|
|
151
|
+
subscribe: E.subscribe,
|
|
152
|
+
getSnapshot: E.getSnapshot,
|
|
153
|
+
panelRef: D,
|
|
154
|
+
textInputRef: O,
|
|
155
|
+
selectRef: k,
|
|
156
|
+
open: q,
|
|
157
|
+
close: G,
|
|
158
|
+
updateDraft: (e) => J({ draftValue: e }),
|
|
159
|
+
updateNumberDraft: (e) => J({ numberDraft: e }),
|
|
160
|
+
updateTextDraft: (e) => J({ textDraft: e }),
|
|
161
|
+
updateDateDraft: (e) => J({ dateDraft: e }),
|
|
158
162
|
dispose: () => {
|
|
159
|
-
|
|
163
|
+
K.detach(), U(), H();
|
|
160
164
|
}
|
|
161
165
|
};
|
|
162
166
|
};
|
|
163
167
|
//#endregion
|
|
164
|
-
export {
|
|
168
|
+
export { T as createFilterPopoverController, C as resolveOpenedFilterColumn };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=5e4,o=new Map,s=[],c=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex&&e.columnKey===r.columnKey&&e.start===r.start&&e.length===r.length}),l=()=>{let i=null,l=0,u=null,d=!1,f=null,p=e.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),m=e=>{p.setSnapshot({...p.getSnapshot(),...e})},h=null,g=()=>{let e=p.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};h!==null&&h.query===t.query&&h.matchCount===t.matchCount&&h.currentIndex===t.currentIndex&&h.open===t.open||(h=t,i?.onChange?.(t))},_=()=>{let e=p.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},v=()=>{l+=1,f=null,u=null,d=!1,m({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},y=(e,o=!1)=>{let h=i,b=p.getSnapshot();if(!h||!b.open||b.query.length===0){v(),g();return}l+=1;let x=l,{rowModel:S,columns:C,caseSensitive:w}=h,T=b.query,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=5e4,o=new Map,s=[],c=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex&&e.columnKey===r.columnKey&&e.start===r.start&&e.length===r.length}),l=()=>{let i=null,l=0,u=null,d=!1,f=null,p=e.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),m=e=>{p.setSnapshot({...p.getSnapshot(),...e})},h=null,g=()=>{let e=p.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};h!==null&&h.query===t.query&&h.matchCount===t.matchCount&&h.currentIndex===t.currentIndex&&h.open===t.open||(h=t,i?.onChange?.(t))},_=()=>{let e=p.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},v=()=>{l+=1,f=null,u=null,d=!1,m({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},y=(e,o=!1)=>{let h=i,b=p.getSnapshot();if(!h||!b.open||b.query.length===0){v(),g();return}l+=1;let x=l,{rowModel:S,columns:C,caseSensitive:w}=h,T=h.conditionalFormat!==!1,E=b.query,D=f!==null&&f.query===E&&f.caseSensitive===w;f={rowModel:S,columns:C,query:E,caseSensitive:w,conditionalFormatShown:T},(o||u===null||u.columns!==C||u.query!==E||u.caseSensitive!==w||u.conditionalFormatShown!==T)&&(u={columns:C,query:E,caseSensitive:w,conditionalFormatShown:T,byRow:new WeakMap});let O=u.byRow,k=0,A=e||d;d=A;let j=b.currentIndex===null?null:b.matches[b.currentIndex]??null,M=[],N=!1,P=S.getRowCount(),F=P>a,I=(e,t)=>{let i=[];return C.forEach((a,o)=>{if(n.isSyntheticColumnKey(a.key)||!r.isFindableColumn(a,T))return;let s=r.resolveFindCellText(a,e,!T||a.conditionalFormat?.chips===void 0?void 0:{rowIndex:t,sourceRowIndex:S.getSourceIndex(t)??t,rowKey:S.getRowKey(t)??t,colIndex:o});for(let e of r.findRangesInText(s,E,w))i.push({colIndex:o,columnKey:String(a.key),start:e.start,length:e.length})}),i.length===0?s:i};!D&&!b.scanning&&m({scanning:!0}),t.runChunked(P,e=>{if(N)return;let t=S.getRow(e);if(t===void 0)return;let n;F&&typeof t==`object`&&t?(n=O.get(t),n===void 0?(n=I(t,e),O.set(t,n)):k+=1):n=I(t,e);for(let t of n){if(M.length>=1e4){N=!0;return}M.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==x}).then(e=>{if(!e||l!==x||(d=!1,o&&N===p.getSnapshot().truncated&&c(p.getSnapshot().matches,M)))return;let t=r.resolveCurrentAfterRescan(M,j);m({matches:M,index:r.buildFindIndex(M),currentIndex:t,scanning:!1,truncated:N}),g(),A&&_(),!o&&k>0&&y(!1,!0)})},b=()=>{let e=p.getSnapshot();return!i||!e.open||e.query.length===0?!1:f===null||f.rowModel!==i.rowModel||f.columns!==i.columns||f.query!==e.query||f.caseSensitive!==i.caseSensitive||f.conditionalFormatShown!==(i.conditionalFormat!==!1)};return{update:e=>{let t=i;if(i=e,!e.enabled){p.getSnapshot().open&&(m({open:!1,query:``}),v(),g());return}t!==e&&b()&&y(!1)},open:e=>{if(!i?.enabled)return;let t=p.getSnapshot(),n=e??t.query;m({open:!0,query:n}),n!==t.query||!t.open?y(!0):g()},close:()=>{p.getSnapshot().open&&(m({open:!1,query:``}),v(),g())},setQuery:e=>{let t=p.getSnapshot();!t.open||e===t.query||(m({query:e}),y(!0))},next:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);m({currentIndex:t}),g(),_()},prev:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);m({currentIndex:t}),g(),_()},subscribe:p.subscribe,getSnapshot:p.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
|
|
@@ -13,6 +13,7 @@ export type FindArgs<T> = {
|
|
|
13
13
|
caseSensitive: boolean;
|
|
14
14
|
onNavigate: (rowIndex: number, colIndex: number) => void;
|
|
15
15
|
onChange?: (params: FindChangeParams) => void;
|
|
16
|
+
conditionalFormat?: boolean | undefined;
|
|
16
17
|
};
|
|
17
18
|
export type FindSnapshot = {
|
|
18
19
|
open: boolean;
|
|
@@ -48,45 +48,52 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
m += 1;
|
|
51
|
-
let T = m, { rowModel: E, columns: D, caseSensitive: O } = d, k = b.query,
|
|
51
|
+
let T = m, { rowModel: E, columns: D, caseSensitive: O } = d, k = d.conditionalFormat !== !1, A = b.query, j = _ !== null && _.query === A && _.caseSensitive === O;
|
|
52
52
|
_ = {
|
|
53
53
|
rowModel: E,
|
|
54
54
|
columns: D,
|
|
55
|
-
query:
|
|
56
|
-
caseSensitive: O
|
|
57
|
-
|
|
55
|
+
query: A,
|
|
56
|
+
caseSensitive: O,
|
|
57
|
+
conditionalFormatShown: k
|
|
58
|
+
}, (c || h === null || h.columns !== D || h.query !== A || h.caseSensitive !== O || h.conditionalFormatShown !== k) && (h = {
|
|
58
59
|
columns: D,
|
|
59
|
-
query:
|
|
60
|
+
query: A,
|
|
60
61
|
caseSensitive: O,
|
|
62
|
+
conditionalFormatShown: k,
|
|
61
63
|
byRow: /* @__PURE__ */ new WeakMap()
|
|
62
64
|
});
|
|
63
|
-
let
|
|
64
|
-
g =
|
|
65
|
-
let
|
|
66
|
-
let
|
|
67
|
-
return D.forEach((
|
|
68
|
-
if (n(
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
let M = h.byRow, N = 0, P = e || g;
|
|
66
|
+
g = P;
|
|
67
|
+
let F = b.currentIndex === null ? null : b.matches[b.currentIndex] ?? null, I = [], L = !1, R = E.getRowCount(), z = R > u, B = (e, t) => {
|
|
68
|
+
let r = [];
|
|
69
|
+
return D.forEach((o, c) => {
|
|
70
|
+
if (n(o.key) || !a(o, k)) return;
|
|
71
|
+
let l = s(o, e, !k || o.conditionalFormat?.chips === void 0 ? void 0 : {
|
|
72
|
+
rowIndex: t,
|
|
73
|
+
sourceRowIndex: E.getSourceIndex(t) ?? t,
|
|
74
|
+
rowKey: E.getRowKey(t) ?? t,
|
|
75
|
+
colIndex: c
|
|
76
|
+
});
|
|
77
|
+
for (let e of i(l, A, O)) r.push({
|
|
78
|
+
colIndex: c,
|
|
79
|
+
columnKey: String(o.key),
|
|
73
80
|
start: e.start,
|
|
74
81
|
length: e.length
|
|
75
82
|
});
|
|
76
|
-
}),
|
|
83
|
+
}), r.length === 0 ? f : r;
|
|
77
84
|
};
|
|
78
|
-
!
|
|
79
|
-
if (
|
|
85
|
+
!j && !b.scanning && y({ scanning: !0 }), t(R, (e) => {
|
|
86
|
+
if (L) return;
|
|
80
87
|
let t = E.getRow(e);
|
|
81
88
|
if (t === void 0) return;
|
|
82
89
|
let n;
|
|
83
|
-
|
|
90
|
+
z && typeof t == "object" && t ? (n = M.get(t), n === void 0 ? (n = B(t, e), M.set(t, n)) : N += 1) : n = B(t, e);
|
|
84
91
|
for (let t of n) {
|
|
85
|
-
if (
|
|
86
|
-
|
|
92
|
+
if (I.length >= 1e4) {
|
|
93
|
+
L = !0;
|
|
87
94
|
return;
|
|
88
95
|
}
|
|
89
|
-
|
|
96
|
+
I.push({
|
|
90
97
|
rowIndex: e,
|
|
91
98
|
colIndex: t.colIndex,
|
|
92
99
|
columnKey: t.columnKey,
|
|
@@ -95,19 +102,19 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
}, { isCancelled: () => m !== T }).then((e) => {
|
|
98
|
-
if (!e || m !== T || (g = !1, c &&
|
|
99
|
-
let t = o(
|
|
105
|
+
if (!e || m !== T || (g = !1, c && L === v.getSnapshot().truncated && p(v.getSnapshot().matches, I))) return;
|
|
106
|
+
let t = o(I, F);
|
|
100
107
|
y({
|
|
101
|
-
matches:
|
|
102
|
-
index: r(
|
|
108
|
+
matches: I,
|
|
109
|
+
index: r(I),
|
|
103
110
|
currentIndex: t,
|
|
104
111
|
scanning: !1,
|
|
105
|
-
truncated:
|
|
106
|
-
}), x(),
|
|
112
|
+
truncated: L
|
|
113
|
+
}), x(), P && S(), !c && N > 0 && w(!1, !0);
|
|
107
114
|
});
|
|
108
115
|
}, T = () => {
|
|
109
116
|
let e = v.getSnapshot();
|
|
110
|
-
return !l || !e.open || e.query.length === 0 ? !1 : _ === null || _.rowModel !== l.rowModel || _.columns !== l.columns || _.query !== e.query || _.caseSensitive !== l.caseSensitive;
|
|
117
|
+
return !l || !e.open || e.query.length === 0 ? !1 : _ === null || _.rowModel !== l.rowModel || _.columns !== l.columns || _.query !== e.query || _.caseSensitive !== l.caseSensitive || _.conditionalFormatShown !== (l.conditionalFormat !== !1);
|
|
111
118
|
};
|
|
112
119
|
return {
|
|
113
120
|
update: (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs")
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/domGuards.cjs"),a=require("./escapeClaimController.cjs");var o=10,s=(e,t,n,r)=>{if(!e.getLabelRow)return t;let i=e.getRowCount(),a=t;for(;a>=0&&a<i&&e.getLabelRow(a);)a+=n;return a>=0&&a<i?a:r},c=e=>s(e,0,1,0),l=e=>t.resolveFirstDataColIndex(e),u=(e,t)=>({row:c(e),col:l(t)}),d=()=>{let t=null,d=e=>{t=e},f=(e,t)=>s(e,t,-1,s(e,t,1,t)),p=e=>{let t=e.getRowCount()-1;return s(e,t,-1,t)},m=(e,r,i)=>{if(t===null)return;let{uiState:a,dispatch:o}=t;if(i){let t=a.selection?.type===`cell`?a.selection.range.start:e;o(n.gridActions.startSelection(t)),o(n.gridActions.updateSelection(r)),o(n.gridActions.endSelection()),o(n.gridActions.activateCell(r));return}o(n.gridActions.startSelection(r)),o(n.gridActions.endSelection()),o(n.gridActions.activateCell(r))},h=()=>{if(t===null||t.uiState.activeCell)return!1;let{rowModel:e,visibleColumns:n}=t;if(e.getRowCount()===0||n.length===0)return!0;let r=u(e,n);return m(r,r,!1),!0},g=e=>{let n=t?.uiState;return e&&n?.selection?.type===`cell`?n.selection.range.end:n?.activeCell??{row:0,col:0}},_=(e,n,i)=>{if(t===null)return;let{rowModel:a,visibleColumns:o}=t,c=a.getRowCount();if(c===0||o.length===0||h())return;let l=g(i),u=r.clamp(l.row+e,0,c-1);u=e===0?f(a,u):s(a,u,e>0?1:-1,l.row);let d={row:u,col:r.clamp(l.col+n,0,o.length-1)};m(l,d,i)},v=(e,n)=>{if(t===null)return;let{uiState:i,rowModel:a,visibleColumns:o}=t;if(a.getRowCount()===0||o.length===0)return;let s=i.activeCell?g(n):{row:c(a),col:l(o)},u=e(s,a,o);m(s,{row:f(a,r.clamp(u.row,0,a.getRowCount()-1)),col:r.clamp(u.col,0,o.length-1)},n&&i.activeCell!==null)},y=(e,n,i)=>{let a=n.getRowCount(),c=t?.resolvePageRow?t.resolvePageRow(e.row,i):e.row+i*o,l=r.clamp(i>0?Math.max(c,e.row+1):Math.min(c,e.row-1),0,a-1),u=s(n,l,i,-1);return u>=0?u:s(n,l,i>0?-1:1,e.row)};return{update:d,handleKeyDown:async r=>{if(t===null)return;let{uiState:o,rowModel:s,visibleColumns:u,readOnly:d,canEditCell:f,setEditorInitialValue:m,dispatch:g,handleCopy:b,openFind:x,handleCellDoubleClick:S,isWholeGridSelected:C,selectEntireGrid:w,onUndo:T,onRedo:E,onClearSelection:D,enableClearOnDelete:O,onToggleCheckboxCell:k,onToggleGroup:A,onToggleDetailRow:j}=t;if(i.shouldIgnoreGridKeydown(r.target)||o.editingCell||r.isComposing&&i.isImeInputTarget(r.target))return;if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`c`){r.preventDefault(),await b();return}if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`f`&&x){r.preventDefault(),x();return}if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`a`){if(r.preventDefault(),C){g(n.gridActions.clearSelection()),g(n.gridActions.activateCell(null));return}w();return}if((r.ctrlKey||r.metaKey)&&!r.isComposing){if(r.key.toLowerCase()===`z`){r.preventDefault(),r.shiftKey?E():T();return}if(r.key.toLowerCase()===`y`&&!r.shiftKey){r.preventDefault(),E();return}}let M=r.ctrlKey||r.metaKey;if(r.key===`ArrowDown`&&r.altKey&&!M&&!r.shiftKey&&o.activeCell&&t.openColumnMenu?.(o.activeCell.col)){r.preventDefault();return}if(M&&!r.altKey&&(r.key===`ArrowUp`||r.key===`ArrowDown`)){r.preventDefault();let e=r.key===`ArrowDown`;v((t,n)=>({row:e?p(n):c(n),col:t.col}),r.shiftKey);return}if(M&&!r.altKey&&(r.key===`ArrowLeft`||r.key===`ArrowRight`)){r.preventDefault();let e=r.key===`ArrowRight`;v((t,n,r)=>({row:t.row,col:e?r.length-1:l(r)}),r.shiftKey);return}if((r.key===`Home`||r.key===`End`)&&!r.altKey){r.preventDefault();let e=r.key===`End`;v((t,n,r)=>({row:M?e?p(n):c(n):t.row,col:e?r.length-1:l(r)}),r.shiftKey);return}if((r.key===`PageDown`||r.key===`PageUp`)&&!M&&!r.altKey){if(r.preventDefault(),h())return;let e=r.key===`PageDown`?1:-1;v((t,n)=>({row:y(t,n,e),col:t.col}),r.shiftKey);return}if(r.key===`ArrowUp`){r.preventDefault(),_(-1,0,r.shiftKey);return}if(r.key===`ArrowDown`){r.preventDefault(),_(1,0,r.shiftKey);return}if(r.key===`ArrowLeft`){r.preventDefault(),_(0,-1,r.shiftKey);return}if(r.key===`ArrowRight`){r.preventDefault(),_(0,1,r.shiftKey);return}if(r.key===`Tab`){if(!o.activeCell&&!r.shiftKey){if(t.rowModel.getRowCount()===0||t.visibleColumns.length===0)return;r.preventDefault(),h();return}let e=o.activeCell?.col??0;if(r.shiftKey?e<=l(t.visibleColumns):e>=t.visibleColumns.length-1){!r.shiftKey&&o.activeCell&&t.onTabPastLastColumn?.(o.activeCell.row)&&r.preventDefault();return}r.preventDefault(),_(0,r.shiftKey?-1:1,!1);return}if(r.key===`Escape`){a.isClearableSelection(o.selection)&&r.preventDefault(),g(n.gridActions.clearSelection());return}if((r.key===`Delete`||r.key===`Backspace`)&&O){r.preventDefault(),D();return}if((r.key===`Enter`||r.key===` `)&&o.activeCell){let e=s.getGroupRow?.(o.activeCell.row);if(e){r.preventDefault(),A(e.groupKey);return}if(j&&u[o.activeCell.col]?.key===`__ssg_detail_toggle__`&&j(o.activeCell)){r.preventDefault();return}}if(r.key===`Enter`||r.key===`F2`){if(r.preventDefault(),o.activeCell){S(o.activeCell);return}r.key===`Enter`&&h();return}if(r.key===` `&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&r.preventDefault(),i.isPrintableKey(r)&&o.activeCell){let t=s.getRow(o.activeCell.row),i=u[o.activeCell.col];if(!t||!i||!e.isViewCellEditable({readOnly:d,canEditCell:f},s,o.activeCell.row,o.activeCell.col,t,i))return;if(i.editor?.type===`checkbox`){r.preventDefault(),r.key===` `&&k(o.activeCell);return}r.preventDefault(),m(r.key),g(n.gridActions.startEdit(o.activeCell))}}}};exports.createKeyboardController=d,exports.resolveFirstDataCell=u;
|