@jetbrains/ring-ui-built 7.0.106 → 7.0.108
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/components/_helpers/date-picker.js +1 -1
- package/components/_helpers/theme.js +15 -14
- package/components/alert-service/alert-service.d.ts +2 -2
- package/components/alert-service/alert-service.js +2 -2
- package/components/auth/auth-core.js +1 -0
- package/components/auth/auth.js +1 -0
- package/components/auth/iframe-flow.js +1 -0
- package/components/auth/token-validator.js +1 -0
- package/components/auth-dialog/auth-dialog.js +1 -0
- package/components/auth-dialog-service/auth-dialog-service.js +1 -0
- package/components/avatar/avatar.js +1 -0
- package/components/avatar-stack/avatar-stack.js +1 -0
- package/components/banner/banner.js +1 -0
- package/components/button-group/button-group.js +18 -1
- package/components/components/util-stories.js +3 -0
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +1 -0
- package/components/data-list/data-list.js +1 -0
- package/components/data-list/selection.js +1 -0
- package/components/date-picker/animate-date.d.ts +1 -0
- package/components/date-picker/animate-date.js +39 -0
- package/components/date-picker/consts.d.ts +21 -4
- package/components/date-picker/consts.js +18 -1
- package/components/date-picker/date-picker.d.ts +48 -1
- package/components/date-picker/date-picker.js +44 -17
- package/components/date-picker/date-popup.d.ts +3 -9
- package/components/date-picker/date-popup.js +59 -72
- package/components/date-picker/day.js +24 -15
- package/components/date-picker/month-names.js +76 -72
- package/components/date-picker/month-slider.d.ts +5 -20
- package/components/date-picker/month-slider.js +129 -47
- package/components/date-picker/month.d.ts +4 -0
- package/components/date-picker/month.js +81 -76
- package/components/date-picker/months.js +75 -191
- package/components/date-picker/scroll-arith.d.ts +35 -0
- package/components/date-picker/scroll-arith.js +74 -0
- package/components/date-picker/use-intersection-observer.d.ts +6 -0
- package/components/date-picker/use-intersection-observer.js +93 -0
- package/components/date-picker/use-scroll-behavior.d.ts +8 -0
- package/components/date-picker/use-scroll-behavior.js +223 -0
- package/components/date-picker/weekdays.js +3 -0
- package/components/date-picker/years.d.ts +1 -18
- package/components/date-picker/years.js +259 -78
- package/components/dialog/dialog.js +1 -0
- package/components/dropdown-menu/dropdown-menu.js +1 -0
- package/components/editable-heading/editable-heading.js +1 -0
- package/components/error-bubble/error-bubble.js +1 -0
- package/components/footer/footer.d.ts +1 -1
- package/components/global/dom.d.ts +1 -1
- package/components/global/dom.js +1 -1
- package/components/header/header.js +1 -0
- package/components/header/profile.js +1 -0
- package/components/header/services.js +1 -0
- package/components/header/smart-profile.js +1 -0
- package/components/header/smart-services.js +1 -0
- package/components/heading/heading.d.ts +4 -4
- package/components/list/list-item.js +1 -0
- package/components/list/list-users-groups-source.js +1 -0
- package/components/list/list.js +1 -0
- package/components/login-dialog/login-dialog.js +1 -0
- package/components/login-dialog/service.js +1 -0
- package/components/message/message.js +1 -0
- package/components/old-browsers-message/old-browsers-message-stop.js +1 -0
- package/components/old-browsers-message/old-browsers-message.js +1 -0
- package/components/old-browsers-message/white-list.js +3 -2
- package/components/pager/pager.js +1 -0
- package/components/popup/popup.js +1 -0
- package/components/popup/position-css.js +1 -0
- package/components/popup/position.js +1 -0
- package/components/popup-menu/popup-menu.js +1 -0
- package/components/query-assist/query-assist-suggestions.js +1 -0
- package/components/query-assist/query-assist.js +1 -0
- package/components/select/select-filter.js +1 -0
- package/components/select/select-popup.js +1 -0
- package/components/select/select.js +1 -0
- package/components/shortcuts/core.js +1 -0
- package/components/shortcuts/shortcuts-hoc.js +1 -0
- package/components/shortcuts/shortcuts.js +1 -0
- package/components/slider/slider.js +1 -0
- package/components/style.css +1 -1
- package/components/table/disable-hover-hoc.js +1 -0
- package/components/table/multitable.js +1 -0
- package/components/table/row-with-focus-sensor.js +1 -0
- package/components/table/row.js +1 -0
- package/components/table/simple-table.js +1 -0
- package/components/table/smart-table.js +1 -0
- package/components/table/table.js +1 -0
- package/components/tabs/collapsible-more.js +1 -0
- package/components/tabs/collapsible-tabs.js +1 -0
- package/components/tabs/dumb-tabs.d.ts +1 -0
- package/components/tabs/dumb-tabs.js +3 -1
- package/components/tabs/smart-tabs.js +1 -0
- package/components/tabs/tabs.js +1 -0
- package/components/tags-input/tags-input.js +1 -0
- package/components/tooltip/tooltip.js +1 -0
- package/components/user-agreement/service.js +1 -0
- package/components/user-agreement/user-agreement.js +1 -0
- package/components/user-card/card.js +1 -0
- package/components/user-card/smart-user-card-tooltip.js +1 -0
- package/components/user-card/tooltip.js +1 -0
- package/components/user-card/user-card.js +1 -0
- package/components/util-stories.d.ts +1 -0
- package/package.json +3 -3
- package/typings.d.ts +5 -0
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { Component, createElement } from 'react';
|
|
3
3
|
import { isAfter } from 'date-fns/isAfter';
|
|
4
4
|
import { isBefore } from 'date-fns/isBefore';
|
|
5
|
-
import { isSameDay } from 'date-fns/isSameDay';
|
|
6
5
|
import { startOfDay } from 'date-fns/startOfDay';
|
|
7
6
|
import { set } from 'date-fns';
|
|
8
7
|
import memoize from '../global/memoize.js';
|
|
@@ -11,6 +10,8 @@ import Months from './months.js';
|
|
|
11
10
|
import Years from './years.js';
|
|
12
11
|
import Weekdays from './weekdays.js';
|
|
13
12
|
import { parseTime } from './consts.js';
|
|
13
|
+
import { animateDate } from './animate-date.js';
|
|
14
|
+
import MonthNames from './month-names.js';
|
|
14
15
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
15
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
16
17
|
import 'classnames';
|
|
@@ -36,42 +37,36 @@ import 'memoize-one';
|
|
|
36
37
|
import '../control-label/control-label.js';
|
|
37
38
|
import '../control-help/control-help.js';
|
|
38
39
|
import 'date-fns/addMonths';
|
|
39
|
-
import 'date-fns/getDay';
|
|
40
|
-
import 'date-fns/getDaysInMonth';
|
|
41
40
|
import 'date-fns/startOfMonth';
|
|
42
|
-
import 'date-fns/subMonths';
|
|
43
|
-
import 'date-fns/endOfMonth';
|
|
44
|
-
import '../global/schedule-raf.js';
|
|
45
|
-
import '../global/linear-function.js';
|
|
46
|
-
import '../global/use-event-callback.js';
|
|
47
41
|
import './month.js';
|
|
48
|
-
import 'date-fns/addDays';
|
|
49
42
|
import 'date-fns/format';
|
|
50
|
-
import 'date-fns/
|
|
43
|
+
import 'date-fns/getDay';
|
|
51
44
|
import './day.js';
|
|
45
|
+
import 'core-js/modules/es.array.includes.js';
|
|
46
|
+
import 'date-fns/addDays';
|
|
52
47
|
import 'date-fns/getDate';
|
|
48
|
+
import 'date-fns/isSameDay';
|
|
53
49
|
import 'date-fns/isToday';
|
|
54
50
|
import 'date-fns/add';
|
|
55
|
-
import '
|
|
56
|
-
import '
|
|
57
|
-
import '
|
|
58
|
-
import '
|
|
59
|
-
import './
|
|
51
|
+
import '../global/sniffer.js';
|
|
52
|
+
import 'sniffr';
|
|
53
|
+
import './use-intersection-observer.js';
|
|
54
|
+
import './scroll-arith.js';
|
|
55
|
+
import './use-scroll-behavior.js';
|
|
56
|
+
import '../global/use-event-callback.js';
|
|
57
|
+
import '../global/schedule-raf.js';
|
|
60
58
|
import 'date-fns/addYears';
|
|
61
|
-
import 'date-fns/subYears';
|
|
62
59
|
import 'date-fns/getYear';
|
|
63
60
|
import 'date-fns/isSameYear';
|
|
64
61
|
import 'date-fns/isThisYear';
|
|
65
62
|
import 'date-fns/setYear';
|
|
63
|
+
import 'date-fns/startOfYear';
|
|
64
|
+
import 'date-fns/setDay';
|
|
65
|
+
import 'date-fns/isThisMonth';
|
|
66
|
+
import '../global/linear-function.js';
|
|
67
|
+
import './month-slider.js';
|
|
66
68
|
|
|
67
|
-
const scrollExpDelay = 10;
|
|
68
69
|
class DatePopup extends Component {
|
|
69
|
-
static sameDay(next, prev) {
|
|
70
|
-
if (next && prev) {
|
|
71
|
-
return isSameDay(next, prev);
|
|
72
|
-
}
|
|
73
|
-
return next === prev;
|
|
74
|
-
}
|
|
75
70
|
static defaultProps = {
|
|
76
71
|
onChange() {}
|
|
77
72
|
};
|
|
@@ -92,21 +87,22 @@ class DatePopup extends Component {
|
|
|
92
87
|
this.state = {
|
|
93
88
|
...defaultState,
|
|
94
89
|
active,
|
|
95
|
-
scrollDate:
|
|
90
|
+
scrollDate: {
|
|
91
|
+
date: parsedDate,
|
|
92
|
+
source: 'other'
|
|
93
|
+
}
|
|
96
94
|
};
|
|
97
95
|
} else {
|
|
98
96
|
this.state = {
|
|
99
97
|
...defaultState,
|
|
100
98
|
active: props.from && !props.to ? 'to' : 'from',
|
|
101
|
-
scrollDate:
|
|
99
|
+
scrollDate: {
|
|
100
|
+
date: this.parse(props.from, 'from'),
|
|
101
|
+
source: 'other'
|
|
102
|
+
}
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
componentDidMount() {
|
|
106
|
-
if (this.componentRef.current) {
|
|
107
|
-
this.componentRef.current.addEventListener('wheel', this.handleWheel);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
106
|
componentDidUpdate(prevProps, prevState) {
|
|
111
107
|
if (this.state.active !== prevState.active) {
|
|
112
108
|
if (this.state.text && prevState.active) {
|
|
@@ -118,19 +114,11 @@ class DatePopup extends Component {
|
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
116
|
componentWillUnmount() {
|
|
121
|
-
|
|
122
|
-
this.componentRef.current.removeEventListener('wheel', this.handleWheel);
|
|
123
|
-
}
|
|
117
|
+
this.animationCleanup?.();
|
|
124
118
|
}
|
|
125
|
-
|
|
126
|
-
_scrollTS;
|
|
119
|
+
animationCleanup = null;
|
|
127
120
|
isInTimeMode = () => !this.props.range && this.props.withTime || false;
|
|
128
121
|
componentRef = /*#__PURE__*/React.createRef();
|
|
129
|
-
handleWheel = e => {
|
|
130
|
-
if (e.cancelable) {
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
122
|
parse(text, type) {
|
|
135
123
|
if (type === 'time') {
|
|
136
124
|
return parseTime(String(text));
|
|
@@ -238,31 +226,6 @@ class DatePopup extends Component {
|
|
|
238
226
|
}
|
|
239
227
|
return false;
|
|
240
228
|
};
|
|
241
|
-
scheduleScroll = () => {
|
|
242
|
-
const current = this.state.scrollDate && this.parse(this.state.scrollDate, 'date') || this.parse(this.props[this.state.active], 'date') || new Date();
|
|
243
|
-
const goal = this._scrollDate;
|
|
244
|
-
if (!current || !goal || DatePopup.sameDay(goal, current)) {
|
|
245
|
-
this._scrollDate = null;
|
|
246
|
-
this._scrollTS = null;
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
if (this._scrollTS) {
|
|
250
|
-
const diff = goal - Number(current);
|
|
251
|
-
const dt = Date.now() - this._scrollTS;
|
|
252
|
-
const next = goal - diff * Math.E ** (-dt / scrollExpDelay);
|
|
253
|
-
this.setState({
|
|
254
|
-
scrollDate: next
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
this._scrollTS = Date.now();
|
|
258
|
-
window.requestAnimationFrame(this.scheduleScroll);
|
|
259
|
-
};
|
|
260
|
-
scrollTo = scrollDate => {
|
|
261
|
-
this._scrollDate = scrollDate;
|
|
262
|
-
if (!this._scrollTS) {
|
|
263
|
-
this.scheduleScroll();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
229
|
hoverHandler = hoverDate => this.setState({
|
|
267
230
|
hoverDate
|
|
268
231
|
});
|
|
@@ -273,7 +236,23 @@ class DatePopup extends Component {
|
|
|
273
236
|
if (name !== 'time') {
|
|
274
237
|
const parsed = this.parse(text, name);
|
|
275
238
|
if (this.isValidDate(parsed)) {
|
|
276
|
-
this.
|
|
239
|
+
this.animationCleanup?.();
|
|
240
|
+
const currentScrollDate = this.state.scrollDate?.date;
|
|
241
|
+
if (currentScrollDate != null) {
|
|
242
|
+
this.animationCleanup = animateDate(currentScrollDate, parsed, date => {
|
|
243
|
+
this.setState({
|
|
244
|
+
scrollDate: {
|
|
245
|
+
date,
|
|
246
|
+
source: 'other'
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
} else {
|
|
251
|
+
this.setScrollDate({
|
|
252
|
+
date: parsed,
|
|
253
|
+
source: 'other'
|
|
254
|
+
});
|
|
255
|
+
}
|
|
277
256
|
}
|
|
278
257
|
}
|
|
279
258
|
this.setState({
|
|
@@ -295,9 +274,11 @@ class DatePopup extends Component {
|
|
|
295
274
|
});
|
|
296
275
|
}
|
|
297
276
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
277
|
+
setScrollDate = scrollDate => {
|
|
278
|
+
this.setState({
|
|
279
|
+
scrollDate
|
|
280
|
+
});
|
|
281
|
+
};
|
|
301
282
|
onClear = e => {
|
|
302
283
|
let changes;
|
|
303
284
|
if (this.props.range) {
|
|
@@ -359,7 +340,10 @@ class DatePopup extends Component {
|
|
|
359
340
|
break;
|
|
360
341
|
}
|
|
361
342
|
}
|
|
362
|
-
const scrollDate = this.state.scrollDate ||
|
|
343
|
+
const scrollDate = this.state.scrollDate || {
|
|
344
|
+
date: new Date(),
|
|
345
|
+
source: 'other'
|
|
346
|
+
};
|
|
363
347
|
const calendarProps = {
|
|
364
348
|
...restProps,
|
|
365
349
|
...dates,
|
|
@@ -367,8 +351,7 @@ class DatePopup extends Component {
|
|
|
367
351
|
activeDate,
|
|
368
352
|
currentRange,
|
|
369
353
|
activeRange,
|
|
370
|
-
|
|
371
|
-
onScrollChange: this.scrollTo
|
|
354
|
+
setScrollDate: this.setScrollDate
|
|
372
355
|
};
|
|
373
356
|
const clearable = Boolean(this.props.onClear);
|
|
374
357
|
return /*#__PURE__*/jsxs("div", {
|
|
@@ -421,6 +404,10 @@ class DatePopup extends Component {
|
|
|
421
404
|
onHover: this.hoverHandler,
|
|
422
405
|
onSelect: this.selectHandler,
|
|
423
406
|
locale: locale
|
|
407
|
+
}), /*#__PURE__*/jsx(MonthNames, {
|
|
408
|
+
...calendarProps,
|
|
409
|
+
onHover: this.hoverHandler,
|
|
410
|
+
onSelect: this.selectHandler
|
|
424
411
|
}), /*#__PURE__*/jsx(Years, {
|
|
425
412
|
...calendarProps
|
|
426
413
|
})]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
1
2
|
import { Component } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import { addDays } from 'date-fns/addDays';
|
|
@@ -13,6 +14,8 @@ import { getDayNumInWeek, weekdays } from './consts.js';
|
|
|
13
14
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
14
15
|
import { jsx } from 'react/jsx-runtime';
|
|
15
16
|
import 'date-fns/add';
|
|
17
|
+
import '../global/sniffer.js';
|
|
18
|
+
import 'sniffr';
|
|
16
19
|
|
|
17
20
|
let hoverTO;
|
|
18
21
|
class Day extends Component {
|
|
@@ -61,32 +64,38 @@ class Day extends Component {
|
|
|
61
64
|
const spreadRange = makeSpreadRange(currentRange);
|
|
62
65
|
const disabled = this.isDisabled(day);
|
|
63
66
|
const activeSpreadRange = makeSpreadRange(activeRange);
|
|
67
|
+
const className = classNames(styles.day, dayInWeekClass, {
|
|
68
|
+
[styles.current]: ['date', 'from', 'to'].some(this.is),
|
|
69
|
+
[styles.active]: !disabled && this.is('activeDate'),
|
|
70
|
+
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
71
|
+
[styles.empty]: empty,
|
|
72
|
+
[styles.from]: currentRange && this.isDay(currentRange[0]) && !reverse || activeRange && this.isDay(activeRange[0]),
|
|
73
|
+
[styles.to]: currentRange && this.isDay(currentRange[1]) || activeRange && this.isDay(activeRange[1]),
|
|
74
|
+
[styles.between]: this.inRange(currentRange),
|
|
75
|
+
[styles.activeBetween]: !disabled && this.inRange(activeRange),
|
|
76
|
+
[styles.first]: getDate(day) === 1,
|
|
77
|
+
[styles.spread]: this.inRange(spreadRange),
|
|
78
|
+
[styles.activeSpread]: !disabled && this.inRange(activeSpreadRange),
|
|
79
|
+
[styles.disabled]: disabled
|
|
80
|
+
});
|
|
81
|
+
if (empty) {
|
|
82
|
+
return /*#__PURE__*/jsx("div", {
|
|
83
|
+
className: className
|
|
84
|
+
});
|
|
85
|
+
}
|
|
64
86
|
return (
|
|
65
87
|
/*#__PURE__*/
|
|
66
88
|
// TODO make keyboard navigation actually work
|
|
67
89
|
jsx("button", {
|
|
68
90
|
type: "button",
|
|
69
|
-
className:
|
|
70
|
-
[styles.current]: ['date', 'from', 'to'].some(this.is),
|
|
71
|
-
[styles.active]: !disabled && this.is('activeDate'),
|
|
72
|
-
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
73
|
-
[styles.empty]: empty,
|
|
74
|
-
[styles.from]: currentRange && this.isDay(currentRange[0]) && !reverse || activeRange && this.isDay(activeRange[0]),
|
|
75
|
-
[styles.to]: currentRange && this.isDay(currentRange[1]) || activeRange && this.isDay(activeRange[1]),
|
|
76
|
-
[styles.between]: this.inRange(currentRange),
|
|
77
|
-
[styles.activeBetween]: !disabled && this.inRange(activeRange),
|
|
78
|
-
[styles.first]: getDate(day) === 1,
|
|
79
|
-
[styles.spread]: this.inRange(spreadRange),
|
|
80
|
-
[styles.activeSpread]: !disabled && this.inRange(activeSpreadRange),
|
|
81
|
-
[styles.disabled]: disabled
|
|
82
|
-
}),
|
|
91
|
+
className: className,
|
|
83
92
|
onClick: this.handleClick,
|
|
84
93
|
onMouseOver: this.handleMouseOver,
|
|
85
94
|
onFocus: this.handleMouseOver,
|
|
86
95
|
onMouseOut: this.handleMouseOut,
|
|
87
96
|
onBlur: this.handleMouseOut,
|
|
88
97
|
disabled: disabled,
|
|
89
|
-
children:
|
|
98
|
+
children: /*#__PURE__*/jsx("span", {
|
|
90
99
|
className: classNames({
|
|
91
100
|
[styles.today]: isToday(day)
|
|
92
101
|
}),
|
|
@@ -1,31 +1,50 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { endOfMonth } from 'date-fns/endOfMonth';
|
|
5
4
|
import { format } from 'date-fns/format';
|
|
6
5
|
import { isThisMonth } from 'date-fns/isThisMonth';
|
|
7
|
-
import { set } from 'date-fns/set';
|
|
8
|
-
import { startOfDay } from 'date-fns/startOfDay';
|
|
9
6
|
import { startOfYear } from 'date-fns/startOfYear';
|
|
7
|
+
import { startOfMonth, addMonths, getYear } from 'date-fns';
|
|
10
8
|
import linearFunction from '../global/linear-function.js';
|
|
11
9
|
import MonthSlider from './month-slider.js';
|
|
12
|
-
import { YEAR,
|
|
10
|
+
import { YEAR, yearScrollSpeed, MIDDLE_DAY } from './consts.js';
|
|
11
|
+
import { animateDate } from './animate-date.js';
|
|
13
12
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
14
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
14
|
import 'date-fns/addYears';
|
|
16
|
-
import '
|
|
15
|
+
import '../global/schedule-raf.js';
|
|
17
16
|
import 'date-fns/add';
|
|
17
|
+
import '../global/sniffer.js';
|
|
18
|
+
import 'sniffr';
|
|
18
19
|
|
|
19
20
|
class MonthName extends PureComponent {
|
|
21
|
+
componentWillUnmount() {
|
|
22
|
+
this.animationCleanup?.();
|
|
23
|
+
}
|
|
24
|
+
animationCleanup = null;
|
|
20
25
|
handleClick = () => {
|
|
21
|
-
const
|
|
22
|
-
|
|
26
|
+
const start = startOfMonth(this.getMiddleDay(this.props.monthIndex));
|
|
27
|
+
const nextStart = addMonths(start, 1);
|
|
28
|
+
// Because the space between months belongs to the next month, we position the target month a bit to the top
|
|
29
|
+
// eslint-disable-next-line no-magic-numbers
|
|
30
|
+
const targetDate = new Date(0.4 * Number(start) + 0.6 * Number(nextStart));
|
|
31
|
+
this.animationCleanup?.();
|
|
32
|
+
this.animationCleanup = animateDate(this.props.scrollDate.date, targetDate, date => {
|
|
33
|
+
this.props.setScrollDate({
|
|
34
|
+
date,
|
|
35
|
+
source: 'other'
|
|
36
|
+
});
|
|
37
|
+
});
|
|
23
38
|
};
|
|
39
|
+
getMiddleDay(monthIndex) {
|
|
40
|
+
return new Date(getYear(this.props.scrollDate.date), monthIndex, MIDDLE_DAY);
|
|
41
|
+
}
|
|
24
42
|
render() {
|
|
25
43
|
const {
|
|
26
|
-
|
|
44
|
+
monthIndex,
|
|
27
45
|
locale
|
|
28
46
|
} = this.props;
|
|
47
|
+
const month = this.getMiddleDay(monthIndex);
|
|
29
48
|
return /*#__PURE__*/jsx("button", {
|
|
30
49
|
type: "button",
|
|
31
50
|
className: classNames(styles.monthName, {
|
|
@@ -38,77 +57,63 @@ class MonthName extends PureComponent {
|
|
|
38
57
|
});
|
|
39
58
|
}
|
|
40
59
|
}
|
|
60
|
+
const monthsIndices = Array.from({
|
|
61
|
+
length: YEAR
|
|
62
|
+
}, (_, i) => i);
|
|
41
63
|
function MonthNames(props) {
|
|
42
|
-
const $ = c(
|
|
43
|
-
if ($[0] !== "
|
|
44
|
-
for (let $i = 0; $i <
|
|
64
|
+
const $ = c(21);
|
|
65
|
+
if ($[0] !== "633552d635d6cf61dab4cfd31bcb62cbd2b7859ba7d592e2891928ab59b43fa8") {
|
|
66
|
+
for (let $i = 0; $i < 21; $i += 1) {
|
|
45
67
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
46
68
|
}
|
|
47
|
-
$[0] = "
|
|
69
|
+
$[0] = "633552d635d6cf61dab4cfd31bcb62cbd2b7859ba7d592e2891928ab59b43fa8";
|
|
48
70
|
}
|
|
49
71
|
const {
|
|
50
72
|
scrollDate,
|
|
51
73
|
locale
|
|
52
74
|
} = props;
|
|
53
|
-
let months;
|
|
54
|
-
if ($[1] !== scrollDate) {
|
|
55
|
-
months = [];
|
|
56
|
-
for (let i = 0; i < YEAR; i++) {
|
|
57
|
-
const middleDay = set(scrollDate, {
|
|
58
|
-
month: i,
|
|
59
|
-
date: MIDDLE_DAY
|
|
60
|
-
});
|
|
61
|
-
months.push(startOfDay(middleDay));
|
|
62
|
-
}
|
|
63
|
-
$[1] = scrollDate;
|
|
64
|
-
$[2] = months;
|
|
65
|
-
} else {
|
|
66
|
-
months = $[2];
|
|
67
|
-
}
|
|
68
75
|
let bottom;
|
|
69
|
-
let pxToDate;
|
|
70
76
|
let top;
|
|
71
|
-
if ($[
|
|
77
|
+
if ($[1] !== props.currentRange || $[2] !== scrollDate.date) {
|
|
72
78
|
let t0;
|
|
73
|
-
if ($[
|
|
74
|
-
t0 = startOfYear(scrollDate);
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
79
|
+
if ($[5] !== scrollDate.date) {
|
|
80
|
+
t0 = startOfYear(scrollDate.date);
|
|
81
|
+
$[5] = scrollDate.date;
|
|
82
|
+
$[6] = t0;
|
|
77
83
|
} else {
|
|
78
|
-
t0 = $[
|
|
84
|
+
t0 = $[6];
|
|
79
85
|
}
|
|
80
|
-
pxToDate = linearFunction(0, Number(t0), yearScrollSpeed);
|
|
86
|
+
const pxToDate = linearFunction(0, Number(t0), yearScrollSpeed);
|
|
81
87
|
top = 0;
|
|
82
88
|
bottom = 0;
|
|
83
89
|
if (props.currentRange) {
|
|
84
90
|
[top, bottom] = props.currentRange.map(date => Math.floor(pxToDate.x(Number(date))));
|
|
85
91
|
}
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[7] = top;
|
|
92
|
+
$[1] = props.currentRange;
|
|
93
|
+
$[2] = scrollDate.date;
|
|
94
|
+
$[3] = bottom;
|
|
95
|
+
$[4] = top;
|
|
91
96
|
} else {
|
|
92
|
-
bottom = $[
|
|
93
|
-
|
|
94
|
-
top = $[7];
|
|
97
|
+
bottom = $[3];
|
|
98
|
+
top = $[4];
|
|
95
99
|
}
|
|
96
100
|
let t0;
|
|
97
|
-
if ($[
|
|
98
|
-
t0 =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
if ($[7] !== locale || $[8] !== props.setScrollDate || $[9] !== scrollDate) {
|
|
102
|
+
t0 = monthsIndices.map(monthIndex => /*#__PURE__*/jsx(MonthName, {
|
|
103
|
+
scrollDate: scrollDate,
|
|
104
|
+
monthIndex: monthIndex,
|
|
105
|
+
setScrollDate: props.setScrollDate,
|
|
101
106
|
locale: locale
|
|
102
|
-
},
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
+
}, monthIndex));
|
|
108
|
+
$[7] = locale;
|
|
109
|
+
$[8] = props.setScrollDate;
|
|
110
|
+
$[9] = scrollDate;
|
|
111
|
+
$[10] = t0;
|
|
107
112
|
} else {
|
|
108
|
-
t0 = $[
|
|
113
|
+
t0 = $[10];
|
|
109
114
|
}
|
|
110
115
|
let t1;
|
|
111
|
-
if ($[
|
|
116
|
+
if ($[11] !== bottom || $[12] !== props.currentRange || $[13] !== top) {
|
|
112
117
|
t1 = props.currentRange && /*#__PURE__*/jsx("div", {
|
|
113
118
|
className: styles.range,
|
|
114
119
|
style: {
|
|
@@ -116,37 +121,36 @@ function MonthNames(props) {
|
|
|
116
121
|
height: bottom + 1 - (top - 1)
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
124
|
+
$[11] = bottom;
|
|
125
|
+
$[12] = props.currentRange;
|
|
126
|
+
$[13] = top;
|
|
127
|
+
$[14] = t1;
|
|
123
128
|
} else {
|
|
124
|
-
t1 = $[
|
|
129
|
+
t1 = $[14];
|
|
125
130
|
}
|
|
126
131
|
let t2;
|
|
127
|
-
if ($[
|
|
132
|
+
if ($[15] !== props) {
|
|
128
133
|
t2 = /*#__PURE__*/jsx(MonthSlider, {
|
|
129
|
-
...props
|
|
130
|
-
pxToDate: pxToDate
|
|
134
|
+
...props
|
|
131
135
|
});
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[20] = t2;
|
|
136
|
+
$[15] = props;
|
|
137
|
+
$[16] = t2;
|
|
135
138
|
} else {
|
|
136
|
-
t2 = $[
|
|
139
|
+
t2 = $[16];
|
|
137
140
|
}
|
|
138
141
|
let t3;
|
|
139
|
-
if ($[
|
|
142
|
+
if ($[17] !== t0 || $[18] !== t1 || $[19] !== t2) {
|
|
140
143
|
t3 = /*#__PURE__*/jsxs("div", {
|
|
141
144
|
className: styles.monthNames,
|
|
145
|
+
"data-test": "ring-date-popup--month-names",
|
|
142
146
|
children: [t0, t1, t2]
|
|
143
147
|
});
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
+
$[17] = t0;
|
|
149
|
+
$[18] = t1;
|
|
150
|
+
$[19] = t2;
|
|
151
|
+
$[20] = t3;
|
|
148
152
|
} else {
|
|
149
|
-
t3 = $[
|
|
153
|
+
t3 = $[20];
|
|
150
154
|
}
|
|
151
155
|
return t3;
|
|
152
156
|
}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
interface MonthSliderState {
|
|
8
|
-
dragging: boolean;
|
|
9
|
-
}
|
|
10
|
-
export default class MonthSlider extends PureComponent<MonthSliderProps> {
|
|
11
|
-
state: {
|
|
12
|
-
dragging: boolean;
|
|
13
|
-
};
|
|
14
|
-
componentDidUpdate(prevProps: MonthSliderProps, prevState: MonthSliderState): void;
|
|
15
|
-
onMouseDown: () => void;
|
|
16
|
-
onMouseUp: () => void;
|
|
17
|
-
onMouseMove: (e: MouseEvent) => void;
|
|
18
|
-
render(): import("react").JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import { type ScrollDate } from './consts';
|
|
2
|
+
export default function MonthSlider({ scrollDate, setScrollDate, }: {
|
|
3
|
+
scrollDate: ScrollDate;
|
|
4
|
+
setScrollDate: (scrollDate: ScrollDate) => void;
|
|
5
|
+
}): import("react").JSX.Element;
|