@rolster/react-components 18.20.6 → 18.21.0
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-Cp7p-Y-D.css → index-eohCf4O9.css} +10 -10
- package/dist/cjs/index.js +543 -297
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-Cp7p-Y-D.css → index-eohCf4O9.css} +10 -10
- package/dist/es/index.js +542 -297
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js +6 -2
- package/dist/esm/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js +10 -3
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/Button/Button.js +6 -2
- package/dist/esm/components/atoms/Button/Button.js.map +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.css +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.js +10 -5
- package/dist/esm/components/atoms/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Icon.js +6 -2
- package/dist/esm/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +9 -6
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +8 -5
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/Poster/Poster.js +6 -2
- package/dist/esm/components/atoms/Poster/Poster.js.map +1 -1
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js +6 -2
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.css +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.js +6 -2
- package/dist/esm/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/atoms/Switch/Switch.css +1 -1
- package/dist/esm/components/atoms/Switch/Switch.js +10 -5
- package/dist/esm/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/esm/components/molecules/Alert/Alert.js +7 -3
- package/dist/esm/components/molecules/Alert/Alert.js.map +1 -1
- package/dist/esm/components/molecules/Ballot/Ballot.js +8 -3
- package/dist/esm/components/molecules/Ballot/Ballot.js.map +1 -1
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.js +8 -3
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.js.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.css +2 -2
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.d.ts +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +11 -9
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +14 -5
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -1
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +14 -5
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -1
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js +15 -6
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js.map +1 -1
- package/dist/esm/components/molecules/FieldText/FieldText.js +14 -5
- package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -1
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js +7 -7
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js.map +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +7 -7
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +7 -7
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js.map +1 -1
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.js +16 -2
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js +23 -32
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.d.ts +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +3 -3
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.d.ts +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +3 -3
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.d.ts +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +4 -4
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/organisms/Card/Card.js +6 -2
- package/dist/esm/components/organisms/Card/Card.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.css +5 -5
- package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +2 -2
- package/dist/esm/components/organisms/Confirmation/Confirmation.js +10 -7
- package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.js +31 -9
- package/dist/esm/components/organisms/Datatable/Datatable.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +5 -5
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +25 -13
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.d.ts +5 -4
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +12 -9
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.d.ts +5 -4
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +8 -8
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js +6 -2
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js.map +1 -1
- package/dist/esm/components/organisms/Modal/Modal.js +6 -2
- package/dist/esm/components/organisms/Modal/Modal.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +15 -9
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +20 -12
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.d.ts +2 -2
- package/dist/esm/components/organisms/Snackbar/Snackbar.js +11 -8
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/context.js +9 -8
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/helpers/css.js +1 -1
- package/dist/esm/helpers/css.js.map +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +1 -0
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/language.d.ts +4 -0
- package/dist/esm/helpers/language.js +102 -0
- package/dist/esm/helpers/language.js.map +1 -0
- package/dist/esm/i18n.d.ts +0 -8
- package/package.json +5 -5
package/dist/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import require$$0, { useState, useEffect,
|
|
1
|
+
import require$$0, { useState, useEffect, useMemo, useCallback, useRef, createContext } from 'react';
|
|
2
2
|
import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/commons';
|
|
3
|
-
import { ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, createAutocompleteStore, verifyDateRange, dateOutRange, PickerListenerEvent } from '@rolster/components';
|
|
4
3
|
import { dateFormatTemplate, DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
|
|
4
|
+
import { i18n, i18nSubscribe } from '@rolster/i18n';
|
|
5
|
+
import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, verifyDateRange, dateOutRange, PickerListenerEvent } from '@rolster/components';
|
|
5
6
|
import ReactDOM from 'react-dom';
|
|
6
|
-
import { i18n } from '@rolster/i18n';
|
|
7
7
|
import { useReactControl } from '@rolster/react-forms';
|
|
8
8
|
|
|
9
9
|
var jsxRuntime = {exports: {}};
|
|
@@ -1361,138 +1361,6 @@ function RlsAmount({ value, decimals, rlsTheme, symbol }) {
|
|
|
1361
1361
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: currencyFormat({ value, decimals }) })] }));
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
|
-
function createObserver(options) {
|
|
1365
|
-
const { setScrolleable, table } = options;
|
|
1366
|
-
const observer = new ResizeObserver(() => {
|
|
1367
|
-
const scrollHeight = table.scrollHeight || 0;
|
|
1368
|
-
const clientHeight = table.clientHeight || 0;
|
|
1369
|
-
setScrolleable(scrollHeight > clientHeight);
|
|
1370
|
-
});
|
|
1371
|
-
observer.observe(table);
|
|
1372
|
-
return observer;
|
|
1373
|
-
}
|
|
1374
|
-
function useDatatable() {
|
|
1375
|
-
const [scrolleable, setScrolleable] = useState(false);
|
|
1376
|
-
const tableRef = useRef(null);
|
|
1377
|
-
useEffect(() => {
|
|
1378
|
-
const observer = tableRef?.current &&
|
|
1379
|
-
createObserver({ setScrolleable, table: tableRef?.current });
|
|
1380
|
-
return () => {
|
|
1381
|
-
observer?.disconnect();
|
|
1382
|
-
};
|
|
1383
|
-
}, []);
|
|
1384
|
-
return { scrolleable, tableRef };
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
function useListController(props) {
|
|
1388
|
-
const { suggestions, automatic, formControl, reference } = props;
|
|
1389
|
-
const listIsOpen = useRef(false);
|
|
1390
|
-
const contentRef = useRef(null);
|
|
1391
|
-
const listRef = useRef(null);
|
|
1392
|
-
const inputRef = useRef(null);
|
|
1393
|
-
const [collection, setCollection] = useState(new ListCollection(suggestions));
|
|
1394
|
-
const [state, refreshState] = useState({
|
|
1395
|
-
focused: false,
|
|
1396
|
-
higher: false,
|
|
1397
|
-
value: '',
|
|
1398
|
-
modalIsVisible: false
|
|
1399
|
-
});
|
|
1400
|
-
const position = useRef(0);
|
|
1401
|
-
const valueProtected = useRef();
|
|
1402
|
-
const changeValueInternal = useRef(false);
|
|
1403
|
-
useEffect(() => {
|
|
1404
|
-
function onCloseSuggestions({ target }) {
|
|
1405
|
-
!contentRef?.current?.contains(target) &&
|
|
1406
|
-
refreshState((state) => ({ ...state, modalIsVisible: false }));
|
|
1407
|
-
}
|
|
1408
|
-
document.addEventListener('click', onCloseSuggestions);
|
|
1409
|
-
return () => {
|
|
1410
|
-
document.removeEventListener('click', onCloseSuggestions);
|
|
1411
|
-
};
|
|
1412
|
-
}, []);
|
|
1413
|
-
useEffect(() => {
|
|
1414
|
-
if (!listIsOpen.current && state.modalIsVisible) {
|
|
1415
|
-
listIsOpen.current = true;
|
|
1416
|
-
}
|
|
1417
|
-
if (listIsOpen.current && !state.modalIsVisible) {
|
|
1418
|
-
formControl?.touch();
|
|
1419
|
-
}
|
|
1420
|
-
refreshState((state) => ({
|
|
1421
|
-
...state,
|
|
1422
|
-
higher: locationListCanTop(contentRef.current, listRef.current)
|
|
1423
|
-
}));
|
|
1424
|
-
}, [state.modalIsVisible]);
|
|
1425
|
-
useEffect(() => {
|
|
1426
|
-
setCollection(new ListCollection(suggestions, reference));
|
|
1427
|
-
}, [suggestions]);
|
|
1428
|
-
useEffect(() => {
|
|
1429
|
-
if (!changeValueInternal.current) {
|
|
1430
|
-
if (formControl?.value) {
|
|
1431
|
-
const element = collection.find(formControl.value);
|
|
1432
|
-
if (!element) {
|
|
1433
|
-
valueProtected.current = formControl.value;
|
|
1434
|
-
automatic
|
|
1435
|
-
? setFormValue(collection.value[0], true)
|
|
1436
|
-
: setFormValue(undefined);
|
|
1437
|
-
}
|
|
1438
|
-
else {
|
|
1439
|
-
refreshState((state) => ({ ...state, value: element.description }));
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
else if (valueProtected.current) {
|
|
1443
|
-
const element = collection.find(valueProtected.current);
|
|
1444
|
-
element && setFormValue(element);
|
|
1445
|
-
}
|
|
1446
|
-
else {
|
|
1447
|
-
automatic && setFormValue(collection.value[0], true);
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
changeValueInternal.current = false;
|
|
1451
|
-
}, [collection, formControl?.value]);
|
|
1452
|
-
const setState = useCallback((state) => {
|
|
1453
|
-
refreshState((_state) => ({ ..._state, ...state }));
|
|
1454
|
-
}, []);
|
|
1455
|
-
const setFormValue = useCallback((element, initialValue = false) => {
|
|
1456
|
-
refreshState((state) => ({
|
|
1457
|
-
...state,
|
|
1458
|
-
value: element?.description || ''
|
|
1459
|
-
}));
|
|
1460
|
-
changeValueInternal.current = true;
|
|
1461
|
-
initialValue
|
|
1462
|
-
? formControl?.setInitialValue(element?.value)
|
|
1463
|
-
: formControl?.setValue(element?.value);
|
|
1464
|
-
}, [formControl]);
|
|
1465
|
-
const navigationInput = useCallback((event) => {
|
|
1466
|
-
if (state.modalIsVisible) {
|
|
1467
|
-
const _position = navigationListFromInput({
|
|
1468
|
-
content: contentRef.current,
|
|
1469
|
-
event: event,
|
|
1470
|
-
list: listRef.current
|
|
1471
|
-
});
|
|
1472
|
-
position.current = _position ?? 0;
|
|
1473
|
-
}
|
|
1474
|
-
}, [state.modalIsVisible]);
|
|
1475
|
-
const navigationElement = useCallback((event) => {
|
|
1476
|
-
position.current = navigationListFromElement({
|
|
1477
|
-
content: contentRef.current,
|
|
1478
|
-
event: event,
|
|
1479
|
-
input: inputRef.current,
|
|
1480
|
-
list: listRef.current,
|
|
1481
|
-
position: position.current
|
|
1482
|
-
});
|
|
1483
|
-
}, [state.modalIsVisible]);
|
|
1484
|
-
return {
|
|
1485
|
-
...state,
|
|
1486
|
-
contentRef,
|
|
1487
|
-
inputRef,
|
|
1488
|
-
listRef,
|
|
1489
|
-
navigationElement,
|
|
1490
|
-
navigationInput,
|
|
1491
|
-
setFormValue,
|
|
1492
|
-
setState
|
|
1493
|
-
};
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
1364
|
function renderClassStatus(base, status = {}, additionals) {
|
|
1497
1365
|
const resultClass = [base];
|
|
1498
1366
|
Object.entries(status).forEach(([key, state]) => {
|
|
@@ -1505,7 +1373,7 @@ function renderClassStatus(base, status = {}, additionals) {
|
|
|
1505
1373
|
if (additionals) {
|
|
1506
1374
|
resultClass.push(additionals);
|
|
1507
1375
|
}
|
|
1508
|
-
return resultClass.join(' ');
|
|
1376
|
+
return resultClass.join(' ').trim();
|
|
1509
1377
|
}
|
|
1510
1378
|
|
|
1511
1379
|
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
@@ -1516,34 +1384,142 @@ function rangeFormatTemplate({ maxDate, minDate }) {
|
|
|
1516
1384
|
return `${minFormat} - ${maxFormat}`;
|
|
1517
1385
|
}
|
|
1518
1386
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1387
|
+
const errorsDictionary = {
|
|
1388
|
+
es: {
|
|
1389
|
+
alphabetic: 'Campo solo permite caracteres',
|
|
1390
|
+
alphanumber: 'Campo solo permite caracteres y número',
|
|
1391
|
+
decimal: 'Campo debe ser número decimal',
|
|
1392
|
+
defined: 'Campo debe estar definido',
|
|
1393
|
+
email: 'Campo debe ser correo electrónico',
|
|
1394
|
+
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
1395
|
+
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
1396
|
+
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
1397
|
+
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
1398
|
+
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
1399
|
+
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
1400
|
+
nickname: 'Campo inválido para nombre de usuario',
|
|
1401
|
+
onlynumber: 'Campo debe ser númerico',
|
|
1402
|
+
password: 'Campo no permitido para password',
|
|
1403
|
+
reqlength: 'Campo debe tener {length} caracter(es)',
|
|
1404
|
+
required: 'Campo es requerido',
|
|
1405
|
+
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
1406
|
+
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
1407
|
+
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
1408
|
+
_unknown: 'Campo inválido {error}'
|
|
1409
|
+
},
|
|
1410
|
+
en: {
|
|
1411
|
+
alphabetic: 'Field only allows characters',
|
|
1412
|
+
alphanumber: 'Field only allows characters and number',
|
|
1413
|
+
decimal: 'Field must be decimal number',
|
|
1414
|
+
defined: 'Field must be defined',
|
|
1415
|
+
email: 'Field must be email',
|
|
1416
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1417
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1418
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1419
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1420
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1421
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1422
|
+
nickname: 'Invalid field for username',
|
|
1423
|
+
onlynumber: 'Field must be numeric',
|
|
1424
|
+
password: 'Field not allowed for password',
|
|
1425
|
+
reqlength: 'Field must be {length} characters',
|
|
1426
|
+
required: 'Field is required',
|
|
1427
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1428
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1429
|
+
textonly: 'Field only allows characters (no space)',
|
|
1430
|
+
_unknown: 'Invalid field {error}'
|
|
1431
|
+
},
|
|
1432
|
+
fr: {
|
|
1433
|
+
alphabetic: 'Field only allows characters',
|
|
1434
|
+
alphanumber: 'Field only allows characters and number',
|
|
1435
|
+
decimal: 'Field must be decimal number',
|
|
1436
|
+
defined: 'Field must be defined',
|
|
1437
|
+
email: 'Field must be email',
|
|
1438
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1439
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1440
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1441
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1442
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1443
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1444
|
+
nickname: 'Invalid field for username',
|
|
1445
|
+
onlynumber: 'Field must be numeric',
|
|
1446
|
+
password: 'Field not allowed for password',
|
|
1447
|
+
reqlength: 'Field must be {length} characters',
|
|
1448
|
+
required: 'Field is required',
|
|
1449
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1450
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1451
|
+
textonly: 'Field only allows characters (no space)',
|
|
1452
|
+
_unknown: 'Invalid field {error}'
|
|
1453
|
+
},
|
|
1454
|
+
pt: {
|
|
1455
|
+
alphabetic: 'Field only allows characters',
|
|
1456
|
+
alphanumber: 'Field only allows characters and number',
|
|
1457
|
+
decimal: 'Field must be decimal number',
|
|
1458
|
+
defined: 'Field must be defined',
|
|
1459
|
+
email: 'Field must be email',
|
|
1460
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1461
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1462
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1463
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1464
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1465
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1466
|
+
nickname: 'Invalid field for username',
|
|
1467
|
+
onlynumber: 'Field must be numeric',
|
|
1468
|
+
password: 'Field not allowed for password',
|
|
1469
|
+
reqlength: 'Field must be {thanValue} characters',
|
|
1470
|
+
required: 'Field is required',
|
|
1471
|
+
strMinlength: 'Field must have minimum {thanValue} characters',
|
|
1472
|
+
strMaxlength: 'Field must have maximum {thanValue} characters',
|
|
1473
|
+
textonly: 'Field only allows characters (no space)',
|
|
1474
|
+
_unknown: 'Invalid field {error}'
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
let _msgErrorsI18n = i18n(errorsDictionary);
|
|
1478
|
+
function setErrorsI18n(dictionary) {
|
|
1479
|
+
_msgErrorsI18n = i18n(Object.entries(errorsDictionary).reduce((_dictionary, [key, value]) => {
|
|
1480
|
+
_dictionary[key] = { ...value, ...dictionary[key] };
|
|
1481
|
+
return _dictionary;
|
|
1482
|
+
}, {}));
|
|
1483
|
+
}
|
|
1484
|
+
function msgErrorsI18n(key, language, interpolators) {
|
|
1485
|
+
return _msgErrorsI18n(key, { language, interpolators });
|
|
1525
1486
|
}
|
|
1526
1487
|
|
|
1527
1488
|
function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
|
|
1528
|
-
|
|
1489
|
+
const className = useMemo(() => {
|
|
1490
|
+
return renderClassStatus('rls-avatar', { rounded, skeleton });
|
|
1491
|
+
}, [rounded, skeleton]);
|
|
1492
|
+
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
1529
1493
|
}
|
|
1530
1494
|
|
|
1531
1495
|
function RlsBadge({ children, rlsTheme }) {
|
|
1532
1496
|
return (jsxRuntimeExports.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
|
|
1533
1497
|
}
|
|
1534
1498
|
|
|
1499
|
+
function RlsBreadcrumbLabel({ label }) {
|
|
1500
|
+
const className = useMemo(() => {
|
|
1501
|
+
return renderClassStatus('rls-breadcrumb__label__a', {
|
|
1502
|
+
actionable: !!label.onClick
|
|
1503
|
+
});
|
|
1504
|
+
}, [label.onClick]);
|
|
1505
|
+
return (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: label.onClick, children: jsxRuntimeExports.jsx("a", { className: className, children: label.label }) }));
|
|
1506
|
+
}
|
|
1535
1507
|
function RlsBreadcrumb({ labels }) {
|
|
1536
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map((
|
|
1537
|
-
actionable: !!onClick
|
|
1538
|
-
}), children: label }) }, index))) }));
|
|
1508
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map((label, index) => (jsxRuntimeExports.jsx(RlsBreadcrumbLabel, { label: label }, index))) }));
|
|
1539
1509
|
}
|
|
1540
1510
|
|
|
1541
1511
|
function RlsIcon({ value, skeleton }) {
|
|
1542
|
-
|
|
1512
|
+
const className = useMemo(() => {
|
|
1513
|
+
return renderClassStatus('rls-icon', { skeleton });
|
|
1514
|
+
}, [skeleton]);
|
|
1515
|
+
return (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx("i", { className: `rls-icon-${value}` }) }));
|
|
1543
1516
|
}
|
|
1544
1517
|
|
|
1545
1518
|
function RlsButton({ type, children, disabled, identifier, prefixIcon, suffixIcon, rlsTheme, onClick }) {
|
|
1546
|
-
|
|
1519
|
+
const className = useMemo(() => {
|
|
1520
|
+
return renderClassStatus('rls-button__content', { type });
|
|
1521
|
+
}, [type]);
|
|
1522
|
+
return (jsxRuntimeExports.jsx("button", { id: identifier, className: "rls-button", onClick: onClick, "rls-theme": rlsTheme, disabled: disabled, children: jsxRuntimeExports.jsxs("div", { className: className, children: [prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: prefixIcon }), children && jsxRuntimeExports.jsx("div", { className: "rls-button__label", children: children }), suffixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: suffixIcon })] }) }));
|
|
1547
1523
|
}
|
|
1548
1524
|
|
|
1549
1525
|
function RlsButtonAction({ icon, disabled, identifier, onClick, tooltip }) {
|
|
@@ -1551,12 +1527,16 @@ function RlsButtonAction({ icon, disabled, identifier, onClick, tooltip }) {
|
|
|
1551
1527
|
}
|
|
1552
1528
|
|
|
1553
1529
|
function RlsCheckBox({ checked, disabled, identifier, onClick, rlsTheme }) {
|
|
1554
|
-
|
|
1530
|
+
const className = useMemo(() => {
|
|
1531
|
+
return renderClassStatus('rls-checkbox', { checked, disabled });
|
|
1532
|
+
}, [checked, disabled]);
|
|
1533
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-checkbox__component" }) }));
|
|
1555
1534
|
}
|
|
1556
1535
|
function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1536
|
+
const onClick = useCallback(() => {
|
|
1537
|
+
formControl.setValue(!formControl.value);
|
|
1538
|
+
}, [formControl.value]);
|
|
1539
|
+
return (jsxRuntimeExports.jsx(RlsCheckBox, { identifier: identifier, checked: !!formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
1560
1540
|
}
|
|
1561
1541
|
|
|
1562
1542
|
function RlsInput({ children, disabled, formControl, identifier, onValue, placeholder, type, value }) {
|
|
@@ -1574,10 +1554,13 @@ function RlsInput({ children, disabled, formControl, identifier, onValue, placeh
|
|
|
1574
1554
|
formControl?.blur();
|
|
1575
1555
|
setFocused(() => false);
|
|
1576
1556
|
}, [formControl]);
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
disabled: formControl?.disabled || disabled
|
|
1580
|
-
|
|
1557
|
+
const className = useMemo(() => {
|
|
1558
|
+
return renderClassStatus('rls-input', {
|
|
1559
|
+
disabled: formControl?.disabled || disabled,
|
|
1560
|
+
focused: formControl?.focused ?? focused
|
|
1561
|
+
});
|
|
1562
|
+
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
1563
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type ?? 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.value || value || '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
1581
1564
|
}
|
|
1582
1565
|
|
|
1583
1566
|
function RlsInputMoney({ decimals, disabled, formControl, identifier, onValue, placeholder, symbol, value }) {
|
|
@@ -1612,10 +1595,13 @@ function RlsInputPassword({ disabled, formControl, identifier, onValue, placehol
|
|
|
1612
1595
|
formControl?.blur();
|
|
1613
1596
|
setFocused(() => false);
|
|
1614
1597
|
}, [formControl]);
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
disabled: formControl?.disabled || disabled
|
|
1618
|
-
|
|
1598
|
+
const className = useMemo(() => {
|
|
1599
|
+
return renderClassStatus('rls-input-password', {
|
|
1600
|
+
disabled: formControl?.disabled || disabled,
|
|
1601
|
+
focused: formControl?.focused ?? focused
|
|
1602
|
+
});
|
|
1603
|
+
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
1604
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type ?? 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
1619
1605
|
}
|
|
1620
1606
|
|
|
1621
1607
|
function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
|
|
@@ -1644,11 +1630,17 @@ function RlsMessageIcon({ icon, children, rlsTheme }) {
|
|
|
1644
1630
|
}
|
|
1645
1631
|
|
|
1646
1632
|
function RlsPoster({ children, contrast, outline, rlsTheme }) {
|
|
1647
|
-
|
|
1633
|
+
const className = useMemo(() => {
|
|
1634
|
+
return renderClassStatus('rls-poster', { contrast, outline });
|
|
1635
|
+
}, [contrast, outline]);
|
|
1636
|
+
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: children }));
|
|
1648
1637
|
}
|
|
1649
1638
|
|
|
1650
1639
|
function RlsProgressBar({ indeterminate, percentage, rlsTheme }) {
|
|
1651
|
-
|
|
1640
|
+
const className = useMemo(() => {
|
|
1641
|
+
return renderClassStatus('rls-progress-bar', { indeterminate });
|
|
1642
|
+
}, [indeterminate]);
|
|
1643
|
+
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage || 0}%` } }) }));
|
|
1652
1644
|
}
|
|
1653
1645
|
|
|
1654
1646
|
function RlsProgressCircular({ rlsTheme }) {
|
|
@@ -1656,7 +1648,10 @@ function RlsProgressCircular({ rlsTheme }) {
|
|
|
1656
1648
|
}
|
|
1657
1649
|
|
|
1658
1650
|
function RlsRadioButton({ checked, disabled, identifier, rlsTheme, onClick }) {
|
|
1659
|
-
|
|
1651
|
+
const className = useMemo(() => {
|
|
1652
|
+
return renderClassStatus('rls-radiobutton', { checked, disabled });
|
|
1653
|
+
}, [checked, disabled]);
|
|
1654
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-radiobutton__component" }) }));
|
|
1660
1655
|
}
|
|
1661
1656
|
|
|
1662
1657
|
function RlsSkeleton({ rlsTheme }) {
|
|
@@ -1668,30 +1663,42 @@ function RlsSkeletonText({ active, children, rlsTheme }) {
|
|
|
1668
1663
|
}
|
|
1669
1664
|
|
|
1670
1665
|
function RlsSwitch({ checked, disabled, identifier, onClick, rlsTheme }) {
|
|
1671
|
-
|
|
1666
|
+
const className = useMemo(() => {
|
|
1667
|
+
return renderClassStatus('rls-switch', { checked, disabled });
|
|
1668
|
+
}, [checked, disabled]);
|
|
1669
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsxs("div", { className: "rls-switch__component", children: [jsxRuntimeExports.jsx("div", { className: "rls-switch__component__element" }), jsxRuntimeExports.jsx("div", { className: "rls-switch__component__bar" })] }) }));
|
|
1672
1670
|
}
|
|
1673
1671
|
function RlsSwitchControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1672
|
+
const onClick = useCallback(() => {
|
|
1673
|
+
formControl.setValue(!formControl.value);
|
|
1674
|
+
}, [formControl.value]);
|
|
1675
|
+
return (jsxRuntimeExports.jsx(RlsSwitch, { identifier: identifier, checked: formControl.value || false, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
1677
1676
|
}
|
|
1678
1677
|
|
|
1679
1678
|
function RlsAlert({ bordered, children, icon, identifier, rlsTheme }) {
|
|
1680
|
-
|
|
1679
|
+
const className = useMemo(() => {
|
|
1680
|
+
return renderClassStatus('rls-alert', { bordered });
|
|
1681
|
+
}, [bordered]);
|
|
1682
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-alert__icon", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsx("div", { className: "rls-alert__content", children: children })] }));
|
|
1681
1683
|
}
|
|
1682
1684
|
|
|
1683
1685
|
function RlsBallot({ bordered, children, img, initials, skeleton, subtitle, rlsTheme }) {
|
|
1684
|
-
|
|
1686
|
+
const className = useMemo(() => {
|
|
1687
|
+
return renderClassStatus('rls-ballot', { bordered, skeleton });
|
|
1688
|
+
}, [bordered, skeleton]);
|
|
1689
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntimeExports.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntimeExports.jsx("img", { src: img }), initials && jsxRuntimeExports.jsx("span", { children: initials })] })), jsxRuntimeExports.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntimeExports.jsx("label", { className: "rls-ballot__title", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-ballot__subtitle", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: jsxRuntimeExports.jsx("span", { children: subtitle }) }) }))] })] }));
|
|
1685
1690
|
}
|
|
1686
1691
|
|
|
1687
1692
|
function RlsButtonProgress({ icon, disabled, onClick, progressing, rlsTheme }) {
|
|
1688
|
-
|
|
1693
|
+
const className = useMemo(() => {
|
|
1694
|
+
return renderClassStatus('rls-button-progress', { progressing });
|
|
1695
|
+
}, [progressing]);
|
|
1696
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [!progressing && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: icon, onClick: onClick, disabled: disabled })), progressing && jsxRuntimeExports.jsx(RlsProgressCircular, {})] }));
|
|
1689
1697
|
}
|
|
1690
1698
|
|
|
1691
1699
|
function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
|
|
1692
1700
|
const componentRef = useRef(null);
|
|
1693
|
-
const [
|
|
1694
|
-
const [action, setAction] = useState(firstAction);
|
|
1701
|
+
const [action, setAction] = useState(options[0]);
|
|
1695
1702
|
const [visible, setVisible] = useState(false);
|
|
1696
1703
|
useEffect(() => {
|
|
1697
1704
|
function onCloseMenu({ target }) {
|
|
@@ -1702,6 +1709,12 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1702
1709
|
document.removeEventListener('click', onCloseMenu);
|
|
1703
1710
|
};
|
|
1704
1711
|
}, []);
|
|
1712
|
+
const classNameList = useMemo(() => {
|
|
1713
|
+
return renderClassStatus('rls-button-toggle__list', {
|
|
1714
|
+
hide: !visible,
|
|
1715
|
+
visible
|
|
1716
|
+
});
|
|
1717
|
+
}, [visible]);
|
|
1705
1718
|
const onClickMenu = useCallback(() => {
|
|
1706
1719
|
setVisible((visible) => !visible);
|
|
1707
1720
|
}, []);
|
|
@@ -1712,34 +1725,58 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1712
1725
|
}, [onAction, automatic]);
|
|
1713
1726
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => {
|
|
1714
1727
|
onAction(action.value);
|
|
1715
|
-
}, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className:
|
|
1716
|
-
visible,
|
|
1717
|
-
hide: !visible
|
|
1718
|
-
}), children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => {
|
|
1728
|
+
}, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: classNameList, children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => {
|
|
1719
1729
|
onSelectAction(action);
|
|
1720
1730
|
}, children: action.label }, index))) }) })] }));
|
|
1721
1731
|
}
|
|
1722
1732
|
|
|
1723
1733
|
function RlsMessageFormError({ className, formControl }) {
|
|
1724
|
-
|
|
1734
|
+
const [language, setLanguage] = useState('es');
|
|
1735
|
+
useEffect(() => {
|
|
1736
|
+
return i18nSubscribe((language) => {
|
|
1737
|
+
setLanguage(language);
|
|
1738
|
+
});
|
|
1739
|
+
}, []);
|
|
1740
|
+
const msgError = useMemo(() => {
|
|
1741
|
+
return (formControl?.error &&
|
|
1742
|
+
(msgErrorsI18n(formControl.error.id, language, formControl.error.data) ??
|
|
1743
|
+
msgErrorsI18n('_unknown', language, { error: formControl.error.id })));
|
|
1744
|
+
}, [formControl?.error, language]);
|
|
1745
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: formControl?.wrong && (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: msgError }) })) }));
|
|
1725
1746
|
}
|
|
1726
1747
|
|
|
1727
1748
|
function RlsFieldMoney({ children, decimals, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, symbol, rlsTheme, value }) {
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1749
|
+
const className = useMemo(() => {
|
|
1750
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1751
|
+
return renderClassStatus('rls-field-box', {
|
|
1730
1752
|
focused: formControl?.focused && !_disabled,
|
|
1731
1753
|
error: formControl?.wrong,
|
|
1732
1754
|
disabled: _disabled
|
|
1733
|
-
}, 'rls-field-money')
|
|
1755
|
+
}, 'rls-field-money');
|
|
1756
|
+
}, [
|
|
1757
|
+
formControl?.focused,
|
|
1758
|
+
formControl?.wrong,
|
|
1759
|
+
formControl?.disabled,
|
|
1760
|
+
disabled
|
|
1761
|
+
]);
|
|
1762
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1734
1763
|
}
|
|
1735
1764
|
|
|
1736
1765
|
function RlsFieldNumber({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1766
|
+
const className = useMemo(() => {
|
|
1767
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1768
|
+
return renderClassStatus('rls-field-box', {
|
|
1739
1769
|
focused: formControl?.focused && !_disabled,
|
|
1740
1770
|
error: formControl?.wrong,
|
|
1741
1771
|
disabled: _disabled
|
|
1742
|
-
}, 'rls-field-number')
|
|
1772
|
+
}, 'rls-field-number');
|
|
1773
|
+
}, [
|
|
1774
|
+
formControl?.focused,
|
|
1775
|
+
formControl?.wrong,
|
|
1776
|
+
formControl?.disabled,
|
|
1777
|
+
disabled
|
|
1778
|
+
]);
|
|
1779
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1743
1780
|
}
|
|
1744
1781
|
|
|
1745
1782
|
function RlsFieldPassword({ children, disabled, formControl, identifier, msgErrorDisabled, placeholder, rlsTheme }) {
|
|
@@ -1747,21 +1784,37 @@ function RlsFieldPassword({ children, disabled, formControl, identifier, msgErro
|
|
|
1747
1784
|
const onToggleInput = useCallback(() => {
|
|
1748
1785
|
setPassword((password) => !password);
|
|
1749
1786
|
}, []);
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1787
|
+
const className = useMemo(() => {
|
|
1788
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1789
|
+
return renderClassStatus('rls-field-box', {
|
|
1752
1790
|
focused: formControl?.focused && !_disabled,
|
|
1753
1791
|
error: formControl?.wrong,
|
|
1754
1792
|
disabled: _disabled
|
|
1755
|
-
}, 'rls-field-password')
|
|
1793
|
+
}, 'rls-field-password');
|
|
1794
|
+
}, [
|
|
1795
|
+
formControl?.focused,
|
|
1796
|
+
formControl?.wrong,
|
|
1797
|
+
formControl?.disabled,
|
|
1798
|
+
disabled
|
|
1799
|
+
]);
|
|
1800
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1756
1801
|
}
|
|
1757
1802
|
|
|
1758
1803
|
function RlsFieldText({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1804
|
+
const className = useMemo(() => {
|
|
1805
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1806
|
+
return renderClassStatus('rls-field-box', {
|
|
1761
1807
|
focused: formControl?.focused && !_disabled,
|
|
1762
1808
|
error: formControl?.wrong,
|
|
1763
1809
|
disabled: _disabled
|
|
1764
|
-
}, 'rls-field-text')
|
|
1810
|
+
}, 'rls-field-text');
|
|
1811
|
+
}, [
|
|
1812
|
+
formControl?.focused,
|
|
1813
|
+
formControl?.wrong,
|
|
1814
|
+
formControl?.disabled,
|
|
1815
|
+
disabled
|
|
1816
|
+
]);
|
|
1817
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1765
1818
|
}
|
|
1766
1819
|
|
|
1767
1820
|
function RlsLabelCheckBox({ children, disabled, extended, identifier, formControl, rlsTheme }) {
|
|
@@ -1774,10 +1827,10 @@ function RlsLabelCheckBox({ children, disabled, extended, identifier, formContro
|
|
|
1774
1827
|
? formControl?.setValue(!formControl.value)
|
|
1775
1828
|
: setChecked((checked) => !checked);
|
|
1776
1829
|
}, [formControl]);
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1830
|
+
const className = useMemo(() => {
|
|
1831
|
+
return renderClassStatus('rls-label-checkbox', { disabled, extended });
|
|
1832
|
+
}, [disabled, extended]);
|
|
1833
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
|
|
1781
1834
|
}
|
|
1782
1835
|
|
|
1783
1836
|
function RlsLabelRadioButton({ children, disabled, extended, identifier, formControl, rlsTheme, value }) {
|
|
@@ -1788,10 +1841,10 @@ function RlsLabelRadioButton({ children, disabled, extended, identifier, formCon
|
|
|
1788
1841
|
const onSelect = useCallback(() => {
|
|
1789
1842
|
formControl && formControl?.setValue(value);
|
|
1790
1843
|
}, [formControl, value]);
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1844
|
+
const className = useMemo(() => {
|
|
1845
|
+
return renderClassStatus('rls-label-radiobutton', { disabled, extended });
|
|
1846
|
+
}, [disabled, extended]);
|
|
1847
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
|
|
1795
1848
|
}
|
|
1796
1849
|
|
|
1797
1850
|
function RlsLabelSwitch({ children, disabled, extended, identifier, formControl, rlsTheme }) {
|
|
@@ -1804,62 +1857,53 @@ function RlsLabelSwitch({ children, disabled, extended, identifier, formControl,
|
|
|
1804
1857
|
? formControl?.setValue(!formControl.value)
|
|
1805
1858
|
: setChecked((checked) => !checked);
|
|
1806
1859
|
}, [formControl]);
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1860
|
+
const className = useMemo(() => {
|
|
1861
|
+
return renderClassStatus('rls-label-switch', { disabled, extended });
|
|
1862
|
+
}, [disabled, extended]);
|
|
1863
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-switch__text", children: children })] }));
|
|
1811
1864
|
}
|
|
1812
1865
|
|
|
1813
1866
|
function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
1814
1867
|
const controller = useRef(new PaginationController({ suggestions, count }));
|
|
1815
1868
|
const [template, setTemplate] = useState(controller.current.template);
|
|
1869
|
+
const refreshTemplate = useCallback((template, suggestions) => {
|
|
1870
|
+
const { firstPage, lastPage } = template;
|
|
1871
|
+
onPagination && onPagination({ firstPage, lastPage, suggestions });
|
|
1872
|
+
setTemplate(template);
|
|
1873
|
+
}, [onPagination]);
|
|
1816
1874
|
useEffect(() => {
|
|
1817
1875
|
controller.current = new PaginationController({
|
|
1818
1876
|
suggestions,
|
|
1819
1877
|
count,
|
|
1820
1878
|
position: template.currentPage.value
|
|
1821
1879
|
});
|
|
1822
|
-
|
|
1823
|
-
onPagination({
|
|
1824
|
-
firstPage: controller.current.template.firstPage,
|
|
1825
|
-
lastPage: controller.current.template.lastPage,
|
|
1826
|
-
suggestions: controller.current.page.collection
|
|
1827
|
-
});
|
|
1828
|
-
setTemplate(controller.current.template);
|
|
1880
|
+
refreshTemplate(controller.current.template, controller.current.page.collection);
|
|
1829
1881
|
}, [suggestions, count]);
|
|
1830
1882
|
useEffect(() => {
|
|
1831
1883
|
refreshPagination(controller.current.filtrable(filter));
|
|
1832
1884
|
}, [filter]);
|
|
1833
|
-
|
|
1885
|
+
const refreshPagination = useCallback((pagination) => {
|
|
1834
1886
|
if (pagination) {
|
|
1835
|
-
|
|
1836
|
-
const { firstPage, lastPage } = template;
|
|
1837
|
-
onPagination &&
|
|
1838
|
-
onPagination({
|
|
1839
|
-
firstPage,
|
|
1840
|
-
lastPage,
|
|
1841
|
-
suggestions: page.collection
|
|
1842
|
-
});
|
|
1843
|
-
setTemplate(template);
|
|
1887
|
+
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1844
1888
|
}
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1889
|
+
}, []);
|
|
1890
|
+
const goToPagination = useCallback((page) => {
|
|
1847
1891
|
refreshPagination(controller.current.goToPage(page));
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1892
|
+
}, []);
|
|
1893
|
+
const goFirstPagination = useCallback(() => {
|
|
1850
1894
|
refreshPagination(controller.current.goFirstPage());
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1895
|
+
}, []);
|
|
1896
|
+
const goPreviousPagination = useCallback(() => {
|
|
1853
1897
|
refreshPagination(controller.current.goPreviousPage());
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1898
|
+
}, []);
|
|
1899
|
+
const goNextPagination = useCallback(() => {
|
|
1856
1900
|
refreshPagination(controller.current.goNextPage());
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1901
|
+
}, []);
|
|
1902
|
+
const goLastPagination = useCallback(() => {
|
|
1859
1903
|
refreshPagination(controller.current.goLastPage());
|
|
1860
|
-
}
|
|
1904
|
+
}, []);
|
|
1861
1905
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template.pages.map((page, index) => {
|
|
1862
|
-
return (jsxRuntimeExports.jsx("div", { className:
|
|
1906
|
+
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
1863
1907
|
active: page.active
|
|
1864
1908
|
}), onClick: () => {
|
|
1865
1909
|
goToPagination(page);
|
|
@@ -1867,7 +1911,7 @@ function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
|
1867
1911
|
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template.description }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1868
1912
|
}
|
|
1869
1913
|
|
|
1870
|
-
function RlsPickerDay({ date, disabled:
|
|
1914
|
+
function RlsPickerDay({ date, disabled: _disabled, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1871
1915
|
const currentDate = date || new Date(); // Initial date
|
|
1872
1916
|
const [weeks, setWeeks] = useState([]);
|
|
1873
1917
|
const [value, setValue] = useState(formControl?.value || currentDate.getDate());
|
|
@@ -1900,12 +1944,12 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1900
1944
|
onValue && onValue(value);
|
|
1901
1945
|
}
|
|
1902
1946
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day__element', {
|
|
1903
|
-
disabled: disabled ||
|
|
1947
|
+
disabled: disabled || _disabled,
|
|
1904
1948
|
focused,
|
|
1905
1949
|
forbidden,
|
|
1906
1950
|
selected,
|
|
1907
1951
|
today
|
|
1908
|
-
}), onClick: value && !
|
|
1952
|
+
}), onClick: value && !_disabled ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1909
1953
|
}
|
|
1910
1954
|
|
|
1911
1955
|
const FORMAT_RANGE = '{dd}/{mx}/{aa}';
|
|
@@ -1946,7 +1990,7 @@ function RlsPickerDayRange({ date, disabled: _disabled, formControl, maxDate, mi
|
|
|
1946
1990
|
: undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1947
1991
|
}
|
|
1948
1992
|
|
|
1949
|
-
function RlsPickerMonth({ date, disabled:
|
|
1993
|
+
function RlsPickerMonth({ date, disabled: _disabled, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
1950
1994
|
const currentDate = date || new Date();
|
|
1951
1995
|
const [months, setMonths] = useState([]);
|
|
1952
1996
|
const [value, setValue] = useState(formControl?.value || currentDate.getMonth());
|
|
@@ -1980,10 +2024,10 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
|
|
|
1980
2024
|
}
|
|
1981
2025
|
}
|
|
1982
2026
|
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-month__component', {
|
|
1983
|
-
disabled: disabled ||
|
|
2027
|
+
disabled: disabled || _disabled,
|
|
1984
2028
|
focused,
|
|
1985
2029
|
selected
|
|
1986
|
-
}), onClick: !(disabled ||
|
|
2030
|
+
}), onClick: !(disabled || _disabled)
|
|
1987
2031
|
? () => {
|
|
1988
2032
|
onChange(value);
|
|
1989
2033
|
}
|
|
@@ -2037,7 +2081,7 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
|
|
|
2037
2081
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-month-title", children: [jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsxRuntimeExports.jsx("span", { onClick: onClick, children: monthName }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
2038
2082
|
}
|
|
2039
2083
|
|
|
2040
|
-
function RlsPickerYear({ date, disabled:
|
|
2084
|
+
function RlsPickerYear({ date, disabled: _disabled, formControl, maxDate, minDate, onValue, rlsTheme }) {
|
|
2041
2085
|
const currentDate = date || new Date();
|
|
2042
2086
|
const [value, setValue] = useState(formControl?.value || currentDate.getFullYear());
|
|
2043
2087
|
const [year, setYear] = useState(formControl?.value || currentDate.getFullYear());
|
|
@@ -2077,11 +2121,11 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
2077
2121
|
setYearValue(value);
|
|
2078
2122
|
onValue && onValue(value);
|
|
2079
2123
|
}
|
|
2080
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious ||
|
|
2081
|
-
disabled: disabled ||
|
|
2124
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || _disabled }) }), jsxRuntimeExports.jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || _disabled }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-year__year', {
|
|
2125
|
+
disabled: disabled || _disabled,
|
|
2082
2126
|
focused,
|
|
2083
2127
|
selected
|
|
2084
|
-
}), onClick: value && !
|
|
2128
|
+
}), onClick: value && !_disabled
|
|
2085
2129
|
? () => {
|
|
2086
2130
|
onChange(value);
|
|
2087
2131
|
}
|
|
@@ -2093,7 +2137,10 @@ function RlsToolbar({ actions, children, subtitle }) {
|
|
|
2093
2137
|
}
|
|
2094
2138
|
|
|
2095
2139
|
function RlsCard({ children, outline, rlsTheme }) {
|
|
2096
|
-
|
|
2140
|
+
const className = useMemo(() => {
|
|
2141
|
+
return renderClassStatus('rls-card', { outline });
|
|
2142
|
+
}, [outline]);
|
|
2143
|
+
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-card__content", children: children }) }));
|
|
2097
2144
|
}
|
|
2098
2145
|
|
|
2099
2146
|
const reactI18n = i18n({
|
|
@@ -2126,13 +2173,16 @@ class ConfirmationResult extends PartialSealed {
|
|
|
2126
2173
|
}
|
|
2127
2174
|
}
|
|
2128
2175
|
function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
|
|
2129
|
-
|
|
2176
|
+
const className = useMemo(() => {
|
|
2177
|
+
return renderClassStatus('rls-confirmation', { visible });
|
|
2178
|
+
}, [visible]);
|
|
2179
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { identifier: approved.identifier, type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { identifier: reject.identifier, type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
|
|
2130
2180
|
}
|
|
2131
|
-
function
|
|
2181
|
+
function useConfirmation() {
|
|
2132
2182
|
const [config, setConfig] = useState({});
|
|
2133
2183
|
const [visible, setVisible] = useState(false);
|
|
2134
2184
|
const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
|
|
2135
|
-
|
|
2185
|
+
const confirmation = useCallback((options) => {
|
|
2136
2186
|
return new Promise((resolve) => {
|
|
2137
2187
|
const { content, rlsTheme, subtitle, title, approved, reject } = options;
|
|
2138
2188
|
setConfig({
|
|
@@ -2161,7 +2211,7 @@ function useConfirmationService() {
|
|
|
2161
2211
|
});
|
|
2162
2212
|
setVisible(true);
|
|
2163
2213
|
});
|
|
2164
|
-
}
|
|
2214
|
+
}, []);
|
|
2165
2215
|
return {
|
|
2166
2216
|
RlsConfirmation: rlsConfirmation,
|
|
2167
2217
|
confirmation
|
|
@@ -2172,27 +2222,188 @@ function RlsDatatableHeader({ children, identifier }) {
|
|
|
2172
2222
|
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", children: children }));
|
|
2173
2223
|
}
|
|
2174
2224
|
function RlsDatatableTitle({ children, className, control, identifier }) {
|
|
2175
|
-
|
|
2225
|
+
const classDatatableName = useMemo(() => {
|
|
2226
|
+
return renderClassStatus('rls-datatable__title', { control }, className);
|
|
2227
|
+
}, [control, className]);
|
|
2228
|
+
return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
|
|
2176
2229
|
}
|
|
2177
2230
|
function RlsDatatableSubheader({ children, className, identifier }) {
|
|
2178
|
-
|
|
2231
|
+
const classDatatableName = useMemo(() => {
|
|
2232
|
+
return renderClassStatus('rls-datatable__subheader', {}, className);
|
|
2233
|
+
}, [className]);
|
|
2234
|
+
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
|
|
2179
2235
|
}
|
|
2180
2236
|
function RlsDatatableRecord({ children, className, error, identifier, info, successs, warning }) {
|
|
2181
|
-
|
|
2237
|
+
const classDatatableName = useMemo(() => {
|
|
2238
|
+
return renderClassStatus('rls-datatable__record', { error, info, successs, warning }, className);
|
|
2239
|
+
}, [error, info, successs, warning, className]);
|
|
2240
|
+
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classDatatableName, children: children }));
|
|
2182
2241
|
}
|
|
2183
2242
|
function RlsDatatableTotals({ children, className, error, identifier, info, successs, warning }) {
|
|
2184
|
-
|
|
2243
|
+
const classDatatableName = useMemo(() => {
|
|
2244
|
+
return renderClassStatus('rls-datatable__totals', { error, info, successs, warning }, className);
|
|
2245
|
+
}, [error, info, successs, warning, className]);
|
|
2246
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
|
|
2185
2247
|
}
|
|
2186
2248
|
function RlsDatatableCell({ children, className, control, identifier, overflow }) {
|
|
2187
|
-
|
|
2249
|
+
const classDatatableName = useMemo(() => {
|
|
2250
|
+
return renderClassStatus('rls-datatable__cell', { control, overflow }, className);
|
|
2251
|
+
}, [control, overflow, className]);
|
|
2252
|
+
return (jsxRuntimeExports.jsx("th", { id: identifier, className: classDatatableName, children: children }));
|
|
2188
2253
|
}
|
|
2189
2254
|
function RlsDatatableData({ children, className, control, identifier, overflow }) {
|
|
2190
|
-
|
|
2255
|
+
const classDatatableName = useMemo(() => {
|
|
2256
|
+
return renderClassStatus('rls-datatable__data', { control, overflow }, className);
|
|
2257
|
+
}, [control, overflow, className]);
|
|
2258
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classDatatableName, children: children }));
|
|
2191
2259
|
}
|
|
2192
2260
|
function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
|
|
2193
|
-
|
|
2261
|
+
const className = useMemo(() => {
|
|
2262
|
+
return renderClassStatus('rls-datatable', {
|
|
2194
2263
|
scrolleable: datatable?.scrolleable
|
|
2195
|
-
})
|
|
2264
|
+
});
|
|
2265
|
+
}, [datatable]);
|
|
2266
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__body", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
function createObserver(options) {
|
|
2270
|
+
const { setScrolleable, table } = options;
|
|
2271
|
+
const observer = new ResizeObserver(() => {
|
|
2272
|
+
const scrollHeight = table.scrollHeight || 0;
|
|
2273
|
+
const clientHeight = table.clientHeight || 0;
|
|
2274
|
+
setScrolleable(scrollHeight > clientHeight);
|
|
2275
|
+
});
|
|
2276
|
+
observer.observe(table);
|
|
2277
|
+
return observer;
|
|
2278
|
+
}
|
|
2279
|
+
function useDatatable() {
|
|
2280
|
+
const [scrolleable, setScrolleable] = useState(false);
|
|
2281
|
+
const tableRef = useRef(null);
|
|
2282
|
+
useEffect(() => {
|
|
2283
|
+
const observer = tableRef?.current &&
|
|
2284
|
+
createObserver({ setScrolleable, table: tableRef?.current });
|
|
2285
|
+
return () => {
|
|
2286
|
+
observer?.disconnect();
|
|
2287
|
+
};
|
|
2288
|
+
}, []);
|
|
2289
|
+
return { scrolleable, tableRef };
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
function useListController(props) {
|
|
2293
|
+
const { suggestions, automatic, formControl, reference } = props;
|
|
2294
|
+
const listIsOpen = useRef(false);
|
|
2295
|
+
const contentRef = useRef(null);
|
|
2296
|
+
const listRef = useRef(null);
|
|
2297
|
+
const inputRef = useRef(null);
|
|
2298
|
+
const [collection, setCollection] = useState(new ListCollection(suggestions));
|
|
2299
|
+
const [state, refreshState] = useState({
|
|
2300
|
+
focused: false,
|
|
2301
|
+
higher: false,
|
|
2302
|
+
value: '',
|
|
2303
|
+
modalIsVisible: false
|
|
2304
|
+
});
|
|
2305
|
+
const position = useRef(0);
|
|
2306
|
+
const valueProtected = useRef();
|
|
2307
|
+
const changeValueInternal = useRef(false);
|
|
2308
|
+
useEffect(() => {
|
|
2309
|
+
function onCloseSuggestions({ target }) {
|
|
2310
|
+
!contentRef?.current?.contains(target) &&
|
|
2311
|
+
refreshState((state) => ({ ...state, modalIsVisible: false }));
|
|
2312
|
+
}
|
|
2313
|
+
document.addEventListener('click', onCloseSuggestions);
|
|
2314
|
+
return () => {
|
|
2315
|
+
document.removeEventListener('click', onCloseSuggestions);
|
|
2316
|
+
};
|
|
2317
|
+
}, []);
|
|
2318
|
+
useEffect(() => {
|
|
2319
|
+
if (!listIsOpen.current && state.modalIsVisible) {
|
|
2320
|
+
listIsOpen.current = true;
|
|
2321
|
+
}
|
|
2322
|
+
if (listIsOpen.current && !state.modalIsVisible) {
|
|
2323
|
+
formControl?.touch();
|
|
2324
|
+
}
|
|
2325
|
+
refreshState((state) => ({
|
|
2326
|
+
...state,
|
|
2327
|
+
higher: locationListCanTop(contentRef.current, listRef.current)
|
|
2328
|
+
}));
|
|
2329
|
+
}, [state.modalIsVisible]);
|
|
2330
|
+
useEffect(() => {
|
|
2331
|
+
setCollection(new ListCollection(suggestions, reference));
|
|
2332
|
+
}, [suggestions]);
|
|
2333
|
+
useEffect(() => {
|
|
2334
|
+
if (!changeValueInternal.current) {
|
|
2335
|
+
if (formControl?.value) {
|
|
2336
|
+
const element = collection.find(formControl.value);
|
|
2337
|
+
if (!element) {
|
|
2338
|
+
valueProtected.current = formControl.value;
|
|
2339
|
+
automatic
|
|
2340
|
+
? setFormValue(collection.value[0], true)
|
|
2341
|
+
: setFormValue(undefined);
|
|
2342
|
+
}
|
|
2343
|
+
else {
|
|
2344
|
+
refreshState((state) => ({ ...state, value: element.description }));
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
else if (valueProtected.current) {
|
|
2348
|
+
const element = collection.find(valueProtected.current);
|
|
2349
|
+
element && setFormValue(element);
|
|
2350
|
+
}
|
|
2351
|
+
else {
|
|
2352
|
+
automatic && setFormValue(collection.value[0], true);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
changeValueInternal.current = false;
|
|
2356
|
+
}, [collection, formControl?.value]);
|
|
2357
|
+
const setState = useCallback((state) => {
|
|
2358
|
+
refreshState((_state) => ({ ..._state, ...state }));
|
|
2359
|
+
}, []);
|
|
2360
|
+
const setFormValue = useCallback((element, initialValue = false) => {
|
|
2361
|
+
refreshState((state) => ({
|
|
2362
|
+
...state,
|
|
2363
|
+
value: element?.description || ''
|
|
2364
|
+
}));
|
|
2365
|
+
changeValueInternal.current = true;
|
|
2366
|
+
initialValue
|
|
2367
|
+
? formControl?.setInitialValue(element?.value)
|
|
2368
|
+
: formControl?.setValue(element?.value);
|
|
2369
|
+
}, [formControl]);
|
|
2370
|
+
const navigationInput = useCallback((event) => {
|
|
2371
|
+
if (state.modalIsVisible) {
|
|
2372
|
+
const _position = navigationListFromInput({
|
|
2373
|
+
content: contentRef.current,
|
|
2374
|
+
event: event,
|
|
2375
|
+
list: listRef.current
|
|
2376
|
+
});
|
|
2377
|
+
position.current = _position ?? 0;
|
|
2378
|
+
}
|
|
2379
|
+
}, [state.modalIsVisible]);
|
|
2380
|
+
const navigationElement = useCallback((event) => {
|
|
2381
|
+
position.current = navigationListFromElement({
|
|
2382
|
+
content: contentRef.current,
|
|
2383
|
+
event: event,
|
|
2384
|
+
input: inputRef.current,
|
|
2385
|
+
list: listRef.current,
|
|
2386
|
+
position: position.current
|
|
2387
|
+
});
|
|
2388
|
+
}, [state.modalIsVisible]);
|
|
2389
|
+
return {
|
|
2390
|
+
...state,
|
|
2391
|
+
contentRef,
|
|
2392
|
+
inputRef,
|
|
2393
|
+
listRef,
|
|
2394
|
+
navigationElement,
|
|
2395
|
+
navigationInput,
|
|
2396
|
+
setFormValue,
|
|
2397
|
+
setState
|
|
2398
|
+
};
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
function useRenderClassStatus(base, status = {}, additionals) {
|
|
2402
|
+
const [className, setClassName] = useState('');
|
|
2403
|
+
useEffect(() => {
|
|
2404
|
+
setClassName(renderClassStatus(base, status, additionals));
|
|
2405
|
+
}, [base, Object.values(status), additionals]);
|
|
2406
|
+
return className;
|
|
2196
2407
|
}
|
|
2197
2408
|
|
|
2198
2409
|
const DURATION_ANIMATION$1 = 240;
|
|
@@ -2302,16 +2513,27 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2302
2513
|
const autocomplete = useFieldAutocomplete(props);
|
|
2303
2514
|
const { render, children, formControl, msgErrorDisabled, onSearch, placeholder, rlsTheme, searching } = props;
|
|
2304
2515
|
const _disabled = formControl?.disabled || props.disabled;
|
|
2305
|
-
const className =
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2516
|
+
const className = useMemo(() => {
|
|
2517
|
+
return renderClassStatus('rls-field-box', {
|
|
2518
|
+
focused: autocomplete.focused && !_disabled,
|
|
2519
|
+
error: formControl?.wrong,
|
|
2520
|
+
disabled: _disabled,
|
|
2521
|
+
selected: !!autocomplete.value
|
|
2522
|
+
}, 'rls-field-list rls-field-autocomplete');
|
|
2523
|
+
}, [
|
|
2524
|
+
formControl?.wrong,
|
|
2525
|
+
formControl?.disabled,
|
|
2526
|
+
autocomplete.value,
|
|
2527
|
+
autocomplete.focused,
|
|
2528
|
+
props.disabled
|
|
2529
|
+
]);
|
|
2530
|
+
const classNameList = useMemo(() => {
|
|
2531
|
+
return renderClassStatus('rls-field-list__suggestions', {
|
|
2532
|
+
higher: autocomplete.higher,
|
|
2533
|
+
visible: autocomplete.modalIsVisible
|
|
2534
|
+
});
|
|
2535
|
+
}, [autocomplete.higher, autocomplete.modalIsVisible]);
|
|
2536
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.contentRef, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__control", readOnly: true, disabled: _disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: _disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx("div", { className: classNameList, children: autocomplete.modalIsVisible && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: autocomplete.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: autocomplete.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: autocomplete.pattern, onChange: (event) => {
|
|
2315
2537
|
autocomplete.setPattern(event.target.value);
|
|
2316
2538
|
}, disabled: _disabled || searching, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: autocomplete.onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: _disabled || searching, onClick: () => {
|
|
2317
2539
|
onSearch(autocomplete.pattern);
|
|
@@ -2322,7 +2544,10 @@ function RlsFieldAutocomplete(props) {
|
|
|
2322
2544
|
}
|
|
2323
2545
|
|
|
2324
2546
|
function RlsModal({ children, overflow, visible, rlsTheme }) {
|
|
2325
|
-
|
|
2547
|
+
const className = useMemo(() => {
|
|
2548
|
+
return renderClassStatus('rls-modal', { overflow, visible });
|
|
2549
|
+
}, [overflow, visible]);
|
|
2550
|
+
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
|
|
2326
2551
|
}
|
|
2327
2552
|
|
|
2328
2553
|
const FORMAT_TITLE = '{dw}, {mx} {dd} de {aa}';
|
|
@@ -2378,17 +2603,20 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2378
2603
|
formControl?.setValue(value);
|
|
2379
2604
|
onListener && onListener({ event: PickerListenerEvent.Select, value });
|
|
2380
2605
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2606
|
+
const classNameComponent = useMemo(() => {
|
|
2607
|
+
return renderClassStatus('rls-picker-date__component', {
|
|
2608
|
+
day: visibility === 'DAY',
|
|
2609
|
+
month: visibility === 'MONTH',
|
|
2610
|
+
year: visibility === 'YEAR'
|
|
2611
|
+
});
|
|
2612
|
+
}, [visibility]);
|
|
2613
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_TITLE) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) }))] }));
|
|
2386
2614
|
}
|
|
2387
2615
|
|
|
2388
2616
|
const FORMAT_DATE = '{dd}/{mx}/{aa}';
|
|
2389
|
-
function RlsFieldDate({ children, date, disabled, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, rlsTheme, value:
|
|
2617
|
+
function RlsFieldDate({ children, date, disabled, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, rlsTheme, value: _value }) {
|
|
2390
2618
|
const today = new Date(); // Initial current date in component
|
|
2391
|
-
const [value, setValue] = useState(formControl?.value ||
|
|
2619
|
+
const [value, setValue] = useState(formControl?.value || _value);
|
|
2392
2620
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2393
2621
|
useEffect(() => {
|
|
2394
2622
|
const dateRange = verifyDateRange({
|
|
@@ -2408,9 +2636,9 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
2408
2636
|
}
|
|
2409
2637
|
function onClickAction() {
|
|
2410
2638
|
if (value) {
|
|
2411
|
-
formControl?.setValue(
|
|
2639
|
+
formControl?.setValue(_value);
|
|
2412
2640
|
formControl?.touch();
|
|
2413
|
-
onChange(
|
|
2641
|
+
onChange(_value);
|
|
2414
2642
|
}
|
|
2415
2643
|
else {
|
|
2416
2644
|
setModalIsVisible(true);
|
|
@@ -2420,7 +2648,10 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
2420
2648
|
? dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2421
2649
|
: '';
|
|
2422
2650
|
const _disabled = formControl?.disabled || disabled;
|
|
2423
|
-
|
|
2651
|
+
const className = useMemo(() => {
|
|
2652
|
+
return renderClassStatus('rls-field-box', { disabled: _disabled });
|
|
2653
|
+
}, [formControl?.disabled, disabled]);
|
|
2654
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: _disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: _disabled, maxDate: maxDate, minDate: minDate, onListener: ({ event, value }) => {
|
|
2424
2655
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2425
2656
|
formControl?.touch();
|
|
2426
2657
|
setModalIsVisible(false);
|
|
@@ -2470,13 +2701,19 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2470
2701
|
formControl?.setValue(value);
|
|
2471
2702
|
onListener && onListener({ event: PickerListenerEvent.Select, value });
|
|
2472
2703
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2704
|
+
const classNameComponent = useMemo(() => {
|
|
2705
|
+
return renderClassStatus('rls-picker-date-range__component', {
|
|
2706
|
+
day: visibility === 'DAY',
|
|
2707
|
+
month: visibility === 'MONTH',
|
|
2708
|
+
year: visibility === 'YEAR'
|
|
2709
|
+
});
|
|
2710
|
+
}, [visibility]);
|
|
2711
|
+
const classNameFooter = useMemo(() => {
|
|
2712
|
+
return renderClassStatus('rls-picker-date-range__footer', {
|
|
2713
|
+
automatic
|
|
2714
|
+
});
|
|
2715
|
+
}, [automatic]);
|
|
2716
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: classNameFooter, children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
|
|
2480
2717
|
}
|
|
2481
2718
|
|
|
2482
2719
|
function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, rlsTheme, value: defaultValue }) {
|
|
@@ -2501,9 +2738,10 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2501
2738
|
onValue && onValue(value);
|
|
2502
2739
|
}
|
|
2503
2740
|
const _disabled = formControl?.disabled || disabled;
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2741
|
+
const className = useMemo(() => {
|
|
2742
|
+
return renderClassStatus('rls-field-box', { disabled: _disabled });
|
|
2743
|
+
}, [formControl?.disabled, disabled]);
|
|
2744
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: _disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: _disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: _disabled, maxDate: maxDate, minDate: minDate, onListener: ({ event, value }) => {
|
|
2507
2745
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2508
2746
|
formControl?.touch();
|
|
2509
2747
|
setModalIsVisible(false);
|
|
@@ -2609,7 +2847,10 @@ function RlsFieldSelect(props) {
|
|
|
2609
2847
|
}
|
|
2610
2848
|
|
|
2611
2849
|
function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
2612
|
-
|
|
2850
|
+
const className = useMemo(() => {
|
|
2851
|
+
return renderClassStatus('rls-form-navigation', { visible });
|
|
2852
|
+
}, [visible]);
|
|
2853
|
+
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
2613
2854
|
}
|
|
2614
2855
|
|
|
2615
2856
|
const DURATION_ANIMATION = 240;
|
|
@@ -2628,9 +2869,12 @@ function calculateDuration({ length }) {
|
|
|
2628
2869
|
return duration + DURATION_RESET;
|
|
2629
2870
|
}
|
|
2630
2871
|
function RlsSnackbar({ content, icon, title, visible, rlsTheme }) {
|
|
2631
|
-
|
|
2872
|
+
const className = useMemo(() => {
|
|
2873
|
+
return renderClassStatus('rls-snackbar', { visible });
|
|
2874
|
+
}, [visible]);
|
|
2875
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-snackbar__avatar", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsxs("div", { className: "rls-snackbar__component", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-snackbar__title", children: title }), jsxRuntimeExports.jsx("div", { className: "rls-snackbar__content", children: content })] })] }));
|
|
2632
2876
|
}
|
|
2633
|
-
function
|
|
2877
|
+
function useSnackbar() {
|
|
2634
2878
|
const [config, setConfig] = useState({});
|
|
2635
2879
|
const [duration, setDuration] = useState(4000);
|
|
2636
2880
|
const [timeoutId, setTimeoutId] = useState();
|
|
@@ -2649,12 +2893,12 @@ function useSnackbarService() {
|
|
|
2649
2893
|
setTimeout(() => snackbar(config), DURATION_ANIMATION);
|
|
2650
2894
|
}
|
|
2651
2895
|
}, [visible]);
|
|
2652
|
-
|
|
2896
|
+
const snackbar = useCallback((config) => {
|
|
2653
2897
|
const { content } = config;
|
|
2654
2898
|
setConfig(config);
|
|
2655
2899
|
setDuration(calculateDuration(String(content)));
|
|
2656
|
-
setVisible(!visible);
|
|
2657
|
-
}
|
|
2900
|
+
setVisible((visible) => !visible);
|
|
2901
|
+
}, []);
|
|
2658
2902
|
return {
|
|
2659
2903
|
RlsSnackbar: rlsSnackbar,
|
|
2660
2904
|
snackbar
|
|
@@ -2669,13 +2913,14 @@ const RlsContext = createContext({
|
|
|
2669
2913
|
withNavbar: () => { }
|
|
2670
2914
|
});
|
|
2671
2915
|
function RlsApplication({ children }) {
|
|
2672
|
-
const { RlsConfirmation, confirmation } =
|
|
2673
|
-
const { RlsSnackbar, snackbar } =
|
|
2674
|
-
const [
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2916
|
+
const { RlsConfirmation, confirmation } = useConfirmation();
|
|
2917
|
+
const { RlsSnackbar, snackbar } = useSnackbar();
|
|
2918
|
+
const [_withNavbar, withNavbar] = useState(false);
|
|
2919
|
+
const className = useMemo(() => {
|
|
2920
|
+
return renderClassStatus('rls-app__body', { snackbar: _withNavbar });
|
|
2921
|
+
}, [_withNavbar]);
|
|
2922
|
+
return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar, withNavbar }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
2678
2923
|
}
|
|
2679
2924
|
|
|
2680
|
-
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerMonthTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus,
|
|
2925
|
+
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerMonthTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useRenderClassStatus, useSnackbar };
|
|
2681
2926
|
//# sourceMappingURL=index.js.map
|