@rolster/react-components 18.17.3 → 18.18.1
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-CQEyyT3g.css → index-Bco_fVV_.css} +1 -1
- package/dist/cjs/index.js +91 -68
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-CQEyyT3g.css → index-Bco_fVV_.css} +1 -1
- package/dist/es/index.js +91 -68
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.css +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js +4 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.js +6 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.js.map +1 -1
- package/dist/esm/components/definitions.d.ts +1 -3
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +3 -2
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -1
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +3 -2
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -1
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js +3 -2
- package/dist/esm/components/molecules/FieldPassword/FieldPassword.js.map +1 -1
- package/dist/esm/components/molecules/FieldText/FieldText.js +3 -2
- package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +8 -8
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.d.ts +1 -0
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +18 -15
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +2 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +2 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.d.ts +1 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +6 -6
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.d.ts +1 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +4 -3
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/controllers/ListController.d.ts +1 -0
- package/dist/esm/controllers/ListController.js +23 -16
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1395,8 +1395,18 @@ function RlsBadge({ children, rlsTheme }) {
|
|
|
1395
1395
|
return (jsxRuntimeExports.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1399
|
+
|
|
1400
|
+
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1401
|
+
const minFormat = dates.dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1402
|
+
const maxFormat = dates.dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1403
|
+
return `${minFormat} - ${maxFormat}`;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1398
1406
|
function RlsBreadcrumb({ labels }) {
|
|
1399
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsxRuntimeExports.jsx("a", { className:
|
|
1407
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsxRuntimeExports.jsx("a", { className: renderClassStatus('rls-breadcrumb__label__a', {
|
|
1408
|
+
actionable: !!onClick
|
|
1409
|
+
}), children: label }) }, index))) }));
|
|
1400
1410
|
}
|
|
1401
1411
|
|
|
1402
1412
|
function RlsIcon({ value, skeleton }) {
|
|
@@ -1482,7 +1492,11 @@ function RlsInputPassword({ disabled, formControl, identifier, onValue, placehol
|
|
|
1482
1492
|
}
|
|
1483
1493
|
|
|
1484
1494
|
function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
|
|
1485
|
-
|
|
1495
|
+
const [value, setValue] = require$$0.useState('');
|
|
1496
|
+
function onValueInput(value) {
|
|
1497
|
+
!formControl && setValue(value);
|
|
1498
|
+
}
|
|
1499
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-input-search", children: [jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, placeholder: placeholder, onValue: onValueInput, children: formControl?.value ?? value }), onSearch && jsxRuntimeExports.jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
|
|
1486
1500
|
}
|
|
1487
1501
|
|
|
1488
1502
|
function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
|
|
@@ -1502,14 +1516,6 @@ function RlsMessageIcon({ icon, children, rlsTheme }) {
|
|
|
1502
1516
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-message-icon", "rls-theme": rlsTheme, children: [icon && jsxRuntimeExports.jsx(RlsIcon, { value: icon }), jsxRuntimeExports.jsx("span", { className: "truncate", children: children })] }));
|
|
1503
1517
|
}
|
|
1504
1518
|
|
|
1505
|
-
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1506
|
-
|
|
1507
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1508
|
-
const minFormat = dates.dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1509
|
-
const maxFormat = dates.dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1510
|
-
return `${minFormat} - ${maxFormat}`;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
1519
|
function RlsPoster({ children, contrast, outline, rlsTheme }) {
|
|
1514
1520
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-poster', { contrast, outline }), "rls-theme": rlsTheme, children: children }));
|
|
1515
1521
|
}
|
|
@@ -1588,18 +1594,20 @@ function RlsMessageFormError({ className, formControl }) {
|
|
|
1588
1594
|
}
|
|
1589
1595
|
|
|
1590
1596
|
function RlsFieldMoney({ children, decimals, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, symbol, rlsTheme, value }) {
|
|
1597
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1591
1598
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1592
|
-
focused: formControl?.focused,
|
|
1599
|
+
focused: formControl?.focused && !_disabled,
|
|
1593
1600
|
error: formControl?.wrong,
|
|
1594
|
-
disabled:
|
|
1601
|
+
disabled: _disabled
|
|
1595
1602
|
}, 'rls-field-money'), "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.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1596
1603
|
}
|
|
1597
1604
|
|
|
1598
1605
|
function RlsFieldNumber({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1606
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1599
1607
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1600
|
-
focused: formControl?.focused,
|
|
1608
|
+
focused: formControl?.focused && !_disabled,
|
|
1601
1609
|
error: formControl?.wrong,
|
|
1602
|
-
disabled:
|
|
1610
|
+
disabled: _disabled
|
|
1603
1611
|
}, 'rls-field-number'), "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.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1604
1612
|
}
|
|
1605
1613
|
|
|
@@ -1608,18 +1616,20 @@ function RlsFieldPassword({ children, disabled, formControl, identifier, msgErro
|
|
|
1608
1616
|
function onToggleInput() {
|
|
1609
1617
|
setPassword(!password);
|
|
1610
1618
|
}
|
|
1619
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1611
1620
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus(' rls-field-box', {
|
|
1612
|
-
focused: formControl?.focused,
|
|
1621
|
+
focused: formControl?.focused && !_disabled,
|
|
1613
1622
|
error: formControl?.wrong,
|
|
1614
|
-
disabled:
|
|
1623
|
+
disabled: _disabled
|
|
1615
1624
|
}, 'rls-field-password'), "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(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1616
1625
|
}
|
|
1617
1626
|
|
|
1618
1627
|
function RlsFieldText({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1628
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1619
1629
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1620
|
-
focused: formControl?.focused,
|
|
1630
|
+
focused: formControl?.focused && !_disabled,
|
|
1621
1631
|
error: formControl?.wrong,
|
|
1622
|
-
disabled:
|
|
1632
|
+
disabled: _disabled
|
|
1623
1633
|
}, 'rls-field-text'), "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.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1624
1634
|
}
|
|
1625
1635
|
|
|
@@ -2078,7 +2088,7 @@ function useDatatable() {
|
|
|
2078
2088
|
}
|
|
2079
2089
|
|
|
2080
2090
|
function useListController(props) {
|
|
2081
|
-
const { suggestions, formControl, value } = props;
|
|
2091
|
+
const { suggestions, automatic, formControl, value } = props;
|
|
2082
2092
|
const listIsOpen = require$$0.useRef(false);
|
|
2083
2093
|
const contentRef = require$$0.useRef(null);
|
|
2084
2094
|
const listRef = require$$0.useRef(null);
|
|
@@ -2091,7 +2101,7 @@ function useListController(props) {
|
|
|
2091
2101
|
});
|
|
2092
2102
|
const collection = require$$0.useRef(new components.ListCollection([]));
|
|
2093
2103
|
const position = require$$0.useRef(0);
|
|
2094
|
-
const
|
|
2104
|
+
const _protected = require$$0.useRef();
|
|
2095
2105
|
require$$0.useEffect(() => {
|
|
2096
2106
|
function onCloseSuggestions({ target }) {
|
|
2097
2107
|
!contentRef?.current?.contains(target) &&
|
|
@@ -2116,31 +2126,38 @@ function useListController(props) {
|
|
|
2116
2126
|
}, [state.modalIsVisible]);
|
|
2117
2127
|
require$$0.useEffect(() => {
|
|
2118
2128
|
collection.current = new components.ListCollection(suggestions);
|
|
2119
|
-
refresh(collection.current, formControl?.value);
|
|
2120
|
-
}, [suggestions
|
|
2121
|
-
|
|
2129
|
+
refresh(collection.current, formControl?.value, automatic);
|
|
2130
|
+
}, [suggestions]);
|
|
2131
|
+
require$$0.useEffect(() => {
|
|
2132
|
+
refresh(collection.current, formControl?.value, automatic);
|
|
2133
|
+
}, [formControl?.value]);
|
|
2134
|
+
function refresh(collection, state, automatic) {
|
|
2122
2135
|
if (!state) {
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2136
|
+
!refreshWithProtected(collection, automatic) &&
|
|
2137
|
+
refreshState({ value: '' });
|
|
2138
|
+
return undefined;
|
|
2126
2139
|
}
|
|
2127
2140
|
const element = collection.find(state);
|
|
2128
2141
|
if (element) {
|
|
2129
|
-
|
|
2142
|
+
_protected.current = undefined;
|
|
2130
2143
|
return refreshState({ value: element.description });
|
|
2131
2144
|
}
|
|
2132
|
-
if (!
|
|
2133
|
-
|
|
2145
|
+
if (!refreshWithProtected(collection, automatic)) {
|
|
2146
|
+
_protected.current = state;
|
|
2134
2147
|
setFormValue(value);
|
|
2135
2148
|
refreshState({ value: '' });
|
|
2136
2149
|
}
|
|
2137
2150
|
}
|
|
2138
|
-
function
|
|
2139
|
-
if (
|
|
2140
|
-
|
|
2151
|
+
function refreshWithProtected(collection, automatic) {
|
|
2152
|
+
if (automatic && collection.value[0]) {
|
|
2153
|
+
setFormValue(collection.value[0].value);
|
|
2154
|
+
return true;
|
|
2155
|
+
}
|
|
2156
|
+
if (_protected.current) {
|
|
2157
|
+
const element = collection.find(_protected.current);
|
|
2141
2158
|
if (element) {
|
|
2142
|
-
formControl?.setValue(
|
|
2143
|
-
|
|
2159
|
+
formControl?.setValue(_protected.current);
|
|
2160
|
+
_protected.current = undefined;
|
|
2144
2161
|
return true;
|
|
2145
2162
|
}
|
|
2146
2163
|
}
|
|
@@ -2194,21 +2211,12 @@ function useFieldAutocomplete(props) {
|
|
|
2194
2211
|
pattern: '',
|
|
2195
2212
|
previous: null
|
|
2196
2213
|
});
|
|
2197
|
-
const disabled = props.formControl?.disabled || props.disabled;
|
|
2198
2214
|
require$$0.useEffect(() => {
|
|
2199
2215
|
refreshCoincidences(pattern, true);
|
|
2200
2216
|
}, [props.suggestions]);
|
|
2201
2217
|
require$$0.useEffect(() => {
|
|
2202
2218
|
refreshCoincidences(pattern);
|
|
2203
2219
|
}, [pattern]);
|
|
2204
|
-
function onClickControl() {
|
|
2205
|
-
if (!disabled) {
|
|
2206
|
-
controller.setState({ modalIsVisible: true });
|
|
2207
|
-
setTimeout(() => {
|
|
2208
|
-
controller.inputRef?.current?.focus();
|
|
2209
|
-
}, DURATION_ANIMATION$1);
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
2220
|
function onFocusInput() {
|
|
2213
2221
|
controller.setState({ focused: true });
|
|
2214
2222
|
}
|
|
@@ -2226,10 +2234,21 @@ function useFieldAutocomplete(props) {
|
|
|
2226
2234
|
break;
|
|
2227
2235
|
}
|
|
2228
2236
|
}
|
|
2237
|
+
function onClickControl() {
|
|
2238
|
+
controller.setState({ modalIsVisible: true });
|
|
2239
|
+
setTimeout(() => {
|
|
2240
|
+
controller.inputRef?.current?.focus();
|
|
2241
|
+
}, DURATION_ANIMATION$1);
|
|
2242
|
+
}
|
|
2229
2243
|
function onClickAction() {
|
|
2230
|
-
controller.
|
|
2231
|
-
|
|
2232
|
-
|
|
2244
|
+
if (controller.value) {
|
|
2245
|
+
controller.setState({ modalIsVisible: false, value: '' });
|
|
2246
|
+
controller.setFormValue(props.value);
|
|
2247
|
+
props.onValue && props.onValue(props.value);
|
|
2248
|
+
}
|
|
2249
|
+
else {
|
|
2250
|
+
onClickControl();
|
|
2251
|
+
}
|
|
2233
2252
|
}
|
|
2234
2253
|
function onClickBackdrop() {
|
|
2235
2254
|
controller.setState({ modalIsVisible: false });
|
|
@@ -2247,15 +2266,16 @@ function useFieldAutocomplete(props) {
|
|
|
2247
2266
|
};
|
|
2248
2267
|
}
|
|
2249
2268
|
function onChange({ description, value }) {
|
|
2250
|
-
|
|
2269
|
+
const { onSelect, onValue } = props;
|
|
2270
|
+
if (onSelect) {
|
|
2251
2271
|
controller.setState({ modalIsVisible: false });
|
|
2252
|
-
value &&
|
|
2272
|
+
value && onSelect(value);
|
|
2253
2273
|
}
|
|
2254
2274
|
else {
|
|
2255
2275
|
controller.setState({ modalIsVisible: false, value: description });
|
|
2256
2276
|
controller.setFormValue(value);
|
|
2257
2277
|
}
|
|
2258
|
-
|
|
2278
|
+
onValue && onValue(value);
|
|
2259
2279
|
}
|
|
2260
2280
|
function refreshCoincidences(pattern, reboot = false) {
|
|
2261
2281
|
const { collection, store } = components.createAutocompleteStore({
|
|
@@ -2286,21 +2306,21 @@ function useFieldAutocomplete(props) {
|
|
|
2286
2306
|
function RlsFieldAutocompleteTemplate(props) {
|
|
2287
2307
|
const autocomplete = useFieldAutocomplete(props);
|
|
2288
2308
|
const { controller } = autocomplete;
|
|
2289
|
-
const { render, children, formControl,
|
|
2290
|
-
const
|
|
2309
|
+
const { render, children, formControl, msgErrorDisabled, onSearch, placeholder, rlsTheme, searching } = props;
|
|
2310
|
+
const _disabled = formControl?.disabled || props.disabled;
|
|
2291
2311
|
const className = renderClassStatus('rls-field-box', {
|
|
2292
|
-
focused: controller.focused,
|
|
2293
|
-
disabled,
|
|
2312
|
+
focused: controller.focused && !_disabled,
|
|
2294
2313
|
error: formControl?.wrong,
|
|
2314
|
+
disabled: _disabled,
|
|
2295
2315
|
selected: !!controller.value
|
|
2296
2316
|
}, 'rls-field-list rls-field-autocomplete');
|
|
2297
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.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:
|
|
2317
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.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: controller.value, onClick: autocomplete.onClickControl }), jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: _disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: controller.value ? 'trash-2' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2298
2318
|
visible: controller.modalIsVisible,
|
|
2299
2319
|
higher: controller.higher,
|
|
2300
2320
|
hide: !controller.modalIsVisible
|
|
2301
|
-
}), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: controller.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: controller.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: autocomplete.pattern, onChange: (
|
|
2302
|
-
autocomplete.setPattern(value);
|
|
2303
|
-
}, disabled:
|
|
2321
|
+
}), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: controller.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: controller.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: autocomplete.pattern, onChange: (event) => {
|
|
2322
|
+
autocomplete.setPattern(event.target.value);
|
|
2323
|
+
}, disabled: _disabled || searching, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: autocomplete.onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: _disabled || searching, onClick: () => {
|
|
2304
2324
|
onSearch(autocomplete.pattern);
|
|
2305
2325
|
}, 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 truncate", children: reactI18n('listEmptyTitle') }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: autocomplete.onClickBackdrop })] })] }));
|
|
2306
2326
|
}
|
|
@@ -2406,7 +2426,8 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
2406
2426
|
const valueInput = value
|
|
2407
2427
|
? dates.dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2408
2428
|
: '';
|
|
2409
|
-
|
|
2429
|
+
const _disabled = formControl?.disabled || disabled;
|
|
2430
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled: _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' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: _disabled, maxDate: maxDate, minDate: minDate, onListener: ({ event, value }) => {
|
|
2410
2431
|
event !== components.PickerListenerEvent.Cancel && onChange(value);
|
|
2411
2432
|
formControl?.touch();
|
|
2412
2433
|
setModalIsVisible(false);
|
|
@@ -2486,7 +2507,8 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2486
2507
|
setValue(value);
|
|
2487
2508
|
onValue && onValue(value);
|
|
2488
2509
|
}
|
|
2489
|
-
|
|
2510
|
+
const _disabled = formControl?.disabled || disabled;
|
|
2511
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled: _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' }) })] }) }), !msgErrorDisabled && (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: ({ event, value }) => {
|
|
2490
2512
|
event !== components.PickerListenerEvent.Cancel && onChange(value);
|
|
2491
2513
|
formControl?.touch();
|
|
2492
2514
|
setModalIsVisible(false);
|
|
@@ -2540,16 +2562,17 @@ function useFieldSelect(props) {
|
|
|
2540
2562
|
};
|
|
2541
2563
|
}
|
|
2542
2564
|
function onChange({ description, value }) {
|
|
2565
|
+
const { onSelect, onValue } = props;
|
|
2543
2566
|
controller.inputRef?.current?.focus();
|
|
2544
|
-
if (
|
|
2567
|
+
if (onSelect) {
|
|
2545
2568
|
controller.setState({ modalIsVisible: false });
|
|
2546
|
-
value &&
|
|
2569
|
+
value && onSelect(value);
|
|
2547
2570
|
}
|
|
2548
2571
|
else {
|
|
2549
2572
|
controller.setFormValue(value);
|
|
2550
2573
|
controller.setState({ modalIsVisible: false, value: description });
|
|
2551
2574
|
}
|
|
2552
|
-
|
|
2575
|
+
onValue && onValue(value);
|
|
2553
2576
|
}
|
|
2554
2577
|
return {
|
|
2555
2578
|
controller,
|
|
@@ -2568,15 +2591,15 @@ function RlsFieldSelectTemplate(props) {
|
|
|
2568
2591
|
const select = useFieldSelect(props);
|
|
2569
2592
|
const { controller } = select;
|
|
2570
2593
|
const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme } = props;
|
|
2571
|
-
const
|
|
2594
|
+
const _disabled = formControl?.disabled || props.disabled;
|
|
2572
2595
|
const className = renderClassStatus('rls-field-box', {
|
|
2573
|
-
focused: controller.focused,
|
|
2574
|
-
|
|
2575
|
-
|
|
2596
|
+
focused: controller.focused && !_disabled,
|
|
2597
|
+
error: formControl?.wrong,
|
|
2598
|
+
disabled: _disabled
|
|
2576
2599
|
}, 'rls-field-list rls-field-select');
|
|
2577
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.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", { ref: controller.inputRef, className: "rls-field-list__control", readOnly: true, disabled:
|
|
2600
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: controller.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", { ref: controller.inputRef, className: "rls-field-list__control", readOnly: true, disabled: _disabled, placeholder: placeholder, value: controller.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-field-list__action', {
|
|
2578
2601
|
visible: controller.modalIsVisible
|
|
2579
|
-
}), disabled:
|
|
2602
|
+
}), disabled: _disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
|
|
2580
2603
|
visible: controller.modalIsVisible,
|
|
2581
2604
|
higher: controller.higher,
|
|
2582
2605
|
hide: !controller.modalIsVisible
|