@iyulab/flex-table 0.60.0 → 0.62.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.
@@ -11,12 +11,18 @@ import type { TemplateResult } from 'lit';
11
11
  * 표 내보내기의 대상 — 선택 범위(`selectionOnly`) 또는 바깥에서 준 행(`rows`, 예: `await source.fetchAll()`). 둘은
12
12
  * 함께 쓰지 않는다(바깥 행에는 표의 선택 범위가 없다).
13
13
  */
14
- export type TableExportOptions = {
14
+ export type TableExportOptions = ({
15
15
  selectionOnly?: boolean;
16
16
  rows?: undefined;
17
17
  } | {
18
18
  rows: DataRow[];
19
19
  selectionOnly?: undefined;
20
+ }) & {
21
+ /**
22
+ * CSV/TSV — start with a UTF-8 byte order mark so spreadsheet apps (Excel) read non-ASCII text correctly.
23
+ * Default: `true` for `exportToFile` (a file a person opens), `false` for `exportToString`/`exportToBlob`.
24
+ */
25
+ bom?: boolean;
20
26
  };
21
27
  export declare class FlexTable extends LitElement {
22
28
  static styles: import("lit").CSSResult;
@@ -199,7 +205,14 @@ export declare class FlexTable extends LitElement {
199
205
  get canRedo(): boolean;
200
206
  get activeCell(): CellPosition | null;
201
207
  get editingCell(): CellPosition | null;
208
+ /**
209
+ * The active sort — `[{ key, direction }]`, the first is the primary. Setting it shows that sort (the header
210
+ * indicators) and, in client mode, re-sorts; it does not fire `sort-change`, which is the user's act. A data
211
+ * source's `sortCriteria` goes here as is — the initial or restored sort of a server-paged list, the same as
212
+ * `u-rich-table`'s `sortCriteria`.
213
+ */
202
214
  get sortCriteria(): SortCriteria[];
215
+ set sortCriteria(criteria: SortCriteria[]);
203
216
  /** Number of rows after filtering (before pagination). */
204
217
  get filteredRowCount(): number;
205
218
  /**
@@ -1,3 +1,3 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./flex-table-kM69-hSo.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./flex-table-CbBVOhRQ.js";
2
2
  import { t as c } from "./locale-D9g0ksXq.js";
3
3
  export { s as FlexTable, o as RowSelectionState, i as UndoStack, a as downloadBlob, r as effectiveAlign, n as exportData, e as exportDataBlob, c as flexTableLocale, t as renderCell };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { ColumnFilter, FilterPredicate, FilterErrorCallback } from './core/
9
9
  export { RowSelectionState } from './core/row-selection.js';
10
10
  export { UndoStack } from './core/undo.js';
11
11
  export type { UndoAction } from './core/undo.js';
12
- export type { ExportFormat } from './export/export.js';
12
+ export type { ExportFormat, ExportOptions } from './export/export.js';
13
13
  export { exportData, exportDataBlob, downloadBlob } from './export/export.js';
14
14
  export { renderCell } from './renderers/cell-renderer.js';
15
15
  export { flexTableLocale } from './locale.js';
@@ -102,6 +102,12 @@ export interface ColumnDefinition<T = DataRow> {
102
102
  * - Function: custom formatter receiving (value, row, col)
103
103
  */
104
104
  format?: string | ((value: unknown, row: T, col: ColumnDefinition<T>) => string);
105
+ /**
106
+ * The value export writes for this column — CSV/TSV/JSON/XLSX. Without it export writes the raw value (as
107
+ * `format`/`render` do not apply to export). Give it where the file should say what the list shows, e.g. a status
108
+ * code shown as a label: `exportValue: (v) => statusLabel(v)`. A returned `Date` becomes a date cell in XLSX.
109
+ */
110
+ exportValue?: (value: unknown, row: T) => string | number | boolean | Date | null | undefined;
105
111
  /** Per-column conditional formatting rules applied during cell rendering */
106
112
  conditionalRules?: ConditionalRule<T>[];
107
113
  /**
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./flex-table-kM69-hSo.js";
1
+ import { t as e } from "./flex-table-CbBVOhRQ.js";
2
2
  import { n as t, r as n, u as r } from "./fetch-all-J37bOtgc.js";
3
3
  import { t as i } from "./source-DNPtWmC3.js";
4
4
  import { n as a, t as o } from "./view-BtoXdUGF.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/flex-table",
3
- "version": "0.60.0",
3
+ "version": "0.62.0",
4
4
  "description": "A minimalist, input-centric data grid web component",
5
5
  "type": "module",
6
6
  "main": "./dist/flex-table.js",
@@ -40,7 +40,7 @@ Replacing `data` with the same array reference does not trigger the clear-on-cha
40
40
  | `visibleColumns` | `ColumnDefinition[]` (non-hidden) |
41
41
  | `filteredRowCount` | `number` |
42
42
  | `filterKeys` | `string[]` |
43
- | `sortCriteria` | `SortCriteria[]` — `{ key, direction: 'asc' \| 'desc' }` |
43
+ | `sortCriteria` | `SortCriteria[]` — `{ key, direction: 'asc' \| 'desc' }`. Settable too (no `sort-change`): a source's sort goes in as is |
44
44
  | `activeCell` / `editingCell` | `CellPosition \| null` — `{ row, col }` |
45
45
  | `canUndo` / `canRedo` | `boolean` |
46
46
 
@@ -133,11 +133,14 @@ Enter/Escape and blur-to-commit behavior.
133
133
  | `importFromFile(file)` | `Promise<void>`; `.xlsx`, `.csv`, `.tsv`; fires `data-import` |
134
134
  | `exportToString(format, { selectionOnly? } \| { rows })` | `string \| Uint8Array`; format `'csv' \| 'tsv' \| 'json' \| 'xlsx'` (xlsx returns uncompressed bytes — synchronous). `rows`: export these rows with the visible columns |
135
135
  | `exportToBlob(format, options?)` | `Promise<Blob>` typed with the format's MIME; xlsx is DEFLATE-compressed |
136
- | `exportToFile(format, filename?, options?)` | `Promise<void>` — triggers a download (xlsx compressed) |
136
+ | `exportToFile(format, filename?, options?)` | `Promise<void>` — triggers a download (xlsx compressed); CSV/TSV start with a UTF-8 BOM unless `{ bom: false }` |
137
137
 
138
138
  A server-paged table holds one page. Export the list's whole result with
139
139
  `table.exportToFile('xlsx', 'x.xlsx', { rows: await source.fetchAll() })` — never the table's own rows there.
140
- Table-less: `exportDataBlob(rows, columns, format)` + `downloadBlob(blob, name)` from the root entry.
140
+ Table-less: `exportDataBlob(rows, columns, format, { bom? })` + `downloadBlob(blob, name)` from the root entry.
141
+
142
+ A column's `exportValue(value, row)` is what export writes for it (default: the raw value — `format`/`render` do not
143
+ apply). In XLSX a `date`/`datetime` column's ISO strings become date cells, at the wall-clock time the table shows.
141
144
 
142
145
  ## Events
143
146