@astral/ui 0.38.0 → 0.39.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.
- package/DataGrid/DataGridHead/DataGridHead.js +2 -2
- package/DataGrid/DataGridHeadColumn/DataGridHeadColumn.d.ts +1 -1
- package/DataGrid/DataGridHeadColumn/DataGridHeadColumn.js +2 -3
- package/DataGrid/DataGridHeadColumn/styled.d.ts +2 -2
- package/DataGrid/DataGridHeadColumn/styled.js +3 -3
- package/DataGrid/DataGridHeadColumn/types.d.ts +3 -2
- package/DataGrid/types.d.ts +2 -1
- package/esm/DataGrid/DataGridHead/DataGridHead.js +2 -2
- package/esm/DataGrid/DataGridHeadColumn/DataGridHeadColumn.d.ts +1 -1
- package/esm/DataGrid/DataGridHeadColumn/DataGridHeadColumn.js +2 -3
- package/esm/DataGrid/DataGridHeadColumn/styled.d.ts +2 -2
- package/esm/DataGrid/DataGridHeadColumn/styled.js +3 -3
- package/esm/DataGrid/DataGridHeadColumn/types.d.ts +3 -2
- package/esm/DataGrid/types.d.ts +2 -1
- package/package.json +2 -2
|
@@ -62,8 +62,8 @@ function DataGridHead(_a) {
|
|
|
62
62
|
}; }, [sorting]);
|
|
63
63
|
var renderColumns = (0, react_1.useMemo)(function () {
|
|
64
64
|
return columns.map(function (_a) {
|
|
65
|
-
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align,
|
|
66
|
-
return ((0, jsx_runtime_1.jsx)(DataGridHeadColumn_1.DataGridHeadColumn, { sorting: sorting,
|
|
65
|
+
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align, width = _a.width;
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)(DataGridHeadColumn_1.DataGridHeadColumn, { sorting: sorting, field: field, onSort: handleSort, label: label, sortable: sortable, align: align, width: width }, field));
|
|
67
67
|
});
|
|
68
68
|
}, [columns, handleSort, sorting]);
|
|
69
69
|
return ((0, jsx_runtime_1.jsx)(TableHead_1.TableHead, { children: (0, jsx_runtime_1.jsxs)(Table_1.TableRow, { children: [selectable && ((0, jsx_runtime_1.jsx)(Table_1.TableCell, __assign({ padding: "checkbox" }, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: checked, indeterminate: indeterminate, onChange: onSelectAllRows }, void 0) }), void 0)), renderColumns] }, void 0) }, void 0));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DataGridHeadColumnProps } from './types';
|
|
3
|
-
export declare function DataGridHeadColumn<T>({ onSort, field, sortable, align, label, sorting,
|
|
3
|
+
export declare function DataGridHeadColumn<T>({ onSort, field, sortable, align, label, sorting, width, }: DataGridHeadColumnProps<T>): JSX.Element;
|
|
@@ -17,14 +17,13 @@ var Typography_1 = require("../../Typography/Typography");
|
|
|
17
17
|
var constants_1 = require("../constants");
|
|
18
18
|
var styled_1 = require("./styled");
|
|
19
19
|
function DataGridHeadColumn(_a) {
|
|
20
|
-
var onSort = _a.onSort, field = _a.field, sortable = _a.sortable, align = _a.align, label = _a.label, sorting = _a.sorting,
|
|
20
|
+
var onSort = _a.onSort, field = _a.field, sortable = _a.sortable, align = _a.align, label = _a.label, sorting = _a.sorting, width = _a.width;
|
|
21
21
|
var sortParams = sorting.find(function (_a) {
|
|
22
22
|
var fieldId = _a.fieldId;
|
|
23
23
|
return field === fieldId;
|
|
24
24
|
});
|
|
25
25
|
var hideSortIcon = !Boolean(sortParams);
|
|
26
26
|
var sortDirection = sortParams ? sortParams.sort : constants_1.SortStates.ASC;
|
|
27
|
-
|
|
28
|
-
return ((0, jsx_runtime_1.jsxs)(styled_1.StyledTableCell, __assign({ onClick: onSort(field, sortable), fitContent: fitContent, align: align }, { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, __assign({ variant: "pointer" }, { children: label }), void 0), sortable && ((0, jsx_runtime_1.jsx)(styled_1.StyledTableSortLabel, { hideSortIcon: hideSortIcon, direction: sortDirection, active: true }, void 0))] }), void 0));
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(styled_1.StyledTableCell, __assign({ onClick: onSort(field, sortable), align: align, width: width }, { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, __assign({ variant: "pointer" }, { children: label }), void 0), sortable && ((0, jsx_runtime_1.jsx)(styled_1.StyledTableSortLabel, { hideSortIcon: hideSortIcon, direction: sortDirection, active: true }, void 0))] }), void 0));
|
|
29
28
|
}
|
|
30
29
|
exports.DataGridHeadColumn = DataGridHeadColumn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
3
|
export declare const StyledTableSortLabel: import("@emotion/styled").StyledComponent<{
|
|
4
4
|
active?: boolean | undefined;
|
|
5
5
|
children?: import("react").ReactNode;
|
|
@@ -34,5 +34,5 @@ export declare const StyledTableSortLabel: import("@emotion/styled").StyledCompo
|
|
|
34
34
|
export declare const StyledTableCell: import("@emotion/styled").StyledComponent<TableCellProps & {
|
|
35
35
|
theme?: import("@emotion/react").Theme | undefined;
|
|
36
36
|
} & {
|
|
37
|
-
|
|
37
|
+
width?: CSSProperties['width'];
|
|
38
38
|
}, {}, {}>;
|
|
@@ -12,9 +12,9 @@ exports.StyledTableSortLabel = (0, styles_1.styled)(Table_1.TableSortLabel)(temp
|
|
|
12
12
|
return hideSortIcon && 'hidden';
|
|
13
13
|
});
|
|
14
14
|
exports.StyledTableCell = (0, styles_1.styled)(Table_1.TableCell, {
|
|
15
|
-
shouldForwardProp: function (prop) { return prop !== '
|
|
15
|
+
shouldForwardProp: function (prop) { return prop !== 'width'; },
|
|
16
16
|
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n\n cursor: pointer;\n\n user-select: none;\n"], ["\n width: ", ";\n\n cursor: pointer;\n\n user-select: none;\n"])), function (_a) {
|
|
17
|
-
var
|
|
18
|
-
return
|
|
17
|
+
var _b = _a.width, width = _b === void 0 ? 'auto' : _b;
|
|
18
|
+
return width;
|
|
19
19
|
});
|
|
20
20
|
var templateObject_1, templateObject_2;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { DataGridSort } from '../types';
|
|
3
4
|
export declare type DataGridHeadColumnProps<T> = {
|
|
4
5
|
onSort: (field: keyof T, sortable: boolean | undefined) => () => void;
|
|
5
6
|
sorting: DataGridSort<T>[];
|
|
6
|
-
renderCell?: RenderCell<T>;
|
|
7
7
|
label?: string;
|
|
8
8
|
sortable?: boolean;
|
|
9
9
|
align?: TableCellProps['align'];
|
|
10
10
|
field: keyof T;
|
|
11
|
+
width?: CSSProperties['width'];
|
|
11
12
|
};
|
package/DataGrid/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { SortStates } from './constants';
|
|
3
3
|
export declare type CellValue = string | number | boolean | Date | null | undefined | object;
|
|
4
4
|
export declare type SortState = `${SortStates}`;
|
|
@@ -30,4 +30,5 @@ export declare type DataGridColumns<Column extends {}> = {
|
|
|
30
30
|
renderCell?: RenderCell<Column>;
|
|
31
31
|
format?: (data: Column) => CellValue;
|
|
32
32
|
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
|
|
33
|
+
width?: CSSProperties['width'];
|
|
33
34
|
};
|
|
@@ -59,8 +59,8 @@ export function DataGridHead(_a) {
|
|
|
59
59
|
}; }, [sorting]);
|
|
60
60
|
var renderColumns = useMemo(function () {
|
|
61
61
|
return columns.map(function (_a) {
|
|
62
|
-
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align,
|
|
63
|
-
return (_jsx(DataGridHeadColumn, { sorting: sorting,
|
|
62
|
+
var field = _a.field, label = _a.label, sortable = _a.sortable, align = _a.align, width = _a.width;
|
|
63
|
+
return (_jsx(DataGridHeadColumn, { sorting: sorting, field: field, onSort: handleSort, label: label, sortable: sortable, align: align, width: width }, field));
|
|
64
64
|
});
|
|
65
65
|
}, [columns, handleSort, sorting]);
|
|
66
66
|
return (_jsx(TableHead, { children: _jsxs(TableRow, { children: [selectable && (_jsx(TableCell, __assign({ padding: "checkbox" }, { children: _jsx(Checkbox, { checked: checked, indeterminate: indeterminate, onChange: onSelectAllRows }, void 0) }), void 0)), renderColumns] }, void 0) }, void 0));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DataGridHeadColumnProps } from './types';
|
|
3
|
-
export declare function DataGridHeadColumn<T>({ onSort, field, sortable, align, label, sorting,
|
|
3
|
+
export declare function DataGridHeadColumn<T>({ onSort, field, sortable, align, label, sorting, width, }: DataGridHeadColumnProps<T>): JSX.Element;
|
|
@@ -14,13 +14,12 @@ import { Typography } from '../../Typography/Typography';
|
|
|
14
14
|
import { SortStates } from '../constants';
|
|
15
15
|
import { StyledTableCell, StyledTableSortLabel } from './styled';
|
|
16
16
|
export function DataGridHeadColumn(_a) {
|
|
17
|
-
var onSort = _a.onSort, field = _a.field, sortable = _a.sortable, align = _a.align, label = _a.label, sorting = _a.sorting,
|
|
17
|
+
var onSort = _a.onSort, field = _a.field, sortable = _a.sortable, align = _a.align, label = _a.label, sorting = _a.sorting, width = _a.width;
|
|
18
18
|
var sortParams = sorting.find(function (_a) {
|
|
19
19
|
var fieldId = _a.fieldId;
|
|
20
20
|
return field === fieldId;
|
|
21
21
|
});
|
|
22
22
|
var hideSortIcon = !Boolean(sortParams);
|
|
23
23
|
var sortDirection = sortParams ? sortParams.sort : SortStates.ASC;
|
|
24
|
-
|
|
25
|
-
return (_jsxs(StyledTableCell, __assign({ onClick: onSort(field, sortable), fitContent: fitContent, align: align }, { children: [_jsx(Typography, __assign({ variant: "pointer" }, { children: label }), void 0), sortable && (_jsx(StyledTableSortLabel, { hideSortIcon: hideSortIcon, direction: sortDirection, active: true }, void 0))] }), void 0));
|
|
24
|
+
return (_jsxs(StyledTableCell, __assign({ onClick: onSort(field, sortable), align: align, width: width }, { children: [_jsx(Typography, __assign({ variant: "pointer" }, { children: label }), void 0), sortable && (_jsx(StyledTableSortLabel, { hideSortIcon: hideSortIcon, direction: sortDirection, active: true }, void 0))] }), void 0));
|
|
26
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
3
|
export declare const StyledTableSortLabel: import("@emotion/styled").StyledComponent<{
|
|
4
4
|
active?: boolean | undefined;
|
|
5
5
|
children?: import("react").ReactNode;
|
|
@@ -34,5 +34,5 @@ export declare const StyledTableSortLabel: import("@emotion/styled").StyledCompo
|
|
|
34
34
|
export declare const StyledTableCell: import("@emotion/styled").StyledComponent<TableCellProps & {
|
|
35
35
|
theme?: import("@emotion/react").Theme | undefined;
|
|
36
36
|
} & {
|
|
37
|
-
|
|
37
|
+
width?: CSSProperties['width'];
|
|
38
38
|
}, {}, {}>;
|
|
@@ -9,9 +9,9 @@ export var StyledTableSortLabel = styled(TableSortLabel)(templateObject_1 || (te
|
|
|
9
9
|
return hideSortIcon && 'hidden';
|
|
10
10
|
});
|
|
11
11
|
export var StyledTableCell = styled(TableCell, {
|
|
12
|
-
shouldForwardProp: function (prop) { return prop !== '
|
|
12
|
+
shouldForwardProp: function (prop) { return prop !== 'width'; },
|
|
13
13
|
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n\n cursor: pointer;\n\n user-select: none;\n"], ["\n width: ", ";\n\n cursor: pointer;\n\n user-select: none;\n"])), function (_a) {
|
|
14
|
-
var
|
|
15
|
-
return
|
|
14
|
+
var _b = _a.width, width = _b === void 0 ? 'auto' : _b;
|
|
15
|
+
return width;
|
|
16
16
|
});
|
|
17
17
|
var templateObject_1, templateObject_2;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TableCellProps } from '@mui/material';
|
|
2
|
-
import {
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { DataGridSort } from '../types';
|
|
3
4
|
export declare type DataGridHeadColumnProps<T> = {
|
|
4
5
|
onSort: (field: keyof T, sortable: boolean | undefined) => () => void;
|
|
5
6
|
sorting: DataGridSort<T>[];
|
|
6
|
-
renderCell?: RenderCell<T>;
|
|
7
7
|
label?: string;
|
|
8
8
|
sortable?: boolean;
|
|
9
9
|
align?: TableCellProps['align'];
|
|
10
10
|
field: keyof T;
|
|
11
|
+
width?: CSSProperties['width'];
|
|
11
12
|
};
|
package/esm/DataGrid/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { SortStates } from './constants';
|
|
3
3
|
export declare type CellValue = string | number | boolean | Date | null | undefined | object;
|
|
4
4
|
export declare type SortState = `${SortStates}`;
|
|
@@ -30,4 +30,5 @@ export declare type DataGridColumns<Column extends {}> = {
|
|
|
30
30
|
renderCell?: RenderCell<Column>;
|
|
31
31
|
format?: (data: Column) => CellValue;
|
|
32
32
|
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
|
|
33
|
+
width?: CSSProperties['width'];
|
|
33
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astral/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"browser": "./src/index.ts",
|
|
5
5
|
"jest": {
|
|
6
6
|
"moduleNameMapper": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@astral/icons": "^0.
|
|
11
|
+
"@astral/icons": "^0.39.0",
|
|
12
12
|
"@emotion/cache": "11.7.1",
|
|
13
13
|
"@emotion/react": "11.9.0",
|
|
14
14
|
"@emotion/server": "11.4.0",
|