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,183 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import moment from 'moment-timezone';
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import Arrow from '../../UI/Arrow/Arrow';
|
|
7
|
+
|
|
8
|
+
import './RangeCalendar.scss';
|
|
9
|
+
|
|
10
|
+
function RangeCalendar(props) {
|
|
11
|
+
const {
|
|
12
|
+
className,
|
|
13
|
+
date,
|
|
14
|
+
setDate,
|
|
15
|
+
startDate,
|
|
16
|
+
endDate,
|
|
17
|
+
allowPrev = true,
|
|
18
|
+
allowNext = true,
|
|
19
|
+
onClick = () => {},
|
|
20
|
+
onHover = () => {},
|
|
21
|
+
startPrevDate,
|
|
22
|
+
endPrevDate,
|
|
23
|
+
limitRange,
|
|
24
|
+
isShortWeekNames,
|
|
25
|
+
minDate,
|
|
26
|
+
maxDate,
|
|
27
|
+
momentMinDate,
|
|
28
|
+
momentMaxDate,
|
|
29
|
+
isDontLimitFuture,
|
|
30
|
+
testId = 'range-calendar',
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const [days, setDays] = useState({});
|
|
34
|
+
|
|
35
|
+
const title = useMemo(
|
|
36
|
+
() => `${moment(date).format('MMM')} ${moment(date).format('YYYY')}`,
|
|
37
|
+
[date],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const result = {};
|
|
42
|
+
const day = moment(date).startOf('month');
|
|
43
|
+
const daysInMonth = day.daysInMonth();
|
|
44
|
+
for (let d = 0; d < daysInMonth; d += 1) {
|
|
45
|
+
let week = day.week();
|
|
46
|
+
if (day.month() === 11 && week === 1) week = 53;
|
|
47
|
+
if (day.month() === 0 && week === 53) week = 0;
|
|
48
|
+
if (!Object.prototype.hasOwnProperty.call(result, week)) {
|
|
49
|
+
result[week] = {};
|
|
50
|
+
}
|
|
51
|
+
result[week][day.weekday()] = { date: day.toDate() };
|
|
52
|
+
day.add(1, 'd');
|
|
53
|
+
}
|
|
54
|
+
setDays(result);
|
|
55
|
+
}, [date]);
|
|
56
|
+
|
|
57
|
+
const renderDay = (week, dayOfWeek) => {
|
|
58
|
+
const day = days[week][dayOfWeek];
|
|
59
|
+
const isFutureDay = day && moment(day.date).isAfter(moment(), 'day');
|
|
60
|
+
const isPastDay = limitRange
|
|
61
|
+
? day
|
|
62
|
+
&& moment(day.date).isBefore(moment().subtract(limitRange, 'days'), 'day')
|
|
63
|
+
: null;
|
|
64
|
+
const isRangeStart = day && moment(day.date).isSame(startDate, 'day');
|
|
65
|
+
const isRangeEnd
|
|
66
|
+
= day
|
|
67
|
+
&& moment(day.date).isSame(moment(endDate).subtract(1, 'hour'), 'day');
|
|
68
|
+
const isRangeInside
|
|
69
|
+
= day
|
|
70
|
+
&& startDate
|
|
71
|
+
&& endDate
|
|
72
|
+
&& moment(day.date).isAfter(startDate, 'day')
|
|
73
|
+
&& moment(day.date).isBefore(moment(endDate).subtract(1, 'hour'), 'day');
|
|
74
|
+
const isPrevRangeEnd
|
|
75
|
+
= day
|
|
76
|
+
&& (moment(day.date).isSame(startPrevDate, 'day')
|
|
77
|
+
|| moment(day.date).isSame(moment(endPrevDate).subtract(1, 'day'), 'day'));
|
|
78
|
+
const isPrevRangeInside
|
|
79
|
+
= day
|
|
80
|
+
&& startPrevDate
|
|
81
|
+
&& endPrevDate
|
|
82
|
+
&& moment(day.date).isAfter(startPrevDate, 'day')
|
|
83
|
+
&& moment(day.date).isBefore(moment(endPrevDate).subtract(1, 'day'), 'day');
|
|
84
|
+
const classNames = cn(
|
|
85
|
+
'range-calendar__day',
|
|
86
|
+
{ 'range-calendar__day--clickable': day },
|
|
87
|
+
{
|
|
88
|
+
'range-calendar__day--disabled':
|
|
89
|
+
isPastDay
|
|
90
|
+
|| (minDate && moment(day?.date).isBefore(momentMinDate, 'day'))
|
|
91
|
+
|| (!isDontLimitFuture
|
|
92
|
+
&& (maxDate ? moment(day?.date).isAfter(momentMaxDate) : isFutureDay)),
|
|
93
|
+
},
|
|
94
|
+
{ 'range-calendar__day--range-start': isRangeStart },
|
|
95
|
+
{ 'range-calendar__day--range-end': isRangeEnd },
|
|
96
|
+
{ 'range-calendar__day--range-inside': isRangeInside },
|
|
97
|
+
{ 'range-calendar__day--prev-range-end': isPrevRangeEnd },
|
|
98
|
+
{ 'range-calendar__day--prev-range-inside': isPrevRangeInside },
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
key={`${week}_${dayOfWeek}`}
|
|
104
|
+
className={classNames}
|
|
105
|
+
onClick={day ? e => onClick(day.date, e) : null}
|
|
106
|
+
onMouseOver={day ? () => onHover(day.date) : null}
|
|
107
|
+
onMouseLeave={() => onHover(null)}
|
|
108
|
+
>
|
|
109
|
+
<span className="calendar__day-num">{day && day.date.getDate()}</span>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handlePrev = () => {
|
|
115
|
+
setDate(moment(date).subtract(1, 'month').toDate());
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const handleNext = () => {
|
|
119
|
+
setDate(moment(date).add(1, 'month').toDate());
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const getFormatedWeekName = input =>
|
|
123
|
+
isShortWeekNames ? input.charAt(0) : input;
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div className={cn('range-calendar', className)} data-testid={testId}>
|
|
127
|
+
<div className="range-calendar-header">
|
|
128
|
+
<Arrow
|
|
129
|
+
type="left"
|
|
130
|
+
disabled={
|
|
131
|
+
!allowPrev
|
|
132
|
+
|| (minDate
|
|
133
|
+
&& moment(date)
|
|
134
|
+
.startOf('month')
|
|
135
|
+
.isSameOrBefore(momentMinDate, 'months'))
|
|
136
|
+
}
|
|
137
|
+
onClick={handlePrev}
|
|
138
|
+
className="range-calendar-header__prev"
|
|
139
|
+
/>
|
|
140
|
+
|
|
141
|
+
<div className="range-calendar-header__title">{title}</div>
|
|
142
|
+
|
|
143
|
+
<Arrow
|
|
144
|
+
type="right"
|
|
145
|
+
disabled={
|
|
146
|
+
!allowNext
|
|
147
|
+
|| (!isDontLimitFuture
|
|
148
|
+
&& moment(date)
|
|
149
|
+
.startOf('month')
|
|
150
|
+
.isSameOrAfter(
|
|
151
|
+
maxDate
|
|
152
|
+
? momentMaxDate
|
|
153
|
+
: moment().add(1, 'day').startOf('day'),
|
|
154
|
+
'months',
|
|
155
|
+
))
|
|
156
|
+
}
|
|
157
|
+
onClick={handleNext}
|
|
158
|
+
className="range-calendar-header__next"
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div className="range-calendar__week range-calendar__week-title">
|
|
163
|
+
{[...Array.from({ length: 7 }).keys()].map((dayOfWeek) => {
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
key={`day-of-week_${dayOfWeek}`}
|
|
167
|
+
className="range-calendar__day range-calendar__day--title"
|
|
168
|
+
>
|
|
169
|
+
{getFormatedWeekName(moment().weekday(dayOfWeek).format('dd'))}
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
})}
|
|
173
|
+
</div>
|
|
174
|
+
{Object.keys(days).map((week, index) => (
|
|
175
|
+
<div key={`week_${index}`} className="range-calendar__week">
|
|
176
|
+
{[...Array.from({ length: 7 }).keys()].map(dayOfWeek => renderDay(week, dayOfWeek))}
|
|
177
|
+
</div>
|
|
178
|
+
))}
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export default RangeCalendar;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
// import { numberFilter, numberFilterWithoutDots, rounded } from '../../../Functions/utils';
|
|
6
|
+
import { addRangeDefault } from '../../../Functions/operations';
|
|
7
|
+
import Button from '../../UI/Button/Button';
|
|
8
|
+
import Input from '../Input/Input';
|
|
9
|
+
|
|
10
|
+
import RangeListRow, { RangeListCell } from './partial/RangeListRow';
|
|
11
|
+
|
|
12
|
+
import './RangeList.scss';
|
|
13
|
+
|
|
14
|
+
const RC = 'range-list';
|
|
15
|
+
const DEFAULT_STATE = { from: '', to: '' };
|
|
16
|
+
|
|
17
|
+
function RangeList(props) {
|
|
18
|
+
const {
|
|
19
|
+
className,
|
|
20
|
+
value = [],
|
|
21
|
+
disabled,
|
|
22
|
+
validateErrors,
|
|
23
|
+
onChange,
|
|
24
|
+
isFloatValues,
|
|
25
|
+
decimalPlaces,
|
|
26
|
+
error,
|
|
27
|
+
defaultErrorText,
|
|
28
|
+
nullValueText,
|
|
29
|
+
isOnlyOneRow = false,
|
|
30
|
+
testId = 'range-list',
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const NULL_VALUE_TEXT = nullValueText ?? 'No data';
|
|
34
|
+
|
|
35
|
+
const [state, setState] = useState(DEFAULT_STATE);
|
|
36
|
+
const [innerError, setInnerError] = useState('');
|
|
37
|
+
const [outerError, setOuterError] = useState('');
|
|
38
|
+
|
|
39
|
+
const inputFromRef = useRef(null);
|
|
40
|
+
const inputToRef = useRef(null);
|
|
41
|
+
|
|
42
|
+
const isValidRange = Boolean(
|
|
43
|
+
state?.from && state?.to && Number(state?.from) <= Number(state?.to),
|
|
44
|
+
);
|
|
45
|
+
const isShowRow = (isOnlyOneRow && value?.length === 0) || !isOnlyOneRow;
|
|
46
|
+
|
|
47
|
+
const handle = {
|
|
48
|
+
inputsChange: (val, prop) => setState({ ...state, [prop]: val }),
|
|
49
|
+
addRange: () => {
|
|
50
|
+
if (
|
|
51
|
+
isValidRange
|
|
52
|
+
&& (!validateErrors?.(Number(state.from), Number(state.to)) ?? true)
|
|
53
|
+
) {
|
|
54
|
+
onChange(
|
|
55
|
+
addRangeDefault(
|
|
56
|
+
Number(state.from),
|
|
57
|
+
Number(state.to),
|
|
58
|
+
value,
|
|
59
|
+
isFloatValues ? decimalPlaces : null,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
setState(DEFAULT_STATE);
|
|
63
|
+
setInnerError('');
|
|
64
|
+
setOuterError('');
|
|
65
|
+
}
|
|
66
|
+
else if (!isValidRange) {
|
|
67
|
+
setInnerError(defaultErrorText);
|
|
68
|
+
}
|
|
69
|
+
else if (validateErrors) {
|
|
70
|
+
setOuterError(validateErrors(Number(state.from), Number(state.to)));
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
removeRange: index =>
|
|
74
|
+
onChange(value.filter((item, idx) => idx !== index)),
|
|
75
|
+
rangeValidation: (e, key) => {
|
|
76
|
+
const oppositeKey = key === 'from' ? 'to' : 'from';
|
|
77
|
+
|
|
78
|
+
if (!state?.from && !state?.to) {
|
|
79
|
+
setInnerError('');
|
|
80
|
+
setOuterError('');
|
|
81
|
+
return e;
|
|
82
|
+
}
|
|
83
|
+
if (!state[oppositeKey]) {
|
|
84
|
+
const mustToFocus
|
|
85
|
+
= key === 'from' ? inputToRef.current : inputFromRef.current;
|
|
86
|
+
mustToFocus.focus();
|
|
87
|
+
}
|
|
88
|
+
else if (!isValidRange) {
|
|
89
|
+
setInnerError(defaultErrorText);
|
|
90
|
+
if (validateErrors)
|
|
91
|
+
setOuterError(validateErrors(Number(state.from), Number(state.to)));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
setInnerError('');
|
|
95
|
+
if (validateErrors)
|
|
96
|
+
setOuterError(validateErrors(Number(state.from), Number(state.to)));
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
},
|
|
100
|
+
onKeyUpFromInput: (code) => {
|
|
101
|
+
if (code === 13) {
|
|
102
|
+
if (isValidRange) inputFromRef.current.blur();
|
|
103
|
+
else if (!state.to) inputToRef.current.focus();
|
|
104
|
+
else if (state.from) inputFromRef.current.select();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
onKeyUpToInput: (code) => {
|
|
108
|
+
if (code === 13) inputToRef.current.blur();
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const renderInputsAndAddButtonRow = () => (
|
|
113
|
+
<div className={cn(`${RC}__row`, `${RC}__inputs`)}>
|
|
114
|
+
<RangeListCell className={`${RC}__cell-input`}>
|
|
115
|
+
<Input
|
|
116
|
+
ref={inputFromRef}
|
|
117
|
+
onlyNumbers={
|
|
118
|
+
isFloatValues
|
|
119
|
+
? { type: 'float', decimalPlaces: decimalPlaces || 0 }
|
|
120
|
+
: { type: 'int' }
|
|
121
|
+
}
|
|
122
|
+
value={state.from}
|
|
123
|
+
onBlur={e => handle.rangeValidation(e, 'from')}
|
|
124
|
+
onChange={val => handle.inputsChange(val, 'from')}
|
|
125
|
+
onKeyUp={code => handle.onKeyUpFromInput(code)}
|
|
126
|
+
/>
|
|
127
|
+
</RangeListCell>
|
|
128
|
+
<RangeListCell className={`${RC}__cell-input`}>
|
|
129
|
+
<Input
|
|
130
|
+
ref={inputToRef}
|
|
131
|
+
onlyNumbers={
|
|
132
|
+
isFloatValues
|
|
133
|
+
? { type: 'float', decimalPlaces: decimalPlaces || 0 }
|
|
134
|
+
: { type: 'int' }
|
|
135
|
+
}
|
|
136
|
+
value={state.to}
|
|
137
|
+
onBlur={e => handle.rangeValidation(e, 'to')}
|
|
138
|
+
onChange={val => handle.inputsChange(val, 'to')}
|
|
139
|
+
onKeyUp={code => handle.onKeyUpToInput(code)}
|
|
140
|
+
/>
|
|
141
|
+
</RangeListCell>
|
|
142
|
+
<RangeListCell className={`${RC}__cell-button`}>
|
|
143
|
+
<Button onClick={handle.addRange}>Add</Button>
|
|
144
|
+
</RangeListCell>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
data-testid={testId}
|
|
151
|
+
className={cn(RC, className, { [`${RC}_disabled`]: disabled })}
|
|
152
|
+
>
|
|
153
|
+
<div className={cn(`${RC}__row`, `${RC}__labels`)}>
|
|
154
|
+
<RangeListCell className={`${RC}__cell-label`}>From</RangeListCell>
|
|
155
|
+
<RangeListCell className={`${RC}__cell-label`}>To</RangeListCell>
|
|
156
|
+
</div>
|
|
157
|
+
{isShowRow && renderInputsAndAddButtonRow()}
|
|
158
|
+
{(innerError || outerError || error) && (
|
|
159
|
+
<span className={`${RC}__error`}>
|
|
160
|
+
{innerError || error || outerError}
|
|
161
|
+
</span>
|
|
162
|
+
)}
|
|
163
|
+
{!value?.length && (
|
|
164
|
+
<div className={cn(`${RC}__row`, `${RC}__values`, `${RC}__null-value`)}>
|
|
165
|
+
{NULL_VALUE_TEXT}
|
|
166
|
+
</div>
|
|
167
|
+
)}
|
|
168
|
+
{value.map((row, idx) => (
|
|
169
|
+
<RangeListRow
|
|
170
|
+
data-testid={`${testId}-row-${idx}`}
|
|
171
|
+
key={`idx-${idx}-from-${row.from}-to${row.to}`}
|
|
172
|
+
{...row}
|
|
173
|
+
idx={idx}
|
|
174
|
+
actionClick={() => handle.removeRange(idx)}
|
|
175
|
+
/>
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export default RangeList;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { Trash2 } from 'react-feather';
|
|
3
|
+
|
|
4
|
+
const RC = 'range-list';
|
|
5
|
+
|
|
6
|
+
export function RangeListCell({ children, idx, className, onClick }) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={cn(`${RC}__cell`, className, { [`${RC}__cell-${idx}`]: idx })}
|
|
10
|
+
onClick={onClick}
|
|
11
|
+
>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function RangeListRow({ from, to, idx, actionClick }) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={cn(`${RC}__row`, `${RC}__values`, {
|
|
21
|
+
[`${RC}__values_first-value`]: idx === 0,
|
|
22
|
+
})}
|
|
23
|
+
>
|
|
24
|
+
<RangeListCell idx={1} className={`${RC}__cell-value`}>
|
|
25
|
+
{from}
|
|
26
|
+
</RangeListCell>
|
|
27
|
+
<RangeListCell idx={2} className={`${RC}__cell-value`}>
|
|
28
|
+
{to}
|
|
29
|
+
</RangeListCell>
|
|
30
|
+
<RangeListCell
|
|
31
|
+
idx={3}
|
|
32
|
+
className={`${RC}__cell-action`}
|
|
33
|
+
onClick={() => actionClick(idx)}
|
|
34
|
+
>
|
|
35
|
+
<Trash2 />
|
|
36
|
+
</RangeListCell>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default RangeListRow;
|