@ishibashi0112/spreadsheet-grid-core 1.12.0 → 1.13.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/changeTracker.cjs +1 -1
- package/dist/controllers/changeTracker.d.ts +9 -0
- package/dist/controllers/changeTracker.js +205 -145
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +9 -1
- package/dist/controllers/rowDiffer.cjs +2 -0
- package/dist/controllers/rowDiffer.d.ts +19 -0
- package/dist/controllers/rowDiffer.js +131 -0
- package/dist/engine/diffStage.cjs +1 -0
- package/dist/engine/diffStage.d.ts +26 -0
- package/dist/engine/diffStage.js +117 -0
- package/dist/engine/features.d.ts +8 -0
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +33 -25
- package/dist/engine/gridApi.cjs +9 -8
- package/dist/engine/gridApi.d.ts +5 -1
- package/dist/engine/gridApi.js +272 -221
- package/dist/engine/newRowController.cjs +1 -1
- package/dist/engine/newRowController.js +1 -0
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +8 -1
- package/dist/engine/rowPipeline.js +32 -22
- package/dist/engine/treeStage.cjs +1 -1
- package/dist/engine/treeStage.d.ts +1 -0
- package/dist/engine/treeStage.js +2 -2
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +12 -0
- package/dist/logic/changeNavigation.cjs +1 -0
- package/dist/logic/changeNavigation.d.ts +25 -0
- package/dist/logic/changeNavigation.js +62 -0
- package/dist/logic/changeTracking.cjs +1 -1
- package/dist/logic/changeTracking.d.ts +1 -0
- package/dist/logic/changeTracking.js +8 -5
- package/dist/logic/diffView.cjs +1 -0
- package/dist/logic/diffView.d.ts +20 -0
- package/dist/logic/diffView.js +51 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +14 -0
- package/dist/logic/localeTextFeatures.js +21 -8
- package/dist/logic/multiSelect.cjs +1 -1
- package/dist/logic/multiSelect.js +1 -1
- package/dist/logic/rangeDecorations.cjs +4 -0
- package/dist/logic/rangeDecorations.d.ts +78 -0
- package/dist/logic/rangeDecorations.js +223 -0
- package/dist/logic/rowDiff.cjs +1 -0
- package/dist/logic/rowDiff.d.ts +57 -0
- package/dist/logic/rowDiff.js +169 -0
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -0
- package/dist/logic/sorting.js +42 -27
- package/dist/model/gridStore.d.ts +4 -1
- package/dist/model/gridTypes.core.d.ts +123 -23
- package/package.json +1 -1
package/dist/engine/gridApi.js
CHANGED
|
@@ -1,61 +1,69 @@
|
|
|
1
1
|
import { gridActions as e } from "../model/gridActions.js";
|
|
2
2
|
import { collectAllGroupKeys as t, collectAllGroupRows as n } from "../logic/grouping.js";
|
|
3
|
-
import { findDetailRowIndex as r, findViewRowIndexByKey as i } from "../logic/detailRow.js";
|
|
4
|
-
import { normalizeCellRange as
|
|
5
|
-
import { computeSinglePaneColumnExtent as
|
|
6
|
-
import { scanInvalidCells as
|
|
7
|
-
import { resolveDataRowNumber as
|
|
8
|
-
import { resolveFirstEditableColIndex as
|
|
9
|
-
import { logicalToPhysicalScrollTop as
|
|
10
|
-
import { isScrolledToBottom as
|
|
11
|
-
import { clearRowSelection as
|
|
12
|
-
import { applyColumnState as
|
|
13
|
-
import { createInertExportCommands as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import { findDetailRowIndex as r, findViewRowIndexByKey as i, resolveFirstDataColIndex as a } from "../logic/detailRow.js";
|
|
4
|
+
import { normalizeCellRange as o, normalizeRowRange as s } from "../model/gridSelectors.js";
|
|
5
|
+
import { computeSinglePaneColumnExtent as c } from "../logic/geometry.js";
|
|
6
|
+
import { scanInvalidCells as l } from "../logic/validation.js";
|
|
7
|
+
import { resolveDataRowNumber as u } from "../logic/labelRows.js";
|
|
8
|
+
import { resolveFirstEditableColIndex as d } from "../logic/newRow.js";
|
|
9
|
+
import { logicalToPhysicalScrollTop as f, physicalToLogicalScrollTop as p } from "../logic/verticalGeometry.js";
|
|
10
|
+
import { isScrolledToBottom as m } from "../utils/scrollBottom.js";
|
|
11
|
+
import { clearRowSelection as h, countSelectedRows as g, resolveIsRowSelected as _, rowSelectionFromModel as ee, rowSelectionToModel as te, selectAllRows as ne } from "../logic/rowSelection.js";
|
|
12
|
+
import { applyColumnState as re, buildGridState as v, dropUnknownColumnKeys as ie, extractColumnState as ae, isSameColumnLayout as oe, migrateGridStatePatch as se, resolveClosedColumnGroupsForState as ce } from "../logic/gridState.js";
|
|
13
|
+
import { createInertExportCommands as le } from "./features.js";
|
|
14
|
+
import { resolveChangeTargetIndex as ue } from "../logic/changeNavigation.js";
|
|
15
|
+
import { markUrgentFilters as de } from "../logic/urgentFilters.js";
|
|
16
|
+
import { computeHorizontalScrollTarget as fe, computeVerticalScrollTarget as pe } from "../logic/scrollTargets.js";
|
|
16
17
|
//#region src/engine/gridApi.ts
|
|
17
|
-
var
|
|
18
|
+
var me = (e) => {
|
|
18
19
|
if (process.env.NODE_ENV === "production") return;
|
|
19
20
|
let t = e.map((e) => `\`${e}\``).join(", ");
|
|
20
21
|
console.warn(`[spreadsheet-grid] applyState: 今の列定義(columns)に無い列 ${t} の列幅 / フィルター / 並べ替えを捨てました。列定義を読み込む前なら、列定義を渡してから applyState を呼んでください。列を消した後の古い保存状態なら、applyState の後の getState() の値を保存し直すと出なくなります。
|
|
21
22
|
[spreadsheet-grid] applyState: dropped the widths / filters / sort of ${t}, which are not in the current columns. If the columns are not loaded yet, pass them before calling applyState. If the saved state is from before those columns were removed, save getState() again after applyState to stop this warning.`);
|
|
22
|
-
},
|
|
23
|
+
}, y = (e, t) => {
|
|
23
24
|
process.env.NODE_ENV === "production" || e.has(t) || (e.add(t), console.warn(`[spreadsheet-grid] ${t}: trackChanges が効いていないので、何もしません(trackChanges と rowKeyGetter を指定し、clientSide の rows + onRowsChange で使ってください。/lite では機能セットに changeTracking: changeTrackingFeature も要ります)。
|
|
24
25
|
[spreadsheet-grid] ${t}: does nothing because trackChanges is not active (set trackChanges and rowKeyGetter, and use clientSide rows with onRowsChange. With /lite, also add changeTracking: changeTrackingFeature to the features).`));
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
}, he = (e, t) => {
|
|
27
|
+
process.env.NODE_ENV === "production" || e.has(t) || (e.add(t), console.warn(`[spreadsheet-grid] ${t}: trackChanges の baseline が効いていないので、何もしません(trackChanges={{ baseline }} と rowKeyGetter を指定し、clientSide で使ってください。createSpreadsheetGrid で組み立てるときは機能セットに changeTracking と diffView: diffViewFeature も要ります)。
|
|
28
|
+
[spreadsheet-grid] ${t}: does nothing because trackChanges.baseline is not active (set trackChanges={{ baseline }} and rowKeyGetter on a client-side grid. With createSpreadsheetGrid, also add changeTracking and diffView: diffViewFeature to the features).`));
|
|
29
|
+
}, ge = /^(get|is|can|export|download)/, _e = 1e3, b = (b = {}) => {
|
|
30
|
+
let x = null, S = !1, C = /* @__PURE__ */ new Set(), w = !1, T = null, E = (e) => T !== null && T.base === e.columns ? T.next : e.columns, D = (b.export?.createExportCommands ?? le)(() => x, b.grouping), O = null, k = null, A = null, j = /* @__PURE__ */ new Set(), M = (e) => {
|
|
31
|
+
process.env.NODE_ENV === "production" || j.has(e) || (j.add(e), console.warn(`[spreadsheet-grid] ${e}: ツリーデータが効いていません(treeData と rowKeyGetter が要り、clientSide だけです。/lite では treeData: treeDataFeature を組み込みます)。
|
|
28
32
|
[spreadsheet-grid] ${e}: tree data is not active (it needs treeData and rowKeyGetter, works only on the client side, and needs treeData: treeDataFeature in /lite).`));
|
|
29
|
-
},
|
|
30
|
-
let n = t.getOpenResolver?.(
|
|
33
|
+
}, N = (e, t) => {
|
|
34
|
+
let n = t.getOpenResolver?.(J(e).treeOpen);
|
|
31
35
|
if (n) return n;
|
|
32
36
|
let r = t.stage.display.open;
|
|
33
37
|
return (e) => r[e] === 1;
|
|
34
|
-
},
|
|
35
|
-
let r =
|
|
38
|
+
}, P = (t, n) => {
|
|
39
|
+
let r = x, i = r?.treeData;
|
|
36
40
|
if (!r || !i) return [];
|
|
37
|
-
let { structure: a, layout: o } = i.stage, s =
|
|
41
|
+
let { structure: a, layout: o } = i.stage, s = N(r, i), c = t.filter((e) => {
|
|
38
42
|
let t = a.keyToIndex.get(e);
|
|
39
43
|
return t !== void 0 && o.childStart[t + 1] > o.childStart[t] && s(t) !== n;
|
|
40
44
|
});
|
|
41
45
|
if (c.length === 0) return [];
|
|
42
|
-
let l =
|
|
43
|
-
return r.dispatch(e.setTreeRowsOpen(c, n, i.filterSignature)),
|
|
44
|
-
},
|
|
45
|
-
let n =
|
|
46
|
-
n && (
|
|
46
|
+
let l = J(r).treeOpen;
|
|
47
|
+
return r.dispatch(e.setTreeRowsOpen(c, n, i.filterSignature)), J(r).treeOpen === l ? [] : c;
|
|
48
|
+
}, F = (e, t) => {
|
|
49
|
+
let n = x;
|
|
50
|
+
n && (k = {
|
|
47
51
|
rowKey: e,
|
|
48
52
|
colIndex: t,
|
|
49
53
|
rowModel: n.rowModel,
|
|
50
54
|
until: Date.now() + 1e3
|
|
51
55
|
});
|
|
52
|
-
},
|
|
53
|
-
let e =
|
|
56
|
+
}, I = () => {
|
|
57
|
+
let e = x, t = O;
|
|
54
58
|
if (!e || t === null) return;
|
|
55
|
-
|
|
59
|
+
O = null;
|
|
56
60
|
let n = i(e.rowModel, t.rowKey, /* @__PURE__ */ new Map());
|
|
57
61
|
if (n < 0) {
|
|
58
|
-
|
|
62
|
+
F(t.rowKey, t.colIndex);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (e.rowModel.getRemovedRow?.(n) !== void 0) {
|
|
66
|
+
V(H(n, "auto"), null, "auto"), e.setChangeNavRow?.(t.rowKey);
|
|
59
67
|
return;
|
|
60
68
|
}
|
|
61
69
|
if (t.colIndex !== null) {
|
|
@@ -63,59 +71,59 @@ var de = (e) => {
|
|
|
63
71
|
return;
|
|
64
72
|
}
|
|
65
73
|
let r = "auto";
|
|
66
|
-
H(
|
|
67
|
-
},
|
|
68
|
-
let n =
|
|
74
|
+
V(H(n, r), null, r);
|
|
75
|
+
}, L = (e, t) => {
|
|
76
|
+
let n = x;
|
|
69
77
|
if (!n) return [];
|
|
70
78
|
let r = n.treeData;
|
|
71
|
-
if (r &&
|
|
79
|
+
if (r && b.treeData) {
|
|
72
80
|
let i = r.stage.structure.keyToIndex.get(e);
|
|
73
|
-
if (i === void 0) return
|
|
81
|
+
if (i === void 0) return F(e, t), [];
|
|
74
82
|
if (r.stage.visibility.included !== null && r.stage.visibility.included[i] !== 1) return [];
|
|
75
|
-
let a =
|
|
83
|
+
let a = N(n, r), o = b.treeData.collectTreeAncestors(r.stage.structure, i).reverse().filter((e) => !a(e)).map((e) => r.stage.structure.keys[e]), s = P(o, !0);
|
|
76
84
|
for (let e of s) r.notifyOpenChange(e, !0);
|
|
77
|
-
if (s.length > 0) return
|
|
85
|
+
if (s.length > 0) return O = {
|
|
78
86
|
rowKey: e,
|
|
79
87
|
colIndex: t
|
|
80
88
|
}, s;
|
|
81
89
|
}
|
|
82
|
-
return
|
|
90
|
+
return O = {
|
|
83
91
|
rowKey: e,
|
|
84
92
|
colIndex: t
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
let r = Math.max(e.scrollHeight - e.clientHeight, 0), i = Math.max(e.scrollWidth - e.clientWidth, 0), a = Math.min(Math.max(t.top, 0), r), o = Math.min(Math.max(t.left, 0), i), s = e.scrollTop, c = e.scrollLeft, l = Math.round(a) !== Math.round(s) || Math.round(o) !== Math.round(c) ?
|
|
93
|
+
}, I(), [];
|
|
94
|
+
}, R = null, z = !1, B = (e, t, n = "auto") => {
|
|
95
|
+
let r = Math.max(e.scrollHeight - e.clientHeight, 0), i = Math.max(e.scrollWidth - e.clientWidth, 0), a = Math.min(Math.max(t.top, 0), r), o = Math.min(Math.max(t.left, 0), i), s = e.scrollTop, c = e.scrollLeft, l = Math.round(a) !== Math.round(s) || Math.round(o) !== Math.round(c) ? x?.markApiScroll() : void 0;
|
|
88
96
|
e.scrollTo({
|
|
89
97
|
top: a,
|
|
90
98
|
left: o,
|
|
91
99
|
behavior: n
|
|
92
100
|
}), l && n === "auto" && e.scrollTop === s && e.scrollLeft === c && getComputedStyle(e).scrollBehavior !== "smooth" && l();
|
|
93
|
-
},
|
|
94
|
-
let r =
|
|
101
|
+
}, V = (e, t, n) => {
|
|
102
|
+
let r = x?.scrollContainerRef.current ?? null, i = x;
|
|
95
103
|
if (!r || !i) return;
|
|
96
|
-
let a =
|
|
97
|
-
|
|
104
|
+
let a = p(r.scrollTop, i.verticalScaleFactor), o = e ?? a, s = o === a ? r.scrollTop : f(o, i.verticalScaleFactor);
|
|
105
|
+
B(r, {
|
|
98
106
|
top: n === "end" || n === "auto" && o > a ? Math.ceil(s) : s,
|
|
99
107
|
left: t === null ? r.scrollLeft : t
|
|
100
108
|
});
|
|
101
|
-
},
|
|
102
|
-
let n =
|
|
109
|
+
}, H = (e, t) => {
|
|
110
|
+
let n = x?.scrollContainerRef.current ?? null, r = x;
|
|
103
111
|
if (!n || !r || r.viewRowCount === 0) return null;
|
|
104
112
|
let i = Math.min(Math.max(e, 0), r.viewRowCount - 1);
|
|
105
|
-
return
|
|
113
|
+
return pe({
|
|
106
114
|
rowTop: r.rowMetrics.rowTop(i),
|
|
107
115
|
rowHeight: r.rowMetrics.cellHeight(i),
|
|
108
116
|
headerHeight: r.headerHeight,
|
|
109
117
|
viewportHeight: n.clientHeight - (r.footerHeight ?? 0),
|
|
110
|
-
currentScrollTop:
|
|
118
|
+
currentScrollTop: p(n.scrollTop, r.verticalScaleFactor),
|
|
111
119
|
align: t,
|
|
112
120
|
stickyTopInset: r.stickyTopInset
|
|
113
121
|
});
|
|
114
|
-
},
|
|
115
|
-
let n =
|
|
122
|
+
}, U = (e, t) => {
|
|
123
|
+
let n = x?.scrollContainerRef.current ?? null, r = x;
|
|
116
124
|
if (!n || !r) return null;
|
|
117
|
-
let i =
|
|
118
|
-
return !i || i.pane !== "center" ? null :
|
|
125
|
+
let i = c(r.paneLayout, e);
|
|
126
|
+
return !i || i.pane !== "center" ? null : fe({
|
|
119
127
|
cellLeft: r.leftPaneTotalWidth + r.centerLeadingWidth + i.extent.start,
|
|
120
128
|
cellWidth: i.extent.width,
|
|
121
129
|
leftPaneWidth: r.leftPaneTotalWidth,
|
|
@@ -124,146 +132,187 @@ var de = (e) => {
|
|
|
124
132
|
currentScrollLeft: n.scrollLeft,
|
|
125
133
|
align: t
|
|
126
134
|
});
|
|
127
|
-
},
|
|
128
|
-
H(
|
|
129
|
-
},
|
|
130
|
-
let t =
|
|
135
|
+
}, W = (e, t, n) => {
|
|
136
|
+
V(H(e, n), U(t, n), n);
|
|
137
|
+
}, G = (e) => e.viewRowCount <= 0 || e.orderedColumns.length === 0, K = (e) => {
|
|
138
|
+
let t = x;
|
|
131
139
|
return t ? {
|
|
132
140
|
row: Math.min(Math.max(e.row, 0), Math.max(t.viewRowCount - 1, 0)),
|
|
133
141
|
col: Math.min(Math.max(e.col, 0), Math.max(t.orderedColumns.length - 1, 0))
|
|
134
142
|
} : e;
|
|
135
|
-
},
|
|
143
|
+
}, q = (e, t, n = 1) => {
|
|
136
144
|
let r = (t) => e.rowModel.getLabelRow?.(t) !== void 0;
|
|
137
145
|
if (!r(t)) return t;
|
|
138
146
|
for (let i of [n, -n]) for (let n = t + i; n >= 0 && n < e.viewRowCount; n += i) if (!r(n)) return n;
|
|
139
147
|
return t;
|
|
140
|
-
},
|
|
148
|
+
}, J = (e) => e.getUiState?.() ?? e.uiState, Y = (e) => e.pendingRowSelection?.() ?? J(e).rowSelection, X = null, ve = /* @__PURE__ */ new Set(), ye = (t) => {
|
|
149
|
+
let n = x, r = b.diffView?.collectChangeTargets;
|
|
150
|
+
if (!n?.diffActive || !n.changeTracker || !r) return he(ve, t === 1 ? "goToNextChange" : "goToPrevChange"), !1;
|
|
151
|
+
if (S) return !1;
|
|
152
|
+
let o = n.changeTracker, s = r(n.rowModel, n.orderedColumns, o);
|
|
153
|
+
if (s.length === 0) return !1;
|
|
154
|
+
let c = J(n).activeCell, l = null, u = X, d = u !== null && (u.active === null ? c === null : c !== null && c.row === u.active.row && c.col === u.active.col);
|
|
155
|
+
if (u !== null && d) {
|
|
156
|
+
let e = i(n.rowModel, u.rowKey, /* @__PURE__ */ new Map());
|
|
157
|
+
e >= 0 && (l = {
|
|
158
|
+
row: e,
|
|
159
|
+
col: u.columnKey === null ? -1 : n.orderedColumns.findIndex((e) => e.key === u.columnKey)
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (l === null && c !== null) {
|
|
163
|
+
let e = n.rowModel.getRow(c.row) == null ? void 0 : n.rowModel.getRowKey(c.row);
|
|
164
|
+
l = {
|
|
165
|
+
row: c.row,
|
|
166
|
+
col: e !== void 0 && o.isAddedRow(e) ? -1 : c.col
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
let f = ue(s, l, t), p = s[f];
|
|
170
|
+
if (p === void 0) return !1;
|
|
171
|
+
let m = n.rowModel.getRowKey(p.row), h = a(n.orderedColumns);
|
|
172
|
+
if (p.kind === "removed") return W(p.row, c?.col ?? h, "auto"), n.setChangeNavRow?.(m), X = {
|
|
173
|
+
rowKey: m,
|
|
174
|
+
columnKey: null,
|
|
175
|
+
active: c === null ? null : { ...c }
|
|
176
|
+
}, n.announceChangeNav?.(p, f + 1, s.length), !0;
|
|
177
|
+
let g = c !== null && c.col >= h && c.col < n.orderedColumns.length, _ = p.col >= 0 ? p.col : g ? c.col : h;
|
|
178
|
+
return n.setChangeNavRow?.(null), n.dispatch(e.startSelection({
|
|
179
|
+
row: p.row,
|
|
180
|
+
col: _
|
|
181
|
+
})), n.dispatch(e.endSelection()), W(p.row, _, "auto"), X = {
|
|
182
|
+
rowKey: m,
|
|
183
|
+
columnKey: p.col >= 0 ? n.orderedColumns[p.col]?.key ?? null : null,
|
|
184
|
+
active: {
|
|
185
|
+
row: p.row,
|
|
186
|
+
col: _
|
|
187
|
+
}
|
|
188
|
+
}, n.focusGrid?.(), n.announceChangeNav?.(p, f + 1, s.length), !0;
|
|
189
|
+
}, Z = {
|
|
141
190
|
model: null,
|
|
142
191
|
map: /* @__PURE__ */ new Map()
|
|
143
192
|
}, Q = {
|
|
144
193
|
scrollToRow: (e, t) => {
|
|
145
194
|
let n = t?.align ?? "auto";
|
|
146
|
-
H(
|
|
195
|
+
V(H(e, n), null, n);
|
|
147
196
|
},
|
|
148
|
-
scrollToCell: (e, t, n) =>
|
|
197
|
+
scrollToCell: (e, t, n) => W(e, t, n?.align ?? "auto"),
|
|
149
198
|
scrollToTop: () => {
|
|
150
|
-
let e =
|
|
151
|
-
e &&
|
|
199
|
+
let e = x?.scrollContainerRef.current ?? null;
|
|
200
|
+
e && B(e, {
|
|
152
201
|
top: 0,
|
|
153
202
|
left: e.scrollLeft
|
|
154
203
|
});
|
|
155
204
|
},
|
|
156
205
|
scrollToBottom: () => {
|
|
157
|
-
let e =
|
|
158
|
-
!e || !t || (
|
|
206
|
+
let e = x?.scrollContainerRef.current ?? null, t = x;
|
|
207
|
+
!e || !t || (B(e, {
|
|
159
208
|
top: Math.max(t.headerHeight + t.physicalBodyHeight + (t.footerHeight ?? 0) - e.clientHeight, 0),
|
|
160
209
|
left: e.scrollLeft
|
|
161
|
-
}),
|
|
210
|
+
}), R = t.measuredRowHeights ? {
|
|
162
211
|
pinnedTop: e.scrollTop,
|
|
163
|
-
until: Date.now() +
|
|
164
|
-
} : null,
|
|
212
|
+
until: Date.now() + _e
|
|
213
|
+
} : null, z = !1);
|
|
165
214
|
},
|
|
166
215
|
getScrollPosition: () => {
|
|
167
|
-
let e =
|
|
216
|
+
let e = x?.scrollContainerRef.current ?? null;
|
|
168
217
|
return e ? {
|
|
169
218
|
top: e.scrollTop,
|
|
170
219
|
left: e.scrollLeft
|
|
171
220
|
} : null;
|
|
172
221
|
},
|
|
173
222
|
isAtBottom: () => {
|
|
174
|
-
let e =
|
|
175
|
-
return e ?
|
|
223
|
+
let e = x?.scrollContainerRef.current ?? null;
|
|
224
|
+
return e ? m(e) : !1;
|
|
176
225
|
},
|
|
177
226
|
setScrollPosition: (e, t) => {
|
|
178
|
-
let n =
|
|
179
|
-
n &&
|
|
227
|
+
let n = x?.scrollContainerRef.current ?? null;
|
|
228
|
+
n && B(n, {
|
|
180
229
|
top: e.top ?? n.scrollTop,
|
|
181
230
|
left: e.left ?? n.scrollLeft
|
|
182
231
|
}, t?.behavior ?? "auto");
|
|
183
232
|
},
|
|
184
233
|
getVisibleRowRange: () => {
|
|
185
|
-
let e =
|
|
234
|
+
let e = x;
|
|
186
235
|
return !e || e.windowLastRow < e.windowFirstRow ? null : {
|
|
187
236
|
startIndex: e.windowFirstRow,
|
|
188
237
|
endIndex: e.windowLastRow + 1
|
|
189
238
|
};
|
|
190
239
|
},
|
|
191
240
|
getActiveCell: () => {
|
|
192
|
-
let e =
|
|
241
|
+
let e = x ? J(x).activeCell : null;
|
|
193
242
|
return e ? {
|
|
194
243
|
row: e.row,
|
|
195
244
|
col: e.col
|
|
196
245
|
} : null;
|
|
197
246
|
},
|
|
198
247
|
setActiveCell: (t, n) => {
|
|
199
|
-
let r =
|
|
200
|
-
if (!r || t &&
|
|
201
|
-
let i = t ?
|
|
202
|
-
row:
|
|
248
|
+
let r = x;
|
|
249
|
+
if (!r || t && G(r)) return;
|
|
250
|
+
let i = t ? K(t) : null, a = i ? {
|
|
251
|
+
row: q(r, i.row),
|
|
203
252
|
col: i.col
|
|
204
253
|
} : null;
|
|
205
|
-
a !== null && a.row === r.rowModel.newRow?.index && (r.dispatch(e.startSelection(a)), r.dispatch(e.endSelection())), r.dispatch(e.activateCell(a)), a && n?.scrollIntoView &&
|
|
254
|
+
a !== null && a.row === r.rowModel.newRow?.index && (r.dispatch(e.startSelection(a)), r.dispatch(e.endSelection())), r.dispatch(e.activateCell(a)), a && n?.scrollIntoView && W(a.row, a.col, "auto");
|
|
206
255
|
},
|
|
207
|
-
getSelection: () =>
|
|
256
|
+
getSelection: () => x ? J(x).selection : null,
|
|
208
257
|
focus: () => {
|
|
209
|
-
|
|
258
|
+
x?.focusGrid?.();
|
|
210
259
|
},
|
|
211
260
|
startEditing: (t, n) => {
|
|
212
|
-
let r =
|
|
261
|
+
let r = x;
|
|
213
262
|
if (!r || !r.startEditCell || t === void 0 != (n === void 0)) return !1;
|
|
214
|
-
let i =
|
|
263
|
+
let i = J(r);
|
|
215
264
|
if (i.editingCell !== null) return !1;
|
|
216
265
|
let a = t === void 0 || n === void 0 ? i.activeCell : {
|
|
217
266
|
row: t,
|
|
218
267
|
col: n
|
|
219
268
|
};
|
|
220
|
-
return !a || !Number.isInteger(a.row) || !Number.isInteger(a.col) || a.row < 0 || a.row >= r.viewRowCount || a.col < 0 || a.col >= r.orderedColumns.length || !r.startEditCell(a) ? !1 : (r.dispatch(e.startSelection(a)), r.dispatch(e.endSelection()),
|
|
269
|
+
return !a || !Number.isInteger(a.row) || !Number.isInteger(a.col) || a.row < 0 || a.row >= r.viewRowCount || a.col < 0 || a.col >= r.orderedColumns.length || !r.startEditCell(a) ? !1 : (r.dispatch(e.startSelection(a)), r.dispatch(e.endSelection()), W(a.row, a.col, "auto"), r.focusGrid?.(), !0);
|
|
221
270
|
},
|
|
222
271
|
focusNewRow: () => {
|
|
223
|
-
let t =
|
|
272
|
+
let t = x, n = t?.rowModel.newRow;
|
|
224
273
|
if (!t || !n) return !1;
|
|
225
|
-
let r =
|
|
274
|
+
let r = d(t.orderedColumns, t.readOnly);
|
|
226
275
|
if (r < 0) return !1;
|
|
227
276
|
let i = {
|
|
228
277
|
row: n.index,
|
|
229
278
|
col: r
|
|
230
279
|
};
|
|
231
|
-
return t.dispatch(e.startSelection(i)), t.dispatch(e.endSelection()), t.dispatch(e.activateCell(i)),
|
|
280
|
+
return t.dispatch(e.startSelection(i)), t.dispatch(e.endSelection()), t.dispatch(e.activateCell(i)), W(i.row, i.col, "auto"), t.focusGrid?.(), !0;
|
|
232
281
|
},
|
|
233
282
|
commitNewRow: () => {
|
|
234
|
-
let e =
|
|
283
|
+
let e = x, t = e?.rowModel.newRow;
|
|
235
284
|
if (!e || !t) return !1;
|
|
236
|
-
let n =
|
|
285
|
+
let n = J(e).editingCell;
|
|
237
286
|
return n !== null && n.row === t.index && e.focusGrid?.(), t.hasDraft() ? t.commit() : !1;
|
|
238
287
|
},
|
|
239
288
|
getViewRowIndex: (e) => {
|
|
240
|
-
let t =
|
|
289
|
+
let t = x;
|
|
241
290
|
return t ? (Z.model !== t.rowModel && (Z = {
|
|
242
291
|
model: t.rowModel,
|
|
243
292
|
map: /* @__PURE__ */ new Map()
|
|
244
293
|
}), i(t.rowModel, e, Z.map)) : -1;
|
|
245
294
|
},
|
|
246
|
-
getColIndex: (e) =>
|
|
295
|
+
getColIndex: (e) => x?.orderedColumns.findIndex((t) => t.key === e) ?? -1,
|
|
247
296
|
getRowNumber: (e) => {
|
|
248
|
-
let t =
|
|
249
|
-
return !t || n < 0 || t.rowModel.getLabelRow?.(n) !== void 0 ? null : t.labelViewIndexes ?
|
|
297
|
+
let t = x, n = Q.getViewRowIndex(e);
|
|
298
|
+
return !t || n < 0 || t.rowModel.getLabelRow?.(n) !== void 0 ? null : t.labelViewIndexes ? u(t.labelViewIndexes, n) : n + 1;
|
|
250
299
|
},
|
|
251
300
|
selectCell: (t, n, r) => {
|
|
252
|
-
let i =
|
|
253
|
-
if (!i ||
|
|
254
|
-
let a =
|
|
301
|
+
let i = x;
|
|
302
|
+
if (!i || G(i)) return;
|
|
303
|
+
let a = K({
|
|
255
304
|
row: t,
|
|
256
305
|
col: n
|
|
257
306
|
}), o = {
|
|
258
|
-
row:
|
|
307
|
+
row: q(i, a.row),
|
|
259
308
|
col: a.col
|
|
260
309
|
};
|
|
261
|
-
i.dispatch(e.startSelection(o)), i.dispatch(e.endSelection()), r?.scrollIntoView &&
|
|
310
|
+
i.dispatch(e.startSelection(o)), i.dispatch(e.endSelection()), r?.scrollIntoView && W(o.row, o.col, "auto");
|
|
262
311
|
},
|
|
263
312
|
selectRange: (t, n) => {
|
|
264
|
-
let r =
|
|
265
|
-
if (!r ||
|
|
266
|
-
let i =
|
|
313
|
+
let r = x;
|
|
314
|
+
if (!r || G(r)) return;
|
|
315
|
+
let i = K(t.start), a = K(t.end), o = q(r, i.row, a.row < i.row ? -1 : 1);
|
|
267
316
|
(o < Math.min(i.row, a.row) || o > Math.max(i.row, a.row)) && (i = {
|
|
268
317
|
row: o,
|
|
269
318
|
col: i.col
|
|
@@ -273,50 +322,50 @@ var de = (e) => {
|
|
|
273
322
|
}), r.dispatch(e.startSelection(i)), r.dispatch(e.updateSelection(a)), r.dispatch(e.endSelection()), o !== i.row && r.dispatch(e.activateCell({
|
|
274
323
|
row: o,
|
|
275
324
|
col: i.col
|
|
276
|
-
})), n?.scrollIntoView &&
|
|
325
|
+
})), n?.scrollIntoView && W(a.row, a.col, "auto");
|
|
277
326
|
},
|
|
278
327
|
clearSelection: () => {
|
|
279
|
-
|
|
328
|
+
x?.dispatch(e.clearSelection());
|
|
280
329
|
},
|
|
281
330
|
getSelectedRows: () => {
|
|
282
|
-
let e =
|
|
331
|
+
let e = x;
|
|
283
332
|
if (!e) return [];
|
|
284
|
-
let t =
|
|
333
|
+
let t = J(e).selection;
|
|
285
334
|
if (!t) return [];
|
|
286
335
|
let n = [], r = (t) => {
|
|
287
336
|
let r = e.rowModel.getRow(t);
|
|
288
337
|
r && n.push(r);
|
|
289
338
|
};
|
|
290
339
|
if (t.type === "cell") {
|
|
291
|
-
let e =
|
|
340
|
+
let e = o(t.range);
|
|
292
341
|
for (let t = e.start.row; t <= e.end.row; t += 1) r(t);
|
|
293
342
|
} else if (t.type === "row") {
|
|
294
|
-
let e =
|
|
343
|
+
let e = s(t.startRow, t.endRow);
|
|
295
344
|
for (let t = e.startRow; t <= e.endRow; t += 1) r(t);
|
|
296
345
|
} else for (let t = 0; t < e.viewRowCount; t += 1) r(t);
|
|
297
346
|
return n;
|
|
298
347
|
},
|
|
299
|
-
exportCsv: (e) =>
|
|
300
|
-
downloadCsv: (e, t) =>
|
|
301
|
-
getExportData: (e) =>
|
|
348
|
+
exportCsv: (e) => D.exportCsv(e),
|
|
349
|
+
downloadCsv: (e, t) => D.downloadCsv(e, t),
|
|
350
|
+
getExportData: (e) => D.getExportData(e),
|
|
302
351
|
getState: () => {
|
|
303
|
-
let e =
|
|
304
|
-
if (!e) return
|
|
352
|
+
let e = x;
|
|
353
|
+
if (!e) return v({}, {
|
|
305
354
|
globalText: "",
|
|
306
355
|
columnFilters: {}
|
|
307
356
|
}, [], []);
|
|
308
|
-
let t =
|
|
309
|
-
return
|
|
357
|
+
let t = J(e), n = e.includeGroupingInState === !0;
|
|
358
|
+
return v(t.columnWidths, t.filters, t.sort, ae(E(e), n), void 0, n ? t.collapsedGroupKeys : void 0, ce(e.columnGroupTree, t.closedColumnGroupKeys), e.treeData?.getClosedRowKeys(t.treeOpen) ?? void 0);
|
|
310
359
|
},
|
|
311
360
|
applyState: (t) => {
|
|
312
|
-
let n =
|
|
361
|
+
let n = x;
|
|
313
362
|
if (!n) return;
|
|
314
|
-
let { patch: r, dropped: i } = se(
|
|
315
|
-
i.length > 0 &&
|
|
316
|
-
let a =
|
|
363
|
+
let { patch: r, dropped: i } = ie(se(t), new Set(n.columns.map((e) => e.key)));
|
|
364
|
+
i.length > 0 && me(i);
|
|
365
|
+
let a = J(n);
|
|
317
366
|
if (n.onColumnsChange && r.columns) {
|
|
318
|
-
let e =
|
|
319
|
-
|
|
367
|
+
let e = E(n), t = re(e, r.columns, r.columnWidths ?? a.columnWidths);
|
|
368
|
+
oe(e, t) || (T = {
|
|
320
369
|
base: n.columns,
|
|
321
370
|
next: t
|
|
322
371
|
}, n.onColumnsChange(t));
|
|
@@ -326,12 +375,12 @@ var de = (e) => {
|
|
|
326
375
|
globalText: r.filters.globalText ?? a.filters.globalText,
|
|
327
376
|
columnFilters: r.filters.columnFilters ?? a.filters.columnFilters
|
|
328
377
|
};
|
|
329
|
-
|
|
378
|
+
de(t), n.dispatch(e.setAllFilters(t));
|
|
330
379
|
}
|
|
331
380
|
r.sort && n.dispatch(e.setSort(r.sort)), r.collapsedGroups && n.dispatch(e.setCollapsedGroupKeys(new Set(r.collapsedGroups))), r.closedColumnGroups && n.dispatch(e.setClosedColumnGroupKeys(new Set(r.closedColumnGroups))), r.closedTreeRows && n.dispatch(e.setClosedTreeRowKeys(r.closedTreeRows));
|
|
332
381
|
},
|
|
333
382
|
setColumnGroupOpen: (t, n) => {
|
|
334
|
-
let r =
|
|
383
|
+
let r = x;
|
|
335
384
|
if (r) {
|
|
336
385
|
if (!r.columnGroupTree?.groups.get(t)?.collapsible) {
|
|
337
386
|
process.env.NODE_ENV !== "production" && !r.columnGroupTree ? console.warn("[spreadsheet-grid] setColumnGroupOpen: 列のグループがありません(columnGroups を渡していないか、/lite で columnGroups: columnGroupsFeature を組み込んでいません)。\n[spreadsheet-grid] setColumnGroupOpen: there are no column groups (columnGroups is not passed, or columnGroups: columnGroupsFeature is not registered in /lite).") : process.env.NODE_ENV !== "production" && console.warn(`[spreadsheet-grid] setColumnGroupOpen: 開閉できる列のグループ \`${t}\` がありません(columnGroups の collapsible)。\n[spreadsheet-grid] setColumnGroupOpen: there is no collapsible column group \`${t}\` (collapsible in columnGroups).`);
|
|
@@ -341,47 +390,47 @@ var de = (e) => {
|
|
|
341
390
|
}
|
|
342
391
|
},
|
|
343
392
|
setTreeRowOpen: (e, t) => {
|
|
344
|
-
let n =
|
|
393
|
+
let n = x;
|
|
345
394
|
if (!n?.treeData) {
|
|
346
|
-
|
|
395
|
+
M("setTreeRowOpen");
|
|
347
396
|
return;
|
|
348
397
|
}
|
|
349
|
-
for (let r of
|
|
398
|
+
for (let r of P([e], t)) n.treeData.notifyOpenChange(r, t);
|
|
350
399
|
},
|
|
351
400
|
expandAllTreeRows: () => {
|
|
352
|
-
let t =
|
|
401
|
+
let t = x;
|
|
353
402
|
if (!t?.treeData) {
|
|
354
|
-
|
|
403
|
+
M("expandAllTreeRows");
|
|
355
404
|
return;
|
|
356
405
|
}
|
|
357
406
|
t.dispatch(e.setAllTreeRowsOpen(!0, t.treeData.filterSignature));
|
|
358
407
|
},
|
|
359
408
|
collapseAllTreeRows: () => {
|
|
360
|
-
let t =
|
|
409
|
+
let t = x;
|
|
361
410
|
if (!t?.treeData) {
|
|
362
|
-
|
|
411
|
+
M("collapseAllTreeRows");
|
|
363
412
|
return;
|
|
364
413
|
}
|
|
365
414
|
t.dispatch(e.setAllTreeRowsOpen(!1, t.treeData.filterSignature));
|
|
366
415
|
},
|
|
367
416
|
revealRow: (e, t) => {
|
|
368
417
|
let n = t?.columnKey === void 0 ? -1 : Q.getColIndex(t.columnKey);
|
|
369
|
-
|
|
418
|
+
L(e, n >= 0 ? n : null);
|
|
370
419
|
},
|
|
371
420
|
getRowSelection: () => {
|
|
372
|
-
let e =
|
|
373
|
-
return e ?
|
|
421
|
+
let e = x;
|
|
422
|
+
return e ? te(Y(e)) : {
|
|
374
423
|
type: "include",
|
|
375
424
|
rowKeys: []
|
|
376
425
|
};
|
|
377
426
|
},
|
|
378
427
|
setRowSelection: (e) => {
|
|
379
|
-
|
|
428
|
+
x?.commitRowSelection(ee(e));
|
|
380
429
|
},
|
|
381
430
|
getSelectedRowKeys: () => {
|
|
382
|
-
let e =
|
|
431
|
+
let e = x;
|
|
383
432
|
if (!e) return [];
|
|
384
|
-
let t =
|
|
433
|
+
let t = Y(e);
|
|
385
434
|
if (t.mode === "include") return Array.from(t.keys);
|
|
386
435
|
let n = [], r = e.rowModel.getRowCount();
|
|
387
436
|
for (let i = 0; i < r; i += 1) {
|
|
@@ -392,42 +441,42 @@ var de = (e) => {
|
|
|
392
441
|
return n;
|
|
393
442
|
},
|
|
394
443
|
getSelectedRowData: () => {
|
|
395
|
-
let e =
|
|
444
|
+
let e = x;
|
|
396
445
|
if (!e) return [];
|
|
397
|
-
let t =
|
|
446
|
+
let t = Y(e), n = [], r = e.rowModel.getRowCount();
|
|
398
447
|
for (let i = 0; i < r; i += 1) {
|
|
399
448
|
let r = e.rowModel.getRow(i);
|
|
400
|
-
r &&
|
|
449
|
+
r && _(t, e.rowModel.getRowKey(i) ?? i) && n.push(r);
|
|
401
450
|
}
|
|
402
451
|
return n;
|
|
403
452
|
},
|
|
404
453
|
getSelectedRowCount: () => {
|
|
405
|
-
let e =
|
|
406
|
-
return e ?
|
|
454
|
+
let e = x;
|
|
455
|
+
return e ? g(Y(e), e.leafRowCount) : 0;
|
|
407
456
|
},
|
|
408
457
|
isRowSelected: (e) => {
|
|
409
|
-
let t =
|
|
410
|
-
return t ?
|
|
458
|
+
let t = x;
|
|
459
|
+
return t ? _(Y(t), e) : !1;
|
|
411
460
|
},
|
|
412
461
|
selectAllRows: () => {
|
|
413
|
-
|
|
462
|
+
x?.commitRowSelection(ne());
|
|
414
463
|
},
|
|
415
464
|
clearRowSelection: () => {
|
|
416
|
-
|
|
465
|
+
x?.commitRowSelection(h());
|
|
417
466
|
},
|
|
418
467
|
undo: () => {
|
|
419
|
-
|
|
468
|
+
x?.undoRows();
|
|
420
469
|
},
|
|
421
470
|
redo: () => {
|
|
422
|
-
|
|
471
|
+
x?.redoRows();
|
|
423
472
|
},
|
|
424
|
-
canUndo: () =>
|
|
425
|
-
canRedo: () =>
|
|
473
|
+
canUndo: () => x?.canUndoRows() ?? !1,
|
|
474
|
+
canRedo: () => x?.canRedoRows() ?? !1,
|
|
426
475
|
clearUndoHistory: () => {
|
|
427
|
-
|
|
476
|
+
x?.clearUndoHistory();
|
|
428
477
|
},
|
|
429
478
|
applyRows: (e, t) => {
|
|
430
|
-
let n =
|
|
479
|
+
let n = x;
|
|
431
480
|
if (n) {
|
|
432
481
|
if (!n.applyRowsChange || n.isServerSide) {
|
|
433
482
|
process.env.NODE_ENV !== "production" && console.warn("[spreadsheet-grid] applyRows: onRowsChange が無いか serverSide なので、何もしません(serverSide の行はサーバーで変えて refreshServerSide() で取り直してください)。\n[spreadsheet-grid] applyRows: does nothing without onRowsChange or with serverSide (change serverSide rows on the server and reload them with refreshServerSide()).");
|
|
@@ -442,26 +491,26 @@ var de = (e) => {
|
|
|
442
491
|
}
|
|
443
492
|
},
|
|
444
493
|
setGroupCollapsed: (t, n) => {
|
|
445
|
-
|
|
494
|
+
x?.dispatch(e.setGroupCollapsed(t, n));
|
|
446
495
|
},
|
|
447
496
|
expandAllGroups: () => {
|
|
448
|
-
|
|
497
|
+
x?.dispatch(e.setCollapsedGroupKeys(/* @__PURE__ */ new Set()));
|
|
449
498
|
},
|
|
450
499
|
collapseAllGroups: () => {
|
|
451
|
-
let n =
|
|
500
|
+
let n = x;
|
|
452
501
|
!n || !n.groupTree || n.dispatch(e.setCollapsedGroupKeys(new Set(t(n.groupTree))));
|
|
453
502
|
},
|
|
454
503
|
getGroupRows: () => {
|
|
455
|
-
let e =
|
|
504
|
+
let e = x;
|
|
456
505
|
if (!e?.groupTree) return [];
|
|
457
|
-
let t =
|
|
506
|
+
let t = J(e).collapsedGroupKeys;
|
|
458
507
|
return n(e.groupTree).map((e) => ({
|
|
459
508
|
...e,
|
|
460
509
|
collapsed: t.has(e.groupKey)
|
|
461
510
|
}));
|
|
462
511
|
},
|
|
463
512
|
setDetailRowExpanded: (t, n) => {
|
|
464
|
-
let i =
|
|
513
|
+
let i = x;
|
|
465
514
|
if (!(!i || !i.detailRowEnabled)) {
|
|
466
515
|
if (n && i.detailIsExpandable) {
|
|
467
516
|
let e = r(i.rowModel, t, i.detailIndexCacheRef.current, !i.isServerSide);
|
|
@@ -473,7 +522,7 @@ var de = (e) => {
|
|
|
473
522
|
})) return;
|
|
474
523
|
}
|
|
475
524
|
}
|
|
476
|
-
if (!n && i.beforeDetailRowsCollapse &&
|
|
525
|
+
if (!n && i.beforeDetailRowsCollapse && J(i).expandedDetailRowKeys.has(t)) {
|
|
477
526
|
let e = r(i.rowModel, t, i.detailIndexCacheRef.current, !i.isServerSide);
|
|
478
527
|
e >= 0 && i.beforeDetailRowsCollapse([e]);
|
|
479
528
|
}
|
|
@@ -481,55 +530,57 @@ var de = (e) => {
|
|
|
481
530
|
}
|
|
482
531
|
},
|
|
483
532
|
getExpandedDetailRowKeys: () => {
|
|
484
|
-
let e =
|
|
485
|
-
return e && e.detailRowEnabled ? Array.from(
|
|
533
|
+
let e = x;
|
|
534
|
+
return e && e.detailRowEnabled ? Array.from(J(e).expandedDetailRowKeys) : [];
|
|
486
535
|
},
|
|
487
536
|
collapseAllDetailRows: () => {
|
|
488
|
-
let t =
|
|
537
|
+
let t = x;
|
|
489
538
|
if (!(!t || !t.detailRowEnabled)) {
|
|
490
539
|
if (t.beforeDetailRowsCollapse) {
|
|
491
|
-
let e = Array.from(
|
|
540
|
+
let e = Array.from(J(t).expandedDetailRowKeys, (e) => r(t.rowModel, e, t.detailIndexCacheRef.current, !t.isServerSide)).filter((e) => e >= 0);
|
|
492
541
|
e.length > 0 && t.beforeDetailRowsCollapse(e);
|
|
493
542
|
}
|
|
494
543
|
t.dispatch(e.setExpandedDetailRowKeys(/* @__PURE__ */ new Set()));
|
|
495
544
|
}
|
|
496
545
|
},
|
|
497
546
|
moveRow: (e, t) => {
|
|
498
|
-
|
|
547
|
+
x?.moveRowByKey(e, t);
|
|
499
548
|
},
|
|
549
|
+
goToNextChange: () => ye(1),
|
|
550
|
+
goToPrevChange: () => ye(-1),
|
|
500
551
|
getChanges: () => {
|
|
501
|
-
let e =
|
|
502
|
-
return !e?.changeTrackingActive || !e.changeTracker ? (
|
|
552
|
+
let e = x;
|
|
553
|
+
return !e?.changeTrackingActive || !e.changeTracker ? (y(C, "getChanges"), {
|
|
503
554
|
rows: [],
|
|
504
555
|
rowCount: 0,
|
|
505
556
|
cellCount: 0
|
|
506
557
|
}) : e.changeTracker.getChanges();
|
|
507
558
|
},
|
|
508
559
|
markChangesSaved: (e) => {
|
|
509
|
-
let t =
|
|
560
|
+
let t = x;
|
|
510
561
|
if (!t?.changeTrackingActive || !t.changeTracker) {
|
|
511
|
-
|
|
562
|
+
y(C, "markChangesSaved");
|
|
512
563
|
return;
|
|
513
564
|
}
|
|
514
565
|
t.changeTracker.markChangesSaved(e);
|
|
515
566
|
},
|
|
516
567
|
revertChanges: (e) => {
|
|
517
|
-
let t =
|
|
568
|
+
let t = x;
|
|
518
569
|
if (!t?.changeTrackingActive || !t.changeTracker) {
|
|
519
|
-
|
|
570
|
+
y(C, "revertChanges");
|
|
520
571
|
return;
|
|
521
572
|
}
|
|
522
573
|
t.changeTracker.revertChanges(e);
|
|
523
574
|
},
|
|
524
575
|
getInvalidCells: () => {
|
|
525
|
-
let e =
|
|
576
|
+
let e = x;
|
|
526
577
|
if (!e) return [];
|
|
527
578
|
if (e.isServerSide) return process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] getInvalidCells は serverSide モードでは利用できません(空配列を返します)。\n[SpreadsheetGrid] getInvalidCells is not available with serverSide (returns an empty array)."), [];
|
|
528
579
|
let t = e.treeData, n = t?.stage.structure.childCount, r = t?.columnKey;
|
|
529
|
-
return
|
|
580
|
+
return l(e.rows, e.columns, e.resolvedRowKeyGetter, e.labelRowExport?.isLabelRow, e.localeTexts, n ? (e, t) => t.aggFunc != null && t.key !== r && (n[e] ?? 0) > 0 : void 0);
|
|
530
581
|
},
|
|
531
582
|
refreshServerSide: () => {
|
|
532
|
-
let e =
|
|
583
|
+
let e = x;
|
|
533
584
|
if (e) {
|
|
534
585
|
if (!e.isServerSide) {
|
|
535
586
|
process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] refreshServerSide は clientSide(rows)モードでは何もしません。dataSource を渡したときだけ有効です(createSpreadsheetGrid では features に serverSide: serverSideFeature も要ります)。\n[SpreadsheetGrid] refreshServerSide does nothing with clientSide rows. It works only when dataSource is passed (with createSpreadsheetGrid, features also needs serverSide: serverSideFeature).");
|
|
@@ -539,7 +590,7 @@ var de = (e) => {
|
|
|
539
590
|
}
|
|
540
591
|
},
|
|
541
592
|
retryServerSideLoads: () => {
|
|
542
|
-
let e =
|
|
593
|
+
let e = x;
|
|
543
594
|
if (e) {
|
|
544
595
|
if (!e.isServerSide) {
|
|
545
596
|
process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] retryServerSideLoads は clientSide(rows)モードでは何もしません。dataSource を渡したときだけ有効です(createSpreadsheetGrid では features に serverSide: serverSideFeature も要ります)。\n[SpreadsheetGrid] retryServerSideLoads does nothing with clientSide rows. It works only when dataSource is passed (with createSpreadsheetGrid, features also needs serverSide: serverSideFeature).");
|
|
@@ -549,14 +600,14 @@ var de = (e) => {
|
|
|
549
600
|
}
|
|
550
601
|
},
|
|
551
602
|
openFilterManager: () => {
|
|
552
|
-
|
|
603
|
+
x?.openToolPanel("filter");
|
|
553
604
|
},
|
|
554
605
|
closeFilterManager: () => {
|
|
555
|
-
let e =
|
|
606
|
+
let e = x;
|
|
556
607
|
e && e.activeToolPanelTab === "filter" && e.closeToolPanel();
|
|
557
608
|
},
|
|
558
609
|
openFind: (e) => {
|
|
559
|
-
let t =
|
|
610
|
+
let t = x?.find;
|
|
560
611
|
if (!t) return;
|
|
561
612
|
let n = typeof e == "object" && e ? e : null, r = n ? n.query : e;
|
|
562
613
|
if (t.replace) {
|
|
@@ -565,47 +616,47 @@ var de = (e) => {
|
|
|
565
616
|
}
|
|
566
617
|
t.open(typeof r == "string" ? r : void 0);
|
|
567
618
|
},
|
|
568
|
-
replaceNext: (e) =>
|
|
619
|
+
replaceNext: (e) => x?.find.replace?.replaceCurrent(e) ?? {
|
|
569
620
|
replaced: 0,
|
|
570
621
|
skipped: 0
|
|
571
622
|
},
|
|
572
|
-
replaceAll: (e) =>
|
|
623
|
+
replaceAll: (e) => x?.find.replace?.replaceAll(e) ?? Promise.resolve({
|
|
573
624
|
replaced: 0,
|
|
574
625
|
skipped: 0
|
|
575
626
|
}),
|
|
576
627
|
closeFind: () => {
|
|
577
|
-
|
|
628
|
+
x?.find.close();
|
|
578
629
|
},
|
|
579
630
|
findNext: () => {
|
|
580
|
-
|
|
631
|
+
x?.find.next();
|
|
581
632
|
},
|
|
582
633
|
findPrev: () => {
|
|
583
|
-
|
|
634
|
+
x?.find.prev();
|
|
584
635
|
}
|
|
585
636
|
}, $ = () => {
|
|
586
|
-
if (!
|
|
587
|
-
|
|
588
|
-
let e =
|
|
589
|
-
if (
|
|
637
|
+
if (!z) return;
|
|
638
|
+
z = !1;
|
|
639
|
+
let e = x;
|
|
640
|
+
if (R === null || e === null) return;
|
|
590
641
|
let t = e.scrollContainerRef.current;
|
|
591
|
-
if (!t || !e.measuredRowHeights || Date.now() >
|
|
592
|
-
|
|
642
|
+
if (!t || !e.measuredRowHeights || Date.now() > R.until || t.scrollTop < R.pinnedTop - 1) {
|
|
643
|
+
R = null;
|
|
593
644
|
return;
|
|
594
645
|
}
|
|
595
|
-
|
|
646
|
+
B(t, {
|
|
596
647
|
top: Math.max(e.headerHeight + e.physicalBodyHeight + (e.footerHeight ?? 0) - t.clientHeight, 0),
|
|
597
648
|
left: t.scrollLeft
|
|
598
|
-
}),
|
|
599
|
-
...
|
|
649
|
+
}), R = {
|
|
650
|
+
...R,
|
|
600
651
|
pinnedTop: t.scrollTop
|
|
601
652
|
};
|
|
602
653
|
};
|
|
603
654
|
for (let e of Object.keys(Q)) {
|
|
604
655
|
let t = Q[e];
|
|
605
|
-
typeof t != "function" ||
|
|
606
|
-
if (!
|
|
607
|
-
if (process.env.NODE_ENV !== "production" && !
|
|
608
|
-
[spreadsheet-grid] ${e}() on the handle of an unmounted grid does nothing (the handle was kept in a variable and called after the grid was removed, e.g. by conditional rendering). Reading methods (getState() and so on) return the values from when it was removed.`)), e === "startEditing" || e === "focusNewRow" || e === "commitNewRow") return !1;
|
|
656
|
+
typeof t != "function" || ge.test(e) || (Q[e] = (...n) => {
|
|
657
|
+
if (!S) return t(...n);
|
|
658
|
+
if (process.env.NODE_ENV !== "production" && !w && (w = !0, console.warn(`[spreadsheet-grid] 外したグリッドのハンドルの ${e}() は何もしません(ハンドルを変数に持ったまま、グリッドを条件付きの描画などで外した後に呼んだ)。読むメソッド(getState() など)は外したときの値を返します。
|
|
659
|
+
[spreadsheet-grid] ${e}() on the handle of an unmounted grid does nothing (the handle was kept in a variable and called after the grid was removed, e.g. by conditional rendering). Reading methods (getState() and so on) return the values from when it was removed.`)), e === "startEditing" || e === "focusNewRow" || e === "commitNewRow" || e === "goToNextChange" || e === "goToPrevChange") return !1;
|
|
609
660
|
if (e === "replaceNext") return {
|
|
610
661
|
replaced: 0,
|
|
611
662
|
skipped: 0
|
|
@@ -618,48 +669,48 @@ var de = (e) => {
|
|
|
618
669
|
}
|
|
619
670
|
return {
|
|
620
671
|
update: (e) => {
|
|
621
|
-
let t =
|
|
622
|
-
|
|
623
|
-
let n =
|
|
624
|
-
if (n !== null && n.rowModel !== e.rowModel && (
|
|
625
|
-
|
|
626
|
-
let t =
|
|
627
|
-
t !== null && t.rowKey === n.rowKey && t.rowModel === e.rowModel && (
|
|
672
|
+
let t = x?.physicalBodyHeight;
|
|
673
|
+
S = !1, x = e, T = null, t !== e.physicalBodyHeight && (z = !0);
|
|
674
|
+
let n = k;
|
|
675
|
+
if (n !== null && n.rowModel !== e.rowModel && (k = null, Date.now() <= n.until)) {
|
|
676
|
+
L(n.rowKey, n.colIndex);
|
|
677
|
+
let t = k;
|
|
678
|
+
t !== null && t.rowKey === n.rowKey && t.rowModel === e.rowModel && (k = null);
|
|
628
679
|
}
|
|
629
|
-
e.deferBottomPin || (
|
|
680
|
+
e.deferBottomPin || (I(), $());
|
|
630
681
|
},
|
|
631
682
|
handle: Q,
|
|
632
|
-
applyScroll:
|
|
633
|
-
verticalTargetFor:
|
|
634
|
-
horizontalTargetFor:
|
|
635
|
-
scrollToCellInternal:
|
|
683
|
+
applyScroll: V,
|
|
684
|
+
verticalTargetFor: H,
|
|
685
|
+
horizontalTargetFor: U,
|
|
686
|
+
scrollToCellInternal: W,
|
|
636
687
|
settleBottomPin: $,
|
|
637
|
-
flushPendingReveal:
|
|
688
|
+
flushPendingReveal: I,
|
|
638
689
|
revealCell: (e, t, n) => {
|
|
639
|
-
let r =
|
|
640
|
-
|
|
690
|
+
let r = x, i = A;
|
|
691
|
+
A = null;
|
|
641
692
|
let a = r?.treeData;
|
|
642
|
-
if (n === !0 && r && a &&
|
|
643
|
-
let t = a.stage.structure.keyToIndex.get(e), n = new Set(t === void 0 ? [] :
|
|
644
|
-
for (let e of
|
|
693
|
+
if (n === !0 && r && a && b.treeData && i && J(r).treeOpen === i.state) {
|
|
694
|
+
let t = a.stage.structure.keyToIndex.get(e), n = new Set(t === void 0 ? [] : b.treeData.collectTreeAncestors(a.stage.structure, t).map((e) => a.stage.structure.keys[e])), r = i.keys.filter((e) => !n.has(e)).reverse();
|
|
695
|
+
for (let e of P(r, !1)) a.notifyOpenChange(e, !1);
|
|
645
696
|
}
|
|
646
|
-
let o =
|
|
647
|
-
n === !0 && r && o.length > 0 && (
|
|
697
|
+
let o = L(e, t);
|
|
698
|
+
n === !0 && r && o.length > 0 && (A = {
|
|
648
699
|
keys: o,
|
|
649
|
-
state:
|
|
700
|
+
state: J(r).treeOpen
|
|
650
701
|
});
|
|
651
702
|
},
|
|
652
703
|
toggleTreeCell: (e, t) => {
|
|
653
|
-
let n =
|
|
704
|
+
let n = x, r = n?.treeData;
|
|
654
705
|
if (!n || !r || n.orderedColumns[e.col]?.key !== r.columnKey) return !1;
|
|
655
706
|
let i = n.rowModel.getRowKey(e.row);
|
|
656
|
-
if (i !== void 0) for (let e of
|
|
707
|
+
if (i !== void 0) for (let e of P([i], t)) r.notifyOpenChange(e, t);
|
|
657
708
|
return !0;
|
|
658
709
|
},
|
|
659
710
|
dispose: () => {
|
|
660
|
-
|
|
711
|
+
S = !0, R = null;
|
|
661
712
|
}
|
|
662
713
|
};
|
|
663
714
|
};
|
|
664
715
|
//#endregion
|
|
665
|
-
export {
|
|
716
|
+
export { b as createGridApi };
|