gm-datagrid 0.1.33 → 0.1.34
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/CHANGELOG.md +16 -0
- package/README.md +19 -9
- package/dist/context/GridContext.d.ts +5 -1
- package/dist/dataset/buildServerFetchParams.d.ts +18 -0
- package/dist/dataset/useGMDataSet.d.ts +16 -6
- package/dist/engine/useEngineSync.d.ts +5 -1
- package/dist/gm-datagrid.js +9135 -8997
- package/dist/gm-datagrid.umd.cjs +47 -47
- package/dist/index.d.ts +1 -1
- package/dist/lib/serverModes.d.ts +12 -0
- package/dist/types/index.d.ts +40 -6
- package/docs/PUBLISH.md +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { GMDatagrid } from './GMDatagrid';
|
|
|
2
2
|
export { GMGridContainer } from './GMGridContainer';
|
|
3
3
|
export type { GMGridContainerRef } from './GMGridContainer';
|
|
4
4
|
export { useGMGrid } from './context/GridContext';
|
|
5
|
-
export type { GMDatagridProps, GMDatagridRef, ColumnDef, Row, CellRange, CellCoord, FilterGroup, FilterCondition, SortKey, ApiContext, DensityMode, MuiChipColor, StatusMapEntry, CellRenderParams, CellEditParams, GridBulkActionProps, GridBulkMenuItemProps, GridBulkMenuActionDef, GridBulkActionsMenuSlotProps, GridCreatorSlotProps, GridSynchronizerSlotProps, GridToolbarSlots, GridToolbarSlotProps, StatusSwitchConfig, StatusSwitchUpdateArgs, } from './types';
|
|
5
|
+
export type { GMDatagridProps, GMDatagridRef, ColumnDef, Row, CellRange, CellCoord, FilterGroup, FilterCondition, SortKey, SourceApiResult, GMDatagridFetchParams, GridProcessingMode, ApiContext, DensityMode, MuiChipColor, StatusMapEntry, CellRenderParams, CellEditParams, GridBulkActionProps, GridBulkMenuItemProps, GridBulkMenuActionDef, GridBulkActionsMenuSlotProps, GridCreatorSlotProps, GridSynchronizerSlotProps, GridToolbarSlots, GridToolbarSlotProps, StatusSwitchConfig, StatusSwitchUpdateArgs, } from './types';
|
|
6
6
|
export { ColumnDataTypesEnum } from './types';
|
|
7
7
|
export { default as RecordStatusSwitchCell } from './cells/RecordStatusSwitchCell';
|
|
8
8
|
export { resolveColumnStatusSwitchConfig } from './cells/resolveColumnStatusSwitch';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** MUI DataGrid-compatible client | server processing mode. */
|
|
2
|
+
export type GridProcessingMode = 'client' | 'server';
|
|
3
|
+
export declare const DEFAULT_GRID_PROCESSING_MODE: GridProcessingMode;
|
|
4
|
+
export declare function isServerPagination(mode?: GridProcessingMode): boolean;
|
|
5
|
+
export declare function isServerSorting(mode?: GridProcessingMode): boolean;
|
|
6
|
+
export declare function isServerFiltering(mode?: GridProcessingMode): boolean;
|
|
7
|
+
/** True when any dimension uses server-side processing (triggers query-driven fetch). */
|
|
8
|
+
export declare function usesServerDrivenFetch(flags: {
|
|
9
|
+
paginationMode?: GridProcessingMode;
|
|
10
|
+
sortingMode?: GridProcessingMode;
|
|
11
|
+
filterMode?: GridProcessingMode;
|
|
12
|
+
}): boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -316,14 +316,30 @@ export interface AggregationCalculatedParams {
|
|
|
316
316
|
/** Current rows used in the calculation. */
|
|
317
317
|
rows: Row[];
|
|
318
318
|
}
|
|
319
|
+
export type GridProcessingMode = 'client' | 'server';
|
|
320
|
+
/** Return type for `sourceApi` — `total` supplies server `rowCount` when paginationMode is server. */
|
|
321
|
+
export interface SourceApiResult {
|
|
322
|
+
success: boolean;
|
|
323
|
+
data: Row[];
|
|
324
|
+
/** Total rows matching the current server query (not just the current page). */
|
|
325
|
+
total?: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Query payload merged into every `sourceApi` call when server modes are enabled.
|
|
329
|
+
* Extra keys from `apiParameters` are included via index signature.
|
|
330
|
+
*/
|
|
331
|
+
export type GMDatagridFetchParams = {
|
|
332
|
+
page?: number;
|
|
333
|
+
pageSize?: number;
|
|
334
|
+
sortStack?: SortKey[];
|
|
335
|
+
filterGroup?: FilterGroup | null;
|
|
336
|
+
search?: string;
|
|
337
|
+
} & Record<string, unknown>;
|
|
319
338
|
export interface GMDatagridProps {
|
|
320
339
|
title: string;
|
|
321
340
|
columns: ColumnDef[];
|
|
322
|
-
/** Async data fetcher.
|
|
323
|
-
sourceApi?: (params: Record<string, unknown>) => Promise<
|
|
324
|
-
success: boolean;
|
|
325
|
-
data: Row[];
|
|
326
|
-
}>;
|
|
341
|
+
/** Async data fetcher. Returns rows for the current query; optional `total` for server pagination. */
|
|
342
|
+
sourceApi?: (params: Record<string, unknown>) => Promise<SourceApiResult>;
|
|
327
343
|
/** Initial params merged with apiContext on every sourceApi call. */
|
|
328
344
|
apiParameters?: Record<string, unknown>;
|
|
329
345
|
/** Provide static rows — skips sourceApi entirely. */
|
|
@@ -440,7 +456,25 @@ export interface GMDatagridProps {
|
|
|
440
456
|
* Equivalent to MUI DataGrid v9 `paginationMode`.
|
|
441
457
|
* @default "client"
|
|
442
458
|
*/
|
|
443
|
-
paginationMode?:
|
|
459
|
+
paginationMode?: GridProcessingMode;
|
|
460
|
+
/**
|
|
461
|
+
* `"client"` — Wasm sorts loaded rows (default).
|
|
462
|
+
* `"server"` — `sortStack` is sent to `sourceApi`; sort changes trigger refetch.
|
|
463
|
+
* Equivalent to MUI DataGrid `sortingMode`.
|
|
464
|
+
* @default "client"
|
|
465
|
+
*/
|
|
466
|
+
sortingMode?: GridProcessingMode;
|
|
467
|
+
/**
|
|
468
|
+
* `"client"` — Wasm + match-sorter filter loaded rows (default).
|
|
469
|
+
* `"server"` — `filterGroup` and toolbar `search` are sent to `sourceApi`.
|
|
470
|
+
* Equivalent to MUI DataGrid `filterMode`.
|
|
471
|
+
* @default "client"
|
|
472
|
+
*/
|
|
473
|
+
filterMode?: GridProcessingMode;
|
|
474
|
+
/**
|
|
475
|
+
* Fired when `sourceApi` returns `total` (controlled `rowCount` pattern, MUI-compatible).
|
|
476
|
+
*/
|
|
477
|
+
onRowCountChange?: (rowCount: number) => void;
|
|
444
478
|
/**
|
|
445
479
|
* UI label locale for built-in strings (filter operators, tooltips, placeholders).
|
|
446
480
|
* @default 'es'
|
package/docs/PUBLISH.md
CHANGED
|
@@ -13,8 +13,8 @@ make publish-check
|
|
|
13
13
|
## Registry status
|
|
14
14
|
|
|
15
15
|
- Package: `gm-datagrid` (public)
|
|
16
|
-
- Version to publish: see `react-wrapper/package.json` (currently **0.1.
|
|
17
|
-
- Latest on npm before this release was **0.1.
|
|
16
|
+
- Version to publish: see `react-wrapper/package.json` (currently **0.1.34**)
|
|
17
|
+
- Latest on npm before this release was **0.1.33**
|
|
18
18
|
|
|
19
19
|
## Publish (requires npm login + 2FA OTP)
|
|
20
20
|
|
|
@@ -41,9 +41,9 @@ npm publish --access public --otp=XXXXXX
|
|
|
41
41
|
|
|
42
42
|
## After publish
|
|
43
43
|
|
|
44
|
-
1. goal-front: `pnpm add gm-datagrid@0.1.
|
|
45
|
-
2. Smoke:
|
|
46
|
-
3. Tag git (optional): `git tag gm-datagrid-v0.1.
|
|
44
|
+
1. goal-front: `pnpm add gm-datagrid@0.1.34` (or match published version)
|
|
45
|
+
2. Smoke: server pagination flags (`paginationMode` / `sortingMode` / `filterMode`), bulk menu slot, `valueGetter` + `getRowId`
|
|
46
|
+
3. Tag git (optional): `git tag gm-datagrid-v0.1.34`
|
|
47
47
|
|
|
48
48
|
## Tarball contents
|
|
49
49
|
|
package/package.json
CHANGED