intelicoreact 1.6.22 → 1.6.24
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/ActionAlert/ActionAlert.js +98 -1
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +48 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.js +249 -1
- package/dist/Atomic/FormElements/Calendar/Calendar.props.js +4 -1
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +65 -1
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +52 -1
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +424 -1
- package/dist/Atomic/FormElements/Datepicker/Datepicker.props.js +4 -1
- package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.js +173 -1
- package/dist/Atomic/FormElements/Datepicker/components/DatepickerCalendar.props.js +4 -1
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +735 -1
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +20 -1
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +529 -1
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +94 -1
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +105 -1
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +67 -1
- package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +247 -1
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +160 -1
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +193 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +135 -1
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +116 -1
- package/dist/Atomic/FormElements/Input/Input.js +467 -1
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +161 -1
- package/dist/Atomic/FormElements/InputColor/InputColor.js +64 -1
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +200 -1
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +354 -1
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +71 -1
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +693 -1
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +254 -1
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +32 -1
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +200 -1
- package/dist/Atomic/FormElements/InputLink/InputLink.js +99 -1
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +37 -1
- package/dist/Atomic/FormElements/InputMask/InputMask.js +1214 -1
- package/dist/Atomic/FormElements/InputMask/config.js +15 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +58 -1
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +674 -1
- package/dist/Atomic/FormElements/InputMask2/config.js +15 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +58 -1
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +766 -1
- package/dist/Atomic/FormElements/InputMask3/config.js +15 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +58 -1
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +114 -1
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +140 -1
- package/dist/Atomic/FormElements/Label/Label.js +87 -1
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +506 -1
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +45 -1
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +331 -1
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +66 -1
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +80 -1
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +57 -1
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +54 -1
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +183 -1
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +222 -1
- package/dist/Atomic/FormElements/RangeList/RangeList.js +175 -1
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +43 -1
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +443 -1
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +858 -1
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +39 -1
- package/dist/Atomic/FormElements/Switcher/Switcher.js +59 -1
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +50 -1
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +44 -1
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +100 -1
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +52 -1
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +64 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +170 -1
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +202 -1
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +67 -1
- package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +115 -1
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -2
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1110 -1
- package/dist/Atomic/FormElements/Text/Text.js +125 -1
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +49 -1
- package/dist/Atomic/FormElements/Textarea/Textarea.js +80 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +176 -1
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +62 -1
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +119 -1
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +188 -1
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +83 -1
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +82 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +101 -1
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +29 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +113 -1
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +30 -1
- package/dist/Atomic/Layout/Header/Header.js +85 -1
- package/dist/Atomic/Layout/Spinner/Spinner.js +44 -1
- package/dist/Atomic/UI/Accordion/Accordion.js +108 -1
- package/dist/Atomic/UI/Accordion/AccordionItem.js +176 -1
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +238 -1
- package/dist/Atomic/UI/AccordionText/AccordionText.js +69 -1
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +207 -1
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +56 -1
- package/dist/Atomic/UI/Alert/Alert.js +72 -1
- package/dist/Atomic/UI/Arrow/Arrow.js +132 -1
- package/dist/Atomic/UI/Box/Box.js +52 -1
- package/dist/Atomic/UI/Button/Button.js +47 -1
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +72 -1
- package/dist/Atomic/UI/Chart/Chart.js +172 -1
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +95 -1
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +80 -1
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +188 -1
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +335 -1
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +43 -1
- package/dist/Atomic/UI/Chart/partial/utils.js +60 -1
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +109 -1
- package/dist/Atomic/UI/DateTime/DateTime.js +57 -1
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +44 -1
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +15 -1
- package/dist/Atomic/UI/DoubleString/DoubleString.js +102 -1
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +70 -1
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +221 -1
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +106 -1
- package/dist/Atomic/UI/Hint/Hint.js +256 -1
- package/dist/Atomic/UI/Hint/partials/_utils.js +64 -1
- package/dist/Atomic/UI/Modal/Modal.js +179 -1
- package/dist/Atomic/UI/Modal/ModalHOC.js +97 -1
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +71 -1
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +110 -1
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +192 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +75 -1
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +80 -1
- package/dist/Atomic/UI/NavLine/NavLine.js +317 -1
- package/dist/Atomic/UI/PageTitle/PageTitle.js +77 -1
- package/dist/Atomic/UI/PieChart/PieChart.js +42 -1
- package/dist/Atomic/UI/Price/Price.js +31 -1
- package/dist/Atomic/UI/PriceRange/PriceRange.js +44 -1
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +98 -1
- package/dist/Atomic/UI/Status/Status.js +67 -1
- package/dist/Atomic/UI/Table/Partials/TdCell.js +87 -1
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +38 -1
- package/dist/Atomic/UI/Table/Partials/TdRow.js +99 -1
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +52 -1
- package/dist/Atomic/UI/Table/Table.js +63 -1
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +80 -1
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +28 -1
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +13 -1
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +53 -1
- package/dist/Atomic/UI/Tag/Tag.js +167 -1
- package/dist/Atomic/UI/TagList/TagList.js +251 -1
- package/dist/Atomic/UI/UserBox/UserBox.js +86 -1
- package/dist/Atomic/UI/WizardStepper/constructor.js +84 -1
- package/dist/Atomic/UI/WizardStepper/index.js +3 -1
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +37 -1
- package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +3 -1
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +61 -1
- package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +3 -1
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +39 -1
- package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +3 -1
- package/dist/Atomic/UI/WizardStepper/ui/icons.js +49 -1
- package/dist/Atomic/UI/WizardStepper/ui/index.js +3 -1
- package/dist/Classes/AbortableFetch.js +454 -1
- package/dist/Classes/AnimatedHandler.js +47 -1
- package/dist/Classes/RESTAPI/index.js +228 -1
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +457 -1
- package/dist/Classes/RESTAPI/partials/ApiBase.js +48 -1
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +112 -1
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +189 -1
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +252 -1
- package/dist/Classes/RESTAPI/partials/Utils.js +92 -1
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +3 -1
- package/dist/Classes/RESTAPI/partials/_utils.js +197 -1
- package/dist/Constants/index.constants.js +78 -1
- package/dist/Functions/Portal.js +22 -1
- package/dist/Functions/customEventListener.js +96 -1
- package/dist/Functions/dateTime.js +149 -1
- package/dist/Functions/fieldValueFormatters.js +405 -1
- package/dist/Functions/guards/assertions.js +294 -1
- package/dist/Functions/guards/safeValue.js +75 -1
- package/dist/Functions/guards/typeGuards.js +373 -1
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +95 -1
- package/dist/Functions/locale/createTranslator.js +32 -1
- package/dist/Functions/operations.js +130 -1
- package/dist/Functions/presets/inputMaskPresets.js +170 -1
- package/dist/Functions/presets/inputPresets.js +60 -1
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +45 -1
- package/dist/Functions/schemas.js +31 -1
- package/dist/Functions/useBodyScrollLock.js +17 -1
- package/dist/Functions/useClickOutside.js +15 -1
- package/dist/Functions/useDebounce.js +17 -1
- package/dist/Functions/useFieldFocus.js +84 -1
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +39 -1
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +159 -1
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +78 -1
- package/dist/Functions/useFormTools/functions/General.js +134 -1
- package/dist/Functions/useFormTools/functions/RenderFields.js +111 -1
- package/dist/Functions/useFormTools/functions/usePrevious.js +12 -1
- package/dist/Functions/useFormTools/index.js +778 -1
- package/dist/Functions/useInputHighlightError.js +67 -1
- package/dist/Functions/useIsMobile/useIsMobile.js +33 -1
- package/dist/Functions/useKeyPress/useHandleKeyPress.js +52 -1
- package/dist/Functions/useKeyPress/useKeyPress.js +52 -1
- package/dist/Functions/useLocalStorage.js +34 -1
- package/dist/Functions/useLocationParams.js +27 -1
- package/dist/Functions/useMediaQuery.js +17 -1
- package/dist/Functions/useMetaInfo.js +43 -1
- package/dist/Functions/useMouseUpOutside.js +16 -1
- package/dist/Functions/useOnlineStatus.js +29 -1
- package/dist/Functions/usePasswordChecker.js +110 -1
- package/dist/Functions/usePrevious.js +12 -1
- package/dist/Functions/useResize.js +31 -1
- package/dist/Functions/useScrollTo.js +17 -1
- package/dist/Functions/useToggle.js +17 -1
- package/dist/Functions/utils.js +522 -1
- package/dist/Langs.js +168 -1
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +21 -1
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +23 -1
- package/dist/Molecular/CustomIcons/components/AppStore.js +29 -1
- package/dist/Molecular/CustomIcons/components/Arrow.js +32 -1
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +17 -1
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +22 -1
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +22 -1
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +17 -1
- package/dist/Molecular/CustomIcons/components/Bell.js +15 -1
- package/dist/Molecular/CustomIcons/components/Button.js +12 -1
- package/dist/Molecular/CustomIcons/components/Campaigns.js +16 -1
- package/dist/Molecular/CustomIcons/components/Check.js +14 -1
- package/dist/Molecular/CustomIcons/components/Check2.js +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +12 -1
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +11 -1
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +11 -1
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +11 -1
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +11 -1
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +27 -1
- package/dist/Molecular/CustomIcons/components/Close.js +14 -1
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +17 -1
- package/dist/Molecular/CustomIcons/components/Delete.js +16 -1
- package/dist/Molecular/CustomIcons/components/Edit.js +15 -1
- package/dist/Molecular/CustomIcons/components/Email.js +31 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +18 -1
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +35 -1
- package/dist/Molecular/CustomIcons/components/Flows.js +15 -1
- package/dist/Molecular/CustomIcons/components/Gift.js +25 -1
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +29 -1
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +29 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +19 -1
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +20 -1
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +19 -1
- package/dist/Molecular/CustomIcons/components/Home.js +16 -1
- package/dist/Molecular/CustomIcons/components/Home2.js +22 -1
- package/dist/Molecular/CustomIcons/components/Key.js +23 -1
- package/dist/Molecular/CustomIcons/components/Landers.js +20 -1
- package/dist/Molecular/CustomIcons/components/Lock.js +15 -1
- package/dist/Molecular/CustomIcons/components/Mail.js +26 -1
- package/dist/Molecular/CustomIcons/components/Mastercard.js +73 -1
- package/dist/Molecular/CustomIcons/components/Minus.js +25 -1
- package/dist/Molecular/CustomIcons/components/Offers.js +16 -1
- package/dist/Molecular/CustomIcons/components/Pause.js +28 -1
- package/dist/Molecular/CustomIcons/components/PayPal.js +41 -1
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +28 -1
- package/dist/Molecular/CustomIcons/components/Phone.js +30 -1
- package/dist/Molecular/CustomIcons/components/Play.js +25 -1
- package/dist/Molecular/CustomIcons/components/Plus.js +25 -1
- package/dist/Molecular/CustomIcons/components/Profile.js +16 -1
- package/dist/Molecular/CustomIcons/components/QRCode.js +29 -1
- package/dist/Molecular/CustomIcons/components/Rectangle.js +12 -1
- package/dist/Molecular/CustomIcons/components/Revert.js +13 -1
- package/dist/Molecular/CustomIcons/components/Star.js +14 -1
- package/dist/Molecular/CustomIcons/components/Star2.js +16 -1
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +14 -1
- package/dist/Molecular/CustomIcons/components/Trash.js +15 -1
- package/dist/Molecular/CustomIcons/components/TrashRed.js +15 -1
- package/dist/Molecular/CustomIcons/components/Triggers.js +15 -1
- package/dist/Molecular/CustomIcons/components/User.js +25 -1
- package/dist/Molecular/CustomIcons/components/Visa.js +31 -1
- package/dist/Molecular/CustomIcons/components/X.js +12 -1
- package/dist/Molecular/CustomIcons/index.js +61 -1
- package/dist/Molecular/FormElement/FormElement.js +54 -1
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +184 -1
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +53 -1
- package/dist/Molecular/InputAddress/InputAddress.js +626 -1
- package/dist/Molecular/InputPassword/InputPassword.js +48 -1
- package/dist/index.js +104 -1
- package/package.json +1 -1
- package/dist/Molecular/InputAddress/InputAddress.d.ts +0 -26
- package/dist/Molecular/InputAddress/InputAddress.js.map +0 -1
|
@@ -1 +1,188 @@
|
|
|
1
|
-
|
|
1
|
+
import { clone } from "../../../../Functions/utils";
|
|
2
|
+
|
|
3
|
+
// auxiliary functions
|
|
4
|
+
|
|
5
|
+
export const addDatasetsObjects = (currentData, mutation) => ({
|
|
6
|
+
...currentData,
|
|
7
|
+
datasets: currentData.datasets?.map?.((dataset) => ({
|
|
8
|
+
...dataset,
|
|
9
|
+
...(typeof mutation === "function" ? mutation(dataset) : mutation),
|
|
10
|
+
})),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const createGradient = ({
|
|
14
|
+
ctx,
|
|
15
|
+
area,
|
|
16
|
+
colors,
|
|
17
|
+
direction,
|
|
18
|
+
correctionFactors,
|
|
19
|
+
collorStopPoints,
|
|
20
|
+
}) => {
|
|
21
|
+
const getStartGradient = () => {
|
|
22
|
+
switch (direction) {
|
|
23
|
+
case "toTop-toRight":
|
|
24
|
+
return ctx.createLinearGradient(
|
|
25
|
+
area.left,
|
|
26
|
+
area.bottom,
|
|
27
|
+
area.right,
|
|
28
|
+
area.top,
|
|
29
|
+
);
|
|
30
|
+
case "toTop-toLeft":
|
|
31
|
+
return ctx.createLinearGradient(
|
|
32
|
+
area.right,
|
|
33
|
+
area.bottom,
|
|
34
|
+
area.left,
|
|
35
|
+
area.top,
|
|
36
|
+
);
|
|
37
|
+
case "toBottom-toRight":
|
|
38
|
+
return ctx.createLinearGradient(
|
|
39
|
+
area.left,
|
|
40
|
+
area.top,
|
|
41
|
+
area.right,
|
|
42
|
+
area.bottom,
|
|
43
|
+
);
|
|
44
|
+
case "toBottom-toLeft":
|
|
45
|
+
return ctx.createLinearGradient(
|
|
46
|
+
area.right,
|
|
47
|
+
area.top,
|
|
48
|
+
area.left,
|
|
49
|
+
area.bottom,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
case "toBottom":
|
|
53
|
+
return ctx.createLinearGradient(0, area.top, 0, area.bottom);
|
|
54
|
+
case "toTop":
|
|
55
|
+
return ctx.createLinearGradient(0, area.bottom, 0, area.top);
|
|
56
|
+
case "toLeft":
|
|
57
|
+
return ctx.createLinearGradient(area.right, 0, area.left, 0);
|
|
58
|
+
case "toRight":
|
|
59
|
+
default:
|
|
60
|
+
return ctx.createLinearGradient(area.left, 0, area.right, 0);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getGradientWithPoints = (corection) => {
|
|
65
|
+
const newGradient = getStartGradient();
|
|
66
|
+
const staptPoint = corection ? 1 - corection : 0;
|
|
67
|
+
|
|
68
|
+
colors.forEach((color, idx) => {
|
|
69
|
+
const point = (() => {
|
|
70
|
+
if (idx === colors.length - 1) return 1;
|
|
71
|
+
return collorStopPoints && Array.isArray(collorStopPoints)
|
|
72
|
+
? staptPoint + collorStopPoints[idx] * (corection || 1)
|
|
73
|
+
: staptPoint + (1 / colors.length) * (corection || 1);
|
|
74
|
+
})();
|
|
75
|
+
|
|
76
|
+
newGradient.addColorStop(point.toFixed(2), color);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return newGradient;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return correctionFactors
|
|
83
|
+
? correctionFactors.map((corection) => getGradientWithPoints(corection))
|
|
84
|
+
: getGradientWithPoints();
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// target functions
|
|
88
|
+
|
|
89
|
+
export const addGradientsObject = (
|
|
90
|
+
currentData,
|
|
91
|
+
gradientSettingsObj,
|
|
92
|
+
chartInstance,
|
|
93
|
+
) =>
|
|
94
|
+
addDatasetsObjects(currentData, (dataset) => ({
|
|
95
|
+
[gradientSettingsObj.gradientTargetPropertyName]: createGradient({
|
|
96
|
+
ctx: chartInstance.ctx,
|
|
97
|
+
area: chartInstance.chartArea,
|
|
98
|
+
colors: gradientSettingsObj.colors,
|
|
99
|
+
direction: gradientSettingsObj.direction,
|
|
100
|
+
correctionFactors:
|
|
101
|
+
gradientSettingsObj.typeDistributionOfGradientPoints === "personalBase"
|
|
102
|
+
? dataset.data.map(
|
|
103
|
+
(value) => value / Math.max.apply(null, dataset.data),
|
|
104
|
+
)
|
|
105
|
+
: null,
|
|
106
|
+
collorStopPoints: gradientSettingsObj.collorStopPoints,
|
|
107
|
+
}),
|
|
108
|
+
|
|
109
|
+
...(gradientSettingsObj.isAddFill ? { fill: true } : {}),
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
export const addNotLibraryAnimation = (
|
|
113
|
+
currentData,
|
|
114
|
+
animationObj,
|
|
115
|
+
chartInstance,
|
|
116
|
+
) => {
|
|
117
|
+
const { type, ...restAnimationObj } = animationObj || {};
|
|
118
|
+
|
|
119
|
+
switch (type) {
|
|
120
|
+
case "runningColumns":
|
|
121
|
+
const runningColumnsDefaultFromValue = 25;
|
|
122
|
+
const runningColumnsDefaultToValue = 75;
|
|
123
|
+
const runningColumnsDefaultAverageValue = 50;
|
|
124
|
+
const runningColumnsDefaultColumnsDelayCoef = 50;
|
|
125
|
+
|
|
126
|
+
return addDatasetsObjects(currentData, (dataset) => ({
|
|
127
|
+
animations: dataset.data.map((item, idx) => ({
|
|
128
|
+
y: {
|
|
129
|
+
duration: animationObj.duration,
|
|
130
|
+
easing: animationObj.easing || "linear",
|
|
131
|
+
from:
|
|
132
|
+
animationObj.isFixExtremeColumns &&
|
|
133
|
+
(!idx || idx === dataset.data.length - 1)
|
|
134
|
+
? runningColumnsDefaultAverageValue
|
|
135
|
+
: animationObj.from || runningColumnsDefaultFromValue,
|
|
136
|
+
to:
|
|
137
|
+
animationObj.isFixExtremeColumns &&
|
|
138
|
+
(!idx || idx === dataset.data.length - 1)
|
|
139
|
+
? runningColumnsDefaultAverageValue
|
|
140
|
+
: animationObj.to || runningColumnsDefaultToValue,
|
|
141
|
+
loop: true,
|
|
142
|
+
delay:
|
|
143
|
+
Math.random().toFixed(1) *
|
|
144
|
+
(animationObj.columnsDelayCoef ||
|
|
145
|
+
runningColumnsDefaultColumnsDelayCoef),
|
|
146
|
+
},
|
|
147
|
+
})),
|
|
148
|
+
}));
|
|
149
|
+
default:
|
|
150
|
+
return currentData;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// must be last function in file
|
|
155
|
+
function changeData(
|
|
156
|
+
currentData,
|
|
157
|
+
iterationKey,
|
|
158
|
+
settingsForChange,
|
|
159
|
+
chartInstance,
|
|
160
|
+
) {
|
|
161
|
+
// console.log('iterationKey - ', iterationKey);
|
|
162
|
+
// console.log('settingsForChange - ', settingsForChange);
|
|
163
|
+
|
|
164
|
+
switch (iterationKey) {
|
|
165
|
+
case "setMaxBarThickness":
|
|
166
|
+
return addDatasetsObjects(currentData, {
|
|
167
|
+
maxBarThickness: settingsForChange,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
case "addGradientsObjects":
|
|
171
|
+
return settingsForChange.reduce(
|
|
172
|
+
(acc, gradientSettingsObj) =>
|
|
173
|
+
addGradientsObject(acc, gradientSettingsObj, chartInstance),
|
|
174
|
+
clone(currentData),
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
case "addNotLibraryAnimations":
|
|
178
|
+
return settingsForChange.reduce(
|
|
179
|
+
(acc, animationObj) =>
|
|
180
|
+
addNotLibraryAnimation(acc, animationObj, chartInstance),
|
|
181
|
+
currentData,
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
default:
|
|
185
|
+
return currentData;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export default changeData;
|
|
@@ -1 +1,335 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
FINTURF_ADD_GRADIENT_COLORS_NEGATIVE,
|
|
3
|
+
FINTURF_TOOLTIP_OPTIONS,
|
|
4
|
+
GRADIENTS_OBJECTS,
|
|
5
|
+
} from "./Chart.constants";
|
|
6
|
+
import addAdditionalOptions from "./optionsSetters";
|
|
7
|
+
|
|
8
|
+
// options constructors for ChartJS
|
|
9
|
+
|
|
10
|
+
export const reactChartJsOptionsLayouts = {
|
|
11
|
+
lineIconLayout: {
|
|
12
|
+
options: {
|
|
13
|
+
responsive: true,
|
|
14
|
+
maintainAspectRatio: false,
|
|
15
|
+
scales: {
|
|
16
|
+
x: { display: false },
|
|
17
|
+
y: { display: false },
|
|
18
|
+
},
|
|
19
|
+
elements: {
|
|
20
|
+
point: { radius: 0 },
|
|
21
|
+
line: {
|
|
22
|
+
tension: 0.45,
|
|
23
|
+
borderJoinStyle: "round",
|
|
24
|
+
borderWidth: 2,
|
|
25
|
+
capBezierPoints: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
redraw: true,
|
|
30
|
+
notLibraryOptions: {
|
|
31
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
32
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
33
|
+
// => Файл Chart.js => определение ChartComponent
|
|
34
|
+
chartTypeKey: "Line",
|
|
35
|
+
setCanvasDimensions: {
|
|
36
|
+
width: "75px",
|
|
37
|
+
height: "35px",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
lineLayout: {
|
|
42
|
+
options: {
|
|
43
|
+
responsive: true,
|
|
44
|
+
elements: {
|
|
45
|
+
point: {
|
|
46
|
+
radius: 4,
|
|
47
|
+
pointStyle: "circle",
|
|
48
|
+
backgroundColor: "#FFFFFF",
|
|
49
|
+
color: "#FFFFFF",
|
|
50
|
+
},
|
|
51
|
+
line: {
|
|
52
|
+
tension: 0.45,
|
|
53
|
+
borderJoinStyle: "round",
|
|
54
|
+
borderWidth: 2,
|
|
55
|
+
capBezierPoints: true,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
redraw: true,
|
|
60
|
+
notLibraryOptions: {
|
|
61
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
62
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
63
|
+
// => Файл Chart.js => определение ChartComponent
|
|
64
|
+
chartTypeKey: "Line",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
barLayout: {
|
|
68
|
+
options: {
|
|
69
|
+
responsive: true,
|
|
70
|
+
elements: {
|
|
71
|
+
bar: {
|
|
72
|
+
borderRadius: 10,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
redraw: true,
|
|
77
|
+
notLibraryOptions: {
|
|
78
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
79
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
80
|
+
// => Файл Chart.js => определение ChartComponent
|
|
81
|
+
chartTypeKey: "Bar",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
emptyLayout: {
|
|
85
|
+
options: {
|
|
86
|
+
responsive: true,
|
|
87
|
+
maintainAspectRatio: false,
|
|
88
|
+
scales: {
|
|
89
|
+
x: { display: false },
|
|
90
|
+
y: { display: false },
|
|
91
|
+
},
|
|
92
|
+
elements: {
|
|
93
|
+
point: { radius: 0 },
|
|
94
|
+
line: { borderWidth: 0 },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
notLibraryOptions: {
|
|
98
|
+
// Этот ключ должен быть в любой итоговой конфигурации для нормальной работы компонента именно в такой вложенности
|
|
99
|
+
// На основании этого ключа будет приниматься решение какой компонет будет использован (<Line />, <Bar /> и т.д.)
|
|
100
|
+
// => Файл Chart.js => определение подкомпонента ChartComponent => строка const Component = ...
|
|
101
|
+
chartTypeKey: "Line",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const finturfChartLayouts = (() => {
|
|
107
|
+
return ["barLayout", "lineLayout"].reduce(
|
|
108
|
+
(acc, key) => ({
|
|
109
|
+
...acc,
|
|
110
|
+
[key]: {
|
|
111
|
+
...reactChartJsOptionsLayouts[key],
|
|
112
|
+
|
|
113
|
+
options: {
|
|
114
|
+
...reactChartJsOptionsLayouts[key].options,
|
|
115
|
+
scales: {
|
|
116
|
+
...reactChartJsOptionsLayouts[key].options?.scales,
|
|
117
|
+
x: {
|
|
118
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.x,
|
|
119
|
+
grid: {
|
|
120
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.x?.grid,
|
|
121
|
+
display: false,
|
|
122
|
+
offset: true,
|
|
123
|
+
},
|
|
124
|
+
ticks: {
|
|
125
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.ticks,
|
|
126
|
+
autoSkipPadding: 10,
|
|
127
|
+
align: "center",
|
|
128
|
+
color: "#757F8C",
|
|
129
|
+
lineHeight: 18,
|
|
130
|
+
font: {
|
|
131
|
+
family: "Sarabun",
|
|
132
|
+
style: "normal",
|
|
133
|
+
weight: 400,
|
|
134
|
+
size: 8,
|
|
135
|
+
},
|
|
136
|
+
// callback: (value, index, ticks) => {
|
|
137
|
+
// console.log(value);
|
|
138
|
+
// console.log(index);
|
|
139
|
+
// console.log(ticks);
|
|
140
|
+
// console.log('***********');
|
|
141
|
+
// return value;
|
|
142
|
+
// },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
y: {
|
|
146
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y,
|
|
147
|
+
min: 0,
|
|
148
|
+
// grace: '5%',
|
|
149
|
+
bounds: "data",
|
|
150
|
+
grid: {
|
|
151
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.grid,
|
|
152
|
+
borderColor: "#E1E8F1",
|
|
153
|
+
color: "#E1E8F1",
|
|
154
|
+
borderDash: [5],
|
|
155
|
+
// borderDashOffset: 12,
|
|
156
|
+
drawTicks: false,
|
|
157
|
+
z: -1,
|
|
158
|
+
},
|
|
159
|
+
ticks: {
|
|
160
|
+
...reactChartJsOptionsLayouts[key].options?.scales?.y?.ticks,
|
|
161
|
+
autoSkipPadding: 10,
|
|
162
|
+
align: "center",
|
|
163
|
+
color: "#A0A4B0",
|
|
164
|
+
lineHeight: 18,
|
|
165
|
+
padding: 6,
|
|
166
|
+
font: {
|
|
167
|
+
family: "Sarabun",
|
|
168
|
+
style: "normal",
|
|
169
|
+
weight: 400,
|
|
170
|
+
size: 10,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
notLibraryOptions: {
|
|
178
|
+
...reactChartJsOptionsLayouts[key].notLibraryOptions,
|
|
179
|
+
setCanvasDimensions: {
|
|
180
|
+
height: "194px",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
185
|
+
{},
|
|
186
|
+
);
|
|
187
|
+
})();
|
|
188
|
+
|
|
189
|
+
const finturfChartBar = {
|
|
190
|
+
...finturfChartLayouts.barLayout,
|
|
191
|
+
options: {
|
|
192
|
+
...finturfChartLayouts.barLayout?.options,
|
|
193
|
+
maintainAspectRatio: false,
|
|
194
|
+
elements: {
|
|
195
|
+
...finturfChartLayouts.barLayout?.options?.elements,
|
|
196
|
+
bar: {
|
|
197
|
+
...finturfChartLayouts.barLayout?.options?.elements?.bar,
|
|
198
|
+
borderRadius: 4,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
notLibraryOptions: {
|
|
203
|
+
...finturfChartLayouts.barLayout?.notLibraryOptions,
|
|
204
|
+
changeData: {
|
|
205
|
+
...finturfChartLayouts.barLayout?.notLibraryOptions?.changeData,
|
|
206
|
+
setMaxBarThickness: 16,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const finturfChartLine = {
|
|
212
|
+
...finturfChartLayouts.lineLayout,
|
|
213
|
+
options: {
|
|
214
|
+
...finturfChartLayouts.lineLayout?.options,
|
|
215
|
+
maintainAspectRatio: false,
|
|
216
|
+
elements: {
|
|
217
|
+
...finturfChartLayouts.lineLayout.options?.elements,
|
|
218
|
+
point: {
|
|
219
|
+
...finturfChartLayouts.lineLayout.options?.elements?.point,
|
|
220
|
+
radius: 2,
|
|
221
|
+
borderColor: "#32A784",
|
|
222
|
+
borderWidth: 4,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const finturfReactChartJsOptions = {
|
|
229
|
+
finturfChartBar: addAdditionalOptions(finturfChartBar, {
|
|
230
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.bar,
|
|
231
|
+
addTooltipOptions: FINTURF_TOOLTIP_OPTIONS,
|
|
232
|
+
}),
|
|
233
|
+
|
|
234
|
+
finturfLoadingModeBar: {
|
|
235
|
+
...finturfChartBar,
|
|
236
|
+
|
|
237
|
+
options: {
|
|
238
|
+
...finturfChartBar.options,
|
|
239
|
+
animations: {
|
|
240
|
+
...finturfChartBar.options?.animations,
|
|
241
|
+
y: {
|
|
242
|
+
...finturfChartBar.options?.animations?.y,
|
|
243
|
+
duration: 0,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
notLibraryOptions: {
|
|
249
|
+
...finturfChartBar.notLibraryOptions,
|
|
250
|
+
changeData: {
|
|
251
|
+
...finturfChartBar.notLibraryOptions?.changeData,
|
|
252
|
+
addNotLibraryAnimations: [
|
|
253
|
+
{
|
|
254
|
+
type: "runningColumns",
|
|
255
|
+
// duration - ms
|
|
256
|
+
duration: 600,
|
|
257
|
+
// default easing - 'linear',
|
|
258
|
+
// easing: 'easeInOutExpo',
|
|
259
|
+
// ToDo - предусмотреть 'auto' и default для from и to
|
|
260
|
+
from: 10,
|
|
261
|
+
to: 75,
|
|
262
|
+
columnsDelayCoef: 500,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
finturfChartLine: addAdditionalOptions(finturfChartLine, {
|
|
270
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.line,
|
|
271
|
+
addTooltipOptions: FINTURF_TOOLTIP_OPTIONS,
|
|
272
|
+
// consoleCurrentData: true,
|
|
273
|
+
}),
|
|
274
|
+
|
|
275
|
+
finturfLoadingModeLine: {
|
|
276
|
+
...finturfChartLine,
|
|
277
|
+
|
|
278
|
+
options: {
|
|
279
|
+
...finturfChartLine.options,
|
|
280
|
+
elements: {
|
|
281
|
+
...finturfChartLine.options?.elements,
|
|
282
|
+
point: {
|
|
283
|
+
...finturfChartLine.options?.elements?.point,
|
|
284
|
+
radius: 4,
|
|
285
|
+
borderWidth: 1,
|
|
286
|
+
borderColor: "#E1E8F1",
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
animations: {
|
|
290
|
+
...finturfChartLine.options?.animations,
|
|
291
|
+
y: {
|
|
292
|
+
...finturfChartLine.options?.animations?.y,
|
|
293
|
+
duration: 0,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
notLibraryOptions: {
|
|
299
|
+
...finturfChartLine.notLibraryOptions,
|
|
300
|
+
changeData: {
|
|
301
|
+
...finturfChartLine.notLibraryOptions?.changeData,
|
|
302
|
+
addNotLibraryAnimations: [
|
|
303
|
+
{
|
|
304
|
+
type: "runningColumns",
|
|
305
|
+
// duration - ms
|
|
306
|
+
duration: 600,
|
|
307
|
+
// default easing - 'linear',
|
|
308
|
+
// easing: 'easeInOutExpo',
|
|
309
|
+
columnsDelayCoef: 500,
|
|
310
|
+
isFixExtremeColumns: true,
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
finturfPositiveLineIcon: addAdditionalOptions(
|
|
318
|
+
reactChartJsOptionsLayouts.lineIconLayout,
|
|
319
|
+
{
|
|
320
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.positiveLineIcon,
|
|
321
|
+
},
|
|
322
|
+
),
|
|
323
|
+
|
|
324
|
+
finturfNegativeLineIcon: addAdditionalOptions(
|
|
325
|
+
reactChartJsOptionsLayouts.lineIconLayout,
|
|
326
|
+
{
|
|
327
|
+
addGradientsSettings: GRADIENTS_OBJECTS.finturf.negativeLineIcon,
|
|
328
|
+
},
|
|
329
|
+
),
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export default {
|
|
333
|
+
...finturfReactChartJsOptions,
|
|
334
|
+
emptyLayout: reactChartJsOptionsLayouts.emptyLayout,
|
|
335
|
+
};
|
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
// gradientsSettings is Array of objects
|
|
2
|
+
export const addGradientsSettings = (currentOptions, gradientsSettings) => ({
|
|
3
|
+
...currentOptions,
|
|
4
|
+
notLibraryOptions: {
|
|
5
|
+
...currentOptions.notLibraryOptions,
|
|
6
|
+
changeData: {
|
|
7
|
+
...currentOptions.notLibraryOptions?.changeData,
|
|
8
|
+
addGradientsObjects: gradientsSettings,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const addTooltipOptions = (currentOptions, tooltipOptions) => ({
|
|
14
|
+
...currentOptions,
|
|
15
|
+
options: {
|
|
16
|
+
...currentOptions.options,
|
|
17
|
+
plugins: {
|
|
18
|
+
...currentOptions.options.plugins,
|
|
19
|
+
tooltip: tooltipOptions,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// must be last function in file
|
|
25
|
+
const addAdditionalOptions = (currentOptions, optionsToAdd) => {
|
|
26
|
+
const addOption = (currentOptions, optionKey, optionData) => {
|
|
27
|
+
switch (optionKey) {
|
|
28
|
+
case "addGradientsSettings":
|
|
29
|
+
return addGradientsSettings(currentOptions, optionData);
|
|
30
|
+
case "addTooltipOptions":
|
|
31
|
+
return addTooltipOptions(currentOptions, optionData);
|
|
32
|
+
default:
|
|
33
|
+
return currentOptions;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const iterator = Object.keys(optionsToAdd);
|
|
38
|
+
return iterator.reduce(
|
|
39
|
+
(acc, key) => addOption(acc, key, optionsToAdd[key]),
|
|
40
|
+
currentOptions,
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export default addAdditionalOptions;
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { clone, omitKeys } from "../../../../Functions/utils";
|
|
2
|
+
|
|
3
|
+
import { CHART_TYPES, DEFAULT_CHART_MODEL } from "./Chart.constants";
|
|
4
|
+
import changeData from "./datasetSetters";
|
|
5
|
+
import optionsConstructor from "./optionsConstructor";
|
|
6
|
+
|
|
7
|
+
export const getChartTypeKey = (model) =>
|
|
8
|
+
optionsConstructor[model]?.notLibraryOptions?.chartTypeKey;
|
|
9
|
+
|
|
10
|
+
export const correctModelKey = (model) =>
|
|
11
|
+
model &&
|
|
12
|
+
optionsConstructor[model] &&
|
|
13
|
+
CHART_TYPES.includes(getChartTypeKey(model))
|
|
14
|
+
? model
|
|
15
|
+
: DEFAULT_CHART_MODEL;
|
|
16
|
+
|
|
17
|
+
export const getOptions = (model) =>
|
|
18
|
+
omitKeys(
|
|
19
|
+
optionsConstructor[model] || optionsConstructor[DEFAULT_CHART_MODEL],
|
|
20
|
+
["notLibraryOptions"],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const getNotLibraryOptionsOptions = (model) => {
|
|
24
|
+
const { notLibraryOptions } =
|
|
25
|
+
optionsConstructor[model] || optionsConstructor[DEFAULT_CHART_MODEL] || {};
|
|
26
|
+
return notLibraryOptions ? clone(notLibraryOptions) : undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const prepareData = (model, data, chartInstance, addToDatasets) => {
|
|
30
|
+
if (!chartInstance) return data;
|
|
31
|
+
const notLibraryOptions = getNotLibraryOptionsOptions(model);
|
|
32
|
+
|
|
33
|
+
const iterator = notLibraryOptions?.changeData
|
|
34
|
+
? Object.keys(notLibraryOptions.changeData)
|
|
35
|
+
: [];
|
|
36
|
+
|
|
37
|
+
const changedData = iterator.reduce(
|
|
38
|
+
(acc, dataChangeKey) =>
|
|
39
|
+
changeData(
|
|
40
|
+
acc,
|
|
41
|
+
dataChangeKey,
|
|
42
|
+
notLibraryOptions.changeData[dataChangeKey],
|
|
43
|
+
chartInstance,
|
|
44
|
+
addToDatasets,
|
|
45
|
+
),
|
|
46
|
+
clone(data),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return addToDatasets &&
|
|
50
|
+
typeof addToDatasets === "object" &&
|
|
51
|
+
!Array.isArray(addToDatasets)
|
|
52
|
+
? {
|
|
53
|
+
...changedData,
|
|
54
|
+
datasets: changedData.datasets.map((dataset) => ({
|
|
55
|
+
...dataset,
|
|
56
|
+
...addToDatasets,
|
|
57
|
+
})),
|
|
58
|
+
}
|
|
59
|
+
: changedData;
|
|
60
|
+
};
|