@ishibashi0112/spreadsheet-grid-solid 1.6.0 → 1.7.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 +85 -14
- package/README.md +2 -2
- package/dist/editors/CellEditorLayer.d.ts +4 -2
- package/dist/editors/SearchSelectCellEditor.d.ts +24 -0
- package/dist/editors/SelectCellEditor.d.ts +2 -3
- package/dist/features/selectSearch.d.ts +2 -0
- package/dist/features/types.d.ts +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3216 -2942
- package/dist/model/gridTypes.d.ts +2 -0
- package/dist/source/index.jsx +408 -48
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/package.json +3 -3
- package/skills/spreadsheet-grid-solid/SKILL.md +1 -0
package/dist/source/index.jsx
CHANGED
|
@@ -1445,6 +1445,7 @@ import { Show as Show8, createMemo as createMemo7, untrack as untrack11 } from "
|
|
|
1445
1445
|
import { toDateInputValue } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorValues";
|
|
1446
1446
|
import { resolveTypedStartText } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorStart";
|
|
1447
1447
|
import { formatLocaleText as formatLocaleText4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
1448
|
+
import { isSearchSelectEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
1448
1449
|
|
|
1449
1450
|
// src/editors/TextCellEditor.tsx
|
|
1450
1451
|
import { Show as Show6, createRenderEffect as createRenderEffect3, createSignal as createSignal4, onCleanup as onCleanup3, onSettled as onSettled3, untrack as untrack6 } from "solid-js";
|
|
@@ -1735,8 +1736,11 @@ import {
|
|
|
1735
1736
|
handleSelectEditorKeyDown,
|
|
1736
1737
|
resolveSelectEditorStart,
|
|
1737
1738
|
resolveSelectOptionRowHeight,
|
|
1738
|
-
typeaheadJump
|
|
1739
|
+
typeaheadJump,
|
|
1740
|
+
createPointerMoveFilter
|
|
1739
1741
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
1742
|
+
import { withAnchorVisibility } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
|
|
1743
|
+
import { revealOverflowTitle } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
|
|
1740
1744
|
import { isImeComposingKeyEvent } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
1741
1745
|
function SelectCellEditor(props) {
|
|
1742
1746
|
const texts = useGridLocaleText();
|
|
@@ -1748,6 +1752,7 @@ function SelectCellEditor(props) {
|
|
|
1748
1752
|
const start = untrack8(() => resolveSelectEditorStart(props.options, props.value, props.initialText, Date.now()));
|
|
1749
1753
|
let typeahead = start.typeahead;
|
|
1750
1754
|
const [highlight, setHighlight] = createSignal6(start.highlight);
|
|
1755
|
+
const pointerMoved = createPointerMoveFilter();
|
|
1751
1756
|
let currentHighlight = start.highlight;
|
|
1752
1757
|
const updateHighlight = (next) => {
|
|
1753
1758
|
currentHighlight = typeof next === "function" ? next(currentHighlight) : next;
|
|
@@ -1768,12 +1773,15 @@ function SelectCellEditor(props) {
|
|
|
1768
1773
|
return;
|
|
1769
1774
|
}
|
|
1770
1775
|
setPlacement(
|
|
1771
|
-
|
|
1772
|
-
element
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1776
|
+
withAnchorVisibility(
|
|
1777
|
+
element,
|
|
1778
|
+
computeSelectPopoverPlacement(
|
|
1779
|
+
element.getBoundingClientRect(),
|
|
1780
|
+
untrack8(() => props.options.length),
|
|
1781
|
+
window.innerWidth,
|
|
1782
|
+
window.innerHeight,
|
|
1783
|
+
optionRowHeight
|
|
1784
|
+
)
|
|
1777
1785
|
)
|
|
1778
1786
|
);
|
|
1779
1787
|
};
|
|
@@ -1787,23 +1795,28 @@ function SelectCellEditor(props) {
|
|
|
1787
1795
|
window.removeEventListener("scroll", measure, true);
|
|
1788
1796
|
};
|
|
1789
1797
|
});
|
|
1798
|
+
let refocusSeen = false;
|
|
1790
1799
|
createEffect2(
|
|
1791
1800
|
() => props.options.length,
|
|
1792
|
-
(
|
|
1793
|
-
if (
|
|
1801
|
+
outsideGraphApply(() => {
|
|
1802
|
+
if (refocusSeen) {
|
|
1794
1803
|
untrack8(input)?.focus();
|
|
1795
1804
|
measure();
|
|
1796
1805
|
}
|
|
1797
|
-
|
|
1806
|
+
refocusSeen = true;
|
|
1807
|
+
}),
|
|
1798
1808
|
{ name: "selectEditorOptionsRefocus" }
|
|
1799
1809
|
);
|
|
1810
|
+
let followedPosition;
|
|
1800
1811
|
createEffect2(
|
|
1801
1812
|
() => `${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
|
|
1802
|
-
(position
|
|
1813
|
+
outsideGraphApply((position) => {
|
|
1814
|
+
const previous = followedPosition;
|
|
1815
|
+
followedPosition = position;
|
|
1803
1816
|
if (previous !== void 0 && previous !== position) {
|
|
1804
1817
|
measure();
|
|
1805
1818
|
}
|
|
1806
|
-
},
|
|
1819
|
+
}),
|
|
1807
1820
|
{ name: "selectEditorFollowCell" }
|
|
1808
1821
|
);
|
|
1809
1822
|
const mount = () => placement2() !== null ? portal.container() : null;
|
|
@@ -1815,8 +1828,8 @@ function SelectCellEditor(props) {
|
|
|
1815
1828
|
},
|
|
1816
1829
|
{ name: "selectEditorScrollHighlight" }
|
|
1817
1830
|
);
|
|
1818
|
-
const commitValue = (
|
|
1819
|
-
const result = props.onCommit(
|
|
1831
|
+
const commitValue = (option, direction) => {
|
|
1832
|
+
const result = props.onCommit(option.value, direction, option);
|
|
1820
1833
|
if (result && result.status === "rejected") {
|
|
1821
1834
|
setError(result.message);
|
|
1822
1835
|
}
|
|
@@ -1827,7 +1840,7 @@ function SelectCellEditor(props) {
|
|
|
1827
1840
|
props.onCancel();
|
|
1828
1841
|
return;
|
|
1829
1842
|
}
|
|
1830
|
-
commitValue(option
|
|
1843
|
+
commitValue(option, direction);
|
|
1831
1844
|
};
|
|
1832
1845
|
const handleKeyDown = (event) => {
|
|
1833
1846
|
if (isImeComposingKeyEvent(event)) {
|
|
@@ -1918,7 +1931,8 @@ function SelectCellEditor(props) {
|
|
|
1918
1931
|
left: px(placement2()?.left ?? 0),
|
|
1919
1932
|
top: px(placement2()?.top ?? 0),
|
|
1920
1933
|
width: px(placement2()?.width ?? 0),
|
|
1921
|
-
"max-height": px(placement2()?.maxHeight ?? 0)
|
|
1934
|
+
"max-height": px(placement2()?.maxHeight ?? 0),
|
|
1935
|
+
visibility: placement2()?.hidden ? "hidden" : void 0
|
|
1922
1936
|
}}
|
|
1923
1937
|
onPointerDown={(event) => event.preventDefault()}
|
|
1924
1938
|
>
|
|
@@ -1939,8 +1953,13 @@ function SelectCellEditor(props) {
|
|
|
1939
1953
|
"ssg-select-editor-option",
|
|
1940
1954
|
{ "ssg-select-editor-option--highlighted": index === highlight() }
|
|
1941
1955
|
]}
|
|
1942
|
-
onClick={() => commitValue(option()
|
|
1943
|
-
onPointerEnter={() =>
|
|
1956
|
+
onClick={() => commitValue(option())}
|
|
1957
|
+
onPointerEnter={(event) => revealOverflowTitle(event.currentTarget)}
|
|
1958
|
+
onPointerMove={(event) => {
|
|
1959
|
+
if (pointerMoved(event)) {
|
|
1960
|
+
updateHighlight(index);
|
|
1961
|
+
}
|
|
1962
|
+
}}
|
|
1944
1963
|
>
|
|
1945
1964
|
{option().label}
|
|
1946
1965
|
</div>}
|
|
@@ -2174,7 +2193,7 @@ function CellEditorLayer(props) {
|
|
|
2174
2193
|
get alignTop() {
|
|
2175
2194
|
return props.alignTop;
|
|
2176
2195
|
},
|
|
2177
|
-
onCommit: (value, direction) => props.onCommit(value, direction),
|
|
2196
|
+
onCommit: (value, direction, option, forwardText) => props.onCommit(value, direction, option, forwardText),
|
|
2178
2197
|
onCancel: () => props.onCancel(),
|
|
2179
2198
|
onRegisterFlush: (flush) => props.onRegisterFlush?.(flush)
|
|
2180
2199
|
};
|
|
@@ -2206,6 +2225,25 @@ function CellEditorLayer(props) {
|
|
|
2206
2225
|
}
|
|
2207
2226
|
case "select": {
|
|
2208
2227
|
const session = untrack11(() => props.session);
|
|
2228
|
+
const current = untrack11(editor);
|
|
2229
|
+
const SearchSelectEditor = props.SearchSelectEditor;
|
|
2230
|
+
const initialText = session ? resolveTypedStartText(initialValue, session.value) : void 0;
|
|
2231
|
+
if (SearchSelectEditor && current?.type === "select" && isSearchSelectEditor(current)) {
|
|
2232
|
+
const loadOptions = current.loadOptions;
|
|
2233
|
+
return <SearchSelectEditor
|
|
2234
|
+
{...common}
|
|
2235
|
+
popoverSlot={props.slots.popover}
|
|
2236
|
+
themeClassName={props.themeClassName}
|
|
2237
|
+
options={selectOptions()}
|
|
2238
|
+
value={session?.value}
|
|
2239
|
+
displayText={session ? session.column.valueFormatter?.({ value: session.value, row: session.row, column: session.column }) : void 0}
|
|
2240
|
+
allowFreeText={current.allowFreeText === true}
|
|
2241
|
+
load={loadOptions && session ? (query, signal) => loadOptions({ query, row: session.row, rowKey: session.rowKey, column: session.column, signal }) : void 0}
|
|
2242
|
+
initialText={initialText}
|
|
2243
|
+
cellTop={props.rect?.top ?? 0}
|
|
2244
|
+
cellLeft={props.rect?.left ?? 0}
|
|
2245
|
+
/>;
|
|
2246
|
+
}
|
|
2209
2247
|
return <SelectCellEditor
|
|
2210
2248
|
{...common}
|
|
2211
2249
|
popoverSlot={props.slots.popover}
|
|
@@ -2214,7 +2252,7 @@ function CellEditorLayer(props) {
|
|
|
2214
2252
|
value={props.session?.value}
|
|
2215
2253
|
cellTop={props.rect?.top ?? 0}
|
|
2216
2254
|
cellLeft={props.rect?.left ?? 0}
|
|
2217
|
-
initialText={
|
|
2255
|
+
initialText={initialText}
|
|
2218
2256
|
/>;
|
|
2219
2257
|
}
|
|
2220
2258
|
case "custom": {
|
|
@@ -2417,6 +2455,7 @@ function DefaultGridBottomBar(props) {
|
|
|
2417
2455
|
// src/devWarnings.ts
|
|
2418
2456
|
import { createEffect as createEffect3, createMemo as createMemo9 } from "solid-js";
|
|
2419
2457
|
import { AUTO_HEIGHT_MAX_ROWS } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
|
|
2458
|
+
import { isSearchSelectEditor as isSearchSelectEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
2420
2459
|
import { createInertExportCommands } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/features";
|
|
2421
2460
|
import {
|
|
2422
2461
|
warnUnregisteredFeatureMethod,
|
|
@@ -2436,6 +2475,14 @@ var FEATURE_PROPS = {
|
|
|
2436
2475
|
rowDrag: [{ prop: "enableRowDrag", isUsed: (props) => props.enableRowDrag === true }],
|
|
2437
2476
|
scrollHint: [{ prop: "scrollHint", isUsed: (props) => props.scrollHint !== void 0 && props.scrollHint !== false }],
|
|
2438
2477
|
imeDirectInput: [{ prop: "imeDirectInput", isUsed: (props) => props.imeDirectInput === true }],
|
|
2478
|
+
// 列の select エディタの search(loadOptions / allowFreeText は search の既定を true にする)。どれか 1 列でも検索できる選択
|
|
2479
|
+
// エディタなら警告する(React 版と同じ)。
|
|
2480
|
+
selectSearch: [
|
|
2481
|
+
{
|
|
2482
|
+
prop: "columns[].editor.search / loadOptions / allowFreeText",
|
|
2483
|
+
isUsed: (props) => props.columns.some((column) => isSearchSelectEditor2(column.editor))
|
|
2484
|
+
}
|
|
2485
|
+
],
|
|
2439
2486
|
totalRow: [{ prop: "totalRow", isUsed: (props) => props.totalRow !== void 0 && props.totalRow !== false }],
|
|
2440
2487
|
pinnedRows: [
|
|
2441
2488
|
{ prop: "pinnedTopRows", isUsed: (props) => (props.pinnedTopRows?.length ?? 0) > 0 },
|
|
@@ -4183,7 +4230,9 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
4183
4230
|
localeTexts: localeTexts(),
|
|
4184
4231
|
followsRow: activeRowFollowEnabled(),
|
|
4185
4232
|
getUiState: store.getState,
|
|
4186
|
-
rowKeyGetter: resolvedRowKeyGetter()
|
|
4233
|
+
rowKeyGetter: resolvedRowKeyGetter(),
|
|
4234
|
+
// 追加(1.7.0 / 検索できる選択エディタ): select の fillRow が書く項目の列(reject の検査に使う。隠した列も含む全部の列)。
|
|
4235
|
+
columns: columns()
|
|
4187
4236
|
}), "render", "edit");
|
|
4188
4237
|
connectController(cells, () => ({
|
|
4189
4238
|
rows: rows(),
|
|
@@ -5247,7 +5296,8 @@ function GridShellBody(props, features, mountGate, mode) {
|
|
|
5247
5296
|
session={editingSessionInfo()}
|
|
5248
5297
|
themeClassName={portalClassName()}
|
|
5249
5298
|
slots={slots()}
|
|
5250
|
-
onCommit={(value, direction) => edit.commitEdit(value, direction)}
|
|
5299
|
+
onCommit={(value, direction, option, forwardText) => edit.commitEdit(value, direction, option, forwardText)}
|
|
5300
|
+
SearchSelectEditor={features.selectSearch?.SearchSelectCellEditor}
|
|
5251
5301
|
onCancel={edit.cancelEdit}
|
|
5252
5302
|
onRegisterFlush={edit.registerDraftFlush}
|
|
5253
5303
|
onRegisterLateCommit={edit.registerLateCommitReceiver}
|
|
@@ -9240,11 +9290,319 @@ var scrollHintFeature = {
|
|
|
9240
9290
|
localeText: DEFAULT_SCROLL_HINT_LOCALE_TEXT
|
|
9241
9291
|
};
|
|
9242
9292
|
|
|
9293
|
+
// src/features/selectSearch.ts
|
|
9294
|
+
import { DEFAULT_SELECT_SEARCH_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9295
|
+
|
|
9296
|
+
// src/editors/SearchSelectCellEditor.tsx
|
|
9297
|
+
import { For as For15, Show as Show27, createEffect as createEffect11, createMemo as createMemo30, createRenderEffect as createRenderEffect7, createSignal as createSignal17, createUniqueId as createUniqueId6, onCleanup as onCleanup13, onSettled as onSettled9, untrack as untrack20 } from "solid-js";
|
|
9298
|
+
import { Portal as Portal5 } from "@solidjs/web";
|
|
9299
|
+
import {
|
|
9300
|
+
computeSelectPopoverPlacement as computeSelectPopoverPlacement2,
|
|
9301
|
+
resolveSelectOptionRowHeight as resolveSelectOptionRowHeight2,
|
|
9302
|
+
SELECT_SEARCH_POPOVER_MIN_WIDTH,
|
|
9303
|
+
createPointerMoveFilter as createPointerMoveFilter2
|
|
9304
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
|
|
9305
|
+
import { withAnchorVisibility as withAnchorVisibility2 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
|
|
9306
|
+
import { revealOverflowTitle as revealOverflowTitle2 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
|
|
9307
|
+
import {
|
|
9308
|
+
resolveSelectListWindow,
|
|
9309
|
+
revealSelectListRow,
|
|
9310
|
+
splitSelectSearchText
|
|
9311
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch";
|
|
9312
|
+
import {
|
|
9313
|
+
createSearchSelectEditorController
|
|
9314
|
+
} from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/searchSelectEditorController";
|
|
9315
|
+
import { isImeComposingKeyEvent as isImeComposingKeyEvent4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
9316
|
+
function MatchedText(props) {
|
|
9317
|
+
const parts = createMemo30(() => splitSelectSearchText(props.text, props.range));
|
|
9318
|
+
return <For15 each={parts()} keyed={false}>
|
|
9319
|
+
{(part) => <Show27 when={part().match} fallback={part().text}>
|
|
9320
|
+
<mark class="ssg-select-editor-match">{part().text}</mark>
|
|
9321
|
+
</Show27>}
|
|
9322
|
+
</For15>;
|
|
9323
|
+
}
|
|
9324
|
+
function SearchSelectCellEditor(props) {
|
|
9325
|
+
const texts = useFeatureLocaleText();
|
|
9326
|
+
const portal = useGridPortal();
|
|
9327
|
+
const [input, setInput] = createSignal17();
|
|
9328
|
+
const [scroller, setScroller] = createSignal17();
|
|
9329
|
+
const [popover, setPopover] = createSignal17();
|
|
9330
|
+
createTopAlignedInput(input, () => props.alignTop ?? false, () => props.cellHeight ?? 0);
|
|
9331
|
+
const listId = createUniqueId6();
|
|
9332
|
+
const pointerMoved = createPointerMoveFilter2();
|
|
9333
|
+
const [error, setError] = createSignal17(null);
|
|
9334
|
+
const commitWithResult = (committed, direction, option, forwardText) => {
|
|
9335
|
+
const result = props.onCommit(committed, direction, option, forwardText);
|
|
9336
|
+
if (result && result.status === "rejected") {
|
|
9337
|
+
setError(result.message);
|
|
9338
|
+
}
|
|
9339
|
+
return result;
|
|
9340
|
+
};
|
|
9341
|
+
const controller = untrack20(
|
|
9342
|
+
() => createSearchSelectEditorController({
|
|
9343
|
+
options: props.options,
|
|
9344
|
+
value: props.value,
|
|
9345
|
+
initialText: props.initialText,
|
|
9346
|
+
displayText: props.displayText,
|
|
9347
|
+
allowFreeText: props.allowFreeText,
|
|
9348
|
+
load: props.load ? (query, signal) => props.load(query, signal) : void 0,
|
|
9349
|
+
onCommit: commitWithResult,
|
|
9350
|
+
onCancel: () => props.onCancel()
|
|
9351
|
+
})
|
|
9352
|
+
);
|
|
9353
|
+
const [snapshot2, setSnapshot] = createSignal17(controller.getSnapshot(), { name: "searchSelectSnapshot" });
|
|
9354
|
+
createEffect11(
|
|
9355
|
+
() => props.options,
|
|
9356
|
+
outsideGraphApply((options) => controller.setOptions(options)),
|
|
9357
|
+
{ name: "searchSelectOptions" }
|
|
9358
|
+
);
|
|
9359
|
+
props.onRegisterFlush?.(untrack20(() => props.allowFreeText) ? controller.flush : null);
|
|
9360
|
+
const rowHeight = resolveSelectOptionRowHeight2();
|
|
9361
|
+
const [placement2, setPlacement] = createSignal17(null);
|
|
9362
|
+
const [scrollTop, setScrollTop] = createSignal17(0);
|
|
9363
|
+
const listRows = createMemo30(() => Math.max(snapshot2().results.length, 1));
|
|
9364
|
+
const viewportHeight = createMemo30(() => Math.min(listRows(), 8) * rowHeight);
|
|
9365
|
+
const measure = () => {
|
|
9366
|
+
const element = untrack20(input);
|
|
9367
|
+
if (!element) {
|
|
9368
|
+
return;
|
|
9369
|
+
}
|
|
9370
|
+
setPlacement(
|
|
9371
|
+
withAnchorVisibility2(
|
|
9372
|
+
element,
|
|
9373
|
+
computeSelectPopoverPlacement2(
|
|
9374
|
+
element.getBoundingClientRect(),
|
|
9375
|
+
untrack20(listRows),
|
|
9376
|
+
window.innerWidth,
|
|
9377
|
+
window.innerHeight,
|
|
9378
|
+
rowHeight,
|
|
9379
|
+
SELECT_SEARCH_POPOVER_MIN_WIDTH
|
|
9380
|
+
)
|
|
9381
|
+
)
|
|
9382
|
+
);
|
|
9383
|
+
};
|
|
9384
|
+
const reveal = (element, height) => {
|
|
9385
|
+
if (!element) {
|
|
9386
|
+
return;
|
|
9387
|
+
}
|
|
9388
|
+
const current = controller.getSnapshot().highlight;
|
|
9389
|
+
const next = current < 0 ? 0 : revealSelectListRow(current, element.scrollTop, height, rowHeight);
|
|
9390
|
+
if (next !== element.scrollTop) {
|
|
9391
|
+
element.scrollTop = next;
|
|
9392
|
+
}
|
|
9393
|
+
setScrollTop(next);
|
|
9394
|
+
};
|
|
9395
|
+
let disposed = false;
|
|
9396
|
+
onSettled9(() => {
|
|
9397
|
+
const element = untrack20(input);
|
|
9398
|
+
if (element) {
|
|
9399
|
+
element.focus();
|
|
9400
|
+
if (untrack20(() => props.initialText) === void 0) {
|
|
9401
|
+
element.select();
|
|
9402
|
+
} else {
|
|
9403
|
+
element.setSelectionRange(element.value.length, element.value.length);
|
|
9404
|
+
}
|
|
9405
|
+
}
|
|
9406
|
+
setSnapshot(controller.getSnapshot());
|
|
9407
|
+
const unsubscribe = controller.subscribe(() => setSnapshot(controller.getSnapshot()));
|
|
9408
|
+
const detach = controller.attach();
|
|
9409
|
+
measure();
|
|
9410
|
+
window.addEventListener("resize", measure);
|
|
9411
|
+
window.addEventListener("scroll", measure, true);
|
|
9412
|
+
return () => {
|
|
9413
|
+
window.removeEventListener("resize", measure);
|
|
9414
|
+
window.removeEventListener("scroll", measure, true);
|
|
9415
|
+
detach();
|
|
9416
|
+
unsubscribe();
|
|
9417
|
+
};
|
|
9418
|
+
});
|
|
9419
|
+
onCleanup13(() => {
|
|
9420
|
+
disposed = true;
|
|
9421
|
+
});
|
|
9422
|
+
let measuredKey;
|
|
9423
|
+
createEffect11(
|
|
9424
|
+
() => `${listRows()}:${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
|
|
9425
|
+
outsideGraphApply((key) => {
|
|
9426
|
+
const previous = measuredKey;
|
|
9427
|
+
measuredKey = key;
|
|
9428
|
+
if (previous !== void 0 && previous !== key) {
|
|
9429
|
+
measure();
|
|
9430
|
+
}
|
|
9431
|
+
}),
|
|
9432
|
+
{ name: "searchSelectMeasure" }
|
|
9433
|
+
);
|
|
9434
|
+
createEffect11(
|
|
9435
|
+
() => [snapshot2().results, scroller(), viewportHeight()],
|
|
9436
|
+
outsideGraphApply(([, element, height]) => reveal(element, height)),
|
|
9437
|
+
{ name: "searchSelectReveal" }
|
|
9438
|
+
);
|
|
9439
|
+
const handleKeyDown = (event) => {
|
|
9440
|
+
if (isImeComposingKeyEvent4(event)) {
|
|
9441
|
+
return;
|
|
9442
|
+
}
|
|
9443
|
+
const before = controller.getSnapshot().highlight;
|
|
9444
|
+
if (controller.keyDown(toEditorKeyEvent(event), props.enterMove) && controller.getSnapshot().highlight !== before) {
|
|
9445
|
+
setError(null);
|
|
9446
|
+
reveal(untrack20(scroller), untrack20(viewportHeight));
|
|
9447
|
+
}
|
|
9448
|
+
};
|
|
9449
|
+
const results = () => snapshot2().results;
|
|
9450
|
+
const status = () => snapshot2().status;
|
|
9451
|
+
const visible = createMemo30(() => {
|
|
9452
|
+
const list = results();
|
|
9453
|
+
const window_ = resolveSelectListWindow(scrollTop(), viewportHeight(), rowHeight, list.length);
|
|
9454
|
+
return list.slice(window_.start, window_.end).map((result, offset) => ({ result, index: window_.start + offset }));
|
|
9455
|
+
});
|
|
9456
|
+
const listShown = () => placement2() !== null && results().length > 0;
|
|
9457
|
+
const activeId = () => {
|
|
9458
|
+
const { highlight } = snapshot2();
|
|
9459
|
+
return listShown() && highlight >= 0 && results()[highlight] ? `${listId}-${highlight}` : void 0;
|
|
9460
|
+
};
|
|
9461
|
+
const freeTextOnly = () => props.allowFreeText === true && status() === "ready" && snapshot2().filtered && results().length === 0;
|
|
9462
|
+
const mount = () => placement2() !== null && !freeTextOnly() ? portal.container() : null;
|
|
9463
|
+
const initialText = untrack20(() => snapshot2().text);
|
|
9464
|
+
const view = <>
|
|
9465
|
+
<input
|
|
9466
|
+
ref={setInput}
|
|
9467
|
+
type="text"
|
|
9468
|
+
value={initialText}
|
|
9469
|
+
onInput={(event) => {
|
|
9470
|
+
setError(null);
|
|
9471
|
+
controller.input(event.currentTarget.value, event.isComposing);
|
|
9472
|
+
}}
|
|
9473
|
+
onCompositionEnd={(event) => controller.input(event.currentTarget.value, false)}
|
|
9474
|
+
onKeyDown={handleKeyDown}
|
|
9475
|
+
onBlur={() => {
|
|
9476
|
+
if (!disposed) {
|
|
9477
|
+
controller.blur();
|
|
9478
|
+
}
|
|
9479
|
+
}}
|
|
9480
|
+
role="combobox"
|
|
9481
|
+
aria-autocomplete="list"
|
|
9482
|
+
aria-label={props.ariaLabel}
|
|
9483
|
+
aria-expanded={listShown() ? "true" : "false"}
|
|
9484
|
+
aria-controls={listShown() ? listId : void 0}
|
|
9485
|
+
aria-activedescendant={activeId()}
|
|
9486
|
+
aria-invalid={error() !== null ? "true" : void 0}
|
|
9487
|
+
autocomplete="off"
|
|
9488
|
+
spellcheck="false"
|
|
9489
|
+
class={[
|
|
9490
|
+
"ssg-cell-editor-input",
|
|
9491
|
+
"ssg-cell-editor-input--search",
|
|
9492
|
+
{ "ssg-cell-editor-input--invalid": error() !== null }
|
|
9493
|
+
]}
|
|
9494
|
+
style={props.align ? { "text-align": props.align } : void 0}
|
|
9495
|
+
/>
|
|
9496
|
+
<CellEditorError message={error()} />
|
|
9497
|
+
<Show27 when={mount()}>
|
|
9498
|
+
{(container) => <Portal5 mount={container()}>
|
|
9499
|
+
<div
|
|
9500
|
+
ref={setPopover}
|
|
9501
|
+
class={[
|
|
9502
|
+
"ssg-select-editor-popover",
|
|
9503
|
+
"ssg-select-editor-popover--search",
|
|
9504
|
+
{ "ssg-select-editor-popover--loading": status() === "loading" && results().length > 0 },
|
|
9505
|
+
props.themeClassName,
|
|
9506
|
+
props.popoverSlot?.className
|
|
9507
|
+
]}
|
|
9508
|
+
style={{
|
|
9509
|
+
...props.popoverSlot?.style,
|
|
9510
|
+
left: px(placement2()?.left ?? 0),
|
|
9511
|
+
top: px(placement2()?.top ?? 0),
|
|
9512
|
+
width: px(placement2()?.width ?? 0),
|
|
9513
|
+
"max-height": px(placement2()?.maxHeight ?? 0),
|
|
9514
|
+
visibility: placement2()?.hidden ? "hidden" : void 0
|
|
9515
|
+
}}
|
|
9516
|
+
onPointerDown={(event) => event.preventDefault()}
|
|
9517
|
+
>
|
|
9518
|
+
<Show27 when={status() === "error"}>
|
|
9519
|
+
<div class="ssg-select-editor-empty ssg-select-editor-error" role="alert">
|
|
9520
|
+
<span class="ssg-select-editor-error-text" title={snapshot2().errorMessage ?? void 0}>
|
|
9521
|
+
{texts().selectSearchFailed}
|
|
9522
|
+
</span>
|
|
9523
|
+
<button type="button" class="ssg-select-editor-retry" tabindex={-1} onClick={() => controller.retry()}>
|
|
9524
|
+
{texts().retry}
|
|
9525
|
+
</button>
|
|
9526
|
+
</div>
|
|
9527
|
+
</Show27>
|
|
9528
|
+
<Show27 when={status() !== "error" && results().length === 0}>
|
|
9529
|
+
<div class="ssg-select-editor-empty" role="status">
|
|
9530
|
+
{status() === "loading" ? texts().selectSearchLoading : snapshot2().filtered ? texts().selectSearchNoMatch : texts().noOptions}
|
|
9531
|
+
</div>
|
|
9532
|
+
</Show27>
|
|
9533
|
+
<Show27 when={results().length > 0}>
|
|
9534
|
+
<div
|
|
9535
|
+
ref={setScroller}
|
|
9536
|
+
role="listbox"
|
|
9537
|
+
id={listId}
|
|
9538
|
+
aria-label={props.ariaLabel}
|
|
9539
|
+
aria-busy={status() === "loading" ? "true" : void 0}
|
|
9540
|
+
class="ssg-select-editor-scroller"
|
|
9541
|
+
style={{ height: px(viewportHeight()) }}
|
|
9542
|
+
onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}
|
|
9543
|
+
>
|
|
9544
|
+
<div class="ssg-select-editor-rows" role="presentation" style={{ height: px(results().length * rowHeight) }}>
|
|
9545
|
+
<For15 each={visible()} keyed={false}>
|
|
9546
|
+
{(item) => <div
|
|
9547
|
+
id={`${listId}-${item().index}`}
|
|
9548
|
+
role="option"
|
|
9549
|
+
aria-selected={item().index === snapshot2().highlight ? "true" : "false"}
|
|
9550
|
+
aria-setsize={results().length}
|
|
9551
|
+
aria-posinset={item().index + 1}
|
|
9552
|
+
class={[
|
|
9553
|
+
"ssg-select-editor-option",
|
|
9554
|
+
{ "ssg-select-editor-option--highlighted": item().index === snapshot2().highlight }
|
|
9555
|
+
]}
|
|
9556
|
+
style={{ top: px(item().index * rowHeight) }}
|
|
9557
|
+
onClick={() => controller.choose(untrack20(item).index)}
|
|
9558
|
+
onPointerEnter={(event) => revealOverflowTitle2(event.currentTarget)}
|
|
9559
|
+
onPointerMove={(event) => {
|
|
9560
|
+
if (pointerMoved(event)) {
|
|
9561
|
+
controller.hover(untrack20(item).index);
|
|
9562
|
+
}
|
|
9563
|
+
}}
|
|
9564
|
+
>
|
|
9565
|
+
<span class="ssg-select-editor-option-label">
|
|
9566
|
+
<MatchedText text={item().result.option.label} range={item().result.labelMatch} />
|
|
9567
|
+
</span>
|
|
9568
|
+
<Show27 when={item().result.option.description}>
|
|
9569
|
+
{(description) => <span class="ssg-select-editor-option-description">
|
|
9570
|
+
<MatchedText text={description()} range={item().result.descriptionMatch} />
|
|
9571
|
+
</span>}
|
|
9572
|
+
</Show27>
|
|
9573
|
+
</div>}
|
|
9574
|
+
</For15>
|
|
9575
|
+
</div>
|
|
9576
|
+
</div>
|
|
9577
|
+
</Show27>
|
|
9578
|
+
</div>
|
|
9579
|
+
</Portal5>}
|
|
9580
|
+
</Show27>
|
|
9581
|
+
</>;
|
|
9582
|
+
createPortalTokens(popover, () => props.themeClassName, placement2);
|
|
9583
|
+
createRenderEffect7(
|
|
9584
|
+
() => [input(), snapshot2().text],
|
|
9585
|
+
([element, text]) => {
|
|
9586
|
+
if (element && element.value !== text) {
|
|
9587
|
+
element.value = text;
|
|
9588
|
+
}
|
|
9589
|
+
},
|
|
9590
|
+
{ name: "searchSelectInputText" }
|
|
9591
|
+
);
|
|
9592
|
+
return view;
|
|
9593
|
+
}
|
|
9594
|
+
|
|
9595
|
+
// src/features/selectSearch.ts
|
|
9596
|
+
var selectSearchFeature = {
|
|
9597
|
+
SearchSelectCellEditor,
|
|
9598
|
+
localeText: DEFAULT_SELECT_SEARCH_LOCALE_TEXT
|
|
9599
|
+
};
|
|
9600
|
+
|
|
9243
9601
|
// src/features/selectionAggregates.ts
|
|
9244
9602
|
import { DEFAULT_AGGREGATES_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
|
|
9245
9603
|
|
|
9246
9604
|
// src/primitives/selectionAggregates.ts
|
|
9247
|
-
import { createMemo as
|
|
9605
|
+
import { createMemo as createMemo31 } from "solid-js";
|
|
9248
9606
|
import {
|
|
9249
9607
|
createSelectionAggregatesRunner,
|
|
9250
9608
|
resolveSyncSelectionAggregates,
|
|
@@ -9256,15 +9614,15 @@ import {
|
|
|
9256
9614
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
|
|
9257
9615
|
function createSelectionAggregates(args) {
|
|
9258
9616
|
const stabilizeTarget = createSelectionAggregateTargetStabilizer();
|
|
9259
|
-
const target =
|
|
9617
|
+
const target = createMemo31(() => {
|
|
9260
9618
|
const current = args();
|
|
9261
9619
|
return stabilizeTarget(
|
|
9262
9620
|
current.enabled ? resolveSelectionAggregateTarget(current.selection, current.viewRowCount, current.orderedColumns) : null
|
|
9263
9621
|
);
|
|
9264
9622
|
});
|
|
9265
|
-
const rowModel =
|
|
9266
|
-
const key =
|
|
9267
|
-
const syncResult =
|
|
9623
|
+
const rowModel = createMemo31(() => args().rowModel);
|
|
9624
|
+
const key = createMemo31(() => ({ rowModel: rowModel(), target: target() }));
|
|
9625
|
+
const syncResult = createMemo31(() => resolveSyncSelectionAggregates(key()));
|
|
9268
9626
|
const runner = createSelectionAggregatesRunner();
|
|
9269
9627
|
connectController(
|
|
9270
9628
|
runner,
|
|
@@ -9273,16 +9631,16 @@ function createSelectionAggregates(args) {
|
|
|
9273
9631
|
"selectionAggregates"
|
|
9274
9632
|
);
|
|
9275
9633
|
const snapshot2 = createExternalStoreSignal(runner, "selectionAggregatesStore");
|
|
9276
|
-
return
|
|
9634
|
+
return createMemo31(() => selectSelectionAggregatesResult(syncResult(), snapshot2(), key()));
|
|
9277
9635
|
}
|
|
9278
9636
|
|
|
9279
9637
|
// src/view/GridSelectionAggregates.tsx
|
|
9280
|
-
import { For as
|
|
9638
|
+
import { For as For16, Show as Show28, createMemo as createMemo32 } from "solid-js";
|
|
9281
9639
|
import { formatSelectionAggregateNumber } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
|
|
9282
9640
|
import { formatLocaleText as formatLocaleText16 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
9283
9641
|
function GridSelectionAggregates(props) {
|
|
9284
9642
|
const texts = useFeatureLocaleText();
|
|
9285
|
-
const chips =
|
|
9643
|
+
const chips = createMemo32(() => {
|
|
9286
9644
|
const aggregates = props.aggregates;
|
|
9287
9645
|
if (!aggregates) {
|
|
9288
9646
|
return null;
|
|
@@ -9315,12 +9673,12 @@ function GridSelectionAggregates(props) {
|
|
|
9315
9673
|
}
|
|
9316
9674
|
return list;
|
|
9317
9675
|
});
|
|
9318
|
-
return <
|
|
9676
|
+
return <Show28 when={chips()}>
|
|
9319
9677
|
{(list) => <div class={["ssg-bar-aggregates", { "ssg-bar-aggregates--trailing": props.trailing }]}>
|
|
9320
9678
|
<div class="ssg-bar-aggregates-inner" title={list().map((chip) => chip.text).join(" ")}>
|
|
9321
9679
|
<div class="ssg-bar-aggregates-list">
|
|
9322
9680
|
<span class="ssg-bar-aggregates-fit" aria-hidden="true" />
|
|
9323
|
-
<
|
|
9681
|
+
<For16 each={list()} keyed={(chip) => chip.key}>
|
|
9324
9682
|
{(chip, index) => <span
|
|
9325
9683
|
class={[
|
|
9326
9684
|
"ssg-bar-chip",
|
|
@@ -9331,16 +9689,16 @@ function GridSelectionAggregates(props) {
|
|
|
9331
9689
|
]}
|
|
9332
9690
|
style={{ order: String(-index()) }}
|
|
9333
9691
|
>
|
|
9334
|
-
<
|
|
9692
|
+
<Show28 when={chip().label !== void 0} fallback={chip().text}>
|
|
9335
9693
|
{chip().label}
|
|
9336
9694
|
<b class="ssg-bar-aggregate-value">{chip().value}</b>
|
|
9337
|
-
</
|
|
9695
|
+
</Show28>
|
|
9338
9696
|
</span>}
|
|
9339
|
-
</
|
|
9697
|
+
</For16>
|
|
9340
9698
|
</div>
|
|
9341
9699
|
</div>
|
|
9342
9700
|
</div>}
|
|
9343
|
-
</
|
|
9701
|
+
</Show28>;
|
|
9344
9702
|
}
|
|
9345
9703
|
|
|
9346
9704
|
// src/features/selectionAggregates.ts
|
|
@@ -9351,7 +9709,7 @@ var selectionAggregatesFeature = {
|
|
|
9351
9709
|
};
|
|
9352
9710
|
|
|
9353
9711
|
// src/primitives/toolPanel.ts
|
|
9354
|
-
import { createMemo as
|
|
9712
|
+
import { createMemo as createMemo33 } from "solid-js";
|
|
9355
9713
|
import {
|
|
9356
9714
|
createToolPanelController,
|
|
9357
9715
|
resolveActiveToolPanelTab,
|
|
@@ -9370,7 +9728,7 @@ function createToolPanel(inputs) {
|
|
|
9370
9728
|
onSuppressedEscape: inputs.onSuppressedEscape
|
|
9371
9729
|
}), "render", "toolPanel");
|
|
9372
9730
|
const snapshot2 = createExternalStoreSignal(controller, "toolPanelStore");
|
|
9373
|
-
const availableTabs =
|
|
9731
|
+
const availableTabs = createMemo33(
|
|
9374
9732
|
() => resolveAvailableToolPanelTabs({
|
|
9375
9733
|
canUseFilterTab: inputs.canUseFilterTab(),
|
|
9376
9734
|
canUseColumnsTab: inputs.canUseColumnsTab(),
|
|
@@ -9379,10 +9737,10 @@ function createToolPanel(inputs) {
|
|
|
9379
9737
|
{ equals: sameTabs }
|
|
9380
9738
|
);
|
|
9381
9739
|
return {
|
|
9382
|
-
activeTab:
|
|
9740
|
+
activeTab: createMemo33(() => resolveActiveToolPanelTab(snapshot2().requestedTab, availableTabs())),
|
|
9383
9741
|
availableTabs,
|
|
9384
|
-
layout:
|
|
9385
|
-
flashTick:
|
|
9742
|
+
layout: createMemo33(() => snapshot2().layout),
|
|
9743
|
+
flashTick: createMemo33(() => snapshot2().flashTick),
|
|
9386
9744
|
panelRef: controller.panelRef,
|
|
9387
9745
|
open: controller.open,
|
|
9388
9746
|
close: controller.close,
|
|
@@ -9406,7 +9764,7 @@ import {
|
|
|
9406
9764
|
} from "@ishibashi0112/spreadsheet-grid-core/internal/logic/totalRow";
|
|
9407
9765
|
|
|
9408
9766
|
// src/view/GridTotalRow.tsx
|
|
9409
|
-
import { For as
|
|
9767
|
+
import { For as For17, Show as Show29, createMemo as createMemo34 } from "solid-js";
|
|
9410
9768
|
import {
|
|
9411
9769
|
formatTotalRowCellText as formatTotalRowCellText2,
|
|
9412
9770
|
resolveTotalRowCaption as resolveTotalRowCaption2
|
|
@@ -9433,7 +9791,7 @@ function GridTotalRow(props) {
|
|
|
9433
9791
|
...props.stickyBottom > 0 ? { bottom: px(props.stickyBottom) } : null
|
|
9434
9792
|
}}
|
|
9435
9793
|
>
|
|
9436
|
-
<
|
|
9794
|
+
<Show29 when={props.ownsRowHeader}>
|
|
9437
9795
|
<div
|
|
9438
9796
|
role={rowHeaderIsCell() ? "rowheader" : void 0}
|
|
9439
9797
|
aria-colindex={rowHeaderIsCell() ? 1 : void 0}
|
|
@@ -9448,13 +9806,13 @@ function GridTotalRow(props) {
|
|
|
9448
9806
|
>
|
|
9449
9807
|
{rowHeaderText() === "" ? null : rowHeaderText()}
|
|
9450
9808
|
</div>
|
|
9451
|
-
</
|
|
9452
|
-
<
|
|
9809
|
+
</Show29>
|
|
9810
|
+
<For17 each={props.entries} keyed={(entry) => entry.column.key}>
|
|
9453
9811
|
{(entry) => {
|
|
9454
|
-
const unbound =
|
|
9812
|
+
const unbound = createMemo34(() => entry().column);
|
|
9455
9813
|
const cell = () => props.cells.get(unbound().key);
|
|
9456
9814
|
const isLabelCell = () => unbound().key === props.labelColumnKey;
|
|
9457
|
-
const content =
|
|
9815
|
+
const content = createMemo34(() => {
|
|
9458
9816
|
const total = cell();
|
|
9459
9817
|
if (total) {
|
|
9460
9818
|
const column = unbound();
|
|
@@ -9506,7 +9864,7 @@ function GridTotalRow(props) {
|
|
|
9506
9864
|
{content()}
|
|
9507
9865
|
</div>;
|
|
9508
9866
|
}}
|
|
9509
|
-
</
|
|
9867
|
+
</For17>
|
|
9510
9868
|
</div>
|
|
9511
9869
|
</>;
|
|
9512
9870
|
}
|
|
@@ -9533,6 +9891,7 @@ var fullGridFeatures = {
|
|
|
9533
9891
|
motionExtras: motionExtrasFeature,
|
|
9534
9892
|
find: findFeature,
|
|
9535
9893
|
imeDirectInput: imeDirectInputFeature,
|
|
9894
|
+
selectSearch: selectSearchFeature,
|
|
9536
9895
|
columnAutosize: columnAutosizeFeature,
|
|
9537
9896
|
columnReorder: columnReorderFeature,
|
|
9538
9897
|
rowDrag: rowDragFeature,
|
|
@@ -9590,6 +9949,7 @@ export {
|
|
|
9590
9949
|
restoreColumnsFromState,
|
|
9591
9950
|
rowDragFeature,
|
|
9592
9951
|
scrollHintFeature,
|
|
9952
|
+
selectSearchFeature,
|
|
9593
9953
|
selectionAggregatesFeature,
|
|
9594
9954
|
serverSideFeature,
|
|
9595
9955
|
standardFeatures,
|