@hipay/hipay-material-ui 3.12.3-beta.0 → 3.13.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -117,7 +117,7 @@ var HiDateRangePicker = /*#__PURE__*/function (_React$Component) {
|
|
117
117
|
var today = (0, _momentTimezone.default)();
|
118
118
|
var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
119
119
|
|
120
|
-
if (change && day > todayDate) {
|
120
|
+
if (change && day > todayDate && _this.props.disableFutureDays) {
|
121
121
|
change = false;
|
122
122
|
}
|
123
123
|
|
@@ -131,11 +131,11 @@ function buildDateRangeInfo(t, from, to, format) {
|
|
131
131
|
|
132
132
|
|
133
133
|
switch (prefix) {
|
134
|
-
case
|
134
|
+
case 'week':
|
135
135
|
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(info);
|
136
136
|
break;
|
137
137
|
|
138
|
-
case
|
138
|
+
case 'quarter':
|
139
139
|
info = "".concat(t.short_quarter).concat(from.format('Q'), ", ").concat(info);
|
140
140
|
break;
|
141
141
|
|
@@ -186,7 +186,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
186
186
|
from = (0, _momentTimezone.default)().startOf('week');
|
187
187
|
to = (0, _momentTimezone.default)();
|
188
188
|
info = buildDateRangeInfo(t, from, to, format, {
|
189
|
-
prefix:
|
189
|
+
prefix: 'week',
|
190
190
|
toNow: true,
|
191
191
|
displayDays: true
|
192
192
|
});
|
@@ -197,7 +197,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
197
197
|
from = (0, _momentTimezone.default)().subtract(1, 'week').startOf('week');
|
198
198
|
to = (0, _momentTimezone.default)().subtract(1, 'week').endOf('week');
|
199
199
|
info = buildDateRangeInfo(t, from, to, format, {
|
200
|
-
prefix:
|
200
|
+
prefix: 'week',
|
201
201
|
toNow: false,
|
202
202
|
displayDays: true
|
203
203
|
});
|
@@ -227,7 +227,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
227
227
|
from = (0, _momentTimezone.default)().startOf('quarter');
|
228
228
|
to = (0, _momentTimezone.default)();
|
229
229
|
info = buildDateRangeInfo(t, from, to, format, {
|
230
|
-
prefix:
|
230
|
+
prefix: 'quarter',
|
231
231
|
toNow: true,
|
232
232
|
displayDays: true
|
233
233
|
});
|
@@ -238,7 +238,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
238
238
|
from = (0, _momentTimezone.default)().subtract(1, 'quarter').startOf('quarter');
|
239
239
|
to = (0, _momentTimezone.default)().subtract(1, 'quarter').endOf('quarter');
|
240
240
|
info = buildDateRangeInfo(t, from, to, format, {
|
241
|
-
prefix:
|
241
|
+
prefix: 'quarter',
|
242
242
|
toNow: false,
|
243
243
|
displayDays: true
|
244
244
|
});
|
@@ -255,11 +255,11 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
255
255
|
});
|
256
256
|
break;
|
257
257
|
|
258
|
-
case
|
259
|
-
label =
|
258
|
+
case '1':
|
259
|
+
label = '24h';
|
260
260
|
from = (0, _momentTimezone.default)().subtract(1, 'day');
|
261
261
|
to = (0, _momentTimezone.default)();
|
262
|
-
info = "".concat(t.from, " ").concat(from.format(
|
262
|
+
info = "".concat(t.from, " ").concat(from.format('HH:mm'), " ").concat(t.yesterday.toLowerCase(), " ").concat(t.to_now);
|
263
263
|
break;
|
264
264
|
|
265
265
|
default:
|
@@ -327,7 +327,7 @@ var styles = function styles(theme) {
|
|
327
327
|
},
|
328
328
|
formControlLabel: {
|
329
329
|
top: theme.spacing(5),
|
330
|
-
overflow:
|
330
|
+
overflow: 'unset'
|
331
331
|
}
|
332
332
|
};
|
333
333
|
};
|
@@ -352,7 +352,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
352
352
|
var _this;
|
353
353
|
|
354
354
|
(0, _classCallCheck2.default)(this, HiDateRangeSelector);
|
355
|
-
_this = _super.call(this);
|
355
|
+
_this = _super.call(this, props);
|
356
356
|
_this.options = [];
|
357
357
|
|
358
358
|
_this.handleBlur = function (event) {
|
@@ -441,8 +441,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
441
441
|
|
442
442
|
if (customOptionsAvailable.length) {
|
443
443
|
options.push({
|
444
|
-
id:
|
445
|
-
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ?
|
444
|
+
id: 'custom_periods_subheader',
|
445
|
+
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
446
446
|
icon: _ref2,
|
447
447
|
label: translations.custom_periods,
|
448
448
|
children: this.options.filter(function (o) {
|
@@ -454,8 +454,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
454
454
|
|
455
455
|
if (presetOptionsAvailable.length) {
|
456
456
|
options.push({
|
457
|
-
id:
|
458
|
-
type: PRESET_PERIOD_LIST.includes(selectedPreset) ?
|
457
|
+
id: 'preset_periods_subheader',
|
458
|
+
type: PRESET_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
459
459
|
icon: _ref3,
|
460
460
|
label: translations.preset_periods,
|
461
461
|
children: this.options.filter(function (o) {
|
@@ -467,8 +467,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
467
467
|
|
468
468
|
if (slidingOptionsAvailable.length) {
|
469
469
|
options.push({
|
470
|
-
id:
|
471
|
-
type: SLIDING_PERIOD_LIST.includes(selectedPreset) ?
|
470
|
+
id: 'sliding_periods_subheader',
|
471
|
+
type: SLIDING_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
472
472
|
icon: _ref4,
|
473
473
|
label: translations.sliding_periods,
|
474
474
|
children: this.options.filter(function (o) {
|
@@ -497,6 +497,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
497
497
|
idRange = _this$props2.idRange,
|
498
498
|
idSelect = _this$props2.idSelect,
|
499
499
|
minimumDate = _this$props2.minimumDate,
|
500
|
+
disableFutureDays = _this$props2.disableFutureDays,
|
500
501
|
label = _this$props2.label,
|
501
502
|
from = _this$props2.from,
|
502
503
|
onChange = _this$props2.onChange,
|
@@ -507,7 +508,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
507
508
|
selectProps = _this$props2.selectProps,
|
508
509
|
staticPosition = _this$props2.staticPosition,
|
509
510
|
className = _this$props2.className,
|
510
|
-
props = (0, _objectWithoutProperties2.default)(_this$props2, ["availableOptionKeys", "disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition", "className"]);
|
511
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, ["availableOptionKeys", "disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "disableFutureDays", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition", "className"]);
|
511
512
|
var _this$state = this.state,
|
512
513
|
selectedPreset = _this$state.selectedPreset,
|
513
514
|
containerWidth = _this$state.containerWidth;
|
@@ -577,6 +578,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
577
578
|
onChange: onChange,
|
578
579
|
toError: toError,
|
579
580
|
fromError: fromError,
|
581
|
+
disableFutureDays: disableFutureDays,
|
580
582
|
minimumDate: minimumDate,
|
581
583
|
errorText: null,
|
582
584
|
onReset: this.handleReset,
|
@@ -604,6 +606,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
604
606
|
|
605
607
|
HiDateRangeSelector.defaultProps = {
|
606
608
|
availableOptionKeys: [].concat(PRESET_PERIOD_LIST, CUSTOM_PERIOD_LIST),
|
609
|
+
disableFutureDays: true,
|
607
610
|
enableTime: false,
|
608
611
|
returnSelectValue: false,
|
609
612
|
staticPosition: false,
|
@@ -638,7 +641,7 @@ HiDateRangeSelector.defaultProps = {
|
|
638
641
|
current_quarter: 'Current Quarter',
|
639
642
|
previous_quarter: 'Previous Quarter',
|
640
643
|
current_year: 'Current Year',
|
641
|
-
year_on_year:
|
644
|
+
year_on_year: 'Last twelve months',
|
642
645
|
invalid_format: 'The date format is not valid',
|
643
646
|
to_superior_from: 'Date from cannot be greater than date to',
|
644
647
|
date_superior_max_date: 'Date from cannot be greater than %s',
|
@@ -647,7 +650,7 @@ HiDateRangeSelector.defaultProps = {
|
|
647
650
|
missing_date_to: 'Missing date to',
|
648
651
|
preset_periods: 'Preset periods',
|
649
652
|
custom_periods: 'Custom periods',
|
650
|
-
custom_period_info:
|
653
|
+
custom_period_info: 'Select a custom period',
|
651
654
|
sliding_periods: 'Sliding periods'
|
652
655
|
}
|
653
656
|
};
|
@@ -117,7 +117,7 @@ var HiDateRangePicker = /*#__PURE__*/function (_React$Component) {
|
|
117
117
|
var today = (0, _momentTimezone.default)();
|
118
118
|
var todayDate = new Date(today.year(), today.month(), today.date(), 23, 59, 59);
|
119
119
|
|
120
|
-
if (change && day > todayDate) {
|
120
|
+
if (change && day > todayDate && _this.props.disableFutureDays) {
|
121
121
|
change = false;
|
122
122
|
}
|
123
123
|
|
@@ -131,11 +131,11 @@ function buildDateRangeInfo(t, from, to, format) {
|
|
131
131
|
|
132
132
|
|
133
133
|
switch (prefix) {
|
134
|
-
case
|
134
|
+
case 'week':
|
135
135
|
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(info);
|
136
136
|
break;
|
137
137
|
|
138
|
-
case
|
138
|
+
case 'quarter':
|
139
139
|
info = "".concat(t.short_quarter).concat(from.format('Q'), ", ").concat(info);
|
140
140
|
break;
|
141
141
|
|
@@ -186,7 +186,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
186
186
|
from = (0, _momentTimezone.default)().startOf('week');
|
187
187
|
to = (0, _momentTimezone.default)();
|
188
188
|
info = buildDateRangeInfo(t, from, to, format, {
|
189
|
-
prefix:
|
189
|
+
prefix: 'week',
|
190
190
|
toNow: true,
|
191
191
|
displayDays: true
|
192
192
|
});
|
@@ -197,7 +197,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
197
197
|
from = (0, _momentTimezone.default)().subtract(1, 'week').startOf('week');
|
198
198
|
to = (0, _momentTimezone.default)().subtract(1, 'week').endOf('week');
|
199
199
|
info = buildDateRangeInfo(t, from, to, format, {
|
200
|
-
prefix:
|
200
|
+
prefix: 'week',
|
201
201
|
toNow: false,
|
202
202
|
displayDays: true
|
203
203
|
});
|
@@ -227,7 +227,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
227
227
|
from = (0, _momentTimezone.default)().startOf('quarter');
|
228
228
|
to = (0, _momentTimezone.default)();
|
229
229
|
info = buildDateRangeInfo(t, from, to, format, {
|
230
|
-
prefix:
|
230
|
+
prefix: 'quarter',
|
231
231
|
toNow: true,
|
232
232
|
displayDays: true
|
233
233
|
});
|
@@ -238,7 +238,7 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
238
238
|
from = (0, _momentTimezone.default)().subtract(1, 'quarter').startOf('quarter');
|
239
239
|
to = (0, _momentTimezone.default)().subtract(1, 'quarter').endOf('quarter');
|
240
240
|
info = buildDateRangeInfo(t, from, to, format, {
|
241
|
-
prefix:
|
241
|
+
prefix: 'quarter',
|
242
242
|
toNow: false,
|
243
243
|
displayDays: true
|
244
244
|
});
|
@@ -255,11 +255,11 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
255
255
|
});
|
256
256
|
break;
|
257
257
|
|
258
|
-
case
|
259
|
-
label =
|
258
|
+
case '1':
|
259
|
+
label = '24h';
|
260
260
|
from = (0, _momentTimezone.default)().subtract(1, 'day');
|
261
261
|
to = (0, _momentTimezone.default)();
|
262
|
-
info = "".concat(t.from, " ").concat(from.format(
|
262
|
+
info = "".concat(t.from, " ").concat(from.format('HH:mm'), " ").concat(t.yesterday.toLowerCase(), " ").concat(t.to_now);
|
263
263
|
break;
|
264
264
|
|
265
265
|
default:
|
@@ -327,7 +327,7 @@ var styles = function styles(theme) {
|
|
327
327
|
},
|
328
328
|
formControlLabel: {
|
329
329
|
top: theme.spacing(5),
|
330
|
-
overflow:
|
330
|
+
overflow: 'unset'
|
331
331
|
}
|
332
332
|
};
|
333
333
|
};
|
@@ -352,7 +352,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
352
352
|
var _this;
|
353
353
|
|
354
354
|
(0, _classCallCheck2.default)(this, HiDateRangeSelector);
|
355
|
-
_this = _super.call(this);
|
355
|
+
_this = _super.call(this, props);
|
356
356
|
_this.options = [];
|
357
357
|
|
358
358
|
_this.handleBlur = function (event) {
|
@@ -441,8 +441,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
441
441
|
|
442
442
|
if (customOptionsAvailable.length) {
|
443
443
|
options.push({
|
444
|
-
id:
|
445
|
-
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ?
|
444
|
+
id: 'custom_periods_subheader',
|
445
|
+
type: CUSTOM_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
446
446
|
icon: _ref2,
|
447
447
|
label: translations.custom_periods,
|
448
448
|
children: this.options.filter(function (o) {
|
@@ -454,8 +454,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
454
454
|
|
455
455
|
if (presetOptionsAvailable.length) {
|
456
456
|
options.push({
|
457
|
-
id:
|
458
|
-
type: PRESET_PERIOD_LIST.includes(selectedPreset) ?
|
457
|
+
id: 'preset_periods_subheader',
|
458
|
+
type: PRESET_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
459
459
|
icon: _ref3,
|
460
460
|
label: translations.preset_periods,
|
461
461
|
children: this.options.filter(function (o) {
|
@@ -467,8 +467,8 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
467
467
|
|
468
468
|
if (slidingOptionsAvailable.length) {
|
469
469
|
options.push({
|
470
|
-
id:
|
471
|
-
type: SLIDING_PERIOD_LIST.includes(selectedPreset) ?
|
470
|
+
id: 'sliding_periods_subheader',
|
471
|
+
type: SLIDING_PERIOD_LIST.includes(selectedPreset) ? 'primary-highlight' : 'highlight',
|
472
472
|
icon: _ref4,
|
473
473
|
label: translations.sliding_periods,
|
474
474
|
children: this.options.filter(function (o) {
|
@@ -497,6 +497,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
497
497
|
idRange = _this$props2.idRange,
|
498
498
|
idSelect = _this$props2.idSelect,
|
499
499
|
minimumDate = _this$props2.minimumDate,
|
500
|
+
disableFutureDays = _this$props2.disableFutureDays,
|
500
501
|
label = _this$props2.label,
|
501
502
|
from = _this$props2.from,
|
502
503
|
onChange = _this$props2.onChange,
|
@@ -507,7 +508,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
507
508
|
selectProps = _this$props2.selectProps,
|
508
509
|
staticPosition = _this$props2.staticPosition,
|
509
510
|
className = _this$props2.className,
|
510
|
-
props = (0, _objectWithoutProperties2.default)(_this$props2, ["availableOptionKeys", "disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition", "className"]);
|
511
|
+
props = (0, _objectWithoutProperties2.default)(_this$props2, ["availableOptionKeys", "disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "disableFutureDays", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition", "className"]);
|
511
512
|
var _this$state = this.state,
|
512
513
|
selectedPreset = _this$state.selectedPreset,
|
513
514
|
containerWidth = _this$state.containerWidth;
|
@@ -577,6 +578,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
577
578
|
onChange: onChange,
|
578
579
|
toError: toError,
|
579
580
|
fromError: fromError,
|
581
|
+
disableFutureDays: disableFutureDays,
|
580
582
|
minimumDate: minimumDate,
|
581
583
|
errorText: null,
|
582
584
|
onReset: this.handleReset,
|
@@ -604,6 +606,7 @@ var HiDateRangeSelector = /*#__PURE__*/function (_React$Component) {
|
|
604
606
|
|
605
607
|
HiDateRangeSelector.defaultProps = {
|
606
608
|
availableOptionKeys: [].concat(PRESET_PERIOD_LIST, CUSTOM_PERIOD_LIST),
|
609
|
+
disableFutureDays: true,
|
607
610
|
enableTime: false,
|
608
611
|
returnSelectValue: false,
|
609
612
|
staticPosition: false,
|
@@ -638,7 +641,7 @@ HiDateRangeSelector.defaultProps = {
|
|
638
641
|
current_quarter: 'Current Quarter',
|
639
642
|
previous_quarter: 'Previous Quarter',
|
640
643
|
current_year: 'Current Year',
|
641
|
-
year_on_year:
|
644
|
+
year_on_year: 'Last twelve months',
|
642
645
|
invalid_format: 'The date format is not valid',
|
643
646
|
to_superior_from: 'Date from cannot be greater than date to',
|
644
647
|
date_superior_max_date: 'Date from cannot be greater than %s',
|
@@ -647,7 +650,7 @@ HiDateRangeSelector.defaultProps = {
|
|
647
650
|
missing_date_to: 'Missing date to',
|
648
651
|
preset_periods: 'Preset periods',
|
649
652
|
custom_periods: 'Custom periods',
|
650
|
-
custom_period_info:
|
653
|
+
custom_period_info: 'Select a custom period',
|
651
654
|
sliding_periods: 'Sliding periods'
|
652
655
|
}
|
653
656
|
};
|