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