@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/es/index.js
CHANGED
|
@@ -1393,8 +1393,18 @@ function RlsBadge({ children, rlsTheme }) {
|
|
|
1393
1393
|
return (jsxRuntimeExports.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
1396
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1397
|
+
|
|
1398
|
+
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1399
|
+
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1400
|
+
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1401
|
+
return `${minFormat} - ${maxFormat}`;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1396
1404
|
function RlsBreadcrumb({ labels }) {
|
|
1397
|
-
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:
|
|
1405
|
+
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', {
|
|
1406
|
+
actionable: !!onClick
|
|
1407
|
+
}), children: label }) }, index))) }));
|
|
1398
1408
|
}
|
|
1399
1409
|
|
|
1400
1410
|
function RlsIcon({ value, skeleton }) {
|
|
@@ -1480,7 +1490,11 @@ function RlsInputPassword({ disabled, formControl, identifier, onValue, placehol
|
|
|
1480
1490
|
}
|
|
1481
1491
|
|
|
1482
1492
|
function RlsInputSearch({ formControl, identifier, onSearch, placeholder }) {
|
|
1483
|
-
|
|
1493
|
+
const [value, setValue] = useState('');
|
|
1494
|
+
function onValueInput(value) {
|
|
1495
|
+
!formControl && setValue(value);
|
|
1496
|
+
}
|
|
1497
|
+
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 })] }));
|
|
1484
1498
|
}
|
|
1485
1499
|
|
|
1486
1500
|
function RlsInputText({ disabled, formControl, identifier, onValue, placeholder, value }) {
|
|
@@ -1500,14 +1514,6 @@ function RlsMessageIcon({ icon, children, rlsTheme }) {
|
|
|
1500
1514
|
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 })] }));
|
|
1501
1515
|
}
|
|
1502
1516
|
|
|
1503
|
-
const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
|
|
1504
|
-
|
|
1505
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
1506
|
-
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
1507
|
-
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
1508
|
-
return `${minFormat} - ${maxFormat}`;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
1517
|
function RlsPoster({ children, contrast, outline, rlsTheme }) {
|
|
1512
1518
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-poster', { contrast, outline }), "rls-theme": rlsTheme, children: children }));
|
|
1513
1519
|
}
|
|
@@ -1586,18 +1592,20 @@ function RlsMessageFormError({ className, formControl }) {
|
|
|
1586
1592
|
}
|
|
1587
1593
|
|
|
1588
1594
|
function RlsFieldMoney({ children, decimals, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, symbol, rlsTheme, value }) {
|
|
1595
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1589
1596
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1590
|
-
focused: formControl?.focused,
|
|
1597
|
+
focused: formControl?.focused && !_disabled,
|
|
1591
1598
|
error: formControl?.wrong,
|
|
1592
|
-
disabled:
|
|
1599
|
+
disabled: _disabled
|
|
1593
1600
|
}, '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 }))] }));
|
|
1594
1601
|
}
|
|
1595
1602
|
|
|
1596
1603
|
function RlsFieldNumber({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1604
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1597
1605
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1598
|
-
focused: formControl?.focused,
|
|
1606
|
+
focused: formControl?.focused && !_disabled,
|
|
1599
1607
|
error: formControl?.wrong,
|
|
1600
|
-
disabled:
|
|
1608
|
+
disabled: _disabled
|
|
1601
1609
|
}, '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 }))] }));
|
|
1602
1610
|
}
|
|
1603
1611
|
|
|
@@ -1606,18 +1614,20 @@ function RlsFieldPassword({ children, disabled, formControl, identifier, msgErro
|
|
|
1606
1614
|
function onToggleInput() {
|
|
1607
1615
|
setPassword(!password);
|
|
1608
1616
|
}
|
|
1617
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1609
1618
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus(' rls-field-box', {
|
|
1610
|
-
focused: formControl?.focused,
|
|
1619
|
+
focused: formControl?.focused && !_disabled,
|
|
1611
1620
|
error: formControl?.wrong,
|
|
1612
|
-
disabled:
|
|
1621
|
+
disabled: _disabled
|
|
1613
1622
|
}, '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 }))] }));
|
|
1614
1623
|
}
|
|
1615
1624
|
|
|
1616
1625
|
function RlsFieldText({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, rlsTheme, value }) {
|
|
1626
|
+
const _disabled = formControl?.disabled || disabled;
|
|
1617
1627
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: renderClassStatus('rls-field-box', {
|
|
1618
|
-
focused: formControl?.focused,
|
|
1628
|
+
focused: formControl?.focused && !_disabled,
|
|
1619
1629
|
error: formControl?.wrong,
|
|
1620
|
-
disabled:
|
|
1630
|
+
disabled: _disabled
|
|
1621
1631
|
}, '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 }))] }));
|
|
1622
1632
|
}
|
|
1623
1633
|
|
|
@@ -2076,7 +2086,7 @@ function useDatatable() {
|
|
|
2076
2086
|
}
|
|
2077
2087
|
|
|
2078
2088
|
function useListController(props) {
|
|
2079
|
-
const { suggestions, formControl, value } = props;
|
|
2089
|
+
const { suggestions, automatic, formControl, value } = props;
|
|
2080
2090
|
const listIsOpen = useRef(false);
|
|
2081
2091
|
const contentRef = useRef(null);
|
|
2082
2092
|
const listRef = useRef(null);
|
|
@@ -2089,7 +2099,7 @@ function useListController(props) {
|
|
|
2089
2099
|
});
|
|
2090
2100
|
const collection = useRef(new ListCollection([]));
|
|
2091
2101
|
const position = useRef(0);
|
|
2092
|
-
const
|
|
2102
|
+
const _protected = useRef();
|
|
2093
2103
|
useEffect(() => {
|
|
2094
2104
|
function onCloseSuggestions({ target }) {
|
|
2095
2105
|
!contentRef?.current?.contains(target) &&
|
|
@@ -2114,31 +2124,38 @@ function useListController(props) {
|
|
|
2114
2124
|
}, [state.modalIsVisible]);
|
|
2115
2125
|
useEffect(() => {
|
|
2116
2126
|
collection.current = new ListCollection(suggestions);
|
|
2117
|
-
refresh(collection.current, formControl?.value);
|
|
2118
|
-
}, [suggestions
|
|
2119
|
-
|
|
2127
|
+
refresh(collection.current, formControl?.value, automatic);
|
|
2128
|
+
}, [suggestions]);
|
|
2129
|
+
useEffect(() => {
|
|
2130
|
+
refresh(collection.current, formControl?.value, automatic);
|
|
2131
|
+
}, [formControl?.value]);
|
|
2132
|
+
function refresh(collection, state, automatic) {
|
|
2120
2133
|
if (!state) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2134
|
+
!refreshWithProtected(collection, automatic) &&
|
|
2135
|
+
refreshState({ value: '' });
|
|
2136
|
+
return undefined;
|
|
2124
2137
|
}
|
|
2125
2138
|
const element = collection.find(state);
|
|
2126
2139
|
if (element) {
|
|
2127
|
-
|
|
2140
|
+
_protected.current = undefined;
|
|
2128
2141
|
return refreshState({ value: element.description });
|
|
2129
2142
|
}
|
|
2130
|
-
if (!
|
|
2131
|
-
|
|
2143
|
+
if (!refreshWithProtected(collection, automatic)) {
|
|
2144
|
+
_protected.current = state;
|
|
2132
2145
|
setFormValue(value);
|
|
2133
2146
|
refreshState({ value: '' });
|
|
2134
2147
|
}
|
|
2135
2148
|
}
|
|
2136
|
-
function
|
|
2137
|
-
if (
|
|
2138
|
-
|
|
2149
|
+
function refreshWithProtected(collection, automatic) {
|
|
2150
|
+
if (automatic && collection.value[0]) {
|
|
2151
|
+
setFormValue(collection.value[0].value);
|
|
2152
|
+
return true;
|
|
2153
|
+
}
|
|
2154
|
+
if (_protected.current) {
|
|
2155
|
+
const element = collection.find(_protected.current);
|
|
2139
2156
|
if (element) {
|
|
2140
|
-
formControl?.setValue(
|
|
2141
|
-
|
|
2157
|
+
formControl?.setValue(_protected.current);
|
|
2158
|
+
_protected.current = undefined;
|
|
2142
2159
|
return true;
|
|
2143
2160
|
}
|
|
2144
2161
|
}
|
|
@@ -2192,21 +2209,12 @@ function useFieldAutocomplete(props) {
|
|
|
2192
2209
|
pattern: '',
|
|
2193
2210
|
previous: null
|
|
2194
2211
|
});
|
|
2195
|
-
const disabled = props.formControl?.disabled || props.disabled;
|
|
2196
2212
|
useEffect(() => {
|
|
2197
2213
|
refreshCoincidences(pattern, true);
|
|
2198
2214
|
}, [props.suggestions]);
|
|
2199
2215
|
useEffect(() => {
|
|
2200
2216
|
refreshCoincidences(pattern);
|
|
2201
2217
|
}, [pattern]);
|
|
2202
|
-
function onClickControl() {
|
|
2203
|
-
if (!disabled) {
|
|
2204
|
-
controller.setState({ modalIsVisible: true });
|
|
2205
|
-
setTimeout(() => {
|
|
2206
|
-
controller.inputRef?.current?.focus();
|
|
2207
|
-
}, DURATION_ANIMATION$1);
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
2218
|
function onFocusInput() {
|
|
2211
2219
|
controller.setState({ focused: true });
|
|
2212
2220
|
}
|
|
@@ -2224,10 +2232,21 @@ function useFieldAutocomplete(props) {
|
|
|
2224
2232
|
break;
|
|
2225
2233
|
}
|
|
2226
2234
|
}
|
|
2235
|
+
function onClickControl() {
|
|
2236
|
+
controller.setState({ modalIsVisible: true });
|
|
2237
|
+
setTimeout(() => {
|
|
2238
|
+
controller.inputRef?.current?.focus();
|
|
2239
|
+
}, DURATION_ANIMATION$1);
|
|
2240
|
+
}
|
|
2227
2241
|
function onClickAction() {
|
|
2228
|
-
controller.
|
|
2229
|
-
|
|
2230
|
-
|
|
2242
|
+
if (controller.value) {
|
|
2243
|
+
controller.setState({ modalIsVisible: false, value: '' });
|
|
2244
|
+
controller.setFormValue(props.value);
|
|
2245
|
+
props.onValue && props.onValue(props.value);
|
|
2246
|
+
}
|
|
2247
|
+
else {
|
|
2248
|
+
onClickControl();
|
|
2249
|
+
}
|
|
2231
2250
|
}
|
|
2232
2251
|
function onClickBackdrop() {
|
|
2233
2252
|
controller.setState({ modalIsVisible: false });
|
|
@@ -2245,15 +2264,16 @@ function useFieldAutocomplete(props) {
|
|
|
2245
2264
|
};
|
|
2246
2265
|
}
|
|
2247
2266
|
function onChange({ description, value }) {
|
|
2248
|
-
|
|
2267
|
+
const { onSelect, onValue } = props;
|
|
2268
|
+
if (onSelect) {
|
|
2249
2269
|
controller.setState({ modalIsVisible: false });
|
|
2250
|
-
value &&
|
|
2270
|
+
value && onSelect(value);
|
|
2251
2271
|
}
|
|
2252
2272
|
else {
|
|
2253
2273
|
controller.setState({ modalIsVisible: false, value: description });
|
|
2254
2274
|
controller.setFormValue(value);
|
|
2255
2275
|
}
|
|
2256
|
-
|
|
2276
|
+
onValue && onValue(value);
|
|
2257
2277
|
}
|
|
2258
2278
|
function refreshCoincidences(pattern, reboot = false) {
|
|
2259
2279
|
const { collection, store } = createAutocompleteStore({
|
|
@@ -2284,21 +2304,21 @@ function useFieldAutocomplete(props) {
|
|
|
2284
2304
|
function RlsFieldAutocompleteTemplate(props) {
|
|
2285
2305
|
const autocomplete = useFieldAutocomplete(props);
|
|
2286
2306
|
const { controller } = autocomplete;
|
|
2287
|
-
const { render, children, formControl,
|
|
2288
|
-
const
|
|
2307
|
+
const { render, children, formControl, msgErrorDisabled, onSearch, placeholder, rlsTheme, searching } = props;
|
|
2308
|
+
const _disabled = formControl?.disabled || props.disabled;
|
|
2289
2309
|
const className = renderClassStatus('rls-field-box', {
|
|
2290
|
-
focused: controller.focused,
|
|
2291
|
-
disabled,
|
|
2310
|
+
focused: controller.focused && !_disabled,
|
|
2292
2311
|
error: formControl?.wrong,
|
|
2312
|
+
disabled: _disabled,
|
|
2293
2313
|
selected: !!controller.value
|
|
2294
2314
|
}, 'rls-field-list rls-field-autocomplete');
|
|
2295
|
-
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:
|
|
2315
|
+
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', {
|
|
2296
2316
|
visible: controller.modalIsVisible,
|
|
2297
2317
|
higher: controller.higher,
|
|
2298
2318
|
hide: !controller.modalIsVisible
|
|
2299
|
-
}), 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: (
|
|
2300
|
-
autocomplete.setPattern(value);
|
|
2301
|
-
}, disabled:
|
|
2319
|
+
}), 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) => {
|
|
2320
|
+
autocomplete.setPattern(event.target.value);
|
|
2321
|
+
}, disabled: _disabled || searching, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: autocomplete.onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: _disabled || searching, onClick: () => {
|
|
2302
2322
|
onSearch(autocomplete.pattern);
|
|
2303
2323
|
}, 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 })] })] }));
|
|
2304
2324
|
}
|
|
@@ -2404,7 +2424,8 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
2404
2424
|
const valueInput = value
|
|
2405
2425
|
? dateFormatTemplate(value, format || FORMAT_DATE)
|
|
2406
2426
|
: '';
|
|
2407
|
-
|
|
2427
|
+
const _disabled = formControl?.disabled || disabled;
|
|
2428
|
+
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 }) => {
|
|
2408
2429
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2409
2430
|
formControl?.touch();
|
|
2410
2431
|
setModalIsVisible(false);
|
|
@@ -2484,7 +2505,8 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
|
|
|
2484
2505
|
setValue(value);
|
|
2485
2506
|
onValue && onValue(value);
|
|
2486
2507
|
}
|
|
2487
|
-
|
|
2508
|
+
const _disabled = formControl?.disabled || disabled;
|
|
2509
|
+
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 }) => {
|
|
2488
2510
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2489
2511
|
formControl?.touch();
|
|
2490
2512
|
setModalIsVisible(false);
|
|
@@ -2538,16 +2560,17 @@ function useFieldSelect(props) {
|
|
|
2538
2560
|
};
|
|
2539
2561
|
}
|
|
2540
2562
|
function onChange({ description, value }) {
|
|
2563
|
+
const { onSelect, onValue } = props;
|
|
2541
2564
|
controller.inputRef?.current?.focus();
|
|
2542
|
-
if (
|
|
2565
|
+
if (onSelect) {
|
|
2543
2566
|
controller.setState({ modalIsVisible: false });
|
|
2544
|
-
value &&
|
|
2567
|
+
value && onSelect(value);
|
|
2545
2568
|
}
|
|
2546
2569
|
else {
|
|
2547
2570
|
controller.setFormValue(value);
|
|
2548
2571
|
controller.setState({ modalIsVisible: false, value: description });
|
|
2549
2572
|
}
|
|
2550
|
-
|
|
2573
|
+
onValue && onValue(value);
|
|
2551
2574
|
}
|
|
2552
2575
|
return {
|
|
2553
2576
|
controller,
|
|
@@ -2566,15 +2589,15 @@ function RlsFieldSelectTemplate(props) {
|
|
|
2566
2589
|
const select = useFieldSelect(props);
|
|
2567
2590
|
const { controller } = select;
|
|
2568
2591
|
const { render, suggestions, children, formControl, msgErrorDisabled, placeholder, rlsTheme } = props;
|
|
2569
|
-
const
|
|
2592
|
+
const _disabled = formControl?.disabled || props.disabled;
|
|
2570
2593
|
const className = renderClassStatus('rls-field-box', {
|
|
2571
|
-
focused: controller.focused,
|
|
2572
|
-
|
|
2573
|
-
|
|
2594
|
+
focused: controller.focused && !_disabled,
|
|
2595
|
+
error: formControl?.wrong,
|
|
2596
|
+
disabled: _disabled
|
|
2574
2597
|
}, 'rls-field-list rls-field-select');
|
|
2575
|
-
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:
|
|
2598
|
+
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', {
|
|
2576
2599
|
visible: controller.modalIsVisible
|
|
2577
|
-
}), disabled:
|
|
2600
|
+
}), 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', {
|
|
2578
2601
|
visible: controller.modalIsVisible,
|
|
2579
2602
|
higher: controller.higher,
|
|
2580
2603
|
hide: !controller.modalIsVisible
|