intelicoreact 1.8.3 → 1.8.5
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/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.jsx +18 -0
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -0
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -0
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -0
- package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -0
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -0
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -0
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -0
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -0
- package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -0
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -0
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -0
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -0
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -0
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -0
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -0
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -0
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -0
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -0
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -0
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1 -1
- package/dist/Atomic/FormElements/Text/Text.jsx +126 -0
- package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -0
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -0
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -0
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -0
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -0
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -0
- package/dist/Atomic/Layout/Header/Header.jsx +86 -0
- package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -0
- package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -0
- package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -0
- package/dist/Atomic/UI/Box/Box.jsx +53 -0
- package/dist/Atomic/UI/Chart/Chart.jsx +178 -0
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -0
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -0
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -0
- package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -0
- package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -0
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -0
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -0
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -0
- package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -0
- package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -0
- package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -0
- package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -0
- package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -0
- package/dist/Atomic/UI/Table/Table.jsx +63 -0
- package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -0
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -0
- package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -0
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -0
- package/dist/Atomic/UI/Tag/Tag.interface.ts +1 -0
- package/dist/Atomic/UI/Tag/Tag.js +1 -1
- package/dist/Atomic/UI/TagList/TagList.jsx +256 -0
- package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -0
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -0
- package/dist/Functions/customEventListener.jsx +96 -0
- package/dist/Functions/operations.jsx +138 -0
- package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -0
- package/dist/Functions/useFormTools/index.jsx +777 -0
- package/dist/Functions/usePasswordChecker.jsx +128 -0
- package/dist/Functions/utils.jsx +492 -0
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -0
- package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -0
- package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -0
- package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Button.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Check.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -0
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -0
- package/dist/Molecular/CustomIcons/components/Close.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -0
- package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Email.jsx +32 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -0
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -0
- package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -0
- package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -0
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -0
- package/dist/Molecular/CustomIcons/components/Home.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -0
- package/dist/Molecular/CustomIcons/components/Key.jsx +24 -0
- package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -0
- package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -0
- package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -0
- package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -0
- package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -0
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -0
- package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -0
- package/dist/Molecular/CustomIcons/components/Play.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -0
- package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -0
- package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -0
- package/dist/Molecular/CustomIcons/components/Star.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -0
- package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -0
- package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -0
- package/dist/Molecular/CustomIcons/components/User.jsx +26 -0
- package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -0
- package/dist/Molecular/CustomIcons/components/X.jsx +13 -0
- package/dist/Molecular/FormElement/FormElement.jsx +52 -0
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -0
- package/dist/Molecular/InputAddress/InputAddress.jsx +641 -0
- package/dist/Molecular/InputPassword/InputPassword.jsx +50 -0
- package/package.json +13 -6
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +0 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +0 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +0 -1
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +0 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +0 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +0 -1
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +0 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +0 -1
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +0 -1
- package/dist/Atomic/FormElements/RangeList/RangeList.js +0 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +0 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +0 -1
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +0 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +0 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +0 -1
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +0 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.d.ts +0 -16
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +0 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +0 -1
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.d.ts +0 -9
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.d.ts +0 -5
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.d.ts +0 -79
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js.map +0 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js.map +0 -1
- package/dist/Atomic/FormElements/Text/Text.js +0 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +0 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +0 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +0 -1
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +0 -1
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +0 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +0 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +0 -1
- package/dist/Atomic/Layout/Header/Header.js +0 -1
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +0 -1
- package/dist/Atomic/UI/AccordionText/AccordionText.js +0 -1
- package/dist/Atomic/UI/Arrow/Arrow.js +0 -1
- package/dist/Atomic/UI/Box/Box.js +0 -1
- package/dist/Atomic/UI/Chart/Chart.js +0 -1
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +0 -1
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +0 -1
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +0 -1
- package/dist/Atomic/UI/DateTime/DateTime.js +0 -1
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +0 -1
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +0 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +0 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +0 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +0 -1
- package/dist/Atomic/UI/PieChart/PieChart.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +0 -1
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +0 -1
- package/dist/Atomic/UI/Table/Table.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +0 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +0 -1
- package/dist/Atomic/UI/TagList/TagList.js +0 -1
- package/dist/Atomic/UI/WizardStepper/constructor.js +0 -1
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +0 -1
- package/dist/Functions/customEventListener.js +0 -1
- package/dist/Functions/operations.js +0 -1
- package/dist/Functions/useFormTools/functions/RenderFields.js +0 -1
- package/dist/Functions/useFormTools/index.js +0 -1
- package/dist/Functions/usePasswordChecker.js +0 -1
- package/dist/Functions/utils.js +0 -1
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +0 -1
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +0 -1
- package/dist/Molecular/CustomIcons/components/AppStore.js +0 -1
- package/dist/Molecular/CustomIcons/components/Arrow.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +0 -1
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +0 -1
- package/dist/Molecular/CustomIcons/components/Bell.js +0 -1
- package/dist/Molecular/CustomIcons/components/Button.js +0 -1
- package/dist/Molecular/CustomIcons/components/Campaigns.js +0 -1
- package/dist/Molecular/CustomIcons/components/Check.js +0 -1
- package/dist/Molecular/CustomIcons/components/Check2.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +0 -1
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +0 -1
- package/dist/Molecular/CustomIcons/components/Close.js +0 -1
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +0 -1
- package/dist/Molecular/CustomIcons/components/Delete.js +0 -1
- package/dist/Molecular/CustomIcons/components/Edit.js +0 -1
- package/dist/Molecular/CustomIcons/components/Email.js +0 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +0 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +0 -1
- package/dist/Molecular/CustomIcons/components/Flows.js +0 -1
- package/dist/Molecular/CustomIcons/components/Gift.js +0 -1
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +0 -1
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +0 -1
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +0 -1
- package/dist/Molecular/CustomIcons/components/Home.js +0 -1
- package/dist/Molecular/CustomIcons/components/Home2.js +0 -1
- package/dist/Molecular/CustomIcons/components/Key.js +0 -1
- package/dist/Molecular/CustomIcons/components/Landers.js +0 -1
- package/dist/Molecular/CustomIcons/components/Lock.js +0 -1
- package/dist/Molecular/CustomIcons/components/Mail.js +0 -1
- package/dist/Molecular/CustomIcons/components/Mastercard.js +0 -1
- package/dist/Molecular/CustomIcons/components/Minus.js +0 -1
- package/dist/Molecular/CustomIcons/components/Offers.js +0 -1
- package/dist/Molecular/CustomIcons/components/Pause.js +0 -1
- package/dist/Molecular/CustomIcons/components/PayPal.js +0 -1
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +0 -1
- package/dist/Molecular/CustomIcons/components/Phone.js +0 -1
- package/dist/Molecular/CustomIcons/components/Play.js +0 -1
- package/dist/Molecular/CustomIcons/components/Plus.js +0 -1
- package/dist/Molecular/CustomIcons/components/Profile.js +0 -1
- package/dist/Molecular/CustomIcons/components/QRCode.js +0 -1
- package/dist/Molecular/CustomIcons/components/Rectangle.js +0 -1
- package/dist/Molecular/CustomIcons/components/Revert.js +0 -1
- package/dist/Molecular/CustomIcons/components/Star.js +0 -1
- package/dist/Molecular/CustomIcons/components/Star2.js +0 -1
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +0 -1
- package/dist/Molecular/CustomIcons/components/Trash.js +0 -1
- package/dist/Molecular/CustomIcons/components/TrashRed.js +0 -1
- package/dist/Molecular/CustomIcons/components/Triggers.js +0 -1
- package/dist/Molecular/CustomIcons/components/User.js +0 -1
- package/dist/Molecular/CustomIcons/components/Visa.js +0 -1
- package/dist/Molecular/CustomIcons/components/X.js +0 -1
- package/dist/Molecular/FormElement/FormElement.js +0 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +0 -1
- package/dist/Molecular/InputAddress/InputAddress.js +0 -1
- package/dist/Molecular/InputPassword/InputPassword.js +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BarElement,
|
|
3
|
+
CategoryScale,
|
|
4
|
+
Chart as ChartJS,
|
|
5
|
+
Filler,
|
|
6
|
+
LinearScale,
|
|
7
|
+
LineElement,
|
|
8
|
+
PointElement,
|
|
9
|
+
Tooltip,
|
|
10
|
+
} from 'chart.js';
|
|
11
|
+
|
|
12
|
+
import cn from 'classnames';
|
|
13
|
+
import {
|
|
14
|
+
useCallback,
|
|
15
|
+
useEffect,
|
|
16
|
+
useLayoutEffect,
|
|
17
|
+
useMemo,
|
|
18
|
+
useRef,
|
|
19
|
+
useState,
|
|
20
|
+
} from 'react';
|
|
21
|
+
import * as ChartComponents from 'react-chartjs-2';
|
|
22
|
+
|
|
23
|
+
import { clone } from '../../../Functions/utils';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
COMPONENT_OPTIONS,
|
|
27
|
+
DEFAULT_CHART_MODEL,
|
|
28
|
+
ICON_MODELS,
|
|
29
|
+
} from './partial/Chart.constants';
|
|
30
|
+
import ChartTypeSwitcherIcon from './partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon';
|
|
31
|
+
import {
|
|
32
|
+
correctModelKey,
|
|
33
|
+
getChartTypeKey,
|
|
34
|
+
getNotLibraryOptionsOptions,
|
|
35
|
+
getOptions,
|
|
36
|
+
prepareData,
|
|
37
|
+
} from './partial/utils';
|
|
38
|
+
|
|
39
|
+
import './Chart.scss';
|
|
40
|
+
|
|
41
|
+
const RC = 'chart';
|
|
42
|
+
|
|
43
|
+
ChartJS.register(
|
|
44
|
+
CategoryScale,
|
|
45
|
+
LinearScale,
|
|
46
|
+
BarElement,
|
|
47
|
+
PointElement,
|
|
48
|
+
LineElement,
|
|
49
|
+
Filler,
|
|
50
|
+
Tooltip,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
function Chart({
|
|
54
|
+
className,
|
|
55
|
+
initialModel,
|
|
56
|
+
modelsForSwitch,
|
|
57
|
+
setModelExternalValue,
|
|
58
|
+
description,
|
|
59
|
+
customOptions,
|
|
60
|
+
data,
|
|
61
|
+
addToDatasets,
|
|
62
|
+
modifyOptions,
|
|
63
|
+
}) {
|
|
64
|
+
if (!data) return null;
|
|
65
|
+
|
|
66
|
+
const { label, value } = description || {};
|
|
67
|
+
|
|
68
|
+
const [model, setModel] = useState(DEFAULT_CHART_MODEL);
|
|
69
|
+
const [localData, setLocalData] = useState(data);
|
|
70
|
+
const chartRef = useRef(null);
|
|
71
|
+
const charContainertRef = useRef(null);
|
|
72
|
+
|
|
73
|
+
const options = useMemo(
|
|
74
|
+
() =>
|
|
75
|
+
customOptions
|
|
76
|
+
|| (modifyOptions ? modifyOptions(getOptions(model)) : getOptions(model)),
|
|
77
|
+
[customOptions, model, modifyOptions?.toString?.(), data],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const notLibraryOptionsOptions = useMemo(
|
|
81
|
+
() =>
|
|
82
|
+
customOptions
|
|
83
|
+
? customOptions?.notLibraryOptions
|
|
84
|
+
: getNotLibraryOptionsOptions(model),
|
|
85
|
+
[customOptions, model, data],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const ChartComponent = useCallback(
|
|
89
|
+
(props) => {
|
|
90
|
+
const Component = ChartComponents[getChartTypeKey(model)];
|
|
91
|
+
return <Component ref={chartRef} {...props} />;
|
|
92
|
+
},
|
|
93
|
+
[model],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const isExcludeDescription
|
|
97
|
+
= COMPONENT_OPTIONS.disableDescriptionsFor.includes(model);
|
|
98
|
+
const isExcludeChartTypeSwitcher
|
|
99
|
+
= COMPONENT_OPTIONS.disableChartTypeSwitcherFor.includes(model);
|
|
100
|
+
|
|
101
|
+
useLayoutEffect(() => {
|
|
102
|
+
if (setModelExternalValue && model !== 'emptyLayout')
|
|
103
|
+
setModelExternalValue(model);
|
|
104
|
+
}, [model]);
|
|
105
|
+
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
const { setCanvasDimensions } = notLibraryOptionsOptions || {};
|
|
108
|
+
if (charContainertRef.current) {
|
|
109
|
+
charContainertRef.current.style.width = setCanvasDimensions?.width ?? '';
|
|
110
|
+
charContainertRef.current.style.height
|
|
111
|
+
= setCanvasDimensions?.height ?? '';
|
|
112
|
+
}
|
|
113
|
+
}, [notLibraryOptionsOptions]);
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
setModel(correctModelKey(initialModel));
|
|
117
|
+
}, [initialModel]);
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
setLocalData(
|
|
121
|
+
prepareData(model, clone(data), chartRef.current, addToDatasets),
|
|
122
|
+
);
|
|
123
|
+
}, [model, data]);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div
|
|
127
|
+
className={cn(
|
|
128
|
+
RC,
|
|
129
|
+
{ [`${RC}_icon-mode`]: ICON_MODELS.includes(model) },
|
|
130
|
+
className,
|
|
131
|
+
)}
|
|
132
|
+
>
|
|
133
|
+
<div
|
|
134
|
+
className={cn(`${RC}__header`, {
|
|
135
|
+
[`${RC}__header_only-switcher`]: !description,
|
|
136
|
+
})}
|
|
137
|
+
>
|
|
138
|
+
{description && !isExcludeDescription
|
|
139
|
+
? (
|
|
140
|
+
<div className={cn(`${RC}__description`)}>
|
|
141
|
+
{label
|
|
142
|
+
? (
|
|
143
|
+
<span className={cn(`${RC}__description-title`)}>{label}</span>
|
|
144
|
+
)
|
|
145
|
+
: null}
|
|
146
|
+
{value
|
|
147
|
+
? (
|
|
148
|
+
<div className={cn(`${RC}__description-value`)}>{value}</div>
|
|
149
|
+
)
|
|
150
|
+
: null}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
: null}
|
|
154
|
+
{!isExcludeChartTypeSwitcher
|
|
155
|
+
? (
|
|
156
|
+
<div className={cn(`${RC}__type-switcher`)}>
|
|
157
|
+
<ChartTypeSwitcherIcon
|
|
158
|
+
iconType="Bar"
|
|
159
|
+
isActive={getChartTypeKey(model) === 'Bar'}
|
|
160
|
+
onClick={() => setModel(modelsForSwitch?.[0] || 'barLayout')}
|
|
161
|
+
/>
|
|
162
|
+
<ChartTypeSwitcherIcon
|
|
163
|
+
iconType="Line"
|
|
164
|
+
isActive={getChartTypeKey(model) === 'Line'}
|
|
165
|
+
onClick={() => setModel(modelsForSwitch?.[1] || 'lineLayout')}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
)
|
|
169
|
+
: null}
|
|
170
|
+
</div>
|
|
171
|
+
<div ref={charContainertRef} className={cn(`${RC}__chart-wrapper`)}>
|
|
172
|
+
<ChartComponent {...options} data={localData} />
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export default Chart;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import './ChartTypeSwitcherIcon.scss';
|
|
4
|
+
|
|
5
|
+
const RC = 'chart__type-switcher-icon';
|
|
6
|
+
|
|
7
|
+
function getIcon(type) {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case 'Bar':
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width="24"
|
|
13
|
+
height="24"
|
|
14
|
+
viewBox="0 0 24 25"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
>
|
|
18
|
+
<rect y="0.5" width="24" height="24" rx="4" fill="#EAF2FF" />
|
|
19
|
+
<path
|
|
20
|
+
d="M18 18V11"
|
|
21
|
+
stroke="#1F7499"
|
|
22
|
+
strokeWidth="2"
|
|
23
|
+
strokeLinecap="round"
|
|
24
|
+
strokeLinejoin="round"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M12 18V6"
|
|
28
|
+
stroke="#1F7499"
|
|
29
|
+
strokeWidth="2"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M6 18V13"
|
|
35
|
+
stroke="#1F7499"
|
|
36
|
+
strokeWidth="2"
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
/>
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
case 'Line':
|
|
43
|
+
return (
|
|
44
|
+
<svg
|
|
45
|
+
width="24"
|
|
46
|
+
height="24"
|
|
47
|
+
viewBox="0 0 24 25"
|
|
48
|
+
fill="none"
|
|
49
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
+
>
|
|
51
|
+
<rect y="0.5" width="24" height="24" rx="4" fill="#EAF2FF" />
|
|
52
|
+
<path
|
|
53
|
+
d="M21 8L15.2544 13.2668C14.1075 14.3181 12.3288 14.3014 11.1818
|
|
54
|
+
13.25V13.25C10.0349 12.1986 8.25615 12.1819 7.10919 13.2332L3 17"
|
|
55
|
+
stroke="#1F7499"
|
|
56
|
+
strokeWidth="2"
|
|
57
|
+
strokeLinecap="round"
|
|
58
|
+
strokeLinejoin="round"
|
|
59
|
+
/>
|
|
60
|
+
</svg>
|
|
61
|
+
);
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function ChartTypeSwitcherIcon({ iconType, isActive, className, onClick }) {
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
className={cn(RC, { [`${RC}_active`]: isActive }, className)}
|
|
71
|
+
onClick={onClick}
|
|
72
|
+
>
|
|
73
|
+
{getIcon(iconType)}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default ChartTypeSwitcherIcon;
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FINTURF_TOOLTIP_OPTIONS,
|
|
3
|
+
GRADIENTS_OBJECTS,
|
|
4
|
+
} from './Chart.constants';
|
|
5
|
+
import addAdditionalOptions from './optionsSetters';
|
|
6
|
+
|
|
7
|
+
// options constructors for ChartJS
|
|
8
|
+
|
|
9
|
+
export const reactChartJsOptionsLayouts = {
|
|
10
|
+
lineIconLayout: {
|
|
11
|
+
options: {
|
|
12
|
+
responsive: true,
|
|
13
|
+
maintainAspectRatio: false,
|
|
14
|
+
scales: {
|
|
15
|
+
x: { display: false },
|
|
16
|
+
y: { display: false },
|
|
17
|
+
},
|
|
18
|
+
elements: {
|
|
19
|
+
point: { radius: 0 },
|
|
20
|
+
line: {
|
|
21
|
+
tension: 0.45,
|
|
22
|
+
borderJoinStyle: 'round',
|
|
23
|
+
borderWidth: 2,
|
|
24
|
+
capBezierPoints: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
redraw: true,
|
|
29
|
+
notLibraryOptions: {
|
|
30
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
31
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
32
|
+
// => Файл Chart.js => определение ChartComponent
|
|
33
|
+
chartTypeKey: 'Line',
|
|
34
|
+
setCanvasDimensions: {
|
|
35
|
+
width: '75px',
|
|
36
|
+
height: '35px',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
lineLayout: {
|
|
41
|
+
options: {
|
|
42
|
+
responsive: true,
|
|
43
|
+
elements: {
|
|
44
|
+
point: {
|
|
45
|
+
radius: 4,
|
|
46
|
+
pointStyle: 'circle',
|
|
47
|
+
backgroundColor: '#FFFFFF',
|
|
48
|
+
color: '#FFFFFF',
|
|
49
|
+
},
|
|
50
|
+
line: {
|
|
51
|
+
tension: 0.45,
|
|
52
|
+
borderJoinStyle: 'round',
|
|
53
|
+
borderWidth: 2,
|
|
54
|
+
capBezierPoints: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
redraw: true,
|
|
59
|
+
notLibraryOptions: {
|
|
60
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
61
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
62
|
+
// => Файл Chart.js => определение ChartComponent
|
|
63
|
+
chartTypeKey: 'Line',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
barLayout: {
|
|
67
|
+
options: {
|
|
68
|
+
responsive: true,
|
|
69
|
+
elements: {
|
|
70
|
+
bar: {
|
|
71
|
+
borderRadius: 10,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
redraw: true,
|
|
76
|
+
notLibraryOptions: {
|
|
77
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
78
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
79
|
+
// => Файл Chart.js => определение ChartComponent
|
|
80
|
+
chartTypeKey: 'Bar',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
emptyLayout: {
|
|
84
|
+
options: {
|
|
85
|
+
responsive: true,
|
|
86
|
+
maintainAspectRatio: false,
|
|
87
|
+
scales: {
|
|
88
|
+
x: { display: false },
|
|
89
|
+
y: { display: false },
|
|
90
|
+
},
|
|
91
|
+
elements: {
|
|
92
|
+
point: { radius: 0 },
|
|
93
|
+
line: { borderWidth: 0 },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
notLibraryOptions: {
|
|
97
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
98
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
99
|
+
// => Файл Chart.js => определение подкомпонента ChartComponent => строка const Component = ...
|
|
100
|
+
chartTypeKey: 'Line',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const finturfChartLayouts = (() => {
|
|
106
|
+
return ['barLayout', 'lineLayout'].reduce(
|
|
107
|
+
(acc, key) => ({
|
|
108
|
+
...acc,
|
|
109
|
+
[key]: {
|
|
110
|
+
...reactChartJsOptionsLayouts[key],
|
|
111
|
+
|
|
112
|
+
options: {
|
|
113
|
+
...reactChartJsOptionsLayouts[key].options,
|
|
114
|
+
scales: {
|
|
115
|
+
...reactChartJsOptionsLayouts[key].options?.scales,
|
|
116
|
+
x: {
|
|
117
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.x,
|
|
118
|
+
grid: {
|
|
119
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.x?.grid,
|
|
120
|
+
display: false,
|
|
121
|
+
offset: true,
|
|
122
|
+
},
|
|
123
|
+
ticks: {
|
|
124
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.ticks,
|
|
125
|
+
autoSkipPadding: 10,
|
|
126
|
+
align: 'center',
|
|
127
|
+
color: '#757F8C',
|
|
128
|
+
lineHeight: 18,
|
|
129
|
+
font: {
|
|
130
|
+
family: 'Sarabun',
|
|
131
|
+
style: 'normal',
|
|
132
|
+
weight: 400,
|
|
133
|
+
size: 8,
|
|
134
|
+
},
|
|
135
|
+
// callback: (value, index, ticks) => {
|
|
136
|
+
// console.log(value);
|
|
137
|
+
// console.log(index);
|
|
138
|
+
// console.log(ticks);
|
|
139
|
+
// console.log('***********');
|
|
140
|
+
// return value;
|
|
141
|
+
// },
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
y: {
|
|
145
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y,
|
|
146
|
+
min: 0,
|
|
147
|
+
// grace: '5%',
|
|
148
|
+
bounds: 'data',
|
|
149
|
+
grid: {
|
|
150
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.grid,
|
|
151
|
+
borderColor: '#E1E8F1',
|
|
152
|
+
color: '#E1E8F1',
|
|
153
|
+
borderDash: [5],
|
|
154
|
+
// borderDashOffset: 12,
|
|
155
|
+
drawTicks: false,
|
|
156
|
+
z: -1,
|
|
157
|
+
},
|
|
158
|
+
ticks: {
|
|
159
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.ticks,
|
|
160
|
+
autoSkipPadding: 10,
|
|
161
|
+
align: 'center',
|
|
162
|
+
color: '#A0A4B0',
|
|
163
|
+
lineHeight: 18,
|
|
164
|
+
padding: 6,
|
|
165
|
+
font: {
|
|
166
|
+
family: 'Sarabun',
|
|
167
|
+
style: 'normal',
|
|
168
|
+
weight: 400,
|
|
169
|
+
size: 10,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
notLibraryOptions: {
|
|
177
|
+
...reactChartJsOptionsLayouts[key].notLibraryOptions,
|
|
178
|
+
setCanvasDimensions: {
|
|
179
|
+
height: '194px',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
{},
|
|
185
|
+
);
|
|
186
|
+
})();
|
|
187
|
+
|
|
188
|
+
const finturfChartBar = {
|
|
189
|
+
...finturfChartLayouts.barLayout,
|
|
190
|
+
options: {
|
|
191
|
+
...finturfChartLayouts.barLayout?.options,
|
|
192
|
+
maintainAspectRatio: false,
|
|
193
|
+
elements: {
|
|
194
|
+
...finturfChartLayouts.barLayout?.options?.elements,
|
|
195
|
+
bar: {
|
|
196
|
+
...finturfChartLayouts.barLayout?.options?.elements?.bar,
|
|
197
|
+
borderRadius: 4,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
notLibraryOptions: {
|
|
202
|
+
...finturfChartLayouts.barLayout?.notLibraryOptions,
|
|
203
|
+
changeData: {
|
|
204
|
+
...finturfChartLayouts.barLayout?.notLibraryOptions?.changeData,
|
|
205
|
+
setMaxBarThickness: 16,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const finturfChartLine = {
|
|
211
|
+
...finturfChartLayouts.lineLayout,
|
|
212
|
+
options: {
|
|
213
|
+
...finturfChartLayouts.lineLayout?.options,
|
|
214
|
+
maintainAspectRatio: false,
|
|
215
|
+
elements: {
|
|
216
|
+
...finturfChartLayouts.lineLayout.options?.elements,
|
|
217
|
+
point: {
|
|
218
|
+
...finturfChartLayouts.lineLayout.options?.elements?.point,
|
|
219
|
+
radius: 2,
|
|
220
|
+
borderColor: '#32A784',
|
|
221
|
+
borderWidth: 4,
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const finturfReactChartJsOptions = {
|
|
228
|
+
finturfChartBar: addAdditionalOptions(finturfChartBar, {
|
|
229
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.bar,
|
|
230
|
+
addTooltipOptions: FINTURF_TOOLTIP_OPTIONS,
|
|
231
|
+
}),
|
|
232
|
+
|
|
233
|
+
finturfLoadingModeBar: {
|
|
234
|
+
...finturfChartBar,
|
|
235
|
+
|
|
236
|
+
options: {
|
|
237
|
+
...finturfChartBar.options,
|
|
238
|
+
animations: {
|
|
239
|
+
...finturfChartBar.options?.animations,
|
|
240
|
+
y: {
|
|
241
|
+
...finturfChartBar.options?.animations?.y,
|
|
242
|
+
duration: 0,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
notLibraryOptions: {
|
|
248
|
+
...finturfChartBar.notLibraryOptions,
|
|
249
|
+
changeData: {
|
|
250
|
+
...finturfChartBar.notLibraryOptions?.changeData,
|
|
251
|
+
addNotLibraryAnimations: [
|
|
252
|
+
{
|
|
253
|
+
type: 'runningColumns',
|
|
254
|
+
// duration - ms
|
|
255
|
+
duration: 600,
|
|
256
|
+
// default easing - 'linear',
|
|
257
|
+
// easing: 'easeInOutExpo',
|
|
258
|
+
// ToDo - предусмотреть 'auto' и default для from и to
|
|
259
|
+
from: 10,
|
|
260
|
+
to: 75,
|
|
261
|
+
columnsDelayCoef: 500,
|
|
262
|
+
},
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
finturfChartLine: addAdditionalOptions(finturfChartLine, {
|
|
269
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.line,
|
|
270
|
+
addTooltipOptions: FINTURF_TOOLTIP_OPTIONS,
|
|
271
|
+
// consoleCurrentData: true,
|
|
272
|
+
}),
|
|
273
|
+
|
|
274
|
+
finturfLoadingModeLine: {
|
|
275
|
+
...finturfChartLine,
|
|
276
|
+
|
|
277
|
+
options: {
|
|
278
|
+
...finturfChartLine.options,
|
|
279
|
+
elements: {
|
|
280
|
+
...finturfChartLine.options?.elements,
|
|
281
|
+
point: {
|
|
282
|
+
...finturfChartLine.options?.elements?.point,
|
|
283
|
+
radius: 4,
|
|
284
|
+
borderWidth: 1,
|
|
285
|
+
borderColor: '#E1E8F1',
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
animations: {
|
|
289
|
+
...finturfChartLine.options?.animations,
|
|
290
|
+
y: {
|
|
291
|
+
...finturfChartLine.options?.animations?.y,
|
|
292
|
+
duration: 0,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
notLibraryOptions: {
|
|
298
|
+
...finturfChartLine.notLibraryOptions,
|
|
299
|
+
changeData: {
|
|
300
|
+
...finturfChartLine.notLibraryOptions?.changeData,
|
|
301
|
+
addNotLibraryAnimations: [
|
|
302
|
+
{
|
|
303
|
+
type: 'runningColumns',
|
|
304
|
+
// duration - ms
|
|
305
|
+
duration: 600,
|
|
306
|
+
// default easing - 'linear',
|
|
307
|
+
// easing: 'easeInOutExpo',
|
|
308
|
+
columnsDelayCoef: 500,
|
|
309
|
+
isFixExtremeColumns: true,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
finturfPositiveLineIcon: addAdditionalOptions(
|
|
317
|
+
reactChartJsOptionsLayouts.lineIconLayout,
|
|
318
|
+
{
|
|
319
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.positiveLineIcon,
|
|
320
|
+
},
|
|
321
|
+
),
|
|
322
|
+
|
|
323
|
+
finturfNegativeLineIcon: addAdditionalOptions(
|
|
324
|
+
reactChartJsOptionsLayouts.lineIconLayout,
|
|
325
|
+
{
|
|
326
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.negativeLineIcon,
|
|
327
|
+
},
|
|
328
|
+
),
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export default {
|
|
332
|
+
...finturfReactChartJsOptions,
|
|
333
|
+
emptyLayout: reactChartJsOptionsLayouts.emptyLayout,
|
|
334
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import './CircleProgressBar.scss';
|
|
6
|
+
|
|
7
|
+
function CircleProgressBar({
|
|
8
|
+
amount,
|
|
9
|
+
totalAmount,
|
|
10
|
+
isReverseType,
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
colors,
|
|
14
|
+
isInnerLine,
|
|
15
|
+
radius = 59,
|
|
16
|
+
strokeWidth = 2,
|
|
17
|
+
innerLineStrokeWidth = 2,
|
|
18
|
+
testId = 'circle-progress-bar',
|
|
19
|
+
}) {
|
|
20
|
+
const circumference = Math.round(2 * Math.PI * radius);
|
|
21
|
+
const amountProgress
|
|
22
|
+
= amount < totalAmount ? Math.round((amount / totalAmount) * 100) : 100; // %
|
|
23
|
+
const defaultColors = {
|
|
24
|
+
start: '#6b81dd',
|
|
25
|
+
finish: '#f06d8d',
|
|
26
|
+
meter: '#ffcad6',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const [strokeDashoffset, setStrokeDashoffset] = useState(isReverseType ? String(0) : circumference);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setStrokeDashoffset(circumference - (circumference * amountProgress) / 100);
|
|
33
|
+
}, [amountProgress]);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-testid={testId}
|
|
38
|
+
className={cn('limit-progress-bar', { 'limit-progress-bar--reverse': isReverseType }, className)}
|
|
39
|
+
>
|
|
40
|
+
<svg
|
|
41
|
+
className="limit-progress-bar__progress"
|
|
42
|
+
width="124"
|
|
43
|
+
height="124"
|
|
44
|
+
viewBox="0 0 124 124"
|
|
45
|
+
>
|
|
46
|
+
<defs>
|
|
47
|
+
{isReverseType
|
|
48
|
+
? (
|
|
49
|
+
<linearGradient
|
|
50
|
+
id="limit-progress-bar-linear-gradient-reverse"
|
|
51
|
+
x1="0"
|
|
52
|
+
y1="1"
|
|
53
|
+
x2="0"
|
|
54
|
+
y2="0"
|
|
55
|
+
>
|
|
56
|
+
<stop
|
|
57
|
+
offset="0"
|
|
58
|
+
stopColor={colors.finish || defaultColors.finish}
|
|
59
|
+
/>
|
|
60
|
+
<stop
|
|
61
|
+
offset="1"
|
|
62
|
+
stopColor={colors.start || defaultColors.start}
|
|
63
|
+
/>
|
|
64
|
+
</linearGradient>
|
|
65
|
+
)
|
|
66
|
+
: (
|
|
67
|
+
<linearGradient
|
|
68
|
+
id="limit-progress-bar-linear-gradient"
|
|
69
|
+
x1="0"
|
|
70
|
+
y1="1"
|
|
71
|
+
x2="0"
|
|
72
|
+
y2="0"
|
|
73
|
+
>
|
|
74
|
+
<stop
|
|
75
|
+
offset="0"
|
|
76
|
+
stopColor={colors.start || defaultColors.start}
|
|
77
|
+
/>
|
|
78
|
+
<stop
|
|
79
|
+
offset="1"
|
|
80
|
+
stopColor={colors.finish || defaultColors.finish}
|
|
81
|
+
/>
|
|
82
|
+
</linearGradient>
|
|
83
|
+
)}
|
|
84
|
+
</defs>
|
|
85
|
+
<circle
|
|
86
|
+
className="limit-progress-bar__meter"
|
|
87
|
+
cx={radius}
|
|
88
|
+
cy={radius}
|
|
89
|
+
r={radius}
|
|
90
|
+
stroke={!isInnerLine ? '' : colors.meter || defaultColors.meter}
|
|
91
|
+
strokeWidth={String(innerLineStrokeWidth)}
|
|
92
|
+
/>
|
|
93
|
+
<circle
|
|
94
|
+
className="limit-progress-bar__value"
|
|
95
|
+
cx={radius}
|
|
96
|
+
cy={radius}
|
|
97
|
+
r={radius}
|
|
98
|
+
strokeWidth={String(strokeWidth)}
|
|
99
|
+
stroke={`url(#limit-progress-bar-linear-gradient${isReverseType ? '-reverse' : ''})`}
|
|
100
|
+
style={{
|
|
101
|
+
strokeDasharray: circumference,
|
|
102
|
+
strokeDashoffset,
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
</svg>
|
|
106
|
+
<div className="limit-progress-bar__content">{children}</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default CircleProgressBar;
|