@iyulab/data-components 0.18.0 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.19.0] - 2026-08-31
4
+
5
+ ### Fixed
6
+
7
+ - 🔴**`u-simple-sheet`: `Ctrl`/`Cmd` + `C` never copied anything.** Cell selection is internal
8
+ state, not a real browser text selection (`Range`), so the native `copy` DOM event this
9
+ component relied on never fired — every browser requires an actual selection for that event to
10
+ exist. The copy logic itself (TSV serialization, `clipboardData.setData`) was fully implemented
11
+ and correctly bound; it was simply unreachable from the keyboard. `Ctrl`/`Cmd` + `C`/`V` now
12
+ detect the key combination explicitly and call the Clipboard API directly, matching the sibling
13
+ `u-rich-table`'s existing pattern. The native `copy`/`paste` listeners stay as a fallback for an
14
+ actual text-selection scenario.
15
+
16
+ ### Added
17
+
18
+ - **`u-simple-sheet` and `u-rich-table` gained a `clipboard-error` event**
19
+ (`{ action: 'copy' | 'paste', error }`) — a denied clipboard permission or an insecure context
20
+ previously failed the operation silently (an unhandled promise rejection, no signal to the
21
+ consumer). Both components now fire this event instead, matching `flex-table`'s existing
22
+ pattern for the same case.
23
+
3
24
  ## [0.18.0] - 2026-08-19
4
25
 
5
26
  ### Added
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/decorate.js
1
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/decorate.js
2
2
  function __decorate(decorators, target, key, desc) {
3
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.146.0/helpers/esm/decorateMetadata.js
1
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/decorateMetadata.js
2
2
  function __decorateMetadata(k, v) {
3
3
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
4
4
  }
@@ -1,6 +1,6 @@
1
1
  import { styles } from "./UDataView.styles.js";
2
- import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorateMetadata.js";
3
- import __decorate from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
2
+ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorateMetadata.js";
3
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
4
4
  import { html } from "lit";
5
5
  import { customElement, property } from "lit/decorators.js";
6
6
  import "@iyulab/components/dist/components/icon/UIcon.js";
@@ -112,6 +112,11 @@ export declare class USimpleSheet extends UElement {
112
112
  private _onColHeaderMouseDown;
113
113
  /** 행 헤더 클릭 → 전체 행 선택 */
114
114
  private _onRowHeaderMouseDown;
115
+ /** Ctrl+C 경로 전용 — 권한 거부·비보안 컨텍스트 등으로 Clipboard API가 실패해도
116
+ * 조용히 죽지 않고 `clipboard-error`를 낸다(flex-table의 동일 패턴 참조). */
117
+ private _copySelection;
118
+ /** Ctrl+V 경로 전용 — 위와 동일한 이유로 실패를 흡수한다. */
119
+ private _pasteFromClipboard;
115
120
  private _onCopy;
116
121
  private _onPaste;
117
122
  private _selectionToTSV;
@@ -1,5 +1,5 @@
1
- import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorateMetadata.js";
2
- import __decorate from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorateMetadata.js";
2
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
3
3
  import { messages } from "../../utilities/messages.js";
4
4
  import { styles } from "./USimpleSheet.styles.js";
5
5
  import { html } from "lit";
@@ -92,6 +92,20 @@ var USimpleSheet = class USimpleSheet extends UElement {
92
92
  if (!this.readonly && this._sel) this._fillRight();
93
93
  return;
94
94
  }
95
+ if (e.key === "c" || e.key === "C") {
96
+ if (this._sel) {
97
+ e.preventDefault();
98
+ this._copySelection();
99
+ }
100
+ return;
101
+ }
102
+ if (e.key === "v" || e.key === "V") {
103
+ if (!this.readonly && this._sel) {
104
+ e.preventDefault();
105
+ this._pasteFromClipboard();
106
+ }
107
+ return;
108
+ }
95
109
  }
96
110
  if (e.key === "Delete" || e.key === "Backspace") {
97
111
  e.preventDefault();
@@ -625,6 +639,30 @@ var USimpleSheet = class USimpleSheet extends UElement {
625
639
  </td>
626
640
  `;
627
641
  }
642
+ /** Ctrl+C 경로 전용 — 권한 거부·비보안 컨텍스트 등으로 Clipboard API가 실패해도
643
+ * 조용히 죽지 않고 `clipboard-error`를 낸다(flex-table의 동일 패턴 참조). */
644
+ async _copySelection() {
645
+ try {
646
+ await navigator.clipboard.writeText(this._selectionToTSV());
647
+ } catch (err) {
648
+ this.fire("clipboard-error", { detail: {
649
+ action: "copy",
650
+ error: err
651
+ } });
652
+ }
653
+ }
654
+ /** Ctrl+V 경로 전용 — 위와 동일한 이유로 실패를 흡수한다. */
655
+ async _pasteFromClipboard() {
656
+ try {
657
+ const text = await navigator.clipboard.readText();
658
+ this._pasteFromText(text);
659
+ } catch (err) {
660
+ this.fire("clipboard-error", { detail: {
661
+ action: "paste",
662
+ error: err
663
+ } });
664
+ }
665
+ }
628
666
  _selectionToTSV() {
629
667
  if (!this._sel) return "";
630
668
  const { minRow, maxRow, minCol, maxCol } = normalizeRange(this._sel);
@@ -1,5 +1,5 @@
1
- import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorateMetadata.js";
2
- import __decorate from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorateMetadata.js";
2
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
3
3
  import { messages } from "../../utilities/messages.js";
4
4
  import "../u-rich-table/URichTable.js";
5
5
  import { styles } from "./styles.js";
@@ -1,5 +1,5 @@
1
- import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorateMetadata.js";
2
- import __decorate from "../../_virtual/_@oxc-project_runtime@0.146.0/helpers/esm/decorate.js";
1
+ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorateMetadata.js";
2
+ import __decorate from "../../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
3
3
  import { messages } from "../../utilities/messages.js";
4
4
  import { richTableStyles } from "./styles.js";
5
5
  import { parseTSV, toTSV } from "./utils/clipboard.js";
@@ -720,11 +720,35 @@ var URichTable = class URichTable extends LitElement {
720
720
  const rows = this.getSelectedRows();
721
721
  if (rows.length === 0) return;
722
722
  const tsv = toTSV(rows, this.columns);
723
- await navigator.clipboard.writeText(tsv);
723
+ try {
724
+ await navigator.clipboard.writeText(tsv);
725
+ } catch (err) {
726
+ this.dispatchEvent(new CustomEvent("clipboard-error", {
727
+ detail: {
728
+ action: "copy",
729
+ error: err
730
+ },
731
+ bubbles: true,
732
+ composed: true
733
+ }));
734
+ }
724
735
  }
725
736
  async _handlePaste() {
726
737
  if (this.editingCell) return;
727
- const text = await navigator.clipboard.readText();
738
+ let text;
739
+ try {
740
+ text = await navigator.clipboard.readText();
741
+ } catch (err) {
742
+ this.dispatchEvent(new CustomEvent("clipboard-error", {
743
+ detail: {
744
+ action: "paste",
745
+ error: err
746
+ },
747
+ bubbles: true,
748
+ composed: true
749
+ }));
750
+ return;
751
+ }
728
752
  if (!text.trim()) return;
729
753
  const parsedRows = parseTSV(text, this.columns);
730
754
  if (parsedRows.length === 0) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/data-components",
3
3
  "description": "iyulab data visualization components",
4
- "version": "0.18.0",
4
+ "version": "0.19.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "web-components",
@@ -54,6 +54,18 @@ When the user needs to act on rows — selection, inline edit, server paging —
54
54
  | `renderCard` | `(item, index) => TemplateResult` | — | | Replaces card content in `grid` / `list` |
55
55
  | `renderCell` | `(item, column, index) => TemplateResult \| string` | — | | Replaces cell content in `table` |
56
56
 
57
+ ## CSS Custom Properties
58
+
59
+ | Property | Description |
60
+ |----------|-------------|
61
+ | `--dc-muted-color` | Secondary text/labels (default `--u-txt-color-weak`) |
62
+ | `--dc-header-color` | Column/row headers in `mode="table"` (default `--u-txt-color-weak`) |
63
+ | `--dc-empty-color` | Empty-state message (default `--u-txt-color-weak`) |
64
+
65
+ ⚠ Grid gap and card min-width are set via the `gap`/`gridMinWidth` properties (applied as
66
+ inline styles), not custom properties — a stylesheet override of `--gap`/`--min-width` would
67
+ lose to them.
68
+
57
69
  ## DataColumn
58
70
 
59
71
  | Field | Type | Description |
@@ -82,3 +82,9 @@ before any selection.
82
82
  |------|-------------|
83
83
  | `header` | Extra content above the dialog's search bar |
84
84
  | `footer` | Replaces the dialog's default Cancel/Confirm buttons |
85
+
86
+ ## CSS Custom Properties
87
+
88
+ | Property | Description |
89
+ |----------|-------------|
90
+ | `--record-picker-popover-max-height` | Max height of the inline dropdown (default `50vh`) |
@@ -178,6 +178,7 @@ type SelectionChange = RichTableEventMap['selection-change'];
178
178
  | `row-expand` | `{ row, expanded }` | A detail row was opened or closed |
179
179
  | `row-activate` | `{ row, id, via }` | A row was clicked, or `Enter` was pressed on a focused non-editable cell (`via` is `'click'` or `'keyboard'`). Independent of `selectable` — selection is "what to act on", activation is "what to view" |
180
180
  | `paste` | `{ rows }` | TSV was pasted into the grid |
181
+ | `clipboard-error` | `{ action: 'copy' \| 'paste', error }` | `Ctrl`/`Cmd` + `C`/`V` called the Clipboard API and it rejected (denied permission, insecure context) |
181
182
 
182
183
  ## ColumnDef
183
184
 
@@ -207,6 +208,15 @@ type SelectionChange = RichTableEventMap['selection-change'];
207
208
  | `bulk-actions` | Toolbar area shown while rows are selected |
208
209
  | `toolbar-end` | Trailing toolbar area, always shown |
209
210
 
211
+ ## CSS Custom Properties
212
+
213
+ | Property | Description |
214
+ |----------|-------------|
215
+ | `--dc-font-size` | Body cell / edit input font size, shared with the edit control so the size doesn't jump on entering edit mode (default `--u-density`, `13px`) |
216
+ | `--dc-muted-color` | Secondary text — pager caption, disabled affordances (default `--u-txt-color-weak`) |
217
+ | `--dc-icon-color` | Sort indicator, expander, row-menu icon color (default `--u-txt-color-weak`) |
218
+ | `--dc-empty-color` | Empty-state message color (default `--u-txt-color-weak`) |
219
+
210
220
  ## Keyboard
211
221
 
212
222
  | Keys | Action |
@@ -48,6 +48,20 @@ from a server, use [`u-rich-table`](./rich-table.md) instead.
48
48
  | `noMatchMessage` | `string` | `''` | | Text shown when a `strict` dropdown has no match (falls back to the locale string) |
49
49
  | `theme` | `'light'\|'dark'` | — | ✓ | Forces a theme. Unset follows the ancestor `theme`/`data-theme` context (`:host-context`, Chromium only) |
50
50
 
51
+ ## CSS Custom Properties
52
+
53
+ | Property | Description |
54
+ |----------|-------------|
55
+ | `--dc-sheet-height` | Host height (default `400px`) |
56
+ | `--dc-row-height` | Row height, also used as cell `line-height` (default `24px`) |
57
+ | `--dc-cell-padding-block` / `--dc-cell-padding-inline` | Cell and edit-input padding (default `0px` / `6px`) |
58
+ | `--dc-font-size` | Body cell / edit input / dropdown item font size (default `--u-density`, `13px`) |
59
+ | `--dc-header-font-size` | Column header font size (default `12px` — independent of `--dc-font-size`/`--u-density` by design) |
60
+ | `--dc-header-font-weight` | Column header font weight (default `600`) |
61
+ | `--dc-header-color` | Column/row header text color (default `--u-txt-color-weak`) |
62
+ | `--dc-empty-color` | Empty-state message color (default `--u-txt-color-weak`) |
63
+ | `--dc-readonly-color` | Read-only cell text color (default `--u-txt-color-weak`) |
64
+
51
65
  ## Methods
52
66
 
53
67
  | Method | Description |
@@ -72,6 +86,7 @@ from a server, use [`u-rich-table`](./rich-table.md) instead.
72
86
  | Event | `detail` | Fired when |
73
87
  |---|---|---|
74
88
  | `change` | `{ data: string[][] }` | Any edit, paste, fill or `setCell()` committed a value |
89
+ | `clipboard-error` | `{ action: 'copy' \| 'paste', error: unknown }` | `Ctrl`/`Cmd` + `C`/`V` called the Clipboard API and it rejected (denied permission, insecure context) |
75
90
 
76
91
  ## SheetColumn
77
92