@ishibashi0112/spreadsheet-grid-core 1.7.0 → 1.9.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/activeRowFollowController.cjs +1 -1
- package/dist/controllers/activeRowFollowController.d.ts +1 -0
- package/dist/controllers/activeRowFollowController.js +33 -24
- package/dist/controllers/changeTracker.cjs +1 -0
- package/dist/controllers/changeTracker.d.ts +39 -0
- package/dist/controllers/changeTracker.js +238 -0
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.js +43 -40
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -1
- package/dist/controllers/columnAutosizeRunner.js +12 -11
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +3 -1
- package/dist/controllers/findController.js +80 -75
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +25 -1
- package/dist/controllers/historyController.js +125 -71
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +4 -0
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +1 -0
- package/dist/engine/columnLayout.js +10 -10
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.d.ts +4 -1
- package/dist/engine/createGridEngine.js +48 -41
- package/dist/engine/exportCommands.cjs +2 -2
- package/dist/engine/exportCommands.js +82 -34
- package/dist/engine/features.cjs +1 -1
- package/dist/engine/features.d.ts +16 -0
- package/dist/engine/features.js +25 -1
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +43 -31
- package/dist/engine/gridApi.cjs +9 -7
- package/dist/engine/gridApi.d.ts +23 -2
- package/dist/engine/gridApi.js +248 -96
- package/dist/engine/memo.cjs +1 -1
- package/dist/engine/memo.d.ts +1 -1
- package/dist/engine/memo.js +12 -11
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +9 -1
- package/dist/engine/notifiers.js +23 -8
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +29 -2
- package/dist/engine/rowPipeline.js +76 -50
- package/dist/engine/treeStage.cjs +1 -0
- package/dist/engine/treeStage.d.ts +46 -0
- package/dist/engine/treeStage.js +171 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +13 -0
- package/dist/logic/cellNote.cjs +1 -1
- package/dist/logic/cellNote.d.ts +1 -1
- package/dist/logic/cellNote.js +9 -1
- package/dist/logic/changeTracking.cjs +1 -0
- package/dist/logic/changeTracking.d.ts +51 -0
- package/dist/logic/changeTracking.js +185 -0
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.js +54 -54
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +4 -1
- package/dist/logic/columnAutosize.js +89 -72
- package/dist/logic/conditionalFormat.cjs +1 -1
- package/dist/logic/conditionalFormat.js +8 -5
- package/dist/logic/contextMenuTarget.cjs +1 -1
- package/dist/logic/contextMenuTarget.d.ts +4 -3
- package/dist/logic/contextMenuTarget.js +42 -36
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +11 -1
- package/dist/logic/exportCsv.js +30 -22
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -2
- package/dist/logic/exportData.js +40 -28
- package/dist/logic/fillHandle.cjs +1 -1
- package/dist/logic/fillHandle.js +109 -103
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +1 -1
- package/dist/logic/find.js +11 -9
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.js +71 -71
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +3 -2
- package/dist/logic/gridState.js +6 -6
- package/dist/logic/groupExport.cjs +1 -1
- package/dist/logic/groupExport.js +12 -12
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +17 -0
- package/dist/logic/localeTextFeatures.js +22 -7
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +2 -1
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -1
- package/dist/logic/sorting.js +32 -32
- package/dist/logic/treeData.cjs +7 -0
- package/dist/logic/treeData.d.ts +83 -0
- package/dist/logic/treeData.js +438 -0
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +23 -22
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +15 -0
- package/dist/model/gridActions.js +15 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +175 -156
- package/dist/model/gridTypes.core.d.ts +282 -6
- package/dist/utils/clipboard.cjs +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.js +70 -67
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.d.ts +6 -0
- package/dist/utils/permissions.js +11 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AutosizeChipOf, type AutosizeTotalRowTexts } from '../logic/columnAutosize.js';
|
|
1
|
+
import { type AutosizeAggregateTextOf, type AutosizeCellLeadingWidth, type AutosizeChipOf, type AutosizeTotalRowTexts } from '../logic/columnAutosize.js';
|
|
2
2
|
import { gridActions } from '../model/gridActions.js';
|
|
3
3
|
import type { AutoSizeColumnsMode, GridColumn, RowModel } from '../model/gridTypes.unbound.js';
|
|
4
4
|
type ReadonlyRef<V> = {
|
|
@@ -12,6 +12,8 @@ export type ColumnAutosizeRunnerArgs<T> = {
|
|
|
12
12
|
totalRowTexts?: AutosizeTotalRowTexts;
|
|
13
13
|
chipOf?: AutosizeChipOf<T> | undefined;
|
|
14
14
|
pinnedRows?: readonly T[] | undefined;
|
|
15
|
+
cellLeadingWidth?: AutosizeCellLeadingWidth<T> | undefined;
|
|
16
|
+
aggregateTextOf?: AutosizeAggregateTextOf<T> | undefined;
|
|
15
17
|
};
|
|
16
18
|
export type ColumnAutosizeRunner<T> = {
|
|
17
19
|
update: (args: ColumnAutosizeRunnerArgs<T>) => void;
|
|
@@ -14,27 +14,28 @@ var o = 180, s = () => {
|
|
|
14
14
|
},
|
|
15
15
|
runAutosize: async (t) => {
|
|
16
16
|
if (a === null || t.length === 0 || !r()) return;
|
|
17
|
-
let { rowModel: d, gridRootRef: f, columnWidths: p, dispatch: m, totalRowTexts: h, chipOf: g, pinnedRows: _ } = a,
|
|
17
|
+
let { rowModel: d, gridRootRef: f, columnWidths: p, dispatch: m, totalRowTexts: h, chipOf: g, pinnedRows: _, cellLeadingWidth: v, aggregateTextOf: y } = a, b = c += 1;
|
|
18
18
|
u();
|
|
19
|
-
let
|
|
19
|
+
let x = d.getRowCount(), S = f.current, C = i(t, g, y);
|
|
20
20
|
l = setTimeout(() => {
|
|
21
|
-
c ===
|
|
21
|
+
c === b && s.setSnapshot(!0);
|
|
22
22
|
}, o);
|
|
23
23
|
try {
|
|
24
|
-
if (!await n(
|
|
24
|
+
if (!await n(x, (e) => {
|
|
25
25
|
let t = d.getRow(e);
|
|
26
|
-
t &&
|
|
27
|
-
}, { isCancelled: () => c !==
|
|
28
|
-
_?.forEach((e, t) =>
|
|
29
|
-
let t =
|
|
30
|
-
gridRoot:
|
|
26
|
+
t && C.collect(t, e);
|
|
27
|
+
}, { isCancelled: () => c !== b || a?.rowModel !== d })) return;
|
|
28
|
+
_?.forEach((e, t) => C.collect(e, -1 - t));
|
|
29
|
+
let t = C.finalize({
|
|
30
|
+
gridRoot: S,
|
|
31
31
|
currentWidths: p,
|
|
32
32
|
totalRowTexts: h,
|
|
33
|
-
chipOf: g
|
|
33
|
+
chipOf: g,
|
|
34
|
+
cellLeadingWidth: v
|
|
34
35
|
});
|
|
35
36
|
Object.keys(t).length > 0 && m(e.syncColumnWidths(t));
|
|
36
37
|
} finally {
|
|
37
|
-
c ===
|
|
38
|
+
c === b && (u(), s.setSnapshot(!1));
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
subscribe: s.subscribe,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/chunkedLoop.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,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/chunkedLoop.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,p=null,m=t.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),h=e=>{m.setSnapshot({...m.getSnapshot(),...e})},g=null,_=()=>{let e=m.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open,truncated:e.truncated};g!==null&&g.query===t.query&&g.matchCount===t.matchCount&&g.currentIndex===t.currentIndex&&g.open===t.open&&g.truncated===t.truncated||(g=t,i?.onChange?.(t))},v=e=>{let t=m.getSnapshot();if(t.currentIndex===null)return;let n=t.matches[t.currentIndex];n&&i?.onNavigate(n.rowIndex,n.colIndex,e)},y=()=>{l+=1,p=null,u=null,d=!1,h({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},b=(t,o=!1)=>{let g=i,x=m.getSnapshot();if(!g||!x.open||x.query.length===0){y(),_();return}l+=1;let S=l,{rowModel:C,columns:w,caseSensitive:T}=g,E=g.conditionalFormat!==!1,D=x.query,O=p!==null&&p.query===D&&p.caseSensitive===T;p={rowModel:C,columns:w,query:D,caseSensitive:T,conditionalFormatShown:E},(o||u===null||u.columns!==w||u.query!==D||u.caseSensitive!==T||u.conditionalFormatShown!==E)&&(u={columns:w,query:D,caseSensitive:T,conditionalFormatShown:E,byRow:new WeakMap});let k=u.byRow,A=0,j=t||d;d=j;let M=x.currentIndex===null?null:x.matches[x.currentIndex]??null,N=[],P=!1,F=C.getRowCount(),I=F>a,L=(t,n)=>{let i=[];return w.forEach((a,o)=>{if(e.isSyntheticColumnKey(a.key)||!r.isFindableColumn(a,E))return;let s=r.resolveFindCellText(a,t,!E||a.conditionalFormat?.chips===void 0?void 0:{rowIndex:n,sourceRowIndex:C.getSourceIndex(n)??n,rowKey:C.getRowKey(n)??n,colIndex:o});for(let e of r.findRangesInText(s,D,T))i.push({colIndex:o,columnKey:String(a.key),start:e.start,length:e.length})}),i.length===0?s:i};!O&&!x.scanning&&h({scanning:!0}),n.runChunked(F,e=>{if(P)return;let t=C.getRow(e);if(t===void 0)return;let n=C.getTreeRow?.(e)?.aggregates,r;I&&typeof t==`object`&&t?(r=k.get(t),r===void 0?(r=L(t,e),k.set(t,r)):A+=1):r=L(t,e);for(let t of r)if(!(n!==void 0&&t.columnKey in n)){if(N.length>=1e4){P=!0;return}N.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==S}).then(e=>{if(!e||l!==S||(d=!1,o&&P===m.getSnapshot().truncated&&c(m.getSnapshot().matches,N)))return;let t=r.resolveCurrentAfterRescan(N,M);h({matches:N,index:r.buildFindIndex(N,i?.toViewRow),currentIndex:t,scanning:!1,truncated:P}),f=i?.toViewRow,_(),j&&v(`query`),!o&&A>0&&b(!1,!0)})},x=()=>{let e=m.getSnapshot();return!i||!e.open||e.query.length===0?!1:p===null||p.rowModel!==i.rowModel||p.columns!==i.columns||p.query!==e.query||p.caseSensitive!==i.caseSensitive||p.conditionalFormatShown!==(i.conditionalFormat!==!1)};return{update:e=>{let t=i;if(i=e,!e.enabled){m.getSnapshot().open&&(h({open:!1,query:``}),y(),_());return}if(t!==e&&x()){b(!1);return}let n=m.getSnapshot();e.toViewRow!==f&&!n.scanning&&(f=e.toViewRow,n.matches.length>0&&h({index:r.buildFindIndex(n.matches,e.toViewRow)}))},open:e=>{if(!i?.enabled)return;let t=m.getSnapshot(),n=e??t.query;h({open:!0,query:n}),n!==t.query||!t.open?b(!0):_()},close:()=>{m.getSnapshot().open&&(h({open:!1,query:``}),y(),_())},setQuery:e=>{let t=m.getSnapshot();!t.open||e===t.query||(h({query:e}),b(!0))},next:()=>{let e=m.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);h({currentIndex:t}),_(),v(`step`)},prev:()=>{let e=m.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);h({currentIndex:t}),_(),v(`step`)},subscribe:m.subscribe,getSnapshot:m.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GridColumn, RowModel } from '../model/gridTypes.unbound.js';
|
|
2
|
+
export type FindNavigateCause = 'query' | 'step';
|
|
2
3
|
import { type FindIndex, type FindMatch } from '../logic/find.js';
|
|
3
4
|
export type FindChangeParams = {
|
|
4
5
|
query: string;
|
|
@@ -12,9 +13,10 @@ export type FindArgs<T> = {
|
|
|
12
13
|
rowModel: RowModel<T>;
|
|
13
14
|
columns: readonly GridColumn<T>[];
|
|
14
15
|
caseSensitive: boolean;
|
|
15
|
-
onNavigate: (rowIndex: number, colIndex: number) => void;
|
|
16
|
+
onNavigate: (rowIndex: number, colIndex: number, cause: FindNavigateCause) => void;
|
|
16
17
|
onChange?: (params: FindChangeParams) => void;
|
|
17
18
|
conditionalFormat?: boolean | undefined;
|
|
19
|
+
toViewRow?: ((rowIndex: number) => number) | undefined;
|
|
18
20
|
};
|
|
19
21
|
export type FindSnapshot = {
|
|
20
22
|
open: boolean;
|
|
@@ -7,7 +7,7 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
7
7
|
let r = t[n];
|
|
8
8
|
return e.rowIndex === r.rowIndex && e.colIndex === r.colIndex && e.columnKey === r.columnKey && e.start === r.start && e.length === r.length;
|
|
9
9
|
}), m = () => {
|
|
10
|
-
let l = null, m = 0, h = null, g = !1, _ = null,
|
|
10
|
+
let l = null, m = 0, h = null, g = !1, _, v = null, y = t({
|
|
11
11
|
open: !1,
|
|
12
12
|
query: "",
|
|
13
13
|
matches: [],
|
|
@@ -15,67 +15,67 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
15
15
|
currentIndex: null,
|
|
16
16
|
scanning: !1,
|
|
17
17
|
truncated: !1
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
...
|
|
18
|
+
}), b = (e) => {
|
|
19
|
+
y.setSnapshot({
|
|
20
|
+
...y.getSnapshot(),
|
|
21
21
|
...e
|
|
22
22
|
});
|
|
23
|
-
},
|
|
24
|
-
let e =
|
|
23
|
+
}, x = null, S = () => {
|
|
24
|
+
let e = y.getSnapshot(), t = {
|
|
25
25
|
query: e.query,
|
|
26
26
|
matchCount: e.matches.length,
|
|
27
27
|
currentIndex: e.currentIndex,
|
|
28
28
|
open: e.open,
|
|
29
29
|
truncated: e.truncated
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
m += 1,
|
|
31
|
+
x !== null && x.query === t.query && x.matchCount === t.matchCount && x.currentIndex === t.currentIndex && x.open === t.open && x.truncated === t.truncated || (x = t, l?.onChange?.(t));
|
|
32
|
+
}, C = (e) => {
|
|
33
|
+
let t = y.getSnapshot();
|
|
34
|
+
if (t.currentIndex === null) return;
|
|
35
|
+
let n = t.matches[t.currentIndex];
|
|
36
|
+
n && l?.onNavigate(n.rowIndex, n.colIndex, e);
|
|
37
|
+
}, w = () => {
|
|
38
|
+
m += 1, v = null, h = null, g = !1, b({
|
|
39
39
|
matches: [],
|
|
40
40
|
index: d,
|
|
41
41
|
currentIndex: null,
|
|
42
42
|
scanning: !1,
|
|
43
43
|
truncated: !1
|
|
44
44
|
});
|
|
45
|
-
},
|
|
46
|
-
let d = l,
|
|
47
|
-
if (!d || !
|
|
48
|
-
|
|
45
|
+
}, T = (t, c = !1) => {
|
|
46
|
+
let d = l, x = y.getSnapshot();
|
|
47
|
+
if (!d || !x.open || x.query.length === 0) {
|
|
48
|
+
w(), S();
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
m += 1;
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
rowModel:
|
|
55
|
-
columns:
|
|
56
|
-
query:
|
|
57
|
-
caseSensitive:
|
|
58
|
-
conditionalFormatShown:
|
|
59
|
-
}, (c || h === null || h.columns !==
|
|
60
|
-
columns:
|
|
61
|
-
query:
|
|
62
|
-
caseSensitive:
|
|
63
|
-
conditionalFormatShown:
|
|
52
|
+
let E = m, { rowModel: D, columns: O, caseSensitive: k } = d, A = d.conditionalFormat !== !1, j = x.query, M = v !== null && v.query === j && v.caseSensitive === k;
|
|
53
|
+
v = {
|
|
54
|
+
rowModel: D,
|
|
55
|
+
columns: O,
|
|
56
|
+
query: j,
|
|
57
|
+
caseSensitive: k,
|
|
58
|
+
conditionalFormatShown: A
|
|
59
|
+
}, (c || h === null || h.columns !== O || h.query !== j || h.caseSensitive !== k || h.conditionalFormatShown !== A) && (h = {
|
|
60
|
+
columns: O,
|
|
61
|
+
query: j,
|
|
62
|
+
caseSensitive: k,
|
|
63
|
+
conditionalFormatShown: A,
|
|
64
64
|
byRow: /* @__PURE__ */ new WeakMap()
|
|
65
65
|
});
|
|
66
|
-
let
|
|
67
|
-
g =
|
|
68
|
-
let
|
|
66
|
+
let N = h.byRow, P = 0, F = t || g;
|
|
67
|
+
g = F;
|
|
68
|
+
let I = x.currentIndex === null ? null : x.matches[x.currentIndex] ?? null, L = [], R = !1, z = D.getRowCount(), B = z > u, V = (t, n) => {
|
|
69
69
|
let r = [];
|
|
70
|
-
return
|
|
71
|
-
if (e(o.key) || !a(o,
|
|
72
|
-
let l = s(o, t, !
|
|
70
|
+
return O.forEach((o, c) => {
|
|
71
|
+
if (e(o.key) || !a(o, A)) return;
|
|
72
|
+
let l = s(o, t, !A || o.conditionalFormat?.chips === void 0 ? void 0 : {
|
|
73
73
|
rowIndex: n,
|
|
74
|
-
sourceRowIndex:
|
|
75
|
-
rowKey:
|
|
74
|
+
sourceRowIndex: D.getSourceIndex(n) ?? n,
|
|
75
|
+
rowKey: D.getRowKey(n) ?? n,
|
|
76
76
|
colIndex: c
|
|
77
77
|
});
|
|
78
|
-
for (let e of i(l,
|
|
78
|
+
for (let e of i(l, j, k)) r.push({
|
|
79
79
|
colIndex: c,
|
|
80
80
|
columnKey: String(o.key),
|
|
81
81
|
start: e.start,
|
|
@@ -83,18 +83,18 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
83
83
|
});
|
|
84
84
|
}), r.length === 0 ? f : r;
|
|
85
85
|
};
|
|
86
|
-
!
|
|
87
|
-
if (
|
|
88
|
-
let t =
|
|
86
|
+
!M && !x.scanning && b({ scanning: !0 }), n(z, (e) => {
|
|
87
|
+
if (R) return;
|
|
88
|
+
let t = D.getRow(e);
|
|
89
89
|
if (t === void 0) return;
|
|
90
|
-
let n;
|
|
91
|
-
|
|
92
|
-
for (let t of n) {
|
|
93
|
-
if (
|
|
94
|
-
|
|
90
|
+
let n = D.getTreeRow?.(e)?.aggregates, r;
|
|
91
|
+
B && typeof t == "object" && t ? (r = N.get(t), r === void 0 ? (r = V(t, e), N.set(t, r)) : P += 1) : r = V(t, e);
|
|
92
|
+
for (let t of r) if (!(n !== void 0 && t.columnKey in n)) {
|
|
93
|
+
if (L.length >= 1e4) {
|
|
94
|
+
R = !0;
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
L.push({
|
|
98
98
|
rowIndex: e,
|
|
99
99
|
colIndex: t.colIndex,
|
|
100
100
|
columnKey: t.columnKey,
|
|
@@ -102,61 +102,66 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
|
|
|
102
102
|
length: t.length
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
}, { isCancelled: () => m !==
|
|
106
|
-
if (!e || m !==
|
|
107
|
-
let t = o(
|
|
108
|
-
|
|
109
|
-
matches:
|
|
110
|
-
index: r(
|
|
105
|
+
}, { isCancelled: () => m !== E }).then((e) => {
|
|
106
|
+
if (!e || m !== E || (g = !1, c && R === y.getSnapshot().truncated && p(y.getSnapshot().matches, L))) return;
|
|
107
|
+
let t = o(L, I);
|
|
108
|
+
b({
|
|
109
|
+
matches: L,
|
|
110
|
+
index: r(L, l?.toViewRow),
|
|
111
111
|
currentIndex: t,
|
|
112
112
|
scanning: !1,
|
|
113
|
-
truncated:
|
|
114
|
-
}),
|
|
113
|
+
truncated: R
|
|
114
|
+
}), _ = l?.toViewRow, S(), F && C("query"), !c && P > 0 && T(!1, !0);
|
|
115
115
|
});
|
|
116
|
-
},
|
|
117
|
-
let e =
|
|
118
|
-
return !l || !e.open || e.query.length === 0 ? !1 :
|
|
116
|
+
}, E = () => {
|
|
117
|
+
let e = y.getSnapshot();
|
|
118
|
+
return !l || !e.open || e.query.length === 0 ? !1 : v === null || v.rowModel !== l.rowModel || v.columns !== l.columns || v.query !== e.query || v.caseSensitive !== l.caseSensitive || v.conditionalFormatShown !== (l.conditionalFormat !== !1);
|
|
119
119
|
};
|
|
120
120
|
return {
|
|
121
121
|
update: (e) => {
|
|
122
122
|
let t = l;
|
|
123
123
|
if (l = e, !e.enabled) {
|
|
124
|
-
|
|
124
|
+
y.getSnapshot().open && (b({
|
|
125
125
|
open: !1,
|
|
126
126
|
query: ""
|
|
127
|
-
}),
|
|
127
|
+
}), w(), S());
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
t !== e &&
|
|
130
|
+
if (t !== e && E()) {
|
|
131
|
+
T(!1);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
let n = y.getSnapshot();
|
|
135
|
+
e.toViewRow !== _ && !n.scanning && (_ = e.toViewRow, n.matches.length > 0 && b({ index: r(n.matches, e.toViewRow) }));
|
|
131
136
|
},
|
|
132
137
|
open: (e) => {
|
|
133
138
|
if (!l?.enabled) return;
|
|
134
|
-
let t =
|
|
135
|
-
|
|
139
|
+
let t = y.getSnapshot(), n = e ?? t.query;
|
|
140
|
+
b({
|
|
136
141
|
open: !0,
|
|
137
142
|
query: n
|
|
138
|
-
}), n !== t.query || !t.open ?
|
|
143
|
+
}), n !== t.query || !t.open ? T(!0) : S();
|
|
139
144
|
},
|
|
140
145
|
close: () => {
|
|
141
|
-
|
|
146
|
+
y.getSnapshot().open && (b({
|
|
142
147
|
open: !1,
|
|
143
148
|
query: ""
|
|
144
|
-
}),
|
|
149
|
+
}), w(), S());
|
|
145
150
|
},
|
|
146
151
|
setQuery: (e) => {
|
|
147
|
-
let t =
|
|
148
|
-
!t.open || e === t.query || (
|
|
152
|
+
let t = y.getSnapshot();
|
|
153
|
+
!t.open || e === t.query || (b({ query: e }), T(!0));
|
|
149
154
|
},
|
|
150
155
|
next: () => {
|
|
151
|
-
let e =
|
|
152
|
-
|
|
156
|
+
let e = y.getSnapshot(), t = c(e.currentIndex, e.matches.length, 1);
|
|
157
|
+
b({ currentIndex: t }), S(), C("step");
|
|
153
158
|
},
|
|
154
159
|
prev: () => {
|
|
155
|
-
let e =
|
|
156
|
-
|
|
160
|
+
let e = y.getSnapshot(), t = c(e.currentIndex, e.matches.length, -1);
|
|
161
|
+
b({ currentIndex: t }), S(), C("step");
|
|
157
162
|
},
|
|
158
|
-
subscribe:
|
|
159
|
-
getSnapshot:
|
|
163
|
+
subscribe: y.subscribe,
|
|
164
|
+
getSnapshot: y.getSnapshot,
|
|
160
165
|
dispose: () => {
|
|
161
166
|
m += 1, l = null;
|
|
162
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../logic/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/historyRebase.cjs"),r=require("../logic/history.cjs");var i=(e,n)=>{let r=new Map;return{getRowKey:t=>t>=0&&t<e.getRowCount()?e.getRowKey(t):void 0,viewIndexOf:i=>{if(n){let e=n.structure.keyToIndex.get(i);for(;e!==void 0&&e>=0;){let t=n.display.viewIndexOf[e];if(t>=0)return t;e=n.structure.parent[e]}return-1}return t.findViewRowIndexByKey(e,i,r)}}},a=()=>{let t=null,i=r.createHistoryStack(),a=null,o=null,s={canUndo:!1,canRedo:!1},c=null,l=!1,u=null,d=()=>t!==null&&t.enabled&&t.onRowsChange!=null,f=()=>d()&&r.canUndoHistory(i),p=()=>d()&&r.canRedoHistory(i),m=()=>{let e={canUndo:f(),canRedo:p()};e.canUndo===s.canUndo&&e.canRedo===s.canRedo||(s=e,t?.onUndoRedoStateChange?.(e))},h=e=>{let n=o!==null&&e.rows!==o;t=e,e.rows!==o&&(c=null),o===null?o=e.rows:e.rows!==o&&(o=e.rows,a===e.rows?a=null:(a=null,i=r.createHistoryStack(),l=!1)),m();let s=u;s!==null&&(e.rows===s.rows?(u=null,e.onAfterRestore?.(_(s.entry))):n&&(u=null))},g=(e,n)=>{let r=t?.rowLocator;if(!r)return;let i=e=>e===void 0||e<0?void 0:r.getRowKey(e),a=e?.type===`cell`?[e.range.start.row,e.range.end.row]:e?.type===`row`?[e.startRow,e.endRow]:[void 0,void 0];return{active:i(n?.row),start:i(a[0]),end:i(a[1])}},_=n=>{let r=t?.rowLocator,i=n.rowKeys;if(!t||!r||!i)return n.activeCell;let{dispatch:a}=t,o=e=>e===void 0?-1:r.viewIndexOf(e),s=n.activeCell,c=o(i.active);s&&c>=0&&c!==s.row&&(s={row:c,col:s.col});let l=n.selection,u=o(i.start),d=o(i.end);return l?.type===`cell`&&u>=0&&d>=0?(a(e.gridActions.startSelection({row:u,col:l.range.start.col})),a(e.gridActions.updateSelection({row:d,col:l.range.end.col})),a(e.gridActions.endSelection())):l?.type===`row`&&u>=0&&d>=0&&(a(e.gridActions.startRowSelection(u)),a(e.gridActions.updateRowSelection(d)),a(e.gridActions.endSelection())),s!==null&&t.noteFollowMove?.(s),a(e.gridActions.activateCell(s)),s},v=n=>{if(t===null)return;let{dispatch:r}=t,i=n.selection;i?.type===`cell`?(r(e.gridActions.startSelection(i.range.start)),r(e.gridActions.updateSelection(i.range.end)),r(e.gridActions.endSelection())):i?.type===`row`?(r(e.gridActions.startRowSelection(i.startRow)),r(e.gridActions.updateRowSelection(i.endRow)),r(e.gridActions.endSelection())):i?.type===`col`?(r(e.gridActions.startColumnSelection(i.startCol)),r(e.gridActions.updateColumnSelection(i.endCol)),r(e.gridActions.endSelection())):r(e.gridActions.clearSelection()),r(e.gridActions.activateCell(n.activeCell))},y=(e,n)=>{t===null||!t.onRowsChange||(t.enabled&&(i=r.pushHistory(i,{rows:e,after:n,selection:t.selection,activeCell:t.activeCell,rowKeys:g(t.selection,t.activeCell)},t.limit),a=n,m()),c=n,t.onGridRowsChange?.(e,n),t.onRowsChange(n))},b=e=>{t===null||!t.onRowsChange||y(t.rows,e)},x=e=>{if(t===null||!t.onRowsChange)return;if(t.enabled){a=e;let t=i.past[i.past.length-1];t&&(i={...i,past:[...i.past.slice(0,-1),{...t,after:e}]})}let n=c??t.rows;c=e,t.onGridRowsChange?.(n,e),t.onRowsChange(e)},S=(e,n)=>{if(t===null||!t.onRowsChange)return;let r=c??t.rows,i=Array.isArray(e)?e:e(r);if(n?.undoable!==!1){y(r,i);return}t.enabled&&(a=i,l=!0),c=i,t.onRowsChange(i)},C=(e,r)=>{if(!e)return null;if(!l||e.after===r)return e.rows;let i=t?.rowKeyGetter;return!i&&(e.rows.length!==e.after.length||e.after.length!==r.length)?e.rows:n.revertRowsChange(e.rows,e.after,r,i??((e,t)=>t))},w=e=>{if(e===null||t===null||!t.onRowsChange)return;i=e.stack,a=e.snapshot.rows;let n=c??t.rows;c=e.snapshot.rows,t.onGridRowsChange?.(n,e.snapshot.rows),t.onRowsChange(e.snapshot.rows),e.snapshot.rowKeys&&t.rowLocator&&e.snapshot.activeCell!==null&&t.noteFollowMove?.(e.snapshot.activeCell),v(e.snapshot),e.snapshot.rowKeys&&t.rowLocator?u={rows:e.snapshot.rows,entry:e.snapshot}:t.onAfterRestore?.(e.snapshot.activeCell),m()},T=(e,n)=>t===null?null:{rows:e,after:n,selection:t.selection,activeCell:t.activeCell,rowKeys:g(t.selection,t.activeCell)},E=(e,n)=>{if(!d()||t===null)return;let r=c??t.rows,a=C(e,r),o=a===null?null:T(r,a);if(a===null||o===null)return;let s=n(i,o);w(s===null?null:{stack:s.stack,snapshot:{...s.snapshot,rows:a}})};return{update:h,handleRowsChange:b,amendRowsChange:x,applyRows:S,undo:()=>{E(i.past[i.past.length-1],r.undoHistory)},redo:()=>{E(i.future[i.future.length-1],r.redoHistory)},canUndo:f,canRedo:p,clearHistory:()=>{i=r.createHistoryStack(),l=!1,m()}}};exports.createHistoryController=a,exports.createHistoryRowLocator=i;
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { type GridUiAction } from '../model/gridActions.js';
|
|
2
|
-
import type { CellCoord, GridSelection, UndoRedoState } from '../model/gridTypes.unbound.js';
|
|
2
|
+
import type { CellCoord, GridRowKey, GridSelection, RowModel, UndoRedoState } from '../model/gridTypes.unbound.js';
|
|
3
3
|
export type GridHistoryEntry<T> = {
|
|
4
4
|
rows: T[];
|
|
5
5
|
after: T[];
|
|
6
6
|
selection: GridSelection;
|
|
7
7
|
activeCell: CellCoord | null;
|
|
8
|
+
rowKeys?: HistoryRowKeys | undefined;
|
|
8
9
|
};
|
|
10
|
+
type HistoryRowKeys = {
|
|
11
|
+
active: GridRowKey | undefined;
|
|
12
|
+
start: GridRowKey | undefined;
|
|
13
|
+
end: GridRowKey | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type HistoryRowLocator = {
|
|
16
|
+
getRowKey: (viewIndex: number) => GridRowKey | undefined;
|
|
17
|
+
viewIndexOf: (rowKey: GridRowKey) => number;
|
|
18
|
+
};
|
|
19
|
+
type HistoryTreeLookup = {
|
|
20
|
+
structure: {
|
|
21
|
+
keyToIndex: ReadonlyMap<GridRowKey, number>;
|
|
22
|
+
parent: Int32Array;
|
|
23
|
+
};
|
|
24
|
+
display: {
|
|
25
|
+
viewIndexOf: Int32Array;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const createHistoryRowLocator: <T>(rowModel: RowModel<T>, tree?: HistoryTreeLookup | null | undefined) => HistoryRowLocator;
|
|
9
29
|
export type HistoryApplyRowsOptions = {
|
|
10
30
|
undoable?: boolean | undefined;
|
|
11
31
|
};
|
|
@@ -20,6 +40,9 @@ export type HistoryControllerArgs<T> = {
|
|
|
20
40
|
onUndoRedoStateChange?: (state: UndoRedoState) => void;
|
|
21
41
|
onAfterRestore?: (activeCell: CellCoord | null) => void;
|
|
22
42
|
rowKeyGetter?: ((row: T, index: number) => unknown) | undefined;
|
|
43
|
+
onGridRowsChange?: ((prevRows: T[], nextRows: T[]) => void) | undefined;
|
|
44
|
+
rowLocator?: HistoryRowLocator | undefined;
|
|
45
|
+
noteFollowMove?: ((cell: CellCoord) => void) | undefined;
|
|
23
46
|
};
|
|
24
47
|
export type HistoryController<T> = {
|
|
25
48
|
update: (args: HistoryControllerArgs<T>) => void;
|
|
@@ -33,3 +56,4 @@ export type HistoryController<T> = {
|
|
|
33
56
|
clearHistory: () => void;
|
|
34
57
|
};
|
|
35
58
|
export declare const createHistoryController: <T>() => HistoryController<T>;
|
|
59
|
+
export {};
|
|
@@ -1,97 +1,151 @@
|
|
|
1
1
|
import { gridActions as e } from "../model/gridActions.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { findViewRowIndexByKey as t } from "../logic/detailRow.js";
|
|
3
|
+
import { revertRowsChange as n } from "../logic/historyRebase.js";
|
|
4
|
+
import { canRedoHistory as r, canUndoHistory as i, createHistoryStack as a, pushHistory as o, redoHistory as s, undoHistory as c } from "../logic/history.js";
|
|
4
5
|
//#region src/controllers/historyController.ts
|
|
5
|
-
var
|
|
6
|
-
let
|
|
6
|
+
var l = (e, n) => {
|
|
7
|
+
let r = /* @__PURE__ */ new Map();
|
|
8
|
+
return {
|
|
9
|
+
getRowKey: (t) => t >= 0 && t < e.getRowCount() ? e.getRowKey(t) : void 0,
|
|
10
|
+
viewIndexOf: (i) => {
|
|
11
|
+
if (n) {
|
|
12
|
+
let e = n.structure.keyToIndex.get(i);
|
|
13
|
+
for (; e !== void 0 && e >= 0;) {
|
|
14
|
+
let t = n.display.viewIndexOf[e];
|
|
15
|
+
if (t >= 0) return t;
|
|
16
|
+
e = n.structure.parent[e];
|
|
17
|
+
}
|
|
18
|
+
return -1;
|
|
19
|
+
}
|
|
20
|
+
return t(e, i, r);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}, u = () => {
|
|
24
|
+
let t = null, l = a(), u = null, d = null, f = {
|
|
7
25
|
canUndo: !1,
|
|
8
26
|
canRedo: !1
|
|
9
|
-
}, p = null, m = !1, h = () =>
|
|
27
|
+
}, p = null, m = !1, h = null, g = () => t !== null && t.enabled && t.onRowsChange != null, _ = () => g() && i(l), v = () => g() && r(l), y = () => {
|
|
10
28
|
let e = {
|
|
11
|
-
canUndo:
|
|
12
|
-
canRedo:
|
|
29
|
+
canUndo: _(),
|
|
30
|
+
canRedo: v()
|
|
31
|
+
};
|
|
32
|
+
e.canUndo === f.canUndo && e.canRedo === f.canRedo || (f = e, t?.onUndoRedoStateChange?.(e));
|
|
33
|
+
}, b = (e) => {
|
|
34
|
+
let n = d !== null && e.rows !== d;
|
|
35
|
+
t = e, e.rows !== d && (p = null), d === null ? d = e.rows : e.rows !== d && (d = e.rows, u === e.rows ? u = null : (u = null, l = a(), m = !1)), y();
|
|
36
|
+
let r = h;
|
|
37
|
+
r !== null && (e.rows === r.rows ? (h = null, e.onAfterRestore?.(S(r.entry))) : n && (h = null));
|
|
38
|
+
}, x = (e, n) => {
|
|
39
|
+
let r = t?.rowLocator;
|
|
40
|
+
if (!r) return;
|
|
41
|
+
let i = (e) => e === void 0 || e < 0 ? void 0 : r.getRowKey(e), a = e?.type === "cell" ? [e.range.start.row, e.range.end.row] : e?.type === "row" ? [e.startRow, e.endRow] : [void 0, void 0];
|
|
42
|
+
return {
|
|
43
|
+
active: i(n?.row),
|
|
44
|
+
start: i(a[0]),
|
|
45
|
+
end: i(a[1])
|
|
13
46
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
}, S = (n) => {
|
|
48
|
+
let r = t?.rowLocator, i = n.rowKeys;
|
|
49
|
+
if (!t || !r || !i) return n.activeCell;
|
|
50
|
+
let { dispatch: a } = t, o = (e) => e === void 0 ? -1 : r.viewIndexOf(e), s = n.activeCell, c = o(i.active);
|
|
51
|
+
s && c >= 0 && c !== s.row && (s = {
|
|
52
|
+
row: c,
|
|
53
|
+
col: s.col
|
|
54
|
+
});
|
|
55
|
+
let l = n.selection, u = o(i.start), d = o(i.end);
|
|
56
|
+
return l?.type === "cell" && u >= 0 && d >= 0 ? (a(e.startSelection({
|
|
57
|
+
row: u,
|
|
58
|
+
col: l.range.start.col
|
|
59
|
+
})), a(e.updateSelection({
|
|
60
|
+
row: d,
|
|
61
|
+
col: l.range.end.col
|
|
62
|
+
})), a(e.endSelection())) : l?.type === "row" && u >= 0 && d >= 0 && (a(e.startRowSelection(u)), a(e.updateRowSelection(d)), a(e.endSelection())), s !== null && t.noteFollowMove?.(s), a(e.activateCell(s)), s;
|
|
63
|
+
}, C = (n) => {
|
|
64
|
+
if (t === null) return;
|
|
65
|
+
let { dispatch: r } = t, i = n.selection;
|
|
66
|
+
i?.type === "cell" ? (r(e.startSelection(i.range.start)), r(e.updateSelection(i.range.end)), r(e.endSelection())) : i?.type === "row" ? (r(e.startRowSelection(i.startRow)), r(e.updateRowSelection(i.endRow)), r(e.endSelection())) : i?.type === "col" ? (r(e.startColumnSelection(i.startCol)), r(e.updateColumnSelection(i.endCol)), r(e.endSelection())) : r(e.clearSelection()), r(e.activateCell(n.activeCell));
|
|
67
|
+
}, w = (e, n) => {
|
|
68
|
+
t === null || !t.onRowsChange || (t.enabled && (l = o(l, {
|
|
23
69
|
rows: e,
|
|
24
|
-
after:
|
|
25
|
-
selection:
|
|
26
|
-
activeCell:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
p = e, c.onRowsChange(e);
|
|
70
|
+
after: n,
|
|
71
|
+
selection: t.selection,
|
|
72
|
+
activeCell: t.activeCell,
|
|
73
|
+
rowKeys: x(t.selection, t.activeCell)
|
|
74
|
+
}, t.limit), u = n, y()), p = n, t.onGridRowsChange?.(e, n), t.onRowsChange(n));
|
|
75
|
+
}, T = (e) => {
|
|
76
|
+
t === null || !t.onRowsChange || w(t.rows, e);
|
|
77
|
+
}, E = (e) => {
|
|
78
|
+
if (t === null || !t.onRowsChange) return;
|
|
79
|
+
if (t.enabled) {
|
|
80
|
+
u = e;
|
|
81
|
+
let t = l.past[l.past.length - 1];
|
|
82
|
+
t && (l = {
|
|
83
|
+
...l,
|
|
84
|
+
past: [...l.past.slice(0, -1), {
|
|
85
|
+
...t,
|
|
86
|
+
after: e
|
|
87
|
+
}]
|
|
88
|
+
});
|
|
44
89
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (t
|
|
49
|
-
|
|
90
|
+
let n = p ?? t.rows;
|
|
91
|
+
p = e, t.onGridRowsChange?.(n, e), t.onRowsChange(e);
|
|
92
|
+
}, D = (e, n) => {
|
|
93
|
+
if (t === null || !t.onRowsChange) return;
|
|
94
|
+
let r = p ?? t.rows, i = Array.isArray(e) ? e : e(r);
|
|
95
|
+
if (n?.undoable !== !1) {
|
|
96
|
+
w(r, i);
|
|
50
97
|
return;
|
|
51
98
|
}
|
|
52
|
-
|
|
53
|
-
},
|
|
99
|
+
t.enabled && (u = i, m = !0), p = i, t.onRowsChange(i);
|
|
100
|
+
}, O = (e, r) => {
|
|
54
101
|
if (!e) return null;
|
|
55
|
-
if (!m || e.after ===
|
|
56
|
-
let
|
|
57
|
-
return !
|
|
58
|
-
},
|
|
59
|
-
e === null ||
|
|
60
|
-
|
|
102
|
+
if (!m || e.after === r) return e.rows;
|
|
103
|
+
let i = t?.rowKeyGetter;
|
|
104
|
+
return !i && (e.rows.length !== e.after.length || e.after.length !== r.length) ? e.rows : n(e.rows, e.after, r, i ?? ((e, t) => t));
|
|
105
|
+
}, k = (e) => {
|
|
106
|
+
if (e === null || t === null || !t.onRowsChange) return;
|
|
107
|
+
l = e.stack, u = e.snapshot.rows;
|
|
108
|
+
let n = p ?? t.rows;
|
|
109
|
+
p = e.snapshot.rows, t.onGridRowsChange?.(n, e.snapshot.rows), t.onRowsChange(e.snapshot.rows), e.snapshot.rowKeys && t.rowLocator && e.snapshot.activeCell !== null && t.noteFollowMove?.(e.snapshot.activeCell), C(e.snapshot), e.snapshot.rowKeys && t.rowLocator ? h = {
|
|
110
|
+
rows: e.snapshot.rows,
|
|
111
|
+
entry: e.snapshot
|
|
112
|
+
} : t.onAfterRestore?.(e.snapshot.activeCell), y();
|
|
113
|
+
}, A = (e, n) => t === null ? null : {
|
|
61
114
|
rows: e,
|
|
62
|
-
after:
|
|
63
|
-
selection:
|
|
64
|
-
activeCell:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
115
|
+
after: n,
|
|
116
|
+
selection: t.selection,
|
|
117
|
+
activeCell: t.activeCell,
|
|
118
|
+
rowKeys: x(t.selection, t.activeCell)
|
|
119
|
+
}, j = (e, n) => {
|
|
120
|
+
if (!g() || t === null) return;
|
|
121
|
+
let r = p ?? t.rows, i = O(e, r), a = i === null ? null : A(r, i);
|
|
122
|
+
if (i === null || a === null) return;
|
|
123
|
+
let o = n(l, a);
|
|
124
|
+
k(o === null ? null : {
|
|
125
|
+
stack: o.stack,
|
|
72
126
|
snapshot: {
|
|
73
|
-
...
|
|
74
|
-
rows:
|
|
127
|
+
...o.snapshot,
|
|
128
|
+
rows: i
|
|
75
129
|
}
|
|
76
130
|
});
|
|
77
131
|
};
|
|
78
132
|
return {
|
|
79
|
-
update:
|
|
80
|
-
handleRowsChange:
|
|
81
|
-
amendRowsChange:
|
|
82
|
-
applyRows:
|
|
133
|
+
update: b,
|
|
134
|
+
handleRowsChange: T,
|
|
135
|
+
amendRowsChange: E,
|
|
136
|
+
applyRows: D,
|
|
83
137
|
undo: () => {
|
|
84
|
-
|
|
138
|
+
j(l.past[l.past.length - 1], c);
|
|
85
139
|
},
|
|
86
140
|
redo: () => {
|
|
87
|
-
|
|
141
|
+
j(l.future[l.future.length - 1], s);
|
|
88
142
|
},
|
|
89
|
-
canUndo:
|
|
90
|
-
canRedo:
|
|
143
|
+
canUndo: _,
|
|
144
|
+
canRedo: v,
|
|
91
145
|
clearHistory: () => {
|
|
92
|
-
l =
|
|
146
|
+
l = a(), m = !1, y();
|
|
93
147
|
}
|
|
94
148
|
};
|
|
95
149
|
};
|
|
96
150
|
//#endregion
|
|
97
|
-
export {
|
|
151
|
+
export { u as createHistoryController, l as createHistoryRowLocator };
|