@ishibashi0112/spreadsheet-grid 1.9.0 → 1.11.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/API_REFERENCE.md +262 -30
- package/README.md +2 -2
- package/dist/CellEditorLayer.d.ts +6 -1
- package/dist/ColumnFilterPopover-DObE236Y.cjs +1 -0
- package/dist/{ColumnFilterPopover-BkvL8LdP.js → ColumnFilterPopover-xpVqTNCI.js} +5 -5
- package/dist/DateEditorCalendar-C4DuVjsL.js +128 -0
- package/dist/DateEditorCalendar-Cg4a2Y8d.cjs +1 -0
- package/dist/GridShell.d.ts +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/editors/DateCellEditor.d.ts +2 -1
- package/dist/editors/DateTimeCellEditor.d.ts +25 -0
- package/dist/editors/MultiSelectCellEditor.d.ts +23 -0
- package/dist/editors/NumberCellEditor.d.ts +2 -1
- package/dist/editors/SearchSelectCellEditor.d.ts +2 -1
- package/dist/editors/SelectCellEditor.d.ts +2 -1
- package/dist/editors/TextCellEditor.d.ts +2 -1
- package/dist/features/dateTimeEditors.d.ts +2 -0
- package/dist/features/excelShortcuts.d.ts +2 -0
- package/dist/features/multiSelect.d.ts +2 -0
- package/dist/features/newRow.d.ts +2 -0
- package/dist/features/types.d.ts +18 -0
- package/dist/hooks/useGridClipboardController.d.ts +1 -0
- package/dist/hooks/useGridLocaleText.d.ts +1 -1
- package/dist/hooks/useGridStore.d.ts +1 -1
- package/dist/index.cjs +11 -9
- package/dist/index.js +4870 -4032
- package/dist/lite/CellEditorErrorBubble-BH68ZTcj.js +23 -0
- package/dist/lite/CellEditorErrorBubble-DDoxYBXj.cjs +1 -0
- package/dist/lite/CopyRangeOverlay-BrCXRBtd.js +23 -0
- package/dist/lite/CopyRangeOverlay-CJGp8xo5.cjs +1 -0
- package/dist/lite/DateCellEditor-BPCZK7xI.js +81 -0
- package/dist/lite/DateCellEditor-BQfImAET.cjs +1 -0
- package/dist/lite/DateEditorCalendar-C4DuVjsL.js +128 -0
- package/dist/lite/DateEditorCalendar-Cg4a2Y8d.cjs +1 -0
- package/dist/lite/createSpreadsheetGrid-D7fxsRZG.cjs +11 -0
- package/dist/lite/createSpreadsheetGrid-DRJX-y38.js +5075 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/dateTimeEditors-BrNH3QkX.cjs +1 -0
- package/dist/lite/dateTimeEditors-CbxvlPg6.js +277 -0
- package/dist/lite/features/dateTimeEditors.cjs +1 -0
- package/dist/lite/features/dateTimeEditors.js +2 -0
- package/dist/lite/features/excelShortcuts.cjs +1 -0
- package/dist/lite/features/excelShortcuts.js +5 -0
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/motionExtras.cjs +1 -1
- package/dist/lite/features/motionExtras.js +1 -1
- package/dist/lite/features/multiSelect.cjs +1 -0
- package/dist/lite/features/multiSelect.js +2 -0
- package/dist/lite/features/newRow.cjs +1 -0
- package/dist/lite/features/newRow.js +11 -0
- package/dist/lite/features/pinnedRows.cjs +1 -1
- package/dist/lite/features/pinnedRows.js +1 -1
- package/dist/lite/features/rowDrag.cjs +1 -1
- package/dist/lite/features/rowDrag.js +1 -1
- package/dist/lite/features/selectSearch.cjs +1 -1
- package/dist/lite/features/selectSearch.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +2 -2
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/{filtering-c1X_zP3o.js → filtering-DaFmWbBq.js} +145 -142
- package/dist/lite/filtering-DskgJ8zD.cjs +1 -0
- package/dist/lite/lazyPopups-Cokq5TOf.cjs +2 -0
- package/dist/lite/{lazyPopups-DV5yAqW8.js → lazyPopups-DlBfI7Iu.js} +13 -9
- package/dist/lite/motionExtras-CZvGdgRi.js +26 -0
- package/dist/lite/motionExtras-Cz6DeWVG.cjs +1 -0
- package/dist/lite/multiSelect-CcxB2bAd.cjs +1 -0
- package/dist/lite/multiSelect-fz6tgldg.js +296 -0
- package/dist/lite/pinnedRows-Bx5s2ykl.cjs +1 -0
- package/dist/lite/pinnedRows-ibpSVG2h.js +149 -0
- package/dist/lite/{rowDrag-Bb1xlVXa.cjs → rowDrag--lPuW0-D.cjs} +1 -1
- package/dist/lite/{rowDrag-Dvg4JlGR.js → rowDrag-DVqgwSaj.js} +2 -1
- package/dist/lite/selectSearch-UHDjcmLg.cjs +1 -0
- package/dist/lite/{selectSearch-B1OSCMbw.js → selectSearch-n7CsaJiu.js} +53 -39
- package/dist/lite/{toolPanel-DQlOiytT.cjs → toolPanel-BD5l2a18.cjs} +1 -1
- package/dist/lite/{toolPanel-B1e18z68.js → toolPanel-BEzcyMBS.js} +1 -1
- package/dist/lite/useTopAlignedInput-BPhb8DcZ.js +15 -0
- package/dist/lite/useTopAlignedInput-T3k_V2-u.cjs +1 -0
- package/dist/lite.cjs +1 -1
- package/dist/lite.d.ts +4 -0
- package/dist/lite.js +25 -21
- package/dist/model/gridTypes.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/{toolPanelViews-Biz2p7sx.js → toolPanelViews-C8Vw3fEC.js} +2 -2
- package/dist/toolPanelViews-GXwba3Zw.cjs +1 -0
- package/dist/useGridLocaleText-CRSWUb4o.cjs +1 -0
- package/dist/useGridLocaleText-CpoTVgyp.js +6 -0
- package/dist/{usePopupLocaleText-DJN10Asc.js → usePopupLocaleText-Cfb4fQ8G.js} +1 -1
- package/dist/{usePopupLocaleText-lEFHqTvJ.cjs → usePopupLocaleText-CmlJsMAf.cjs} +1 -1
- package/dist/usePortalTokens-CeVR4LF2.cjs +1 -0
- package/dist/usePortalTokens-CkjVoVTY.js +45 -0
- package/dist/{useVirtualizerCore-C1k6Aw8p.js → useVirtualizerCore-BKZtPhuo.js} +1 -1
- package/dist/useVirtualizerCore-CA1UYXG3.cjs +1 -0
- package/dist/view/DateEditorCalendar.d.ts +14 -0
- package/dist/view/GridBodyLayer.d.ts +9 -1
- package/dist/view/GridMultiSelectChips.d.ts +6 -0
- package/dist/view/GridPinnedRows.d.ts +2 -1
- package/dist/view/lazyPopups.d.ts +3 -1
- package/package.json +2 -2
- package/skills/spreadsheet-grid/SKILL.md +8 -2
- package/dist/ColumnFilterPopover-cNVxOkoI.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-B8ove8hh.js +0 -4857
- package/dist/lite/createSpreadsheetGrid-M3WJSRoB.cjs +0 -9
- package/dist/lite/filtering-BTAXzOAK.cjs +0 -1
- package/dist/lite/lazyPopups-B1nKq4RV.cjs +0 -2
- package/dist/lite/motionExtras-aDs-d_Qv.cjs +0 -1
- package/dist/lite/motionExtras-pdhFC4q1.js +0 -46
- package/dist/lite/pinnedRows-C0z2lLC4.js +0 -144
- package/dist/lite/pinnedRows-CrwRr7W0.cjs +0 -1
- package/dist/lite/selectSearch-BIeA4Xhg.cjs +0 -1
- package/dist/lite/useTopAlignedInput-BAL_0rjw.cjs +0 -1
- package/dist/lite/useTopAlignedInput-CAagCTj-.js +0 -37
- package/dist/toolPanelViews-BAy-NXrx.cjs +0 -1
- package/dist/useGridLocaleText-BV4EomZe.cjs +0 -1
- package/dist/useGridLocaleText-Drud4qg0.js +0 -49
- package/dist/useVirtualizerCore-Cif7t8mS.cjs +0 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { r as e } from "./useController-zuzvTNo5.js";
|
|
2
|
+
import { i as t, r as n } from "./usePortalTokens-hsX2T3ep.js";
|
|
3
|
+
import { r } from "./useGridLocaleText-CpoTVgyp.js";
|
|
4
|
+
import { t as i } from "./CellEditorErrorBubble-BH68ZTcj.js";
|
|
5
|
+
import { useCallback as a, useEffect as o, useId as ee, useRef as s, useState as c, useSyncExternalStore as te } from "react";
|
|
6
|
+
import { cx as l } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cx";
|
|
7
|
+
import { createPortal as ne } from "react-dom";
|
|
8
|
+
import { isImeComposingKeyEvent as re } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
9
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { isCommitToSelectionKey as ie } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys";
|
|
11
|
+
import { SELECT_SEARCH_POPOVER_MIN_WIDTH as p, computeSelectPopoverPlacement as m, createPointerMoveFilter as ae, resolveSelectOptionRowHeight as oe } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
12
|
+
import { withAnchorVisibility as h } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
|
|
13
|
+
import { revealOverflowTitle as se } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
|
|
14
|
+
import { MULTI_SELECT_VISIBLE_ROWS as ce, resolveMultiSelectChipLabels as g, splitRangesByChips as _ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/multiSelect";
|
|
15
|
+
import { DEFAULT_MULTI_SELECT_LOCALE_TEXT as v } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
16
|
+
import { resolveSelectListWindow as le, revealSelectListRow as ue, splitSelectSearchText as y } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch";
|
|
17
|
+
import { createMultiSelectEditorController as de } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/multiSelectEditorController";
|
|
18
|
+
//#region src/editors/MultiSelectCellEditor.tsx
|
|
19
|
+
function fe({ text: e, range: t }) {
|
|
20
|
+
return /* @__PURE__ */ d(u, { children: y(e, t).map((e, t) => e.match ? /* @__PURE__ */ d("mark", {
|
|
21
|
+
className: "ssg-select-editor-match",
|
|
22
|
+
children: e.text
|
|
23
|
+
}, t) : e.text) });
|
|
24
|
+
}
|
|
25
|
+
var pe = /* @__PURE__ */ d("svg", {
|
|
26
|
+
viewBox: "0 0 12 12",
|
|
27
|
+
fill: "none",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
strokeWidth: "1.8",
|
|
30
|
+
strokeLinecap: "round",
|
|
31
|
+
strokeLinejoin: "round",
|
|
32
|
+
focusable: "false",
|
|
33
|
+
children: /* @__PURE__ */ d("path", { d: "M2.6 6.3 4.9 8.6 9.4 3.7" })
|
|
34
|
+
});
|
|
35
|
+
function b({ ariaLabel: g, options: _, value: v, search: y, load: b, onCommit: x, onCancel: S, onCommitToSelection: C, onRegisterFlush: w, align: T, themeClassName: E, popoverSlot: D, enterMove: me, initialText: he, cellTop: ge = 0, cellLeft: _e = 0, alignTop: ve = !1 }) {
|
|
36
|
+
let O = r(), k = y ? O.multiSelectSearchHint : O.multiSelectHint, A = s(null), j = s(null), M = s(null), N = s(null), P = ee(), [ye] = c(ae), [F, I] = c(null), L = (e, t) => {
|
|
37
|
+
let n = x(e, t);
|
|
38
|
+
return n && n.status === "rejected" && I(n.message), n;
|
|
39
|
+
}, [R] = c(() => de({
|
|
40
|
+
options: _,
|
|
41
|
+
value: v,
|
|
42
|
+
initialText: he,
|
|
43
|
+
search: y,
|
|
44
|
+
load: b,
|
|
45
|
+
onCommit: L,
|
|
46
|
+
onCancel: S
|
|
47
|
+
}));
|
|
48
|
+
e(() => {
|
|
49
|
+
R.setHandlers({
|
|
50
|
+
onCommit: L,
|
|
51
|
+
onCancel: S,
|
|
52
|
+
load: b
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
let z = te(R.subscribe, R.getSnapshot, R.getSnapshot);
|
|
56
|
+
o(() => R.attach(), [R]), e(() => {
|
|
57
|
+
R.setOptions(_);
|
|
58
|
+
}, [R, _]), e(() => {
|
|
59
|
+
w?.(R.flush);
|
|
60
|
+
}, [w, R]);
|
|
61
|
+
let [B] = c(oe), [V, H] = c(null), [be, U] = c(0), { results: W, highlight: G, status: K, selected: xe, chips: Se } = z;
|
|
62
|
+
t(N, V !== null, E, { layout: V });
|
|
63
|
+
let q = n(V !== null), Ce = Math.max(W.length, 1), J = Math.min(Ce, ce), we = (e) => h(e, m(e.getBoundingClientRect(), J + 1, window.innerWidth, window.innerHeight, B, p)), Te = () => y ? j.current : A.current, Ee = a((e) => {
|
|
64
|
+
A.current = e;
|
|
65
|
+
}, []);
|
|
66
|
+
e(() => {
|
|
67
|
+
let e = y ? j.current : A.current;
|
|
68
|
+
e?.focus(), e instanceof HTMLInputElement && e.setSelectionRange(e.value.length, e.value.length);
|
|
69
|
+
}, [y]);
|
|
70
|
+
let Y = s(null);
|
|
71
|
+
e(() => {
|
|
72
|
+
let e = `${J}:${B}:${ge}:${_e}`, t = A.current;
|
|
73
|
+
Y.current === e || !t || (Y.current = e, H(we(t)));
|
|
74
|
+
}), o(() => {
|
|
75
|
+
let e = () => {
|
|
76
|
+
let e = A.current;
|
|
77
|
+
e && H(h(e, m(e.getBoundingClientRect(), J + 1, window.innerWidth, window.innerHeight, B, p)));
|
|
78
|
+
};
|
|
79
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
80
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
81
|
+
};
|
|
82
|
+
}, [J, B]);
|
|
83
|
+
let De = V !== null, X = J * B, Z = a(() => {
|
|
84
|
+
let e = M.current;
|
|
85
|
+
if (!e) return;
|
|
86
|
+
let t = R.getSnapshot().highlight, n = t < 0 ? 0 : ue(t, e.scrollTop, X, B);
|
|
87
|
+
n !== e.scrollTop && (e.scrollTop = n), U(n);
|
|
88
|
+
}, [
|
|
89
|
+
R,
|
|
90
|
+
B,
|
|
91
|
+
X
|
|
92
|
+
]);
|
|
93
|
+
e(() => {
|
|
94
|
+
Z();
|
|
95
|
+
}, [
|
|
96
|
+
Z,
|
|
97
|
+
W,
|
|
98
|
+
De
|
|
99
|
+
]);
|
|
100
|
+
let Oe = (e) => {
|
|
101
|
+
if (re(e.nativeEvent)) return;
|
|
102
|
+
if (C !== void 0 && ie(e)) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
let t = C(R.valueToCommit());
|
|
105
|
+
t && t.status === "rejected" && I(t.message);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
let t = R.getSnapshot();
|
|
109
|
+
if (R.keyDown(e, me)) {
|
|
110
|
+
let e = R.getSnapshot();
|
|
111
|
+
e.selected !== t.selected && I(null), e.highlight !== t.highlight && Z();
|
|
112
|
+
}
|
|
113
|
+
}, Q = le(be, X, B, W.length), ke = W.slice(Q.start, Q.end), $ = V !== null && W.length > 0, Ae = $ && G >= 0 && W[G] ? `${P}-${G}` : void 0, je = K === "error" ? /* @__PURE__ */ f("div", {
|
|
114
|
+
className: "ssg-select-editor-empty ssg-select-editor-error",
|
|
115
|
+
role: "alert",
|
|
116
|
+
children: [/* @__PURE__ */ d("span", {
|
|
117
|
+
className: "ssg-select-editor-error-text",
|
|
118
|
+
title: z.errorMessage ?? void 0,
|
|
119
|
+
children: O.multiSelectFailed
|
|
120
|
+
}), /* @__PURE__ */ d("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
className: "ssg-select-editor-retry",
|
|
123
|
+
tabIndex: -1,
|
|
124
|
+
onClick: () => R.retry(),
|
|
125
|
+
children: O.retry
|
|
126
|
+
})]
|
|
127
|
+
}) : W.length > 0 ? null : /* @__PURE__ */ d("div", {
|
|
128
|
+
className: "ssg-select-editor-empty",
|
|
129
|
+
role: "status",
|
|
130
|
+
children: K === "loading" ? O.multiSelectLoading : z.filtered ? O.multiSelectNoMatch : O.noOptions
|
|
131
|
+
}), Me = {
|
|
132
|
+
role: "combobox",
|
|
133
|
+
"aria-label": g,
|
|
134
|
+
"aria-expanded": $,
|
|
135
|
+
"aria-controls": $ ? P : void 0,
|
|
136
|
+
"aria-activedescendant": Ae,
|
|
137
|
+
"aria-invalid": F !== null || void 0,
|
|
138
|
+
onKeyDown: Oe,
|
|
139
|
+
onBlur: () => R.blur()
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
142
|
+
/* @__PURE__ */ f("div", {
|
|
143
|
+
ref: Ee,
|
|
144
|
+
className: l("ssg-cell-editor-input ssg-cell-editor-input--multi", y && "ssg-cell-editor-input--multi-search", ve && "ssg-cell-editor-input--multi-top", F !== null && "ssg-cell-editor-input--invalid"),
|
|
145
|
+
style: T === "right" ? { justifyContent: "flex-end" } : T === "center" ? { justifyContent: "center" } : void 0,
|
|
146
|
+
tabIndex: y ? void 0 : 0,
|
|
147
|
+
...y ? {} : Me,
|
|
148
|
+
onPointerDown: (e) => {
|
|
149
|
+
y && e.target !== j.current && (e.preventDefault(), Te()?.focus());
|
|
150
|
+
},
|
|
151
|
+
children: [/* @__PURE__ */ d("span", {
|
|
152
|
+
className: "ssg-multi-select-editor-chips",
|
|
153
|
+
children: Se.map((e) => /* @__PURE__ */ f("span", {
|
|
154
|
+
className: "ssg-multi-select-chip",
|
|
155
|
+
children: [/* @__PURE__ */ d("span", {
|
|
156
|
+
className: "ssg-multi-select-chip-label",
|
|
157
|
+
children: e.label
|
|
158
|
+
}), /* @__PURE__ */ d("button", {
|
|
159
|
+
type: "button",
|
|
160
|
+
tabIndex: -1,
|
|
161
|
+
className: "ssg-multi-select-chip-remove",
|
|
162
|
+
"aria-label": e.label,
|
|
163
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
164
|
+
onClick: () => {
|
|
165
|
+
I(null), R.remove(e.value);
|
|
166
|
+
},
|
|
167
|
+
children: "×"
|
|
168
|
+
})]
|
|
169
|
+
}, e.value))
|
|
170
|
+
}), y ? /* @__PURE__ */ d("input", {
|
|
171
|
+
ref: j,
|
|
172
|
+
type: "text",
|
|
173
|
+
value: z.text,
|
|
174
|
+
onChange: (e) => {
|
|
175
|
+
R.input(e.target.value, e.nativeEvent.isComposing === !0);
|
|
176
|
+
},
|
|
177
|
+
onCompositionEnd: (e) => R.input(e.currentTarget.value, !1),
|
|
178
|
+
"aria-autocomplete": "list",
|
|
179
|
+
autoComplete: "off",
|
|
180
|
+
spellCheck: !1,
|
|
181
|
+
className: "ssg-multi-select-editor-search",
|
|
182
|
+
...Me
|
|
183
|
+
}) : null]
|
|
184
|
+
}),
|
|
185
|
+
F !== null && (!V || V.hidden || !q) ? /* @__PURE__ */ d(i, { message: F }) : null,
|
|
186
|
+
V && q ? ne(/* @__PURE__ */ f("div", {
|
|
187
|
+
ref: N,
|
|
188
|
+
className: l("ssg-select-editor-popover ssg-select-editor-popover--search ssg-select-editor-popover--multi", K === "loading" && W.length > 0 && "ssg-select-editor-popover--loading", E, D?.className),
|
|
189
|
+
style: {
|
|
190
|
+
...D?.style,
|
|
191
|
+
left: V.left,
|
|
192
|
+
top: V.top,
|
|
193
|
+
width: V.width,
|
|
194
|
+
maxHeight: V.maxHeight,
|
|
195
|
+
visibility: V.hidden ? "hidden" : void 0
|
|
196
|
+
},
|
|
197
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
198
|
+
children: [
|
|
199
|
+
je,
|
|
200
|
+
W.length > 0 ? /* @__PURE__ */ d("div", {
|
|
201
|
+
ref: M,
|
|
202
|
+
role: "listbox",
|
|
203
|
+
id: P,
|
|
204
|
+
"aria-label": g,
|
|
205
|
+
"aria-multiselectable": "true",
|
|
206
|
+
"aria-busy": K === "loading" || void 0,
|
|
207
|
+
className: "ssg-select-editor-scroller",
|
|
208
|
+
style: { height: X },
|
|
209
|
+
onScroll: (e) => U(e.currentTarget.scrollTop),
|
|
210
|
+
children: /* @__PURE__ */ d("div", {
|
|
211
|
+
className: "ssg-select-editor-rows",
|
|
212
|
+
role: "presentation",
|
|
213
|
+
style: { height: W.length * B },
|
|
214
|
+
children: ke.map((e, t) => {
|
|
215
|
+
let n = Q.start + t, { option: r } = e, i = xe.includes(r.value);
|
|
216
|
+
return /* @__PURE__ */ f("div", {
|
|
217
|
+
id: `${P}-${n}`,
|
|
218
|
+
role: "option",
|
|
219
|
+
"aria-selected": i,
|
|
220
|
+
"aria-setsize": W.length,
|
|
221
|
+
"aria-posinset": n + 1,
|
|
222
|
+
className: l("ssg-select-editor-option", n === G && "ssg-select-editor-option--highlighted", i && "ssg-select-editor-option--checked"),
|
|
223
|
+
style: { top: n * B },
|
|
224
|
+
onClick: () => {
|
|
225
|
+
I(null), R.toggle(n);
|
|
226
|
+
},
|
|
227
|
+
onPointerEnter: (e) => se(e.currentTarget),
|
|
228
|
+
onPointerMove: (e) => {
|
|
229
|
+
ye(e) && R.hover(n);
|
|
230
|
+
},
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ d("span", {
|
|
233
|
+
className: "ssg-multi-select-check",
|
|
234
|
+
"aria-hidden": "true",
|
|
235
|
+
children: i ? pe : null
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ d("span", {
|
|
238
|
+
className: "ssg-select-editor-option-label",
|
|
239
|
+
children: /* @__PURE__ */ d(fe, {
|
|
240
|
+
text: r.label,
|
|
241
|
+
range: e.labelMatch
|
|
242
|
+
})
|
|
243
|
+
}),
|
|
244
|
+
r.description ? /* @__PURE__ */ d("span", {
|
|
245
|
+
className: "ssg-select-editor-option-description",
|
|
246
|
+
children: /* @__PURE__ */ d(fe, {
|
|
247
|
+
text: r.description,
|
|
248
|
+
range: e.descriptionMatch
|
|
249
|
+
})
|
|
250
|
+
}) : null
|
|
251
|
+
]
|
|
252
|
+
}, `${r.value}-${n}`);
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
}) : null,
|
|
256
|
+
F === null ? k === "" ? null : /* @__PURE__ */ d("div", {
|
|
257
|
+
className: "ssg-multi-select-hint",
|
|
258
|
+
"aria-hidden": "true",
|
|
259
|
+
style: { minHeight: B },
|
|
260
|
+
children: k
|
|
261
|
+
}) : /* @__PURE__ */ d("div", {
|
|
262
|
+
className: "ssg-multi-select-hint ssg-multi-select-hint--error",
|
|
263
|
+
role: "alert",
|
|
264
|
+
style: { minHeight: B },
|
|
265
|
+
children: F
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
}), q) : null
|
|
269
|
+
] });
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/view/GridMultiSelectChips.tsx
|
|
273
|
+
function x({ labels: e, separator: t, renderLabel: n }) {
|
|
274
|
+
return e.length === 0 ? null : /* @__PURE__ */ d("span", {
|
|
275
|
+
className: "ssg-multi-select-chips",
|
|
276
|
+
"data-ssg-tooltip-overflow": e.join(t),
|
|
277
|
+
children: e.map((e, t) => /* @__PURE__ */ d("span", {
|
|
278
|
+
className: "ssg-multi-select-chip",
|
|
279
|
+
children: /* @__PURE__ */ d("span", {
|
|
280
|
+
className: "ssg-multi-select-chip-label",
|
|
281
|
+
children: n(e, t)
|
|
282
|
+
})
|
|
283
|
+
}, t))
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/features/multiSelect.ts
|
|
288
|
+
var S = {
|
|
289
|
+
MultiSelectCellEditor: b,
|
|
290
|
+
MultiSelectChips: x,
|
|
291
|
+
resolveChipLabels: g,
|
|
292
|
+
splitRangesByChips: _,
|
|
293
|
+
localeText: v
|
|
294
|
+
};
|
|
295
|
+
//#endregion
|
|
296
|
+
export { S as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useGridLocaleText-CRSWUb4o.cjs"),t=require("./CheckboxCell-BBzjMEcs.cjs");let n=require("react"),r=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/slotProps"),a=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText"),o=require("react/jsx-runtime"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor"),c=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/detailRow"),l=require("@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions"),u=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/checkboxEditor"),d=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cellText"),f=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures");var p=()=>{},m=e=>e,h=80,g=(0,o.jsx)(`path`,{d:`M9.8 1.5 14.5 6.2l-1.4 1.4-1-.9-2.6 2.6.3 3.2-1.4 1.4-2.6-2.6-3.3 3.3-.7-.7 3.3-3.3L2.5 8l1.4-1.4 3.2.3 2.6-2.6-.9-1z`});function _({pane:n,position:f,ownsRowHeader:_,leadingWidth:v,rows:y,rowHeight:b,stickyOffset:x,bodyHeight:S,renderEntries:C,rowKeyGetter:w,ariaRowIndexStart:T,rowHeaderCellStyle:E,getRowClassName:D,showCellOverflowTooltip:O,conditionalFormat:k,conditionalFormatStats:A,multiSelect:j,slots:M,onPointerEnter:N}){let P=e.r(),F=C.filter(Boolean),I=!_&&F.length===0,L=(e,n,r)=>{if((0,c.isSyntheticColumnKey)(n.key))return null;if(n.renderCell)return n.renderCell({...r,tree:void 0,setValue:p});let i=(0,s.resolveColumnEditor)(n,e);if(i?.type===`checkbox`)return(0,o.jsx)(t.t,{slot:M?.checkbox,label:n.title||n.key,checked:(0,u.isCheckboxChecked)(r.value,i),readOnly:!0,onToggle:p});let a=k?n.conditionalFormat:void 0;if(a?.dataBar?.showValue===!1)return null;let l=j&&n.valueFormatter===void 0?j.resolveChipLabels(i,r.value,e):void 0;if(j&&l!==void 0)return(0,o.jsx)(j.MultiSelectChips,{labels:l,separator:P.multiSelectSeparator,renderLabel:m});let f=(0,d.formatCellText)(n,r.value,e,P.multiSelectSeparator),h=k&&a?.chips?k.resolveChipSpec(a.chips,r):null;return k&&h?(0,o.jsx)(k.GridChip,{spec:h,children:h.label??f}):(0,o.jsx)(`span`,{className:`ssg-cell-value`,children:f})};return(0,o.jsxs)(o.Fragment,{children:[S>0&&(0,o.jsx)(`div`,{"aria-hidden":`true`,style:{height:S}}),(0,o.jsx)(`div`,{className:(0,r.cx)(`ssg-pinned-rows`,`ssg-pinned-rows--${f}`),style:{[f]:x,height:y.length*b},onPointerEnter:N,children:y.map((e,t)=>{let s=w(e,t),c=(0,i.resolveSlotProps)(D?.(e,t,{row:e,rowIndex:t,sourceRowIndex:t,rowKey:s,isSelected:!1,pinned:f}));return(0,o.jsxs)(`div`,{"data-pane":n,"data-ssg-pinned":f,role:`row`,"aria-rowindex":T+t,"aria-hidden":I||void 0,className:(0,r.cx)(`ssg-pinned-row`,c.className),style:{...c.style,height:b,top:t*b},children:[_&&(0,o.jsx)(`div`,{role:`rowheader`,"aria-colindex":1,className:(0,r.cx)(`ssg-header-cell`,`ssg-row-header-cell`,`ssg-pinned-row-header`,c.className,M?.rowHeaderCell?.className),style:{...M?.rowHeaderCell?.style,...c.style,...E,height:b},children:(0,o.jsx)(`svg`,{className:`ssg-pinned-row-icon`,viewBox:`0 0 16 16`,role:`img`,"aria-label":(0,a.formatLocaleText)(f===`top`?P.pinnedTopRow:P.pinnedBottomRow,{row:t+1}),children:g})}),F.map(n=>{let a=n.column,u=(0,l.getCellValue)(e,a),d={row:e,rowIndex:t,sourceRowIndex:t,rowKey:s,colIndex:n.logicalIndex,value:u,column:a,isActive:!1,isSelected:!1,isEditing:!1,readOnly:!0,pinned:f},p=(0,i.resolveSlotProps)(typeof a.cellClassName==`function`?a.cellClassName(d):a.cellClassName),m=k?a.conditionalFormat:void 0,g=A.get(a.key),_=k&&m?.dataBar?k.resolveDataBar(m.dataBar,u,g):null,y=k&&m?.colorScale?k.resolveColorScaleBackground(m.colorScale,u,g):null,x=_?_.negative?m?.dataBar?.negativeColor:m?.dataBar?.color:void 0;return(0,o.jsxs)(`div`,{role:`gridcell`,"aria-colindex":n.logicalIndex+2,"aria-readonly":!0,"data-ssg-col-key":a.key,"data-ssg-tooltip-overflow":O&&!a.renderCell?``:void 0,className:(0,r.cx)(`ssg-body-cell`,`ssg-pinned-cell`,a.align===`center`&&`ssg-body-cell--align-center`,a.align===`right`&&`ssg-body-cell--align-right`,_!==null&&`ssg-body-cell--cf-bar`,y!==null&&`ssg-body-cell--cf-scale`,m?.chips!==void 0&&n.paneLocalSize<h&&`ssg-body-cell--chip-compact`,c.className,p.className,M?.bodyCell?.className),style:{...M?.bodyCell?.style,...y===null?null:{backgroundColor:y},...c.style,...p.style,left:v+n.paneLocalStart,width:n.paneLocalSize,minWidth:n.paneLocalSize,height:b},children:[_&&(0,o.jsx)(`span`,{className:(0,r.cx)(`ssg-cf-bar`,_.negative&&`ssg-cf-bar--negative`),style:{left:`${_.start}%`,width:`${_.end-_.start}%`,...x?{backgroundColor:x}:null},"aria-hidden":`true`}),L(e,a,d)]},a.key)})]},String(s))})})]})}var v=new Set([`rowHeaderCellStyle`]),y={PinnedRows:(0,n.memo)(_,(e,t)=>(0,i.arePropsEqualWithStyleKeys)(e,t,v)),localeText:f.DEFAULT_PINNED_ROWS_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { r as e } from "./useGridLocaleText-CpoTVgyp.js";
|
|
2
|
+
import { t } from "./CheckboxCell-DAGCJJkg.js";
|
|
3
|
+
import { memo as n } from "react";
|
|
4
|
+
import { cx as r } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cx";
|
|
5
|
+
import { arePropsEqualWithStyleKeys as i, resolveSlotProps as a } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/slotProps";
|
|
6
|
+
import { formatLocaleText as o } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
7
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { resolveColumnEditor as u } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/columnEditor";
|
|
9
|
+
import { isSyntheticColumnKey as d } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/detailRow";
|
|
10
|
+
import { getCellValue as f } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/permissions";
|
|
11
|
+
import { isCheckboxChecked as p } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/checkboxEditor";
|
|
12
|
+
import { formatCellText as m } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cellText";
|
|
13
|
+
import { DEFAULT_PINNED_ROWS_LOCALE_TEXT as h } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
14
|
+
//#region src/view/GridPinnedRows.tsx
|
|
15
|
+
var g = () => {}, _ = (e) => e, v = 80, y = /* @__PURE__ */ c("path", { d: "M9.8 1.5 14.5 6.2l-1.4 1.4-1-.9-2.6 2.6.3 3.2-1.4 1.4-2.6-2.6-3.3 3.3-.7-.7 3.3-3.3L2.5 8l1.4-1.4 3.2.3 2.6-2.6-.9-1z" });
|
|
16
|
+
function b({ pane: n, position: i, ownsRowHeader: h, leadingWidth: b, rows: x, rowHeight: S, stickyOffset: C, bodyHeight: w, renderEntries: T, rowKeyGetter: E, ariaRowIndexStart: D, rowHeaderCellStyle: O, getRowClassName: k, showCellOverflowTooltip: A, conditionalFormat: j, conditionalFormatStats: M, multiSelect: N, slots: P, onPointerEnter: F }) {
|
|
17
|
+
let I = e(), L = T.filter(Boolean), R = !h && L.length === 0, z = (e, n, r) => {
|
|
18
|
+
if (d(n.key)) return null;
|
|
19
|
+
if (n.renderCell) return n.renderCell({
|
|
20
|
+
...r,
|
|
21
|
+
tree: void 0,
|
|
22
|
+
setValue: g
|
|
23
|
+
});
|
|
24
|
+
let i = u(n, e);
|
|
25
|
+
if (i?.type === "checkbox") return /* @__PURE__ */ c(t, {
|
|
26
|
+
slot: P?.checkbox,
|
|
27
|
+
label: n.title || n.key,
|
|
28
|
+
checked: p(r.value, i),
|
|
29
|
+
readOnly: !0,
|
|
30
|
+
onToggle: g
|
|
31
|
+
});
|
|
32
|
+
let a = j ? n.conditionalFormat : void 0;
|
|
33
|
+
if (a?.dataBar?.showValue === !1) return null;
|
|
34
|
+
let o = N && n.valueFormatter === void 0 ? N.resolveChipLabels(i, r.value, e) : void 0;
|
|
35
|
+
if (N && o !== void 0) return /* @__PURE__ */ c(N.MultiSelectChips, {
|
|
36
|
+
labels: o,
|
|
37
|
+
separator: I.multiSelectSeparator,
|
|
38
|
+
renderLabel: _
|
|
39
|
+
});
|
|
40
|
+
let s = m(n, r.value, e, I.multiSelectSeparator), l = j && a?.chips ? j.resolveChipSpec(a.chips, r) : null;
|
|
41
|
+
return j && l ? /* @__PURE__ */ c(j.GridChip, {
|
|
42
|
+
spec: l,
|
|
43
|
+
children: l.label ?? s
|
|
44
|
+
}) : /* @__PURE__ */ c("span", {
|
|
45
|
+
className: "ssg-cell-value",
|
|
46
|
+
children: s
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ l(s, { children: [w > 0 && /* @__PURE__ */ c("div", {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
style: { height: w }
|
|
52
|
+
}), /* @__PURE__ */ c("div", {
|
|
53
|
+
className: r("ssg-pinned-rows", `ssg-pinned-rows--${i}`),
|
|
54
|
+
style: {
|
|
55
|
+
[i]: C,
|
|
56
|
+
height: x.length * S
|
|
57
|
+
},
|
|
58
|
+
onPointerEnter: F,
|
|
59
|
+
children: x.map((e, t) => {
|
|
60
|
+
let s = E(e, t), u = a(k?.(e, t, {
|
|
61
|
+
row: e,
|
|
62
|
+
rowIndex: t,
|
|
63
|
+
sourceRowIndex: t,
|
|
64
|
+
rowKey: s,
|
|
65
|
+
isSelected: !1,
|
|
66
|
+
pinned: i
|
|
67
|
+
}));
|
|
68
|
+
return /* @__PURE__ */ l("div", {
|
|
69
|
+
"data-pane": n,
|
|
70
|
+
"data-ssg-pinned": i,
|
|
71
|
+
role: "row",
|
|
72
|
+
"aria-rowindex": D + t,
|
|
73
|
+
"aria-hidden": R || void 0,
|
|
74
|
+
className: r("ssg-pinned-row", u.className),
|
|
75
|
+
style: {
|
|
76
|
+
...u.style,
|
|
77
|
+
height: S,
|
|
78
|
+
top: t * S
|
|
79
|
+
},
|
|
80
|
+
children: [h && /* @__PURE__ */ c("div", {
|
|
81
|
+
role: "rowheader",
|
|
82
|
+
"aria-colindex": 1,
|
|
83
|
+
className: r("ssg-header-cell", "ssg-row-header-cell", "ssg-pinned-row-header", u.className, P?.rowHeaderCell?.className),
|
|
84
|
+
style: {
|
|
85
|
+
...P?.rowHeaderCell?.style,
|
|
86
|
+
...u.style,
|
|
87
|
+
...O,
|
|
88
|
+
height: S
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ c("svg", {
|
|
91
|
+
className: "ssg-pinned-row-icon",
|
|
92
|
+
viewBox: "0 0 16 16",
|
|
93
|
+
role: "img",
|
|
94
|
+
"aria-label": o(i === "top" ? I.pinnedTopRow : I.pinnedBottomRow, { row: t + 1 }),
|
|
95
|
+
children: y
|
|
96
|
+
})
|
|
97
|
+
}), L.map((n) => {
|
|
98
|
+
let o = n.column, d = f(e, o), p = {
|
|
99
|
+
row: e,
|
|
100
|
+
rowIndex: t,
|
|
101
|
+
sourceRowIndex: t,
|
|
102
|
+
rowKey: s,
|
|
103
|
+
colIndex: n.logicalIndex,
|
|
104
|
+
value: d,
|
|
105
|
+
column: o,
|
|
106
|
+
isActive: !1,
|
|
107
|
+
isSelected: !1,
|
|
108
|
+
isEditing: !1,
|
|
109
|
+
readOnly: !0,
|
|
110
|
+
pinned: i
|
|
111
|
+
}, m = a(typeof o.cellClassName == "function" ? o.cellClassName(p) : o.cellClassName), h = j ? o.conditionalFormat : void 0, g = M.get(o.key), _ = j && h?.dataBar ? j.resolveDataBar(h.dataBar, d, g) : null, y = j && h?.colorScale ? j.resolveColorScaleBackground(h.colorScale, d, g) : null, x = _ ? _.negative ? h?.dataBar?.negativeColor : h?.dataBar?.color : void 0;
|
|
112
|
+
return /* @__PURE__ */ l("div", {
|
|
113
|
+
role: "gridcell",
|
|
114
|
+
"aria-colindex": n.logicalIndex + 2,
|
|
115
|
+
"aria-readonly": !0,
|
|
116
|
+
"data-ssg-col-key": o.key,
|
|
117
|
+
"data-ssg-tooltip-overflow": A && !o.renderCell ? "" : void 0,
|
|
118
|
+
className: r("ssg-body-cell", "ssg-pinned-cell", o.align === "center" && "ssg-body-cell--align-center", o.align === "right" && "ssg-body-cell--align-right", _ !== null && "ssg-body-cell--cf-bar", y !== null && "ssg-body-cell--cf-scale", h?.chips !== void 0 && n.paneLocalSize < v && "ssg-body-cell--chip-compact", u.className, m.className, P?.bodyCell?.className),
|
|
119
|
+
style: {
|
|
120
|
+
...P?.bodyCell?.style,
|
|
121
|
+
...y === null ? null : { backgroundColor: y },
|
|
122
|
+
...u.style,
|
|
123
|
+
...m.style,
|
|
124
|
+
left: b + n.paneLocalStart,
|
|
125
|
+
width: n.paneLocalSize,
|
|
126
|
+
minWidth: n.paneLocalSize,
|
|
127
|
+
height: S
|
|
128
|
+
},
|
|
129
|
+
children: [_ && /* @__PURE__ */ c("span", {
|
|
130
|
+
className: r("ssg-cf-bar", _.negative && "ssg-cf-bar--negative"),
|
|
131
|
+
style: {
|
|
132
|
+
left: `${_.start}%`,
|
|
133
|
+
width: `${_.end - _.start}%`,
|
|
134
|
+
...x ? { backgroundColor: x } : null
|
|
135
|
+
},
|
|
136
|
+
"aria-hidden": "true"
|
|
137
|
+
}), z(e, o, p)]
|
|
138
|
+
}, o.key);
|
|
139
|
+
})]
|
|
140
|
+
}, String(s));
|
|
141
|
+
})
|
|
142
|
+
})] });
|
|
143
|
+
}
|
|
144
|
+
var x = /* @__PURE__ */ new Set(["rowHeaderCellStyle"]), S = {
|
|
145
|
+
PinnedRows: /* @__PURE__ */ n(b, (e, t) => i(e, t, x)),
|
|
146
|
+
localeText: h
|
|
147
|
+
};
|
|
148
|
+
//#endregion
|
|
149
|
+
export { S as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./useController-Zlv7BRoY.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),r=require("react/jsx-runtime"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures"),a=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/rowDragTarget"),o=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/rowDragController");var s=n=>{let r=(0,t.useRef)(null),i=(0,t.useRef)(null),a=(0,t.useRef)(null),s=e.t(o.createRowDragController,{...n,leftIndicatorRef:r,centerIndicatorRef:i,rightIndicatorRef:a});return{onRowDragHandlePointerDown:s.onRowDragHandlePointerDown,leftIndicatorRef:r,centerIndicatorRef:i,rightIndicatorRef:a,applyReorderSettle:s.applyReorderSettle}},c={useRowDrag:({rowModel:i,visibleColumns:o,isRowDraggable:c,canDropRow:l,rows:u,resolveRowKey:d,hasRowKeys:f,localeTexts:p,...m})=>{let h=(0,t.useMemo)(()=>(0,a.createRowDropCheck)(l,u,d),[l,u,d]),g=(0,t.useCallback)(e=>(0,a.resolveRowDragLabel)(i,o,e,p.dragRowLabel),[i,o,p]),_=(0,t.useCallback)(e=>(0,a.getDragRowToken)(i,e),[i]),v=(0,t.useCallback)((e,t)=>(0,a.locateDragRowToken)(i,f,e,t),[i,f]),{onRowDragHandlePointerDown:y,leftIndicatorRef:b,centerIndicatorRef:x,rightIndicatorRef:S,applyReorderSettle:C}=s({...m,getRowDragLabel:g,getDragRow:_,locateDragRow:v,canDropAt:h});e.r(()=>{C()},[i,C]);let w=m.enabled;return{renderHandleCell:(0,t.useCallback)((e,t)=>{if(c){let n=i.getSourceIndex(t)??t;if(!c(e,{rowKey:i.getRowKey(t)??t,sourceRowIndex:n}))return null}return(0,r.jsx)(`span`,{className:(0,n.cx)(`ssg-row-drag-handle`,!w&&`ssg-row-drag-handle--disabled`),"data-ssg-tooltip":w?p.dragRow:p.dragRowDisabled,"aria-hidden":`true`,onPointerDown:w?e=>y(t,e):void 0,children:(0,r.jsxs)(`svg`,{width:`8`,height:`14`,viewBox:`0 0 8 14`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsx)(`circle`,{cx:`2`,cy:`3`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`3`,r:`1`}),(0,r.jsx)(`circle`,{cx:`2`,cy:`7`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`7`,r:`1`}),(0,r.jsx)(`circle`,{cx:`2`,cy:`11`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`11`,r:`1`})]})})},[c,i,w,y,p]),renderDropIndicator:(e,t)=>(0,r.jsx)(`div`,{ref:e===`left`?b:e===`center`?x:S,className:t})}},localeText:i.DEFAULT_ROW_DRAG_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
1
|
+
const e=require("./useController-Zlv7BRoY.cjs");let t=require("react"),n=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),r=require("react/jsx-runtime"),i=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures"),a=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/rowDragTarget"),o=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/rowDragController");var s=n=>{let r=(0,t.useRef)(null),i=(0,t.useRef)(null),a=(0,t.useRef)(null),s=e.t(o.createRowDragController,{...n,leftIndicatorRef:r,centerIndicatorRef:i,rightIndicatorRef:a});return{onRowDragHandlePointerDown:s.onRowDragHandlePointerDown,leftIndicatorRef:r,centerIndicatorRef:i,rightIndicatorRef:a,applyReorderSettle:s.applyReorderSettle}},c={useRowDrag:({rowModel:i,visibleColumns:o,isRowDraggable:c,canDropRow:l,rows:u,resolveRowKey:d,hasRowKeys:f,localeTexts:p,...m})=>{let h=(0,t.useMemo)(()=>(0,a.createRowDropCheck)(l,u,d),[l,u,d]),g=(0,t.useCallback)(e=>(0,a.resolveRowDragLabel)(i,o,e,p.dragRowLabel),[i,o,p]),_=(0,t.useCallback)(e=>(0,a.getDragRowToken)(i,e),[i]),v=(0,t.useCallback)((e,t)=>(0,a.locateDragRowToken)(i,f,e,t),[i,f]),{onRowDragHandlePointerDown:y,leftIndicatorRef:b,centerIndicatorRef:x,rightIndicatorRef:S,applyReorderSettle:C}=s({...m,getRowDragLabel:g,getDragRow:_,locateDragRow:v,canDropAt:h,maxDropSlot:i.newRow?.index});e.r(()=>{C()},[i,C]);let w=m.enabled;return{renderHandleCell:(0,t.useCallback)((e,t)=>{if(c){let n=i.getSourceIndex(t)??t;if(!c(e,{rowKey:i.getRowKey(t)??t,sourceRowIndex:n}))return null}return(0,r.jsx)(`span`,{className:(0,n.cx)(`ssg-row-drag-handle`,!w&&`ssg-row-drag-handle--disabled`),"data-ssg-tooltip":w?p.dragRow:p.dragRowDisabled,"aria-hidden":`true`,onPointerDown:w?e=>y(t,e):void 0,children:(0,r.jsxs)(`svg`,{width:`8`,height:`14`,viewBox:`0 0 8 14`,fill:`currentColor`,"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsx)(`circle`,{cx:`2`,cy:`3`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`3`,r:`1`}),(0,r.jsx)(`circle`,{cx:`2`,cy:`7`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`7`,r:`1`}),(0,r.jsx)(`circle`,{cx:`2`,cy:`11`,r:`1`}),(0,r.jsx)(`circle`,{cx:`6`,cy:`11`,r:`1`})]})})},[c,i,w,y,p]),renderDropIndicator:(e,t)=>(0,r.jsx)(`div`,{ref:e===`left`?b:e===`center`?x:S,className:t})}},localeText:i.DEFAULT_ROW_DRAG_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useController-Zlv7BRoY.cjs"),t=require("./usePortalTokens-CUAiwfmK.cjs"),n=require("./useGridLocaleText-CRSWUb4o.cjs"),r=require("./CellEditorErrorBubble-DDoxYBXj.cjs"),i=require("./useTopAlignedInput-T3k_V2-u.cjs");let a=require("react"),o=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/cx"),ee=require("react-dom"),s=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards"),c=require("react/jsx-runtime"),te=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/editorKeys"),l=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState"),u=require("@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds"),ne=require("@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle"),d=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures"),f=require("@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch"),re=require("@ishibashi0112/spreadsheet-grid-core/internal/controllers/searchSelectEditorController");function p({text:e,range:t}){return(0,c.jsx)(c.Fragment,{children:(0,f.splitSelectSearchText)(e,t).map((e,t)=>e.match?(0,c.jsx)(`mark`,{className:`ssg-select-editor-match`,children:e.text},t):e.text)})}var ie=()=>{let e=!1;return{set:t=>{e=t},take:()=>{let t=e;return e=!1,t}}};function m({ariaLabel:d,options:m,value:h,displayText:ae,allowFreeText:g,load:_,onCommit:oe,onCancel:v,onCommitToSelection:y,onRegisterFlush:b,align:x,themeClassName:S,popoverSlot:C,enterMove:se,initialText:w,cellTop:ce=0,cellLeft:le=0,cellHeight:T=0,alignTop:ue=!1}){let E=n.r(),D=(0,a.useRef)(null),O=(0,a.useRef)(null),k=(0,a.useRef)(null);i.t(D,ue,T);let A=(0,a.useId)(),[j]=(0,a.useState)(l.createPointerMoveFilter),[M,N]=(0,a.useState)(null),[P]=(0,a.useState)(ie),F=(e,t,n,r)=>{let i=P.take()&&y!==void 0?y(e):oe(e,t,n,r);return i&&i.status===`rejected`&&N(i.message),i},[I]=(0,a.useState)(()=>(0,re.createSearchSelectEditorController)({options:m,value:h,initialText:w,displayText:ae,allowFreeText:g,load:_,onCommit:F,onCancel:v}));e.r(()=>{I.setHandlers({onCommit:F,onCancel:v,load:_})});let L=(0,a.useSyncExternalStore)(I.subscribe,I.getSnapshot,I.getSnapshot);(0,a.useEffect)(()=>I.attach(),[I]),e.r(()=>{I.setOptions(m)},[I,m]),e.r(()=>{b?.(g?I.flush:null)},[b,g,I]);let[R]=(0,a.useState)(l.resolveSelectOptionRowHeight),[z,B]=(0,a.useState)(null),[V,H]=(0,a.useState)(0),{results:U,highlight:W,status:G}=L,K=g&&G===`ready`&&L.filtered&&U.length===0;t.i(k,z!==null&&!K,S,{layout:z});let q=t.r(z!==null),J=Math.max(U.length,1),de=e=>(0,u.withAnchorVisibility)(e,(0,l.computeSelectPopoverPlacement)(e.getBoundingClientRect(),J,window.innerWidth,window.innerHeight,R,l.SELECT_SEARCH_POPOVER_MIN_WIDTH)),fe=(0,a.useCallback)(e=>{D.current=e,e&&(e.focus(),w===void 0?e.select():e.setSelectionRange(e.value.length,e.value.length))},[w]),Y=(0,a.useRef)(null);e.r(()=>{let e=`${J}:${R}:${ce}:${le}`,t=D.current;Y.current===e||!t||(Y.current=e,B(de(t)))}),(0,a.useEffect)(()=>{let e=()=>{let e=D.current;e&&B((0,u.withAnchorVisibility)(e,(0,l.computeSelectPopoverPlacement)(e.getBoundingClientRect(),J,window.innerWidth,window.innerHeight,R,l.SELECT_SEARCH_POPOVER_MIN_WIDTH)))};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[J,R]);let pe=z!==null,X=Math.min(J,8)*R,Z=(0,a.useCallback)(()=>{let e=O.current;if(!e)return;let t=I.getSnapshot().highlight,n=t<0?0:(0,f.revealSelectListRow)(t,e.scrollTop,X,R);n!==e.scrollTop&&(e.scrollTop=n),H(n)},[I,R,X]);e.r(()=>{Z()},[Z,U,pe]);let me=e=>{if((0,s.isImeComposingKeyEvent)(e.nativeEvent))return;let t=I.getSnapshot().highlight;y!==void 0&&(0,te.isCommitToSelectionKey)(e)?P.set(!0):I.getSnapshot().status!==`loading`&&P.set(!1),I.keyDown(e,se)&&I.getSnapshot().highlight!==t&&(N(null),Z())},Q=(0,f.resolveSelectListWindow)(V,X,R,U.length),he=U.slice(Q.start,Q.end),$=z!==null&&U.length>0,ge=$&&W>=0&&U[W]?`${A}-${W}`:void 0,_e=G===`error`?(0,c.jsxs)(`div`,{className:`ssg-select-editor-empty ssg-select-editor-error`,role:`alert`,children:[(0,c.jsx)(`span`,{className:`ssg-select-editor-error-text`,title:L.errorMessage??void 0,children:E.selectSearchFailed}),(0,c.jsx)(`button`,{type:`button`,className:`ssg-select-editor-retry`,tabIndex:-1,onClick:()=>I.retry(),children:E.retry})]}):U.length>0?null:(0,c.jsx)(`div`,{className:`ssg-select-editor-empty`,role:`status`,children:G===`loading`?E.selectSearchLoading:L.filtered?E.selectSearchNoMatch:E.noOptions});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`input`,{ref:fe,type:`text`,value:L.text,onChange:e=>{N(null),I.input(e.target.value,e.nativeEvent.isComposing===!0)},onCompositionEnd:e=>I.input(e.currentTarget.value,!1),onKeyDown:me,onBlur:()=>I.blur(),role:`combobox`,"aria-autocomplete":`list`,"aria-label":d,"aria-expanded":$,"aria-controls":$?A:void 0,"aria-activedescendant":ge,"aria-invalid":M!==null||void 0,autoComplete:`off`,spellCheck:!1,className:(0,o.cx)(`ssg-cell-editor-input ssg-cell-editor-input--search`,M!==null&&`ssg-cell-editor-input--invalid`),style:x?{textAlign:x}:void 0}),M===null?null:(0,c.jsx)(r.t,{message:M}),z&&q&&!K?(0,ee.createPortal)((0,c.jsxs)(`div`,{ref:k,className:(0,o.cx)(`ssg-select-editor-popover ssg-select-editor-popover--search`,G===`loading`&&U.length>0&&`ssg-select-editor-popover--loading`,S,C?.className),style:{...C?.style,left:z.left,top:z.top,width:z.width,maxHeight:z.maxHeight,visibility:z.hidden?`hidden`:void 0},onPointerDown:e=>e.preventDefault(),children:[_e,U.length>0?(0,c.jsx)(`div`,{ref:O,role:`listbox`,id:A,"aria-label":d,"aria-busy":G===`loading`||void 0,className:`ssg-select-editor-scroller`,style:{height:X},onScroll:e=>H(e.currentTarget.scrollTop),children:(0,c.jsx)(`div`,{className:`ssg-select-editor-rows`,role:`presentation`,style:{height:U.length*R},children:he.map((e,t)=>{let n=Q.start+t,{option:r}=e;return(0,c.jsxs)(`div`,{id:`${A}-${n}`,role:`option`,"aria-selected":n===W,"aria-setsize":U.length,"aria-posinset":n+1,className:(0,o.cx)(`ssg-select-editor-option`,n===W&&`ssg-select-editor-option--highlighted`),style:{top:n*R},onClick:()=>I.choose(n),onPointerEnter:e=>(0,ne.revealOverflowTitle)(e.currentTarget),onPointerMove:e=>{j(e)&&I.hover(n)},children:[(0,c.jsx)(`span`,{className:`ssg-select-editor-option-label`,children:(0,c.jsx)(p,{text:r.label,range:e.labelMatch})}),r.description?(0,c.jsx)(`span`,{className:`ssg-select-editor-option-description`,children:(0,c.jsx)(p,{text:r.description,range:e.descriptionMatch})}):null]},`${r.value}-${n}`)})})}):null]}),q):null]})}var h={SearchSelectCellEditor:m,localeText:d.DEFAULT_SELECT_SEARCH_LOCALE_TEXT};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|