simple-table-core 4.0.0 → 4.0.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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/src/utils/loadingPlaceholderUtils.d.ts +11 -0
- package/dist/cjs/src/utils/propSyncEqual.d.ts +2 -2
- package/dist/cjs/stories/tests/22-LoadingStateTests.stories.d.ts +20 -13
- package/dist/index.es.js +1 -1
- package/dist/src/utils/loadingPlaceholderUtils.d.ts +11 -0
- package/dist/src/utils/propSyncEqual.d.ts +2 -2
- package/dist/stories/tests/22-LoadingStateTests.stories.d.ts +20 -13
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Row from "../types/Row";
|
|
2
|
+
import type { GetRowId } from "../types/GetRowId";
|
|
3
|
+
/** Mark and return a fresh empty row used as an `isLoading` skeleton placeholder. */
|
|
4
|
+
export declare const createLoadingPlaceholderRow: () => Row;
|
|
5
|
+
export declare const isLoadingPlaceholderRow: (row: Row) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Consumer `getRowId` often collapses empty placeholders to the same key.
|
|
8
|
+
* Skip it for placeholders so WeakMap identity / positional ids stay unique.
|
|
9
|
+
*/
|
|
10
|
+
export declare const wrapGetRowIdForLoadingPlaceholders: (getRowId: GetRowId | undefined) => GetRowId | undefined;
|
|
11
|
+
export declare const createLoadingPlaceholderRows: (count: number) => Row[];
|
|
@@ -44,8 +44,8 @@ export declare function collectHeaderAccessors(headers: ReadonlyArray<HeaderStru
|
|
|
44
44
|
* invisible — callers must pass new object identities when data changes.
|
|
45
45
|
*/
|
|
46
46
|
export declare function shallowEqualRow(a: object, b: object): boolean;
|
|
47
|
-
/** Compatible with `GetRowId`; return may be
|
|
48
|
-
export type GetRowIdLike = (params: GetRowIdParams) => string | number | undefined;
|
|
47
|
+
/** Compatible with `GetRowId`; return may be nullish for sync helpers. */
|
|
48
|
+
export type GetRowIdLike = (params: GetRowIdParams) => string | number | null | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* Above this length, skip per-field shallow compares when row object identity
|
|
51
51
|
* differs. Same-array-ref and same-row-object cases stay O(1) / O(n) pointer
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LOADING STATE TESTS
|
|
3
|
-
* Tests for isLoading prop - skeleton loaders
|
|
3
|
+
* Tests for isLoading prop - skeleton loaders when data is loading.
|
|
4
4
|
*/
|
|
5
5
|
import type { Meta } from "@storybook/html";
|
|
6
6
|
import { SimpleTableVanilla } from "../../src/index";
|
|
7
7
|
declare const meta: Meta;
|
|
8
8
|
export default meta;
|
|
9
|
+
/**
|
|
10
|
+
* Rows + isLoading: real data stays visible and skeleton rows are appended below.
|
|
11
|
+
*/
|
|
9
12
|
export declare const LoadingStateShowsSkeletons: {
|
|
10
13
|
render: () => HTMLDivElement & {
|
|
11
14
|
_table?: SimpleTableVanilla | undefined;
|
|
@@ -54,14 +57,20 @@ export declare const LoadingToLoadedRemovesStaleCells: {
|
|
|
54
57
|
}) => Promise<void>;
|
|
55
58
|
};
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
* Pagination / infinite-scroll style: loaded rows stay put; skeletons append;
|
|
61
|
+
* clearing loading with more rows removes skeletons.
|
|
62
|
+
*/
|
|
63
|
+
export declare const LoadingAppendsSkeletonsUnderLoadedRows: {
|
|
64
|
+
render: () => HTMLDivElement & {
|
|
65
|
+
_table?: SimpleTableVanilla | undefined;
|
|
66
|
+
};
|
|
67
|
+
play: ({ canvasElement }: {
|
|
68
|
+
canvasElement: HTMLElement;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Entering loading with existing expandable rows keeps their chevrons/content
|
|
73
|
+
* and only appends skeleton placeholder rows below.
|
|
65
74
|
*/
|
|
66
75
|
export declare const ExpandableCellsShowSkeletonWhenEnteringLoading: {
|
|
67
76
|
render: () => HTMLDivElement & {
|
|
@@ -72,10 +81,8 @@ export declare const ExpandableCellsShowSkeletonWhenEnteringLoading: {
|
|
|
72
81
|
}) => Promise<void>;
|
|
73
82
|
};
|
|
74
83
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* expandable cells, so they stay stuck on the skeleton instead of restoring
|
|
78
|
-
* the expand icon + value.
|
|
84
|
+
* Full-table skeleton (empty + loading) then resolve expandable rows: expandable
|
|
85
|
+
* cells must restore chevron + value instead of staying stuck on skeletons.
|
|
79
86
|
*/
|
|
80
87
|
export declare const ExpandableCellsRestoreContentWhenLeavingLoading: {
|
|
81
88
|
render: () => HTMLDivElement & {
|