@object-ui/plugin-list 3.1.1 → 3.1.3
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +22 -0
- package/dist/index.js +83688 -44011
- package/dist/index.umd.cjs +114 -45
- package/dist/plugin-list.css +1 -1
- package/package.json +8 -8
- package/src/ObjectGallery.tsx +1 -1
- package/src/__tests__/DataFetch.test.tsx +8 -8
- package/src/__tests__/Export.test.tsx +3 -3
- package/src/__tests__/ListView.test.tsx +24 -24
- package/src/registration.test.tsx +0 -8
|
@@ -40,7 +40,7 @@ describe('ListView Data Fetch', () => {
|
|
|
40
40
|
it('shows data limit warning when items reach the page size', async () => {
|
|
41
41
|
// Generate exactly 100 items (default page size)
|
|
42
42
|
const items = Array.from({ length: 100 }, (_, i) => ({
|
|
43
|
-
|
|
43
|
+
id: String(i),
|
|
44
44
|
name: `Item ${i}`,
|
|
45
45
|
}));
|
|
46
46
|
mockDataSource.find.mockResolvedValue(items);
|
|
@@ -62,8 +62,8 @@ describe('ListView Data Fetch', () => {
|
|
|
62
62
|
|
|
63
63
|
it('does not show data limit warning when items are below page size', async () => {
|
|
64
64
|
const items = [
|
|
65
|
-
{
|
|
66
|
-
{
|
|
65
|
+
{ id: '1', name: 'Alice' },
|
|
66
|
+
{ id: '2', name: 'Bob' },
|
|
67
67
|
];
|
|
68
68
|
mockDataSource.find.mockResolvedValue(items);
|
|
69
69
|
|
|
@@ -84,7 +84,7 @@ describe('ListView Data Fetch', () => {
|
|
|
84
84
|
|
|
85
85
|
it('uses custom page size from schema.pagination', async () => {
|
|
86
86
|
const items = Array.from({ length: 50 }, (_, i) => ({
|
|
87
|
-
|
|
87
|
+
id: String(i),
|
|
88
88
|
name: `Item ${i}`,
|
|
89
89
|
}));
|
|
90
90
|
mockDataSource.find.mockResolvedValue(items);
|
|
@@ -126,7 +126,7 @@ describe('ListView Data Fetch', () => {
|
|
|
126
126
|
},
|
|
127
127
|
});
|
|
128
128
|
mockDataSource.find.mockResolvedValue([
|
|
129
|
-
{
|
|
129
|
+
{ id: '1', name: 'Order 1', customer: { name: 'Alice' }, account: { name: 'Acme' } },
|
|
130
130
|
]);
|
|
131
131
|
|
|
132
132
|
const schema: ListViewSchema = {
|
|
@@ -152,7 +152,7 @@ describe('ListView Data Fetch', () => {
|
|
|
152
152
|
let resolveSchema: (value: any) => void;
|
|
153
153
|
const schemaPromise = new Promise(resolve => { resolveSchema = resolve; });
|
|
154
154
|
mockDataSource.getObjectSchema = vi.fn().mockReturnValue(schemaPromise);
|
|
155
|
-
mockDataSource.find.mockResolvedValue([{
|
|
155
|
+
mockDataSource.find.mockResolvedValue([{ id: '1', name: 'Item 1' }]);
|
|
156
156
|
|
|
157
157
|
const schema: ListViewSchema = {
|
|
158
158
|
type: 'list-view',
|
|
@@ -203,14 +203,14 @@ describe('ListView Data Fetch', () => {
|
|
|
203
203
|
);
|
|
204
204
|
|
|
205
205
|
// Resolve second (newer) request first
|
|
206
|
-
resolveSecond!([{
|
|
206
|
+
resolveSecond!([{ id: '2', name: 'Second' }]);
|
|
207
207
|
|
|
208
208
|
await vi.waitFor(() => {
|
|
209
209
|
expect(mockDataSource.find).toHaveBeenCalled();
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
// Resolve first (stale) request later
|
|
213
|
-
resolveFirst!([{
|
|
213
|
+
resolveFirst!([{ id: '1', name: 'First (stale)' }]);
|
|
214
214
|
|
|
215
215
|
// Wait for state to settle — second request data should win
|
|
216
216
|
await vi.waitFor(() => {
|
|
@@ -76,8 +76,8 @@ describe('ListView Export', () => {
|
|
|
76
76
|
|
|
77
77
|
it('should handle export with complex object fields in CSV safely', async () => {
|
|
78
78
|
const mockItems = [
|
|
79
|
-
{
|
|
80
|
-
{
|
|
79
|
+
{ id: '1', name: 'Alice', tags: ['admin', 'user'], metadata: { role: 'lead' } },
|
|
80
|
+
{ id: '2', name: 'Bob', tags: ['user'], metadata: null },
|
|
81
81
|
];
|
|
82
82
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
83
83
|
|
|
@@ -134,7 +134,7 @@ describe('ListView Export', () => {
|
|
|
134
134
|
|
|
135
135
|
it('should handle export with JSON format', async () => {
|
|
136
136
|
const mockItems = [
|
|
137
|
-
{
|
|
137
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
138
138
|
];
|
|
139
139
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
140
140
|
|
|
@@ -430,9 +430,9 @@ describe('ListView', () => {
|
|
|
430
430
|
|
|
431
431
|
it('should show record count bar when data is loaded', async () => {
|
|
432
432
|
const mockItems = [
|
|
433
|
-
{
|
|
434
|
-
{
|
|
435
|
-
{
|
|
433
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
434
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
435
|
+
{ id: '3', name: 'Charlie', email: 'charlie@test.com' },
|
|
436
436
|
];
|
|
437
437
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
438
438
|
|
|
@@ -930,8 +930,8 @@ describe('ListView', () => {
|
|
|
930
930
|
describe('showRecordCount flag', () => {
|
|
931
931
|
it('should hide record count bar when showRecordCount is false', async () => {
|
|
932
932
|
const mockItems = [
|
|
933
|
-
{
|
|
934
|
-
{
|
|
933
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
934
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
935
935
|
];
|
|
936
936
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
937
937
|
|
|
@@ -957,7 +957,7 @@ describe('ListView', () => {
|
|
|
957
957
|
|
|
958
958
|
it('should show record count bar by default (showRecordCount undefined)', async () => {
|
|
959
959
|
const mockItems = [
|
|
960
|
-
{
|
|
960
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
961
961
|
];
|
|
962
962
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
963
963
|
|
|
@@ -1453,7 +1453,7 @@ describe('ListView', () => {
|
|
|
1453
1453
|
describe('pageSizeOptions', () => {
|
|
1454
1454
|
it('should render page size selector when pageSizeOptions is provided', async () => {
|
|
1455
1455
|
const mockItems = [
|
|
1456
|
-
{
|
|
1456
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1457
1457
|
];
|
|
1458
1458
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
1459
1459
|
|
|
@@ -1474,7 +1474,7 @@ describe('ListView', () => {
|
|
|
1474
1474
|
|
|
1475
1475
|
it('should not render page size selector when pageSizeOptions is not provided', async () => {
|
|
1476
1476
|
const mockItems = [
|
|
1477
|
-
{
|
|
1477
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1478
1478
|
];
|
|
1479
1479
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
1480
1480
|
|
|
@@ -1539,8 +1539,8 @@ describe('ListView', () => {
|
|
|
1539
1539
|
data: {
|
|
1540
1540
|
provider: 'value',
|
|
1541
1541
|
items: [
|
|
1542
|
-
{
|
|
1543
|
-
{
|
|
1542
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1543
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1544
1544
|
],
|
|
1545
1545
|
} as any,
|
|
1546
1546
|
};
|
|
@@ -1562,8 +1562,8 @@ describe('ListView', () => {
|
|
|
1562
1562
|
viewType: 'grid',
|
|
1563
1563
|
fields: ['name', 'email'],
|
|
1564
1564
|
data: [
|
|
1565
|
-
{
|
|
1566
|
-
{
|
|
1565
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1566
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1567
1567
|
] as any,
|
|
1568
1568
|
};
|
|
1569
1569
|
|
|
@@ -1584,9 +1584,9 @@ describe('ListView', () => {
|
|
|
1584
1584
|
viewType: 'grid',
|
|
1585
1585
|
fields: ['name', 'email'],
|
|
1586
1586
|
data: [
|
|
1587
|
-
{
|
|
1588
|
-
{
|
|
1589
|
-
{
|
|
1587
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1588
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1589
|
+
{ id: '3', name: 'Charlie', email: 'charlie@test.com' },
|
|
1590
1590
|
] as any,
|
|
1591
1591
|
};
|
|
1592
1592
|
|
|
@@ -1616,8 +1616,8 @@ describe('ListView', () => {
|
|
|
1616
1616
|
data: {
|
|
1617
1617
|
provider: 'value',
|
|
1618
1618
|
items: [
|
|
1619
|
-
{
|
|
1620
|
-
{
|
|
1619
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1620
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1621
1621
|
],
|
|
1622
1622
|
} as any,
|
|
1623
1623
|
};
|
|
@@ -1641,7 +1641,7 @@ describe('ListView', () => {
|
|
|
1641
1641
|
|
|
1642
1642
|
it('should fall back to dataSource.find when schema.data is not set', async () => {
|
|
1643
1643
|
const mockItems = [
|
|
1644
|
-
{
|
|
1644
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1645
1645
|
];
|
|
1646
1646
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
1647
1647
|
|
|
@@ -1947,8 +1947,8 @@ describe('ListView', () => {
|
|
|
1947
1947
|
describe('pageSizeOptions dynamic integration', () => {
|
|
1948
1948
|
it('should render page size selector as controlled component', async () => {
|
|
1949
1949
|
const mockItems = [
|
|
1950
|
-
{
|
|
1951
|
-
{
|
|
1950
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1951
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1952
1952
|
];
|
|
1953
1953
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
1954
1954
|
|
|
@@ -1972,8 +1972,8 @@ describe('ListView', () => {
|
|
|
1972
1972
|
|
|
1973
1973
|
it('should re-fetch data when page size changes', async () => {
|
|
1974
1974
|
const mockItems = [
|
|
1975
|
-
{
|
|
1976
|
-
{
|
|
1975
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
1976
|
+
{ id: '2', name: 'Bob', email: 'bob@test.com' },
|
|
1977
1977
|
];
|
|
1978
1978
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
1979
1979
|
|
|
@@ -2008,7 +2008,7 @@ describe('ListView', () => {
|
|
|
2008
2008
|
|
|
2009
2009
|
it('should render all page size options in the selector', async () => {
|
|
2010
2010
|
const mockItems = [
|
|
2011
|
-
{
|
|
2011
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
2012
2012
|
];
|
|
2013
2013
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
2014
2014
|
|
|
@@ -2036,7 +2036,7 @@ describe('ListView', () => {
|
|
|
2036
2036
|
|
|
2037
2037
|
it('should not render page size selector when pageSizeOptions is not configured', async () => {
|
|
2038
2038
|
const mockItems = [
|
|
2039
|
-
{
|
|
2039
|
+
{ id: '1', name: 'Alice', email: 'alice@test.com' },
|
|
2040
2040
|
];
|
|
2041
2041
|
mockDataSource.find.mockResolvedValue(mockItems);
|
|
2042
2042
|
|