@ishibashi0112/spreadsheet-grid-solid 1.6.0 → 1.8.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.
@@ -620,10 +620,11 @@ import { formatLocaleText as formatLocaleText2 } from "@ishibashi0112/spreadshee
620
620
 
621
621
  // src/primitives/memoWhen.ts
622
622
  import { createMemo as createMemo4, getOwner as getOwner2, isDisposed, runWithOwner as runWithOwner2, untrack as untrack2 } from "solid-js";
623
- function createMemoWhen(needed, compute, empty) {
623
+ function createMemoWhen(needed, compute, empty, equals) {
624
624
  const guarded = () => needed() ? compute() : empty;
625
+ const options = equals ? { equals } : void 0;
625
626
  if (untrack2(needed)) {
626
- return createMemo4(guarded);
627
+ return createMemo4(guarded, options);
627
628
  }
628
629
  const owner = getOwner2();
629
630
  let memo;
@@ -637,7 +638,7 @@ function createMemoWhen(needed, compute, empty) {
637
638
  if (!owner || isDisposed(owner)) {
638
639
  return compute();
639
640
  }
640
- memo = runWithOwner2(owner, () => createMemo4(guarded));
641
+ memo = runWithOwner2(owner, () => createMemo4(guarded, options));
641
642
  return memo();
642
643
  };
643
644
  }
@@ -727,6 +728,20 @@ var markReusedRow = (element) => {
727
728
  };
728
729
 
729
730
  // src/view/GridBodyLayer.tsx
731
+ var sameUnsavedTexts = (a, b) => {
732
+ if (a === b) {
733
+ return true;
734
+ }
735
+ if (!a || !b || a.size !== b.size) {
736
+ return false;
737
+ }
738
+ for (const [key, text] of a) {
739
+ if (b.get(key) !== text) {
740
+ return false;
741
+ }
742
+ }
743
+ return true;
744
+ };
730
745
  var NO_SELECTED_COLUMNS = [-1, -1];
731
746
  var EMPTY_SLOT = resolveSlotProps(void 0);
732
747
  var NO_VALUE = () => null;
@@ -782,6 +797,7 @@ function GridBodyLayer(props) {
782
797
  return { state: assignRowSlots(prev?.state, props.rows, slotKindOf, prev?.model === model), model };
783
798
  }
784
799
  );
800
+ const trackingOn = createMemo5(() => props.unsavedTracking !== void 0);
785
801
  return <For2 each={slotted().state.items} keyed={(item) => item.slot}>
786
802
  {(item) => {
787
803
  const rowIndex = createMemo5(() => item().index);
@@ -927,6 +943,30 @@ function GridBodyLayer(props) {
927
943
  )
928
944
  );
929
945
  const rowNumber = () => props.labelViewIndexes ? resolveDataRowNumber(props.labelViewIndexes, rowIndex()) : rowIndex() + 1;
946
+ const rowUnsavedTexts = createMemoWhen(
947
+ trackingOn,
948
+ () => {
949
+ const marks = props.unsavedTracking;
950
+ const saved = marks?.getUnsavedCells(rowKey());
951
+ if (!marks || !saved) {
952
+ return void 0;
953
+ }
954
+ const current = currentRow();
955
+ let texts2;
956
+ for (const [columnKey, savedValue] of saved) {
957
+ const trackedColumn = marks.trackedColumns.get(columnKey);
958
+ if (trackedColumn && !Object.is(getCellValue(current, trackedColumn), savedValue)) {
959
+ (texts2 ??= /* @__PURE__ */ new Map()).set(columnKey, marks.describeCell(trackedColumn, current, savedValue));
960
+ }
961
+ }
962
+ return texts2;
963
+ },
964
+ void 0,
965
+ sameUnsavedTexts
966
+ );
967
+ const rowUnsaved = () => rowUnsavedTexts() !== void 0;
968
+ const unsavedTextOf = (columnKey) => untrack3(trackingOn) ? () => rowUnsavedTexts()?.get(columnKey) ?? null : NO_VALUE;
969
+ const unsavedMarkOf = (unsavedText) => untrack3(trackingOn) ? () => unsavedText() !== null ? <span class="ssg-unsaved-mark" aria-hidden="true" /> : null : null;
930
970
  const textCellBase = createMemo5(() => {
931
971
  const slot = rowSlot();
932
972
  const bodyCell = cellEnv().bodyCellSlot;
@@ -956,14 +996,18 @@ function GridBodyLayer(props) {
956
996
  void 0
957
997
  );
958
998
  const cell = () => ({ row: rowIndex(), col: colIndex() });
999
+ const unsavedText = unsavedTextOf(untrack3(unbound).key);
1000
+ const unsavedMark = unsavedMarkOf(unsavedText);
959
1001
  return <div
960
1002
  role="gridcell"
961
1003
  aria-colindex={colIndex() + 2}
962
1004
  aria-selected={isSelected() ? "true" : "false"}
963
1005
  aria-readonly={readOnlyCell() ? "true" : void 0}
1006
+ aria-description={unsavedText() ?? void 0}
964
1007
  id={isActive() ? props.activeCellDomId : void 0}
965
1008
  aria-owns={editingCol() === colIndex() ? props.cellEditorDomId : void 0}
966
1009
  data-ssg-col-key={column().key}
1010
+ data-ssg-tooltip={unsavedText() ?? void 0}
967
1011
  data-ssg-tooltip-overflow={cellEnv().showCellOverflowTooltip ? "" : void 0}
968
1012
  class={joinClasses(
969
1013
  textCellBase().className,
@@ -971,6 +1015,7 @@ function GridBodyLayer(props) {
971
1015
  column().align === "right" && "ssg-body-cell--align-right",
972
1016
  alignTop() && "ssg-body-cell--valign-top",
973
1017
  readOnlyCell() && !isSelected() && "ssg-body-cell--readonly",
1018
+ unsavedText() !== null && "ssg-body-cell--unsaved",
974
1019
  isHovered() && "ssg-body-cell--row-hovered"
975
1020
  )}
976
1021
  onPointerDown={(event) => props.onCellPointerDown(cell(), event)}
@@ -992,65 +1037,11 @@ function GridBodyLayer(props) {
992
1037
  <span class="ssg-cell-value">
993
1038
  {props.cellText(currentRow(), column(), findRanges(), rowFindCurrent)}
994
1039
  </span>
1040
+ {unsavedMark}
995
1041
  </div>;
996
1042
  };
997
- return <div
998
- ref={(element) => {
999
- rowElement = element;
1000
- }}
1001
- data-pane={props.pane}
1002
- data-row-index={rowIndex()}
1003
- role="row"
1004
- aria-rowindex={rowIndex() + 2 + props.ariaRowOffset}
1005
- aria-selected={props.enableRowSelection ? isRowChecked() ? "true" : "false" : void 0}
1006
- data-row-key={String(rowKey())}
1007
- class={joinClasses(
1008
- "ssg-body-row",
1009
- rowSlot().className,
1010
- props.slots.bodyRow?.className,
1011
- isRowChecked() && "ssg-body-row--checked"
1012
- )}
1013
- style={{
1014
- ...props.slots.bodyRow?.style,
1015
- ...rowSlot().style,
1016
- height: px(rowSize()),
1017
- transform: `translateY(${item().start}px)`
1018
- }}
1019
- >
1020
- <Show2 when={props.ownsRowHeader}>
1021
- <div
1022
- role="rowheader"
1023
- aria-colindex={1}
1024
- onPointerDown={(event) => props.onRowHeaderPointerDown(rowIndex(), event)}
1025
- onPointerEnter={(event) => props.onRowHeaderPointerEnter(rowIndex(), event)}
1026
- onPointerLeave={() => props.onRowHeaderPointerLeave(rowIndex())}
1027
- class={joinClasses(
1028
- "ssg-header-cell ssg-row-header-cell",
1029
- rowSlot().className,
1030
- props.slots.rowHeaderCell?.className,
1031
- props.enableRowSelection && "ssg-row-header-cell--checkbox",
1032
- (props.isWholeGridSelected || isRowSelected()) && "ssg-header-cell--selected",
1033
- isHovered() && "ssg-header-cell--hovered"
1034
- )}
1035
- style={{
1036
- ...props.slots.rowHeaderCell?.style,
1037
- ...rowSlot().style,
1038
- width: px(props.rowHeaderWidth),
1039
- "min-width": px(props.rowHeaderWidth),
1040
- height: px(rowSize())
1041
- }}
1042
- >
1043
- <Show2 when={props.enableRowSelection} fallback={rowNumber()}>
1044
- <RowSelectionCheckbox
1045
- slot={props.slots.checkbox}
1046
- label={formatLocaleText2(texts().selectRow, { row: rowNumber() })}
1047
- state={isRowChecked() ? "checked" : "unchecked"}
1048
- />
1049
- </Show2>
1050
- </div>
1051
- </Show2>
1052
- <For2 each={props.entries} keyed={cellKey}>
1053
- {(entry) => {
1043
+ const cells = () => <For2 each={props.entries} keyed={cellKey}>
1044
+ {(entry) => {
1054
1045
  const shape = untrack3(() => cellShapeOf(entry().column));
1055
1046
  if (shape === "text") {
1056
1047
  return renderTextCell(entry);
@@ -1179,7 +1170,9 @@ function GridBodyLayer(props) {
1179
1170
  },
1180
1171
  null
1181
1172
  );
1182
- const tooltipText = () => resolveCellTooltipText(invalidMessage(), cellNote());
1173
+ const unsavedText = unsavedTextOf(untrack3(unbound).key);
1174
+ const unsavedMark = unsavedMarkOf(unsavedText);
1175
+ const tooltipText = () => resolveCellTooltipText(invalidMessage(), cellNote(), unsavedText());
1183
1176
  const autoHeightFlags = createMemoWhen(
1184
1177
  rowAutoHeight,
1185
1178
  () => {
@@ -1199,8 +1192,8 @@ function GridBodyLayer(props) {
1199
1192
  const cell = () => ({ row: rowIndex(), col: colIndex() });
1200
1193
  const keyedContent = untrack3(() => entry().column.renderCell !== void 0);
1201
1194
  const cellChildren = plain ? () => props.renderCellContent(currentRow, column(), cellState) : () => <>
1202
- <Show2 when={dataBar()}>
1203
- {(bar) => <span
1195
+ <Show2 when={dataBar()}>
1196
+ {(bar) => <span
1204
1197
  class={["ssg-cf-bar", { "ssg-cf-bar--negative": bar().negative }]}
1205
1198
  style={{
1206
1199
  left: `${bar().start}%`,
@@ -1209,16 +1202,16 @@ function GridBodyLayer(props) {
1209
1202
  }}
1210
1203
  aria-hidden="true"
1211
1204
  />}
1212
- </Show2>
1213
- <Show2
1205
+ </Show2>
1206
+ <Show2
1214
1207
  when={isAutoHeightCell()}
1215
1208
  fallback={props.renderCellContent(currentRow, column(), cellState)}
1216
1209
  >
1217
- <div class="ssg-autoheight-content" data-autoheight-content="">
1218
- {props.renderCellContent(currentRow, column(), cellState)}
1219
- </div>
1220
- </Show2>
1221
- </>;
1210
+ <div class="ssg-autoheight-content" data-autoheight-content="">
1211
+ {props.renderCellContent(currentRow, column(), cellState)}
1212
+ </div>
1213
+ </Show2>
1214
+ </>;
1222
1215
  const cellContent = keyedContent ? () => {
1223
1216
  rowKey();
1224
1217
  return cellChildren();
@@ -1251,6 +1244,7 @@ function GridBodyLayer(props) {
1251
1244
  readOnlyCell() && !isSelected() && "ssg-body-cell--readonly",
1252
1245
  invalidMessage() !== null && "ssg-body-cell--invalid",
1253
1246
  cellNote() !== null && "ssg-body-cell--has-note",
1247
+ unsavedText() !== null && "ssg-body-cell--unsaved",
1254
1248
  isHovered() && "ssg-body-cell--row-hovered"
1255
1249
  )}
1256
1250
  onPointerDown={(event) => {
@@ -1277,10 +1271,72 @@ function GridBodyLayer(props) {
1277
1271
  "z-index": isActive() ? 3 : 1
1278
1272
  }}
1279
1273
  >
1280
- {cellContent()}
1281
- </div>;
1274
+ {cellContent()}
1275
+ {unsavedMark}
1276
+ </div>;
1282
1277
  }}
1283
- </For2>
1278
+ </For2>;
1279
+ return <div
1280
+ ref={(element) => {
1281
+ rowElement = element;
1282
+ }}
1283
+ data-pane={props.pane}
1284
+ data-row-index={rowIndex()}
1285
+ role="row"
1286
+ aria-rowindex={rowIndex() + 2 + props.ariaRowOffset}
1287
+ aria-selected={props.enableRowSelection ? isRowChecked() ? "true" : "false" : void 0}
1288
+ data-row-key={String(rowKey())}
1289
+ class={joinClasses(
1290
+ "ssg-body-row",
1291
+ rowSlot().className,
1292
+ props.slots.bodyRow?.className,
1293
+ isRowChecked() && "ssg-body-row--checked",
1294
+ rowUnsaved() && "ssg-body-row--unsaved"
1295
+ )}
1296
+ style={{
1297
+ ...props.slots.bodyRow?.style,
1298
+ ...rowSlot().style,
1299
+ height: px(rowSize()),
1300
+ transform: `translateY(${item().start}px)`
1301
+ }}
1302
+ >
1303
+ <Show2 when={props.ownsRowHeader}>
1304
+ <div
1305
+ role="rowheader"
1306
+ aria-colindex={1}
1307
+ aria-description={rowUnsaved() ? props.unsavedTracking?.rowDescription : void 0}
1308
+ onPointerDown={(event) => props.onRowHeaderPointerDown(rowIndex(), event)}
1309
+ onPointerEnter={(event) => props.onRowHeaderPointerEnter(rowIndex(), event)}
1310
+ onPointerLeave={() => props.onRowHeaderPointerLeave(rowIndex())}
1311
+ class={joinClasses(
1312
+ "ssg-header-cell ssg-row-header-cell",
1313
+ rowSlot().className,
1314
+ props.slots.rowHeaderCell?.className,
1315
+ props.enableRowSelection && "ssg-row-header-cell--checkbox",
1316
+ rowUnsaved() && "ssg-row-header-cell--unsaved",
1317
+ (props.isWholeGridSelected || isRowSelected()) && "ssg-header-cell--selected",
1318
+ isHovered() && "ssg-header-cell--hovered"
1319
+ )}
1320
+ style={{
1321
+ ...props.slots.rowHeaderCell?.style,
1322
+ ...rowSlot().style,
1323
+ width: px(props.rowHeaderWidth),
1324
+ "min-width": px(props.rowHeaderWidth),
1325
+ height: px(rowSize())
1326
+ }}
1327
+ >
1328
+ <Show2 when={props.enableRowSelection} fallback={rowNumber()}>
1329
+ <RowSelectionCheckbox
1330
+ slot={props.slots.checkbox}
1331
+ label={formatLocaleText2(texts().selectRow, { row: rowNumber() })}
1332
+ state={isRowChecked() ? "checked" : "unchecked"}
1333
+ />
1334
+ </Show2>
1335
+ </div>
1336
+ </Show2>
1337
+ <Show2 when={trackingOn()} fallback={cells()}>
1338
+ {cells()}
1339
+ </Show2>
1284
1340
  </div>;
1285
1341
  }}
1286
1342
  </Show2>
@@ -1445,6 +1501,7 @@ import { Show as Show8, createMemo as createMemo7, untrack as untrack11 } from "
1445
1501
  import { toDateInputValue } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorValues";
1446
1502
  import { resolveTypedStartText } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/editorStart";
1447
1503
  import { formatLocaleText as formatLocaleText4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
1504
+ import { isSearchSelectEditor } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
1448
1505
 
1449
1506
  // src/editors/TextCellEditor.tsx
1450
1507
  import { Show as Show6, createRenderEffect as createRenderEffect3, createSignal as createSignal4, onCleanup as onCleanup3, onSettled as onSettled3, untrack as untrack6 } from "solid-js";
@@ -1735,8 +1792,11 @@ import {
1735
1792
  handleSelectEditorKeyDown,
1736
1793
  resolveSelectEditorStart,
1737
1794
  resolveSelectOptionRowHeight,
1738
- typeaheadJump
1795
+ typeaheadJump,
1796
+ createPointerMoveFilter
1739
1797
  } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
1798
+ import { withAnchorVisibility } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
1799
+ import { revealOverflowTitle } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
1740
1800
  import { isImeComposingKeyEvent } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
1741
1801
  function SelectCellEditor(props) {
1742
1802
  const texts = useGridLocaleText();
@@ -1748,6 +1808,7 @@ function SelectCellEditor(props) {
1748
1808
  const start = untrack8(() => resolveSelectEditorStart(props.options, props.value, props.initialText, Date.now()));
1749
1809
  let typeahead = start.typeahead;
1750
1810
  const [highlight, setHighlight] = createSignal6(start.highlight);
1811
+ const pointerMoved = createPointerMoveFilter();
1751
1812
  let currentHighlight = start.highlight;
1752
1813
  const updateHighlight = (next) => {
1753
1814
  currentHighlight = typeof next === "function" ? next(currentHighlight) : next;
@@ -1768,12 +1829,15 @@ function SelectCellEditor(props) {
1768
1829
  return;
1769
1830
  }
1770
1831
  setPlacement(
1771
- computeSelectPopoverPlacement(
1772
- element.getBoundingClientRect(),
1773
- untrack8(() => props.options.length),
1774
- window.innerWidth,
1775
- window.innerHeight,
1776
- optionRowHeight
1832
+ withAnchorVisibility(
1833
+ element,
1834
+ computeSelectPopoverPlacement(
1835
+ element.getBoundingClientRect(),
1836
+ untrack8(() => props.options.length),
1837
+ window.innerWidth,
1838
+ window.innerHeight,
1839
+ optionRowHeight
1840
+ )
1777
1841
  )
1778
1842
  );
1779
1843
  };
@@ -1787,23 +1851,28 @@ function SelectCellEditor(props) {
1787
1851
  window.removeEventListener("scroll", measure, true);
1788
1852
  };
1789
1853
  });
1854
+ let refocusSeen = false;
1790
1855
  createEffect2(
1791
1856
  () => props.options.length,
1792
- (_length, previous) => {
1793
- if (previous !== void 0) {
1857
+ outsideGraphApply(() => {
1858
+ if (refocusSeen) {
1794
1859
  untrack8(input)?.focus();
1795
1860
  measure();
1796
1861
  }
1797
- },
1862
+ refocusSeen = true;
1863
+ }),
1798
1864
  { name: "selectEditorOptionsRefocus" }
1799
1865
  );
1866
+ let followedPosition;
1800
1867
  createEffect2(
1801
1868
  () => `${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
1802
- (position, previous) => {
1869
+ outsideGraphApply((position) => {
1870
+ const previous = followedPosition;
1871
+ followedPosition = position;
1803
1872
  if (previous !== void 0 && previous !== position) {
1804
1873
  measure();
1805
1874
  }
1806
- },
1875
+ }),
1807
1876
  { name: "selectEditorFollowCell" }
1808
1877
  );
1809
1878
  const mount = () => placement2() !== null ? portal.container() : null;
@@ -1815,8 +1884,8 @@ function SelectCellEditor(props) {
1815
1884
  },
1816
1885
  { name: "selectEditorScrollHighlight" }
1817
1886
  );
1818
- const commitValue = (optionValue, direction) => {
1819
- const result = props.onCommit(optionValue, direction);
1887
+ const commitValue = (option, direction) => {
1888
+ const result = props.onCommit(option.value, direction, option);
1820
1889
  if (result && result.status === "rejected") {
1821
1890
  setError(result.message);
1822
1891
  }
@@ -1827,7 +1896,7 @@ function SelectCellEditor(props) {
1827
1896
  props.onCancel();
1828
1897
  return;
1829
1898
  }
1830
- commitValue(option.value, direction);
1899
+ commitValue(option, direction);
1831
1900
  };
1832
1901
  const handleKeyDown = (event) => {
1833
1902
  if (isImeComposingKeyEvent(event)) {
@@ -1918,7 +1987,8 @@ function SelectCellEditor(props) {
1918
1987
  left: px(placement2()?.left ?? 0),
1919
1988
  top: px(placement2()?.top ?? 0),
1920
1989
  width: px(placement2()?.width ?? 0),
1921
- "max-height": px(placement2()?.maxHeight ?? 0)
1990
+ "max-height": px(placement2()?.maxHeight ?? 0),
1991
+ visibility: placement2()?.hidden ? "hidden" : void 0
1922
1992
  }}
1923
1993
  onPointerDown={(event) => event.preventDefault()}
1924
1994
  >
@@ -1939,8 +2009,13 @@ function SelectCellEditor(props) {
1939
2009
  "ssg-select-editor-option",
1940
2010
  { "ssg-select-editor-option--highlighted": index === highlight() }
1941
2011
  ]}
1942
- onClick={() => commitValue(option().value)}
1943
- onPointerEnter={() => updateHighlight(index)}
2012
+ onClick={() => commitValue(option())}
2013
+ onPointerEnter={(event) => revealOverflowTitle(event.currentTarget)}
2014
+ onPointerMove={(event) => {
2015
+ if (pointerMoved(event)) {
2016
+ updateHighlight(index);
2017
+ }
2018
+ }}
1944
2019
  >
1945
2020
  {option().label}
1946
2021
  </div>}
@@ -2174,7 +2249,7 @@ function CellEditorLayer(props) {
2174
2249
  get alignTop() {
2175
2250
  return props.alignTop;
2176
2251
  },
2177
- onCommit: (value, direction) => props.onCommit(value, direction),
2252
+ onCommit: (value, direction, option, forwardText) => props.onCommit(value, direction, option, forwardText),
2178
2253
  onCancel: () => props.onCancel(),
2179
2254
  onRegisterFlush: (flush) => props.onRegisterFlush?.(flush)
2180
2255
  };
@@ -2206,6 +2281,25 @@ function CellEditorLayer(props) {
2206
2281
  }
2207
2282
  case "select": {
2208
2283
  const session = untrack11(() => props.session);
2284
+ const current = untrack11(editor);
2285
+ const SearchSelectEditor = props.SearchSelectEditor;
2286
+ const initialText = session ? resolveTypedStartText(initialValue, session.value) : void 0;
2287
+ if (SearchSelectEditor && current?.type === "select" && isSearchSelectEditor(current)) {
2288
+ const loadOptions = current.loadOptions;
2289
+ return <SearchSelectEditor
2290
+ {...common}
2291
+ popoverSlot={props.slots.popover}
2292
+ themeClassName={props.themeClassName}
2293
+ options={selectOptions()}
2294
+ value={session?.value}
2295
+ displayText={session ? session.column.valueFormatter?.({ value: session.value, row: session.row, column: session.column }) : void 0}
2296
+ allowFreeText={current.allowFreeText === true}
2297
+ load={loadOptions && session ? (query, signal) => loadOptions({ query, row: session.row, rowKey: session.rowKey, column: session.column, signal }) : void 0}
2298
+ initialText={initialText}
2299
+ cellTop={props.rect?.top ?? 0}
2300
+ cellLeft={props.rect?.left ?? 0}
2301
+ />;
2302
+ }
2209
2303
  return <SelectCellEditor
2210
2304
  {...common}
2211
2305
  popoverSlot={props.slots.popover}
@@ -2214,7 +2308,7 @@ function CellEditorLayer(props) {
2214
2308
  value={props.session?.value}
2215
2309
  cellTop={props.rect?.top ?? 0}
2216
2310
  cellLeft={props.rect?.left ?? 0}
2217
- initialText={session ? resolveTypedStartText(initialValue, session.value) : void 0}
2311
+ initialText={initialText}
2218
2312
  />;
2219
2313
  }
2220
2314
  case "custom": {
@@ -2390,16 +2484,21 @@ function DefaultGridBottomBar(props) {
2390
2484
  const SelectionAggregates = props.SelectionAggregates;
2391
2485
  return SelectionAggregates ? <SelectionAggregates aggregates={props.selectionAggregates} trailing={trailing} /> : null;
2392
2486
  };
2487
+ const unsavedChip = () => <Show10 when={props.unsavedText}>
2488
+ {(text) => <span class="ssg-bar-chip ssg-bar-chip--unsaved">{text()}</span>}
2489
+ </Show10>;
2393
2490
  return <div class={["ssg-bar--bottom", props.slot?.className]} style={props.slot?.style}>
2394
2491
  <div class="ssg-bar-container">
2395
2492
  <Show10 when={props.showCounts}>
2396
2493
  <div class="ssg-bar-group">
2397
2494
  <span class="ssg-bar-chip">{props.derivedSummary.rowSummaryText}</span>
2398
2495
  <span class="ssg-bar-chip">{props.derivedSummary.columnSummaryText}</span>
2496
+ {unsavedChip()}
2399
2497
  </div>
2400
2498
  {aggregates(false)}
2401
2499
  </Show10>
2402
2500
  <div class="ssg-bar-group">
2501
+ <Show10 when={!props.showCounts}>{unsavedChip()}</Show10>
2403
2502
  <span class="ssg-bar-chip">
2404
2503
  {formatLocaleText5(texts().activeCell, { cell: props.derivedSummary.activeCellLabel })}
2405
2504
  </span>
@@ -2417,6 +2516,7 @@ function DefaultGridBottomBar(props) {
2417
2516
  // src/devWarnings.ts
2418
2517
  import { createEffect as createEffect3, createMemo as createMemo9 } from "solid-js";
2419
2518
  import { AUTO_HEIGHT_MAX_ROWS } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry";
2519
+ import { isSearchSelectEditor as isSearchSelectEditor2 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
2420
2520
  import { createInertExportCommands } from "@ishibashi0112/spreadsheet-grid-core/internal/engine/features";
2421
2521
  import {
2422
2522
  warnUnregisteredFeatureMethod,
@@ -2436,6 +2536,19 @@ var FEATURE_PROPS = {
2436
2536
  rowDrag: [{ prop: "enableRowDrag", isUsed: (props) => props.enableRowDrag === true }],
2437
2537
  scrollHint: [{ prop: "scrollHint", isUsed: (props) => props.scrollHint !== void 0 && props.scrollHint !== false }],
2438
2538
  imeDirectInput: [{ prop: "imeDirectInput", isUsed: (props) => props.imeDirectInput === true }],
2539
+ // 列の select エディタの search(loadOptions / allowFreeText は search の既定を true にする)。どれか 1 列でも検索できる選択
2540
+ // エディタなら警告する(React 版と同じ)。
2541
+ selectSearch: [
2542
+ {
2543
+ prop: "columns[].editor.search / loadOptions / allowFreeText",
2544
+ isUsed: (props) => props.columns.some((column) => isSearchSelectEditor2(column.editor))
2545
+ }
2546
+ ],
2547
+ // 変更の追跡(React 版と同じ)。
2548
+ changeTracking: [
2549
+ { prop: "trackChanges", isUsed: (props) => props.trackChanges === true },
2550
+ { prop: "onChangesChange", isUsed: (props) => props.onChangesChange !== void 0 }
2551
+ ],
2439
2552
  totalRow: [{ prop: "totalRow", isUsed: (props) => props.totalRow !== void 0 && props.totalRow !== false }],
2440
2553
  pinnedRows: [
2441
2554
  { prop: "pinnedTopRows", isUsed: (props) => (props.pinnedTopRows?.length ?? 0) > 0 },
@@ -2624,6 +2737,26 @@ function createShellDevWarningsInDev(args) {
2624
2737
  }
2625
2738
  }
2626
2739
  );
2740
+ const trackChangesWarned = /* @__PURE__ */ new Set();
2741
+ createChangeEffect(args.trackChangesUnavailable, (reason) => {
2742
+ if (reason === null || trackChangesWarned.has(reason)) {
2743
+ return;
2744
+ }
2745
+ trackChangesWarned.add(reason);
2746
+ if (reason === "serverSide") {
2747
+ console.warn(
2748
+ "[SpreadsheetGrid] trackChanges \u306F serverSide(dataSource)\u3067\u306F\u4F7F\u3048\u307E\u305B\u3093(\u5370\u3082 getChanges() \u3082\u51FA\u307E\u305B\u3093)\u3002\n[SpreadsheetGrid] trackChanges does not work with serverSide (dataSource). No marks are shown and getChanges() is empty."
2749
+ );
2750
+ } else if (reason === "rowKeyGetter") {
2751
+ console.warn(
2752
+ "[SpreadsheetGrid] trackChanges \u306B\u306F rowKeyGetter \u304C\u8981\u308A\u307E\u3059(\u884C\u306E\u30AD\u30FC\u3067\u5909\u66F4\u3092\u8FFD\u3046\u305F\u3081\u3002\u6307\u5B9A\u3059\u308B\u307E\u3067\u4F55\u3082\u3057\u307E\u305B\u3093)\u3002\n[SpreadsheetGrid] trackChanges needs rowKeyGetter (changes are tracked by row key). It does nothing until you set it."
2753
+ );
2754
+ } else if (reason === "onRowsChange") {
2755
+ console.warn(
2756
+ "[SpreadsheetGrid] trackChanges \u306B\u306F onRowsChange \u304C\u8981\u308A\u307E\u3059(\u30B0\u30EA\u30C3\u30C9\u3067\u76F4\u3057\u305F\u884C\u3092\u53D7\u3051\u53D6\u308B\u305F\u3081\u3002\u6307\u5B9A\u3059\u308B\u307E\u3067\u4F55\u3082\u3057\u307E\u305B\u3093)\u3002\n[SpreadsheetGrid] trackChanges needs onRowsChange (to receive the rows edited in the grid). It does nothing until you set it."
2757
+ );
2758
+ }
2759
+ });
2627
2760
  if (!args.filteringAvailable) {
2628
2761
  createChangeEffect(
2629
2762
  () => args.globalFilterText().trim() !== "" || args.columnFilterCount() > 0,
@@ -2700,7 +2833,8 @@ var SLOT_CONTEXT_KEYS = Object.keys({
2700
2833
  derivedSummary: true,
2701
2834
  globalFilterStatus: true,
2702
2835
  globalFilterProgress: true,
2703
- selectionAggregates: true
2836
+ selectionAggregates: true,
2837
+ unsavedChanges: true
2704
2838
  });
2705
2839
  var DERIVED_SUMMARY_KEYS = Object.keys({
2706
2840
  rowSummaryText: true,
@@ -3150,7 +3284,8 @@ function GridShellBody(props, features, mountGate, mode) {
3150
3284
  detailActive: () => vertical().detailActive,
3151
3285
  maxBodyPx: () => viewMaxBodyPx() ?? MAX_BODY_PX,
3152
3286
  globalFilterText,
3153
- columnFilterCount: () => Object.keys(columnFilters()).length
3287
+ columnFilterCount: () => Object.keys(columnFilters()).length,
3288
+ trackChangesUnavailable: () => !(props.trackChanges ?? false) || features.changeTracking === void 0 ? null : isServerSide() ? "serverSide" : props.rowKeyGetter === void 0 ? "rowKeyGetter" : props.onRowsChange == null ? "onRowsChange" : null
3154
3289
  });
3155
3290
  const stickyLabelIndexes = createMemo10(() => {
3156
3291
  const indexes = labelViewIndexes();
@@ -3826,6 +3961,11 @@ function GridShellBody(props, features, mountGate, mode) {
3826
3961
  onGutterRowSelect: rowSelectionCommands.handleGutterRowSelect,
3827
3962
  onGutterRowSelectDrag: rowSelectionCommands.handleGutterRowSelectDrag
3828
3963
  }), "render", "pointer");
3964
+ const changeTrackingParts = features.changeTracking;
3965
+ const changeTracker = engine.changeTracker;
3966
+ const changeTrackingActive = createMemo10(
3967
+ () => (props.trackChanges ?? false) && changeTrackingParts !== void 0 && !isServerSide() && props.rowKeyGetter !== void 0 && props.onRowsChange != null
3968
+ );
3829
3969
  const history = createHistoryController();
3830
3970
  connectController(history, () => ({
3831
3971
  rows: rows(),
@@ -3842,8 +3982,66 @@ function GridShellBody(props, features, mountGate, mode) {
3842
3982
  requestAnimationFrame(() => engine.gridApi.scrollToCellInternal(activeCell.row, activeCell.col, "auto"));
3843
3983
  }
3844
3984
  },
3845
- rowKeyGetter: props.rowKeyGetter
3985
+ rowKeyGetter: props.rowKeyGetter,
3986
+ // 追加(1.8.0): グリッドの変更を変更の追跡へ(効いていなければ渡さない)。
3987
+ onGridRowsChange: changeTrackingActive() ? changeTracker.noteGridRowsChange : void 0
3846
3988
  }), "render", "history");
3989
+ connectController(changeTracker, () => ({
3990
+ enabled: changeTrackingActive(),
3991
+ rows: rows(),
3992
+ columns: columns(),
3993
+ rowKeyGetter: props.rowKeyGetter,
3994
+ applyRows: props.onRowsChange ? history.applyRows : void 0
3995
+ }), "render", "changeTracker");
3996
+ const changeSnapshot = createExternalStoreSignal(changeTracker, "changeTrackerStore");
3997
+ connectController(
3998
+ { update: (args) => changeTracker.notifyChanges(args.callback) },
3999
+ () => {
4000
+ changeSnapshot();
4001
+ return { callback: inOwnTick(props.onChangesChange) };
4002
+ },
4003
+ "effect",
4004
+ "changeNotifier"
4005
+ );
4006
+ const unsavedChanges = createMemo10(
4007
+ () => changeTrackingActive() ? { rowCount: changeSnapshot().rowCount, cellCount: changeSnapshot().cellCount } : null,
4008
+ { equals: (a, b) => a === b || a !== null && b !== null && a.rowCount === b.rowCount && a.cellCount === b.cellCount }
4009
+ );
4010
+ const unsavedTracking = createMemo10(() => {
4011
+ const parts = changeTrackingParts;
4012
+ if (!changeTrackingActive() || !parts) {
4013
+ return void 0;
4014
+ }
4015
+ changeSnapshot();
4016
+ const texts = localeTexts();
4017
+ return {
4018
+ getUnsavedCells: changeTracker.getUnsavedCells,
4019
+ trackedColumns: changeTracker.getTrackedColumns(),
4020
+ describeCell: (column, row, savedValue) => parts.describeUnsavedCell(column, row, savedValue, texts),
4021
+ rowDescription: texts.unsavedRow
4022
+ };
4023
+ });
4024
+ const resolveRevertItems = () => {
4025
+ const parts = changeTrackingParts;
4026
+ if (!untrack13(changeTrackingActive) || untrack13(readOnly) || !parts) {
4027
+ return void 0;
4028
+ }
4029
+ const state = untrack13(ui);
4030
+ const model = untrack13(rowModel);
4031
+ const ordered = untrack13(orderedColumns);
4032
+ const texts = untrack13(localeTexts);
4033
+ return (target, isTargetSelected) => parts.buildRevertMenuItems({
4034
+ target,
4035
+ isTargetSelected,
4036
+ selection: state.selection,
4037
+ rowModel: model,
4038
+ orderedColumns: ordered,
4039
+ getUnsavedCells: changeTracker.getUnsavedCells,
4040
+ trackedColumns: changeTracker.getTrackedColumns(),
4041
+ revert: changeTracker.revert,
4042
+ texts
4043
+ });
4044
+ };
3847
4045
  const handleRowsChange = () => props.onRowsChange ? history.handleRowsChange : void 0;
3848
4046
  const cells = createCellCommands();
3849
4047
  const { selectEntireGrid, clearSelectedCells, tryStartEdit: tryStartEditCell } = cells;
@@ -4044,7 +4242,8 @@ function GridShellBody(props, features, mountGate, mode) {
4044
4242
  rowModel: untrack13(rowModel),
4045
4243
  orderedColumns: columnsNow,
4046
4244
  selection: state.selection,
4047
- activeCell: state.activeCell
4245
+ activeCell: state.activeCell,
4246
+ resolveRevertItems: resolveRevertItems()
4048
4247
  });
4049
4248
  if (!params) {
4050
4249
  return false;
@@ -4109,7 +4308,8 @@ function GridShellBody(props, features, mountGate, mode) {
4109
4308
  rowModel: untrack13(rowModel),
4110
4309
  orderedColumns: untrack13(orderedColumns),
4111
4310
  selection: state.selection,
4112
- activeCell: state.activeCell
4311
+ activeCell: state.activeCell,
4312
+ resolveRevertItems: resolveRevertItems()
4113
4313
  });
4114
4314
  if (!params) {
4115
4315
  return;
@@ -4183,7 +4383,9 @@ function GridShellBody(props, features, mountGate, mode) {
4183
4383
  localeTexts: localeTexts(),
4184
4384
  followsRow: activeRowFollowEnabled(),
4185
4385
  getUiState: store.getState,
4186
- rowKeyGetter: resolvedRowKeyGetter()
4386
+ rowKeyGetter: resolvedRowKeyGetter(),
4387
+ // 追加(1.7.0 / 検索できる選択エディタ): select の fillRow が書く項目の列(reject の検査に使う。隠した列も含む全部の列)。
4388
+ columns: columns()
4187
4389
  }), "render", "edit");
4188
4390
  connectController(cells, () => ({
4189
4391
  rows: rows(),
@@ -4597,6 +4799,9 @@ function GridShellBody(props, features, mountGate, mode) {
4597
4799
  canRedoRows: history.canRedo,
4598
4800
  clearUndoHistory: history.clearHistory,
4599
4801
  applyRowsChange: props.onRowsChange ? history.applyRows : void 0,
4802
+ // 追加(1.8.0): 変更の追跡(getChanges / markChangesSaved / revertChanges の委譲先)。
4803
+ changeTracker,
4804
+ changeTrackingActive: changeTrackingActive(),
4600
4805
  detailRowEnabled: detailRowEnabled(),
4601
4806
  detailIsExpandable: props.detailRow?.isExpandable,
4602
4807
  detailIndexCacheRef: engine.detailIndexCache,
@@ -4735,7 +4940,9 @@ function GridShellBody(props, features, mountGate, mode) {
4735
4940
  derivedSummary: liveDerivedSummary,
4736
4941
  globalFilterStatus: globalFilterStatus(),
4737
4942
  globalFilterProgress: globalFilterProgress(),
4738
- selectionAggregates: selectionAggregates()
4943
+ selectionAggregates: selectionAggregates(),
4944
+ // 追加(1.8.0): 変更の追跡の件数(効いていなければ null)。
4945
+ unsavedChanges: unsavedChanges()
4739
4946
  };
4740
4947
  });
4741
4948
  const liveSlotContext = createLiveObject(SLOT_CONTEXT_KEYS, slotContext);
@@ -4782,6 +4989,7 @@ function GridShellBody(props, features, mountGate, mode) {
4782
4989
  showCounts={props.showBottomBarCounts ?? true}
4783
4990
  selectionAggregates={selectionAggregates()}
4784
4991
  SelectionAggregates={selectionAggregatesFeature2?.SelectionAggregates}
4992
+ unsavedText={changeTrackingParts ? changeTrackingParts.formatUnsavedSummary(unsavedChanges(), localeTexts()) : null}
4785
4993
  />}
4786
4994
  >
4787
4995
  {customBottomBar()}
@@ -5247,7 +5455,8 @@ function GridShellBody(props, features, mountGate, mode) {
5247
5455
  session={editingSessionInfo()}
5248
5456
  themeClassName={portalClassName()}
5249
5457
  slots={slots()}
5250
- onCommit={(value, direction) => edit.commitEdit(value, direction)}
5458
+ onCommit={(value, direction, option, forwardText) => edit.commitEdit(value, direction, option, forwardText)}
5459
+ SearchSelectEditor={features.selectSearch?.SearchSelectCellEditor}
5251
5460
  onCancel={edit.cancelEdit}
5252
5461
  onRegisterFlush={edit.registerDraftFlush}
5253
5462
  onRegisterLateCommit={edit.registerLateCommitReceiver}
@@ -5265,6 +5474,7 @@ function GridShellBody(props, features, mountGate, mode) {
5265
5474
  verticalAlign={props.verticalAlign}
5266
5475
  conditionalFormat={conditionalFormatFeature2}
5267
5476
  conditionalFormatStats={conditionalFormatStats()}
5477
+ unsavedTracking={unsavedTracking()}
5268
5478
  findIndex={findIndex()}
5269
5479
  findCurrentIndex={findCurrentIndex()}
5270
5480
  grouping={groupingFeature2}
@@ -9240,11 +9450,335 @@ var scrollHintFeature = {
9240
9450
  localeText: DEFAULT_SCROLL_HINT_LOCALE_TEXT
9241
9451
  };
9242
9452
 
9453
+ // src/features/selectSearch.ts
9454
+ import { DEFAULT_SELECT_SEARCH_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
9455
+
9456
+ // src/editors/SearchSelectCellEditor.tsx
9457
+ 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";
9458
+ import { Portal as Portal5 } from "@solidjs/web";
9459
+ import {
9460
+ computeSelectPopoverPlacement as computeSelectPopoverPlacement2,
9461
+ resolveSelectOptionRowHeight as resolveSelectOptionRowHeight2,
9462
+ SELECT_SEARCH_POPOVER_MIN_WIDTH,
9463
+ createPointerMoveFilter as createPointerMoveFilter2
9464
+ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectEditorState";
9465
+ import { withAnchorVisibility as withAnchorVisibility2 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/editorVisibleBounds";
9466
+ import { revealOverflowTitle as revealOverflowTitle2 } from "@ishibashi0112/spreadsheet-grid-core/internal/utils/overflowTitle";
9467
+ import {
9468
+ resolveSelectListWindow,
9469
+ revealSelectListRow,
9470
+ splitSelectSearchText
9471
+ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectSearch";
9472
+ import {
9473
+ createSearchSelectEditorController
9474
+ } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/searchSelectEditorController";
9475
+ import { isImeComposingKeyEvent as isImeComposingKeyEvent4 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
9476
+ function MatchedText(props) {
9477
+ const parts = createMemo30(() => splitSelectSearchText(props.text, props.range));
9478
+ return <For15 each={parts()} keyed={false}>
9479
+ {(part) => <Show27 when={part().match} fallback={part().text}>
9480
+ <mark class="ssg-select-editor-match">{part().text}</mark>
9481
+ </Show27>}
9482
+ </For15>;
9483
+ }
9484
+ function SearchSelectCellEditor(props) {
9485
+ const texts = useFeatureLocaleText();
9486
+ const portal = useGridPortal();
9487
+ const [input, setInput] = createSignal17();
9488
+ const [scroller, setScroller] = createSignal17();
9489
+ const [popover, setPopover] = createSignal17();
9490
+ createTopAlignedInput(input, () => props.alignTop ?? false, () => props.cellHeight ?? 0);
9491
+ const listId = createUniqueId6();
9492
+ const pointerMoved = createPointerMoveFilter2();
9493
+ const [error, setError] = createSignal17(null);
9494
+ const commitWithResult = (committed, direction, option, forwardText) => {
9495
+ const result = props.onCommit(committed, direction, option, forwardText);
9496
+ if (result && result.status === "rejected") {
9497
+ setError(result.message);
9498
+ }
9499
+ return result;
9500
+ };
9501
+ const controller = untrack20(
9502
+ () => createSearchSelectEditorController({
9503
+ options: props.options,
9504
+ value: props.value,
9505
+ initialText: props.initialText,
9506
+ displayText: props.displayText,
9507
+ allowFreeText: props.allowFreeText,
9508
+ load: props.load ? (query, signal) => props.load(query, signal) : void 0,
9509
+ onCommit: commitWithResult,
9510
+ onCancel: () => props.onCancel()
9511
+ })
9512
+ );
9513
+ const [snapshot2, setSnapshot] = createSignal17(controller.getSnapshot(), { name: "searchSelectSnapshot" });
9514
+ createEffect11(
9515
+ () => props.options,
9516
+ outsideGraphApply((options) => controller.setOptions(options)),
9517
+ { name: "searchSelectOptions" }
9518
+ );
9519
+ props.onRegisterFlush?.(untrack20(() => props.allowFreeText) ? controller.flush : null);
9520
+ const rowHeight = resolveSelectOptionRowHeight2();
9521
+ const [placement2, setPlacement] = createSignal17(null);
9522
+ const [scrollTop, setScrollTop] = createSignal17(0);
9523
+ const listRows = createMemo30(() => Math.max(snapshot2().results.length, 1));
9524
+ const viewportHeight = createMemo30(() => Math.min(listRows(), 8) * rowHeight);
9525
+ const measure = () => {
9526
+ const element = untrack20(input);
9527
+ if (!element) {
9528
+ return;
9529
+ }
9530
+ setPlacement(
9531
+ withAnchorVisibility2(
9532
+ element,
9533
+ computeSelectPopoverPlacement2(
9534
+ element.getBoundingClientRect(),
9535
+ untrack20(listRows),
9536
+ window.innerWidth,
9537
+ window.innerHeight,
9538
+ rowHeight,
9539
+ SELECT_SEARCH_POPOVER_MIN_WIDTH
9540
+ )
9541
+ )
9542
+ );
9543
+ };
9544
+ const reveal = (element, height) => {
9545
+ if (!element) {
9546
+ return;
9547
+ }
9548
+ const current = controller.getSnapshot().highlight;
9549
+ const next = current < 0 ? 0 : revealSelectListRow(current, element.scrollTop, height, rowHeight);
9550
+ if (next !== element.scrollTop) {
9551
+ element.scrollTop = next;
9552
+ }
9553
+ setScrollTop(next);
9554
+ };
9555
+ let disposed = false;
9556
+ onSettled9(() => {
9557
+ const element = untrack20(input);
9558
+ if (element) {
9559
+ element.focus();
9560
+ if (untrack20(() => props.initialText) === void 0) {
9561
+ element.select();
9562
+ } else {
9563
+ element.setSelectionRange(element.value.length, element.value.length);
9564
+ }
9565
+ }
9566
+ setSnapshot(controller.getSnapshot());
9567
+ const unsubscribe = controller.subscribe(() => setSnapshot(controller.getSnapshot()));
9568
+ const detach = controller.attach();
9569
+ measure();
9570
+ window.addEventListener("resize", measure);
9571
+ window.addEventListener("scroll", measure, true);
9572
+ return () => {
9573
+ window.removeEventListener("resize", measure);
9574
+ window.removeEventListener("scroll", measure, true);
9575
+ detach();
9576
+ unsubscribe();
9577
+ };
9578
+ });
9579
+ onCleanup13(() => {
9580
+ disposed = true;
9581
+ });
9582
+ let measuredKey;
9583
+ createEffect11(
9584
+ () => `${listRows()}:${props.cellTop ?? 0}:${props.cellLeft ?? 0}`,
9585
+ outsideGraphApply((key) => {
9586
+ const previous = measuredKey;
9587
+ measuredKey = key;
9588
+ if (previous !== void 0 && previous !== key) {
9589
+ measure();
9590
+ }
9591
+ }),
9592
+ { name: "searchSelectMeasure" }
9593
+ );
9594
+ createEffect11(
9595
+ () => [snapshot2().results, scroller(), viewportHeight()],
9596
+ outsideGraphApply(([, element, height]) => reveal(element, height)),
9597
+ { name: "searchSelectReveal" }
9598
+ );
9599
+ const handleKeyDown = (event) => {
9600
+ if (isImeComposingKeyEvent4(event)) {
9601
+ return;
9602
+ }
9603
+ const before = controller.getSnapshot().highlight;
9604
+ if (controller.keyDown(toEditorKeyEvent(event), props.enterMove) && controller.getSnapshot().highlight !== before) {
9605
+ setError(null);
9606
+ reveal(untrack20(scroller), untrack20(viewportHeight));
9607
+ }
9608
+ };
9609
+ const results = () => snapshot2().results;
9610
+ const status = () => snapshot2().status;
9611
+ const visible = createMemo30(() => {
9612
+ const list = results();
9613
+ const window_ = resolveSelectListWindow(scrollTop(), viewportHeight(), rowHeight, list.length);
9614
+ return list.slice(window_.start, window_.end).map((result, offset) => ({ result, index: window_.start + offset }));
9615
+ });
9616
+ const listShown = () => placement2() !== null && results().length > 0;
9617
+ const activeId = () => {
9618
+ const { highlight } = snapshot2();
9619
+ return listShown() && highlight >= 0 && results()[highlight] ? `${listId}-${highlight}` : void 0;
9620
+ };
9621
+ const freeTextOnly = () => props.allowFreeText === true && status() === "ready" && snapshot2().filtered && results().length === 0;
9622
+ const mount = () => placement2() !== null && !freeTextOnly() ? portal.container() : null;
9623
+ const initialText = untrack20(() => snapshot2().text);
9624
+ const view = <>
9625
+ <input
9626
+ ref={setInput}
9627
+ type="text"
9628
+ value={initialText}
9629
+ onInput={(event) => {
9630
+ setError(null);
9631
+ controller.input(event.currentTarget.value, event.isComposing);
9632
+ }}
9633
+ onCompositionEnd={(event) => controller.input(event.currentTarget.value, false)}
9634
+ onKeyDown={handleKeyDown}
9635
+ onBlur={() => {
9636
+ if (!disposed) {
9637
+ controller.blur();
9638
+ }
9639
+ }}
9640
+ role="combobox"
9641
+ aria-autocomplete="list"
9642
+ aria-label={props.ariaLabel}
9643
+ aria-expanded={listShown() ? "true" : "false"}
9644
+ aria-controls={listShown() ? listId : void 0}
9645
+ aria-activedescendant={activeId()}
9646
+ aria-invalid={error() !== null ? "true" : void 0}
9647
+ autocomplete="off"
9648
+ spellcheck="false"
9649
+ class={[
9650
+ "ssg-cell-editor-input",
9651
+ "ssg-cell-editor-input--search",
9652
+ { "ssg-cell-editor-input--invalid": error() !== null }
9653
+ ]}
9654
+ style={props.align ? { "text-align": props.align } : void 0}
9655
+ />
9656
+ <CellEditorError message={error()} />
9657
+ <Show27 when={mount()}>
9658
+ {(container) => <Portal5 mount={container()}>
9659
+ <div
9660
+ ref={setPopover}
9661
+ class={[
9662
+ "ssg-select-editor-popover",
9663
+ "ssg-select-editor-popover--search",
9664
+ { "ssg-select-editor-popover--loading": status() === "loading" && results().length > 0 },
9665
+ props.themeClassName,
9666
+ props.popoverSlot?.className
9667
+ ]}
9668
+ style={{
9669
+ ...props.popoverSlot?.style,
9670
+ left: px(placement2()?.left ?? 0),
9671
+ top: px(placement2()?.top ?? 0),
9672
+ width: px(placement2()?.width ?? 0),
9673
+ "max-height": px(placement2()?.maxHeight ?? 0),
9674
+ visibility: placement2()?.hidden ? "hidden" : void 0
9675
+ }}
9676
+ onPointerDown={(event) => event.preventDefault()}
9677
+ >
9678
+ <Show27 when={status() === "error"}>
9679
+ <div class="ssg-select-editor-empty ssg-select-editor-error" role="alert">
9680
+ <span class="ssg-select-editor-error-text" title={snapshot2().errorMessage ?? void 0}>
9681
+ {texts().selectSearchFailed}
9682
+ </span>
9683
+ <button type="button" class="ssg-select-editor-retry" tabindex={-1} onClick={() => controller.retry()}>
9684
+ {texts().retry}
9685
+ </button>
9686
+ </div>
9687
+ </Show27>
9688
+ <Show27 when={status() !== "error" && results().length === 0}>
9689
+ <div class="ssg-select-editor-empty" role="status">
9690
+ {status() === "loading" ? texts().selectSearchLoading : snapshot2().filtered ? texts().selectSearchNoMatch : texts().noOptions}
9691
+ </div>
9692
+ </Show27>
9693
+ <Show27 when={results().length > 0}>
9694
+ <div
9695
+ ref={setScroller}
9696
+ role="listbox"
9697
+ id={listId}
9698
+ aria-label={props.ariaLabel}
9699
+ aria-busy={status() === "loading" ? "true" : void 0}
9700
+ class="ssg-select-editor-scroller"
9701
+ style={{ height: px(viewportHeight()) }}
9702
+ onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}
9703
+ >
9704
+ <div class="ssg-select-editor-rows" role="presentation" style={{ height: px(results().length * rowHeight) }}>
9705
+ <For15 each={visible()} keyed={false}>
9706
+ {(item) => <div
9707
+ id={`${listId}-${item().index}`}
9708
+ role="option"
9709
+ aria-selected={item().index === snapshot2().highlight ? "true" : "false"}
9710
+ aria-setsize={results().length}
9711
+ aria-posinset={item().index + 1}
9712
+ class={[
9713
+ "ssg-select-editor-option",
9714
+ { "ssg-select-editor-option--highlighted": item().index === snapshot2().highlight }
9715
+ ]}
9716
+ style={{ top: px(item().index * rowHeight) }}
9717
+ onClick={() => controller.choose(untrack20(item).index)}
9718
+ onPointerEnter={(event) => revealOverflowTitle2(event.currentTarget)}
9719
+ onPointerMove={(event) => {
9720
+ if (pointerMoved(event)) {
9721
+ controller.hover(untrack20(item).index);
9722
+ }
9723
+ }}
9724
+ >
9725
+ <span class="ssg-select-editor-option-label">
9726
+ <MatchedText text={item().result.option.label} range={item().result.labelMatch} />
9727
+ </span>
9728
+ <Show27 when={item().result.option.description}>
9729
+ {(description) => <span class="ssg-select-editor-option-description">
9730
+ <MatchedText text={description()} range={item().result.descriptionMatch} />
9731
+ </span>}
9732
+ </Show27>
9733
+ </div>}
9734
+ </For15>
9735
+ </div>
9736
+ </div>
9737
+ </Show27>
9738
+ </div>
9739
+ </Portal5>}
9740
+ </Show27>
9741
+ </>;
9742
+ createPortalTokens(popover, () => props.themeClassName, placement2);
9743
+ createRenderEffect7(
9744
+ () => [input(), snapshot2().text],
9745
+ ([element, text]) => {
9746
+ if (element && element.value !== text) {
9747
+ element.value = text;
9748
+ }
9749
+ },
9750
+ { name: "searchSelectInputText" }
9751
+ );
9752
+ return view;
9753
+ }
9754
+
9755
+ // src/features/selectSearch.ts
9756
+ var selectSearchFeature = {
9757
+ SearchSelectCellEditor,
9758
+ localeText: DEFAULT_SELECT_SEARCH_LOCALE_TEXT
9759
+ };
9760
+
9761
+ // src/features/changeTracking.ts
9762
+ import { createChangeTracker } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/changeTracker";
9763
+ import {
9764
+ buildRevertMenuItems,
9765
+ describeUnsavedCell,
9766
+ formatUnsavedSummary
9767
+ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/changeTracking";
9768
+ import { DEFAULT_CHANGE_TRACKING_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
9769
+ var changeTrackingFeature = {
9770
+ createChangeTracker,
9771
+ describeUnsavedCell,
9772
+ formatUnsavedSummary,
9773
+ buildRevertMenuItems,
9774
+ localeText: DEFAULT_CHANGE_TRACKING_LOCALE_TEXT
9775
+ };
9776
+
9243
9777
  // src/features/selectionAggregates.ts
9244
9778
  import { DEFAULT_AGGREGATES_LOCALE_TEXT } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFeatures";
9245
9779
 
9246
9780
  // src/primitives/selectionAggregates.ts
9247
- import { createMemo as createMemo30 } from "solid-js";
9781
+ import { createMemo as createMemo31 } from "solid-js";
9248
9782
  import {
9249
9783
  createSelectionAggregatesRunner,
9250
9784
  resolveSyncSelectionAggregates,
@@ -9256,15 +9790,15 @@ import {
9256
9790
  } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
9257
9791
  function createSelectionAggregates(args) {
9258
9792
  const stabilizeTarget = createSelectionAggregateTargetStabilizer();
9259
- const target = createMemo30(() => {
9793
+ const target = createMemo31(() => {
9260
9794
  const current = args();
9261
9795
  return stabilizeTarget(
9262
9796
  current.enabled ? resolveSelectionAggregateTarget(current.selection, current.viewRowCount, current.orderedColumns) : null
9263
9797
  );
9264
9798
  });
9265
- const rowModel = createMemo30(() => args().rowModel);
9266
- const key = createMemo30(() => ({ rowModel: rowModel(), target: target() }));
9267
- const syncResult = createMemo30(() => resolveSyncSelectionAggregates(key()));
9799
+ const rowModel = createMemo31(() => args().rowModel);
9800
+ const key = createMemo31(() => ({ rowModel: rowModel(), target: target() }));
9801
+ const syncResult = createMemo31(() => resolveSyncSelectionAggregates(key()));
9268
9802
  const runner = createSelectionAggregatesRunner();
9269
9803
  connectController(
9270
9804
  runner,
@@ -9273,16 +9807,16 @@ function createSelectionAggregates(args) {
9273
9807
  "selectionAggregates"
9274
9808
  );
9275
9809
  const snapshot2 = createExternalStoreSignal(runner, "selectionAggregatesStore");
9276
- return createMemo30(() => selectSelectionAggregatesResult(syncResult(), snapshot2(), key()));
9810
+ return createMemo31(() => selectSelectionAggregatesResult(syncResult(), snapshot2(), key()));
9277
9811
  }
9278
9812
 
9279
9813
  // src/view/GridSelectionAggregates.tsx
9280
- import { For as For15, Show as Show27, createMemo as createMemo31 } from "solid-js";
9814
+ import { For as For16, Show as Show28, createMemo as createMemo32 } from "solid-js";
9281
9815
  import { formatSelectionAggregateNumber } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/selectionAggregates";
9282
9816
  import { formatLocaleText as formatLocaleText16 } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
9283
9817
  function GridSelectionAggregates(props) {
9284
9818
  const texts = useFeatureLocaleText();
9285
- const chips = createMemo31(() => {
9819
+ const chips = createMemo32(() => {
9286
9820
  const aggregates = props.aggregates;
9287
9821
  if (!aggregates) {
9288
9822
  return null;
@@ -9315,12 +9849,12 @@ function GridSelectionAggregates(props) {
9315
9849
  }
9316
9850
  return list;
9317
9851
  });
9318
- return <Show27 when={chips()}>
9852
+ return <Show28 when={chips()}>
9319
9853
  {(list) => <div class={["ssg-bar-aggregates", { "ssg-bar-aggregates--trailing": props.trailing }]}>
9320
9854
  <div class="ssg-bar-aggregates-inner" title={list().map((chip) => chip.text).join(" ")}>
9321
9855
  <div class="ssg-bar-aggregates-list">
9322
9856
  <span class="ssg-bar-aggregates-fit" aria-hidden="true" />
9323
- <For15 each={list()} keyed={(chip) => chip.key}>
9857
+ <For16 each={list()} keyed={(chip) => chip.key}>
9324
9858
  {(chip, index) => <span
9325
9859
  class={[
9326
9860
  "ssg-bar-chip",
@@ -9331,16 +9865,16 @@ function GridSelectionAggregates(props) {
9331
9865
  ]}
9332
9866
  style={{ order: String(-index()) }}
9333
9867
  >
9334
- <Show27 when={chip().label !== void 0} fallback={chip().text}>
9868
+ <Show28 when={chip().label !== void 0} fallback={chip().text}>
9335
9869
  {chip().label}
9336
9870
  <b class="ssg-bar-aggregate-value">{chip().value}</b>
9337
- </Show27>
9871
+ </Show28>
9338
9872
  </span>}
9339
- </For15>
9873
+ </For16>
9340
9874
  </div>
9341
9875
  </div>
9342
9876
  </div>}
9343
- </Show27>;
9877
+ </Show28>;
9344
9878
  }
9345
9879
 
9346
9880
  // src/features/selectionAggregates.ts
@@ -9351,7 +9885,7 @@ var selectionAggregatesFeature = {
9351
9885
  };
9352
9886
 
9353
9887
  // src/primitives/toolPanel.ts
9354
- import { createMemo as createMemo32 } from "solid-js";
9888
+ import { createMemo as createMemo33 } from "solid-js";
9355
9889
  import {
9356
9890
  createToolPanelController,
9357
9891
  resolveActiveToolPanelTab,
@@ -9370,7 +9904,7 @@ function createToolPanel(inputs) {
9370
9904
  onSuppressedEscape: inputs.onSuppressedEscape
9371
9905
  }), "render", "toolPanel");
9372
9906
  const snapshot2 = createExternalStoreSignal(controller, "toolPanelStore");
9373
- const availableTabs = createMemo32(
9907
+ const availableTabs = createMemo33(
9374
9908
  () => resolveAvailableToolPanelTabs({
9375
9909
  canUseFilterTab: inputs.canUseFilterTab(),
9376
9910
  canUseColumnsTab: inputs.canUseColumnsTab(),
@@ -9379,10 +9913,10 @@ function createToolPanel(inputs) {
9379
9913
  { equals: sameTabs }
9380
9914
  );
9381
9915
  return {
9382
- activeTab: createMemo32(() => resolveActiveToolPanelTab(snapshot2().requestedTab, availableTabs())),
9916
+ activeTab: createMemo33(() => resolveActiveToolPanelTab(snapshot2().requestedTab, availableTabs())),
9383
9917
  availableTabs,
9384
- layout: createMemo32(() => snapshot2().layout),
9385
- flashTick: createMemo32(() => snapshot2().flashTick),
9918
+ layout: createMemo33(() => snapshot2().layout),
9919
+ flashTick: createMemo33(() => snapshot2().flashTick),
9386
9920
  panelRef: controller.panelRef,
9387
9921
  open: controller.open,
9388
9922
  close: controller.close,
@@ -9406,7 +9940,7 @@ import {
9406
9940
  } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/totalRow";
9407
9941
 
9408
9942
  // src/view/GridTotalRow.tsx
9409
- import { For as For16, Show as Show28, createMemo as createMemo33 } from "solid-js";
9943
+ import { For as For17, Show as Show29, createMemo as createMemo34 } from "solid-js";
9410
9944
  import {
9411
9945
  formatTotalRowCellText as formatTotalRowCellText2,
9412
9946
  resolveTotalRowCaption as resolveTotalRowCaption2
@@ -9433,7 +9967,7 @@ function GridTotalRow(props) {
9433
9967
  ...props.stickyBottom > 0 ? { bottom: px(props.stickyBottom) } : null
9434
9968
  }}
9435
9969
  >
9436
- <Show28 when={props.ownsRowHeader}>
9970
+ <Show29 when={props.ownsRowHeader}>
9437
9971
  <div
9438
9972
  role={rowHeaderIsCell() ? "rowheader" : void 0}
9439
9973
  aria-colindex={rowHeaderIsCell() ? 1 : void 0}
@@ -9448,13 +9982,13 @@ function GridTotalRow(props) {
9448
9982
  >
9449
9983
  {rowHeaderText() === "" ? null : rowHeaderText()}
9450
9984
  </div>
9451
- </Show28>
9452
- <For16 each={props.entries} keyed={(entry) => entry.column.key}>
9985
+ </Show29>
9986
+ <For17 each={props.entries} keyed={(entry) => entry.column.key}>
9453
9987
  {(entry) => {
9454
- const unbound = createMemo33(() => entry().column);
9988
+ const unbound = createMemo34(() => entry().column);
9455
9989
  const cell = () => props.cells.get(unbound().key);
9456
9990
  const isLabelCell = () => unbound().key === props.labelColumnKey;
9457
- const content = createMemo33(() => {
9991
+ const content = createMemo34(() => {
9458
9992
  const total = cell();
9459
9993
  if (total) {
9460
9994
  const column = unbound();
@@ -9506,7 +10040,7 @@ function GridTotalRow(props) {
9506
10040
  {content()}
9507
10041
  </div>;
9508
10042
  }}
9509
- </For16>
10043
+ </For17>
9510
10044
  </div>
9511
10045
  </>;
9512
10046
  }
@@ -9533,6 +10067,8 @@ var fullGridFeatures = {
9533
10067
  motionExtras: motionExtrasFeature,
9534
10068
  find: findFeature,
9535
10069
  imeDirectInput: imeDirectInputFeature,
10070
+ selectSearch: selectSearchFeature,
10071
+ changeTracking: changeTrackingFeature,
9536
10072
  columnAutosize: columnAutosizeFeature,
9537
10073
  columnReorder: columnReorderFeature,
9538
10074
  rowDrag: rowDragFeature,
@@ -9568,6 +10104,7 @@ import { restoreColumnsFromState } from "@ishibashi0112/spreadsheet-grid-core/in
9568
10104
  export {
9569
10105
  SpreadsheetGrid,
9570
10106
  autoHeightFeature,
10107
+ changeTrackingFeature,
9571
10108
  columnAutosizeFeature,
9572
10109
  columnGroupsFeature,
9573
10110
  columnMenuFeature,
@@ -9590,6 +10127,7 @@ export {
9590
10127
  restoreColumnsFromState,
9591
10128
  rowDragFeature,
9592
10129
  scrollHintFeature,
10130
+ selectSearchFeature,
9593
10131
  selectionAggregatesFeature,
9594
10132
  serverSideFeature,
9595
10133
  standardFeatures,