@axelor/aos-mobile-ui 7.2.5 → 8.0.0
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/lib/components/atoms/BootstrapIcon/BootstrapIcon.d.ts +10 -0
- package/lib/components/atoms/BootstrapIcon/BootstrapIcon.js +40 -0
- package/lib/components/atoms/BootstrapIcon/BootstrapIcon.js.map +1 -0
- package/lib/components/atoms/Icon/Icon.d.ts +9 -2
- package/lib/components/atoms/Icon/Icon.js +15 -3
- package/lib/components/atoms/Icon/Icon.js.map +1 -1
- package/lib/components/atoms/RadioButton/RadioButton.d.ts +2 -1
- package/lib/components/atoms/RadioButton/RadioButton.js +2 -2
- package/lib/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/atoms/Switch/Switch.d.ts +2 -1
- package/lib/components/atoms/Switch/Switch.js +2 -2
- package/lib/components/atoms/Switch/Switch.js.map +1 -1
- package/lib/components/atoms/index.d.ts +1 -0
- package/lib/components/atoms/index.js +1 -0
- package/lib/components/atoms/index.js.map +1 -1
- package/lib/components/molecules/Alert/Alert.d.ts +2 -1
- package/lib/components/molecules/Alert/Alert.js +5 -4
- package/lib/components/molecules/Alert/Alert.js.map +1 -1
- package/lib/components/molecules/Button/Button.d.ts +1 -2
- package/lib/components/molecules/Button/Button.js +2 -2
- package/lib/components/molecules/Button/Button.js.map +1 -1
- package/lib/components/molecules/Checkbox/Checkbox.d.ts +3 -1
- package/lib/components/molecules/Checkbox/Checkbox.js +24 -6
- package/lib/components/molecules/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/molecules/Chip/Chip.js +18 -27
- package/lib/components/molecules/Chip/Chip.js.map +1 -1
- package/lib/components/molecules/CircleButton/CircleButton.d.ts +1 -2
- package/lib/components/molecules/CircleButton/CircleButton.js +3 -3
- package/lib/components/molecules/CircleButton/CircleButton.js.map +1 -1
- package/lib/components/molecules/ClearableCard/ClearableCard.js +1 -1
- package/lib/components/molecules/ClearableCard/ClearableCard.js.map +1 -1
- package/lib/components/molecules/DoubleIcon/DoubleIcon.d.ts +0 -1
- package/lib/components/molecules/DoubleIcon/DoubleIcon.js.map +1 -1
- package/lib/components/molecules/DropdownMenu/DropdownMenu.js +1 -1
- package/lib/components/molecules/DropdownMenu/DropdownMenu.js.map +1 -1
- package/lib/components/molecules/EditableInput/EditableInput.js +2 -3
- package/lib/components/molecules/EditableInput/EditableInput.js.map +1 -1
- package/lib/components/molecules/IconInput/IconInput.js +1 -1
- package/lib/components/molecules/IconInput/IconInput.js.map +1 -1
- package/lib/components/molecules/Image/Image.js +1 -1
- package/lib/components/molecules/Image/Image.js.map +1 -1
- package/lib/components/molecules/Increment/Increment.js +2 -2
- package/lib/components/molecules/Increment/Increment.js.map +1 -1
- package/lib/components/molecules/Increment/IncrementButton.d.ts +1 -1
- package/lib/components/molecules/Label/Label.js +13 -7
- package/lib/components/molecules/Label/Label.js.map +1 -1
- package/lib/components/molecules/LabelText/LabelText.d.ts +1 -2
- package/lib/components/molecules/LabelText/LabelText.js +2 -2
- package/lib/components/molecules/LabelText/LabelText.js.map +1 -1
- package/lib/components/molecules/MessageBox/MessageBox.js +3 -3
- package/lib/components/molecules/MessageBox/MessageBox.js.map +1 -1
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js +1 -1
- package/lib/components/molecules/MultiValuePickerButton/MultiValuePickerButton.js.map +1 -1
- package/lib/components/molecules/NotesCard/NotesCard.js +1 -1
- package/lib/components/molecules/NotesCard/NotesCard.js.map +1 -1
- package/lib/components/molecules/NumberChevronInput/NumberChevronInput.d.ts +21 -0
- package/lib/components/molecules/NumberChevronInput/NumberChevronInput.js +117 -0
- package/lib/components/molecules/NumberChevronInput/NumberChevronInput.js.map +1 -0
- package/lib/components/molecules/RadioSelect/RadioSelect.d.ts +3 -1
- package/lib/components/molecules/RadioSelect/RadioSelect.js +3 -3
- package/lib/components/molecules/RadioSelect/RadioSelect.js.map +1 -1
- package/lib/components/molecules/RightIconButton/RightIconButton.js +1 -0
- package/lib/components/molecules/RightIconButton/RightIconButton.js.map +1 -1
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js +3 -3
- package/lib/components/molecules/SelectionContainer/SelectionContainer.js.map +1 -1
- package/lib/components/molecules/StarScore/StarScore.js +6 -6
- package/lib/components/molecules/StarScore/StarScore.js.map +1 -1
- package/lib/components/molecules/SwitchCard/SwitchCard.js +10 -2
- package/lib/components/molecules/SwitchCard/SwitchCard.js.map +1 -1
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/components/molecules/ToggleSwitch/ToggleSwitch.js.map +1 -1
- package/lib/components/molecules/ViewAllContainer/ViewAllContainer.js +1 -1
- package/lib/components/molecules/ViewAllContainer/ViewAllContainer.js.map +1 -1
- package/lib/components/molecules/index.d.ts +1 -0
- package/lib/components/molecules/index.js +1 -0
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearch/ItemCard.js +1 -1
- package/lib/components/organisms/AutoCompleteSearch/ItemCard.js.map +1 -1
- package/lib/components/organisms/CheckboxScrollList/CheckboxScrollList.d.ts +20 -0
- package/lib/components/organisms/CheckboxScrollList/CheckboxScrollList.js +76 -0
- package/lib/components/organisms/CheckboxScrollList/CheckboxScrollList.js.map +1 -0
- package/lib/components/organisms/ChipSelect/ChipSelect.js +23 -9
- package/lib/components/organisms/ChipSelect/ChipSelect.js.map +1 -1
- package/lib/components/organisms/DropdownMenuItem/DropdownMenuItem.d.ts +1 -2
- package/lib/components/organisms/DropdownMenuItem/DropdownMenuItem.js +2 -2
- package/lib/components/organisms/DropdownMenuItem/DropdownMenuItem.js.map +1 -1
- package/lib/components/organisms/DurationInput/DurationInput.d.ts +11 -0
- package/lib/components/organisms/DurationInput/DurationInput.js +85 -0
- package/lib/components/organisms/DurationInput/DurationInput.js.map +1 -0
- package/lib/components/organisms/DurationInput/duration.helpers.d.ts +4 -0
- package/lib/components/organisms/DurationInput/duration.helpers.js +41 -0
- package/lib/components/organisms/DurationInput/duration.helpers.js.map +1 -0
- package/lib/components/organisms/FloatingButton/FloatingButton.js +2 -2
- package/lib/components/organisms/FloatingButton/FloatingButton.js.map +1 -1
- package/lib/components/organisms/GroupByScrollList/BottomSeparator.d.ts +7 -0
- package/lib/components/organisms/GroupByScrollList/BottomSeparator.js +44 -0
- package/lib/components/organisms/GroupByScrollList/BottomSeparator.js.map +1 -0
- package/lib/components/organisms/GroupByScrollList/GroupByScrollList.d.ts +23 -0
- package/lib/components/organisms/GroupByScrollList/GroupByScrollList.js +60 -0
- package/lib/components/organisms/GroupByScrollList/GroupByScrollList.js.map +1 -0
- package/lib/components/organisms/GroupByScrollList/TopSeparator.d.ts +18 -0
- package/lib/components/organisms/GroupByScrollList/TopSeparator.js +73 -0
- package/lib/components/organisms/GroupByScrollList/TopSeparator.js.map +1 -0
- package/lib/components/organisms/HeaderContainer/HeaderContainer.js +1 -1
- package/lib/components/organisms/HeaderContainer/HeaderContainer.js.map +1 -1
- package/lib/components/organisms/ScrollList/ScrollList.d.ts +2 -1
- package/lib/components/organisms/ScrollList/ScrollList.js +2 -2
- package/lib/components/organisms/ScrollList/ScrollList.js.map +1 -1
- package/lib/components/organisms/SearchBar/SearchBar.js +2 -2
- package/lib/components/organisms/SearchBar/SearchBar.js.map +1 -1
- package/lib/components/organisms/index.d.ts +3 -0
- package/lib/components/organisms/index.js +3 -0
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/templates/Dashboard/Chart/BarChart.d.ts +12 -0
- package/lib/components/templates/Dashboard/Chart/BarChart.js +69 -0
- package/lib/components/templates/Dashboard/Chart/BarChart.js.map +1 -0
- package/lib/components/templates/Dashboard/Chart/LineChart.d.ts +12 -0
- package/lib/components/templates/Dashboard/Chart/LineChart.js +71 -0
- package/lib/components/templates/Dashboard/Chart/LineChart.js.map +1 -0
- package/lib/components/templates/Dashboard/Chart/PieChart.d.ts +16 -0
- package/lib/components/templates/Dashboard/Chart/PieChart.js +89 -0
- package/lib/components/templates/Dashboard/Chart/PieChart.js.map +1 -0
- package/lib/components/templates/Dashboard/Chart/chart.helper.d.ts +5 -0
- package/lib/components/templates/Dashboard/Chart/chart.helper.js +96 -0
- package/lib/components/templates/Dashboard/Chart/chart.helper.js.map +1 -0
- package/lib/components/templates/Dashboard/Chart/index.d.ts +3 -0
- package/lib/components/templates/Dashboard/Chart/index.js +21 -0
- package/lib/components/templates/Dashboard/Chart/index.js.map +1 -0
- package/lib/components/templates/Dashboard/Dashboard.d.ts +16 -0
- package/lib/components/templates/Dashboard/Dashboard.js +88 -0
- package/lib/components/templates/Dashboard/Dashboard.js.map +1 -0
- package/lib/components/templates/Dashboard/chart.d.ts +11 -0
- package/lib/components/templates/Dashboard/chart.js +33 -0
- package/lib/components/templates/Dashboard/chart.js.map +1 -0
- package/lib/components/templates/Dashboard/dashboard.helper.d.ts +7 -0
- package/lib/components/templates/Dashboard/dashboard.helper.js +19 -0
- package/lib/components/templates/Dashboard/dashboard.helper.js.map +1 -0
- package/lib/components/templates/Dashboard/index.d.ts +2 -0
- package/lib/components/templates/Dashboard/index.js +20 -0
- package/lib/components/templates/Dashboard/index.js.map +1 -0
- package/lib/components/templates/ObjectCard/ObjectCard.d.ts +0 -1
- package/lib/components/templates/ObjectCard/ObjectCard.js +1 -1
- package/lib/components/templates/ObjectCard/ObjectCard.js.map +1 -1
- package/lib/components/templates/TabsScreen/TabsScreen.js +2 -2
- package/lib/components/templates/TabsScreen/TabsScreen.js.map +1 -1
- package/lib/components/templates/index.d.ts +1 -0
- package/lib/components/templates/index.js +1 -0
- package/lib/components/templates/index.js.map +1 -1
- package/lib/icons/bootstrap-icon-map.json +7137 -0
- package/lib/theme/ThemeContext.js +5 -5
- package/lib/theme/ThemeContext.js.map +1 -1
- package/lib/theme/index.d.ts +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/themes.d.ts +1 -0
- package/lib/theme/themes.js +80 -0
- package/lib/theme/themes.js.map +1 -1
- package/lib/types/file.d.ts +1 -1
- package/lib/types/file.js +9 -9
- package/lib/types/file.js.map +1 -1
- package/lib/utils/commons-styles.js +2 -2
- package/lib/utils/commons-styles.js.map +1 -1
- package/package.json +20 -5
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useMemo } from 'react';
|
|
19
|
+
import { Dimensions, StyleSheet } from 'react-native';
|
|
20
|
+
import { LineChart as RNLineChart } from 'react-native-gifted-charts';
|
|
21
|
+
import { useThemeColor } from '../../../../theme';
|
|
22
|
+
import { Card, Text } from '../../../atoms';
|
|
23
|
+
import { checkNullString } from '../../../../utils';
|
|
24
|
+
import { initLineData } from './chart.helper';
|
|
25
|
+
const MARGIN = 5;
|
|
26
|
+
const LineChart = ({ style, widthGraph, datasets, spacing, backgroundColor, title, rotateLabel = true, }) => {
|
|
27
|
+
const Colors = useThemeColor();
|
|
28
|
+
const chartProps = useMemo(() => {
|
|
29
|
+
return initLineData(datasets, rotateLabel, spacing, Colors);
|
|
30
|
+
}, [Colors, datasets, rotateLabel, spacing]);
|
|
31
|
+
const styles = useMemo(() => {
|
|
32
|
+
return getStyles(rotateLabel);
|
|
33
|
+
}, [rotateLabel]);
|
|
34
|
+
const _containerWidth = useMemo(() => {
|
|
35
|
+
return widthGraph - MARGIN * 2;
|
|
36
|
+
}, [widthGraph]);
|
|
37
|
+
const _graphWidth = useMemo(() => {
|
|
38
|
+
return _containerWidth - 50;
|
|
39
|
+
}, [_containerWidth]);
|
|
40
|
+
const _spacing = useMemo(() => {
|
|
41
|
+
if (spacing != null) {
|
|
42
|
+
return spacing;
|
|
43
|
+
}
|
|
44
|
+
return Math.max(_containerWidth / datasets?.[0]?.length, 20);
|
|
45
|
+
}, [_containerWidth, datasets, spacing]);
|
|
46
|
+
return (<Card style={[styles.container, { width: _containerWidth }, style]}>
|
|
47
|
+
<RNLineChart width={_graphWidth} yAxisTextStyle={{
|
|
48
|
+
color: Colors.secondaryColor_dark.background,
|
|
49
|
+
}} xAxisLabelTextStyle={{ color: Colors.secondaryColor_dark.background }} initialSpacing={_spacing / 2} spacing={_spacing} endSpacing={_spacing} isAnimated={true} backgroundColor={backgroundColor} {...chartProps}/>
|
|
50
|
+
{!checkNullString(title) && <Text style={styles.title}>{title}</Text>}
|
|
51
|
+
</Card>);
|
|
52
|
+
};
|
|
53
|
+
const getStyles = rotateLabel => StyleSheet.create({
|
|
54
|
+
container: {
|
|
55
|
+
minWidth: Dimensions.get('window').width > 500
|
|
56
|
+
? Dimensions.get('window').width / 4 - MARGIN * 2
|
|
57
|
+
: Dimensions.get('window').width / 2 - MARGIN * 2,
|
|
58
|
+
margin: MARGIN,
|
|
59
|
+
paddingHorizontal: 0,
|
|
60
|
+
paddingRight: 5,
|
|
61
|
+
paddingVertical: 10,
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
},
|
|
64
|
+
title: {
|
|
65
|
+
marginTop: rotateLabel ? 30 : 0,
|
|
66
|
+
alignSelf: 'center',
|
|
67
|
+
textAlign: 'center',
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
export default LineChart;
|
|
71
|
+
//# sourceMappingURL=LineChart.js.map
|
|
@@ -0,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AA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,WAAW,CAAC,EAAE,CAC9B,UAAU,CAAC,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,QAAQ,EACN,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,GAAG;YAClC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC;YACjD,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC;QACrD,MAAM,EAAE,MAAM;QACd,iBAAiB,EAAE,CAAC;QACpB,YAAY,EAAE,CAAC;QACf,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE,QAAQ;KACnB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC;AAEL,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Data } from '../dashboard.helper';
|
|
2
|
+
interface PieChartProps {
|
|
3
|
+
styleContainer?: any;
|
|
4
|
+
widthGraph?: number;
|
|
5
|
+
datasets: Data[];
|
|
6
|
+
legend?: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
donut?: boolean;
|
|
9
|
+
showGradient?: boolean;
|
|
10
|
+
sectionAutoFocus?: boolean;
|
|
11
|
+
radius?: number;
|
|
12
|
+
innerRadius?: number;
|
|
13
|
+
focusOnPress?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const PieChart: ({ styleContainer, widthGraph, datasets, legend, title, donut, showGradient, sectionAutoFocus, radius, innerRadius, focusOnPress, }: PieChartProps) => JSX.Element;
|
|
16
|
+
export default PieChart;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
20
|
+
import { PieChart as RNPieChart } from 'react-native-gifted-charts';
|
|
21
|
+
import { useThemeColor } from '../../../../theme/ThemeContext';
|
|
22
|
+
import { checkNullString } from '../../../../utils/strings';
|
|
23
|
+
import { Text } from '../../../atoms';
|
|
24
|
+
import Chart from '../chart';
|
|
25
|
+
const MARGIN = 5;
|
|
26
|
+
const PieChart = ({ styleContainer, widthGraph, datasets, legend = false, title, donut = false, showGradient = false, sectionAutoFocus = true, radius = 90, innerRadius = 60, focusOnPress = false, }) => {
|
|
27
|
+
const Colors = useThemeColor();
|
|
28
|
+
const [dataSet, setDataSet] = useState(datasets);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setDataSet(datasets.map((item, index) => {
|
|
31
|
+
return item.color != null
|
|
32
|
+
? { ...item }
|
|
33
|
+
: { ...item, color: Chart.getChartColor(index, Colors).background };
|
|
34
|
+
}));
|
|
35
|
+
}, [Colors, datasets]);
|
|
36
|
+
const _width = useMemo(() => {
|
|
37
|
+
return widthGraph - MARGIN * 2;
|
|
38
|
+
}, [widthGraph]);
|
|
39
|
+
return (<View style={[styles.container, { width: _width }, styleContainer]}>
|
|
40
|
+
<RNPieChart data={dataSet} donut={donut} showGradient={showGradient} sectionAutoFocus={sectionAutoFocus} radius={radius} innerRadius={innerRadius} focusOnPress={focusOnPress} innerCircleColor={Colors.backgroundColor}/>
|
|
41
|
+
{!checkNullString(title) && <Text style={styles.title}>{title}</Text>}
|
|
42
|
+
{legend && (<View style={styles.legendContainer}>
|
|
43
|
+
{dataSet.map((_data, index) => (<View key={index} style={styles.itemLegendContainer}>
|
|
44
|
+
<View style={[
|
|
45
|
+
styles.legendColor,
|
|
46
|
+
{
|
|
47
|
+
borderColor: _data.color,
|
|
48
|
+
backgroundColor: _data.color,
|
|
49
|
+
},
|
|
50
|
+
]}/>
|
|
51
|
+
<Text style={styles.legend} fontSize={15}>{`${_data.label} : ${_data.value}`}</Text>
|
|
52
|
+
</View>))}
|
|
53
|
+
</View>)}
|
|
54
|
+
</View>);
|
|
55
|
+
};
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
container: {
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
alignContent: 'center',
|
|
62
|
+
minWidth: Dimensions.get('window').width > 500
|
|
63
|
+
? Dimensions.get('window').width / 4 - MARGIN * 2
|
|
64
|
+
: Dimensions.get('window').width / 2 - MARGIN * 2,
|
|
65
|
+
margin: MARGIN,
|
|
66
|
+
},
|
|
67
|
+
title: {
|
|
68
|
+
alignSelf: 'center',
|
|
69
|
+
textAlign: 'center',
|
|
70
|
+
},
|
|
71
|
+
legendContainer: {
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
},
|
|
74
|
+
itemLegendContainer: {
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
marginVertical: 5,
|
|
77
|
+
},
|
|
78
|
+
legend: {
|
|
79
|
+
marginHorizontal: 5,
|
|
80
|
+
},
|
|
81
|
+
legendColor: {
|
|
82
|
+
borderWidth: 5,
|
|
83
|
+
marginVertical: 2,
|
|
84
|
+
borderTopRightRadius: 7,
|
|
85
|
+
borderBottomRightRadius: 7,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
export default PieChart;
|
|
89
|
+
//# sourceMappingURL=PieChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieChart.js","sourceRoot":"","sources":["../../../../../src/components/templates/Dashboard/Chart/PieChart.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,QAAQ,IAAI,UAAU,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,UAAU,CAAC;AAG7B,MAAM,MAAM,GAAG,CAAC,CAAC;AAgBjB,MAAM,QAAQ,GAAG,CAAC,EAChB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,MAAM,GAAG,KAAK,EACd,KAAK,EACL,KAAK,GAAG,KAAK,EACb,YAAY,GAAG,KAAK,EACpB,gBAAgB,GAAG,IAAI,EACvB,MAAM,GAAG,EAAE,EACX,WAAW,GAAG,EAAE,EAChB,YAAY,GAAG,KAAK,GACN,EAAE,EAAE;IAClB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC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,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,QAAQ;KACpB;IACD,eAAe,EAAE;QACf,aAAa,EAAE,QAAQ;KACxB;IACD,mBAAmB,EAAE;QACnB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,CAAC;KAClB;IACD,MAAM,EAAE;QACN,gBAAgB,EAAE,CAAC;KACpB;IACD,WAAW,EAAE;QACX,WAAW,EAAE,CAAC;QACd,cAAc,EAAE,CAAC;QACjB,oBAAoB,EAAE,CAAC;QACvB,uBAAuB,EAAE,CAAC;KAC3B;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThemeColors } from '../../../../theme';
|
|
2
|
+
import { Data } from '../dashboard.helper';
|
|
3
|
+
export declare const initBarData: (datasets: Data[][], rotateLabel: boolean, spacing: number, Colors: ThemeColors) => any;
|
|
4
|
+
export declare const addLabelTextStyleToDataset: (datasets: Data[][], rotateLabel: boolean, spacing: number, Colors: ThemeColors) => Data[][];
|
|
5
|
+
export declare const initLineData: (datasets: Data[][], rotateLabel: boolean, spacing: number, Colors: ThemeColors) => any;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import Chart from '../chart';
|
|
19
|
+
const mergeDataForGroupedBars = (datasets) => {
|
|
20
|
+
const mergedData = [];
|
|
21
|
+
datasets.forEach(dataset => {
|
|
22
|
+
dataset.forEach(data => {
|
|
23
|
+
const { label, value } = data;
|
|
24
|
+
const groupIndex = mergedData.findIndex(group => group.label === label);
|
|
25
|
+
if (groupIndex === -1) {
|
|
26
|
+
mergedData.push({
|
|
27
|
+
label: label,
|
|
28
|
+
valueList: [value],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
mergedData[groupIndex].valueList.push(value);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return mergedData;
|
|
37
|
+
};
|
|
38
|
+
const transformToBarChartData = (groupedData, rotateLabel, spacing, Colors) => {
|
|
39
|
+
let finalData = [];
|
|
40
|
+
groupedData.forEach((group) => {
|
|
41
|
+
group.valueList.forEach((value, index) => {
|
|
42
|
+
finalData.push({
|
|
43
|
+
value: value,
|
|
44
|
+
label: index === 0 ? group.label : '',
|
|
45
|
+
frontColor: Chart.getChartColor(index, Colors).background,
|
|
46
|
+
spacing: index === group.valueList.length - 1 ? 24 : 2,
|
|
47
|
+
labelTextStyle: getLabelStyle(rotateLabel, spacing, Colors, true),
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return finalData;
|
|
52
|
+
};
|
|
53
|
+
export const initBarData = (datasets, rotateLabel, spacing, Colors) => {
|
|
54
|
+
if (!Array.isArray(datasets)) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
return transformToBarChartData(mergeDataForGroupedBars(datasets), rotateLabel, spacing, Colors);
|
|
58
|
+
};
|
|
59
|
+
const getLabelStyle = (rotateLabel, spacing, Colors, isBar = false) => {
|
|
60
|
+
return {
|
|
61
|
+
width: rotateLabel ? 60 : spacing,
|
|
62
|
+
color: Colors.secondaryColor_dark.background,
|
|
63
|
+
top: (rotateLabel ? 10 : 0) + (isBar ? 2 : 0),
|
|
64
|
+
left: 5,
|
|
65
|
+
transform: rotateLabel ? [{ rotate: '45deg' }] : [],
|
|
66
|
+
fontSize: 13,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export const addLabelTextStyleToDataset = (datasets, rotateLabel, spacing, Colors) => {
|
|
70
|
+
return datasets.map(dataArray => dataArray.map(data => ({
|
|
71
|
+
...data,
|
|
72
|
+
labelTextStyle: getLabelStyle(rotateLabel, spacing, Colors),
|
|
73
|
+
})));
|
|
74
|
+
};
|
|
75
|
+
const generateLineChartProps = (datasets, Colors) => {
|
|
76
|
+
const props = {};
|
|
77
|
+
datasets.forEach((dataset, index) => {
|
|
78
|
+
const color = dataset[0]?.color || Chart.getChartColor(index, Colors).background;
|
|
79
|
+
props[`dataPointsColor${index + 1}`] = color;
|
|
80
|
+
props[`color${index + 1}`] = color;
|
|
81
|
+
if (index === 0) {
|
|
82
|
+
props.data = dataset;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
props[`data${index + 1}`] = dataset;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return props;
|
|
89
|
+
};
|
|
90
|
+
export const initLineData = (datasets, rotateLabel, spacing, Colors) => {
|
|
91
|
+
if (!Array.isArray(datasets)) {
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
return generateLineChartProps(addLabelTextStyleToDataset(datasets, rotateLabel, spacing, Colors), Colors);
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=chart.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.helper.js","sourceRoot":"","sources":["../../../../../src/components/templates/Dashboard/Chart/chart.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,MAAM,UAAU,CAAC;AAG7B,MAAM,uBAAuB,GAAG,CAAC,QA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@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { default as BarChart } from './BarChart';
|
|
19
|
+
export { default as LineChart } from './LineChart';
|
|
20
|
+
export { default as PieChart } from './PieChart';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/templates/Dashboard/Chart/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Chart from './chart';
|
|
2
|
+
import { Data } from './dashboard.helper';
|
|
3
|
+
interface Graph {
|
|
4
|
+
type: keyof typeof Chart.chartType;
|
|
5
|
+
dataList: Data[][];
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
interface Line {
|
|
9
|
+
graphList: Graph[];
|
|
10
|
+
}
|
|
11
|
+
interface DashboardProps {
|
|
12
|
+
style?: any;
|
|
13
|
+
lineList: Line[];
|
|
14
|
+
}
|
|
15
|
+
declare const Dashboard: ({ style, lineList }: DashboardProps) => JSX.Element;
|
|
16
|
+
export default Dashboard;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
20
|
+
import { ScrollView } from '../../atoms';
|
|
21
|
+
import Chart from './chart';
|
|
22
|
+
import { Max_Number_Graph_Line as MAX_GRAPH_PER_LINE, } from './dashboard.helper';
|
|
23
|
+
import { BarChart, LineChart, PieChart } from './Chart';
|
|
24
|
+
const getGraphWidth = (nbGraphInLine) => {
|
|
25
|
+
if (nbGraphInLine === 1) {
|
|
26
|
+
return Dimensions.get('window').width;
|
|
27
|
+
}
|
|
28
|
+
else if (Dimensions.get('window').width < 500) {
|
|
29
|
+
return Dimensions.get('window').width / 2;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return Dimensions.get('window').width / nbGraphInLine;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const BarChartRender = (datasets, key, title, widthGraph) => {
|
|
36
|
+
return (<BarChart key={key} title={title} datasets={datasets} widthGraph={widthGraph}/>);
|
|
37
|
+
};
|
|
38
|
+
const LineChartRender = (datasets, key, title, widthGraph) => {
|
|
39
|
+
return (<LineChart key={key} title={title} datasets={datasets} widthGraph={widthGraph}/>);
|
|
40
|
+
};
|
|
41
|
+
const PieChartRender = (datasets, key, title, widthGraph, type) => {
|
|
42
|
+
return (<PieChart key={key} title={title} datasets={datasets[0]} widthGraph={widthGraph} donut={type === Chart.chartType.donut}/>);
|
|
43
|
+
};
|
|
44
|
+
const renderChart = (graph, indexGraph, nbGraphInLine) => {
|
|
45
|
+
const { dataList, title, type } = graph;
|
|
46
|
+
const widthGraph = getGraphWidth(nbGraphInLine);
|
|
47
|
+
switch (type) {
|
|
48
|
+
case Chart.chartType.bar:
|
|
49
|
+
return BarChartRender(dataList, indexGraph, title, widthGraph);
|
|
50
|
+
case Chart.chartType.pie:
|
|
51
|
+
case Chart.chartType.donut:
|
|
52
|
+
return PieChartRender(dataList, indexGraph, title, widthGraph, type);
|
|
53
|
+
case Chart.chartType.line:
|
|
54
|
+
return LineChartRender(dataList, indexGraph, title, widthGraph);
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const Dashboard = ({ style, lineList }) => {
|
|
60
|
+
return (<ScrollView style={[styles.container, style]}>
|
|
61
|
+
{lineList?.map((line, indexLine) => {
|
|
62
|
+
const validGraphs = line.graphList.filter(graph => graph.dataList?.[0]?.length > 0);
|
|
63
|
+
const nbGraphInLine = Math.min(validGraphs.length, MAX_GRAPH_PER_LINE);
|
|
64
|
+
const limitedGraphList = line.graphList?.slice(0, MAX_GRAPH_PER_LINE);
|
|
65
|
+
return (<View style={styles.lineContainer} key={indexLine}>
|
|
66
|
+
{limitedGraphList?.map((graph, indexGraph) => {
|
|
67
|
+
if (graph.dataList?.[0]?.length > 0) {
|
|
68
|
+
return renderChart(graph, indexGraph, nbGraphInLine);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
})}
|
|
72
|
+
</View>);
|
|
73
|
+
})}
|
|
74
|
+
</ScrollView>);
|
|
75
|
+
};
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
container: {
|
|
78
|
+
flexDirection: 'column',
|
|
79
|
+
height: null,
|
|
80
|
+
},
|
|
81
|
+
lineContainer: {
|
|
82
|
+
flexWrap: 'wrap',
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
justifyContent: 'space-evenly',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
export default Dashboard;
|
|
88
|
+
//# sourceMappingURL=Dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../../../../src/components/templates/Dashboard/Dashboard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAEL,qBAAqB,IAAI,kBAAkB,GAC5C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAiBtD,MAAM,aAAa,GAAG,CAAC,aAAqB,EAAE,EAAE;IAC9C,IAAI,aAAa,KAAK,CAAC,EAAE;QACvB,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;KACvC;SAAM,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,GAAG,GAAG,EAAE;QAC/C,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ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L,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAChD;YAAA,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;oBAC3C,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE;wBACnC,OAAO,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;qBACtD;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CACJ;UAAA,EAAE,IAAI,CAAC,CACR,CAAC;QACJ,CAAC,CAAC,CACJ;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,aAAa,EAAE,QAAQ;QACvB,MAAM,EAAE,IAAI;KACb;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,MAAM;QAChB,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,cAAc;KAC/B;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color, ThemeColors } from '../../../theme';
|
|
2
|
+
declare class Chart {
|
|
3
|
+
static chartType: {
|
|
4
|
+
bar: string;
|
|
5
|
+
pie: string;
|
|
6
|
+
line: string;
|
|
7
|
+
donut: string;
|
|
8
|
+
};
|
|
9
|
+
static getChartColor: (index: number, Colors: ThemeColors) => Color;
|
|
10
|
+
}
|
|
11
|
+
export default Chart;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
class Chart {
|
|
19
|
+
static chartType = {
|
|
20
|
+
bar: 'bar',
|
|
21
|
+
pie: 'pie',
|
|
22
|
+
line: 'line',
|
|
23
|
+
donut: 'donut',
|
|
24
|
+
};
|
|
25
|
+
static getChartColor = (index, Colors) => {
|
|
26
|
+
const colorArray = Object.values(Colors)
|
|
27
|
+
.filter(_color => typeof _color !== 'string')
|
|
28
|
+
.map(value => value);
|
|
29
|
+
return colorArray[index % colorArray.length];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default Chart;
|
|
33
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../../../../src/components/templates/Dashboard/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,KAAK;IACT,MAAM,CAAC,SAAS,GAAG;QACjB,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;KACf,CAAC;IAEF,MAAM,CAAC,aAAa,GAAG,CAAC,KAAa,EAAE,MAAmB,EAAS,EAAE;QACnE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;aACrC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC;aAC5C,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC;;AAGJ,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export const Max_Number_Graph_Line = 4;
|
|
19
|
+
//# sourceMappingURL=dashboard.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.helper.js","sourceRoot":"","sources":["../../../../src/components/templates/Dashboard/dashboard.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export * from './Chart';
|
|
19
|
+
export { default as Dashboard } from './Dashboard';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/templates/Dashboard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC"}
|
|
@@ -71,7 +71,7 @@ const ObjectCard = ({ style, leftContainerFlex = 3, iconLeftMargin = 20, touchab
|
|
|
71
71
|
{item.displayText}
|
|
72
72
|
</Text>);
|
|
73
73
|
}
|
|
74
|
-
return (<LabelText key={`${item.displayText} - ${item.order}`} style={[styles.text, item.style]} textStyle={item.style} iconName={item.iconName}
|
|
74
|
+
return (<LabelText key={`${item.displayText} - ${item.order}`} style={[styles.text, item.style]} textStyle={item.style} iconName={item.iconName} size={item.size} color={item.color} title={item.indicatorText} value={item.displayText} onlyOneLine={item.numberOfLines === 1}/>);
|
|
75
75
|
}, []);
|
|
76
76
|
const renderBadgeElement = useCallback((item) => {
|
|
77
77
|
if (item.customComponent != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectCard.js","sourceRoot":"","sources":["../../../../src/components/templates/ObjectCard/ObjectCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA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AAE,MAAM;KACd;IACD,sBAAsB,EAAE;QACtB,cAAc,EAAE,UAAU;KAC3B;IACD,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KACd;IACD,oBAAoB,EAAE;QACpB,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,KAAK;KACb;IACD,GAAG,EAAE;QACH,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;KACrB;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,EAAE;KACV;IACD,UAAU,EAAE;QACV,WAAW,EAAE,EAAE;QACf,IAAI,EAAE,CAAC;KACR;IACD,aAAa,EAAE;QACb,aAAa,EAAE,QAAQ;QACvB,cAAc,EAAE,YAAY;QAC5B,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,CAAC;KACR;IACD,uBAAuB,EAAE;QACvB,UAAU,EAAE,CAAC;QACb,aAAa,EAAE,QAAQ;QACvB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,CAAC;KACR;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -74,7 +74,7 @@ const TabsScreen = ({ style, viewStyle, position = Platform.OS === 'ios' ? TabsP
|
|
|
74
74
|
{ height: tabHeight, backgroundColor: Colors.backgroundColor },
|
|
75
75
|
styles.scroll,
|
|
76
76
|
]}>
|
|
77
|
-
{showLeftIcon && (<Icon name="
|
|
77
|
+
{showLeftIcon && (<Icon name="chevron-left" style={getIconStyle('left')}/>)}
|
|
78
78
|
<ScrollView horizontal={true} onContentSizeChange={width => {
|
|
79
79
|
if (parseInt(width.toString(), 10) < Dimensions.get('window').width) {
|
|
80
80
|
setShowRightIcon(false);
|
|
@@ -106,7 +106,7 @@ const TabsScreen = ({ style, viewStyle, position = Platform.OS === 'ios' ? TabsP
|
|
|
106
106
|
}}>
|
|
107
107
|
{panels?.map(_item => (<Tab key={_item.key} title={_item.title} isActive={_item.isActive} disabled={_item.disabled} count={_item.count} showBadge={_item.showBadge} onPress={() => swicthTab(_item.key)} style={getTabStyle(tabsLength)}/>))}
|
|
108
108
|
</ScrollView>
|
|
109
|
-
{showRightIcon && (<Icon name="
|
|
109
|
+
{showRightIcon && (<Icon name="chevron-right" style={getIconStyle('right')}/>)}
|
|
110
110
|
</View>);
|
|
111
111
|
}, [
|
|
112
112
|
Colors,
|