@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/cjs/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('react');
|
|
4
4
|
var commons = require('@rolster/commons');
|
|
5
|
-
var dates = require('@rolster/dates');
|
|
6
5
|
var i18n = require('@rolster/i18n');
|
|
7
6
|
var components = require('@rolster/components');
|
|
7
|
+
var dates = require('@rolster/dates');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
9
9
|
var reactForms = require('@rolster/react-forms');
|
|
10
10
|
|
|
@@ -1356,115 +1356,6 @@ function renderClassStatus(base, status = {}, additionals) {
|
|
|
1356
1356
|
return _classElement.join(' ').trim();
|
|
1357
1357
|
}
|
|
1358
1358
|
|
|
1359
|
-
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1360
|
-
|
|
1361
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1362
|
-
const minFormat = dates.dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1363
|
-
const maxFormat = dates.dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1364
|
-
return `${minFormat} - ${maxFormat}`;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
const errorsDictionary = {
|
|
1368
|
-
es: {
|
|
1369
|
-
alphabetic: 'Campo solo permite caracteres',
|
|
1370
|
-
alphanumber: 'Campo solo permite caracteres y número',
|
|
1371
|
-
decimal: 'Campo debe ser número decimal',
|
|
1372
|
-
defined: 'Campo debe estar definido',
|
|
1373
|
-
email: 'Campo debe ser correo electrónico',
|
|
1374
|
-
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
1375
|
-
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
1376
|
-
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
1377
|
-
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
1378
|
-
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
1379
|
-
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
1380
|
-
nickname: 'Campo inválido para nombre de usuario',
|
|
1381
|
-
onlynumber: 'Campo debe ser númerico',
|
|
1382
|
-
password: 'Campo no permitido para password',
|
|
1383
|
-
reqlength: 'Campo debe tener {length} caracter(es)',
|
|
1384
|
-
required: 'Campo es requerido',
|
|
1385
|
-
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
1386
|
-
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
1387
|
-
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
1388
|
-
_unknown: 'Campo inválido {error}'
|
|
1389
|
-
},
|
|
1390
|
-
en: {
|
|
1391
|
-
alphabetic: 'Field only allows characters',
|
|
1392
|
-
alphanumber: 'Field only allows characters and number',
|
|
1393
|
-
decimal: 'Field must be decimal number',
|
|
1394
|
-
defined: 'Field must be defined',
|
|
1395
|
-
email: 'Field must be email',
|
|
1396
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1397
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1398
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1399
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1400
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1401
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1402
|
-
nickname: 'Invalid field for username',
|
|
1403
|
-
onlynumber: 'Field must be numeric',
|
|
1404
|
-
password: 'Field not allowed for password',
|
|
1405
|
-
reqlength: 'Field must be {length} characters',
|
|
1406
|
-
required: 'Field is required',
|
|
1407
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
1408
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
1409
|
-
textonly: 'Field only allows characters (no space)',
|
|
1410
|
-
_unknown: 'Invalid field {error}'
|
|
1411
|
-
},
|
|
1412
|
-
fr: {
|
|
1413
|
-
alphabetic: 'Field only allows characters',
|
|
1414
|
-
alphanumber: 'Field only allows characters and number',
|
|
1415
|
-
decimal: 'Field must be decimal number',
|
|
1416
|
-
defined: 'Field must be defined',
|
|
1417
|
-
email: 'Field must be email',
|
|
1418
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1419
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1420
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1421
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1422
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1423
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1424
|
-
nickname: 'Invalid field for username',
|
|
1425
|
-
onlynumber: 'Field must be numeric',
|
|
1426
|
-
password: 'Field not allowed for password',
|
|
1427
|
-
reqlength: 'Field must be {length} characters',
|
|
1428
|
-
required: 'Field is required',
|
|
1429
|
-
strMinlength: 'Field must have minimum {length} characters',
|
|
1430
|
-
strMaxlength: 'Field must have maximum {length} characters',
|
|
1431
|
-
textonly: 'Field only allows characters (no space)',
|
|
1432
|
-
_unknown: 'Invalid field {error}'
|
|
1433
|
-
},
|
|
1434
|
-
pt: {
|
|
1435
|
-
alphabetic: 'Field only allows characters',
|
|
1436
|
-
alphanumber: 'Field only allows characters and number',
|
|
1437
|
-
decimal: 'Field must be decimal number',
|
|
1438
|
-
defined: 'Field must be defined',
|
|
1439
|
-
email: 'Field must be email',
|
|
1440
|
-
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1441
|
-
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1442
|
-
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1443
|
-
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1444
|
-
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1445
|
-
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1446
|
-
nickname: 'Invalid field for username',
|
|
1447
|
-
onlynumber: 'Field must be numeric',
|
|
1448
|
-
password: 'Field not allowed for password',
|
|
1449
|
-
reqlength: 'Field must be {thanValue} characters',
|
|
1450
|
-
required: 'Field is required',
|
|
1451
|
-
strMinlength: 'Field must have minimum {thanValue} characters',
|
|
1452
|
-
strMaxlength: 'Field must have maximum {thanValue} characters',
|
|
1453
|
-
textonly: 'Field only allows characters (no space)',
|
|
1454
|
-
_unknown: 'Invalid field {error}'
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
let _msgErrorsI18n = i18n.i18n(errorsDictionary);
|
|
1458
|
-
function setErrorsI18n(dictionary) {
|
|
1459
|
-
_msgErrorsI18n = i18n.i18n(Object.entries(errorsDictionary).reduce((_dictionary, [key, value]) => {
|
|
1460
|
-
_dictionary[key] = { ...value, ...dictionary[key] };
|
|
1461
|
-
return _dictionary;
|
|
1462
|
-
}, {}));
|
|
1463
|
-
}
|
|
1464
|
-
function msgErrorsI18n(key, language, interpolators) {
|
|
1465
|
-
return _msgErrorsI18n(key, { language, interpolators });
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
1359
|
const className = 'rls-tabular-text';
|
|
1469
1360
|
const pointers = ['.', ','];
|
|
1470
1361
|
function getCharClass(char) {
|
|
@@ -1797,6 +1688,107 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1797
1688
|
}, children: action.label }, index))) }) })] }));
|
|
1798
1689
|
}
|
|
1799
1690
|
|
|
1691
|
+
const errorsDictionary = {
|
|
1692
|
+
es: {
|
|
1693
|
+
alphabetic: 'Campo solo permite caracteres',
|
|
1694
|
+
alphanumber: 'Campo solo permite caracteres y número',
|
|
1695
|
+
decimal: 'Campo debe ser número decimal',
|
|
1696
|
+
defined: 'Campo debe estar definido',
|
|
1697
|
+
email: 'Campo debe ser correo electrónico',
|
|
1698
|
+
greaterThanValue: 'Campo debe tener un valor mayor a {thanValue}',
|
|
1699
|
+
greaterOrEqualsThanValue: 'Campo debe tener un valor mayor o igual a {thanValue}',
|
|
1700
|
+
lessThanValue: 'Campo debe tener un valor menor a {thanValue}',
|
|
1701
|
+
lessOrEqualsThanValue: 'Campo debe tener un valor menor o igual a {thanValue}',
|
|
1702
|
+
maxValue: 'Campo debe tener un valor máximo de {thanValue}',
|
|
1703
|
+
minValue: 'Campo debe tener un valor mínimo de {thanValue}',
|
|
1704
|
+
nickname: 'Campo inválido para nombre de usuario',
|
|
1705
|
+
onlynumber: 'Campo debe ser númerico',
|
|
1706
|
+
password: 'Campo no permitido para password',
|
|
1707
|
+
reqlength: 'Campo debe tener {length} caracter(es)',
|
|
1708
|
+
required: 'Campo es requerido',
|
|
1709
|
+
strMinlength: 'Campo debe tener mínimo {length} caracter(es)',
|
|
1710
|
+
strMaxlength: 'Campo debe tener máximo {length} caracter(es)',
|
|
1711
|
+
textonly: 'Campo solo permite caracteres (sin espacio)',
|
|
1712
|
+
_unknown: 'Campo inválido {error}'
|
|
1713
|
+
},
|
|
1714
|
+
en: {
|
|
1715
|
+
alphabetic: 'Field only allows characters',
|
|
1716
|
+
alphanumber: 'Field only allows characters and number',
|
|
1717
|
+
decimal: 'Field must be decimal number',
|
|
1718
|
+
defined: 'Field must be defined',
|
|
1719
|
+
email: 'Field must be email',
|
|
1720
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1721
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1722
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1723
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1724
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1725
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1726
|
+
nickname: 'Invalid field for username',
|
|
1727
|
+
onlynumber: 'Field must be numeric',
|
|
1728
|
+
password: 'Field not allowed for password',
|
|
1729
|
+
reqlength: 'Field must be {length} characters',
|
|
1730
|
+
required: 'Field is required',
|
|
1731
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1732
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1733
|
+
textonly: 'Field only allows characters (no space)',
|
|
1734
|
+
_unknown: 'Invalid field {error}'
|
|
1735
|
+
},
|
|
1736
|
+
fr: {
|
|
1737
|
+
alphabetic: 'Field only allows characters',
|
|
1738
|
+
alphanumber: 'Field only allows characters and number',
|
|
1739
|
+
decimal: 'Field must be decimal number',
|
|
1740
|
+
defined: 'Field must be defined',
|
|
1741
|
+
email: 'Field must be email',
|
|
1742
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1743
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1744
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1745
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1746
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1747
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1748
|
+
nickname: 'Invalid field for username',
|
|
1749
|
+
onlynumber: 'Field must be numeric',
|
|
1750
|
+
password: 'Field not allowed for password',
|
|
1751
|
+
reqlength: 'Field must be {length} characters',
|
|
1752
|
+
required: 'Field is required',
|
|
1753
|
+
strMinlength: 'Field must have minimum {length} characters',
|
|
1754
|
+
strMaxlength: 'Field must have maximum {length} characters',
|
|
1755
|
+
textonly: 'Field only allows characters (no space)',
|
|
1756
|
+
_unknown: 'Invalid field {error}'
|
|
1757
|
+
},
|
|
1758
|
+
pt: {
|
|
1759
|
+
alphabetic: 'Field only allows characters',
|
|
1760
|
+
alphanumber: 'Field only allows characters and number',
|
|
1761
|
+
decimal: 'Field must be decimal number',
|
|
1762
|
+
defined: 'Field must be defined',
|
|
1763
|
+
email: 'Field must be email',
|
|
1764
|
+
greaterThanValue: 'Field must have a value greater than {thanValue}',
|
|
1765
|
+
greaterOrEqualsThanValue: 'Field must have a value greater than or equal to {thanValue}',
|
|
1766
|
+
lessThanValue: 'Field must have a value less than {thanValue}',
|
|
1767
|
+
lessOrEqualsThanValue: 'Field must have a value less than or equal to {thanValue}',
|
|
1768
|
+
minValue: 'Field must have a minimum value of {thanValue}',
|
|
1769
|
+
maxValue: 'Field must have a maximum value of {thanValue}',
|
|
1770
|
+
nickname: 'Invalid field for username',
|
|
1771
|
+
onlynumber: 'Field must be numeric',
|
|
1772
|
+
password: 'Field not allowed for password',
|
|
1773
|
+
reqlength: 'Field must be {thanValue} characters',
|
|
1774
|
+
required: 'Field is required',
|
|
1775
|
+
strMinlength: 'Field must have minimum {thanValue} characters',
|
|
1776
|
+
strMaxlength: 'Field must have maximum {thanValue} characters',
|
|
1777
|
+
textonly: 'Field only allows characters (no space)',
|
|
1778
|
+
_unknown: 'Invalid field {error}'
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
let _msgErrorsI18n = i18n.i18n(errorsDictionary);
|
|
1782
|
+
function setErrorsI18n(dictionary) {
|
|
1783
|
+
_msgErrorsI18n = i18n.i18n(Object.entries(errorsDictionary).reduce((_dictionary, [key, value]) => {
|
|
1784
|
+
_dictionary[key] = { ...value, ...dictionary[key] };
|
|
1785
|
+
return _dictionary;
|
|
1786
|
+
}, {}));
|
|
1787
|
+
}
|
|
1788
|
+
function msgErrorsI18n(key, language, interpolators) {
|
|
1789
|
+
return _msgErrorsI18n(key, { language, interpolators });
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1800
1792
|
function RlsMessageFormError({ className, formControl }) {
|
|
1801
1793
|
const [language, setLanguage] = require$$0.useState('es');
|
|
1802
1794
|
require$$0.useEffect(() => {
|
|
@@ -2501,29 +2493,6 @@ function RlsDatatableFloating({ children, className, identifier, invested, rlsTh
|
|
|
2501
2493
|
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, "rls-theme": rlsTheme, children: children }));
|
|
2502
2494
|
}
|
|
2503
2495
|
|
|
2504
|
-
function createObserver(options) {
|
|
2505
|
-
const { setScrolleable, table } = options;
|
|
2506
|
-
const observer = new ResizeObserver(() => {
|
|
2507
|
-
const scrollHeight = table.scrollHeight || 0;
|
|
2508
|
-
const clientHeight = table.clientHeight || 0;
|
|
2509
|
-
setScrolleable(scrollHeight > clientHeight);
|
|
2510
|
-
});
|
|
2511
|
-
observer.observe(table);
|
|
2512
|
-
return observer;
|
|
2513
|
-
}
|
|
2514
|
-
function useDatatable() {
|
|
2515
|
-
const [scrolleable, setScrolleable] = require$$0.useState(false);
|
|
2516
|
-
const tableRef = require$$0.useRef(null);
|
|
2517
|
-
require$$0.useEffect(() => {
|
|
2518
|
-
const observer = tableRef?.current &&
|
|
2519
|
-
createObserver({ setScrolleable, table: tableRef?.current });
|
|
2520
|
-
return () => {
|
|
2521
|
-
observer?.disconnect();
|
|
2522
|
-
};
|
|
2523
|
-
}, []);
|
|
2524
|
-
return { scrolleable, tableRef };
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
2496
|
function calculateMinHeightList(count, height) {
|
|
2528
2497
|
return count <= 0 ? 160 : (count < 6 ? count : 6) * height;
|
|
2529
2498
|
}
|
|
@@ -2641,126 +2610,6 @@ function useListController(props) {
|
|
|
2641
2610
|
};
|
|
2642
2611
|
}
|
|
2643
2612
|
|
|
2644
|
-
function useRelocationOnComponent({ container, element, onDrag }) {
|
|
2645
|
-
const position = require$$0.useRef({ x: 0, y: 0 });
|
|
2646
|
-
const dragOffset = require$$0.useRef({ x: 0, y: 0 });
|
|
2647
|
-
const dragging = require$$0.useRef(false);
|
|
2648
|
-
const getClientX = require$$0.useCallback((positionX) => {
|
|
2649
|
-
let clientX = position.current.x + positionX - dragOffset.current.x;
|
|
2650
|
-
if (clientX < 0) {
|
|
2651
|
-
clientX = 0;
|
|
2652
|
-
}
|
|
2653
|
-
else {
|
|
2654
|
-
const width = clientX + element.current.offsetWidth;
|
|
2655
|
-
if (width > container.current.offsetWidth) {
|
|
2656
|
-
clientX = container.current.offsetWidth - element.current.offsetWidth;
|
|
2657
|
-
}
|
|
2658
|
-
}
|
|
2659
|
-
return clientX;
|
|
2660
|
-
}, []);
|
|
2661
|
-
const getClientY = require$$0.useCallback((positionY) => {
|
|
2662
|
-
let clientY = position.current.y + positionY - dragOffset.current.y;
|
|
2663
|
-
if (clientY < 0) {
|
|
2664
|
-
clientY = 0;
|
|
2665
|
-
}
|
|
2666
|
-
else {
|
|
2667
|
-
const height = clientY + element.current.offsetHeight;
|
|
2668
|
-
if (height > container.current.offsetHeight) {
|
|
2669
|
-
clientY = container.current.offsetHeight - element.current.offsetHeight;
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
return clientY;
|
|
2673
|
-
}, []);
|
|
2674
|
-
const start = require$$0.useCallback((positionX, positionY) => {
|
|
2675
|
-
dragOffset.current = {
|
|
2676
|
-
x: positionX,
|
|
2677
|
-
y: positionY
|
|
2678
|
-
};
|
|
2679
|
-
position.current = {
|
|
2680
|
-
x: element.current.offsetLeft,
|
|
2681
|
-
y: element.current.offsetTop
|
|
2682
|
-
};
|
|
2683
|
-
dragging.current = true;
|
|
2684
|
-
}, []);
|
|
2685
|
-
const relocation = require$$0.useCallback((positionX, positionY) => {
|
|
2686
|
-
const clientX = getClientX(positionX);
|
|
2687
|
-
const clientY = getClientY(positionY);
|
|
2688
|
-
element.current.style.top = `${clientY}px`;
|
|
2689
|
-
element.current.style.left = `${clientX}px`;
|
|
2690
|
-
onDrag && onDrag();
|
|
2691
|
-
}, []);
|
|
2692
|
-
require$$0.useEffect(() => {
|
|
2693
|
-
const mousedown = (event) => {
|
|
2694
|
-
start(event.clientX, event.clientY);
|
|
2695
|
-
};
|
|
2696
|
-
const mousemove = (event) => {
|
|
2697
|
-
if (dragging.current) {
|
|
2698
|
-
relocation(event.clientX, event.clientY);
|
|
2699
|
-
event.preventDefault();
|
|
2700
|
-
}
|
|
2701
|
-
};
|
|
2702
|
-
const mouseup = () => {
|
|
2703
|
-
dragging.current = false;
|
|
2704
|
-
};
|
|
2705
|
-
const touchstart = (event) => {
|
|
2706
|
-
if (event.touches[0]) {
|
|
2707
|
-
start(event.touches[0].clientX, event.touches[0].clientY);
|
|
2708
|
-
}
|
|
2709
|
-
};
|
|
2710
|
-
const touchmove = (event) => {
|
|
2711
|
-
if (event.touches[0] && dragging.current) {
|
|
2712
|
-
relocation(event.touches[0].clientX, event.touches[0].clientY);
|
|
2713
|
-
event.preventDefault();
|
|
2714
|
-
}
|
|
2715
|
-
};
|
|
2716
|
-
const touchend = () => {
|
|
2717
|
-
dragging.current = false;
|
|
2718
|
-
};
|
|
2719
|
-
element.current.addEventListener('mousedown', mousedown);
|
|
2720
|
-
element.current.addEventListener('mousemove', mousemove);
|
|
2721
|
-
element.current.addEventListener('mouseup', mouseup);
|
|
2722
|
-
element.current.addEventListener('touchstart', touchstart);
|
|
2723
|
-
element.current.addEventListener('touchmove', touchmove);
|
|
2724
|
-
element.current.addEventListener('touchend', touchend);
|
|
2725
|
-
return () => {
|
|
2726
|
-
element.current?.removeEventListener('mousedown', mousedown);
|
|
2727
|
-
element.current?.removeEventListener('mousemove', mousemove);
|
|
2728
|
-
element.current?.removeEventListener('mouseup', mouseup);
|
|
2729
|
-
element.current?.removeEventListener('touchstart', touchstart);
|
|
2730
|
-
element.current?.removeEventListener('touchmove', touchmove);
|
|
2731
|
-
element.current?.removeEventListener('touchend', touchend);
|
|
2732
|
-
};
|
|
2733
|
-
}, []);
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
function useResize(props) {
|
|
2737
|
-
const { refElement, onResize } = props;
|
|
2738
|
-
const dimension = require$$0.useRef({ height: 0, width: 0 });
|
|
2739
|
-
const observer = require$$0.useCallback((entries) => {
|
|
2740
|
-
const { height, width } = entries[0].contentRect;
|
|
2741
|
-
onResize &&
|
|
2742
|
-
onResize({
|
|
2743
|
-
current: dimension.current,
|
|
2744
|
-
dimension: {
|
|
2745
|
-
height,
|
|
2746
|
-
width
|
|
2747
|
-
}
|
|
2748
|
-
});
|
|
2749
|
-
dimension.current = { height, width };
|
|
2750
|
-
}, []);
|
|
2751
|
-
require$$0.useEffect(() => {
|
|
2752
|
-
dimension.current = {
|
|
2753
|
-
height: refElement.current.offsetHeight,
|
|
2754
|
-
width: refElement.current.offsetWidth
|
|
2755
|
-
};
|
|
2756
|
-
const resizeObserver = new ResizeObserver(observer);
|
|
2757
|
-
resizeObserver.observe(refElement.current);
|
|
2758
|
-
return () => {
|
|
2759
|
-
resizeObserver.disconnect();
|
|
2760
|
-
};
|
|
2761
|
-
}, []);
|
|
2762
|
-
}
|
|
2763
|
-
|
|
2764
2613
|
const DURATION_ANIMATION$1 = 240;
|
|
2765
2614
|
const MAX_ELEMENTS = 6;
|
|
2766
2615
|
function useFieldAutocomplete(props) {
|
|
@@ -3078,6 +2927,14 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
3078
2927
|
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 }) })] }));
|
|
3079
2928
|
}
|
|
3080
2929
|
|
|
2930
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
2931
|
+
|
|
2932
|
+
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
2933
|
+
const minFormat = dates.dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
2934
|
+
const maxFormat = dates.dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
2935
|
+
return `${minFormat} - ${maxFormat}`;
|
|
2936
|
+
}
|
|
2937
|
+
|
|
3081
2938
|
function RlsPickerDateRange({ automatic, date: _picker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
3082
2939
|
const _date = require$$0.useMemo(() => dates.normalizeMinTime(_picker ?? new Date()), [_picker]);
|
|
3083
2940
|
const _range = require$$0.useMemo(() => formControl?.value ?? dates.DateRange.now(), [formControl?.value]);
|
|
@@ -3335,6 +3192,126 @@ function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
|
3335
3192
|
return (jsxRuntimeExports.jsx("div", { className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
3336
3193
|
}
|
|
3337
3194
|
|
|
3195
|
+
function useRelocationOnComponent({ container, element, onDrag }) {
|
|
3196
|
+
const position = require$$0.useRef({ x: 0, y: 0 });
|
|
3197
|
+
const dragOffset = require$$0.useRef({ x: 0, y: 0 });
|
|
3198
|
+
const dragging = require$$0.useRef(false);
|
|
3199
|
+
const getClientX = require$$0.useCallback((positionX) => {
|
|
3200
|
+
let clientX = position.current.x + positionX - dragOffset.current.x;
|
|
3201
|
+
if (clientX < 0) {
|
|
3202
|
+
clientX = 0;
|
|
3203
|
+
}
|
|
3204
|
+
else {
|
|
3205
|
+
const width = clientX + element.current.offsetWidth;
|
|
3206
|
+
if (width > container.current.offsetWidth) {
|
|
3207
|
+
clientX = container.current.offsetWidth - element.current.offsetWidth;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
return clientX;
|
|
3211
|
+
}, []);
|
|
3212
|
+
const getClientY = require$$0.useCallback((positionY) => {
|
|
3213
|
+
let clientY = position.current.y + positionY - dragOffset.current.y;
|
|
3214
|
+
if (clientY < 0) {
|
|
3215
|
+
clientY = 0;
|
|
3216
|
+
}
|
|
3217
|
+
else {
|
|
3218
|
+
const height = clientY + element.current.offsetHeight;
|
|
3219
|
+
if (height > container.current.offsetHeight) {
|
|
3220
|
+
clientY = container.current.offsetHeight - element.current.offsetHeight;
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3223
|
+
return clientY;
|
|
3224
|
+
}, []);
|
|
3225
|
+
const start = require$$0.useCallback((positionX, positionY) => {
|
|
3226
|
+
dragOffset.current = {
|
|
3227
|
+
x: positionX,
|
|
3228
|
+
y: positionY
|
|
3229
|
+
};
|
|
3230
|
+
position.current = {
|
|
3231
|
+
x: element.current.offsetLeft,
|
|
3232
|
+
y: element.current.offsetTop
|
|
3233
|
+
};
|
|
3234
|
+
dragging.current = true;
|
|
3235
|
+
}, []);
|
|
3236
|
+
const relocation = require$$0.useCallback((positionX, positionY) => {
|
|
3237
|
+
const clientX = getClientX(positionX);
|
|
3238
|
+
const clientY = getClientY(positionY);
|
|
3239
|
+
element.current.style.top = `${clientY}px`;
|
|
3240
|
+
element.current.style.left = `${clientX}px`;
|
|
3241
|
+
onDrag && onDrag();
|
|
3242
|
+
}, []);
|
|
3243
|
+
require$$0.useEffect(() => {
|
|
3244
|
+
const mousedown = (event) => {
|
|
3245
|
+
start(event.clientX, event.clientY);
|
|
3246
|
+
};
|
|
3247
|
+
const mousemove = (event) => {
|
|
3248
|
+
if (dragging.current) {
|
|
3249
|
+
relocation(event.clientX, event.clientY);
|
|
3250
|
+
event.preventDefault();
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
const mouseup = () => {
|
|
3254
|
+
dragging.current = false;
|
|
3255
|
+
};
|
|
3256
|
+
const touchstart = (event) => {
|
|
3257
|
+
if (event.touches[0]) {
|
|
3258
|
+
start(event.touches[0].clientX, event.touches[0].clientY);
|
|
3259
|
+
}
|
|
3260
|
+
};
|
|
3261
|
+
const touchmove = (event) => {
|
|
3262
|
+
if (event.touches[0] && dragging.current) {
|
|
3263
|
+
relocation(event.touches[0].clientX, event.touches[0].clientY);
|
|
3264
|
+
event.preventDefault();
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
const touchend = () => {
|
|
3268
|
+
dragging.current = false;
|
|
3269
|
+
};
|
|
3270
|
+
element.current.addEventListener('mousedown', mousedown);
|
|
3271
|
+
element.current.addEventListener('mousemove', mousemove);
|
|
3272
|
+
element.current.addEventListener('mouseup', mouseup);
|
|
3273
|
+
element.current.addEventListener('touchstart', touchstart);
|
|
3274
|
+
element.current.addEventListener('touchmove', touchmove);
|
|
3275
|
+
element.current.addEventListener('touchend', touchend);
|
|
3276
|
+
return () => {
|
|
3277
|
+
element.current?.removeEventListener('mousedown', mousedown);
|
|
3278
|
+
element.current?.removeEventListener('mousemove', mousemove);
|
|
3279
|
+
element.current?.removeEventListener('mouseup', mouseup);
|
|
3280
|
+
element.current?.removeEventListener('touchstart', touchstart);
|
|
3281
|
+
element.current?.removeEventListener('touchmove', touchmove);
|
|
3282
|
+
element.current?.removeEventListener('touchend', touchend);
|
|
3283
|
+
};
|
|
3284
|
+
}, []);
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
function useResize(props) {
|
|
3288
|
+
const { refElement, onResize } = props;
|
|
3289
|
+
const dimension = require$$0.useRef({ height: 0, width: 0 });
|
|
3290
|
+
const observer = require$$0.useCallback((entries) => {
|
|
3291
|
+
const { height, width } = entries[0].contentRect;
|
|
3292
|
+
onResize &&
|
|
3293
|
+
onResize({
|
|
3294
|
+
current: dimension.current,
|
|
3295
|
+
dimension: {
|
|
3296
|
+
height,
|
|
3297
|
+
width
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
dimension.current = { height, width };
|
|
3301
|
+
}, []);
|
|
3302
|
+
require$$0.useEffect(() => {
|
|
3303
|
+
dimension.current = {
|
|
3304
|
+
height: refElement.current.offsetHeight,
|
|
3305
|
+
width: refElement.current.offsetWidth
|
|
3306
|
+
};
|
|
3307
|
+
const resizeObserver = new ResizeObserver(observer);
|
|
3308
|
+
resizeObserver.observe(refElement.current);
|
|
3309
|
+
return () => {
|
|
3310
|
+
resizeObserver.disconnect();
|
|
3311
|
+
};
|
|
3312
|
+
}, []);
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3338
3315
|
function getRatioFactor(ratio) {
|
|
3339
3316
|
switch (ratio) {
|
|
3340
3317
|
case '16:9':
|
|
@@ -3538,7 +3515,11 @@ function RlsImageEditor(props) {
|
|
|
3538
3515
|
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 })] }));
|
|
3539
3516
|
}
|
|
3540
3517
|
|
|
3541
|
-
|
|
3518
|
+
function RlsImageEditorModal(props) {
|
|
3519
|
+
return (jsxRuntimeExports.jsx(RlsModal, { className: "rls-image-editor-modal", visible: props.visible, children: jsxRuntimeExports.jsx(RlsImageEditor, { ...props, children: props.children }) }));
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
const MIME_TYPE_SUPPORTS = [
|
|
3542
3523
|
'image/png',
|
|
3543
3524
|
'image/jpg',
|
|
3544
3525
|
'image/jpeg',
|
|
@@ -3547,16 +3528,13 @@ const mimeTypeSupports = [
|
|
|
3547
3528
|
'image/gif',
|
|
3548
3529
|
'image/svg+xml'
|
|
3549
3530
|
];
|
|
3550
|
-
|
|
3531
|
+
|
|
3532
|
+
function useImageEditorController(options) {
|
|
3551
3533
|
const refInput = require$$0.useRef(null);
|
|
3534
|
+
const [srcEditor, setSrcEditor] = require$$0.useState();
|
|
3552
3535
|
const [labels, setLabels] = require$$0.useState({
|
|
3553
3536
|
actionCancel: reactI18n('chooserImageActionCancel')
|
|
3554
3537
|
});
|
|
3555
|
-
const [src, setSrc] = require$$0.useState();
|
|
3556
|
-
const [srcEditor, setSrcEditor] = require$$0.useState();
|
|
3557
|
-
const onSelect = require$$0.useCallback(() => {
|
|
3558
|
-
refInput.current.click();
|
|
3559
|
-
}, []);
|
|
3560
3538
|
const processImage = require$$0.useCallback((file) => {
|
|
3561
3539
|
const reader = new FileReader();
|
|
3562
3540
|
reader.onload = function () {
|
|
@@ -3566,9 +3544,12 @@ function RlsImageChooser(props) {
|
|
|
3566
3544
|
reader.readAsDataURL(file);
|
|
3567
3545
|
}, []);
|
|
3568
3546
|
require$$0.useEffect(() => {
|
|
3547
|
+
refInput.current = document.createElement('input');
|
|
3548
|
+
refInput.current.type = 'file';
|
|
3549
|
+
refInput.current.disabled = true;
|
|
3569
3550
|
refInput.current.onchange = () => {
|
|
3570
3551
|
if (refInput.current.files &&
|
|
3571
|
-
|
|
3552
|
+
MIME_TYPE_SUPPORTS.includes(refInput.current.files[0].type)) {
|
|
3572
3553
|
processImage(refInput.current.files[0]);
|
|
3573
3554
|
}
|
|
3574
3555
|
};
|
|
@@ -3578,18 +3559,48 @@ function RlsImageChooser(props) {
|
|
|
3578
3559
|
});
|
|
3579
3560
|
});
|
|
3580
3561
|
}, []);
|
|
3581
|
-
require$$0.useEffect(() => {
|
|
3582
|
-
props.src && setSrc(props.src);
|
|
3583
|
-
}, [props.src]);
|
|
3584
3562
|
const onEditorValue = require$$0.useCallback((image) => {
|
|
3585
|
-
setSrc(image.base64);
|
|
3586
3563
|
setSrcEditor(undefined);
|
|
3587
|
-
|
|
3588
|
-
}, [
|
|
3564
|
+
options.onValue && options.onValue(image);
|
|
3565
|
+
}, [options.onValue]);
|
|
3589
3566
|
const onCancel = require$$0.useCallback(() => {
|
|
3590
3567
|
setSrcEditor(undefined);
|
|
3591
3568
|
}, []);
|
|
3592
|
-
|
|
3569
|
+
const component = require$$0.useMemo(() => {
|
|
3570
|
+
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 }) })));
|
|
3571
|
+
}, [
|
|
3572
|
+
srcEditor,
|
|
3573
|
+
labels,
|
|
3574
|
+
options.formControl,
|
|
3575
|
+
options.imgWidth,
|
|
3576
|
+
options.imgQuality,
|
|
3577
|
+
options.disabled,
|
|
3578
|
+
onEditorValue,
|
|
3579
|
+
onCancel
|
|
3580
|
+
]);
|
|
3581
|
+
const onImageChooser = require$$0.useCallback(() => {
|
|
3582
|
+
refInput.current.click();
|
|
3583
|
+
}, []);
|
|
3584
|
+
return { RlsImageEditorChooser: component, onImageChooser };
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
function RlsImageChooser(props) {
|
|
3588
|
+
const [src, setSrc] = require$$0.useState();
|
|
3589
|
+
const onValue = require$$0.useCallback((image) => {
|
|
3590
|
+
setSrc(image.base64);
|
|
3591
|
+
props.onValue && props.onValue(image);
|
|
3592
|
+
}, [props.onValue]);
|
|
3593
|
+
const { RlsImageEditorChooser, onImageChooser } = useImageEditorController({
|
|
3594
|
+
disabled: props.disabled,
|
|
3595
|
+
formControl: props.formControl,
|
|
3596
|
+
imgQuality: props.imgQuality,
|
|
3597
|
+
imgWidth: props.imgWidth,
|
|
3598
|
+
onValue
|
|
3599
|
+
});
|
|
3600
|
+
require$$0.useEffect(() => {
|
|
3601
|
+
props.src && setSrc(props.src);
|
|
3602
|
+
}, [props.src]);
|
|
3603
|
+
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] }));
|
|
3593
3604
|
}
|
|
3594
3605
|
|
|
3595
3606
|
const DURATION_ANIMATION = 240;
|
|
@@ -3678,6 +3689,29 @@ function RlsApplication({ children }) {
|
|
|
3678
3689
|
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
3679
3690
|
}
|
|
3680
3691
|
|
|
3692
|
+
function createObserver(options) {
|
|
3693
|
+
const { setScrolleable, table } = options;
|
|
3694
|
+
const observer = new ResizeObserver(() => {
|
|
3695
|
+
const scrollHeight = table.scrollHeight || 0;
|
|
3696
|
+
const clientHeight = table.clientHeight || 0;
|
|
3697
|
+
setScrolleable(scrollHeight > clientHeight);
|
|
3698
|
+
});
|
|
3699
|
+
observer.observe(table);
|
|
3700
|
+
return observer;
|
|
3701
|
+
}
|
|
3702
|
+
function useDatatable() {
|
|
3703
|
+
const [scrolleable, setScrolleable] = require$$0.useState(false);
|
|
3704
|
+
const tableRef = require$$0.useRef(null);
|
|
3705
|
+
require$$0.useEffect(() => {
|
|
3706
|
+
const observer = tableRef?.current &&
|
|
3707
|
+
createObserver({ setScrolleable, table: tableRef?.current });
|
|
3708
|
+
return () => {
|
|
3709
|
+
observer?.disconnect();
|
|
3710
|
+
};
|
|
3711
|
+
}, []);
|
|
3712
|
+
return { scrolleable, tableRef };
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3681
3715
|
exports.ConfirmationResult = ConfirmationResult;
|
|
3682
3716
|
exports.RlsAlert = RlsAlert;
|
|
3683
3717
|
exports.RlsAmount = RlsAmount;
|
|
@@ -3760,6 +3794,7 @@ exports.useConfirmation = useConfirmation;
|
|
|
3760
3794
|
exports.useDatatable = useDatatable;
|
|
3761
3795
|
exports.useFieldAutocomplete = useFieldAutocomplete;
|
|
3762
3796
|
exports.useFieldSelect = useFieldSelect;
|
|
3797
|
+
exports.useImageEditorController = useImageEditorController;
|
|
3763
3798
|
exports.useListController = useListController;
|
|
3764
3799
|
exports.useRelocationOnComponent = useRelocationOnComponent;
|
|
3765
3800
|
exports.useResize = useResize;
|