@easyvision/easyvision-ui 1.7.3 → 1.7.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/README.md +4 -2
- package/dist/index.cjs +9 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -308,8 +308,14 @@ interface CreateLoopbackTableFetcherOptions<T> {
|
|
|
308
308
|
fields?: string[];
|
|
309
309
|
/** Order applied when the table has no active sort. */
|
|
310
310
|
defaultOrder?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* Field(s) requested when the table sets `idsOnly` (eager-ids select-all
|
|
313
|
+
* resolution). Defaults to `['id']`. Override if your model's primary key
|
|
314
|
+
* is named differently or if `getRowId` reads from another property.
|
|
315
|
+
*/
|
|
316
|
+
idFields?: string[];
|
|
311
317
|
}
|
|
312
|
-
declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
318
|
+
declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, idsOnly, }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
313
319
|
/**
|
|
314
320
|
* Evaluate a LoopBack `where` clause against a single row, returning `true`
|
|
315
321
|
* iff the row satisfies the clause.
|
|
@@ -422,6 +428,13 @@ interface ApiFetchParams {
|
|
|
422
428
|
} | null;
|
|
423
429
|
/** Latest perform-confirmed multifilter query, when a multifilter is bound. */
|
|
424
430
|
filter?: MultifilterQuery;
|
|
431
|
+
/**
|
|
432
|
+
* Hint that only the row id is needed. Set by the table during eager-ids
|
|
433
|
+
* select-all resolution so adapters can shrink the wire payload (e.g.
|
|
434
|
+
* Loopback's `fields: ['id']`, skipping `include`). Adapters that ignore
|
|
435
|
+
* this still work — they just send full rows that the table discards.
|
|
436
|
+
*/
|
|
437
|
+
idsOnly?: boolean;
|
|
425
438
|
}
|
|
426
439
|
interface ApiFetchResult<T> {
|
|
427
440
|
rows: T[];
|
package/dist/index.d.ts
CHANGED
|
@@ -308,8 +308,14 @@ interface CreateLoopbackTableFetcherOptions<T> {
|
|
|
308
308
|
fields?: string[];
|
|
309
309
|
/** Order applied when the table has no active sort. */
|
|
310
310
|
defaultOrder?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* Field(s) requested when the table sets `idsOnly` (eager-ids select-all
|
|
313
|
+
* resolution). Defaults to `['id']`. Override if your model's primary key
|
|
314
|
+
* is named differently or if `getRowId` reads from another property.
|
|
315
|
+
*/
|
|
316
|
+
idFields?: string[];
|
|
311
317
|
}
|
|
312
|
-
declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
318
|
+
declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, idsOnly, }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
313
319
|
/**
|
|
314
320
|
* Evaluate a LoopBack `where` clause against a single row, returning `true`
|
|
315
321
|
* iff the row satisfies the clause.
|
|
@@ -422,6 +428,13 @@ interface ApiFetchParams {
|
|
|
422
428
|
} | null;
|
|
423
429
|
/** Latest perform-confirmed multifilter query, when a multifilter is bound. */
|
|
424
430
|
filter?: MultifilterQuery;
|
|
431
|
+
/**
|
|
432
|
+
* Hint that only the row id is needed. Set by the table during eager-ids
|
|
433
|
+
* select-all resolution so adapters can shrink the wire payload (e.g.
|
|
434
|
+
* Loopback's `fields: ['id']`, skipping `include`). Adapters that ignore
|
|
435
|
+
* this still work — they just send full rows that the table discards.
|
|
436
|
+
*/
|
|
437
|
+
idsOnly?: boolean;
|
|
425
438
|
}
|
|
426
439
|
interface ApiFetchResult<T> {
|
|
427
440
|
rows: T[];
|
package/dist/index.js
CHANGED
|
@@ -1986,23 +1986,26 @@ function ColumnVisibilityMenu({ table, label }) {
|
|
|
1986
1986
|
|
|
1987
1987
|
// adapters/loopback.ts
|
|
1988
1988
|
function createLoopbackTableFetcher(opts) {
|
|
1989
|
-
const { fetchPage, fetchCount, include, fields, defaultOrder } = opts;
|
|
1989
|
+
const { fetchPage, fetchCount, include, fields, defaultOrder, idFields } = opts;
|
|
1990
1990
|
return async ({
|
|
1991
1991
|
page,
|
|
1992
1992
|
itemsPerPage,
|
|
1993
1993
|
sort,
|
|
1994
|
-
filter
|
|
1994
|
+
filter,
|
|
1995
|
+
idsOnly
|
|
1995
1996
|
}) => {
|
|
1996
1997
|
const order = sort ? [`${sort.column} ${sort.descending ? "DESC" : "ASC"}`] : defaultOrder ?? [];
|
|
1997
1998
|
const skip = (page - 1) * itemsPerPage;
|
|
1998
1999
|
const where = filter?.where ?? {};
|
|
2000
|
+
const effectiveFields = idsOnly ? idFields ?? ["id"] : fields;
|
|
2001
|
+
const effectiveInclude = idsOnly ? void 0 : include;
|
|
1999
2002
|
const pageFilter = {
|
|
2000
2003
|
where,
|
|
2001
2004
|
skip,
|
|
2002
2005
|
limit: itemsPerPage,
|
|
2003
2006
|
order,
|
|
2004
|
-
...
|
|
2005
|
-
...
|
|
2007
|
+
...effectiveInclude ? { include: effectiveInclude } : {},
|
|
2008
|
+
...effectiveFields ? { fields: effectiveFields } : {}
|
|
2006
2009
|
};
|
|
2007
2010
|
const [rows, count] = await Promise.all([
|
|
2008
2011
|
fetchPage(pageFilter),
|
|
@@ -2290,7 +2293,8 @@ function EasyVisionTable(props) {
|
|
|
2290
2293
|
page: p,
|
|
2291
2294
|
itemsPerPage: PAGE_SIZE,
|
|
2292
2295
|
sort,
|
|
2293
|
-
filter: merged
|
|
2296
|
+
filter: merged,
|
|
2297
|
+
idsOnly: !collectRows
|
|
2294
2298
|
});
|
|
2295
2299
|
if (seq !== eagerSeqRef.current) return;
|
|
2296
2300
|
knownTotal = result.totalCount;
|