@rolster/react-components 18.22.5 → 18.23.4
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-2Kl_PXwH.css → index-SyKruNt7.css} +14 -0
- package/dist/cjs/index.js +303 -268
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-2Kl_PXwH.css → index-SyKruNt7.css} +14 -0
- package/dist/es/index.js +303 -269
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js +1 -1
- package/dist/esm/components/atoms/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/Button/Button.js +1 -1
- package/dist/esm/components/atoms/Button/Button.js.map +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.js +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/components/atoms/Icon/Icon.js +1 -1
- package/dist/esm/components/atoms/Icon/Icon.js.map +1 -1
- package/dist/esm/components/atoms/Image/Image.js +1 -1
- package/dist/esm/components/atoms/Image/Image.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +1 -1
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/Poster/Poster.js +1 -1
- package/dist/esm/components/atoms/Poster/Poster.js.map +1 -1
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js +1 -1
- package/dist/esm/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.js +1 -1
- package/dist/esm/components/atoms/RadioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/atoms/Switch/Switch.js +1 -1
- package/dist/esm/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/esm/components/atoms/TabularText/TabularText.js +1 -1
- package/dist/esm/components/atoms/TabularText/TabularText.js.map +1 -1
- package/dist/esm/components/molecules/Alert/Alert.js +1 -1
- package/dist/esm/components/molecules/Alert/Alert.js.map +1 -1
- package/dist/esm/components/molecules/Ballot/Ballot.js +1 -1
- package/dist/esm/components/molecules/Ballot/Ballot.js.map +1 -1
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.js +1 -1
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.js.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -1
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +1 -1
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -1
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js +1 -1
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js.map +1 -1
- package/dist/esm/components/molecules/FieldText/FieldText.js +1 -1
- package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -1
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js +1 -1
- package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js.map +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +1 -1
- package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/molecules/Slider/Slider.js +2 -2
- package/dist/esm/components/molecules/Slider/Slider.js.map +1 -1
- package/dist/esm/components/molecules/index.d.ts +0 -21
- package/dist/esm/components/molecules/index.js +1 -21
- package/dist/esm/components/molecules/index.js.map +1 -1
- package/dist/esm/components/organisms/Card/Card.js +1 -1
- package/dist/esm/components/organisms/Card/Card.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.js +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.d.ts +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.js +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +3 -2
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +2 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js +1 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js.map +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js +14 -53
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.d.ts +1 -2
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +4 -3
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.css +13 -0
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.css.map +1 -0
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.d.ts +19 -0
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.js +8 -0
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.js.map +1 -0
- package/dist/esm/components/organisms/Modal/Modal.js +1 -1
- package/dist/esm/components/organisms/Modal/Modal.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +2 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.js +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/components/types.d.ts +2 -0
- package/dist/esm/constants/image-editor.constant.d.ts +1 -0
- package/dist/esm/constants/image-editor.constant.js +10 -0
- package/dist/esm/constants/image-editor.constant.js.map +1 -0
- package/dist/esm/context.d.ts +2 -1
- package/dist/esm/context.js +3 -2
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/controllers/ImageEditorController.d.ts +16 -0
- package/dist/esm/controllers/ImageEditorController.js +62 -0
- package/dist/esm/controllers/ImageEditorController.js.map +1 -0
- package/dist/esm/helpers/date-range-picker.js +1 -1
- package/dist/esm/helpers/date-range-picker.js.map +1 -1
- package/dist/esm/index.d.ts +72 -3
- package/dist/esm/index.js +71 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/components/atoms/index.d.ts +0 -25
- package/dist/esm/components/atoms/index.js +0 -26
- package/dist/esm/components/atoms/index.js.map +0 -1
- package/dist/esm/components/index.d.ts +0 -5
- package/dist/esm/components/index.js +0 -5
- package/dist/esm/components/index.js.map +0 -1
- package/dist/esm/components/organisms/index.d.ts +0 -16
- package/dist/esm/components/organisms/index.js +0 -17
- package/dist/esm/components/organisms/index.js.map +0 -1
- package/dist/esm/constants/index.d.ts +0 -1
- package/dist/esm/constants/index.js +0 -2
- package/dist/esm/constants/index.js.map +0 -1
- package/dist/esm/controllers/index.d.ts +0 -4
- package/dist/esm/controllers/index.js +0 -5
- package/dist/esm/controllers/index.js.map +0 -1
- package/dist/esm/helpers/index.d.ts +0 -3
- package/dist/esm/helpers/index.js +0 -4
- package/dist/esm/helpers/index.js.map +0 -1
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import require$$0, { useMemo, useCallback, useState, useRef, useEffect, createContext } from 'react';
|
|
2
2
|
import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/commons';
|
|
3
|
-
import { dateFormatTemplate, DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
|
|
4
3
|
import { i18n, i18nSubscribe } from '@rolster/i18n';
|
|
5
4
|
import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, dateOutRange, verifyDateRange, PickerListenerEvent } from '@rolster/components';
|
|
5
|
+
import { DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, dateFormatTemplate, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
7
|
import { useReactControl } from '@rolster/react-forms';
|
|
8
8
|
|
|
@@ -1354,115 +1354,6 @@ function renderClassStatus(base, status = {}, additionals) {
|
|
|
1354
1354
|
return _classElement.join(' ').trim();
|
|
1355
1355
|
}
|
|
1356
1356
|
|
|
1357
|
-
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1358
|
-
|
|
1359
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1360
|
-
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1361
|
-
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1362
|
-
return `${minFormat} - ${maxFormat}`;
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
const errorsDictionary = {
|
|
1366
|
-
es: {
|
|
1367
|
-
alphabetic: 'Campo solo permite caracteres',
|
|
1368
|
-
alphanumber: 'Campo solo permite caracteres y número',
|
|
1369
|
-
decimal: 'Campo debe ser número decimal',
|
|
1370
|
-
defined: 'Campo debe estar definido',
|
|
1371
|
-
email: 'Campo debe ser correo electrónico',
|
|
1372
|
-
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
1373
|
-
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
1374
|
-
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
1375
|
-
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
1376
|
-
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
1377
|
-
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
1378
|
-
nickname: 'Campo inválido para nombre de usuario',
|
|
1379
|
-
onlynumber: 'Campo debe ser númerico',
|
|
1380
|
-
password: 'Campo no permitido para password',
|
|
1381
|
-
reqlength: 'Campo debe tener {length} caracter(es)',
|
|
1382
|
-
required: 'Campo es requerido',
|
|
1383
|
-
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
1384
|
-
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
1385
|
-
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
1386
|
-
_unknown: 'Campo inválido {error}'
|
|
1387
|
-
},
|
|
1388
|
-
en: {
|
|
1389
|
-
alphabetic: 'Field only allows characters',
|
|
1390
|
-
alphanumber: 'Field only allows characters and number',
|
|
1391
|
-
decimal: 'Field must be decimal number',
|
|
1392
|
-
defined: 'Field must be defined',
|
|
1393
|
-
email: 'Field must be email',
|
|
1394
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1395
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1396
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1397
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1398
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1399
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1400
|
-
nickname: 'Invalid field for username',
|
|
1401
|
-
onlynumber: 'Field must be numeric',
|
|
1402
|
-
password: 'Field not allowed for password',
|
|
1403
|
-
reqlength: 'Field must be {length} characters',
|
|
1404
|
-
required: 'Field is required',
|
|
1405
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
1406
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
1407
|
-
textonly: 'Field only allows characters (no space)',
|
|
1408
|
-
_unknown: 'Invalid field {error}'
|
|
1409
|
-
},
|
|
1410
|
-
fr: {
|
|
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
|
-
pt: {
|
|
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 {thanValue} characters',
|
|
1448
|
-
required: 'Field is required',
|
|
1449
|
-
strMinlength: 'Field must have minimum {thanValue} characters',
|
|
1450
|
-
strMaxlength: 'Field must have maximum {thanValue} characters',
|
|
1451
|
-
textonly: 'Field only allows characters (no space)',
|
|
1452
|
-
_unknown: 'Invalid field {error}'
|
|
1453
|
-
}
|
|
1454
|
-
};
|
|
1455
|
-
let _msgErrorsI18n = i18n(errorsDictionary);
|
|
1456
|
-
function setErrorsI18n(dictionary) {
|
|
1457
|
-
_msgErrorsI18n = i18n(Object.entries(errorsDictionary).reduce((_dictionary, [key, value]) => {
|
|
1458
|
-
_dictionary[key] = { ...value, ...dictionary[key] };
|
|
1459
|
-
return _dictionary;
|
|
1460
|
-
}, {}));
|
|
1461
|
-
}
|
|
1462
|
-
function msgErrorsI18n(key, language, interpolators) {
|
|
1463
|
-
return _msgErrorsI18n(key, { language, interpolators });
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
1357
|
const className = 'rls-tabular-text';
|
|
1467
1358
|
const pointers = ['.', ','];
|
|
1468
1359
|
function getCharClass(char) {
|
|
@@ -1795,6 +1686,107 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1795
1686
|
}, children: action.label }, index))) }) })] }));
|
|
1796
1687
|
}
|
|
1797
1688
|
|
|
1689
|
+
const errorsDictionary = {
|
|
1690
|
+
es: {
|
|
1691
|
+
alphabetic: 'Campo solo permite caracteres',
|
|
1692
|
+
alphanumber: 'Campo solo permite caracteres y número',
|
|
1693
|
+
decimal: 'Campo debe ser número decimal',
|
|
1694
|
+
defined: 'Campo debe estar definido',
|
|
1695
|
+
email: 'Campo debe ser correo electrónico',
|
|
1696
|
+
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
1697
|
+
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
1698
|
+
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
1699
|
+
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
1700
|
+
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
1701
|
+
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
1702
|
+
nickname: 'Campo inválido para nombre de usuario',
|
|
1703
|
+
onlynumber: 'Campo debe ser númerico',
|
|
1704
|
+
password: 'Campo no permitido para password',
|
|
1705
|
+
reqlength: 'Campo debe tener {length} caracter(es)',
|
|
1706
|
+
required: 'Campo es requerido',
|
|
1707
|
+
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
1708
|
+
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
1709
|
+
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
1710
|
+
_unknown: 'Campo inválido {error}'
|
|
1711
|
+
},
|
|
1712
|
+
en: {
|
|
1713
|
+
alphabetic: 'Field only allows characters',
|
|
1714
|
+
alphanumber: 'Field only allows characters and number',
|
|
1715
|
+
decimal: 'Field must be decimal number',
|
|
1716
|
+
defined: 'Field must be defined',
|
|
1717
|
+
email: 'Field must be email',
|
|
1718
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1719
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1720
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1721
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1722
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1723
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1724
|
+
nickname: 'Invalid field for username',
|
|
1725
|
+
onlynumber: 'Field must be numeric',
|
|
1726
|
+
password: 'Field not allowed for password',
|
|
1727
|
+
reqlength: 'Field must be {length} characters',
|
|
1728
|
+
required: 'Field is required',
|
|
1729
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1730
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1731
|
+
textonly: 'Field only allows characters (no space)',
|
|
1732
|
+
_unknown: 'Invalid field {error}'
|
|
1733
|
+
},
|
|
1734
|
+
fr: {
|
|
1735
|
+
alphabetic: 'Field only allows characters',
|
|
1736
|
+
alphanumber: 'Field only allows characters and number',
|
|
1737
|
+
decimal: 'Field must be decimal number',
|
|
1738
|
+
defined: 'Field must be defined',
|
|
1739
|
+
email: 'Field must be email',
|
|
1740
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1741
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1742
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1743
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1744
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1745
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1746
|
+
nickname: 'Invalid field for username',
|
|
1747
|
+
onlynumber: 'Field must be numeric',
|
|
1748
|
+
password: 'Field not allowed for password',
|
|
1749
|
+
reqlength: 'Field must be {length} characters',
|
|
1750
|
+
required: 'Field is required',
|
|
1751
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1752
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1753
|
+
textonly: 'Field only allows characters (no space)',
|
|
1754
|
+
_unknown: 'Invalid field {error}'
|
|
1755
|
+
},
|
|
1756
|
+
pt: {
|
|
1757
|
+
alphabetic: 'Field only allows characters',
|
|
1758
|
+
alphanumber: 'Field only allows characters and number',
|
|
1759
|
+
decimal: 'Field must be decimal number',
|
|
1760
|
+
defined: 'Field must be defined',
|
|
1761
|
+
email: 'Field must be email',
|
|
1762
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1763
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1764
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1765
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1766
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1767
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1768
|
+
nickname: 'Invalid field for username',
|
|
1769
|
+
onlynumber: 'Field must be numeric',
|
|
1770
|
+
password: 'Field not allowed for password',
|
|
1771
|
+
reqlength: 'Field must be {thanValue} characters',
|
|
1772
|
+
required: 'Field is required',
|
|
1773
|
+
strMinlength: 'Field must have minimum {thanValue} characters',
|
|
1774
|
+
strMaxlength: 'Field must have maximum {thanValue} characters',
|
|
1775
|
+
textonly: 'Field only allows characters (no space)',
|
|
1776
|
+
_unknown: 'Invalid field {error}'
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
let _msgErrorsI18n = i18n(errorsDictionary);
|
|
1780
|
+
function setErrorsI18n(dictionary) {
|
|
1781
|
+
_msgErrorsI18n = i18n(Object.entries(errorsDictionary).reduce((_dictionary, [key, value]) => {
|
|
1782
|
+
_dictionary[key] = { ...value, ...dictionary[key] };
|
|
1783
|
+
return _dictionary;
|
|
1784
|
+
}, {}));
|
|
1785
|
+
}
|
|
1786
|
+
function msgErrorsI18n(key, language, interpolators) {
|
|
1787
|
+
return _msgErrorsI18n(key, { language, interpolators });
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1798
1790
|
function RlsMessageFormError({ className, formControl }) {
|
|
1799
1791
|
const [language, setLanguage] = useState('es');
|
|
1800
1792
|
useEffect(() => {
|
|
@@ -2499,29 +2491,6 @@ function RlsDatatableFloating({ children, className, identifier, invested, rlsTh
|
|
|
2499
2491
|
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, "rls-theme": rlsTheme, children: children }));
|
|
2500
2492
|
}
|
|
2501
2493
|
|
|
2502
|
-
function createObserver(options) {
|
|
2503
|
-
const { setScrolleable, table } = options;
|
|
2504
|
-
const observer = new ResizeObserver(() => {
|
|
2505
|
-
const scrollHeight = table.scrollHeight || 0;
|
|
2506
|
-
const clientHeight = table.clientHeight || 0;
|
|
2507
|
-
setScrolleable(scrollHeight > clientHeight);
|
|
2508
|
-
});
|
|
2509
|
-
observer.observe(table);
|
|
2510
|
-
return observer;
|
|
2511
|
-
}
|
|
2512
|
-
function useDatatable() {
|
|
2513
|
-
const [scrolleable, setScrolleable] = useState(false);
|
|
2514
|
-
const tableRef = useRef(null);
|
|
2515
|
-
useEffect(() => {
|
|
2516
|
-
const observer = tableRef?.current &&
|
|
2517
|
-
createObserver({ setScrolleable, table: tableRef?.current });
|
|
2518
|
-
return () => {
|
|
2519
|
-
observer?.disconnect();
|
|
2520
|
-
};
|
|
2521
|
-
}, []);
|
|
2522
|
-
return { scrolleable, tableRef };
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2525
2494
|
function calculateMinHeightList(count, height) {
|
|
2526
2495
|
return count <= 0 ? 160 : (count < 6 ? count : 6) * height;
|
|
2527
2496
|
}
|
|
@@ -2639,126 +2608,6 @@ function useListController(props) {
|
|
|
2639
2608
|
};
|
|
2640
2609
|
}
|
|
2641
2610
|
|
|
2642
|
-
function useRelocationOnComponent({ container, element, onDrag }) {
|
|
2643
|
-
const position = useRef({ x: 0, y: 0 });
|
|
2644
|
-
const dragOffset = useRef({ x: 0, y: 0 });
|
|
2645
|
-
const dragging = useRef(false);
|
|
2646
|
-
const getClientX = useCallback((positionX) => {
|
|
2647
|
-
let clientX = position.current.x + positionX - dragOffset.current.x;
|
|
2648
|
-
if (clientX < 0) {
|
|
2649
|
-
clientX = 0;
|
|
2650
|
-
}
|
|
2651
|
-
else {
|
|
2652
|
-
const width = clientX + element.current.offsetWidth;
|
|
2653
|
-
if (width > container.current.offsetWidth) {
|
|
2654
|
-
clientX = container.current.offsetWidth - element.current.offsetWidth;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
return clientX;
|
|
2658
|
-
}, []);
|
|
2659
|
-
const getClientY = useCallback((positionY) => {
|
|
2660
|
-
let clientY = position.current.y + positionY - dragOffset.current.y;
|
|
2661
|
-
if (clientY < 0) {
|
|
2662
|
-
clientY = 0;
|
|
2663
|
-
}
|
|
2664
|
-
else {
|
|
2665
|
-
const height = clientY + element.current.offsetHeight;
|
|
2666
|
-
if (height > container.current.offsetHeight) {
|
|
2667
|
-
clientY = container.current.offsetHeight - element.current.offsetHeight;
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
return clientY;
|
|
2671
|
-
}, []);
|
|
2672
|
-
const start = useCallback((positionX, positionY) => {
|
|
2673
|
-
dragOffset.current = {
|
|
2674
|
-
x: positionX,
|
|
2675
|
-
y: positionY
|
|
2676
|
-
};
|
|
2677
|
-
position.current = {
|
|
2678
|
-
x: element.current.offsetLeft,
|
|
2679
|
-
y: element.current.offsetTop
|
|
2680
|
-
};
|
|
2681
|
-
dragging.current = true;
|
|
2682
|
-
}, []);
|
|
2683
|
-
const relocation = useCallback((positionX, positionY) => {
|
|
2684
|
-
const clientX = getClientX(positionX);
|
|
2685
|
-
const clientY = getClientY(positionY);
|
|
2686
|
-
element.current.style.top = `${clientY}px`;
|
|
2687
|
-
element.current.style.left = `${clientX}px`;
|
|
2688
|
-
onDrag && onDrag();
|
|
2689
|
-
}, []);
|
|
2690
|
-
useEffect(() => {
|
|
2691
|
-
const mousedown = (event) => {
|
|
2692
|
-
start(event.clientX, event.clientY);
|
|
2693
|
-
};
|
|
2694
|
-
const mousemove = (event) => {
|
|
2695
|
-
if (dragging.current) {
|
|
2696
|
-
relocation(event.clientX, event.clientY);
|
|
2697
|
-
event.preventDefault();
|
|
2698
|
-
}
|
|
2699
|
-
};
|
|
2700
|
-
const mouseup = () => {
|
|
2701
|
-
dragging.current = false;
|
|
2702
|
-
};
|
|
2703
|
-
const touchstart = (event) => {
|
|
2704
|
-
if (event.touches[0]) {
|
|
2705
|
-
start(event.touches[0].clientX, event.touches[0].clientY);
|
|
2706
|
-
}
|
|
2707
|
-
};
|
|
2708
|
-
const touchmove = (event) => {
|
|
2709
|
-
if (event.touches[0] && dragging.current) {
|
|
2710
|
-
relocation(event.touches[0].clientX, event.touches[0].clientY);
|
|
2711
|
-
event.preventDefault();
|
|
2712
|
-
}
|
|
2713
|
-
};
|
|
2714
|
-
const touchend = () => {
|
|
2715
|
-
dragging.current = false;
|
|
2716
|
-
};
|
|
2717
|
-
element.current.addEventListener('mousedown', mousedown);
|
|
2718
|
-
element.current.addEventListener('mousemove', mousemove);
|
|
2719
|
-
element.current.addEventListener('mouseup', mouseup);
|
|
2720
|
-
element.current.addEventListener('touchstart', touchstart);
|
|
2721
|
-
element.current.addEventListener('touchmove', touchmove);
|
|
2722
|
-
element.current.addEventListener('touchend', touchend);
|
|
2723
|
-
return () => {
|
|
2724
|
-
element.current?.removeEventListener('mousedown', mousedown);
|
|
2725
|
-
element.current?.removeEventListener('mousemove', mousemove);
|
|
2726
|
-
element.current?.removeEventListener('mouseup', mouseup);
|
|
2727
|
-
element.current?.removeEventListener('touchstart', touchstart);
|
|
2728
|
-
element.current?.removeEventListener('touchmove', touchmove);
|
|
2729
|
-
element.current?.removeEventListener('touchend', touchend);
|
|
2730
|
-
};
|
|
2731
|
-
}, []);
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
function useResize(props) {
|
|
2735
|
-
const { refElement, onResize } = props;
|
|
2736
|
-
const dimension = useRef({ height: 0, width: 0 });
|
|
2737
|
-
const observer = useCallback((entries) => {
|
|
2738
|
-
const { height, width } = entries[0].contentRect;
|
|
2739
|
-
onResize &&
|
|
2740
|
-
onResize({
|
|
2741
|
-
current: dimension.current,
|
|
2742
|
-
dimension: {
|
|
2743
|
-
height,
|
|
2744
|
-
width
|
|
2745
|
-
}
|
|
2746
|
-
});
|
|
2747
|
-
dimension.current = { height, width };
|
|
2748
|
-
}, []);
|
|
2749
|
-
useEffect(() => {
|
|
2750
|
-
dimension.current = {
|
|
2751
|
-
height: refElement.current.offsetHeight,
|
|
2752
|
-
width: refElement.current.offsetWidth
|
|
2753
|
-
};
|
|
2754
|
-
const resizeObserver = new ResizeObserver(observer);
|
|
2755
|
-
resizeObserver.observe(refElement.current);
|
|
2756
|
-
return () => {
|
|
2757
|
-
resizeObserver.disconnect();
|
|
2758
|
-
};
|
|
2759
|
-
}, []);
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
2611
|
const DURATION_ANIMATION$1 = 240;
|
|
2763
2612
|
const MAX_ELEMENTS = 6;
|
|
2764
2613
|
function useFieldAutocomplete(props) {
|
|
@@ -3076,6 +2925,14 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
3076
2925
|
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: icon }) })] }) }), !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: onListener }) })] }));
|
|
3077
2926
|
}
|
|
3078
2927
|
|
|
2928
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
2929
|
+
|
|
2930
|
+
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
2931
|
+
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2932
|
+
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
2933
|
+
return `${minFormat} - ${maxFormat}`;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
3079
2936
|
function RlsPickerDateRange({ automatic, date: _picker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
3080
2937
|
const _date = useMemo(() => normalizeMinTime(_picker ?? new Date()), [_picker]);
|
|
3081
2938
|
const _range = useMemo(() => formControl?.value ?? DateRange.now(), [formControl?.value]);
|
|
@@ -3333,6 +3190,126 @@ function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
|
3333
3190
|
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
3334
3191
|
}
|
|
3335
3192
|
|
|
3193
|
+
function useRelocationOnComponent({ container, element, onDrag }) {
|
|
3194
|
+
const position = useRef({ x: 0, y: 0 });
|
|
3195
|
+
const dragOffset = useRef({ x: 0, y: 0 });
|
|
3196
|
+
const dragging = useRef(false);
|
|
3197
|
+
const getClientX = useCallback((positionX) => {
|
|
3198
|
+
let clientX = position.current.x + positionX - dragOffset.current.x;
|
|
3199
|
+
if (clientX < 0) {
|
|
3200
|
+
clientX = 0;
|
|
3201
|
+
}
|
|
3202
|
+
else {
|
|
3203
|
+
const width = clientX + element.current.offsetWidth;
|
|
3204
|
+
if (width > container.current.offsetWidth) {
|
|
3205
|
+
clientX = container.current.offsetWidth - element.current.offsetWidth;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
return clientX;
|
|
3209
|
+
}, []);
|
|
3210
|
+
const getClientY = useCallback((positionY) => {
|
|
3211
|
+
let clientY = position.current.y + positionY - dragOffset.current.y;
|
|
3212
|
+
if (clientY < 0) {
|
|
3213
|
+
clientY = 0;
|
|
3214
|
+
}
|
|
3215
|
+
else {
|
|
3216
|
+
const height = clientY + element.current.offsetHeight;
|
|
3217
|
+
if (height > container.current.offsetHeight) {
|
|
3218
|
+
clientY = container.current.offsetHeight - element.current.offsetHeight;
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
return clientY;
|
|
3222
|
+
}, []);
|
|
3223
|
+
const start = useCallback((positionX, positionY) => {
|
|
3224
|
+
dragOffset.current = {
|
|
3225
|
+
x: positionX,
|
|
3226
|
+
y: positionY
|
|
3227
|
+
};
|
|
3228
|
+
position.current = {
|
|
3229
|
+
x: element.current.offsetLeft,
|
|
3230
|
+
y: element.current.offsetTop
|
|
3231
|
+
};
|
|
3232
|
+
dragging.current = true;
|
|
3233
|
+
}, []);
|
|
3234
|
+
const relocation = useCallback((positionX, positionY) => {
|
|
3235
|
+
const clientX = getClientX(positionX);
|
|
3236
|
+
const clientY = getClientY(positionY);
|
|
3237
|
+
element.current.style.top = `${clientY}px`;
|
|
3238
|
+
element.current.style.left = `${clientX}px`;
|
|
3239
|
+
onDrag && onDrag();
|
|
3240
|
+
}, []);
|
|
3241
|
+
useEffect(() => {
|
|
3242
|
+
const mousedown = (event) => {
|
|
3243
|
+
start(event.clientX, event.clientY);
|
|
3244
|
+
};
|
|
3245
|
+
const mousemove = (event) => {
|
|
3246
|
+
if (dragging.current) {
|
|
3247
|
+
relocation(event.clientX, event.clientY);
|
|
3248
|
+
event.preventDefault();
|
|
3249
|
+
}
|
|
3250
|
+
};
|
|
3251
|
+
const mouseup = () => {
|
|
3252
|
+
dragging.current = false;
|
|
3253
|
+
};
|
|
3254
|
+
const touchstart = (event) => {
|
|
3255
|
+
if (event.touches[0]) {
|
|
3256
|
+
start(event.touches[0].clientX, event.touches[0].clientY);
|
|
3257
|
+
}
|
|
3258
|
+
};
|
|
3259
|
+
const touchmove = (event) => {
|
|
3260
|
+
if (event.touches[0] && dragging.current) {
|
|
3261
|
+
relocation(event.touches[0].clientX, event.touches[0].clientY);
|
|
3262
|
+
event.preventDefault();
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
const touchend = () => {
|
|
3266
|
+
dragging.current = false;
|
|
3267
|
+
};
|
|
3268
|
+
element.current.addEventListener('mousedown', mousedown);
|
|
3269
|
+
element.current.addEventListener('mousemove', mousemove);
|
|
3270
|
+
element.current.addEventListener('mouseup', mouseup);
|
|
3271
|
+
element.current.addEventListener('touchstart', touchstart);
|
|
3272
|
+
element.current.addEventListener('touchmove', touchmove);
|
|
3273
|
+
element.current.addEventListener('touchend', touchend);
|
|
3274
|
+
return () => {
|
|
3275
|
+
element.current?.removeEventListener('mousedown', mousedown);
|
|
3276
|
+
element.current?.removeEventListener('mousemove', mousemove);
|
|
3277
|
+
element.current?.removeEventListener('mouseup', mouseup);
|
|
3278
|
+
element.current?.removeEventListener('touchstart', touchstart);
|
|
3279
|
+
element.current?.removeEventListener('touchmove', touchmove);
|
|
3280
|
+
element.current?.removeEventListener('touchend', touchend);
|
|
3281
|
+
};
|
|
3282
|
+
}, []);
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
function useResize(props) {
|
|
3286
|
+
const { refElement, onResize } = props;
|
|
3287
|
+
const dimension = useRef({ height: 0, width: 0 });
|
|
3288
|
+
const observer = useCallback((entries) => {
|
|
3289
|
+
const { height, width } = entries[0].contentRect;
|
|
3290
|
+
onResize &&
|
|
3291
|
+
onResize({
|
|
3292
|
+
current: dimension.current,
|
|
3293
|
+
dimension: {
|
|
3294
|
+
height,
|
|
3295
|
+
width
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3298
|
+
dimension.current = { height, width };
|
|
3299
|
+
}, []);
|
|
3300
|
+
useEffect(() => {
|
|
3301
|
+
dimension.current = {
|
|
3302
|
+
height: refElement.current.offsetHeight,
|
|
3303
|
+
width: refElement.current.offsetWidth
|
|
3304
|
+
};
|
|
3305
|
+
const resizeObserver = new ResizeObserver(observer);
|
|
3306
|
+
resizeObserver.observe(refElement.current);
|
|
3307
|
+
return () => {
|
|
3308
|
+
resizeObserver.disconnect();
|
|
3309
|
+
};
|
|
3310
|
+
}, []);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3336
3313
|
function getRatioFactor(ratio) {
|
|
3337
3314
|
switch (ratio) {
|
|
3338
3315
|
case '16:9':
|
|
@@ -3536,7 +3513,11 @@ function RlsImageEditor(props) {
|
|
|
3536
3513
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-editor", children: [jsxRuntimeExports.jsx("div", { ref: refBody, className: "rls-image-editor__body", children: jsxRuntimeExports.jsxs("div", { ref: refImage, className: "rls-image-editor__body__image", children: [jsxRuntimeExports.jsx("div", { ref: refSelection, className: "rls-image-editor__body__selection" }), jsxRuntimeExports.jsx("div", { ref: refOverlayTop, className: "rls-image-editor__body__overlay--top" }), jsxRuntimeExports.jsx("div", { ref: refOverlayRight, className: "rls-image-editor__body__overlay--right" }), jsxRuntimeExports.jsx("div", { ref: refOverlayBottom, className: "rls-image-editor__body__overlay--bottom" }), jsxRuntimeExports.jsx("div", { ref: refOverlayLeft, className: "rls-image-editor__body__overlay--left" }), jsxRuntimeExports.jsx("canvas", { ref: refCanvas })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-editor__sliders", children: jsxRuntimeExports.jsx(RlsSlider, { prefixIcon: "external-link", value: selection, minValue: 50, maxValue: 100, onValue: setSelection, disabled: props.disabled }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__actions", children: [props.children, jsxRuntimeExports.jsx(RlsButton, { type: "classic", prefixIcon: "refresh", onClick: onRestore, disabled: props.disabled, children: labels.actionRestore }), jsxRuntimeExports.jsx(RlsButton, { type: "raised", prefixIcon: "crop", onClick: onCropImage, disabled: props.disabled, children: labels.actionSelect })] })] }), jsxRuntimeExports.jsx("canvas", { ref: refPicture })] }));
|
|
3537
3514
|
}
|
|
3538
3515
|
|
|
3539
|
-
|
|
3516
|
+
function RlsImageEditorModal(props) {
|
|
3517
|
+
return (jsxRuntimeExports.jsx(RlsModal, { className: "rls-image-editor-modal", visible: props.visible, children: jsxRuntimeExports.jsx(RlsImageEditor, { ...props, children: props.children }) }));
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
const MIME_TYPE_SUPPORTS = [
|
|
3540
3521
|
'image/png',
|
|
3541
3522
|
'image/jpg',
|
|
3542
3523
|
'image/jpeg',
|
|
@@ -3545,16 +3526,13 @@ const mimeTypeSupports = [
|
|
|
3545
3526
|
'image/gif',
|
|
3546
3527
|
'image/svg+xml'
|
|
3547
3528
|
];
|
|
3548
|
-
|
|
3529
|
+
|
|
3530
|
+
function useImageEditorController(options) {
|
|
3549
3531
|
const refInput = useRef(null);
|
|
3532
|
+
const [srcEditor, setSrcEditor] = useState();
|
|
3550
3533
|
const [labels, setLabels] = useState({
|
|
3551
3534
|
actionCancel: reactI18n('chooserImageActionCancel')
|
|
3552
3535
|
});
|
|
3553
|
-
const [src, setSrc] = useState();
|
|
3554
|
-
const [srcEditor, setSrcEditor] = useState();
|
|
3555
|
-
const onSelect = useCallback(() => {
|
|
3556
|
-
refInput.current.click();
|
|
3557
|
-
}, []);
|
|
3558
3536
|
const processImage = useCallback((file) => {
|
|
3559
3537
|
const reader = new FileReader();
|
|
3560
3538
|
reader.onload = function () {
|
|
@@ -3564,9 +3542,12 @@ function RlsImageChooser(props) {
|
|
|
3564
3542
|
reader.readAsDataURL(file);
|
|
3565
3543
|
}, []);
|
|
3566
3544
|
useEffect(() => {
|
|
3545
|
+
refInput.current = document.createElement('input');
|
|
3546
|
+
refInput.current.type = 'file';
|
|
3547
|
+
refInput.current.disabled = true;
|
|
3567
3548
|
refInput.current.onchange = () => {
|
|
3568
3549
|
if (refInput.current.files &&
|
|
3569
|
-
|
|
3550
|
+
MIME_TYPE_SUPPORTS.includes(refInput.current.files[0].type)) {
|
|
3570
3551
|
processImage(refInput.current.files[0]);
|
|
3571
3552
|
}
|
|
3572
3553
|
};
|
|
@@ -3576,18 +3557,48 @@ function RlsImageChooser(props) {
|
|
|
3576
3557
|
});
|
|
3577
3558
|
});
|
|
3578
3559
|
}, []);
|
|
3579
|
-
useEffect(() => {
|
|
3580
|
-
props.src && setSrc(props.src);
|
|
3581
|
-
}, [props.src]);
|
|
3582
3560
|
const onEditorValue = useCallback((image) => {
|
|
3583
|
-
setSrc(image.base64);
|
|
3584
3561
|
setSrcEditor(undefined);
|
|
3585
|
-
|
|
3586
|
-
}, [
|
|
3562
|
+
options.onValue && options.onValue(image);
|
|
3563
|
+
}, [options.onValue]);
|
|
3587
3564
|
const onCancel = useCallback(() => {
|
|
3588
3565
|
setSrcEditor(undefined);
|
|
3589
3566
|
}, []);
|
|
3590
|
-
|
|
3567
|
+
const component = useMemo(() => {
|
|
3568
|
+
return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { src: srcEditor, formControl: options.formControl, imgWidth: options.imgWidth, imgQuality: options.imgQuality, onValue: onEditorValue, visible: true, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: options.disabled, children: labels.actionCancel }) })));
|
|
3569
|
+
}, [
|
|
3570
|
+
srcEditor,
|
|
3571
|
+
labels,
|
|
3572
|
+
options.formControl,
|
|
3573
|
+
options.imgWidth,
|
|
3574
|
+
options.imgQuality,
|
|
3575
|
+
options.disabled,
|
|
3576
|
+
onEditorValue,
|
|
3577
|
+
onCancel
|
|
3578
|
+
]);
|
|
3579
|
+
const onImageChooser = useCallback(() => {
|
|
3580
|
+
refInput.current.click();
|
|
3581
|
+
}, []);
|
|
3582
|
+
return { RlsImageEditorChooser: component, onImageChooser };
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
function RlsImageChooser(props) {
|
|
3586
|
+
const [src, setSrc] = useState();
|
|
3587
|
+
const onValue = useCallback((image) => {
|
|
3588
|
+
setSrc(image.base64);
|
|
3589
|
+
props.onValue && props.onValue(image);
|
|
3590
|
+
}, [props.onValue]);
|
|
3591
|
+
const { RlsImageEditorChooser, onImageChooser } = useImageEditorController({
|
|
3592
|
+
disabled: props.disabled,
|
|
3593
|
+
formControl: props.formControl,
|
|
3594
|
+
imgQuality: props.imgQuality,
|
|
3595
|
+
imgWidth: props.imgWidth,
|
|
3596
|
+
onValue
|
|
3597
|
+
});
|
|
3598
|
+
useEffect(() => {
|
|
3599
|
+
props.src && setSrc(props.src);
|
|
3600
|
+
}, [props.src]);
|
|
3601
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: onImageChooser, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), RlsImageEditorChooser] }));
|
|
3591
3602
|
}
|
|
3592
3603
|
|
|
3593
3604
|
const DURATION_ANIMATION = 240;
|
|
@@ -3676,5 +3687,28 @@ function RlsApplication({ children }) {
|
|
|
3676
3687
|
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
3677
3688
|
}
|
|
3678
3689
|
|
|
3679
|
-
|
|
3690
|
+
function createObserver(options) {
|
|
3691
|
+
const { setScrolleable, table } = options;
|
|
3692
|
+
const observer = new ResizeObserver(() => {
|
|
3693
|
+
const scrollHeight = table.scrollHeight || 0;
|
|
3694
|
+
const clientHeight = table.clientHeight || 0;
|
|
3695
|
+
setScrolleable(scrollHeight > clientHeight);
|
|
3696
|
+
});
|
|
3697
|
+
observer.observe(table);
|
|
3698
|
+
return observer;
|
|
3699
|
+
}
|
|
3700
|
+
function useDatatable() {
|
|
3701
|
+
const [scrolleable, setScrolleable] = useState(false);
|
|
3702
|
+
const tableRef = useRef(null);
|
|
3703
|
+
useEffect(() => {
|
|
3704
|
+
const observer = tableRef?.current &&
|
|
3705
|
+
createObserver({ setScrolleable, table: tableRef?.current });
|
|
3706
|
+
return () => {
|
|
3707
|
+
observer?.disconnect();
|
|
3708
|
+
};
|
|
3709
|
+
}, []);
|
|
3710
|
+
return { scrolleable, tableRef };
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useFieldAutocomplete, useFieldSelect, useImageEditorController, useListController, useRelocationOnComponent, useResize, useSnackbar };
|
|
3680
3714
|
//# sourceMappingURL=index.js.map
|