@rolster/react-components 18.21.33 → 18.21.34
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/index.js +21 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +22 -11
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.d.ts +1 -1
- package/dist/esm/components/atoms/Input/Input.d.ts +2 -1
- package/dist/esm/components/atoms/Input/Input.js +14 -6
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.d.ts +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.d.ts +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +9 -5
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.d.ts +1 -0
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js +37 -0
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js.map +1 -0
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1542,21 +1542,28 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
|
1542
1542
|
return (jsxRuntimeExports.jsx(RlsCheckBox, { identifier: identifier, checked: !!formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
1543
1543
|
}
|
|
1544
1544
|
|
|
1545
|
-
function RlsInput({ children, disabled, formControl, identifier, onEnter, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
1545
|
+
function RlsInput({ children, decimals, disabled, formControl, identifier, onEnter, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
1546
1546
|
const valueInitial = formControl?.value ?? value ? String(value) : '';
|
|
1547
1547
|
const [valueInput, setValueInput] = require$$0.useState(valueInitial);
|
|
1548
1548
|
const [focused, setFocused] = require$$0.useState(false);
|
|
1549
|
+
const isChangeInternal = require$$0.useRef(false);
|
|
1549
1550
|
require$$0.useEffect(() => {
|
|
1550
|
-
|
|
1551
|
-
|
|
1551
|
+
if (!isChangeInternal.current) {
|
|
1552
|
+
const control = formControl?.value ? String(formControl.value) : '';
|
|
1553
|
+
valueInput !== control && setValueInput(control);
|
|
1554
|
+
}
|
|
1555
|
+
isChangeInternal.current = false;
|
|
1552
1556
|
}, [formControl?.value]);
|
|
1553
1557
|
const _onChange = require$$0.useCallback((event) => {
|
|
1554
1558
|
const valueInput = event.target.value;
|
|
1555
|
-
const value = type === 'number'
|
|
1559
|
+
const value = type === 'number'
|
|
1560
|
+
? commons.floorDecimals(+valueInput, decimals || 0)
|
|
1561
|
+
: valueInput;
|
|
1562
|
+
isChangeInternal.current = true;
|
|
1556
1563
|
onValue && onValue(value);
|
|
1557
1564
|
setValueInput(valueInput);
|
|
1558
1565
|
formControl?.setValue(value);
|
|
1559
|
-
}, [formControl, onValue]);
|
|
1566
|
+
}, [formControl, onValue, type, decimals]);
|
|
1560
1567
|
const _onKeyDown = require$$0.useCallback((event) => {
|
|
1561
1568
|
onKeyDown && onKeyDown(event);
|
|
1562
1569
|
event.key === 'Enter' && onEnter && onEnter();
|
|
@@ -2676,17 +2683,17 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2676
2683
|
});
|
|
2677
2684
|
});
|
|
2678
2685
|
}, []);
|
|
2679
|
-
const
|
|
2686
|
+
const disabled = require$$0.useMemo(() => {
|
|
2680
2687
|
return formControl?.disabled || props.disabled;
|
|
2681
2688
|
}, [formControl?.disabled, props.disabled]);
|
|
2682
2689
|
const className = require$$0.useMemo(() => {
|
|
2683
2690
|
return renderClassStatus('rls-field-box', {
|
|
2684
|
-
focused: autocomplete.focused && !
|
|
2691
|
+
focused: autocomplete.focused && !disabled,
|
|
2685
2692
|
error: formControl?.wrong,
|
|
2686
|
-
disabled
|
|
2693
|
+
disabled,
|
|
2687
2694
|
selected: !!autocomplete.value
|
|
2688
2695
|
}, 'rls-field-list rls-field-autocomplete');
|
|
2689
|
-
}, [formControl?.wrong, autocomplete.value, autocomplete.focused,
|
|
2696
|
+
}, [formControl?.wrong, autocomplete.value, autocomplete.focused, disabled]);
|
|
2690
2697
|
const classNameList = require$$0.useMemo(() => {
|
|
2691
2698
|
return renderClassStatus('rls-field-list__suggestions', {
|
|
2692
2699
|
higher: autocomplete.higher,
|
|
@@ -2699,7 +2706,11 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2699
2706
|
const onClickPattern = require$$0.useCallback(() => {
|
|
2700
2707
|
onSearch && onSearch(autocomplete.pattern);
|
|
2701
2708
|
}, [onSearch, autocomplete.pattern]);
|
|
2702
|
-
|
|
2709
|
+
const onKeyDownPattern = require$$0.useCallback((event) => {
|
|
2710
|
+
event.key === 'Enter' && onSearch && onSearch(autocomplete.pattern);
|
|
2711
|
+
autocomplete.onKeydownInput(event);
|
|
2712
|
+
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2713
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.contentRef, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameList, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: autocomplete.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: autocomplete.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: labels.listInputPlaceholder, value: autocomplete.pattern, onChange: onChangePattern, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: onKeyDownPattern, disabled: disabled || searching }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: onClickPattern, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), autocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: autocomplete.onClickElement(element), onKeyDown: autocomplete.onKeydownElement(element), children: render(element) }, index))), !autocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: autocomplete.onClickBackdrop })] })] }));
|
|
2703
2714
|
}
|
|
2704
2715
|
function RlsFieldAutocomplete(props) {
|
|
2705
2716
|
const render = require$$0.useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|