beautiful-grid 1.0.15 → 1.0.17

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/README.md CHANGED
@@ -583,6 +583,17 @@ const columns: BGridColumn<Item>[] = [
583
583
  ];
584
584
  ```
585
585
 
586
+ `createSelectEditorPlugin` options:
587
+ - `options`: List of `{ value, label, disabled? }` entries.
588
+ - `allowCustomValue?: boolean`: Set `true` to allow pasting arbitrary values not present in `options` (default: `false`, rejecting unlisted values with `parseValueFailed`). Automatically preserves numeric types when option values are numeric.
589
+ - `copyMode?: 'label' | 'value'`: Controls clipboard copy output (`'label'` by default when label is text, or `'value'`). Matching during paste prioritizes the configured `copyMode` to prevent label/value collisions.
590
+ - `allowEmpty?: boolean`: Set `true` to allow clearing cell values when pasting empty text (default: `false`).
591
+ - `emptyValue?: Value | null`: Value written when empty text is pasted with `allowEmpty: true` (default: `''`).
592
+ - `allowDisabledOptions?: boolean`: Set `true` to allow pasting options marked `disabled: true` (default: `false`, rejecting disabled options).
593
+ - `parseClipboardText?`: Override custom clipboard parsing and validation logic.
594
+ - `getClipboardText?`: Override custom clipboard text retrieval logic.
595
+ - `openOnMount?: boolean`: Automatically opens native picker on editor activation (default: `true`).
596
+
586
597
  #### Editor Icons (Lookup & Quick Triggers)
587
598
 
588
599
  Add inline trigger icons beside cell values using `editorIcon`:
@@ -649,35 +660,40 @@ Configure active cell handling and keyboard behavior with `cellNavigationOptions
649
660
 
650
661
  ---
651
662
 
652
- ### 5. Cell Selection & Clipboard (Excel-compatible)
663
+ ### 5. Cell Range Selection & Clipboard Integration
653
664
 
654
665
  Cell range selection and clipboard copy/paste are enabled by default.
655
666
 
656
667
  ```typescript jsx
657
668
  <BGrid
658
- width={800}
659
- height={400}
660
- columns={columns}
661
669
  data={data}
670
+ columns={columns}
671
+ editable
662
672
  rowKey='id'
663
673
  cellSelectionOptions={{
664
674
  enabled: true,
675
+ multiSelectFocusMode: 'first',
665
676
  clearOnEscape: true,
666
677
  clearOnOutsideClick: true,
667
678
  maxClipboardCells: 100000,
668
- maxClipboardTextLength: 8 * 1024 * 1024,
669
- onCopyError: error => console.warn('Copy skipped:', error),
670
- onPasteError: error => console.warn('Paste failed:', error),
671
- createRowOnPaste: ({ rowIndex, clipboardRow, columns }) => ({
679
+ createRowOnPaste: ({ rowIndex, clipboardRow }) => ({
680
+ status: BGridDataItemStatus.new,
672
681
  values: createNewRowModel(clipboardRow),
673
682
  }),
674
683
  }}
675
684
  />
676
685
  ```
677
686
 
678
- - `Ctrl+C` / `Cmd+C`: Copies selected cells as Tab-separated (`\t`) values and CRLF (`\r\n`) lines, directly pasteable into Excel or Google Sheets.
679
- - `Ctrl+V` / `Cmd+V`: Pastes clipboard matrix starting from the focused cell across editable columns.
680
- - Customize copied text on a per-column basis with `getClipboardText: ({ value, values }) => string`.
687
+ - `Ctrl+C` / `Cmd+C`: Copies selected cells as Tab-separated (`\t`) values and CRLF (`\r\n`) lines, directly pasteable into Excel or Google Sheets. Columns configured with `createSelectEditorPlugin` copy the display `label` by default.
688
+ - `Ctrl+V` / `Cmd+V`: Pastes clipboard values across editable columns:
689
+ - **Single cell fill**: Pasting a 1×1 value into a multi-cell selection fills every cell in the selected range.
690
+ - **Pattern tiling (Repeat)**: Pasting an $n \times m$ matrix into an $N \times M$ selection whose dimensions are exact integer multiples ($N \pmod n = 0$ and $M \pmod m = 0$) tiles/repeats the pattern across the entire selection.
691
+ - **Non-multiple fallback**: When the selection is not an exact multiple, the matrix pastes once starting at the top-left of the selected range (or focused cell if no range).
692
+ - `multiSelectFocusMode: 'last'` makes the last cell selected by a drag the active cell. The default is `'first'` for backward compatibility.
693
+ - **Paste validation & editor protection**:
694
+ - `createSelectEditorPlugin` validates pasted text against option values and string labels, mapping labels back to values with $O(1)$ indexed lookup.
695
+ - By default, unlisted values and disabled options are rejected and reported as `parseValueFailed` through `onPasteError`, preventing data corruption. Set `allowCustomValue: true` on the select editor plugin to allow arbitrary inputs.
696
+ - Customize copied text on a per-column basis with `getClipboardText: ({ value, values }) => string`, or restore/validate custom types with `parseClipboardText: (text, context) => parsedValue`.
681
697
 
682
698
  ---
683
699
 
@@ -1118,7 +1134,7 @@ Below is a categorized reference of `<BGrid>` props. For exact TypeScript types,
1118
1134
  | `onChangeData` | `(index, columnIndex, item, column, meta) => void` | - | Callback fired after a cell edit commits. |
1119
1135
  | `onClick` | `(params: BGridClickParams<T>) => void` | - | Cell click callback. |
1120
1136
  | `cellNavigationOptions` | `BGridCellNavigationOptions` | - | Active cell focus, arrow key navigation, and repeat options. |
1121
- | `cellSelectionOptions` | `BGridCellSelectionOptions` | - | Range drag selection and clipboard copy/paste options. |
1137
+ | `cellSelectionOptions` | `BGridCellSelectionOptions` | - | Range drag selection, active-cell focus, and clipboard copy/paste options. |
1122
1138
 
1123
1139
  #### Additional Features & Overlays
1124
1140
 
@@ -386,7 +386,7 @@ function CellTextEditorGateway(_a) {
386
386
  event.preventDefault();
387
387
  void commit(event.shiftKey ? 'prev' : 'next');
388
388
  }
389
- }, onBlur: function (event) {
389
+ }, onBlur: function () {
390
390
  if (!cellEditSession || !isTextEditing)
391
391
  return;
392
392
  if (composingRef.current) {
@@ -80,7 +80,6 @@ function ColResizer(_a) {
80
80
  var setColumnResizing = (0, store_1.useAppStore)(function (s) { return s.setColumnResizing; });
81
81
  var endCellEdit = (0, store_1.useAppStore)(function (s) { return s.endCellEdit; });
82
82
  var disabled = (0, store_1.useAppStore)(function (s) { return s.disabled; });
83
- var columnsGroup = (0, store_1.useAppStore)(function (s) { return s.columnsGroup; });
84
83
  var onPointerDownResizerHandle = React.useCallback(function (evt, columnIndex) {
85
84
  var _a, _b;
86
85
  if (disabled)
@@ -48,7 +48,7 @@ var React = __importStar(require("react"));
48
48
  var shallow_1 = require("zustand/react/shallow");
49
49
  var store_1 = require("../store");
50
50
  var number_1 = require("../utils/number");
51
- function Pagination(props) {
51
+ function Pagination() {
52
52
  var _a;
53
53
  // [Selector Group 1] Pagination State - 페이지네이션 상태
54
54
  var _b = (0, store_1.useAppStore)((0, shallow_1.useShallow)(function (s) { return ({