@iyulab/flex-table 0.63.0 → 0.64.1

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.
@@ -1,4 +1,4 @@
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-BufHlQ2v.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-CYi9B4h_.js";
2
2
  import { t as c } from "./locale-Covm8PfH.js";
3
3
  import { i as l, r as u } from "./sorting-BJszwEHw.js";
4
4
  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, u as getCellValue, t as renderCell, l as setCellValue };
@@ -1,9 +1,11 @@
1
1
  import type { SortCriteria } from '../core/sorting.js';
2
- import type { ODataSourceOptions, ODataSourceState } from './source.js';
2
+ import type { ODataSource, ODataSourceOptions, ODataSourceState } from './source.js';
3
3
  import type { FetchAllOptions } from '../core/fetch-all.js';
4
4
  /** `useODataSource` 의 옵션 — 프레임워크 중립 소스(`createODataSource`)의 설정과 같다. `initial*` 은 첫 렌더에서만 읽힌다. */
5
5
  export type UseODataSourceOptions = ODataSourceOptions;
6
6
  export interface UseODataSourceResult<T> extends ODataSourceState<T> {
7
+ /** 이 훅이 묶은 소스 — 목록 골격(`<ListPage source={orders.source}>` · `bindSource`)에 넘긴다. 늘 같은 객체다. */
8
+ source: ODataSource<T>;
7
9
  setPage: (page: number) => void;
8
10
  /** 페이지 크기를 바꾸고 첫 장으로 간다. */
9
11
  setPageSize: (size: number) => void;
package/dist/react.js CHANGED
@@ -1,21 +1,22 @@
1
- import { t as e } from "./flex-table-BufHlQ2v.js";
1
+ import { t as e } from "./flex-table-CYi9B4h_.js";
2
2
  import { n as t, r as n, u as r } from "./fetch-all-DkdNzWrF.js";
3
3
  import { t as i } from "./source-dm6qXFh1.js";
4
4
  import { n as a, t as o } from "./view-DuDIMoXV.js";
5
- import s, { useCallback as c, useEffect as l, useMemo as u, useState as d, useSyncExternalStore as f } from "react";
6
- import { createComponent as p } from "@lit/react";
5
+ import s, { useCallback as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p, useSyncExternalStore as m } from "react";
6
+ import { createComponent as h } from "@lit/react";
7
7
  //#region src/odata/use-odata-source.ts
8
- function m(e, t = {}) {
9
- let [n] = d(() => i(e, t));
8
+ function g(e, t = {}) {
9
+ let [n] = p(() => i(e, t));
10
10
  l(() => {
11
11
  n.update(e, t);
12
12
  });
13
- let r = f(n.subscribe, n.getState, n.getState), a = c((e) => {
13
+ let r = m(n.subscribe, n.getState, n.getState), a = c((e) => {
14
14
  let t = e.detail?.criteria;
15
15
  t && n.setSort(t);
16
16
  }, [n]);
17
17
  return {
18
18
  ...r,
19
+ source: n,
19
20
  setPage: n.setPage,
20
21
  setPageSize: n.setPageSize,
21
22
  onSortChange: a,
@@ -26,66 +27,107 @@ function m(e, t = {}) {
26
27
  }
27
28
  //#endregion
28
29
  //#region src/array/use-array-source.ts
29
- function h(e, t = {}) {
30
- let { pageSize: n = 20, defaultOrderBy: i, initialPage: s = 0, initialSearch: l = "", initialSort: f, columns: p, searchFields: m } = t, h = r({
30
+ function _(e, t = {}) {
31
+ let { pageSize: n = 20, defaultOrderBy: i, initialPage: s = 0, initialSearch: l = "", initialSort: m, columns: h, searchFields: g } = t, _ = r({
31
32
  defaultOrderBy: i,
32
33
  initialPage: s,
33
34
  initialSearch: l,
34
- initialSort: f
35
- }), [g, _] = d(h.page), [v, y] = d(h.sortCriteria), [b, x] = d(h.search), [S, C] = d(n), [w, T] = d(n);
36
- n !== w && (T(n), C(n), _(0));
37
- let E = c((e) => {
38
- C(e), _(0);
39
- }, []), D = c((e) => {
40
- x(e), _(0);
41
- }, []), O = c((e) => {
35
+ initialSort: m
36
+ }), [v, y] = p(_.page), [b, x] = p(_.sortCriteria), [S, C] = p(_.search), [w, T] = p(n), [E, D] = p(n);
37
+ n !== E && (D(n), T(n), y(0));
38
+ let O = c((e) => {
39
+ T(e), y(0);
40
+ }, []), k = c((e) => {
41
+ C(e), y(0);
42
+ }, []), A = c((e) => {
42
43
  let t = e.detail?.criteria;
43
- t && (y(t), _(0));
44
- }, []), k = c(() => {}, []), A = c((t) => a(e, {
45
- search: b,
46
- sortCriteria: v,
47
- columns: p,
48
- searchFields: m
44
+ t && (x(t), y(0));
45
+ }, []), j = c(() => {}, []), M = c((t) => a(e, {
46
+ search: S,
47
+ sortCriteria: b,
48
+ columns: h,
49
+ searchFields: g
49
50
  }, t), [
50
51
  e,
52
+ S,
51
53
  b,
52
- v,
53
- p,
54
- m
55
- ]), { data: j, totalCount: M } = u(() => o(e, {
56
- search: b,
57
- sortCriteria: v,
58
- page: g,
59
- pageSize: S,
60
- columns: p,
61
- searchFields: m
54
+ h,
55
+ g
56
+ ]), { data: N, totalCount: P } = d(() => o(e, {
57
+ search: S,
58
+ sortCriteria: b,
59
+ page: v,
60
+ pageSize: w,
61
+ columns: h,
62
+ searchFields: g
62
63
  }), [
63
64
  e,
65
+ S,
64
66
  b,
65
67
  v,
66
- g,
67
- S,
68
- p,
69
- m
70
- ]), N = M === 0 ? 0 : Math.ceil(M / S) - 1;
71
- return g > N && _(N), {
72
- data: j,
73
- totalCount: M,
68
+ w,
69
+ h,
70
+ g
71
+ ]), F = P === 0 ? 0 : Math.ceil(P / w) - 1;
72
+ v > F && y(F);
73
+ let I = d(() => ({
74
+ data: N,
75
+ totalCount: P,
76
+ loading: !1,
77
+ error: null,
78
+ page: v,
79
+ pageSize: w,
80
+ sortCriteria: b,
81
+ search: S
82
+ }), [
83
+ N,
84
+ P,
85
+ v,
86
+ w,
87
+ b,
88
+ S
89
+ ]), L = f(I), R = f(M), z = f(/* @__PURE__ */ new Set());
90
+ u(() => {
91
+ if (R.current = M, L.current !== I) {
92
+ L.current = I;
93
+ for (let e of [...z.current]) e();
94
+ }
95
+ }, [I, M]);
96
+ let [B] = p(() => ({
97
+ getState: () => L.current,
98
+ subscribe(e) {
99
+ return z.current.add(e), () => {
100
+ z.current.delete(e);
101
+ };
102
+ },
103
+ setPage: y,
104
+ setPageSize: O,
105
+ setSort(e) {
106
+ x(e), y(0);
107
+ },
108
+ setSearch: k,
109
+ refresh: j,
110
+ fetchAll: (e) => R.current(e)
111
+ }));
112
+ return {
113
+ source: B,
114
+ data: N,
115
+ totalCount: P,
74
116
  loading: !1,
75
117
  error: null,
76
- page: g,
77
- setPage: _,
78
- pageSize: S,
79
- setPageSize: E,
80
- sortCriteria: v,
81
- onSortChange: O,
82
- search: b,
83
- setSearch: D,
84
- refresh: k,
85
- fetchAll: A
118
+ page: v,
119
+ setPage: y,
120
+ pageSize: w,
121
+ setPageSize: O,
122
+ sortCriteria: b,
123
+ onSortChange: A,
124
+ search: S,
125
+ setSearch: k,
126
+ refresh: j,
127
+ fetchAll: M
86
128
  };
87
129
  }
88
- var g = p({
130
+ var v = h({
89
131
  tagName: "flex-table",
90
132
  elementClass: e,
91
133
  react: s,
@@ -124,4 +166,4 @@ var g = p({
124
166
  }
125
167
  });
126
168
  //#endregion
127
- export { g as FlexTableReact, t as RowLimitError, n as SourceRequestError, h as useArraySource, m as useODataSource };
169
+ export { v as FlexTableReact, t as RowLimitError, n as SourceRequestError, _ as useArraySource, g as useODataSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/flex-table",
3
- "version": "0.63.0",
3
+ "version": "0.64.1",
4
4
  "description": "A minimalist, input-centric data grid web component",
5
5
  "type": "module",
6
6
  "main": "./dist/flex-table.js",
@@ -89,8 +89,8 @@
89
89
  "devDependencies": {
90
90
  "@lit/react": "^1.0.8",
91
91
  "@types/node": "^26.1.1",
92
- "@types/react": "^19.2.17",
93
- "@types/react-dom": "^19.2.7",
92
+ "@types/react": "^19.3.0",
93
+ "@types/react-dom": "^19.3.0",
94
94
  "@typescript-eslint/eslint-plugin": "^8.64.0",
95
95
  "@typescript-eslint/parser": "^8.64.0",
96
96
  "@vitest/browser-playwright": "^5.0.0",
@@ -140,7 +140,8 @@ A server-paged table holds one page. Export the list's whole result with
140
140
  Table-less: `exportDataBlob(rows, columns, format, { bom? })` + `downloadBlob(blob, name)` from the root entry.
141
141
 
142
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.
143
+ apply). In XLSX a `date`/`datetime` column's ISO strings become date cells, at the wall-clock time the table shows;
144
+ in CSV/TSV and a copied range they are wall-clock text (`YYYY-MM-DD` · `YYYY-MM-DD HH:mm:ss`), never the UTC string.
144
145
 
145
146
  ## Events
146
147