@jetbrains/ring-ui-built 7.0.0-beta.1 → 7.0.0-beta.10
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 -10
- package/components/_helpers/button__classes.js +23 -20
- package/components/_helpers/caption.js +11 -21
- package/components/_helpers/card.js +91 -123
- package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
- package/components/_helpers/header.js +1 -1
- package/components/_helpers/icon__svg.js +27 -29
- package/components/_helpers/input.js +151 -193
- package/components/_helpers/query-assist__suggestions.js +79 -94
- package/components/_helpers/select__filter.js +56 -75
- package/components/_helpers/services-link.js +23 -39
- package/components/_helpers/sidebar.js +91 -102
- package/components/_helpers/tab-link.js +8 -12
- package/components/_helpers/theme.js +61 -51
- package/components/_helpers/title.js +59 -84
- package/components/alert/alert.d.ts +7 -24
- package/components/alert/alert.js +111 -179
- package/components/alert/container.d.ts +0 -5
- package/components/alert/container.js +32 -44
- package/components/alert-service/alert-service.js +104 -162
- package/components/analytics/analytics.js +12 -20
- package/components/analytics/analytics__custom-plugin.js +52 -68
- package/components/auth/auth.js +2 -31
- package/components/auth/auth__core.d.ts +4 -4
- package/components/auth/auth__core.js +755 -1433
- package/components/auth/background-flow.js +84 -121
- package/components/auth/down-notification.js +32 -79
- package/components/auth/iframe-flow.js +71 -125
- package/components/auth/request-builder.js +46 -77
- package/components/auth/response-parser.js +84 -112
- package/components/auth/storage.js +162 -324
- package/components/auth/token-validator.js +132 -227
- package/components/auth/window-flow.js +84 -121
- package/components/auth-dialog/auth-dialog.d.ts +0 -18
- package/components/auth-dialog/auth-dialog.js +107 -176
- package/components/auth-dialog-service/auth-dialog-service.js +12 -33
- package/components/avatar/avatar-example-datauri.js +1 -1
- package/components/avatar/avatar.d.ts +0 -13
- package/components/avatar/avatar.js +94 -136
- package/components/avatar/fallback-avatar.d.ts +1 -10
- package/components/avatar/fallback-avatar.js +20 -40
- package/components/badge/badge.d.ts +0 -10
- package/components/badge/badge.js +32 -48
- package/components/breadcrumbs/breadcrumbs.js +13 -17
- package/components/button/button.d.ts +0 -21
- package/components/button/button.js +68 -104
- package/components/button/button__classes.d.ts +1 -1
- package/components/button-group/button-group.d.ts +0 -5
- package/components/button-group/button-group.js +27 -41
- package/components/button-group/caption.d.ts +0 -4
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.d.ts +0 -6
- package/components/button-set/button-set.js +19 -33
- package/components/button-toolbar/button-toolbar.d.ts +0 -6
- package/components/button-toolbar/button-toolbar.js +17 -31
- package/components/caret/caret.js +184 -211
- package/components/checkbox/checkbox.d.ts +0 -19
- package/components/checkbox/checkbox.js +69 -104
- package/components/clipboard/clipboard-fallback.js +7 -7
- package/components/clipboard/clipboard.js +36 -129
- package/components/code/code.d.ts +0 -12
- package/components/code/code.js +83 -163
- 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.d.ts +0 -14
- package/components/confirm/confirm.js +68 -112
- package/components/confirm-service/confirm-service.js +25 -47
- package/components/content-layout/content-layout.d.ts +0 -7
- package/components/content-layout/content-layout.js +41 -63
- package/components/content-layout/sidebar.d.ts +0 -9
- package/components/content-layout/sidebar.js +1 -2
- package/components/contenteditable/contenteditable.d.ts +1 -22
- package/components/contenteditable/contenteditable.js +37 -60
- package/components/control-help/control-help.js +5 -3
- package/components/control-label/control-label.js +9 -14
- package/components/data-list/data-list.d.ts +0 -2
- package/components/data-list/data-list.js +115 -179
- package/components/data-list/data-list.mock.js +3 -6
- package/components/data-list/item.js +119 -165
- package/components/data-list/selection.js +77 -135
- package/components/data-list/title.d.ts +2 -2
- package/components/data-list/title.js +2 -12
- package/components/date-picker/consts.d.ts +0 -2
- package/components/date-picker/consts.js +16 -24
- package/components/date-picker/date-input.d.ts +0 -20
- package/components/date-picker/date-input.js +100 -148
- package/components/date-picker/date-picker.d.ts +0 -29
- package/components/date-picker/date-picker.js +143 -224
- package/components/date-picker/date-popup.d.ts +0 -22
- package/components/date-picker/date-popup.js +282 -352
- package/components/date-picker/day.d.ts +0 -14
- package/components/date-picker/day.js +72 -109
- package/components/date-picker/month-names.d.ts +1 -11
- package/components/date-picker/month-names.js +42 -72
- package/components/date-picker/month-slider.d.ts +0 -9
- package/components/date-picker/month-slider.js +43 -71
- package/components/date-picker/month.d.ts +1 -9
- package/components/date-picker/month.js +18 -30
- package/components/date-picker/months.d.ts +1 -9
- package/components/date-picker/months.js +45 -55
- package/components/date-picker/weekdays.d.ts +2 -8
- package/components/date-picker/weekdays.js +12 -25
- package/components/date-picker/years.d.ts +0 -6
- package/components/date-picker/years.js +77 -104
- package/components/dialog/dialog.d.ts +0 -20
- package/components/dialog/dialog.js +153 -211
- package/components/dialog/dialog__body-scroll-preventer.js +0 -3
- package/components/dropdown/anchor.d.ts +1 -8
- package/components/dropdown/anchor.js +0 -7
- package/components/dropdown/dropdown.d.ts +4 -22
- package/components/dropdown/dropdown.js +134 -176
- package/components/dropdown-menu/dropdown-menu.js +51 -103
- package/components/editable-heading/editable-heading.js +69 -118
- package/components/error-bubble/error-bubble.d.ts +0 -6
- package/components/error-bubble/error-bubble.js +30 -60
- package/components/error-message/error-message.d.ts +0 -10
- package/components/error-message/error-message.js +34 -59
- package/components/footer/footer.js +28 -44
- package/components/form/form.js +1 -1
- 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.d.ts +0 -4
- package/components/global/create-stateful-context.js +14 -17
- package/components/global/data-tests.js +7 -12
- package/components/global/dom.js +49 -82
- package/components/global/focus-sensor-hoc.js +95 -122
- 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/react-dom-renderer.d.ts +0 -5
- package/components/global/react-dom-renderer.js +29 -45
- package/components/global/rerender-hoc.d.ts +2 -2
- 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.d.ts +8 -2
- package/components/global/theme.js +2 -20
- 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.d.ts +0 -14
- package/components/grid/col.js +27 -53
- package/components/grid/grid.d.ts +0 -5
- package/components/grid/grid.js +20 -32
- package/components/grid/row.d.ts +0 -18
- package/components/grid/row.js +23 -47
- package/components/group/group.d.ts +0 -5
- package/components/group/group.js +18 -27
- package/components/header/header-icon.d.ts +0 -22
- package/components/header/header-icon.js +20 -37
- package/components/header/header.d.ts +0 -7
- package/components/header/header.js +30 -74
- package/components/header/links.d.ts +2 -0
- package/components/header/links.js +20 -0
- package/components/header/logo.d.ts +0 -4
- package/components/header/logo.js +15 -30
- package/components/header/profile.d.ts +1 -39
- package/components/header/profile.js +126 -191
- package/components/header/services-link.d.ts +0 -10
- package/components/header/services-link.js +1 -4
- package/components/header/services.d.ts +0 -14
- package/components/header/services.js +65 -110
- package/components/header/smart-profile.d.ts +0 -9
- package/components/header/smart-profile.js +116 -205
- package/components/header/smart-services.d.ts +0 -4
- package/components/header/smart-services.js +72 -141
- package/components/header/tray.d.ts +0 -5
- package/components/header/tray.js +21 -35
- package/components/heading/heading.js +21 -26
- 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.d.ts +0 -11
- package/components/icon/icon.js +60 -85
- package/components/icon/icon__svg.d.ts +0 -8
- package/components/icon/icon__svg.js +0 -6
- package/components/icon/index.js +0 -6
- package/components/input/input-legacy.js +1 -1
- package/components/input/input.js +2 -14
- package/components/input-size/input-size.js +1 -1
- package/components/island/adaptive-island-hoc.d.ts +0 -1
- package/components/island/adaptive-island-hoc.js +30 -39
- package/components/island/content.d.ts +0 -10
- package/components/island/content.js +99 -119
- package/components/island/header.js +55 -73
- package/components/island/island.d.ts +0 -9
- package/components/island/island.js +25 -41
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +16 -27
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +19 -30
- package/components/island-legacy/island-legacy.d.ts +0 -5
- package/components/island-legacy/island-legacy.js +16 -27
- package/components/link/clickableLink.d.ts +0 -9
- package/components/link/clickableLink.js +33 -51
- package/components/link/link.d.ts +0 -25
- package/components/link/link.js +47 -68
- package/components/list/consts.js +2 -2
- package/components/list/list.d.ts +0 -32
- package/components/list/list.js +399 -516
- package/components/list/list__custom.js +51 -78
- package/components/list/list__hint.d.ts +0 -4
- package/components/list/list__hint.js +8 -21
- package/components/list/list__item.js +147 -211
- package/components/list/list__link.js +39 -59
- package/components/list/list__separator.js +15 -30
- package/components/list/list__title.js +25 -41
- package/components/list/list__users-groups-source.js +55 -123
- package/components/loader/loader.d.ts +0 -10
- package/components/loader/loader.js +38 -70
- package/components/loader/loader__core.js +123 -184
- package/components/loader-inline/loader-inline.d.ts +0 -6
- package/components/loader-inline/loader-inline.js +24 -38
- package/components/loader-screen/loader-screen.d.ts +0 -6
- package/components/loader-screen/loader-screen.js +24 -46
- package/components/login-dialog/login-dialog.d.ts +0 -11
- package/components/login-dialog/login-dialog.js +94 -145
- package/components/login-dialog/service.js +11 -33
- package/components/markdown/markdown.js +16 -29
- package/components/message/message.js +171 -218
- 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 +211 -275
- package/components/panel/panel.d.ts +0 -5
- package/components/panel/panel.js +16 -27
- 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 -329
- package/components/popup/popup.target.js +9 -12
- package/components/popup/position.js +94 -101
- package/components/popup-menu/popup-menu.js +31 -76
- package/components/progress-bar/progress-bar.d.ts +19 -33
- package/components/progress-bar/progress-bar.js +55 -99
- package/components/query-assist/query-assist.d.ts +63 -93
- package/components/query-assist/query-assist.js +585 -748
- package/components/query-assist/query-assist__suggestions.js +2 -28
- package/components/radio/radio.d.ts +0 -8
- package/components/radio/radio.js +15 -35
- package/components/radio/radio__item.d.ts +0 -9
- package/components/radio/radio__item.js +52 -72
- package/components/scrollable-section/scrollable-section.js +53 -0
- package/components/select/select.d.ts +3 -0
- package/components/select/select.js +714 -863
- package/components/select/select__filter.js +2 -29
- package/components/select/select__popup.js +317 -465
- package/components/shortcuts/core.js +147 -195
- package/components/shortcuts/shortcut-title.js +6 -10
- package/components/shortcuts/shortcuts-hoc.d.ts +0 -5
- package/components/shortcuts/shortcuts-hoc.js +23 -46
- package/components/shortcuts/shortcuts.d.ts +0 -8
- package/components/shortcuts/shortcuts.js +41 -72
- package/components/slider/slider.js +93 -113
- package/components/slider/slider.utils.js +16 -23
- package/components/storage/storage.d.ts +2 -3
- package/components/storage/storage.js +2 -46
- package/components/storage/storage__local.js +89 -148
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +35 -61
- package/components/table/cell.d.ts +0 -6
- package/components/table/cell.js +11 -27
- package/components/table/disable-hover-hoc.d.ts +0 -1
- package/components/table/disable-hover-hoc.js +27 -42
- package/components/table/header-cell.d.ts +0 -10
- package/components/table/header-cell.js +59 -85
- package/components/table/header.d.ts +1 -23
- package/components/table/header.js +89 -126
- package/components/table/multitable.d.ts +0 -4
- package/components/table/multitable.js +83 -93
- package/components/table/row-with-focus-sensor.d.ts +2 -2
- package/components/table/row-with-focus-sensor.js +26 -60
- package/components/table/row.js +170 -235
- package/components/table/selection-adapter.js +2 -2
- package/components/table/selection-shortcuts-hoc.js +102 -126
- package/components/table/selection.js +150 -217
- package/components/table/simple-table.d.ts +0 -44
- package/components/table/simple-table.js +18 -59
- package/components/table/smart-table.d.ts +0 -48
- package/components/table/smart-table.js +41 -83
- package/components/table/table.d.ts +0 -2
- package/components/table/table.js +269 -377
- package/components/tabs/collapsible-more.d.ts +1 -9
- package/components/tabs/collapsible-more.js +47 -97
- package/components/tabs/collapsible-tab.js +32 -44
- package/components/tabs/collapsible-tabs.d.ts +2 -29
- package/components/tabs/collapsible-tabs.js +89 -161
- package/components/tabs/custom-item.d.ts +1 -7
- package/components/tabs/custom-item.js +4 -7
- package/components/tabs/dumb-tabs.d.ts +0 -11
- package/components/tabs/dumb-tabs.js +60 -104
- package/components/tabs/smart-tabs.d.ts +0 -6
- package/components/tabs/smart-tabs.js +29 -68
- package/components/tabs/tab-link.d.ts +0 -8
- package/components/tabs/tab-link.js +1 -4
- package/components/tabs/tab.d.ts +0 -8
- package/components/tabs/tab.js +14 -32
- package/components/tabs/tabs.js +1 -28
- package/components/tag/tag.d.ts +0 -19
- package/components/tag/tag.js +120 -179
- package/components/tags-input/tags-input.d.ts +7 -33
- package/components/tags-input/tags-input.js +224 -339
- package/components/tags-list/tags-list.d.ts +0 -13
- package/components/tags-list/tags-list.js +45 -74
- package/components/text/text.d.ts +0 -7
- package/components/text/text.js +27 -43
- package/components/toggle/toggle.d.ts +0 -15
- package/components/toggle/toggle.js +52 -77
- package/components/tooltip/tooltip.d.ts +4 -10
- package/components/tooltip/tooltip.js +105 -137
- package/components/user-agreement/service.d.ts +2 -1
- package/components/user-agreement/service.js +260 -405
- package/components/user-agreement/user-agreement.d.ts +0 -18
- package/components/user-agreement/user-agreement.js +92 -138
- package/components/user-card/card.d.ts +0 -35
- package/components/user-card/card.js +2 -27
- package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
- package/components/user-card/smart-user-card-tooltip.js +52 -108
- package/components/user-card/tooltip.d.ts +0 -9
- package/components/user-card/tooltip.js +35 -74
- package/components/user-card/user-card.js +1 -26
- package/package.json +4 -6
- package/components/global/prop-types.d.ts +0 -4
- package/components/global/prop-types.js +0 -9
- package/components/global/react-render-adapter.d.ts +0 -1
- package/components/global/react-render-adapter.js +0 -6
- package/components/header/scrollable-section.js +0 -47
- package/components/header/tray-icon.d.ts +0 -1
- package/components/header/tray-icon.js +0 -26
- package/components/storage/storage__fallback.d.ts +0 -79
- package/components/storage/storage__fallback.js +0 -253
- /package/components/{header → scrollable-section}/scrollable-section.d.ts +0 -0
@@ -1,10 +1,7 @@
|
|
1
|
-
import { _ as _defineProperty,
|
2
|
-
import 'core-js/modules/es.array.map.js';
|
1
|
+
import { _ as _defineProperty, b as _objectSpread2, a as _objectWithoutProperties } from '../_helpers/_rollupPluginBabelHelpers.js';
|
3
2
|
import 'core-js/modules/es.array.reduce.js';
|
4
|
-
import 'core-js/modules/es.object.to-string.js';
|
5
3
|
import * as React from 'react';
|
6
|
-
import {
|
7
|
-
import PropTypes from 'prop-types';
|
4
|
+
import { Component, createElement } from 'react';
|
8
5
|
import { isAfter } from 'date-fns/isAfter';
|
9
6
|
import { isBefore } from 'date-fns/isBefore';
|
10
7
|
import { isSameDay } from 'date-fns/isSameDay';
|
@@ -15,39 +12,28 @@ import DateInput from './date-input.js';
|
|
15
12
|
import Months from './months.js';
|
16
13
|
import Years from './years.js';
|
17
14
|
import Weekdays from './weekdays.js';
|
18
|
-
import {
|
15
|
+
import { parseTime } from './consts.js';
|
19
16
|
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
20
17
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
21
|
-
import 'core-js/modules/es.array.iterator.js';
|
22
|
-
import 'core-js/modules/es.map.js';
|
23
|
-
import 'core-js/modules/es.weak-map.js';
|
24
18
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
25
|
-
import 'core-js/modules/es.array.concat.js';
|
26
|
-
import 'core-js/modules/es.array.filter.js';
|
27
19
|
import 'core-js/modules/es.regexp.exec.js';
|
28
20
|
import 'core-js/modules/es.string.replace.js';
|
29
21
|
import 'classnames';
|
30
22
|
import '../_helpers/input.js';
|
31
|
-
import 'core-js/modules/es.object.values.js';
|
32
23
|
import '@jetbrains/icons/close-12px';
|
33
|
-
import '../global/prop-types.js';
|
34
24
|
import '../button/button.js';
|
35
25
|
import '@jetbrains/icons/chevron-down';
|
36
|
-
import '../icon/icon.js';
|
37
26
|
import 'util-deprecate';
|
27
|
+
import '../icon/icon.js';
|
38
28
|
import '../icon/icon__constants.js';
|
39
29
|
import '../_helpers/icon__svg.js';
|
40
|
-
import 'core-js/modules/es.string.starts-with.js';
|
41
30
|
import '../link/clickableLink.js';
|
42
31
|
import '../global/controls-height.js';
|
43
32
|
import '../_helpers/button__classes.js';
|
44
33
|
import '../global/get-uid.js';
|
45
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
46
34
|
import '../i18n/i18n-context.js';
|
47
35
|
import '../i18n/i18n.js';
|
48
|
-
import 'core-js/modules/es.set.js';
|
49
36
|
import '../global/composeRefs.js';
|
50
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
51
37
|
import 'memoize-one';
|
52
38
|
import '../control-label/control-label.js';
|
53
39
|
import '../control-help/control-help.js';
|
@@ -65,12 +51,8 @@ import 'date-fns/addDays';
|
|
65
51
|
import 'date-fns/format';
|
66
52
|
import 'date-fns/setDay';
|
67
53
|
import './day.js';
|
68
|
-
import 'core-js/modules/es.array.includes.js';
|
69
|
-
import 'core-js/modules/es.string.includes.js';
|
70
54
|
import 'date-fns/getDate';
|
71
55
|
import 'date-fns/isToday';
|
72
|
-
import 'core-js/modules/es.array.index-of.js';
|
73
|
-
import 'core-js/modules/es.array.slice.js';
|
74
56
|
import 'date-fns/add';
|
75
57
|
import './month-names.js';
|
76
58
|
import 'date-fns/isThisMonth';
|
@@ -84,110 +66,98 @@ import 'date-fns/isSameYear';
|
|
84
66
|
import 'date-fns/isThisYear';
|
85
67
|
import 'date-fns/setYear';
|
86
68
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
_defineProperty(
|
100
|
-
_defineProperty(
|
69
|
+
const _excluded = ["from", "to", "date", "time"];
|
70
|
+
const scrollExpDelay = 10;
|
71
|
+
class DatePopup extends Component {
|
72
|
+
static sameDay(next, prev) {
|
73
|
+
if (next && prev) {
|
74
|
+
return isSameDay(next, prev);
|
75
|
+
}
|
76
|
+
return next === prev;
|
77
|
+
}
|
78
|
+
constructor(props) {
|
79
|
+
super(props);
|
80
|
+
_defineProperty(this, "_scrollDate", void 0);
|
81
|
+
_defineProperty(this, "_scrollTS", void 0);
|
82
|
+
_defineProperty(this, "isInTimeMode", () => !this.props.range && this.props.withTime || false);
|
83
|
+
_defineProperty(this, "componentRef", /*#__PURE__*/React.createRef());
|
84
|
+
_defineProperty(this, "handleWheel", e => {
|
101
85
|
if (e.cancelable) {
|
102
86
|
e.preventDefault();
|
103
87
|
}
|
104
88
|
});
|
105
|
-
_defineProperty(
|
106
|
-
|
107
|
-
|
89
|
+
_defineProperty(this, "isValidDate", parsedText => {
|
90
|
+
const minDate = this.parse(this.props.minDate, 'date');
|
91
|
+
const maxDate = this.parse(this.props.maxDate, 'date');
|
108
92
|
if (parsedText) {
|
109
93
|
return !(minDate && isBefore(parsedText, minDate) || maxDate && isAfter(parsedText, maxDate));
|
110
94
|
}
|
111
95
|
return false;
|
112
96
|
});
|
113
|
-
_defineProperty(
|
114
|
-
|
115
|
-
|
97
|
+
_defineProperty(this, "scheduleScroll", () => {
|
98
|
+
const current = this.state.scrollDate && this.parse(this.state.scrollDate, 'date') || this.parse(this.props[this.state.active], 'date') || new Date();
|
99
|
+
const goal = this._scrollDate;
|
116
100
|
if (!current || !goal || DatePopup.sameDay(goal, current)) {
|
117
|
-
|
118
|
-
|
101
|
+
this._scrollDate = null;
|
102
|
+
this._scrollTS = null;
|
119
103
|
return;
|
120
104
|
}
|
121
|
-
if (
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
105
|
+
if (this._scrollTS) {
|
106
|
+
const diff = goal - Number(current);
|
107
|
+
const dt = Date.now() - this._scrollTS;
|
108
|
+
const next = goal - diff * Math.E ** (-dt / scrollExpDelay);
|
109
|
+
this.setState({
|
126
110
|
scrollDate: next
|
127
111
|
});
|
128
112
|
}
|
129
|
-
|
130
|
-
window.requestAnimationFrame(
|
113
|
+
this._scrollTS = Date.now();
|
114
|
+
window.requestAnimationFrame(this.scheduleScroll);
|
131
115
|
});
|
132
|
-
_defineProperty(
|
133
|
-
|
134
|
-
if (!
|
135
|
-
|
116
|
+
_defineProperty(this, "scrollTo", scrollDate => {
|
117
|
+
this._scrollDate = scrollDate;
|
118
|
+
if (!this._scrollTS) {
|
119
|
+
this.scheduleScroll();
|
136
120
|
}
|
137
121
|
});
|
138
|
-
_defineProperty(
|
139
|
-
|
140
|
-
hoverDate
|
141
|
-
});
|
142
|
-
});
|
143
|
-
_defineProperty(_this, "handleActivate", memoize(function (name) {
|
144
|
-
return function () {
|
145
|
-
return _this.setState({
|
146
|
-
active: name
|
147
|
-
});
|
148
|
-
};
|
122
|
+
_defineProperty(this, "hoverHandler", hoverDate => this.setState({
|
123
|
+
hoverDate
|
149
124
|
}));
|
150
|
-
_defineProperty(
|
125
|
+
_defineProperty(this, "handleActivate", memoize(name => () => this.setState({
|
126
|
+
active: name
|
127
|
+
})));
|
128
|
+
_defineProperty(this, "handleInput", (text, name) => {
|
151
129
|
if (name !== 'time') {
|
152
|
-
|
153
|
-
if (
|
154
|
-
|
130
|
+
const parsed = this.parse(text, name);
|
131
|
+
if (this.isValidDate(parsed)) {
|
132
|
+
this.scrollTo(Number(parsed));
|
155
133
|
}
|
156
134
|
}
|
157
|
-
|
135
|
+
this.setState({
|
158
136
|
text,
|
159
137
|
hoverDate: null
|
160
138
|
});
|
161
139
|
});
|
162
|
-
_defineProperty(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
}));
|
167
|
-
_defineProperty(_this, "selectHandler", function (date) {
|
168
|
-
if (_this.isInTimeMode()) {
|
169
|
-
_this.setState({
|
140
|
+
_defineProperty(this, "handleConfirm", memoize(name => () => this.confirm(name)));
|
141
|
+
_defineProperty(this, "selectHandler", date => {
|
142
|
+
if (this.isInTimeMode()) {
|
143
|
+
this.setState({
|
170
144
|
active: 'time'
|
171
|
-
},
|
172
|
-
|
173
|
-
|
174
|
-
});
|
175
|
-
});
|
145
|
+
}, () => this.select({
|
146
|
+
date
|
147
|
+
}));
|
176
148
|
} else {
|
177
|
-
|
178
|
-
[
|
149
|
+
this.select({
|
150
|
+
[this.state.active]: date
|
179
151
|
});
|
180
152
|
}
|
181
153
|
});
|
182
|
-
_defineProperty(
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
});
|
187
|
-
_defineProperty(_this, "onClear", function (e) {
|
154
|
+
_defineProperty(this, "handleScroll", scrollDate => this.setState({
|
155
|
+
scrollDate
|
156
|
+
}));
|
157
|
+
_defineProperty(this, "onClear", e => {
|
188
158
|
var _this$props$onClear, _this$props, _this$componentRef$cu;
|
189
|
-
|
190
|
-
if (
|
159
|
+
let changes;
|
160
|
+
if (this.props.range) {
|
191
161
|
changes = {
|
192
162
|
from: null,
|
193
163
|
to: null
|
@@ -197,297 +167,257 @@ var DatePopup = /*#__PURE__*/function (_Component) {
|
|
197
167
|
date: null
|
198
168
|
};
|
199
169
|
}
|
200
|
-
|
201
|
-
(_this$props$onClear = (_this$props =
|
202
|
-
(_this$componentRef$cu =
|
170
|
+
this.select(changes);
|
171
|
+
(_this$props$onClear = (_this$props = this.props).onClear) === null || _this$props$onClear === void 0 || _this$props$onClear.call(_this$props, e);
|
172
|
+
(_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();
|
203
173
|
});
|
204
|
-
|
174
|
+
const defaultState = {
|
205
175
|
text: null,
|
206
176
|
hoverDate: null,
|
207
177
|
scrollDate: null
|
208
178
|
};
|
209
|
-
|
210
|
-
|
179
|
+
const {
|
180
|
+
range,
|
181
|
+
withTime
|
182
|
+
} = props;
|
211
183
|
if (!range) {
|
212
|
-
|
213
|
-
|
214
|
-
|
184
|
+
const parsedDate = this.parse(props.date, 'date');
|
185
|
+
const active = withTime && parsedDate && !props.time ? 'time' : 'date';
|
186
|
+
this.state = _objectSpread2(_objectSpread2({}, defaultState), {}, {
|
215
187
|
active
|
216
188
|
});
|
217
189
|
} else if (props.from && !props.to) {
|
218
|
-
|
190
|
+
this.state = _objectSpread2(_objectSpread2({}, defaultState), {}, {
|
219
191
|
active: 'to'
|
220
192
|
});
|
221
193
|
} else {
|
222
|
-
|
194
|
+
this.state = _objectSpread2(_objectSpread2({}, defaultState), {}, {
|
223
195
|
active: 'from'
|
224
196
|
});
|
225
197
|
}
|
226
|
-
return _this;
|
227
198
|
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
value: function componentDidMount() {
|
232
|
-
if (this.componentRef.current) {
|
233
|
-
this.componentRef.current.addEventListener('wheel', this.handleWheel);
|
234
|
-
}
|
199
|
+
componentDidMount() {
|
200
|
+
if (this.componentRef.current) {
|
201
|
+
this.componentRef.current.addEventListener('wheel', this.handleWheel);
|
235
202
|
}
|
236
|
-
}
|
237
|
-
|
238
|
-
|
239
|
-
if (this.state.
|
240
|
-
|
241
|
-
this.confirm(prevState.active);
|
242
|
-
}
|
243
|
-
this.setState({
|
244
|
-
text: null
|
245
|
-
});
|
203
|
+
}
|
204
|
+
componentDidUpdate(prevProps, prevState) {
|
205
|
+
if (this.state.active !== prevState.active) {
|
206
|
+
if (this.state.text && prevState.active) {
|
207
|
+
this.confirm(prevState.active);
|
246
208
|
}
|
209
|
+
this.setState({
|
210
|
+
text: null
|
211
|
+
});
|
247
212
|
}
|
248
|
-
}
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
this.componentRef.current.removeEventListener('wheel', this.handleWheel);
|
253
|
-
}
|
213
|
+
}
|
214
|
+
componentWillUnmount() {
|
215
|
+
if (this.componentRef.current) {
|
216
|
+
this.componentRef.current.removeEventListener('wheel', this.handleWheel);
|
254
217
|
}
|
255
|
-
}
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
return parseTime(String(text));
|
260
|
-
}
|
261
|
-
return this.props.parseDateInput(text);
|
218
|
+
}
|
219
|
+
parse(text, type) {
|
220
|
+
if (type === 'time') {
|
221
|
+
return parseTime(String(text));
|
262
222
|
}
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
223
|
+
return this.props.parseDateInput(text);
|
224
|
+
}
|
225
|
+
select(changes) {
|
226
|
+
const {
|
227
|
+
range,
|
228
|
+
withTime
|
229
|
+
} = this.props;
|
230
|
+
const prevActive = this.state.active;
|
231
|
+
if (!range && !withTime) {
|
232
|
+
this.setState({
|
233
|
+
text: null,
|
234
|
+
scrollDate: null
|
235
|
+
});
|
236
|
+
const adjustedDate = changes.date && set(new Date(), {
|
237
|
+
year: changes.date.getFullYear(),
|
238
|
+
month: changes.date.getMonth(),
|
239
|
+
date: changes.date.getDate()
|
240
|
+
});
|
241
|
+
this.props.onChange(adjustedDate);
|
242
|
+
this.props.onComplete();
|
243
|
+
} else if (!range && withTime) {
|
244
|
+
const date = this.parse(this.props.date, 'date');
|
245
|
+
const time = this.parse(this.props.time, 'time');
|
246
|
+
const changeToSubmit = {
|
247
|
+
date: changes.date || date,
|
248
|
+
time: changes.time || time
|
249
|
+
};
|
250
|
+
this.setState({
|
251
|
+
active: changes.date ? 'time' : 'date',
|
252
|
+
text: null,
|
253
|
+
scrollDate: null
|
254
|
+
});
|
255
|
+
this.props.onChange(changeToSubmit);
|
256
|
+
if (!changes.date && prevActive === 'time' && changeToSubmit.date && changeToSubmit.time) {
|
281
257
|
this.props.onComplete();
|
282
|
-
}
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
var _this$props$changes = _objectSpread2(_objectSpread2({}, this.props), changes),
|
300
|
-
from = _this$props$changes.from,
|
301
|
-
to = _this$props$changes.to;
|
302
|
-
from = this.parse(from, 'from');
|
303
|
-
to = this.parse(to, 'to');
|
304
|
-
// proceed to setting the end by default
|
305
|
-
var active = 'to';
|
306
|
-
var complete = false;
|
307
|
-
// end is before beginning
|
308
|
-
if (from && to && isAfter(startOfDay(from), startOfDay(to))) {
|
309
|
-
// ignore the old end when beginning is changed
|
310
|
-
if (changes.from) {
|
311
|
-
to = null;
|
312
|
-
// treat range as reverse when end is changed
|
313
|
-
} else if (changes.to) {
|
314
|
-
to = from;
|
315
|
-
from = changes.to;
|
316
|
-
}
|
258
|
+
}
|
259
|
+
} else {
|
260
|
+
let {
|
261
|
+
from,
|
262
|
+
to
|
263
|
+
} = _objectSpread2(_objectSpread2({}, this.props), changes);
|
264
|
+
from = this.parse(from, 'from');
|
265
|
+
to = this.parse(to, 'to');
|
266
|
+
// proceed to setting the end by default
|
267
|
+
let active = 'to';
|
268
|
+
let complete = false;
|
269
|
+
// end is before beginning
|
270
|
+
if (from && to && isAfter(startOfDay(from), startOfDay(to))) {
|
271
|
+
// ignore the old end when beginning is changed
|
272
|
+
if (changes.from) {
|
273
|
+
to = null;
|
274
|
+
// treat range as reverse when end is changed
|
317
275
|
} else if (changes.to) {
|
318
|
-
|
319
|
-
|
320
|
-
}
|
321
|
-
this.setState({
|
322
|
-
active,
|
323
|
-
hoverDate: null,
|
324
|
-
text: null
|
325
|
-
});
|
326
|
-
this.props.onChange({
|
327
|
-
from,
|
328
|
-
to
|
329
|
-
});
|
330
|
-
if (complete) {
|
331
|
-
this.props.onComplete();
|
276
|
+
to = from;
|
277
|
+
from = changes.to;
|
332
278
|
}
|
279
|
+
} else if (changes.to) {
|
280
|
+
active = 'from';
|
281
|
+
complete = !!from;
|
282
|
+
}
|
283
|
+
this.setState({
|
284
|
+
active,
|
285
|
+
hoverDate: null,
|
286
|
+
text: null
|
287
|
+
});
|
288
|
+
this.props.onChange({
|
289
|
+
from,
|
290
|
+
to
|
291
|
+
});
|
292
|
+
if (complete) {
|
293
|
+
this.props.onComplete();
|
333
294
|
}
|
334
295
|
}
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
result = this.parse(name in this.props ? this.props[name] : '', name);
|
349
|
-
}
|
296
|
+
}
|
297
|
+
confirm(name) {
|
298
|
+
const text = this.state.text;
|
299
|
+
let result;
|
300
|
+
if (name === 'time') {
|
301
|
+
result = this.parse(text, name);
|
302
|
+
const time = this.parse('time' in this.props ? this.props.time : '', 'time');
|
303
|
+
const emptyCase = this.state.active === 'time' ? '00:00' : null;
|
304
|
+
result = result || time || emptyCase;
|
305
|
+
} else {
|
306
|
+
result = this.parse(text, name);
|
307
|
+
if (!this.isValidDate(result)) {
|
308
|
+
result = this.parse(name in this.props ? this.props[name] : '', name);
|
350
309
|
}
|
351
|
-
this.select({
|
352
|
-
[name]: result
|
353
|
-
});
|
354
310
|
}
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
} else {
|
395
|
-
activeRange = [dates.from, activeDate];
|
396
|
-
}
|
311
|
+
this.select({
|
312
|
+
[name]: result
|
313
|
+
});
|
314
|
+
}
|
315
|
+
render() {
|
316
|
+
const {
|
317
|
+
range,
|
318
|
+
withTime,
|
319
|
+
locale
|
320
|
+
} = this.props;
|
321
|
+
const _this$props2 = this.props,
|
322
|
+
{
|
323
|
+
from,
|
324
|
+
to,
|
325
|
+
date,
|
326
|
+
time
|
327
|
+
} = _this$props2,
|
328
|
+
restProps = _objectWithoutProperties(_this$props2, _excluded);
|
329
|
+
const parsedDate = this.parse(this.props.date, 'date');
|
330
|
+
const parsedTo = this.parse(this.props.to, 'to');
|
331
|
+
const names = range ? ['from', 'to'] : ['date'];
|
332
|
+
const dates = names.reduce((obj, key) => {
|
333
|
+
const value = this.props[key];
|
334
|
+
return _objectSpread2(_objectSpread2({}, obj), {}, {
|
335
|
+
[key]: this.parse(value, key)
|
336
|
+
});
|
337
|
+
}, {});
|
338
|
+
const activeDate = this.state.active !== 'time' ? this.state.hoverDate || (this.state.text != null ? this.parse(this.state.text, 'date') : null) : this.state.hoverDate || null;
|
339
|
+
const currentRange = range && dates.from && dates.to && [dates.from, dates.to] || null;
|
340
|
+
let activeRange = null;
|
341
|
+
if (range && activeDate) {
|
342
|
+
switch (this.state.active) {
|
343
|
+
case 'from':
|
344
|
+
if (dates.to && isAfter(startOfDay(activeDate), startOfDay(dates.to))) {
|
345
|
+
activeRange = [activeDate, dates.to];
|
346
|
+
}
|
347
|
+
break;
|
348
|
+
case 'to':
|
349
|
+
if (!dates.from) {
|
397
350
|
break;
|
398
|
-
|
351
|
+
}
|
352
|
+
if (isBefore(startOfDay(activeDate), startOfDay(dates.from))) {
|
353
|
+
activeRange = [activeDate, dates.from];
|
354
|
+
} else {
|
355
|
+
activeRange = [dates.from, activeDate];
|
356
|
+
}
|
357
|
+
break;
|
399
358
|
}
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
onConfirm: _this2.handleConfirm(name),
|
430
|
-
onClear: onClear,
|
431
|
-
locale: locale
|
432
|
-
}));
|
433
|
-
}), this.isInTimeMode() ? /*#__PURE__*/createElement(DateInput, _objectSpread2(_objectSpread2({}, this.props), {}, {
|
434
|
-
text: this.state.text,
|
435
|
-
divider: !!parsedDate,
|
436
|
-
hoverDate: null,
|
437
|
-
name: 'time',
|
438
|
-
key: 'time',
|
439
|
-
date: null,
|
440
|
-
time: time,
|
441
|
-
active: this.state.active === 'time',
|
442
|
-
onActivate: this.handleActivate('time'),
|
359
|
+
}
|
360
|
+
const scrollDate = withTime && !range ? this.state.scrollDate || dates.date || new Date() : this.state.scrollDate || dates[this.state.active] || new Date();
|
361
|
+
const calendarProps = _objectSpread2(_objectSpread2(_objectSpread2({}, restProps), dates), {}, {
|
362
|
+
scrollDate,
|
363
|
+
activeDate,
|
364
|
+
currentRange,
|
365
|
+
activeRange,
|
366
|
+
onScroll: this.handleScroll,
|
367
|
+
onScrollChange: this.scrollTo
|
368
|
+
});
|
369
|
+
const clearable = Boolean(this.props.onClear);
|
370
|
+
return /*#__PURE__*/jsxs("div", {
|
371
|
+
className: modules_0c7b7d96.datePopup,
|
372
|
+
"data-test": "ring-date-popup",
|
373
|
+
ref: this.componentRef,
|
374
|
+
children: [/*#__PURE__*/jsxs("div", {
|
375
|
+
className: modules_0c7b7d96.filterWrapper,
|
376
|
+
children: [names.map(name => {
|
377
|
+
let onClear;
|
378
|
+
if (clearable && name !== 'from' && !this.isInTimeMode()) {
|
379
|
+
onClear = this.onClear.bind(this);
|
380
|
+
}
|
381
|
+
return /*#__PURE__*/createElement(DateInput, _objectSpread2(_objectSpread2(_objectSpread2({}, this.props), this.state), {}, {
|
382
|
+
divider: name === 'from' && (dates[name] != null || parsedTo != null),
|
383
|
+
name: name,
|
384
|
+
key: name,
|
385
|
+
date: dates[name],
|
386
|
+
active: this.state.active === name,
|
387
|
+
onActivate: this.handleActivate(name),
|
443
388
|
onInput: this.handleInput,
|
444
|
-
onConfirm: this.handleConfirm(
|
445
|
-
onClear:
|
389
|
+
onConfirm: this.handleConfirm(name),
|
390
|
+
onClear: onClear,
|
446
391
|
locale: locale
|
447
|
-
}))
|
448
|
-
}), /*#__PURE__*/
|
392
|
+
}));
|
393
|
+
}), this.isInTimeMode() ? /*#__PURE__*/createElement(DateInput, _objectSpread2(_objectSpread2({}, this.props), {}, {
|
394
|
+
text: this.state.text,
|
395
|
+
divider: !!parsedDate,
|
396
|
+
hoverDate: null,
|
397
|
+
name: 'time',
|
398
|
+
key: 'time',
|
399
|
+
date: null,
|
400
|
+
time: time,
|
401
|
+
active: this.state.active === 'time',
|
402
|
+
onActivate: this.handleActivate('time'),
|
403
|
+
onInput: this.handleInput,
|
404
|
+
onConfirm: this.handleConfirm('time'),
|
405
|
+
onClear: clearable && this.onClear || undefined,
|
449
406
|
locale: locale
|
450
|
-
})
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
return isSameDay(next, prev);
|
465
|
-
}
|
466
|
-
return next === prev;
|
467
|
-
}
|
468
|
-
}]);
|
469
|
-
}(Component);
|
470
|
-
_defineProperty(DatePopup, "propTypes", {
|
471
|
-
className: PropTypes.string,
|
472
|
-
date: dateType,
|
473
|
-
range: PropTypes.bool,
|
474
|
-
withTime: PropTypes.bool,
|
475
|
-
time: PropTypes.string,
|
476
|
-
from: dateType,
|
477
|
-
to: dateType,
|
478
|
-
renderAfterCalendar: PropTypes.func,
|
479
|
-
displayFormat: PropTypes.func,
|
480
|
-
parseDateInput: PropTypes.func,
|
481
|
-
onChange: PropTypes.func,
|
482
|
-
onComplete: PropTypes.func,
|
483
|
-
onClear: PropTypes.func,
|
484
|
-
minDate: dateType,
|
485
|
-
maxDate: dateType,
|
486
|
-
fromPlaceholder: PropTypes.string,
|
487
|
-
toPlaceholder: PropTypes.string,
|
488
|
-
timePlaceholder: PropTypes.string,
|
489
|
-
locale: PropTypes.object
|
490
|
-
});
|
407
|
+
})) : '']
|
408
|
+
}), /*#__PURE__*/jsx(Weekdays, {
|
409
|
+
locale: locale
|
410
|
+
}), /*#__PURE__*/jsxs("div", {
|
411
|
+
className: modules_0c7b7d96.calendar,
|
412
|
+
children: [/*#__PURE__*/jsx(Months, _objectSpread2(_objectSpread2({}, calendarProps), {}, {
|
413
|
+
onHover: this.hoverHandler,
|
414
|
+
onSelect: this.selectHandler,
|
415
|
+
locale: locale
|
416
|
+
})), /*#__PURE__*/jsx(Years, _objectSpread2({}, calendarProps))]
|
417
|
+
}), this.props.renderAfterCalendar && this.props.renderAfterCalendar(this.state)]
|
418
|
+
});
|
419
|
+
}
|
420
|
+
}
|
491
421
|
_defineProperty(DatePopup, "defaultProps", {
|
492
422
|
onChange() {}
|
493
423
|
});
|