@jetbrains/ring-ui-built 7.0.28 → 7.0.29
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 -1
- package/components/_helpers/card.js +5 -5
- package/components/_helpers/input.js +7 -7
- package/components/_helpers/select__filter.js +2 -2
- package/components/_helpers/sidebar.js +2 -2
- package/components/alert/alert.js +2 -2
- package/components/alert-service/alert-service.js +2 -2
- package/components/analytics/analytics.js +1 -1
- package/components/analytics/analytics__custom-plugin.js +8 -8
- package/components/auth/auth__core.js +54 -54
- package/components/auth/background-flow.js +4 -4
- package/components/auth/iframe-flow.js +7 -7
- package/components/auth/request-builder.js +3 -3
- package/components/auth/response-parser.js +4 -4
- package/components/auth/storage.js +12 -12
- package/components/auth/token-validator.js +7 -7
- package/components/auth/window-flow.js +7 -7
- package/components/auth-dialog/auth-dialog.js +1 -1
- package/components/avatar-stack/avatar-stack.js +2 -2
- package/components/button/button.js +2 -2
- package/components/caret/caret.js +7 -7
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/code/code.js +1 -1
- package/components/collapse/collapse-content.js +2 -2
- package/components/collapse/collapse.js +1 -1
- package/components/data-list/data-list.js +3 -3
- package/components/data-list/item.js +1 -1
- package/components/date-picker/consts.js +1 -1
- package/components/date-picker/date-input.js +5 -5
- package/components/date-picker/date-picker.js +9 -9
- package/components/date-picker/date-popup.js +4 -4
- package/components/date-picker/years.js +1 -1
- package/components/dialog/dialog.js +1 -1
- package/components/dropdown/dropdown.js +4 -4
- package/components/editable-heading/editable-heading.js +4 -4
- package/components/global/focus-sensor-hoc.js +10 -10
- package/components/global/memoize.js +1 -1
- package/components/global/normalize-indent.js +1 -1
- package/components/global/react-dom-renderer.js +1 -1
- package/components/global/schedule-raf.js +1 -1
- package/components/header/profile.js +6 -6
- package/components/header/smart-profile.js +2 -2
- package/components/header/smart-services.js +4 -4
- package/components/http/http.js +9 -9
- package/components/http/http.mock.js +3 -3
- package/components/hub-source/hub-source.js +6 -6
- package/components/hub-source/hub-source__user.js +2 -2
- package/components/hub-source/hub-source__users-groups.js +4 -4
- package/components/i18n/i18n.js +1 -1
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +3 -3
- package/components/island/header.js +1 -1
- package/components/list/list.js +4 -4
- package/components/list/list__item.js +20 -9
- package/components/list/list__users-groups-source.js +2 -2
- package/components/loader/loader.js +2 -2
- package/components/loader/loader__core.js +27 -27
- package/components/login-dialog/login-dialog.js +1 -1
- package/components/message/message.js +8 -8
- package/components/old-browsers-message/white-list.js +1 -1
- package/components/pager/pager.js +9 -9
- package/components/permissions/permissions.js +7 -7
- package/components/permissions/permissions__cache.js +4 -4
- package/components/popup/popup.js +8 -8
- package/components/popup/position.js +1 -1
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.js +49 -47
- package/components/radio/radio__item.js +2 -2
- package/components/select/select.js +27 -27
- package/components/select/select__popup.js +9 -9
- package/components/shortcuts/core.js +1 -1
- package/components/slider/slider.js +8 -8
- package/components/slider/slider.utils.js +1 -1
- package/components/storage/storage__local.js +1 -1
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +4 -4
- package/components/table/header-cell.js +2 -2
- package/components/table/multitable.js +7 -7
- package/components/table/row-with-focus-sensor.js +4 -4
- package/components/table/row.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +12 -12
- package/components/table/selection.js +7 -7
- package/components/table/table.js +1 -1
- package/components/tabs/collapsible-tab.js +3 -3
- package/components/tabs/collapsible-tabs.js +7 -7
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/smart-tabs.js +1 -1
- package/components/tag/tag.js +2 -2
- package/components/tags-input/tags-input.js +17 -17
- package/components/tooltip/tooltip.js +8 -8
- package/components/upload/upload.js +3 -3
- package/components/user-agreement/service.js +3 -3
- package/components/user-agreement/user-agreement.js +8 -8
- package/package.json +2 -2
@@ -74,17 +74,17 @@ class AuthStorage {
|
|
74
74
|
* @param {{stateKeyPrefix: string, tokenKey: string, onTokenRemove: Function}} config
|
75
75
|
*/
|
76
76
|
constructor(config) {
|
77
|
-
_defineProperty(this, "messagePrefix",
|
78
|
-
_defineProperty(this, "stateKeyPrefix",
|
79
|
-
_defineProperty(this, "tokenKey",
|
80
|
-
_defineProperty(this, "userKey",
|
81
|
-
_defineProperty(this, "stateTTL",
|
82
|
-
_defineProperty(this, "stateQuota",
|
83
|
-
_defineProperty(this, "_lastMessage",
|
84
|
-
_defineProperty(this, "_stateStorage",
|
85
|
-
_defineProperty(this, "_tokenStorage",
|
86
|
-
_defineProperty(this, "_messagesStorage",
|
87
|
-
_defineProperty(this, "_currentUserStorage",
|
77
|
+
_defineProperty(this, "messagePrefix", void 0);
|
78
|
+
_defineProperty(this, "stateKeyPrefix", void 0);
|
79
|
+
_defineProperty(this, "tokenKey", void 0);
|
80
|
+
_defineProperty(this, "userKey", void 0);
|
81
|
+
_defineProperty(this, "stateTTL", void 0);
|
82
|
+
_defineProperty(this, "stateQuota", void 0);
|
83
|
+
_defineProperty(this, "_lastMessage", void 0);
|
84
|
+
_defineProperty(this, "_stateStorage", void 0);
|
85
|
+
_defineProperty(this, "_tokenStorage", void 0);
|
86
|
+
_defineProperty(this, "_messagesStorage", void 0);
|
87
|
+
_defineProperty(this, "_currentUserStorage", void 0);
|
88
88
|
this.messagePrefix = config.messagePrefix || '';
|
89
89
|
this.stateKeyPrefix = config.stateKeyPrefix || '';
|
90
90
|
this.tokenKey = config.tokenKey || '';
|
@@ -177,7 +177,7 @@ class AuthStorage {
|
|
177
177
|
var _state$created;
|
178
178
|
// Clean old states
|
179
179
|
const state = value;
|
180
|
-
const created = (_state$created = state.created) !== null && _state$created !==
|
180
|
+
const created = (_state$created = state.created) !== null && _state$created !== void 0 ? _state$created : Date.now();
|
181
181
|
if (created + this.stateTTL < now) {
|
182
182
|
return this._stateStorage.remove(key);
|
183
183
|
}
|
@@ -13,17 +13,17 @@ import 'core-js/modules/es.string.replace.js';
|
|
13
13
|
class TokenValidationError extends ExtendableError {
|
14
14
|
constructor(message, cause) {
|
15
15
|
super(message);
|
16
|
-
_defineProperty(this, "cause",
|
17
|
-
_defineProperty(this, "authRedirect",
|
16
|
+
_defineProperty(this, "cause", void 0);
|
17
|
+
_defineProperty(this, "authRedirect", void 0);
|
18
18
|
this.cause = cause;
|
19
19
|
this.authRedirect = true;
|
20
20
|
}
|
21
21
|
}
|
22
22
|
class TokenValidator {
|
23
23
|
constructor(config, getUser, storage) {
|
24
|
-
_defineProperty(this, "_getUser",
|
25
|
-
_defineProperty(this, "_config",
|
26
|
-
_defineProperty(this, "_storage",
|
24
|
+
_defineProperty(this, "_getUser", void 0);
|
25
|
+
_defineProperty(this, "_config", void 0);
|
26
|
+
_defineProperty(this, "_storage", void 0);
|
27
27
|
this._getUser = getUser;
|
28
28
|
this._config = config;
|
29
29
|
this._storage = storage;
|
@@ -99,7 +99,7 @@ class TokenValidator {
|
|
99
99
|
const requiredScopes = optionalScopes ? scope.filter(scopeId => !optionalScopes.includes(scopeId)) : scope;
|
100
100
|
const hasAllScopes = requiredScopes.every(scopeId => {
|
101
101
|
var _storedToken$scopes;
|
102
|
-
return (_storedToken$scopes = storedToken.scopes) === null || _storedToken$scopes ===
|
102
|
+
return (_storedToken$scopes = storedToken.scopes) === null || _storedToken$scopes === void 0 ? void 0 : _storedToken$scopes.includes(scopeId);
|
103
103
|
});
|
104
104
|
if (!hasAllScopes) {
|
105
105
|
throw new TokenValidator.TokenValidationError("Token doesn't match required scopes");
|
@@ -133,7 +133,7 @@ class TokenValidator {
|
|
133
133
|
if (errorResponse.status === CODE.UNAUTHORIZED || TokenValidator.shouldRefreshToken(response.error)) {
|
134
134
|
var _errorResponse$data, _errorResponse$data2;
|
135
135
|
// Token expired
|
136
|
-
throw new TokenValidator.TokenValidationError(response.error || errorResponse.message, (_errorResponse$data = errorResponse.data) !== null && _errorResponse$data !==
|
136
|
+
throw new TokenValidator.TokenValidationError(response.error || errorResponse.message, (_errorResponse$data = errorResponse.data) !== null && _errorResponse$data !== void 0 && _errorResponse$data.error ? new Error((_errorResponse$data2 = errorResponse.data) === null || _errorResponse$data2 === void 0 ? void 0 : _errorResponse$data2.error) : undefined);
|
137
137
|
}
|
138
138
|
// Request unexpectedly failed
|
139
139
|
throw errorResponse;
|
@@ -13,14 +13,14 @@ const CLOSED_CHECK_INTERVAL = 200;
|
|
13
13
|
class WindowFlow {
|
14
14
|
constructor(requestBuilder, storage) {
|
15
15
|
_defineProperty(this, "_timeoutId", undefined);
|
16
|
-
_defineProperty(this, "_requestBuilder",
|
17
|
-
_defineProperty(this, "_storage",
|
18
|
-
_defineProperty(this, "reject",
|
19
|
-
_defineProperty(this, "_loginWindow",
|
20
|
-
_defineProperty(this, "_promise",
|
16
|
+
_defineProperty(this, "_requestBuilder", void 0);
|
17
|
+
_defineProperty(this, "_storage", void 0);
|
18
|
+
_defineProperty(this, "reject", void 0);
|
19
|
+
_defineProperty(this, "_loginWindow", void 0);
|
20
|
+
_defineProperty(this, "_promise", void 0);
|
21
21
|
_defineProperty(this, "checkIsClosed", () => {
|
22
22
|
var _this$_loginWindow;
|
23
|
-
if ((_this$_loginWindow = this._loginWindow) !== null && _this$_loginWindow !==
|
23
|
+
if ((_this$_loginWindow = this._loginWindow) !== null && _this$_loginWindow !== void 0 && _this$_loginWindow.closed) {
|
24
24
|
this.stop();
|
25
25
|
return;
|
26
26
|
}
|
@@ -73,7 +73,7 @@ class WindowFlow {
|
|
73
73
|
removeStateListener();
|
74
74
|
removeTokenListener();
|
75
75
|
/* eslint-enable @typescript-eslint/no-use-before-define */
|
76
|
-
(_this$_loginWindow2 = this._loginWindow) === null || _this$_loginWindow2 ===
|
76
|
+
(_this$_loginWindow2 = this._loginWindow) === null || _this$_loginWindow2 === void 0 || _this$_loginWindow2.close();
|
77
77
|
clearTimeout(this._timeoutId);
|
78
78
|
};
|
79
79
|
const removeTokenListener = this._storage.onTokenChange(token => {
|
@@ -111,7 +111,7 @@ class AuthDialog extends Component {
|
|
111
111
|
retrying
|
112
112
|
} = this.state;
|
113
113
|
const defaultTitle = serviceName ? loginToCaption : loginCaption;
|
114
|
-
const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName !== null && serviceName !==
|
114
|
+
const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName !== null && serviceName !== void 0 ? serviceName : '').replace('{{serviceName}}', serviceName !== null && serviceName !== void 0 ? serviceName : '');
|
115
115
|
return jsx(Dialog, {
|
116
116
|
label: title,
|
117
117
|
"data-test": "ring-auth-dialog",
|
@@ -99,7 +99,7 @@ function AvatarStack(_ref) {
|
|
99
99
|
'--ring-avatar-stack-index': index
|
100
100
|
},
|
101
101
|
children: child
|
102
|
-
})), extraItems !== null && extraItems !==
|
102
|
+
})), extraItems !== null && extraItems !== void 0 && extraItems.length ? jsx(DropdownMenu, _objectSpread2({
|
103
103
|
hoverMode: true,
|
104
104
|
hoverShowTimeOut: 10,
|
105
105
|
onShow: () => setDropdownOpen(true),
|
@@ -118,7 +118,7 @@ function AvatarStack(_ref) {
|
|
118
118
|
data: extraItems,
|
119
119
|
menuProps: _objectSpread2({
|
120
120
|
offset: 4
|
121
|
-
}, dropdownMenuProps === null || dropdownMenuProps ===
|
121
|
+
}, dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.menuProps)
|
122
122
|
}, dropdownMenuProps)) : null]
|
123
123
|
}));
|
124
124
|
}
|
@@ -59,13 +59,13 @@ class Button extends PureComponent {
|
|
59
59
|
inline
|
60
60
|
} = _this$props,
|
61
61
|
props = _objectWithoutProperties(_this$props, _excluded);
|
62
|
-
const isInline = (_ref = inline !== null && inline !==
|
62
|
+
const isInline = (_ref = inline !== null && inline !== void 0 ? inline : text) !== null && _ref !== void 0 ? _ref : icon != null;
|
63
63
|
if (text != null) {
|
64
64
|
warnText();
|
65
65
|
}
|
66
66
|
const classes = getButtonClasses(_objectSpread2(_objectSpread2({}, this.props), {}, {
|
67
67
|
inline: isInline,
|
68
|
-
height: height !== null && height !==
|
68
|
+
height: height !== null && height !== void 0 ? height : this.context
|
69
69
|
}));
|
70
70
|
const content = jsxs(Fragment, {
|
71
71
|
children: [icon && jsx(Icon, {
|
@@ -22,11 +22,11 @@ class Caret {
|
|
22
22
|
return typeof value === 'string' ? value.replace(this.returnRE, '') : value;
|
23
23
|
}
|
24
24
|
constructor(target) {
|
25
|
-
_defineProperty(this, "target",
|
25
|
+
_defineProperty(this, "target", void 0);
|
26
26
|
this.target = target;
|
27
27
|
}
|
28
28
|
isContentEditable() {
|
29
|
-
return this.target.contentEditable === 'true';
|
29
|
+
return this.target.contentEditable === 'true' || this.target.getAttribute('contenteditable') === 'true'; // workaround for https://github.com/jsdom/jsdom/issues/1670
|
30
30
|
}
|
31
31
|
/**
|
32
32
|
* Set focus on target if possible
|
@@ -46,7 +46,7 @@ class Caret {
|
|
46
46
|
while (_curNode != null && _curNode !== this.target) {
|
47
47
|
while (_curNode.previousSibling) {
|
48
48
|
var _curNode$previousSibl, _curNode$previousSibl2;
|
49
|
-
curPos += (_curNode$previousSibl = (_curNode$previousSibl2 = _curNode.previousSibling.textContent) === null || _curNode$previousSibl2 ===
|
49
|
+
curPos += (_curNode$previousSibl = (_curNode$previousSibl2 = _curNode.previousSibling.textContent) === null || _curNode$previousSibl2 === void 0 ? void 0 : _curNode$previousSibl2.length) !== null && _curNode$previousSibl !== void 0 ? _curNode$previousSibl : 0;
|
50
50
|
_curNode = _curNode.previousSibling;
|
51
51
|
}
|
52
52
|
_curNode = _curNode.parentNode;
|
@@ -66,7 +66,7 @@ class Caret {
|
|
66
66
|
this.focus();
|
67
67
|
}
|
68
68
|
const selection = window.getSelection();
|
69
|
-
if (!(selection !== null && selection !==
|
69
|
+
if (!(selection !== null && selection !== void 0 && selection.rangeCount)) {
|
70
70
|
return 0;
|
71
71
|
}
|
72
72
|
const range1 = selection.getRangeAt(0);
|
@@ -137,11 +137,11 @@ class Caret {
|
|
137
137
|
i++;
|
138
138
|
if (_curNode.childNodes[i] != null) {
|
139
139
|
var _curNode$childNodes$i, _curNode$childNodes$i2;
|
140
|
-
curPos += (_curNode$childNodes$i = (_curNode$childNodes$i2 = _curNode.childNodes[i].textContent) === null || _curNode$childNodes$i2 ===
|
140
|
+
curPos += (_curNode$childNodes$i = (_curNode$childNodes$i2 = _curNode.childNodes[i].textContent) === null || _curNode$childNodes$i2 === void 0 ? void 0 : _curNode$childNodes$i2.length) !== null && _curNode$childNodes$i !== void 0 ? _curNode$childNodes$i : 0;
|
141
141
|
if (curPos >= position) {
|
142
142
|
var _curNode$textContent$, _curNode$textContent;
|
143
143
|
_curNode = _curNode.childNodes[i];
|
144
|
-
curPos -= (_curNode$textContent$ = (_curNode$textContent = _curNode.textContent) === null || _curNode$textContent ===
|
144
|
+
curPos -= (_curNode$textContent$ = (_curNode$textContent = _curNode.textContent) === null || _curNode$textContent === void 0 ? void 0 : _curNode$textContent.length) !== null && _curNode$textContent$ !== void 0 ? _curNode$textContent$ : 0;
|
145
145
|
i = -1;
|
146
146
|
}
|
147
147
|
} else {
|
@@ -175,7 +175,7 @@ class Caret {
|
|
175
175
|
} else if (position === -1) {
|
176
176
|
var _value$length;
|
177
177
|
const value = isContentEditable ? this.target.textContent : Caret.normalizeNewlines('value' in this.target ? this.target.value : undefined);
|
178
|
-
correctedPosition = (_value$length = value === null || value ===
|
178
|
+
correctedPosition = (_value$length = value === null || value === void 0 ? void 0 : value.length) !== null && _value$length !== void 0 ? _value$length : 0;
|
179
179
|
} else {
|
180
180
|
const {
|
181
181
|
_curNode,
|
@@ -30,7 +30,7 @@ const _excluded = ["children", "label", "className", "containerClassName", "cont
|
|
30
30
|
class Checkbox extends PureComponent {
|
31
31
|
constructor() {
|
32
32
|
super(...arguments);
|
33
|
-
_defineProperty(this, "input",
|
33
|
+
_defineProperty(this, "input", void 0);
|
34
34
|
_defineProperty(this, "inputRef", el => {
|
35
35
|
if (el != null) {
|
36
36
|
el.indeterminate = this.props.indeterminate;
|
@@ -26,12 +26,12 @@ function copyHTMLToClipboard(str) {
|
|
26
26
|
const selection = document.getSelection();
|
27
27
|
// Should restore previous selection
|
28
28
|
const selected = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : false;
|
29
|
-
selection === null || selection ===
|
29
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
30
30
|
const range = document.createRange();
|
31
31
|
range.selectNode(el);
|
32
|
-
selection === null || selection ===
|
32
|
+
selection === null || selection === void 0 || selection.addRange(range);
|
33
33
|
document.execCommand('copy');
|
34
|
-
selection === null || selection ===
|
34
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
35
35
|
document.execCommand('copy');
|
36
36
|
document.body.removeChild(el);
|
37
37
|
if (selected && selection) {
|
package/components/code/code.js
CHANGED
@@ -29,7 +29,7 @@ const registerLanguage = memoize(async language => {
|
|
29
29
|
class Code extends PureComponent {
|
30
30
|
constructor() {
|
31
31
|
super(...arguments);
|
32
|
-
_defineProperty(this, "code",
|
32
|
+
_defineProperty(this, "code", void 0);
|
33
33
|
}
|
34
34
|
componentDidMount() {
|
35
35
|
this.highlight();
|
@@ -51,9 +51,9 @@ const CollapseContent = _ref => {
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
const container = containerRef.current;
|
54
|
-
container === null || container ===
|
54
|
+
container === null || container === void 0 || container.addEventListener('transitionend', onTransitionEnd);
|
55
55
|
return () => {
|
56
|
-
container === null || container ===
|
56
|
+
container === null || container === void 0 || container.removeEventListener('transitionend', onTransitionEnd);
|
57
57
|
};
|
58
58
|
}, [collapsed]);
|
59
59
|
useEffect(() => {
|
@@ -19,7 +19,7 @@ const Collapse = _ref => {
|
|
19
19
|
} = _ref;
|
20
20
|
const [innerCollapsed, setInnerCollapsed] = useState(defaultCollapsed);
|
21
21
|
const id = useId();
|
22
|
-
const finalCollapsedValue = useMemo(() => collapsed !== null && collapsed !==
|
22
|
+
const finalCollapsedValue = useMemo(() => collapsed !== null && collapsed !== void 0 ? collapsed : innerCollapsed, [innerCollapsed, collapsed]);
|
23
23
|
const setCollapsed = useCallback(() => {
|
24
24
|
setInnerCollapsed(!finalCollapsedValue);
|
25
25
|
onChange(!finalCollapsedValue);
|
@@ -84,10 +84,10 @@ class DataList extends PureComponent {
|
|
84
84
|
const item = itemFormatter(focused);
|
85
85
|
if (item.collapsed) {
|
86
86
|
var _item$onExpand;
|
87
|
-
(_item$onExpand = item.onExpand) === null || _item$onExpand ===
|
87
|
+
(_item$onExpand = item.onExpand) === null || _item$onExpand === void 0 || _item$onExpand.call(item);
|
88
88
|
} else {
|
89
89
|
var _item$onCollapse;
|
90
|
-
(_item$onCollapse = item.onCollapse) === null || _item$onCollapse ===
|
90
|
+
(_item$onCollapse = item.onCollapse) === null || _item$onCollapse === void 0 || _item$onCollapse.call(item);
|
91
91
|
}
|
92
92
|
});
|
93
93
|
_defineProperty(this, "shortcutsMap", {
|
@@ -145,7 +145,7 @@ class DataList extends PureComponent {
|
|
145
145
|
title,
|
146
146
|
items
|
147
147
|
} = item;
|
148
|
-
const showMoreLessButton = (_this$props$itemMoreL = (_this$props = this.props).itemMoreLessState) === null || _this$props$itemMoreL ===
|
148
|
+
const showMoreLessButton = (_this$props$itemMoreL = (_this$props = this.props).itemMoreLessState) === null || _this$props$itemMoreL === void 0 ? void 0 : _this$props$itemMoreL.call(_this$props, item);
|
149
149
|
return jsx(Item, {
|
150
150
|
item: model,
|
151
151
|
title: title,
|
@@ -165,7 +165,7 @@ class Item extends PureComponent {
|
|
165
165
|
});
|
166
166
|
}
|
167
167
|
}
|
168
|
-
const itemIsEmpty = !(items !== null && items !==
|
168
|
+
const itemIsEmpty = !(items !== null && items !== void 0 && items.length) || collapsible && collapsed;
|
169
169
|
const offset = level * LIST_LEFT_OFFSET + ITEM_LEFT_OFFSET + parentShift;
|
170
170
|
return jsxs("li", {
|
171
171
|
children: [jsx(Title, {
|
@@ -45,7 +45,7 @@ function shiftWeekArray(arr, startOfWeek) {
|
|
45
45
|
}
|
46
46
|
function getWeekStartsOn(locale) {
|
47
47
|
var _locale$options$weekS, _locale$options;
|
48
|
-
return (_locale$options$weekS = locale === null || locale ===
|
48
|
+
return (_locale$options$weekS = locale === null || locale === void 0 || (_locale$options = locale.options) === null || _locale$options === void 0 ? void 0 : _locale$options.weekStartsOn) !== null && _locale$options$weekS !== void 0 ? _locale$options$weekS : weekdays.MO;
|
49
49
|
}
|
50
50
|
function getDayNumInWeek(locale, day) {
|
51
51
|
const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
|
@@ -33,7 +33,7 @@ import '../i18n/i18n.js';
|
|
33
33
|
class DateInput extends React.PureComponent {
|
34
34
|
constructor() {
|
35
35
|
super(...arguments);
|
36
|
-
_defineProperty(this, "input",
|
36
|
+
_defineProperty(this, "input", void 0);
|
37
37
|
_defineProperty(this, "inputRef", el => {
|
38
38
|
this.input = el;
|
39
39
|
});
|
@@ -116,13 +116,13 @@ class DateInput extends React.PureComponent {
|
|
116
116
|
const placeholder = ((_translations$addFirs, _translations$addSeco, _translations$addTime, _translations$selectN) => {
|
117
117
|
switch (name) {
|
118
118
|
case 'from':
|
119
|
-
return fromPlaceholder || ((_translations$addFirs = translations === null || translations ===
|
119
|
+
return fromPlaceholder || ((_translations$addFirs = translations === null || translations === void 0 ? void 0 : translations.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
|
120
120
|
case 'to':
|
121
|
-
return toPlaceholder || ((_translations$addSeco = translations === null || translations ===
|
121
|
+
return toPlaceholder || ((_translations$addSeco = translations === null || translations === void 0 ? void 0 : translations.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
|
122
122
|
case 'time':
|
123
|
-
return timePlaceholder || ((_translations$addTime = translations === null || translations ===
|
123
|
+
return timePlaceholder || ((_translations$addTime = translations === null || translations === void 0 ? void 0 : translations.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
|
124
124
|
default:
|
125
|
-
return ((_translations$selectN = translations === null || translations ===
|
125
|
+
return ((_translations$selectN = translations === null || translations === void 0 ? void 0 : translations.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
|
126
126
|
}
|
127
127
|
})();
|
128
128
|
const classes = classNames(styles.filter, styles["".concat(name, "Input")], divider && styles["".concat(name, "InputWithDivider")], 'ring-js-shortcuts');
|
@@ -135,7 +135,7 @@ class DatePicker extends PureComponent {
|
|
135
135
|
withTime,
|
136
136
|
applyTimeInput
|
137
137
|
} = this.props;
|
138
|
-
const adjustedChange = withTime && !(change instanceof Date) && (change === null || change ===
|
138
|
+
const adjustedChange = withTime && !(change instanceof Date) && (change === null || change === void 0 ? void 0 : change.date) != null ? applyTimeInput(change.date, change.time) : change;
|
139
139
|
onChange(adjustedChange);
|
140
140
|
});
|
141
141
|
_defineProperty(this, "clear", () => {
|
@@ -148,13 +148,13 @@ class DatePicker extends PureComponent {
|
|
148
148
|
}
|
149
149
|
this.handleChange(change);
|
150
150
|
});
|
151
|
-
_defineProperty(this, "popup",
|
151
|
+
_defineProperty(this, "popup", void 0);
|
152
152
|
_defineProperty(this, "popupRef", el => {
|
153
153
|
this.popup = el;
|
154
154
|
});
|
155
155
|
_defineProperty(this, "closePopup", () => {
|
156
156
|
var _this$popup;
|
157
|
-
(_this$popup = this.popup) === null || _this$popup ===
|
157
|
+
(_this$popup = this.popup) === null || _this$popup === void 0 || _this$popup._onCloseAttempt();
|
158
158
|
});
|
159
159
|
_defineProperty(this, "parse", memoize(date => {
|
160
160
|
const {
|
@@ -190,11 +190,11 @@ class DatePicker extends PureComponent {
|
|
190
190
|
const time = this.formatTime();
|
191
191
|
if (!range && !withTime) {
|
192
192
|
var _ref2;
|
193
|
-
return date ? displayFormat(date, locale) : (_ref2 = datePlaceholder !== null && datePlaceholder !==
|
193
|
+
return date ? displayFormat(date, locale) : (_ref2 = datePlaceholder !== null && datePlaceholder !== void 0 ? datePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setDate) !== null && _ref2 !== void 0 ? _ref2 : translate('setDate');
|
194
194
|
} else if (!range && withTime) {
|
195
195
|
if (!date && !time) {
|
196
196
|
var _ref3;
|
197
|
-
return (_ref3 = dateTimePlaceholder !== null && dateTimePlaceholder !==
|
197
|
+
return (_ref3 = dateTimePlaceholder !== null && dateTimePlaceholder !== void 0 ? dateTimePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setDateTime) !== null && _ref3 !== void 0 ? _ref3 : translate('setDateTime');
|
198
198
|
} else {
|
199
199
|
return "".concat(date && displayFormat(date, locale) || '—', ", ").concat(time || '—');
|
200
200
|
}
|
@@ -214,7 +214,7 @@ class DatePicker extends PureComponent {
|
|
214
214
|
return "\u2014 ".concat(displayFormat(to, locale));
|
215
215
|
} else {
|
216
216
|
var _ref4;
|
217
|
-
return (_ref4 = rangePlaceholder !== null && rangePlaceholder !==
|
217
|
+
return (_ref4 = rangePlaceholder !== null && rangePlaceholder !== void 0 ? rangePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setPeriod) !== null && _ref4 !== void 0 ? _ref4 : translate('setPeriod');
|
218
218
|
}
|
219
219
|
});
|
220
220
|
}
|
@@ -261,14 +261,14 @@ class DatePicker extends PureComponent {
|
|
261
261
|
anchor: inline ? jsx(Link, {
|
262
262
|
"data-test-ring-dropdown-anchor": true,
|
263
263
|
className: styles.anchor,
|
264
|
-
disabled: (_this$props$disabled = this.props.disabled) !== null && _this$props$disabled !==
|
264
|
+
disabled: (_this$props$disabled = this.props.disabled) !== null && _this$props$disabled !== void 0 ? _this$props$disabled : false,
|
265
265
|
pseudo: true,
|
266
266
|
children: this.getAnchorText()
|
267
267
|
}) : jsx(Button, _objectSpread2(_objectSpread2({
|
268
268
|
"data-test-ring-dropdown-anchor": true,
|
269
269
|
className: styles.anchor,
|
270
270
|
inline: false,
|
271
|
-
disabled: (_this$props$disabled2 = this.props.disabled) !== null && _this$props$disabled2 !==
|
271
|
+
disabled: (_this$props$disabled2 = this.props.disabled) !== null && _this$props$disabled2 !== void 0 ? _this$props$disabled2 : false
|
272
272
|
}, this.props.buttonAttributes), {}, {
|
273
273
|
children: anchorContent
|
274
274
|
}))
|
@@ -315,7 +315,7 @@ _defineProperty(DatePicker, "defaultProps", {
|
|
315
315
|
onChange() {},
|
316
316
|
applyTimeInput(date, timeString) {
|
317
317
|
var _timeString$split$map;
|
318
|
-
const [hours, minutes] = (_timeString$split$map = timeString === null || timeString ===
|
318
|
+
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 : [];
|
319
319
|
return minutes != null ? set(date, {
|
320
320
|
hours,
|
321
321
|
minutes
|
@@ -81,8 +81,8 @@ class DatePopup extends Component {
|
|
81
81
|
}
|
82
82
|
constructor(props) {
|
83
83
|
super(props);
|
84
|
-
_defineProperty(this, "_scrollDate",
|
85
|
-
_defineProperty(this, "_scrollTS",
|
84
|
+
_defineProperty(this, "_scrollDate", void 0);
|
85
|
+
_defineProperty(this, "_scrollTS", void 0);
|
86
86
|
_defineProperty(this, "isInTimeMode", () => !this.props.range && this.props.withTime || false);
|
87
87
|
_defineProperty(this, "componentRef", /*#__PURE__*/React.createRef());
|
88
88
|
_defineProperty(this, "handleWheel", e => {
|
@@ -172,8 +172,8 @@ class DatePopup extends Component {
|
|
172
172
|
};
|
173
173
|
}
|
174
174
|
this.select(changes);
|
175
|
-
(_this$props$onClear = (_this$props = this.props).onClear) === null || _this$props$onClear ===
|
176
|
-
(_this$componentRef$cu = this.componentRef.current) === null || _this$componentRef$cu ===
|
175
|
+
(_this$props$onClear = (_this$props = this.props).onClear) === null || _this$props$onClear === void 0 || _this$props$onClear.call(_this$props, e);
|
176
|
+
(_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();
|
177
177
|
});
|
178
178
|
const defaultState = {
|
179
179
|
text: null,
|
@@ -30,7 +30,7 @@ class Years extends PureComponent {
|
|
30
30
|
_defineProperty(this, "state", {
|
31
31
|
scrollDate: null
|
32
32
|
});
|
33
|
-
_defineProperty(this, "stoppedScrolling",
|
33
|
+
_defineProperty(this, "stoppedScrolling", void 0);
|
34
34
|
_defineProperty(this, "componentRef", /*#__PURE__*/createRef());
|
35
35
|
_defineProperty(this, "handleWheel", e => {
|
36
36
|
const {
|
@@ -64,14 +64,14 @@ class Dropdown extends Component {
|
|
64
64
|
}
|
65
65
|
this._toggle(false, nextPinned);
|
66
66
|
});
|
67
|
-
_defineProperty(this, "hoverTimer",
|
67
|
+
_defineProperty(this, "hoverTimer", void 0);
|
68
68
|
_defineProperty(this, "onMouseEnter", event => {
|
69
69
|
var _this$props$onMouseEn, _this$props;
|
70
70
|
if (this.props.disabled) {
|
71
71
|
return;
|
72
72
|
}
|
73
73
|
this._clearTimer();
|
74
|
-
(_this$props$onMouseEn = (_this$props = this.props).onMouseEnter) === null || _this$props$onMouseEn ===
|
74
|
+
(_this$props$onMouseEn = (_this$props = this.props).onMouseEnter) === null || _this$props$onMouseEn === void 0 || _this$props$onMouseEn.call(_this$props, event);
|
75
75
|
this.hoverTimer = window.setTimeout(() => {
|
76
76
|
if (!this.state.show) {
|
77
77
|
this._toggle(true);
|
@@ -83,7 +83,7 @@ class Dropdown extends Component {
|
|
83
83
|
if (this.props.disabled) {
|
84
84
|
return;
|
85
85
|
}
|
86
|
-
(_this$props$onMouseLe = (_this$props2 = this.props).onMouseLeave) === null || _this$props$onMouseLe ===
|
86
|
+
(_this$props$onMouseLe = (_this$props2 = this.props).onMouseLeave) === null || _this$props$onMouseLe === void 0 || _this$props$onMouseLe.call(_this$props2, event);
|
87
87
|
if (this.state.pinned) {
|
88
88
|
return;
|
89
89
|
}
|
@@ -145,7 +145,7 @@ class Dropdown extends Component {
|
|
145
145
|
} = _this$props3,
|
146
146
|
restProps = _objectWithoutProperties(_this$props3, _excluded);
|
147
147
|
const classes = classNames(styles.dropdown, className, {
|
148
|
-
[activeClassName !== null && activeClassName !==
|
148
|
+
[activeClassName !== null && activeClassName !== void 0 ? activeClassName : '']: activeClassName != null && show
|
149
149
|
});
|
150
150
|
let anchorElement;
|
151
151
|
const active = hoverMode ? pinned : show;
|
@@ -153,20 +153,20 @@ const EditableHeading = props => {
|
|
153
153
|
setIsInFocus(true);
|
154
154
|
checkValue(e.target);
|
155
155
|
checkOverflow(e.target);
|
156
|
-
onFocus === null || onFocus ===
|
156
|
+
onFocus === null || onFocus === void 0 || onFocus(e);
|
157
157
|
}, [onFocus, checkOverflow, checkValue]);
|
158
158
|
const onInputChange = React.useCallback(e => {
|
159
159
|
checkValue(e.target);
|
160
160
|
checkOverflow(e.target);
|
161
|
-
onChange === null || onChange ===
|
161
|
+
onChange === null || onChange === void 0 || onChange(e);
|
162
162
|
}, [onChange, checkOverflow, checkValue]);
|
163
163
|
const onInputScroll = React.useCallback(e => {
|
164
164
|
checkOverflow(e.target);
|
165
|
-
onScroll === null || onScroll ===
|
165
|
+
onScroll === null || onScroll === void 0 || onScroll(e);
|
166
166
|
}, [onScroll, checkOverflow]);
|
167
167
|
const onInputBlur = React.useCallback(e => {
|
168
168
|
setIsInFocus(false);
|
169
|
-
onBlur === null || onBlur ===
|
169
|
+
onBlur === null || onBlur === void 0 || onBlur(e);
|
170
170
|
}, [onBlur]);
|
171
171
|
useEffect(() => {
|
172
172
|
window.addEventListener('mousemove', onMouseMove);
|
@@ -13,7 +13,7 @@ function focusSensorHOC(ComposedComponent) {
|
|
13
13
|
_defineProperty(this, "state", {
|
14
14
|
focused: this.props.focused
|
15
15
|
});
|
16
|
-
_defineProperty(this, "node",
|
16
|
+
_defineProperty(this, "node", void 0);
|
17
17
|
_defineProperty(this, "_skipNextCapture", false);
|
18
18
|
_defineProperty(this, "onRefUpdate", node => {
|
19
19
|
if (node) {
|
@@ -30,13 +30,13 @@ function focusSensorHOC(ComposedComponent) {
|
|
30
30
|
this._skipNextCapture = false;
|
31
31
|
return;
|
32
32
|
}
|
33
|
-
const focused = target instanceof Node && ((_this$node = this.node) === null || _this$node ===
|
33
|
+
const focused = target instanceof Node && ((_this$node = this.node) === null || _this$node === void 0 ? void 0 : _this$node.contains(target));
|
34
34
|
if (focused && !this.state.focused) {
|
35
35
|
var _this$props$onFocus, _this$props;
|
36
36
|
this.setState({
|
37
37
|
focused: true
|
38
38
|
});
|
39
|
-
(_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus ===
|
39
|
+
(_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 || _this$props$onFocus.call(_this$props);
|
40
40
|
}
|
41
41
|
});
|
42
42
|
_defineProperty(this, "onBlurCapture", _ref2 => {
|
@@ -51,13 +51,13 @@ function focusSensorHOC(ComposedComponent) {
|
|
51
51
|
} = this;
|
52
52
|
if (focused) {
|
53
53
|
setTimeout(() => {
|
54
|
-
const blurred = target instanceof Node && (node === null || node ===
|
54
|
+
const blurred = target instanceof Node && (node === null || node === void 0 ? void 0 : node.contains(target)) && !node.contains(document.activeElement);
|
55
55
|
if (blurred) {
|
56
56
|
var _this$props$onBlur, _this$props2;
|
57
57
|
this.setState({
|
58
58
|
focused: false
|
59
59
|
});
|
60
|
-
(_this$props$onBlur = (_this$props2 = this.props).onBlur) === null || _this$props$onBlur ===
|
60
|
+
(_this$props$onBlur = (_this$props2 = this.props).onBlur) === null || _this$props$onBlur === void 0 || _this$props$onBlur.call(_this$props2);
|
61
61
|
}
|
62
62
|
}, 1);
|
63
63
|
}
|
@@ -65,13 +65,13 @@ function focusSensorHOC(ComposedComponent) {
|
|
65
65
|
_defineProperty(this, "onFocusRestore", () => {
|
66
66
|
var _this$node2;
|
67
67
|
this._skipNextCapture = true;
|
68
|
-
(_this$node2 = this.node) === null || _this$node2 ===
|
68
|
+
(_this$node2 = this.node) === null || _this$node2 === void 0 || _this$node2.focus({
|
69
69
|
preventScroll: !this.props.scrollOnTableFocus
|
70
70
|
});
|
71
71
|
});
|
72
72
|
_defineProperty(this, "onFocusReset", () => {
|
73
73
|
var _this$node3;
|
74
|
-
(_this$node3 = this.node) === null || _this$node3 ===
|
74
|
+
(_this$node3 = this.node) === null || _this$node3 === void 0 || _this$node3.blur();
|
75
75
|
});
|
76
76
|
}
|
77
77
|
componentDidMount() {
|
@@ -82,14 +82,14 @@ function focusSensorHOC(ComposedComponent) {
|
|
82
82
|
},
|
83
83
|
node
|
84
84
|
} = this;
|
85
|
-
node === null || node ===
|
85
|
+
node === null || node === void 0 || node.setAttribute('tabindex', '0');
|
86
86
|
if (node != null) {
|
87
87
|
node.style.outline = 'none';
|
88
88
|
}
|
89
89
|
document.addEventListener('focus', this.onFocusCapture, true);
|
90
90
|
document.addEventListener('blur', this.onBlurCapture, true);
|
91
91
|
if (autofocus) {
|
92
|
-
node === null || node ===
|
92
|
+
node === null || node === void 0 || node.focus({
|
93
93
|
preventScroll: !scrollOnTableFocus
|
94
94
|
});
|
95
95
|
}
|
@@ -99,7 +99,7 @@ function focusSensorHOC(ComposedComponent) {
|
|
99
99
|
const {
|
100
100
|
focused
|
101
101
|
} = this.props;
|
102
|
-
const isInFocus = (_this$node4 = this.node) === null || _this$node4 ===
|
102
|
+
const isInFocus = (_this$node4 = this.node) === null || _this$node4 === void 0 ? void 0 : _this$node4.contains(document.activeElement);
|
103
103
|
if (focused && (!isInFocus || !prevProps.focused)) {
|
104
104
|
this.onFocusRestore();
|
105
105
|
} else if (!focused && prevProps.focused) {
|
@@ -5,7 +5,7 @@ function memoize(fn) {
|
|
5
5
|
const primitiveCache = new Map();
|
6
6
|
const objectCache = new WeakMap();
|
7
7
|
return function memoized(arg) {
|
8
|
-
const key = arg !== null && arg !==
|
8
|
+
const key = arg !== null && arg !== void 0 ? arg : '__singleValue__';
|
9
9
|
const cache = key instanceof Object ? objectCache : primitiveCache;
|
10
10
|
const cached = cache.get(key);
|
11
11
|
if (cached != null) {
|