@rolster/react-components 18.15.8 → 18.15.11
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-6EQEC0IJ.css → index-l02yDX9t.css} +1 -1
- package/dist/cjs/index.js +112 -193
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-6EQEC0IJ.css → index-l02yDX9t.css} +1 -1
- package/dist/es/index.js +112 -193
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +7 -9
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +3 -7
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +4 -8
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +3 -5
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js +3 -7
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +8 -8
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.d.ts +4 -4
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +1 -3
- package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +1 -3
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +5 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +5 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js +2 -4
- package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +6 -4
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.css +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/FieldAutocomplete/FieldAutocomplete.js +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.d.ts +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js +3 -45
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +2 -6
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +1 -3
- 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/FieldSelectHook.js +3 -46
- package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +7 -16
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +4 -10
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/hooks/ListControlHook.d.ts +4 -4
- package/dist/esm/hooks/ListControlHook.js +46 -10
- package/dist/esm/hooks/ListControlHook.js.map +1 -1
- package/dist/esm/i18n.d.ts +1 -2
- package/dist/esm/i18n.js +1 -2
- package/dist/esm/i18n.js.map +1 -1
- package/package.json +1 -1
|
@@ -1700,7 +1700,7 @@
|
|
|
1700
1700
|
}
|
|
1701
1701
|
.rls-confirmation__subtitle {
|
|
1702
1702
|
text-align: center;
|
|
1703
|
-
color: var(--rls-theme-color-
|
|
1703
|
+
color: var(--rls-theme-color-400);
|
|
1704
1704
|
font-weight: var(--rls-font-weight-bold);
|
|
1705
1705
|
font-size: var(--pvt-subtitle-font-size);
|
|
1706
1706
|
line-height: var(--pvt-subtitle-line-height);
|
package/dist/cjs/index.js
CHANGED
|
@@ -1420,14 +1420,12 @@ function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
|
|
|
1420
1420
|
|
|
1421
1421
|
function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
|
|
1422
1422
|
const [focused, setFocused] = require$$0.useState(false);
|
|
1423
|
-
function onChange(event) {
|
|
1424
|
-
setValue(type === 'number' ? +event.target.value : event.target.value);
|
|
1425
|
-
}
|
|
1426
1423
|
function setValue(value) {
|
|
1427
1424
|
formControl?.setValue(value);
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1425
|
+
onValue && onValue(value);
|
|
1426
|
+
}
|
|
1427
|
+
function onChange(event) {
|
|
1428
|
+
setValue(type === 'number' ? +event.target.value : event.target.value);
|
|
1431
1429
|
}
|
|
1432
1430
|
function onFocus() {
|
|
1433
1431
|
formControl?.focus();
|
|
@@ -1438,44 +1436,34 @@ function RlsInput({ children, disabled, formControl, placeholder, type, value, o
|
|
|
1438
1436
|
setFocused(false);
|
|
1439
1437
|
}
|
|
1440
1438
|
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-input', {
|
|
1441
|
-
focused: formControl?.focused
|
|
1442
|
-
disabled: formControl?.disabled
|
|
1443
|
-
}), children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type
|
|
1439
|
+
focused: formControl?.focused ?? focused,
|
|
1440
|
+
disabled: formControl?.disabled ?? disabled
|
|
1441
|
+
}), children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type ?? 'text', placeholder: placeholder, disabled: formControl?.disabled ?? disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.value ?? value ?? '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
1444
1442
|
}
|
|
1445
1443
|
|
|
1446
1444
|
function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, value, onValue }) {
|
|
1447
1445
|
const [valueInput, setValueInput] = require$$0.useState(value || 0);
|
|
1448
1446
|
function onChange(value) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}
|
|
1452
|
-
if (onValue) {
|
|
1453
|
-
onValue(value);
|
|
1454
|
-
}
|
|
1447
|
+
!formControl && setValueInput(value);
|
|
1448
|
+
onValue && onValue(value);
|
|
1455
1449
|
}
|
|
1456
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value
|
|
1450
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
1457
1451
|
}
|
|
1458
1452
|
|
|
1459
1453
|
function RlsInputNumber({ disabled, formControl, placeholder, value, onValue }) {
|
|
1460
|
-
const [valueInput, setValueInput] = require$$0.useState(value
|
|
1454
|
+
const [valueInput, setValueInput] = require$$0.useState(value ?? 0);
|
|
1461
1455
|
function onChange(value) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
}
|
|
1465
|
-
if (onValue) {
|
|
1466
|
-
onValue(value);
|
|
1467
|
-
}
|
|
1456
|
+
!formControl && setValueInput(value);
|
|
1457
|
+
onValue && onValue(value);
|
|
1468
1458
|
}
|
|
1469
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value
|
|
1459
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value ?? value ?? valueInput }) }));
|
|
1470
1460
|
}
|
|
1471
1461
|
|
|
1472
1462
|
function RlsInputPassword({ disabled, formControl, placeholder, type, onValue }) {
|
|
1473
1463
|
const [focused, setFocused] = require$$0.useState(false);
|
|
1474
1464
|
function onChange(event) {
|
|
1475
1465
|
formControl?.setValue(event.target.value);
|
|
1476
|
-
|
|
1477
|
-
onValue(event.target.value);
|
|
1478
|
-
}
|
|
1466
|
+
onValue && onValue(event.target.value);
|
|
1479
1467
|
}
|
|
1480
1468
|
function onFocus() {
|
|
1481
1469
|
formControl?.focus();
|
|
@@ -1486,9 +1474,9 @@ function RlsInputPassword({ disabled, formControl, placeholder, type, onValue })
|
|
|
1486
1474
|
setFocused(false);
|
|
1487
1475
|
}
|
|
1488
1476
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-input-password', {
|
|
1489
|
-
focused: formControl?.focused
|
|
1477
|
+
focused: formControl?.focused ?? focused,
|
|
1490
1478
|
disabled
|
|
1491
|
-
}), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type
|
|
1479
|
+
}), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type ?? 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
1492
1480
|
}
|
|
1493
1481
|
|
|
1494
1482
|
function RlsInputSearch({ formControl, placeholder, onSearch }) {
|
|
@@ -1498,14 +1486,10 @@ function RlsInputSearch({ formControl, placeholder, onSearch }) {
|
|
|
1498
1486
|
function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
|
|
1499
1487
|
const [valueInput, setValueInput] = require$$0.useState(value || '');
|
|
1500
1488
|
function onChange(value) {
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1504
|
-
if (onValue) {
|
|
1505
|
-
onValue(value);
|
|
1506
|
-
}
|
|
1489
|
+
!formControl && setValueInput(value);
|
|
1490
|
+
onValue && onValue(value);
|
|
1507
1491
|
}
|
|
1508
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value
|
|
1492
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value ?? value ?? valueInput }) }));
|
|
1509
1493
|
}
|
|
1510
1494
|
|
|
1511
1495
|
function RlsLabel({ children, rlsTheme }) {
|
|
@@ -1564,9 +1548,7 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1564
1548
|
const [visible, setVisible] = require$$0.useState(false);
|
|
1565
1549
|
require$$0.useEffect(() => {
|
|
1566
1550
|
function onCloseMenu({ target }) {
|
|
1567
|
-
|
|
1568
|
-
setVisible(false);
|
|
1569
|
-
}
|
|
1551
|
+
!componentRef?.current?.contains(target) && setVisible(false);
|
|
1570
1552
|
}
|
|
1571
1553
|
document.addEventListener('click', onCloseMenu);
|
|
1572
1554
|
return () => {
|
|
@@ -1579,14 +1561,16 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1579
1561
|
function onSelectAction(action) {
|
|
1580
1562
|
setAction(action);
|
|
1581
1563
|
setVisible(false);
|
|
1582
|
-
|
|
1583
|
-
onAction(action.value);
|
|
1584
|
-
}
|
|
1564
|
+
automatic && onAction(action.value);
|
|
1585
1565
|
}
|
|
1586
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () =>
|
|
1566
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => {
|
|
1567
|
+
onAction(action.value);
|
|
1568
|
+
}, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
|
|
1587
1569
|
visible,
|
|
1588
1570
|
hide: !visible
|
|
1589
|
-
}), children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () =>
|
|
1571
|
+
}), children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => {
|
|
1572
|
+
onSelectAction(action);
|
|
1573
|
+
}, children: action.label }, index))) }) })] }));
|
|
1590
1574
|
}
|
|
1591
1575
|
|
|
1592
1576
|
function RlsMessageFormError({ className, formControl }) {
|
|
@@ -1654,9 +1638,7 @@ function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsThe
|
|
|
1654
1638
|
setChecked(formControl?.value === value);
|
|
1655
1639
|
}, [formControl?.value]);
|
|
1656
1640
|
function onSelect() {
|
|
1657
|
-
|
|
1658
|
-
formControl?.setValue(value);
|
|
1659
|
-
}
|
|
1641
|
+
formControl && formControl?.setValue(value);
|
|
1660
1642
|
}
|
|
1661
1643
|
return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
|
|
1662
1644
|
disabled,
|
|
@@ -1767,9 +1749,7 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
|
|
|
1767
1749
|
}
|
|
1768
1750
|
function onChange(value) {
|
|
1769
1751
|
setDayValue(value);
|
|
1770
|
-
|
|
1771
|
-
onValue(value);
|
|
1772
|
-
}
|
|
1752
|
+
onValue && onValue(value);
|
|
1773
1753
|
}
|
|
1774
1754
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: dates.DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day__element', {
|
|
1775
1755
|
disabled: disabled || disabledPicker,
|
|
@@ -1811,7 +1791,11 @@ function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDat
|
|
|
1811
1791
|
forbidden,
|
|
1812
1792
|
ranged,
|
|
1813
1793
|
source
|
|
1814
|
-
}), onClick: value && !disabledPicker
|
|
1794
|
+
}), onClick: value && !disabledPicker
|
|
1795
|
+
? () => {
|
|
1796
|
+
onChange(value);
|
|
1797
|
+
}
|
|
1798
|
+
: undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
|
|
1815
1799
|
}
|
|
1816
1800
|
|
|
1817
1801
|
function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
|
|
@@ -1851,7 +1835,11 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
|
|
|
1851
1835
|
disabled: disabled || disabledPicker,
|
|
1852
1836
|
focused,
|
|
1853
1837
|
selected
|
|
1854
|
-
}), onClick: !(disabled || disabledPicker)
|
|
1838
|
+
}), onClick: !(disabled || disabledPicker)
|
|
1839
|
+
? () => {
|
|
1840
|
+
onChange(value);
|
|
1841
|
+
}
|
|
1842
|
+
: undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
|
|
1855
1843
|
}
|
|
1856
1844
|
|
|
1857
1845
|
function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
|
|
@@ -1874,9 +1862,8 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
|
|
|
1874
1862
|
}
|
|
1875
1863
|
}
|
|
1876
1864
|
function onPreviousYear() {
|
|
1877
|
-
|
|
1865
|
+
commons.itIsDefined(yearControl.value) &&
|
|
1878
1866
|
yearControl.setValue(yearControl.value - 1);
|
|
1879
|
-
}
|
|
1880
1867
|
}
|
|
1881
1868
|
function onPrevious() {
|
|
1882
1869
|
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
@@ -1893,9 +1880,8 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
|
|
|
1893
1880
|
}
|
|
1894
1881
|
}
|
|
1895
1882
|
function onNextYear() {
|
|
1896
|
-
|
|
1883
|
+
commons.itIsDefined(yearControl.value) &&
|
|
1897
1884
|
yearControl.setValue(yearControl.value + 1);
|
|
1898
|
-
}
|
|
1899
1885
|
}
|
|
1900
1886
|
function onNext() {
|
|
1901
1887
|
type === 'month' ? onNextMonth() : onNextYear();
|
|
@@ -1941,15 +1927,17 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
|
|
|
1941
1927
|
}
|
|
1942
1928
|
function onChange(value) {
|
|
1943
1929
|
setYearValue(value);
|
|
1944
|
-
|
|
1945
|
-
onValue(value);
|
|
1946
|
-
}
|
|
1930
|
+
onValue && onValue(value);
|
|
1947
1931
|
}
|
|
1948
1932
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxRuntimeExports.jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-year__year', {
|
|
1949
1933
|
disabled: disabled || disabledPicker,
|
|
1950
1934
|
focused,
|
|
1951
1935
|
selected
|
|
1952
|
-
}), onClick: value && !disabledPicker
|
|
1936
|
+
}), onClick: value && !disabledPicker
|
|
1937
|
+
? () => {
|
|
1938
|
+
onChange(value);
|
|
1939
|
+
}
|
|
1940
|
+
: undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
|
|
1953
1941
|
}
|
|
1954
1942
|
|
|
1955
1943
|
function RlsToolbar({ actions, children, subtitle }) {
|
|
@@ -2080,18 +2068,19 @@ function useListControl({ suggestions, formControl }) {
|
|
|
2080
2068
|
const listRef = require$$0.useRef(null);
|
|
2081
2069
|
const inputRef = require$$0.useRef(null);
|
|
2082
2070
|
const [state, setState] = require$$0.useState({
|
|
2083
|
-
collection: new components.ListCollection([]),
|
|
2084
2071
|
focused: false,
|
|
2085
2072
|
higher: false,
|
|
2086
2073
|
value: '',
|
|
2087
2074
|
visible: false
|
|
2088
2075
|
});
|
|
2076
|
+
const collection = require$$0.useRef(new components.ListCollection([]));
|
|
2089
2077
|
const position = require$$0.useRef(0);
|
|
2078
|
+
const changeInternal = require$$0.useRef(false);
|
|
2079
|
+
const protectedValue = require$$0.useRef();
|
|
2090
2080
|
require$$0.useEffect(() => {
|
|
2091
2081
|
function onCloseSuggestions({ target }) {
|
|
2092
|
-
|
|
2082
|
+
!contentRef?.current?.contains(target) &&
|
|
2093
2083
|
setState((state) => ({ ...state, visible: false }));
|
|
2094
|
-
}
|
|
2095
2084
|
}
|
|
2096
2085
|
document.addEventListener('click', onCloseSuggestions);
|
|
2097
2086
|
return () => {
|
|
@@ -2099,26 +2088,60 @@ function useListControl({ suggestions, formControl }) {
|
|
|
2099
2088
|
};
|
|
2100
2089
|
}, []);
|
|
2101
2090
|
require$$0.useEffect(() => {
|
|
2102
|
-
const content = contentRef.current;
|
|
2103
|
-
const list = listRef.current;
|
|
2104
2091
|
formControl?.touch();
|
|
2105
2092
|
setState((state) => ({
|
|
2106
2093
|
...state,
|
|
2107
|
-
higher: components.locationListCanTop(
|
|
2094
|
+
higher: components.locationListCanTop(contentRef.current, listRef.current)
|
|
2108
2095
|
}));
|
|
2109
2096
|
}, [state.visible]);
|
|
2110
2097
|
require$$0.useEffect(() => {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
}
|
|
2098
|
+
if (!changeInternal.current) {
|
|
2099
|
+
changeInternal.current = false;
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
refresh(collection.current, formControl?.value);
|
|
2103
|
+
}, [formControl?.value]);
|
|
2104
|
+
require$$0.useEffect(() => {
|
|
2105
|
+
collection.current = new components.ListCollection(suggestions);
|
|
2106
|
+
refresh(collection.current, formControl?.value);
|
|
2115
2107
|
}, [suggestions]);
|
|
2108
|
+
function refresh(collection, state) {
|
|
2109
|
+
if (!state) {
|
|
2110
|
+
return refreshProtected(collection) ? undefined : setValue('');
|
|
2111
|
+
}
|
|
2112
|
+
const element = collection.find(state);
|
|
2113
|
+
if (element) {
|
|
2114
|
+
return setValue(element.description);
|
|
2115
|
+
}
|
|
2116
|
+
if (!refreshProtected(collection)) {
|
|
2117
|
+
protectedValue.current = state;
|
|
2118
|
+
setValue('');
|
|
2119
|
+
setFormState(undefined);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
function refreshProtected(collection) {
|
|
2123
|
+
if (protectedValue.current) {
|
|
2124
|
+
const element = collection.find(protectedValue.current);
|
|
2125
|
+
if (element) {
|
|
2126
|
+
formControl?.setValue(protectedValue.current);
|
|
2127
|
+
protectedValue.current = undefined;
|
|
2128
|
+
return true;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
return false;
|
|
2132
|
+
}
|
|
2116
2133
|
function setFocused(focused) {
|
|
2117
2134
|
setState((state) => ({ ...state, focused }));
|
|
2118
2135
|
}
|
|
2119
2136
|
function setValue(value) {
|
|
2120
2137
|
setState((state) => ({ ...state, value }));
|
|
2121
2138
|
}
|
|
2139
|
+
function setFormState(value) {
|
|
2140
|
+
if (formControl) {
|
|
2141
|
+
changeInternal.current = true;
|
|
2142
|
+
formControl.setValue(value);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2122
2145
|
function setVisible(visible) {
|
|
2123
2146
|
setState((state) => ({ ...state, visible }));
|
|
2124
2147
|
}
|
|
@@ -2149,6 +2172,7 @@ function useListControl({ suggestions, formControl }) {
|
|
|
2149
2172
|
navigationElement,
|
|
2150
2173
|
navigationInput,
|
|
2151
2174
|
setFocused,
|
|
2175
|
+
setFormState,
|
|
2152
2176
|
setValue,
|
|
2153
2177
|
setVisible
|
|
2154
2178
|
};
|
|
@@ -2165,51 +2189,13 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2165
2189
|
previous: null
|
|
2166
2190
|
});
|
|
2167
2191
|
const listControl = useListControl({ suggestions, formControl });
|
|
2168
|
-
const {
|
|
2169
|
-
const initializedState = require$$0.useRef(false);
|
|
2170
|
-
const initializedCollection = require$$0.useRef(false);
|
|
2171
|
-
const changeInternal = require$$0.useRef(false);
|
|
2192
|
+
const { inputRef, navigationElement, navigationInput, setFocused, setFormState, setValue, setVisible } = listControl;
|
|
2172
2193
|
require$$0.useEffect(() => {
|
|
2173
2194
|
refreshCoincidences(pattern, true);
|
|
2174
2195
|
}, [suggestions]);
|
|
2175
2196
|
require$$0.useEffect(() => {
|
|
2176
2197
|
refreshCoincidences(pattern);
|
|
2177
2198
|
}, [pattern]);
|
|
2178
|
-
require$$0.useEffect(() => {
|
|
2179
|
-
if (!initializedState.current || !initializedCollection.current) {
|
|
2180
|
-
initializedState.current = true;
|
|
2181
|
-
return;
|
|
2182
|
-
}
|
|
2183
|
-
if (changeInternal.current) {
|
|
2184
|
-
changeInternal.current = false;
|
|
2185
|
-
return;
|
|
2186
|
-
}
|
|
2187
|
-
refresh(collection, formControl?.value);
|
|
2188
|
-
}, [formControl?.value]);
|
|
2189
|
-
require$$0.useEffect(() => {
|
|
2190
|
-
if (!initializedCollection.current || !initializedState.current) {
|
|
2191
|
-
initializedCollection.current = true;
|
|
2192
|
-
return;
|
|
2193
|
-
}
|
|
2194
|
-
refresh(collection, formControl?.value);
|
|
2195
|
-
}, [collection]);
|
|
2196
|
-
function refresh(collection, state) {
|
|
2197
|
-
if (!state) {
|
|
2198
|
-
return setValue('');
|
|
2199
|
-
}
|
|
2200
|
-
const element = collection.find(state);
|
|
2201
|
-
if (element) {
|
|
2202
|
-
return setValue(element.description);
|
|
2203
|
-
}
|
|
2204
|
-
setValue('');
|
|
2205
|
-
setFormState(undefined);
|
|
2206
|
-
}
|
|
2207
|
-
function setFormState(value) {
|
|
2208
|
-
if (formControl) {
|
|
2209
|
-
changeInternal.current = true;
|
|
2210
|
-
formControl.setValue(value);
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
2199
|
function onClickControl() {
|
|
2214
2200
|
if (!disabled) {
|
|
2215
2201
|
setVisible(true);
|
|
@@ -2239,9 +2225,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2239
2225
|
setVisible(false);
|
|
2240
2226
|
setValue('');
|
|
2241
2227
|
setFormState(undefined);
|
|
2242
|
-
|
|
2243
|
-
onValue(undefined);
|
|
2244
|
-
}
|
|
2228
|
+
onValue && onValue(undefined);
|
|
2245
2229
|
}
|
|
2246
2230
|
function onClickBackdrop() {
|
|
2247
2231
|
setVisible(false);
|
|
@@ -2265,9 +2249,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2265
2249
|
setFormState(value);
|
|
2266
2250
|
setValue(description);
|
|
2267
2251
|
}
|
|
2268
|
-
|
|
2269
|
-
onValue(value);
|
|
2270
|
-
}
|
|
2252
|
+
onValue && onValue(value);
|
|
2271
2253
|
}
|
|
2272
2254
|
function refreshCoincidences(pattern, reboot = false) {
|
|
2273
2255
|
const { collection, store } = components.createAutocompleteStore({
|
|
@@ -2352,19 +2334,16 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2352
2334
|
formControl?.setValue(dateCheck);
|
|
2353
2335
|
}, []);
|
|
2354
2336
|
require$$0.useEffect(() => {
|
|
2355
|
-
|
|
2337
|
+
commons.itIsDefined(yearControl.value) &&
|
|
2356
2338
|
setValue(dates.assignYearInDate(value, yearControl.value));
|
|
2357
|
-
}
|
|
2358
2339
|
}, [yearControl.value]);
|
|
2359
2340
|
require$$0.useEffect(() => {
|
|
2360
|
-
|
|
2341
|
+
commons.itIsDefined(monthControl.value) &&
|
|
2361
2342
|
setValue(dates.assignMonthInDate(value, monthControl.value));
|
|
2362
|
-
}
|
|
2363
2343
|
}, [monthControl.value]);
|
|
2364
2344
|
require$$0.useEffect(() => {
|
|
2365
|
-
|
|
2345
|
+
commons.itIsDefined(dayControl.value) &&
|
|
2366
2346
|
setValue(dates.assignDayInDate(value, dayControl.value));
|
|
2367
|
-
}
|
|
2368
2347
|
}, [dayControl.value]);
|
|
2369
2348
|
function onVisibilityDay() {
|
|
2370
2349
|
setVisibility('DAY');
|
|
@@ -2376,24 +2355,18 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2376
2355
|
setVisibility('YEAR');
|
|
2377
2356
|
}
|
|
2378
2357
|
function onCancel() {
|
|
2379
|
-
|
|
2380
|
-
onListener({ type: components.PickerListenerType.Cancel });
|
|
2381
|
-
}
|
|
2358
|
+
onListener && onListener({ type: components.PickerListenerType.Cancel });
|
|
2382
2359
|
}
|
|
2383
2360
|
function onToday() {
|
|
2384
2361
|
yearControl.setValue(today.getFullYear());
|
|
2385
2362
|
dayControl.setValue(today.getDate());
|
|
2386
2363
|
monthControl.setValue(today.getMonth());
|
|
2387
2364
|
formControl?.setValue(today);
|
|
2388
|
-
|
|
2389
|
-
onListener({ type: components.PickerListenerType.Now, value: today });
|
|
2390
|
-
}
|
|
2365
|
+
onListener && onListener({ type: components.PickerListenerType.Now, value: today });
|
|
2391
2366
|
}
|
|
2392
2367
|
function onSelect() {
|
|
2393
2368
|
formControl?.setValue(value);
|
|
2394
|
-
|
|
2395
|
-
onListener({ type: components.PickerListenerType.Select, value });
|
|
2396
|
-
}
|
|
2369
|
+
onListener && onListener({ type: components.PickerListenerType.Select, value });
|
|
2397
2370
|
}
|
|
2398
2371
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: dates.dateFormatTemplate(dateInitial, FORMAT_TITLE) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
|
|
2399
2372
|
day: visibility === 'DAY',
|
|
@@ -2418,9 +2391,7 @@ function RlsFieldDate({ children, date, disabled, formControl, format, maxDate,
|
|
|
2418
2391
|
}, []);
|
|
2419
2392
|
function onChange(value) {
|
|
2420
2393
|
setValue(value);
|
|
2421
|
-
|
|
2422
|
-
onValue(value);
|
|
2423
|
-
}
|
|
2394
|
+
onValue && onValue(value);
|
|
2424
2395
|
}
|
|
2425
2396
|
function onClickInput() {
|
|
2426
2397
|
setModalIsVisible(true);
|
|
@@ -2439,9 +2410,7 @@ function RlsFieldDate({ children, date, disabled, formControl, format, maxDate,
|
|
|
2439
2410
|
? dates.dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2440
2411
|
: '';
|
|
2441
2412
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), 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: ({ value, type }) => {
|
|
2442
|
-
|
|
2443
|
-
onChange(value);
|
|
2444
|
-
}
|
|
2413
|
+
type !== components.PickerListenerType.Cancel && onChange(value);
|
|
2445
2414
|
formControl?.touch();
|
|
2446
2415
|
setModalIsVisible(false);
|
|
2447
2416
|
} }) })] }));
|
|
@@ -2471,9 +2440,7 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2471
2440
|
});
|
|
2472
2441
|
}, [monthControl.value]);
|
|
2473
2442
|
require$$0.useEffect(() => {
|
|
2474
|
-
|
|
2475
|
-
setValue(dayControl.value);
|
|
2476
|
-
}
|
|
2443
|
+
dayControl.value && setValue(dayControl.value);
|
|
2477
2444
|
setVisibility('DAY');
|
|
2478
2445
|
}, [dayControl.value]);
|
|
2479
2446
|
function onVisibilityDay() {
|
|
@@ -2486,15 +2453,11 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2486
2453
|
setVisibility('YEAR');
|
|
2487
2454
|
}
|
|
2488
2455
|
function onCancel() {
|
|
2489
|
-
|
|
2490
|
-
onListener({ type: components.PickerListenerType.Cancel });
|
|
2491
|
-
}
|
|
2456
|
+
onListener && onListener({ type: components.PickerListenerType.Cancel });
|
|
2492
2457
|
}
|
|
2493
2458
|
function onSelect() {
|
|
2494
2459
|
formControl?.setValue(value);
|
|
2495
|
-
|
|
2496
|
-
onListener({ type: components.PickerListenerType.Select, value });
|
|
2497
|
-
}
|
|
2460
|
+
onListener && onListener({ type: components.PickerListenerType.Select, value });
|
|
2498
2461
|
}
|
|
2499
2462
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date-range__component', {
|
|
2500
2463
|
day: visibility === 'DAY',
|
|
@@ -2523,54 +2486,14 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2523
2486
|
}
|
|
2524
2487
|
}
|
|
2525
2488
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
|
|
2526
|
-
|
|
2527
|
-
setValue(value);
|
|
2528
|
-
}
|
|
2489
|
+
value && setValue(value);
|
|
2529
2490
|
setModalIsVisible(false);
|
|
2530
2491
|
} }) })] }));
|
|
2531
2492
|
}
|
|
2532
2493
|
|
|
2533
2494
|
function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
2534
2495
|
const listControl = useListControl({ suggestions, formControl });
|
|
2535
|
-
const {
|
|
2536
|
-
const initializedState = require$$0.useRef(false);
|
|
2537
|
-
const initializedCollection = require$$0.useRef(false);
|
|
2538
|
-
const changeInternal = require$$0.useRef(false);
|
|
2539
|
-
require$$0.useEffect(() => {
|
|
2540
|
-
if (!initializedState.current || !initializedCollection.current) {
|
|
2541
|
-
initializedState.current = true;
|
|
2542
|
-
return;
|
|
2543
|
-
}
|
|
2544
|
-
if (changeInternal.current) {
|
|
2545
|
-
changeInternal.current = false;
|
|
2546
|
-
return;
|
|
2547
|
-
}
|
|
2548
|
-
refresh(collection, formControl?.value);
|
|
2549
|
-
}, [formControl?.value]);
|
|
2550
|
-
require$$0.useEffect(() => {
|
|
2551
|
-
if (!initializedCollection.current || !initializedState.current) {
|
|
2552
|
-
initializedCollection.current = true;
|
|
2553
|
-
return;
|
|
2554
|
-
}
|
|
2555
|
-
refresh(collection, formControl?.value);
|
|
2556
|
-
}, [collection]);
|
|
2557
|
-
function refresh(collection, state) {
|
|
2558
|
-
if (!state) {
|
|
2559
|
-
return setValue('');
|
|
2560
|
-
}
|
|
2561
|
-
const element = collection.find(state);
|
|
2562
|
-
if (element) {
|
|
2563
|
-
return setValue(element.description);
|
|
2564
|
-
}
|
|
2565
|
-
setValue('');
|
|
2566
|
-
setFormState(undefined);
|
|
2567
|
-
}
|
|
2568
|
-
function setFormState(value) {
|
|
2569
|
-
if (formControl) {
|
|
2570
|
-
changeInternal.current = true;
|
|
2571
|
-
formControl.setValue(value);
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2496
|
+
const { inputRef, visible, navigationElement, navigationInput, setFocused, setFormState, setValue, setVisible } = listControl;
|
|
2574
2497
|
function onFocusInput() {
|
|
2575
2498
|
setFocused(true);
|
|
2576
2499
|
}
|
|
@@ -2597,9 +2520,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2597
2520
|
}
|
|
2598
2521
|
function onClickAction() {
|
|
2599
2522
|
setVisible(!visible);
|
|
2600
|
-
|
|
2601
|
-
inputRef?.current?.focus();
|
|
2602
|
-
}
|
|
2523
|
+
!visible && inputRef?.current?.focus();
|
|
2603
2524
|
}
|
|
2604
2525
|
function onClickBackdrop() {
|
|
2605
2526
|
setVisible(false);
|
|
@@ -2624,9 +2545,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2624
2545
|
setFormState(value);
|
|
2625
2546
|
setValue(description);
|
|
2626
2547
|
}
|
|
2627
|
-
|
|
2628
|
-
onValue(value);
|
|
2629
|
-
}
|
|
2548
|
+
onValue && onValue(value);
|
|
2630
2549
|
}
|
|
2631
2550
|
return {
|
|
2632
2551
|
listControl,
|