@jetbrains/ring-ui 5.0.93 → 5.0.95
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/date-picker/date-popup.js +7 -1
- package/components/date-picker/months.js +1 -2
- package/components/query-assist/query-assist.css +12 -6
- package/components/query-assist/query-assist.js +5 -2
- package/dist/_helpers/query-assist__suggestions.js +1 -1
- package/dist/date-picker/date-picker.js +1 -0
- package/dist/date-picker/date-popup.js +7 -1
- package/dist/date-picker/months.js +1 -2
- package/dist/query-assist/query-assist.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -4,6 +4,7 @@ import isAfter from 'date-fns/isAfter';
|
|
|
4
4
|
import isBefore from 'date-fns/isBefore';
|
|
5
5
|
import isSameDay from 'date-fns/isSameDay';
|
|
6
6
|
import startOfDay from 'date-fns/startOfDay';
|
|
7
|
+
import { set } from 'date-fns';
|
|
7
8
|
import memoize from '../global/memoize';
|
|
8
9
|
import DateInput from './date-input';
|
|
9
10
|
import Months from './months';
|
|
@@ -105,7 +106,12 @@ export default class DatePopup extends Component {
|
|
|
105
106
|
text: null,
|
|
106
107
|
scrollDate: null
|
|
107
108
|
});
|
|
108
|
-
|
|
109
|
+
const adjustedDate = changes.date && set(new Date(), {
|
|
110
|
+
year: changes.date.getFullYear(),
|
|
111
|
+
month: changes.date.getMonth(),
|
|
112
|
+
date: changes.date.getDate()
|
|
113
|
+
});
|
|
114
|
+
this.props.onChange(adjustedDate);
|
|
109
115
|
this.props.onComplete();
|
|
110
116
|
}
|
|
111
117
|
else if (!range && withTime) {
|
|
@@ -36,8 +36,7 @@ let dy = 0;
|
|
|
36
36
|
export default function Months(props) {
|
|
37
37
|
const { scrollDate } = props;
|
|
38
38
|
const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
|
|
39
|
-
|
|
40
|
-
const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
|
|
39
|
+
const monthStart = startOfMonth(monthDate);
|
|
41
40
|
let month = subMonths(monthStart, MONTHSBACK);
|
|
42
41
|
const months = [month];
|
|
43
42
|
for (let i = 0; i < MONTHSBACK * DOUBLE; i++) {
|
|
@@ -242,12 +242,6 @@
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
.loaderOnTheRight {
|
|
246
|
-
right: 1px;
|
|
247
|
-
|
|
248
|
-
left: auto;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
245
|
.input::-webkit-scrollbar {
|
|
252
246
|
display: none;
|
|
253
247
|
}
|
|
@@ -263,3 +257,15 @@
|
|
|
263
257
|
.loaderActive {
|
|
264
258
|
padding-right: calc(var(--ring-input-padding-inline) - var(--ring-input-padding-block));
|
|
265
259
|
}
|
|
260
|
+
|
|
261
|
+
.loaderOnTheRight {
|
|
262
|
+
padding-right: 0;
|
|
263
|
+
|
|
264
|
+
@nest [dir=rtl] & {
|
|
265
|
+
padding-left: 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.inputRevertOrder {
|
|
270
|
+
order: -1;
|
|
271
|
+
}
|
|
@@ -777,7 +777,8 @@ export default class QueryAssist extends Component {
|
|
|
777
777
|
const inputClasses = classNames(this.props.inputClassName, {
|
|
778
778
|
[`${styles.input} ring-js-shortcuts`]: true,
|
|
779
779
|
[styles.inputGap]: actions.length || this.isRenderingGlassOrLoader() && !glass,
|
|
780
|
-
[styles.inputGap2]: actions.length === 2
|
|
780
|
+
[styles.inputGap2]: actions.length === 2,
|
|
781
|
+
[styles.inputRevertOrder]: !glass
|
|
781
782
|
});
|
|
782
783
|
const placeholderStyles = classNames({
|
|
783
784
|
[styles.placeholder]: true,
|
|
@@ -804,7 +805,9 @@ export default class QueryAssist extends Component {
|
|
|
804
805
|
{this.props.placeholder}
|
|
805
806
|
</button>)}
|
|
806
807
|
|
|
807
|
-
{actions
|
|
808
|
+
{actions.length
|
|
809
|
+
? (<div data-test="ring-query-assist-actions" className={styles.actions}>{actions}</div>)
|
|
810
|
+
: null}
|
|
808
811
|
|
|
809
812
|
<PopupMenu hidden={!this.state.showPopup} onCloseAttempt={this.closePopup} ref={this.popupRef} anchorElement={this.node} keepMounted attached className={this.props.popupClassName} directions={[PopupMenu.PopupProps.Directions.BOTTOM_RIGHT]} data={useCustomItemRender ? this.state.suggestions : this.renderSuggestions()} data-test="ring-query-assist-popup" hint={this.props.hint} hintOnSelection={this.props.hintOnSelection} left={this.getPopupOffset(this.state.suggestions)} maxHeight={PopupMenu.PopupProps.MaxHeight.SCREEN} onMouseDown={this.trackPopupMouseState} onMouseUp={this.trackPopupMouseState} onSelect={item => this.handleComplete(item)}/>
|
|
810
813
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import List from '../list/list.js';
|
|
3
3
|
|
|
4
|
-
var modules_da7ab055 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"var(--ring-button-height)","loaderWidth":"64px","overInputZIndex":"2","inputGap":"24px","light":"light_rui_d22e","heightS":"heightS_rui_d22e","heightM":"heightM_rui_d22e","heightL":"heightL_rui_d22e","button":"button_rui_d22e","active":"active_rui_d22e","withIcon":"withIcon_rui_d22e","icon":"icon_rui_d22e","primary":"primary_rui_d22e","loader":"loader_rui_d22e","loaderBackground":"loaderBackground_rui_d22e","danger":"danger_rui_d22e","text":"text_rui_d22e","content":"content_rui_d22e","text-loading":"text-loading_rui_d22e","inline":"inline_rui_d22e","withNormalIcon":"withNormalIcon_rui_d22e","withDangerIcon":"withDangerIcon_rui_d22e","progress":"progress_rui_d22e","delayed":"delayed_rui_d22e","short":"short_rui_d22e","dropdownIcon":"dropdownIcon_rui_d22e","queryAssist":"queryAssist_rui_d22e","error":"error_rui_d22e","queryAssistDisabled":"queryAssistDisabled_rui_d22e","huge":"huge_rui_d22e","actions":"actions_rui_d22e","input":"input_rui_d22e","letter-text":"letter-text_rui_d22e","letterDefault":"letterDefault_rui_d22e","letter-field-name":"letter-field-name_rui_d22e","letter-field-value":"letter-field-value_rui_d22e","letter-operator":"letter-operator_rui_d22e","letter-error":"letter-error_rui_d22e","highlight":"highlight_rui_d22e","service":"service_rui_d22e","placeholder":"placeholder_rui_d22e resetButton_rui_8bff","letter":"letter_rui_d22e","rightSearchButton":"rightSearchButton_rui_d22e","clear":"clear_rui_d22e","
|
|
4
|
+
var modules_da7ab055 = {"unit":"8px","button-shadow":"inset 0 0 0 1px","height":"var(--ring-button-height)","loaderWidth":"64px","overInputZIndex":"2","inputGap":"24px","light":"light_rui_d22e","heightS":"heightS_rui_d22e","heightM":"heightM_rui_d22e","heightL":"heightL_rui_d22e","button":"button_rui_d22e","active":"active_rui_d22e","withIcon":"withIcon_rui_d22e","icon":"icon_rui_d22e","primary":"primary_rui_d22e","loader":"loader_rui_d22e","loaderBackground":"loaderBackground_rui_d22e","danger":"danger_rui_d22e","text":"text_rui_d22e","content":"content_rui_d22e","text-loading":"text-loading_rui_d22e","inline":"inline_rui_d22e","withNormalIcon":"withNormalIcon_rui_d22e","withDangerIcon":"withDangerIcon_rui_d22e","progress":"progress_rui_d22e","delayed":"delayed_rui_d22e","short":"short_rui_d22e","dropdownIcon":"dropdownIcon_rui_d22e","queryAssist":"queryAssist_rui_d22e","error":"error_rui_d22e","queryAssistDisabled":"queryAssistDisabled_rui_d22e","huge":"huge_rui_d22e","actions":"actions_rui_d22e","input":"input_rui_d22e","letter-text":"letter-text_rui_d22e","letterDefault":"letterDefault_rui_d22e","letter-field-name":"letter-field-name_rui_d22e","letter-field-value":"letter-field-value_rui_d22e","letter-operator":"letter-operator_rui_d22e","letter-error":"letter-error_rui_d22e","highlight":"highlight_rui_d22e","service":"service_rui_d22e","placeholder":"placeholder_rui_d22e resetButton_rui_8bff","letter":"letter_rui_d22e","rightSearchButton":"rightSearchButton_rui_d22e","clear":"clear_rui_d22e","withoutGlass":"withoutGlass_rui_d22e","loaderActive":"loaderActive_rui_d22e","loaderOnTheRight":"loaderOnTheRight_rui_d22e","inputRevertOrder":"inputRevertOrder_rui_d22e"};
|
|
5
5
|
|
|
6
6
|
const ICON_ID_LENGTH = 44;
|
|
7
7
|
class QueryAssistSuggestions {
|
|
@@ -5,6 +5,7 @@ import isAfter from 'date-fns/isAfter';
|
|
|
5
5
|
import isBefore from 'date-fns/isBefore';
|
|
6
6
|
import isSameDay from 'date-fns/isSameDay';
|
|
7
7
|
import startOfDay from 'date-fns/startOfDay';
|
|
8
|
+
import { set } from 'date-fns';
|
|
8
9
|
import memoize from '../global/memoize.js';
|
|
9
10
|
import DateInput from './date-input.js';
|
|
10
11
|
import Months from './months.js';
|
|
@@ -228,7 +229,12 @@ class DatePopup extends Component {
|
|
|
228
229
|
text: null,
|
|
229
230
|
scrollDate: null
|
|
230
231
|
});
|
|
231
|
-
|
|
232
|
+
const adjustedDate = changes.date && set(new Date(), {
|
|
233
|
+
year: changes.date.getFullYear(),
|
|
234
|
+
month: changes.date.getMonth(),
|
|
235
|
+
date: changes.date.getDate()
|
|
236
|
+
});
|
|
237
|
+
this.props.onChange(adjustedDate);
|
|
232
238
|
this.props.onComplete();
|
|
233
239
|
} else if (!range && withTime) {
|
|
234
240
|
const date = this.parse(this.props.date, 'date');
|
|
@@ -62,8 +62,7 @@ function Months(props) {
|
|
|
62
62
|
scrollDate
|
|
63
63
|
} = props;
|
|
64
64
|
const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
|
|
65
|
-
|
|
66
|
-
const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
|
|
65
|
+
const monthStart = startOfMonth(monthDate);
|
|
67
66
|
let month = subMonths(monthStart, MONTHSBACK);
|
|
68
67
|
const months = [month];
|
|
69
68
|
for (let i = 0; i < MONTHSBACK * DOUBLE; i++) {
|
|
@@ -776,9 +776,9 @@ class QueryAssist extends Component {
|
|
|
776
776
|
const inputClasses = classNames(this.props.inputClassName, {
|
|
777
777
|
[`${modules_da7ab055.input} ring-js-shortcuts`]: true,
|
|
778
778
|
[modules_da7ab055.inputGap]: actions.length || this.isRenderingGlassOrLoader() && !glass,
|
|
779
|
-
[modules_da7ab055.inputGap2]: actions.length === 2
|
|
779
|
+
[modules_da7ab055.inputGap2]: actions.length === 2,
|
|
780
|
+
[modules_da7ab055.inputRevertOrder]: !glass
|
|
780
781
|
});
|
|
781
|
-
|
|
782
782
|
const placeholderStyles = classNames({
|
|
783
783
|
[modules_da7ab055.placeholder]: true,
|
|
784
784
|
[modules_da7ab055.withoutGlass]: !this.isRenderingGlassOrLoader() || !renderLoader && huge
|
|
@@ -832,10 +832,10 @@ class QueryAssist extends Component {
|
|
|
832
832
|
ref: this.placeholderRef,
|
|
833
833
|
onClick: this.handleCaretMove,
|
|
834
834
|
"data-test": "query-assist-placeholder"
|
|
835
|
-
}, this.props.placeholder), actions
|
|
835
|
+
}, this.props.placeholder), actions.length ? /*#__PURE__*/React.createElement("div", {
|
|
836
836
|
"data-test": "ring-query-assist-actions",
|
|
837
837
|
className: modules_da7ab055.actions
|
|
838
|
-
}, actions), /*#__PURE__*/React.createElement(PopupMenu, {
|
|
838
|
+
}, actions) : null, /*#__PURE__*/React.createElement(PopupMenu, {
|
|
839
839
|
hidden: !this.state.showPopup,
|
|
840
840
|
onCloseAttempt: this.closePopup,
|
|
841
841
|
ref: this.popupRef,
|