@rolster/react-components 18.13.5 → 18.14.1
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/dist/cjs/assets/{index-LjAadYQE.css → index--xgdaD5z.css} +460 -468
- package/dist/cjs/index.js +1023 -1025
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-LjAadYQE.css → index--xgdaD5z.css} +460 -468
- package/dist/es/index.js +1004 -1007
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.css +2 -2
- package/dist/esm/components/atoms/Input/Input.js +1 -8
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.css +0 -2
- package/dist/esm/components/atoms/InputNumber/InputNumber.css +0 -2
- package/dist/esm/components/atoms/InputPassword/InputPassword.css +0 -2
- package/dist/esm/components/atoms/InputText/InputText.css +0 -2
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.css +6 -0
- package/dist/esm/components/molecules/{MoneyField/MoneyField.d.ts → FieldMoney/FieldMoney.d.ts} +3 -3
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +13 -0
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -0
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.css +6 -0
- package/dist/esm/components/molecules/{NumberField/NumberField.d.ts → FieldNumber/FieldNumber.d.ts} +3 -3
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +13 -0
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -0
- package/dist/esm/components/molecules/{PasswordField/PasswordField.css → FieldPassword/FieldPassword.css} +3 -3
- package/dist/esm/components/molecules/{PasswordField/PasswordField.d.ts → FieldPassword/FieldPassword.d.ts} +3 -3
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js +18 -0
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js.map +1 -0
- package/dist/esm/components/molecules/FieldText/FieldText.css +6 -0
- package/dist/esm/components/molecules/{TextField/TextField.d.ts → FieldText/FieldText.d.ts} +3 -3
- package/dist/esm/components/molecules/FieldText/FieldText.js +13 -0
- package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -0
- package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.css → LabelCheckBox/LabelCheckBox.css} +5 -5
- package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.d.ts → LabelCheckBox/LabelCheckBox.d.ts} +3 -3
- package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.js → LabelCheckBox/LabelCheckBox.js} +5 -5
- package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.js.map → LabelCheckBox/LabelCheckBox.js.map} +1 -1
- package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.css → LabelRadioButton/LabelRadioButton.css} +5 -5
- package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.d.ts → LabelRadioButton/LabelRadioButton.d.ts} +3 -3
- package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.js → LabelRadioButton/LabelRadioButton.js} +5 -5
- package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.js.map → LabelRadioButton/LabelRadioButton.js.map} +1 -1
- package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.css → LabelSwitch/LabelSwitch.css} +5 -5
- package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.d.ts → LabelSwitch/LabelSwitch.d.ts} +3 -3
- package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.js → LabelSwitch/LabelSwitch.js} +4 -4
- package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.js.map → LabelSwitch/LabelSwitch.js.map} +1 -1
- package/dist/esm/components/molecules/MessageFormError/MesageFormError.css +0 -0
- package/dist/esm/components/molecules/MessageFormError/MesageFormError.d.ts +7 -0
- package/dist/esm/components/molecules/MessageFormError/MesageFormError.js +6 -0
- package/dist/esm/components/molecules/MessageFormError/MesageFormError.js.map +1 -0
- package/dist/esm/components/molecules/{DayPicker/DayPicker.css → PickerDay/PickerDay.css} +13 -13
- package/dist/esm/components/molecules/{DayPicker/DayPicker.d.ts → PickerDay/PickerDay.d.ts} +3 -3
- package/dist/esm/components/molecules/{DayPicker/DayPicker.js → PickerDay/PickerDay.js} +5 -5
- package/dist/esm/components/molecules/{DayPicker/DayPicker.js.map → PickerDay/PickerDay.js.map} +1 -1
- package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.css → PickerDayRange/PickerDayRange.css} +14 -14
- package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.d.ts → PickerDayRange/PickerDayRange.d.ts} +3 -3
- package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.js → PickerDayRange/PickerDayRange.js} +5 -5
- package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.js.map → PickerDayRange/PickerDayRange.js.map} +1 -1
- package/dist/esm/components/molecules/{MonthPicker/MonthPicker.css → PickerMonth/PickerMonth.css} +8 -8
- package/dist/esm/components/molecules/{MonthPicker/MonthPicker.d.ts → PickerMonth/PickerMonth.d.ts} +3 -3
- package/dist/esm/components/molecules/{MonthPicker/MonthPicker.js → PickerMonth/PickerMonth.js} +5 -5
- package/dist/esm/components/molecules/{MonthPicker/MonthPicker.js.map → PickerMonth/PickerMonth.js.map} +1 -1
- package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.css → PickerMonthTitle/PickerMonthTitle.css} +3 -3
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.d.ts +15 -0
- package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.js → PickerMonthTitle/PickerMonthTitle.js} +5 -5
- package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.js.map → PickerMonthTitle/PickerMonthTitle.js.map} +1 -1
- package/dist/esm/components/molecules/{YearPicker/YearPicker.css → PickerYear/PickerYear.css} +14 -14
- package/dist/esm/components/molecules/{YearPicker/YearPicker.d.ts → PickerYear/PickerYear.d.ts} +3 -3
- package/dist/esm/components/molecules/{YearPicker/YearPicker.js → PickerYear/PickerYear.js} +5 -5
- package/dist/esm/components/molecules/{YearPicker/YearPicker.js.map → PickerYear/PickerYear.js.map} +1 -1
- package/dist/esm/components/molecules/index.d.ts +13 -12
- package/dist/esm/components/molecules/index.js +13 -12
- package/dist/esm/components/molecules/index.js.map +1 -1
- package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.css → FieldAutocomplete/FieldAutocomplete.css} +15 -15
- package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.d.ts → FieldAutocomplete/FieldAutocomplete.d.ts} +5 -5
- package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.js → FieldAutocomplete/FieldAutocomplete.js} +13 -13
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -0
- package/dist/esm/components/organisms/{AutocompleteField/AutocompleteFieldHook.d.ts → FieldAutocomplete/FieldAutocompleteHook.d.ts} +3 -3
- package/dist/esm/components/organisms/{AutocompleteField/AutocompleteFieldHook.js → FieldAutocomplete/FieldAutocompleteHook.js} +2 -2
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js.map +1 -0
- package/dist/esm/components/organisms/{DateField/DateField.css → FieldDate/FieldDate.css} +8 -8
- package/dist/esm/components/organisms/{DateField/DateField.d.ts → FieldDate/FieldDate.d.ts} +3 -3
- package/dist/esm/components/organisms/{DateField/DateField.js → FieldDate/FieldDate.js} +7 -6
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -0
- package/dist/esm/components/organisms/{DateRangeField/DateRangeField.css → FieldDateRange/FieldDateRange.css} +6 -6
- package/dist/esm/components/organisms/{DateRangeField/DateRangeField.d.ts → FieldDateRange/FieldDateRange.d.ts} +3 -3
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +34 -0
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.css +10 -0
- package/dist/esm/components/organisms/{SelectField/SelectField.d.ts → FieldSelect/FieldSelect.d.ts} +5 -5
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +27 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -0
- package/dist/esm/components/organisms/{SelectField/SelectFieldHook.d.ts → FieldSelect/FieldSelectHook.d.ts} +3 -3
- package/dist/esm/components/organisms/{SelectField/SelectFieldHook.js → FieldSelect/FieldSelectHook.js} +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js.map +1 -0
- package/dist/esm/components/organisms/{DatePicker/DatePicker.css → PickerDate/PickerDate.css} +17 -17
- package/dist/esm/components/organisms/{DatePicker/DatePicker.d.ts → PickerDate/PickerDate.d.ts} +3 -3
- package/dist/esm/components/organisms/{DatePicker/DatePicker.js → PickerDate/PickerDate.js} +6 -6
- package/dist/esm/components/organisms/{DatePicker/DatePicker.js.map → PickerDate/PickerDate.js.map} +1 -1
- package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.css → PickerDateRange/PickerDateRange.css} +16 -16
- package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.d.ts → PickerDateRange/PickerDateRange.d.ts} +3 -3
- package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.js → PickerDateRange/PickerDateRange.js} +7 -7
- package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.js.map → PickerDateRange/PickerDateRange.js.map} +1 -1
- package/dist/esm/components/organisms/index.d.ts +6 -6
- package/dist/esm/components/organisms/index.js +6 -6
- package/dist/esm/components/organisms/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/components/molecules/MoneyField/MoneyField.css +0 -6
- package/dist/esm/components/molecules/MoneyField/MoneyField.js +0 -12
- package/dist/esm/components/molecules/MoneyField/MoneyField.js.map +0 -1
- package/dist/esm/components/molecules/MonthTitlePicker/MonthTitlePicker.d.ts +0 -15
- package/dist/esm/components/molecules/NumberField/NumberField.css +0 -6
- package/dist/esm/components/molecules/NumberField/NumberField.js +0 -12
- package/dist/esm/components/molecules/NumberField/NumberField.js.map +0 -1
- package/dist/esm/components/molecules/PasswordField/PasswordField.js +0 -17
- package/dist/esm/components/molecules/PasswordField/PasswordField.js.map +0 -1
- package/dist/esm/components/molecules/TextField/TextField.css +0 -6
- package/dist/esm/components/molecules/TextField/TextField.js +0 -12
- package/dist/esm/components/molecules/TextField/TextField.js.map +0 -1
- package/dist/esm/components/organisms/AutocompleteField/AutocompleteField.js.map +0 -1
- package/dist/esm/components/organisms/AutocompleteField/AutocompleteFieldHook.js.map +0 -1
- package/dist/esm/components/organisms/DateField/DateField.js.map +0 -1
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.js +0 -33
- package/dist/esm/components/organisms/DateRangeField/DateRangeField.js.map +0 -1
- package/dist/esm/components/organisms/SelectField/SelectField.css +0 -10
- package/dist/esm/components/organisms/SelectField/SelectField.js +0 -27
- package/dist/esm/components/organisms/SelectField/SelectField.js.map +0 -1
- package/dist/esm/components/organisms/SelectField/SelectFieldHook.js.map +0 -1
package/dist/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useRef, useEffect, createContext } from 'react';
|
|
3
3
|
import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/helpers-advanced';
|
|
4
|
-
import { dateIsBefore, normalizeMinTime, dateIsAfter, normalizeMaxTime, getDaysOfMonth, getDateWeight, dateIsEqualsWeight, dateIsBetween, assignDayInDate, Month, MONTH_NAMES, DAY_LABELS, DateRange, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/helpers-date';
|
|
5
4
|
import { hasPattern } from '@rolster/helpers-string';
|
|
6
|
-
import {
|
|
5
|
+
import { dateIsBefore, normalizeMinTime, dateIsAfter, normalizeMaxTime, getDaysOfMonth, getDateWeight, dateIsEqualsWeight, dateIsBetween, assignDayInDate, Month, MONTH_NAMES, DAY_LABELS, DateRange, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/helpers-date';
|
|
7
6
|
import ReactDOM from 'react-dom';
|
|
7
|
+
import { i18n } from '@rolster/i18n';
|
|
8
8
|
import { createFormControlProps } from '@rolster/helpers-forms';
|
|
9
9
|
import 'uuid';
|
|
10
10
|
import { BehaviorSubject } from 'rxjs';
|
|
@@ -73,14 +73,7 @@ function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
|
|
|
73
73
|
function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
|
|
74
74
|
const [focused, setFocused] = useState(false);
|
|
75
75
|
function onChange(event) {
|
|
76
|
-
|
|
77
|
-
case 'number':
|
|
78
|
-
setState(+event.target.value);
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
setState(event.target.value);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
76
|
+
setState(type === 'number' ? +event.target.value : event.target.value);
|
|
84
77
|
}
|
|
85
78
|
function setState(value) {
|
|
86
79
|
formControl?.setState(value);
|
|
@@ -254,7 +247,47 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
254
247
|
}), children: jsx("ul", { children: options.map((action, index) => (jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
|
|
255
248
|
}
|
|
256
249
|
|
|
257
|
-
function
|
|
250
|
+
function RlsMessageFormError({ className, formControl }) {
|
|
251
|
+
return (jsx(Fragment, { children: formControl?.wrong && (jsx("div", { className: className, children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })) }));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function RlsFieldMoney({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
|
|
255
|
+
return (jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
256
|
+
focused: formControl?.focused,
|
|
257
|
+
error: formControl?.wrong,
|
|
258
|
+
disabled: formControl?.disabled || disabled
|
|
259
|
+
}, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
263
|
+
return (jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
264
|
+
focused: formControl?.focused,
|
|
265
|
+
error: formControl?.wrong,
|
|
266
|
+
disabled: formControl?.disabled || disabled
|
|
267
|
+
}, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsTheme }) {
|
|
271
|
+
const [password, setPassword] = useState(true);
|
|
272
|
+
function onToggleInput() {
|
|
273
|
+
setPassword(!password);
|
|
274
|
+
}
|
|
275
|
+
return (jsxs("div", { className: renderClassStatus(' rls-field-box', {
|
|
276
|
+
focused: formControl?.focused,
|
|
277
|
+
error: formControl?.wrong,
|
|
278
|
+
disabled: formControl?.disabled || disabled
|
|
279
|
+
}, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
283
|
+
return (jsxs("div", { className: renderClassStatus('rls-field-box', {
|
|
284
|
+
focused: formControl?.focused,
|
|
285
|
+
error: formControl?.wrong,
|
|
286
|
+
disabled: formControl?.disabled || disabled
|
|
287
|
+
}, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme }) {
|
|
258
291
|
const [checked, setChecked] = useState(formControl?.value || false);
|
|
259
292
|
useEffect(() => {
|
|
260
293
|
setChecked(formControl?.state || false);
|
|
@@ -267,946 +300,906 @@ function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme
|
|
|
267
300
|
setChecked(!checked);
|
|
268
301
|
}
|
|
269
302
|
}
|
|
270
|
-
return (jsxs("div", { className: renderClassStatus('rls-checkbox
|
|
303
|
+
return (jsxs("div", { className: renderClassStatus('rls-label-checkbox', {
|
|
271
304
|
disabled,
|
|
272
305
|
extended
|
|
273
|
-
}), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function dateIsOutRangeMin(props) {
|
|
277
|
-
const { date, minDate } = props;
|
|
278
|
-
return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
|
|
279
|
-
}
|
|
280
|
-
function dateIsOutRangeMax(props) {
|
|
281
|
-
const { date, maxDate } = props;
|
|
282
|
-
return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
|
|
283
|
-
}
|
|
284
|
-
function dateOutRange(props) {
|
|
285
|
-
return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
|
|
286
|
-
}
|
|
287
|
-
function checkDateRange(props) {
|
|
288
|
-
const { date, maxDate, minDate } = props;
|
|
289
|
-
return minDate && dateIsOutRangeMax(props)
|
|
290
|
-
? minDate
|
|
291
|
-
: maxDate && dateIsOutRangeMax(props)
|
|
292
|
-
? maxDate
|
|
293
|
-
: date;
|
|
306
|
+
}), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
|
|
294
307
|
}
|
|
295
308
|
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
function createFirstWeek$1(props, date, today) {
|
|
312
|
-
const days = [];
|
|
313
|
-
let day = 1;
|
|
314
|
-
for (let start = 0; start < date.getDay(); start++) {
|
|
315
|
-
days.push(createDayState(props, today));
|
|
316
|
-
}
|
|
317
|
-
for (let end = date.getDay(); end < 7; end++) {
|
|
318
|
-
days.push(createDayState(props, today, day));
|
|
319
|
-
day++;
|
|
320
|
-
}
|
|
321
|
-
return { days };
|
|
322
|
-
}
|
|
323
|
-
function createDaysPending$1(props, today, days) {
|
|
324
|
-
const daysPending = [];
|
|
325
|
-
const length = 7 - days;
|
|
326
|
-
for (let index = 0; index < length; index++) {
|
|
327
|
-
daysPending.push(createDayState(props, today));
|
|
328
|
-
}
|
|
329
|
-
return daysPending;
|
|
330
|
-
}
|
|
331
|
-
function createNextWeeks$1(props, date, today) {
|
|
332
|
-
const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
333
|
-
const weeks = [];
|
|
334
|
-
let days = [];
|
|
335
|
-
let countDays = 1;
|
|
336
|
-
let day = DAYS_WEEK - date.getDay() + 1;
|
|
337
|
-
do {
|
|
338
|
-
days.push(createDayState(props, today, day));
|
|
339
|
-
day++;
|
|
340
|
-
countDays++;
|
|
341
|
-
if (countDays > DAYS_WEEK) {
|
|
342
|
-
weeks.push({ days });
|
|
343
|
-
days = [];
|
|
344
|
-
countDays = 1;
|
|
345
|
-
}
|
|
346
|
-
} while (day <= daysMonth);
|
|
347
|
-
if (days.length && days.length < DAYS_WEEK) {
|
|
348
|
-
weeks.push({
|
|
349
|
-
days: [...days, ...createDaysPending$1(props, today, days.length)]
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
return weeks;
|
|
353
|
-
}
|
|
354
|
-
function dayIsOutsideMin(props, day) {
|
|
355
|
-
const { month, year, minDate } = props;
|
|
356
|
-
return minDate
|
|
357
|
-
? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
|
|
358
|
-
: false;
|
|
359
|
-
}
|
|
360
|
-
function dayIsOutsideMax(props, day) {
|
|
361
|
-
const { month, year, maxDate } = props;
|
|
362
|
-
return maxDate
|
|
363
|
-
? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
|
|
364
|
-
: false;
|
|
365
|
-
}
|
|
366
|
-
function dayIsOutside(props, day) {
|
|
367
|
-
return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
|
|
368
|
-
}
|
|
369
|
-
function checkDayPicker(props) {
|
|
370
|
-
const { day, maxDate, minDate } = props;
|
|
371
|
-
return minDate && dayIsOutsideMin(props, day)
|
|
372
|
-
? minDate.getDate()
|
|
373
|
-
: maxDate && dayIsOutsideMax(props, day)
|
|
374
|
-
? maxDate.getDate()
|
|
375
|
-
: undefined;
|
|
376
|
-
}
|
|
377
|
-
function createDayPicker(props) {
|
|
378
|
-
const date = new Date(props.year, props.month, 1);
|
|
379
|
-
const today = new Date();
|
|
380
|
-
const firstWeek = createFirstWeek$1(props, date, today);
|
|
381
|
-
const nextWeeks = createNextWeeks$1(props, date, today);
|
|
382
|
-
return [firstWeek, ...nextWeeks];
|
|
309
|
+
function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsTheme, value }) {
|
|
310
|
+
const [checked, setChecked] = useState(formControl?.state || false);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
setChecked(formControl?.state === value);
|
|
313
|
+
}, [formControl?.state]);
|
|
314
|
+
function onSelect() {
|
|
315
|
+
if (formControl) {
|
|
316
|
+
formControl?.setState(value);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return (jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
|
|
320
|
+
disabled,
|
|
321
|
+
extended
|
|
322
|
+
}), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
|
|
383
323
|
}
|
|
384
324
|
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
function
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
return
|
|
399
|
-
}
|
|
400
|
-
function createDayRangeState(props, base, day) {
|
|
401
|
-
return {
|
|
402
|
-
disabled: dayRangeIsOutside(props, day || 0),
|
|
403
|
-
end: day ? rangeIsSelected(props, base, day) : false,
|
|
404
|
-
forbidden: !day,
|
|
405
|
-
ranged: day ? dayIsRange(props, base, day) : false,
|
|
406
|
-
source: day ? sourceIsSelected(props, base, day) : false,
|
|
407
|
-
value: day
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function createFirstWeek(props, base) {
|
|
411
|
-
const days = [];
|
|
412
|
-
let day = 1;
|
|
413
|
-
for (let start = 0; start < base.getDay(); start++) {
|
|
414
|
-
days.push(createDayRangeState(props, base));
|
|
415
|
-
}
|
|
416
|
-
for (let end = base.getDay(); end < 7; end++) {
|
|
417
|
-
days.push(createDayRangeState(props, base, day));
|
|
418
|
-
day++;
|
|
419
|
-
}
|
|
420
|
-
return { days };
|
|
421
|
-
}
|
|
422
|
-
function createDaysPending(props, base, days) {
|
|
423
|
-
const daysPending = [];
|
|
424
|
-
const length = 7 - days;
|
|
425
|
-
for (let index = 0; index < length; index++) {
|
|
426
|
-
daysPending.push(createDayRangeState(props, base));
|
|
427
|
-
}
|
|
428
|
-
return daysPending;
|
|
429
|
-
}
|
|
430
|
-
function createNextWeeks(props, base) {
|
|
431
|
-
const weeks = [];
|
|
432
|
-
const { date } = props;
|
|
433
|
-
const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
434
|
-
let days = [];
|
|
435
|
-
let countDays = 1;
|
|
436
|
-
let day = DAYS_WEEK - base.getDay() + 1;
|
|
437
|
-
do {
|
|
438
|
-
days.push(createDayRangeState(props, date, day));
|
|
439
|
-
day++;
|
|
440
|
-
countDays++;
|
|
441
|
-
if (countDays > 7) {
|
|
442
|
-
weeks.push({ days });
|
|
443
|
-
days = [];
|
|
444
|
-
countDays = 1;
|
|
445
|
-
}
|
|
446
|
-
} while (day <= dayCount);
|
|
447
|
-
if (days.length && days.length < DAYS_WEEK) {
|
|
448
|
-
weeks.push({
|
|
449
|
-
days: [...days, ...createDaysPending(props, base, days.length)]
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
return weeks;
|
|
453
|
-
}
|
|
454
|
-
function dayRangeIsOutsideMin(props, day) {
|
|
455
|
-
const { date, minDate } = props;
|
|
456
|
-
return minDate
|
|
457
|
-
? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
|
|
458
|
-
: false;
|
|
459
|
-
}
|
|
460
|
-
function dayRangeIsOutsideMax(props, day) {
|
|
461
|
-
const { date, maxDate } = props;
|
|
462
|
-
return maxDate
|
|
463
|
-
? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
|
|
464
|
-
: false;
|
|
465
|
-
}
|
|
466
|
-
function dayRangeIsOutside(props, day) {
|
|
467
|
-
return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
|
|
468
|
-
}
|
|
469
|
-
function createDayRangePicker(props) {
|
|
470
|
-
const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
|
|
471
|
-
const firstWeek = createFirstWeek(props, date);
|
|
472
|
-
const nextWeeks = createNextWeeks(props, date);
|
|
473
|
-
return [firstWeek, ...nextWeeks];
|
|
325
|
+
function RlsLabelSwitch({ children, disabled, extended, formControl, rlsTheme }) {
|
|
326
|
+
const [checked, setChecked] = useState(formControl?.value || false);
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
setChecked(formControl?.state || false);
|
|
329
|
+
}, [formControl?.state]);
|
|
330
|
+
function onToggle() {
|
|
331
|
+
if (formControl) {
|
|
332
|
+
formControl?.setState(!formControl.state);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
setChecked(!checked);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return (jsxs("div", { className: renderClassStatus('rls-label-switch', { disabled, extended }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-switch__text", children: children })] }));
|
|
474
339
|
}
|
|
475
340
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
341
|
+
const DEFAULT_COUNT_ELEMENT = 20;
|
|
342
|
+
const MIN_NUMBER_PAGE = 1;
|
|
343
|
+
const FIRST_PAGE = 0;
|
|
344
|
+
const DEFAULT_MAX_VISIBLE = 4;
|
|
345
|
+
function RlsPagination({ elements, count: defaultCount, filter, onElements, onPagination }) {
|
|
346
|
+
const count = defaultCount || DEFAULT_COUNT_ELEMENT;
|
|
347
|
+
const [collection, setCollection] = useState([]);
|
|
348
|
+
const [index, setIndex] = useState(0);
|
|
349
|
+
const [maxPage, setMaxPage] = useState(calculateMaxPage(elements, count));
|
|
350
|
+
const [paginations, setPaginations] = useState([]);
|
|
351
|
+
const [currentPagination, setCurrentPagination] = useState();
|
|
352
|
+
const [description, setDescription] = useState('');
|
|
353
|
+
const [firstPage, setFirstPage] = useState(true);
|
|
354
|
+
const [lastPage, setLastPage] = useState(false);
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
refreshFromElements(elements);
|
|
357
|
+
}, [elements]);
|
|
358
|
+
useEffect(() => {
|
|
359
|
+
const isFirstPage = currentPagination?.value === FIRST_PAGE;
|
|
360
|
+
const isLastPage = currentPagination?.value === maxPage - 1;
|
|
361
|
+
setFirstPage(isFirstPage);
|
|
362
|
+
setLastPage(isLastPage);
|
|
363
|
+
if (onPagination) {
|
|
364
|
+
onPagination({ firstPage: isFirstPage, lastPage: isLastPage });
|
|
365
|
+
}
|
|
366
|
+
}, [currentPagination]);
|
|
367
|
+
useEffect(() => {
|
|
368
|
+
refreshFromFilter(filter);
|
|
369
|
+
}, [filter]);
|
|
370
|
+
function onChangeElements(elements) {
|
|
371
|
+
if (onElements) {
|
|
372
|
+
onElements(elements);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function calculateMaxPage(collection, count) {
|
|
376
|
+
return collection.length ? Math.ceil(collection.length / count) : 0;
|
|
377
|
+
}
|
|
378
|
+
function onSelectPagination(pagination) {
|
|
379
|
+
const { value } = pagination;
|
|
380
|
+
pagination.active = true;
|
|
381
|
+
setIndex(value);
|
|
382
|
+
setCurrentPagination(pagination);
|
|
383
|
+
refreshFromChanged(clonePage({ index: value }));
|
|
384
|
+
}
|
|
385
|
+
function goPagination(pagination) {
|
|
386
|
+
if (currentPagination) {
|
|
387
|
+
currentPagination.active = false;
|
|
388
|
+
}
|
|
389
|
+
onSelectPagination(pagination);
|
|
390
|
+
}
|
|
391
|
+
function goPreviousPagination() {
|
|
392
|
+
if (currentPagination) {
|
|
393
|
+
const { prev, value } = currentPagination;
|
|
394
|
+
if (prev) {
|
|
395
|
+
onSelectPagination(prev);
|
|
396
|
+
currentPagination.active = false;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
const prevIndex = value - MIN_NUMBER_PAGE;
|
|
400
|
+
if (prevIndex >= FIRST_PAGE) {
|
|
401
|
+
refreshFromChanged(clonePageFromIndex(prevIndex));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function goFirstPagination() {
|
|
407
|
+
if (collection.length) {
|
|
408
|
+
refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function goNextPagination() {
|
|
412
|
+
if (currentPagination) {
|
|
413
|
+
const { next, value } = currentPagination;
|
|
414
|
+
if (next) {
|
|
415
|
+
onSelectPagination(next);
|
|
416
|
+
currentPagination.active = false;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
const nextIndex = value + 1;
|
|
420
|
+
if (nextIndex <= maxPage) {
|
|
421
|
+
refreshFromChanged(clonePageFromIndex(nextIndex));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function goLastPagination() {
|
|
427
|
+
if (collection.length) {
|
|
428
|
+
refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function createPageCollection(props) {
|
|
432
|
+
const { collection, count, index } = props;
|
|
433
|
+
if (collection.length) {
|
|
434
|
+
const finish = (index + MIN_NUMBER_PAGE) * count;
|
|
435
|
+
const start = index * count;
|
|
436
|
+
return collection.slice(start, finish);
|
|
437
|
+
}
|
|
438
|
+
return [];
|
|
439
|
+
}
|
|
440
|
+
function refreshFromElements(elements) {
|
|
441
|
+
elements.length
|
|
442
|
+
? refreshFromChanged(refreshPage(elements, filter))
|
|
443
|
+
: rebootPagination();
|
|
444
|
+
}
|
|
445
|
+
function refreshFromFilter(filter) {
|
|
446
|
+
refreshFromChanged(refreshPage(elements, filter));
|
|
447
|
+
}
|
|
448
|
+
function refreshFromChanged(page) {
|
|
449
|
+
refreshPaginations(page);
|
|
450
|
+
refreshDescription(page);
|
|
451
|
+
onChangeElements(createPageCollection(page));
|
|
452
|
+
}
|
|
453
|
+
function refreshCollection(elements, filter) {
|
|
454
|
+
const collection = filter
|
|
455
|
+
? elements.filter((element) => hasPattern(JSON.stringify(element), filter))
|
|
456
|
+
: elements;
|
|
457
|
+
setCollection(collection);
|
|
458
|
+
return collection;
|
|
459
|
+
}
|
|
460
|
+
function refreshMaxPage(collection, count) {
|
|
461
|
+
const maxPage = calculateMaxPage(collection, count);
|
|
462
|
+
setMaxPage(maxPage);
|
|
463
|
+
return maxPage;
|
|
464
|
+
}
|
|
465
|
+
function refreshIndex(collection, currentMaxPage) {
|
|
466
|
+
const maxPage = currentMaxPage || refreshMaxPage(collection, count);
|
|
467
|
+
if (index < maxPage || index === FIRST_PAGE) {
|
|
468
|
+
return index;
|
|
469
|
+
}
|
|
470
|
+
const newIndex = maxPage - 1;
|
|
471
|
+
setIndex(newIndex);
|
|
472
|
+
return newIndex;
|
|
473
|
+
}
|
|
474
|
+
function refreshDescription(page) {
|
|
475
|
+
const { collection, count, index } = page;
|
|
476
|
+
const totalCount = elements.length;
|
|
477
|
+
const start = index * count + MIN_NUMBER_PAGE;
|
|
478
|
+
let end = (index + MIN_NUMBER_PAGE) * count;
|
|
479
|
+
if (end > collection.length) {
|
|
480
|
+
end = collection.length;
|
|
481
|
+
}
|
|
482
|
+
setDescription(`${start} - ${end} de ${totalCount}`);
|
|
483
|
+
}
|
|
484
|
+
function refreshPaginations({ index, maxPage }) {
|
|
485
|
+
let maxPageVisible = index + DEFAULT_MAX_VISIBLE;
|
|
486
|
+
if (maxPageVisible > maxPage) {
|
|
487
|
+
maxPageVisible = maxPage;
|
|
488
|
+
}
|
|
489
|
+
let minIndexPage = maxPageVisible - DEFAULT_MAX_VISIBLE;
|
|
490
|
+
if (minIndexPage < 0) {
|
|
491
|
+
minIndexPage = 0;
|
|
492
|
+
}
|
|
493
|
+
if (minIndexPage > index) {
|
|
494
|
+
minIndexPage = index;
|
|
495
|
+
}
|
|
496
|
+
let prevPagination = undefined;
|
|
497
|
+
const paginations = [];
|
|
498
|
+
for (let i = minIndexPage; i < maxPageVisible; i++) {
|
|
499
|
+
const pagination = createPagination(i, index);
|
|
500
|
+
paginations.push(pagination);
|
|
501
|
+
pagination.prev = prevPagination;
|
|
502
|
+
if (prevPagination) {
|
|
503
|
+
prevPagination.next = pagination;
|
|
504
|
+
}
|
|
505
|
+
prevPagination = pagination;
|
|
506
|
+
}
|
|
507
|
+
setPaginations(paginations);
|
|
508
|
+
}
|
|
509
|
+
function clonePage(pagePartial) {
|
|
510
|
+
return {
|
|
511
|
+
collection: pagePartial.collection || collection,
|
|
512
|
+
index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
|
|
513
|
+
count: pagePartial.count || count,
|
|
514
|
+
maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function clonePageFromIndex(index) {
|
|
518
|
+
return clonePage({ index });
|
|
519
|
+
}
|
|
520
|
+
function refreshPage(elements, filter) {
|
|
521
|
+
const collection = refreshCollection(elements, filter);
|
|
522
|
+
const maxPage = refreshMaxPage(collection, count);
|
|
523
|
+
const index = refreshIndex(collection, maxPage);
|
|
524
|
+
return clonePage({ collection, index, maxPage });
|
|
525
|
+
}
|
|
526
|
+
function createPagination(value, index) {
|
|
527
|
+
const active = value === index;
|
|
528
|
+
const pagination = {
|
|
529
|
+
label: (value + 1).toString(),
|
|
530
|
+
value,
|
|
531
|
+
active
|
|
532
|
+
};
|
|
533
|
+
if (active) {
|
|
534
|
+
setCurrentPagination(pagination);
|
|
535
|
+
}
|
|
536
|
+
return pagination;
|
|
537
|
+
}
|
|
538
|
+
function rebootPagination() {
|
|
539
|
+
setCollection([]);
|
|
540
|
+
setMaxPage(0);
|
|
541
|
+
setIndex(0);
|
|
542
|
+
setPaginations([]);
|
|
543
|
+
onChangeElements([]);
|
|
544
|
+
}
|
|
545
|
+
return (jsxs("div", { className: "rls-pagination", children: [jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrowhead-left" }) }), jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsx("div", { className: "rls-pagination__pages", children: paginations.map((page, index) => {
|
|
546
|
+
return (jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
547
|
+
active: page.active
|
|
548
|
+
}), onClick: () => {
|
|
549
|
+
goPagination(page);
|
|
550
|
+
}, children: page.label }, index));
|
|
551
|
+
}) }), jsx("div", { className: "rls-pagination__description", children: description }), jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function dateIsOutRangeMin(props) {
|
|
555
|
+
const { date, minDate } = props;
|
|
556
|
+
return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
|
|
557
|
+
}
|
|
558
|
+
function dateIsOutRangeMax(props) {
|
|
559
|
+
const { date, maxDate } = props;
|
|
560
|
+
return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
|
|
561
|
+
}
|
|
562
|
+
function dateOutRange(props) {
|
|
563
|
+
return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
|
|
564
|
+
}
|
|
565
|
+
function checkDateRange(props) {
|
|
566
|
+
const { date, maxDate, minDate } = props;
|
|
567
|
+
return minDate && dateIsOutRangeMax(props)
|
|
568
|
+
? minDate
|
|
569
|
+
: maxDate && dateIsOutRangeMax(props)
|
|
570
|
+
? maxDate
|
|
571
|
+
: date;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const DAYS_WEEK = 7;
|
|
575
|
+
const COUNT_YEAR_RANGE = 4;
|
|
576
|
+
|
|
577
|
+
function createDayState(props, today, value) {
|
|
578
|
+
const { date, day, month, year } = props;
|
|
579
|
+
const dateValue = value && new Date(year, month, value);
|
|
580
|
+
return {
|
|
581
|
+
disabled: dayIsOutside(props, value || 0),
|
|
582
|
+
focused: !!value && day === value,
|
|
583
|
+
forbidden: !value,
|
|
584
|
+
selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
|
|
585
|
+
today: !!dateValue && dateIsEqualsWeight(today, dateValue),
|
|
483
586
|
value
|
|
484
587
|
};
|
|
485
588
|
}
|
|
486
|
-
function
|
|
487
|
-
const
|
|
589
|
+
function createFirstWeek$1(props, date, today) {
|
|
590
|
+
const days = [];
|
|
591
|
+
let day = 1;
|
|
592
|
+
for (let start = 0; start < date.getDay(); start++) {
|
|
593
|
+
days.push(createDayState(props, today));
|
|
594
|
+
}
|
|
595
|
+
for (let end = date.getDay(); end < 7; end++) {
|
|
596
|
+
days.push(createDayState(props, today, day));
|
|
597
|
+
day++;
|
|
598
|
+
}
|
|
599
|
+
return { days };
|
|
600
|
+
}
|
|
601
|
+
function createDaysPending$1(props, today, days) {
|
|
602
|
+
const daysPending = [];
|
|
603
|
+
const length = 7 - days;
|
|
604
|
+
for (let index = 0; index < length; index++) {
|
|
605
|
+
daysPending.push(createDayState(props, today));
|
|
606
|
+
}
|
|
607
|
+
return daysPending;
|
|
608
|
+
}
|
|
609
|
+
function createNextWeeks$1(props, date, today) {
|
|
610
|
+
const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
611
|
+
const weeks = [];
|
|
612
|
+
let days = [];
|
|
613
|
+
let countDays = 1;
|
|
614
|
+
let day = DAYS_WEEK - date.getDay() + 1;
|
|
615
|
+
do {
|
|
616
|
+
days.push(createDayState(props, today, day));
|
|
617
|
+
day++;
|
|
618
|
+
countDays++;
|
|
619
|
+
if (countDays > DAYS_WEEK) {
|
|
620
|
+
weeks.push({ days });
|
|
621
|
+
days = [];
|
|
622
|
+
countDays = 1;
|
|
623
|
+
}
|
|
624
|
+
} while (day <= daysMonth);
|
|
625
|
+
if (days.length && days.length < DAYS_WEEK) {
|
|
626
|
+
weeks.push({
|
|
627
|
+
days: [...days, ...createDaysPending$1(props, today, days.length)]
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
return weeks;
|
|
631
|
+
}
|
|
632
|
+
function dayIsOutsideMin(props, day) {
|
|
633
|
+
const { month, year, minDate } = props;
|
|
488
634
|
return minDate
|
|
489
|
-
?
|
|
635
|
+
? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
|
|
490
636
|
: false;
|
|
491
637
|
}
|
|
492
|
-
function
|
|
493
|
-
const { year, maxDate } = props;
|
|
638
|
+
function dayIsOutsideMax(props, day) {
|
|
639
|
+
const { month, year, maxDate } = props;
|
|
494
640
|
return maxDate
|
|
495
|
-
?
|
|
641
|
+
? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
|
|
496
642
|
: false;
|
|
497
643
|
}
|
|
498
|
-
function
|
|
499
|
-
return
|
|
500
|
-
}
|
|
501
|
-
function checkMonthPicker(props) {
|
|
502
|
-
const { maxDate, minDate, month } = props;
|
|
503
|
-
return minDate && monthIsOutsideMin(props, month)
|
|
504
|
-
? minDate.getMonth()
|
|
505
|
-
: maxDate && monthIsOutsideMax(props, month)
|
|
506
|
-
? maxDate.getMonth()
|
|
507
|
-
: undefined;
|
|
508
|
-
}
|
|
509
|
-
function createMonthPicker(props) {
|
|
510
|
-
return [
|
|
511
|
-
createMonthState(props, Month.January),
|
|
512
|
-
createMonthState(props, Month.February),
|
|
513
|
-
createMonthState(props, Month.March),
|
|
514
|
-
createMonthState(props, Month.April),
|
|
515
|
-
createMonthState(props, Month.May),
|
|
516
|
-
createMonthState(props, Month.June),
|
|
517
|
-
createMonthState(props, Month.July),
|
|
518
|
-
createMonthState(props, Month.August),
|
|
519
|
-
createMonthState(props, Month.September),
|
|
520
|
-
createMonthState(props, Month.October),
|
|
521
|
-
createMonthState(props, Month.November),
|
|
522
|
-
createMonthState(props, Month.December)
|
|
523
|
-
];
|
|
524
|
-
}
|
|
525
|
-
function monthIsLimitMin(props) {
|
|
526
|
-
const { month, date, minDate } = props;
|
|
527
|
-
if (itIsDefined(month) && date) {
|
|
528
|
-
const minYear = minDate ? minDate.getFullYear() : 0;
|
|
529
|
-
const minMonth = minDate ? minDate.getMonth() : 0;
|
|
530
|
-
return date.getFullYear() === minYear && month <= minMonth;
|
|
531
|
-
}
|
|
532
|
-
return false;
|
|
644
|
+
function dayIsOutside(props, day) {
|
|
645
|
+
return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
|
|
533
646
|
}
|
|
534
|
-
function
|
|
535
|
-
const {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
return false;
|
|
647
|
+
function checkDayPicker(props) {
|
|
648
|
+
const { day, maxDate, minDate } = props;
|
|
649
|
+
return minDate && dayIsOutsideMin(props, day)
|
|
650
|
+
? minDate.getDate()
|
|
651
|
+
: maxDate && dayIsOutsideMax(props, day)
|
|
652
|
+
? maxDate.getDate()
|
|
653
|
+
: undefined;
|
|
542
654
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
655
|
+
function createDayPicker(props) {
|
|
656
|
+
const date = new Date(props.year, props.month, 1);
|
|
657
|
+
const today = new Date();
|
|
658
|
+
const firstWeek = createFirstWeek$1(props, date, today);
|
|
659
|
+
const nextWeeks = createNextWeeks$1(props, date, today);
|
|
660
|
+
return [firstWeek, ...nextWeeks];
|
|
548
661
|
}
|
|
549
662
|
|
|
550
|
-
|
|
551
|
-
(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
PickerListenerType["Cancel"] = "PickerCancel";
|
|
555
|
-
})(PickerListenerType || (PickerListenerType = {}));
|
|
556
|
-
|
|
557
|
-
function createYear(props, value) {
|
|
558
|
-
const { date, year } = props;
|
|
559
|
-
return {
|
|
560
|
-
disabled: !value,
|
|
561
|
-
focused: value === year,
|
|
562
|
-
selected: value === date.getFullYear(),
|
|
563
|
-
value
|
|
564
|
-
};
|
|
663
|
+
function dateIsSelected(base, date, day) {
|
|
664
|
+
return (date.getFullYear() === base.getFullYear() &&
|
|
665
|
+
date.getMonth() === base.getMonth() &&
|
|
666
|
+
day === date.getDate());
|
|
565
667
|
}
|
|
566
|
-
function
|
|
567
|
-
|
|
568
|
-
return minDate ? year < minDate.getFullYear() : false;
|
|
668
|
+
function sourceIsSelected({ sourceDate }, base, day) {
|
|
669
|
+
return dateIsSelected(base, sourceDate, day);
|
|
569
670
|
}
|
|
570
|
-
function
|
|
571
|
-
|
|
572
|
-
|
|
671
|
+
function rangeIsSelected({ range }, base, day) {
|
|
672
|
+
return (dateIsSelected(base, range.minDate, day) ||
|
|
673
|
+
dateIsSelected(base, range.maxDate, day));
|
|
573
674
|
}
|
|
574
|
-
function
|
|
575
|
-
|
|
576
|
-
return minDate && yearIsOutlineMin(props)
|
|
577
|
-
? minDate.getFullYear()
|
|
578
|
-
: maxDate && yearIsOutlineMax(props)
|
|
579
|
-
? maxDate.getFullYear()
|
|
580
|
-
: undefined;
|
|
675
|
+
function dayIsRange({ range }, base, day) {
|
|
676
|
+
return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
|
|
581
677
|
}
|
|
582
|
-
function
|
|
583
|
-
const { year, maxDate, minDate } = props;
|
|
584
|
-
const prevYears = [];
|
|
585
|
-
const nextYears = [];
|
|
586
|
-
let minRange = year;
|
|
587
|
-
let maxRange = year;
|
|
588
|
-
const minYear = minDate?.getFullYear() || 0;
|
|
589
|
-
const maxYear = maxDate?.getFullYear() || 10000;
|
|
590
|
-
for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
|
|
591
|
-
const prevValue = year - COUNT_YEAR_RANGE + index;
|
|
592
|
-
const nextValue = year + index + 1;
|
|
593
|
-
const prevYear = prevValue >= minYear ? prevValue : undefined;
|
|
594
|
-
const nextYear = nextValue <= maxYear ? nextValue : undefined;
|
|
595
|
-
const prevState = createYear(props, prevYear);
|
|
596
|
-
const nextState = createYear(props, nextYear);
|
|
597
|
-
prevYears.push(prevState);
|
|
598
|
-
nextYears.push(nextState);
|
|
599
|
-
if (!!prevState.value && minRange > prevState.value) {
|
|
600
|
-
minRange = prevState.value;
|
|
601
|
-
}
|
|
602
|
-
if (!!nextState.value && maxRange < nextState.value) {
|
|
603
|
-
maxRange = nextState.value;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
const yearCenter = createYear(props, year);
|
|
607
|
-
return {
|
|
608
|
-
canPrevious: minYear < minRange,
|
|
609
|
-
canNext: maxYear > maxRange,
|
|
610
|
-
maxRange,
|
|
611
|
-
minRange,
|
|
612
|
-
years: [...prevYears, yearCenter, ...nextYears]
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function createEmptyStore() {
|
|
678
|
+
function createDayRangeState(props, base, day) {
|
|
617
679
|
return {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
680
|
+
disabled: dayRangeIsOutside(props, day || 0),
|
|
681
|
+
end: day ? rangeIsSelected(props, base, day) : false,
|
|
682
|
+
forbidden: !day,
|
|
683
|
+
ranged: day ? dayIsRange(props, base, day) : false,
|
|
684
|
+
source: day ? sourceIsSelected(props, base, day) : false,
|
|
685
|
+
value: day
|
|
621
686
|
};
|
|
622
687
|
}
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
688
|
+
function createFirstWeek(props, base) {
|
|
689
|
+
const days = [];
|
|
690
|
+
let day = 1;
|
|
691
|
+
for (let start = 0; start < base.getDay(); start++) {
|
|
692
|
+
days.push(createDayRangeState(props, base));
|
|
627
693
|
}
|
|
628
|
-
let
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
search = hasPattern(pattern || '', newStore.pattern, true);
|
|
632
|
-
if (!search) {
|
|
633
|
-
newStore = newStore.previous;
|
|
634
|
-
}
|
|
694
|
+
for (let end = base.getDay(); end < 7; end++) {
|
|
695
|
+
days.push(createDayRangeState(props, base, day));
|
|
696
|
+
day++;
|
|
635
697
|
}
|
|
636
|
-
return
|
|
698
|
+
return { days };
|
|
637
699
|
}
|
|
638
|
-
function
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
700
|
+
function createDaysPending(props, base, days) {
|
|
701
|
+
const daysPending = [];
|
|
702
|
+
const length = 7 - days;
|
|
703
|
+
for (let index = 0; index < length; index++) {
|
|
704
|
+
daysPending.push(createDayRangeState(props, base));
|
|
642
705
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
706
|
+
return daysPending;
|
|
707
|
+
}
|
|
708
|
+
function createNextWeeks(props, base) {
|
|
709
|
+
const weeks = [];
|
|
710
|
+
const { date } = props;
|
|
711
|
+
const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
|
|
712
|
+
let days = [];
|
|
713
|
+
let countDays = 1;
|
|
714
|
+
let day = DAYS_WEEK - base.getDay() + 1;
|
|
715
|
+
do {
|
|
716
|
+
days.push(createDayRangeState(props, date, day));
|
|
717
|
+
day++;
|
|
718
|
+
countDays++;
|
|
719
|
+
if (countDays > 7) {
|
|
720
|
+
weeks.push({ days });
|
|
721
|
+
days = [];
|
|
722
|
+
countDays = 1;
|
|
652
723
|
}
|
|
653
|
-
};
|
|
724
|
+
} while (day <= dayCount);
|
|
725
|
+
if (days.length && days.length < DAYS_WEEK) {
|
|
726
|
+
weeks.push({
|
|
727
|
+
days: [...days, ...createDaysPending(props, base, days.length)]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
return weeks;
|
|
731
|
+
}
|
|
732
|
+
function dayRangeIsOutsideMin(props, day) {
|
|
733
|
+
const { date, minDate } = props;
|
|
734
|
+
return minDate
|
|
735
|
+
? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
|
|
736
|
+
: false;
|
|
737
|
+
}
|
|
738
|
+
function dayRangeIsOutsideMax(props, day) {
|
|
739
|
+
const { date, maxDate } = props;
|
|
740
|
+
return maxDate
|
|
741
|
+
? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
|
|
742
|
+
: false;
|
|
743
|
+
}
|
|
744
|
+
function dayRangeIsOutside(props, day) {
|
|
745
|
+
return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
|
|
746
|
+
}
|
|
747
|
+
function createDayRangePicker(props) {
|
|
748
|
+
const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
|
|
749
|
+
const firstWeek = createFirstWeek(props, date);
|
|
750
|
+
const nextWeeks = createNextWeeks(props, date);
|
|
751
|
+
return [firstWeek, ...nextWeeks];
|
|
654
752
|
}
|
|
655
753
|
|
|
656
|
-
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
754
|
+
function createMonthState(props, value) {
|
|
755
|
+
const { date, month, year } = props;
|
|
756
|
+
return {
|
|
757
|
+
disabled: monthIsOutside(props, value),
|
|
758
|
+
focused: value === month,
|
|
759
|
+
label: MONTH_NAMES()[value],
|
|
760
|
+
selected: date.getFullYear() === year && value === date.getMonth(),
|
|
761
|
+
value
|
|
762
|
+
};
|
|
665
763
|
}
|
|
666
|
-
function
|
|
667
|
-
const {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
672
|
-
if (elements?.length) {
|
|
673
|
-
elements.item(0).focus();
|
|
674
|
-
setTimeout(() => {
|
|
675
|
-
listElement?.scroll({ top: 0, behavior: 'smooth' });
|
|
676
|
-
}, 100);
|
|
677
|
-
}
|
|
678
|
-
return POSITION_INITIAL;
|
|
764
|
+
function monthIsOutsideMin(props, month) {
|
|
765
|
+
const { year, minDate } = props;
|
|
766
|
+
return minDate
|
|
767
|
+
? minDate.getFullYear() === year && month < minDate.getMonth()
|
|
768
|
+
: false;
|
|
679
769
|
}
|
|
680
|
-
function
|
|
681
|
-
const {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
686
|
-
if (!elements?.length) {
|
|
687
|
-
return POSITION_INITIAL;
|
|
688
|
-
}
|
|
689
|
-
const position = elements.length - 1;
|
|
690
|
-
const element = elements.item(position);
|
|
691
|
-
element?.focus();
|
|
692
|
-
setTimeout(() => {
|
|
693
|
-
listElement?.scroll({
|
|
694
|
-
top: element?.offsetTop + element?.offsetLeft,
|
|
695
|
-
behavior: 'smooth'
|
|
696
|
-
});
|
|
697
|
-
}, 100);
|
|
698
|
-
return position;
|
|
770
|
+
function monthIsOutsideMax(props, month) {
|
|
771
|
+
const { year, maxDate } = props;
|
|
772
|
+
return maxDate
|
|
773
|
+
? maxDate.getFullYear() === year && month > maxDate.getMonth()
|
|
774
|
+
: false;
|
|
699
775
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
702
|
-
const elements = listElement?.querySelectorAll(classElement);
|
|
703
|
-
const newPosition = position + 1;
|
|
704
|
-
if (newPosition < (elements?.length || 0)) {
|
|
705
|
-
elements?.item(newPosition)?.focus();
|
|
706
|
-
return newPosition;
|
|
707
|
-
}
|
|
708
|
-
if (!locationListIsBottom(contentElement, listElement)) {
|
|
709
|
-
inputElement?.focus();
|
|
710
|
-
}
|
|
711
|
-
return position;
|
|
776
|
+
function monthIsOutside(props, month) {
|
|
777
|
+
return monthIsOutsideMin(props, month) || monthIsOutsideMax(props, month);
|
|
712
778
|
}
|
|
713
|
-
function
|
|
714
|
-
const {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
}
|
|
721
|
-
if (locationListIsBottom(contentElement, listElement)) {
|
|
722
|
-
inputElement?.focus();
|
|
723
|
-
}
|
|
724
|
-
return POSITION_INITIAL;
|
|
779
|
+
function checkMonthPicker(props) {
|
|
780
|
+
const { maxDate, minDate, month } = props;
|
|
781
|
+
return minDate && monthIsOutsideMin(props, month)
|
|
782
|
+
? minDate.getMonth()
|
|
783
|
+
: maxDate && monthIsOutsideMax(props, month)
|
|
784
|
+
? maxDate.getMonth()
|
|
785
|
+
: undefined;
|
|
725
786
|
}
|
|
726
|
-
function
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
787
|
+
function createMonthPicker(props) {
|
|
788
|
+
return [
|
|
789
|
+
createMonthState(props, Month.January),
|
|
790
|
+
createMonthState(props, Month.February),
|
|
791
|
+
createMonthState(props, Month.March),
|
|
792
|
+
createMonthState(props, Month.April),
|
|
793
|
+
createMonthState(props, Month.May),
|
|
794
|
+
createMonthState(props, Month.June),
|
|
795
|
+
createMonthState(props, Month.July),
|
|
796
|
+
createMonthState(props, Month.August),
|
|
797
|
+
createMonthState(props, Month.September),
|
|
798
|
+
createMonthState(props, Month.October),
|
|
799
|
+
createMonthState(props, Month.November),
|
|
800
|
+
createMonthState(props, Month.December)
|
|
801
|
+
];
|
|
735
802
|
}
|
|
736
|
-
function
|
|
737
|
-
const {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
return navigationElementUp(props);
|
|
743
|
-
default:
|
|
744
|
-
return POSITION_INITIAL;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
class ListCollection {
|
|
749
|
-
constructor(value) {
|
|
750
|
-
this.value = value;
|
|
803
|
+
function monthIsLimitMin(props) {
|
|
804
|
+
const { month, date, minDate } = props;
|
|
805
|
+
if (itIsDefined(month) && date) {
|
|
806
|
+
const minYear = minDate ? minDate.getFullYear() : 0;
|
|
807
|
+
const minMonth = minDate ? minDate.getMonth() : 0;
|
|
808
|
+
return date.getFullYear() === minYear && month <= minMonth;
|
|
751
809
|
}
|
|
752
|
-
|
|
753
|
-
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
function monthIsLimitMax(props) {
|
|
813
|
+
const { month, date, maxDate } = props;
|
|
814
|
+
if (itIsDefined(month) && date) {
|
|
815
|
+
const maxYear = maxDate ? maxDate.getFullYear() : 10000;
|
|
816
|
+
const maxMonth = maxDate ? maxDate.getMonth() : 11;
|
|
817
|
+
return date.getFullYear() === maxYear && month >= maxMonth;
|
|
754
818
|
}
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
function monthLimitTemplate(props) {
|
|
822
|
+
return {
|
|
823
|
+
limitNext: monthIsLimitMax(props),
|
|
824
|
+
limitPrevious: monthIsLimitMin(props)
|
|
825
|
+
};
|
|
755
826
|
}
|
|
756
827
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
: new DateRange(date, sourceDate.current);
|
|
822
|
-
sourceDate.current = date;
|
|
823
|
-
setRange(range);
|
|
824
|
-
formControl?.setState(range);
|
|
825
|
-
}
|
|
826
|
-
return (jsxs("div", { className: "rls-day-range-picker", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-day-range-picker__title", children: dateFormatTemplate(sourceDate.current, DATE_RANGE_FORMAT) }), jsx("div", { className: "rls-day-range-picker__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-day-range-picker__label", children: title }, index))) }), jsx("div", { className: "rls-day-range-picker__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-day-range-picker__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsx("div", { className: renderClassStatus('rls-day-range-picker__day', {
|
|
827
|
-
disabled: disabled || disabledPicker,
|
|
828
|
-
end,
|
|
829
|
-
forbidden,
|
|
830
|
-
ranged,
|
|
831
|
-
source
|
|
832
|
-
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-day-range-picker__day__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
function RlsMoneyField({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
|
|
836
|
-
return (jsxs("div", { className: renderClassStatus('rls-box-field', {
|
|
837
|
-
focused: formControl?.focused,
|
|
838
|
-
error: formControl?.wrong,
|
|
839
|
-
disabled: formControl?.disabled || disabled
|
|
840
|
-
}, 'rls-money-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsx("div", { className: "rls-box-field__body", children: jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
function RlsMonthPicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
844
|
-
const currentDate = date || new Date();
|
|
845
|
-
const [months, setMonths] = useState([]);
|
|
846
|
-
const [value, setValue] = useState(formControl?.state || currentDate.getMonth());
|
|
847
|
-
useEffect(() => {
|
|
848
|
-
const props = createPickerProps(); // MonthPickerProps
|
|
849
|
-
const month = checkMonthPicker(props);
|
|
850
|
-
month ? setMonthValue(month) : setMonths(createMonthPicker(props));
|
|
851
|
-
}, [date, year, value, minDate, maxDate]);
|
|
852
|
-
useEffect(() => {
|
|
853
|
-
const month = checkMonthPicker(createPickerProps());
|
|
854
|
-
itIsDefined(month)
|
|
855
|
-
? formControl?.setState(month)
|
|
856
|
-
: setValue(formControl?.state || currentDate.getMonth());
|
|
857
|
-
}, [formControl?.state]);
|
|
858
|
-
function createPickerProps() {
|
|
859
|
-
return {
|
|
860
|
-
date: currentDate,
|
|
861
|
-
month: itIsDefined(formControl?.state) ? formControl?.state : value,
|
|
862
|
-
year: year || currentDate.getFullYear(),
|
|
863
|
-
minDate,
|
|
864
|
-
maxDate
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
function setMonthValue(value) {
|
|
868
|
-
formControl ? formControl.setState(value) : setValue(value);
|
|
869
|
-
}
|
|
870
|
-
function onChange(value) {
|
|
871
|
-
setMonthValue(value);
|
|
872
|
-
if (onValue) {
|
|
873
|
-
onValue(value);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
return (jsx("div", { className: "rls-month-picker", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-month-picker__component', {
|
|
877
|
-
disabled: disabled || disabledPicker,
|
|
878
|
-
focused,
|
|
879
|
-
selected
|
|
880
|
-
}), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-month-picker__span", children: label }) }, index))) }));
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
function RlsMonthTitlePicker({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
884
|
-
const { limitNext, limitPrevious } = monthLimitTemplate({
|
|
885
|
-
date,
|
|
886
|
-
maxDate,
|
|
887
|
-
minDate,
|
|
888
|
-
month: monthControl.state
|
|
889
|
-
});
|
|
890
|
-
const monthName = MONTH_NAMES()[monthControl.state || 0];
|
|
891
|
-
function onPreviousMonth() {
|
|
892
|
-
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
893
|
-
if (monthControl.state > Month.January) {
|
|
894
|
-
monthControl.setState(monthControl.state - 1);
|
|
895
|
-
}
|
|
896
|
-
else {
|
|
897
|
-
monthControl.setState(Month.December);
|
|
898
|
-
yearControl.setState(yearControl.state - 1);
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
function onPreviousYear() {
|
|
903
|
-
if (itIsDefined(yearControl.state)) {
|
|
904
|
-
yearControl.setState(yearControl.state - 1);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function onPrevious() {
|
|
908
|
-
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
909
|
-
}
|
|
910
|
-
function onNextMonth() {
|
|
911
|
-
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
912
|
-
if (monthControl.state < Month.December) {
|
|
913
|
-
monthControl.setState(monthControl.state + 1);
|
|
914
|
-
}
|
|
915
|
-
else {
|
|
916
|
-
monthControl.setState(Month.January);
|
|
917
|
-
yearControl.setState(yearControl.state + 1);
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
function onNextYear() {
|
|
922
|
-
if (itIsDefined(yearControl.state)) {
|
|
923
|
-
yearControl.setState(yearControl.state + 1);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
function onNext() {
|
|
927
|
-
type === 'month' ? onNextMonth() : onNextYear();
|
|
928
|
-
}
|
|
929
|
-
return (jsxs("div", { className: "rls-month-title-picker", children: [jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsx("span", { onClick: onClick, children: monthName }), jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
function RlsNumberField({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
|
|
933
|
-
return (jsxs("div", { className: renderClassStatus('rls-box-field', {
|
|
934
|
-
focused: formControl?.focused,
|
|
935
|
-
error: formControl?.wrong,
|
|
936
|
-
disabled: formControl?.disabled || disabled
|
|
937
|
-
}, 'rls-number-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsx("div", { className: "rls-box-field__body", children: jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
|
|
828
|
+
var PickerListenerType;
|
|
829
|
+
(function (PickerListenerType) {
|
|
830
|
+
PickerListenerType["Select"] = "PickerSelect";
|
|
831
|
+
PickerListenerType["Now"] = "PickerNow";
|
|
832
|
+
PickerListenerType["Cancel"] = "PickerCancel";
|
|
833
|
+
})(PickerListenerType || (PickerListenerType = {}));
|
|
834
|
+
|
|
835
|
+
function createYear(props, value) {
|
|
836
|
+
const { date, year } = props;
|
|
837
|
+
return {
|
|
838
|
+
disabled: !value,
|
|
839
|
+
focused: value === year,
|
|
840
|
+
selected: value === date.getFullYear(),
|
|
841
|
+
value
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
function yearIsOutlineMin(props) {
|
|
845
|
+
const { year, minDate } = props;
|
|
846
|
+
return minDate ? year < minDate.getFullYear() : false;
|
|
847
|
+
}
|
|
848
|
+
function yearIsOutlineMax(props) {
|
|
849
|
+
const { year, maxDate } = props;
|
|
850
|
+
return maxDate ? year > maxDate.getFullYear() : false;
|
|
851
|
+
}
|
|
852
|
+
function checkYearPicker(props) {
|
|
853
|
+
const { maxDate, minDate } = props;
|
|
854
|
+
return minDate && yearIsOutlineMin(props)
|
|
855
|
+
? minDate.getFullYear()
|
|
856
|
+
: maxDate && yearIsOutlineMax(props)
|
|
857
|
+
? maxDate.getFullYear()
|
|
858
|
+
: undefined;
|
|
859
|
+
}
|
|
860
|
+
function createYearPicker(props) {
|
|
861
|
+
const { year, maxDate, minDate } = props;
|
|
862
|
+
const prevYears = [];
|
|
863
|
+
const nextYears = [];
|
|
864
|
+
let minRange = year;
|
|
865
|
+
let maxRange = year;
|
|
866
|
+
const minYear = minDate?.getFullYear() || 0;
|
|
867
|
+
const maxYear = maxDate?.getFullYear() || 10000;
|
|
868
|
+
for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
|
|
869
|
+
const prevValue = year - COUNT_YEAR_RANGE + index;
|
|
870
|
+
const nextValue = year + index + 1;
|
|
871
|
+
const prevYear = prevValue >= minYear ? prevValue : undefined;
|
|
872
|
+
const nextYear = nextValue <= maxYear ? nextValue : undefined;
|
|
873
|
+
const prevState = createYear(props, prevYear);
|
|
874
|
+
const nextState = createYear(props, nextYear);
|
|
875
|
+
prevYears.push(prevState);
|
|
876
|
+
nextYears.push(nextState);
|
|
877
|
+
if (!!prevState.value && minRange > prevState.value) {
|
|
878
|
+
minRange = prevState.value;
|
|
879
|
+
}
|
|
880
|
+
if (!!nextState.value && maxRange < nextState.value) {
|
|
881
|
+
maxRange = nextState.value;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
const yearCenter = createYear(props, year);
|
|
885
|
+
return {
|
|
886
|
+
canPrevious: minYear < minRange,
|
|
887
|
+
canNext: maxYear > maxRange,
|
|
888
|
+
maxRange,
|
|
889
|
+
minRange,
|
|
890
|
+
years: [...prevYears, yearCenter, ...nextYears]
|
|
891
|
+
};
|
|
938
892
|
}
|
|
939
893
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
const
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
elements
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
for (let i = minIndexPage; i < maxPageVisible; i++) {
|
|
1098
|
-
const pagination = createPagination(i, index);
|
|
1099
|
-
paginations.push(pagination);
|
|
1100
|
-
pagination.prev = prevPagination;
|
|
1101
|
-
if (prevPagination) {
|
|
1102
|
-
prevPagination.next = pagination;
|
|
1103
|
-
}
|
|
1104
|
-
prevPagination = pagination;
|
|
1105
|
-
}
|
|
1106
|
-
setPaginations(paginations);
|
|
1107
|
-
}
|
|
1108
|
-
function clonePage(pagePartial) {
|
|
894
|
+
function createEmptyStore() {
|
|
895
|
+
return {
|
|
896
|
+
coincidences: undefined,
|
|
897
|
+
pattern: '',
|
|
898
|
+
previous: null
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
function searchForPattern(props) {
|
|
902
|
+
const { pattern, store } = props;
|
|
903
|
+
if (!store?.pattern) {
|
|
904
|
+
return null;
|
|
905
|
+
}
|
|
906
|
+
let newStore = store;
|
|
907
|
+
let search = false;
|
|
908
|
+
while (!search && newStore) {
|
|
909
|
+
search = hasPattern(pattern || '', newStore.pattern, true);
|
|
910
|
+
if (!search) {
|
|
911
|
+
newStore = newStore.previous;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return newStore || createEmptyStore();
|
|
915
|
+
}
|
|
916
|
+
function createStoreAutocomplete(props) {
|
|
917
|
+
const { pattern, suggestions, reboot } = props;
|
|
918
|
+
if (!pattern) {
|
|
919
|
+
return { collection: suggestions, store: createEmptyStore() };
|
|
920
|
+
}
|
|
921
|
+
const store = reboot ? createEmptyStore() : searchForPattern(props);
|
|
922
|
+
const elements = store?.coincidences || suggestions;
|
|
923
|
+
const coincidences = elements.filter((element) => element.hasCoincidence(pattern));
|
|
924
|
+
return {
|
|
925
|
+
collection: coincidences,
|
|
926
|
+
store: {
|
|
927
|
+
coincidences,
|
|
928
|
+
pattern,
|
|
929
|
+
previous: store
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const classElement = '.rls-list-field__element';
|
|
935
|
+
const POSITION_INITIAL = 0;
|
|
936
|
+
function locationListIsBottom(contentElement, listElement) {
|
|
937
|
+
if (contentElement && listElement) {
|
|
938
|
+
const { top, height } = contentElement.getBoundingClientRect();
|
|
939
|
+
const { clientHeight } = listElement;
|
|
940
|
+
return top + height + clientHeight < window.innerHeight;
|
|
941
|
+
}
|
|
942
|
+
return true;
|
|
943
|
+
}
|
|
944
|
+
function navigationInputDown(props) {
|
|
945
|
+
const { contentElement, listElement } = props;
|
|
946
|
+
if (!locationListIsBottom(contentElement, listElement)) {
|
|
947
|
+
return undefined;
|
|
948
|
+
}
|
|
949
|
+
const elements = listElement?.querySelectorAll(classElement);
|
|
950
|
+
if (elements?.length) {
|
|
951
|
+
elements.item(0).focus();
|
|
952
|
+
setTimeout(() => {
|
|
953
|
+
listElement?.scroll({ top: 0, behavior: 'smooth' });
|
|
954
|
+
}, 100);
|
|
955
|
+
}
|
|
956
|
+
return POSITION_INITIAL;
|
|
957
|
+
}
|
|
958
|
+
function navigationInputUp(props) {
|
|
959
|
+
const { contentElement, listElement } = props;
|
|
960
|
+
if (locationListIsBottom(contentElement, listElement)) {
|
|
961
|
+
return undefined;
|
|
962
|
+
}
|
|
963
|
+
const elements = listElement?.querySelectorAll(classElement);
|
|
964
|
+
if (!elements?.length) {
|
|
965
|
+
return POSITION_INITIAL;
|
|
966
|
+
}
|
|
967
|
+
const position = elements.length - 1;
|
|
968
|
+
const element = elements.item(position);
|
|
969
|
+
element?.focus();
|
|
970
|
+
setTimeout(() => {
|
|
971
|
+
listElement?.scroll({
|
|
972
|
+
top: element?.offsetTop + element?.offsetLeft,
|
|
973
|
+
behavior: 'smooth'
|
|
974
|
+
});
|
|
975
|
+
}, 100);
|
|
976
|
+
return position;
|
|
977
|
+
}
|
|
978
|
+
function navigationElementDown(props) {
|
|
979
|
+
const { contentElement, inputElement, listElement, position } = props;
|
|
980
|
+
const elements = listElement?.querySelectorAll(classElement);
|
|
981
|
+
const newPosition = position + 1;
|
|
982
|
+
if (newPosition < (elements?.length || 0)) {
|
|
983
|
+
elements?.item(newPosition)?.focus();
|
|
984
|
+
return newPosition;
|
|
985
|
+
}
|
|
986
|
+
if (!locationListIsBottom(contentElement, listElement)) {
|
|
987
|
+
inputElement?.focus();
|
|
988
|
+
}
|
|
989
|
+
return position;
|
|
990
|
+
}
|
|
991
|
+
function navigationElementUp(props) {
|
|
992
|
+
const { contentElement, inputElement, listElement, position } = props;
|
|
993
|
+
if (position > 0) {
|
|
994
|
+
const elements = listElement?.querySelectorAll(classElement);
|
|
995
|
+
const newPosition = position - 1;
|
|
996
|
+
elements?.item(newPosition)?.focus();
|
|
997
|
+
return newPosition;
|
|
998
|
+
}
|
|
999
|
+
if (locationListIsBottom(contentElement, listElement)) {
|
|
1000
|
+
inputElement?.focus();
|
|
1001
|
+
}
|
|
1002
|
+
return POSITION_INITIAL;
|
|
1003
|
+
}
|
|
1004
|
+
function listNavigationInput(props) {
|
|
1005
|
+
switch (props.event.code) {
|
|
1006
|
+
case 'ArrowDown':
|
|
1007
|
+
return navigationInputDown(props);
|
|
1008
|
+
case 'ArrowUp':
|
|
1009
|
+
return navigationInputUp(props);
|
|
1010
|
+
default:
|
|
1011
|
+
return undefined;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function listNavigationElement(props) {
|
|
1015
|
+
const { event } = props;
|
|
1016
|
+
switch (event.code) {
|
|
1017
|
+
case 'ArrowDown':
|
|
1018
|
+
return navigationElementDown(props);
|
|
1019
|
+
case 'ArrowUp':
|
|
1020
|
+
return navigationElementUp(props);
|
|
1021
|
+
default:
|
|
1022
|
+
return POSITION_INITIAL;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
class ListCollection {
|
|
1027
|
+
constructor(value) {
|
|
1028
|
+
this.value = value;
|
|
1029
|
+
}
|
|
1030
|
+
find(element) {
|
|
1031
|
+
return this.value.find((current) => current.compareTo(element));
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1036
|
+
const currentDate = date || new Date(); // Initial date
|
|
1037
|
+
const [weeks, setWeeks] = useState([]);
|
|
1038
|
+
const [value, setValue] = useState(formControl?.state || currentDate.getDate());
|
|
1039
|
+
useEffect(() => {
|
|
1040
|
+
const props = createPickerProps();
|
|
1041
|
+
const day = checkDayPicker(props);
|
|
1042
|
+
day ? setDayValue(day) : setWeeks(createDayPicker(props));
|
|
1043
|
+
}, [date, month, year, value, minDate, maxDate]);
|
|
1044
|
+
useEffect(() => {
|
|
1045
|
+
const day = checkDayPicker(createPickerProps());
|
|
1046
|
+
day
|
|
1047
|
+
? formControl?.setState(day)
|
|
1048
|
+
: setValue(formControl?.state || currentDate.getDate());
|
|
1049
|
+
}, [formControl?.state]);
|
|
1050
|
+
function createPickerProps() {
|
|
1109
1051
|
return {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1052
|
+
date: currentDate,
|
|
1053
|
+
day: formControl?.state || value,
|
|
1054
|
+
month: itIsDefined(month) ? month : currentDate.getMonth(),
|
|
1055
|
+
year: year || currentDate.getFullYear(),
|
|
1056
|
+
minDate,
|
|
1057
|
+
maxDate
|
|
1114
1058
|
};
|
|
1115
1059
|
}
|
|
1116
|
-
function
|
|
1117
|
-
|
|
1118
|
-
}
|
|
1119
|
-
function refreshPage(elements, filter) {
|
|
1120
|
-
const collection = refreshCollection(elements, filter);
|
|
1121
|
-
const maxPage = refreshMaxPage(collection, count);
|
|
1122
|
-
const index = refreshIndex(collection, maxPage);
|
|
1123
|
-
return clonePage({ collection, index, maxPage });
|
|
1060
|
+
function setDayValue(value) {
|
|
1061
|
+
formControl ? formControl.setState(value) : setValue(value);
|
|
1124
1062
|
}
|
|
1125
|
-
function
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
value,
|
|
1130
|
-
active
|
|
1131
|
-
};
|
|
1132
|
-
if (active) {
|
|
1133
|
-
setCurrentPagination(pagination);
|
|
1063
|
+
function onChange(value) {
|
|
1064
|
+
setDayValue(value);
|
|
1065
|
+
if (onValue) {
|
|
1066
|
+
onValue(value);
|
|
1134
1067
|
}
|
|
1135
|
-
return pagination;
|
|
1136
|
-
}
|
|
1137
|
-
function rebootPagination() {
|
|
1138
|
-
setCollection([]);
|
|
1139
|
-
setMaxPage(0);
|
|
1140
|
-
setIndex(0);
|
|
1141
|
-
setPaginations([]);
|
|
1142
|
-
onChangeElements([]);
|
|
1143
1068
|
}
|
|
1144
|
-
return (jsxs("div", { className: "rls-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1069
|
+
return (jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsx("div", { className: renderClassStatus('rls-picker-day__element', {
|
|
1070
|
+
disabled: disabled || disabledPicker,
|
|
1071
|
+
focused,
|
|
1072
|
+
forbidden,
|
|
1073
|
+
selected,
|
|
1074
|
+
today
|
|
1075
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1151
1076
|
}
|
|
1152
1077
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1078
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1079
|
+
|
|
1080
|
+
function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
|
|
1081
|
+
const currentRange = formControl?.state || DateRange.now();
|
|
1082
|
+
const currentDate = normalizeMinTime(date || currentRange.minDate);
|
|
1083
|
+
const sourceDate = useRef(currentRange.minDate);
|
|
1084
|
+
const [weeks, setWeeks] = useState([]);
|
|
1085
|
+
const [range, setRange] = useState(currentRange);
|
|
1086
|
+
useEffect(() => {
|
|
1087
|
+
setWeeks(createDayRangePicker({
|
|
1088
|
+
date: currentDate,
|
|
1089
|
+
range,
|
|
1090
|
+
sourceDate: sourceDate.current,
|
|
1091
|
+
minDate,
|
|
1092
|
+
maxDate
|
|
1093
|
+
}));
|
|
1094
|
+
}, [range, date, minDate, maxDate]);
|
|
1095
|
+
function onChange(value) {
|
|
1096
|
+
const date = assignDayInDate(currentDate, value);
|
|
1097
|
+
const range = dateIsBefore(date, sourceDate.current)
|
|
1098
|
+
? new DateRange(sourceDate.current, date)
|
|
1099
|
+
: new DateRange(date, sourceDate.current);
|
|
1100
|
+
sourceDate.current = date;
|
|
1101
|
+
setRange(range);
|
|
1102
|
+
formControl?.setState(range);
|
|
1157
1103
|
}
|
|
1158
|
-
return (jsxs("div", { className: renderClassStatus('
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1104
|
+
return (jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-picker-day-range__title", children: dateFormatTemplate(sourceDate.current, DATE_RANGE_FORMAT) }), jsx("div", { className: "rls-picker-day-range__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-picker-day-range__label", children: title }, index))) }), jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-picker-day-range__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsx("div", { className: renderClassStatus('rls-picker-day-range__element', {
|
|
1105
|
+
disabled: disabled || disabledPicker,
|
|
1106
|
+
end,
|
|
1107
|
+
forbidden,
|
|
1108
|
+
ranged,
|
|
1109
|
+
source
|
|
1110
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1163
1111
|
}
|
|
1164
1112
|
|
|
1165
|
-
function
|
|
1166
|
-
const
|
|
1113
|
+
function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
1114
|
+
const currentDate = date || new Date();
|
|
1115
|
+
const [months, setMonths] = useState([]);
|
|
1116
|
+
const [value, setValue] = useState(formControl?.state || currentDate.getMonth());
|
|
1167
1117
|
useEffect(() => {
|
|
1168
|
-
|
|
1118
|
+
const props = createPickerProps(); // MonthPickerProps
|
|
1119
|
+
const month = checkMonthPicker(props);
|
|
1120
|
+
month ? setMonthValue(month) : setMonths(createMonthPicker(props));
|
|
1121
|
+
}, [date, year, value, minDate, maxDate]);
|
|
1122
|
+
useEffect(() => {
|
|
1123
|
+
const month = checkMonthPicker(createPickerProps());
|
|
1124
|
+
itIsDefined(month)
|
|
1125
|
+
? formControl?.setState(month)
|
|
1126
|
+
: setValue(formControl?.state || currentDate.getMonth());
|
|
1169
1127
|
}, [formControl?.state]);
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1172
|
-
|
|
1128
|
+
function createPickerProps() {
|
|
1129
|
+
return {
|
|
1130
|
+
date: currentDate,
|
|
1131
|
+
month: itIsDefined(formControl?.state) ? formControl?.state : value,
|
|
1132
|
+
year: year || currentDate.getFullYear(),
|
|
1133
|
+
minDate,
|
|
1134
|
+
maxDate
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function setMonthValue(value) {
|
|
1138
|
+
formControl ? formControl.setState(value) : setValue(value);
|
|
1139
|
+
}
|
|
1140
|
+
function onChange(value) {
|
|
1141
|
+
setMonthValue(value);
|
|
1142
|
+
if (onValue) {
|
|
1143
|
+
onValue(value);
|
|
1173
1144
|
}
|
|
1174
1145
|
}
|
|
1175
|
-
return (
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1146
|
+
return (jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-picker-month__component', {
|
|
1147
|
+
disabled: disabled || disabledPicker,
|
|
1148
|
+
focused,
|
|
1149
|
+
selected
|
|
1150
|
+
}), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
|
|
1179
1151
|
}
|
|
1180
1152
|
|
|
1181
|
-
function
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1153
|
+
function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
1154
|
+
const { limitNext, limitPrevious } = monthLimitTemplate({
|
|
1155
|
+
date,
|
|
1156
|
+
maxDate,
|
|
1157
|
+
minDate,
|
|
1158
|
+
month: monthControl.state
|
|
1159
|
+
});
|
|
1160
|
+
const monthName = MONTH_NAMES()[monthControl.state || 0];
|
|
1161
|
+
function onPreviousMonth() {
|
|
1162
|
+
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
1163
|
+
if (monthControl.state > Month.January) {
|
|
1164
|
+
monthControl.setState(monthControl.state - 1);
|
|
1165
|
+
}
|
|
1166
|
+
else {
|
|
1167
|
+
monthControl.setState(Month.December);
|
|
1168
|
+
yearControl.setState(yearControl.state - 1);
|
|
1169
|
+
}
|
|
1189
1170
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1171
|
+
}
|
|
1172
|
+
function onPreviousYear() {
|
|
1173
|
+
if (itIsDefined(yearControl.state)) {
|
|
1174
|
+
yearControl.setState(yearControl.state - 1);
|
|
1192
1175
|
}
|
|
1193
1176
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
function
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1177
|
+
function onPrevious() {
|
|
1178
|
+
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
1179
|
+
}
|
|
1180
|
+
function onNextMonth() {
|
|
1181
|
+
if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
|
|
1182
|
+
if (monthControl.state < Month.December) {
|
|
1183
|
+
monthControl.setState(monthControl.state + 1);
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
monthControl.setState(Month.January);
|
|
1187
|
+
yearControl.setState(yearControl.state + 1);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
function onNextYear() {
|
|
1192
|
+
if (itIsDefined(yearControl.state)) {
|
|
1193
|
+
yearControl.setState(yearControl.state + 1);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function onNext() {
|
|
1197
|
+
type === 'month' ? onNextMonth() : onNextYear();
|
|
1198
|
+
}
|
|
1199
|
+
return (jsxs("div", { className: "rls-picker-month-title", children: [jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsx("span", { onClick: onClick, children: monthName }), jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
1207
1200
|
}
|
|
1208
1201
|
|
|
1209
|
-
function
|
|
1202
|
+
function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme }) {
|
|
1210
1203
|
const currentDate = date || new Date();
|
|
1211
1204
|
const [value, setValue] = useState(formControl?.state || currentDate.getFullYear());
|
|
1212
1205
|
const [year, setYear] = useState(formControl?.state || currentDate.getFullYear());
|
|
@@ -1248,11 +1241,19 @@ function RlsYearPicker({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
1248
1241
|
onValue(value);
|
|
1249
1242
|
}
|
|
1250
1243
|
}
|
|
1251
|
-
return (jsxs("div", { className: "rls-year
|
|
1244
|
+
return (jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-year__header", children: [jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-picker-year__year', {
|
|
1252
1245
|
disabled: disabled || disabledPicker,
|
|
1253
1246
|
focused,
|
|
1254
1247
|
selected
|
|
1255
|
-
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-
|
|
1248
|
+
}), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
function RlsToolbar({ actions, children, subtitle }) {
|
|
1252
|
+
return (jsxs("div", { className: "rls-toolbar", children: [jsxs("div", { className: "rls-toolbar__description", children: [children && jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsx("div", { children: action }, index))) }))] }));
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
function RlsCard({ children, outline, rlsTheme }) {
|
|
1256
|
+
return (jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-card__content", children: children }) }));
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
1258
1259
|
const reactI18n = i18n({
|
|
@@ -1276,6 +1277,87 @@ const reactI18n = i18n({
|
|
|
1276
1277
|
}
|
|
1277
1278
|
});
|
|
1278
1279
|
|
|
1280
|
+
class ConfirmationResult extends PartialSealed {
|
|
1281
|
+
static approved() {
|
|
1282
|
+
return new ConfirmationResult('approved');
|
|
1283
|
+
}
|
|
1284
|
+
static reject() {
|
|
1285
|
+
return new ConfirmationResult('reject');
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
1289
|
+
return (jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-confirmation__component", children: [jsxs("div", { className: "rls-confirmation__header", children: [title && (jsx("div", { className: "rls-confirmation__header__title", children: title })), subtitle && (jsx("div", { className: "rls-confirmation__header__subtitle", children: subtitle }))] }), jsx("div", { className: "rls-confirmation__body", children: content && (jsx("div", { className: "rls-confirmation__body__content", children: content })) }), (approved || reject) && (jsx("div", { className: "rls-confirmation__footer", children: jsxs("div", { className: "rls-confirmation__footer__actions", children: [approved && (jsx(RlsButton, { type: "raised", onClick: () => {
|
|
1290
|
+
if (approved.onClick) {
|
|
1291
|
+
approved.onClick();
|
|
1292
|
+
}
|
|
1293
|
+
}, children: approved.label })), reject && (jsx(RlsButton, { type: "outline", onClick: () => {
|
|
1294
|
+
if (reject.onClick) {
|
|
1295
|
+
reject.onClick();
|
|
1296
|
+
}
|
|
1297
|
+
}, children: reject.label }))] }) }))] }), jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1298
|
+
}
|
|
1299
|
+
function useConfirmationService() {
|
|
1300
|
+
const [config, setConfig] = useState({});
|
|
1301
|
+
const [visible, setVisible] = useState(false);
|
|
1302
|
+
const rlsConfirmation = ReactDOM.createPortal(jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
|
|
1303
|
+
function confirmation(config) {
|
|
1304
|
+
return new Promise((resolve) => {
|
|
1305
|
+
const { content, rlsTheme, subtitle, title, approved, reject } = config;
|
|
1306
|
+
setConfig({
|
|
1307
|
+
content,
|
|
1308
|
+
rlsTheme,
|
|
1309
|
+
subtitle,
|
|
1310
|
+
title,
|
|
1311
|
+
approved: {
|
|
1312
|
+
label: approved || reactI18n('confirmationActionApproved'),
|
|
1313
|
+
onClick: () => {
|
|
1314
|
+
setVisible(false);
|
|
1315
|
+
resolve(ConfirmationResult.approved());
|
|
1316
|
+
}
|
|
1317
|
+
},
|
|
1318
|
+
reject: reject
|
|
1319
|
+
? {
|
|
1320
|
+
label: reject,
|
|
1321
|
+
onClick: () => {
|
|
1322
|
+
setVisible(false);
|
|
1323
|
+
resolve(ConfirmationResult.reject());
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
: undefined
|
|
1327
|
+
});
|
|
1328
|
+
setVisible(true);
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
return {
|
|
1332
|
+
RlsConfirmation: rlsConfirmation,
|
|
1333
|
+
confirmation
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
function RlsDatatableHeader({ children }) {
|
|
1338
|
+
return jsx("tr", { className: "rls-datatable__header", children: children });
|
|
1339
|
+
}
|
|
1340
|
+
function RlsDatatableTitle({ children, className, control }) {
|
|
1341
|
+
return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
|
|
1342
|
+
}
|
|
1343
|
+
function RlsDatatableData({ children, className, error }) {
|
|
1344
|
+
return (jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
|
|
1345
|
+
}
|
|
1346
|
+
function RlsDatatableCell({ children, className, control, overflow }) {
|
|
1347
|
+
return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
|
|
1348
|
+
}
|
|
1349
|
+
function RlsDatatableTotals({ children, className, error }) {
|
|
1350
|
+
return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
|
|
1351
|
+
}
|
|
1352
|
+
function RlsDatatableInfo({ children, className, control, overflow }) {
|
|
1353
|
+
return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
|
|
1354
|
+
}
|
|
1355
|
+
function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
|
|
1356
|
+
return (jsxs("div", { className: renderClassStatus('rls-datatable', {
|
|
1357
|
+
scrolleable: datatable?.scrolleable
|
|
1358
|
+
}), "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1279
1361
|
function useDatatable() {
|
|
1280
1362
|
const [scrolleable, setScrolleable] = useState(false);
|
|
1281
1363
|
const bodyRef = useRef(null);
|
|
@@ -1366,7 +1448,7 @@ function useListControl({ suggestions, formControl }) {
|
|
|
1366
1448
|
|
|
1367
1449
|
const DURATION_ANIMATION$1 = 240;
|
|
1368
1450
|
const MAX_ELEMENTS = 6;
|
|
1369
|
-
function
|
|
1451
|
+
function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, suggestions }) {
|
|
1370
1452
|
const [pattern, setPattern] = useState('');
|
|
1371
1453
|
const [coincidences, setCoincidences] = useState([]);
|
|
1372
1454
|
const currentStore = useRef({
|
|
@@ -1505,115 +1587,30 @@ function useAutocompleteField({ disabled, formControl, onSelect, onValue, sugges
|
|
|
1505
1587
|
};
|
|
1506
1588
|
}
|
|
1507
1589
|
|
|
1508
|
-
function
|
|
1509
|
-
const { coincidences, listControl, pattern, onBlurInput, onClickAction, onClickBackdrop, onClickControl, onClickElement, onFocusInput, onKeydownElement, onKeydownInput, setPattern } =
|
|
1590
|
+
function RlsFieldAutocompleteTemplate({ suggestions, children, disabled, formControl, hiddenIcon, placeholder, searching, rlsTheme, onSearch, onSelect, onValue, render }) {
|
|
1591
|
+
const { coincidences, listControl, pattern, onBlurInput, onClickAction, onClickBackdrop, onClickControl, onClickElement, onFocusInput, onKeydownElement, onKeydownInput, setPattern } = useFieldAutocomplete({
|
|
1510
1592
|
suggestions,
|
|
1511
1593
|
disabled,
|
|
1512
1594
|
formControl,
|
|
1513
1595
|
onSelect,
|
|
1514
1596
|
onValue
|
|
1515
1597
|
});
|
|
1516
|
-
return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-box
|
|
1598
|
+
return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', {
|
|
1517
1599
|
disabled,
|
|
1518
1600
|
focused: listControl.focused,
|
|
1519
1601
|
selected: !!listControl.value
|
|
1520
|
-
}, 'rls-
|
|
1602
|
+
}, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("label", { className: "rls-field-list__control", onClick: onClickControl, children: listControl.value ? (jsx("span", { className: "rls-field-list__control__description", children: listControl.value })) : (jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && listControl.value && (jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "trash-2" }) }))] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
1521
1603
|
visible: listControl.visible,
|
|
1522
1604
|
hide: !listControl.visible,
|
|
1523
1605
|
higher: listControl.higher
|
|
1524
|
-
}), children: [jsx("div", { className: "rls-
|
|
1606
|
+
}), children: [jsx("div", { className: "rls-field-list__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-field-list__ul", children: [jsxs("div", { className: "rls-field-list__ul__search", children: [jsx("input", { ref: listControl.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: pattern, onChange: ({ target: { value } }) => {
|
|
1525
1607
|
setPattern(value);
|
|
1526
1608
|
}, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (jsx("button", { disabled: disabled || searching, onClick: () => {
|
|
1527
1609
|
onSearch(pattern);
|
|
1528
|
-
}, children: jsx(RlsIcon, { value: "search" }) }))] }), searching && jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsx("li", { className: "rls-
|
|
1529
|
-
}
|
|
1530
|
-
function RlsAutocompleteField(props) {
|
|
1531
|
-
return (jsx(RlsAutocompleteFieldTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
function RlsCard({ children, outline, rlsTheme }) {
|
|
1535
|
-
return (jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-card__content", children: children }) }));
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
class ConfirmationResult extends PartialSealed {
|
|
1539
|
-
static approved() {
|
|
1540
|
-
return new ConfirmationResult('approved');
|
|
1541
|
-
}
|
|
1542
|
-
static reject() {
|
|
1543
|
-
return new ConfirmationResult('reject');
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
1547
|
-
return (jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-confirmation__component", children: [jsxs("div", { className: "rls-confirmation__header", children: [title && (jsx("div", { className: "rls-confirmation__header__title", children: title })), subtitle && (jsx("div", { className: "rls-confirmation__header__subtitle", children: subtitle }))] }), jsx("div", { className: "rls-confirmation__body", children: content && (jsx("div", { className: "rls-confirmation__body__content", children: content })) }), (approved || reject) && (jsx("div", { className: "rls-confirmation__footer", children: jsxs("div", { className: "rls-confirmation__footer__actions", children: [approved && (jsx(RlsButton, { type: "raised", onClick: () => {
|
|
1548
|
-
if (approved.onClick) {
|
|
1549
|
-
approved.onClick();
|
|
1550
|
-
}
|
|
1551
|
-
}, children: approved.label })), reject && (jsx(RlsButton, { type: "outline", onClick: () => {
|
|
1552
|
-
if (reject.onClick) {
|
|
1553
|
-
reject.onClick();
|
|
1554
|
-
}
|
|
1555
|
-
}, children: reject.label }))] }) }))] }), jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
1556
|
-
}
|
|
1557
|
-
function useConfirmationService() {
|
|
1558
|
-
const [config, setConfig] = useState({});
|
|
1559
|
-
const [visible, setVisible] = useState(false);
|
|
1560
|
-
const rlsConfirmation = ReactDOM.createPortal(jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
|
|
1561
|
-
function confirmation(config) {
|
|
1562
|
-
return new Promise((resolve) => {
|
|
1563
|
-
const { content, rlsTheme, subtitle, title, approved, reject } = config;
|
|
1564
|
-
setConfig({
|
|
1565
|
-
content,
|
|
1566
|
-
rlsTheme,
|
|
1567
|
-
subtitle,
|
|
1568
|
-
title,
|
|
1569
|
-
approved: {
|
|
1570
|
-
label: approved || reactI18n('confirmationActionApproved'),
|
|
1571
|
-
onClick: () => {
|
|
1572
|
-
setVisible(false);
|
|
1573
|
-
resolve(ConfirmationResult.approved());
|
|
1574
|
-
}
|
|
1575
|
-
},
|
|
1576
|
-
reject: reject
|
|
1577
|
-
? {
|
|
1578
|
-
label: reject,
|
|
1579
|
-
onClick: () => {
|
|
1580
|
-
setVisible(false);
|
|
1581
|
-
resolve(ConfirmationResult.reject());
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
: undefined
|
|
1585
|
-
});
|
|
1586
|
-
setVisible(true);
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
return {
|
|
1590
|
-
RlsConfirmation: rlsConfirmation,
|
|
1591
|
-
confirmation
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
function RlsDatatableHeader({ children }) {
|
|
1596
|
-
return jsx("tr", { className: "rls-datatable__header", children: children });
|
|
1597
|
-
}
|
|
1598
|
-
function RlsDatatableTitle({ children, className, control }) {
|
|
1599
|
-
return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
|
|
1610
|
+
}, children: jsx(RlsIcon, { value: "search" }) }))] }), searching && jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !coincidences.length && (jsx("li", { className: "rls-field-list__empty", children: jsxs("div", { className: "rls-field-list__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-field-list__backdrop", onClick: onClickBackdrop })] })] }));
|
|
1600
1611
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return (jsx(
|
|
1603
|
-
}
|
|
1604
|
-
function RlsDatatableCell({ children, className, control, overflow }) {
|
|
1605
|
-
return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
|
|
1606
|
-
}
|
|
1607
|
-
function RlsDatatableTotals({ children, className, error }) {
|
|
1608
|
-
return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
|
|
1609
|
-
}
|
|
1610
|
-
function RlsDatatableInfo({ children, className, control, overflow }) {
|
|
1611
|
-
return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
|
|
1612
|
-
}
|
|
1613
|
-
function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
|
|
1614
|
-
return (jsxs("div", { className: renderClassStatus('rls-datatable', {
|
|
1615
|
-
scrolleable: datatable?.scrolleable
|
|
1616
|
-
}), "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
|
|
1612
|
+
function RlsFieldAutocomplete(props) {
|
|
1613
|
+
return (jsx(RlsFieldAutocompleteTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
|
|
1617
1614
|
}
|
|
1618
1615
|
|
|
1619
1616
|
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
@@ -1622,6 +1619,10 @@ function rangeFormatTemplate({ maxDate, minDate }) {
|
|
|
1622
1619
|
return `${minFormat} - ${maxFormat}`;
|
|
1623
1620
|
}
|
|
1624
1621
|
|
|
1622
|
+
function RlsModal({ children, visible, rlsTheme }) {
|
|
1623
|
+
return ReactDOM.createPortal(jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-modal__component", children: children }), jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1625
1626
|
const controlIsValid = (props) => {
|
|
1626
1627
|
const { state, validators } = props;
|
|
1627
1628
|
return validators.reduce((errors, validator) => {
|
|
@@ -1719,7 +1720,7 @@ function useReactControl(controlProps, controlValidators) {
|
|
|
1719
1720
|
}
|
|
1720
1721
|
|
|
1721
1722
|
const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
|
|
1722
|
-
function
|
|
1723
|
+
function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
1723
1724
|
const today = new Date(); // Initial current date in component
|
|
1724
1725
|
const dateInitial = formControl?.state || date || today;
|
|
1725
1726
|
const yearControl = useReactControl(dateInitial.getFullYear());
|
|
@@ -1780,18 +1781,14 @@ function RlsDatePicker({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
1780
1781
|
onListener({ type: PickerListenerType.Select, value });
|
|
1781
1782
|
}
|
|
1782
1783
|
}
|
|
1783
|
-
return (jsxs("div", { className: "rls-date
|
|
1784
|
+
return (jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-date__header", children: [jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_DESCRIPTION) }) }), jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
|
|
1784
1785
|
day: visibility === 'DAY',
|
|
1785
1786
|
month: visibility === 'MONTH',
|
|
1786
1787
|
year: visibility === 'YEAR'
|
|
1787
|
-
}), children: [jsx(
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
function RlsModal({ children, visible, rlsTheme }) {
|
|
1791
|
-
return ReactDOM.createPortal(jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-modal__component", children: children }), jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
1788
|
+
}), children: [jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.state, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-picker-date__footer', { automatic }), children: jsxs("div", { className: "rls-picker-date__actions", children: [jsx("div", { className: "rls-picker-date__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-picker-date__actions--today", children: jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsx("div", { className: "rls-picker-date__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
|
|
1792
1789
|
}
|
|
1793
1790
|
|
|
1794
|
-
function
|
|
1791
|
+
function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate, onValue, placeholder, rlsTheme }) {
|
|
1795
1792
|
const today = new Date(); // Initial current date in component
|
|
1796
1793
|
const [value, setValue] = useState();
|
|
1797
1794
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
@@ -1827,7 +1824,7 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
1827
1824
|
setModalIsVisible(true);
|
|
1828
1825
|
}
|
|
1829
1826
|
}
|
|
1830
|
-
return (jsxs("div", { className: "rls-date
|
|
1827
|
+
return (jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { className: "rls-field-date__control", type: "text", value: value ? dateFormatTemplate(value, DATE_RANGE_FORMAT) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-field-date__action", onClick: onClean, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
|
|
1831
1828
|
if (type !== PickerListenerType.Cancel) {
|
|
1832
1829
|
onChange(value, true);
|
|
1833
1830
|
}
|
|
@@ -1838,7 +1835,7 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
|
|
|
1838
1835
|
} }) })] }));
|
|
1839
1836
|
}
|
|
1840
1837
|
|
|
1841
|
-
function
|
|
1838
|
+
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
1842
1839
|
const dateInitial = normalizeMinTime(datePicker || new Date());
|
|
1843
1840
|
const rangeInitial = formControl?.state || DateRange.now();
|
|
1844
1841
|
const yearControl = useReactControl(dateInitial.getFullYear());
|
|
@@ -1887,16 +1884,16 @@ function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl
|
|
|
1887
1884
|
onListener({ type: PickerListenerType.Select, value });
|
|
1888
1885
|
}
|
|
1889
1886
|
}
|
|
1890
|
-
return (jsxs("div", { className: "rls-date-range
|
|
1887
|
+
return (jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-date-range__header", children: [jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.state }) }), jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-picker-date-range__component', {
|
|
1891
1888
|
day: visibility === 'DAY',
|
|
1892
1889
|
month: visibility === 'MONTH',
|
|
1893
1890
|
year: visibility === 'YEAR'
|
|
1894
|
-
}), children: [jsx(
|
|
1891
|
+
}), children: [jsx(RlsPickerDayRange, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-picker-date-range__footer', {
|
|
1895
1892
|
automatic
|
|
1896
|
-
}), children: jsxs("div", { className: "rls-date-
|
|
1893
|
+
}), children: jsxs("div", { className: "rls-picker-date-range__actions", children: [jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
|
|
1897
1894
|
}
|
|
1898
1895
|
|
|
1899
|
-
function
|
|
1896
|
+
function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
|
|
1900
1897
|
const currentRange = formControl?.state || DateRange.now();
|
|
1901
1898
|
const currentDate = datePicker || new Date();
|
|
1902
1899
|
const [value, setValue] = useState(currentRange);
|
|
@@ -1913,7 +1910,7 @@ function RlsDateRangeField({ children, date: datePicker, disabled, formControl,
|
|
|
1913
1910
|
setModalIsVisible(true);
|
|
1914
1911
|
}
|
|
1915
1912
|
}
|
|
1916
|
-
return (jsxs("div", { className: "rls-date-
|
|
1913
|
+
return (jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
1917
1914
|
if (value) {
|
|
1918
1915
|
setValue(value);
|
|
1919
1916
|
}
|
|
@@ -1921,11 +1918,7 @@ function RlsDateRangeField({ children, date: datePicker, disabled, formControl,
|
|
|
1921
1918
|
} }) })] }));
|
|
1922
1919
|
}
|
|
1923
1920
|
|
|
1924
|
-
function
|
|
1925
|
-
return (jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
function useSelectField({ suggestions, formControl, onSelect, onValue }) {
|
|
1921
|
+
function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
1929
1922
|
const listControl = useListControl({ suggestions, formControl });
|
|
1930
1923
|
const { collection, inputRef, visible, navigationElement, navigationInput, setFocused, setValue, setVisible } = listControl;
|
|
1931
1924
|
const initializedState = useRef(false);
|
|
@@ -2036,24 +2029,28 @@ function useSelectField({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2036
2029
|
};
|
|
2037
2030
|
}
|
|
2038
2031
|
|
|
2039
|
-
function
|
|
2040
|
-
const { listControl, onBlurInput, onClickAction, onClickBackdrop, onClickElement, onClickInput, onFocusInput, onKeydownElement, onKeydownInput } =
|
|
2032
|
+
function RlsFieldSelectTemplate({ suggestions, children, disabled, formControl, placeholder, rlsTheme, onSelect, onValue, render }) {
|
|
2033
|
+
const { listControl, onBlurInput, onClickAction, onClickBackdrop, onClickElement, onClickInput, onFocusInput, onKeydownElement, onKeydownInput } = useFieldSelect({
|
|
2041
2034
|
suggestions,
|
|
2042
2035
|
disabled,
|
|
2043
2036
|
formControl,
|
|
2044
2037
|
onSelect,
|
|
2045
2038
|
onValue
|
|
2046
2039
|
});
|
|
2047
|
-
return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-box
|
|
2040
|
+
return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', { focused: listControl.focused, disabled }, 'rls-field-list rls-field-select'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { ref: listControl.inputRef, className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: listControl.value, onFocus: onFocusInput, onBlur: onBlurInput, onClick: onClickInput, onKeyDown: onKeydownInput }), jsx("button", { className: renderClassStatus('rls-field-list__action', {
|
|
2048
2041
|
visible: listControl.visible
|
|
2049
|
-
}), disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }),
|
|
2042
|
+
}), disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2050
2043
|
visible: listControl.visible,
|
|
2051
2044
|
hide: !listControl.visible,
|
|
2052
2045
|
higher: listControl.higher
|
|
2053
|
-
}), children: [jsx("div", { className: "rls-
|
|
2046
|
+
}), children: [jsx("div", { className: "rls-field-list__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsx("li", { className: "rls-field-list__empty", children: jsxs("div", { className: "rls-field-list__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-field-list__backdrop", onClick: onClickBackdrop })] })] }));
|
|
2054
2047
|
}
|
|
2055
|
-
function
|
|
2056
|
-
return (jsx(
|
|
2048
|
+
function RlsFieldSelect(props) {
|
|
2049
|
+
return (jsx(RlsFieldSelectTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
2053
|
+
return (jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
2057
2054
|
}
|
|
2058
2055
|
|
|
2059
2056
|
const DURATION_ANIMATION = 240;
|
|
@@ -2117,5 +2114,5 @@ function RlsApplication({ children }) {
|
|
|
2117
2114
|
return (jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
|
|
2118
2115
|
}
|
|
2119
2116
|
|
|
2120
|
-
export { ConfirmationResult, RlsAmount, RlsApplication,
|
|
2117
|
+
export { ConfirmationResult, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableInfo, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerMonthTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSearchInput, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, useConfirmationService, useDatatable, useListControl, useSnackbarService };
|
|
2121
2118
|
//# sourceMappingURL=index.js.map
|