@redsift/table 11.0.0-alpha.0 → 11.0.0-alpha.1
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/index.d.ts +86 -3
- package/index.js +3942 -3845
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
|
-
import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridPinnedColumns, GridFilterModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { GridColumnTypesRecord, GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridPinnedColumns, GridFilterModel, GridSortModel, GridSortItem, GridColumnVisibilityModel, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
3
3
|
export * from '@mui/x-data-grid-pro';
|
|
4
4
|
export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
5
|
-
import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
|
|
6
5
|
import React, { ReactNode, ComponentProps, RefObject } from 'react';
|
|
7
6
|
import { TablePaginationProps } from '@mui/material';
|
|
7
|
+
import { Theme, Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
|
|
8
8
|
|
|
9
9
|
declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any, any, any>;
|
|
10
10
|
|
|
11
|
+
declare const getRsStringColumnType: () => {
|
|
12
|
+
type: string;
|
|
13
|
+
filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
|
|
14
|
+
};
|
|
15
|
+
declare const getRsNumberColumnType: () => {
|
|
16
|
+
type: string;
|
|
17
|
+
filterOperators: _mui_x_data_grid_pro.GridFilterOperator<any, string | number | null, any>[];
|
|
18
|
+
};
|
|
19
|
+
declare const customColumnTypes: Partial<GridColumnTypesRecord>;
|
|
20
|
+
|
|
11
21
|
declare const IS_BETWEEN: {
|
|
12
22
|
label: string;
|
|
13
23
|
value: string;
|
|
@@ -90,6 +100,22 @@ declare const operatorList: {
|
|
|
90
100
|
|
|
91
101
|
declare function getCompletion(text: string, role: string, openai_api_key: string | undefined, model?: string): Promise<string>;
|
|
92
102
|
|
|
103
|
+
declare const PAGINATION_MODEL_KEY = "paginationModel";
|
|
104
|
+
declare const FILTER_MODEL_KEY = "filterModel";
|
|
105
|
+
declare const SORT_MODEL_KEY = "sortModel";
|
|
106
|
+
declare const VISIBILITY_MODEL_KEY = "visibilityModel";
|
|
107
|
+
declare const PINNED_COLUMNS = "pinnedColumns";
|
|
108
|
+
declare const DIMENSION_MODEL_KEY = "dimension";
|
|
109
|
+
declare const FILTER_SEARCH_KEY = "searchModel";
|
|
110
|
+
declare const CATEGORIES: readonly ["paginationModel", "filterModel", "sortModel", "visibilityModel", "dimension", "searchModel", "pinnedColumns"];
|
|
111
|
+
type Category = (typeof CATEGORIES)[number];
|
|
112
|
+
declare const buildStorageKey: ({ id, version, category }: {
|
|
113
|
+
id: string;
|
|
114
|
+
version: number;
|
|
115
|
+
category: Category;
|
|
116
|
+
}) => `${string}:${number}:paginationModel` | `${string}:${number}:filterModel` | `${string}:${number}:sortModel` | `${string}:${number}:visibilityModel` | `${string}:${number}:pinnedColumns` | `${string}:${number}:dimension` | `${string}:${number}:searchModel`;
|
|
117
|
+
declare const clearPreviousVersionStorage: (id: string, currentVersion: number) => void;
|
|
118
|
+
|
|
93
119
|
interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<DataGridProProps, 'rows'> {
|
|
94
120
|
/** License key for MUI Datagrid Pro. */
|
|
95
121
|
license?: string;
|
|
@@ -131,6 +157,63 @@ type StyledDataGridProps = {
|
|
|
131
157
|
|
|
132
158
|
declare const DataGrid: Comp<DataGridProps, HTMLDivElement>;
|
|
133
159
|
|
|
160
|
+
type OperatorValue = string | string[];
|
|
161
|
+
declare const decodeValue: (value: string) => OperatorValue;
|
|
162
|
+
declare const encodeValue: (value: string | undefined) => string;
|
|
163
|
+
declare const urlSearchParamsToString: (searchParams: URLSearchParams) => string;
|
|
164
|
+
declare const numberOperatorEncoder: Record<string, string>;
|
|
165
|
+
declare const numberOperatorDecoder: Record<string, string>;
|
|
166
|
+
declare const isOperatorValueValid: (field: string, operator: OperatorValue, columns: DataGridProps['columns']) => boolean;
|
|
167
|
+
declare const isValueValid: (value: OperatorValue, field: string, columns: DataGridProps['columns'], operator: OperatorValue) => boolean;
|
|
168
|
+
declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel;
|
|
169
|
+
declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
|
|
170
|
+
declare const getSortingFromString: (notParsed: string, columns: DataGridProps['columns']) => GridSortModel | null;
|
|
171
|
+
declare const getSearchParamsFromSorting: (sorting: GridSortItem[]) => URLSearchParams;
|
|
172
|
+
declare const getSearchParamsFromColumnVisibility: (columnVisibility: GridColumnVisibilityModel, columns: DataGridProps['columns']) => URLSearchParams;
|
|
173
|
+
declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel | null;
|
|
174
|
+
declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns | null;
|
|
175
|
+
declare const getSearchParamsFromPinnedColumns: (pinnedColumns: GridPinnedColumns) => URLSearchParams;
|
|
176
|
+
declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
|
|
177
|
+
type FinalSearchInput = {
|
|
178
|
+
filterModel: GridFilterModel;
|
|
179
|
+
sortModel: GridSortModel;
|
|
180
|
+
columnsVisibilityModel: GridColumnVisibilityModel;
|
|
181
|
+
pinnedColumnsModel: GridPinnedColumns;
|
|
182
|
+
search: string;
|
|
183
|
+
columns: DataGridProps['columns'];
|
|
184
|
+
};
|
|
185
|
+
declare const getFinalSearch: ({ search, filterModel, sortModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
186
|
+
type PinnedColumns = {
|
|
187
|
+
left: string[];
|
|
188
|
+
right: string[];
|
|
189
|
+
};
|
|
190
|
+
type ModelsLocalStorage = {
|
|
191
|
+
localStorageFilters: string;
|
|
192
|
+
setLocalStorageFilters: (search: string) => void;
|
|
193
|
+
localStorageSorting: string;
|
|
194
|
+
setLocalStorageSorting: (search: string) => void;
|
|
195
|
+
localStorageColumnsVisibility: string;
|
|
196
|
+
setLocalStorageColumnsVisibility: (search: string) => void;
|
|
197
|
+
localStoragePinnedColumns: string;
|
|
198
|
+
setLocalStoragePinnedColumns: (search: string) => void;
|
|
199
|
+
};
|
|
200
|
+
type ModelsTable = {
|
|
201
|
+
filterModel: GridFilterModel;
|
|
202
|
+
sortModel: GridSortModel;
|
|
203
|
+
columnVisibilityModel: GridColumnVisibilityModel;
|
|
204
|
+
pinnedColumnsModel: PinnedColumns;
|
|
205
|
+
};
|
|
206
|
+
/** Return the state of the table given the URL and the local storage state */
|
|
207
|
+
declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, localStorage: ModelsLocalStorage) => ModelsTable;
|
|
208
|
+
type DataGridModel = {
|
|
209
|
+
filterModel: GridFilterModel;
|
|
210
|
+
sortModel: GridSortModel;
|
|
211
|
+
columnsModel: GridColumnVisibilityModel;
|
|
212
|
+
pinnedColumnsModel: GridPinnedColumns;
|
|
213
|
+
};
|
|
214
|
+
declare const updateUrl: ({ filterModel, sortModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
215
|
+
declare const areFilterModelsEquivalent: (filterModel: GridFilterModel, filterModelToMatch: GridFilterModel) => boolean;
|
|
216
|
+
|
|
134
217
|
interface CompletionResponseItem {
|
|
135
218
|
field: string;
|
|
136
219
|
operator: string;
|
|
@@ -252,4 +335,4 @@ interface TextCellProps extends ComponentProps<'div'> {
|
|
|
252
335
|
*/
|
|
253
336
|
declare const TextCell: Comp<TextCellProps, HTMLDivElement>;
|
|
254
337
|
|
|
255
|
-
export { CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, CompletionResponse, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, DataGridProps, ENDS_WITH_ANY_OF, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, STARTS_WITH_ANY_OF, SelectionStatus, StyledDataGridProps, TextCell, Toolbar, getCompletion, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, operatorList };
|
|
338
|
+
export { CATEGORIES, CONTAINS_ANY_OF, CONTAINS_ANY_OF_I, Category, CompletionResponse, DEFAULT_OPERATORS, DETAIL_PANEL_TOGGLE_COL_DEF, DIMENSION_MODEL_KEY, DOES_NOT_CONTAIN, DOES_NOT_EQUAL, DataGrid, DataGridModel, DataGridProps, ENDS_WITH_ANY_OF, FILTER_MODEL_KEY, FILTER_SEARCH_KEY, FilterConfig, GridToolbarFilterSemanticField, GridToolbarFilterSemanticFieldProps, IS_ANY_OF, IS_BETWEEN, IS_NOT_ANY_OF, PAGINATION_MODEL_KEY, PINNED_COLUMNS, PinnedColumns, SORT_MODEL_KEY, STARTS_WITH_ANY_OF, SelectionStatus, StyledDataGridProps, TextCell, Toolbar, VISIBILITY_MODEL_KEY, areFilterModelsEquivalent, buildStorageKey, clearPreviousVersionStorage, customColumnTypes, decodeValue, encodeValue, getColumnVisibilityFromString, getCompletion, getFilterModelFromString, getFinalSearch, getGridNumericOperators, getGridStringArrayOperators, getGridStringOperators, getModelsParsedOrUpdateLocalStorage, getPinnedColumnsFromString, getRsNumberColumnType, getRsStringColumnType, getSearchParamsFromColumnVisibility, getSearchParamsFromFilterModel, getSearchParamsFromPinnedColumns, getSearchParamsFromSorting, getSearchParamsFromTab, getSortingFromString, isOperatorValueValid, isValueValid, numberOperatorDecoder, numberOperatorEncoder, operatorList, updateUrl, urlSearchParamsToString };
|