@rolster/react-components 18.15.8 → 18.15.10
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 +122 -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 +122 -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 +56 -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,21 @@ 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 initializedState = require$$0.useRef(false);
|
|
2079
|
+
const initializedCollection = require$$0.useRef(false);
|
|
2080
|
+
const changeInternal = require$$0.useRef(false);
|
|
2081
|
+
const protectedValue = require$$0.useRef();
|
|
2090
2082
|
require$$0.useEffect(() => {
|
|
2091
2083
|
function onCloseSuggestions({ target }) {
|
|
2092
|
-
|
|
2084
|
+
!contentRef?.current?.contains(target) &&
|
|
2093
2085
|
setState((state) => ({ ...state, visible: false }));
|
|
2094
|
-
}
|
|
2095
2086
|
}
|
|
2096
2087
|
document.addEventListener('click', onCloseSuggestions);
|
|
2097
2088
|
return () => {
|
|
@@ -2099,26 +2090,68 @@ function useListControl({ suggestions, formControl }) {
|
|
|
2099
2090
|
};
|
|
2100
2091
|
}, []);
|
|
2101
2092
|
require$$0.useEffect(() => {
|
|
2102
|
-
const content = contentRef.current;
|
|
2103
|
-
const list = listRef.current;
|
|
2104
2093
|
formControl?.touch();
|
|
2105
2094
|
setState((state) => ({
|
|
2106
2095
|
...state,
|
|
2107
|
-
higher: components.locationListCanTop(
|
|
2096
|
+
higher: components.locationListCanTop(contentRef.current, listRef.current)
|
|
2108
2097
|
}));
|
|
2109
2098
|
}, [state.visible]);
|
|
2110
2099
|
require$$0.useEffect(() => {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
}
|
|
2100
|
+
if (!initializedState.current || !initializedCollection.current) {
|
|
2101
|
+
initializedState.current = true;
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (changeInternal.current) {
|
|
2105
|
+
changeInternal.current = false;
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
refresh(collection.current, formControl?.value);
|
|
2109
|
+
}, [formControl?.value]);
|
|
2110
|
+
require$$0.useEffect(() => {
|
|
2111
|
+
collection.current = new components.ListCollection(suggestions);
|
|
2112
|
+
if (!initializedCollection.current || !initializedState.current) {
|
|
2113
|
+
initializedCollection.current = true;
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
refresh(collection.current, formControl?.value);
|
|
2115
2117
|
}, [suggestions]);
|
|
2118
|
+
function refresh(collection, state) {
|
|
2119
|
+
if (!state) {
|
|
2120
|
+
return refreshProtected(collection) ? undefined : setValue('');
|
|
2121
|
+
}
|
|
2122
|
+
const element = collection.find(state);
|
|
2123
|
+
if (element) {
|
|
2124
|
+
return setValue(element.description);
|
|
2125
|
+
}
|
|
2126
|
+
if (!refreshProtected(collection)) {
|
|
2127
|
+
protectedValue.current = state;
|
|
2128
|
+
setValue('');
|
|
2129
|
+
setFormState(undefined);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
function refreshProtected(collection) {
|
|
2133
|
+
if (protectedValue.current) {
|
|
2134
|
+
const element = collection.find(protectedValue.current);
|
|
2135
|
+
if (element) {
|
|
2136
|
+
formControl?.setValue(protectedValue.current);
|
|
2137
|
+
protectedValue.current = undefined;
|
|
2138
|
+
return true;
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
return false;
|
|
2142
|
+
}
|
|
2116
2143
|
function setFocused(focused) {
|
|
2117
2144
|
setState((state) => ({ ...state, focused }));
|
|
2118
2145
|
}
|
|
2119
2146
|
function setValue(value) {
|
|
2120
2147
|
setState((state) => ({ ...state, value }));
|
|
2121
2148
|
}
|
|
2149
|
+
function setFormState(value) {
|
|
2150
|
+
if (formControl) {
|
|
2151
|
+
changeInternal.current = true;
|
|
2152
|
+
formControl.setValue(value);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2122
2155
|
function setVisible(visible) {
|
|
2123
2156
|
setState((state) => ({ ...state, visible }));
|
|
2124
2157
|
}
|
|
@@ -2149,6 +2182,7 @@ function useListControl({ suggestions, formControl }) {
|
|
|
2149
2182
|
navigationElement,
|
|
2150
2183
|
navigationInput,
|
|
2151
2184
|
setFocused,
|
|
2185
|
+
setFormState,
|
|
2152
2186
|
setValue,
|
|
2153
2187
|
setVisible
|
|
2154
2188
|
};
|
|
@@ -2165,51 +2199,13 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2165
2199
|
previous: null
|
|
2166
2200
|
});
|
|
2167
2201
|
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);
|
|
2202
|
+
const { inputRef, navigationElement, navigationInput, setFocused, setFormState, setValue, setVisible } = listControl;
|
|
2172
2203
|
require$$0.useEffect(() => {
|
|
2173
2204
|
refreshCoincidences(pattern, true);
|
|
2174
2205
|
}, [suggestions]);
|
|
2175
2206
|
require$$0.useEffect(() => {
|
|
2176
2207
|
refreshCoincidences(pattern);
|
|
2177
2208
|
}, [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
2209
|
function onClickControl() {
|
|
2214
2210
|
if (!disabled) {
|
|
2215
2211
|
setVisible(true);
|
|
@@ -2239,9 +2235,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2239
2235
|
setVisible(false);
|
|
2240
2236
|
setValue('');
|
|
2241
2237
|
setFormState(undefined);
|
|
2242
|
-
|
|
2243
|
-
onValue(undefined);
|
|
2244
|
-
}
|
|
2238
|
+
onValue && onValue(undefined);
|
|
2245
2239
|
}
|
|
2246
2240
|
function onClickBackdrop() {
|
|
2247
2241
|
setVisible(false);
|
|
@@ -2265,9 +2259,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
|
|
|
2265
2259
|
setFormState(value);
|
|
2266
2260
|
setValue(description);
|
|
2267
2261
|
}
|
|
2268
|
-
|
|
2269
|
-
onValue(value);
|
|
2270
|
-
}
|
|
2262
|
+
onValue && onValue(value);
|
|
2271
2263
|
}
|
|
2272
2264
|
function refreshCoincidences(pattern, reboot = false) {
|
|
2273
2265
|
const { collection, store } = components.createAutocompleteStore({
|
|
@@ -2352,19 +2344,16 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2352
2344
|
formControl?.setValue(dateCheck);
|
|
2353
2345
|
}, []);
|
|
2354
2346
|
require$$0.useEffect(() => {
|
|
2355
|
-
|
|
2347
|
+
commons.itIsDefined(yearControl.value) &&
|
|
2356
2348
|
setValue(dates.assignYearInDate(value, yearControl.value));
|
|
2357
|
-
}
|
|
2358
2349
|
}, [yearControl.value]);
|
|
2359
2350
|
require$$0.useEffect(() => {
|
|
2360
|
-
|
|
2351
|
+
commons.itIsDefined(monthControl.value) &&
|
|
2361
2352
|
setValue(dates.assignMonthInDate(value, monthControl.value));
|
|
2362
|
-
}
|
|
2363
2353
|
}, [monthControl.value]);
|
|
2364
2354
|
require$$0.useEffect(() => {
|
|
2365
|
-
|
|
2355
|
+
commons.itIsDefined(dayControl.value) &&
|
|
2366
2356
|
setValue(dates.assignDayInDate(value, dayControl.value));
|
|
2367
|
-
}
|
|
2368
2357
|
}, [dayControl.value]);
|
|
2369
2358
|
function onVisibilityDay() {
|
|
2370
2359
|
setVisibility('DAY');
|
|
@@ -2376,24 +2365,18 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2376
2365
|
setVisibility('YEAR');
|
|
2377
2366
|
}
|
|
2378
2367
|
function onCancel() {
|
|
2379
|
-
|
|
2380
|
-
onListener({ type: components.PickerListenerType.Cancel });
|
|
2381
|
-
}
|
|
2368
|
+
onListener && onListener({ type: components.PickerListenerType.Cancel });
|
|
2382
2369
|
}
|
|
2383
2370
|
function onToday() {
|
|
2384
2371
|
yearControl.setValue(today.getFullYear());
|
|
2385
2372
|
dayControl.setValue(today.getDate());
|
|
2386
2373
|
monthControl.setValue(today.getMonth());
|
|
2387
2374
|
formControl?.setValue(today);
|
|
2388
|
-
|
|
2389
|
-
onListener({ type: components.PickerListenerType.Now, value: today });
|
|
2390
|
-
}
|
|
2375
|
+
onListener && onListener({ type: components.PickerListenerType.Now, value: today });
|
|
2391
2376
|
}
|
|
2392
2377
|
function onSelect() {
|
|
2393
2378
|
formControl?.setValue(value);
|
|
2394
|
-
|
|
2395
|
-
onListener({ type: components.PickerListenerType.Select, value });
|
|
2396
|
-
}
|
|
2379
|
+
onListener && onListener({ type: components.PickerListenerType.Select, value });
|
|
2397
2380
|
}
|
|
2398
2381
|
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
2382
|
day: visibility === 'DAY',
|
|
@@ -2418,9 +2401,7 @@ function RlsFieldDate({ children, date, disabled, formControl, format, maxDate,
|
|
|
2418
2401
|
}, []);
|
|
2419
2402
|
function onChange(value) {
|
|
2420
2403
|
setValue(value);
|
|
2421
|
-
|
|
2422
|
-
onValue(value);
|
|
2423
|
-
}
|
|
2404
|
+
onValue && onValue(value);
|
|
2424
2405
|
}
|
|
2425
2406
|
function onClickInput() {
|
|
2426
2407
|
setModalIsVisible(true);
|
|
@@ -2439,9 +2420,7 @@ function RlsFieldDate({ children, date, disabled, formControl, format, maxDate,
|
|
|
2439
2420
|
? dates.dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2440
2421
|
: '';
|
|
2441
2422
|
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
|
-
}
|
|
2423
|
+
type !== components.PickerListenerType.Cancel && onChange(value);
|
|
2445
2424
|
formControl?.touch();
|
|
2446
2425
|
setModalIsVisible(false);
|
|
2447
2426
|
} }) })] }));
|
|
@@ -2471,9 +2450,7 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2471
2450
|
});
|
|
2472
2451
|
}, [monthControl.value]);
|
|
2473
2452
|
require$$0.useEffect(() => {
|
|
2474
|
-
|
|
2475
|
-
setValue(dayControl.value);
|
|
2476
|
-
}
|
|
2453
|
+
dayControl.value && setValue(dayControl.value);
|
|
2477
2454
|
setVisibility('DAY');
|
|
2478
2455
|
}, [dayControl.value]);
|
|
2479
2456
|
function onVisibilityDay() {
|
|
@@ -2486,15 +2463,11 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2486
2463
|
setVisibility('YEAR');
|
|
2487
2464
|
}
|
|
2488
2465
|
function onCancel() {
|
|
2489
|
-
|
|
2490
|
-
onListener({ type: components.PickerListenerType.Cancel });
|
|
2491
|
-
}
|
|
2466
|
+
onListener && onListener({ type: components.PickerListenerType.Cancel });
|
|
2492
2467
|
}
|
|
2493
2468
|
function onSelect() {
|
|
2494
2469
|
formControl?.setValue(value);
|
|
2495
|
-
|
|
2496
|
-
onListener({ type: components.PickerListenerType.Select, value });
|
|
2497
|
-
}
|
|
2470
|
+
onListener && onListener({ type: components.PickerListenerType.Select, value });
|
|
2498
2471
|
}
|
|
2499
2472
|
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
2473
|
day: visibility === 'DAY',
|
|
@@ -2523,54 +2496,14 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2523
2496
|
}
|
|
2524
2497
|
}
|
|
2525
2498
|
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
|
-
}
|
|
2499
|
+
value && setValue(value);
|
|
2529
2500
|
setModalIsVisible(false);
|
|
2530
2501
|
} }) })] }));
|
|
2531
2502
|
}
|
|
2532
2503
|
|
|
2533
2504
|
function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
2534
2505
|
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
|
-
}
|
|
2506
|
+
const { inputRef, visible, navigationElement, navigationInput, setFocused, setFormState, setValue, setVisible } = listControl;
|
|
2574
2507
|
function onFocusInput() {
|
|
2575
2508
|
setFocused(true);
|
|
2576
2509
|
}
|
|
@@ -2597,9 +2530,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2597
2530
|
}
|
|
2598
2531
|
function onClickAction() {
|
|
2599
2532
|
setVisible(!visible);
|
|
2600
|
-
|
|
2601
|
-
inputRef?.current?.focus();
|
|
2602
|
-
}
|
|
2533
|
+
!visible && inputRef?.current?.focus();
|
|
2603
2534
|
}
|
|
2604
2535
|
function onClickBackdrop() {
|
|
2605
2536
|
setVisible(false);
|
|
@@ -2624,9 +2555,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
|
|
|
2624
2555
|
setFormState(value);
|
|
2625
2556
|
setValue(description);
|
|
2626
2557
|
}
|
|
2627
|
-
|
|
2628
|
-
onValue(value);
|
|
2629
|
-
}
|
|
2558
|
+
onValue && onValue(value);
|
|
2630
2559
|
}
|
|
2631
2560
|
return {
|
|
2632
2561
|
listControl,
|