@azrico/reactgrid 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/views/DataGrid.tsx +5 -5
package/package.json
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -20,8 +20,8 @@ import clsx from 'clsx';
|
|
|
20
20
|
import { useResizeDetector } from 'react-resize-detector';
|
|
21
21
|
|
|
22
22
|
/* -------------------------------------------------------------------------- */
|
|
23
|
-
type
|
|
24
|
-
type
|
|
23
|
+
type ModifyFields<T, R> = Omit<T, keyof R> & R;
|
|
24
|
+
type MakeWriteable<Type> = {
|
|
25
25
|
-readonly [Key in keyof Type]: Type[Key];
|
|
26
26
|
};
|
|
27
27
|
/* -------------------------------------------------------------------------- */
|
|
@@ -76,7 +76,7 @@ type AzGridProps = {
|
|
|
76
76
|
className?: string;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
type DataGridProps =
|
|
79
|
+
type DataGridProps = ModifyFields<
|
|
80
80
|
AzGridProps,
|
|
81
81
|
{
|
|
82
82
|
columns: ColumnDefinition[];
|
|
@@ -108,7 +108,7 @@ export function AzGrid(props: AzGridProps) {
|
|
|
108
108
|
/* Columns */
|
|
109
109
|
/* -------------------------------------------------------------------------- */
|
|
110
110
|
const cached_columns = React.useMemo(() => {
|
|
111
|
-
const final_columns:
|
|
111
|
+
const final_columns: MakeWriteable<ColumnDefinition>[] = [];
|
|
112
112
|
let mcols = props.columns || [];
|
|
113
113
|
let mcolExts = props.tableColumnExtensions || [];
|
|
114
114
|
let rightColumns = props.rightColumns || [];
|
|
@@ -123,7 +123,7 @@ export function AzGrid(props: AzGridProps) {
|
|
|
123
123
|
.map((r) => {
|
|
124
124
|
if (typeof r === 'string') return { field: r, header: r };
|
|
125
125
|
if (typeof r === 'object') {
|
|
126
|
-
let final_cl:
|
|
126
|
+
let final_cl: MakeWriteable<ColumnDefinition> = {
|
|
127
127
|
name: r.field || r.name || r.key || r.columnName,
|
|
128
128
|
header: r.header || r.title || r.name || '-',
|
|
129
129
|
width: r.width || undefined,
|