@easyvision/easyvision-ui 1.9.3 → 1.10.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/README.md +33 -1
- package/dist/index.cjs +107 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +106 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -409,6 +409,57 @@ declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTab
|
|
|
409
409
|
*/
|
|
410
410
|
declare function matchLoopbackWhere(row: unknown, where: LoopbackFilter['where'] | undefined): boolean;
|
|
411
411
|
|
|
412
|
+
/**
|
|
413
|
+
* ingot adapter (NML v3 backend) — sibling of `adapters/loopback.ts`.
|
|
414
|
+
*
|
|
415
|
+
* The multifilter and local mode speak one `where` dialect: LoopBack keys
|
|
416
|
+
* with mongo-style operators (`$in`, `$gte`, `$regex`, `$or`…), which westack
|
|
417
|
+
* accepts as-is. ingot keeps LoopBack's `?filter=` shape but only accepts
|
|
418
|
+
* operator names without `$` (`inq`, `gte`, `ilike`, `or`…): a `$` operator
|
|
419
|
+
* is a 400, a top-level `$or` a 500. This adapter translates on the way out,
|
|
420
|
+
* so nothing upstream changes.
|
|
421
|
+
*
|
|
422
|
+
* Behaviour checked against nml-cloud@wip/v3 in dev (2026-11-24):
|
|
423
|
+
* - `like` / `ilike` are a literal substring match (`%`, `.`, `(` match
|
|
424
|
+
* themselves; no wildcards needed), case-sensitive / -insensitive.
|
|
425
|
+
* - `regexp` is disabled server-side and there is no `not`.
|
|
426
|
+
* - Lists sent with `limit` return the total in `X-Total-Count`, exposed
|
|
427
|
+
* to the browser by CORS, so one request per page is enough.
|
|
428
|
+
*/
|
|
429
|
+
|
|
430
|
+
/** ingot `filter` object (same shape as LoopBack's). */
|
|
431
|
+
interface IngotFilter {
|
|
432
|
+
where?: Record<string, unknown>;
|
|
433
|
+
fields?: string[];
|
|
434
|
+
include?: object[];
|
|
435
|
+
order?: string[];
|
|
436
|
+
limit?: number;
|
|
437
|
+
skip?: number;
|
|
438
|
+
}
|
|
439
|
+
interface CreateIngotTableFetcherOptions<T> {
|
|
440
|
+
/**
|
|
441
|
+
* Returns one page of rows plus the total, which ingot sends in the
|
|
442
|
+
* `X-Total-Count` header of the same response (`filter` always carries
|
|
443
|
+
* `limit`, so the header is always there).
|
|
444
|
+
*/
|
|
445
|
+
fetchPage: (filter: IngotFilter) => Promise<ApiFetchResult<T>>;
|
|
446
|
+
/** `include` clause applied to every page fetch. */
|
|
447
|
+
include?: object[];
|
|
448
|
+
/** `fields` clause (whitelist) applied to every page fetch. */
|
|
449
|
+
fields?: string[];
|
|
450
|
+
/** Order applied when the table has no active sort, e.g. `['updatedAt DESC']`. */
|
|
451
|
+
defaultOrder?: string[];
|
|
452
|
+
/** Field(s) requested when the table sets `idsOnly`. Defaults to `['id']`. */
|
|
453
|
+
idFields?: string[];
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Translates a mongo-style LoopBack `where` (as built by the multifilter) into
|
|
457
|
+
* ingot's dialect. Throws on anything ingot cannot express (`$not`, real regex
|
|
458
|
+
* patterns, unknown `$` operators) rather than silently widening the query.
|
|
459
|
+
*/
|
|
460
|
+
declare function toIngotWhere(where: Record<string, unknown>): Record<string, unknown>;
|
|
461
|
+
declare function createIngotTableFetcher<T = unknown>(opts: CreateIngotTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, idsOnly }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
462
|
+
|
|
412
463
|
/** A value ExcelJS can write into a cell without further coercion. */
|
|
413
464
|
type ExportCellValue = string | number | boolean | Date | null;
|
|
414
465
|
interface ExportCellStyle {
|
|
@@ -681,6 +732,28 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
681
732
|
* />
|
|
682
733
|
*/
|
|
683
734
|
loopback?: CreateLoopbackTableFetcherOptions<T>;
|
|
735
|
+
/**
|
|
736
|
+
* Same shortcut for ingot backends (NML v3). The multifilter's mongo-style
|
|
737
|
+
* `where` is translated to ingot operators (`$in`→`inq`, text search →
|
|
738
|
+
* `ilike`…), and the total comes from the page response itself, so
|
|
739
|
+
* `fetchPage` returns `{ rows, totalCount }` with `totalCount` read from
|
|
740
|
+
* the `X-Total-Count` header. Mutually exclusive with `loopback`.
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* <EasyVisionTable
|
|
744
|
+
* id="documents"
|
|
745
|
+
* ingot={{
|
|
746
|
+
* fetchPage: async (filter) => {
|
|
747
|
+
* const res = await api.get('/documents', { params: { filter: JSON.stringify(filter) } });
|
|
748
|
+
* return { rows: res.data, totalCount: Number(res.headers['x-total-count']) };
|
|
749
|
+
* },
|
|
750
|
+
* include: [{ relation: 'subject' }],
|
|
751
|
+
* defaultOrder: ['updatedAt DESC'],
|
|
752
|
+
* }}
|
|
753
|
+
* columns={columns}
|
|
754
|
+
* />
|
|
755
|
+
*/
|
|
756
|
+
ingot?: CreateIngotTableFetcherOptions<T>;
|
|
684
757
|
/**
|
|
685
758
|
* Fires after each successful API fetch with the freshly loaded rows and total count.
|
|
686
759
|
* Useful when the page needs to mirror the loaded slice into another store
|
|
@@ -889,4 +962,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
|
|
|
889
962
|
*/
|
|
890
963
|
declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
|
|
891
964
|
|
|
892
|
-
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns };
|
|
965
|
+
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateIngotTableFetcherOptions, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type IngotFilter, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createIngotTableFetcher, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns, toIngotWhere };
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,57 @@ declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTab
|
|
|
409
409
|
*/
|
|
410
410
|
declare function matchLoopbackWhere(row: unknown, where: LoopbackFilter['where'] | undefined): boolean;
|
|
411
411
|
|
|
412
|
+
/**
|
|
413
|
+
* ingot adapter (NML v3 backend) — sibling of `adapters/loopback.ts`.
|
|
414
|
+
*
|
|
415
|
+
* The multifilter and local mode speak one `where` dialect: LoopBack keys
|
|
416
|
+
* with mongo-style operators (`$in`, `$gte`, `$regex`, `$or`…), which westack
|
|
417
|
+
* accepts as-is. ingot keeps LoopBack's `?filter=` shape but only accepts
|
|
418
|
+
* operator names without `$` (`inq`, `gte`, `ilike`, `or`…): a `$` operator
|
|
419
|
+
* is a 400, a top-level `$or` a 500. This adapter translates on the way out,
|
|
420
|
+
* so nothing upstream changes.
|
|
421
|
+
*
|
|
422
|
+
* Behaviour checked against nml-cloud@wip/v3 in dev (2026-11-24):
|
|
423
|
+
* - `like` / `ilike` are a literal substring match (`%`, `.`, `(` match
|
|
424
|
+
* themselves; no wildcards needed), case-sensitive / -insensitive.
|
|
425
|
+
* - `regexp` is disabled server-side and there is no `not`.
|
|
426
|
+
* - Lists sent with `limit` return the total in `X-Total-Count`, exposed
|
|
427
|
+
* to the browser by CORS, so one request per page is enough.
|
|
428
|
+
*/
|
|
429
|
+
|
|
430
|
+
/** ingot `filter` object (same shape as LoopBack's). */
|
|
431
|
+
interface IngotFilter {
|
|
432
|
+
where?: Record<string, unknown>;
|
|
433
|
+
fields?: string[];
|
|
434
|
+
include?: object[];
|
|
435
|
+
order?: string[];
|
|
436
|
+
limit?: number;
|
|
437
|
+
skip?: number;
|
|
438
|
+
}
|
|
439
|
+
interface CreateIngotTableFetcherOptions<T> {
|
|
440
|
+
/**
|
|
441
|
+
* Returns one page of rows plus the total, which ingot sends in the
|
|
442
|
+
* `X-Total-Count` header of the same response (`filter` always carries
|
|
443
|
+
* `limit`, so the header is always there).
|
|
444
|
+
*/
|
|
445
|
+
fetchPage: (filter: IngotFilter) => Promise<ApiFetchResult<T>>;
|
|
446
|
+
/** `include` clause applied to every page fetch. */
|
|
447
|
+
include?: object[];
|
|
448
|
+
/** `fields` clause (whitelist) applied to every page fetch. */
|
|
449
|
+
fields?: string[];
|
|
450
|
+
/** Order applied when the table has no active sort, e.g. `['updatedAt DESC']`. */
|
|
451
|
+
defaultOrder?: string[];
|
|
452
|
+
/** Field(s) requested when the table sets `idsOnly`. Defaults to `['id']`. */
|
|
453
|
+
idFields?: string[];
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Translates a mongo-style LoopBack `where` (as built by the multifilter) into
|
|
457
|
+
* ingot's dialect. Throws on anything ingot cannot express (`$not`, real regex
|
|
458
|
+
* patterns, unknown `$` operators) rather than silently widening the query.
|
|
459
|
+
*/
|
|
460
|
+
declare function toIngotWhere(where: Record<string, unknown>): Record<string, unknown>;
|
|
461
|
+
declare function createIngotTableFetcher<T = unknown>(opts: CreateIngotTableFetcherOptions<T>): ({ page, itemsPerPage, sort, filter, idsOnly }: ApiFetchParams) => Promise<ApiFetchResult<T>>;
|
|
462
|
+
|
|
412
463
|
/** A value ExcelJS can write into a cell without further coercion. */
|
|
413
464
|
type ExportCellValue = string | number | boolean | Date | null;
|
|
414
465
|
interface ExportCellStyle {
|
|
@@ -681,6 +732,28 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
681
732
|
* />
|
|
682
733
|
*/
|
|
683
734
|
loopback?: CreateLoopbackTableFetcherOptions<T>;
|
|
735
|
+
/**
|
|
736
|
+
* Same shortcut for ingot backends (NML v3). The multifilter's mongo-style
|
|
737
|
+
* `where` is translated to ingot operators (`$in`→`inq`, text search →
|
|
738
|
+
* `ilike`…), and the total comes from the page response itself, so
|
|
739
|
+
* `fetchPage` returns `{ rows, totalCount }` with `totalCount` read from
|
|
740
|
+
* the `X-Total-Count` header. Mutually exclusive with `loopback`.
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* <EasyVisionTable
|
|
744
|
+
* id="documents"
|
|
745
|
+
* ingot={{
|
|
746
|
+
* fetchPage: async (filter) => {
|
|
747
|
+
* const res = await api.get('/documents', { params: { filter: JSON.stringify(filter) } });
|
|
748
|
+
* return { rows: res.data, totalCount: Number(res.headers['x-total-count']) };
|
|
749
|
+
* },
|
|
750
|
+
* include: [{ relation: 'subject' }],
|
|
751
|
+
* defaultOrder: ['updatedAt DESC'],
|
|
752
|
+
* }}
|
|
753
|
+
* columns={columns}
|
|
754
|
+
* />
|
|
755
|
+
*/
|
|
756
|
+
ingot?: CreateIngotTableFetcherOptions<T>;
|
|
684
757
|
/**
|
|
685
758
|
* Fires after each successful API fetch with the freshly loaded rows and total count.
|
|
686
759
|
* Useful when the page needs to mirror the loaded slice into another store
|
|
@@ -889,4 +962,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
|
|
|
889
962
|
*/
|
|
890
963
|
declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
|
|
891
964
|
|
|
892
|
-
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns };
|
|
965
|
+
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateIngotTableFetcherOptions, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type IngotFilter, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createIngotTableFetcher, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns, toIngotWhere };
|
package/dist/index.js
CHANGED
|
@@ -2327,6 +2327,97 @@ function matchLeaf(value, condition) {
|
|
|
2327
2327
|
return true;
|
|
2328
2328
|
}
|
|
2329
2329
|
|
|
2330
|
+
// adapters/ingot.ts
|
|
2331
|
+
var OPERATORS = {
|
|
2332
|
+
$eq: "eq",
|
|
2333
|
+
$ne: "neq",
|
|
2334
|
+
$neq: "neq",
|
|
2335
|
+
$in: "inq",
|
|
2336
|
+
$nin: "nin",
|
|
2337
|
+
$gt: "gt",
|
|
2338
|
+
$gte: "gte",
|
|
2339
|
+
$lt: "lt",
|
|
2340
|
+
$lte: "lte",
|
|
2341
|
+
$exists: "exists"
|
|
2342
|
+
};
|
|
2343
|
+
var LOGICAL = { $and: "and", $or: "or" };
|
|
2344
|
+
var isPlainObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
2345
|
+
function regexToLiteral(pattern) {
|
|
2346
|
+
const body = pattern.replace(/^\.\*/, "");
|
|
2347
|
+
let literal = "";
|
|
2348
|
+
for (let i = 0; i < body.length; i++) {
|
|
2349
|
+
const ch = body[i];
|
|
2350
|
+
if (ch === "\\") {
|
|
2351
|
+
if (i + 1 >= body.length) return void 0;
|
|
2352
|
+
literal += body[++i];
|
|
2353
|
+
} else if (ch === "." && body[i + 1] === "*" && i + 2 === body.length) {
|
|
2354
|
+
break;
|
|
2355
|
+
} else if (".*+?^${}()|[]".includes(ch)) {
|
|
2356
|
+
return void 0;
|
|
2357
|
+
} else {
|
|
2358
|
+
literal += ch;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
return literal;
|
|
2362
|
+
}
|
|
2363
|
+
function translateOperators(field, ops) {
|
|
2364
|
+
const out = {};
|
|
2365
|
+
for (const [op, value] of Object.entries(ops)) {
|
|
2366
|
+
if (!op.startsWith("$")) {
|
|
2367
|
+
out[op] = value;
|
|
2368
|
+
} else if (op === "$regex") {
|
|
2369
|
+
const flags = ops.$options ?? "";
|
|
2370
|
+
if (flags !== "" && flags !== "i") {
|
|
2371
|
+
throw new Error(`ingot: unsupported $options "${String(flags)}" on "${field}" (only "i")`);
|
|
2372
|
+
}
|
|
2373
|
+
const literal = typeof value === "string" ? regexToLiteral(value) : void 0;
|
|
2374
|
+
if (literal === void 0) {
|
|
2375
|
+
throw new Error(`ingot: "${field}" uses a regex pattern; ingot only supports literal substring search`);
|
|
2376
|
+
}
|
|
2377
|
+
out[flags === "i" ? "ilike" : "like"] = literal;
|
|
2378
|
+
} else if (op === "$options") {
|
|
2379
|
+
if (!("$regex" in ops)) throw new Error(`ingot: $options without $regex on "${field}"`);
|
|
2380
|
+
} else if (op in OPERATORS) {
|
|
2381
|
+
out[OPERATORS[op]] = value;
|
|
2382
|
+
} else {
|
|
2383
|
+
throw new Error(`ingot: unsupported operator ${op} on "${field}"`);
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
return out;
|
|
2387
|
+
}
|
|
2388
|
+
function toIngotWhere(where) {
|
|
2389
|
+
const out = {};
|
|
2390
|
+
for (const [key, value] of Object.entries(where)) {
|
|
2391
|
+
if (key in LOGICAL) {
|
|
2392
|
+
if (!Array.isArray(value)) throw new Error(`ingot: ${key} expects an array`);
|
|
2393
|
+
out[LOGICAL[key]] = value.map((sub) => toIngotWhere(sub));
|
|
2394
|
+
} else if (key.startsWith("$")) {
|
|
2395
|
+
throw new Error(`ingot: unsupported operator ${key}`);
|
|
2396
|
+
} else if (isPlainObject(value) && Object.keys(value).some((k) => k.startsWith("$"))) {
|
|
2397
|
+
out[key] = translateOperators(key, value);
|
|
2398
|
+
} else {
|
|
2399
|
+
out[key] = value;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
return out;
|
|
2403
|
+
}
|
|
2404
|
+
function createIngotTableFetcher(opts) {
|
|
2405
|
+
const { fetchPage, include, fields, defaultOrder, idFields } = opts;
|
|
2406
|
+
return async ({ page, itemsPerPage, sort, filter, idsOnly }) => {
|
|
2407
|
+
const order = sort ? [`${sort.column} ${sort.descending ? "DESC" : "ASC"}`] : defaultOrder ?? [];
|
|
2408
|
+
const effectiveFields = idsOnly ? idFields ?? ["id"] : fields;
|
|
2409
|
+
const effectiveInclude = idsOnly ? void 0 : include;
|
|
2410
|
+
return fetchPage({
|
|
2411
|
+
where: toIngotWhere(filter?.where ?? {}),
|
|
2412
|
+
skip: (page - 1) * itemsPerPage,
|
|
2413
|
+
limit: itemsPerPage,
|
|
2414
|
+
order,
|
|
2415
|
+
...effectiveInclude ? { include: effectiveInclude } : {},
|
|
2416
|
+
...effectiveFields ? { fields: effectiveFields } : {}
|
|
2417
|
+
});
|
|
2418
|
+
};
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2330
2421
|
// export/sources.ts
|
|
2331
2422
|
var sources = /* @__PURE__ */ new Map();
|
|
2332
2423
|
var registerExportSource = (fullId, source) => {
|
|
@@ -2392,6 +2483,7 @@ function EasyVisionTable(props) {
|
|
|
2392
2483
|
data,
|
|
2393
2484
|
fetchData: fetchDataProp,
|
|
2394
2485
|
loopback,
|
|
2486
|
+
ingot,
|
|
2395
2487
|
onDataLoaded,
|
|
2396
2488
|
multifilter,
|
|
2397
2489
|
multifilterRef,
|
|
@@ -2430,9 +2522,19 @@ function EasyVisionTable(props) {
|
|
|
2430
2522
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2431
2523
|
[lbFetchPage, lbFetchCount, lbIncludeKey, lbFieldsKey, lbOrderKey]
|
|
2432
2524
|
);
|
|
2433
|
-
const
|
|
2434
|
-
const
|
|
2435
|
-
const
|
|
2525
|
+
const igFetchPage = ingot?.fetchPage;
|
|
2526
|
+
const igIncludeKey = JSON.stringify(ingot?.include ?? null);
|
|
2527
|
+
const igFieldsKey = JSON.stringify(ingot?.fields ?? null);
|
|
2528
|
+
const igOrderKey = JSON.stringify(ingot?.defaultOrder ?? null);
|
|
2529
|
+
const ingotFetcher = useMemo(
|
|
2530
|
+
() => ingot ? createIngotTableFetcher(ingot) : void 0,
|
|
2531
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2532
|
+
[igFetchPage, igIncludeKey, igFieldsKey, igOrderKey]
|
|
2533
|
+
);
|
|
2534
|
+
const fetchData = fetchDataProp ?? loopbackFetcher ?? ingotFetcher;
|
|
2535
|
+
const apiShortcut = Boolean(loopback || ingot);
|
|
2536
|
+
const paginationMode = apiShortcut ? "api" : paginationModeProp;
|
|
2537
|
+
const orderingMode = apiShortcut ? "api" : orderingModeProp;
|
|
2436
2538
|
const getRowId = useMemo(
|
|
2437
2539
|
() => getRowIdProp ?? ((row) => String(row?.id ?? "")),
|
|
2438
2540
|
[getRowIdProp]
|
|
@@ -3282,6 +3384,6 @@ function EasyVisionExportButton({
|
|
|
3282
3384
|
}
|
|
3283
3385
|
var defaultCell = (content, title) => /* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", title, children: content });
|
|
3284
3386
|
|
|
3285
|
-
export { EasyVisionAccordion, EasyVisionAccordionItem, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, EasyVisionExportButton, EasyVisionInput, EasyVisionMultifilter, EasyVisionSelector, EasyVisionTable, buildWorkbook, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns };
|
|
3387
|
+
export { EasyVisionAccordion, EasyVisionAccordionItem, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, EasyVisionExportButton, EasyVisionInput, EasyVisionMultifilter, EasyVisionSelector, EasyVisionTable, buildWorkbook, createIngotTableFetcher, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns, toIngotWhere };
|
|
3286
3388
|
//# sourceMappingURL=index.js.map
|
|
3287
3389
|
//# sourceMappingURL=index.js.map
|