@kahitsan/ksui 0.17.1 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kahitsan/ksui",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "ksui is a standalone set of SolidJS UI components for KahitSan/Hilinga and any SolidJS app. Published to the public npm registry and consumed as a normal dependency. Ships source under a `solid` export condition so the consumer's vite-plugin-solid compiles it with only solid-js externalized; it depends on nothing but solid-js + lucide-solid and injects its own CSS.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -48,4 +48,14 @@ describe("DataTable (client-side mode)", () => {
48
48
  ));
49
49
  expect(screen.getByPlaceholderText("Filter...")).toBeTruthy();
50
50
  });
51
+
52
+ it("respects pageLength: only that many rows render on page 1 (client-side)", () => {
53
+ render(() => (
54
+ <DataTable columns={COLUMNS} data={DATA} paging={true} pageLength={2} />
55
+ ));
56
+ // page size 2 over 3 rows → page 1 shows the first two, the third is on page 2.
57
+ expect(screen.getByText("Alpha")).toBeTruthy();
58
+ expect(screen.getByText("Beta")).toBeTruthy();
59
+ expect(screen.queryByText("Gamma")).toBeNull();
60
+ });
51
61
  });
@@ -294,6 +294,8 @@ export function ResourcePage<T extends ResourceRow>(
294
294
  searching={true}
295
295
  ordering={true}
296
296
  paging={true}
297
+ pageLength={spec.pageLength}
298
+ lengthMenu={spec.lengthMenu ? [...spec.lengthMenu] : undefined}
297
299
  searchPlaceholder={spec.labels.searchPlaceholder}
298
300
  emptyMessage={spec.labels.empty}
299
301
  noResultsMessage={spec.labels.noResults}
@@ -156,6 +156,13 @@ export interface ResourceUiSpec {
156
156
  };
157
157
  /** data-testid prefix (e.g. "things" → things-add-btn, things-row-3). */
158
158
  readonly testIdPrefix: string;
159
+ /** Initial rows-per-page for the list (DataTable `pageLength`). When omitted,
160
+ * DataTable's own default (10) applies. A host can lower a resolved user/workspace
161
+ * preference in here (the platform's route-settings `pageSize`). */
162
+ readonly pageLength?: number;
163
+ /** The rows-per-page options offered in the list's page-size menu (DataTable
164
+ * `lengthMenu`). When omitted, DataTable's default ([10, 25, 50, 100]) applies. */
165
+ readonly lengthMenu?: readonly number[];
159
166
  }
160
167
 
161
168
  // ---- derived endpoints -----------------------------------------------------