@iyulab/flex-table 0.50.2 → 0.50.4

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.50.4] - 2026-10-06
4
+
5
+ ### Fixed
6
+
7
+ - **`useODataSource` reports `loading: true` from the first render** until the first response settles. The first
8
+ render used to return `loading: false` with no rows before the request went out, so a screen that shows an empty
9
+ state on `!loading && totalCount === 0` flashed "no results" for a frame on every mount. Mounting with
10
+ `enabled: false` already reported `loading: true`; both paths now follow one rule.
11
+
12
+ ## [0.50.3] - 2026-10-06
13
+
14
+ ### Documentation
15
+
16
+ - README Quick Start looks the table up by its tag (`document.querySelector('flex-table')`), so the element is
17
+ typed in TypeScript and its `columns` / `data` are checked — `getElementById` gives a plain `HTMLElement`.
18
+
3
19
  ## [0.50.2] - 2026-10-06
4
20
 
5
21
  ### Documentation
package/README.md CHANGED
@@ -20,12 +20,12 @@ npm install @iyulab/flex-table
20
20
 
21
21
  ```html
22
22
  <!-- The table is its own scroll container, so give it a height — see Sizing below. -->
23
- <flex-table id="table" style="height: 400px" row-height="32" show-row-numbers></flex-table>
23
+ <flex-table style="height: 400px" row-height="32" show-row-numbers></flex-table>
24
24
 
25
25
  <script type="module">
26
26
  import '@iyulab/flex-table';
27
27
 
28
- const table = document.getElementById('table');
28
+ const table = document.querySelector('flex-table'); // the tag gives the element its type
29
29
 
30
30
  table.columns = [
31
31
  { key: 'name', label: 'Name', type: 'text', width: 200 },
@@ -815,7 +815,7 @@ The hook returns:
815
815
  | Field | Description |
816
816
  |---|---|
817
817
  | `data` / `totalCount` | Current page rows and the server's total (`@odata.count`). When the server pages its response (`@odata.nextLink`, e.g. a page size smaller than `pageSize`), the hook follows the link until the page is filled; a link outside the request's origin, or one that returns to a page already read, is reported through `error` instead of showing a short page |
818
- | `loading` | A request is in flight |
818
+ | `loading` | A request is in flight, or none has answered yet (true from the first render until the first response settles, and while `enabled: false`) |
819
819
  | `error` | The last failed request, or `null`: `{ message, status?, code?, details?, body? }`. **Render `error.message`** — a failed request otherwise leaves the grid silently empty. Branch on `status` (HTTP), `code` (the server's rejection code, OData `error.code`) and `details` (OData `error.details`); `body` is the parsed response (or its text). A failure with no response — a network error, or a `@odata.nextLink` the hook refused — has a `message` only |
820
820
  | `page` / `setPage` | Zero-based page index |
821
821
  | `sortCriteria` / `onSortChange` | Bind `onSortChange` to the table's `sort-change` event |
@@ -43,6 +43,10 @@ export interface UseODataSourceOptions {
43
43
  export interface UseODataSourceResult<T> {
44
44
  data: T[];
45
45
  totalCount: number;
46
+ /**
47
+ * 조회 중이거나 아직 한 번도 답을 받지 않았으면 `true` — 첫 렌더부터 첫 응답(성공·실패)이 정착할 때까지,
48
+ * 그리고 `enabled: false` 인 동안. 그래서 `!loading && totalCount === 0` 이 곧 «결과 없음» 이다.
49
+ */
46
50
  loading: boolean;
47
51
  /**
48
52
  * 마지막 요청의 실패, 없으면 `null`. 화면에는 `error.message` 를 그린다. «어떤 실패인가» 는
package/dist/react.js CHANGED
@@ -40,7 +40,7 @@ function m(e) {
40
40
  //#endregion
41
41
  //#region src/odata/use-odata-source.ts
42
42
  function h(e, r = {}) {
43
- let { pageSize: i = 20, defaultOrderBy: s, initialPage: u = 0, initialSearch: f = "", initialSort: h, fixedFilter: g, baseUrl: _, fetcher: v = fetch, onUnauthorized: y, enabled: b = !0 } = r, x = g ? JSON.stringify(g) : "", [S, C] = l([]), [w, T] = l(0), [E, D] = l(!1), [O, k] = l(null), A = t({
43
+ let { pageSize: i = 20, defaultOrderBy: s, initialPage: u = 0, initialSearch: f = "", initialSort: h, fixedFilter: g, baseUrl: _, fetcher: v = fetch, onUnauthorized: y, enabled: b = !0 } = r, x = g ? JSON.stringify(g) : "", [S, C] = l([]), [w, T] = l(0), [E, D] = l(!0), [O, k] = l(null), A = t({
44
44
  defaultOrderBy: s,
45
45
  initialPage: u,
46
46
  initialSearch: f,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/flex-table",
3
- "version": "0.50.2",
3
+ "version": "0.50.4",
4
4
  "description": "A minimalist, input-centric data grid web component",
5
5
  "type": "module",
6
6
  "main": "./dist/flex-table.js",
@@ -110,7 +110,7 @@ function Orders() {
110
110
  | Field | Notes |
111
111
  |---|---|
112
112
  | `data`, `totalCount` | Current page and `@odata.count`; `@odata.nextLink` is followed to fill a page |
113
- | `loading` | Request in flight |
113
+ | `loading` | Request in flight, or no answer yet (true from the first render until the first response settles, and while `enabled: false`) — so `!loading && totalCount === 0` means "no results" |
114
114
  | `error` | `SourceError \| null` — `{ message, status?, code?, details?, body? }`; render `error.message`, branch on `status` / `code` (OData `error.code`) |
115
115
  | `page`, `setPage` | Zero-based |
116
116
  | `sortCriteria`, `onSortChange` | Pass `onSortChange` to the table's `sort-change` (resets to page 0) |