@ishibashi0112/spreadsheet-grid-core 1.2.0 → 1.3.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/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +1 -0
- package/dist/controllers/clipboardController.js +79 -70
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +75 -73
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +63 -61
- package/dist/controllers/detailRowController.cjs +1 -0
- package/dist/controllers/detailRowController.d.ts +41 -0
- package/dist/controllers/detailRowController.js +97 -0
- package/dist/controllers/detailTabOrder.cjs +1 -1
- package/dist/controllers/detailTabOrder.js +17 -16
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +4 -1
- package/dist/controllers/editController.js +163 -91
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.js +23 -19
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +107 -106
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +1 -0
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +87 -76
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +4 -0
- package/dist/controllers/keyboardController.js +101 -97
- package/dist/controllers/liveUiState.cjs +1 -0
- package/dist/controllers/liveUiState.d.ts +7 -0
- package/dist/controllers/liveUiState.js +4 -0
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +127 -126
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +3 -0
- package/dist/controllers/popoverSupport.js +62 -41
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +74 -73
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +1 -1
- package/dist/controllers/tooltipController.js +122 -97
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.js +55 -54
- package/dist/engine/cellCommands.cjs +1 -0
- package/dist/engine/cellCommands.d.ts +27 -0
- package/dist/engine/cellCommands.js +89 -0
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.d.ts +2 -1
- package/dist/engine/columnCommands.js +98 -67
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +2 -2
- package/dist/engine/gridApi.cjs +6 -5
- package/dist/engine/gridApi.d.ts +3 -0
- package/dist/engine/gridApi.js +158 -144
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +5 -0
- package/dist/engine/rowSelectionCommands.js +73 -38
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +2 -2
- package/dist/logic/cellPlacement.cjs +1 -0
- package/dist/logic/cellPlacement.d.ts +22 -0
- package/dist/logic/cellPlacement.js +44 -0
- package/dist/logic/contextMenuTarget.cjs +1 -1
- package/dist/logic/contextMenuTarget.d.ts +20 -2
- package/dist/logic/contextMenuTarget.js +62 -3
- package/dist/logic/dateFilterCondition.cjs +1 -1
- package/dist/logic/dateFilterCondition.d.ts +1 -0
- package/dist/logic/dateFilterCondition.js +17 -13
- package/dist/logic/density.cjs +1 -0
- package/dist/logic/density.d.ts +5 -0
- package/dist/logic/density.js +17 -0
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +6 -1
- package/dist/logic/detailRow.js +21 -17
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +10 -0
- package/dist/logic/domGuards.js +18 -2
- package/dist/logic/editorKeys.cjs +1 -0
- package/dist/logic/editorKeys.d.ts +30 -0
- package/dist/logic/editorKeys.js +34 -0
- package/dist/logic/editorStart.cjs +1 -0
- package/dist/logic/editorStart.d.ts +7 -0
- package/dist/logic/editorStart.js +23 -0
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +10 -7
- package/dist/logic/gridBarSummary.cjs +1 -0
- package/dist/logic/gridBarSummary.d.ts +27 -0
- package/dist/logic/gridBarSummary.js +137 -0
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +1 -0
- package/dist/logic/gridState.js +19 -16
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.js +2 -2
- package/dist/logic/rowDragTarget.cjs +1 -0
- package/dist/logic/rowDragTarget.d.ts +14 -0
- package/dist/logic/rowDragTarget.js +47 -0
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +27 -4
- package/dist/logic/selectEditorState.js +29 -14
- package/dist/logic/valueFormatters.d.ts +8 -3
- package/dist/model/gridTypes.core.d.ts +31 -12
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.js +60 -59
- package/dist/utils/editorVisibleBounds.cjs +1 -0
- package/dist/utils/editorVisibleBounds.d.ts +10 -0
- package/dist/utils/editorVisibleBounds.js +40 -0
- package/dist/utils/errorBubblePlacement.cjs +1 -0
- package/dist/utils/errorBubblePlacement.d.ts +8 -0
- package/dist/utils/errorBubblePlacement.js +26 -0
- package/dist/utils/multilineEditor.cjs +2 -0
- package/dist/utils/multilineEditor.d.ts +7 -0
- package/dist/utils/multilineEditor.js +22 -0
- package/dist/utils/popupContainer.cjs +1 -1
- package/dist/utils/popupContainer.js +35 -28
- package/dist/utils/shadowDom.cjs +1 -0
- package/dist/utils/shadowDom.d.ts +5 -0
- package/dist/utils/shadowDom.js +33 -0
- package/package.json +1 -1
package/dist/engine/gridApi.js
CHANGED
|
@@ -8,37 +8,37 @@ import { resolveDataRowNumber as l } from "../logic/labelRows.js";
|
|
|
8
8
|
import { logicalToPhysicalScrollTop as u, physicalToLogicalScrollTop as d } from "../logic/verticalGeometry.js";
|
|
9
9
|
import { isScrolledToBottom as f } from "../utils/scrollBottom.js";
|
|
10
10
|
import { clearRowSelection as p, countSelectedRows as m, resolveIsRowSelected as h, rowSelectionFromModel as g, rowSelectionToModel as _, selectAllRows as v } from "../logic/rowSelection.js";
|
|
11
|
-
import { applyColumnState as y, buildGridState as b, dropUnknownColumnKeys as x, extractColumnState as S,
|
|
12
|
-
import { createInertExportCommands as
|
|
13
|
-
import { markUrgentFilters as
|
|
14
|
-
import { computeHorizontalScrollTarget as
|
|
11
|
+
import { applyColumnState as y, buildGridState as b, dropUnknownColumnKeys as x, extractColumnState as S, isSameColumnLayout as C, migrateGridStatePatch as w } from "../logic/gridState.js";
|
|
12
|
+
import { createInertExportCommands as T } from "./features.js";
|
|
13
|
+
import { markUrgentFilters as E } from "../logic/urgentFilters.js";
|
|
14
|
+
import { computeHorizontalScrollTarget as D, computeVerticalScrollTarget as O } from "../logic/scrollTargets.js";
|
|
15
15
|
//#region src/engine/gridApi.ts
|
|
16
|
-
var
|
|
16
|
+
var k = (e) => {
|
|
17
17
|
if (process.env.NODE_ENV === "production") return;
|
|
18
18
|
let t = e.map((e) => `\`${e}\``).join(", ");
|
|
19
19
|
console.warn(`[spreadsheet-grid] applyState: 今の列定義(columns)に無い列 ${t} の列幅 / フィルター / 並べ替えを捨てました。列定義を読み込む前なら、列定義を渡してから applyState を呼んでください。列を消した後の古い保存状態なら、applyState の後の getState() の値を保存し直すと出なくなります。
|
|
20
20
|
[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.`);
|
|
21
|
-
},
|
|
22
|
-
let
|
|
23
|
-
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) ?
|
|
21
|
+
}, A = /^(get|is|can|export|download)/, j = 1e3, M = (M = {}) => {
|
|
22
|
+
let N = null, P = !1, F = !1, I = null, L = (e) => I !== null && I.base === e.columns ? I.next : e.columns, R = (M.export?.createExportCommands ?? T)(() => N, M.grouping), z = null, B = !1, V = (e, t, n = "auto") => {
|
|
23
|
+
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) ? N?.markApiScroll() : void 0;
|
|
24
24
|
e.scrollTo({
|
|
25
25
|
top: a,
|
|
26
26
|
left: o,
|
|
27
27
|
behavior: n
|
|
28
28
|
}), l && n === "auto" && e.scrollTop === s && e.scrollLeft === c && getComputedStyle(e).scrollBehavior !== "smooth" && l();
|
|
29
|
-
},
|
|
30
|
-
let r =
|
|
29
|
+
}, H = (e, t, n) => {
|
|
30
|
+
let r = N?.scrollContainerRef.current ?? null, i = N;
|
|
31
31
|
if (!r || !i) return;
|
|
32
32
|
let a = d(r.scrollTop, i.verticalScaleFactor), o = e ?? a, s = o === a ? r.scrollTop : u(o, i.verticalScaleFactor);
|
|
33
|
-
|
|
33
|
+
V(r, {
|
|
34
34
|
top: n === "end" || n === "auto" && o > a ? Math.ceil(s) : s,
|
|
35
35
|
left: t === null ? r.scrollLeft : t
|
|
36
36
|
});
|
|
37
|
-
},
|
|
38
|
-
let n =
|
|
37
|
+
}, U = (e, t) => {
|
|
38
|
+
let n = N?.scrollContainerRef.current ?? null, r = N;
|
|
39
39
|
if (!n || !r || r.viewRowCount === 0) return null;
|
|
40
40
|
let i = Math.min(Math.max(e, 0), r.viewRowCount - 1);
|
|
41
|
-
return
|
|
41
|
+
return O({
|
|
42
42
|
rowTop: r.rowMetrics.rowTop(i),
|
|
43
43
|
rowHeight: r.rowMetrics.cellHeight(i),
|
|
44
44
|
headerHeight: r.headerHeight,
|
|
@@ -47,11 +47,11 @@ var O = (e) => {
|
|
|
47
47
|
align: t,
|
|
48
48
|
stickyTopInset: r.stickyTopInset
|
|
49
49
|
});
|
|
50
|
-
},
|
|
51
|
-
let n =
|
|
50
|
+
}, W = (e, t) => {
|
|
51
|
+
let n = N?.scrollContainerRef.current ?? null, r = N;
|
|
52
52
|
if (!n || !r) return null;
|
|
53
53
|
let i = s(r.paneLayout, e);
|
|
54
|
-
return !i || i.pane !== "center" ? null :
|
|
54
|
+
return !i || i.pane !== "center" ? null : D({
|
|
55
55
|
cellLeft: r.leftPaneTotalWidth + r.centerLeadingWidth + i.extent.start,
|
|
56
56
|
cellWidth: i.extent.width,
|
|
57
57
|
leftPaneWidth: r.leftPaneTotalWidth,
|
|
@@ -60,129 +60,129 @@ var O = (e) => {
|
|
|
60
60
|
currentScrollLeft: n.scrollLeft,
|
|
61
61
|
align: t
|
|
62
62
|
});
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
let t =
|
|
63
|
+
}, G = (e, t, n) => {
|
|
64
|
+
H(U(e, n), W(t, n), n);
|
|
65
|
+
}, K = (e) => e.viewRowCount <= 0 || e.orderedColumns.length === 0, q = (e) => {
|
|
66
|
+
let t = N;
|
|
67
67
|
return t ? {
|
|
68
68
|
row: Math.min(Math.max(e.row, 0), Math.max(t.viewRowCount - 1, 0)),
|
|
69
69
|
col: Math.min(Math.max(e.col, 0), Math.max(t.orderedColumns.length - 1, 0))
|
|
70
70
|
} : e;
|
|
71
|
-
},
|
|
71
|
+
}, J = (e, t, n = 1) => {
|
|
72
72
|
let r = (t) => e.rowModel.getLabelRow?.(t) !== void 0;
|
|
73
73
|
if (!r(t)) return t;
|
|
74
74
|
for (let i of [n, -n]) for (let n = t + i; n >= 0 && n < e.viewRowCount; n += i) if (!r(n)) return n;
|
|
75
75
|
return t;
|
|
76
|
-
},
|
|
76
|
+
}, Y = (e) => e.getUiState?.() ?? e.uiState, X = (e) => e.pendingRowSelection?.() ?? Y(e).rowSelection, Z = {
|
|
77
77
|
model: null,
|
|
78
78
|
map: /* @__PURE__ */ new Map()
|
|
79
|
-
},
|
|
79
|
+
}, Q = {
|
|
80
80
|
scrollToRow: (e, t) => {
|
|
81
81
|
let n = t?.align ?? "auto";
|
|
82
|
-
|
|
82
|
+
H(U(e, n), null, n);
|
|
83
83
|
},
|
|
84
|
-
scrollToCell: (e, t, n) =>
|
|
84
|
+
scrollToCell: (e, t, n) => G(e, t, n?.align ?? "auto"),
|
|
85
85
|
scrollToTop: () => {
|
|
86
|
-
let e =
|
|
87
|
-
e &&
|
|
86
|
+
let e = N?.scrollContainerRef.current ?? null;
|
|
87
|
+
e && V(e, {
|
|
88
88
|
top: 0,
|
|
89
89
|
left: e.scrollLeft
|
|
90
90
|
});
|
|
91
91
|
},
|
|
92
92
|
scrollToBottom: () => {
|
|
93
|
-
let e =
|
|
94
|
-
!e || !t || (
|
|
93
|
+
let e = N?.scrollContainerRef.current ?? null, t = N;
|
|
94
|
+
!e || !t || (V(e, {
|
|
95
95
|
top: Math.max(t.headerHeight + t.physicalBodyHeight + (t.footerHeight ?? 0) - e.clientHeight, 0),
|
|
96
96
|
left: e.scrollLeft
|
|
97
|
-
}),
|
|
97
|
+
}), z = t.measuredRowHeights ? {
|
|
98
98
|
pinnedTop: e.scrollTop,
|
|
99
|
-
until: Date.now() +
|
|
100
|
-
} : null);
|
|
99
|
+
until: Date.now() + j
|
|
100
|
+
} : null, B = !1);
|
|
101
101
|
},
|
|
102
102
|
getScrollPosition: () => {
|
|
103
|
-
let e =
|
|
103
|
+
let e = N?.scrollContainerRef.current ?? null;
|
|
104
104
|
return e ? {
|
|
105
105
|
top: e.scrollTop,
|
|
106
106
|
left: e.scrollLeft
|
|
107
107
|
} : null;
|
|
108
108
|
},
|
|
109
109
|
isAtBottom: () => {
|
|
110
|
-
let e =
|
|
110
|
+
let e = N?.scrollContainerRef.current ?? null;
|
|
111
111
|
return e ? f(e) : !1;
|
|
112
112
|
},
|
|
113
113
|
setScrollPosition: (e, t) => {
|
|
114
|
-
let n =
|
|
115
|
-
n &&
|
|
114
|
+
let n = N?.scrollContainerRef.current ?? null;
|
|
115
|
+
n && V(n, {
|
|
116
116
|
top: e.top ?? n.scrollTop,
|
|
117
117
|
left: e.left ?? n.scrollLeft
|
|
118
118
|
}, t?.behavior ?? "auto");
|
|
119
119
|
},
|
|
120
120
|
getVisibleRowRange: () => {
|
|
121
|
-
let e =
|
|
121
|
+
let e = N;
|
|
122
122
|
return !e || e.windowLastRow < e.windowFirstRow ? null : {
|
|
123
123
|
startIndex: e.windowFirstRow,
|
|
124
124
|
endIndex: e.windowLastRow + 1
|
|
125
125
|
};
|
|
126
126
|
},
|
|
127
127
|
getActiveCell: () => {
|
|
128
|
-
let e =
|
|
128
|
+
let e = N ? Y(N).activeCell : null;
|
|
129
129
|
return e ? {
|
|
130
130
|
row: e.row,
|
|
131
131
|
col: e.col
|
|
132
132
|
} : null;
|
|
133
133
|
},
|
|
134
134
|
setActiveCell: (t, n) => {
|
|
135
|
-
let r =
|
|
136
|
-
if (!r || t &&
|
|
137
|
-
let i = t ?
|
|
138
|
-
row:
|
|
135
|
+
let r = N;
|
|
136
|
+
if (!r || t && K(r)) return;
|
|
137
|
+
let i = t ? q(t) : null, a = i ? {
|
|
138
|
+
row: J(r, i.row),
|
|
139
139
|
col: i.col
|
|
140
140
|
} : null;
|
|
141
|
-
r.dispatch(e.activateCell(a)), a && n?.scrollIntoView &&
|
|
141
|
+
r.dispatch(e.activateCell(a)), a && n?.scrollIntoView && G(a.row, a.col, "auto");
|
|
142
142
|
},
|
|
143
|
-
getSelection: () =>
|
|
143
|
+
getSelection: () => N ? Y(N).selection : null,
|
|
144
144
|
focus: () => {
|
|
145
|
-
|
|
145
|
+
N?.focusGrid?.();
|
|
146
146
|
},
|
|
147
147
|
startEditing: (t, n) => {
|
|
148
|
-
let r =
|
|
148
|
+
let r = N;
|
|
149
149
|
if (!r || !r.startEditCell || t === void 0 != (n === void 0)) return !1;
|
|
150
|
-
let i =
|
|
150
|
+
let i = Y(r);
|
|
151
151
|
if (i.editingCell !== null) return !1;
|
|
152
152
|
let a = t === void 0 || n === void 0 ? i.activeCell : {
|
|
153
153
|
row: t,
|
|
154
154
|
col: n
|
|
155
155
|
};
|
|
156
|
-
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()),
|
|
156
|
+
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()), G(a.row, a.col, "auto"), r.focusGrid?.(), !0);
|
|
157
157
|
},
|
|
158
158
|
getViewRowIndex: (e) => {
|
|
159
|
-
let t =
|
|
160
|
-
return t ? (
|
|
159
|
+
let t = N;
|
|
160
|
+
return t ? (Z.model !== t.rowModel && (Z = {
|
|
161
161
|
model: t.rowModel,
|
|
162
162
|
map: /* @__PURE__ */ new Map()
|
|
163
|
-
}), i(t.rowModel, e,
|
|
163
|
+
}), i(t.rowModel, e, Z.map)) : -1;
|
|
164
164
|
},
|
|
165
|
-
getColIndex: (e) =>
|
|
165
|
+
getColIndex: (e) => N?.orderedColumns.findIndex((t) => t.key === e) ?? -1,
|
|
166
166
|
getRowNumber: (e) => {
|
|
167
|
-
let t =
|
|
167
|
+
let t = N, n = Q.getViewRowIndex(e);
|
|
168
168
|
return !t || n < 0 || t.rowModel.getLabelRow?.(n) !== void 0 ? null : t.labelViewIndexes ? l(t.labelViewIndexes, n) : n + 1;
|
|
169
169
|
},
|
|
170
170
|
selectCell: (t, n, r) => {
|
|
171
|
-
let i =
|
|
172
|
-
if (!i ||
|
|
173
|
-
let a =
|
|
171
|
+
let i = N;
|
|
172
|
+
if (!i || K(i)) return;
|
|
173
|
+
let a = q({
|
|
174
174
|
row: t,
|
|
175
175
|
col: n
|
|
176
176
|
}), o = {
|
|
177
|
-
row:
|
|
177
|
+
row: J(i, a.row),
|
|
178
178
|
col: a.col
|
|
179
179
|
};
|
|
180
|
-
i.dispatch(e.startSelection(o)), i.dispatch(e.endSelection()), r?.scrollIntoView &&
|
|
180
|
+
i.dispatch(e.startSelection(o)), i.dispatch(e.endSelection()), r?.scrollIntoView && G(o.row, o.col, "auto");
|
|
181
181
|
},
|
|
182
182
|
selectRange: (t, n) => {
|
|
183
|
-
let r =
|
|
184
|
-
if (!r ||
|
|
185
|
-
let i =
|
|
183
|
+
let r = N;
|
|
184
|
+
if (!r || K(r)) return;
|
|
185
|
+
let i = q(t.start), a = q(t.end), o = J(r, i.row, a.row < i.row ? -1 : 1);
|
|
186
186
|
(o < Math.min(i.row, a.row) || o > Math.max(i.row, a.row)) && (i = {
|
|
187
187
|
row: o,
|
|
188
188
|
col: i.col
|
|
@@ -192,15 +192,15 @@ var O = (e) => {
|
|
|
192
192
|
}), r.dispatch(e.startSelection(i)), r.dispatch(e.updateSelection(a)), r.dispatch(e.endSelection()), o !== i.row && r.dispatch(e.activateCell({
|
|
193
193
|
row: o,
|
|
194
194
|
col: i.col
|
|
195
|
-
})), n?.scrollIntoView &&
|
|
195
|
+
})), n?.scrollIntoView && G(a.row, a.col, "auto");
|
|
196
196
|
},
|
|
197
197
|
clearSelection: () => {
|
|
198
|
-
|
|
198
|
+
N?.dispatch(e.clearSelection());
|
|
199
199
|
},
|
|
200
200
|
getSelectedRows: () => {
|
|
201
|
-
let e =
|
|
201
|
+
let e = N;
|
|
202
202
|
if (!e) return [];
|
|
203
|
-
let t =
|
|
203
|
+
let t = Y(e).selection;
|
|
204
204
|
if (!t) return [];
|
|
205
205
|
let n = [], r = (t) => {
|
|
206
206
|
let r = e.rowModel.getRow(t);
|
|
@@ -215,54 +215,54 @@ var O = (e) => {
|
|
|
215
215
|
} else for (let t = 0; t < e.viewRowCount; t += 1) r(t);
|
|
216
216
|
return n;
|
|
217
217
|
},
|
|
218
|
-
exportCsv: (e) =>
|
|
219
|
-
downloadCsv: (e, t) =>
|
|
220
|
-
getExportData: (e) =>
|
|
218
|
+
exportCsv: (e) => R.exportCsv(e),
|
|
219
|
+
downloadCsv: (e, t) => R.downloadCsv(e, t),
|
|
220
|
+
getExportData: (e) => R.getExportData(e),
|
|
221
221
|
getState: () => {
|
|
222
|
-
let e =
|
|
222
|
+
let e = N;
|
|
223
223
|
if (!e) return b({}, {
|
|
224
224
|
globalText: "",
|
|
225
225
|
columnFilters: {}
|
|
226
226
|
}, [], []);
|
|
227
|
-
let t =
|
|
228
|
-
return b(t.columnWidths, t.filters, t.sort, S(
|
|
227
|
+
let t = Y(e), n = e.includeGroupingInState === !0;
|
|
228
|
+
return b(t.columnWidths, t.filters, t.sort, S(L(e), n), void 0, n ? t.collapsedGroupKeys : void 0);
|
|
229
229
|
},
|
|
230
230
|
applyState: (t) => {
|
|
231
|
-
let n =
|
|
231
|
+
let n = N;
|
|
232
232
|
if (!n) return;
|
|
233
|
-
let { patch: r, dropped: i } = x(
|
|
234
|
-
i.length > 0 &&
|
|
235
|
-
let a =
|
|
233
|
+
let { patch: r, dropped: i } = x(w(t), new Set(n.columns.map((e) => e.key)));
|
|
234
|
+
i.length > 0 && k(i);
|
|
235
|
+
let a = Y(n);
|
|
236
236
|
if (n.onColumnsChange && r.columns) {
|
|
237
|
-
let e =
|
|
238
|
-
|
|
237
|
+
let e = L(n), t = y(e, r.columns, r.columnWidths ?? a.columnWidths);
|
|
238
|
+
C(e, t) || (I = {
|
|
239
239
|
base: n.columns,
|
|
240
|
-
next:
|
|
241
|
-
}, n.onColumnsChange(
|
|
240
|
+
next: t
|
|
241
|
+
}, n.onColumnsChange(t));
|
|
242
242
|
}
|
|
243
243
|
if (r.columnWidths && n.dispatch(e.resetColumnWidths(r.columnWidths)), r.filters) {
|
|
244
244
|
let t = {
|
|
245
245
|
globalText: r.filters.globalText ?? a.filters.globalText,
|
|
246
246
|
columnFilters: r.filters.columnFilters ?? a.filters.columnFilters
|
|
247
247
|
};
|
|
248
|
-
|
|
248
|
+
E(t), n.dispatch(e.setAllFilters(t));
|
|
249
249
|
}
|
|
250
250
|
r.sort && n.dispatch(e.setSort(r.sort)), r.collapsedGroups && n.dispatch(e.setCollapsedGroupKeys(new Set(r.collapsedGroups)));
|
|
251
251
|
},
|
|
252
252
|
getRowSelection: () => {
|
|
253
|
-
let e =
|
|
254
|
-
return e ? _(
|
|
253
|
+
let e = N;
|
|
254
|
+
return e ? _(X(e)) : {
|
|
255
255
|
type: "include",
|
|
256
256
|
rowKeys: []
|
|
257
257
|
};
|
|
258
258
|
},
|
|
259
259
|
setRowSelection: (e) => {
|
|
260
|
-
|
|
260
|
+
N?.commitRowSelection(g(e));
|
|
261
261
|
},
|
|
262
262
|
getSelectedRowKeys: () => {
|
|
263
|
-
let e =
|
|
263
|
+
let e = N;
|
|
264
264
|
if (!e) return [];
|
|
265
|
-
let t =
|
|
265
|
+
let t = X(e);
|
|
266
266
|
if (t.mode === "include") return Array.from(t.keys);
|
|
267
267
|
let n = [], r = e.rowModel.getRowCount();
|
|
268
268
|
for (let i = 0; i < r; i += 1) {
|
|
@@ -273,9 +273,9 @@ var O = (e) => {
|
|
|
273
273
|
return n;
|
|
274
274
|
},
|
|
275
275
|
getSelectedRowData: () => {
|
|
276
|
-
let e =
|
|
276
|
+
let e = N;
|
|
277
277
|
if (!e) return [];
|
|
278
|
-
let t =
|
|
278
|
+
let t = X(e), n = [], r = e.rowModel.getRowCount();
|
|
279
279
|
for (let i = 0; i < r; i += 1) {
|
|
280
280
|
let r = e.rowModel.getRow(i);
|
|
281
281
|
r && h(t, e.rowModel.getRowKey(i) ?? i) && n.push(r);
|
|
@@ -283,32 +283,32 @@ var O = (e) => {
|
|
|
283
283
|
return n;
|
|
284
284
|
},
|
|
285
285
|
getSelectedRowCount: () => {
|
|
286
|
-
let e =
|
|
287
|
-
return e ? m(
|
|
286
|
+
let e = N;
|
|
287
|
+
return e ? m(X(e), e.leafRowCount) : 0;
|
|
288
288
|
},
|
|
289
289
|
isRowSelected: (e) => {
|
|
290
|
-
let t =
|
|
291
|
-
return t ? h(
|
|
290
|
+
let t = N;
|
|
291
|
+
return t ? h(X(t), e) : !1;
|
|
292
292
|
},
|
|
293
293
|
selectAllRows: () => {
|
|
294
|
-
|
|
294
|
+
N?.commitRowSelection(v());
|
|
295
295
|
},
|
|
296
296
|
clearRowSelection: () => {
|
|
297
|
-
|
|
297
|
+
N?.commitRowSelection(p());
|
|
298
298
|
},
|
|
299
299
|
undo: () => {
|
|
300
|
-
|
|
300
|
+
N?.undoRows();
|
|
301
301
|
},
|
|
302
302
|
redo: () => {
|
|
303
|
-
|
|
303
|
+
N?.redoRows();
|
|
304
304
|
},
|
|
305
|
-
canUndo: () =>
|
|
306
|
-
canRedo: () =>
|
|
305
|
+
canUndo: () => N?.canUndoRows() ?? !1,
|
|
306
|
+
canRedo: () => N?.canRedoRows() ?? !1,
|
|
307
307
|
clearUndoHistory: () => {
|
|
308
|
-
|
|
308
|
+
N?.clearUndoHistory();
|
|
309
309
|
},
|
|
310
310
|
applyRows: (e, t) => {
|
|
311
|
-
let n =
|
|
311
|
+
let n = N;
|
|
312
312
|
if (n) {
|
|
313
313
|
if (!n.applyRowsChange || n.isServerSide) {
|
|
314
314
|
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()).");
|
|
@@ -318,26 +318,26 @@ var O = (e) => {
|
|
|
318
318
|
}
|
|
319
319
|
},
|
|
320
320
|
setGroupCollapsed: (t, n) => {
|
|
321
|
-
|
|
321
|
+
N?.dispatch(e.setGroupCollapsed(t, n));
|
|
322
322
|
},
|
|
323
323
|
expandAllGroups: () => {
|
|
324
|
-
|
|
324
|
+
N?.dispatch(e.setCollapsedGroupKeys(/* @__PURE__ */ new Set()));
|
|
325
325
|
},
|
|
326
326
|
collapseAllGroups: () => {
|
|
327
|
-
let n =
|
|
327
|
+
let n = N;
|
|
328
328
|
!n || !n.groupTree || n.dispatch(e.setCollapsedGroupKeys(new Set(t(n.groupTree))));
|
|
329
329
|
},
|
|
330
330
|
getGroupRows: () => {
|
|
331
|
-
let e =
|
|
331
|
+
let e = N;
|
|
332
332
|
if (!e?.groupTree) return [];
|
|
333
|
-
let t =
|
|
333
|
+
let t = Y(e).collapsedGroupKeys;
|
|
334
334
|
return n(e.groupTree).map((e) => ({
|
|
335
335
|
...e,
|
|
336
336
|
collapsed: t.has(e.groupKey)
|
|
337
337
|
}));
|
|
338
338
|
},
|
|
339
339
|
setDetailRowExpanded: (t, n) => {
|
|
340
|
-
let i =
|
|
340
|
+
let i = N;
|
|
341
341
|
if (!(!i || !i.detailRowEnabled)) {
|
|
342
342
|
if (n && i.detailIsExpandable) {
|
|
343
343
|
let e = r(i.rowModel, t, i.detailIndexCacheRef.current, !i.isServerSide);
|
|
@@ -349,7 +349,7 @@ var O = (e) => {
|
|
|
349
349
|
})) return;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
if (!n && i.beforeDetailRowsCollapse &&
|
|
352
|
+
if (!n && i.beforeDetailRowsCollapse && Y(i).expandedDetailRowKeys.has(t)) {
|
|
353
353
|
let e = r(i.rowModel, t, i.detailIndexCacheRef.current, !i.isServerSide);
|
|
354
354
|
e >= 0 && i.beforeDetailRowsCollapse([e]);
|
|
355
355
|
}
|
|
@@ -357,89 +357,103 @@ var O = (e) => {
|
|
|
357
357
|
}
|
|
358
358
|
},
|
|
359
359
|
getExpandedDetailRowKeys: () => {
|
|
360
|
-
let e =
|
|
361
|
-
return e && e.detailRowEnabled ? Array.from(
|
|
360
|
+
let e = N;
|
|
361
|
+
return e && e.detailRowEnabled ? Array.from(Y(e).expandedDetailRowKeys) : [];
|
|
362
362
|
},
|
|
363
363
|
collapseAllDetailRows: () => {
|
|
364
|
-
let t =
|
|
364
|
+
let t = N;
|
|
365
365
|
if (!(!t || !t.detailRowEnabled)) {
|
|
366
366
|
if (t.beforeDetailRowsCollapse) {
|
|
367
|
-
let e = Array.from(
|
|
367
|
+
let e = Array.from(Y(t).expandedDetailRowKeys, (e) => r(t.rowModel, e, t.detailIndexCacheRef.current, !t.isServerSide)).filter((e) => e >= 0);
|
|
368
368
|
e.length > 0 && t.beforeDetailRowsCollapse(e);
|
|
369
369
|
}
|
|
370
370
|
t.dispatch(e.setExpandedDetailRowKeys(/* @__PURE__ */ new Set()));
|
|
371
371
|
}
|
|
372
372
|
},
|
|
373
373
|
moveRow: (e, t) => {
|
|
374
|
-
|
|
374
|
+
N?.moveRowByKey(e, t);
|
|
375
375
|
},
|
|
376
376
|
getInvalidCells: () => {
|
|
377
|
-
let e =
|
|
377
|
+
let e = N;
|
|
378
378
|
return e ? e.isServerSide ? (process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] getInvalidCells は serverSide モードでは利用できません(空配列を返します)。\n[SpreadsheetGrid] getInvalidCells is not available with serverSide (returns an empty array)."), []) : c(e.rows, e.columns, e.resolvedRowKeyGetter, e.labelRowExport?.isLabelRow, e.localeTexts) : [];
|
|
379
379
|
},
|
|
380
380
|
refreshServerSide: () => {
|
|
381
|
-
let e =
|
|
381
|
+
let e = N;
|
|
382
382
|
if (e) {
|
|
383
383
|
if (!e.isServerSide) {
|
|
384
|
-
process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] refreshServerSide は clientSide(rows)モードでは何もしません。dataSource を渡したときだけ有効です(
|
|
384
|
+
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).");
|
|
385
385
|
return;
|
|
386
386
|
}
|
|
387
387
|
e.serverSideRefresh();
|
|
388
388
|
}
|
|
389
389
|
},
|
|
390
390
|
retryServerSideLoads: () => {
|
|
391
|
-
let e =
|
|
391
|
+
let e = N;
|
|
392
392
|
if (e) {
|
|
393
393
|
if (!e.isServerSide) {
|
|
394
|
-
process.env.NODE_ENV !== "production" && console.warn("[SpreadsheetGrid] retryServerSideLoads は clientSide(rows)モードでは何もしません。dataSource を渡したときだけ有効です(
|
|
394
|
+
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).");
|
|
395
395
|
return;
|
|
396
396
|
}
|
|
397
397
|
e.serverSideRetryFailed();
|
|
398
398
|
}
|
|
399
399
|
},
|
|
400
400
|
openFilterManager: () => {
|
|
401
|
-
|
|
401
|
+
N?.openToolPanel("filter");
|
|
402
402
|
},
|
|
403
403
|
closeFilterManager: () => {
|
|
404
|
-
let e =
|
|
404
|
+
let e = N;
|
|
405
405
|
e && e.activeToolPanelTab === "filter" && e.closeToolPanel();
|
|
406
406
|
},
|
|
407
407
|
openFind: (e) => {
|
|
408
|
-
|
|
408
|
+
N?.find.open(e);
|
|
409
409
|
},
|
|
410
410
|
closeFind: () => {
|
|
411
|
-
|
|
411
|
+
N?.find.close();
|
|
412
412
|
},
|
|
413
413
|
findNext: () => {
|
|
414
|
-
|
|
414
|
+
N?.find.next();
|
|
415
415
|
},
|
|
416
416
|
findPrev: () => {
|
|
417
|
-
|
|
417
|
+
N?.find.prev();
|
|
418
418
|
}
|
|
419
|
+
}, $ = () => {
|
|
420
|
+
if (!B) return;
|
|
421
|
+
B = !1;
|
|
422
|
+
let e = N;
|
|
423
|
+
if (z === null || e === null) return;
|
|
424
|
+
let t = e.scrollContainerRef.current;
|
|
425
|
+
if (!t || !e.measuredRowHeights || Date.now() > z.until || t.scrollTop < z.pinnedTop - 1) {
|
|
426
|
+
z = null;
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
V(t, {
|
|
430
|
+
top: Math.max(e.headerHeight + e.physicalBodyHeight + (e.footerHeight ?? 0) - t.clientHeight, 0),
|
|
431
|
+
left: t.scrollLeft
|
|
432
|
+
}), z = {
|
|
433
|
+
...z,
|
|
434
|
+
pinnedTop: t.scrollTop
|
|
435
|
+
};
|
|
419
436
|
};
|
|
437
|
+
for (let e of Object.keys(Q)) {
|
|
438
|
+
let t = Q[e];
|
|
439
|
+
typeof t != "function" || A.test(e) || (Q[e] = (...n) => P ? (process.env.NODE_ENV !== "production" && !F && (F = !0, console.warn(`[spreadsheet-grid] 外したグリッドのハンドルの ${e}() は何もしません(ハンドルを変数に持ったまま、グリッドを <Show> / 条件付きの描画で外した後に呼んだ)。読むメソッド(getState() など)は外したときの値を返します。
|
|
440
|
+
[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 by <Show> or conditional rendering). Reading methods (getState() and so on) return the values from when it was removed.`)), e === "startEditing" ? !1 : void 0) : t(...n));
|
|
441
|
+
}
|
|
420
442
|
return {
|
|
421
443
|
update: (e) => {
|
|
422
|
-
let t =
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
pinnedTop: n.scrollTop
|
|
435
|
-
};
|
|
436
|
-
},
|
|
437
|
-
handle: q,
|
|
438
|
-
applyScroll: L,
|
|
439
|
-
verticalTargetFor: R,
|
|
440
|
-
horizontalTargetFor: z,
|
|
441
|
-
scrollToCellInternal: B
|
|
444
|
+
let t = N?.physicalBodyHeight;
|
|
445
|
+
P = !1, N = e, I = null, t !== e.physicalBodyHeight && (B = !0), e.deferBottomPin || $();
|
|
446
|
+
},
|
|
447
|
+
handle: Q,
|
|
448
|
+
applyScroll: H,
|
|
449
|
+
verticalTargetFor: U,
|
|
450
|
+
horizontalTargetFor: W,
|
|
451
|
+
scrollToCellInternal: G,
|
|
452
|
+
settleBottomPin: $,
|
|
453
|
+
dispose: () => {
|
|
454
|
+
P = !0, z = null;
|
|
455
|
+
}
|
|
442
456
|
};
|
|
443
457
|
};
|
|
444
458
|
//#endregion
|
|
445
|
-
export {
|
|
459
|
+
export { M as createGridApi };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../logic/rowSelection.cjs");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/rowSelection.cjs");var r=[],i=(e,t)=>t,a=()=>{let a=null,o=null,s,c=!1,l=()=>{if(a===null)throw Error(`[SpreadsheetGrid] rowSelectionCommands は update 前に呼べません。`);return a},u=null,d=(t,r)=>{let{rowSelectionState:i,onRowSelectionChange:a,controlledRowSelectionModel:o,dispatch:s}=l(),c=!n.rowSelectionStateEquals(t??i,r);if(o===void 0&&s(e.gridActions.setRowSelectionState(r)),c&&a){let e=u;u=r;try{a(n.rowSelectionToModel(r))}finally{u=e}}},f=e=>{e.mode===`exclude`&&e.keys.size===0&&m.clear(),d(void 0,e)},p=t.createDetailKeysPruner(),m=new Set,h=null,g=(e,t,n)=>{let r=Math.min(t,n),i=Math.max(t,n),a=[];for(let t=r;t<=i;t+=1)e.getRow(t)&&a.push(e.getRowKey(t)??t);return a};return{update:o=>{a=o;let l=o.controlledRowSelectionModel,u=o.rowSelectionState;if((!c||!Object.is(l,s))&&(c=!0,s=l,l!==void 0)){let t=n.rowSelectionFromModel(l);n.rowSelectionStateEquals(o.rowSelectionState,t)||(o.dispatch(e.gridActions.setRowSelectionState(t)),u=t)}let f=o.sourceRows,g=f?.rows??r,_=f?.rowKeyGetter??i;if(p.update({enabled:f!==void 0,rows:g,expandedKeys:u.keys,keyOf:_,setExpandedKeys:e=>{let t={mode:u.mode,keys:new Set(e)};if(u.mode===`exclude`){for(let e of u.keys)t.keys.has(e)||m.add(e);h=g}d(u,t),u=t}}),m.size>0){if(f===void 0||u.mode!==`exclude`)m.clear(),h=null;else if(g!==h){h=g;let e=new Map;if(t.findKeysIn(g,_,m,e),e.size>0){let t=new Set(u.keys);for(let n of e.keys())t.add(n),m.delete(n);d(u,{mode:`exclude`,keys:t})}}}},commitRowSelection:f,pendingRowSelection:()=>u,handleGutterRowSelect:(e,t)=>{let{rowModel:r,rowSelectionMode:i,rowSelectionState:a}=l();if(!r.getRow(e))return;let s=r.getRowKey(e)??e;if(i===`single`){o=e,f(n.selectSingleRow(s));return}if(t.shiftKey&&o!==null){f(n.selectRowRange(g(r,o,e)));return}o=e,f(n.toggleRowKey(a,s))},handleGutterRowSelectDrag:e=>{let{rowModel:t,rowSelectionMode:r}=l();if(t.getRow(e)){if(r===`single`){f(n.selectSingleRow(t.getRowKey(e)??e));return}o!==null&&f(n.selectRowRange(g(t,o,e)))}},handleToggleSelectAllRows:()=>{let{rowSelectionState:e,leafRowCount:t,filteredDataRows:r}=l();if(r){let{rows:t,order:i,rowKeyGetter:a}=r,o=[];for(let e=0;e<i.length;e+=1){let n=i[e];o.push(a(t[n],n))}let s=n.countSelectedRowsInOrder(e,t,i,a),c=o.length>0&&s>=o.length;f(c?n.removeRowKeys(e,o):n.addRowRange(e,o));return}let i=n.getSelectAllState(e,t);f(i===`all`?n.clearRowSelection():n.selectAllRows())}}};exports.createRowSelectionCommands=a;
|
|
@@ -9,8 +9,13 @@ export type RowSelectionCommandsArgs<T> = {
|
|
|
9
9
|
controlledRowSelectionModel: RowSelectionModel | undefined;
|
|
10
10
|
leafRowCount: number;
|
|
11
11
|
filteredDataRows?: FilteredDataRows<T> | null;
|
|
12
|
+
sourceRows?: SourceRows<T> | undefined;
|
|
12
13
|
dispatch: (action: GridUiAction) => void;
|
|
13
14
|
};
|
|
15
|
+
export type SourceRows<T> = {
|
|
16
|
+
rows: readonly T[];
|
|
17
|
+
rowKeyGetter: (row: T, index: number) => GridRowKey;
|
|
18
|
+
};
|
|
14
19
|
export type FilteredDataRows<T> = {
|
|
15
20
|
rows: readonly T[];
|
|
16
21
|
order: RowOrder;
|