@movable/ui 3.7.3 → 3.8.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.
@@ -0,0 +1,46 @@
1
+ import { BoxProps } from '@mui/material';
2
+ import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
+ export interface InkDataGridTextWrapCellProps {
4
+ /**
5
+ * Word break behavior for long text
6
+ * @default 'break-word'
7
+ */
8
+ wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
9
+ /**
10
+ * Text alignment within the cell
11
+ * @default 'left'
12
+ */
13
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
14
+ /**
15
+ * Custom styling for the cell content
16
+ */
17
+ sx?: BoxProps['sx'];
18
+ }
19
+ /**
20
+ * A DataGrid cell component that handles long strings with text wrapping functionality.
21
+ *
22
+ * Features:
23
+ * - Wraps text within cell boundaries
24
+ * - Adjusts row height dynamically based on content (requires getRowHeight={() => 'auto'} on DataGrid)
25
+ * - Maintains consistent vertical alignment with other cells
26
+ * - Configurable text alignment and word breaking
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const columns: GridColDef[] = [
31
+ * {
32
+ * field: 'description',
33
+ * headerName: 'Description',
34
+ * width: 300,
35
+ * renderCell: (params) => <InkDataGridTextWrapCell {...params} />,
36
+ * },
37
+ * ];
38
+ *
39
+ * <InkDataGrid
40
+ * rows={data}
41
+ * columns={columns}
42
+ * getRowHeight={() => 'auto'}
43
+ * />
44
+ * ```
45
+ */
46
+ export declare function InkDataGridTextWrapCell({ value, wordBreak, textAlign, sx, }: GridRenderCellParams & InkDataGridTextWrapCellProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { GridColDef } from '@mui/x-data-grid-premium';
2
+ import { BoxProps } from '@mui/material';
3
+ import { InkDataGridTextWrapCellProps } from './InkDataGridTextWrapCell';
4
+ /**
5
+ * Helper function to create a column definition with text wrapping cell.
6
+ *
7
+ * @param field - Column field name
8
+ * @param headerName - Column header display name
9
+ * @param options - Additional options for the cell and column
10
+ * @returns GridColDef with text wrapping cell
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const columns = [
15
+ * createTextWrapColumn('description', 'Description', {
16
+ * width: 300,
17
+ * }),
18
+ * ];
19
+ * ```
20
+ */
21
+ export declare function createTextWrapColumn(field: string, headerName: string, options?: {
22
+ width?: number;
23
+ wordBreak?: InkDataGridTextWrapCellProps['wordBreak'];
24
+ textAlign?: InkDataGridTextWrapCellProps['textAlign'];
25
+ sx?: BoxProps['sx'];
26
+ } & Partial<GridColDef>): GridColDef;
@@ -0,0 +1,2 @@
1
+ export { InkDataGridTextWrapCell, type InkDataGridTextWrapCellProps, } from './InkDataGridTextWrapCell';
2
+ export { createTextWrapColumn } from './createTextWrapColumn';
@@ -1,3 +1,4 @@
1
1
  export { InkDataGrid, type InkDataGridProps } from './InkDataGrid';
2
2
  export { InkDataGridEmpty, type InkDataGridEmptyProps, } from './InkDataGridEmpty';
3
3
  export { createEmptyColumns } from './CreateEmptyColumns';
4
+ export { InkDataGridTextWrapCell, type InkDataGridTextWrapCellProps, createTextWrapColumn, } from './CustomCells';
@@ -24,4 +24,4 @@ export { InternalUseOnlyLabel, InternalUseOnlyAlert, } from './InternalUseOnlyIn
24
24
  export { InkChart } from './InkChart';
25
25
  export { InkCard } from './InkCard';
26
26
  export { InkGridToolBar } from './InkGridToolBar';
27
- export { InkDataGrid, InkDataGridEmpty, createEmptyColumns, type InkDataGridProps, type InkDataGridEmptyProps, } from './InkDataGrid';
27
+ export { InkDataGrid, InkDataGridEmpty, InkDataGridTextWrapCell, createEmptyColumns, createTextWrapColumn, type InkDataGridProps, type InkDataGridEmptyProps, type InkDataGridTextWrapCellProps, } from './InkDataGrid';
package/lib/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import { ForwardRefExoticComponent } from 'react';
25
25
  import { Grid2Props } from '@mui/material/Grid2';
26
26
  import { GridColDef } from '@mui/x-data-grid-premium';
27
27
  import { GridColumnVisibilityModel } from '@mui/x-data-grid-premium';
28
+ import { GridRenderCellParams } from '@mui/x-data-grid-premium';
28
29
  import { JSX as JSX_2 } from 'react/jsx-runtime';
29
30
  import { LinkProps } from '@mui/material';
30
31
  import { ListItemIconProps } from '@mui/material/ListItemIcon';
@@ -139,6 +140,30 @@ declare type CopyFn = (text: string) => Promise<boolean>;
139
140
  */
140
141
  export declare function createEmptyColumns(columns: GridColDef[]): GridColDef[];
141
142
 
143
+ /**
144
+ * Helper function to create a column definition with text wrapping cell.
145
+ *
146
+ * @param field - Column field name
147
+ * @param headerName - Column header display name
148
+ * @param options - Additional options for the cell and column
149
+ * @returns GridColDef with text wrapping cell
150
+ *
151
+ * @example
152
+ * ```tsx
153
+ * const columns = [
154
+ * createTextWrapColumn('description', 'Description', {
155
+ * width: 300,
156
+ * }),
157
+ * ];
158
+ * ```
159
+ */
160
+ export declare function createTextWrapColumn(field: string, headerName: string, options?: {
161
+ width?: number;
162
+ wordBreak?: InkDataGridTextWrapCellProps['wordBreak'];
163
+ textAlign?: InkDataGridTextWrapCellProps['textAlign'];
164
+ sx?: BoxProps['sx'];
165
+ } & Partial<GridColDef>): GridColDef;
166
+
142
167
  declare const defaultDrawerWidths: {
143
168
  md: number;
144
169
  lg: number;
@@ -409,6 +434,52 @@ export declare interface InkDataGridProps extends DataGridPremiumProps {
409
434
  disableColumnReorder?: boolean;
410
435
  }
411
436
 
437
+ /**
438
+ * A DataGrid cell component that handles long strings with text wrapping functionality.
439
+ *
440
+ * Features:
441
+ * - Wraps text within cell boundaries
442
+ * - Adjusts row height dynamically based on content (requires getRowHeight={() => 'auto'} on DataGrid)
443
+ * - Maintains consistent vertical alignment with other cells
444
+ * - Configurable text alignment and word breaking
445
+ *
446
+ * @example
447
+ * ```tsx
448
+ * const columns: GridColDef[] = [
449
+ * {
450
+ * field: 'description',
451
+ * headerName: 'Description',
452
+ * width: 300,
453
+ * renderCell: (params) => <InkDataGridTextWrapCell {...params} />,
454
+ * },
455
+ * ];
456
+ *
457
+ * <InkDataGrid
458
+ * rows={data}
459
+ * columns={columns}
460
+ * getRowHeight={() => 'auto'}
461
+ * />
462
+ * ```
463
+ */
464
+ export declare function InkDataGridTextWrapCell({ value, wordBreak, textAlign, sx, }: GridRenderCellParams & InkDataGridTextWrapCellProps): JSX_2.Element;
465
+
466
+ export declare interface InkDataGridTextWrapCellProps {
467
+ /**
468
+ * Word break behavior for long text
469
+ * @default 'break-word'
470
+ */
471
+ wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
472
+ /**
473
+ * Text alignment within the cell
474
+ * @default 'left'
475
+ */
476
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
477
+ /**
478
+ * Custom styling for the cell content
479
+ */
480
+ sx?: BoxProps['sx'];
481
+ }
482
+
412
483
  export declare function InkDialog({ Title, Content, Actions, onClose, hideCloseButton, ActionsProp, ...props }: InkDialogProps): JSX_2.Element;
413
484
 
414
485
  export declare const inkDialog: InkDialogPageObject;