@dhiraj0720/report1chart 2.5.2 → 2.5.4

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": "@dhiraj0720/report1chart",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "main": "src/index.jsx",
5
5
  "scripts": {
6
6
  "test": "echo 'No tests'"
@@ -2,14 +2,33 @@ import React from 'react';
2
2
  import { View, Text, ScrollView, StyleSheet } from 'react-native';
3
3
 
4
4
  const Arrow = ({ value }) => (
5
- <Text style={{ color: value >= 0 ? 'green' : 'red', fontWeight: '700' }}>
5
+ <Text
6
+ style={[
7
+ styles.arrow,
8
+ value >= 0 ? styles.up : styles.down,
9
+ ]}
10
+ >
6
11
  {value >= 0 ? '↑' : '↓'} {Math.abs(value)}%
7
12
  </Text>
8
13
  );
9
14
 
10
- const Cell = ({ children, bold }) => (
11
- <View style={styles.cell}>
12
- <Text style={[bold && styles.bold]}>{children}</Text>
15
+ const Cell = ({ children, bold, frozen }) => (
16
+ <View
17
+ style={[
18
+ styles.cell,
19
+ frozen && styles.frozenCell,
20
+ ]}
21
+ >
22
+ <Text
23
+ numberOfLines={1}
24
+ ellipsizeMode="tail"
25
+ style={[
26
+ styles.text,
27
+ bold && styles.bold,
28
+ ]}
29
+ >
30
+ {children}
31
+ </Text>
13
32
  </View>
14
33
  );
15
34
 
@@ -18,14 +37,16 @@ const FrozenTableReport1A = ({ rows }) => {
18
37
  <View style={styles.container}>
19
38
  {/* LEFT FROZEN COLUMN */}
20
39
  <View style={styles.frozen}>
21
- <Cell bold>FAALİYET</Cell>
40
+ <Cell bold frozen>FAALİYET</Cell>
22
41
  {rows.map((r, i) => (
23
- <Cell key={i} bold>{r.name}</Cell>
42
+ <Cell key={i} frozen bold>
43
+ {r.name}
44
+ </Cell>
24
45
  ))}
25
46
  </View>
26
47
 
27
- {/* SCROLLABLE */}
28
- <ScrollView horizontal>
48
+ {/* SCROLLABLE COLUMNS */}
49
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
29
50
  <View>
30
51
  <View style={styles.headerRow}>
31
52
  <Cell bold>2024</Cell>
@@ -51,3 +72,68 @@ const FrozenTableReport1A = ({ rows }) => {
51
72
  };
52
73
 
53
74
  export default FrozenTableReport1A;
75
+
76
+ /* ======================
77
+ STYLES (COMPACT)
78
+ ====================== */
79
+ const styles = StyleSheet.create({
80
+ container: {
81
+ flexDirection: 'row',
82
+ borderWidth: 1,
83
+ borderColor: '#ddd',
84
+ borderRadius: 8,
85
+ overflow: 'hidden',
86
+ backgroundColor: '#fff',
87
+ },
88
+
89
+ frozen: {
90
+ width: 150, // 👈 fixed width
91
+ backgroundColor: '#f5f7fa',
92
+ },
93
+
94
+ frozenCell: {
95
+ alignItems: 'flex-start',
96
+ paddingHorizontal: 8,
97
+ },
98
+
99
+ headerRow: {
100
+ flexDirection: 'row',
101
+ backgroundColor: '#f0f0f0',
102
+ },
103
+
104
+ row: {
105
+ flexDirection: 'row',
106
+ },
107
+
108
+ cell: {
109
+ width: 110, // 👈 compact width
110
+ paddingVertical: 6, // 👈 reduced height
111
+ paddingHorizontal: 6,
112
+ borderBottomWidth: 1,
113
+ borderColor: '#eee',
114
+ justifyContent: 'center',
115
+ alignItems: 'center',
116
+ },
117
+
118
+ text: {
119
+ fontSize: 12, // 👈 smaller text
120
+ color: '#222',
121
+ },
122
+
123
+ bold: {
124
+ fontWeight: '700',
125
+ },
126
+
127
+ arrow: {
128
+ fontSize: 12,
129
+ fontWeight: '700',
130
+ },
131
+
132
+ up: {
133
+ color: '#2e7d32',
134
+ },
135
+
136
+ down: {
137
+ color: '#d32f2f',
138
+ },
139
+ });
@@ -1,35 +1,106 @@
1
1
  import React, { useState } from 'react';
2
- import { Modal, View, Text, TouchableOpacity, Dimensions } from 'react-native';
2
+ import {
3
+ Modal,
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ SafeAreaView,
9
+ } from 'react-native';
10
+ import SafeScreen from './components/SafeScreen';
3
11
  import FrozenTableReport1A from './FrozenTableReport1A';
4
12
 
5
13
  const FullScreenTableModal = ({ visible, rows, onClose }) => {
6
14
  const [landscape, setLandscape] = useState(false);
7
- const { width, height } = Dimensions.get('window');
8
15
 
9
16
  return (
10
- <Modal visible={visible} animationType="slide">
11
- <View style={{ flex: 1, padding: 16 }}>
12
- {/* TOP BAR */}
13
- <View style={{
14
- flexDirection: 'row',
15
- justifyContent: 'space-between',
16
- marginBottom: 8,
17
- }}>
18
- <TouchableOpacity onPress={onClose}>
19
- <Text style={{ fontSize: 18 }}>✕</Text>
20
- </TouchableOpacity>
21
-
22
- <TouchableOpacity onPress={() => setLandscape(!landscape)}>
23
- <Text style={{ fontWeight: '700' }}>⟳ Rotate</Text>
24
- </TouchableOpacity>
25
- </View>
17
+ <Modal
18
+ visible={visible}
19
+ animationType="slide"
20
+ statusBarTranslucent
21
+ >
22
+ <SafeScreen>
23
+ <View style={styles.container}>
24
+ {/* TOP BAR */}
25
+ <View style={styles.header}>
26
+ <TouchableOpacity onPress={onClose}>
27
+ <Text style={styles.close}>✕</Text>
28
+ </TouchableOpacity>
29
+
30
+ <Text style={styles.title}>
31
+ Full Table View
32
+ </Text>
33
+
34
+ <TouchableOpacity
35
+ onPress={() => setLandscape(!landscape)}
36
+ >
37
+ <Text style={styles.rotate}>
38
+ ⟳ Rotate
39
+ </Text>
40
+ </TouchableOpacity>
41
+ </View>
26
42
 
27
- <View style={{ flex: 1 }}>
28
- <FrozenTableReport1A rows={rows} />
43
+ {/* TABLE */}
44
+ <View
45
+ style={[
46
+ styles.tableWrapper,
47
+ landscape && styles.landscape,
48
+ ]}
49
+ >
50
+ <FrozenTableReport1A rows={rows} />
51
+ </View>
29
52
  </View>
30
- </View>
53
+ </SafeScreen>
31
54
  </Modal>
32
55
  );
33
56
  };
34
57
 
35
58
  export default FullScreenTableModal;
59
+
60
+ /* ======================
61
+ STYLES
62
+ ====================== */
63
+ const styles = StyleSheet.create({
64
+ safe: {
65
+ flex: 1,
66
+ backgroundColor: '#fff',
67
+ },
68
+
69
+ container: {
70
+ flex: 1,
71
+ padding: 12,
72
+ },
73
+
74
+ header: {
75
+ flexDirection: 'row',
76
+ alignItems: 'center',
77
+ justifyContent: 'space-between',
78
+ marginBottom: 10,
79
+ },
80
+
81
+ close: {
82
+ fontSize: 20,
83
+ fontWeight: '700',
84
+ },
85
+
86
+ title: {
87
+ fontSize: 16,
88
+ fontWeight: '700',
89
+ },
90
+
91
+ rotate: {
92
+ fontSize: 14,
93
+ fontWeight: '700',
94
+ color: '#1565c0',
95
+ },
96
+
97
+ tableWrapper: {
98
+ flex: 1,
99
+ },
100
+
101
+ /* LANDSCAPE MODE */
102
+ landscape: {
103
+ flex: 1,
104
+ justifyContent: 'center',
105
+ },
106
+ });