@ishibashi0112/spreadsheet-grid 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.
Files changed (39) hide show
  1. package/API_REFERENCE.md +161 -20
  2. package/README.md +2 -2
  3. package/dist/CellEditorLayer.d.ts +5 -3
  4. package/dist/GridShell.d.ts +1 -1
  5. package/dist/common.d.ts +1 -1
  6. package/dist/editors/SearchSelectCellEditor.d.ts +24 -0
  7. package/dist/editors/SelectCellEditor.d.ts +1 -1
  8. package/dist/features/changeTracking.d.ts +2 -0
  9. package/dist/features/selectSearch.d.ts +2 -0
  10. package/dist/features/types.d.ts +12 -1
  11. package/dist/hooks/useGridBarContext.d.ts +4 -3
  12. package/dist/hooks/useGridEditController.d.ts +1 -1
  13. package/dist/index.cjs +9 -6
  14. package/dist/index.js +3368 -3027
  15. package/dist/lite/createSpreadsheetGrid-Dk8_KZ1L.js +4657 -0
  16. package/dist/lite/createSpreadsheetGrid-wGOM8DxG.cjs +9 -0
  17. package/dist/lite/createSpreadsheetGrid.cjs +1 -1
  18. package/dist/lite/createSpreadsheetGrid.js +1 -1
  19. package/dist/lite/features/changeTracking.cjs +1 -0
  20. package/dist/lite/features/changeTracking.js +13 -0
  21. package/dist/lite/features/selectSearch.cjs +1 -0
  22. package/dist/lite/features/selectSearch.js +2 -0
  23. package/dist/lite/selectSearch-B1OSCMbw.js +204 -0
  24. package/dist/lite/selectSearch-BIeA4Xhg.cjs +1 -0
  25. package/dist/lite/useTopAlignedInput-BAL_0rjw.cjs +1 -0
  26. package/dist/lite/useTopAlignedInput-CAagCTj-.js +37 -0
  27. package/dist/lite.cjs +1 -1
  28. package/dist/lite.d.ts +2 -0
  29. package/dist/lite.js +15 -13
  30. package/dist/model/gridTypes.d.ts +2 -0
  31. package/dist/style.css +1 -1
  32. package/dist/style.layer.css +1 -1
  33. package/dist/themes/mantine.css +2 -1
  34. package/dist/view/DefaultGridBottomBar.d.ts +2 -1
  35. package/dist/view/GridBodyLayer.d.ts +11 -2
  36. package/package.json +2 -2
  37. package/skills/spreadsheet-grid/SKILL.md +4 -2
  38. package/dist/lite/createSpreadsheetGrid-CvNJLEhA.js +0 -4536
  39. package/dist/lite/createSpreadsheetGrid-iAPCKb03.cjs +0 -6
@@ -4,7 +4,7 @@ type SelectCellEditorProps = {
4
4
  ariaLabel?: string;
5
5
  options: readonly GridSelectEditorOption[];
6
6
  value: unknown;
7
- onCommit: (value: unknown, direction?: EditorCommitDirection) => EditorCommitResult | void;
7
+ onCommit: (value: unknown, direction?: EditorCommitDirection, option?: GridSelectEditorOption) => EditorCommitResult | void;
8
8
  onCancel: () => void;
9
9
  onRegisterFlush?: ((flush: (() => void) | null) => void) | undefined;
10
10
  align?: 'left' | 'center' | 'right';
@@ -0,0 +1,2 @@
1
+ import type { GridFeature } from './types.js';
2
+ export declare const changeTrackingFeature: GridFeature<"changeTracking">;
@@ -0,0 +1,2 @@
1
+ import type { GridFeature } from './types.js';
2
+ export declare const selectSearchFeature: GridFeature<"selectSearch">;
@@ -10,16 +10,18 @@ import type { buildColumnGroupTree, columnHeaderSpanRows, createColumnChooserDro
10
10
  import type { ColumnAutosizeRunnerArgs } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/columnAutosizeRunner';
11
11
  import type { DateRolloverStore } from '@ishibashi0112/spreadsheet-grid-core/internal/controllers/dateRolloverStore';
12
12
  import type { RowOrder } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/filtering';
13
+ import type { buildRevertMenuItems, describeUnsavedCell, formatUnsavedSummary } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/changeTracking';
13
14
  import type { ResolvedGridLocaleText } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText';
14
15
  import type { GridUiAction } from '@ishibashi0112/spreadsheet-grid-core/internal/model/gridActions';
15
16
  import type { ColumnPane, GridPaneLayout } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/geometry';
16
17
  import type { DetailRowExtra, RowMetrics } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/verticalGeometry';
17
- import type { CellCoord, ColumnFilterValue, GridColumn, GridContextMenuItem, GridContextMenuParams, GridResolvedSlots, GridSelection, GridSelectionAggregates, GridLocaleText, GridUiState, GlobalFilterStatus, GridGlobalFilterMatch, GridRowKey, RowModel, SpreadsheetGridProps } from '../model/gridTypes.js';
18
+ import type { CellCoord, ColumnFilterValue, GridColumn, GridContextMenuItem, GridContextMenuParams, GridContextMenuTarget, GridResolvedSlots, GridSelection, GridSelectionAggregates, GridLocaleText, GridUiState, GlobalFilterStatus, GridGlobalFilterMatch, GridRowKey, RowModel, SpreadsheetGridProps } from '../model/gridTypes.js';
18
19
  import type { GridFindBar } from '../view/GridFindBar.js';
19
20
  import type { GridScrollHint } from '../view/GridScrollHint.js';
20
21
  import type { GridTotalRow } from '../view/GridTotalRow.js';
21
22
  import type { GridPinnedRows } from '../view/GridPinnedRows.js';
22
23
  import type { GridColumnGroupHeader } from '../view/GridColumnGroupHeader.js';
24
+ import type { SearchSelectCellEditor } from '../editors/SearchSelectCellEditor.js';
23
25
  import type { GridBodyLabelRow } from '../view/GridBodyLabelRow.js';
24
26
  import type { GridBodyGroupRow } from '../view/GridBodyGroupRow.js';
25
27
  import type { GridStickyLabelLayer } from '../view/GridStickyLabelLayer.js';
@@ -202,6 +204,7 @@ export type BodyContextMenuInput<T> = {
202
204
  orderedColumns: GridColumn<T>[];
203
205
  selection: GridSelection;
204
206
  activeCell: CellCoord | null;
207
+ resolveRevertItems?: ((target: GridContextMenuTarget<T>, isTargetSelected: boolean) => GridContextMenuItem[]) | undefined;
205
208
  };
206
209
  export type CellContextMenuInput<T> = Omit<BodyContextMenuInput<T>, 'event'> & {
207
210
  cell: CellCoord;
@@ -271,6 +274,14 @@ export type ReactGridFeatures = {
271
274
  createColumnChooserDropClamp: typeof createColumnChooserDropClamp;
272
275
  ColumnGroupHeader: typeof GridColumnGroupHeader;
273
276
  } | undefined;
277
+ selectSearch?: FeatureLocaleDefaults & {
278
+ SearchSelectCellEditor: typeof SearchSelectCellEditor;
279
+ } | undefined;
280
+ changeTracking?: NonNullable<GridCoreFeatures['changeTracking']> & FeatureLocaleDefaults & {
281
+ describeUnsavedCell: typeof describeUnsavedCell;
282
+ formatUnsavedSummary: typeof formatUnsavedSummary;
283
+ buildRevertMenuItems: typeof buildRevertMenuItems;
284
+ } | undefined;
274
285
  conditionalFormat?: NonNullable<GridCoreFeatures['conditionalFormat']> & ConditionalFormatCellResolvers & {
275
286
  resolveChipSpec: typeof resolveChipSpec;
276
287
  GridChip: typeof GridChip;
@@ -1,6 +1,6 @@
1
- import type { GlobalFilterStatus, GridColumn, GridSelectionAggregates, GridUiState, SpreadsheetGridSlotContext } from '../model/gridTypes.js';
1
+ import type { GlobalFilterStatus, GridChangesSummary, GridColumn, GridSelectionAggregates, GridUiState, SpreadsheetGridSlotContext } from '../model/gridTypes.js';
2
2
  import type { ResolvedGridLocaleText } from '@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText';
3
- type GridSlotContextBase<T> = Omit<SpreadsheetGridSlotContext<T>, 'setGlobalFilterText' | 'derivedSummary' | 'filteredRows' | 'globalFilterStatus' | 'globalFilterProgress' | 'selectionAggregates'>;
3
+ type GridSlotContextBase<T> = Omit<SpreadsheetGridSlotContext<T>, 'setGlobalFilterText' | 'derivedSummary' | 'filteredRows' | 'globalFilterStatus' | 'globalFilterProgress' | 'selectionAggregates' | 'unsavedChanges'>;
4
4
  type UseGridBarContextArgs<T> = {
5
5
  rows: T[];
6
6
  localeTexts: ResolvedGridLocaleText;
@@ -16,10 +16,11 @@ type UseGridBarContextArgs<T> = {
16
16
  globalFilterStatus: GlobalFilterStatus;
17
17
  globalFilterProgress: number;
18
18
  selectionAggregates?: GridSelectionAggregates | null;
19
+ unsavedChanges?: GridChangesSummary | null;
19
20
  filtersApplied?: boolean;
20
21
  columnTitles?: ReadonlyMap<string, string> | null;
21
22
  };
22
- export declare const useGridBarContext: <T>({ rows, localeTexts, viewRowCount, totalRowCount, getFilteredRows, columns, visibleColumns, orderedColumns, labelViewIndexes, uiState, setGlobalFilterText, globalFilterStatus, globalFilterProgress, selectionAggregates, filtersApplied, columnTitles, }: UseGridBarContextArgs<T>) => {
23
+ export declare const useGridBarContext: <T>({ rows, localeTexts, viewRowCount, totalRowCount, getFilteredRows, columns, visibleColumns, orderedColumns, labelViewIndexes, uiState, setGlobalFilterText, globalFilterStatus, globalFilterProgress, selectionAggregates, unsavedChanges, filtersApplied, columnTitles, }: UseGridBarContextArgs<T>) => {
23
24
  slotContextBase: GridSlotContextBase<T>;
24
25
  derivedSummary: import("@ishibashi0112/spreadsheet-grid-core").SpreadsheetGridDerivedSummary;
25
26
  slotContext: SpreadsheetGridSlotContext<T>;
@@ -2,7 +2,7 @@ import { type EditController, type EditControllerArgs } from '@ishibashi0112/spr
2
2
  export declare const useGridEditController: <T extends object>(args: EditControllerArgs<T>, created?: EditController<T>) => {
3
3
  activateSingleCell: (cell: import("@ishibashi0112/spreadsheet-grid-core").CellCoord) => void;
4
4
  startEditWithValue: (cell: import("@ishibashi0112/spreadsheet-grid-core").CellCoord, initialValue: string) => void;
5
- commitEdit: (committedValue: unknown, direction?: import("@ishibashi0112/spreadsheet-grid-core").EditorCommitDirection) => import("@ishibashi0112/spreadsheet-grid-core").EditorCommitResult;
5
+ commitEdit: (committedValue: unknown, direction?: import("@ishibashi0112/spreadsheet-grid-core").EditorCommitDirection, option?: import("@ishibashi0112/spreadsheet-grid-core").GridSelectEditorOption, forwardText?: string) => import("@ishibashi0112/spreadsheet-grid-core").EditorCommitResult;
6
6
  cancelEdit: () => void;
7
7
  registerDraftFlush: (flush: (() => void) | null) => void;
8
8
  };