cecomponent 2.0.83 → 2.0.85

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.
@@ -29,6 +29,8 @@ export interface CETextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElem
29
29
  iconAlignment?: "left" | "right";
30
30
  /** Custom icon node when iconType = "custom" */
31
31
  icon?: React.ReactNode;
32
+ /** Show a clear (×) button at the end of the input when there is text */
33
+ clearIcon?: boolean;
32
34
  validationType?: "number" | "alphanumeric" | "alpha" | "alphanumericWithSpecial" | "alphaWithoutSpecial";
33
35
  }
34
36
  declare const CEDynamicTextField: React.ForwardRefExoticComponent<CETextFieldProps & React.RefAttributes<HTMLInputElement>>;
@@ -2,12 +2,16 @@ import { default as React } from 'react';
2
2
  export interface CEStepperProps {
3
3
  steps: Array<{
4
4
  label: string;
5
+ description?: string;
6
+ meta?: string;
5
7
  errorMessage?: string;
6
8
  }>;
7
9
  activeStep: number;
8
10
  completedSteps: number[];
9
11
  errorSteps?: number[];
12
+ loadingSteps?: number[];
10
13
  size?: "small" | "medium" | "large";
14
+ direction?: "horizontal" | "vertical";
11
15
  onStepClick?: (stepIndex: number) => void;
12
16
  }
13
17
  declare const CEStepper: React.FC<CEStepperProps>;
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { CustomAction } from '../../../types/customActions';
3
3
  export type ComponentType = "text-input" | "number-input" | "auto-suggest" | "date-picker" | "label-text" | "drop-down-input";
4
+ type FreezeColumnsInput = number | Array<string | number>;
4
5
  export interface ColumnConfig {
5
6
  id: string;
6
7
  label?: string;
@@ -11,6 +12,27 @@ export interface ColumnConfig {
11
12
  elementType?: ComponentType;
12
13
  required?: boolean;
13
14
  }
15
+ export interface GridContextState {
16
+ currentPage: number;
17
+ rowsPerPage: number;
18
+ sortConfig: {
19
+ column: string;
20
+ direction: "asc" | "desc";
21
+ } | null;
22
+ filters: {
23
+ [key: string]: {
24
+ value: string;
25
+ operator: string;
26
+ };
27
+ };
28
+ searchQuery: string;
29
+ /** Optional persisted column visibility state */
30
+ visibleColumns?: string[];
31
+ /** Optional persisted column order state */
32
+ columnOrder?: string[];
33
+ /** Optional persisted frozen column ids */
34
+ frozenColumnIds?: string[];
35
+ }
14
36
  interface CEDataGridDynamicTableProps {
15
37
  title?: React.ReactNode;
16
38
  jsonData: any[];
@@ -45,6 +67,18 @@ interface CEDataGridDynamicTableProps {
45
67
  handleCancelClick?: (row: any, rowIndex: number) => void;
46
68
  handleCopyClick?: (row: any, rowIndex: number) => void;
47
69
  handleViewClick?: (row: any, rowIndex: number) => void;
70
+ /** Enables inline row-level edit mode (Edit → Save/Cancel) inside the grid. */
71
+ enableRowLevelEdit?: boolean;
72
+ /**
73
+ * Custom icon (img src URL or SVG path) to use for the inline row-edit trigger button.
74
+ * When omitted, the default Edit icon is used.
75
+ * Has no effect when enableRowLevelEdit is false.
76
+ */
77
+ rowEditIcon?: string;
78
+ /** Optional explicit allow-list of columns that can be edited in row edit mode. */
79
+ editableColumns?: string[];
80
+ /** Optional predicate for fine-grained editability by row+column. Returns true to allow editing. */
81
+ editableCellPredicate?: (rowData: any, columnId: string) => boolean;
48
82
  clickableColumns?: string[];
49
83
  isExportAllToExcel?: boolean;
50
84
  conditionalClickableColumns?: Record<string, string[]>;
@@ -86,7 +120,7 @@ interface CEDataGridDynamicTableProps {
86
120
  onDataUpdate?: (updatedData: {
87
121
  fullData: any[];
88
122
  updatedRow: any;
89
- }) => void;
123
+ }) => void | Promise<void>;
90
124
  isOverrideCSS?: any;
91
125
  showPagination?: boolean;
92
126
  shouldResetSearchOnDataChange?: boolean;
@@ -129,6 +163,47 @@ interface CEDataGridDynamicTableProps {
129
163
  */
130
164
  customActions?: CustomAction[];
131
165
  shouldColumnPersist?: boolean;
166
+ enableFreezeControls?: boolean;
167
+ /**
168
+ * Controlled freeze: freeze columns by id, label, or 1-based visible index.
169
+ * - number: freeze first N visible columns
170
+ * - (string | number)[]: freeze by column id/label or 1-based index
171
+ */
172
+ freezeColumns?: FreezeColumnsInput;
173
+ /** Initial freeze config for uncontrolled mode (applied once on mount). */
174
+ defaultFreezeColumns?: FreezeColumnsInput;
175
+ /** Emits the current frozen column ids whenever the user pins or unpins a column. */
176
+ onFreezeColumnsChange?: (frozenColumnIds: string[]) => void;
177
+ /**
178
+ * Unique identifier for this grid instance (required for view management)
179
+ */
180
+ gridId?: string;
181
+ /**
182
+ * Enable automatic saving of grid state (columns, pagination)
183
+ * @default false
184
+ */
185
+ enableAutoSave?: boolean;
186
+ /**
187
+ * Enable automatic restoration of grid state on mount
188
+ * @default false
189
+ */
190
+ enableAutoRestore?: boolean;
191
+ /**
192
+ * Exposes manual Save/Restore actions so external buttons can control persistence.
193
+ */
194
+ onViewPersistenceReady?: (actions: {
195
+ saveView: () => void;
196
+ restoreView: () => void;
197
+ }) => void;
198
+ /**
199
+ * Optional external grid context to restore/drive page, page-size, sort, filters and search.
200
+ * Consumers can persist this object and pass it back after data refresh.
201
+ */
202
+ gridContext?: Partial<GridContextState>;
203
+ /**
204
+ * Emits whenever local grid context changes.
205
+ */
206
+ onGridContextChange?: (context: GridContextState) => void;
132
207
  }
133
208
  declare const CEDataGridDynamicTable: React.FC<CEDataGridDynamicTableProps>;
134
209
  export default CEDataGridDynamicTable;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { SavedView } from './types/ViewConfig';
3
+ interface ManageViewsModalProps {
4
+ isOpen: boolean;
5
+ onClose: () => void;
6
+ views: SavedView[];
7
+ onLoadView: (viewId: string) => void;
8
+ onDeleteView: (viewId: string) => void;
9
+ onRenameView: (viewId: string, newName: string) => void;
10
+ isLoading?: boolean;
11
+ }
12
+ declare const ManageViewsModal: React.FC<ManageViewsModalProps>;
13
+ export default ManageViewsModal;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ interface SaveViewModalProps {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSave: (payload: {
6
+ name: string;
7
+ description: string;
8
+ includeFilters: boolean;
9
+ includeSort: boolean;
10
+ includeSearch: boolean;
11
+ }) => void;
12
+ isLoading?: boolean;
13
+ }
14
+ declare const SaveViewModal: React.FC<SaveViewModalProps>;
15
+ export default SaveViewModal;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * Example component demonstrating how to use useViewPersistence hook
4
+ * with external Save/Restore buttons outside the grid
5
+ */
6
+ interface ViewPersistenceControlsProps {
7
+ gridId?: string;
8
+ onSave?: () => void;
9
+ onRestore?: () => void;
10
+ /** @deprecated Use onRestore instead. */
11
+ onLoad?: () => void;
12
+ }
13
+ export declare const ViewPersistenceControls: React.FC<ViewPersistenceControlsProps>;
14
+ export default ViewPersistenceControls;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Hook for managing automatic view persistence
3
+ * Automatically saves changes and provides save/load methods
4
+ */
5
+ export declare const useViewPersistence: (gridId: string | undefined, enabled?: boolean) => {
6
+ autoSave: (visibleColumns: string[], columnOrder: string[], frozenColumnIds: string[] | undefined, currentPage: number, rowsPerPage: number, sortConfig?: any, filters?: any, searchQuery?: string) => void;
7
+ autoRestore: () => {
8
+ visibleColumns: string[];
9
+ columnOrder: string[];
10
+ frozenColumnIds?: string[];
11
+ currentPage: number;
12
+ rowsPerPage: number;
13
+ sort?: any;
14
+ filters?: any;
15
+ searchQuery?: string;
16
+ } | null;
17
+ saveView: (visibleColumns: string[], columnOrder: string[], frozenColumnIds: string[] | undefined, currentPage: number, rowsPerPage: number, viewName?: string, sortConfig?: any, filters?: any, searchQuery?: string) => string | null;
18
+ loadView: (viewId?: string) => {
19
+ visibleColumns: string[];
20
+ columnOrder: string[];
21
+ frozenColumnIds?: string[];
22
+ currentPage: number;
23
+ rowsPerPage: number;
24
+ sort?: any;
25
+ filters?: any;
26
+ searchQuery?: string;
27
+ } | null;
28
+ getSavedViews: () => import('../types/ViewConfig').SavedView[];
29
+ clearAllViews: () => boolean;
30
+ };
31
+ export default useViewPersistence;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * View Configuration Types
3
+ * Defines structure for saving and loading grid view states
4
+ */
5
+ export interface PaginationState {
6
+ currentPage: number;
7
+ rowsPerPage: number;
8
+ }
9
+ export interface ColumnState {
10
+ visibleColumns: string[];
11
+ columnOrder: string[];
12
+ frozenColumnIds?: string[];
13
+ }
14
+ export interface SortState {
15
+ column: string;
16
+ direction: "asc" | "desc";
17
+ }
18
+ export interface FilterState {
19
+ [key: string]: {
20
+ value: string;
21
+ operator: string;
22
+ };
23
+ }
24
+ export interface ViewConfig {
25
+ name: string;
26
+ description?: string;
27
+ timestamp: number;
28
+ columns: ColumnState;
29
+ pagination: PaginationState;
30
+ sort?: SortState | null;
31
+ filters?: FilterState;
32
+ searchQuery?: string;
33
+ }
34
+ export interface SavedView {
35
+ id: string;
36
+ config: ViewConfig;
37
+ }
38
+ export interface ViewContextPayload {
39
+ name: string;
40
+ description?: string;
41
+ includeFilters?: boolean;
42
+ includeSort?: boolean;
43
+ includeSearch?: boolean;
44
+ }
@@ -0,0 +1,53 @@
1
+ import { ViewConfig, SavedView, ColumnState, PaginationState, ViewContextPayload } from '../types/ViewConfig';
2
+ export declare class ViewManager {
3
+ private storageKeyPrefix;
4
+ /**
5
+ * Generate unique storage key for a grid instance
6
+ */
7
+ private getStorageKey;
8
+ /**
9
+ * Get all saved views for a grid
10
+ */
11
+ getSavedViews(gridId: string): SavedView[];
12
+ /**
13
+ * Save a new view configuration
14
+ */
15
+ saveView(gridId: string, payload: ViewContextPayload, columns: ColumnState, pagination: PaginationState, additionalData?: {
16
+ sort?: any;
17
+ filters?: any;
18
+ searchQuery?: string;
19
+ }): SavedView;
20
+ /**
21
+ * Update an existing view
22
+ */
23
+ updateView(gridId: string, viewId: string, columns: ColumnState, pagination: PaginationState, additionalData?: {
24
+ sort?: any;
25
+ filters?: any;
26
+ searchQuery?: string;
27
+ }): SavedView | null;
28
+ /**
29
+ * Load a saved view configuration
30
+ */
31
+ loadView(gridId: string, viewId: string): ViewConfig | null;
32
+ /**
33
+ * Delete a saved view
34
+ */
35
+ deleteView(gridId: string, viewId: string): boolean;
36
+ /**
37
+ * Rename a saved view
38
+ */
39
+ renameView(gridId: string, viewId: string, newName: string, description?: string): SavedView | null;
40
+ /**
41
+ * Clear all views for a grid
42
+ */
43
+ clearAllViews(gridId: string): boolean;
44
+ /**
45
+ * Export views as JSON
46
+ */
47
+ exportViews(gridId: string): string;
48
+ /**
49
+ * Import views from JSON
50
+ */
51
+ importViews(gridId: string, jsonString: string): boolean;
52
+ }
53
+ export declare const viewManager: ViewManager;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cecomponent",
3
3
  "description": "A React component library for building modern UIs for Cleanearth",
4
- "version": "2.0.83",
4
+ "version": "2.0.85",
5
5
  "main": "dist/ce-component-lib.js",
6
6
  "module": "dist/ce-component-lib.mjs",
7
7
  "types": "dist/idex.d.ts",