@jescon-technologies/react-native-ui-kit 0.0.21 → 0.0.22
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/index.d.ts +3 -1
- package/index.js +3 -1
- package/package.json +1 -1
- package/src/CustomComponents/CHeaderView.tsx +86 -0
- package/src/CustomComponents/HeaderBlock.tsx +1 -1
- package/src/Hoc/HDashboard.tsx +36 -34
- package/src/Hoc/HHeading.tsx +121 -0
- package/src/Hoc/HProvider.tsx +1 -8
- package/src/Hoc/HWrappedComponent.tsx +183 -0
package/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { default as ABlink } from './src/Alerts/ABlink';
|
|
|
5
5
|
export { default as HIcons } from './src/Hoc/HIcons';
|
|
6
6
|
export { default as HView } from './src/Hoc/HView';
|
|
7
7
|
export { default as HProvider } from './src/Hoc/HProvider';
|
|
8
|
+
export { default as HWrappedComponent } from './src/Hoc/HWrappedComponent';
|
|
9
|
+
export { default as HHeading } from './src/Hoc/HHeading';
|
|
8
10
|
export { default as HShadowButton } from './src/Hoc/HShadowButton';
|
|
9
11
|
export { default as Navigation } from './src/Navigation/PageNavigation';
|
|
10
12
|
export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
|
|
@@ -29,5 +31,5 @@ export * from './src/Navigation/useNavigation';
|
|
|
29
31
|
export * from './src/Navigation/useIsFocused';
|
|
30
32
|
export * from './src/Navigation/useFocusEffect';
|
|
31
33
|
export * from './src/CommonStyle/ComponentFunctions';
|
|
32
|
-
export * from '../../../src/Common/
|
|
34
|
+
export * from '../../../src/Common/ApiConstants'
|
|
33
35
|
export * from '../../../src/Common/Global';
|
package/index.js
CHANGED
|
@@ -5,6 +5,8 @@ export { default as ABlink } from './src/Alerts/ABlink';
|
|
|
5
5
|
export { default as HIcons } from './src/Hoc/HIcons';
|
|
6
6
|
export { default as HView } from './src/Hoc/HView';
|
|
7
7
|
export { default as HProvider } from './src/Hoc/HProvider';
|
|
8
|
+
export { default as HWrappedComponent } from './src/Hoc/HWrappedComponent';
|
|
9
|
+
export { default as HHeading } from './src/Hoc/HHeading';
|
|
8
10
|
export { default as HShadowButton } from './src/Hoc/HShadowButton';
|
|
9
11
|
export { default as Navigation } from './src/Navigation/PageNavigation';
|
|
10
12
|
export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
|
|
@@ -29,5 +31,5 @@ export * from './src/Navigation/useNavigation';
|
|
|
29
31
|
export * from './src/Navigation/useIsFocused';
|
|
30
32
|
export * from './src/Navigation/useFocusEffect';
|
|
31
33
|
export * from './src/CommonStyle/ComponentFunctions';
|
|
32
|
-
export * from '../../../src/Common/
|
|
34
|
+
export * from '../../../src/Common/ApiConstants'
|
|
33
35
|
export * from '../../../src/Common/Global';
|
package/package.json
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
View,
|
|
5
|
+
ScrollView,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
StyleProp,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Types
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
export interface CHeaderViewProps {
|
|
16
|
+
/** Extra style merged onto the outer container. */
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
/** Header rail content (usually a column/row of buttons). */
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Styles
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
base: {
|
|
28
|
+
backgroundColor: 'white',
|
|
29
|
+
},
|
|
30
|
+
content: {
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
},
|
|
33
|
+
webContent: {
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
paddingVertical: '1%',
|
|
36
|
+
},
|
|
37
|
+
mobileContent: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
paddingHorizontal: '1%',
|
|
40
|
+
paddingRight: '10%',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Component
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
const CHeaderView: React.FC<CHeaderViewProps> = ({ style, children }) => {
|
|
49
|
+
const isWeb = Platform.OS === 'web';
|
|
50
|
+
|
|
51
|
+
const containerStyle: ViewStyle = isWeb
|
|
52
|
+
? {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
left: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
width: 80,
|
|
57
|
+
borderRightWidth: 1,
|
|
58
|
+
borderRightColor: 'lightgrey',
|
|
59
|
+
zIndex: 10,
|
|
60
|
+
elevation: 10,
|
|
61
|
+
maxHeight: '90%',
|
|
62
|
+
}
|
|
63
|
+
: {
|
|
64
|
+
borderTopWidth: 1,
|
|
65
|
+
borderTopColor: 'lightgrey',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<View style={[styles.base, containerStyle, style]}>
|
|
70
|
+
<ScrollView
|
|
71
|
+
horizontal={!isWeb}
|
|
72
|
+
showsHorizontalScrollIndicator={false}
|
|
73
|
+
showsVerticalScrollIndicator={false}
|
|
74
|
+
bounces={false}
|
|
75
|
+
contentContainerStyle={[
|
|
76
|
+
styles.content,
|
|
77
|
+
isWeb ? styles.webContent : styles.mobileContent,
|
|
78
|
+
]}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</ScrollView>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default CHeaderView;
|
|
@@ -33,7 +33,7 @@ import NetworkServiceCall from '../Common/NetworkServiceCall';
|
|
|
33
33
|
import HIcons from '../Hoc/HIcons';
|
|
34
34
|
import ResponseComponentContext from '../Handlers/ResponseComponentContext';
|
|
35
35
|
import { Global } from '../../../../../src/Common/Global';
|
|
36
|
-
import { notifyURL } from '
|
|
36
|
+
import { notifyURL } from '@jescon-technologies/react-native-ui-kit';
|
|
37
37
|
|
|
38
38
|
// import HelpdeskScreenFocus from '../Helpdesk/View/HelpdeskScreenFocus';
|
|
39
39
|
// import CHelpdeskView from '../Helpdesk/View/CHelpdeskView';
|
package/src/Hoc/HDashboard.tsx
CHANGED
|
@@ -30,7 +30,7 @@ import NetworkServiceCall from '../Common/NetworkServiceCall';
|
|
|
30
30
|
import { notifyMessage } from '../CommonStyle/ComponentFunctions';
|
|
31
31
|
import HShadowButton from './HShadowButton';
|
|
32
32
|
import HIcons from './HIcons';
|
|
33
|
-
import { normalize} from '../CommonStyle/ComponentFunctions';
|
|
33
|
+
import { normalize } from '../CommonStyle/ComponentFunctions';
|
|
34
34
|
import { Global } from '../../../../../src/Common/Global';
|
|
35
35
|
import SDateTimePicker from '../StaticComponents/SDateTimePicker';
|
|
36
36
|
|
|
@@ -117,7 +117,7 @@ interface ContentConfig {
|
|
|
117
117
|
interface ChartStyleConfig {
|
|
118
118
|
bar?: Record<string, unknown>;
|
|
119
119
|
line?: Record<string, unknown>;
|
|
120
|
-
pie?: { centerCaption?: string;
|
|
120
|
+
pie?: { centerCaption?: string;[key: string]: unknown };
|
|
121
121
|
axisTextStyle?: TextStyle;
|
|
122
122
|
[key: string]: unknown;
|
|
123
123
|
}
|
|
@@ -493,7 +493,7 @@ const WIDGET_RENDERERS: Record<string, React.ComponentType<WidgetRendererProps>>
|
|
|
493
493
|
// Widget shell
|
|
494
494
|
// ---------------------------------------------------------------------------
|
|
495
495
|
|
|
496
|
-
interface WidgetBodyProps extends WidgetRendererProps {}
|
|
496
|
+
interface WidgetBodyProps extends WidgetRendererProps { }
|
|
497
497
|
|
|
498
498
|
const WidgetBody: React.FC<WidgetBodyProps> = ({ widget, theme, content, chartStyle }) => {
|
|
499
499
|
const Renderer = WIDGET_RENDERERS[widget.type];
|
|
@@ -507,7 +507,7 @@ const WidgetBody: React.FC<WidgetBodyProps> = ({ widget, theme, content, chartSt
|
|
|
507
507
|
);
|
|
508
508
|
};
|
|
509
509
|
|
|
510
|
-
interface DashboardWidgetProps extends WidgetRendererProps {}
|
|
510
|
+
interface DashboardWidgetProps extends WidgetRendererProps { }
|
|
511
511
|
|
|
512
512
|
const DashboardWidget: React.FC<DashboardWidgetProps> = ({
|
|
513
513
|
widget,
|
|
@@ -884,21 +884,21 @@ const styles = StyleSheet.create({
|
|
|
884
884
|
justifyContent: 'center',
|
|
885
885
|
padding: 24,
|
|
886
886
|
},
|
|
887
|
-
centerStateText: { marginTop:
|
|
887
|
+
centerStateText: { marginTop: 8, fontSize: 14, textAlign: 'center' },
|
|
888
888
|
header: {
|
|
889
|
-
|
|
890
|
-
paddingBottom: 10,
|
|
889
|
+
paddingVertical: 8,
|
|
891
890
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
892
|
-
marginBottom:
|
|
891
|
+
marginBottom: 8,
|
|
893
892
|
},
|
|
894
893
|
headerTop: {
|
|
895
894
|
flexDirection: 'row',
|
|
896
895
|
alignItems: 'flex-start',
|
|
897
896
|
justifyContent: 'space-between',
|
|
897
|
+
width: '100%',
|
|
898
898
|
},
|
|
899
899
|
headerIdentity: { flexDirection: 'row', alignItems: 'center', flex: 1 },
|
|
900
900
|
headerCopy: { flex: 1 },
|
|
901
|
-
dashboardTitle: { fontSize: 24, fontWeight: '800', letterSpacing: -0.2 },
|
|
901
|
+
dashboardTitle: { fontSize: 24, fontWeight: '800', letterSpacing: -0.2, width: '50%' },
|
|
902
902
|
dateRangeBadge: {
|
|
903
903
|
flexDirection: 'row',
|
|
904
904
|
alignItems: 'center',
|
|
@@ -908,6 +908,7 @@ const styles = StyleSheet.create({
|
|
|
908
908
|
padding: 7,
|
|
909
909
|
borderWidth: 1,
|
|
910
910
|
borderRadius: 14,
|
|
911
|
+
width: '50%',
|
|
911
912
|
},
|
|
912
913
|
dateRangeIconWrap: {
|
|
913
914
|
width: 32,
|
|
@@ -919,15 +920,15 @@ const styles = StyleSheet.create({
|
|
|
919
920
|
dateRangeCopy: { flexShrink: 1, marginLeft: 9 },
|
|
920
921
|
dateRangeLabel: { fontSize: 9, fontWeight: '800', letterSpacing: 0.7 },
|
|
921
922
|
dateRange: { fontSize: 12, fontWeight: '700', marginTop: 2 },
|
|
922
|
-
departmentSelector: { flexDirection: 'row', paddingVertical:
|
|
923
|
+
departmentSelector: { flexDirection: 'row', paddingVertical: 8 },
|
|
923
924
|
departmentButton: {
|
|
924
925
|
flexDirection: 'row',
|
|
925
926
|
alignItems: 'center',
|
|
926
|
-
gap:
|
|
927
|
+
gap: 6,
|
|
927
928
|
borderWidth: 1,
|
|
928
929
|
borderRadius: 12,
|
|
929
|
-
paddingHorizontal:
|
|
930
|
-
paddingVertical:
|
|
930
|
+
paddingHorizontal: 12,
|
|
931
|
+
paddingVertical: 6,
|
|
931
932
|
marginRight: 8,
|
|
932
933
|
},
|
|
933
934
|
departmentButtonText: { fontSize: 12, fontWeight: '700' },
|
|
@@ -935,8 +936,8 @@ const styles = StyleSheet.create({
|
|
|
935
936
|
width: '50%',
|
|
936
937
|
borderWidth: 1,
|
|
937
938
|
borderRadius: 12,
|
|
938
|
-
padding:
|
|
939
|
-
marginBottom:
|
|
939
|
+
padding: 12,
|
|
940
|
+
marginBottom: 8,
|
|
940
941
|
minHeight: 88,
|
|
941
942
|
overflow: 'hidden',
|
|
942
943
|
},
|
|
@@ -950,13 +951,13 @@ const styles = StyleSheet.create({
|
|
|
950
951
|
alignItems: 'flex-start',
|
|
951
952
|
justifyContent: 'space-between',
|
|
952
953
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
953
|
-
paddingBottom:
|
|
954
|
-
marginBottom:
|
|
954
|
+
paddingBottom: 8,
|
|
955
|
+
marginBottom: 8,
|
|
955
956
|
},
|
|
956
|
-
widgetHeaderCopy: { flex: 1, paddingRight:
|
|
957
|
-
widgetIcon: { marginRight:
|
|
957
|
+
widgetHeaderCopy: { flex: 1, paddingRight: 8 },
|
|
958
|
+
widgetIcon: { marginRight: 6, marginTop: 1 },
|
|
958
959
|
widgetTitle: { fontSize: 16, fontWeight: '800', letterSpacing: -0.2 },
|
|
959
|
-
widgetSubtitle: { fontSize: 12, marginTop:
|
|
960
|
+
widgetSubtitle: { fontSize: 12, marginTop: 2, lineHeight: 17, fontWeight: '500' },
|
|
960
961
|
detailsButton: {
|
|
961
962
|
height: 24,
|
|
962
963
|
flexDirection: 'row',
|
|
@@ -964,7 +965,7 @@ const styles = StyleSheet.create({
|
|
|
964
965
|
justifyContent: 'center',
|
|
965
966
|
borderWidth: 1,
|
|
966
967
|
borderRadius: 12,
|
|
967
|
-
paddingHorizontal:
|
|
968
|
+
paddingHorizontal: 8,
|
|
968
969
|
marginTop: 1,
|
|
969
970
|
},
|
|
970
971
|
detailsButtonText: { fontSize: 10, fontWeight: '700' },
|
|
@@ -973,24 +974,24 @@ const styles = StyleSheet.create({
|
|
|
973
974
|
flexDirection: 'row',
|
|
974
975
|
flexWrap: 'wrap',
|
|
975
976
|
justifyContent: 'flex-start',
|
|
976
|
-
marginTop:
|
|
977
|
+
marginTop: 8,
|
|
977
978
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
978
|
-
paddingTop:
|
|
979
|
+
paddingTop: 8,
|
|
979
980
|
},
|
|
980
981
|
chartLegendItem: {
|
|
981
982
|
width: '50%',
|
|
982
983
|
flexDirection: 'row',
|
|
983
984
|
alignItems: 'center',
|
|
984
|
-
paddingVertical:
|
|
985
|
-
paddingRight:
|
|
985
|
+
paddingVertical: 4,
|
|
986
|
+
paddingRight: 8,
|
|
986
987
|
},
|
|
987
|
-
chartLegendDot: { width: 8, height: 8, borderRadius: 4, marginRight:
|
|
988
|
+
chartLegendDot: { width: 8, height: 8, borderRadius: 4, marginRight: 6 },
|
|
988
989
|
chartLegendLabel: { flex: 1, fontSize: 10, fontWeight: '600' },
|
|
989
990
|
chartLegendValue: { fontSize: 10, fontWeight: '800' },
|
|
990
|
-
emptyText: { fontSize: 13, textAlign: 'center', paddingVertical:
|
|
991
|
+
emptyText: { fontSize: 13, textAlign: 'center', paddingVertical: 16 },
|
|
991
992
|
itemTitle: { fontSize: 13, fontWeight: '700' },
|
|
992
|
-
itemSubtitle: { fontSize: 11, marginTop:
|
|
993
|
-
progressTrack: { height: 10, borderRadius: 8, overflow: 'hidden', marginVertical:
|
|
993
|
+
itemSubtitle: { fontSize: 11, marginTop: 2 },
|
|
994
|
+
progressTrack: { height: 10, borderRadius: 8, overflow: 'hidden', marginVertical: 4 },
|
|
994
995
|
progressFill: { height: '100%', borderRadius: 8 },
|
|
995
996
|
heatmap: { flexDirection: 'row', flexWrap: 'wrap' },
|
|
996
997
|
heatCell: {
|
|
@@ -1000,21 +1001,22 @@ const styles = StyleSheet.create({
|
|
|
1000
1001
|
minHeight: 58,
|
|
1001
1002
|
alignItems: 'center',
|
|
1002
1003
|
justifyContent: 'center',
|
|
1003
|
-
margin:
|
|
1004
|
+
margin: 2,
|
|
1004
1005
|
borderRadius: 8,
|
|
1005
1006
|
},
|
|
1006
1007
|
heatLabel: { fontSize: 11, fontWeight: '600' },
|
|
1007
|
-
heatValue: { fontSize: 14, fontWeight: '700', marginTop:
|
|
1008
|
-
rankRow: { flexDirection: 'row', alignItems: 'center', paddingVertical:
|
|
1008
|
+
heatValue: { fontSize: 14, fontWeight: '700', marginTop: 2 },
|
|
1009
|
+
rankRow: { flexDirection: 'row', alignItems: 'center', paddingVertical: 4 },
|
|
1009
1010
|
rankNumber: { width: 24, fontSize: 13, fontWeight: '700' },
|
|
1010
1011
|
rankBody: { flex: 1 },
|
|
1011
|
-
rankLabels: { flexDirection: 'row', justifyContent: 'space-between', marginBottom:
|
|
1012
|
+
rankLabels: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 2 },
|
|
1012
1013
|
datePickerRow: {
|
|
1013
1014
|
justifyContent: 'space-between',
|
|
1014
|
-
|
|
1015
|
+
width: '50%',
|
|
1015
1016
|
},
|
|
1016
1017
|
datePickerWrapper: {
|
|
1017
1018
|
marginHorizontal: '2%',
|
|
1019
|
+
marginTop: '2%',
|
|
1018
1020
|
},
|
|
1019
1021
|
datePickerLabel: {
|
|
1020
1022
|
position: 'absolute',
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, Text, StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
import { normalize } from '../CommonStyle/ComponentFunctions';
|
|
4
|
+
import HIcons from './HIcons';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Types
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
export interface HHeadingStyles {
|
|
11
|
+
iconname?: string;
|
|
12
|
+
icongroup?: number;
|
|
13
|
+
bgcolor?: string;
|
|
14
|
+
iconsize?: number;
|
|
15
|
+
iconcolor?: string;
|
|
16
|
+
displaytext?: string;
|
|
17
|
+
textsize?: number;
|
|
18
|
+
textcolor?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HHeadingProps {
|
|
22
|
+
/** Style bag — all keys optional; defaults are applied for missing keys. */
|
|
23
|
+
styles?: HHeadingStyles;
|
|
24
|
+
/** Optional expand handler; receives `1` when tapped. */
|
|
25
|
+
Expand?: (value: number) => void;
|
|
26
|
+
/** Right-side content (icons, buttons, etc.). */
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Defaults
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
const DEFAULT_STYLES: Required<
|
|
36
|
+
Pick<
|
|
37
|
+
HHeadingStyles,
|
|
38
|
+
| 'iconname'
|
|
39
|
+
| 'bgcolor'
|
|
40
|
+
| 'iconsize'
|
|
41
|
+
| 'iconcolor'
|
|
42
|
+
| 'displaytext'
|
|
43
|
+
| 'textsize'
|
|
44
|
+
| 'textcolor'
|
|
45
|
+
>
|
|
46
|
+
> = {
|
|
47
|
+
iconname: 'file',
|
|
48
|
+
bgcolor: '#f2efef',
|
|
49
|
+
iconsize: 18,
|
|
50
|
+
iconcolor: 'black',
|
|
51
|
+
displaytext: 'Testing',
|
|
52
|
+
textsize: 15,
|
|
53
|
+
textcolor: 'darkblue',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Component
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
function HHeading(props: HHeadingProps): React.ReactElement {
|
|
61
|
+
const styles: HHeadingStyles =
|
|
62
|
+
props.styles !== undefined ? props.styles : DEFAULT_STYLES;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<TouchableOpacity
|
|
66
|
+
style={{
|
|
67
|
+
backgroundColor: styles.bgcolor ?? '#f2efef',
|
|
68
|
+
paddingVertical: 3,
|
|
69
|
+
paddingHorizontal: 6,
|
|
70
|
+
marginTop: 3,
|
|
71
|
+
marginBottom: 2,
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
elevation: 5,
|
|
77
|
+
borderWidth: 0.5,
|
|
78
|
+
borderColor: 'lightgrey',
|
|
79
|
+
width: '99%',
|
|
80
|
+
alignSelf: 'center',
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<TouchableOpacity
|
|
84
|
+
onPress={() => (props.Expand !== undefined ? props.Expand(1) : null)}
|
|
85
|
+
disabled={props.Expand === undefined}
|
|
86
|
+
style={{ width: normalize(30), alignItems: 'center', marginRight: 5 }}
|
|
87
|
+
>
|
|
88
|
+
<HIcons.Icons
|
|
89
|
+
icongroup={styles.icongroup ?? 5}
|
|
90
|
+
name={styles.iconname}
|
|
91
|
+
color={styles.iconcolor}
|
|
92
|
+
size={normalize(styles.iconsize ?? DEFAULT_STYLES.iconsize)}
|
|
93
|
+
/>
|
|
94
|
+
</TouchableOpacity>
|
|
95
|
+
|
|
96
|
+
<Text
|
|
97
|
+
style={{
|
|
98
|
+
textShadowRadius: 2,
|
|
99
|
+
fontSize: normalize(styles.textsize ?? DEFAULT_STYLES.textsize),
|
|
100
|
+
fontWeight: 'bold',
|
|
101
|
+
color: styles.textcolor,
|
|
102
|
+
flex: 1,
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
{styles.displaytext}
|
|
106
|
+
</Text>
|
|
107
|
+
|
|
108
|
+
<View
|
|
109
|
+
style={{
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
width: normalize(60),
|
|
112
|
+
justifyContent: 'space-around',
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
{props.children}
|
|
116
|
+
</View>
|
|
117
|
+
</TouchableOpacity>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default memo(HHeading);
|
package/src/Hoc/HProvider.tsx
CHANGED
|
@@ -2,27 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import HView from '../Hoc/HView';
|
|
3
3
|
import Navigation from '../Navigation/PageNavigation';
|
|
4
4
|
import ErrorBoundary from '../Common/ErrorBoundary';
|
|
5
|
-
import { GlobalProvider } from '../Common/GlobalContext';
|
|
6
5
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
7
6
|
|
|
8
7
|
interface HProviderProps {
|
|
9
8
|
components: Record<string, React.ComponentType<any>>;
|
|
10
9
|
screens: any;
|
|
11
|
-
Global?: object;
|
|
12
|
-
global?: object;
|
|
13
10
|
}
|
|
14
11
|
export default function HProvider(props: HProviderProps) {
|
|
15
|
-
const global = props.Global ?? props.global;
|
|
16
|
-
|
|
17
12
|
return (
|
|
18
|
-
|
|
19
|
-
<SafeAreaView style={{ flex: 1 }}>
|
|
13
|
+
<SafeAreaView style={{ flex: 1 }} edges={['left', 'right', 'bottom']}>
|
|
20
14
|
<ErrorBoundary>
|
|
21
15
|
<HView components={props.components}>
|
|
22
16
|
<Navigation screens={props.screens} />
|
|
23
17
|
</HView>
|
|
24
18
|
</ErrorBoundary>
|
|
25
19
|
</SafeAreaView>
|
|
26
|
-
</GlobalProvider>
|
|
27
20
|
);
|
|
28
21
|
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
Dimensions,
|
|
6
|
+
Platform,
|
|
7
|
+
StyleProp,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
TextStyle,
|
|
10
|
+
DimensionValue,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
|
|
13
|
+
import HeaderBlock from '../CustomComponents/HeaderBlock';
|
|
14
|
+
import HView from './HView';
|
|
15
|
+
import { Global, GlobalOptionDetail } from '../../../../../src/Common/Global';
|
|
16
|
+
import CHeaderView from '../CustomComponents/CHeaderView';
|
|
17
|
+
import HShadowCountButton from './HShadowButton';
|
|
18
|
+
import { normalize, CButtonShadow } from '../CommonStyle/ComponentFunctions';
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Types
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
/** Extended shape — `Global.optiondetail` items need these extra fields. */
|
|
25
|
+
interface OptionDetailItem extends GlobalOptionDetail {
|
|
26
|
+
keyid?: string | number;
|
|
27
|
+
icongroup?: number;
|
|
28
|
+
icon?: string;
|
|
29
|
+
display?: string;
|
|
30
|
+
color?: string;
|
|
31
|
+
visibility?: boolean;
|
|
32
|
+
component?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface HWrappedComponentParams {
|
|
36
|
+
component: string;
|
|
37
|
+
data: OptionDetailItem;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface HWrappedComponentProps {
|
|
42
|
+
route: {
|
|
43
|
+
params: HWrappedComponentParams;
|
|
44
|
+
key?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// Constants
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
const BUTTON_SIZE =
|
|
54
|
+
Platform.OS === 'web'
|
|
55
|
+
? Dimensions.get('screen').height * 0.1
|
|
56
|
+
: Dimensions.get('screen').height * 0.05;
|
|
57
|
+
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Component
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
const HWrappedComponent: React.FC<HWrappedComponentProps> = ({ route }) => {
|
|
63
|
+
const { component, data, ...restParams } = route.params;
|
|
64
|
+
|
|
65
|
+
const [callback, setCallback] = useState<boolean>(false);
|
|
66
|
+
const [selectedComponent, setSelectedComponent] = useState<string>(component);
|
|
67
|
+
const [selectedData, setSelectedData] = useState<OptionDetailItem>(data);
|
|
68
|
+
|
|
69
|
+
const handleHeaderBack = useCallback(() => {
|
|
70
|
+
setCallback((prev) => !prev);
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
const handleCirclePress = (item: OptionDetailItem): void => {
|
|
74
|
+
setSelectedData(item);
|
|
75
|
+
setSelectedComponent(item.component ?? '');
|
|
76
|
+
console.log('ViewHOCComponent', JSON.stringify(item));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const optionDetail = Global.optiondetail as OptionDetailItem[] | null | undefined;
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<View style={styles.container}>
|
|
83
|
+
<HeaderBlock callback={handleHeaderBack} data={data} />
|
|
84
|
+
<CHeaderView>
|
|
85
|
+
{optionDetail?.map(
|
|
86
|
+
(item) =>
|
|
87
|
+
item.visibility && (
|
|
88
|
+
<HShadowCountButton
|
|
89
|
+
key={item.keyid}
|
|
90
|
+
useicon
|
|
91
|
+
usetext
|
|
92
|
+
disabled={false}
|
|
93
|
+
buttonstyle={[
|
|
94
|
+
styles.button,
|
|
95
|
+
{
|
|
96
|
+
...CButtonShadow(),
|
|
97
|
+
width: BUTTON_SIZE,
|
|
98
|
+
height: BUTTON_SIZE,
|
|
99
|
+
borderColor: item.color,
|
|
100
|
+
backgroundColor:
|
|
101
|
+
item === selectedData
|
|
102
|
+
? Global.AppTheme.selected_color
|
|
103
|
+
: Global.AppTheme.bg_button,
|
|
104
|
+
},
|
|
105
|
+
]}
|
|
106
|
+
iconcolor={item.color}
|
|
107
|
+
icongroup={item.icongroup || 5}
|
|
108
|
+
iconname={item.icon}
|
|
109
|
+
iconsize={
|
|
110
|
+
Platform.OS === 'web' ? normalize(25) : normalize(15)
|
|
111
|
+
}
|
|
112
|
+
displaytext={item.display}
|
|
113
|
+
buttonCallback={() => handleCirclePress(item)}
|
|
114
|
+
textstyle={[
|
|
115
|
+
styles.buttonText,
|
|
116
|
+
{
|
|
117
|
+
color: item.color,
|
|
118
|
+
},
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
)}
|
|
123
|
+
</CHeaderView>
|
|
124
|
+
{selectedComponent && selectedData ? (
|
|
125
|
+
<HView
|
|
126
|
+
headerCallback={callback}
|
|
127
|
+
component={selectedComponent}
|
|
128
|
+
optiondata={selectedData}
|
|
129
|
+
{...restParams}
|
|
130
|
+
/>
|
|
131
|
+
) : null}
|
|
132
|
+
</View>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Styles
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
const styles = StyleSheet.create({
|
|
141
|
+
container: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
backgroundColor: '#fff',
|
|
144
|
+
} as ViewStyle,
|
|
145
|
+
|
|
146
|
+
button: {
|
|
147
|
+
borderRadius: 10,
|
|
148
|
+
borderWidth: 0.5,
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
// ⚠️ Original: `marginVertical: Platform.OS === 'web' && '5%'` and
|
|
152
|
+
// `marginHorizontal: Platform.OS !== 'web' && '.5%'` — when the condition
|
|
153
|
+
// is false, the value is `false`, which is an INVALID `DimensionValue`.
|
|
154
|
+
// RN silently ignores `false`; TS rejects it. Fix via conditional spread
|
|
155
|
+
// so behavior is identical (no margin) and the type is valid.
|
|
156
|
+
...(Platform.OS === 'web' ? { marginVertical: '5%' as DimensionValue } : {}),
|
|
157
|
+
...(Platform.OS !== 'web' ? { marginHorizontal: '.5%' as DimensionValue } : {}),
|
|
158
|
+
} as ViewStyle,
|
|
159
|
+
|
|
160
|
+
buttonText: {
|
|
161
|
+
fontSize: normalize(7),
|
|
162
|
+
fontWeight: 'bold',
|
|
163
|
+
textAlign: 'center',
|
|
164
|
+
} as TextStyle,
|
|
165
|
+
|
|
166
|
+
contentContainer: {
|
|
167
|
+
flex: 1,
|
|
168
|
+
padding: 10,
|
|
169
|
+
} as ViewStyle,
|
|
170
|
+
|
|
171
|
+
gridContainer: {
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
justifyContent: 'center',
|
|
174
|
+
paddingVertical: 10,
|
|
175
|
+
} as ViewStyle,
|
|
176
|
+
|
|
177
|
+
scrollContainer: {
|
|
178
|
+
flexDirection: 'row',
|
|
179
|
+
justifyContent: 'space-around',
|
|
180
|
+
} as ViewStyle,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
export default HWrappedComponent;
|