@jetbrains/ring-ui-built 7.0.65 → 7.0.70
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/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +18 -26
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, b as _objectSpread2, a as _objectWithoutProperties } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { Component, createElement } from 'react';
|
|
@@ -14,9 +13,6 @@ import Years from './years.js';
|
|
|
14
13
|
import Weekdays from './weekdays.js';
|
|
15
14
|
import { parseTime } from './consts.js';
|
|
16
15
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
17
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
18
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
19
|
-
import 'core-js/modules/es.string.replace.js';
|
|
20
16
|
import 'classnames';
|
|
21
17
|
import '../_helpers/input.js';
|
|
22
18
|
import '@jetbrains/icons/close-12px';
|
|
@@ -67,7 +63,6 @@ import 'date-fns/isSameYear';
|
|
|
67
63
|
import 'date-fns/isThisYear';
|
|
68
64
|
import 'date-fns/setYear';
|
|
69
65
|
|
|
70
|
-
const _excluded = ["from", "to", "date", "time"];
|
|
71
66
|
const scrollExpDelay = 10;
|
|
72
67
|
class DatePopup extends Component {
|
|
73
68
|
static sameDay(next, prev) {
|
|
@@ -76,102 +71,11 @@ class DatePopup extends Component {
|
|
|
76
71
|
}
|
|
77
72
|
return next === prev;
|
|
78
73
|
}
|
|
74
|
+
static defaultProps = {
|
|
75
|
+
onChange() {}
|
|
76
|
+
};
|
|
79
77
|
constructor(props) {
|
|
80
78
|
super(props);
|
|
81
|
-
_defineProperty(this, "_scrollDate", void 0);
|
|
82
|
-
_defineProperty(this, "_scrollTS", void 0);
|
|
83
|
-
_defineProperty(this, "isInTimeMode", () => !this.props.range && this.props.withTime || false);
|
|
84
|
-
_defineProperty(this, "componentRef", /*#__PURE__*/React.createRef());
|
|
85
|
-
_defineProperty(this, "handleWheel", e => {
|
|
86
|
-
if (e.cancelable) {
|
|
87
|
-
e.preventDefault();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
_defineProperty(this, "isValidDate", parsedText => {
|
|
91
|
-
const minDate = this.parse(this.props.minDate, 'date');
|
|
92
|
-
const maxDate = this.parse(this.props.maxDate, 'date');
|
|
93
|
-
if (parsedText) {
|
|
94
|
-
return !(minDate && isBefore(parsedText, minDate) || maxDate && isAfter(parsedText, maxDate));
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
});
|
|
98
|
-
_defineProperty(this, "scheduleScroll", () => {
|
|
99
|
-
const current = this.state.scrollDate && this.parse(this.state.scrollDate, 'date') || this.parse(this.props[this.state.active], 'date') || new Date();
|
|
100
|
-
const goal = this._scrollDate;
|
|
101
|
-
if (!current || !goal || DatePopup.sameDay(goal, current)) {
|
|
102
|
-
this._scrollDate = null;
|
|
103
|
-
this._scrollTS = null;
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (this._scrollTS) {
|
|
107
|
-
const diff = goal - Number(current);
|
|
108
|
-
const dt = Date.now() - this._scrollTS;
|
|
109
|
-
const next = goal - diff * Math.E ** (-dt / scrollExpDelay);
|
|
110
|
-
this.setState({
|
|
111
|
-
scrollDate: next
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
this._scrollTS = Date.now();
|
|
115
|
-
window.requestAnimationFrame(this.scheduleScroll);
|
|
116
|
-
});
|
|
117
|
-
_defineProperty(this, "scrollTo", scrollDate => {
|
|
118
|
-
this._scrollDate = scrollDate;
|
|
119
|
-
if (!this._scrollTS) {
|
|
120
|
-
this.scheduleScroll();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
_defineProperty(this, "hoverHandler", hoverDate => this.setState({
|
|
124
|
-
hoverDate
|
|
125
|
-
}));
|
|
126
|
-
_defineProperty(this, "handleActivate", memoize(name => () => this.setState({
|
|
127
|
-
active: name
|
|
128
|
-
})));
|
|
129
|
-
_defineProperty(this, "handleInput", (text, name) => {
|
|
130
|
-
if (name !== 'time') {
|
|
131
|
-
const parsed = this.parse(text, name);
|
|
132
|
-
if (this.isValidDate(parsed)) {
|
|
133
|
-
this.scrollTo(Number(parsed));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
this.setState({
|
|
137
|
-
text,
|
|
138
|
-
hoverDate: null
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
_defineProperty(this, "handleConfirm", memoize(name => () => this.confirm(name)));
|
|
142
|
-
_defineProperty(this, "selectHandler", date => {
|
|
143
|
-
if (this.isInTimeMode()) {
|
|
144
|
-
this.setState({
|
|
145
|
-
active: 'time'
|
|
146
|
-
}, () => this.select({
|
|
147
|
-
date
|
|
148
|
-
}));
|
|
149
|
-
} else {
|
|
150
|
-
this.select({
|
|
151
|
-
[this.state.active]: date
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
_defineProperty(this, "handleScroll", scrollDate => this.setState({
|
|
156
|
-
scrollDate
|
|
157
|
-
}));
|
|
158
|
-
_defineProperty(this, "onClear", e => {
|
|
159
|
-
var _this$props$onClear, _this$props, _this$componentRef$cu;
|
|
160
|
-
let changes;
|
|
161
|
-
if (this.props.range) {
|
|
162
|
-
changes = {
|
|
163
|
-
from: null,
|
|
164
|
-
to: null
|
|
165
|
-
};
|
|
166
|
-
} else {
|
|
167
|
-
changes = {
|
|
168
|
-
date: null
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
this.select(changes);
|
|
172
|
-
(_this$props$onClear = (_this$props = this.props).onClear) === null || _this$props$onClear === void 0 || _this$props$onClear.call(_this$props, e);
|
|
173
|
-
(_this$componentRef$cu = this.componentRef.current) === null || _this$componentRef$cu === void 0 || (_this$componentRef$cu = _this$componentRef$cu.querySelector('input')) === null || _this$componentRef$cu === void 0 || _this$componentRef$cu.focus();
|
|
174
|
-
});
|
|
175
79
|
const defaultState = {
|
|
176
80
|
text: null,
|
|
177
81
|
hoverDate: null,
|
|
@@ -184,17 +88,20 @@ class DatePopup extends Component {
|
|
|
184
88
|
if (!range) {
|
|
185
89
|
const parsedDate = this.parse(props.date, 'date');
|
|
186
90
|
const active = withTime && parsedDate && !props.time ? 'time' : 'date';
|
|
187
|
-
this.state =
|
|
91
|
+
this.state = {
|
|
92
|
+
...defaultState,
|
|
188
93
|
active
|
|
189
|
-
}
|
|
94
|
+
};
|
|
190
95
|
} else if (props.from && !props.to) {
|
|
191
|
-
this.state =
|
|
96
|
+
this.state = {
|
|
97
|
+
...defaultState,
|
|
192
98
|
active: 'to'
|
|
193
|
-
}
|
|
99
|
+
};
|
|
194
100
|
} else {
|
|
195
|
-
this.state =
|
|
101
|
+
this.state = {
|
|
102
|
+
...defaultState,
|
|
196
103
|
active: 'from'
|
|
197
|
-
}
|
|
104
|
+
};
|
|
198
105
|
}
|
|
199
106
|
}
|
|
200
107
|
componentDidMount() {
|
|
@@ -217,6 +124,15 @@ class DatePopup extends Component {
|
|
|
217
124
|
this.componentRef.current.removeEventListener('wheel', this.handleWheel);
|
|
218
125
|
}
|
|
219
126
|
}
|
|
127
|
+
_scrollDate;
|
|
128
|
+
_scrollTS;
|
|
129
|
+
isInTimeMode = () => !this.props.range && this.props.withTime || false;
|
|
130
|
+
componentRef = /*#__PURE__*/React.createRef();
|
|
131
|
+
handleWheel = e => {
|
|
132
|
+
if (e.cancelable) {
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
220
136
|
parse(text, type) {
|
|
221
137
|
if (type === 'time') {
|
|
222
138
|
return parseTime(String(text));
|
|
@@ -261,7 +177,10 @@ class DatePopup extends Component {
|
|
|
261
177
|
let {
|
|
262
178
|
from,
|
|
263
179
|
to
|
|
264
|
-
} =
|
|
180
|
+
} = {
|
|
181
|
+
...this.props,
|
|
182
|
+
...changes
|
|
183
|
+
};
|
|
265
184
|
from = this.parse(from, 'from');
|
|
266
185
|
to = this.parse(to, 'to');
|
|
267
186
|
// proceed to setting the end by default
|
|
@@ -313,6 +232,90 @@ class DatePopup extends Component {
|
|
|
313
232
|
[name]: result
|
|
314
233
|
});
|
|
315
234
|
}
|
|
235
|
+
isValidDate = parsedText => {
|
|
236
|
+
const minDate = this.parse(this.props.minDate, 'date');
|
|
237
|
+
const maxDate = this.parse(this.props.maxDate, 'date');
|
|
238
|
+
if (parsedText) {
|
|
239
|
+
return !(minDate && isBefore(parsedText, minDate) || maxDate && isAfter(parsedText, maxDate));
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
};
|
|
243
|
+
scheduleScroll = () => {
|
|
244
|
+
const current = this.state.scrollDate && this.parse(this.state.scrollDate, 'date') || this.parse(this.props[this.state.active], 'date') || new Date();
|
|
245
|
+
const goal = this._scrollDate;
|
|
246
|
+
if (!current || !goal || DatePopup.sameDay(goal, current)) {
|
|
247
|
+
this._scrollDate = null;
|
|
248
|
+
this._scrollTS = null;
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (this._scrollTS) {
|
|
252
|
+
const diff = goal - Number(current);
|
|
253
|
+
const dt = Date.now() - this._scrollTS;
|
|
254
|
+
const next = goal - diff * Math.E ** (-dt / scrollExpDelay);
|
|
255
|
+
this.setState({
|
|
256
|
+
scrollDate: next
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
this._scrollTS = Date.now();
|
|
260
|
+
window.requestAnimationFrame(this.scheduleScroll);
|
|
261
|
+
};
|
|
262
|
+
scrollTo = scrollDate => {
|
|
263
|
+
this._scrollDate = scrollDate;
|
|
264
|
+
if (!this._scrollTS) {
|
|
265
|
+
this.scheduleScroll();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
hoverHandler = hoverDate => this.setState({
|
|
269
|
+
hoverDate
|
|
270
|
+
});
|
|
271
|
+
handleActivate = memoize(name => () => this.setState({
|
|
272
|
+
active: name
|
|
273
|
+
}));
|
|
274
|
+
handleInput = (text, name) => {
|
|
275
|
+
if (name !== 'time') {
|
|
276
|
+
const parsed = this.parse(text, name);
|
|
277
|
+
if (this.isValidDate(parsed)) {
|
|
278
|
+
this.scrollTo(Number(parsed));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.setState({
|
|
282
|
+
text,
|
|
283
|
+
hoverDate: null
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
handleConfirm = memoize(name => () => this.confirm(name));
|
|
287
|
+
selectHandler = date => {
|
|
288
|
+
if (this.isInTimeMode()) {
|
|
289
|
+
this.setState({
|
|
290
|
+
active: 'time'
|
|
291
|
+
}, () => this.select({
|
|
292
|
+
date
|
|
293
|
+
}));
|
|
294
|
+
} else {
|
|
295
|
+
this.select({
|
|
296
|
+
[this.state.active]: date
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
handleScroll = scrollDate => this.setState({
|
|
301
|
+
scrollDate
|
|
302
|
+
});
|
|
303
|
+
onClear = e => {
|
|
304
|
+
let changes;
|
|
305
|
+
if (this.props.range) {
|
|
306
|
+
changes = {
|
|
307
|
+
from: null,
|
|
308
|
+
to: null
|
|
309
|
+
};
|
|
310
|
+
} else {
|
|
311
|
+
changes = {
|
|
312
|
+
date: null
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
this.select(changes);
|
|
316
|
+
this.props.onClear?.(e);
|
|
317
|
+
this.componentRef.current?.querySelector('input')?.focus();
|
|
318
|
+
};
|
|
316
319
|
// eslint-disable-next-line complexity
|
|
317
320
|
render() {
|
|
318
321
|
const {
|
|
@@ -320,22 +323,22 @@ class DatePopup extends Component {
|
|
|
320
323
|
withTime,
|
|
321
324
|
locale
|
|
322
325
|
} = this.props;
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
restProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
326
|
+
const {
|
|
327
|
+
from,
|
|
328
|
+
to,
|
|
329
|
+
date,
|
|
330
|
+
time,
|
|
331
|
+
...restProps
|
|
332
|
+
} = this.props;
|
|
331
333
|
const parsedDate = this.parse(this.props.date, 'date');
|
|
332
334
|
const parsedTo = this.parse(this.props.to, 'to');
|
|
333
335
|
const names = range ? ['from', 'to'] : ['date'];
|
|
334
336
|
const dates = names.reduce((obj, key) => {
|
|
335
337
|
const value = this.props[key];
|
|
336
|
-
return
|
|
338
|
+
return {
|
|
339
|
+
...obj,
|
|
337
340
|
[key]: this.parse(value, key)
|
|
338
|
-
}
|
|
341
|
+
};
|
|
339
342
|
}, {});
|
|
340
343
|
const activeDate = this.state.active !== 'time' ? this.state.hoverDate || (this.state.text ? this.parse(this.state.text, 'date') : null) : this.state.hoverDate || null;
|
|
341
344
|
const currentRange = range && dates.from && dates.to && [dates.from, dates.to] || null;
|
|
@@ -360,14 +363,16 @@ class DatePopup extends Component {
|
|
|
360
363
|
}
|
|
361
364
|
}
|
|
362
365
|
const scrollDate = withTime && !range ? this.state.scrollDate || dates.date || new Date() : this.state.scrollDate || dates[this.state.active] || new Date();
|
|
363
|
-
const calendarProps =
|
|
366
|
+
const calendarProps = {
|
|
367
|
+
...restProps,
|
|
368
|
+
...dates,
|
|
364
369
|
scrollDate,
|
|
365
370
|
activeDate,
|
|
366
371
|
currentRange,
|
|
367
372
|
activeRange,
|
|
368
373
|
onScroll: this.handleScroll,
|
|
369
374
|
onScrollChange: this.scrollTo
|
|
370
|
-
}
|
|
375
|
+
};
|
|
371
376
|
const clearable = Boolean(this.props.onClear);
|
|
372
377
|
return jsxs("div", {
|
|
373
378
|
className: styles.datePopup,
|
|
@@ -380,7 +385,9 @@ class DatePopup extends Component {
|
|
|
380
385
|
if (clearable && name !== 'from' && !this.isInTimeMode()) {
|
|
381
386
|
onClear = this.onClear.bind(this);
|
|
382
387
|
}
|
|
383
|
-
return /*#__PURE__*/createElement(DateInput,
|
|
388
|
+
return /*#__PURE__*/createElement(DateInput, {
|
|
389
|
+
...this.props,
|
|
390
|
+
...this.state,
|
|
384
391
|
divider: name === 'from' && (!!dates[name] || !!parsedTo),
|
|
385
392
|
name: name,
|
|
386
393
|
key: name,
|
|
@@ -391,8 +398,9 @@ class DatePopup extends Component {
|
|
|
391
398
|
onConfirm: this.handleConfirm(name),
|
|
392
399
|
onClear: onClear,
|
|
393
400
|
locale: locale
|
|
394
|
-
})
|
|
395
|
-
}), this.isInTimeMode() ? (/*#__PURE__*/createElement(DateInput,
|
|
401
|
+
});
|
|
402
|
+
}), this.isInTimeMode() ? (/*#__PURE__*/createElement(DateInput, {
|
|
403
|
+
...this.props,
|
|
396
404
|
text: this.state.text,
|
|
397
405
|
divider: !!parsedDate,
|
|
398
406
|
hoverDate: null,
|
|
@@ -406,22 +414,22 @@ class DatePopup extends Component {
|
|
|
406
414
|
onConfirm: this.handleConfirm('time'),
|
|
407
415
|
onClear: clearable && this.onClear || undefined,
|
|
408
416
|
locale: locale
|
|
409
|
-
}))
|
|
417
|
+
})) : '']
|
|
410
418
|
}), jsx(Weekdays, {
|
|
411
419
|
locale: locale
|
|
412
420
|
}), jsxs("div", {
|
|
413
421
|
className: styles.calendar,
|
|
414
|
-
children: [jsx(Months,
|
|
422
|
+
children: [jsx(Months, {
|
|
423
|
+
...calendarProps,
|
|
415
424
|
onHover: this.hoverHandler,
|
|
416
425
|
onSelect: this.selectHandler,
|
|
417
426
|
locale: locale
|
|
418
|
-
})
|
|
427
|
+
}), jsx(Years, {
|
|
428
|
+
...calendarProps
|
|
429
|
+
})]
|
|
419
430
|
}), this.props.renderAfterCalendar && this.props.renderAfterCalendar(this.state)]
|
|
420
431
|
});
|
|
421
432
|
}
|
|
422
433
|
}
|
|
423
|
-
_defineProperty(DatePopup, "defaultProps", {
|
|
424
|
-
onChange() {}
|
|
425
|
-
});
|
|
426
434
|
|
|
427
435
|
export { DatePopup as default };
|
|
@@ -11,7 +11,7 @@ export default class Day extends Component<DayProps> {
|
|
|
11
11
|
isDay: (date: Date) => boolean;
|
|
12
12
|
is: (name: "date" | "from" | "to" | "activeDate") => boolean;
|
|
13
13
|
inRange: (range: [Date, Date] | null) => boolean | null;
|
|
14
|
-
isDisabled: (date: Date) => boolean
|
|
14
|
+
isDisabled: (date: Date) => boolean;
|
|
15
15
|
parse(text: string | null | undefined): Date | null;
|
|
16
16
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { Component } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -14,36 +12,32 @@ import { isToday } from 'date-fns/isToday';
|
|
|
14
12
|
import { startOfDay } from 'date-fns/startOfDay';
|
|
15
13
|
import { getDayNumInWeek, weekdays } from './consts.js';
|
|
16
14
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
17
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
18
15
|
import 'date-fns/add';
|
|
19
16
|
|
|
20
17
|
let hoverTO;
|
|
21
18
|
class Day extends Component {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return min && isBefore(startOfDay(date), startOfDay(min)) || max && isAfter(startOfDay(date), startOfDay(max));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
19
|
+
handleClick = () => this.props.onSelect(this.props.day);
|
|
20
|
+
handleMouseOver = () => {
|
|
21
|
+
if (hoverTO) {
|
|
22
|
+
window.clearTimeout(hoverTO);
|
|
23
|
+
hoverTO = null;
|
|
24
|
+
}
|
|
25
|
+
this.props.onHover(this.props.day);
|
|
26
|
+
};
|
|
27
|
+
handleMouseOut = () => {
|
|
28
|
+
hoverTO = window.setTimeout(this.props.onHover, 0);
|
|
29
|
+
};
|
|
30
|
+
isDay = date => isSameDay(this.props.day, date);
|
|
31
|
+
is = name => {
|
|
32
|
+
const value = this.props[name];
|
|
33
|
+
return !!value && this.isDay(value);
|
|
34
|
+
};
|
|
35
|
+
inRange = range => range && isAfter(startOfDay(this.props.day), startOfDay(range[0])) && isBefore(startOfDay(this.props.day), startOfDay(range[1]));
|
|
36
|
+
isDisabled = date => {
|
|
37
|
+
const min = this.parse(this.props.minDate);
|
|
38
|
+
const max = this.parse(this.props.maxDate);
|
|
39
|
+
return !!min && isBefore(startOfDay(date), startOfDay(min)) || !!max && isAfter(startOfDay(date), startOfDay(max));
|
|
40
|
+
};
|
|
47
41
|
parse(text) {
|
|
48
42
|
return this.props.parseDateInput(text);
|
|
49
43
|
}
|
|
@@ -62,13 +56,13 @@ class Day extends Component {
|
|
|
62
56
|
return range && [range[0], addDays(range[1], 1)];
|
|
63
57
|
}
|
|
64
58
|
const spreadRange = makeSpreadRange(currentRange);
|
|
65
|
-
const disabled =
|
|
59
|
+
const disabled = this.isDisabled(day);
|
|
66
60
|
const activeSpreadRange = makeSpreadRange(activeRange);
|
|
67
61
|
return (
|
|
68
62
|
// TODO make keyboard navigation actually work
|
|
69
63
|
jsx("button", {
|
|
70
64
|
type: 'button',
|
|
71
|
-
className: classNames(styles.day, styles[
|
|
65
|
+
className: classNames(styles.day, styles[`Day${dayInWeek}`], {
|
|
72
66
|
[styles.current]: ['date', 'from', 'to'].some(this.is),
|
|
73
67
|
[styles.active]: !disabled && this.is('activeDate'),
|
|
74
68
|
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { b as _objectSpread2, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -15,17 +13,13 @@ import { YEAR, MIDDLE_DAY, yearScrollSpeed } from './consts.js';
|
|
|
15
13
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
16
14
|
import 'date-fns/addYears';
|
|
17
15
|
import 'date-fns/subYears';
|
|
18
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
19
16
|
import 'date-fns/add';
|
|
20
17
|
|
|
21
18
|
class MonthName extends PureComponent {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.props.onScrollChange(end.getTime());
|
|
27
|
-
});
|
|
28
|
-
}
|
|
19
|
+
handleClick = () => {
|
|
20
|
+
const end = endOfMonth(this.props.month);
|
|
21
|
+
this.props.onScrollChange(end.getTime());
|
|
22
|
+
};
|
|
29
23
|
render() {
|
|
30
24
|
const {
|
|
31
25
|
month,
|
|
@@ -74,9 +68,10 @@ function MonthNames(props) {
|
|
|
74
68
|
top: top - 1,
|
|
75
69
|
height: bottom + 1 - (top - 1)
|
|
76
70
|
}
|
|
77
|
-
}), jsx(MonthSlider,
|
|
71
|
+
}), jsx(MonthSlider, {
|
|
72
|
+
...props,
|
|
78
73
|
pxToDate: pxToDate
|
|
79
|
-
})
|
|
74
|
+
})]
|
|
80
75
|
});
|
|
81
76
|
}
|
|
82
77
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -9,30 +7,13 @@ import { subYears } from 'date-fns/subYears';
|
|
|
9
7
|
import linearFunction from '../global/linear-function.js';
|
|
10
8
|
import units, { yearScrollSpeed } from './consts.js';
|
|
11
9
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
12
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
13
10
|
import 'date-fns/add';
|
|
14
11
|
|
|
15
12
|
const COVERYEARS = 3;
|
|
16
13
|
class MonthSlider extends PureComponent {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dragging: false
|
|
21
|
-
});
|
|
22
|
-
_defineProperty(this, "onMouseDown", () => {
|
|
23
|
-
this.setState({
|
|
24
|
-
dragging: true
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
_defineProperty(this, "onMouseUp", () => {
|
|
28
|
-
this.setState({
|
|
29
|
-
dragging: false
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
_defineProperty(this, "onMouseMove", e => {
|
|
33
|
-
this.props.onScroll(linearFunction(0, Number(this.props.scrollDate), yearScrollSpeed).y(e.movementY));
|
|
34
|
-
});
|
|
35
|
-
}
|
|
14
|
+
state = {
|
|
15
|
+
dragging: false
|
|
16
|
+
};
|
|
36
17
|
componentDidUpdate(prevProps, prevState) {
|
|
37
18
|
if (this.state.dragging && !prevState.dragging) {
|
|
38
19
|
window.addEventListener('mousemove', this.onMouseMove);
|
|
@@ -42,6 +23,19 @@ class MonthSlider extends PureComponent {
|
|
|
42
23
|
window.removeEventListener('mouseup', this.onMouseUp);
|
|
43
24
|
}
|
|
44
25
|
}
|
|
26
|
+
onMouseDown = () => {
|
|
27
|
+
this.setState({
|
|
28
|
+
dragging: true
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
onMouseUp = () => {
|
|
32
|
+
this.setState({
|
|
33
|
+
dragging: false
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
onMouseMove = e => {
|
|
37
|
+
this.props.onScroll(linearFunction(0, Number(this.props.scrollDate), yearScrollSpeed).y(e.movementY));
|
|
38
|
+
};
|
|
45
39
|
render() {
|
|
46
40
|
let year = subYears(startOfDay(this.props.scrollDate), 1);
|
|
47
41
|
const years = [year];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { createElement } from 'react';
|
|
3
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
3
|
import { addDays } from 'date-fns/addDays';
|
|
@@ -9,7 +8,6 @@ import { setDay } from 'date-fns/setDay';
|
|
|
9
8
|
import Day from './day.js';
|
|
10
9
|
import { shiftWeekArray, getWeekStartsOn, weekdays, FIFTH_DAY, WEEK } from './consts.js';
|
|
11
10
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
12
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
13
11
|
import 'classnames';
|
|
14
12
|
import 'date-fns/getDate';
|
|
15
13
|
import 'date-fns/isAfter';
|
|
@@ -17,7 +15,6 @@ import 'date-fns/isBefore';
|
|
|
17
15
|
import 'date-fns/isSameDay';
|
|
18
16
|
import 'date-fns/isToday';
|
|
19
17
|
import 'date-fns/startOfDay';
|
|
20
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
21
18
|
import 'date-fns/add';
|
|
22
19
|
|
|
23
20
|
function Month(props) {
|
|
@@ -43,11 +40,12 @@ function Month(props) {
|
|
|
43
40
|
children: format(props.month, 'LLLL', {
|
|
44
41
|
locale
|
|
45
42
|
})
|
|
46
|
-
}), days.map(date => (/*#__PURE__*/createElement(Day,
|
|
43
|
+
}), days.map(date => (/*#__PURE__*/createElement(Day, {
|
|
44
|
+
...props,
|
|
47
45
|
day: date,
|
|
48
46
|
empty: date < start,
|
|
49
47
|
key: +date
|
|
50
|
-
})))
|
|
48
|
+
})))]
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { useMemo, useRef, useEffect, createElement } from 'react';
|
|
4
3
|
import { addMonths } from 'date-fns/addMonths';
|
|
@@ -14,7 +13,6 @@ import Month from './month.js';
|
|
|
14
13
|
import MonthNames from './month-names.js';
|
|
15
14
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
16
15
|
import units, { DOUBLE, HALF, WEEK, weekdays } from './consts.js';
|
|
17
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
18
16
|
import 'date-fns/addDays';
|
|
19
17
|
import 'date-fns/format';
|
|
20
18
|
import 'date-fns/setDay';
|
|
@@ -32,7 +30,6 @@ import 'date-fns/startOfYear';
|
|
|
32
30
|
import './month-slider.js';
|
|
33
31
|
import 'date-fns/addYears';
|
|
34
32
|
import 'date-fns/subYears';
|
|
35
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
36
33
|
import 'date-fns/add';
|
|
37
34
|
|
|
38
35
|
const {
|
|
@@ -118,11 +115,14 @@ function Months(props) {
|
|
|
118
115
|
top: Math.floor(calHeight * HALF - monthHeight(months[0]) - monthHeight(months[1]) + offset)
|
|
119
116
|
},
|
|
120
117
|
className: styles.days,
|
|
121
|
-
children: months.map(date => (/*#__PURE__*/createElement(Month,
|
|
118
|
+
children: months.map(date => (/*#__PURE__*/createElement(Month, {
|
|
119
|
+
...props,
|
|
122
120
|
month: date,
|
|
123
121
|
key: +date
|
|
124
|
-
})))
|
|
125
|
-
}), jsx(MonthNames,
|
|
122
|
+
})))
|
|
123
|
+
}), jsx(MonthNames, {
|
|
124
|
+
...props
|
|
125
|
+
})]
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -6,7 +6,6 @@ import { setDay } from 'date-fns/setDay';
|
|
|
6
6
|
import { startOfDay } from 'date-fns/startOfDay';
|
|
7
7
|
import { shiftWeekArray, getWeekStartsOn, weekdays } from './consts.js';
|
|
8
8
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
9
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
10
9
|
import 'date-fns/add';
|
|
11
10
|
|
|
12
11
|
function Weekdays(props) {
|