@rolster/react-components 18.21.9 → 18.21.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/index.js +51 -36
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +51 -37
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +11 -3
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +2 -2
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +2 -2
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js +2 -2
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/organisms/Datatable/Datatable.d.ts +19 -13
- package/dist/esm/components/organisms/Datatable/Datatable.js +35 -29
- package/dist/esm/components/organisms/Datatable/Datatable.js.map +1 -1
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -1538,10 +1538,18 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
|
|
1540
1540
|
function RlsInput({ children, disabled, formControl, identifier, onValue, placeholder, type, value }) {
|
|
1541
|
+
const valueInitial = formControl?.value ?? value ? String(value) : '';
|
|
1542
|
+
const [valueInput, setValueInput] = useState(valueInitial);
|
|
1541
1543
|
const [focused, setFocused] = useState(false);
|
|
1544
|
+
useEffect(() => {
|
|
1545
|
+
const valueControl = formControl?.value ? String(formControl.value) : '';
|
|
1546
|
+
(!focused || valueInput !== valueControl) && setValueInput(valueControl);
|
|
1547
|
+
}, [formControl?.value]);
|
|
1542
1548
|
const onChange = useCallback((event) => {
|
|
1543
|
-
const
|
|
1549
|
+
const valueInput = event.target.value;
|
|
1550
|
+
const value = type === 'number' ? +valueInput : valueInput;
|
|
1544
1551
|
onValue && onValue(value);
|
|
1552
|
+
setValueInput(valueInput);
|
|
1545
1553
|
formControl?.setValue(value);
|
|
1546
1554
|
}, [formControl, onValue]);
|
|
1547
1555
|
const onFocus = useCallback(() => {
|
|
@@ -1558,25 +1566,25 @@ function RlsInput({ children, disabled, formControl, identifier, onValue, placeh
|
|
|
1558
1566
|
focused: formControl?.focused ?? focused
|
|
1559
1567
|
});
|
|
1560
1568
|
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
1561
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, 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:
|
|
1569
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, 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: valueInput }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
1562
1570
|
}
|
|
1563
1571
|
|
|
1564
1572
|
function RlsInputMoney({ decimals, disabled, formControl, identifier, onValue, placeholder, symbol, value }) {
|
|
1565
|
-
const [valueInput, setValueInput] = useState(value
|
|
1573
|
+
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
1566
1574
|
const onValueInput = useCallback((value) => {
|
|
1567
1575
|
!formControl && setValueInput(value);
|
|
1568
1576
|
onValue && onValue(value);
|
|
1569
1577
|
}, [formControl, onValue]);
|
|
1570
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value:
|
|
1578
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
1571
1579
|
}
|
|
1572
1580
|
|
|
1573
1581
|
function RlsInputNumber({ disabled, formControl, identifier, onValue, placeholder, value }) {
|
|
1574
|
-
const [valueInput, setValueInput] = useState(value ?? 0);
|
|
1582
|
+
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
1575
1583
|
const onValueInput = useCallback((value) => {
|
|
1576
1584
|
!formControl && setValueInput(value);
|
|
1577
1585
|
onValue && onValue(value);
|
|
1578
1586
|
}, [formControl, onValue]);
|
|
1579
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value:
|
|
1587
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
1580
1588
|
}
|
|
1581
1589
|
|
|
1582
1590
|
function RlsInputPassword({ disabled, formControl, identifier, onValue, placeholder, type }) {
|
|
@@ -1611,12 +1619,12 @@ function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
|
|
|
1611
1619
|
}
|
|
1612
1620
|
|
|
1613
1621
|
function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
|
|
1614
|
-
const [valueInput, setValueInput] = useState(value ?? '');
|
|
1622
|
+
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? '');
|
|
1615
1623
|
const onValueInput = useCallback((value) => {
|
|
1616
1624
|
!formControl && setValueInput(value);
|
|
1617
1625
|
onValue && onValue(value);
|
|
1618
1626
|
}, [formControl, onValue]);
|
|
1619
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value:
|
|
1627
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: valueInput, disabled: disabled, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
1620
1628
|
}
|
|
1621
1629
|
|
|
1622
1630
|
function RlsLabel({ children, rlsTheme }) {
|
|
@@ -2308,52 +2316,58 @@ function useConfirmation() {
|
|
|
2308
2316
|
};
|
|
2309
2317
|
}
|
|
2310
2318
|
|
|
2319
|
+
function RlsDatatable({ children, datatable, footer, header, identifier, rlsTheme, summary, toolbar }) {
|
|
2320
|
+
const className = useMemo(() => {
|
|
2321
|
+
return renderClassStatus('rls-datatable', {
|
|
2322
|
+
scrolleable: datatable?.scrolleable
|
|
2323
|
+
});
|
|
2324
|
+
}, [datatable]);
|
|
2325
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__body", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
|
|
2326
|
+
}
|
|
2311
2327
|
function RlsDatatableHeader({ children, identifier }) {
|
|
2312
2328
|
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: "rls-datatable__header", children: children }));
|
|
2313
2329
|
}
|
|
2314
2330
|
function RlsDatatableTitle({ children, className, control, identifier }) {
|
|
2315
|
-
const
|
|
2331
|
+
const classNameTitle = useMemo(() => {
|
|
2316
2332
|
return renderClassStatus('rls-datatable__title', { control }, className);
|
|
2317
|
-
}, [
|
|
2318
|
-
return (jsxRuntimeExports.jsx("th", { id: identifier, className:
|
|
2333
|
+
}, [className, control]);
|
|
2334
|
+
return (jsxRuntimeExports.jsx("th", { id: identifier, className: classNameTitle, children: children }));
|
|
2319
2335
|
}
|
|
2320
2336
|
function RlsDatatableSubheader({ children, className, identifier }) {
|
|
2321
|
-
const
|
|
2337
|
+
const classNameSubheader = useMemo(() => {
|
|
2322
2338
|
return renderClassStatus('rls-datatable__subheader', {}, className);
|
|
2323
2339
|
}, [className]);
|
|
2324
|
-
return (jsxRuntimeExports.jsx("tr", { id: identifier, className:
|
|
2340
|
+
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameSubheader, children: children }));
|
|
2325
2341
|
}
|
|
2326
|
-
function RlsDatatableRecord({ children, className, error, identifier, info, successs, warning }) {
|
|
2327
|
-
const
|
|
2328
|
-
return renderClassStatus('rls-datatable__record', { error, info, successs, warning }, className);
|
|
2329
|
-
}, [error, info, successs, warning
|
|
2330
|
-
return (jsxRuntimeExports.jsx("tr", { id: identifier, className:
|
|
2342
|
+
function RlsDatatableRecord({ children, className, error, identifier, info, overflow, successs, warning }) {
|
|
2343
|
+
const classNameRecord = useMemo(() => {
|
|
2344
|
+
return renderClassStatus('rls-datatable__record', { error, info, overflow, successs, warning }, className);
|
|
2345
|
+
}, [className, error, info, overflow, successs, warning]);
|
|
2346
|
+
return (jsxRuntimeExports.jsx("tr", { id: identifier, className: classNameRecord, children: children }));
|
|
2331
2347
|
}
|
|
2332
|
-
function RlsDatatableTotals({ children, className, error, identifier, info, successs, warning }) {
|
|
2333
|
-
const
|
|
2334
|
-
return renderClassStatus('rls-datatable__totals', { error, info, successs, warning }, className);
|
|
2335
|
-
}, [error, info, successs, warning
|
|
2336
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className:
|
|
2348
|
+
function RlsDatatableTotals({ children, className, error, identifier, info, overflow, successs, warning }) {
|
|
2349
|
+
const classNameTotals = useMemo(() => {
|
|
2350
|
+
return renderClassStatus('rls-datatable__totals', { error, info, overflow, successs, warning }, className);
|
|
2351
|
+
}, [className, error, info, overflow, successs, warning]);
|
|
2352
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameTotals, children: children }));
|
|
2337
2353
|
}
|
|
2338
2354
|
function RlsDatatableCell({ children, className, control, identifier, overflow }) {
|
|
2339
|
-
const
|
|
2355
|
+
const classNameCell = useMemo(() => {
|
|
2340
2356
|
return renderClassStatus('rls-datatable__cell', { control, overflow }, className);
|
|
2341
|
-
}, [control, overflow
|
|
2342
|
-
return (jsxRuntimeExports.jsx("
|
|
2357
|
+
}, [className, control, overflow]);
|
|
2358
|
+
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameCell, children: children }));
|
|
2343
2359
|
}
|
|
2344
2360
|
function RlsDatatableData({ children, className, control, identifier, overflow }) {
|
|
2345
|
-
const
|
|
2361
|
+
const classNameData = useMemo(() => {
|
|
2346
2362
|
return renderClassStatus('rls-datatable__data', { control, overflow }, className);
|
|
2347
|
-
}, [
|
|
2348
|
-
return (jsxRuntimeExports.jsx("div", { id: identifier, className:
|
|
2363
|
+
}, [className, overflow, control]);
|
|
2364
|
+
return (jsxRuntimeExports.jsx("div", { id: identifier, className: classNameData, children: children }));
|
|
2349
2365
|
}
|
|
2350
|
-
function
|
|
2351
|
-
const
|
|
2352
|
-
return renderClassStatus('rls-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
}, [datatable]);
|
|
2356
|
-
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [toolbar && jsxRuntimeExports.jsx("div", { className: "rls-datatable__toolbar", children: toolbar }), jsxRuntimeExports.jsxs("table", { id: identifier, children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__head", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.tableRef, className: "rls-datatable__body", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__summary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__footer", children: footer })] }));
|
|
2366
|
+
function RlsDatatableFloating({ children, className, identifier, invested }) {
|
|
2367
|
+
const classNameFloating = useMemo(() => {
|
|
2368
|
+
return renderClassStatus('rls-datatable__floating', { invested }, className);
|
|
2369
|
+
}, [className, invested]);
|
|
2370
|
+
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, children: children }));
|
|
2357
2371
|
}
|
|
2358
2372
|
|
|
2359
2373
|
function createObserver(options) {
|
|
@@ -3109,5 +3123,5 @@ function RlsApplication({ children }) {
|
|
|
3109
3123
|
return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar, withNavbar }, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
3110
3124
|
}
|
|
3111
3125
|
|
|
3112
|
-
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useSnackbar };
|
|
3126
|
+
export { ConfirmationResult, RlsAlert, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, setErrorsI18n, useConfirmation, useDatatable, useListController, useSnackbar };
|
|
3113
3127
|
//# sourceMappingURL=index.js.map
|