@idealyst/datagrid 1.2.57 → 1.2.59
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/datagrid",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.59",
|
|
4
4
|
"description": "High-performance datagrid component for React and React Native",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/datagrid#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"publish:npm": "npm publish"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@idealyst/components": "^1.2.
|
|
40
|
-
"@idealyst/theme": "^1.2.
|
|
39
|
+
"@idealyst/components": "^1.2.59",
|
|
40
|
+
"@idealyst/theme": "^1.2.59",
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
42
|
"react-native": ">=0.60.0",
|
|
43
43
|
"react-native-unistyles": "^3.0.4",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@idealyst/components": "^1.2.
|
|
65
|
-
"@idealyst/theme": "^1.2.
|
|
64
|
+
"@idealyst/components": "^1.2.59",
|
|
65
|
+
"@idealyst/theme": "^1.2.59",
|
|
66
66
|
"@types/react": "^19.1.0",
|
|
67
67
|
"@types/react-window": "^1.8.8",
|
|
68
68
|
"react": "^19.1.0",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StyleProp } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Flattens a style prop (which can be a single style, an array of styles,
|
|
5
|
+
* or nested arrays) into a single style object.
|
|
6
|
+
*/
|
|
7
|
+
export function flattenStyle<T extends object>(
|
|
8
|
+
style: StyleProp<T> | React.CSSProperties | undefined
|
|
9
|
+
): React.CSSProperties {
|
|
10
|
+
if (!style) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(style)) {
|
|
15
|
+
return style.reduce<React.CSSProperties>((acc, s) => {
|
|
16
|
+
return { ...acc, ...flattenStyle(s as StyleProp<T>) };
|
|
17
|
+
}, {});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return style as React.CSSProperties;
|
|
21
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UnistylesRuntime } from 'react-native-unistyles';
|
|
3
|
+
import { flattenStyle } from '../../flattenStyle';
|
|
3
4
|
|
|
4
5
|
interface RowProps {
|
|
5
6
|
children: React.ReactNode;
|
|
@@ -9,7 +10,7 @@ interface RowProps {
|
|
|
9
10
|
|
|
10
11
|
export const Row: React.FC<RowProps> = ({ children, style, onPress }) => {
|
|
11
12
|
// Handle function-based styles (Unistyles 3) with proper theme access
|
|
12
|
-
let resolvedStyle = {};
|
|
13
|
+
let resolvedStyle: React.CSSProperties = {};
|
|
13
14
|
if (typeof style === 'function') {
|
|
14
15
|
try {
|
|
15
16
|
resolvedStyle = style((UnistylesRuntime as any).theme);
|
|
@@ -18,7 +19,7 @@ export const Row: React.FC<RowProps> = ({ children, style, onPress }) => {
|
|
|
18
19
|
resolvedStyle = {};
|
|
19
20
|
}
|
|
20
21
|
} else if (style) {
|
|
21
|
-
resolvedStyle = style;
|
|
22
|
+
resolvedStyle = flattenStyle(style);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const combinedStyle = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UnistylesRuntime } from 'react-native-unistyles';
|
|
3
|
+
import { flattenStyle } from '../../flattenStyle';
|
|
3
4
|
|
|
4
5
|
interface TableProps {
|
|
5
6
|
children: React.ReactNode;
|
|
@@ -7,7 +8,7 @@ interface TableProps {
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export const Table: React.FC<TableProps> = ({ children, style }) => {
|
|
10
|
-
let resolvedStyle = {};
|
|
11
|
+
let resolvedStyle: React.CSSProperties = {};
|
|
11
12
|
if (typeof style === 'function') {
|
|
12
13
|
try {
|
|
13
14
|
resolvedStyle = style((UnistylesRuntime as any).theme);
|
|
@@ -15,9 +16,9 @@ export const Table: React.FC<TableProps> = ({ children, style }) => {
|
|
|
15
16
|
resolvedStyle = {};
|
|
16
17
|
}
|
|
17
18
|
} else if (style) {
|
|
18
|
-
resolvedStyle = style;
|
|
19
|
+
resolvedStyle = flattenStyle(style);
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
const combinedStyle = {
|
|
22
23
|
width: '100%',
|
|
23
24
|
tableLayout: 'fixed' as const,
|
|
@@ -40,7 +41,7 @@ interface TableRowProps {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export const TableRow: React.FC<TableRowProps> = ({ children, style, onPress }) => {
|
|
43
|
-
let resolvedStyle = {};
|
|
44
|
+
let resolvedStyle: React.CSSProperties = {};
|
|
44
45
|
if (typeof style === 'function') {
|
|
45
46
|
try {
|
|
46
47
|
resolvedStyle = style((UnistylesRuntime as any).theme);
|
|
@@ -48,7 +49,7 @@ export const TableRow: React.FC<TableRowProps> = ({ children, style, onPress })
|
|
|
48
49
|
resolvedStyle = {};
|
|
49
50
|
}
|
|
50
51
|
} else if (style) {
|
|
51
|
-
resolvedStyle = style;
|
|
52
|
+
resolvedStyle = flattenStyle(style);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
return (
|
|
@@ -82,7 +83,7 @@ export const TableCell: React.FC<TableCellProps> = ({ children, style, width, co
|
|
|
82
83
|
const combinedStyle = {
|
|
83
84
|
verticalAlign: 'middle',
|
|
84
85
|
...(width && { width }),
|
|
85
|
-
...style,
|
|
86
|
+
...flattenStyle(style),
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
return (
|