gm-datagrid 0.1.7 → 0.1.10
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 +99 -2
- package/dist/cells/FilterCell.d.ts +30 -4
- package/dist/features/useExport.d.ts +5 -1
- package/dist/gm-datagrid.js +2401 -2261
- package/dist/gm-datagrid.umd.cjs +19 -19
- package/dist/lib/i18n.d.ts +32 -0
- package/dist/toolbar/GridToolbar.d.ts +6 -1
- package/dist/toolbar/MobileToolbar.d.ts +10 -1
- package/dist/toolbar/ToolbarButtons.d.ts +2 -2
- package/dist/types/index.d.ts +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n.ts — Internationalisation labels for GMDatagrid built-in UI text.
|
|
3
|
+
*
|
|
4
|
+
* Extend GRID_LABELS to add more locales.
|
|
5
|
+
* Pass `locale` prop to GMDatagrid to switch language.
|
|
6
|
+
*/
|
|
7
|
+
export type GridLocale = 'es' | 'en';
|
|
8
|
+
export interface GridLabels {
|
|
9
|
+
/** Quick filter input placeholder */
|
|
10
|
+
search: string;
|
|
11
|
+
/** Filter panel toggle tooltip (when closed) */
|
|
12
|
+
filterBy: string;
|
|
13
|
+
/** Filter panel toggle tooltip (when open) */
|
|
14
|
+
hideFilters: string;
|
|
15
|
+
/** Clear all active filters action label */
|
|
16
|
+
clearFilters: string;
|
|
17
|
+
/** Default "show all" option in enum / boolean dropdowns */
|
|
18
|
+
all: string;
|
|
19
|
+
/** Boolean filter: true branch */
|
|
20
|
+
yes: string;
|
|
21
|
+
/** Boolean filter: false branch */
|
|
22
|
+
no: string;
|
|
23
|
+
/** Numeric range filter: lower bound tooltip */
|
|
24
|
+
min: string;
|
|
25
|
+
/** Numeric range filter: upper bound tooltip */
|
|
26
|
+
max: string;
|
|
27
|
+
/** Group-by picker: no-grouping option */
|
|
28
|
+
noGroup: string;
|
|
29
|
+
/** Date operator dropdown labels keyed by DateFilterOp */
|
|
30
|
+
dateOps: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
export declare const GRID_LABELS: Record<GridLocale, GridLabels>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DensityMode } from '../types';
|
|
3
|
+
import { GridLabels } from '../lib/i18n';
|
|
3
4
|
interface GridToolbarProps {
|
|
4
5
|
title: string;
|
|
5
6
|
loading: boolean;
|
|
6
7
|
quickFilter: boolean;
|
|
7
8
|
quickFilterPlaceholder?: string;
|
|
8
9
|
onQuickFilterChange: (text: string) => void;
|
|
9
|
-
onExport
|
|
10
|
+
onExport?: () => void;
|
|
10
11
|
onRefresh: () => void;
|
|
11
12
|
density: DensityMode;
|
|
12
13
|
onToggleDensity: () => void;
|
|
@@ -23,6 +24,10 @@ interface GridToolbarProps {
|
|
|
23
24
|
}>;
|
|
24
25
|
groupByField?: string | null;
|
|
25
26
|
onGroupBy?: (field: string | null) => void;
|
|
27
|
+
/** Callback to clear all active column filters */
|
|
28
|
+
onClearFilters?: () => void;
|
|
29
|
+
/** UI label translations */
|
|
30
|
+
labels?: GridLabels;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
33
|
* Desktop toolbar: title, optional quick-filter input, action buttons, subtotals row.
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DensityMode } from '../types';
|
|
3
|
+
import { GridLabels } from '../lib/i18n';
|
|
3
4
|
interface MobileToolbarProps {
|
|
4
5
|
title: string;
|
|
5
6
|
loading: boolean;
|
|
6
7
|
quickFilter: boolean;
|
|
7
8
|
quickFilterPlaceholder?: string;
|
|
8
9
|
onQuickFilterChange: (text: string) => void;
|
|
9
|
-
onExport
|
|
10
|
+
onExport?: () => void;
|
|
10
11
|
onRefresh: () => void;
|
|
11
12
|
density: DensityMode;
|
|
12
13
|
onToggleDensity: () => void;
|
|
14
|
+
/** Filter panel toggle */
|
|
15
|
+
filterOpen?: boolean;
|
|
16
|
+
onToggleFilter?: () => void;
|
|
17
|
+
activeFilterCount?: number;
|
|
18
|
+
/** Clear all active filters */
|
|
19
|
+
onClearFilters?: () => void;
|
|
20
|
+
/** UI label translations */
|
|
21
|
+
labels?: GridLabels;
|
|
13
22
|
}
|
|
14
23
|
/**
|
|
15
24
|
* Collapsible mobile toolbar — same features as GridToolbar but stacked vertically.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DensityMode } from '../types';
|
|
3
3
|
interface ToolbarButtonsProps {
|
|
4
|
-
onExport
|
|
4
|
+
onExport?: () => void;
|
|
5
5
|
onRefresh: () => void;
|
|
6
6
|
onToggleDensity: () => void;
|
|
7
7
|
density: DensityMode;
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Shared toolbar action buttons: Export, Refresh, Density toggle.
|
|
11
|
+
* Shared toolbar action buttons: Export (optional), Refresh, Density toggle.
|
|
12
12
|
*/
|
|
13
13
|
declare const ToolbarButtons: React.NamedExoticComponent<ToolbarButtonsProps>;
|
|
14
14
|
export default ToolbarButtons;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -185,4 +185,49 @@ export interface GMDatagridProps {
|
|
|
185
185
|
* @default "client"
|
|
186
186
|
*/
|
|
187
187
|
paginationMode?: 'client' | 'server';
|
|
188
|
+
/**
|
|
189
|
+
* UI label locale for built-in strings (filter operators, tooltips, placeholders).
|
|
190
|
+
* @default 'es'
|
|
191
|
+
*/
|
|
192
|
+
locale?: 'es' | 'en';
|
|
193
|
+
/**
|
|
194
|
+
* Allow Excel export via the toolbar button.
|
|
195
|
+
* @default true
|
|
196
|
+
*/
|
|
197
|
+
exportable?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Whitelist of column `field` names that may be exported.
|
|
200
|
+
* When omitted (or empty) all visible columns are exported.
|
|
201
|
+
*/
|
|
202
|
+
exportableColumns?: string[];
|
|
203
|
+
/**
|
|
204
|
+
* Show the filter panel toggle and allow column filtering.
|
|
205
|
+
* @default true
|
|
206
|
+
*/
|
|
207
|
+
filterable?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Whitelist of column `field` names that may be filtered.
|
|
210
|
+
* When omitted (or empty) every column respects its own `filterable` flag.
|
|
211
|
+
*/
|
|
212
|
+
filterableColumns?: string[];
|
|
213
|
+
/**
|
|
214
|
+
* Allow sorting by clicking column headers.
|
|
215
|
+
* @default true
|
|
216
|
+
*/
|
|
217
|
+
sortable?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Whitelist of column `field` names that may be sorted.
|
|
220
|
+
* When omitted (or empty) every column respects its own `sortable` flag.
|
|
221
|
+
*/
|
|
222
|
+
sortableColumns?: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Show the group-by picker in the toolbar.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
227
|
+
groupable?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whitelist of column `field` names offered in the group-by picker.
|
|
230
|
+
* When omitted (or empty) all non-action columns are offered.
|
|
231
|
+
*/
|
|
232
|
+
groupableColumns?: string[];
|
|
188
233
|
}
|