@idealyst/datagrid 1.2.14 → 1.2.15

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.14",
3
+ "version": "1.2.15",
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.14",
40
- "@idealyst/theme": "^1.2.14",
39
+ "@idealyst/components": "^1.2.15",
40
+ "@idealyst/theme": "^1.2.15",
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.14",
65
- "@idealyst/theme": "^1.2.14",
64
+ "@idealyst/components": "^1.2.15",
65
+ "@idealyst/theme": "^1.2.15",
66
66
  "@types/react": "^19.1.0",
67
67
  "@types/react-window": "^1.8.8",
68
68
  "react": "^19.1.0",
@@ -32,7 +32,8 @@ export type DataGridStylesheet = {
32
32
  /**
33
33
  * Generate DataGrid styles
34
34
  */
35
- export const dataGridStyles = StyleSheet.create((theme: Theme) => {
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ export const dataGridStyles = StyleSheet.create(((theme: Theme) => {
36
37
  return {
37
38
  container: {
38
39
  borderWidth: 1,
@@ -165,7 +166,7 @@ export const dataGridStyles = StyleSheet.create((theme: Theme) => {
165
166
  variants: {
166
167
  selected: {
167
168
  true: {
168
- backgroundColor: theme.intents.primary.hover,
169
+ backgroundColor: theme.intents.primary.light,
169
170
  },
170
171
  false: {
171
172
  backgroundColor: theme.colors.surface.primary,
@@ -209,4 +210,4 @@ export const dataGridStyles = StyleSheet.create((theme: Theme) => {
209
210
  borderWidth: 0,
210
211
  },
211
212
  };
212
- });
213
+ }) as any);
@@ -120,7 +120,7 @@ export function DataGrid<T extends Record<string, any>>({
120
120
 
121
121
  const renderHeader = () => (
122
122
  <TableRow style={{
123
- ...dataGridStyles.headerRow({ stickyHeader }),
123
+ ...(dataGridStyles.headerRow as any)({ stickyHeader }),
124
124
  minHeight: headerHeight,
125
125
  ...headerStyle,
126
126
  }}>
@@ -140,7 +140,7 @@ export function DataGrid<T extends Record<string, any>>({
140
140
  ) : (
141
141
  <Text
142
142
  weight="bold"
143
- style={dataGridStyles.headerText({ clickable: column.sortable || false })}
143
+ style={(dataGridStyles.headerText as any)({ clickable: column.sortable || false })}
144
144
  >
145
145
  {column.header}
146
146
  {column.sortable && (
@@ -174,7 +174,7 @@ export function DataGrid<T extends Record<string, any>>({
174
174
  <TableRow
175
175
  key={actualIndex}
176
176
  style={{
177
- ...dataGridStyles.row({ selected: isSelected }),
177
+ ...(dataGridStyles.row as any)({ selected: isSelected }),
178
178
  minHeight: rowHeight,
179
179
  ...computedRowStyle,
180
180
  }}
@@ -236,7 +236,7 @@ export function DataGrid<T extends Record<string, any>>({
236
236
  <Table style={{ width: minTableWidth, minWidth: minTableWidth }}>
237
237
  {renderColGroup()}
238
238
  <TableHeader style={{
239
- ...dataGridStyles.header({ stickyHeader: true }),
239
+ ...(dataGridStyles.header as any)({ stickyHeader: true }),
240
240
  position: 'sticky',
241
241
  top: 0,
242
242
  zIndex: 100,
@@ -298,7 +298,7 @@ export function DataGrid<T extends Record<string, any>>({
298
298
  <View style={{ minWidth: minTableWidth }}>
299
299
  <Table style={{ width: minTableWidth, ...(virtualized ? { height: totalHeight } : {}) }}>
300
300
  {renderColGroup()}
301
- <TableHeader style={dataGridStyles.header({ stickyHeader: false })}>
301
+ <TableHeader style={(dataGridStyles.header as any)({ stickyHeader: false })}>
302
302
  {renderHeader()}
303
303
  </TableHeader>
304
304
  <TableBody>
@@ -11,7 +11,7 @@ export const Cell: React.FC<CellProps> = ({ children, style }) => {
11
11
  let resolvedStyle = {};
12
12
  if (typeof style === 'function') {
13
13
  try {
14
- resolvedStyle = style(UnistylesRuntime.theme);
14
+ resolvedStyle = style((UnistylesRuntime as any).theme);
15
15
  } catch (error) {
16
16
  console.warn('Error resolving Cell style:', error);
17
17
  resolvedStyle = {};
@@ -12,7 +12,7 @@ export const Row: React.FC<RowProps> = ({ children, style, onPress }) => {
12
12
  let resolvedStyle = {};
13
13
  if (typeof style === 'function') {
14
14
  try {
15
- resolvedStyle = style(UnistylesRuntime.theme);
15
+ resolvedStyle = style((UnistylesRuntime as any).theme);
16
16
  } catch (error) {
17
17
  console.warn('Error resolving Row style:', error);
18
18
  resolvedStyle = {};
@@ -10,6 +10,9 @@ interface ScrollViewProps {
10
10
  scrollEventThrottle?: number;
11
11
  showsHorizontalScrollIndicator?: boolean;
12
12
  showsVerticalScrollIndicator?: boolean;
13
+ // Native-only props (ignored on web)
14
+ bounces?: boolean;
15
+ directionalLockEnabled?: boolean;
13
16
  }
14
17
 
15
18
  export const ScrollView: React.FC<ScrollViewProps> = ({
@@ -10,7 +10,7 @@ export const Table: React.FC<TableProps> = ({ children, style }) => {
10
10
  let resolvedStyle = {};
11
11
  if (typeof style === 'function') {
12
12
  try {
13
- resolvedStyle = style(UnistylesRuntime.theme);
13
+ resolvedStyle = style((UnistylesRuntime as any).theme);
14
14
  } catch (error) {
15
15
  resolvedStyle = {};
16
16
  }
@@ -43,7 +43,7 @@ export const TableRow: React.FC<TableRowProps> = ({ children, style, onPress })
43
43
  let resolvedStyle = {};
44
44
  if (typeof style === 'function') {
45
45
  try {
46
- resolvedStyle = style(UnistylesRuntime.theme);
46
+ resolvedStyle = style((UnistylesRuntime as any).theme);
47
47
  } catch (error) {
48
48
  resolvedStyle = {};
49
49
  }
@@ -10,7 +10,7 @@ export const TableBody: React.FC<TableBodyProps> = ({ children, style }) => {
10
10
  let resolvedStyle = {};
11
11
  if (typeof style === 'function') {
12
12
  try {
13
- resolvedStyle = style(UnistylesRuntime.theme);
13
+ resolvedStyle = style((UnistylesRuntime as any).theme);
14
14
  } catch (error) {
15
15
  resolvedStyle = {};
16
16
  }
@@ -10,7 +10,7 @@ export const TableHeader: React.FC<TableHeaderProps> = ({ children, style }) =>
10
10
  let resolvedStyle = {};
11
11
  if (typeof style === 'function') {
12
12
  try {
13
- resolvedStyle = style(UnistylesRuntime.theme);
13
+ resolvedStyle = style((UnistylesRuntime as any).theme);
14
14
  } catch (error) {
15
15
  resolvedStyle = {};
16
16
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { VariableSizeList, FixedSizeList } from 'react-window';
2
+ import { VariableSizeList, FixedSizeList, ListChildComponentProps } from 'react-window';
3
3
 
4
4
  interface VirtualizedListProps {
5
5
  data: any[];
@@ -21,26 +21,32 @@ export const VirtualizedList: React.FC<VirtualizedListProps> = ({
21
21
  onScroll,
22
22
  }) => {
23
23
  const isVariableSize = typeof itemHeight === 'function';
24
- const List = isVariableSize ? VariableSizeList : FixedSizeList;
25
-
26
- const listProps = {
27
- height: horizontal ? '100%' : height,
24
+
25
+ const Row = ({ index, style }: ListChildComponentProps) => (
26
+ <div style={{ ...style, display: 'table-row-group' }}>
27
+ {renderItem({ item: data[index], index })}
28
+ </div>
29
+ );
30
+
31
+ const commonProps = {
32
+ height: horizontal ? '100%' as const : height,
28
33
  width: horizontal ? height : width,
29
34
  itemCount: data.length,
30
- itemSize: itemHeight,
31
- layout: horizontal ? 'horizontal' : 'vertical',
35
+ layout: horizontal ? 'horizontal' as const : 'vertical' as const,
32
36
  onScroll,
33
37
  };
34
38
 
35
39
  return (
36
40
  <div style={{ display: 'table', width: '100%', tableLayout: 'fixed' }}>
37
- <List {...listProps}>
38
- {({ index, style }) => (
39
- <div style={{ ...style, display: 'table-row-group' }}>
40
- {renderItem({ item: data[index], index })}
41
- </div>
42
- )}
43
- </List>
41
+ {isVariableSize ? (
42
+ <VariableSizeList {...commonProps} itemSize={itemHeight as (index: number) => number}>
43
+ {Row}
44
+ </VariableSizeList>
45
+ ) : (
46
+ <FixedSizeList {...commonProps} itemSize={itemHeight as number}>
47
+ {Row}
48
+ </FixedSizeList>
49
+ )}
44
50
  </div>
45
51
  );
46
52
  };