intelicoreact 0.0.61 → 0.0.65

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.
@@ -2,7 +2,7 @@ import React, {useEffect, useState} from 'react';
2
2
  import moment from 'moment-timezone';
3
3
  import cn from 'classnames';
4
4
 
5
- import {INTERVALS as intervals, CUSTOM_INTERVAL_KEY as customKey } from '../dependencies';
5
+ import {INTERVALS as intervals, CUSTOM_INTERVAL_KEY as customKey, CUSTOM_INTERVAL_KEY_TEXT } from '../dependencies';
6
6
 
7
7
  import SelectItem from './SelectItem';
8
8
  import Datepicker from './Datepicker';
@@ -25,6 +25,7 @@ const OpenedPart = React.forwardRef((props, ref) => {
25
25
  isCompare,
26
26
  setIsCompare,
27
27
  toggleOff,
28
+ isShortWeekNames
28
29
  } = props;
29
30
 
30
31
  const items = isCompact ? [...Object.keys(intervals)] : [...Object.keys(intervals), customKey];
@@ -76,7 +77,7 @@ const OpenedPart = React.forwardRef((props, ref) => {
76
77
  <SelectItem
77
78
  key={index}
78
79
  item={item}
79
- label={(txt?.labels && txt?.labels[item]) || intervals[item]?.label || item}
80
+ label={(txt?.labels && txt?.labels[item]) || intervals[item]?.label || (item === customKey ? CUSTOM_INTERVAL_KEY_TEXT : item )}
80
81
  isActive={activeInterval === item}
81
82
  onItemClick={() => handleItemClick(item.value || item)}
82
83
  disabled={item === customKey}
@@ -103,6 +104,7 @@ const OpenedPart = React.forwardRef((props, ref) => {
103
104
  isCompareHidden={isCompareHidden}
104
105
  limitRange={limitRange}
105
106
  setActiveInterval={setActiveInterval}
107
+ isShortWeekNames={isShortWeekNames}
106
108
  />
107
109
  )}
108
110
  </div>
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- import icon from '../../../../../../assets/icons/check.svg'
5
-
6
4
  const SelectItem = ({ item, label, isActive, onItemClick, onMouseEnter, disabled }) => (
7
5
  <div
8
6
  className={cn(
@@ -15,7 +13,11 @@ const SelectItem = ({ item, label, isActive, onItemClick, onMouseEnter, disabled
15
13
  onMouseEnter={onMouseEnter}
16
14
  data-item={item}
17
15
  >
18
- {isActive && <object data={icon} className={cn('opened-part__intervals-item-icon-active')} />}
16
+ {isActive && (
17
+ <svg className={cn('opened-part__intervals-item-icon-active')} width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
18
+ <path d="M13.3333 4L5.99999 11.3333L2.66666 8" stroke="black" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
19
+ </svg>
20
+ )}
19
21
  {label}
20
22
  </div>
21
23
  );
@@ -130,6 +130,14 @@ export const getActualDateRange = inputDateRange => {
130
130
  }
131
131
  return null;
132
132
  })();
133
+ if (actualIntervalKey === ALL_TIME_KEY) return {
134
+ intervalKey: ALL_TIME_KEY,
135
+ start: null,
136
+ end: null,
137
+ compare: inputDateRange.compare,
138
+ startPrevDate: null,
139
+ endPrevDate:null
140
+ };
133
141
  const actualValues = {
134
142
  // intervalKey: inputDateRange.intervalKey || customIntervalKey,
135
143
  intervalKey: actualIntervalKey || CUSTOM_INTERVAL_KEY,
@@ -19,7 +19,8 @@ const RangeCalendar = props => {
19
19
  onHover = () => {},
20
20
  startPrevDate,
21
21
  endPrevDate,
22
- limitRange
22
+ limitRange,
23
+ isShortWeekNames
23
24
  } = props;
24
25
 
25
26
  const [days, setDays] = useState({});
@@ -100,6 +101,8 @@ const RangeCalendar = props => {
100
101
  setDate(moment(date).add(1, 'month').toDate());
101
102
  };
102
103
 
104
+ const getFormatedWeekName = input => isShortWeekNames ? input.charAt(0) : input;
105
+
103
106
  return (
104
107
  <div className={cn('range-calendar', className)}>
105
108
  <div className="range-calendar-header">
@@ -126,7 +129,7 @@ const RangeCalendar = props => {
126
129
  {[...Array(7).keys()].map(dayOfWeek => {
127
130
  return (
128
131
  <div key={`day-of-week_${dayOfWeek}`} className="range-calendar__day range-calendar__day--title">
129
- {moment().weekday(dayOfWeek).format('dd').charAt(0)}
132
+ {getFormatedWeekName(moment().weekday(dayOfWeek).format('dd'))}
130
133
  </div>
131
134
  );
132
135
  })}