@jetbrains/ring-ui 5.0.36 → 5.0.37
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/input/input.css +2 -0
- package/components/query-assist/query-assist.js +1 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
- package/dist/_helpers/anchor.js +0 -1
- package/dist/_helpers/card.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
- package/dist/_helpers/footer.js +2 -13
- package/dist/_helpers/query-assist__suggestions.js +0 -10
- package/dist/_helpers/select__filter.js +0 -11
- package/dist/_helpers/services-link.js +0 -2
- package/dist/_helpers/sidebar.js +0 -12
- package/dist/_helpers/theme.js +0 -3
- package/dist/_helpers/title.js +0 -9
- package/dist/alert/alert.js +2 -32
- package/dist/alert/container.js +0 -5
- package/dist/alert-service/alert-service.js +0 -26
- package/dist/analytics/analytics.js +0 -22
- package/dist/analytics/analytics__custom-plugin.js +0 -38
- package/dist/analytics/analytics__fus-plugin.js +0 -20
- package/dist/analytics/analytics__ga-plugin.js +0 -13
- package/dist/analytics/analytics__plugin-utils.js +0 -8
- package/dist/analytics-ng/analytics-ng.js +3 -9
- package/dist/auth/auth.js +2 -3
- package/dist/auth/auth__core.js +30 -243
- package/dist/auth/background-flow.js +2 -25
- package/dist/auth/down-notification.js +0 -7
- package/dist/auth/iframe-flow.js +2 -26
- package/dist/auth/landing.js +2 -6
- package/dist/auth/request-builder.js +0 -11
- package/dist/auth/response-parser.js +4 -26
- package/dist/auth/storage.js +4 -60
- package/dist/auth/token-validator.js +6 -42
- package/dist/auth/window-flow.js +2 -34
- package/dist/auth-dialog/auth-dialog.js +2 -12
- package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
- package/dist/auth-ng/auth-ng.js +6 -22
- package/dist/auth-ng/auth-ng.mock.js +0 -4
- package/dist/autofocus-ng/autofocus-ng.js +0 -5
- package/dist/avatar/avatar.js +4 -17
- package/dist/avatar/fallback-avatar.js +2 -9
- package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
- package/dist/badge/badge.js +0 -3
- package/dist/button/button.js +0 -8
- package/dist/button-group/button-group.js +0 -3
- package/dist/button-group/caption.js +0 -2
- package/dist/button-group-ng/button-group-ng.js +0 -4
- package/dist/button-ng/button-ng.js +3 -21
- package/dist/button-set/button-set.js +0 -3
- package/dist/button-set-ng/button-set-ng.js +0 -2
- package/dist/button-toolbar/button-toolbar.js +0 -3
- package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
- package/dist/caret/caret.js +2 -53
- package/dist/checkbox/checkbox.js +0 -12
- package/dist/code/code.js +3 -25
- package/dist/compiler-ng/compiler-ng.js +0 -5
- package/dist/confirm/confirm.js +0 -6
- package/dist/confirm-service/confirm-service.js +10 -8
- package/dist/content-layout/content-layout.js +0 -7
- package/dist/contenteditable/contenteditable.js +6 -13
- package/dist/data-list/data-list.js +4 -28
- package/dist/data-list/item.js +0 -15
- package/dist/data-list/selection.js +0 -27
- package/dist/date-picker/consts.js +0 -7
- package/dist/date-picker/date-input.js +0 -20
- package/dist/date-picker/date-picker.js +2 -36
- package/dist/date-picker/date-popup.js +18 -71
- package/dist/date-picker/day.js +0 -14
- package/dist/date-picker/month-names.js +0 -9
- package/dist/date-picker/month-slider.js +0 -10
- package/dist/date-picker/month.js +2 -4
- package/dist/date-picker/months.js +6 -13
- package/dist/date-picker/years.js +0 -14
- package/dist/dialog/dialog.js +0 -19
- package/dist/dialog-ng/dialog-ng.js +17 -105
- package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
- package/dist/dropdown/dropdown.js +2 -33
- package/dist/dropdown-menu/dropdown-menu.js +4 -8
- package/dist/editable-heading/editable-heading.js +0 -3
- package/dist/error-bubble/error-bubble.js +2 -4
- package/dist/error-message/error-message.js +0 -3
- package/dist/footer-ng/footer-ng.js +0 -13
- package/dist/form-ng/form-ng.js +1 -21
- package/dist/global/angular-component-factory.js +0 -10
- package/dist/global/compose.js +0 -1
- package/dist/global/composeRefs.js +0 -1
- package/dist/global/controls-height.js +0 -2
- package/dist/global/create-stateful-context.js +0 -5
- package/dist/global/data-tests.js +0 -4
- package/dist/global/dom.js +2 -11
- package/dist/global/focus-sensor-hoc.js +4 -33
- package/dist/global/fuzzy-highlight.js +2 -16
- package/dist/global/get-event-key.js +8 -17
- package/dist/global/get-uid.js +0 -2
- package/dist/global/linear-function.js +0 -2
- package/dist/global/listeners.js +0 -13
- package/dist/global/memoize.js +0 -2
- package/dist/global/normalize-indent.js +2 -5
- package/dist/global/react-dom-renderer.js +0 -8
- package/dist/global/react-render-adapter.js +0 -7
- package/dist/global/rerender-hoc.js +0 -7
- package/dist/global/ring-angular-component.js +0 -5
- package/dist/global/schedule-raf.js +0 -5
- package/dist/global/trivial-template-tag.js +2 -3
- package/dist/global/url.js +0 -27
- package/dist/grid/col.js +0 -4
- package/dist/grid/grid.js +0 -3
- package/dist/grid/row.js +0 -5
- package/dist/group/group.js +0 -3
- package/dist/header/header.js +0 -5
- package/dist/header/logo.js +0 -4
- package/dist/header/profile.js +0 -7
- package/dist/header/services.js +0 -11
- package/dist/header/smart-profile.js +4 -18
- package/dist/header/smart-services.js +0 -17
- package/dist/header/tray-icon.js +2 -3
- package/dist/header/tray.js +0 -3
- package/dist/heading/heading.js +0 -5
- package/dist/http/http.js +20 -65
- package/dist/http/http.mock.js +2 -14
- package/dist/hub-source/hub-source.js +0 -32
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +0 -12
- package/dist/icon/icon.js +0 -13
- package/dist/icon/icon__constants.js +0 -4
- package/dist/icon/icon__svg.js +0 -10
- package/dist/icon-ng/icon-ng.js +2 -7
- package/dist/input/input.js +0 -30
- package/dist/input-ng/input-ng.js +0 -17
- package/dist/island/adaptive-island-hoc.js +0 -7
- package/dist/island/content.js +0 -25
- package/dist/island/header.js +0 -7
- package/dist/island/island.js +0 -4
- package/dist/island-legacy/content-legacy.js +0 -2
- package/dist/island-legacy/header-legacy.js +0 -2
- package/dist/island-legacy/island-legacy.js +0 -2
- package/dist/island-ng/island-content-ng.js +0 -3
- package/dist/link/clickableLink.js +2 -10
- package/dist/link/link.js +2 -9
- package/dist/link-ng/link-ng.js +0 -2
- package/dist/list/consts.js +0 -4
- package/dist/list/list.js +6 -128
- package/dist/list/list__custom.js +0 -4
- package/dist/list/list__hint.js +0 -3
- package/dist/list/list__item.js +0 -8
- package/dist/list/list__link.js +2 -3
- package/dist/list/list__separator.js +0 -1
- package/dist/list/list__title.js +0 -1
- package/dist/list/list__users-groups-source.js +4 -17
- package/dist/loader/loader.js +0 -10
- package/dist/loader/loader__core.js +6 -70
- package/dist/loader-inline/loader-inline.js +0 -3
- package/dist/loader-ng/loader-ng.js +0 -7
- package/dist/loader-screen/loader-screen.js +0 -3
- package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
- package/dist/login-dialog/login-dialog.js +0 -15
- package/dist/login-dialog/service.js +2 -4
- package/dist/markdown/code.js +0 -2
- package/dist/markdown/heading.js +0 -1
- package/dist/markdown/link.js +0 -1
- package/dist/markdown/markdown.js +0 -2
- package/dist/message/message.js +0 -24
- package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
- package/dist/old-browsers-message/old-browsers-message.js +2 -21
- package/dist/old-browsers-message/white-list.js +2 -6
- package/dist/pager/pager.js +2 -39
- package/dist/panel/panel.js +0 -3
- package/dist/permissions/permissions.js +1 -43
- package/dist/permissions/permissions__cache.js +12 -63
- package/dist/permissions-ng/permissions-ng.js +11 -19
- package/dist/place-under-ng/place-under-ng.js +0 -19
- package/dist/popup/popup.consts.js +0 -11
- package/dist/popup/popup.js +6 -68
- package/dist/popup/position.js +8 -30
- package/dist/popup-menu/popup-menu.js +4 -13
- package/dist/progress-bar/progress-bar.js +0 -14
- package/dist/promised-click-ng/promised-click-ng.js +3 -22
- package/dist/query-assist/query-assist.js +17 -201
- package/dist/radio/radio.js +0 -6
- package/dist/radio/radio__item.js +0 -9
- package/dist/radio-ng/radio-ng.js +0 -4
- package/dist/save-field-ng/save-field-ng.js +1 -37
- package/dist/select/select.js +18 -208
- package/dist/select/select__popup.js +4 -76
- package/dist/select-ng/select-ng.js +18 -74
- package/dist/select-ng/select-ng__lazy.js +2 -17
- package/dist/select-ng/select-ng__options.js +3 -29
- package/dist/shortcuts/core.js +4 -56
- package/dist/shortcuts/shortcuts-hoc.js +0 -4
- package/dist/shortcuts/shortcuts.js +0 -10
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
- package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
- package/dist/sidebar-ng/sidebar-ng.js +2 -12
- package/dist/storage/storage.js +2 -5
- package/dist/storage/storage__fallback.js +2 -48
- package/dist/storage/storage__local.js +0 -23
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +0 -37
- package/dist/table/cell.js +0 -2
- package/dist/table/disable-hover-hoc.js +0 -9
- package/dist/table/header-cell.js +0 -8
- package/dist/table/header.js +0 -16
- package/dist/table/multitable.js +0 -23
- package/dist/table/row-with-focus-sensor.js +0 -12
- package/dist/table/row.js +0 -18
- package/dist/table/selection-adapter.js +0 -2
- package/dist/table/selection-shortcuts-hoc.js +8 -42
- package/dist/table/selection.js +0 -50
- package/dist/table/smart-table.js +0 -9
- package/dist/table/table.js +6 -37
- package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
- package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
- package/dist/tabs/collapsible-more.js +0 -5
- package/dist/tabs/collapsible-tab.js +0 -4
- package/dist/tabs/collapsible-tabs.js +8 -28
- package/dist/tabs/dumb-tabs.js +0 -8
- package/dist/tabs/smart-tabs.js +0 -6
- package/dist/tabs/tab-link.js +0 -1
- package/dist/tabs/tab.js +0 -2
- package/dist/tabs-ng/tabs-ng.js +13 -29
- package/dist/tag/tag.js +0 -24
- package/dist/tags-input/tags-input.js +0 -76
- package/dist/tags-list/tags-list.js +0 -6
- package/dist/template-ng/template-ng.js +0 -12
- package/dist/text/text.js +0 -3
- package/dist/theme-ng/theme-ng.js +0 -8
- package/dist/title-ng/title-ng.js +6 -17
- package/dist/toggle/toggle.js +0 -4
- package/dist/tooltip/tooltip.js +4 -35
- package/dist/tooltip-ng/tooltip-ng.js +2 -8
- package/dist/user-agreement/service.js +0 -62
- package/dist/user-agreement/user-agreement.js +0 -8
- package/dist/user-card/smart-user-card-tooltip.js +2 -8
- package/dist/user-card/tooltip.js +0 -3
- package/package.json +15 -15
|
@@ -5,10 +5,8 @@ class Selection extends Selection$1 {
|
|
|
5
5
|
_buildData(data) {
|
|
6
6
|
return new Set(this._getDescendants(data));
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
_buildSelected(data, selected) {
|
|
10
9
|
const _selected = new Set(selected);
|
|
11
|
-
|
|
12
10
|
[...data].forEach(item => {
|
|
13
11
|
if (_selected.has(item)) {
|
|
14
12
|
this._selectDescendants(item, _selected);
|
|
@@ -16,7 +14,6 @@ class Selection extends Selection$1 {
|
|
|
16
14
|
});
|
|
17
15
|
return _selected;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
_getDescendants(items) {
|
|
21
18
|
let result = [];
|
|
22
19
|
items.forEach(item => {
|
|
@@ -25,90 +22,66 @@ class Selection extends Selection$1 {
|
|
|
25
22
|
});
|
|
26
23
|
return result;
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
_getAncestors(item) {
|
|
30
26
|
let result = [];
|
|
31
27
|
const parent = [...this._data].find(it => this._getChildren(it).includes(item));
|
|
32
|
-
|
|
33
28
|
if (parent) {
|
|
34
29
|
result = [parent, ...this._getAncestors(parent)];
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return result;
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
_selectDescendants(item, selected) {
|
|
41
34
|
this._getDescendants(this._getChildren(item)).forEach(it => selected.add(it));
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
_deselectDescendants(item, selected) {
|
|
45
37
|
this._getDescendants(this._getChildren(item)).forEach(it => selected.delete(it));
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
_selectAncestors(item, selected) {
|
|
49
40
|
this._getAncestors(item).forEach(ancestor => {
|
|
50
41
|
const groupIsSelected = this._getChildren(ancestor).filter(it => this._isItemSelectable(it)).every(it => selected.has(it));
|
|
51
|
-
|
|
52
42
|
if (groupIsSelected) {
|
|
53
43
|
selected.add(ancestor);
|
|
54
44
|
}
|
|
55
45
|
});
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
_deselectAncestors(item, selected) {
|
|
59
48
|
this._getAncestors(item).forEach(it => selected.delete(it));
|
|
60
49
|
}
|
|
61
|
-
|
|
62
50
|
select() {
|
|
63
51
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
|
|
64
|
-
|
|
65
52
|
if (!value || !this._isItemSelectable(value)) {
|
|
66
53
|
return this;
|
|
67
54
|
}
|
|
68
|
-
|
|
69
55
|
const selected = new Set(this._selected);
|
|
70
56
|
selected.add(value);
|
|
71
|
-
|
|
72
57
|
this._selectDescendants(value, selected);
|
|
73
|
-
|
|
74
58
|
this._selectAncestors(value, selected);
|
|
75
|
-
|
|
76
59
|
return this.cloneWith({
|
|
77
60
|
selected
|
|
78
61
|
});
|
|
79
62
|
}
|
|
80
|
-
|
|
81
63
|
focus(value) {
|
|
82
64
|
return super.focus(value);
|
|
83
65
|
}
|
|
84
|
-
|
|
85
66
|
resetSelection() {
|
|
86
67
|
return super.resetSelection();
|
|
87
68
|
}
|
|
88
|
-
|
|
89
69
|
cloneWith(config) {
|
|
90
70
|
return super.cloneWith(config);
|
|
91
71
|
}
|
|
92
|
-
|
|
93
72
|
deselect() {
|
|
94
73
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
|
|
95
|
-
|
|
96
74
|
if (!value || !this._isItemSelectable(value)) {
|
|
97
75
|
return this;
|
|
98
76
|
}
|
|
99
|
-
|
|
100
77
|
const selected = new Set(this._selected);
|
|
101
78
|
selected.delete(value);
|
|
102
|
-
|
|
103
79
|
this._deselectDescendants(value, selected);
|
|
104
|
-
|
|
105
80
|
this._deselectAncestors(value, selected);
|
|
106
|
-
|
|
107
81
|
return this.cloneWith({
|
|
108
82
|
selected
|
|
109
83
|
});
|
|
110
84
|
}
|
|
111
|
-
|
|
112
85
|
}
|
|
113
86
|
|
|
114
87
|
export { Selection as default };
|
|
@@ -2,16 +2,13 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import add from 'date-fns/add';
|
|
3
3
|
|
|
4
4
|
const unit = 8; // px;
|
|
5
|
-
|
|
6
5
|
const units = {
|
|
7
6
|
unit,
|
|
8
|
-
|
|
9
7
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
10
8
|
cellSize: unit * 3,
|
|
11
9
|
calHeight: unit * 36,
|
|
12
10
|
yearHeight: unit * 4
|
|
13
11
|
/* eslint-enable */
|
|
14
|
-
|
|
15
12
|
};
|
|
16
13
|
const YEAR = 12;
|
|
17
14
|
const WEEK = 7;
|
|
@@ -25,9 +22,7 @@ const weekdays = {
|
|
|
25
22
|
SU: 0
|
|
26
23
|
};
|
|
27
24
|
const MIDDLE_DAY = 15;
|
|
28
|
-
|
|
29
25
|
const durationToMillis = duration => +add(0, duration);
|
|
30
|
-
|
|
31
26
|
const yearDuration = durationToMillis({
|
|
32
27
|
years: 1
|
|
33
28
|
});
|
|
@@ -37,13 +32,11 @@ const HALF = 0.5;
|
|
|
37
32
|
const dateType = PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number]);
|
|
38
33
|
function parseTime(time) {
|
|
39
34
|
let result = null;
|
|
40
|
-
|
|
41
35
|
if (/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
|
|
42
36
|
result = time;
|
|
43
37
|
} else if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
|
|
44
38
|
result = `0${time}`;
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
return result;
|
|
48
41
|
}
|
|
49
42
|
|
|
@@ -27,26 +27,20 @@ import 'date-fns/add';
|
|
|
27
27
|
class DateInput extends React.PureComponent {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
|
-
|
|
31
30
|
_defineProperty(this, "input", void 0);
|
|
32
|
-
|
|
33
31
|
_defineProperty(this, "inputRef", el => {
|
|
34
32
|
this.input = el;
|
|
35
33
|
this.updateInput(this.props);
|
|
36
34
|
});
|
|
37
|
-
|
|
38
35
|
_defineProperty(this, "handleChange", e => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name));
|
|
39
|
-
|
|
40
36
|
_defineProperty(this, "handleKeyDown", e => e.key === 'Enter' && this.props.onConfirm());
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
componentDidUpdate(prevProps) {
|
|
44
39
|
const {
|
|
45
40
|
hidden,
|
|
46
41
|
text,
|
|
47
42
|
active
|
|
48
43
|
} = this.props;
|
|
49
|
-
|
|
50
44
|
if (!hidden && prevProps.hidden || text !== prevProps.text || active !== prevProps.active) {
|
|
51
45
|
this.updateInput({
|
|
52
46
|
text,
|
|
@@ -54,21 +48,17 @@ class DateInput extends React.PureComponent {
|
|
|
54
48
|
});
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
updateInput(_ref) {
|
|
59
52
|
let {
|
|
60
53
|
text,
|
|
61
54
|
active
|
|
62
55
|
} = _ref;
|
|
63
56
|
const el = this.input;
|
|
64
|
-
|
|
65
57
|
if (!el) {
|
|
66
58
|
return;
|
|
67
59
|
}
|
|
68
|
-
|
|
69
60
|
if (active) {
|
|
70
61
|
el.focus();
|
|
71
|
-
|
|
72
62
|
if (!text) {
|
|
73
63
|
el.select();
|
|
74
64
|
}
|
|
@@ -76,7 +66,6 @@ class DateInput extends React.PureComponent {
|
|
|
76
66
|
el.blur();
|
|
77
67
|
}
|
|
78
68
|
}
|
|
79
|
-
|
|
80
69
|
render() {
|
|
81
70
|
const {
|
|
82
71
|
active,
|
|
@@ -96,7 +85,6 @@ class DateInput extends React.PureComponent {
|
|
|
96
85
|
locale
|
|
97
86
|
} = this.props;
|
|
98
87
|
let displayText = '';
|
|
99
|
-
|
|
100
88
|
if (active && hoverDate) {
|
|
101
89
|
displayText = displayFormat(hoverDate, locale);
|
|
102
90
|
} else if (active && text != null) {
|
|
@@ -106,23 +94,18 @@ class DateInput extends React.PureComponent {
|
|
|
106
94
|
} else if (name === 'time') {
|
|
107
95
|
displayText = time || '';
|
|
108
96
|
}
|
|
109
|
-
|
|
110
97
|
const placeholder = (() => {
|
|
111
98
|
switch (name) {
|
|
112
99
|
case 'from':
|
|
113
100
|
return fromPlaceholder || translations.addFirstDate;
|
|
114
|
-
|
|
115
101
|
case 'to':
|
|
116
102
|
return toPlaceholder || translations.addSecondDate;
|
|
117
|
-
|
|
118
103
|
case 'time':
|
|
119
104
|
return timePlaceholder || translations.addTime;
|
|
120
|
-
|
|
121
105
|
default:
|
|
122
106
|
return translations.selectName.replace('%name%', name);
|
|
123
107
|
}
|
|
124
108
|
})();
|
|
125
|
-
|
|
126
109
|
const classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96[`${name}Input`], divider && modules_0c7b7d96[`${name}InputWithDivider`], 'ring-js-shortcuts');
|
|
127
110
|
return /*#__PURE__*/React.createElement(Input, {
|
|
128
111
|
autoComplete: "off",
|
|
@@ -139,9 +122,7 @@ class DateInput extends React.PureComponent {
|
|
|
139
122
|
placeholder: placeholder
|
|
140
123
|
});
|
|
141
124
|
}
|
|
142
|
-
|
|
143
125
|
}
|
|
144
|
-
|
|
145
126
|
_defineProperty(DateInput, "propTypes", {
|
|
146
127
|
active: PropTypes.bool,
|
|
147
128
|
divider: PropTypes.bool,
|
|
@@ -162,7 +143,6 @@ _defineProperty(DateInput, "propTypes", {
|
|
|
162
143
|
onClear: PropTypes.func,
|
|
163
144
|
locale: PropTypes.object
|
|
164
145
|
});
|
|
165
|
-
|
|
166
146
|
_defineProperty(DateInput, "defaultProps", {
|
|
167
147
|
fromPlaceholder: null,
|
|
168
148
|
toPlaceholder: null,
|
|
@@ -107,7 +107,6 @@ const PopupComponent = _ref => {
|
|
|
107
107
|
hidden: hidden
|
|
108
108
|
})));
|
|
109
109
|
};
|
|
110
|
-
|
|
111
110
|
PopupComponent.propTypes = {
|
|
112
111
|
hidden: PropTypes.bool,
|
|
113
112
|
className: PropTypes.string,
|
|
@@ -119,11 +118,9 @@ PopupComponent.propTypes = {
|
|
|
119
118
|
/**
|
|
120
119
|
* @name Date Picker
|
|
121
120
|
*/
|
|
122
|
-
|
|
123
121
|
class DatePicker extends PureComponent {
|
|
124
122
|
constructor() {
|
|
125
123
|
super(...arguments);
|
|
126
|
-
|
|
127
124
|
_defineProperty(this, "handleChange", change => {
|
|
128
125
|
const {
|
|
129
126
|
onChange,
|
|
@@ -133,48 +130,36 @@ class DatePicker extends PureComponent {
|
|
|
133
130
|
const adjustedChange = withTime && !(change instanceof Date) && (change === null || change === void 0 ? void 0 : change.date) != null ? applyTimeInput(change.date, change.time) : change;
|
|
134
131
|
onChange(adjustedChange);
|
|
135
132
|
});
|
|
136
|
-
|
|
137
133
|
_defineProperty(this, "clear", () => {
|
|
138
134
|
let change = null;
|
|
139
|
-
|
|
140
135
|
if (this.props.range) {
|
|
141
136
|
change = {
|
|
142
137
|
from: null,
|
|
143
138
|
to: null
|
|
144
139
|
};
|
|
145
140
|
}
|
|
146
|
-
|
|
147
141
|
this.handleChange(change);
|
|
148
142
|
});
|
|
149
|
-
|
|
150
143
|
_defineProperty(this, "popup", void 0);
|
|
151
|
-
|
|
152
144
|
_defineProperty(this, "popupRef", el => {
|
|
153
145
|
this.popup = el;
|
|
154
146
|
});
|
|
155
|
-
|
|
156
147
|
_defineProperty(this, "closePopup", () => {
|
|
157
148
|
var _this$popup;
|
|
158
|
-
|
|
159
149
|
(_this$popup = this.popup) === null || _this$popup === void 0 ? void 0 : _this$popup._onCloseAttempt();
|
|
160
150
|
});
|
|
161
|
-
|
|
162
151
|
_defineProperty(this, "parse", memoize(date => {
|
|
163
152
|
const {
|
|
164
153
|
parseDateInput
|
|
165
154
|
} = this.props;
|
|
166
|
-
|
|
167
155
|
if (date instanceof Date) {
|
|
168
156
|
return date;
|
|
169
157
|
}
|
|
170
|
-
|
|
171
158
|
if (typeof date === 'number') {
|
|
172
159
|
return new Date(date);
|
|
173
160
|
}
|
|
174
|
-
|
|
175
161
|
return parseDateInput(date);
|
|
176
162
|
}));
|
|
177
|
-
|
|
178
163
|
_defineProperty(this, "getAnchorText", () => {
|
|
179
164
|
const {
|
|
180
165
|
range,
|
|
@@ -192,7 +177,6 @@ class DatePicker extends PureComponent {
|
|
|
192
177
|
const from = this.parse(this.props.from);
|
|
193
178
|
const to = this.parse(this.props.to);
|
|
194
179
|
const time = this.formatTime();
|
|
195
|
-
|
|
196
180
|
if (!range && !withTime) {
|
|
197
181
|
return date ? displayFormat(date, locale) : datePlaceholder || translations.setDate;
|
|
198
182
|
} else if (!range && withTime) {
|
|
@@ -220,21 +204,17 @@ class DatePicker extends PureComponent {
|
|
|
220
204
|
}
|
|
221
205
|
});
|
|
222
206
|
}
|
|
223
|
-
|
|
224
207
|
formatTime() {
|
|
225
208
|
const {
|
|
226
209
|
displayTimeFormat,
|
|
227
210
|
locale
|
|
228
211
|
} = this.props;
|
|
229
212
|
const date = this.parse(this.props.date);
|
|
230
|
-
|
|
231
213
|
if (date != null) {
|
|
232
214
|
return displayTimeFormat(date, locale);
|
|
233
215
|
}
|
|
234
|
-
|
|
235
216
|
return null;
|
|
236
217
|
}
|
|
237
|
-
|
|
238
218
|
render() {
|
|
239
219
|
const anchorContent = /*#__PURE__*/React.createElement("div", {
|
|
240
220
|
className: modules_0c7b7d96.anchorContent
|
|
@@ -245,7 +225,6 @@ class DatePicker extends PureComponent {
|
|
|
245
225
|
glyph: chevronDownIcon,
|
|
246
226
|
className: modules_0c7b7d96.chevronDownIcon
|
|
247
227
|
}));
|
|
248
|
-
|
|
249
228
|
if (this.props.disabled) {
|
|
250
229
|
return /*#__PURE__*/React.createElement(Button, {
|
|
251
230
|
"data-test-ring-dropdown-anchor": true,
|
|
@@ -254,7 +233,6 @@ class DatePicker extends PureComponent {
|
|
|
254
233
|
text: false
|
|
255
234
|
}, anchorContent);
|
|
256
235
|
}
|
|
257
|
-
|
|
258
236
|
const {
|
|
259
237
|
className,
|
|
260
238
|
popupClassName,
|
|
@@ -282,7 +260,8 @@ class DatePicker extends PureComponent {
|
|
|
282
260
|
className: popupClassName,
|
|
283
261
|
popupRef: this.popupRef,
|
|
284
262
|
onClear: clear ? this.clear : null,
|
|
285
|
-
datePopupProps: {
|
|
263
|
+
datePopupProps: {
|
|
264
|
+
...datePopupProps,
|
|
286
265
|
// We want to provide translations further down to DateInput.
|
|
287
266
|
// Yet we should pass at least DateInput default translations not to have them empty.
|
|
288
267
|
translations: Object.assign({}, DateInput.defaultProps.translations, translations),
|
|
@@ -293,9 +272,7 @@ class DatePicker extends PureComponent {
|
|
|
293
272
|
onComplete: this.closePopup
|
|
294
273
|
}));
|
|
295
274
|
}
|
|
296
|
-
|
|
297
275
|
}
|
|
298
|
-
|
|
299
276
|
_defineProperty(DatePicker, "propTypes", {
|
|
300
277
|
className: PropTypes.string,
|
|
301
278
|
popupClassName: PropTypes.string,
|
|
@@ -323,7 +300,6 @@ _defineProperty(DatePicker, "propTypes", {
|
|
|
323
300
|
translations: PropTypes.object,
|
|
324
301
|
locale: PropTypes.object
|
|
325
302
|
});
|
|
326
|
-
|
|
327
303
|
_defineProperty(DatePicker, "defaultProps", {
|
|
328
304
|
className: '',
|
|
329
305
|
date: null,
|
|
@@ -350,43 +326,33 @@ _defineProperty(DatePicker, "defaultProps", {
|
|
|
350
326
|
rangePlaceholder: 'Set a period',
|
|
351
327
|
minDate: null,
|
|
352
328
|
maxDate: null,
|
|
353
|
-
|
|
354
329
|
onChange() {},
|
|
355
|
-
|
|
356
330
|
translations: {
|
|
357
331
|
setDate: 'Set a date',
|
|
358
332
|
setDateTime: 'Set date and time',
|
|
359
333
|
setPeriod: 'Set a period'
|
|
360
334
|
},
|
|
361
|
-
|
|
362
335
|
applyTimeInput(date, timeString) {
|
|
363
336
|
var _timeString$split$map;
|
|
364
|
-
|
|
365
337
|
const [hours, minutes] = (_timeString$split$map = timeString === null || timeString === void 0 ? void 0 : timeString.split(':').map(Number)) !== null && _timeString$split$map !== void 0 ? _timeString$split$map : [];
|
|
366
338
|
return minutes != null ? set(date, {
|
|
367
339
|
hours,
|
|
368
340
|
minutes
|
|
369
341
|
}) : date;
|
|
370
342
|
},
|
|
371
|
-
|
|
372
343
|
parseDateInput(string) {
|
|
373
344
|
if (!string) {
|
|
374
345
|
return null;
|
|
375
346
|
}
|
|
376
|
-
|
|
377
347
|
const today = new Date();
|
|
378
|
-
|
|
379
348
|
for (const format of formats) {
|
|
380
349
|
const date = parse(string, format, today);
|
|
381
|
-
|
|
382
350
|
if (isValid(date)) {
|
|
383
351
|
return date;
|
|
384
352
|
}
|
|
385
353
|
}
|
|
386
|
-
|
|
387
354
|
return null;
|
|
388
355
|
}
|
|
389
|
-
|
|
390
356
|
});
|
|
391
357
|
|
|
392
358
|
export { DatePicker as default };
|