@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.3
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/_rollupPluginBabelHelpers.js +1 -504
- package/components/_helpers/anchor.js +7 -5
- package/components/_helpers/button__classes.js +15 -13
- package/components/_helpers/caption.js +11 -17
- package/components/_helpers/card.js +92 -96
- package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
- package/components/_helpers/icon__svg.js +27 -23
- package/components/_helpers/input.js +150 -171
- package/components/_helpers/query-assist__suggestions.js +78 -93
- package/components/_helpers/select__filter.js +56 -67
- package/components/_helpers/services-link.js +23 -29
- package/components/_helpers/sidebar.js +91 -93
- package/components/_helpers/tab-link.js +8 -6
- package/components/_helpers/theme.js +41 -50
- package/components/_helpers/title.js +59 -69
- package/components/alert/alert.js +112 -156
- package/components/alert/container.js +32 -39
- package/components/alert-service/alert-service.js +104 -161
- package/components/analytics/analytics.js +12 -20
- package/components/analytics/analytics__custom-plugin.js +52 -68
- package/components/auth/auth.js +2 -27
- package/components/auth/auth__core.d.ts +1 -1
- package/components/auth/auth__core.js +742 -1428
- package/components/auth/background-flow.js +84 -121
- package/components/auth/down-notification.js +31 -69
- package/components/auth/iframe-flow.js +70 -123
- package/components/auth/request-builder.js +46 -77
- package/components/auth/response-parser.js +84 -112
- package/components/auth/storage.js +160 -318
- package/components/auth/token-validator.js +132 -227
- package/components/auth/window-flow.js +84 -121
- package/components/auth-dialog/auth-dialog.js +99 -150
- package/components/auth-dialog-service/auth-dialog-service.js +6 -26
- package/components/avatar/avatar-example-datauri.js +1 -1
- package/components/avatar/avatar.js +94 -123
- package/components/avatar/fallback-avatar.js +20 -34
- package/components/badge/badge.js +32 -38
- package/components/breadcrumbs/breadcrumbs.js +13 -17
- package/components/button/button.js +67 -80
- package/components/button-group/button-group.js +27 -36
- package/components/button-set/button-set.js +19 -27
- package/components/button-toolbar/button-toolbar.js +17 -25
- package/components/caret/caret.js +184 -211
- package/components/checkbox/checkbox.js +69 -86
- package/components/clipboard/clipboard-fallback.js +7 -7
- package/components/clipboard/clipboard.js +36 -128
- package/components/code/code.js +83 -151
- package/components/collapse/collapse-content.js +42 -60
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -12
- package/components/collapse/collapse.js +12 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.js +57 -87
- package/components/confirm-service/confirm-service.js +23 -44
- package/components/content-layout/content-layout.js +41 -56
- package/components/content-layout/sidebar.js +1 -1
- package/components/contenteditable/contenteditable.js +38 -46
- package/components/control-help/control-help.js +5 -3
- package/components/control-label/control-label.js +9 -8
- package/components/data-list/data-list.js +113 -156
- package/components/data-list/data-list.mock.js +3 -5
- package/components/data-list/item.js +120 -140
- package/components/data-list/selection.js +77 -135
- package/components/data-list/title.js +2 -10
- package/components/date-picker/consts.js +16 -22
- package/components/date-picker/date-input.js +99 -124
- package/components/date-picker/date-picker.js +140 -184
- package/components/date-picker/date-popup.js +280 -327
- package/components/date-picker/day.js +71 -94
- package/components/date-picker/month-names.js +41 -59
- package/components/date-picker/month-slider.js +42 -61
- package/components/date-picker/month.js +17 -24
- package/components/date-picker/months.js +44 -49
- package/components/date-picker/weekdays.js +12 -21
- package/components/date-picker/years.js +77 -98
- package/components/dialog/dialog.js +151 -187
- package/components/dialog/dialog__body-scroll-preventer.js +0 -3
- package/components/dropdown/anchor.js +0 -6
- package/components/dropdown/dropdown.js +134 -154
- package/components/dropdown-menu/dropdown-menu.js +59 -87
- package/components/editable-heading/editable-heading.js +69 -116
- package/components/error-bubble/error-bubble.js +29 -54
- package/components/error-message/error-message.js +34 -49
- package/components/footer/footer.js +27 -28
- package/components/global/compose.js +1 -8
- package/components/global/composeRefs.d.ts +0 -3
- package/components/global/composeRefs.js +8 -15
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +14 -13
- package/components/global/data-tests.js +7 -12
- package/components/global/dom.js +49 -82
- package/components/global/focus-sensor-hoc.js +99 -106
- package/components/global/fuzzy-highlight.js +23 -34
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +3 -7
- package/components/global/inject-styles.js +7 -14
- package/components/global/listeners.js +28 -47
- package/components/global/memoize.js +6 -10
- package/components/global/normalize-indent.js +19 -46
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/prop-types.js +3 -5
- package/components/global/react-dom-renderer.js +29 -40
- package/components/global/rerender-hoc.js +16 -32
- package/components/global/schedule-raf.js +4 -4
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +1 -18
- package/components/global/trivial-template-tag.js +4 -9
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -23
- package/components/global/use-event-callback.js +7 -4
- package/components/grid/col.js +27 -39
- package/components/grid/grid.js +18 -27
- package/components/grid/row.js +23 -30
- package/components/group/group.js +16 -22
- package/components/header/header-icon.js +19 -31
- package/components/header/header.d.ts +0 -1
- package/components/header/header.js +30 -64
- package/components/header/links.js +6 -3
- package/components/header/logo.js +15 -26
- package/components/header/profile.js +124 -150
- package/components/header/services-link.js +1 -3
- package/components/header/services.js +64 -97
- package/components/header/smart-profile.js +101 -178
- package/components/header/smart-services.js +55 -90
- package/components/header/tray.js +21 -30
- package/components/heading/heading.js +21 -20
- package/components/http/http.js +162 -319
- package/components/http/http.mock.js +50 -98
- package/components/hub-source/hub-source.js +77 -182
- package/components/hub-source/hub-source__user.js +9 -37
- package/components/hub-source/hub-source__users-groups.js +34 -60
- package/components/i18n/i18n-context.js +7 -8
- package/components/i18n/i18n.js +3 -6
- package/components/icon/icon.js +60 -74
- package/components/icon/icon__svg.js +0 -5
- package/components/icon/index.js +0 -5
- package/components/input/input.js +1 -11
- package/components/island/adaptive-island-hoc.js +29 -37
- package/components/island/content.js +100 -110
- package/components/island/header.js +56 -66
- package/components/island/island.js +25 -33
- package/components/island-legacy/content-legacy.js +16 -22
- package/components/island-legacy/header-legacy.js +19 -25
- package/components/island-legacy/island-legacy.js +16 -22
- package/components/link/clickableLink.js +33 -42
- package/components/link/link.js +47 -55
- package/components/list/consts.js +2 -2
- package/components/list/list.js +399 -486
- package/components/list/list__custom.js +51 -61
- package/components/list/list__hint.js +9 -17
- package/components/list/list__item.js +147 -178
- package/components/list/list__link.js +38 -47
- package/components/list/list__separator.js +15 -24
- package/components/list/list__title.js +25 -34
- package/components/list/list__users-groups-source.js +55 -121
- package/components/loader/loader.js +38 -60
- package/components/loader/loader__core.js +123 -184
- package/components/loader-inline/loader-inline.js +24 -32
- package/components/loader-screen/loader-screen.js +24 -40
- package/components/login-dialog/login-dialog.js +81 -121
- package/components/login-dialog/service.js +6 -29
- package/components/markdown/markdown.js +16 -24
- package/components/message/message.js +170 -201
- package/components/old-browsers-message/old-browsers-message.js +11 -14
- package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
- package/components/old-browsers-message/white-list.js +8 -13
- package/components/pager/pager.js +212 -257
- package/components/panel/panel.js +16 -22
- package/components/permissions/permissions.js +118 -161
- package/components/permissions/permissions__cache.js +191 -218
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +237 -288
- package/components/popup/popup.target.js +9 -7
- package/components/popup/position.js +94 -101
- package/components/popup-menu/popup-menu.js +33 -67
- package/components/progress-bar/progress-bar.js +57 -68
- package/components/query-assist/query-assist.js +583 -652
- package/components/query-assist/query-assist__suggestions.js +2 -26
- package/components/radio/radio.js +15 -27
- package/components/radio/radio__item.js +52 -62
- package/components/scrollable-section/scrollable-section.js +22 -32
- package/components/select/select.js +693 -793
- package/components/select/select__filter.js +1 -26
- package/components/select/select__popup.js +316 -413
- package/components/shortcuts/core.js +147 -195
- package/components/shortcuts/shortcut-title.js +6 -10
- package/components/shortcuts/shortcuts-hoc.js +23 -41
- package/components/shortcuts/shortcuts.js +41 -64
- package/components/slider/slider.js +93 -112
- package/components/slider/slider.utils.js +16 -23
- package/components/storage/storage.js +3 -27
- package/components/storage/storage__fallback.js +137 -210
- package/components/storage/storage__local.js +89 -147
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +35 -53
- package/components/table/cell.js +11 -21
- package/components/table/disable-hover-hoc.js +27 -42
- package/components/table/header-cell.js +59 -75
- package/components/table/header.js +89 -110
- package/components/table/multitable.js +83 -89
- package/components/table/row-with-focus-sensor.js +25 -57
- package/components/table/row.js +169 -200
- package/components/table/selection-adapter.js +2 -2
- package/components/table/selection-shortcuts-hoc.js +108 -113
- package/components/table/selection.js +150 -217
- package/components/table/simple-table.js +19 -55
- package/components/table/smart-table.js +42 -76
- package/components/table/table.js +267 -327
- package/components/tabs/collapsible-more.js +47 -73
- package/components/tabs/collapsible-tab.js +32 -36
- package/components/tabs/collapsible-tabs.js +89 -148
- package/components/tabs/custom-item.js +4 -2
- package/components/tabs/dumb-tabs.js +60 -92
- package/components/tabs/smart-tabs.js +29 -61
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tab.js +15 -24
- package/components/tabs/tabs.js +1 -26
- package/components/tag/tag.d.ts +0 -2
- package/components/tag/tag.js +120 -162
- package/components/tags-input/tags-input.js +222 -304
- package/components/tags-list/tags-list.js +45 -61
- package/components/text/text.js +28 -37
- package/components/toggle/toggle.js +51 -61
- package/components/tooltip/tooltip.js +109 -141
- package/components/user-agreement/service.js +259 -400
- package/components/user-agreement/user-agreement.js +80 -108
- package/components/user-card/card.js +1 -25
- package/components/user-card/smart-user-card-tooltip.js +52 -103
- package/components/user-card/tooltip.js +35 -65
- package/components/user-card/user-card.js +1 -25
- package/package.json +1 -1
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -6
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -26
@@ -1,8 +1,5 @@
|
|
1
|
-
import { _ as _defineProperty
|
2
|
-
import 'core-js/modules/
|
3
|
-
import 'core-js/modules/es.array.includes.js';
|
4
|
-
import 'core-js/modules/es.object.to-string.js';
|
5
|
-
import 'core-js/modules/es.string.includes.js';
|
1
|
+
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
6
3
|
import { Component } from 'react';
|
7
4
|
import PropTypes from 'prop-types';
|
8
5
|
import classNames from 'classnames';
|
@@ -18,111 +15,91 @@ import { startOfDay } from 'date-fns/startOfDay';
|
|
18
15
|
import { dateType, getDayNumInWeek, weekdays } from './consts.js';
|
19
16
|
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
20
17
|
import { jsx } from 'react/jsx-runtime';
|
21
|
-
import 'core-js/modules/es.array.index-of.js';
|
22
|
-
import 'core-js/modules/es.array.slice.js';
|
23
|
-
import 'core-js/modules/es.object.values.js';
|
24
18
|
import 'core-js/modules/es.regexp.exec.js';
|
25
19
|
import 'date-fns/add';
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
args[_key] = arguments[_key];
|
34
|
-
}
|
35
|
-
_this = _callSuper(this, Day, [].concat(args));
|
36
|
-
_defineProperty(_this, "handleClick", function () {
|
37
|
-
return _this.props.onSelect(_this.props.day);
|
38
|
-
});
|
39
|
-
_defineProperty(_this, "handleMouseOver", function () {
|
21
|
+
let hoverTO;
|
22
|
+
class Day extends Component {
|
23
|
+
constructor() {
|
24
|
+
super(...arguments);
|
25
|
+
_defineProperty(this, "handleClick", () => this.props.onSelect(this.props.day));
|
26
|
+
_defineProperty(this, "handleMouseOver", () => {
|
40
27
|
if (hoverTO) {
|
41
28
|
window.clearTimeout(hoverTO);
|
42
29
|
hoverTO = null;
|
43
30
|
}
|
44
|
-
|
45
|
-
});
|
46
|
-
_defineProperty(_this, "handleMouseOut", function () {
|
47
|
-
hoverTO = window.setTimeout(_this.props.onHover, 0);
|
48
|
-
});
|
49
|
-
_defineProperty(_this, "isDay", function (date) {
|
50
|
-
return isSameDay(_this.props.day, date);
|
31
|
+
this.props.onHover(this.props.day);
|
51
32
|
});
|
52
|
-
_defineProperty(
|
53
|
-
|
54
|
-
return value != null && _this.isDay(value);
|
33
|
+
_defineProperty(this, "handleMouseOut", () => {
|
34
|
+
hoverTO = window.setTimeout(this.props.onHover, 0);
|
55
35
|
});
|
56
|
-
_defineProperty(
|
57
|
-
|
36
|
+
_defineProperty(this, "isDay", date => isSameDay(this.props.day, date));
|
37
|
+
_defineProperty(this, "is", name => {
|
38
|
+
const value = this.props[name];
|
39
|
+
return value != null && this.isDay(value);
|
58
40
|
});
|
59
|
-
_defineProperty(
|
60
|
-
|
61
|
-
|
41
|
+
_defineProperty(this, "inRange", range => range && isAfter(startOfDay(this.props.day), startOfDay(range[0])) && isBefore(startOfDay(this.props.day), startOfDay(range[1])));
|
42
|
+
_defineProperty(this, "isDisabled", date => {
|
43
|
+
const min = this.parse(this.props.minDate);
|
44
|
+
const max = this.parse(this.props.maxDate);
|
62
45
|
return min != null && isBefore(startOfDay(date), startOfDay(min)) || max != null && isAfter(startOfDay(date), startOfDay(max));
|
63
46
|
});
|
64
|
-
return _this;
|
65
47
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
48
|
+
parse(text) {
|
49
|
+
return this.props.parseDateInput(text);
|
50
|
+
}
|
51
|
+
render() {
|
52
|
+
const {
|
53
|
+
day,
|
54
|
+
from,
|
55
|
+
currentRange,
|
56
|
+
activeRange,
|
57
|
+
empty,
|
58
|
+
locale
|
59
|
+
} = this.props;
|
60
|
+
const reverse = activeRange && activeRange[1] === from;
|
61
|
+
const dayInWeek = getDayNumInWeek(locale, getDay(day)) + 1;
|
62
|
+
function makeSpreadRange(range) {
|
63
|
+
return range && [range[0], addDays(range[1], 1)];
|
71
64
|
}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
[modules_0c7b7d96.
|
103
|
-
[modules_0c7b7d96.activeBetween]: !disabled && this.inRange(activeRange),
|
104
|
-
[modules_0c7b7d96.first]: getDate(day) === 1,
|
105
|
-
[modules_0c7b7d96.spread]: this.inRange(spreadRange),
|
106
|
-
[modules_0c7b7d96.activeSpread]: !disabled && this.inRange(activeSpreadRange),
|
107
|
-
[modules_0c7b7d96.disabled]: disabled
|
65
|
+
const spreadRange = makeSpreadRange(currentRange);
|
66
|
+
const disabled = this.isDisabled(day);
|
67
|
+
const activeSpreadRange = makeSpreadRange(activeRange);
|
68
|
+
return (
|
69
|
+
/*#__PURE__*/
|
70
|
+
// TODO make keyboard navigation actually work
|
71
|
+
jsx("button", {
|
72
|
+
type: "button",
|
73
|
+
className: classNames(modules_0c7b7d96.day, modules_0c7b7d96["Day".concat(dayInWeek)], {
|
74
|
+
[modules_0c7b7d96.current]: ['date', 'from', 'to'].some(this.is),
|
75
|
+
[modules_0c7b7d96.active]: !disabled && this.is('activeDate'),
|
76
|
+
[modules_0c7b7d96.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
77
|
+
[modules_0c7b7d96.empty]: empty,
|
78
|
+
[modules_0c7b7d96.from]: currentRange && this.isDay(currentRange[0]) && !reverse || activeRange && this.isDay(activeRange[0]),
|
79
|
+
[modules_0c7b7d96.to]: currentRange && this.isDay(currentRange[1]) || activeRange && this.isDay(activeRange[1]),
|
80
|
+
[modules_0c7b7d96.between]: this.inRange(currentRange),
|
81
|
+
[modules_0c7b7d96.activeBetween]: !disabled && this.inRange(activeRange),
|
82
|
+
[modules_0c7b7d96.first]: getDate(day) === 1,
|
83
|
+
[modules_0c7b7d96.spread]: this.inRange(spreadRange),
|
84
|
+
[modules_0c7b7d96.activeSpread]: !disabled && this.inRange(activeSpreadRange),
|
85
|
+
[modules_0c7b7d96.disabled]: disabled
|
86
|
+
}),
|
87
|
+
onClick: this.handleClick,
|
88
|
+
onMouseOver: this.handleMouseOver,
|
89
|
+
onFocus: this.handleMouseOver,
|
90
|
+
onMouseOut: this.handleMouseOut,
|
91
|
+
onBlur: this.handleMouseOut,
|
92
|
+
disabled: disabled,
|
93
|
+
children: empty || /*#__PURE__*/jsx("span", {
|
94
|
+
className: classNames({
|
95
|
+
[modules_0c7b7d96.today]: isToday(day)
|
108
96
|
}),
|
109
|
-
|
110
|
-
onMouseOver: this.handleMouseOver,
|
111
|
-
onFocus: this.handleMouseOver,
|
112
|
-
onMouseOut: this.handleMouseOut,
|
113
|
-
onBlur: this.handleMouseOut,
|
114
|
-
disabled: disabled,
|
115
|
-
children: empty || /*#__PURE__*/jsx("span", {
|
116
|
-
className: classNames({
|
117
|
-
[modules_0c7b7d96.today]: isToday(day)
|
118
|
-
}),
|
119
|
-
children: format(day, 'd')
|
120
|
-
})
|
97
|
+
children: format(day, 'd')
|
121
98
|
})
|
122
|
-
)
|
123
|
-
|
124
|
-
}
|
125
|
-
}
|
99
|
+
})
|
100
|
+
);
|
101
|
+
}
|
102
|
+
}
|
126
103
|
_defineProperty(Day, "propTypes", {
|
127
104
|
day: dateType,
|
128
105
|
from: dateType,
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { _ as _defineProperty,
|
2
|
-
import 'core-js/modules/
|
3
|
-
import 'core-js/modules/es.array.map.js';
|
1
|
+
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
4
3
|
import { PureComponent } from 'react';
|
5
4
|
import PropTypes from 'prop-types';
|
6
5
|
import classNames from 'classnames';
|
@@ -17,82 +16,65 @@ import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
|
17
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
18
17
|
import 'date-fns/addYears';
|
19
18
|
import 'date-fns/subYears';
|
20
|
-
import 'core-js/modules/es.array.index-of.js';
|
21
|
-
import 'core-js/modules/es.array.slice.js';
|
22
|
-
import 'core-js/modules/es.object.values.js';
|
23
19
|
import 'core-js/modules/es.regexp.exec.js';
|
24
20
|
import 'date-fns/add';
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
_this = _callSuper(this, MonthName, [].concat(args));
|
34
|
-
_defineProperty(_this, "handleClick", function () {
|
35
|
-
var end = endOfMonth(_this.props.month);
|
36
|
-
_this.props.onScrollChange(end.getTime());
|
22
|
+
class MonthName extends PureComponent {
|
23
|
+
constructor() {
|
24
|
+
super(...arguments);
|
25
|
+
_defineProperty(this, "handleClick", () => {
|
26
|
+
const end = endOfMonth(this.props.month);
|
27
|
+
this.props.onScrollChange(end.getTime());
|
37
28
|
});
|
38
|
-
return _this;
|
39
29
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
}]);
|
59
|
-
}(PureComponent);
|
30
|
+
render() {
|
31
|
+
const {
|
32
|
+
month,
|
33
|
+
locale
|
34
|
+
} = this.props;
|
35
|
+
return /*#__PURE__*/jsx("button", {
|
36
|
+
type: "button",
|
37
|
+
className: classNames(modules_0c7b7d96.monthName, {
|
38
|
+
[modules_0c7b7d96.today]: isThisMonth(month)
|
39
|
+
}),
|
40
|
+
onClick: this.handleClick,
|
41
|
+
children: format(month, 'LLL', {
|
42
|
+
locale
|
43
|
+
})
|
44
|
+
});
|
45
|
+
}
|
46
|
+
}
|
60
47
|
_defineProperty(MonthName, "propTypes", {
|
61
48
|
month: dateType,
|
62
49
|
onScrollChange: PropTypes.func,
|
63
50
|
locale: PropTypes.object
|
64
51
|
});
|
65
52
|
function MonthNames(props) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
53
|
+
const {
|
54
|
+
scrollDate,
|
55
|
+
locale
|
56
|
+
} = props;
|
57
|
+
const months = [];
|
58
|
+
for (let i = 0; i < YEAR; i++) {
|
59
|
+
const middleDay = set(scrollDate, {
|
71
60
|
month: i,
|
72
61
|
date: MIDDLE_DAY
|
73
62
|
});
|
74
63
|
months.push(startOfDay(middleDay));
|
75
64
|
}
|
76
|
-
|
77
|
-
|
78
|
-
|
65
|
+
const pxToDate = linearFunction(0, Number(startOfYear(scrollDate)), yearScrollSpeed);
|
66
|
+
let top = 0;
|
67
|
+
let bottom = 0;
|
79
68
|
if (props.currentRange) {
|
80
|
-
|
81
|
-
return Math.floor(pxToDate.x(Number(date)));
|
82
|
-
});
|
83
|
-
var _props$currentRange$m2 = _slicedToArray(_props$currentRange$m, 2);
|
84
|
-
top = _props$currentRange$m2[0];
|
85
|
-
bottom = _props$currentRange$m2[1];
|
69
|
+
[top, bottom] = props.currentRange.map(date => Math.floor(pxToDate.x(Number(date))));
|
86
70
|
}
|
87
71
|
return /*#__PURE__*/jsxs("div", {
|
88
72
|
className: modules_0c7b7d96.monthNames,
|
89
|
-
children: [months.map(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
}, +month);
|
95
|
-
}), props.currentRange && /*#__PURE__*/jsx("div", {
|
73
|
+
children: [months.map(month => /*#__PURE__*/jsx(MonthName, {
|
74
|
+
month: month,
|
75
|
+
onScrollChange: props.onScrollChange,
|
76
|
+
locale: locale
|
77
|
+
}, +month)), props.currentRange && /*#__PURE__*/jsx("div", {
|
96
78
|
className: modules_0c7b7d96.range,
|
97
79
|
style: {
|
98
80
|
top: top - 1,
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import { _ as _defineProperty
|
2
|
-
import 'core-js/modules/
|
3
|
-
import 'core-js/modules/es.array.map.js';
|
1
|
+
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
4
3
|
import { PureComponent } from 'react';
|
5
4
|
import PropTypes from 'prop-types';
|
6
5
|
import classNames from 'classnames';
|
@@ -11,79 +10,61 @@ import linearFunction from '../global/linear-function.js';
|
|
11
10
|
import units, { dateType, yearScrollSpeed } from './consts.js';
|
12
11
|
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
13
12
|
import { jsx } from 'react/jsx-runtime';
|
14
|
-
import 'core-js/modules/es.array.index-of.js';
|
15
|
-
import 'core-js/modules/es.array.slice.js';
|
16
|
-
import 'core-js/modules/es.object.values.js';
|
17
13
|
import 'core-js/modules/es.regexp.exec.js';
|
18
14
|
import 'date-fns/add';
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
26
|
-
args[_key] = arguments[_key];
|
27
|
-
}
|
28
|
-
_this = _callSuper(this, MonthSlider, [].concat(args));
|
29
|
-
_defineProperty(_this, "state", {
|
16
|
+
const COVERYEARS = 3;
|
17
|
+
class MonthSlider extends PureComponent {
|
18
|
+
constructor() {
|
19
|
+
super(...arguments);
|
20
|
+
_defineProperty(this, "state", {
|
30
21
|
dragging: false
|
31
22
|
});
|
32
|
-
_defineProperty(
|
33
|
-
|
23
|
+
_defineProperty(this, "onMouseDown", () => {
|
24
|
+
this.setState({
|
34
25
|
dragging: true
|
35
26
|
});
|
36
27
|
});
|
37
|
-
_defineProperty(
|
38
|
-
|
28
|
+
_defineProperty(this, "onMouseUp", () => {
|
29
|
+
this.setState({
|
39
30
|
dragging: false
|
40
31
|
});
|
41
32
|
});
|
42
|
-
_defineProperty(
|
43
|
-
|
33
|
+
_defineProperty(this, "onMouseMove", e => {
|
34
|
+
this.props.onScroll(linearFunction(0, Number(this.props.scrollDate), yearScrollSpeed).y(e.movementY));
|
44
35
|
});
|
45
|
-
return _this;
|
46
36
|
}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
} else if (!this.state.dragging && prevState.dragging) {
|
55
|
-
window.removeEventListener('mousemove', this.onMouseMove);
|
56
|
-
window.removeEventListener('mouseup', this.onMouseUp);
|
57
|
-
}
|
37
|
+
componentDidUpdate(prevProps, prevState) {
|
38
|
+
if (this.state.dragging && !prevState.dragging) {
|
39
|
+
window.addEventListener('mousemove', this.onMouseMove);
|
40
|
+
window.addEventListener('mouseup', this.onMouseUp);
|
41
|
+
} else if (!this.state.dragging && prevState.dragging) {
|
42
|
+
window.removeEventListener('mousemove', this.onMouseMove);
|
43
|
+
window.removeEventListener('mouseup', this.onMouseUp);
|
58
44
|
}
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
year = addYears(year, 1);
|
67
|
-
years.push(year);
|
68
|
-
}
|
69
|
-
var classes = classNames(modules_0c7b7d96.monthSlider, {
|
70
|
-
[modules_0c7b7d96.dragging]: this.state.dragging
|
71
|
-
});
|
72
|
-
return /*#__PURE__*/jsx("div", {
|
73
|
-
children: years.map(function (date) {
|
74
|
-
return /*#__PURE__*/jsx("button", {
|
75
|
-
type: "button",
|
76
|
-
className: classes,
|
77
|
-
style: {
|
78
|
-
top: Math.floor(_this2.props.pxToDate.x(Number(date)) - units.cellSize)
|
79
|
-
},
|
80
|
-
onMouseDown: _this2.onMouseDown
|
81
|
-
}, +date);
|
82
|
-
})
|
83
|
-
});
|
45
|
+
}
|
46
|
+
render() {
|
47
|
+
let year = subYears(startOfDay(this.props.scrollDate), 1);
|
48
|
+
const years = [year];
|
49
|
+
for (let i = 0; i <= COVERYEARS; i++) {
|
50
|
+
year = addYears(year, 1);
|
51
|
+
years.push(year);
|
84
52
|
}
|
85
|
-
|
86
|
-
|
53
|
+
const classes = classNames(modules_0c7b7d96.monthSlider, {
|
54
|
+
[modules_0c7b7d96.dragging]: this.state.dragging
|
55
|
+
});
|
56
|
+
return /*#__PURE__*/jsx("div", {
|
57
|
+
children: years.map(date => /*#__PURE__*/jsx("button", {
|
58
|
+
type: "button",
|
59
|
+
className: classes,
|
60
|
+
style: {
|
61
|
+
top: Math.floor(this.props.pxToDate.x(Number(date)) - units.cellSize)
|
62
|
+
},
|
63
|
+
onMouseDown: this.onMouseDown
|
64
|
+
}, +date))
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
87
68
|
_defineProperty(MonthSlider, "propTypes", {
|
88
69
|
scrollDate: dateType,
|
89
70
|
onScroll: PropTypes.func,
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import 'core-js/modules/es.array.map.js';
|
3
|
-
import 'core-js/modules/es.object.values.js';
|
1
|
+
import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
4
2
|
import { addDays } from 'date-fns/addDays';
|
5
3
|
import { endOfMonth } from 'date-fns/endOfMonth';
|
6
4
|
import { format } from 'date-fns/format';
|
@@ -12,10 +10,7 @@ import { dateType, shiftWeekArray, getWeekStartsOn, weekdays, FIFTH_DAY, WEEK }
|
|
12
10
|
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
13
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
14
12
|
import { createElement } from 'react';
|
15
|
-
import 'core-js/modules/
|
16
|
-
import 'core-js/modules/es.array.includes.js';
|
17
|
-
import 'core-js/modules/es.object.to-string.js';
|
18
|
-
import 'core-js/modules/es.string.includes.js';
|
13
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
19
14
|
import 'classnames';
|
20
15
|
import 'date-fns/getDate';
|
21
16
|
import 'date-fns/isAfter';
|
@@ -23,21 +18,21 @@ import 'date-fns/isBefore';
|
|
23
18
|
import 'date-fns/isSameDay';
|
24
19
|
import 'date-fns/isToday';
|
25
20
|
import 'date-fns/startOfDay';
|
26
|
-
import 'core-js/modules/es.array.index-of.js';
|
27
|
-
import 'core-js/modules/es.array.slice.js';
|
28
21
|
import 'core-js/modules/es.regexp.exec.js';
|
29
22
|
import 'date-fns/add';
|
30
23
|
|
31
24
|
function Month(props) {
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
const start = props.month;
|
26
|
+
const end = endOfMonth(start);
|
27
|
+
const {
|
28
|
+
locale
|
29
|
+
} = props;
|
35
30
|
// pad with empty cells starting from last friday
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
const weekday = getDay(start);
|
32
|
+
const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(props.locale));
|
33
|
+
const fifthDayOfWeek = weekDays[FIFTH_DAY];
|
34
|
+
let day = setDay(start, weekday >= fifthDayOfWeek ? fifthDayOfWeek : fifthDayOfWeek - WEEK);
|
35
|
+
const days = [];
|
41
36
|
while (day < end) {
|
42
37
|
days.push(day);
|
43
38
|
day = addDays(day, 1);
|
@@ -49,13 +44,11 @@ function Month(props) {
|
|
49
44
|
children: format(props.month, 'LLLL', {
|
50
45
|
locale
|
51
46
|
})
|
52
|
-
}), days.map(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}));
|
58
|
-
})]
|
47
|
+
}), days.map(date => /*#__PURE__*/createElement(Day, _objectSpread2(_objectSpread2({}, props), {}, {
|
48
|
+
day: date,
|
49
|
+
empty: date < start,
|
50
|
+
key: +date
|
51
|
+
})))]
|
59
52
|
});
|
60
53
|
}
|
61
54
|
Month.propTypes = {
|